Igor Tolkov

January 2025

1235678910111213141516171819212223252627282931

February 2025

1234567891011121314151617181920212425262728

March 2025

123567891011121314161718192021222324262728293031

April 2025

1234567891011121315161718192021222324252627282930

May 2025

234578910111213141516212224273031

June 2025

123456781112131415161718192021222324252627282930

July 2025

123456789101112131415161718192021222324252628293031

August 2025

1235678910111213141516171819202324252627282930

September 2025

1234567891011121314151617181920212224252627282930

October 2025

1234567891011121314151617181920212223242528293031

November 2025

12345678910111213141516171819202122232425262829

December 2025

91011121314151617181920212223242728293031

Photos feed for the new Facebook

The new Facebook layout, compared with the “old new” Facebook layout, misses a photos feed. Bummer, since that’s probably my favorite way of browsing Facebook.

Challenge: code up a photos feed for Facebook in 40 minutes.

The simple solution relies on a macro plugin (I use Scriptish for Firefox, there is probably a similar app for Chrome.) The macro is Javascript code that is executed on or after page load. Here is the code:

// ==UserScript==
// @id             10
// @name           Facebook-photosfeed
// @version        0.01
// @namespace
// @author         Igor Tolkov
// @description    Introduces a photos feed for Facebook
// @include        https://www.facebook.com/*
// @run-at         document-start
// ==/UserScript==
window.setInterval(function(){
    /* Hides posts, leaving only those which contain photos */
    var show_photos = function(){
        var s = document.getElementsByClassName("_5jmm");
        for(var i in s){
            var a = s[i]; if(!a.className) continue;
            a.style.display = "none";
        }
        for(var t in {"_5cq3":0, "_2a2q":1}){
            var s = document.getElementsByClassName(t);
            for(var i in s){
                var a = s[i]; if(!a.className) continue;
                while(a.className.indexOf("_5jmm")==-1) a = a.parentNode;
                a.style.display = "block";
            }
        }
    };

    /* Adds a photos feed link in sidebar */
    if(!document.getElementById("link_show_photos"))
    {
        var li = document.createElement("LI");
        li.id = "link_show_photos";
        li.className = "sideNavItem stat_elem";
        li.innerHTML = '<a title="News Feed" href="/?sk=photos" class="item clearfix"><div class="rfloat"><span aria-busy="1" aria-label="Loading..." class="img _55ym _55yn _55yo _5tqs uiSideNavSpinner"></span></div><div><span class="imgWrap"><i class="img sp_247cvt sx_cfa14f"></i></span><div class="linkWrap noCount">Photos Feed</div></div></a>';
        var ref = document.getElementById("navItem_app_4748854339" /* News Feed */);
        ref.parentNode.insertBefore(li, ref.nextSibling);
    }
    else
    {
        if(location.search == "?sk=photos")
            document.getElementById("link_show_photos").className = "sideNavItem stat_elem selectedItem open";
        else
            document.getElementById("link_show_photos").className = "sideNavItem stat_elem";
    }

    /* We use a custom news feed landing url. Facebook does not recognize it and ignores it. */
    if(location.search == "?sk=photos")
        show_photos();
}, 500);

Now you can also have a Facebook photos feed!