Last active
October 22, 2023 12:33
-
-
Save petitchamp/757080030467e06366169a598ef51fbc to your computer and use it in GitHub Desktop.
tampermonkey script to filter product with best discount
This file contains 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
// ==UserScript== | |
// @name Best secret highlighter | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author petitchamp | |
// @match https://www.bestsecret.fr/*category.htm* | |
// @match https://www.bestsecret.fr/search.htm* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=bestsecret.fr | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const discountThreshold = 50; | |
const orderSelect = document.querySelector('#sortBy'); | |
if(orderSelect) | |
{ | |
} | |
const savingList = document.querySelectorAll('.t-savings'); | |
savingList.forEach(saving=>{ | |
const discountStr = saving.textContent.slice(1,3); | |
const discount = parseInt(discountStr); | |
if(discount<discountThreshold) | |
{ | |
saving.offsetParent.offsetParent.parentNode.remove(); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment