MediaWiki:Monobook.js

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

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

wgSidebar['Help'] = [ 'KHWiki:About|About', 'Help:Contents|Help Pages', 'KHWiki:Manual of Style|Manual of Style', 'Category:Stubs|Stubs', 'KHWiki:Sandbox|Sandbox', ];

wgSidebar['Games'] = [ 'Kingdom Hearts (game)|Kingdom Hearts', 'Kingdom Hearts: Chain of Memories|Chain of Memories', 'Kingdom Hearts II|Kingdom Hearts II', 'Kingdom Hearts 358/2 Days|358/2 Days', 'Kingdom Hearts Birth by Sleep|Birth by Sleep', 'Kingdom Hearts coded|coded', 'Kingdom Hearts 3D: Dream Drop Distance|Dream Drop Distance', {'Category:Games|Other titles': [ 'Kingdom Hearts Final Mix|Kingdom Hearts Final Mix', 'Kingdom Hearts Re:Chain of Memories|Re:Chain of Memories', 'Kingdom Hearts II Final Mix|Kingdom Hearts II Final Mix', 'Kingdom Hearts Birth by Sleep Final Mix|Birth by Sleep Final Mix', 'Kingdom Hearts Re:coded|Re:coded', 'Kingdom Hearts Mobile|Mobile', ]}, ];

wgSidebar['Universe'] = [ {'Category:Characters|Protagonists': [ 'Sora|Sora', 'Riku|Riku', 'Kairi|Kairi', 'Mickey Mouse|Mickey Mouse', 'Donald Duck|Donald Duck', 'Goofy|Goofy', 'Naminé|Naminé', 'Roxas|Roxas', 'Xion|Xion', 'Terra|Terra', 'Ventus|Ventus', 'Aqua|Aqua', ]},	{'Category:Characters|Antagonists': [ 'Master Xehanort|Master Xehanort', 'Ansem, Seeker of Darkness|Ansem', 'Organization XIII|Organization XIII', 'Maleficent|Maleficent', ]},	'Heartless|Heartless', 'Nobody|Nobodies', 'Unversed|Unversed', 'Dream Eater|Dream Eaters', {'Category:Worlds|Worlds': [ {'Category:Kingdom Hearts worlds|Kingdom Hearts': [ 'Dive to the Heart|Dive to the Heart', 'Destiny Islands|Destiny Islands', 'Disney Castle|Disney Castle', 'Traverse Town|Traverse Town', 'Wonderland|Wonderland', 'Olympus Coliseum|Olympus Coliseum', 'Deep Jungle|Deep Jungle', 'Agrabah|Agrabah', 'Halloween Town|Halloween Town', 'Monstro|Monstro', 'Atlantica|Atlantica', 'Neverland|Neverland', 'Hollow Bastion|Hollow Bastion', '100 Acre Wood|100 Acre Wood', 'End of the World|End of the World', 'Kingdom Hearts|Kingdom Hearts', 'Realm of Darkness|Realm of Darkness', ]},		{'Category:Kingdom Hearts: Chain of Memories worlds|Chain of Memories': [ 'Castle Oblivion|Castle Oblivion', 'Traverse Town|Traverse Town', 'Wonderland|Wonderland', 'Olympus Coliseum|Olympus Coliseum', 'Agrabah|Agrabah', 'Halloween Town|Halloween Town', 'Monstro|Monstro', 'Atlantica|Atlantica', 'Neverland|Neverland', 'Hollow Bastion|Hollow Bastion', '100 Acre Wood|100 Acre Wood', 'Twilight Town|Twilight Town', 'Destiny Islands|Destiny Islands', 'Realm of Darkness|Realm of Darkness', ]},		{'Category:Kingdom Hearts II worlds|Kingdom Hearts II': [ 'Realm of Darkness|Realm of Darkness', {'Twilight Town|Twilight Town': [ 'Simulated Twilight Town|Simulated Twilight Town', ]},			'Dive to the Heart|Dive to the Heart', 'Destiny Islands|Destiny Islands', 'Mysterious Tower|Mysterious Tower', 'Hollow Bastion|Hollow Bastion', 'Radiant Garden|Radiant Garden', 'The Land of Dragons|The Land of Dragons', 'Beast’s Castle|Beast’s Castle', {'Olympus Coliseum|Olympus Coliseum': [ 'Underworld|Underworld', ]},			'Disney Castle|Disney Castle', 'Timeless River|Timeless River', 'Atlantica|Atlantica', 'Port Royal|Port Royal', 'Agrabah|Agrabah', {'Halloween Town|Halloween Town': [ 'Christmas Town|Christmas Town', ]},			'Pride Lands|Pride Lands', '100 Acre Wood|100 Acre Wood', 'Space Paranoids|Space Paranoids', 'The World That Never Was|The World That Never Was', 'Kingdom Hearts (world)|Kingdom Hearts', 'Keyblade Graveyard|Keyblade Graveyard', ]},		{'Category:Kingdom Hearts 358/2 Days worlds|358/2 Days': [ 'Twilight Town|Twilight Town', 'Realm of Darkness|Realm of Darkness', 'The World That Never Was|The World That Never Was', 'Beast’s Castle|Beast’s Castle', 'Agrabah|Agrabah', 'Wonderland|Wonderland', 'Olympus Coliseum|Olympus Coliseum', 'Halloween Town|Halloween Town', 'Neverland|Neverland', 'Destiny Islands|Destiny Islands', 'Castle Oblivion|Castle Oblivion', 'Kingdom Hearts (world)|Kingdom Hearts', ]},		{'Category:Kingdom Hearts Birth by Sleep worlds|Birth by Sleep': [ 'Dive to the Heart|Dive to the Heart', 'The Land of Departure|The Land of Departure', 'Castle Oblivion|Castle Oblivion', 'Dwarf Woodlands|Dwarf Woodlands', 'Enchanted Dominion|Enchanted Dominion', 'Castle of Dreams|Castle of Dreams', 'Mirage Arena|Mirage Arena', 'Radiant Garden|Radiant Garden', '100 Acre Wood|100 Acre Wood', 'Mysterious Tower|Mysterious Tower', 'Disney Town|Disney Town', 'Deep Space|Deep Space', 'Olympus Coliseum|Olympus Coliseum', 'Neverland|Neverland', 'Destiny Islands|Destiny Islands', 'Keyblade Graveyard|Keyblade Graveyard', 'Kingdom Hearts (world)|Kingdom Hearts', 'Realm of Darkness|Realm of Darkness', ]},		{'Category:Kingdom Hearts coded worlds|coded': [ 'Disney Castle|Disney Castle', 'Destiny Islands|Destiny Islands', {'Datascape|Datascape': [ 'Dive to the Heart|Dive to the Heart', 'Traverse Town|Traverse Town', 'Wonderland|Wonderland', 'Olympus Coliseum|Olympus Coliseum', 'Agrabah|Agrabah', 'Hollow Bastion|Hollow Bastion', 'Castle Oblivion|Castle Oblivion', ]},		]},               {'Category:Kingdom Hearts 3D: Dream Drop Distance worlds|Dream Drop Distance': [ 'Destiny Islands|Destiny Islands', 'Mysterious Tower|Mysterious Tower', {'Dreaming Realm|Dreaming Realm': [ 'Traverse Town|Traverse Town', 'La Cité des Cloches|La Cité des Cloches', 'Prankster\'s Paradise|Prankster\'s Paradise', 'The Grid|The Grid', 'Country of the Musketeers|Country of the Musketeers', 'Symphony of Sorcery|Symphony of Sorcery', 'The World That Never Was|The World That Never Was', ]},			'Dive to the Heart|Dive to the Heart', ]},	]}, ];

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

