mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 11:16:51 +00:00
Merge "Support QuestyCaptcha and (kind of) MathCaptcha"
This commit is contained in:
commit
48d025aead
|
@ -704,10 +704,12 @@ $wgResourceModules += array(
|
||||||
'hidetoc',
|
'hidetoc',
|
||||||
|
|
||||||
'captcha-edit',
|
'captcha-edit',
|
||||||
// Only used if FancyCaptcha is installed and triggered on save
|
|
||||||
'captcha-label',
|
'captcha-label',
|
||||||
'fancycaptcha-edit',
|
|
||||||
'colon-separator',
|
'colon-separator',
|
||||||
|
// Only used if FancyCaptcha is installed and triggered on save
|
||||||
|
'fancycaptcha-edit',
|
||||||
|
// Only used if QuestyCaptcha is installed and triggered on save
|
||||||
|
'questycaptcha-edit'
|
||||||
),
|
),
|
||||||
'targets' => array( 'desktop', 'mobile' ),
|
'targets' => array( 'desktop', 'mobile' ),
|
||||||
),
|
),
|
||||||
|
|
|
@ -556,13 +556,22 @@ ve.init.mw.ViewPageTarget.prototype.onSaveErrorCaptcha = function ( editApi ) {
|
||||||
$captchaDiv.append(
|
$captchaDiv.append(
|
||||||
$( '<img>' ).attr( 'src', editApi.captcha.url )
|
$( '<img>' ).attr( 'src', editApi.captcha.url )
|
||||||
);
|
);
|
||||||
} else if ( editApi.captcha.type === 'simple' ) { // SimpleCaptcha
|
} else if ( editApi.captcha.type === 'simple' || editApi.captcha.type === 'math' ) {
|
||||||
|
// SimpleCaptcha and MathCaptcha
|
||||||
$captchaParagraph.append(
|
$captchaParagraph.append(
|
||||||
mw.message( 'captcha-edit' ).parse(),
|
mw.message( 'captcha-edit' ).parse(),
|
||||||
'<br>',
|
'<br>',
|
||||||
document.createTextNode( editApi.captcha.question )
|
document.createTextNode( editApi.captcha.question )
|
||||||
);
|
);
|
||||||
|
} else if ( editApi.captcha.type === 'question' ) {
|
||||||
|
// QuestyCaptcha
|
||||||
|
$captchaParagraph.append(
|
||||||
|
mw.message( 'questycaptcha-edit' ).parse(),
|
||||||
|
'<br>',
|
||||||
|
editApi.captcha.question
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$captchaDiv.append( this.captcha.input.$element );
|
$captchaDiv.append( this.captcha.input.$element );
|
||||||
this.showSaveError( $captchaDiv, false );
|
this.showSaveError( $captchaDiv, false );
|
||||||
this.events.trackSaveError( 'captcha' );
|
this.events.trackSaveError( 'captcha' );
|
||||||
|
|
|
@ -662,7 +662,12 @@ ve.init.mw.Target.prototype.onSaveError = function ( doc, saveData, jqXHR, statu
|
||||||
// "question" or "fancy" type of captcha. They all expose differently named properties in the
|
// "question" or "fancy" type of captcha. They all expose differently named properties in the
|
||||||
// API for different things in the UI. At this point we only support the SimpleCaptcha and FancyCaptcha
|
// API for different things in the UI. At this point we only support the SimpleCaptcha and FancyCaptcha
|
||||||
// which we very intuitively detect by the presence of a "url" property.
|
// which we very intuitively detect by the presence of a "url" property.
|
||||||
if ( editApi && editApi.captcha && ( editApi.captcha.url || editApi.captcha.type === 'simple' ) ) {
|
if ( editApi && editApi.captcha && (
|
||||||
|
editApi.captcha.url ||
|
||||||
|
editApi.captcha.type === 'simple' ||
|
||||||
|
editApi.captcha.type === 'math' ||
|
||||||
|
editApi.captcha.type === 'question'
|
||||||
|
) ) {
|
||||||
this.emit( 'saveErrorCaptcha', editApi );
|
this.emit( 'saveErrorCaptcha', editApi );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue