diff --git a/UniversalLanguageSelector.hooks.php b/UniversalLanguageSelector.hooks.php index e253a027..0450ca15 100644 --- a/UniversalLanguageSelector.hooks.php +++ b/UniversalLanguageSelector.hooks.php @@ -245,7 +245,7 @@ class UniversalLanguageSelectorHooks { */ 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 @@ class UniversalLanguageSelectorHooks { $vars['wgULSPosition'] = $wgULSPosition; $vars['wgULSAnonCanChangeLanguage'] = $wgULSAnonCanChangeLanguage; $vars['wgULSEventLogging'] = $wgULSEventLogging; + $vars['wgULSNoImeSelectors'] = $wgULSNoImeSelectors; return true; } diff --git a/UniversalLanguageSelector.php b/UniversalLanguageSelector.php index f261cc73..24b758b3 100644 --- a/UniversalLanguageSelector.php +++ b/UniversalLanguageSelector.php @@ -123,6 +123,13 @@ $wgULSPosition = 'personal'; */ $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 1d260102..be03c268 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 () {