Open main menu

Changes

MediaWiki:Common.js

2,614 bytes removed, 13:40, 27 October 2020
m
UploadWizard message fix.
/* Any JavaScript here will be loaded for all users on every page load. */
/* Improvements for the HarvardReferences Mediawiki extension. */importScript('HarvardReferences.js'); /* Test function, for testing if js works */(function test() {
var myElement = document.getElementById('mw-testing');
}());
 /*Set some UploadWizard messages */ * Dynamic Navigation Barsmw. See [[Wikipedia:NavFrame]] * * Based on script from enmessages.wikipedia.org, 2008set('mwe-upwiz-09license-15. * * @source www.mediawiki.org/wiki/MediaWiki:Gadgetgpl-NavFrame3.js * @maintainer Helder0', "GNU General Public Licence 3.wiki, 2012–2013 * @maintainer Krinkle, 2013 */( function 0 () { // Set up the words in your languagevar collapseCaption = 'hide';var expandCaption = 'show'; var navigationBarHide = '[' + collapseCaption + '$2 legal code]';var navigationBarShow = '[' + expandCaption + ']'; /** * Shows and hides content and picture (if available) of navigation bars. * * @param {number} indexNavigationBar The index of navigation bar to be toggled * @param {jQuery.Event} e Event object */function toggleNavigationBar( indexNavigationBar, e ) { var navChild, navToggle = document.getElementById( 'NavToggle' + indexNavigationBar ), navFrame = document.getElementById( 'NavFrame' + indexNavigationBar );  // Prevent browser from jumping to href "#" e.preventDefault();  if ( !navFrame || !navToggle ) { return false; }  // If shown now if ( navToggle.firstChild.data == navigationBarHide ) { for ( navChild = navFramemw.firstChild; navChild != null; navChild = navChildmessages.nextSibling ) { if ( hasClassset( navChild, 'NavPic' ) ) { navChildmwe-upwiz-source-ownwork-gpl-3.style.display = 0-explain'none'; } if ( hasClass, "( navChildAnyone may use, 'NavContent' ) ) { navChild.style.display = 'none'; } } navToggle.firstChild.data = navigationBarShow;  // If hidden now } else if ( navToggle.firstChild.data == navigationBarShow ) share or remix { for ( navChild = navFrame.firstChild; navChild != null; navChild = navChild.nextSibling ) { if ( PLURAL:$( navChild ).hasClass( 'NavPic' ) 1|this work| $( navChild ).hasClass( 'NavContent' ) ) { navChild.style.display = 'block'; } } navToggle.firstChild.data = navigationBarHide; these works}} /** * Adds show/hide-button to navigation bars. * * @param {jQuery} $content */function createNavigationBarToggleButton( $content ) { var i, j, navFrame, navToggle, navToggleText, navChild, indexNavigationBar = 0, navFrames = $contentas long as they credit me and share any derivative work under this licence.find( 'div.NavFrame' ).toArray(");  // Iterate over all (new) nav frames for ( i = 0; i < navFramesmw.length; i++ ) { navFrame = navFrames[i]; // If found a navigation bar indexNavigationBar++; navToggle = documentmessages.createElementset( 'a' ); navTogglemwe-upwiz-source-ownwork-assert-gpl-3.className = 'NavToggle'; navToggle.setAttribute( 'id0', 'NavToggle' + indexNavigationBar ); navToggle.setAttribute( 'href'"I, '#' ); $( navToggle ).on( 'click'2, {{GENDER:$.proxy( toggleNavigationBar, null, indexNavigationBar ) );  navToggleText = document.createTextNode( navigationBarHide ); for ( navChild = navFrame.firstChild; navChild != null; navChild = navChild.nextSibling ) 4|the copyright holder}} of {{ if ( PLURAL:$( navChild ).hasClass( 'NavPic' ) 1|this work| $( navChild ).hasClass( 'NavContent' ) ) these works}}, irrevocably grant anyone the right to use { if ( navChild.style.display == 'none' ) { navToggleText = document.createTextNode( navigationBarShow ); break; PLURAL:$1|this work|these works} } }  navToggleunder the GNU General Public 3.appendChild( navToggleText ); // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) for ( j = 0; j < navFrame.childNodes.length; j++ ) { if licence ( [$( navFrame.childNodes[j3 legal code] ).hasClass( 'NavHead' ) ) { navFrame.childNodes[j].appendChild( navToggle ); } } navFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar ); }} mw.hook( 'wikipage.content' ).add( createNavigationBarToggleButton ); }()");
Trusted, Bureaucrats
4,223

edits