User:JustLeafy/global.js

//__NOWYSIWYG__ /* Imports */ importArticles({   type: 'script',    articles: [        'u:dev:AjaxDelete/code.js',        'u:dev:AjaxBatchDelete.js',        'u:dev:AjaxUndo/code.js',        'u:dev:BlogLink/code.js',        'u:dev:CategoryQuickRemove.js',        'u:dev:CommentPreview/code.js',        'u:dev:ConsistentModules/code.js',        'u:justleafy:MediaWiki:DarkMeta.js',        'u:dev:DisableInfoboxBuilder.js',        'u:dev:EditBio/code.js',        'u:dev:EditConflictAlert/code.js',        'u:dev:FindAndReplace/code.js',        'u:dev:GalleryCaptions/code.js',        'u:dev:ManageReferences/code.js',        'u:dev:MassBlock/code.js',        'u:dev:MassEdit/code.js',        'u:dev:MobileEditor.js',        'u:dev:ModernLightbox.js',        'u:dev:ModernProfile/EditButton.js',        'u:dev:MoveSubcategoriesToTheTop.js',        'u:dev:MultiUpload/code.js',        'u:dev:Nuke/code.js',        'u:dev:NullEditButton/code.js', 'u:dev:PortableCSSPad/code.js', 'u:dev:PurgeButton/code.js', 'u:dev:QQX/code.js', 'u:dev:RandomPageShortcut/code.js', 'u:dev:RedirectManagement/code.js', 'u:dev:RevealAnonIP/code.js', 'u:dev:SandboxLink/code.js', 'u:dev:SandboxTab/code.js', 'u:dev:SavedDrafts.js', 'u:dev:SeeMoreActivityButton/code.js', 'u:dev:Sine/code.js', 'u:dev:UserActivityTab/code.js', 'u:dev:UserUnusedFiles.js', 'u:dev:View Source/code.js', 'u:dev:VSTFReport.js', 'u:dev:WallGreetingButton/code.js', 'u:dev:WHAM/code.2.js', 'u:dev:WLHEditLinks/code.js', ] });

//RemoveBlueOutline /* It basically removes unnecessary blue outlines except when tabbing */

