User:OttoLannister550/global.js

importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:MassEdit/code.js',        'u:dev:MediaWiki:MassCategorization/code.js',        'u:dev:MediaWiki:FindAndReplace/code.js',        'u:dev:MediaWiki:AjaxRename/code.js',        'u:dev:MediaWiki:AjaxEdit.js',        'u:dev:MediaWiki:AjaxRedirect/code.js',        'u:dev:MediaWiki:MassNullEdit/code.js',        'u:dev:MediaWiki:AjaxDelete/code.js',        'u:dev:MediaWiki:AjaxBatchDelete.js',        'u:dev:MediaWiki:AjaxBatchUndelete.js',        'u:dev:MediaWiki:AjaxEditPreview.js',        'u:dev:MediaWiki:WhatLinksHere/code.js',        'u:dev:MediaWiki:TopArticles/code.js',        'u:dev:MediaWiki:MassRename/code.js',        'u:dev:MediaWiki:DisplayTimer/code.js',        'u:dev:MediaWiki:NullEditButton/code.js',        'u:dev:MediaWiki:DisableCode/code.js',        'u:dev:MediaWiki:PageCreator/code2.js',        'u:dev:MediaWiki:ThemeToggler.js', 'u:dev:MediaWiki:DateInserter/code.js', 'u:dev:MediaWiki:QuickPurge.js', 'u:dev:MediaWiki:SkinSwitchFD.js', 'u:dev:MediaWiki:MultiUpload.js', 'u:dev:MediaWiki:ImageMapEdit.js', 'u:dev:MediaWiki:ImageMapEditZoom.js', 'u:dev:MediaWiki:MobilePreview.js', 'u:dev:MediaWiki:ArticlePreview/code.js', ] });

//Previous Wiki Determinator mw.loader.using('mw.Api', function {	var prevWiki = mw.config.get('wgServer'),		params;   if (prevWiki != 'https://community.fandom.com' && mw.user.options.get('userJS-prevWiki') === null) {   	params = {            action: 'options',            optionname: 'userJS-prevWiki',            optionvalue: prevWiki,            format: 'json'        };    } else if (prevWiki != 'https://community.fandom.com') {    	params = {            action: 'options',            change: 'userJS-prevWiki=' + prevWiki,            format: 'json'        };    } else {    	var ccButton = document.querySelector('.global-navigation .wds-dropdown__content a[href*="community.fandom.com"]');    		ccButton.textContent = 'Previous Wiki';    		ccButton.href = prevWiki;    }    if (prevWiki != 'https://community.fandom.com') {    	var api = new mw.Api;    	api.postWithToken('csrf', params).done(function(data) { console.log(data); });   } });

/* Adding Personal CSS, Personal JS, Wiki CSS, and Wiki JS to the Wiki Tools' Dropdown */ $(function { //Sub Menus Creation Function	function createSubMenus(submenuNames, type, scope) {		var submenuContainer_ul = document.createElement('ul');    	submenuContainer_ul.className = 'wds-list wds-is-linked';    	var i, submenu_a, submenu_li, phpNames;    	for (i = 0; i < submenuNames.length; i++) {		    submenu_a = document.createElement('a');		    switch (scope) {				case 'Personal':    				submenu_a.href = '/wiki/Special:MyPage/' + submenuNames[i].toLowerCase     								  + '.' + type.toLowerCase;    				phpNames = '/index.php?title=Special:MyPage/' +submenuNames[i].toLowerCase     								  + '.' + type.toLowerCase;    				break;				case 'Wiki':    				submenu_a.href = '/wiki/MediaWiki:' + submenuNames[i] + '.'     								  + type.toLowerCase;    				phpNames = '/index.php?title=MediaWiki:' +submenuNames[i] + '.'     								  + type.toLowerCase;				}				$.ajax({ type: 'HEAD', url: phpNames, error: submenu_a.style.opacity = '0.5' });   	    submenu_a.id = scope + '_' + submenuNames[i] + '_' + type;    	    submenu_a.innerHTML = submenuNames[i] + ' ' + type;    	    submenu_li = document.createElement('li');         	submenu_li.appendChild(submenu_a);    	    submenuContainer_ul.appendChild(submenu_li);    	}    	var submenuContainer_div = document.createElement('div');    	submenuContainer_div.className = 'wds-is-not-scrollable wds-dropdown-level-2__content';    	submenuContainer_div.appendChild(submenuContainer_ul);    	return submenuContainer_div;	} //Creating the Sub Menus	var personalCSSSubMenus = ['Common', 'Fandomdesktop', 'FandomMobile', 'Oasis'];	var personalJSSubMenus = ['Common', 'Fandomdesktop', 'FandomMobile', 'Oasis'];	var wikiCSSSubMenus = ['Common', 'Fandomdesktop', 'Wikia', 'Print',					   'Group-autoconfirmed', 'Group-sysop', 'Group-bot'];	var wikiJSSubMenus = ['Common', 'Fandomdesktop', 'Wikia', 'Group-autoconfirmed', 'Group-sysop', 'Group-bot']; var menuContent = []; menuContent[0] = createSubMenus(personalCSSSubMenus,'CSS','Personal'); menuContent[1] = createSubMenus(personalJSSubMenus,'JS','Personal'); menuContent[2] = createSubMenus(wikiCSSSubMenus,'CSS','Wiki'); menuContent[3] = createSubMenus(wikiJSSubMenus,'JS','Wiki'); //Creating the Menus var menu_a, menu_li; var menus = ['Personal CSS', 'Personal JS', 'Wiki CSS', 'Wiki JS']; var wikiToolsDropdown = document.querySelectorAll('.wiki-tools .wds-dropdown__content>ul.wds-list'); for (i = 0; i < menus.length; i++) { menu_a = document.createElement('a'); menu_a.href = '#'; menu_a.id = menus[i].replace(' ', '_'); menu_a.innerHTML = menus[i]; menu_li = document.createElement('li'); menu_li.className = 'wds-dropdown-level-2 is-calculated css-js_pages_li'; menu_li.appendChild(menu_a); menu_li.appendChild(menuContent[i]); wikiToolsDropdown[0].appendChild(menu_li); wikiToolsDropdown[1].appendChild(menu_li); } //Styling the Menus var cssjsPageMenus_li = document.getElementsByClassName('css-js_pages_li'); var cssjsPageMenus_a = document.querySelectorAll('.wds-dropdown__content .css-js_pages_li>a'); var cssjsPageSubMenus_div = document.querySelectorAll('.css-js_pages_li>div.wds-dropdown-level-2__content'); for (i = 0; i < cssjsPageMenus_li.length; i++) { cssjsPageMenus_li[i].style.marginRight = '9px'; cssjsPageMenus_li[i].style.marginLeft = '0'; cssjsPageMenus_a[i].style.paddingLeft = '19px'; cssjsPageSubMenus_div[i].style.left = 'inherit'; cssjsPageSubMenus_div[i].style.right = '100%'; } });