[GUIDE] Removing Unwanted Articles From Front Page

AngerDanger

macrumors 601
Original poster
Dec 9, 2008
4,625
20,880
I've written a script that allows users to block front page articles by keyword. I figured this would save users, moderators, and editors a bit of headache.

You'll need an extension so that your browser can run the script (user scripts allow your browser to run custom JavaScript files on webpages). Below is a series of links to Tampermonkey, a user script extension supported by many browsers:

This code will need to be copied and pasted into a new user script. By default, it's set to block articles with "Carpool Karaoke," "Samsung," and "Beta" in the title. Add to or remove these words to block whatever you want:

Code:
// ==UserScript==
// ==UserScript==
// @name         iDontCare
// @namespace    http://angerdanger.com
// @version      0.1
// @description  Hide Unwanted MR Articles
// @author       AngerDanger
// @match        https://www.macrumors.com/
// @grant        none
// ==/UserScript==

window.onload = function(){
    var keywords = ["Carpool Karaoke", "Samsung", "Beta"]; // <-- EDIT THESE KEYWORDS
    var titles = document.getElementsByClassName('title');
    for (var j = 0; j < keywords.length; j++){
        for (var i = 0; i < titles.length; i++){
            if (titles[i].innerHTML.indexOf(keywords[j]) >= 0){
                titles[i].parentNode.parentNode.removeChild(titles[i].parentNode);
                i--;
            }
        }
    }
};
Caveats
  • The script runs after the page has loaded, so there will be a moment where you're able to see the articles before they poof out of existence.
  • You'll still see blocked articles on mobile browsers.
  • This won't block any articles from being pushed as notifications.
 
Last edited:

Pakaku

macrumors 68020
Aug 29, 2009
2,231
2,284
Works pretty well under Firefox, but another caveat I see is it can't do anything about the sidebar stories so far. Lots of iffy articles seem to always get tucked away in there.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.