Created
September 20, 2018 08:50
-
-
Save Gmousse/c1aecfd014319918af372492c878c927 to your computer and use it in GitHub Desktop.
Pick a random restaurant on the Deliveroo current page
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
/** | |
* Open a random restaurant page from the current deliveroo page. | |
*/ | |
function pickARestaurant() { | |
const restaurants = Array.from(document.getElementsByTagName('a')).filter(x => x.children[0] && x.children[0].className.includes("RestaurantCard")).map(x => x.href); | |
window.open(restaurants[Math.round(Math.random() * restaurants.length)]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment