Merge "Allow disabling of IME by a jQuery selector"
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user