From: Florianschmidtwelzow Date: Wed, 21 Jan 2015 07:22:39 +0000 (+0100) Subject: Remove JS for FancyCaptcha adjustment X-Git-Tag: 1.31.0-rc.0~10084^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=e019b02b1e8ae9a3ee6d3c1fc0591d9a985b5822;p=lhc%2Fweb%2Fwiklou.git Remove JS for FancyCaptcha adjustment With change If9a68aaee2cf98d63647816ccc8fc0bad12ca3d3 the html output of FancyCaptcha is wellformed, so there is no need to run this JS code on UserLogin anymore. Bug: T87190 Change-Id: I5e60a07ce9451c4e23bfa0e3217c3949bf6b8058 --- diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index 5b6d22bbe4..0410ef01f1 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -1367,9 +1367,6 @@ class LoginForm extends SpecialPage { 'mediawiki.ui.input', 'mediawiki.special.userlogin.common.styles' ) ); - $out->addModules( array( - 'mediawiki.special.userlogin.common.js' - ) ); if ( $this->mType == 'signup' ) { // XXX hack pending RL or JS parse() support for complex content messages diff --git a/resources/Resources.php b/resources/Resources.php index 28a27d7bf4..95bc955877 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -1647,15 +1647,6 @@ return array( 'resources/src/mediawiki.special/mediawiki.special.userlogin.login.css', ), ), - 'mediawiki.special.userlogin.common.js' => array( - 'scripts' => array( - 'resources/src/mediawiki.special/mediawiki.special.userlogin.common.js', - ), - 'messages' => array( - 'createacct-captcha', - 'createacct-imgcaptcha-ph', - ), - ), 'mediawiki.special.userlogin.signup.js' => array( 'scripts' => 'resources/src/mediawiki.special/mediawiki.special.userlogin.signup.js', 'messages' => array( diff --git a/resources/src/mediawiki.special/mediawiki.special.userlogin.common.js b/resources/src/mediawiki.special/mediawiki.special.userlogin.common.js deleted file mode 100644 index f5289deea0..0000000000 --- a/resources/src/mediawiki.special/mediawiki.special.userlogin.common.js +++ /dev/null @@ -1,72 +0,0 @@ -/*! - * JavaScript for login and signup forms. - */ -( function ( mw, $ ) { - // Move the FancyCaptcha image into a more attractive container. - // The CAPTCHA is in a
at the top of the form. If it's a FancyCaptcha, - // then we remove it and insert it lower down, in a customized div with just what we need (e.g. - // no 'fancycaptcha-createaccount' message). - function adjustFancyCaptcha( $content, buttonSubmit ) { - var $submit = $content.find( buttonSubmit ), - tabIndex, - $captchaStuff, - $captchaImageContainer, - // JavaScript can't yet parse the message 'createacct-imgcaptcha-help' when it - // contains a MediaWiki transclusion, so PHP parses it and sends the HTML. - // This is only set for the signup form (and undefined for login). - helpMsg = mw.config.get( 'wgCreateacctImgcaptchaHelp' ), - helpHtml = ''; - - if ( !$submit.length ) { - return; - } - tabIndex = $submit.prop( 'tabIndex' ) - 1; - $captchaStuff = $content.find( '.captcha' ); - - if ( $captchaStuff.length ) { - // The FancyCaptcha has this class in the ConfirmEdit extension since 2013-04-18. - $captchaImageContainer = $captchaStuff.find( '.fancycaptcha-image-container' ); - if ( $captchaImageContainer.length !== 1 ) { - return; - } - - $captchaStuff.remove(); - - if ( helpMsg ) { - helpHtml = '' + helpMsg + ''; - } - - // Insert another div before the submit button that will include the - // repositioned FancyCaptcha div, an input field, and possible help. - $submit.closest( 'div' ).before( [ - '
', - '', - '
', - '
', - '', - helpHtml, - '
', - '
' - ].join( '' ) ); - - // Stick the FancyCaptcha container inside our bordered and framed parents. - $captchaImageContainer - .prependTo( $content.find( '.mw-createacct-captcha-and-reload' ) ); - - // Find the input field, add the text (if any) of the existing CAPTCHA - // field (although usually it's blanked out on every redisplay), - // and after it move over the hidden field that tells the CAPTCHA - // what to do. - $content.find( '#wpCaptchaWord' ) - .val( $captchaStuff.find( '#wpCaptchaWord' ).val() ) - .after( $captchaStuff.find( '#wpCaptchaId' ) ); - } - } - - $( function () { - // Work with both login and signup form - adjustFancyCaptcha( $( '#mw-content-text' ), '#wpCreateaccount, #wpLoginAttempt' ); - } ); -}( mediaWiki, jQuery ) );