Skip to content

Instantly share code, notes, and snippets.

@norio-nomura
Created April 25, 2011 01:04
Show Gist options
  • Save norio-nomura/940027 to your computer and use it in GitHub Desktop.
Save norio-nomura/940027 to your computer and use it in GitHub Desktop.
Twitter で共有
javascript:(function(){
var w = window,
d = w.document,
enc = w.encodeURIComponent,
j = (w.getSelection || d.getSelection),
k = d.selection,
l = d.location,
t = d.title,
s = (j ? j() : (k ? k.createRange().text : 0)),
s2 = ((s.toString() === '') ? t : (t + ' "' + s + '"'));
w.open('https://twitter.com/intent/tweet?text=' + enc(s2) + '&url=' + enc(l));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment