userscripts/visual/ylilauta-expand-images.js

27 lines
761 B
JavaScript
Raw Normal View History

2022-10-25 19:39:14 +02:00
// ==UserScript==
// @name Expand all images - ylilauta.org
// @namespace Violentmonkey Scripts
// @match *://ylilauta.org/*
// @version 1.0
// ==/UserScript==
function toggle_images() {
2022-12-09 02:42:45 +01:00
const media_jpg = document.querySelectorAll("a.jpg")
const media_png = document.querySelectorAll("a.png")
2022-10-25 19:39:14 +02:00
2022-12-09 02:42:45 +01:00
for (let i = 0; i < media_jpg.length; ++i) {
media_jpg[i].click()
}
2022-10-25 19:39:14 +02:00
2022-12-09 02:42:45 +01:00
for (let i = 0; i < media_png.length; ++i) {
media_png[i].click()
}
2022-10-25 19:39:14 +02:00
}
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)