I have recently made a url shortener and I want to make an "Instant Shorten" Bookmark link on my site, like YOURLS 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.
I'm not sure how to do this, please help me!
Edit: This is the code that YOURLS currently uses to shorten using the bookmark link:
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)+'&jsonp=yourls';void(d.body.appendChild(s));%7D)();
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…