Created
January 18, 2011 05:45
-
-
Save kijun/784029 to your computer and use it in GitHub Desktop.
Google Reader Current Article Bookmarklet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="javascript:var curp = 'id(\'current-entry\')'; var titlep = curp + '//h2[@class=\'entry-title\']/text()'; var hostp = curp + '//span[@class=\'entry-source-title\']/text()'; var urlp = curp + '//a[@class=\'entry-original\']/@href'; function xpath(x) { var r; try { r=document.evaluate(x,document,null,0,null); switch(r.resultType) { case 1:r=r.numberValue;break; case 2:r=r.stringValue;break; case 3:r=r.booleanValue;break; case 4:var n=r,r=[],e;while(e=n.iterateNext())r.push(e);break; } } catch(ex){r=ex.message;} return r; } function parse() { var text = xpath(titlep)[0].nodeValue; text += '\nfrom '+xpath(hostp)[0].nodeValue; text += '\n['+xpath(urlp)[0].nodeValue+']'; alert(text); } parse();">Current Article</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://kijunseo.com/post/2815502380/1
리더에서 글 읽고있다가 이 코드를 호출하면 현재 읽고 있는 글 정보를 alert창에 띄워줌.
copy / paste 하기 귀찮아서 만들었어 별거 아님;