Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save reallytiredofclowns/9814f42f17830194e1c9f3616b7c7ebd to your computer and use it in GitHub Desktop.
Save reallytiredofclowns/9814f42f17830194e1c9f3616b7c7ebd to your computer and use it in GitHub Desktop.
Auto expand subscriptions menu on discuit.net
// ==UserScript==
// @name discuit-expand-subscriptions
// @namespace discuit-aw-userscripts
// @version 2024-02-10
// @description Autoexpand discuit.net sidebar subscription menu.
// @author AuralWanderer
// @match https://discuit.net/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=discuit.net
// @grant none
// ==/UserScript==
var expandInterval = setInterval(
function () {
const patText = /show\s*\d+\s*more/i;
var expandButton = document.querySelectorAll("div.sidebar-item.with-image span");
for (var i = 0; i < expandButton.length; i++) {
if (expandButton.length) {
if (expandButton[i].textContent.search(patText) > -1) {
expandButton[i].click();
clearInterval(expandInterval);
break;
}
}
}
},
1000
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment