// UI Definition
var GuacamoleUI = {
+ "LOGOUT_PROMPT" : "Logging out will disconnect all of your active "
+ + "Guacamole sessions. Are you sure you wish to log out?",
+
/* Detection Constants */
"LONG_PRESS_DETECT_TIMEOUT" : 800, /* milliseconds */
};
// Touch-specific keyboard show
- GuacamoleUI.buttons.touchShowKeyboard.ontouchstart =
GuacamoleUI.buttons.touchShowKeyboard.onclick =
function(e) {
+
+ // Center event target in case browser automatically centers
+ // input fields on focus.
+ GuacamoleUI.eventTarget.style.left =
+ (window.pageXOffset + GuacamoleUI.viewport.offsetWidth / 2) + "px";
+
+ GuacamoleUI.eventTarget.style.top =
+ (window.pageYOffset + GuacamoleUI.viewport.offsetHeight / 2) + "px";
+
GuacamoleUI.eventTarget.focus();
GuacamoleUI.hideTouchMenu();
- e.preventDefault();
+
};
// Logout
GuacamoleUI.buttons.logout.onclick =
GuacamoleUI.buttons.touchLogout.onclick =
function() {
- window.location.href = "logout";
+
+ // Logout after warning user about session disconnect
+ if (confirm(GuacamoleUI.LOGOUT_PROMPT)) {
+ window.location.href = "logout";
+ GuacamoleUI.hideTouchMenu();
+ }
+
};
// Timeouts for detecting if users wants menu to open or close
GuacamoleUI.eventTarget.setAttribute("autocorrect", "off");
GuacamoleUI.eventTarget.setAttribute("autocapitalize", "off");
+ // Automatically reposition event target on scroll
+ window.addEventListener("scroll", function() {
+ GuacamoleUI.eventTarget.style.left = window.pageXOffset + "px";
+ GuacamoleUI.eventTarget.style.top = window.pageYOffset + "px";
+ });
+
})();
// Tie UI events / behavior to a specific Guacamole client
guac.sendKeyEvent(0, KEYSYM_CTRL);
};
-};
\ No newline at end of file
+};