Autoconnect option as URL query

This commit is contained in:
samhed 2013-10-04 17:59:03 +02:00
parent 3cb89f5a14
commit f8ddfc732d
1 changed files with 14 additions and 3 deletions

View File

@ -33,7 +33,7 @@ load: function (callback) {
// Render default UI and initialize settings menu // Render default UI and initialize settings menu
start: function(callback) { start: function(callback) {
var html = '', i, sheet, sheets, llevels, port; var html = '', i, sheet, sheets, llevels, port, autoconnect;
// Stylesheet selection dropdown // Stylesheet selection dropdown
sheet = WebUtil.selectStylesheet(); sheet = WebUtil.selectStylesheet();
@ -86,6 +86,15 @@ start: function(callback) {
'onUpdateState': UI.updateState, 'onUpdateState': UI.updateState,
'onClipboard': UI.clipReceive, 'onClipboard': UI.clipReceive,
'onDesktopName': UI.updateDocumentTitle}); 'onDesktopName': UI.updateDocumentTitle});
autoconnect = WebUtil.getQueryVar('autoconnect', false);
if (autoconnect === 'true' || autoconnect == '1') {
autoconnect = true;
UI.connect();
} else {
autoconnect = false;
}
UI.updateVisualState(); UI.updateVisualState();
// Unfocus clipboard when over the VNC area // Unfocus clipboard when over the VNC area
@ -135,8 +144,10 @@ start: function(callback) {
// Open the description dialog // Open the description dialog
$D('noVNC_description').style.display = "block"; $D('noVNC_description').style.display = "block";
} else { } else {
// Open the connect panel on first load // Show the connect panel on first load unless autoconnecting
UI.toggleConnectPanel(); if (autoconnect === UI.connSettingsOpen) {
UI.toggleConnectPanel();
}
} }
// Add mouse event click/focus/blur event handlers to the UI // Add mouse event click/focus/blur event handlers to the UI