Add styling classes for status line state.

This commit is contained in:
Joel Martin 2010-05-16 19:58:51 -05:00
parent b92e282ad7
commit 3c1bead9a0
3 changed files with 24 additions and 6 deletions

View File

@ -50,6 +50,15 @@ body {
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
} }
.VNC_status_normal {
color: #fff;
}
.VNC_status_error {
color: #f44;
}
.VNC_status_warn {
color: #ff4;
}
#VNC_screen { #VNC_screen {
-webkit-border-radius: 10px; -webkit-border-radius: 10px;
-moz-border-radius: 10px; -moz-border-radius: 10px;

View File

@ -29,8 +29,17 @@
#VNC_status { #VNC_status {
margin-top: 15px; margin-top: 15px;
text-align: center; text-align: center;
/*background: #eee;*/
}
.VNC_status_normal {
background: #eee; background: #eee;
} }
.VNC_status_error {
background: #f44;
}
.VNC_status_warn {
background: #ff4;
}
/* Do not set width/height for VNC_screen or VNC_canvas or incorrect /* Do not set width/height for VNC_screen or VNC_canvas or incorrect
* scaling will occur. Canvas resizes to remote VNC settings */ * scaling will occur. Canvas resizes to remote VNC settings */

12
vnc.js
View File

@ -1004,7 +1004,7 @@ clipboardClear: function () {
}, },
updateState: function(state, statusMsg) { updateState: function(state, statusMsg) {
var s, c, func, color, cmsg; var s, c, func, klass, cmsg;
s = RFB.statusLine; s = RFB.statusLine;
c = RFB.connectBtn; c = RFB.connectBtn;
func = function(msg) { console.log(msg); }; func = function(msg) { console.log(msg); };
@ -1012,25 +1012,25 @@ updateState: function(state, statusMsg) {
case 'failed': case 'failed':
func = function(msg) { console.error(msg); }; func = function(msg) { console.error(msg); };
c.disabled = true; c.disabled = true;
color = "#880000"; klass = "error";
break; break;
case 'normal': case 'normal':
c.value = "Disconnect"; c.value = "Disconnect";
c.onclick = RFB.disconnect; c.onclick = RFB.disconnect;
c.disabled = false; c.disabled = false;
color = "#000000"; klass = "normal";
break; break;
case 'disconnected': case 'disconnected':
c.value = "Connect"; c.value = "Connect";
c.onclick = function () { RFB.connect(); }; c.onclick = function () { RFB.connect(); };
c.disabled = false; c.disabled = false;
color = "#000000"; klass = "normal";
break; break;
default: default:
func = function(msg) { console.warn(msg); }; func = function(msg) { console.warn(msg); };
c.disabled = true; c.disabled = true;
color = "#444400"; klass = "warn";
break; break;
} }
@ -1041,7 +1041,7 @@ updateState: function(state, statusMsg) {
} }
RFB.state = state; RFB.state = state;
s.style.color = color; s.setAttribute("class", "VNC_status_" + klass);
cmsg = typeof(statusMsg) !== 'undefined' ? (" Msg: " + statusMsg) : ""; cmsg = typeof(statusMsg) !== 'undefined' ? (" Msg: " + statusMsg) : "";
func("New state '" + state + "'." + cmsg); func("New state '" + state + "'." + cmsg);
if (typeof(statusMsg) !== 'undefined') { if (typeof(statusMsg) !== 'undefined') {