styling to follow conventions better
This commit is contained in:
parent
90de671cba
commit
b7d83f5add
@ -6,14 +6,14 @@
|
|||||||
// @version 1.0
|
// @version 1.0
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
window.addEventListener("load", function () {
|
window.addEventListener("load", () => {
|
||||||
const keywords = [] // e.g. ["/sdg/", "luke smith"]
|
const keywords = [] // e.g. ["/sdg/", "luke smith"]
|
||||||
const data = document.getElementsByClassName("teaser")
|
const data = document.getElementsByClassName("teaser")
|
||||||
|
|
||||||
for (let i = 0; i < data.length; ++i) {
|
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) {
|
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"
|
data[i].offsetParent.style.display = "none"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// @version 1.0
|
// @version 1.0
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
window.toggle_images = function () {
|
window.toggleImgs = () => {
|
||||||
const data = document.getElementsByClassName("fileThumb")
|
const data = document.getElementsByClassName("fileThumb")
|
||||||
|
|
||||||
for (let i = 0; i < data.length; ++i) {
|
for (let i = 0; i < data.length; ++i) {
|
||||||
@ -21,5 +21,5 @@ window.toggle_images = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const parent_element = document.getElementsByClassName("navLinks desktop")[0]
|
const parentElem = document.getElementsByClassName("navLinks desktop")[0]
|
||||||
parent_element.innerHTML += " [<a href='javascript:toggle_images()'>Toggle</a>]"
|
parentElem.innerHTML += " [<a href='javascript:toggleImgs()'>Toggle</a>]"
|
||||||
|
@ -5,22 +5,22 @@
|
|||||||
// @version 1.0
|
// @version 1.0
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
function toggle_images() {
|
const toggleImages = () => {
|
||||||
const media_jpg = document.querySelectorAll("a.jpg")
|
const mediaJpg = document.querySelectorAll("a.jpg")
|
||||||
const media_png = document.querySelectorAll("a.png")
|
const mediaPng = document.querySelectorAll("a.png")
|
||||||
|
|
||||||
for (let i = 0; i < media_jpg.length; ++i) {
|
for (let i = 0; i < mediaJpg.length; ++i) {
|
||||||
media_jpg[i].click()
|
mediaJpg[i].click()
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < media_png.length; ++i) {
|
for (let i = 0; i < mediaPng.length; ++i) {
|
||||||
media_png[i].click()
|
mediaPng[i].click()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const activate_link = document.createElement("button")
|
const activateLink = document.createElement("button")
|
||||||
const parent_element = document.getElementById("navbar")
|
const parentElem = document.getElementById("navbar")
|
||||||
activate_link.innerText = "Toggle"
|
activateLink.innerText = "Toggle"
|
||||||
activate_link.style.fontSize = "9px"
|
activateLink.style.fontSize = "9px"
|
||||||
activate_link.onclick = () => toggle_images()
|
activateLink.onclick = () => toggleImages()
|
||||||
parent_element.append(activate_link)
|
parentElem.append(activateLink)
|
||||||
|
Loading…
Reference in New Issue
Block a user