exploring the Tweet Button

by Joe Saad

HTML

<a href="https://twitter.com/share" class="twitter-share-button" data-lang="en">Test Link</a>
<script>
    $(function(){
        $('a.twitter-share-button').trigger("click");
    });
    
    /*    !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
    */
    
    
</script>

<a id="tweetThis" href="javascript:(function(){window.twttr=window.twttr||{};var D=550,A=450,C=screen.height,B=screen.width,H=Math.round((B/2)-(D/2)),G=0,F=document,E;if(C&gt;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='http://platform.twitter.com/bookmarklets/share.js?v=1';F.getElementsByTagName('head')[0].appendChild(E)}());">Test 2</a>

JavaScript

//document.getElementById("tweetThis").click();


(function(){
    window.twttr=window.twttr||{};
       var D=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='http://platform.twitter.com/bookmarklets/share.js?v=1';
    F.getElementsByTagName('head')[0].appendChild(E);
}());