Make Facebook pleasant again

I go to Facebook every few days, weeks or whatever. Kids’ pics. Volleyball happenings. Doings of people I’ve known over the years.

What’s happened to my follow-feed, though, is people I know to be fine people in real life appear in the feed as the girl on the left:

Tantrum Time

This is disheartening at best.

Politics is entertaining, but, golly, let’s not scream at our favorite character on TV when they do something dumb. Get a grip.

But, of course, the other guy will never get a grip.

So, for Firefox, there’s Grease Monkey and my quick and dirty Grease Monkey script, FaceBookFix.user.js, to the rescue.

This script simply takes Facebook posts off screen if they contain, in text form (sadly not in images), any of a list of words.

It’s not heavily tested, to say the least. Which is to say, I tried it a couple times.

I made it easy to add or delete banned words. Non-programmers can change the script if they can find it on their disk and save it as a text file from WordPad or a better text editor.

The results are nice. My feed is now pleasant. Again. “Never do yourself what a computer can do for you,” so the computer now lets me see the real news un-flooded by noise. (If this post makes it to Facebook, I can’t write “f*** news” or the script will make the post invisible to me!)

Oh. Here’s the whole script as of this moment:

// ==UserScript==
// @name        FaceBookFix
// @namespace   https://www.tranzoa.net/~alex
// @description Get rid of sad Facebook tantrums.    https://www.tranzoa.net/alex/public_stuff/FaceBookFix.user.js
// @include     https://www.facebook.com/
// @version     1
// @grant       none
// ==/UserScript==

/***

    FaceBook posts containing any of these listed strings are whacked.

    The strings are in in no particular order.

    Change as you see fit.

    Non-programmers, leave the last one as the last one.

    Non-programers, for syntax reasons, do not put any:
        single-quote         ( ' )
        pipe/vertical_stroke ( | )
        backslash            ( \ )
    characters in any of the strings.

***/
var find_these_strings  = [
    'killary',
    'drumpf',
    'obozo',
    'shillary',
    'repuglican',
    'democrap',
    'libtard',
    'faux news',
    'hilliary',         // I forget other Internet commenters' alternate spellings. More to come, for sure.
    'trump',
    'hillary',
    'clinton',
    'HRC',
    'DJT',
    'obama',
    'biden',
    'pence',
    'nixon',
    'watergate',
    'reagan',
    'steve bannon',
    'stevebannon',
    'bernie sanders',
    'berniesanders',
    'bernie',           // Sorry about this, Bernie-from-Dimas-days. Your brand has been trashed.
    'sanders',
    'george bush',      // 'bush' is just too generic
    'georgebush',
    ' g bush',
    ' gbush',
    ' gw bush',
    ' gwbush',
    ' h bush',
    ' hbush',
    ' hw bush',         // did I get these bushes right?
    ' hwbush',
    'kkk',              // why are Hollywood and the news guys obsessed with the KKK? No one in the real world cares about them.
    'mcconnell',        // maybe this should be only mitch McConnell
    'sean spicer',
    'seanspicer',
    'harry reid',
    'harryreid',
    'paul ryan',
    'paulryan',
    'muslim',
    'impeach',
    'senate',
    'house of rep',
    'parliment',
    'merkel',
    'abortion',
    'pro-life',
    'prolife',
    'pro-choice',
    'prochoice',
    'occupy democrats',
    'occupy wall',
    'fake news',
    'iran',
    'iraq',
    'isreal',
    'saudia arabia',
    'potus',
    'scotus',
    'executive order',
    'daily show',       // ? poeple seem to feel this show is really important when it discusses politics
    'fuck',             // the whole profanity list should be here.
    'shit',
    'Note: Leave this here at the end of the list.'
    ];
find_these_strings  = find_these_strings.join('|').toLowerCase().split('|');
find_these_strings.pop();       // get rid of the comment at the end


(function (){

function    fix_this_facebook_thing()
{
    var divs = document.getElementsByTagName("div");                            //  Find all DIV elements in the page
    // window.console.log("fixing " + Date.now() + " " + divs.length);
    for (var el_number in divs)                                                 //  Python is *so* superior to JavaScript
    {
        var el  = divs[el_number];
        if ((el.id != undefined) && el.id.startsWith('hyperfeed_story_id_'))    //  For each post in the feed
        {
            var htm = el.innerHTML.toLowerCase();                               //  Look for any of the strings without regard to case
            // window.console.log("scanning " + el.id + " " + htm.length);
            for (string_number in find_these_strings)
            {
                var fs  = find_these_strings[string_number];                    //      For each of the strings to find
                if  (htm.indexOf(fs) >= 0)                                      //          Is the string in the post in text form? (sadly missing them in images and videos)
                {
                    el.style.display    = 'none';                               //          Yes. Take the post off screen
                    // window.console.log("whacked: " + fs + " in " + el.id);
                    break;                                                      //          And don't keep looking in the this post for more matches.
                }
            }
        }
    }
}


var timeout_every_couple_seconds = window.setInterval(fix_this_facebook_thing, 2017);


}());


// eof

Taking the fun away to be a better person

Twenty some years ago my right hand became frozen around a mouse. It took the left hand to pry the mouse from my … hand.

Why?

Microsoft Minesweeper.

Too much Minesweeper.

So, on the principle of “Never do yourself what a machine can do for you.“, I wrote a program to play the game. On screen. Mouse clicks and all.

And after watching expert mode being solved in 7 seconds a few times under Win 3.1, Minesweeper became boring and I stopped playing it. (No. The program did not use the cheat mode. It played fair.)

Problem solved.

Fast forward some years.

I wrote a program to solve Spider.

It didn’t help. I’ve still spent too much time on that game. But the program did find only a couple of impossible-to-win games out of 32 thousand dealt. That was informative.

Fast forward some more years.

I wrote a Sudoku program to stop myself from playing that game, uncompelling and bite sized though the game was. It was a fun program and is handy to find impossible and incompletely initialized / ambiguous games (e.g. at sudoku.com). But it didn’t satisfy.

Fast forward to now.

And we have a screen shot from sudo_ku.py playing a game at www.WebSudoku.com :

Playing Sudoku the right way.

We’ll see if I keep playing this site’s game.

Or a hacked old Python Gnome Sudoku program:

Playing Gnome Sudoku the right way.

The program looks at the screen(s), finds boards, solves them, and plays them using mouse clicks and keys to enter the numbers. Though the program is incomplete, it’s pretty satisfying. Perhaps that’s why at one point many years ago I said that my job was to automate my job. And perhaps that’s why I’m not among the robotic hand-wringers of today. It’s simply fun to watch machines do what they do best.