GUAC-324: Add functions for showing/hiding menu. Update menu title with connection name.

This commit is contained in:
Michael Jumper
2014-04-18 17:37:06 -07:00
parent 4be517ac95
commit f9c9b67e72
2 changed files with 27 additions and 1 deletions

View File

@@ -55,7 +55,7 @@
<!-- Menu -->
<div id="menu">
<h2>Guacamole ${project.version}</h2>
<h2 id="menu-title">Guacamole ${project.version}</h2>
<div class="content">
<button>Test button</button>
<button>Test button</button>

View File

@@ -220,6 +220,8 @@ GuacUI.Client = {
"viewport" : document.getElementById("viewportClone"),
"main" : document.getElementById("main"),
"menu" : document.getElementById("menu"),
"menu_title" : document.getElementById("menu-title"),
"display" : document.getElementById("display"),
"notification_area" : document.getElementById("notificationArea"),
@@ -782,6 +784,30 @@ GuacUI.Client.updateTitle = function () {
else
document.title = GuacUI.Client.connectionName;
GuacUI.Client.menu_title.textContent = GuacUI.Client.connectionName;
};
/**
* Sets whether the menu is currently visible.
*
* @param {Boolean} [shown] Whether the menu should be shown. If omitted, this
* function will cause the menu to be shown by default.
*/
GuacUI.Client.showMenu = function(shown) {
if (shown === false)
GuacUI.Client.menu.className = "closed";
else
GuacUI.Client.menu.className = "open";
};
/**
* Returns whether the menu is currently shown.
*
* @returns {Boolean} true if the menu is shown, false otherwise.
*/
GuacUI.Client.isMenuShown = function() {
return GuacUI.Client.menu.className === "open";
};
/**