start modularisation and breaking down the monofile

This commit is contained in:
Alphons Joseph
2025-03-12 21:45:23 +08:00
parent 3c65e6d6c5
commit c9f0f9cf16
25 changed files with 2284 additions and 2192 deletions
@@ -0,0 +1,13 @@
export function disableNotificationCollector() {
var alertdiv = document.getElementsByClassName(
"notifications__bubble___1EkSQ",
)[0]
if (typeof alertdiv != "undefined") {
var currentNumber = parseInt(alertdiv.textContent!)
if (currentNumber < 9) {
alertdiv.textContent = currentNumber.toString()
} else {
alertdiv.textContent = "9+"
}
}
}
@@ -0,0 +1,10 @@
export function RemoveBackground() {
var bk = document.getElementsByClassName("bg")
var bk2 = document.getElementsByClassName("bg2")
var bk3 = document.getElementsByClassName("bg3")
if (bk.length == 0 || bk2.length == 0 || bk3.length == 0) return
bk[0].remove()
bk2[0].remove()
bk3[0].remove()
}
@@ -0,0 +1,24 @@
export function RemoveShortcutDiv(elements: any) {
if (elements.length === 0) return
elements.forEach((element: any) => {
const shortcuts = document.querySelectorAll(".shortcut")
shortcuts.forEach((shortcut) => {
const anchorElement = shortcut.parentElement // the <a> element is the parent
const textElement = shortcut.querySelector("p") // <p> is a direct child of .shortcut
const title = textElement ? textElement.textContent : ""
let shouldRemove = title === element.name
// Check href only if element.url exists
if (element.url) {
shouldRemove =
shouldRemove && anchorElement!.getAttribute("href") === element.url
}
if (shouldRemove) {
anchorElement!.remove()
}
})
})
}