mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUAC-704: Handle touch events on reconnect button. Generalize reconnect procedure within dialog.
This commit is contained in:
@@ -362,6 +362,19 @@ GuacUI.Client.ModalStatus = function(title_text, text, classname, reconnect) {
|
|||||||
|
|
||||||
// Automatically reconnect after the given time period
|
// Automatically reconnect after the given time period
|
||||||
var reconnect_interval = null;
|
var reconnect_interval = null;
|
||||||
|
var reconnect_forced = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops the reconnect countdown and forces a client reconnect.
|
||||||
|
*/
|
||||||
|
function force_reconnect() {
|
||||||
|
if (!reconnect_forced) {
|
||||||
|
reconnect_forced = true;
|
||||||
|
window.clearInterval(reconnect_interval);
|
||||||
|
GuacUI.Client.connect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (reconnect) {
|
if (reconnect) {
|
||||||
|
|
||||||
var countdown = GuacUI.createChildElement(dialog, "p", "countdown");
|
var countdown = GuacUI.createChildElement(dialog, "p", "countdown");
|
||||||
@@ -377,10 +390,8 @@ GuacUI.Client.ModalStatus = function(title_text, text, classname, reconnect) {
|
|||||||
countdown.textContent = "Reconnecting in " + reconnect + " seconds...";
|
countdown.textContent = "Reconnecting in " + reconnect + " seconds...";
|
||||||
|
|
||||||
// Reconnect if countdown complete
|
// Reconnect if countdown complete
|
||||||
if (reconnect === 0) {
|
if (reconnect === 0)
|
||||||
window.clearInterval(reconnect_interval);
|
force_reconnect();
|
||||||
GuacUI.Client.connect();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,10 +412,13 @@ GuacUI.Client.ModalStatus = function(title_text, text, classname, reconnect) {
|
|||||||
reconnect_button.textContent = "Reconnect";
|
reconnect_button.textContent = "Reconnect";
|
||||||
|
|
||||||
// Reconnect if button clicked
|
// Reconnect if button clicked
|
||||||
reconnect_button.onclick = function() {
|
reconnect_button.onclick = force_reconnect;
|
||||||
window.clearInterval(reconnect_interval);
|
|
||||||
GuacUI.Client.connect();
|
// Reconnect if button tapped
|
||||||
};
|
reconnect_button.addEventListener("touchend", function(e) {
|
||||||
|
if (e.touches.length === 0)
|
||||||
|
force_reconnect();
|
||||||
|
}, true);
|
||||||
|
|
||||||
this.show = function() {
|
this.show = function() {
|
||||||
document.body.appendChild(outer);
|
document.body.appendChild(outer);
|
||||||
|
Reference in New Issue
Block a user