diff --git a/app/ui.js b/app/ui.js index 3d3e1f95..bd4c5bd8 100644 --- a/app/ui.js +++ b/app/ui.js @@ -13,13 +13,7 @@ window.addEventListener("load", function() { loader.src = "vendor/browser-es-module-loader/dist/browser-es-module-loader.js"; document.head.appendChild(loader); }); -window.addEventListener("load", function() { - var connect_btn_el = document.getElementById("noVNC_connect_button"); - if (typeof(connect_btn_el) != 'undefined' && connect_btn_el != null) - { - connect_btn_el.click(); - } -}); + window.updateSetting = (name, value) => { WebUtil.writeSetting(name, value); @@ -31,8 +25,8 @@ window.updateSetting = (name, value) => { } } -import "core-js/stable"; -import "regenerator-runtime/runtime"; +//import "core-js/stable"; +//import "regenerator-runtime/runtime"; import * as Log from '../core/util/logging.js'; import _, { l10n } from './localization.js'; import { isTouchDevice, isSafari, hasScrollbarGutter, dragThreshold, supportsBinaryClipboard, isFirefox, isWindows, isIOS, supportsPointerLock } @@ -134,6 +128,7 @@ const UI = { UI.addExtraKeysHandlers(); UI.addGamingHandlers(); UI.addMachineHandlers(); + UI.addConnectionControlHandlers(); UI.addClipboardHandlers(); UI.addSettingsHandlers(); UI.addDisplaysHandler(); @@ -408,6 +403,17 @@ const UI = { } }, + addConnectionControlHandlers() { + UI.addClickHandle('noVNC_disconnect_button', UI.disconnect); + + var connect_btn_el = document.getElementById("noVNC_connect_button_2"); + if (typeof(connect_btn_el) != 'undefined' && connect_btn_el != null) + { + connect_btn_el.addEventListener('click', UI.connect); + } + + }, + addTouchSpecificHandlers() { document.getElementById("noVNC_keyboard_button") .addEventListener('click', UI.toggleVirtualKeyboard); diff --git a/app/ui_screen.js b/app/ui_screen.js index f5e9783a..74afc8e4 100644 --- a/app/ui_screen.js +++ b/app/ui_screen.js @@ -169,12 +169,14 @@ const UI = { identify(data) { const screen = data.screens.find(el => el.id === UI.screenID) - document.getElementById('noVNC_identify_monitor').innerHTML = screen.num - document.getElementById('noVNC_identify_monitor').classList.add("show") - document.querySelector('title').textContent = 'Display ' + screen.num + ' - ' + UI.screenID - setTimeout(() => { - document.getElementById('noVNC_identify_monitor').classList.remove("show") - }, 3500) + if (screen) { + document.getElementById('noVNC_identify_monitor').innerHTML = screen.num + document.getElementById('noVNC_identify_monitor').classList.add("show") + document.querySelector('title').textContent = 'Display ' + screen.num + ' - ' + UI.screenID + setTimeout(() => { + document.getElementById('noVNC_identify_monitor').classList.remove("show") + }, 3500) + } }, diff --git a/vnc.html b/vnc.html index 60bf101c..c6fa0a33 100644 --- a/vnc.html +++ b/vnc.html @@ -50,7 +50,7 @@ - +
@@ -523,7 +523,7 @@ -