Last active
February 15, 2023 06:25
-
-
Save digiwombat/3325e64be77e95e9cee2de64cae2dacc to your computer and use it in GitHub Desktop.
Hider for potatoes.
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 Potato Hider | |
// @description Hides them numbers. | |
// @version 0.6 | |
// @match https://www.twitch.tv/videos* | |
// @match https://www.twitch.tv/*/videos* | |
// @match https://www.twitch.tv/directory/following/videos* | |
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.3/jquery.min.js | |
// @grant none | |
// ==/UserScript== | |
var handledElements = []; | |
const intervalId = setInterval(replaceAllText, 300); | |
var matcher = new RegExp('[0-9][0-9][0-9]?', 'g'); | |
function replaceAllText() { | |
replaceText('h2'); | |
replaceText('h3'); | |
document.title = document.title.replace(matcher, '???'); | |
} | |
function replaceText(selector) { | |
$(selector).each(function () { | |
var $this = $(this); | |
if(!handledElements.includes($this)) | |
{ | |
if (!$this.children().length) | |
{ | |
$this.text($this.text().replace(matcher, '???')); | |
handledElements.push($this); | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment