[GUIDE] Removing Unwanted Articles From Front Page

Discussion in 'Site and Forum Feedback' started by AngerDanger, Aug 7, 2017.

  1. AngerDanger, Aug 7, 2017
    Last edited: Aug 9, 2017

    AngerDanger macrumors 68030

    AngerDanger

    Joined:
    Dec 9, 2008
    #1
    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.
     
  2. Pakaku macrumors 68000

    Pakaku

    Joined:
    Aug 29, 2009
    #2
    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.
     
  3. OllyW Moderator

    OllyW

    Staff Member

    Joined:
    Oct 11, 2005
    Location:
    The Black Country, England
    #3
    I grew up with newspapers and magazines so I just skip the articles that don't interest me. :cool:
     
  4. ActionableMango macrumors 604

    ActionableMango

    Joined:
    Sep 21, 2010
    #4

    D1

    I also grew up with newspapers and magazines so I
    [continued on page D5]

    D5
    [continued from page D1]
    also just skip the articles that don't interest me.
     
  5. AngerDanger thread starter macrumors 68030

    AngerDanger

    Joined:
    Dec 9, 2008
    #5
    Screen Shot 2017-08-08 at 6.02.19 PM copy.png
     

Share This Page