open help popup when the option is set.

This commit is contained in:
friarzen 2018-11-27 04:28:52 +00:00 committed by Brenden Tuck
parent 57551c791d
commit ce3a1da1dc

View file

@ -77,10 +77,12 @@ let options_plugin = (function () {
if (code === 27) { // Escape key
if ($('#helpdialog').is(':visible')) {
plugins['popups'].closePopup("#helpdialog");
} else {
plugins['popups'].closePopup("#optionsdialog");
return true;
}
if ($('#optionsdialog').is(':visible')) {
plugins['popups'].closePopup("#optionsdialog");
return true;
}
return true;
}
return false;
}
@ -129,6 +131,21 @@ let options_plugin = (function () {
plugins['popups'].closePopup("#helpdialog");
}
//
// Make sure to close any dialogs on connection lost
var onText = function (args, kwargs) {
// is helppopup set? and if so, does this Text have type 'help'?
if ('helppopup' in options && options['helppopup'] ) {
if (kwargs && ('type' in kwargs) && (kwargs['type'] == 'help') ) {
$('#helpdialogcontent').append('<div>'+ args + '</div>');
plugins['popups'].togglePopup("#helpdialog");
return true;
}
}
return false;
}
//
// Register and init plugin
var init = function () {
@ -155,6 +172,7 @@ let options_plugin = (function () {
onGotOptions: onGotOptions,
onPrompt: onPrompt,
onConnectionClose: onConnectionClose,
onText: onText,
}
})()
plugin_handler.add('options', options_plugin);