Skip to content

Instantly share code, notes, and snippets.

@ManicJamie
Last active July 26, 2023 23:43
Show Gist options
  • Save ManicJamie/1ef1d11b1296ac9f7d32d0a14a8a40f6 to your computer and use it in GitHub Desktop.
Save ManicJamie/1ef1d11b1296ac9f7d32d0a14a8a40f6 to your computer and use it in GitHub Desktop.
srcHideLevelSidebar
// ==UserScript==
// @name Remove level in sidebar for HK
// @namespace Violentmonkey Scripts
// @match https://www.speedrun.com/*
// @grant none
// @version 1.0
// @author -
// @description HK only has 1 level category - remove this name from the sidebar
// ==/UserScript==
const regexes = ["https:\/\/www.speedrun.com\/hollowknight*",
"https:\/\/www.speedrun.com\/hkmemes*",
"https:\/\/www.speedrun.com\/hkmods*"]
function matchesGames() {
for (var i = 0; i < regexes.length; i++) {
if (document.URL.match(regexes[i]) != null) {
return true;
}
}
return false;
}
const callback = (mutationList, observer) => {
if (!matchesGames()) { return; }
var elements = document.getElementsByClassName("line-clamp-2 text-sm font-semibold text-panel-link");
for (i = 0; i < elements.length; i++) {
if (elements[i].innerHTML == "<span><span>Level</span></span>") {
elements[i].remove();
}
}
}
const observer = new MutationObserver(callback);
observer.observe(document.body, { attributes: true, childList: true, subtree: true });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment