Today, in this article we are going to delve into the topic of
MediaWiki:Gadget-CollapsibleNav.js. This is a topic that has sparked the interest of many people in recent times, and is essential to understanding key aspects of our society.
MediaWiki:Gadget-CollapsibleNav.js has a profound impact on our daily lives, influencing our decisions, beliefs and lifestyle. Throughout this text, we will explore the different dimensions of
MediaWiki:Gadget-CollapsibleNav.js, from its history to its relevance today. In addition, we will analyze how
MediaWiki:Gadget-CollapsibleNav.js has evolved over time and the implications it has in various areas of society. Without a doubt, this article will be very useful for all those who wish to better understand the phenomenon of
MediaWiki:Gadget-CollapsibleNav.js and its importance in today's world.
/**
* Collapsible navigation for Vector
* @maintainer Nardog
*/
// CC0
'use strict';
function onToggle( e ) {
var collapsedIds = mw.storage.getObject( 'vector-nav-collapsed' ) || ,
index = collapsedIds.indexOf( this.id );
if ( e.type === 'afterExpand' ) {
// Remove ID from array
if ( index !== -1 ) {
collapsedIds.splice( index, 1 );
}
if ( collapsedIds.length ) {
mw.storage.setObject( 'vector-nav-collapsed', collapsedIds );
} else {
// Remove the data altogether if empty
mw.storage.remove( 'vector-nav-collapsed' );
}
} else {
if ( index === -1 ) {
collapsedIds.push( this.id );
mw.storage.setObject( 'vector-nav-collapsed', collapsedIds );
}
}
}
$( function () {
var collapsedIds = mw.storage.getObject( 'vector-nav-collapsed' ) || ;
$( '#mw-panel .vector-menu' )
.addClass( 'collapsible-nav mw-collapsible' )
.addClass( function () {
if ( collapsedIds.indexOf( this.id ) !== -1 ) {
return 'mw-collapsed';
}
} )
.children( '.vector-menu-heading' )
.addClass( 'mw-collapsible-toggle' )
.end()
.children( '.vector-menu-content' )
.addClass( 'mw-collapsible-content' )
.end()
.makeCollapsible()
.on( 'afterCollapse.mw-collapsible afterExpand.mw-collapsible', onToggle );
} );