MediaWiki:Monobook.js

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

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

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

wgSidebar['Franchises'] = [ 'My Little Pony n Friends|n Friends', 'My Little Pony Tales|Tales', 'My Little Pony (Generation 3)|Generation 3', 'My Little Pony: Friendship is Magic|Friendship is Magic', 'My Little Pony: Equestria Girls|Equestria Girls', 'My Little Pony: Pony Life|Pony Life', {'Category:Franchises|Minor franchises': [ 'My Little Bunny', 'My Little Kitty', 'My Little Puppy', 'My Pretty Mermaid', 'Fairytales', 'Moondreamers', 'GloFriends', 'Little LovelyLocks', 'Little Pretty', ]}, ];

wgSidebar['Characters'] = [ {'Category:My Little Pony characters|n Friends': [ 'Megan Williams (My Little Pony)|Megan', 'Spike (My Little Pony)|Spike', 'Twilight (My Little Pony)|Twilight', 'Wind Whistler (My Little Pony)|Wind Whistler', 'Heart Throb (My Little Pony)|Heart Throb', 'Gusty (My Little Pony)|Gusty', 'North Star (My Little Pony)|North Star', 'The Moochick', 'Tirac (My Little Pony)|Tirac', 'Scorpan (My Little Pony)|Scorpan', ]},	{'Category:Tales characters|Tales': [ 'Starlight (Tales)|Starlight', 'Sweetheart', 'Melody', 'Bright Eyes', 'Patch', 'Clover', 'Bon Bon (Tales)|Bon Bon', 'Teddy (Tales)|Teddy', 'Ace (Tales)|Ace', 'Lancer (Tales)|Lancer',

]},	{'Category:Generation 3 characters|Generaton 3': [ 'Minty (Generation 3)|Minty', 'Kimono (Generation 3)|Kimono', 'Rainbow Dash (Generation 3)|Rainbow Dash', 'Wysteria (Generation 3)|Wysteria', 'Pinkie Pie (Generation 3)|Pinkie Pie', 'Razaroo', 'Scootaloo (Generation 3)|Scootaloo', 'Cheerilee (Generation 3)|Cheerilee', 'Sweetie Belle (Generation 3)|Sweetie Belle', 'Starsong (Generation 3)|Starsong',

]},	{'Category:Friendship is Magic characters|Friendship is Magic': [ {'Male Six|Mane Six': [ 'Twilight Sparkle (Friendship is Magic)|Twilight Sparkle', 'Rarity (Friendship is Magic)|Rarity', 'Applejack (Friendship is Magic)|Applejack', 'Pinkie Pie (Friendship is Magic)|Pinkie Pie', 'Rainbow Dash (Friendship is Magic)|Rainbow Dash', 'Fluttershy (Friendship is Magic)|Fluttershy', ]},			{'Background Six|Background Six': [ 'Lyra Heartstrings (Friendship is Magic)|Lyra Heartstrings', 'Bon Bon (Friendship is Magic)|Bon Bon', 'Vinyl Scratch (Friendship is Magic)|Vinyl Scratch', 'Octavia Melody (Friendship is Magic)|Octavia Melody', 'Dr. Hooves', 'Derpy (Friendship is Magic)|Derpy', ]},

{'Cutie Mark Crusaders|Cutie Mark Crusaders': [ 'Apple Bloom (Friendship is Magic)|Apple Bloom', 'Sweetie Belle (Friendship is Magic)|Sweetie Belle', 'Scootaloo (Friendship is Magic)|Scootaloo', 'Babs Seed (Friendship is Magic)|Babs Seed', ]},			{'Equestrian Royal Family|Royal Family': [ 'Princess Celestia (Friendship is Magic)|Princess Celestia', 'Princess Luna (Friendship is Magic)|Princess Luna', 'Princess Cadance (Friendship is Magic)|Princess Cadance', 'Shining Armor (Friendship is Magic)|Shining Armor', 'Flurryheart|Flurryheart', ]},			{'School of Friendship|School of Friendship': [ 'Sandbar', 'Yona', 'Gallus', 'Smolder', 'Silverstream', 'Ocellus', 'Starlight Glimmer', 'Trixie Lulamoon (Frieindship is Magic)|Trixie', 'Sunburst', ]},			{'Ponyviille Schoolhouse|Ponyville Schoolhouse': [ 'Cheerilee (Friendship is Magic)|Cheerilee', 'Diamond Tiara (Friendship is Magic)|Diamond Tiara', 'Silver Spoon(Friendship is Magic)|Silver Spoon', 'Snails', 'Twist', 'Featherweight', 'Lilymoon', 'Pipsqeak', 'Button Mash', ]},			{'Dragon Lands': [ 'Ember (Friendship is Magic)|Ember', 'Garble', 'Razor', 'Dragon Lord Torch|Torch', 'Maar', 'Fume', 'Charcoal', 'Fizzle', 'Clump', ]},			{'Families': [ {'Apple family': [ 'Granny Smith (Friendship is Magic)|Granny Smith', 'Big McIntosh (Friendship is Magic)|Big McIntosh', 'Pear Butter', 'Bright McIntosh', 'Sugar Belle', 'Big Sugar', 'Grand Pear', ]},		                  			{'Pie family': [ 'Pinkie Pie (Friendship is Magic)|Pinkie Pie', 'Maud Pie (Friendship is Magic)|Maud Pie', 'Marble Pie', 'Limestone Pie', 'Igneous Pie', 'Smokey Quartz', 'Cheese Sandwich', ]},		                  'Sparkle family', 'Shy family', 'Belle family', 'Dash family', 'Lulamoon family', 'Scootaloo family', 'Starlight family', ]},		'Category:Friendship is Magic villains|Villains',

]},	'Equestria Girls characters|Equestria Girls', 'Pony life characters|Pony Life', 'Generation 5 characters|Generation 5', ];

wgSidebar['Mythos'] = [ 'Places', 'Objects', 'Events', 'Species', 'Society', 'Consumables|Food', 'Science', 'Abilities', 'Category:Mythology of My Little Pony|More...', ];

wgSidebar['Media'] = [ 'My Little Pony on TV|Television', 'My Little Pony films|Films', 'My Little Pony on stage|Stage', 'My Little Pony books|Books', 'My Little Pony comics|Comics', 'My Little Pony manga|Manga', 'My Little Pony magazines|Magazines', 'My Little Pony software|Software', ];

wgSidebar['Products'] = [ 'My Little Pony toys|Toys', 'My Little Pony items|Items ', 'My Little Pony fashion|Fashion', ];

/** * 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 ) .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 > 4 && article.substr( 0, 4 ) == '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', mw.config.get('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 */ $( MonobookSidebar.init );