jenkins-bot has submitted this change and it was merged.

Change subject: Allow disabling of IME by a jQuery selector
......................................................................


Allow disabling of IME by a jQuery selector

Add the variable $wgULSNoImeSelectors to allow custom
disabling of IME in specific elements.

Add captcha input field id to the exclusion list.

Bug: 41675
Change-Id: Ib03a20c50a4f473e6a58638b85da16659268eb09
---
M UniversalLanguageSelector.hooks.php
M UniversalLanguageSelector.php
M resources/js/ext.uls.ime.js
3 files changed, 16 insertions(+), 2 deletions(-)

Approvals:
  Nikerabbit: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/UniversalLanguageSelector.hooks.php 
b/UniversalLanguageSelector.hooks.php
index e253a02..0450ca1 100644
--- a/UniversalLanguageSelector.hooks.php
+++ b/UniversalLanguageSelector.hooks.php
@@ -245,7 +245,7 @@
         */
        public static function addConfig( &$vars ) {
                global $wgULSGeoService, $wgULSIMEEnabled, $wgULSPosition,
-                       $wgULSAnonCanChangeLanguage, $wgULSEventLogging;
+                       $wgULSAnonCanChangeLanguage, $wgULSEventLogging, 
$wgULSNoImeSelectors;
 
                // Place constant stuff here (not depending on request context)
                if ( is_string( $wgULSGeoService ) ) {
@@ -255,6 +255,7 @@
                $vars['wgULSPosition'] = $wgULSPosition;
                $vars['wgULSAnonCanChangeLanguage'] = 
$wgULSAnonCanChangeLanguage;
                $vars['wgULSEventLogging'] = $wgULSEventLogging;
+               $vars['wgULSNoImeSelectors'] = $wgULSNoImeSelectors;
 
                return true;
        }
diff --git a/UniversalLanguageSelector.php b/UniversalLanguageSelector.php
index f261cc7..24b758b 100644
--- a/UniversalLanguageSelector.php
+++ b/UniversalLanguageSelector.php
@@ -123,6 +123,13 @@
  */
 $wgULSEventLogging = false;
 
+/**
+ * Array of jQuery selectors of elements on which IME must not be enabled.
+ *
+ * @since 2013.07
+ */
+$wgULSNoImeSelectors = array( '#wpCaptchaWord' );
+
 $dir = __DIR__;
 
 // Internationalization
diff --git a/resources/js/ext.uls.ime.js b/resources/js/ext.uls.ime.js
index 1d26010..be03c26 100644
--- a/resources/js/ext.uls.ime.js
+++ b/resources/js/ext.uls.ime.js
@@ -160,7 +160,7 @@
        mw.ime.setup = function () {
 
                $( 'body' ).on( 'focus.ime', inputSelector, function () {
-                       var imeselector, $input;
+                       var imeselector, $input, noImeSelector;
 
                        // It's possible to disable IME through the settings
                        // panels before it was initialized, so we need to check
@@ -170,6 +170,12 @@
                        }
 
                        $input = $( this );
+                       noImeSelector = mw.config.get( 'wgULSNoImeSelectors' 
).join( ', ' );
+
+                       if ( noImeSelector.length && $input.is( noImeSelector ) 
) {
+                               $input.addClass( 'noime' );
+                       }
+
                        $input.ime( {
                                languages: mw.ime.getIMELanguageList(),
                                languageSelector: function () {

-- 
To view, visit https://gerrit.wikimedia.org/r/68339
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib03a20c50a4f473e6a58638b85da16659268eb09
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>
Gerrit-Reviewer: Amire80 <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to