From: Fomafix Date: Tue, 2 Apr 2019 12:47:58 +0000 (+0200) Subject: protect.js: Reorder function declararion to avoid forward reference X-Git-Tag: 1.34.0-rc.0~2175^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=cf94fc563358db526390bf6f6ce05a2d3ebb2919 protect.js: Reorder function declararion to avoid forward reference The ESLint rule exception no-use-before-define can removed. Change-Id: Ib730102ae33f37ff95b001d689666f729885cd2d --- diff --git a/resources/src/mediawiki.legacy/protect.js b/resources/src/mediawiki.legacy/protect.js index 18f1c38cb2..01d6a655a6 100644 --- a/resources/src/mediawiki.legacy/protect.js +++ b/resources/src/mediawiki.legacy/protect.js @@ -1,149 +1,71 @@ -/* eslint-disable no-use-before-define */ ( function () { var config = require( './config.json' ), reasonCodePointLimit = mw.config.get( 'wgCommentCodePointLimit' ), reasonByteLimit = mw.config.get( 'wgCommentByteLimit' ); /** - * Set up the protection chaining interface (i.e. "unlock move permissions" checkbox) - * on the protection form + * Get a list of all protection selectors on the page * - * @return {boolean} - */ - function init() { - var $cell = $( '' ), - $row = $( '' ).append( $cell ); - - if ( !$( '#mwProtectSet' ).length ) { - return false; - } - - $( 'form#mw-Protect-Form' ).on( 'submit', toggleUnchainedInputs.bind( this, true ) ); - getExpirySelectors().each( function () { - $( this ).on( 'change', updateExpiryList ); - } ); - getExpiryInputs().each( function () { - $( this ).on( 'keyup change', updateExpiry ); - } ); - getLevelSelectors().each( function () { - $( this ).on( 'change', updateLevels ); - } ); - - $( '#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' } ) - .on( 'click', onChainClick ) - .prop( 'checked', !areAllTypesMatching() ), - document.createTextNode( ' ' ), - $( '