Skip to content

Instantly share code, notes, and snippets.

@kijun
Created January 18, 2011 05:45
Show Gist options
  • Save kijun/784029 to your computer and use it in GitHub Desktop.
Save kijun/784029 to your computer and use it in GitHub Desktop.
Google Reader Current Article Bookmarklet
<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>
@kijun
Copy link
Author

kijun commented Jan 19, 2011

http://kijunseo.com/post/2815502380/1

리더에서 글 읽고있다가 이 코드를 호출하면 현재 읽고 있는 글 정보를 alert창에 띄워줌.
copy / paste 하기 귀찮아서 만들었어 별거 아님;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment