MediaWiki:Monobook.js: Difference between revisions

From Halopedia, the Halo wiki

No edit summary
No edit summary
Line 355: Line 355:
'Special:WikiForum|Halopedia forums',
'Special:WikiForum|Halopedia forums',
'Halopedia:Discord Server|Discord server',
'Halopedia:Discord Server|Discord server',
'https://twitter.com/Halopedia|Twitter',
'https://www.facebook.com/HalopediaWiki|Facebook',
'Halopedia:Featured/Article|Featured articles',
'Halopedia:Featured/Article|Featured articles',
'Special:TopUsers|Distinguished users',
'Halopedia:Projects/Improvement|Article Improvement Drive',
'Halopedia:Patrollers|Patroller group',
];
];


Line 362: Line 365:
{'Category:Halopedia policies|Policies': [
{'Category:Halopedia policies|Policies': [
'Halopedia:General Disclaimer|General Disclaimer',
'Halopedia:General Disclaimer|General Disclaimer',
'Halopedia:What Halopedia is not|What Halopedia is not',
'Halopedia:What Halopedia is|What Halopedia is',
'Halopedia:Blocking Policy|Blocking Policy',
'Halopedia:Blocking Policy|Blocking Policy',
'Halopedia:Bots|Bot Policy',
'Halopedia:Bots|Bot Policy',
Line 384: Line 387:
'Help:Links|Links',
'Help:Links|Links',
'Help:References|References',
'Help:References|References',
'Halopedia:Rollback|Rollback rights',
'Help:Tables|Tables',
'Help:Tables|Tables',
'Help:Templates|Templates',
'Help:Templates|Templates',

Revision as of 14:48, February 11, 2021

/* Any JavaScript here will be loaded for users using the MonoBook skin */

/* MONOBOOK SIDEBAR v2.3 */
window.wgSidebar = ( window.wgSidebar || {} );

wgSidebar['Navigation'] = [
	'Main Page|Main page',
	'Special:RecentChanges|Recent changes',
	'Special:Random|Random page',
];

wgSidebar['Games'] = [
	{'Category:Video games|Original trilogy': [
		'Halo: Combat Evolved|Halo: Combat Evolved',
		'Halo: Combat Evolved Anniversary|Halo: Combat Evolved Anniversary',
		'Halo 2|Halo 2',
		'Halo 2: Anniversary|Halo 2: Anniversary',
		'Halo 3|Halo 3',
	]},
	{'Reclaimer Saga|Reclaimer Saga': [
		'Halo 4|Halo 4',
		'Halo 5: Guardians|Halo 5: Guardians',
		'Halo Infinite|Halo Infinite',
	]},
	{'Category:Video games|Halo: Spartan series': [
		'Halo: Spartan Assault|Halo: Spartan Assault',
		'Halo: Spartan Strike|Halo: Spartan Strike',
	]},
	{'Category:Video games|Halo Wars series': [
		'Halo Wars|Halo Wars',
		'Halo Wars 2|Halo Wars 2',
	]},
	{'Category:Video games|Other games': [
		'Halo 3: ODST|Halo 3: ODST',
		'Halo: Reach|Halo: Reach',
		'Halo: Fireteam Raven|Halo: Fireteam Raven',
	]},
	{'Category:Video games|Ports and expansions': [
		'Halo: Combat Evolved (PC port)|Halo PC',
		'Halo Custom Edition',
		'Halo 2 Multiplayer Map Pack|Halo 2 Multiplayer Map Pack',
		'Halo 2 (Windows Vista)|Halo 2 Vista',
		'Halo 3 Mythic|Halo 3 Mythic',
		'Halo: The Master Chief Collection|The Master Chief Collection',
		'Halo 5: Forge|Halo 5: Forge',
	]},
	{'Category:Applications|Applications': [
		'Halo Waypoint|Halo Waypoint',
		'Halo 4: King of the Hill Fueled by Mountain Dew|Halo 4: King of the Hill',
		'Halo Channel|Halo Channel',
		'Halo (Windows 10 app)|Halo App',
		'Halo Stickers|Halo Stickers',
		'Halo Recruit|Halo Recruit',
	]},
	{'Category:Tabletop games|Table top': [
		{'Category:Tabletop games|Spartan Games': [
			'Halo: Fleet Battles|Halo: Fleet Battles',
			'Halo: Ground Command|Halo: Ground Command',
		]},
		'Halo 4: King of the Hill Fueled by Mountain Dew|Halo 4: King of the Hill',
		'Halo Interactive Strategy Game|Halo Interactive Strategy Game',
		'Risk|Halo Risk',
		'Monopoly: Halo Collector\'s Edition|Halo Monopoly',
	]},
	{'Category:Deleted material|Canceled projects': [
		'Halo: Chronicles|Halo: Chronicles',
		'Titan (canceled game)|Titan',
		'Haggar|Haggar',
		'Halo Online|Halo Online',
	]},
];

wgSidebar['Books & media'] = [
	{'Category:Novels|Novels': [
		{'The Forerunner Saga|The Forerunner Saga': [
			'Halo: Cryptum|Cryptum',
			'Halo: Primordium|Primordium',
			'Halo: Silentium|Silentium',
		]},
		{'Kilo-Five Trilogy|Kilo-Five Trilogy': [
			'Halo: Glasslands|Glasslands',
			'Halo: The Thursday War|The Thursday War',
			'Halo: Mortal Dictata|Mortal Dictata',
		]},
		{'A Master Chief Story|A Master Chief Story': [
			'Halo: Silent Storm|Silent Storm',
			'Halo: Oblivion|Oblivion',
			'Halo: Shadows of Reach|Shadows of Reach',
		]},
		{'Battle Born: A Halo Young Adult Novel Series|Battle Born': [
			'Halo: Battle Born|Battle Born',
			'Halo: Meridian Divide|Meridian Divide',
		]},
		'Halo: The Fall of Reach|The Fall of Reach',
		'Halo: The Flood|The Flood',
		'Halo: First Strike|First Strike',
		'Halo: Ghosts of Onyx|Ghosts of Onyx',
		'Halo: Contact Harvest|Contact Harvest',
		'Halo: The Cole Protocol|The Cole Protocol',
		'Halo: Evolutions|Evolutions',
		'Halo: Broken Circle|Broken Circle',
		'Halo: New Blood|New Blood',
		'Halo: Hunters in the Dark|Hunters in the Dark',
		'Halo: Saint\'s Testimony|Saint\'s Testimony',
		'Halo: Last Light|Last Light',
		'Halo: Shadow of Intent|Shadow of Intent',
		'Halo: Fractures|Fractures',
		'Halo: Smoke and Shadow|Smoke and Shadow',
		'Halo: Envoy|Envoy',
		'Halo: Retribution|Retribution',
		'Halo: Legacy of Onyx|Legacy of Onyx',
		'Halo: Bad Blood|Bad Blood',
		'Halo: Renegades|Renegades',
	]},
	{'Category:Comics|Comics': [
		'Halo Graphic Novel|Graphic Novel',
		'Halo 3: The Cradle of Life|The Cradle of Life',
		'Halo: Uprising|Uprising',
		'Halo: Helljumper|Helljumper',
		'Halo: Blood Line|Blood Line',
		'Halo: Fall of Reach|Fall of Reach',
		'Halo Wars: Genesis|Genesis',
		'Halo: Initiation|Initiation',
		'Halo: Escalation|Escalation',
		'Halo: Tales from Slipspace|Tales from Slipspace',
		'Halo: Rise of Atriox|Rise of Atriox',
		'Halo: Collateral Damage|Collateral Damage',
		'Halo: Lone Wolf|Lone Wolf',
	]},
	{'Category:Art books|Art books': [
		'The Art of Halo: Creating a Virtual World|The Art of Halo',
		'The Art of Halo 3|The Art of Halo 3',
		'Halo: The Great Journey - The Art of Building Worlds|Halo: The Great Journey',
		'Awakening: The Art of Halo 4|The Art of Halo 4',
		'The Art of Halo 5: Guardians|The Art of Halo 5: Guardians',
		'The Art of Halo Infinite|The Art of Halo Infinite',
	]},
	{'Category:Reference books|Reference': [
		'Halo Encyclopedia: The Definitive Guide to the Halo Universe|Halo Encyclopedia  ',
		'Halo: The Essential Visual Guide|Halo: The Essential Visual Guide',
		'Halo 4: The Essential Visual Guide|Halo 4: The Essential Visual Guide',
		'Halo Mythos: A Guide to the Story of Halo‎|Halo Mythos',
		'Halo: Warfleet – An Illustrated Guide to the Spacecraft of Halo|Halo: Warfleet',
		'Halo: Official Spartan Field Manual|Halo: Official Spartan Field Manual',
	]},
	{'Category:Strategy guides|Strategy guides': [
		'Halo: Combat Evolved: Sybex Official Strategies & Secrets|Halo: Combat Evolved',
		'Halo 2: The Official Strategy Guide|Halo 2',
		'Halo 3: The Official Strategy Guide|Halo 3',
		'Halo Wars: Official Strategy Guide|Halo Wars',
		'Halo 3: ODST Official Strategy Guide|Halo 3: ODST',
		'Halo: Reach Official Strategy Guide|Halo: Reach',
		'Halo 4: Official Game Guide|Halo 4',
		'Halo 5: Guardians Official Game Guide|Halo 5: Guardians',
	]},
	{'Category:Animated films|Animation': [
		'Halo Legends|Halo Legends',
		'Halo: The Fall of Reach - The Animated Series|Halo: The Fall of Reach',
	]},
	{'Category:Live action|Live action': [
		'Halo: Landfall|Landfall',
		'The Life|The Life',
		'Birth of a Spartan|Birth of a Spartan',
		'Remember Reach|Remember Reach',
		'Halo 4: Forward Unto Dawn|Halo 4: Forward Unto Dawn',
		'Halo film|Halo movie',
		'Halo: Nightfall|Nightfall',
		'Halo: The Television Series|The Television Series',
	]},
];

wgSidebar['Gameplay'] = [
	'Halo Waypoint|Waypoint',
	'Equipment|Equipment',
	'Weapons|Weapons',
	'Category:Vehicles|Vehicles',
	'Armor permutations|Armor permutations',
	'Category:Levels|Walkthroughs',
	'Multiplayer|Multiplayer',
];

wgSidebar['The universe'] = [
	{'Category:Characters|Characters': [
		{'Blue Team': [
			'John-117',
			'Linda-058',
			'Kelly-087',
			'Frederic-104',
		]},
		{'Red Team': [
			'Jerome-092',
			'Douglas-042',
			'Alice-130',
		]},
		{'Alpha-Nine': [
			'Rookie',
			'Michael Crespo|Michael "Mickey" Crespo',
			'Taylor Miles|Taylor "Dutch" Miles',
			'Kojo Agu|Kojo "Romeo" Agu',
		]},
		{'NOBLE Team': [
			'SPARTAN-B312',
			'Carter-A259',
			'Jun-A266',
			'Emile-A239',
			'Kat-B320',
			'Jorge-052',
		]},
		{'Fireteam Osiris': [
			'Jameson Locke',
			'Edward Buck',
			'Olympia Vale',
			'Holly Tanaka',
		]},
		'Catherine Halsey',
		'Jacob Keyes',
		'Cortana',
		'Avery Johnson',
		'343 Guilty Spark',
		'Thel \'Vadam',
		'Terrence Hood',
		'Miranda Keyes',
		'Rtas \'Vadum',
		'Gravemind',
		'James Cutter',
		'John Forge',
		'Ellen Anders',
		'Librarian',
		'IsoDidact',
		'Ur-Didact',
		'Jul \'Mdama',
		'Thomas Lasky',
		'Sarah Palmer',
		'Roland',
		'Atriox',
		'Isabel',
	]},
	{'Category:Places|Locations': [
		'Earth',
		'Reach',
		'Harvest',
		'Sanghelios',
		'High Charity',
		'Mombasa',
		'Installation 04|Alpha Halo',
		'Installation 05|Delta Halo',
		'Installation 00|The Ark',
		'Requiem',
		'Maethrillian',
	]},
	{'Category:Sapient species|Species': [
		'Human',
		'San\'Shyuum',
		'Sangheili',
		'Kig-Yar',
		'Jiralhanae',
		'Huragok',
		'Lekgolo',
		'Yanme\'e',
		'Unggoy',
		'Forerunner',
		'Flood',
	]},
	{'Category:Factions|Factions': [
		{'United Nations Space Command|United Nations Space Command': [
			'UNSC Army',
			'UNSC Air Force',
			'UNSC Marine Corps',
			'Orbital Drop Shock Troopers',
			'UNSC Navy',
			'Office of Naval Intelligence',
			'Spartan|SPARTAN programs',
		]},
		{'Covenant|Covenant': [
			'Covenant military',
			'Covenant Honor Guard',
			'High Council',
		]},
		{'Insurrectionist|Insurrectionists': [
			'United Rebel Front',
			'New Colonial Alliance',
		]},
		'Unified Earth Government',
		'Swords of Sanghelios',
		'Jul \'Mdama\'s Covenant',
		'Ecumene|Forerunner ecumene',
		'Ancient humanity',
		'Precursor|Precursors',
	]},
	{'Category:Technology|Technology': [
		'Technological Achievement Tiers',
		'Active camouflage',
		'Artificial intelligence',
		'Biological augmentation',
		'Cryonics',
		'Energy shielding',
		'Holography',
		'Slipstream space',
		'Powered exoskeleton',
		'Category:Propulsion|Propulsion',
		'Category:Communications technology|Communications',
		'Category:Medicine|Medicine',
		'Category:Vehicles|Vehicles',
		'Category:Weapons|Weapons',
	]},
	{'Category:Ships|Ships': [
		'UNSC Pillar of Autumn',
		'Truth and Reconciliation',
		'UNSC In Amber Clad',
		'UNSC Forward Unto Dawn',
		'Shadow of Intent',
		'UNSC Spirit of Fire',
		'UNSC Infinity',
		'Mantle\'s Approach',
		'Enduring Conviction',
	]},
	{'Category:Society and culture|Society and culture': [
		'Category:Languages|Languages',
		'Religion',
		'Mantle',
		'List of food and drinks|Food and drink',
		'Category:Terms and phrases|Terms and phrases',
	]},
	{'Halopedia:Projects/Timeline/Eras|Timeline': [
		'Human-Forerunner wars',
		'Forerunner-Flood war',
		'Great Purification|The Halos\' firing',
		'War of Beginnings',
		'Interplanetary War',
		'Insurrection',
		'Human-Covenant War',
		'Post-Covenant War conflicts',
	]},
];

wgSidebar['Halopedia Archive'] = [
	'Archive:Text Archives|Text Archives',
	'Archive:Website Archives|Website Archives',
	'https://www.youtube.com/channel/UCMeCf0KFYzOHw2lp2GRtgWA|Video Archives',
];

wgSidebar['Community'] = [
	{'Halopedia:Administrators|Administrators': [
		'User:BaconShelf|BaconShelf',
		'User:CIA391|CIA391',
		'User:Dab1001|Dab1001',
		'User:Dragonclaws|Dragonclaws',
		'User:Jack Phoenix|Jack Phoenix',
		'User:NightHammer|NightHammer',
		'User:Porplemontage|Porplemontage',
		'User:Rusty-112|Rusty-112',
		'User:Sith Venator|Sith Venator',
		'User:Tacitus|Tacitus',
	]},
	'Special:WikiForum|Halopedia forums',
	'Halopedia:Discord Server|Discord server',
	'https://twitter.com/Halopedia|Twitter',
	'https://www.facebook.com/HalopediaWiki|Facebook',
	'Halopedia:Featured/Article|Featured articles',
	'Halopedia:Projects/Improvement|Article Improvement Drive',
	'Halopedia:Patrollers|Patroller group',
];

wgSidebar['Help'] = [
	{'Category:Halopedia policies|Policies': [
		'Halopedia:General Disclaimer|General Disclaimer',
		'Halopedia:What Halopedia is|What Halopedia is',
		'Halopedia:Blocking Policy|Blocking Policy',
		'Halopedia:Bots|Bot Policy',
		'Halopedia:Canon Policy|Canon Policy',
		'Halopedia:Copyright|Copyright Policy',
		'Halopedia:Media Policy|Media Policy',
		'Halopedia:Layout Guide|Layout Guide',
		'Halopedia:Manual of Style|Manual of Style',
		'Halopedia:Notability Policy|Notability Policy',
		'Halopedia:Protected Page Policy|Protected Page Policy',
		'Halopedia:Signature Policy|Signature Policy',
		'Halopedia:Spoilers Policy|Spoilers Policy',
		'Halopedia:Voting Policy|Voting Policy',
	]},
	{'Category:Help|Guidelines': [
		'Help:Signatures|Custom signatures',
		'Help:Disambiguation|Disambiguation',
		'Help:Editing|Editing',
		'Help:Images|Images',
		'Help:Level Walkthroughs|Level walkthroughs',
		'Help:Links|Links',
		'Help:References|References',
		'Halopedia:Rollback|Rollback rights',
		'Help:Tables|Tables',
		'Help:Templates|Templates',
		'Help:Videos|Videos',
	]},
];

wgSidebar['Related sites'] = [
	{'Halopedia:Community|Community': [
		'https://bungie.net|Bungie.net',
		'https://www.halowaypoint.com/en-us|Halo Waypoint',
		'http://halowars.com|Halo Wars',
		'http://halo.bungie.org|Halo.Bungie.Org',
		'http://blog.ascendantjustice.com|Ascendant Justice',
		'http://www.forgehub.com/|Forge Hub',
		'http://haloterms.bungie.org|Terminal Hub',
	]},
	{'Halopedia:Community|Wikis': [
		'http://halofanon.wikia.com/|Halo Fanon',
		'http://unhalo.wikia.com/|Gruntipedia',
		'http://halomachinima.wikia.com/|Halo Machinima',
		'http://halomods.wikia.com/|Halo Mods',
		'http://wiki.halo.fr/index.php/Accueil|Halo.fr',
		'http://rvb.wikia.com/|Red vs. Blue',
		'http://bungie.wikia.com/|Bungiepedia',
	]},
	{'Halopedia:Project Userbox/Babel|International': [
		'http://de.halo.wikia.com/|Deutsch (German)',
		'http://el.halo.wikia.com/|Ελληνικά (Greek)',
		'http://it.halo.wikia.com/|Italiano (Italian)',
		'http://ko.halo.wikia.com/|(Korean)',
		'http://ja.halo.wikia.com/|日本語 (Japanese)',
		'http://pl.halo.wikia.com/|Polski (Polish)',
		'http://ru.halo.wikia.com/|Русские (Russian)',
		'http://es.halo.wikia.com/|Español (Spanish)',
	]},
];

/**
 * MonobookSidebar: Sets sidebar submenus for elements of MonoBook, adding special
 * classes to pass the pointer over to allow the effect on all browsers.
 *
 * Date: 15 October 2010
 * Copyright © 2010 Jesús Martínez Novo ([[User:Ciencia Al Poder]])
 *
 * This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version
 */
MonobookSidebar = {
	re_s: / /g,
	re_p: /%/g,
	loadedMenus: [],
	init: function() {
		if ( !window.wgSidebar ) {
			return;
		}
		for ( var menu in wgSidebar ) {
			var item = document.getElementById( MonobookSidebar.getId( menu ) );
			if ( !item ) {
				continue;
			}
			var menuId = jQuery( item ).parents().get( 2 ).id;
			// Check it's a valid portlet item
			if ( !menuId || menuId === '' ) {
				continue;
			}
			// Generate menu hierarchy
			MonobookSidebar.buildSubmenu( item, wgSidebar[menu] );
			// Set events
			MonobookSidebar.setEvents( menuId );
		}
	},
	buildSubmenu: function( el, arr ) {
		var ul = document.createElement( 'ul' );
		ul.className = 'sub-menu';
		for ( var i = 0; i < arr.length; i++ ) {
			var a;
			var li = document.createElement( 'li' );
			if ( typeof arr[i] == 'string' ) {
				a = MonobookSidebar.linkFromText( arr[i] );
				li.appendChild( a );
			} else {
				for ( var menukey in arr[i] ) {
					a = MonobookSidebar.linkFromText( menukey );
					li.appendChild( a );
					MonobookSidebar.buildSubmenu( li, arr[i][menukey] );
				}
			}
			ul.appendChild( li );
		}
		el.appendChild( ul );
		el.className = 'with-sub-menu';
		var em = document.createElement( 'em' );
		em.appendChild( document.createTextNode( '\u203A' ) );
		el.firstChild.appendChild( em );
	},
	setEvents: function( menuId ) {
		for ( var i = 0; i < MonobookSidebar.loadedMenus; i++ ) {
			if ( MonobookSidebar.loadedMenus[i] == menuId ) {
				return;
			}
		}
		jQuery( '#' + menuId ).children().eq( 1 ).children().eq( 0 )
			.on( 'mouseover', MonobookSidebar.mouseover )
			.on( 'mouseout', MonobookSidebar.mouseout );
		MonobookSidebar.loadedMenus.push( menuId );
	},
	mouseover: function( e ) {
		var target = e.target;
		while ( target.tagName.toLowerCase() != 'div' ) {
			if ( target.tagName.toLowerCase() == 'a' ) {
				target = target.parentNode;
			}
			if ( target.tagName.toLowerCase() == 'li' ) {
				jQuery( target ).addClass( 'hover' );
			}
			target = target.parentNode;
		}
	},
	mouseout: function( e ) {
		var target = e.target;
		while ( target.tagName.toLowerCase() != 'div' ) {
			if ( target.tagName.toLowerCase() == 'a' ) {
				target = target.parentNode;
			}
			if ( target.tagName.toLowerCase() == 'li' ) {
				jQuery( target ).removeClass( 'hover' );
			}
			target = target.parentNode;
		}
	},
	linkFromText: function( txt ) {
		var article = '', caption = '', sepPos = txt.indexOf( '|' );
		if ( sepPos > 0 ) {
			article = txt.substr( 0, sepPos );
			caption = txt.substr( sepPos + 1 );
		} else {
			article = caption = txt;
		}
		article = article.replace( MonobookSidebar.re_s, '_' );
		var a = document.createElement( 'a' );
		if ( article.length > 4 && article.substr( 0, 4 ) == 'http' ) {
			a.setAttribute( 'href', article );
		} else {
			article = article.replace( MonobookSidebar.re_s, '_' );
			// Replace encoded colons with normal colons
			article = article.replace( '%3A', ':' );
			a.setAttribute( 'href', mw.config.get( 'wgArticlePath' ).replace( '$1', article ) );
		}
		a.appendChild( document.createTextNode( caption ) );
		return a;
	},
	getId: function( name ) {
		return 'n-' + name.replace( MonobookSidebar.re_s, '-' ).replace( MonobookSidebar.re_p, '.' );
	}
};

/* Calling this code to initialize */
$( MonobookSidebar.init );