MediaWiki:Monobook.js: Difference between revisions

From the Kingdom Hearts Wiki, the Kingdom Hearts encyclopedia
Jump to navigationJump to search
No edit summary
No edit summary
Line 101: Line 101:
]},
]},
{'Category:Kingdom Hearts coded worlds|coded': [
{'Category:Kingdom Hearts coded worlds|coded': [
'Datascape',
'Datascape (KHC)|Datascape',
]},
]},
{'Category:Kingdom Hearts Birth by Sleep worlds|Birth by Sleep': [
{'Category:Kingdom Hearts Birth by Sleep worlds|Birth by Sleep': [
Line 182: Line 182:
'Kingdom Hearts - III, II.8, Unchained χ & Union χ (Cross) - Original Soundtrack|III, II.8, Unchained χ & Union χ [Cross]',
'Kingdom Hearts - III, II.8, Unchained χ & Union χ (Cross) - Original Soundtrack|III, II.8, Unchained χ & Union χ [Cross]',
]},
]},
{'Category:Compilation albums|Compilations': [
{'Category:Compilation albums|Arrangements': [
'Piano Collections Kingdom Hearts|Piano Collections',
'Piano Collections Kingdom Hearts|Piano Collections',
'Piano Collections Kingdom Hearts Field & Battle|Piano Collections: Field & Battle',
'Piano Collections Kingdom Hearts Field & Battle|Piano Collections: Field & Battle',
'Kingdom Hearts Tribute Album|Tribute Album',
'Kingdom Hearts Music Collection|Music Collection',
'Kingdom Hearts 10th Anniversary Fan Selection -Melodies & Memories-|10th Anniversary Fan Selection',
'Kingdom Hearts 20th Anniversary Vinyl LP Box|20th Anniversary Vinyl LP Box',
]},
]},
{'Category:Concerts|Concerts': [
{'Category:Concerts|Concerts': [
'Kingdom Hearts Concert -First Breath-|Concert: First Breath',
'Kingdom Hearts Concert -First Breath-|Concert -First Breath-',
'Kingdom Hearts Orchestra -World Tour-|Orchestra: World Tour',
'Kingdom Hearts Orchestra -World Tour-|Orchestra -World Tour-',
'Kingdom Hearts Orchestra -World of Tres-|Orchestra: World of Tres',
'Kingdom Hearts Orchestra -World of Tres-|Orchestra -World of Tres-',
'Kingdom Hearts Concert -Second Breath-|Concert -Second Breath-,
]},
]},
]},
]},

Revision as of 17:42, 24 April 2024

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

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

wgSidebar['Games'] = [
	'Kingdom Hearts (game)|Kingdom Hearts',
	'Kingdom Hearts Chain of Memories|Chain of Memories',
	'Kingdom Hearts II',
	'Kingdom Hearts 358/2 Days|358/2 Days',
	'Kingdom Hearts coded|coded',
	'Kingdom Hearts Birth by Sleep|Birth by Sleep',
	'Kingdom Hearts 3D: Dream Drop Distance|Dream Drop Distance',
        'Kingdom Hearts χ|χ[chi]',
        'Kingdom Hearts 0.2 Birth by Sleep -A fragmentary passage-|Kingdom Hearts 0.2',
	'Kingdom Hearts III|Kingdom Hearts III',
        'Kingdom Hearts Dark Road|Dark Road',
        'Kingdom Hearts Melody of Memory|Melody of Memory',
        'Kingdom Hearts Missing-Link|Missing-Link',
        'Kingdom Hearts IV|Kingdom Hearts IV',
	{'Category:Games|Other titles': [
		'Kingdom Hearts Final Mix',
		'Kingdom Hearts Re:Chain of Memories|Re:Chain of Memories',
		'Kingdom Hearts II Final Mix',
		'Kingdom Hearts Re:coded|Re:coded',
		'Kingdom Hearts Birth by Sleep Final Mix|Birth by Sleep Final Mix',
                'Kingdom Hearts HD 1.5 ReMIX|HD 1.5 ReMIX',
                'Kingdom Hearts HD 2.5 ReMIX|HD 2.5 ReMIX',
                'Kingdom Hearts Union χ|Union χ[Cross]',
                'Kingdom Hearts χ Back Cover|χ Back Cover',
                'Kingdom Hearts HD 2.8 Final Chapter Prologue|HD 2.8 Final Chapter Prologue',
                'Kingdom Hearts III Re Mind',
	]},
];

