Skip to content

Instantly share code, notes, and snippets.

@jordanbrock
Created June 15, 2010 04:20
Show Gist options
  • Save jordanbrock/438692 to your computer and use it in GitHub Desktop.
Save jordanbrock/438692 to your computer and use it in GitHub Desktop.
javascript:var%20el=document.createElement('div');el.style.zIndex=10000;el.style.position='absolute';el.style.padding='2em';el.style.top=0;el.style.backgroundColor='%23ffffcc';el.style.border='1px%20solid%20%23008000';el.style.color='%23000%20!important';el.style.fontFamily='Arial,%20sans-serif';el.style.textAlign='left';el.innerHTML='View%20the%20following%20feeds%20in%20Google%20Reader:';var%20found%20=%20false;var%20links%20=%20document.getElementsByTagName('link');for%20(var%20i%20=%200,%20link;%20link%20=%20links%5Bi%5D;%20i++)%20%7B%20var%20type%20=%20link.getAttribute('type');%20var%20rel%20=%20link.getAttribute('rel');%20var%20title%20=%20link.getAttribute('title');%20if%20(type%20&&%20(type%20==%20'application/rss+xml'%20%7C%7C%20type%20==%20'application/atom+xml')%20&&%20rel%20&&%20rel%20==%20'alternate')%20%7B%20var%20href%20=%20link.getAttribute('href');%20if%20(!href.match(/%5Ehttp/))%20%7B%20var%20path%20=%20(href.match(/%5E%5C//))%20?%20'/'%20:%20location.pathname;%20href='http://'%20+%20location.hostname%20+%20path%20+%20href;%20%7D%20var%20previewLink%20=%20document.createElement('a');%20previewLink.href%20=%20'%20http://google.com/reader/preview/*/feed/'%20+%20href;%20previewLink.innerHTML%20=%20((title)%20?%20title%20:%20'')%20+%20'%20-%20'%20+%20href;%20previewLink.style.display='block';%20previewLink.style.color='%2300c';previewLink.style.textDecoration='underline';%20el.appendChild(previewLink);%20found%20=%20true;%7D%7D%20var%20close=document.createElement('a');%20close.innerHTML='Hide%20this%20box';%20close.href='%23';%20close.style.display='block';%20close.style.marginTop='2em';%20close.style.color='%2300c';%20close.style.textDecoration='underline';%20close.onclick=function()%20%7Bel.style.display='none';%20return%20false;%7D;%20el.appendChild(close);%20function%20Google_AddFeedBox()%20%7Bdocument.body.appendChild(el);y=window.scroll(0,%200);%7D%20if%20(!found)%20alert('Oops.%20Can%5C't%20find%20any%20feeds%20for%20this%20page.');%20else%20void(z=Google_AddFeedBox());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment