Last active
February 8, 2019 13:58
-
-
Save quanon/3173173bebd8f658001fa58ac49b39f7 to your computer and use it in GitHub Desktop.
Kindle 版「まんがで読破」シリーズの 11 円セールで、すべての書籍を読み込んだのち 11 円の書籍だけを表示する JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Kindle 版「まんがで読破」シリーズの 11 円セールで、すべての書籍を読み込んだのち 11 円の書籍だけを表示する。 | |
* 「1-Click で今すぐ買う」ボタンをクリックしても画面遷移せずに、購入後の画面が別タブで開くようにするおまけつき。 | |
* https://www.amazon.co.jp/gp/product/B07K2K2RSN?ref_=dbs_r_series&storeType=ebooks | |
*/ | |
const removeAllExcept11yen = () => { | |
Array.from(document.querySelectorAll('.a-color-price')).filter(el => el.innerText !== '¥11').forEach(el => el.closest('.series-childAsin-item').remove()); | |
}; | |
const makeSubmitButtonsOpenNewTab = () => { | |
Array.from(document.querySelectorAll('.series-childAsin-item form')).forEach(el => el.setAttribute('target', '_blank')); | |
} | |
document.querySelector('#seriesAsinListShowAll a').click(); | |
let previousCount = 0; | |
const id = setInterval(() => { | |
const currentCount = document.querySelectorAll('.series-childAsin-item').length; | |
const collapseAll = document.getElementById('seriesAsinListCollapseAll'); | |
if (previousCount === currentCount && collapseAll.style['display'] === 'inline-block') { | |
clearInterval(id); | |
removeAllExcept11yen(); | |
makeSubmitButtonsOpenNewTab(); | |
} | |
window.scrollTo(0, document.getElementById('series-common-atf').scrollHeight); | |
previousCount = currentCount; | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
セールはこちら。02/14 (木) までらしいです。
https://www.amazon.co.jp/gp/product/B07K2K2RSN?ref_=dbs_r_series&storeType=ebooks