Order vnc_lite functions

This commit is contained in:
Samuel Mannehed 2018-08-16 11:52:32 +02:00
parent c756665e81
commit 26d51e490e
1 changed files with 22 additions and 21 deletions

View File

@ -86,10 +86,21 @@
let rfb; let rfb;
let desktopName; let desktopName;
// When this function is called we have received // When this function is called we have
// a desktop name from the server // successfully connected to a server
function updateDesktopName(e) { function connectedToServer(e) {
desktopName = e.detail.name; document.getElementById('sendCtrlAltDelButton').disabled = false;
status("Connected to " + desktopName);
}
// This function is called when we are disconnected
function disconnectedFromServer(e) {
document.getElementById('sendCtrlAltDelButton').disabled = true;
if (e.detail.clean) {
status("Disconnected");
} else {
status("Something went wrong, connection is closed");
}
} }
// When this function is called, the server requires // When this function is called, the server requires
@ -108,6 +119,12 @@
document.getElementById('noVNC_status').querySelector('label').textContent = 'Password Required: '; document.getElementById('noVNC_status').querySelector('label').textContent = 'Password Required: ';
} }
// When this function is called we have received
// a desktop name from the server
function updateDesktopName(e) {
desktopName = e.detail.name;
}
// Send the credentials from the input element // Send the credentials from the input element
function setPassword() { function setPassword() {
rfb.sendCredentials({ password: document.getElementById('password_input').value }); rfb.sendCredentials({ password: document.getElementById('password_input').value });
@ -121,28 +138,12 @@
rfb.sendCtrlAltDel(); rfb.sendCtrlAltDel();
return false; return false;
} }
// Show a status text in the top bar // Show a status text in the top bar
function status(text) { function status(text) {
document.getElementById('noVNC_status').textContent = text; document.getElementById('noVNC_status').textContent = text;
} }
// When this function is called we have
// successfully connected to a server
function connectedToServer(e) {
document.getElementById('sendCtrlAltDelButton').disabled = false;
status("Connected to " + desktopName);
}
// This function is called when we are disconnected
function disconnectedFromServer(e) {
document.getElementById('sendCtrlAltDelButton').disabled = true;
if (e.detail.clean) {
status("Disconnected");
} else {
status("Something went wrong, connection is closed");
}
}
// This function extracts the value of one variable from the // This function extracts the value of one variable from the
// query string. If the variable isn't defined in the URL // query string. If the variable isn't defined in the URL
// it returns the default value instead. // it returns the default value instead.