K-Meleon
KMeleonWiki > Resources > MacroLibrary > KmmGReader
Submitted by: rstlne
Notes:
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:
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 greader_subscribe{ $__s="var b=document.body;"; $__s=$__s."var GR________bookmarklet_domain='http://www.google.com';"; $__s=$__s."if(b&&!document.xmlVersion){"; $__s=$__s."void(z=document.createElement('script'));"; $__s=$__s."void(z.src='http://www.google.com/reader/ui/subscribe-bookmarklet.js');"; $__s=$__s."void(b.appendChild(z));}"; $__s=$__s."else{location='http://www.google.com/reader/view/feed/'+encodeURIComponent(location.href)}"; injectJS($__s); } greader_note{ $__s="var b=document.body;"; $__s=$__s."var GR________bookmarklet_domain='http://www.google.com';"; $__s=$__s."if(b&&!document.xmlVersion){"; $__s=$__s."void(z=document.createElement('script'));"; $__s=$__s."void(z.src='http://www.google.com/reader/ui/link-bookmarklet.js');"; $__s=$__s."void(b.appendChild(z));}else{}"; injectJS($__s); } greader_next{ open("http://www.google.com/reader/next?go=nextauto&t=-5298076397199055872"); } greader_show_all_feeds{ $__s="var el=document.createElement('div');el.style.zIndex=10000;"; $__s=$__s."el.style.position='absolute';el.style.padding='2em';el.style.top=0;"; $__s=$__s."el.style.backgroundColor='#ffffcc';"; $__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."previewLink.style.textDecoration='underline';"; $__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."el.appendChild(close);"; $__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());"; injectJS($__s); } _greader_buildmenu{ 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(Document,inline,greader_menu); setmenu(SelectedText,macro,"Note in Google Reader",greader_note,-1); } $OnInit=$OnInit."_greader_buildmenu;"; $macroModules=$macroModules."greader;"; # vim:set tw=0: # -- The End --