Created
February 17, 2024 16:11
-
-
Save reallytiredofclowns/9814f42f17830194e1c9f3616b7c7ebd to your computer and use it in GitHub Desktop.
Auto expand subscriptions menu on discuit.net
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 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