Connection icons, initial autohiding menu implementation.
authorMichael Jumper <zhangmaike@users.sourceforge.net>
Sun, 20 Nov 2011 06:16:05 +0000 (22:16 -0800)
committerMichael Jumper <zhangmaike@users.sourceforge.net>
Sun, 20 Nov 2011 06:16:05 +0000 (22:16 -0800)
src/main/webapp/client.xhtml
src/main/webapp/images/protocol-icons/tango/terminal.png [new file with mode: 0644]
src/main/webapp/images/protocol-icons/tango/video-display.png [new file with mode: 0644]
src/main/webapp/index.xhtml
src/main/webapp/styles/client.css
src/main/webapp/styles/login.css

index 7dcd85c..ad4defc 100644 (file)
             var errorDialog = document.getElementById("errorDialog");
             var errorDialogText = document.getElementById("errorText");
 
-            // Position display correctly
-            window.onresize = function() {
-                display.style.top = menu.offsetHeight + "px";
-            };
-
-            window.onresize();
-
             var state = document.getElementById("state");
             guac.onstatechange = function(clientState) {
 
             var mouse = new Guacamole.Mouse(display);
             mouse.onmousedown = mouse.onmouseup = mouse.onmousemove =
                 function(mouseState) {
+
+                    if (mouseState.y <= 5)
+                        showMenu();
+
                     guac.sendMouseState(mouseState);
                 };
 
                 // TODO: Handle exception ...
             }
 
+            var menu_shaded = false;
+
+            var hide_interval = null;
+            var show_interval = null;
+
+            function hideMenu() {
+
+                if (!menu_shaded) {
+
+                    var step = Math.floor(menu.offsetHeight / 5) + 1;
+                    var offset = 0;
+                    menu_shaded = true;
+
+                    window.clearInterval(show_interval);
+                    hide_interval = window.setInterval(function() {
+
+                        offset -= step;
+                        menu.style.top = offset + "px";
+
+                        if (offset <= -menu.offsetHeight) {
+                            window.clearInterval(hide_interval);
+                            menu.style.visiblity = "hidden";
+                        }
+
+                    }, 30);
+                }
+
+            }
+
+            function showMenu() {
+
+                if (menu_shaded) {
+
+                    var step = Math.floor(menu.offsetHeight / 5) + 1;
+                    var offset = -menu.offsetHeight;
+                    menu_shaded = false;
+                    menu.style.visiblity = "";
+
+                    window.clearInterval(hide_interval);
+                    show_interval = window.setInterval(function() {
+
+                        offset += step;
+
+                        if (offset >= 0) {
+                            offset = 0;
+                            window.clearInterval(show_interval);
+                        }
+
+                        menu.style.top = offset + "px";
+
+                    }, 30);
+                }
+
+            }
+
+            display.onmouseout = function() {
+                showMenu();
+            };
+
+            display.onmouseover = function() {
+                hideMenu();
+            };
+
 
             /* ]]> */ </script>
 
diff --git a/src/main/webapp/images/protocol-icons/tango/terminal.png b/src/main/webapp/images/protocol-icons/tango/terminal.png
new file mode 100644 (file)
index 0000000..9370a2c
Binary files /dev/null and b/src/main/webapp/images/protocol-icons/tango/terminal.png differ
diff --git a/src/main/webapp/images/protocol-icons/tango/video-display.png b/src/main/webapp/images/protocol-icons/tango/video-display.png
new file mode 100644 (file)
index 0000000..384777e
Binary files /dev/null and b/src/main/webapp/images/protocol-icons/tango/video-display.png differ
index f3b0661..35c399a 100644 (file)
                     var protocol = document.createElement("td");
                     var id = document.createElement("td");
 
+                    var protocolIcon = document.createElement("div");
+                    protocolIcon.className = "protocol icon " + configs[i].protocol;
+
                     // Set CSS
                     protocol.className = "protocol";
                     id.className = "name";
                         "client.xhtml?" + encodeURIComponent(configs[i].id));
 
                     // Set cell contents
-                    protocol.textContent   = configs[i].protocol;
+                    protocol.appendChild(protocolIcon);
+                    //protocol.textContent   = configs[i].protocol;
                     clientLink.textContent = configs[i].id;
                     id.appendChild(clientLink);
 
index 99a09ae..7d99735 100644 (file)
@@ -86,14 +86,6 @@ div.errorDialog p {
     z-index: 1;
 }
 
-#menu.connected {
-    opacity: 0.5;
-}
-
-#menu.connected:hover {
-    opacity: 1;
-}
-
 #menu.error {
     background: #D44;
 }
@@ -139,6 +131,11 @@ div#clipboardDiv {
     border-radius: 0.5em;
 
     width: 50em;
+    opacity: 0.5;
+}
+
+#menu:hover div#clipboardDiv {
+    opacity: 1;
 }
 
 div#clipboardDiv h2 {
index d073c1d..f8e5ca0 100644 (file)
@@ -219,3 +219,14 @@ div#connection-list-ui a[href] {
 div#connection-list-ui a[href]:hover {
     text-decoration: underline;
 }
+
+.protocol.icon {
+    width: 24px;
+    height: 24px;
+    background-image: url('../images/protocol-icons/tango/video-display.png');
+}
+
+.protocol.icon.ssh {
+    background-image: url('../images/protocol-icons/tango/terminal.png');
+}
+