Skip to content

Instantly share code, notes, and snippets.

@ozh
Created October 21, 2012 19:17
Show Gist options
  • Save ozh/3928158 to your computer and use it in GitHub Desktop.
Save ozh/3928158 to your computer and use it in GitHub Desktop.
YOURLS to TweetButton
javascript:(function(){var d=document,s=d.createElement('script');window.yourls_callback=function(r){if(r.short_url){javascript:window.open('https://twitter.com/intent/tweet?text='+encodeURIComponent(' '+r.short_url+' '+d.title.replace(/^[ ]+|[ ]+$/g, '')),'Tweet','width=400,height=260');}else{alert('An error occured: '+r.message);}};s.src='http://u.vanu.jp/admin/index.php?u='+encodeURIComponent(d.location.href)+'&jsonp=yourls';void(d.body.appendChild(s));})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment