Last active
March 17, 2024 06:12
-
-
Save NoPlagiarism/1eb53fc26bd2bb35e24cd571f7cf114c to your computer and use it in GitHub Desktop.
Usersctipt to hide ScuffedUno room code from screen
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
// ==UserScript== | |
// @name Hide Scuffed UNO code | |
// @namespace http://tampermonkey.net/ | |
// @version 0.0.3 | |
// @description Hides code from room in scuffeduno.online. Works only on lobby load (do not change code or open it's editor), also do not change window size (not working on mobile) | |
// @author NoPlagiarism | |
// @match https://scuffeduno.online/menu/room | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// @downloadURL https://gist.githubusercontent.com/NoPlagiarism/1eb53fc26bd2bb35e24cd571f7cf114c/raw/Hide_ScuffedUNO_Code.user.js | |
// @updateURL https://gist.githubusercontent.com/NoPlagiarism/1eb53fc26bd2bb35e24cd571f7cf114c/raw/Hide_ScuffedUNO_Code.user.js | |
// @grant none | |
// ==/UserScript== | |
function waitForElm(selector) { | |
// https://stackoverflow.com/questions/5525071/how-to-wait-until-an-element-exists | |
return new Promise(resolve => { | |
if (document.querySelector(selector)) { | |
return resolve(document.querySelector(selector)); | |
} | |
const observer = new MutationObserver(mutations => { | |
if (document.querySelector(selector)) { | |
observer.disconnect(); | |
resolve(document.querySelector(selector)); | |
} | |
}); | |
// If you get "parameter 1 is not of type 'Node'" error, see https://stackoverflow.com/a/77855838/492336 | |
observer.observe(document.body, { | |
childList: true, | |
subtree: true | |
}); | |
}); | |
} | |
function change(elem) { | |
'use strict'; | |
elem.innerHTML = 'Room code: ##CENSORED##'; | |
}; | |
waitForElm('.mt-16 > .text-2xl').then(change); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment