top | item 42905568

(no title)

DaveSwift | 1 year ago

Love it! Since it's now 2025, we probably should search for "fixed" & "sticky"

Here's a minified version with "sticky" added:

javascript:(()=>[...document.querySelectorAll('body *')].map(el=>["fixed","sticky"].includes(getComputedStyle(el).position)&&el.remove()))();

discuss

order

gabrielsroka|1 year ago

even more minified. forEach doesn't return anything, so you don't need the IIFE.

  javascript:document.querySelectorAll('body *').forEach(el=>['fixed','sticky'].includes(getComputedStyle(el).position)&&el.remove())
or

  javascript:document.querySelectorAll('body *').forEach(el=>/^(fixed|sticky)$/.test(getComputedStyle(el).position)&&el.remove())

evgpbfhnr|1 year ago

Interestingly running this in the console works but from a bookmarklet changes all the page content to false,false,false,.... (on firefox)

Any idea?

0xml|1 year ago

Firefox expects your script to return undefined, so you can add one at the end (or even shorter: void 0).

Robin_Message|1 year ago

Change map to forEach?