Last active
May 7, 2020 13:12
-
-
Save mrbusche/2b1e86ee6cdc588d0d50c8fa525492b7 to your computer and use it in GitHub Desktop.
filter amazon wishlist to price drops only
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
// old version | |
javascript: (function () {function removeItemsWithoutPriceDrops(){let e=!1;const t=document.getElementsByClassName("a-spacing-none g-item-sortable");for(var r=0;r<t.length;r++){var o=t[r].querySelectorAll(".itemPriceDrop"),n=t[r].querySelectorAll("span.a-offscreen");n=n.length?(n=n[0].innerHTML).replace("$",""):0,(0==o.length||n>999999)&&(t[r].parentElement.removeChild(t[r]),e=!0)}e&&removeItemsWithoutPriceDrops()}removeItemsWithoutPriceDrops();})(); | |
// new version | |
javascript: (function() { function removeItemsWithoutPriceDrops() { const lowPrice = 999999; let anyRemoved = false; const listItems = document.getElementsByClassName( "a-spacing-none g-item-sortable" ); for (var i = 0; i < listItems.length; i++) { let priceDrop = listItems[i] .querySelectorAll("span.a-size-small.a-color-tertiary")[1] .innerText.startsWith("Price dropped"); let price = priceDrop ? listItems[i].querySelectorAll("span.a-offscreen") : 0; if (!priceDrop || price > lowPrice) { listItems[i].parentElement.removeChild(listItems[i]); anyRemoved = true; } } if (anyRemoved) { removeItemsWithoutPriceDrops(); } } removeItemsWithoutPriceDrops();})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment