diff --git a/.eslintrc.json b/.eslintrc.json
index 96060c6b9..c498c3d2a 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -1,7 +1,7 @@
{
"root": true,
"extends": [
- "wikimedia/client-es5",
+ "wikimedia/client",
"wikimedia/jquery",
"wikimedia/mediawiki"
]
diff --git a/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js b/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js
index 03a5ada1c..f46d0c1e7 100644
--- a/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js
+++ b/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js
@@ -1,6 +1,6 @@
/* eslint-disable no-jquery/no-global-selector */
$( document ).on( 'click', '.fancycaptcha-reload', function () {
- var $this = $( this ),
+ const $this = $( this ),
$root = $this.closest( '.fancycaptcha-captcha-container' ),
$captchaImage = $root.find( '.fancycaptcha-image' );
@@ -8,8 +8,8 @@ $( document ).on( 'click', '.fancycaptcha-reload', function () {
// AJAX request to get captcha index key
new mw.Api().post( { action: 'fancycaptchareload' } ).done( function ( data ) {
- var captchaIndex = data.fancycaptchareload.index,
- imgSrc;
+ const captchaIndex = data.fancycaptchareload.index;
+ let imgSrc;
if ( typeof captchaIndex === 'string' ) {
// replace index key with a new one for captcha image
imgSrc = $captchaImage.attr( 'src' ).replace( /(wpCaptchaId=)\w+/, '$1' + captchaIndex );
diff --git a/Gruntfile.js b/Gruntfile.js
index fe3c9188a..cdb5b91f3 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -1,8 +1,8 @@
/* eslint-env node */
module.exports = function ( grunt ) {
- var messagesDirs = grunt.file.readJSON( 'extension.json' ).MessagesDirs;
+ const messagesDirs = grunt.file.readJSON( 'extension.json' ).MessagesDirs;
- var subExtensions = [
+ const subExtensions = [
'QuestyCaptcha',
'ReCaptchaNoCaptcha',
'FancyCaptcha',
diff --git a/ReCaptchaNoCaptcha/resources/ve-confirmedit-reCaptchaNoCaptcha/ve.init.mw.NoCaptchaReCaptchaSaveErrorHandler.js b/ReCaptchaNoCaptcha/resources/ve-confirmedit-reCaptchaNoCaptcha/ve.init.mw.NoCaptchaReCaptchaSaveErrorHandler.js
index eda35444d..306177cb2 100644
--- a/ReCaptchaNoCaptcha/resources/ve-confirmedit-reCaptchaNoCaptcha/ve.init.mw.NoCaptchaReCaptchaSaveErrorHandler.js
+++ b/ReCaptchaNoCaptcha/resources/ve-confirmedit-reCaptchaNoCaptcha/ve.init.mw.NoCaptchaReCaptchaSaveErrorHandler.js
@@ -8,8 +8,8 @@ mw.loader.using( 'ext.visualEditor.targetLoader' ).then( function () {
ve.init.mw.NoCaptchaReCaptchaSaveErrorHandler.static.name = 'confirmEditNoCaptchaReCaptcha';
ve.init.mw.NoCaptchaReCaptchaSaveErrorHandler.static.getReadyPromise = function () {
- var onLoadFn = 'onRecaptchaLoadCallback' + Date.now(),
- deferred, config, scriptURL, params;
+ const onLoadFn = 'onRecaptchaLoadCallback' + Date.now();
+ let deferred, config, scriptURL, params;
if ( !this.readyPromise ) {
deferred = $.Deferred();
@@ -27,13 +27,13 @@ mw.loader.using( 'ext.visualEditor.targetLoader' ).then( function () {
};
ve.init.mw.NoCaptchaReCaptchaSaveErrorHandler.static.matchFunction = function ( data ) {
- var captchaData = ve.getProp( data, 'visualeditoredit', 'edit', 'captcha' );
+ const captchaData = ve.getProp( data, 'visualeditoredit', 'edit', 'captcha' );
return !!( captchaData && captchaData.type === 'recaptchanocaptcha' );
};
ve.init.mw.NoCaptchaReCaptchaSaveErrorHandler.static.process = function ( data, target ) {
- var self = this,
+ const self = this,
config = mw.config.get( 'wgConfirmEditConfig' ),
siteKey = config.reCaptchaSiteKey,
$container = $( '
' );
diff --git a/hCaptcha/resources/ve-confirmedit-hCaptcha/ve.init.mw.HCaptchaSaveErrorHandler.js b/hCaptcha/resources/ve-confirmedit-hCaptcha/ve.init.mw.HCaptchaSaveErrorHandler.js
index b86730742..a2e637a44 100644
--- a/hCaptcha/resources/ve-confirmedit-hCaptcha/ve.init.mw.HCaptchaSaveErrorHandler.js
+++ b/hCaptcha/resources/ve-confirmedit-hCaptcha/ve.init.mw.HCaptchaSaveErrorHandler.js
@@ -7,8 +7,8 @@ mw.loader.using( 'ext.visualEditor.targetLoader' ).then( function () {
ve.init.mw.HCaptchaSaveErrorHandler.static.name = 'confirmEditHCaptcha';
ve.init.mw.HCaptchaSaveErrorHandler.static.getReadyPromise = function () {
- var onLoadFn = 'onHcaptchaLoadCallback' + Date.now(),
- deferred, scriptURL, params;
+ const onLoadFn = 'onHcaptchaLoadCallback' + Date.now();
+ let deferred, scriptURL, params;
if ( !this.readyPromise ) {
deferred = $.Deferred();
@@ -25,13 +25,13 @@ mw.loader.using( 'ext.visualEditor.targetLoader' ).then( function () {
};
ve.init.mw.HCaptchaSaveErrorHandler.static.matchFunction = function ( data ) {
- var captchaData = ve.getProp( data, 'visualeditoredit', 'edit', 'captcha' );
+ const captchaData = ve.getProp( data, 'visualeditoredit', 'edit', 'captcha' );
return !!( captchaData && captchaData.type === 'hcaptcha' );
};
ve.init.mw.HCaptchaSaveErrorHandler.static.process = function ( data, target ) {
- var self = this,
+ const self = this,
siteKey = require( './config.json' ).hCaptchaSiteKey,
$container = $( '
' );
diff --git a/resources/libs/ext.confirmEdit.CaptchaInputWidget.js b/resources/libs/ext.confirmEdit.CaptchaInputWidget.js
index 5b336a8fd..410f036a2 100644
--- a/resources/libs/ext.confirmEdit.CaptchaInputWidget.js
+++ b/resources/libs/ext.confirmEdit.CaptchaInputWidget.js
@@ -38,14 +38,13 @@ OO.inheritClass( mw.libs.confirmEdit.CaptchaInputWidget, OO.ui.TextInputWidget )
/* Methods */
mw.libs.confirmEdit.CaptchaInputWidget.prototype.makeCaptchaInterface = function ( captchaData ) {
- var $captchaImg, msg, question,
- $captchaDiv, $captchaParagraph;
+ let $captchaImg, msg, question;
- $captchaParagraph = $( '
' ).append(
+ const $captchaParagraph = $( '
' ).append(
$( '
' ).text( mw.msg( 'captcha-label' ) ),
document.createTextNode( mw.msg( 'colon-separator' ) )
);
- $captchaDiv = $( '' ).append( $captchaParagraph );
+ const $captchaDiv = $( '
' ).append( $captchaParagraph );
if ( captchaData.url ) {
// FancyCaptcha
diff --git a/resources/ve-confirmedit/ve.init.mw.CaptchaSaveErrorHandler.js b/resources/ve-confirmedit/ve.init.mw.CaptchaSaveErrorHandler.js
index a87f373ad..63bc83d0e 100644
--- a/resources/ve-confirmedit/ve.init.mw.CaptchaSaveErrorHandler.js
+++ b/resources/ve-confirmedit/ve.init.mw.CaptchaSaveErrorHandler.js
@@ -15,7 +15,7 @@ mw.loader.using( 'ext.visualEditor.targetLoader' ).then( function () {
ve.init.mw.CaptchaSaveErrorHandler.static.name = 'confirmEditCaptchas';
ve.init.mw.CaptchaSaveErrorHandler.static.matchFunction = function ( data ) {
- var captchaData = ve.getProp( data, 'visualeditoredit', 'edit', 'captcha' );
+ const captchaData = ve.getProp( data, 'visualeditoredit', 'edit', 'captcha' );
return !!( captchaData && (
captchaData.url ||
@@ -26,7 +26,10 @@ mw.loader.using( 'ext.visualEditor.targetLoader' ).then( function () {
};
ve.init.mw.CaptchaSaveErrorHandler.static.process = function ( data, target ) {
- var captchaInput;
+ const captchaInput = new mw.libs.confirmEdit.CaptchaInputWidget(
+ ve.getProp( data, 'visualeditoredit', 'edit', 'captcha' )
+ );
+ ve.targetLinksToNewWindow( captchaInput.$element[ 0 ] );
function onCaptchaLoad() {
target.saveDialog.updateSize();
@@ -34,11 +37,6 @@ mw.loader.using( 'ext.visualEditor.targetLoader' ).then( function () {
captchaInput.scrollElementIntoView();
}
- captchaInput = new mw.libs.confirmEdit.CaptchaInputWidget(
- ve.getProp( data, 'visualeditoredit', 'edit', 'captcha' )
- );
- ve.targetLinksToNewWindow( captchaInput.$element[ 0 ] );
-
captchaInput.on( 'load', onCaptchaLoad );
// Save when pressing 'Enter' in captcha field as it is single line.
captchaInput.on( 'enter', function () {