Advertisement
Francoo

Short

Jan 2nd, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript:(function()%20{var%20l%20=%20(document.querySelector('[rev~="canonical"]')%20||%20document.querySelector('[rel~="alternate"][rel~="short"]')%20||%20document.querySelector('[rel~="shortlink"]')%20||%20document.querySelector('[rel~="shorturl"]')%20||%20document.querySelector('[rel~="alternate"][rel~="shorter"]'));var%20sec%20=%20(parent.document.location.protocol);if%20(l)%20{prompt("Short%20URL:",%20l.getAttribute('href'));}%20else%20if%20(sec%20==%20'https:')%20{window.shortUrlBookmarkletCallback%20=%20function(bitly)%20{if%20(bitly.status_code%20===%20200)%20{prompt("Bit.ly%20URL%20(SSL):",%20bitly.data.url);}%20else%20{alert("Bit.ly%20Error%20(SSL):"%20+%20bitly.status_txt);}};var%20s%20=%20document.createElement('script');s.type%20=%20'text/javascript';s.src%20=%20('https://api-ssl.bit.ly/v3/shorten'+%20'?longURL='%20+%20encodeURIComponent(window.location.href)+%20'&domain=j.mp'+%20'&format=json'+%20'&callback=shortUrlBookmarkletCallback'+%20'&login=[INSERIR_LOGIN]'+%20'&apiKey=[INSERIR_APIKEY]');document.querySelector('body').appendChild(s);}%20else%20{window.shortUrlBookmarkletCallback%20=%20function(bitly)%20{if%20(bitly.status_code%20===%20200)%20{prompt("Bit.ly%20URL:",%20bitly.data.url);}%20else%20{alert("Bit.ly%20Error:"%20+%20bitly.status_txt);}};var%20s%20=%20document.createElement('script');s.type%20=%20'text/javascript';s.src%20=%20('http://api.bit.ly/v3/shorten'+%20'?longURL='%20+%20encodeURIComponent(window.location.href)+%20'&domain=j.mp'+%20'&format=json'+%20'&callback=shortUrlBookmarkletCallback'+%20'&login=[INSERIR_LOGIN]'+%20'&apiKey=[INSERIR_APIKEY]');document.querySelector('body').appendChild(s);}})();
  2.  
  3. PS:Antes de usar, substituir [INSERIR_APIKEY] e [INSERIR_LOGIN] pelos respectivos!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement