4chan
// ==UserScript== // @name Manual media grab // @namespace http://eientei.org/ // @version 0.2 // @description Removes non-media posts from the threads, simplifying manual content grabbing // @author iamtakingiteasy // @match https://boards.4chan.org/*/thread/* // @icon https://www.google.com/s2/favicons?sz=64&domain=4chan.org // @grant none // @run-at document-end // ==/UserScript== (function() { 'use strict'; document.querySelectorAll('.sideArrows').forEach(x => x.parentElement.removeChild(x)); document.querySelectorAll('.replyContainer img').forEach(r => ((f, p) => { const base = 200; const oi = f.querySelector('img'); const a = document.createElement('a'); a.href = f.href; a.onclick = e => e.preventDefault(); a.appendChild(oi); a.style = 'text-align: center; vertical-align: middle; justify-content: center; align-items: center; display: inline-flex'; const vid = a.href.endsWith('.webm') || a.href.endsWith('.mp4'); const gif = a.href.endsWith('.gif'); if (vid || gif) { a.style.width = `calc(${base}px - 0.2ex)`; a.style.height = `calc(${base}px - 0.2ex)`; a.style.border = `0.1ex ${gif ? 'dashed' : 'solid'} maroon`; } else { a.style.width = `${base}px`; a.style.height = `${base}px`; } oi.onclick = ((a, oi, vid) => (e) => { const ni = document.createElement(vid ? 'video' : 'img'); ni.style.maxWidth = `calc(${base}px - 1ex)`; ni.style.maxHeight = `calc(${base}px - 1ex)`; ni.src = a.href; if (vid) { ni.controls = true; ni.autoplay = true; }; const d = document.createElement('div'); d.style = 'border: 0.5ex solid #d9bfb7'; d.onclick = ((a,d,oi) => () => { a.removeChild(d); oi.style.display = 'inherit'; })(a, d, oi); d.appendChild(ni); a.appendChild(d); oi.style.display = 'none'; })(a, oi, vid); p.parentElement.replaceChild(a, p); })(r.parentElement, r.parentElement.parentElement.parentElement.parentElement)); document.querySelectorAll('.replyContainer').forEach(x => x.parentElement.removeChild(x)); const op = document.querySelector('.opContainer'); ((p) => { p.removeChild(op); p.appendChild(op); })(op.parentElement); setTimeout(() => { document.querySelector('.thread').scrollIntoView(); }, 0); })();
Updated