diff options
author | samhed <samuel@cendio.se> | 2015-06-25 15:22:53 +0200 |
---|---|---|
committer | samhed <samuel@cendio.se> | 2015-06-25 15:22:53 +0200 |
commit | 4f19e5c697685f759771e2960d890a78cf5eae55 (patch) | |
tree | bf43e4ad1a48c608401df31c54a0b14d5c3568fe | |
parent | 31ddaa1c7a4f2a8f211f53da1b53bfe294ad6a38 (diff) | |
download | novnc-4f19e5c697685f759771e2960d890a78cf5eae55.tar.gz |
Allow the popupStatusPanel to show any text but close it on a 1.5 second timer.
-rw-r--r-- | include/ui.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/include/ui.js b/include/ui.js index fafafdc..fe9c706 100644 --- a/include/ui.js +++ b/include/ui.js @@ -29,6 +29,7 @@ var UI; settingsOpen : false, connSettingsOpen : false, popupStatusOpen : false, + popupTimeout: null, clipboardOpen: false, keyboardVisible: false, hideKeyboardTimeout: null, @@ -356,17 +357,30 @@ var UI; // Show the popup status panel - togglePopupStatusPanel: function() { + togglePopupStatusPanel: function(text) { var psp = $D('noVNC_popup_status_panel'); - if (UI.popupStatusOpen === true) { + + var closePopup = function() { psp.style.display = "none"; UI.popupStatusOpen = false; + }; + + if (UI.popupStatusOpen === true) { + clearTimeout(UI.popupTimeout); + closePopup(); } else { - psp.innerHTML = $D('noVNC_status').innerHTML; + if (typeof text === 'text') { + psp.innerHTML = text; + } else { + psp.innerHTML = $D('noVNC_status').innerHTML; + } psp.style.display = "block"; psp.style.left = window.innerWidth/2 - parseInt(window.getComputedStyle(psp, false).width)/2 -30 + "px"; UI.popupStatusOpen = true; + + // Show the popup for a maximum of 1.5 seconds + UI.popupTimeout = setTimeout(function() { closePopup(); }, 1500); } }, |