title: How to make an Instant Shorten link for a url shortener
body: <p>I have recently made a <a href="http://n1x.co.uk" rel="nofollow">url shortener</a> and I want to make an "Instant Shorten" Bookmark link on my site, like <a href="http://yourls.org/#About" rel="nofollow">YOURLS</a> can, so you bookmark the link, then go to any webpage, then you click on the bookmark and it automatically shortens the address, adds it to the database and tells you the shortened url in a pop-up. </p>
  
  <p>I'm not sure how to do this, please help me!</p>
  
  <p><strong>Edit:</strong> This is the code that YOURLS currently uses to shorten using the bookmark link:</p>
  
  <p><code>javascript:(function()%7Bvar%20d=document,s=d.createElement('script');window.yourls_callback=function(r)%7Bif(r.short_url)%7Bprompt(r.message,r.short_url);%7Delse%7Balert('An%20error%20occured:%20'+r.message);%7D%7D;s.src='http://nix-pix.co.uk/public/admin/index.php?u='+encodeURIComponent(d.location.href)+'&amp;jsonp=yourls';void(d.body.appendChild(s));%7D)();</code></p>