Skip to content

Instantly share code, notes, and snippets.

@cmdr2
Created August 28, 2026 06:40
Show Gist options
  • Select an option

  • Save cmdr2/91b42a470879877cedd050025a14adbe to your computer and use it in GitHub Desktop.

Select an option

Save cmdr2/91b42a470879877cedd050025a14adbe to your computer and use it in GitHub Desktop.
Focus-Wide
javascript:(function(){var d=document;var elms=d.querySelectorAll('style,link[rel="stylesheet"]');for(var i=0;i<elms.length;i++){elms[i].parentNode.removeChild(elms[i]);}var s=d.createElement('style');s.innerHTML='* { background: #181a1b !important; color: rgb(232, 230, 227) !important; font-family: monospace !important; font-size: 12pt !important; line-height: 1.4 !important; border: none !important; } body { column-count: 4 !important; column-gap: 40px !important; height: 93vh !important; margin: 0 auto !important; padding: 40px !important; } h1, h2, h3 { column-span: all !important; display: inline; } a { color: rgb(232, 230, 227) !important; text-decoration: underline !important; } a:visited { color: rgb(232, 230, 227) !important; } img, svg, canvas { max-width: 100% !important; height: auto !important; cursor: pointer !important; opacity: 0.6 !important; } .img-container-wrapper { position: relative !important; display: inline-block !important; max-width: 100% !important; background: transparent !important; } .img-delete-btn { position: absolute !important; top: 8px !important; right: 8px !important; width: 24px !important; height: 24px !important; background: rgba(0, 0, 0, 0.8) !important; color: white !important; border-radius: 50% !important; display: flex !important; align-items: center !important; justify-content: center !important; font-size: 14px !important; font-weight: bold !important; cursor: pointer !important; z-index: 9999 !important; user-select: none !important; box-shadow: 0 2px 5px rgba(0,0,0,0.5) !important; } .img-delete-btn:hover { background: black !important; }';d.head.appendChild(s);d.querySelectorAll('img, svg, canvas').forEach(function(el){if(el.closest('.img-container-wrapper'))return;function applyInvert(){try{var canvas=d.createElement('canvas');var ctx=canvas.getContext('2d');canvas.width=20;canvas.height=20;if(el.tagName==='IMG'){ctx.drawImage(el,0,0,20,20);}else if(el.tagName==='CANVAS'){ctx.drawImage(el,0,0,20,20);}else{var svgData='data:image/svg+xml;utf8,'+encodeURIComponent(el.outerHTML);var img=new Image();img.src=svgData;ctx.drawImage(img,0,0,20,20);}var imgData=ctx.getImageData(0,0,20,20);var data=imgData.data;var r=0,g=0,b=0,count=0;for(var i=0;i<data.length;i+=4){if(data[i+3]>50){r+=data[i];g+=data[i+1];b+=data[i+2];count++;}}if(count>0){var brightness=(r/count)*0.299+(g/count)*0.587+(b/count)*0.114;if(brightness>150){el.style.setProperty('filter','invert(1) hue-rotate(180deg)','important');}}}catch(e){el.style.setProperty('filter','invert(1) hue-rotate(180deg)','important');}}if(el.tagName==='IMG'&&!el.complete){el.addEventListener('load',applyInvert);}else{applyInvert();}var wrapper=d.createElement('div');wrapper.className='img-container-wrapper';el.parentNode.insertBefore(wrapper,el);wrapper.appendChild(el);var btn=d.createElement('div');btn.className='img-delete-btn';btn.innerText='×';btn.onclick=function(e){e.stopPropagation();e.preventDefault();wrapper.remove();};wrapper.appendChild(btn);el.onclick=function(e){e.stopPropagation();e.preventDefault();var lb=d.createElement('div');lb.setAttribute('style','position:fixed!important;top:0!important;left:0!important;width:100vw!important;height:100vh!important;background:rgba(0,0,0,0.9)!important;z-index:999999!important;display:flex!important;align-items:center!important;justify-content:center!important;');var lbi=d.createElement('img');lbi.setAttribute('style','max-width:95%!important;max-height:95%!important;object-fit:contain!important;filter:none!important;background:transparent!important;');if(el.tagName==='IMG'){lbi.src=el.src;}else if(el.tagName==='CANVAS'){lbi.src=el.toDataURL();}else{lbi.src='data:image/svg+xml;utf8,'+encodeURIComponent(el.outerHTML);}lb.appendChild(lbi);lb.onclick=function(le){le.stopPropagation();lb.remove();d.documentElement.style.setProperty('overflow','auto','important');d.body.style.setProperty('overflow','auto','important');d.body.style.setProperty('position','static','important');window.focus();d.body.focus();};d.body.appendChild(lb);};});})();
@cmdr2

cmdr2 commented Aug 28, 2026

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment