Skip to content

Instantly share code, notes, and snippets.

@mattn
Created August 21, 2009 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mattn/171980 to your computer and use it in GitHub Desktop.
Save mattn/171980 to your computer and use it in GitHub Desktop.
RSS 用 pubsubhubbub publish ブックマークレット
オートディスカバリから application/rss? な RSS を見つけて pubsubhubbub.appspot.com に publish します。
オリジナルからの変更点はオートディスカバリで RSS を見つけるようにした部分くらいです。
インストール方法は javascript: から始まるソースをブックマーク編集の URL に登録するだけです。ブックマーク名称はオリジナルと合わせ「Publish to Hub」にしておくのが良いかと思います。
var _____pshb_BookmarkletRun=function(){var post_id='pshb-bookmarklet-iframe';var post=null;var close=null;if(document.getElementById(post_id)==null){post=document.createElement('iframe');post.id=post_id;post.width='250';post.height='120';var s=post.style;s.position='absolute';s.top='10px';s.right='10px';s.padding='0';s.margin='0';s.border='5px solid #9c0';s.zIndex='1000000';close=document.createElement('a');close.href='javascript:window._____pshb_closeMe();';close.innerHTML='&times;';s=close.style;s.cursor='default';s.fontWeight='bold';s.fontSize='12px';s.position='absolute';s.top='15px';s.right='15px';s.margin='0';s.borderStyle='dotted';s.borderColor='#aaa;';s.borderWidth='0 0 1px 1px';s.padding='0 3px 0 3px';s.display='block';s.textDecoration='none';s.color='#000';s.zIndex='1000001';};var canonicalize=function(s){if(s==''||s==null){return'';};var temp=document.createElement('div');temp.innerHTML=s.toLowerCase();var result=temp.childNodes[0].nodeValue;temp.removeChild(temp.firstChild);return result;};window._____pshb_closeMe=function(){document.body.removeChild(close);document.body.removeChild(post);};var findRssFeed=function(){var links=document.getElementsByTagName('link');for(var i=0;i<links.length;++i){var item=links[i];if(item.type!=undefined&&item.href!=undefined&&item.rel!=undefined&&canonicalize(item.type).indexOf('application/rss')==0&&canonicalize(item.rel).indexOf('alternate')==0&&item.href.length>0){return item.href;};};return null;};window._____pshb_sawLoad=false;window._____pshb_autoClose=true;window._____pshb_handleLoad=function(){if(!window._____pshb_sawLoad){window._____pshb_sawLoad=true;}else{window._____pshb_autoClose=false;};};var autoClose=function(){if(window._____pshb_autoClose){window._____pshb_closeMe();};};if(post!=null){var feed=findRssFeed();var hub=_____pshb_getHub();post.onload=_____pshb_handleLoad;post.src='http://pubsubhubbub.appspot.com/bookmarklet.html'+'?feed='+feed+'&hub='+hub;document.body.appendChild(post);document.body.appendChild(close);setTimeout(autoClose,2000);};};_____pshb_BookmarkletRun();
javascript:(function(){if(document.body&&!document.xmlVersion){var jsonp=document.createElement('script');jsonp.type='text/javascript';jsonp.src='http://gist.github.com/raw/171980/79410350041d838fdeb01f584bfade5e13d05006/bookmarklet_jsonp.min.js?rand='+Math.floor(Math.random()*1000);var head=document.getElementsByTagName('head')[0].appendChild(jsonp);};})();(function(){window._____pshb_getHub = function() {return 'http://pubsubhubbub.appspot.com/';};})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment