From ce3a1da1dc1d3a8f326e648955e42cec64da94e8 Mon Sep 17 00:00:00 2001 From: friarzen Date: Tue, 27 Nov 2018 04:28:52 +0000 Subject: [PATCH] open help popup when the option is set. --- .../static/webclient/js/plugins/options.js | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/evennia/web/webclient/static/webclient/js/plugins/options.js b/evennia/web/webclient/static/webclient/js/plugins/options.js index 114cd6cf0e..d3b6d13158 100644 --- a/evennia/web/webclient/static/webclient/js/plugins/options.js +++ b/evennia/web/webclient/static/webclient/js/plugins/options.js @@ -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('
'+ args + '
'); + 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);