MediaWiki:SocialWidgets.js

/** * @name SocialWidgets * @author Manuel de la Fuente (https://manuelfte.com) * @version 1.1.8 * @license CC-BY-SA-3.0 * @description Inserts widgets for social networks at the top of the sidebar */ /* eslint-env jquery */ $(window).load(function {  'use strict';

console.log('SocialWidgets v1.1.8');

var cfg = window.mw.config.get([   'wgIsMainpage',    'wgPageName'  ]); var twitter = '' + 'Follow @AoTWiki' + ' '; var sidebarFacebook = ' '; var instagram = function (width) { return '' + '<iframe scrolling="no" style="border: none; height: 80px; overflow: hidden; width: ' + width + 'px;" src="data:text/html;charset=utf-8,&lt;html&gt;&lt;body style=&quot;margin: 0;&quot;&gt;&lt;a href=&quot;https://instawidget.net/v/user/attackontitanwiki&quot; id=&quot;link-c91a2877988927980b42557dd8987350de1515c8eba6a70a65fabbbbd0fa36c7&quot;&gt;Follow @attackontitanwiki on Instagram&lt;/a&gt;&lt;script src=&quot;https://instawidget.net/js/instawidget.js?u=c91a2877988927980b42557dd8987350de1515c8eba6a70a65fabbbbd0fa36c7&amp;width=' + width + 'px&quot;&gt;&lt;/script&gt;&lt;/body&gt;&lt;/html&gt;"> ' + ' '; };

if ($.inArray('Spoilers', window.mw.config.get('wgCategories')) > -1) { twitter = '' + 'Tweets by @AoTWiki' + ' ';   sidebarFacebook = ' '; }

var generalModule = '' + 'Join the Attack on Titan/Shingeki no Kyojin Discord server!' + ' ' +   '' + ' Follow us! ' +     ' ' +          twitter + '' + sidebarFacebook + ' ' + instagram(270) + ' ' +   ' ';

var homeModule = twitter + '' + ' ' + ' ' +   instagram(290);

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 }

window.mw.loader.load('//platform.twitter.com/widgets.js'); });