KMeleonWiki > Resources > MacroLibrary > KmmGReader

Submitted by: rstlne


Google Reader is an online RSS feed reader by Google. Google has provided some bookmarklets in the Google Reader Goodies bar and in their official Google Reader blog to add features to Google Reader. Unfortunately, these bookmarklets do not work if you have your bookmark options set to open bookmarks in a new layer.

The following macros provide equivalents to the bookmarklets and the macros work regardless of your bookmark options. They are as follows:

  • Next article in Google Reader: Takes you to the next unread item in Google Reader, marking it as read in the process. It actually goes to the source of the item, which is useful if the RSS subscription includes only snippets.
  • Subscribe in Google Reader: Takes you to the Google Reader view of the first available feed on the current page. Then you may optionally subscribe to the feed.
  • Show all feeds: Shows a list of feeds on the current page in a popup box. Each feed is linked to its corresponding Google Reader view.
  • Note in Google Reader: Pops up a form allowing you to add a note in Google Reader for the current page. If you select text on the current page before invoking this macro, that text will be added to the note as a snippet.

All these macros are attached to the Document popup menu. The "Note in Google Reader" macro can also be found in the Selected Text popup menu.

Open your User Macro Folder (Edit > Configuration > User-Defined Macros) or your Macro Folder (Edit > Configuration > Macros) and create the following text file(s):


# greader.kmm
# Macro equivalents for the "Note in Reader", "Next", and "Subscribe"
# bookmarklets in Google Reader. It is the same as bookmarklets provided by
# Google, except that the macros work even if you have set your bookmark
# options to open bookmarks in a new layer.
# Some bookmarklets were borrowed from:
# http://googlereader.blogspot.com/2005/11/subscribing-to-feeds-via-little-google.html

$__s="var b=document.body;";
$__s=$__s."var GR________bookmarklet_domain='http://www.google.com';";

$__s="var b=document.body;";
$__s=$__s."var GR________bookmarklet_domain='http://www.google.com';";


$__s="var el=document.createElement('div');el.style.zIndex=10000;";
$__s=$__s."el.style.border='1px solid #008000';el.style.color='#000 !important';";
$__s=$__s."el.style.fontFamily='Arial, sans-serif';el.style.textAlign='left';";
$__s=$__s."el.innerHTML='View the following feeds in Google Reader:';";
$__s=$__s."var found = false;var links = document.getElementsByTagName('link');";
$__s=$__s."for (var i = 0, link; link = links[i]; i++) {";
$__s=$__s."var type = link.getAttribute('type');";
$__s=$__s."var rel = link.getAttribute('rel');";
$__s=$__s."var title = link.getAttribute('title');";
$__s=$__s."if (type && (type == 'application/rss+xml' || type == 'application/atom+xml') && rel && rel == 'alternate') {";
$__s=$__s."var href = link.getAttribute('href');";
$__s=$__s."if (!href.match(/^http/)) {";
$__s=$__s."var path = (href.match(/^\\//)) ? '/' : location.pathname;";
$__s=$__s."href='http://' + location.hostname + path + href; }";
$__s=$__s."var previewLink = document.createElement('a');";
$__s=$__s."previewLink.href = ' http://google.com/reader/preview/*/feed/' + href;";
$__s=$__s."previewLink.innerHTML = ((title) ? title : '') + ' - ' + href;";
$__s=$__s."previewLink.style.display='block'; previewLink.style.color='#00c';";
$__s=$__s."el.appendChild(previewLink); found = true;}}";
$__s=$__s."var close=document.createElement('a'); ";
$__s=$__s."close.innerHTML='Hide this box'; close.href='#'; ";
$__s=$__s."close.style.display='block'; close.style.marginTop='2em'; ";
$__s=$__s."close.style.color='#00c'; close.style.textDecoration='underline'; ";
$__s=$__s."close.onclick=function() {el.style.display='none'; return false;};";
$__s=$__s."function Google_AddFeedBox() {document.body.appendChild(el);y=window.scroll(0, 0);}";
$__s=$__s."if (!found) alert('Oops. Can\\'t find any feeds for this page.');";
$__s=$__s."else void(z=Google_AddFeedBox());";

setmenu(greader_menu,macro,"Next article in Google Reader",greader_next,-1);
setmenu(greader_menu,macro,"Subscribe in Google Reader",greader_subscribe,-1);
setmenu(greader_menu,macro,"Show all feeds",greader_show_all_feeds,-1);
setmenu(greader_menu,macro,"Note in Google Reader",greader_note,-1);
setmenu(SelectedText,macro,"Note in Google Reader",greader_note,-1);


# vim:set tw=0:
# -- The End --

Comments & Questions

Resources: Ulcer Treatment What is MS What is Shingles What is ADHD What is Dyslexia Backlink List


(c) 2000-2010 kmeleonbrowser.org. All rights reserved.
design by splif.