Skip to content

Instantly share code, notes, and snippets.

@cuter44
Created December 30, 2013 16:59
Show Gist options
  • Select an option

  • Save cuter44/8184723 to your computer and use it in GitHub Desktop.

Select an option

Save cuter44/8184723 to your computer and use it in GitHub Desktop.
[Bookmarklet]send page URL and selection via e-mail, adapted from douban bookmarklet.
javascript:void(
function()
{
var to=prompt("收件人","[email protected]"),
d=document,
e=encodeURIComponent,
s1=window.getSelection,
s2=d.getSelection,
s3=d.selection,
s=s1?s1():s2?s2():s3?s3.createRange().text:'',
r='mailto:'+to+'?subject=[发射!]'+e(d.title)+'&body='+e(d.location.href)+'%20'+s,
x=function()
{
if (!window.open(r,'抄送','toolbar=0,resizable=1,scrollbars=yes,status=1,width=500,height=360'))
location.href=r;
};
if (/Firefox/.test(navigator.userAgent))
{
setTimeout(x,0);
}else{
x();
}
}
)();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment