>>5958613 pb
>Please use PNGs or JPGs (not JPEGS) for images
/* jsanon here
this post contains a userscript for Greasemonkey, Tampermonkey, etc that makes some improvements to the breads
more info about userscripts and how to install them: https://github.com/OpenUserJs/OpenUserJS.org/wiki/Userscript-Beginners-HOWTO
features so far:
> highlight all lb/pb links in yellow
> show (OP) in the post header for all replies by the original poster
> fix loading .jpeg images from previous breads: workaround for >>5958613
< pic related */
// —————– BEGIN SCRIPT
// UserScript
// @name qresearch tweaks by jsanon
// @version 7733
// @grant none
// @include https://8ch.net/qresearch/*
// /UserScript
(function() {
/**
-
Helper functions
*/
function addStyle(css) {
var style = document.createElement('style');
style.innerHTML = css;
document.querySelector('head').appendChild(style);
}
/**
-
Highlight lb/pb links in yellow
*/
var opPostIDMatch = window.location.href.match(/\/(\d+).html/);
if (!opPostIDMatch) {
// Not on an individual thread page; stop here.
return;
}
var opPostID = opPostIDMatch[1];
addStyle(`
a[href^="/qresearch/res/"]:not([href^="/qresearch/res/${opPostID}.html"]) {
background: #ffb;
}
`);
/**
-
Add "(OP)" to OP user ID
*/
var opPosterID = document.querySelector('.post.op .poster_id').innerText.trim();
function highlightPostsByOPUser() {
Array.from(document.querySelectorAll('span.poster_id:not(.poster_id_checked)'))
.forEach(el ={
var posterID = el.innerText.trim();
if (posterID === opPosterID) {
el.style.fontWeight = 'bold';
el.parentNode.insertBefore(document.createTextNode(' (OP)'), el.nextSibling);
}
el.classList.add('poster_id_checked');
});
}
highlightPostsByOPUser();
setInterval(highlightPostsByOPUser, 2000);
/**
-
Fix loading .jpeg images from previous breads
*/
function fixJpegImages() {
Array.from(document.querySelectorAll('div.post.post-hover'))
.forEach(el ={
var arrFileInfoName = el.querySelectorAll('p.fileinfo a:not(.hide-image-link)');
var arrImg = el.querySelectorAll('img');
for (var i = 0; i < arrFileInfoName.length; i++) {
var fileInfoName = arrFileInfoName[i].innerText;
var img = arrImg[i];
if (/.jpeg\s*$/.test(fileInfoName) &&
img && /.jpg$/.test(img.src)) {
img.src = img.src.replace(/.jpg$/, '.jpeg');
}
}
});
}
setInterval(fixJpegImages, 1000);
})();
// —————– END SCRIPT