User:DeXart/global.js

$(function { $(' VSTF  ').insertBefore('.wds-global-navigation__search'); $(' Administracja  ').insertBefore('.wds-global-navigation__search'); $(' Obrazy  ').insertBefore('.wds-global-navigation__search'); }); $(window).load(function {   importArticles({ type: "script", articles: [ 'u:dev:MediaWiki:AjaxBatchDelete/code.js', 'u:dev:MediaWiki:AjaxBatchUndelete/code.js', 'u:dev:MediaWiki:AjaxDiff/code.js', 'u:dev:MediaWiki:AjaxRedirect/code.js', 'u:dev:MediaWiki:AjaxRename/code.js', 'u:dev:MediaWiki:AjaxRC/code.js', 'u:dev:MediaWiki:AjaxUndo/code.js', 'u:dev:MediaWiki:FastDelete/code.js', 'u:dev:MediaWiki:LastEdited/code.js', 'u:dev:MediaWiki:NullEditButton/code.js', 'u:dev:MediaWiki:PortableCSSPad/code.js', 'u:dev:WHAM/code.2.js', 'u:dev:MediaWiki:SearchSuggest/code.js', 'u:dev:MediaWiki:DisableCode/code.js', 'u:dev:MediaWiki:AnchoredRollback/code.js', 'u:dev:MediaWiki:Rollback/code.2.js', 'u:dev:QuickCreateUserPage/code.js' ]   }); }); // RC instead of WA under the icon in new nav // Author: Nanaki $(function {   $('.wds-community-header__wiki-buttons a[data-tracking="wiki-activity"]').attr({href: '/wiki/Special:RecentChanges', title: 'Ostatnie zmiany', 'data-tracking': 'recent-changes'}); }); // Additional icon that links to Special:Upload // Author: Nanaki $(function {   var newpage = $('.wds-community-header__wiki-buttons a[data-tracking="add-new-page"]');    newpage.clone.attr({href: '/wiki/Special:Upload', title: 'Prześlij plik', 'data-tracking': 'upload'}).insertAfter(newpage).find('svg').attr('id', '').html('<path d="M 8.984375 0.98632812 A 1.0001 1.0001 0 0 0 8.203125 1.3828125 L 4.2929688 5.2929688 A 1.0001 1.0001 0 1 0 5.7070312 6.7070312 L 8 4.4140625 L 8 12 A 1.0001 1.0001 0 1 0 10 12 L 10 4.4140625 L 12.292969 6.7070312 A 1.0001 1.0001 0 1 0 13.707031 5.2929688 L 9.7910156 1.3769531 A 1.0001 1.0001 0 0 0 8.984375 0.98632812 z M 2.984375 10.986328 A 1.0001 1.0001 0 0 0 2 12 L 2 16 A 1.0001 1.0001 0 0 0 3 17 L 15 17 A 1.0001 1.0001 0 0 0 16 16 L 16 12 A 1.0001 1.0001 0 1 0 14 12 L 14 15 L 4 15 L 4 12 A 1.0001 1.0001 0 0 0 2.984375 10.986328 z "> '); }); // Bypass Special:InfoboxBuilder // Author: Nanaki if($('.template-classification-type-text').data('type') == 'infobox') $('#ca-edit').attr('href', function(a) { return this.href + '&useeditor=source'; }) // ChangeSkins window.monoBookText = "Monobook"; window.oasisText = "Oasis"; window.venusText = "Venus"; window.mobileText = "Mobile"; importScriptPage('MediaWiki:SkinSwitchButton/code.js', 'dev'); // LICENSES FILE function emptyLicenseAlert(form) { var msg = "Licencja pliku nie została wybrana. Możesz spróbować ponownie, ale pamiętaj, że pliki bez licencji są usuwane." if(window.emptyLicenseWarningDelivered) return true; if($('#wpLicense').val == '') { alert(msg); window.emptyLicenseWarningDelivered = true return false }	return true; } $('#mw-upload-form').submit(function(e) {return emptyLicenseAlert(this);}); $(".wikia-gallery-item .thumbimage").each(function(i,elem) {		$(elem).attr('title',$(elem).attr('alt'));	}); $(".wikia-gallery-item .image").each(function(i,elem) {		$(elem).attr('title',$(elem).attr('alt')); }); /* ================================================ * Sprawdzanie urodzin by User:Duckey Detective * ================================================ */ var bday = { users: ['Baakamono', 'Bartd94', 'Benios912', 'Ciastkoo', 'Damian102', 'DarknessEyes23', 'DeXart', 'Diode24q', 'Duckey Detective', 'Ex q', 'Freshyy', 'Isthealice', 'Kung Führer', 'Light22', 'Lukisiak', 'Luqgreg', 'MaciekP42', 'Matik7', 'Marchewka97', 'MesserWoland', 'Myslec', 'Nanaki', 'Ofkorse', 'OwocekTV', 'Painto', 'Pio387', 'PiotrekD', 'Pirr', 'ProOski', 'Rafi862', 'Railfail536', 'RavenZuza', 'Runouw', 'Sandy97', 'Szynka013', 'Tragolipus', 'Vengir', 'Vuh', 'Wedkarski', 'WindMarine12'], debug: true, init: function init { bday.log('Initializing'); if (typeof Storage === "undefined") { bday.log('localStorage isn\'t supported by your browser', 'error'); return; }   var userName = mw.config.get('wgUserName'); var d = new Date; var storage = JSON.parse(localStorage.getItem('bday')); var today = d.getFullYear + '-' + (d.getMonth + 1) + '-' + d.getDate; bday.log('userName: ' + userName); bday.log('today: ' + today); if (storage === null || !storage[today]) { bday.log('No checks today'); var obj = {}; obj[today] = true; localStorage.setItem('bday', JSON.stringify(obj)); new mw.Api.get({       action: 'query',        list: 'users',        ususers: bday.users.join('|')      }).done(function (data) {        bday.log('Users id obtained');        var _loop = function _loop {          if (_isArray) {            if (_i >= _iterator.length) return 'break';            _ref = _iterator[_i++];          } else {            _i = _iterator.next;            if (_i.done) return 'break';            _ref = _i.value;          }          var user = _ref;          $.ajax({ url: 'https://services.wikia.com/user-attribute/user/' + user.userid }).done(function (data) { for (var _iterator2 = data._embedded.properties, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator];;) { var _ref2; if (_isArray2) { if (_i2 >= _iterator2.length) break; _ref2 = _iterator2[_i2++]; } else { _i2 = _iterator2.next; if (_i2.done) break; _ref2 = _i2.value; }             var prop = _ref2; if (prop.name === 'UserProfilePagesV3_birthday') { bday.log('birthday found: ' + prop.value + ' - ' + user.name); if (prop.value === d.getMonth + 1 + '-' + d.getDate) { bday.log(user.name + '\'s birthday'); var message = user.name === userName ? 'Wszystkiego najlepszego!' : user.name + ' ma dziś urodziny!'; if ($('#WikiaNotifications').length === 0) { bday.log('creating WikiaNotifications'); $('#WikiaBarWrapper').append(' ' + message + ' '); } else { bday.log('WikiaNotifications exists'); $('#WikiaNotifications').append(' ' + message + ' '); }               }              }            }          }).fail(function  { bday.log('Couldn\'t get user data', 'error'); });       };        for (var _iterator = data.query.users, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator];;) {         var _ref;          var _ret = _loop;          if (_ret === 'break') break;        }      }); } else { bday.log('Already checked today. Aborting', 'warn'); } },  refresh: function refresh { bday.log('Refreshing', 'warn'); localStorage.removeItem('bday'); bday.log('localStorage cleared'); bday.init; }, log: function log(msg) { var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'log'; if (bday.debug === true) { var prefixed = 'BDAY: ' + msg + '.'; switch (type) { case 'log': console.log(prefixed); break; case 'warn': console.warn(prefixed); break; case 'error': console.error(prefixed); break; default: console.log(prefixed); break; }   }  } }; mw.loader.using('mediawiki.api').then(function  {  bday.init; }); // INFOBOX BULDIER BLOCKER by Vuh if ($('.template-classification-type-text').data('type') == 'infobox') $('#ca-edit').attr('href', function(a) {   return this.href + '&useeditor=source'; }) if(window.location.pathname.indexOf('Special:InfoboxBuilder') != -1) {var pname = window.location.pathname.split('Special:InfoboxBuilder/')[1]; location.replace(document.URL.replace(window.location.href.split('/wiki/')[1],'Template:'+pname+'?action=edit&useeditor=source'));} // by DUCKEY importArticle({   type: 'script',    article: 'u:pl.duckey:User:Duckey_Detective/common.js' }); importArticle({   type: 'style',    article: 'u:pl.duckey:User:Duckey_Detective/common.css' });