Made violentmonkey script that adds previews for /img/ links right into the page. Turning textboard into imageboard. I need to figure out how to turn imageboards into textboards next, I know that I can just disable images completely, but that also disables captcha.
// ==UserScript==
// @name 4-ch.net image previews
// @namespace Violentmonkey Scripts
// @match https://4-ch.net/*
// @grant none
// @version 1.0
// @author -
// @description Adds image previews for /img/ links.
// ==/UserScript==
function load_html(evt) {
var iterthis = document.getElementsByTagName("a")
if (!iterthis) return
for (var i = 0; i < iterthis.length; i++) {
var a = iterthis[i]
if (a.href.startsWith("https://4-ch.net/img/src/")) {
var filename = a.href.substring("https://4-ch.net/img/src/".length)
var index = filename.lastIndexOf(".")
filename = filename.substring(0, index)
//alert(filename)
var img = document.createElement("img")
img.src = "https://4-ch.net/img/thumb/" + filename + "s.jpg"
var br = document.createElement("br")
var nexta = document.createElement("a")
nexta.href = a.href
nexta.rel = "noreferrer noopener nofollow"
nexta.target = "_blank"
add_after(a, br)
add_after(a, nexta)
nexta.appendChild(img)
add_after(a, br)
i+=1 //skipping over "a" we just created
}
}
}
function add_after(referenceNode, newNode) {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling)
}
window.addEventListener('DOMContentLoaded', load_html, false)
Made greasemonkey script to make browsing 5ch slightly less annoying. I suspect that the old style redirect exists mostly to show ads.
// ==UserScript==
// @name 5ch.net less annoying links
// @namespace Violentmonkey Scripts
// @match https://*.5ch.net/*
// @grant none
// @version 1.0
// @author -
// @description Make links slightly less annoying to open
// @run-at document-start
// ==/UserScript==
//https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/noreferrer
//https://www.reliablesoft.net/noreferrer-noopener/
//<a href="somelink" rel="noreferrer noopener" target="_blank">
function load_html(evt) {
var iterthis = document.getElementsByTagName("a")
if (!iterthis) return
for (var i = 0; i < iterthis.length; i++) {
var a = iterthis[i]
//alert(a.href)
if (a.href.startsWith("http://jump.5ch.net/?")) {
a.href = a.href.substring("http://jump.5ch.net/?".length)
} else if (a.href.startsWith("https://jump.5ch.net/?")) {
a.href = "http://" + a.href.substring("https://jump.5ch.net/?".length)
}
}
}
window.addEventListener('DOMContentLoaded', load_html, false)
Hm, to get a thumbnail for https://i.imgur.com/gTIU1UVh.jpg , you replace the last h with t
https://i.imgur.com/gTIU1UVt.jpg
imgur thumbnail
https://webapps.stackexchange.com/questions/16103/is-it-possible-to-find-the-thumbnail-of-an-existing-imgur-image
Guys, http or https? Imgur supports both. Https is encrypted, so it's harder for middleman to read what you are reading. But because it is encrypted, online caching doesn't work anymore. For mails and other such matters encryption is a must, but for funny images it probably isn't that necessary?