-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.js
29 lines (25 loc) · 1023 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
javascript: (function () {
function removeItemsWithoutPriceDrops() {
const lowPrice = 999999;
const listItems = document.querySelectorAll('[data-itemid]');
const listItemsArray = Array.from(listItems);
for (const element of listItemsArray) {
const item = element.querySelector('[id^="itemMain"]');
if (item) {
const hasPriceDrop = item.querySelector(".itemPriceDrop") !== null;
const hasCoupon = item.querySelector('[id^="coupon-badge"]') !== null;
const hasDealBadge = item.querySelector(".wl-deal-rich-badge") !== null;
if (hasPriceDrop || hasCoupon || hasDealBadge) {
const priceText = element.querySelector("span.a-offscreen").innerText;
const price = parseFloat(priceText.replace("$", ""));
if (price > lowPrice) {
element.parentElement.removeChild(element);
}
} else {
element.parentElement.removeChild(element);
}
}
}
}
removeItemsWithoutPriceDrops();
})();