Skip to content

Instantly share code, notes, and snippets.

@petitchamp
Last active October 22, 2023 12:33
Show Gist options
  • Save petitchamp/757080030467e06366169a598ef51fbc to your computer and use it in GitHub Desktop.
Save petitchamp/757080030467e06366169a598ef51fbc to your computer and use it in GitHub Desktop.
tampermonkey script to filter product with best discount
// ==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