Skip to content

Instantly share code, notes, and snippets.

@roamlog
Created September 17, 2010 08:37
Show Gist options
  • Save roamlog/583929 to your computer and use it in GitHub Desktop.
Save roamlog/583929 to your computer and use it in GitHub Desktop.
javascript:var d=document,w=window,f='https://twitter.com/share',l=d.location,e=encodeURIComponent,c=w.getSelection?w.getSelection().toString():d.getSelection?d.getSelection():d.selection.createRange().text;p='?url='+e(l.href)+'&text='+ e(c?c:d.title);a=function(){if(!w.open(f+p,'Tweet Button','toolbar=0,status=0,resizable=0,width=550,height=400,left=200,top=200'))l.href=f+'.new'+p};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else{a()}void(0);
@roamlog
Copy link
Author

roamlog commented Sep 17, 2010

@jinnli 昨天贴了段 twitter bookmarklet 的代码给我 (http://tinypaste.com/f4f30), 有那么一点点问题, 如果我选中了一段文本后,还是会提取页面的 title 到弹出页面的输入框中, 所以稍微修改了一下.

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