Last active
May 30, 2018 02:45
-
-
Save risent/cf4eb684ed21ad9ef62ffaa1d3b01993 to your computer and use it in GitHub Desktop.
Twitter Shared Button Bookmarlet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fcuntion() { | |
var text = encodeURIComponent(window.getSelection().toString() || window.document.title); | |
var url = encodeURIComponent(window.location.href); | |
var dstUrl = 'https://twitter.com/intent/tweet?url=' + url + '&text=' + text; | |
var windowName = 'Tweet Intent'; | |
var features = 'width=600,height=350,left=600,top=200'; | |
window.open(dstUrl, windowName, features); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function()%7Bwindow.twitter%20%3D%20window.twitter%20%7C%7C%20%7B%7D%3Bvar%20text%20%3D%20encodeURIComponent(window.getSelection().toString()%20%7C%7C%20window.document.title)%3Bvar%20url%20%3D%20encodeURIComponent(window.location.href)%3Bvar%20dstUrl%20%3D%20'https%3A%2F%2Ftwitter.com%2Fintent%2Ftweet%3Furl%3D'%20%2B%20url%20%2B%20%20%20'%26text%3D'%20%2B%20text%3Bvar%20windowName%20%3D%20'Tweet%20Intent'%3Bvar%20features%20%3D%20'width%3D600%2Cheight%3D350%2Cleft%3D600%2Ctop%3D200'%3Bwindow.open(dstUrl%2C%20windowName%2C%20features)%7D)() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tweet