• jtk@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    7 months ago

    I went an extra step and made myself a Firefox add-on a few years ago. It takes a regular expression, scans all element attributes for values matching the expression, and applies a given CSS style to those elements. Given a pattern like… (Holy hell, you can’t really post a regular expression on lemmy, it’s trying to do some markdown stuff to it, but it involves the domains of all the sites I hate like twitter.com, x.com, facebook.com, etc…), and the style visibility: hidden, all links to those sites, no matter what page I’m on, are completely removed from my internet experience. I never see them.

    Edit: Oh the regex issue was actually because my add-on was filtering the elements with twitter.com, x.com, etc. as it’s supposed to :) I can’t even see my own comment unless I turn it off.

    • Aniki 🌱🌿@lemm.ee
      link
      fedilink
      English
      arrow-up
      3
      arrow-down
      1
      ·
      7 months ago

      That’s amazing! Do you have the source anywhere? I’ve always wanted to dabble in simple Firefox plugins

      • jtk@lemmy.sdf.org
        link
        fedilink
        English
        arrow-up
        2
        ·
        7 months ago

        Extension: https://addons.mozilla.org/en-US/firefox/addon/ssure/

        Source: https://github.com/7w0/ssure

        Be warned, the UI is just a textarea that takes JSON and involves escaping characters for both JS strings and regular expressions in the same string. regex requires backslashes to escape things like ‘.’ and JS requires backslashes to be doubled to output a single backslash 😬 The example escaped JSON at the bottom of the options screen should be enough to figure out how to add your own domains to the list. The only reason it’s a public plugin is because it’s literally impossible to just run a plugin from a local source without having to do a ton of extra steps every time you start the browser. Also, you’ll occasionally get confused why things don’t seem right on the internet, like when I tried to talk about this plugin and mentioned twitter.com, causing my own comment to look messed up after I posted it, because the plugin was doing exactly what I told it to do :)