Last active
January 23, 2020 02:50
-
-
Save nayyarv/02f515c9a5e388a5ac3ff85e9f419223 to your computer and use it in GitHub Desktop.
Filter Deliveroo Restaurants
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 DeliverooBlacklist | |
// @version 1 | |
// @grant none | |
// @include https://deliveroo.com.au/restaurants/* | |
// ==/UserScript== | |
var blacklist = ["Guzman Y Gomez", "KFC", "McDonald's", "Nando's", "Gong Cha", "Subway" ]; | |
console.log("Running DeliverooBlacklist") | |
var boxes = document.querySelectorAll("a[class^='HomeFeedUICard']"); | |
for (i = 0; i < boxes.length; ++i){ | |
var box = boxes[i]; | |
var indic = false; | |
for (j = 0; j < blacklist.length; ++j) { | |
var black = blacklist[j]; | |
if (box.getAttribute("aria-label").match(black)) { | |
indic = true; | |
console.log("DeliverooBlacklist: Blocking: ",box.getAttribute("aria-label")) | |
break; | |
} | |
} | |
if (indic) { | |
var p = box.parentNode; | |
while(p.nodeName != "LI"){ | |
p = p.parentNode; | |
} | |
p.setAttribute("style", "display:none;"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment