Skip to content

Instantly share code, notes, and snippets.

@avorio
Created March 7, 2015 11:32
Show Gist options
  • Save avorio/f732f1733b03e04e411b to your computer and use it in GitHub Desktop.
Save avorio/f732f1733b03e04e411b to your computer and use it in GitHub Desktop.
Sending links to Colette using a bookmarklet
javascript: var siteURL='colette', nodeType='link', 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, url='http://'+siteURL+'/node/add/'+nodeType+'?edit[title]='+e(d.title); if(s) { url+='&edit[body][und][0][value]='+e(s); url+='&edit[field_url][und][0][url]='+l;} a=function(){if(!w.open(url,'quickpost','toolbar=0,resizable=1,scrollbars=1,status=1,width=1024,height=570')) l.href=url;}; if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0); else a();void(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment