-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
24 lines (21 loc) · 1.02 KB
/
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
javascript: (function () {
function removeItemsWithoutPriceDrops() {
const lowPrice = 999999;
let anyRemoved = false;
const listItems = document.getElementsByClassName('a-spacing-none g-item-sortable');
for (const element of listItems) {
let priceDrop = element.querySelectorAll('span div div div div div div div div div div div.a-row.itemPriceDrop').length;
let coupon = element.querySelectorAll('span div div div div div div div div div div div i[id^="coupon-badge"]').length;
let dealBadge = element.querySelectorAll('span div div div div div div div div div div span.wl-deal-rich-badge').length;
let price = (priceDrop || coupon || dealBadge) ? element.querySelectorAll('span.a-offscreen')[0].innerText.replace('$', '') : 0;
if (!(priceDrop || coupon || dealBadge) || price > lowPrice) {
element.parentElement.removeChild(element);
anyRemoved = true;
}
}
if (anyRemoved) {
removeItemsWithoutPriceDrops();
}
}
removeItemsWithoutPriceDrops();
})();