wgSidebar['Literature and music'] = [ 'Kingdom Hearts series (manga)|Manga', 'Kingdom Hearts novels|Novels', 'Kingdom Hearts Another Report|Another Report', {'Kingdom Hearts Official Strategy Guide|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', ]},	{'Category:Music|Music': [ 'Kingdom Hearts Original Soundtrack', 'Kingdom Hearts II Original Soundtrack', 'Kingdom Hearts Original Soundtrack Complete', 'Piano Collections Kingdom Hearts', 'Piano Collections Kingdom Hearts Field & Battle', 'Kingdom Hearts Birth by Sleep & 358/2 Days Original Soundtrack', 'Kingdom Hearts 3D: Dream Drop Distance Original Soundtrack', ]}, ];

wgSidebar['Merchandise'] = [ {'Category:Merchandise|Figures': [ 'Play Arts Figures', 'Formation Arts Figures', 'Static Arts Figures', ]},		'Hot Topic Merchandise|Hot Topic', 'Kingdom Hearts Trading Card Game|TCG', 'Card:Main Page|TCG Wiki', ];

/** * 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 li = document.createElement( 'li' ); if ( typeof arr[i] == 'string' ) { var 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 ) .bind( 'mouseover', MonobookSidebar.mouseover ) .bind( '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, '_' ); // removed encodeURIComponent, it was messing things up --Jack Phoenix var a = document.createElement( 'a' ); if ( article.length > 7 && article.substr( 0, 7 ) == 'http://' ) { a.setAttribute( 'href', article ); } else { article = article.replace( MonobookSidebar.re_s, '_' ); // removed encodeURIComponent, it was messing things up --Jack Phoenix // Replace encoded colons with normal colons -- added this. --Jack Phoenix article = article.replace( '%3A', ':' ); // added code ends here a.setAttribute( 'href', wgArticlePath.replace( '$1', article ) ); }		a.appendChild( document.createTextNode( caption ) ); return a;	}, getId: function( name ) { return 'n-' + encodeURIComponent( name.replace( MonobookSidebar.re_s, '-' ) ).replace( MonobookSidebar.re_p, '.' ); } };

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