From c1f9b1f7b1b77776192048005dcc66dcf3df2bfb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 27 Dec 2014 15:41:37 +0100 Subject: Update to MediaWiki 1.24.1 --- resources/src/mediawiki.legacy/protect.js | 240 ++++++++++++++++++++++++++++++ 1 file changed, 240 insertions(+) create mode 100644 resources/src/mediawiki.legacy/protect.js (limited to 'resources/src/mediawiki.legacy/protect.js') diff --git a/resources/src/mediawiki.legacy/protect.js b/resources/src/mediawiki.legacy/protect.js new file mode 100644 index 00000000..f9069b6f --- /dev/null +++ b/resources/src/mediawiki.legacy/protect.js @@ -0,0 +1,240 @@ +( function ( mw, $ ) { + +var ProtectionForm = window.ProtectionForm = { + /** + * Set up the protection chaining interface (i.e. "unlock move permissions" checkbox) + * on the protection form + */ + init: function () { + var $cell = $( '' ), $row = $( '' ).append( $cell ); + + if ( !$( '#mwProtectSet' ).length ) { + return false; + } + + if ( mw.config.get( 'wgCascadeableLevels' ) !== undefined ) { + $( 'form#mw-Protect-Form' ).submit( this.toggleUnchainedInputs.bind( ProtectionForm, true ) ); + } + this.getExpirySelectors().each( function () { + $( this ).change( ProtectionForm.updateExpiryList.bind( ProtectionForm, this ) ); + } ); + this.getExpiryInputs().each( function () { + $( this ).on( 'keyup change', ProtectionForm.updateExpiry.bind( ProtectionForm, this ) ); + } ); + this.getLevelSelectors().each( function () { + $( this ).change( ProtectionForm.updateLevels.bind( ProtectionForm, this ) ); + } ); + + $( '#mwProtectSet > tbody > tr:first' ).after( $row ); + + // If there is only one protection type, there is nothing to chain + if ( $( '[id ^= mw-protect-table-]' ).length > 1 ) { + $cell.append( + $( '' ) + .attr( { id: 'mwProtectUnchained', type: 'checkbox' } ) + .click( this.onChainClick.bind( this ) ) + .prop( 'checked', !this.areAllTypesMatching() ), + document.createTextNode( ' ' ), + $( '