Guest User

Amazon Wishlist Promotions Bookmarklet

a guest
Mar 11th, 2025
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript:(function(){ function Book(title, price) { this.title = title; this.price = price; } var arr = []; var items = document.querySelectorAll("div[id*='itemInfo']"); for (let item of items) { const title = item.querySelector("h2 > a,h3 > a,h5 > a").innerHTML; let price = item.querySelector("[id*='itemPrice'] > .a-offscreen"); if (price) { price = price.innerText.replace("$", "").replace("%C2%A3", ""); price = parseFloat(price); arr.push(new Book(title, price)); } } arr.sort((a, b) => { if (a.price < b.price) return -1; if (a.price > b.price) return 1; return 0; }); var stringBuilder = ""; for (item of arr) { stringBuilder += item.price + " -> " + item.title; } console.log(stringBuilder); var items = document.querySelectorAll(".a-section.g-item-sortable"); if (items.length == 0) { items = document.querySelectorAll("li[data-price]"); } for (let item of items) { const drop = item.querySelector(".itemPriceDrop,[id^='itemPriceDrop'],.wl-deal-rich-badge"); if (!drop) item.outerHTML=""; } })();
Advertisement
Add Comment
Please, Sign In to add comment