Skip to content

Instantly share code, notes, and snippets.

@mrbusche
Last active May 7, 2020 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrbusche/2b1e86ee6cdc588d0d50c8fa525492b7 to your computer and use it in GitHub Desktop.
Save mrbusche/2b1e86ee6cdc588d0d50c8fa525492b7 to your computer and use it in GitHub Desktop.
filter amazon wishlist to price drops only
// 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