Skip to content

Instantly share code, notes, and snippets.

@mikhailsdv
Created April 25, 2022 10:00
Show Gist options
  • Save mikhailsdv/76f2026de783f259f64b430ef8df9978 to your computer and use it in GitHub Desktop.
Save mikhailsdv/76f2026de783f259f64b430ef8df9978 to your computer and use it in GitHub Desktop.
Hack Random for castlots.org
// ==UserScript==
// @name Hack Random for castlots.org
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://castlots.org/generator-sluchajnyh-chisel/
// @icon https://www.google.com/s2/favicons?sz=64&domain=castlots.org
// @grant none
// ==/UserScript==
(function() {
'use strict';
const numbers = [11, 12, 13, 14, 15];
const el = document.querySelector(".number2");
let i = 0;
const observer = new MutationObserver(() => {
el.childNodes[1].replaceData(0, 99, numbers[i++] || Math.round(Math.random() * 100))
});
observer.observe(el, {attributes: true, childList: true, subtree: true});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment