NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name RandomGOGGames // @description Select random game from page of your library on GOG.com // @author Eugene Pershin // @match *://*.gog.com/account* // @match *://*.gog.com//account* // @license MIT // @version 0.2 // ==/UserScript== (function () { window.onload = () => { var button = document.createElement('div'); button.className = "btn btn--green btn-add-to-cart"; button.innerText = "Случайная игра"; button.onclick = function () { var elements = document.getElementsByClassName('product-state-holder'); elements[getRandomInt(0, elements.length) - 1].click(); }; document.getElementsByClassName('collection-header')[0].before(button); }; function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } }(window));