Last active
January 12, 2018 17:40
-
-
Save w33ble/e59382ba29a48d5096ea9f6ba998a0fc to your computer and use it in GitHub Desktop.
Pruning Dickbars - Bookmarklet Code
This file contains hidden or 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
// version 4-2017.18 | |
(function dbprune() { | |
// restore page scrolling | |
var body = document.body; | |
var html = body.parentElement; | |
body.style['overflow'] = body.style['overflow-y'] = 'auto'; | |
html.style['overflow'] = html.style['overflow-y'] = 'auto'; | |
// check if this is a mobile display | |
var mHeight = 680; | |
var mh = window.innerHeight; | |
var isMobile = mh <= mHeight; | |
// remove dickbars | |
var i, elements = document.querySelectorAll('body *'); | |
for (i = 0; i < elements.length; i++) { | |
var c = getComputedStyle(elements[i]); | |
var h = Number(c.height.replace('px', '')); | |
var isFixed = ['fixed', 'sticky', '-webkit-sticky'].indexOf(c.position) >= 0; | |
var tooTall = (h >= mHeight*3 || h === mh) && c.position === 'absolute'; | |
if (isFixed || (isMobile && tooTall)) { | |
elements[i].parentNode.removeChild(elements[i]); | |
} | |
} | |
})(); |
This file contains hidden or 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
javascript:!function(){var e=document.body,o=e.parentElement;e.style.overflow=e.style["overflow-y"]="auto",o.style.overflow=o.style["overflow-y"]="auto";var t,l=window.innerHeight,r=l<=680,i=document.querySelectorAll("body *");for(t=0;t<i.length;t++){var n=getComputedStyle(i[t]),y=Number(n.height.replace("px","")),d=["fixed","sticky","-webkit-sticky"].indexOf(n.position)>=0,a=(y>=2040||y===l)&&"absolute"===n.position;(d||r&&a)&&i[t].parentNode.removeChild(i[t])}}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment