Skip to content

Instantly share code, notes, and snippets.

@digiwombat
Last active February 15, 2023 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digiwombat/3325e64be77e95e9cee2de64cae2dacc to your computer and use it in GitHub Desktop.
Save digiwombat/3325e64be77e95e9cee2de64cae2dacc to your computer and use it in GitHub Desktop.
Hider for potatoes.
// ==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