4 ms·
The first bookmark on my bookmark bar is "Kill floater", and it removes most floating elements on the page. It even works on many sites that hide the page behin
by 0x38B 6y ago
The first bookmark on my bookmark bar is "Kill floater", and it removes most floating elements on the page. It even works on many sites that hide the page behind a popup. Use it on my iPad all the time.
The bookmarklet:
javascript:(function()%7B(function%20()%20%7Bvar%20i%2C%20elements%20%3D%20document.querySelectorAll('body%20*')%3Bfor%20(i%20%3D%200%3B%20i%20%3C%20elements.length%3B%20i%2B%2B)%20%7Bif%20(getComputedStyle(elements%5Bi%5D).position%20%3D%3D%3D%20'fixed')%20%7Belements%5Bi%5D.parentNode.removeChild(elements%5Bi%5D)%3B%7D%7D%7D)()%7D)()
- peterhil 6y agoThanks! This will save me a lot of time.
- ryanwaggoner 6y agoDo you mind prepending the bookmarklet code with two spaces as described here: https://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc It's breaking the layout of this entire comment thread for me so I have to scroll horizontally to read all of the comments. Thanks!
- dang 6y agoI've added two spaces there.
- peterhil 6y agoI cleaned up and improved this a little. Now it hides the fixed elements, unless their computed top is at 0px. Also makes the body to scroll automatically, as many sites set their body to fixed before the fixed popup is gone: ``` javascript:(function () { var i, elements = document.querySelectorAll('body *'); var style; document.body.style.overflow-y = 'auto' for (i = 0; i < elements.length; i++) { style = getComputedStyle(elements[i]); if (style.position === 'fixed' && style.top !== "0px") { elements[i].style.display = 'none'; } } })() ```