summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'MLEB/UniversalLanguageSelector/resources/js/ext.uls.ime.js')
-rw-r--r--MLEB/UniversalLanguageSelector/resources/js/ext.uls.ime.js68
1 files changed, 37 insertions, 31 deletions
diff --git a/MLEB/UniversalLanguageSelector/resources/js/ext.uls.ime.js b/MLEB/UniversalLanguageSelector/resources/js/ext.uls.ime.js
index e80ff0d4..117777c7 100644
--- a/MLEB/UniversalLanguageSelector/resources/js/ext.uls.ime.js
+++ b/MLEB/UniversalLanguageSelector/resources/js/ext.uls.ime.js
@@ -1,4 +1,4 @@
-/**
+/*!
* ULS - jQuery IME integration
*
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
@@ -16,7 +16,8 @@
* @licence GNU General Public Licence 2.0 or later
* @licence MIT License
*/
-( function ( $, mw ) {
+
+( function () {
'use strict';
var mwImeRulesPath, inputSelector, inputPreferences, ulsIMEPreferences, customHelpLink;
@@ -35,7 +36,8 @@
availableLanguages = {};
for ( language in $.ime.languages ) {
- availableLanguages[language] = ulsLanguages[language];
+ availableLanguages[ language ] = ulsLanguages[ language ] ||
+ $.uls.data.getAutonym( language );
}
return availableLanguages;
@@ -49,9 +51,9 @@
previousIMELanguages = $.ime.preferences.getPreviousLanguages() || [];
imeLanguageList = previousIMELanguages.concat( mw.uls.getFrequentLanguageList() );
- $.each( imeLanguageList, function ( i, v ) {
- if ( $.inArray( v, unique ) === -1 ) {
- unique.push( v );
+ imeLanguageList.forEach( function ( lang ) {
+ if ( unique.indexOf( lang ) === -1 ) {
+ unique.push( lang );
}
} );
@@ -105,6 +107,30 @@
}
};
+ function imeNotification() {
+ var notificationMsg = ( mw.config.get( 'wgULSPosition' ) === 'personal' ) ?
+ 'ext-uls-input-disable-notification-info-personal' :
+ 'ext-uls-input-disable-notification-info-interlanguage',
+ $notification = $( '<div>' )
+ .addClass( 'uls-ime-notification-bubble' )
+ .append(
+ $( '<div>' )
+ .attr( 'data-i18n', 'ext-uls-input-disable-notification' ),
+ $( '<div>' )
+ .addClass( 'link' )
+ .attr( 'data-i18n', 'ext-uls-input-disable-notification-undo' )
+ .on( 'click', function () {
+ $.ime.preferences.enable();
+ $.ime.preferences.save( function () {
+ mw.ime.setup();
+ } );
+ } ),
+ $( '<div>' ).attr( 'data-i18n', notificationMsg )
+ );
+
+ mw.notify( $notification.i18n() );
+ }
+
// Add a 'more settings' link that takes to input settings of ULS
customHelpLink = function () {
var $disableInputToolsLink, $moreSettingsLink,
@@ -208,6 +234,7 @@
/**
* Loads necessary dependencies, checks input for validity and
* adds the ime menu for elements that should have it.
+ *
* @param {jquery.Element} $input
* @since 2013.11
*/
@@ -244,6 +271,7 @@
/**
* Just adds ime menu to any input element.
+ *
* @param {jquery.Element} $input
* @since 2013.11
*/
@@ -266,6 +294,7 @@
$input.focus();
},
languages: mw.ime.getLanguagesWithIME(),
+ ulsPurpose: 'ime-selector',
top: $input.offset().top
} );
@@ -274,7 +303,7 @@
helpHandler: function ( ime ) {
return $( '<a>' )
.attr( {
- href: mw.msg( 'uls-ime-helppage' ).replace( '$1', ime ),
+ href: mw.msg( 'uls-ime-helppage', ime ),
target: '_blank',
title: $.i18n( 'ext-uls-ime-help' )
} )
@@ -295,27 +324,4 @@
}
};
- function imeNotification() {
- var notificationMsg = ( mw.config.get( 'wgULSPosition' ) === 'personal' ) ?
- 'ext-uls-input-disable-notification-info-personal' :
- 'ext-uls-input-disable-notification-info-interlanguage',
- $notification = $( '<div>' )
- .addClass( 'uls-ime-notification-bubble' )
- .append(
- $( '<div>' )
- .attr( 'data-i18n', 'ext-uls-input-disable-notification' ),
- $( '<div>' )
- .addClass( 'link' )
- .attr( 'data-i18n', 'ext-uls-input-disable-notification-undo' )
- .on( 'click', function () {
- $.ime.preferences.enable();
- $.ime.preferences.save( function () {
- mw.ime.setup();
- } );
- } ),
- $( '<div>' ).attr( 'data-i18n', notificationMsg )
- );
-
- mw.notify( $notification.i18n() );
- }
-}( jQuery, mediaWiki ) );
+}() );