mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 11:44:40 +00:00
start modularisation and breaking down the monofile
This commit is contained in:
@@ -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()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user