Hacker News new | ask | show | jobs
by hotwire 3022 days ago
I just have a bookmarklet to kill all "fixed" position divs.

I'm clicking it more and more these days - even those damn fixed navs that take up a stupid percentage of the screen give me the shits.

If clicking the bookmarklet doesn't get rid of your stupid modal newsletter sign up or annoying sticky nav, I'm just closing the tab.

Here's the bookmarklet btw:

javascript:(function()%7B(function () %7Bvar i%2C elements %3D document.querySelectorAll('body *')%3Bfor (i %3D 0%3B i < elements.length%3B i%2B%2B) %7Bif (getComputedStyle(elements%5Bi%5D).position %3D%3D%3D 'fixed') %7Belements%5Bi%5D.parentNode.removeChild(elements%5Bi%5D)%3B%7D%7D%7D)()%7D)()

3 comments

You may also be interested in my filterlist[1] project for uBlock Origin which attempts to do this via CSS style overrides for many, many sites.

[1] https://github.com/yourduskquibbles/webannoyances

Brilliant, and Thank You.

Ironically, though, this will probably limit severely the quantity and quality of data I can feed back to this Mozilla project via this add-on...

holy shit dude.

if this is as awesome as it looks, i'm actually excited.

thank you.

No problem, I hope it works out for you! Feel free to spread the word to others as well as provide sites that are causing issues for you so I can add fixes to the list.
Probably olark and other chat bot crap can be added too. They are mostly used these days for pushy sales people to hook casual browsers.
Fantastic. You must submit your list to the uBlock Origin author for inclusion in the list of available filters.
gorhill is aware of it [0]... I don't want to be too pushy and would rather let him come to his own conclusion on whether to include or not.

[0] https://github.com/uBlockOrigin/uAssets/pull/872

Just want to say; I'm checking in after a few days of using it and... if i think about it, i guess i'm clicking that "killsticky" bookmark less and less.

its funny, suddenly i don't even have to think about it, which is what this is all about - reducing cognitive load.

re inclusion on ublock and the like: it should probably be an option that people can enable/disable; ublock is more about blocking ads/trackers, but i would wager that most people are annoyed with sticky stuff too.

ready for the next challenge?.... getting rid of sites that fuck with the default scroll behaviour ;)

thanks again :)

Came across this as well [0]→[1].

(Slightly modernized version could be:)

    javascript:void([].forEach.call(document.querySelectorAll('body *'),e=>/fixed|sticky/.test(getComputedStyle(e).position)&&e.parentNode.removeChild(e)))
[0] https://news.ycombinator.com/item?id=16516126 [1] https://alisdair.mcdiarmid.org/kill-sticky-headers/
You can golf away 8 characters by replacing

    [].foreach.call(a, b) -> a.forEach(b)
... since the value returned by `querySelectorAll` has a `forEach` method. And 5 more if you replace:

    'body *' -> '*'
Ah, thanks for headsup, I somewhat missed the moment NodeList got sufficiently widespread forEach support. Good to know. In fact my intention was just to add check for `sticky` value along the `fixed` one; the 'golfing' approach was just habitual laziness…
that one looks better than the one i pasted - i've noticed that some sites are using "sticky" instead of "fixed" and my bookmarklet (which I copied off someone else) doesn't remove them.

thanks.

Me too! I cannot recommend this enough. IMO everyone should have this bookmark (or similar). As you say, it's most useful for removing static overlays that just get in the way of page content and take up screen space, but it can also get rid of pop-ups too.

It even works well on iOS/Safari !