Anonymous ID: 4cb1e5 April 3, 2019, 1:17 p.m. No.6035487   🗄️.is 🔗kun   >>5505 >>5544

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 thread poster

  • fix loading .jpeg images from previous breads

 

pic related

 

// —————– BEGIN SCRIPT

 

// UserScript

// @name qresearch tweaks by jsanon

// @version 7709

// @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.classList.add('poster_id_op');

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

Anonymous ID: 4cb1e5 April 3, 2019, 1:25 p.m. No.6035606   🗄️.is 🔗kun

>>6035581

right, renaming the file from .jpeg to .jpg is the other way to fix this for your own posts

 

not everyone will do this though, so I'm sittin here comfy with everything working right