User:Americhino/global.js

if (wgCityId == '177') {importStylesheetPage('MediaWiki:FANSUN.css', 'dev');} if (wgCityId == '7931') {importStylesheetPage('MediaWiki:FANSUN.css', 'dev');} var qtUserPageTemplate = ''; var qtMessageWallGreetingTemplate = ''; // Adding favorite wikis to menu dropdown; borrowing code by Fandyllic var adminWikis = { calvinandhobbes: 'Calvin and Hobbes Wiki', paladins: 'Paladins Wiki', elenaofavalor: 'Elena of Avalor Wiki', americhino: 'Americhino Wiki', }; var activeWikis = { dev: 'FANDOM Open Source Library', community: 'Community Central', wlb: 'Wikia Language Brigade', }; var infoWikis = { marvelcinematicuniverse: 'MCU Wiki', overwatch: 'Overwatch Wiki', fortnite: 'Fortnite Wiki', ddlc: 'DDLC Wiki', evangelion: 'Evangelion', ranma: 'Ranma Wiki', kpop: 'K-Pop Wiki', gameofthrones: 'Game of Thrones Wiki', naruto: 'Narutopedia', hataraku: 'The Devil is a Part-Timer! Wiki', brooklyn99: 'Brooklyn Nine-Nine Wiki', }; $(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])			) );	});   /* Don't try to add Active Wikis menu, if it appears to already exist */ if (!window.activeWikis || $('#ActiveWikis').length) { return; }   /* Star building My Other Wikis menu */ var $activeWikisList = $('').addClass('wds-list wds-is-linked'); var $activeWikis = $('') //.attr('id', 'MyFavWikis2') .addClass('wds-dropdown-level-2') .append(			$('')				.attr('href', '#')				.addClass('wds-dropdown-level-2__toggle')				.attr('data-tracking', 'custom-level-2')				.append( $(' ').text('Active'), $(' ') ),			$(' ')				.addClass('wds-is-not-scrollable wds-dropdown-level-2__content')				.append($activeWikisList)		); // Add links from active wikis list Object.keys(window.activeWikis).forEach(function (key) {       $activeWikisList.append( $('').append(               $('')                    .attr('href', '//' + key + '.wikia.com/')                    .attr('target', '_blank')                    .text(window.activeWikis[key])            ) );	}); /* Don't try to add info Wikis menu, if it appears to already exist */ if (!window.infoWikis || $('#InfoWikis').length) { return; }   /* Star building Info Wikis menu */ var $infoWikisList = $('').addClass('wds-list wds-is-linked'); var $infoWikis = $('') //.attr('id', 'MyFavWikis2') .addClass('wds-dropdown-level-2') .append(			$('<a>')				.attr('href', '#')				.addClass('wds-dropdown-level-2__toggle')				.attr('data-tracking', 'custom-level-2')				.append( $(' ').text('Info'), $('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" width="12" height="12" class="wds-icon wds-icon-tiny wds-dropdown-chevron"><path d="M6.003 10.002a.997.997 0 0 1-.707-.293L.293 4.706a1 1 0 1 1 1.414-1.414l4.296 4.295 4.293-4.293A1 1 0 1 1 11.71 4.71l-5 5a.997.997 0 0 1-.707.293" fill-rule="evenodd"> ') ),			$(' ')				.addClass('wds-is-not-scrollable wds-dropdown-level-2__content')				.append($infoWikisList)		); // Add links from active wikis list Object.keys(window.infoWikis).forEach(function (key) {       $infoWikisList.append( $('<li>').append(               $('<a>')                    .attr('href', '//' + key + '.wikia.com/')                    .attr('target', '_blank')                    .text(window.infoWikis[key])            ) );	});   /* Add completed other wikis (favWikis2) HTML blob to profile menu */ $('div.wds-global-navigation__link-group > div.wds-dropdown__content > ul.wds-list > li:first-child') .before($infoWikis);

