Auto hide annoying Facebook posts

Auto hide annoying Facebook posts

My Facebook has been littered with what can only be described as spam relating to the Apple announcements about some more things they are going to be selling or something like that.  

I am not an Apple fan and do not care less about this so I thought there must be an easy way to hide this kind of thing but I didn't find anything so I decided to make something to do it for me.  

This is a super simple JavaScript GreaseMonkey or TamperMonkey script for scanning your Facebook feed and deleting the nodes form the DOM that contain a string that you have decided is annoying. In this example I have used Apple related words as there is allot of Apple spam on my Facebook at the moment but you can add whatever words you find annoying to the "hideAnnoyingThingsStrings" array and any post containing that string will be deleted.  

If you are interested to see the results then when a matching item is found and hidden then there is a log of that in your console. I find this thing pretty useful for making my Facebook feed more appropriate for work and less annoying to look at in general, especially since David Cameron started running advertising campaigns on there.  

// ==UserScript==
// @name           Hide annoying things form your FaceBook wall
// @namespace   http://hide.annoying.things/
// @version        0.1
// @description   It's apple product release time so I decided I needed to clean the Apple spam from my FB but you can use this for anything
// @match
// @copyright     2014+, Tom Gould
// @require
// @grant          GM_addStyle
// ==/UserScript==
var hideAnnoyingThingsStrings = [
var hideAnnoyingThings = function() {
    $('._4ikz').each(function() {
        var elements = $(this).find('div.mbm');
        $.each(elements, function(key, value) {
            var findings = hideAnnoyingThings_str_contains($(value).html(), hideAnnoyingThingsStrings, 0);
            if (findings !== false) {
                console.log('Found a ' + findings);
var hideAnnoyingThings_str_contains = function(haystack, needles, offset) {
    for (i = 0; i < needles.length; i++) {
        var str = needles[i].toLowerCase();
        var n = (haystack.toLowerCase() + '')
            .indexOf(str, (offset || 0));
        if (n > -1) {
            return str;
    return false;
window.setInterval(hideAnnoyingThings, 1000);


Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.