importArticles({   type: 'style',    articles: [        'u:dev:RemoveBlueOutline.css'    ] }); function handleFirstTab(e) { if (e.keyCode === 9) { // the "I am a keyboard user" key document.body.classList.add('user-is-tabbing'); window.removeEventListener('keydown', handleFirstTab); } }

window.addEventListener('keydown', handleFirstTab);

var didScroll; var lastScrollTop = 0; var delta = 5; var navbarHeight = $('div#globalNavigation').outerHeight; $(window).scroll(function(event){   didScroll = true; }); setInterval(function {   if (didScroll) {        hasScrolled;        didScroll = false;    } }, 250); function hasScrolled { var st = $(this).scrollTop; if(Math.abs(lastScrollTop - st) <= delta) return; if (st > lastScrollTop && st > navbarHeight){ $('div#globalNavigation').removeClass('wds-global-navigation').addClass('wds-global-navigation-up'); } else { if(st + $(window).height < $(document).height) { $('div#globalNavigation').removeClass('wds-global-navigation-up').addClass('wds-global-navigation'); }   }    lastScrollTop = st; }

if (mw.config.get("wgUserGroups").indexOf('sysop') > -1) { window.massCategorizationDelay = 1000; importArticle({       type: 'script',        article: 'u:dev:MediaWiki:MassCategorization/code.js'    }); }

if (typeof(namespaceNotifyWiki) == "undefined") {    var namespaceNotifyWiki = 'vstf'; } if (typeof(namespaceNotifyNamespace) == "undefined") {     var namespaceNotifyNamespace = 114; } if (typeof(namespaceNotifyScriptLocation) == "undefined") {     var namespaceNotifyScriptLocation = "ul.tools"; }   function pagesUpdate {       $('head').append(''); }   function getData(dis){     $('#NamespaceNotify').html('' + dis.query.recentchanges[0].user + ' changed ' + dis.query.recentchanges[0].title + '')   };   $(document).ready(function{     if (mw.config.get('skin') == "oasis") {         $(namespaceNotifyScriptLocation).append('');         $('head').append('a#NSNotifyLink:visited {color:#77F !important;} ');     } else if (mw.config.get('skin') == "monobook") {         $('#p-personal .pBody ul:first-child').prepend('');         $('head').append('#p-personal li a#NSNotifyLink {color:#F00 !important;} #p-personal li a#NSNotifyLink:visited {color:#77F !important;} ');     }           pagesUpdate; })

/* *  * @module                  FANSUN.js * @description             Script for official wiki dark theming. * @author                 Speedit * @version                1.2.10 * @license                CC-BY-SA 3.0 * @notes                  Install FANSUN.css stylesheet(s) on the official wiki(s) to use this script. * */    // Double-run protection window.dev = window.dev || {}; if (window.dev.dark) { return; }   window.dev.dark = { cache: [] }; /**    * @class               FANSUN * @classdesc          The main FANSUN class. Contains script logic *                     for post-render dark theming. */   function FANSUN  { // Scoping to official wikis + FANSUN CSS import this.active = this.wikis.indexOf(mw.config.get('wgDBname')) > -1 && $(document.body).css('color').match(/\d+/g).slice(0, 3) .map(Number).reduce(this.add) > 459; if (!this.active) { return; }       // Override sassParams mw.config.set('wgSassParams', this.sassParams); $.extend(window.sassParams, this.sassParams); // Dark theme class $(document.body).addClass(window.dev.colors           ? 'oasis-dark-theme ' +              'menu-dark ' +              'page-dark'            : 'oasis-dark-theme'        ).removeClass('menu-bright page-bright'); // Editor dark theme if (this.darkHighlight.bool) { $(document.body).on('animationstart.fansun', $.proxy(this.darkHighlight, this)); }       // Override post-render MediaWiki imports $([document.head, document.body]).each($.proxy(this.postRender, this)); }   /**     * Helper method for numeric addition. * @method         add */   FANSUN.prototype.add = function(a, c) { return +a+c; };   /**     * SASS parameters for use in JavaScript. * @type           {Object.} */   FANSUN.prototype.sassParams = { 'background-dynamic': 'false', 'background-image': '', 'background-image-height': '801', 'background-image-width': '1700', 'color-body': '#2c343d', 'color-body-middle': '#2c343d', 'color-buttons': '#00b7e0', 'color-community-header': '#404a57', 'color-header': '#404a57', 'color-links': '#00c8e0', 'color-page': '#39424d', 'oasisTypography': 1, 'page-opacity': '100', 'widthType': 0, 'wordmark-font': 'cpmono' };   /**     * Database names for official wikis. * @type           {Array.} */   FANSUN.prototype.wikis = [ 'wikia', 'ca', 'de', 'es', 'fiwikia', 'frfr', 'it', 'ja', 'kowikia', 'nlwikia', 'plwikia', 'ptcommunity', 'ruwikia', 'vicommunity', 'zh', 'dev', 'infobox', 'vstf', 'communitycouncil' ];   /**     * Dark highlighting in Source mode. * @method         darkHighlight * @see            https://kocka.wikia.com/index.php?title=MediaWiki:Minimalism/VSTF.js&action=raw * @see            https://github.com/Wikia/app/blob/dev/extensions/wikia/EditPageLayout/js/plugins/WikitextSyntaxHighlighterQueueInit.js     */ FANSUN.prototype.darkHighlight = function(e) { if (e.originalEvent.animationName !== this.darkHighlight.animation) { return; }       $(document.body).off('animationstart.fansun'); setTimeout($.proxy(require, null, ['WikiTextSyntaxHighlighter'], this.darkHighlight.syntax, 0)); };   FANSUN.prototype.darkHighlight.bool = (        mw.config.get('wgIsEditPage') &&        typeof window.ace !== 'object' &&        typeof window.RTE !== 'object'    ); FANSUN.prototype.darkHighlight.syntax = function(sh) { sh.reset; var $t = $('#wpTextbox1'), $p = $t.parent; $p.parent.children('#toolbar').after($t); $p.remove; sh.init($t.get(0), WikiaEditor.plugins.syntaxhighlighterqueueinit.prototype.initDarkThemeColors); };   FANSUN.prototype.darkHighlight.animation = 'fansun__textbox'; /**    * Post render MediaWiki import replacement. * @method         postRender */   FANSUN.prototype.postRender = function(i, docNode) { var o = new MutationObserver($.proxy(function(M) { M.forEach($.proxy(function(R) { [].slice.call(R.addedNodes).filter(this.isSASS).forEach($.proxy(function(s) { var url = s.getAttribute('href'); if (!window.dev.dark.cache.includes(url)) { Object.keys(this.sassUtil).forEach($.proxy(function(mode) { $.proxy(this.sassUtil[mode], this)(mode, url, s); }, this)); }               }, this)); }, this)); }, this)); o.observe(docNode, { childList: true }); };   /**     * String caching for SASS. * @type           {Object.} */   FANSUN.prototype.cache = { '__am': '', '__load': '' };   /**     * SASS filter for CSS imports. * @method         isSass */   FANSUN.prototype.isSASS = function(n) { return (           n.nodeName.toLowerCase === 'link' &&            n.getAttribute('rel') === 'stylesheet' &&            n.getAttribute('href').indexOf('sass') > -1 &&            n.getAttribute('href').indexOf('background-dynamic') > -1        ); };   /**     * SASS filter for CSS imports. * @member         sassUtil */   FANSUN.prototype.sassUtil = {}; /**    * AssetManager imports. * @method     __am */   FANSUN.prototype.sassUtil.__am = function(mode, url, s) { if (url.indexOf(mode) === -1) { return; }       // Array processing for AssetManager link // https://slot1-images.wikia.nocookie.net/__am//sasses// var url_a = url.split('/'), sass_i = +url_a.indexOf(mode)+3, sass_s_new; // SASS parameter-string conversion if (this.cache[mode].length > 0) { sass_s_new = this.cache[mode]; } else { sass_s_new = encodeURIComponent($.param(this.sassParams)); // Caching for our new SASS string this.cache[mode] = this.cache.length > 0 ? this.cache[mode] : sass_s_new; }       // URL insertion for new SASS parameters url_a.splice(sass_i, 1, sass_s_new); var url_new = url_a.join('/'); // URL setter window.dev.dark.cache.push(url_new); var newStyle = document.createElement('link'); newStyle.setAttribute('href', url_new); newStyle.setAttribute('rel', 'stylesheet'); document.head.appendChild(newStyle); };   /**     * ResourceLoader imports. * @method     __load */   FANSUN.prototype.sassUtil.__load = function(mode, url, s) { if (url.indexOf(mode) === -1) { return; }       // Array processing for ResourceLoader asset // https://slot1-images.wikia.nocookie.net/__load/-/cb%3D1518765819%26debug%3Dfalse%26lang%3Den%26only%3Dstyles%26%26sass_wordmark-font%3D %26skin%3D var url_a = url.split('/'), sass_bounds = [ 'only%3Dstyles%26', '%26sass_wordmark-font' ],           sass_p_mw, sass_i = +url_a.indexOf(mode)+2, sass_s_mw; // SASS parameter-string conversion if (this.cache[mode].length > 0) { sass_s_mw = this.cache[mode]; } else { // Convert MediaWiki 'mwSassParams' into 'sassParams' format sass_p_mw = {}; for (var k in this.sassParams) { sass_p_mw['sass_' + k] = this.sassParams[k]; }           sass_s_mw = $.param(sass_p_mw); // Caching for our new SASS string this.cache[mode] = this.cache.length > 0 ? this.cache[mode] : sass_s_mw; }       // URL parsing logic to replace SASS parameters var sass_rgx = new RegExp(sass_bounds.join('|')); var sass_a_url = sass_s_url.split(sass_rgx); sass_a_url.splice(1, 1, sass_bounds[0], sass_s_mw, sass_bounds[1]); // Creating new URL var sass_s_new = sass_a_url.join(''); url_a.splice(sass_i, 1, sass_s_new); var url_new = url_a.join('/'); // URL setter window.dev.dark.cache.push(url_new); var newStyle = document.createElement('link'); newStyle.setAttribute('href', url_new); newStyle.setAttribute('rel', 'stylesheet'); document.head.appendChild(newStyle); };   // Script bootloader $(window).on('load', function {        window.dev.dark = new FANSUN;    }); }(window, mediaWiki, jQuery));
 * (function (window, mw, $) {