MediaWiki:SocialWidgets.js

/** * @name SocialWidgets * @author Manuel de la Fuente (https://manuelfte.com) * @version 1.0.0 * @license CC-BY-SA-3.0 * @description Inserts widgets for social networks at the top of the sidebar */ /* eslint-env jquery */ (function {  var cfg = window.mw.config.get([ 'wgIsMainpage', 'wgPageName' ]);

var generalModule = '' + ' Follow us! ' +     ' ' +    ' ';

var homeModule = ' ';

function getJS (url) { $.getScript(url, function (data) {     return data;    }); }

getJS('https://apis.google.com/js/platform.js'); // Inserts Google SDK $(window).load(function { // Fires the rest after page has finished loading    if (cfg.wgIsMainpage !== true) { // If it's not the homepage      if ($('#TOP_RIGHT_BOXAD').length) { // Checks if there are ads        $('#TOP_RIGHT_BOXAD').after(generalModule, $('#wikia-recent-activity')); // Inserts module and Recent Wiki Activity (if there is) below ads      } else if (cfg.wgPageName === 'Special:WikiActivity') { // If there are no ads, checks if it's Special:WikiActivity        $('#WikiaRail').prepend(generalModule, $('.CommunityCornerModule')); // Inserts module and Community Corner at the top of the sidebar      } else { // If there are no ads and it isn't Special:WikiActivity        $('#WikiaRail').prepend(generalModule, $('#wikia-recent-activity')); // Inserts modules at the top of the sidebar      }    } else { // If it's the homepage      $('#home-social-widgets').html(homeModule); // Inserts home module }   getJS('http://platform.twitter.com/widgets.js'); // Inserts Twitter SDK }); });