Skip to content

Instantly share code, notes, and snippets.

@watagashi
Created October 4, 2010 12:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save watagashi/609613 to your computer and use it in GitHub Desktop.
Share with Quoting Bookmarklet | dev.twitter.com http://t.co/khZ0IUy
javascript:(function(){window.twttr=window.twttr||{};var%20D=550,A=450,C=screen.height,B=screen.width,H=Math.round((B/2)-(D/2)),G=0,F=document,E;if(C>A){G=Math.round((C/2)-(A/2))}window.twttr.shareWin=window.open('http://twitter.com/share','','left='+H+',top='+G+',width='+D+',height='+A+',personalbar=0,toolbar=0,scrollbars=1,resizable=1');E=F.createElement('script');E.src='https://raw.github.com/gist/609613/sharetweet.js';F.getElementsByTagName('head')[0].appendChild(E)}());
(function(){function B(L){var M=[],K=0,J=L.length;for(;K<J;K++){M.push(L[K])}return M}function G(J){return encodeURIComponent(J).replace(/\+/g,"%2B")}function C(L){var K=[],J;for(J in L){if(L[J]!==null&&typeof L[J]!=="undefined"){K.push(G(J)+"="+G(L[J]))}}return K.sort().join("&")}function H(){var K=document.getElementsByTagName("a"),Q=document.getElementsByTagName("link"),J=/\bme\b/,M=/^https?\:\/\/(www\.)?twitter.com\/([a-zA-Z0-9_]+)$/,P=B(K).concat(B(Q)),O,S,L,N=0,R;for(;(R=P[N]);N++){S=R.getAttribute("rel");L=R.getAttribute("href");if(S&&L&&S.match(J)&&(O=L.match(M))){return O[2]}}}function F(K){var J;if(K.match(/^https?:\/\//)){return K}else{J=location.host;if(location.port.length>0){J+=":"+location.port}return[location.protocol,"//",J,K].join("")}}function I(){var J=document.getElementsByTagName("link");for(var K=0,L;(L=J[K]);K++){if(L.getAttribute("rel")=="canonical"){return F(L.getAttribute("href"))}}return null}var D=(function(){var K={text:decodeURIComponent(
function(){
var t;
if (document.selection)
t = document.selection.createRange().text;
else if(document.getSelection)
t = document.getSelection();
else if(window.getSelection)
t = window.getSelection();
return (t?'"' + t + '" ':" > ") + document.title;
}()
),url:(I()||location.href),_:((new Date()).getTime())};var J=H();if(J){K.via=J}return C(K)}());var E=window.twttr.shareWin,A="http://twitter.com/share?"+D;if(E&&E.open){E.location.href=A;E.focus()}else{window.location.href=A}}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment