// ==UserScript==// @name IDFilterBlur// @version 1.3// @grant none// @include https://8chan.moe/*/res/*// @include https://8chan.se/*/res/*// @run-at document-idle// @license AGPL// @description Blur images in posts by IDs with less than X posts, including new ones// @namespace https://greasyfork.org/users/1461466// ==/UserScript==//You'll only see blurred images from posts with BELOW MIN_POSTS id.constMIN_POSTS=5;constBlurStrengh=5;functiongetIDCounts(){returnArray.from(document.getElementsByClassName('labelId')).map(x=>x.innerText).filter(x=>x.length>0).reduce((acc,id)=>{acc[id]=acc[id]?acc[id]+1:1;returnacc;},{});}functionblurImagesForLowPostcountIDs(idCounts){letlowCountIDs=newSet(Object.entries(idCounts).filter(([id,count])=>count<MIN_POSTS).map(([id])=>id));for(letpostofdocument.getElementsByClassName('postCell')){letlabel=post.getElementsByClassName('labelId');if(label.length&&lowCountIDs.has(label[0].innerText)){letimages=post.querySelectorAll('img');for(letimgofimages){img.style.filter='blur(15px)';img.style.transition='filter 0.3s';// Optional, makes blur smoother}}else{letimages=post.querySelectorAll('img');for(letimgofimages){img.style.filter='';// Reset blur if ID no longer qualifies}}}}functionupdateBlurring(){constidCounts=getIDCounts();blurImagesForLowPostcountIDs(idCounts);}// Run once on loadupdateBlurring();// Watch for new postsconstthread=document.getElementById('threadList');if(thread){constobserver=newMutationObserver(mutations=>{letneedsUpdate=false;for(constmutationofmutations){for(constnodeofmutation.addedNodes){if(node.nodeType===1&&node.classList.contains('postCell')){needsUpdate=true;}}}if(needsUpdate)updateBlurring();});observer.observe(thread,{childList:true,subtree:true});}
Warning
LINK
You are about to visit a link which has been flagged with the above content warnings. Do you wish to continue?