Last active
December 30, 2023 18:17
-
-
Save divinity76/1ac3270b1e95aab14866ef8ce8679278 to your computer and use it in GitHub Desktop.
4chan expandAll - expand all thumbnailed images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// why max? firefox has issues if you try to click 100+ images at the same time (chrome doesn't, but firefox does, why? idk) | |
function expandAllImages(max=1){ | |
let all=document.querySelectorAll("div.file:not(.image-expanded) img:not(.autoexpanded)"); | |
max=Math.min(max,all.length); | |
for(let i=0;i<max;++i){ | |
all[i].className+=" autoexpanded"; | |
//all[i].parentNode.dispatchEvent(new MouseEvent("click", {ctrlKey: true})); | |
all[i].click(); | |
} | |
return max; | |
} | |
function expandAllImagesPeriodically(){ | |
if(window.stopAutoExpand){ | |
console.log("expandAllImagesPeriodically stopped via window.stopAutoExpand"); | |
return; | |
} | |
setTimeout(expandAllImagesPeriodically,5000); | |
let expanded=expandAllImages(); | |
if(expanded!==0){ | |
console.log("auto-expanded: "+expanded); | |
} | |
} | |
expandAllImagesPeriodically(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment