Skip to content

Instantly share code, notes, and snippets.

@Gmousse
Created September 20, 2018 08:50
Show Gist options
  • Save Gmousse/c1aecfd014319918af372492c878c927 to your computer and use it in GitHub Desktop.
Save Gmousse/c1aecfd014319918af372492c878c927 to your computer and use it in GitHub Desktop.
Pick a random restaurant on the Deliveroo current page
/**
* 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