diff --git a/modules/ext.abuseFilter.examine.js b/modules/ext.abuseFilter.examine.js index 2a2350419..20e71ef6d 100644 --- a/modules/ext.abuseFilter.examine.js +++ b/modules/ext.abuseFilter.examine.js @@ -81,19 +81,14 @@ params = { action: 'abusefiltercheckmatch', filter: filter - }, - api = new mw.Api(); + }; $( this ).injectSpinner( { id: 'filter-check', size: 'large' } ); - if ( examine.type === 'rc' ) { - params.rcid = examine.id; - } else { - params.logid = examine.id; - } + params[ examine.type === 'rc' ? 'rcid' : 'logid' ] = examine.id; // Use post due to the rather large amount of data - api.post( params ) + new mw.Api().post( params ) .done( examinerTestProcess ) .fail( examinerTestProcessFailure ); } diff --git a/modules/ext.abuseFilter.tools.js b/modules/ext.abuseFilter.tools.js index c2d6b5632..7130101c9 100644 --- a/modules/ext.abuseFilter.tools.js +++ b/modules/ext.abuseFilter.tools.js @@ -15,11 +15,11 @@ * @param {jQuery.Event} e The event fired when the function is called */ function doExprSubmit( e ) { - var expr = $( '#wpFilterRules' ).val(), - api = new mw.Api(); + var expr = $( '#wpFilterRules' ).val(); + $( this ).injectSpinner( { id: 'abusefilter-expr', size: 'large' } ); - api.post( { + new mw.Api().post( { action: 'abusefilterevalexpression', expression: expr, prettyprint: 1 @@ -106,8 +106,7 @@ */ function doReautoSubmit() { var nameField = OO.ui.infuse( $( '#reautoconfirm-user' ) ), - name = nameField.getValue(), - api; + name = nameField.getValue(); if ( name === '' ) { return false; @@ -115,8 +114,7 @@ $( this ).injectSpinner( { id: 'abusefilter-reautoconfirm', size: 'large' } ); - api = new mw.Api(); - api.post( { + new mw.Api().post( { action: 'abusefilterunblockautopromote', user: name, token: mw.user.tokens.get( 'csrfToken' ) @@ -128,8 +126,6 @@ $( function initialize() { $( '#mw-abusefilter-submitexpr' ).on( 'click', doExprSubmit ); - if ( $( '#mw-abusefilter-reautoconfirmsubmit' ).length ) { - $( '#mw-abusefilter-reautoconfirmsubmit' ).on( 'click', doReautoSubmit ); - } + $( '#mw-abusefilter-reautoconfirmsubmit' ).on( 'click', doReautoSubmit ); } ); }() );