Display notification when disabling input methods from keyboard icon menu

Bug: 48534
Change-Id: Id6c1cb22cb09a226cfcc84d597724e5d803392f3
This commit is contained in:
Santhosh Thottingal
2013-05-17 17:52:29 +05:30
parent 432fb327b3
commit cea4d81766
4 changed files with 44 additions and 7 deletions

View File

@@ -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."
}

View File

@@ -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"
}
"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",
}

View File

@@ -106,3 +106,8 @@ div.input-settings-block {
padding: 6px 10px;
background: #f0f0f0;
}
.uls-ime-notification-bubble .link {
color: #0645AD;
cursor: pointer;
}

View File

@@ -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 = $( '<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, document ) );