Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/*
 * Adds option to share link to the current page in social networks and email
 * Written by [[:he:User:ערן]] 
 *
 */ 
 
$(function(){
var pageName = mw.config.get('wgPageName');
var title = mw.config.get('wgTitle');
var articleId = mw.config.get('wgArticleId');
var server = 'https://' + mw.config.get('wgServerName');
var pageurl = "//mai.wikipedia.org/wiki/" + pageName;
var shortcut = articleId.toString(36);
var shortLink = $('#t-shorturl a').attr('href');
var tinyUrl = (typeof shortLink === "string") ? shortLink.slice(2) : "(error)";

if (typeof tinyUrl === "undefined") tinyUrl = location.href;
  var socialShares= [
 {
                     'title':'ਈਮੇਲ',
                     'url':'mailto:?subject='+encodeURIComponent(pageName.replace(/ /g,'_'))+'&body='+server+'/wiki/'+encodeURIComponent(pageName.replace(/ /g,'_')),
                     'img':'//upload.wikimedia.org/wikipedia/commons/4/42/Icon_External_Link_E-Mail.png'
 },
 {
                     'title':'ਫੇਸਬੁੱਕ',
                     'url':'http://www.facebook.com/sharer.php?u='+server+'/wiki/'+encodeURIComponent(pageName.replace(/ /g,'_'))+'&t='+encodeURIComponent(pageName.replace(/ /g,'_')),
                     'img':'//upload.wikimedia.org/wikinews/en/5/55/Facebook.png'
 },
 {
                     'title':'ਟਵਿਟਰ',  
                     'url':'http://twitter.com/?status='+encodeURIComponent('' + title +' ' +tinyUrl +' ' ),
                     'img':'//upload.wikimedia.org/wikinews/en/f/f7/Twitter.png'
 }
];
 
  try {
 
    var whatLinksItem= $('#t-whatlinkshere');
    if (!whatLinksItem.length) return;
 
        var shareText=$('<span>ਸਾਂਝਾ ਕਰੋ: </span>');
 
$(socialShares).each(function(){
         var socialSpan= $('<span>');
         var socialA= $('<a>').attr({href:this.url,title:this.title});
if(this.title!='ਈਮੇਲ') socialA.click(function(){
 window.open(this.href,'ਸਾਂਝਾ ਕਰੋ','toolbar=0,status=0,resizable=1,width=550,height=400');
return false;
});
 
         var socialImg= $('<img>').attr({'src': this.img});
         socialA.append(socialImg);
         socialSpan.append(socialA);
         shareText.append(socialSpan);
});
 
        var item = $('<li>').attr({id:'t-socialShare'});
        item.append(shareText);
        whatLinksItem.before(item);
 
  }
  catch(e)
  {
    return;      // lets just ignore what's happened
  }
});