Raw text without reaction images is sad so here's an add-on to display linked images with Tampermonkey.
// ==UserScript==
// @name Fetch images from url
// @namespace http://textboard.org
// @description Replaces links to images with the actual image
// @include *
// ==/UserScript==
(function() {
function getXPath(p, context) {
var arr = new Array();
var xpr = document.evaluate(p,context,null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
var item;
for(var i = 0;item = xpr.snapshotItem(i); i++) {
arr.push(item);
}
return arr;
}
var doc = window.document;
var xpath = "//A[(contains(@href, '.jpg') or contains(@href, '.jpeg') or contains(@href, '.gif') or contains(@href, '.png'))]";
var results = getXPath(xpath, doc);
for(var i = 0; i < results.length; i++) {
var img = document.createElement("img");
var source = results[i].getAttribute("href");
img.setAttribute("src", source);
results[i].textContent = "";
results[i].appendChild(img);
}
}
)();
Test:
https://kaiyodo.co.jp/danboard/img/yr007/01.png
It could be improved to position the image on the top left corner, generate clickable thumbnails and display multiple images the way 2ch.hk does it.
https://pics.me.me/thumb_ai-23-yoba-png-cliparts-for-free-download-uihere-51537963.png
http://vignette.wikia.nocookie.net/azumanga/images/9/92/Yotsuba.%21.full.48845.jpg
It doesn't work with https links.
>>1
That's hotlinking.
It would be better to extend the SchemeBBS markup to support images. Maybe something like sent's syntax
@https://domain.tld/path/to/image.png
?
>>1,6
I'm not fond of the idea of adding images. Hotlinking is not cool and at worst with text, if you live the thing running you may get hate speech. CP is in a whole different league.
>>1
I may had your userscript anyway if you'd just fix the https links and limit image sizes to something sensible. Maybe throw some CSS in there. Userscripts are good, that's the way users should improve their browsing experience. Thanks for caring to write it.
add*
+1