User:Americhino/common.js

// Adding wiki links to global nav wikis menu; borrowing code from Fandyllic var adminWikis = { calvinandhobbes: 'Calvin and Hobbes', paladins: 'Paladins', elenaofavalor: 'Elena of Avalor', }; var activeWikis = { dev: 'Dev', community: 'Central', }; var infoWikis = { marvelcinematicuniverse: 'MCU', overwatch: 'Overwatch', fortnite: 'Fortnite', ddlc: 'DDLC', }; $(function {	'use strict';    $('.wds-global-navigation__link-group .wds-dropdown__content').addClass('wds-is-not-scrollable');    /* Start adding menu */	if (!window.adminWikis || $('#AdminWikis').length) {		return;	}	var $adminWikisList = $('').addClass('wds-list wds-is-linked');	var $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 wikis list	Object.keys(window.adminWikis).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 $adminWikisList.append(               $('').append( $('') .attr('href', '//' + key + '.wikia.com/wiki/') .attr('target', '_blank') .text(window.adminWikis[key]) )               );        }    });    /* Don't try to add My Favorite Wikis menu, if it appears to already exist */	if (!window.activeWikis || $('#ActiveWikis').length) {		return;	}    /* Star building Active Wikis menu */	var $activeWikisList = $('').addClass('wds-list wds-is-linked');	var $activeWikis = $('')		.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 My Favorite 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 = $('')		.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 info 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 */	$('.wds-global-navigation__link-group .wds-dropdown__content:not(.wds-dropdown-level-2__content) .wds-list li:nth-child(2)')		.before($infoWikis);    /* Add completed other wikis (favWikis2) HTML blob to profile menu */	$('.wds-global-navigation__link-group .wds-dropdown__content:not(.wds-dropdown-level-2__content) .wds-list li:nth-child(2)')		.before($activeWikis); /* Add completed other wikis (favWikis) HTML blob to profile menu */	$('.wds-global-navigation__link-group .wds-dropdown__content:not(.wds-dropdown-level-2__content) .wds-list li:nth-child(2)')		.before($adminWikis); });