552
ediciones
Cambios
sin resumen de edición
/**
* Instead of cluttering up the global scope withDynamic Navigation Bars. See [[Wikipedia:NavFrame]] * variables, they should instead be set as a * property of this global variableBased on script from en.wikipedia.org, 2008-09-15.
*
* E@source www.gmediawiki.org/wiki/MediaWiki: Instead ofGadget-NavFrame.js * myVar = 'blah';@maintainer Helder.wiki, 2012–2013 * use * mcw.myVar = 'blah';@maintainer Krinkle, 2013
*/
/**
* Collapsible tablesShows and hides content and picture (if available) of navigation bars.
*
* Based on http://www@param {number} indexNavigationBar The index of navigation bar to be toggled * @param {jQuery.mediawiki.org/wiki/Manual:Collapsible_tables#Common.js_script_.28before_1.18.29Event} e Event object
*/
return false;
}
// If shown now var buttonText if ( navToggle.firstChild.data = ' <span class="collapsible-button">[<span classnavigationBarHide ) { for ( navChild ="jslink">' + mcwnavFrame.i18nfirstChild; navChild != null; navChild = navChild.hideText + '</span>]</span> ';nextSibling ) { $content.each if ( functionhasClass(navChild, 'NavPic' ) ) { var $table navChild.style.display = $( this ), $header, $collapseButton, firstWidth, secondWidth'none'; } // This table is already collapsible if ( $table.datahasClass( navChild, 'collapsibleNavContent' ) ) { navChild.style.display = 'none'; return true;}
}
navToggle.firstChild.data = navigationBarShow; // Use the collapse-button If hidden now } else if specified otherwise the first header cell of the first row $header = $table( navToggle.find( 'tr:first firstChild.collapse-button' data == navigationBarShow );{ if for ( navChild = navFrame.firstChild; navChild !$header= null; navChild = navChild.length nextSibling ) { if ( $header = ( navChild ).hasClass( 'NavPic' ) || $table( navChild ).findhasClass( 'tr:first > th:firstNavContent' )) { navChild.style.display = 'block'; }
}
navToggle.firstChild.data = navigationBarHide; }} /** * Adds show/ No header or the table body is emptyhide-button to navigation bars. if * * @param {jQuery} $content */function createNavigationBarToggleButton( !$header.length || !content ) { var i, j, navFrame, navToggle, navToggleText, navChild, indexNavigationBar = 0, navFrames = $tablecontent.find( 'tr:notdiv.NavFrame' ).toArray(tr:first); // Iterate over all (new) nav frames for ( i = 0; i < navFrames.length; i++ ) { navFrame = navFrames[i]; // If found a navigation bar indexNavigationBar++; navToggle = document.createElement( 'a' ); navToggle.className = 'NavToggle'; navToggle.textsetAttribute('id', 'NavToggle' + indexNavigationBar ); navToggle.replacesetAttribute( /\n/g'href', '#' ); $( navToggle ).on( 'click', $.proxy( toggleNavigationBar, null, indexNavigationBar ) ); navToggleText = document.length createTextNode( navigationBarHide ); for ( navChild = navFrame.firstChild; navChild != null; navChild = navChild.nextSibling ) { return trueif ( $( navChild ).hasClass( 'NavPic' ) || $( navChild ).hasClass( 'NavContent' ) ) { if ( navChild.style.display == 'none' ) { navToggleText = document.createTextNode( navigationBarShow ); break; } }
}
}
}
}
} mw.hook( 'wikipage.content' ).add( createNavigationBarToggleButton );mcw.makeCollapsible }());