/* Add completed other wikis (favWikis2) HTML blob to profile menu */ $('div.wds-global-navigation__link-group > div.wds-dropdown__content > ul.wds-list > li:first-child') .before($activeWikis); /* 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); }); // Adding code links to global nav user menu; borrowing code from Fandyllic var code_links_globalnote = 'Global'; var code_links_localnote = 'Local'; var code_links_global_js = {	global: 'Global.js', }; var code_links_global_css = {	global: 'Global.css', }; var code_links_local_js = {	common: 'Common.js',	wikia: 'Wikia.js',	chat: 'Chat.js', }; var code_links_local_css = {	common: 'Common.css',	wikia: 'Wikia.css',	chat: 'Chat.css', }; $(function { 'use strict'; $('.wds-global-navigation__user-menu .wds-dropdown__content').addClass('wds-is-not-scrollable'); /* Start adding menu */ if (!window.code_links_global_js || $('#CodeLinks').length) { return; }	var $codeLinksList = $('<ul>').addClass('wds-list wds-is-linked'); var $codeLinks = $('<li>') .addClass('wds-dropdown-level-2') .append(			$('<a>')				.attr('href', '#')				.addClass('wds-dropdown-level-2__toggle')				.attr('data-tracking', 'custom-level-2')				.append( $(' ').text('Code Links'), $('<svg xmlns="https://www.w3.org/2000/svg" viewBox="0 0 12 12" width="12" height="12" class="wds-icon wds-icon-tiny wds-dropdown-chevron"><path d="M6.003 10.002a.997.997 0 0 1-.707-.293L.293 4.706a1 1 0 1 1 1.414-1.414l4.296 4.295 4.293-4.293A1 1 0 1 1 11.71 4.71l-5 5a.997.997 0 0 1-.707.293" fill-rule="evenodd"> ') ),			$(' ')				.addClass('wds-is-not-scrollable wds-dropdown-level-2__content')				.append($codeLinksList)		); // Add note at top for global code $codeLinksList.append(		$('<li>')			.text(code_links_globalnote)			.css('font-weight', 'bold')			.addClass('codelinks global')	); // Add links from global js list Object.keys(window.code_links_global_js).forEach(function (key) {       /* Change if (true) to else if special case needs to be added before again */        if (true) { // Use key for URL as normal            $codeLinksList.append( $('<li>').append(                       $('<a>')                        .attr('href', '//community.wikia.com/wiki/User:' + wgUserName + '/' + key + '.js')                        .attr('target', '_blank')                        .text(window.code_links_global_js[key])                    ) );       }     // Add links from global css list	Object.keys(window.code_links_global_css).forEach(function (key) { /* Change if (true) to else if special case needs to be added before again */ if (true) { // Use key for URL as normal $codeLinksList.append(               $('<li>').append( $('<a>') .attr('href', '//community.wikia.com/wiki/User:' + wgUserName + '/' + key + '.css') .attr('target', '_blank') .text(window.code_links_global_css[key]) )               );        }    });	// Add note for local code    $codeLinksList.append( $('<li>') .text(code_links_localnote) .css('font-weight', 'bold') .addClass('codelinks local') );   // Add links from local js list	Object.keys(window.code_links_local_js).forEach(function (key) { $codeLinksList.append(			$('<li>').append( $('<a>') .attr('href', '/wiki/User:' + wgUserName + '/' + key + '.js') .attr('target', '_blank') .text(window.code_links_local_js[key]) )		);	});   // Add links from local css list	Object.keys(window.code_links_local_css).forEach(function (key) { /* Change if (true) to else if special case needs to be added before again */ if (true) { // Use key for URL as normal $codeLinksList.append(               $('<li>').append( $('<a>') .attr('href', '/wiki/User:' + wgUserName + '/' + key + '.css') .attr('target', '_blank') .text(window.code_links_local_css[key]) )               );        }    });	$('div.wds-global-navigation__user-menu > div.wds-dropdown__content > ul.wds-list > li:nth-child(3)')		.before($codeLinks); }); }); /* 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('plus-small')))); });

/* Imports */ importArticles({   type: 'script',    articles: [        'u:dev:QuickCreateUserPage/code.js',        'u:dev:UserAccountAge/code.js',        'u:dev:MastheadGender/code.js',        'u:dev:GlobalEditcount/code.js',        'u:dev:LastEdited/code.js',        'u:dev:RevealAnonIP/usercode.js',        'u:dev:MediaWiki:WorkingMoreUsersCount.js',        'u:dev:EditBio/code.js',        'u:americhino:MediaWiki:QuickCreateMessageWallGreetingShort.js',        'u:dev:MediaWiki:ContribsLink/code.js',        'u:dev:MediaWiki:VSTFReport.js',        'u:americhino:MediaWiki:ModernPortableCSSPad/code.js',        'u:dev:MediaWiki:ModernBackToTopButton/code.js',        'u:dev:MediaWiki:UnsafeScripts/code.js',        'u:dev:MediaWiki:EditBio/code.js',        'u:dev:MediaWiki:FandomizedWikiFeatures/adaptable.js',        'u:dev:MediaWiki:QuickLogs/whatever.js',        'u:dev:MediaWiki:EditConflictAlert/code.js', 'u:americhino:MediaWiki:CustomGlobalNav.js', 'u:dev:MediaWiki:WDSIcons/code.js', 'u:dev:MediaWiki:MastheadRightsBadge.js', ] });