Thursday, May 14, 2015

Gleebox fix for Google Reader command (using TT-RSS)

I'm a fan of Gleebox, especially since I'm getting older and marathon surf sessions can cause my elbow to ache (from reaching for the mouse, then the keyboard, then the mouse).  Using Gleebox saves wear and tear on my elbow and speeds up navigation across sites/pages.

One of Gleebox's drawbacks is that it hasn't been updated in awhile.  One notable broken part is the "open feed in Google Reader" option (Google Reader has been offline for years).  If you have your own TT-RSS instance, or have access to someone else's, the following steps will "re-purpose" the !rss command.

Assuming that you already have Gleebox installed as a Chrome extension on your workstation:

1) Find the pagecmd.js file.  On my desktop, it is located in:

.config/google-chrome/Default/Extensions/miinkdcjglbkbanpkghnkgkgbamdkgji/2.3.1_0/js

2) Open pagecmd.js in your favorite editor and look for the following lines:
// rss: Opens the rss feed of page in google reader
Glee.getRSSLink = function(newtab) {
  // code via bookmark for google reader
  var b = document.body;var GR________bookmarklet_domain = 'http://www.google.com';if (b && !document.xmlVersion) {void(z = document.createElement('script'));void(z.src = 'http://www.google.com/reader/ui/subscribe-bookmarklet.js');void(b.appendChild(z));}else {location = 'http://www.google.com/reader/view/feed/' + encodeURIComponent(location.href)}
};
Make them look like:
Glee.getRSSLink = function(newtab) {
  Glee.Browser.openURL('http://192.168.2.240/tt-rss/public.php?op=subscribe&feed_url='+encodeURIComponent(location.href),newtab,true);
  if(newtab) {
        Glee.empty();
  }
};
Note: there should be no carriage return between "public.php?" and "op=subscribe".  That should be a single line, starting with "Glee.Browser.openURL" and ending with "newtab,true);".  Of course, you should also edit the line so that the location of your TT-RSS server is accurate.

3) Close your browser, wait a few seconds, and open Chrome again.  Visit a page with an RSS feed and attempt to run the Gleebox "!rss" command.  It should attempt to add the feed to your TT-RSS instance.