fixed a few ui quirks and one bug race condition.

This commit is contained in:
mattmcclaskey 2023-10-20 15:38:20 -04:00
parent 4c1977f24a
commit 0603ba9fe4
No known key found for this signature in database
3 changed files with 26 additions and 18 deletions

View File

@ -13,13 +13,7 @@ window.addEventListener("load", function() {
loader.src = "vendor/browser-es-module-loader/dist/browser-es-module-loader.js"; loader.src = "vendor/browser-es-module-loader/dist/browser-es-module-loader.js";
document.head.appendChild(loader); 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) => { window.updateSetting = (name, value) => {
WebUtil.writeSetting(name, value); WebUtil.writeSetting(name, value);
@ -31,8 +25,8 @@ window.updateSetting = (name, value) => {
} }
} }
import "core-js/stable"; //import "core-js/stable";
import "regenerator-runtime/runtime"; //import "regenerator-runtime/runtime";
import * as Log from '../core/util/logging.js'; import * as Log from '../core/util/logging.js';
import _, { l10n } from './localization.js'; import _, { l10n } from './localization.js';
import { isTouchDevice, isSafari, hasScrollbarGutter, dragThreshold, supportsBinaryClipboard, isFirefox, isWindows, isIOS, supportsPointerLock } import { isTouchDevice, isSafari, hasScrollbarGutter, dragThreshold, supportsBinaryClipboard, isFirefox, isWindows, isIOS, supportsPointerLock }
@ -134,6 +128,7 @@ const UI = {
UI.addExtraKeysHandlers(); UI.addExtraKeysHandlers();
UI.addGamingHandlers(); UI.addGamingHandlers();
UI.addMachineHandlers(); UI.addMachineHandlers();
UI.addConnectionControlHandlers();
UI.addClipboardHandlers(); UI.addClipboardHandlers();
UI.addSettingsHandlers(); UI.addSettingsHandlers();
UI.addDisplaysHandler(); 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() { addTouchSpecificHandlers() {
document.getElementById("noVNC_keyboard_button") document.getElementById("noVNC_keyboard_button")
.addEventListener('click', UI.toggleVirtualKeyboard); .addEventListener('click', UI.toggleVirtualKeyboard);

View File

@ -169,12 +169,14 @@ const UI = {
identify(data) { identify(data) {
const screen = data.screens.find(el => el.id === UI.screenID) const screen = data.screens.find(el => el.id === UI.screenID)
document.getElementById('noVNC_identify_monitor').innerHTML = screen.num if (screen) {
document.getElementById('noVNC_identify_monitor').classList.add("show") document.getElementById('noVNC_identify_monitor').innerHTML = screen.num
document.querySelector('title').textContent = 'Display ' + screen.num + ' - ' + UI.screenID document.getElementById('noVNC_identify_monitor').classList.add("show")
setTimeout(() => { document.querySelector('title').textContent = 'Display ' + screen.num + ' - ' + UI.screenID
document.getElementById('noVNC_identify_monitor').classList.remove("show") setTimeout(() => {
}, 3500) document.getElementById('noVNC_identify_monitor').classList.remove("show")
}, 3500)
}
}, },

View File

@ -50,7 +50,7 @@
<script src="vendor/interact.min.js"></script> <script src="vendor/interact.min.js"></script>
<!-- Stylesheets --> <!-- Stylesheets -->
<!--link rel="stylesheet" href="app/styles/base.css"> <link rel="stylesheet" href="app/styles/base.css">
<script src="app/error-handler.js"></script> <script src="app/error-handler.js"></script>
@ -63,7 +63,7 @@
} }
</script> </script>
<script type="module" crossorigin="use-credentials" src="app/ui.js"></script--> <script type="module" crossorigin="use-credentials" src="app/ui.js"></script>
</head> </head>
<body> <body>
@ -523,7 +523,7 @@
</div> </div>
<!-- Connection Controls --> <!-- Connection Controls -->
<div class="noVNC_button_div noVNC_hide_on_connect" id="noVNC_connect_button" > <div class="noVNC_button_div noVNC_hide_on_connect" id="noVNC_connect_button_2">
<input type="image" alt="Connect" src="app/images/connect.svg" <input type="image" alt="Connect" src="app/images/connect.svg"
class="noVNC_button" class="noVNC_button"
title="Connect"> title="Connect">