Skip to content

Instantly share code, notes, and snippets.

@verrev
Last active February 27, 2020 12:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save verrev/88f3ed5607780b6d496df7a5d1cf504a to your computer and use it in GitHub Desktop.
Save verrev/88f3ed5607780b6d496df7a5d1cf504a to your computer and use it in GitHub Desktop.
praad.ee poverty filter | put this in the link part of a boomark and click the bookmark on praad.ee
javascript:(() =>{
s = document.createElement("script");
s.type = "text/javascript";
s.innerHTML = `(maxPrice =>
[...document.getElementsByClassName("meal")].forEach(offer => {
const foods = document.evaluate(
"div[2]/div/div[2]",
offer,
null,
XPathResult.FIRST_ORDERED_NODE_TYPE,
null
).singleNodeValue;
const matches = foods.innerHTML.matchAll(">([0-9]+,[0-9]+)€");
let someUP = false;
for (match of matches) {
const price = Number.parseFloat(match[1].replace(",", "."));
if (price <= maxPrice) {
someUP = true;
break;
}
}
if (!someUP) {
offer.setAttribute("style", "display: none");
}
}))(window.prompt("Enter max price of meal"));`;
document.body.appendChild(s);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment