Skip to content

Instantly share code, notes, and snippets.

@silgon
Last active October 22, 2020 21:08
Show Gist options
  • Save silgon/9948dc378607c57cb016d755d81c3406 to your computer and use it in GitHub Desktop.
Save silgon/9948dc378607c57cb016d755d81c3406 to your computer and use it in GitHub Desktop.
# newest version for Mozilla Firefox 81.0.2
javascript:/*PDF - toggle filter invert*/(function(){var L='style_PDFI',S='#viewerContainer>#viewer.pdfViewer>.page{filter: invert(100%)}',SS,E=document.querySelector('style[id="'+L+'"]');if(E){SS=E.disabled;E.disabled=(SS==true)?false:true}else{SS=document.createElement('style');SS.setAttribute('type','text/css');SS.id=L;SS.innerHTML=S;document.querySelector('head').appendChild(SS); document.querySelectorAll("#viewerContainer>#viewer.pdfViewer>.page").forEach(e=>e.style.border="10px solid rgba(0, 0, 0, 0)"); document.querySelector("#viewerContainer>#viewer.pdfViewer").style.background="#666"; document.querySelector("#toolbarViewer").style.background="#999"; document.querySelector("#toolbarViewer").style.borderBottom="#999 solid 1px"; document.querySelector("#toolbarSidebar").style.background="#999";document.querySelector("#outlineView").style.background="#bbb"}})()
# my bookmarklet
javascript:/*PDF - toggle filter invert*/(function(){var L='style_PDFI',S='#viewerContainer>#viewer.pdfViewer>.page{filter: invert(100%)}',SS,E=document.querySelector('style[id="'+L+'"]');if(E){SS=E.disabled;E.disabled=(SS==true)?false:true}else{SS=document.createElement('style');SS.setAttribute('type','text/css');SS.id=L;SS.innerHTML=S;document.querySelector('head').appendChild(SS); document.querySelectorAll("#viewerContainer>#viewer.pdfViewer>.page").forEach(e=>e.style.border="10px solid rgba(0, 0, 0, 0)")}})()
# base boormarklet (extracted from: https://support.mozilla.org/en-US/questions/1281116)
javascript:/*PDF - toggle filter invert*/(function(){var L='style_PDFI',S='#viewerContainer>#viewer.pdfViewer>.page{filter: invert(100%)}',SS,E=document.querySelector('style[id="'+L+'"]');if(E){SS=E.disabled;E.disabled=(SS==true)?false:true}else{SS=document.createElement('style');SS.setAttribute('type','text/css');SS.id=L;SS.innerHTML=S;document.querySelector('head').appendChild(SS);}})()
# my bookmarklet removes the border
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment