X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki.legacy%2Fprotect.js;h=1d0e33507c1c04a5314a3df531b23bc117588764;hb=9097f95ecc3c45f9265779e0051658ed9e2d2c91;hp=73978d9ba6ad4f0170913b05a09d81a870b52dbc;hpb=41a744cba7b99e2c6db5d8c97913ed33e1d5c3f6;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki.legacy/protect.js b/resources/src/mediawiki.legacy/protect.js index 73978d9ba6..1d0e33507c 100644 --- a/resources/src/mediawiki.legacy/protect.js +++ b/resources/src/mediawiki.legacy/protect.js @@ -1,5 +1,6 @@ ( function () { var ProtectionForm, + config = require( './config.json' ), reasonCodePointLimit = mw.config.get( 'wgCommentCodePointLimit' ), reasonByteLimit = mw.config.get( 'wgCommentByteLimit' ); @@ -18,9 +19,7 @@ return false; } - if ( mw.config.get( 'wgCascadeableLevels' ) !== undefined ) { - $( 'form#mw-Protect-Form' ).on( 'submit', this.toggleUnchainedInputs.bind( ProtectionForm, true ) ); - } + $( 'form#mw-Protect-Form' ).on( 'submit', this.toggleUnchainedInputs.bind( ProtectionForm, true ) ); this.getExpirySelectors().each( function () { $( this ).on( 'change', ProtectionForm.updateExpiryList.bind( ProtectionForm, this ) ); } ); @@ -81,13 +80,7 @@ * @return {boolean} */ isCascadeableLevel: function ( level ) { - var cascadeableLevels = mw.config.get( 'wgCascadeableLevels' ); - - if ( !Array.isArray( cascadeableLevels ) ) { - return false; - } - - return cascadeableLevels.indexOf( level ) !== -1; + return config.CascadingRestrictionLevels.indexOf( level ) !== -1; }, /** @@ -162,7 +155,7 @@ * @return {boolean} */ matchAttribute: function ( objects, attrName ) { - // eslint-disable-next-line jquery/no-map-util + // eslint-disable-next-line no-jquery/no-map-util return $.map( objects, function ( object ) { return object[ attrName ]; } ).filter( function ( item, index, a ) {