User:Rangilo Gujarati/media.js

/* * Adds option to share link to the current page in social networks and email * Written by he:User:ערן * */ $(document).ready(function{ var pageurl = "http://gu.wikipedia.org/wiki/" + encodeURIComponent(wgPageName); //var shortcut = wgArticleId.toString(36); var socialShares= [ {                     'title':'e mail',                     'url':'mailto:?subject='+encodeURIComponent(wgPageName.replace(/ /g,'_'))+'&body=http:'+wgServer+'/wiki/'+encodeURIComponent(wgPageName.replace(/ /g,'_')),                     'img':'//upload.wikimedia.org/wikipedia/commons/4/42/Icon_External_Link_E-Mail.png'        }, {                     'title':'facebook',                     'url':'http://www.facebook.com/sharer.php?u=http:'+wgServer+'/wiki/'+encodeURIComponent(wgPageName.replace(/ /g,'_'))+'&t='+encodeURIComponent(wgPageName.replace(/ /g,'_')),                     'img':'//upload.wikimedia.org/wikinews/en/5/55/Facebook.png'                     }, {                     'title':'twitter',                       'url':'http://twitter.com/?status='+encodeURIComponent('read in gujarati wp: ' + wgTitle +' ' +pageurl +' #tawp' ), '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!='E-mail') 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;      // lets just ignore what's happened } });