Last active
June 17, 2025 10:07
-
-
Save qwqtoday/38f700f19f87e1389c2a701a9011bcd6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 [lichess.org] Change Bot Title to "CHEATER" | |
| // @namespace http://tampermonkey.net/ | |
| // @version 2025-06-12 | |
| // @description Efficiently replaces BOT with CHEATER using MutationObserver | |
| // @author Leung Ho Ching | |
| // @match https://lichess.org/* | |
| // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| function replaceBotText() { | |
| document.querySelectorAll('.utitle').forEach(item => { | |
| if (item.textContent.includes('BOT')) { | |
| item.textContent = item.textContent.replace("BOT", "CHEATER"); | |
| } | |
| }); | |
| } | |
| // Initial run for existing elements | |
| replaceBotText(); | |
| // Set up MutationObserver to watch for DOM changes | |
| const observer = new MutationObserver(mutations => { | |
| mutations.forEach(mutation => { | |
| if (mutation.addedNodes.length) { | |
| replaceBotText(); | |
| } | |
| }); | |
| }); | |
| observer.observe(document.body, { | |
| childList: true, | |
| subtree: true | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment