diff options
author | samhed <samuel@cendio.se> | 2015-06-25 17:04:55 +0200 |
---|---|---|
committer | samhed <samuel@cendio.se> | 2015-06-25 17:04:55 +0200 |
commit | 74f2ac968d782318967d9162454ca945dcc8b3de (patch) | |
tree | db827c8d4c6ddb26717b321f9bcc431a3def64ea | |
parent | 30bfff81d977da82b37c99a6aa77d7ecb9b7f773 (diff) | |
download | novnc-74f2ac968d782318967d9162454ca945dcc8b3de.tar.gz |
Renamed popupStatusPanel to popupStatus and removed the global variable
which kept track on if it was open or not (it automatically closes after
1.5 seconds anyway).
-rw-r--r-- | include/base.css | 2 | ||||
-rw-r--r-- | include/ui.js | 47 | ||||
-rw-r--r-- | vnc.html | 4 |
3 files changed, 16 insertions, 37 deletions
diff --git a/include/base.css b/include/base.css index 888b5f2..f69e64b 100644 --- a/include/base.css +++ b/include/base.css @@ -188,7 +188,7 @@ html { border-radius:10px; } -#noVNC_popup_status_panel { +#noVNC_popup_status { display:none; position: fixed; z-index: 1; diff --git a/include/ui.js b/include/ui.js index 15fb15c..6cfe5b5 100644 --- a/include/ui.js +++ b/include/ui.js @@ -28,8 +28,7 @@ var UI; rfb_state : 'loaded', settingsOpen : false, connSettingsOpen : false, - popupStatusOpen : false, - popupTimeout: null, + popupStatusTimeout: null, clipboardOpen: false, keyboardVisible: false, hideKeyboardTimeout: null, @@ -198,8 +197,8 @@ var UI; $D("xvpShutdownButton").onclick = UI.xvpShutdown; $D("xvpRebootButton").onclick = UI.xvpReboot; $D("xvpResetButton").onclick = UI.xvpReset; - $D("noVNC_status").onclick = UI.togglePopupStatusPanel; - $D("noVNC_popup_status_panel").onclick = UI.togglePopupStatusPanel; + $D("noVNC_status").onclick = UI.togglePopupStatus; + $D("noVNC_popup_status").onclick = UI.togglePopupStatus; $D("xvpButton").onclick = UI.toggleXvpPanel; $D("clipboardButton").onclick = UI.toggleClipboardPanel; $D("settingsButton").onclick = UI.toggleSettingsPanel; @@ -356,19 +355,13 @@ var UI; }, - // Show the popup status panel - togglePopupStatusPanel: function(text) { - var psp = $D('noVNC_popup_status_panel'); + // Show the popup status + togglePopupStatus: function(text) { + var psp = $D('noVNC_popup_status'); - var closePopup = function() { - psp.style.display = "none"; - UI.popupStatusOpen = false; - }; + var closePopup = function() { psp.style.display = "none"; }; - if (UI.popupStatusOpen === true) { - clearTimeout(UI.popupTimeout); - closePopup(); - } else { + if (window.getComputedStyle(psp).display === 'none') { if (typeof text === 'text') { psp.innerHTML = text; } else { @@ -376,11 +369,13 @@ var UI; } psp.style.display = "block"; psp.style.left = window.innerWidth/2 - - parseInt(window.getComputedStyle(psp, false).width)/2 -30 + "px"; - UI.popupStatusOpen = true; + parseInt(window.getComputedStyle(psp).width)/2 -30 + "px"; // Show the popup for a maximum of 1.5 seconds - UI.popupTimeout = setTimeout(function() { closePopup(); }, 1500); + UI.popupStatusTimeout = setTimeout(function() { closePopup(); }, 1500); + } else { + clearTimeout(UI.popupStatusTimeout); + closePopup(); } }, @@ -397,10 +392,6 @@ var UI; if (UI.connSettingsOpen === true) { UI.toggleConnectPanel(); } - // Close popup status panel if open - if (UI.popupStatusOpen === true) { - UI.togglePopupStatusPanel(); - } // Close clipboard panel if open if (UI.clipboardOpen === true) { UI.toggleClipboardPanel(); @@ -430,10 +421,6 @@ var UI; if (UI.connSettingsOpen === true) { UI.toggleConnectPanel(); } - // Close popup status panel if open - if (UI.popupStatusOpen === true) { - UI.togglePopupStatusPanel(); - } // Close XVP panel if open if (UI.xvpOpen === true) { UI.toggleXvpPanel(); @@ -464,10 +451,6 @@ var UI; if (UI.clipboardOpen === true) { UI.toggleClipboardPanel(); } - // Close popup status panel if open - if (UI.popupStatusOpen === true) { - UI.togglePopupStatusPanel(); - } // Close XVP panel if open if (UI.xvpOpen === true) { UI.toggleXvpPanel(); @@ -532,10 +515,6 @@ var UI; if (UI.connSettingsOpen === true) { UI.toggleConnectPanel(); } - // Close popup status panel if open - if (UI.popupStatusOpen === true) { - UI.togglePopupStatusPanel(); - } // Close XVP panel if open if (UI.xvpOpen === true) { UI.toggleXvpPanel(); @@ -126,8 +126,8 @@ <input id="descriptionButton" type="button" value="Close"> </div> - <!-- Popup Status Panel --> - <div id="noVNC_popup_status_panel" class=""> + <!-- Popup Status --> + <div id="noVNC_popup_status" class=""> </div> <!-- Clipboard Panel --> |