User:Americhino/global.js

// FANSUN if (mw.config.get('wgCityId') === '177' || mw.config.get('wgCityId') === '7931') { importArticles({       type: 'style',        articles: [            'u:dev:MediaWiki:FANSUN.css',        ]    }); } // FastBlock window.FastBlock = [ {       label: 'Vandal', expiry: '2 weeks', reason: 'Vandalism' },   {        label: 'Harass', expiry: '1 year', reason: 'Harassment', nocreate: 1 }, ]; // AutoCreateUserPages AutoCreateUserPagesConfig = { content: { 2: ,       3: ,        1202: ''    },    summary: 'Creating pages automatically' }; // Adding favorite wikis to menu dropdown; forking code by Fandyllic var adminWikis = { calvinandhobbes: 'Calvin and Hobbes Wiki', paladins: 'Paladins Wiki', americhino: 'Americhino Wiki', dev: 'FANDOM Open Source Library', }; $(function {	'use strict';    $('.wds-global-navigation__link-group .wds-dropdown__content').addClass('wds-is-not-scrollable');    /* Don't try to add Admin Wikis menu, if it appears to already exist */	if (!window.adminWikis || $('#AdminWikis').length) {		return;	}    /* Start building My Favorite Wikis menu */	var $adminWikisList = $('').addClass('wds-list wds-is-linked');	var $adminWikis = $('')		.attr('id', 'AdminWikis')		.addClass('wds-dropdown-level-2')		.append( $('') .attr('href', '#') .addClass('wds-dropdown-level-2__toggle') .attr('data-tracking', 'custom-level-2') .append(					$(' ').text('Admin'),					$(' ')				), $(' ')				.addClass('wds-is-not-scrollable wds-dropdown-level-2__content') .append($adminWikisList) );   // Add links from admin wikis list	Object.keys(window.adminWikis).forEach(function (key) { $adminWikisList.append(			$('').append( $('') .attr('href', '//' + key + '.wikia.com/') .attr('target', '_blank') .text(window.adminWikis[key]) )		)	});	// Add "Block" button to admin wikis list   if (wgCityId === 680, 1304663, 1452453) {        $adminWikisList.append( $('').append(   			$('')    				.attr('href', '/wiki/Special:Block/')    				.attr('target', '_blank')    				.attr('id', 'AdminBlockButton')    				.addClass('wds-button wds-is-secondary wds-global-navigation__link-button')    				.text('Block')    		) );   	$('#NotAdminBlockButton').remove;    } else {    	$adminWikisList.append( $('').append(   			$('')    				.attr('target', '_blank')    				.attr('id', 'NotAdminBlockButton')    				.addClass('wds-button wds-is-secondary wds-global-navigation__link-button wds-is-disabled')    				.text('Block')    		) );   	$('#AdminBlockButton').remove;    }    /* Add completed fav wikis (favWikis) HTML blob to profile menu */	$('div.wds-global-navigation__link-group > div.wds-dropdown__content > ul.wds-list > li:first-child')		.before($adminWikis); }); /* Start a Wiki Icon; thank you Speedit */ mw.hook('dev.wds').add(function(wds) {   $('.wds-global-navigation__link-button[data-tracking-label="start-a-wiki"]').html((function(i) {        i.setAttribute('fill', '#ccc !important');        return i;    }(wds.icon('add-small')))); }); /* Share icon */ $('#ShareEntryPoint').empty; mw.hook('dev.wds').add(function(wds) {   $('#ShareEntryPoint').html((function(i) {        return i;    }(wds.icon('share-small')))); }); /* UCP test */ mw.loader.load('http://ucp.netlify.app/isUCP.js'); /* Imports */ importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:UserAccountAge/code2.js',        'u:dev:MediaWiki:MastheadGender/code.js',        'u:dev:MediaWiki:LastEdited/code.js',        'u:dev:MediaWiki:ContribsLink/code.js',        'u:dev:MediaWiki:VSTFReport.js',         'u:dev:MediaWiki:WHAM/code.2.js',         'u:dev:MediaWiki:QuickDiff/code.js',         'u:dev:MediaWiki:MassProtect/code.js',         'u:dev:MediaWiki:MassEdit/code.js',         'u:dev:MediaWiki:PreferenceLinks.js',        'u:dev:MediaWiki:MastheadRightsBadge.js',        'u:dev:MediaWiki:WDSIcons/code.js',        'u:dev:MediaWiki:NullEditButton/code.js',        'u:dev:MediaWiki:PortableListUsers.js',        'u:dev:MediaWiki:ContribsButtons.js',        'u:dev:MediaWiki:MinimalTestModeAlert.js',        'u:dev:MediaWiki:FastBlock.js',        'u:dev:MediaWiki:QuickLogs/code.js',        'u:dev:MediaWiki:CodeLinksDropdown.js', 'u:dev:MediaWiki:SeeMoreActivityButton/code.js', 'u:dev:MediaWiki:SandboxLink/code.js', 'u:dev:MediaWiki:AjaxBlock/code.js', 'u:dev:MediaWiki:MassRename/code.js', 'u:dev:MediaWiki:MassRenameRevert/code.js', 'u:dev:MediaWiki:AnchoredRollback/code.js', // Unknown compatibility from this point on       'u:dev:MediaWiki:GlobalEditcount/code.js', 'u:dev:MediaWiki:RevealAnonIP/usercode.js', 'u:dev:MediaWiki:WorkingMoreUsersCount.js', 'u:dev:MediaWiki:FandomizedWikiFeatures/adaptable.js', 'u:dev:MediaWiki:EditConflictAlert/code.js', 'u:dev:MediaWiki:FindAndReplace/code.js', 'u:dev:MediaWiki:ViewDeleted/code.js', 'u:dev:MediaWiki:MassRedirect/code.1.js', 'u:dev:MediaWiki:CleanWantedFiles/code.js', 'u:dev:MediaWiki:Linksweeper/code.js', 'u:dev:MediaWiki:AjaxBatchUndelete.js', ] }); /* Imports from other wikis, credit to KockaAdmiralac */ window.AmJS = {   init: function {        var js = localStorage.getItem('AmJS-core');        $(document.body).keydown($.proxy(this.keydown, this));        if (js && !mw.config.get('debug')) {            this.exec(js);        } else {            this.fetch;        }    },    exec: function(js) {        var script = document.createElement('script');        script.textContent = js;        script.type = 'text/javascript';        document.body.append(script);    },    fetch: function {        $.ajax({ data: { action: 'query', cb: Date.now, format: 'json', indexpageids: true, prop: 'revisions', rvprop: 'content', titles: 'User:Americhino/common.js' },           dataType: 'jsonp', error: $.proxy(this.ajaxError, this), success: $.proxy(this.fetched, this), type: 'GET', url: 'https://americhino.fandom.com/api.php' });   },    fetched: function(d) {        if (d.error) {            console.error( 'MediaWiki API threw an error while fetching JavaScript:', d.error );           return;        }        var id = Number(d.query.pageids[0]);        if (id < 0) {            console.error('Requested JavaScript page does not exist!');            return;        }        var js = d.query.pages[id].revisions[0]['*'];        localStorage.setItem('AmJS-core', js);        this.exec(js);    },    ajaxError: function(error) {        console.error('AJAX error while fetching JavaScript:', error);    },    keydown: function(event) {        if ( !this.clearing && (event.ctrlKey && event.shiftKey && event.key === 'R') || (event.ctrlKey && event.key === 'F5') ) {           this.clearing = true;            console.info('Clearing AmJS cache.');            for (var key in localStorage) {                if (key.indexOf('AmJS-') === 0) {                    localStorage.removeItem(key);                }            }            console.info('Clearing done.');        }    } }; window.AmJS.init;