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).
This commit is contained in:
samhed 2015-06-25 17:04:55 +02:00
parent 30bfff81d9
commit 74f2ac968d
3 changed files with 16 additions and 37 deletions

View File

@ -188,7 +188,7 @@ html {
border-radius:10px; border-radius:10px;
} }
#noVNC_popup_status_panel { #noVNC_popup_status {
display:none; display:none;
position: fixed; position: fixed;
z-index: 1; z-index: 1;

View File

@ -28,8 +28,7 @@ var UI;
rfb_state : 'loaded', rfb_state : 'loaded',
settingsOpen : false, settingsOpen : false,
connSettingsOpen : false, connSettingsOpen : false,
popupStatusOpen : false, popupStatusTimeout: null,
popupTimeout: null,
clipboardOpen: false, clipboardOpen: false,
keyboardVisible: false, keyboardVisible: false,
hideKeyboardTimeout: null, hideKeyboardTimeout: null,
@ -198,8 +197,8 @@ var UI;
$D("xvpShutdownButton").onclick = UI.xvpShutdown; $D("xvpShutdownButton").onclick = UI.xvpShutdown;
$D("xvpRebootButton").onclick = UI.xvpReboot; $D("xvpRebootButton").onclick = UI.xvpReboot;
$D("xvpResetButton").onclick = UI.xvpReset; $D("xvpResetButton").onclick = UI.xvpReset;
$D("noVNC_status").onclick = UI.togglePopupStatusPanel; $D("noVNC_status").onclick = UI.togglePopupStatus;
$D("noVNC_popup_status_panel").onclick = UI.togglePopupStatusPanel; $D("noVNC_popup_status").onclick = UI.togglePopupStatus;
$D("xvpButton").onclick = UI.toggleXvpPanel; $D("xvpButton").onclick = UI.toggleXvpPanel;
$D("clipboardButton").onclick = UI.toggleClipboardPanel; $D("clipboardButton").onclick = UI.toggleClipboardPanel;
$D("settingsButton").onclick = UI.toggleSettingsPanel; $D("settingsButton").onclick = UI.toggleSettingsPanel;
@ -356,19 +355,13 @@ var UI;
}, },
// Show the popup status panel // Show the popup status
togglePopupStatusPanel: function(text) { togglePopupStatus: function(text) {
var psp = $D('noVNC_popup_status_panel'); var psp = $D('noVNC_popup_status');
var closePopup = function() { var closePopup = function() { psp.style.display = "none"; };
psp.style.display = "none";
UI.popupStatusOpen = false;
};
if (UI.popupStatusOpen === true) { if (window.getComputedStyle(psp).display === 'none') {
clearTimeout(UI.popupTimeout);
closePopup();
} else {
if (typeof text === 'text') { if (typeof text === 'text') {
psp.innerHTML = text; psp.innerHTML = text;
} else { } else {
@ -376,11 +369,13 @@ var UI;
} }
psp.style.display = "block"; psp.style.display = "block";
psp.style.left = window.innerWidth/2 - psp.style.left = window.innerWidth/2 -
parseInt(window.getComputedStyle(psp, false).width)/2 -30 + "px"; parseInt(window.getComputedStyle(psp).width)/2 -30 + "px";
UI.popupStatusOpen = true;
// Show the popup for a maximum of 1.5 seconds // 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) { if (UI.connSettingsOpen === true) {
UI.toggleConnectPanel(); UI.toggleConnectPanel();
} }
// Close popup status panel if open
if (UI.popupStatusOpen === true) {
UI.togglePopupStatusPanel();
}
// Close clipboard panel if open // Close clipboard panel if open
if (UI.clipboardOpen === true) { if (UI.clipboardOpen === true) {
UI.toggleClipboardPanel(); UI.toggleClipboardPanel();
@ -430,10 +421,6 @@ var UI;
if (UI.connSettingsOpen === true) { if (UI.connSettingsOpen === true) {
UI.toggleConnectPanel(); UI.toggleConnectPanel();
} }
// Close popup status panel if open
if (UI.popupStatusOpen === true) {
UI.togglePopupStatusPanel();
}
// Close XVP panel if open // Close XVP panel if open
if (UI.xvpOpen === true) { if (UI.xvpOpen === true) {
UI.toggleXvpPanel(); UI.toggleXvpPanel();
@ -464,10 +451,6 @@ var UI;
if (UI.clipboardOpen === true) { if (UI.clipboardOpen === true) {
UI.toggleClipboardPanel(); UI.toggleClipboardPanel();
} }
// Close popup status panel if open
if (UI.popupStatusOpen === true) {
UI.togglePopupStatusPanel();
}
// Close XVP panel if open // Close XVP panel if open
if (UI.xvpOpen === true) { if (UI.xvpOpen === true) {
UI.toggleXvpPanel(); UI.toggleXvpPanel();
@ -532,10 +515,6 @@ var UI;
if (UI.connSettingsOpen === true) { if (UI.connSettingsOpen === true) {
UI.toggleConnectPanel(); UI.toggleConnectPanel();
} }
// Close popup status panel if open
if (UI.popupStatusOpen === true) {
UI.togglePopupStatusPanel();
}
// Close XVP panel if open // Close XVP panel if open
if (UI.xvpOpen === true) { if (UI.xvpOpen === true) {
UI.toggleXvpPanel(); UI.toggleXvpPanel();

View File

@ -126,8 +126,8 @@
<input id="descriptionButton" type="button" value="Close"> <input id="descriptionButton" type="button" value="Close">
</div> </div>
<!-- Popup Status Panel --> <!-- Popup Status -->
<div id="noVNC_popup_status_panel" class=""> <div id="noVNC_popup_status" class="">
</div> </div>
<!-- Clipboard Panel --> <!-- Clipboard Panel -->