GUAC-326: Add notification for mouse emulation type change. Use it to signal completed downloads while we're at it.

This commit is contained in:
Michael Jumper
2014-04-22 16:15:23 -07:00
parent 6c917360cf
commit 2e6f7c5d8e
3 changed files with 57 additions and 5 deletions

View File

@@ -871,6 +871,22 @@ GuacUI.Client.showError = function(title, status, reconnect) {
GuacUI.Client.visibleStatus.show();
};
GuacUI.Client.showNotification = function(message) {
// Create notification
var element = GuacUI.createElement("div", "message notification");
GuacUI.createChildElement(element, "div", "caption").textContent = message;
// Add to DOM
GuacUI.Client.notification_area.appendChild(element);
// Remove from DOM after around 5 seconds
window.setTimeout(function() {
GuacUI.Client.notification_area.removeChild(element);
}, 5000);
};
/**
* Connects to the current Guacamole connection, attaching a new Guacamole
* client to the user interface. If a Guacamole client is already attached,
@@ -1565,6 +1581,7 @@ GuacUI.Client.attach = function(guac) {
if (offset >= bytes.length) {
stream.sendEnd();
GuacUI.Client.notification_area.removeChild(upload.getElement());
GuacUI.Client.showNotification("Upload of \"" + file.name + "\" complete.");
}
// Otherwise, update progress
@@ -1733,14 +1750,20 @@ GuacUI.Client.attach = function(guac) {
GuacUI.Client.absolute_radio.onclick =
GuacUI.Client.absolute_radio.onchange = function() {
GuacUI.Client.setMouseEmulationAbsolute(GuacUI.Client.absolute_radio.checked);
GuacUI.Client.showMenu(false);
if (!GuacUI.Client.emulate_absolute) {
GuacUI.Client.showNotification("Absolute mouse emulation selected");
GuacUI.Client.setMouseEmulationAbsolute(GuacUI.Client.absolute_radio.checked);
GuacUI.Client.showMenu(false);
}
};
GuacUI.Client.relative_radio.onclick =
GuacUI.Client.relative_radio.onchange = function() {
GuacUI.Client.setMouseEmulationAbsolute(!GuacUI.Client.relative_radio.checked);
GuacUI.Client.showMenu(false);
if (GuacUI.Client.emulate_absolute) {
GuacUI.Client.showNotification("Relative mouse emulation selected");
GuacUI.Client.setMouseEmulationAbsolute(!GuacUI.Client.relative_radio.checked);
GuacUI.Client.showMenu(false);
}
};
// Prevent default on all touch events

View File

@@ -36,3 +36,18 @@
to { opacity: 1; }
}
/**
* fadeout: Fade from fully opaque to fully transparent.
*/
@keyframes fadeout {
from { opacity: 1; }
to { opacity: 0; }
}
@-moz-keyframes fadeout {
from { opacity: 1; }
to { opacity: 0; }
}
@-webkit-keyframes fadeout {
from { opacity: 1; }
to { opacity: 0; }
}

View File

@@ -640,3 +640,17 @@ p.hint {
bottom: 0;
opacity: 0;
}
.notification.message {
background: #DFD;
animation: fadein 0.125s linear, fadeout 2s 3s linear;
-webkit-animation: fadein 0.125s linear, fadeout 2s 3s linear;
}
.notification.message .caption {
vertical-align: middle;
white-space: normal;
overflow: hidden;
text-overflow: ellipsis;
}