wgSidebar['The universe'] = [
	{'Category:Characters|Protagonists': [
		'Sora',
		'Riku',
		'Kairi',
		'Mickey Mouse',
		'Donald Duck',
		'Goofy',
		'Naminé',
		'Roxas',
		'Xion',
		'Terra',
		'Ventus',
		'Aqua',
		'Lea',
	]},
	{'Category:Antagonists|Antagonists': [
		'Xehanort',
		'Young Xehanort',
		'Vanitas',
		'Ansem, Seeker of Darkness|Ansem',
		'Organization XIII',
		'Real Organization XIII',
		'Maleficent',
		'Pete',
		'Villains',
	]},
	'Heartless',
	'Nobody|Nobodies',
	'Unversed',
	'Dream Eater|Dream Eaters',
	{'Category:Worlds|Worlds introduced in...': [
		{'Category:Kingdom Hearts worlds|Kingdom Hearts': [
			'Dive to the Heart',
			'Destiny Islands',
			'Disney Castle',
			'Traverse Town',
			'Wonderland',
			'Olympus Coliseum',
			'Deep Jungle',
			'Agrabah',
			'Halloween Town',
			'Monstro',
			'Atlantica',
			'Neverland',
			'Hollow Bastion',
			'100 Acre Wood',
			'End of the World',
			'Realm of Darkness',
		]},
		{'Category:Kingdom Hearts Chain of Memories worlds|Chain of Memories': [
			'Castle Oblivion',
			'Twilight Town',
		]},
		{'Category:Kingdom Hearts II worlds|Kingdom Hearts II': [
			'The Mysterious Tower',
			'Radiant Garden',
			'The Land of Dragons',
			"Beast's Castle",
			'Timeless River',
			'Port Royal',
			'Pride Lands',
			'Space Paranoids',
			'The World That Never Was',
			'Keyblade Graveyard',
		]},
		{'Category:Kingdom Hearts coded worlds|coded': [
			'Datascape (KHC)|Datascape',
		]},
		{'Category:Kingdom Hearts Birth by Sleep worlds|Birth by Sleep': [
			'Land of Departure',
			'Dwarf Woodlands',
			'Enchanted Dominion',
			'Castle of Dreams',
			'Mirage Arena',
			'Disney Town',
			'Deep Space',
		]},
                {'Category:Kingdom Hearts 3D: Dream Drop Distance worlds|Dream Drop Distance': [
			'La Cité des Cloches',
			"Prankster's Paradise",
			'The Grid',
			'Country of the Musketeers',
			'Symphony of Sorcery',
		]},
                {'Category:Kingdom Hearts χ worlds|Kingdom Hearts χ': [
			'Daybreak Town',
		]},
                {'Category:Kingdom Hearts Union χ worlds|Kingdom Hearts Union χ': [
			'Game Central Station',
			'Niceland',
			'Cy-Bug Sector',
			'Candy Kingdom',
		]},
                {'Category:Kingdom Hearts III worlds|Kingdom Hearts III': [
			'Olympus',
			'Toy Box',
			'Kingdom of Corona',
			'Monstropolis',
			'Arendelle',
			'The Caribbean',
			'San Fransokyo',
			'The Final World',
			'Scala ad Caelum',
			'Secret Forest',
			'Quadratum',
		]},

	]},
];

wgSidebar['Game elements'] = [
	'Category:Items|Items',
	'Weapons',
	'Magic',
	'Summon|Summons',
	'Ability|Abilities',
	'Drive Form|Drive Forms',
	'Card (disambiguation)|Cards',
	'Gummi Ship',
	'Mini-games',
];

wgSidebar['Literature .26 music'] = [
	'Kingdom Hearts series (manga)|Manga',
	'Kingdom Hearts (novels)|Novels',
	'Kingdom Hearts Another Report|Another Report',
	'Kingdom Hearts Ultimania|Ultimania',
	{'Category:Strategy guides|Strategy guides': [
		'Kingdom Hearts Official Strategy Guide|Kingdom Hearts',
		'Kingdom Hearts Chain of Memories Official Strategy Guide|Chain of Memories',
		'Kingdom Hearts II Official Strategy Guide|Kingdom Hearts II',
		'Kingdom Hearts 358/2 Days Signature Series Strategy Guide|358/2 Days',
		'Kingdom Hearts Birth by Sleep Signature Series Strategy Guide|Birth by Sleep',
                'Kingdom Hearts 3D: Dream Drop Distance Signature Series Guide|Dream Drop Distance',
                'Kingdom Hearts HD 1.5 ReMIX Game Guide|HD 1.5 ReMIX',
	]},
	{'Category:Music|Music': [
		{'Category:Soundtracks|Soundtracks': [
			'Kingdom Hearts Original Soundtrack|Kingdom Hearts',
			'Kingdom Hearts II Original Soundtrack|Kingdom Hearts II',
			'Kingdom Hearts Original Soundtrack Complete|Kingdom Hearts Complete',
			'Kingdom Hearts Birth by Sleep & 358/2 Days Original Soundtrack|Birth by Sleep & 358/2 Days',
			'Kingdom Hearts: Dream Drop Distance Original Soundtrack|Dream Drop Distance',
			'Kingdom Hearts HD 1.5 ReMIX Original Soundtrack|HD 1.5 ReMIX',
			'Kingdom Hearts HD 2.5 ReMIX Original Soundtrack|HD 2.5 ReMIX',
			'Kingdom Hearts - III, II.8, Unchained χ & Union χ (Cross) - Original Soundtrack|III, II.8, Unchained χ & Union χ [Cross]',
		]},
		{'Category:Compilation albums|Arrangements': [
			'Piano Collections Kingdom Hearts|Piano Collections',
			'Piano Collections Kingdom Hearts Field & Battle|Piano Collections: Field & Battle',
			'Kingdom Hearts Tribute Album|Tribute Album',
			'Kingdom Hearts Music Collection|Music Collection',
			'Kingdom Hearts 10th Anniversary Fan Selection -Melodies & Memories-|10th Anniversary Fan Selection',
			'Kingdom Hearts 20th Anniversary Vinyl LP Box|20th Anniversary Vinyl LP Box',
		]},
		{'Category:Concerts|Concerts': [
			'Kingdom Hearts Concert -First Breath-|Concert -First Breath-',
			'Kingdom Hearts Orchestra -World Tour-|Orchestra -World Tour-',
			'Kingdom Hearts Orchestra -World of Tres-|Orchestra -World of Tres-',
			'Kingdom Hearts Concert -Second Breath-|Concert -Second Breath-,
		]},
	]},
];

wgSidebar['Merchandise'] = [
		'List of merchandise by brand|Merchandise by brand',
		'Kingdom Hearts Trading Card Game|Trading Card Game',
];

wgSidebar['Help'] = [
	'KHWiki:About|About',
	'Help:Contents|Help pages',
	'KHWiki:Manual of Style|Manual of Style',
	'Category:Policies|Wiki policies',
	'KHWiki:Sandbox|Sandbox',
	'Category:Stubs|Stubs',
];

/**
 * 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 );