styling to follow conventions better

This commit is contained in:
17ms 2023-02-16 22:19:01 +02:00
parent 90de671cba
commit b7d83f5add
3 changed files with 19 additions and 19 deletions

View File

@ -6,14 +6,14 @@
// @version 1.0
// ==/UserScript==
window.addEventListener("load", function () {
window.addEventListener("load", () => {
const keywords = [] // e.g. ["/sdg/", "luke smith"]
const data = document.getElementsByClassName("teaser")
for (let i = 0; i < data.length; ++i) {
let inner_txt = data[i].innerText
let innerText = data[i].innerText
for (let j = 0; j < keywords.length; ++j) {
if (inner_txt.includes(keywords[j]) && data[i].offsetParent !== null) {
if (innerText.includes(keywords[j]) && data[i].offsetParent !== null) {
data[i].offsetParent.style.display = "none"
}
}

View File

@ -6,7 +6,7 @@
// @version 1.0
// ==/UserScript==
window.toggle_images = function () {
window.toggleImgs = () => {
const data = document.getElementsByClassName("fileThumb")
for (let i = 0; i < data.length; ++i) {
@ -21,5 +21,5 @@ window.toggle_images = function () {
}
}
const parent_element = document.getElementsByClassName("navLinks desktop")[0]
parent_element.innerHTML += " [<a href='javascript:toggle_images()'>Toggle</a>]"
const parentElem = document.getElementsByClassName("navLinks desktop")[0]
parentElem.innerHTML += " [<a href='javascript:toggleImgs()'>Toggle</a>]"

View File

@ -5,22 +5,22 @@
// @version 1.0
// ==/UserScript==
function toggle_images() {
const media_jpg = document.querySelectorAll("a.jpg")
const media_png = document.querySelectorAll("a.png")
const toggleImages = () => {
const mediaJpg = document.querySelectorAll("a.jpg")
const mediaPng = document.querySelectorAll("a.png")
for (let i = 0; i < media_jpg.length; ++i) {
media_jpg[i].click()
for (let i = 0; i < mediaJpg.length; ++i) {
mediaJpg[i].click()
}
for (let i = 0; i < media_png.length; ++i) {
media_png[i].click()
for (let i = 0; i < mediaPng.length; ++i) {
mediaPng[i].click()
}
}
const activate_link = document.createElement("button")
const parent_element = document.getElementById("navbar")
activate_link.innerText = "Toggle"
activate_link.style.fontSize = "9px"
activate_link.onclick = () => toggle_images()
parent_element.append(activate_link)
const activateLink = document.createElement("button")
const parentElem = document.getElementById("navbar")
activateLink.innerText = "Toggle"
activateLink.style.fontSize = "9px"
activateLink.onclick = () => toggleImages()
parentElem.append(activateLink)