Skip to content

Instantly share code, notes, and snippets.

@1rick
Created August 28, 2013 03:32
Show Gist options
  • Save 1rick/6361866 to your computer and use it in GitHub Desktop.
Save 1rick/6361866 to your computer and use it in GitHub Desktop.
Quickpost to Drupal via prepopulate module ref: http://qiita.com/1rick/items/df199d87762d34897d91
javascript:var nodeaddpath="http://www.example.com/fugu/node/add/article",d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=e?e():k?k():x?x.createRange().text:0,l=d.location,e=encodeURIComponent,title=""+d.title+"",body="> "+s+"\n\nFrom ["+d.title+"]("+d.location+")",url=nodeaddpath+"?edit[title]="+e(title)+"&edit[body][und][0][value]="+e(body);nourl=function(){w.location=nodeaddpath};a=function(){w.open(url,"quickpost","toolbar=0,resizable=1,scrollbars=1,status=1,width=424,height=570")||(l.href=url)};/Firefox/.test(navigator.userAgent)?"about:blank"==l?setTimeout(nourl,0):setTimeout(a,0):"about:blank"==l?nourl():a();;void(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment