📜 ⬆️ ⬇️

Quickly send to twitter the shortened address of the page you are viewing

image
After the appearance of simple bookmarklets to get an abbreviated link of the current page (for goo.gl , and for bit.ly ), I realized that a logical continuation should be a bookmarklet for sending this shortened link to twitter. As a result, a very convenient tool was born, as for me.



So, as usual, create a bookmark and paste the following code into its URL:
')
javascript:window.bitly_callback=function(response){if(response.errorCode)alert("Error: "+response.errorMessage);else{var text="";if(document.getSelection)text=document.getSelection();else if(document.selection&&document.selection.createRange)text=document.selection.createRange().text; document.location="http://twitter.com/home/?status="+text+" "+response.results[window.location.href].shortCNAMEUrl}};var s=document.createElement("script"); s.src="http://api.bit.ly/shorten?version=2.0.1&longUrl="+encodeURIComponent(window.location.href)+"&login=twshorten&apiKey=R_17f3f726d1661bbebbdcb571489724dc&callback=bitly_callback"; void document.body.appendChild(s); 


Now, being on an interesting page, we click on our bookmarklet and automatically get into twitter, and the abbreviated link is already inserted in the message field

image

it only remains to add a couple of words.

Chip

if you are on an interesting page before clicking on the bookmarklet select some text

image

it will automatically be added before the link in the message field

image

now you just need to press the Update button :)

Source: https://habr.com/ru/post/81576/


All Articles