From cea4d81766db6c7c8f98f8f41e17c7a53dfc8073 Mon Sep 17 00:00:00 2001 From: Santhosh Thottingal Date: Fri, 17 May 2013 17:52:29 +0530 Subject: [PATCH] Display notification when disabling input methods from keyboard icon menu Bug: 48534 Change-Id: Id6c1cb22cb09a226cfcc84d597724e5d803392f3 --- i18n/en.json | 6 ++++- i18n/qqq.json | 8 +++++-- resources/css/ext.uls.inputsettings.css | 5 ++++ resources/js/ext.uls.ime.js | 32 +++++++++++++++++++++---- 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index 5fd47afe..9f760d91 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -45,5 +45,9 @@ "ext-uls-input-disable": "Disable input methods", "ext-uls-input-enable": "Enable input methods", "ext-uls-input-disable-info": "Input methods are disabled.", -"ext-uls-input-settings-noime": "No input methods are available for this language." +"ext-uls-input-settings-noime": "No input methods are available for this language.", +"ext-uls-input-disable-notification": "Input tools have been disabled", +"ext-uls-input-disable-notification-undo": "Undo", +"ext-uls-input-disable-notification-info-personal": "You can enable the input tools at any time from the language settings.", +"ext-uls-input-disable-notification-info-interlanguage": "You can enable the input tools at any time from the language settings next to the language list." } diff --git a/i18n/qqq.json b/i18n/qqq.json index 21a75eb8..cd50dccf 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -48,5 +48,9 @@ "ext-uls-input-disable": "Label for disable input tools submit button", "ext-uls-input-enable": "Label for enable input tools button", "ext-uls-input-disable-info": "Info text for the disable input tools button", - "ext-uls-input-settings-noime": "Text to be shown when no input methods are available for a selected language" -} \ No newline at end of file + "ext-uls-input-settings-noime": "Text to be shown when no input methods are available for a selected language", + "ext-uls-input-disable-notification": "Notification bubble text when input methods are disabled", + "ext-uls-input-disable-notification-undo": "Undo link text in the input method disable notification bubble", + "ext-uls-input-disable-notification-info-personal": "Notification bubble text when input methods are disabled, appears if the ULS is at personal toolbar", + "ext-uls-input-disable-notification-info-interlanguage": "Notification bubble text when input methods are disabled, appears if the ULS is at interlanguage toolbar", +} diff --git a/resources/css/ext.uls.inputsettings.css b/resources/css/ext.uls.inputsettings.css index b6b7531d..924cd02b 100644 --- a/resources/css/ext.uls.inputsettings.css +++ b/resources/css/ext.uls.inputsettings.css @@ -106,3 +106,8 @@ div.input-settings-block { padding: 6px 10px; background: #f0f0f0; } + +.uls-ime-notification-bubble .link { + color: #0645AD; + cursor: pointer; +} diff --git a/resources/js/ext.uls.ime.js b/resources/js/ext.uls.ime.js index 0b2c7459..7b81c135 100644 --- a/resources/js/ext.uls.ime.js +++ b/resources/js/ext.uls.ime.js @@ -125,19 +125,20 @@ } ); // Hide the menu. - $moreSettingsLink.on( 'click', function (e) { - imeselector.$menu.removeClass( 'open' ); + $moreSettingsLink.on( 'click', function ( e ) { + imeselector.hide(); e.stopPropagation(); } ); $disableInputToolsLink.i18n(); - $disableInputToolsLink.on( 'click', function (e) { + $disableInputToolsLink.on( 'click', function ( e ) { $.ime.preferences.disable(); imeselector.hide(); - imeselector.$menu.removeClass( 'open' ); + imeselector.$imeSetting.hide(); $.ime.preferences.save( function () { mw.ime.disable(); + imeNotification(); } ); e.stopPropagation(); } ); @@ -200,5 +201,28 @@ } ); + function imeNotification () { + var notificationMsg = ( mw.config.get( 'wgULSPosition' ) === 'personal' ) ? + 'ext-uls-input-disable-notification-info-personal' : + 'ext-uls-input-disable-notification-info-interlanguage', + $notification = $( '
' ) + .addClass( 'uls-ime-notification-bubble' ) + .append( + $( '
' ) + .attr( 'data-i18n', 'ext-uls-input-disable-notification' ), + $( '
' ) + .addClass( 'link' ) + .attr( 'data-i18n', 'ext-uls-input-disable-notification-undo' ) + .on( 'click', function() { + $.ime.preferences.enable(); + $.ime.preferences.save( function () { + mw.ime.setup(); + } ); + } ), + $( '
' ).attr( 'data-i18n', notificationMsg ) + ); + + mw.notify( $notification.i18n() ); + } }( jQuery, mediaWiki, document ) );