Skip to content

Instantly share code, notes, and snippets.

@mie00
Last active April 29, 2018 06:57
Show Gist options
  • Save mie00/f10d6ff3731775264b34c4400e7042ba to your computer and use it in GitHub Desktop.
Save mie00/f10d6ff3731775264b34c4400e7042ba to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name random_order
// @namespace elmenus
// @description randomise order
// @include https://www.elmenus.com/*
// @version 1
// @grant none
// @authors Mohamed Elawadi <mohamed@elawadi.net>
// ==/UserScript==
(function() {
var mie;
function randomize() {
var x = document.querySelectorAll('.category-items,.card')
window.mie && (mie.style.border = 'black solid 0');
mie = x[Math.floor(x.length * Math.random())];
mie.scrollIntoView({block: "center", behavior: "smooth"})
mie.style.border = 'cyan solid 3px'
}
document.body.innerHTML += '<div style="z-index:1200;position:fixed;top:0; right:0;" onclick="randomize()"><i class="icon icon-add"></i></div>'
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment