User:Doork/global.js

window.ajaxRefresh = 100; window.ajaxPages = ["Special:RecentChanges","Special:Watchlist","Special:Log","Special:Contributions","Special:Images", "Special:WikiActivity" ]; window.AjaxRCRefreshText = 'Refresh'; window.AjaxRCRefreshHoverText = 'Refreshing'; var PrivateMessageAlert = { message: '$1 sent you a message!', notifications: true, alertWhileFocused: true };

// Quick Userpage var qtEnableUserPageOverwrite = true; var qtUserPageTemplate = '';

// Quick Access to EditCount if ($('.tally').length) { var $tally = $('.tally'); $tally.attr('title', 'EditCount'); $tally.click(function { window.location.href = wgServer + '/wiki/Special:EditCount/' + $('h1[itemprop="name"]').text; }); }

/* Scripts */ $(window).load(function {   importArticles({ type: "script", articles: [ 'u:dev:MediaWiki:ViewRemoved/code.js', 'u:dev:MediaWiki:View_Source/code.js', 'u:dev:MediaWiki:WallGreetingButton/code.js', 'u:dev:MediaWiki:PurgeButton/code.js', 'u:dev:MediaWiki:Rollback/code.js', 'u:dev:QuickCreateUserPage/code.js', 'u:dev:MediaWiki:MassCategorization/code.js', 'u:dev:MediaWiki:RevealAnonIP/usercode.js', 'u:dev:MediaWiki:DisplayClock/code.js', 'u:dev:MediaWiki:ExternalImageLoader/code.js', 'u:dev:MediaWiki:ListFiles/code.js', 'u:dev:MediaWiki:MultipleFileDelete/code.js', 'u:dev:MediaWiki:QuickComments/code.js', 'u:dev:MediaWiki:UnsafeScripts/code.js', 'u:dev:MediaWiki:QuickThreads/code.js', 'u:dev:MediaWiki:AjaxBlock/code.js', 'u:dev:MediaWiki:CleanWantedFiles/code.js', 'u:dev:MediaWiki:AjaxBatchUndelete/code.js', 'u:dev:MediaWiki:AjaxBatchDelete/code.js', 'u:dev:MediaWiki:AjaxThreadUnfollow/code.js', 'u:dev:MediaWiki:MassBlock/code.js', 'u:dev:MediaWiki:MassProtect/code.js', 'u:dev:MediaWiki:MassUserRights/code.js', 'u:dev:MediaWiki:Linksweeper/code.js', 'u:admintools:MediaWiki:Common.js/ajaxRollback.js', 'u:dev:MediaWiki:MassCategorization/code.js', 'u:dev:MediaWiki:QuickDiff/code.js', 'u:botcentral:User:Peridoork/wikia.js', 'u:dev:Mediawiki:AjaxRC/code.js', 'u:botcentral:User:Ditto_Creeper_Bot/spamreport', 'u:dev:QuickToolsv2/code.js' ]   }); });

