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
This commit is contained in:
committed by
Nikerabbit
parent
fcf27188f6
commit
8205e294d7
@@ -245,7 +245,7 @@ class UniversalLanguageSelectorHooks {
|
|||||||
*/
|
*/
|
||||||
public static function addConfig( &$vars ) {
|
public static function addConfig( &$vars ) {
|
||||||
global $wgULSGeoService, $wgULSIMEEnabled, $wgULSPosition,
|
global $wgULSGeoService, $wgULSIMEEnabled, $wgULSPosition,
|
||||||
$wgULSAnonCanChangeLanguage, $wgULSEventLogging;
|
$wgULSAnonCanChangeLanguage, $wgULSEventLogging, $wgULSNoImeSelectors;
|
||||||
|
|
||||||
// Place constant stuff here (not depending on request context)
|
// Place constant stuff here (not depending on request context)
|
||||||
if ( is_string( $wgULSGeoService ) ) {
|
if ( is_string( $wgULSGeoService ) ) {
|
||||||
@@ -255,6 +255,7 @@ class UniversalLanguageSelectorHooks {
|
|||||||
$vars['wgULSPosition'] = $wgULSPosition;
|
$vars['wgULSPosition'] = $wgULSPosition;
|
||||||
$vars['wgULSAnonCanChangeLanguage'] = $wgULSAnonCanChangeLanguage;
|
$vars['wgULSAnonCanChangeLanguage'] = $wgULSAnonCanChangeLanguage;
|
||||||
$vars['wgULSEventLogging'] = $wgULSEventLogging;
|
$vars['wgULSEventLogging'] = $wgULSEventLogging;
|
||||||
|
$vars['wgULSNoImeSelectors'] = $wgULSNoImeSelectors;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,6 +123,13 @@ $wgULSPosition = 'personal';
|
|||||||
*/
|
*/
|
||||||
$wgULSEventLogging = false;
|
$wgULSEventLogging = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of jQuery selectors of elements on which IME must not be enabled.
|
||||||
|
*
|
||||||
|
* @since 2013.07
|
||||||
|
*/
|
||||||
|
$wgULSNoImeSelectors = array( '#wpCaptchaWord' );
|
||||||
|
|
||||||
$dir = __DIR__;
|
$dir = __DIR__;
|
||||||
|
|
||||||
// Internationalization
|
// Internationalization
|
||||||
|
|||||||
@@ -160,7 +160,7 @@
|
|||||||
mw.ime.setup = function () {
|
mw.ime.setup = function () {
|
||||||
|
|
||||||
$( 'body' ).on( 'focus.ime', inputSelector, function () {
|
$( 'body' ).on( 'focus.ime', inputSelector, function () {
|
||||||
var imeselector, $input;
|
var imeselector, $input, noImeSelector;
|
||||||
|
|
||||||
// It's possible to disable IME through the settings
|
// It's possible to disable IME through the settings
|
||||||
// panels before it was initialized, so we need to check
|
// panels before it was initialized, so we need to check
|
||||||
@@ -170,6 +170,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$input = $( this );
|
$input = $( this );
|
||||||
|
noImeSelector = mw.config.get( 'wgULSNoImeSelectors' ).join( ', ' );
|
||||||
|
|
||||||
|
if ( noImeSelector.length && $input.is( noImeSelector ) ) {
|
||||||
|
$input.addClass( 'noime' );
|
||||||
|
}
|
||||||
|
|
||||||
$input.ime( {
|
$input.ime( {
|
||||||
languages: mw.ime.getIMELanguageList(),
|
languages: mw.ime.getIMELanguageList(),
|
||||||
languageSelector: function () {
|
languageSelector: function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user