Hacker News new | ask | show | jobs
by cornegidouille 1581 days ago
Here's a quick greasemonkey script I just whipped up that you could start from:

  (function(){
      'use strict';
      var links = document.getElementsByClassName("titlelink");  
      for(var link of links){
          if(link.href.includes("twitter") ){
              var owner = link.closest(".athing");
              owner.nextSibling.remove();
              owner.remove();
          }
      }
  })();

You would need to adapt the "includes()" to match any URL you don't care for.
1 comments

Thanks! This works with one exception - when two links in a row are from the same domain only the first one is removed.

I don't know any javascript, but this is my attempt at modification:

    let domains = "twitter\.com|\
                   cnn.com\
                  ";

    (function(){
        'use strict';
        var links = document.getElementsByClassName("titlelink");
        var owners = [];
        for (var link of links) {
            if (link.href.match(domains)) {
                owners.push(link.closest(".athing"));
            }
        }
        for (var owner of owners) {
            owner.nextSibling.remove();
            owner.remove();
        }
    })();