/* QuickAccessToGlobalPages * Original code by User:JPhil2.0 (can be found in http://community.wikia.com/wiki/User:JPhil2.0/global.js?diff=2017878&oldid=2017872) * Modified and fixed by User:Ultragustavo25 */ if(!window.CustomButtonsLoaded) addOnloadHook(addCustomLinks); var CustomButtonsLoaded = true; var i18n = { en: { js: "Global JS", css: "Global CSS", localcommoncss: "Local Common CSS", localcommonjs: "Local Common JS", localchatcss: "Local Chat CSS", localchatjs: "Local Chat JS" },   es: { js: 'JS global', css: 'CSS global', localcommoncss: "CSS Común local", localcommonjs: "JS Común local", localchatcss: "Local Chat CSS", localchatjs: "Local Chat JS" },   'pt-br': { js: "JS global", css: "CSS global", localcommoncss: "CSS Comum local", localcommonjs: "JS Comum local", localchatcss: "CSS local Chat", localchatjs: "JS local Chat" },   pt: { js: "JS global", css: "CSS global", localcommoncss: "CSS Comum local", localcommonjs: "JS Comum local", localchatcss: "CSS local Chat", localchatjs: "JS local Chat" } }; i18n = i18n[mw.config.get("wgUserLanguage")] || i18n[mw.config.get("wgContentLanguage")] || i18n.en; function addCustomLinks { $('' + i18n.js + '').insertBefore('.wds-global-navigation__user-menu li:last'); $('' + i18n.css + '').insertBefore('.wds-global-navigation__user-menu li:last'); $('' + i18n.localcommoncss + '').insertBefore('.wds-global-navigation__user-menu li:last'); $('' + i18n.localcommonjs + '').insertBefore('.wds-global-navigation__user-menu li:last'); $('<a class="wds-global-navigation__dropdown-link" href="/Special:Mypage/chat.css">' + i18n.localchatcss + '</a></li>').insertBefore('.wds-global-navigation__user-menu li:last'); $('<a class="wds-global-navigation__dropdown-link" href="/Special:Mypage/chat.js">' + i18n.localchatjs + '</a></li>').insertBefore('.wds-global-navigation__user-menu li:last'); }

/*
 * A modified version of WHAM with a more up-to-date modal
 * Includes functionality to delete forum/message wall threads and selective deleting of pages, which the original doesn't have
 * Original "WHAM" - http://dev.wikia.com/wiki/WHAM/code.js
 * @author Ozuzanna
 * @TODO interlang message translations

var ug = mw.config.get("wgUserGroups"); if (mw.config.get("wgCanonicalSpecialPageName") === "Contributions" && (ug.indexOf('rollback') + ug.indexOf('content-moderator') + ug.indexOf('sysop') + ug.indexOf('vstf') + ug.indexOf('staff') + ug.indexOf('helper') > -6)) {
 * (function($, mw) {

/*    var walls = [ "Message Wall",        // en        "Nachrichtenseite",     // de		"Muro",                 // es        "Viestiseinä",          // fi        "Mur",                  // fr        "Üzenőfal",             // hu        "Bacheca",              // it        "メッセージ ウォール",  // ja        "메시지_담벼락",        // ko        "Prikbord",             // nl        "Tablica wiadomości",   // pl        "Mural de mensagens",   // pt, pt-br "Стіна обговорення",   // uk        "Стена обсуждения",     // ru        "Tường tin nhắn",       // vi        "留言墙"                // zh    ], username = mw.config.get("wgPageName").split("/")[1], token = mw.user.tokens.get("editToken"), delay = window.WHAMDelay || 100, Api = new mw.Api, $("#contentSub").append(' <a style="color:red;cursor:pointer" id="contribs-wham" title="Super Tool">Quick Tools</a>');
 * Message wall equivalents list, used to prevent deletion of message walls (causes glitches and not necessary)
 * Acquired from https://github.com/Wikia/app/blob/a0c00a44254d958fcd06514b12cb6b75c88da9c0/extensions/wikia/Wall/Wall.namespaces.php

$('#contribs-wham').click(function {     $.showCustomModal('WHAM!', '', { id: 'form-main', width: 660, buttons: [{ message: 'Rollback all edits', defaultButton: true, handler: function { doRollback; }         },{          message: 'Cancel', id: 'close-wham' }]     });      mw.util.addCSS('.modalWrapper .modalContent .modalToolbar {text-align:left;}');      $('#close-wham').after(' ');      $('#close-wham,.close').click(function { $('#form-main').closeModal; location.reload; });

function doRollback { $('.mw-rollback-link a').each(function(i) {       var href = $(this).attr('href') + "&bot=1";        setTimeout(function { $.get(href); if ($('.mw-rollback-link a').length > 0) $('#status-wham').html('Rollbacking... please wait <img src="http://slot1.images.wikia.nocookie.net/__cb62004/common/skins/common/progress-wheel.gif"/>'); if (i === $('.mw-rollback-link a').length - 1) $('#status-wham').html('Rollbacks complete!'); }, i*delay);     }); }

}) (this.jQuery, this.mediaWiki);