initial commit
This commit is contained in:
commit
11529b1da8
42
download/ylilauta-download-media.js
Normal file
42
download/ylilauta-download-media.js
Normal file
@ -0,0 +1,42 @@
|
||||
// ==UserScript==
|
||||
// @name Download media - ylilauta.org
|
||||
// @namespace Violentmonkey Scripts
|
||||
// @match *://ylilauta.org/*
|
||||
// @version 1.0
|
||||
// ==/UserScript==
|
||||
|
||||
|
||||
function download(url) {
|
||||
fetch(url, {
|
||||
mode: "no-cors",
|
||||
})
|
||||
.then(response => response.blob())
|
||||
.then(blob => {
|
||||
let blob_url = window.URL.createObjectURL(blob)
|
||||
let a = document.createElement("a")
|
||||
a.download = url.split("/")[5]
|
||||
a.href = blob_url
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
a.remove()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function init() {
|
||||
const links = Array.from(document.getElementsByClassName("jpg")).concat(Array.from(document.getElementsByClassName("png")))
|
||||
|
||||
for (let i = 0 i < links.length ++i) {
|
||||
let url = links[i].href
|
||||
download(url)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const activate_link = document.createElement("button")
|
||||
const parent_element = document.getElementById("navbar")
|
||||
activate_link.innerText = "⮶"
|
||||
activate_link.style.fontSize = "30px"
|
||||
activate_link.onclick = () => init()
|
||||
parent_element.append(activate_link)
|
||||
|
28
visual/4chan-expand-images.js
Normal file
28
visual/4chan-expand-images.js
Normal file
@ -0,0 +1,28 @@
|
||||
// ==UserScript==
|
||||
// @name Expand all images - 4chan.org
|
||||
// @namespace Violentmonkey Scripts
|
||||
// @match *://boards.4channel.org/*
|
||||
// @match *://boards.4chan.org/*
|
||||
// @version 1.0
|
||||
// ==/UserScript==
|
||||
|
||||
|
||||
window.toggle_images = function () {
|
||||
const data = document.getElementsByClassName("fileThumb")
|
||||
|
||||
for (let i = 0; i < data.length; ++i) {
|
||||
let img_data = data[i].getElementsByTagName("img")
|
||||
if (img_data[0].className === "fileDeletedRes retina") {
|
||||
continue
|
||||
} else if (img_data.length === 1) {
|
||||
ImageExpansion.expand(img_data[0])
|
||||
} else {
|
||||
ImageExpansion.contract(img_data[1])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const parent_element = document.getElementsByClassName("navLinks desktop")[0]
|
||||
parent_element.innerHTML += " [<a href='javascript:toggle_images()'>Toggle</a>]"
|
||||
|
23
visual/4chan-hide-topics.js
Normal file
23
visual/4chan-hide-topics.js
Normal file
@ -0,0 +1,23 @@
|
||||
// ==UserScript==
|
||||
// @name Hide topics from catalog - 4chan.org
|
||||
// @namespace Violentmonkey Scripts
|
||||
// @match *://boards.4channel.org/*/catalog
|
||||
// @version 1.0
|
||||
// ==/UserScript==
|
||||
|
||||
|
||||
window.addEventListener("load", function () {
|
||||
const topics = [] // e.g. ["sdg", "dmp"]
|
||||
const data = document.getElementsByClassName("teaser")
|
||||
|
||||
for (let i = 0; i < data.length; ++i) {
|
||||
let inner_txt = data[i].innerText
|
||||
for (let j = 0; j < topics.length; ++j) {
|
||||
let topic_str = "/" + topics[j] + "/"
|
||||
if (inner_txt.includes(topic_str)) {
|
||||
data[i].offsetParent.style.display = "none"
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
29
visual/ylilauta-expand-images.js
Normal file
29
visual/ylilauta-expand-images.js
Normal file
@ -0,0 +1,29 @@
|
||||
// ==UserScript==
|
||||
// @name Expand all images - ylilauta.org
|
||||
// @namespace Violentmonkey Scripts
|
||||
// @match *://ylilauta.org/*
|
||||
// @version 1.0
|
||||
// ==/UserScript==
|
||||
|
||||
|
||||
function toggle_images() {
|
||||
const media_jpg = document.querySelectorAll("a.jpg")
|
||||
const media_png = document.querySelectorAll("a.png")
|
||||
|
||||
for (let i = 0 i < media_jpg.length ++i) {
|
||||
media_jpg[i].click()
|
||||
}
|
||||
|
||||
for (let i = 0 i < media_png.length ++i) {
|
||||
media_png[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)
|
||||
|
Loading…
Reference in New Issue
Block a user