User:Bassem JARKAS/microblog.js

// Adds option to share link to the current page in social networks and email

addOnloadHook(function {   if(wgIsArticle) {        var shortcut = wgArticleId.toString(36),        url = 'http://defn.me/r/' + wgContentLanguage + '/' + shortcut,	$(document).ready(function{ var socialShares= [ {                    'title':'Email', 'url':'mailto:?subject='+encodeURIComponent(mw.config.get('wgPageName'))+'&body='+wgServer+'/wiki/'+encodeURIComponent(mw.config.get('wgPageName')), 'img':'//upload.wikimedia.org/wikipedia/commons/4/42/Icon_External_Link_E-Mail.png' },	{                    'title':'Facebook', 'url':'http://www.facebook.com/sharer.php?u='+wgServer+'/wiki/'+encodeURIComponent(mw.config.get('wgPageName')), 'img':'//upload.wikimedia.org/wikinews/en/5/55/Facebook.png' },	{                    'title':'Twitter', 'url':'http://twitter.com/?status='+encodeURIComponent('See page: \n'+wgPageName+'\non Wikipedia'), 'img':'//upload.wikimedia.org/wikinews/en/f/f7/Twitter.png' }	];	 try { var whatLinksItem= $( "#t-whatlinkshere" ); if ( !whatLinksItem.length) return; var shareText=$( " Share: " ); $(socialShares).each(function{	        var socialSpan= $( "  " );	         var socialA= $( '',{href:this.url,title:this.title} );	if(this.title!='Email') socialA.click(function{ window.open(this.href,'Share','toolbar=0,status=0,resizable=1,width=550,height=400'); return false; });        var socialImg= $( ' ', {'src': this.img});         socialA.append(socialImg);         socialSpan.append(socialA);         shareText.append(socialSpan); }); var item = $( "",{id:'t-socialShare'} ); item.append( shareText); whatLinksItem.before ( item); } catch(e) {   return; } });

} });