code formatting,

client lines coloring
This commit is contained in:
Maxmtg
2013-04-14 12:34:34 +00:00
parent 44ca43c121
commit f214be71bf
3 changed files with 9 additions and 8 deletions

View File

@@ -7,12 +7,13 @@ div.wrap { width: 640px; margin: 100px auto;}
.title input {width: 300px; } .title input {width: 300px; }
.title span { display: inline-block; width: 120px; text-align: right; } .title span { display: inline-block; width: 120px; text-align: right; }
.messages { height: 20ex; overflow: auto; background-color: #eee; padding: 4px; border: 1px solid black; list-style: none; } .messages { height: 20ex; overflow: auto; background-color: #fff; padding: 4px; border: 1px solid black; list-style: none; }
.messages .incoming { color: #006; } .messages .incoming { color: #006; }
.messages .incoming:before { content: "<< "} .messages .incoming:before { content: "<< "}
.messages .outcoming { color: #060; } .messages .outcoming { color: #060; }
.messages .outcoming:before { content: ">> "} .messages .outcoming:before { content: ">> "}
.messages .error { color: #600; } .messages .error { color: #600; }
.messages li:nth-child(2n) { background-color: #f7f7f7; }
.packets { padding: 4px; background-color: #ddd; border: 1px solid black; border-top: 0px; display: none; } .packets { padding: 4px; background-color: #ddd; border: 1px solid black; border-top: 0px; display: none; }
.packets span { display: inline-block; width: 120px; text-align: right; } .packets span { display: inline-block; width: 120px; text-align: right; }

View File

@@ -31,7 +31,9 @@ function addLi(className, text) {
} }
function onConnectClicked() { function onConnectClicked() {
server.connect($("#ws_uri").val()); var uri = $("#ws_uri").val()
addLi("connecting", "Connecting to ws://" + uri + " ..." )
server.connect(uri);
$('#connect').attr("disabled", "disabled") $('#connect').attr("disabled", "disabled")
$('#disconn').removeAttr("disabled") $('#disconn').removeAttr("disabled")

View File

@@ -44,12 +44,10 @@ public enum PacketOpcode {
private static IPacket decodePacket(PacketOpcode code, String data) { private static IPacket decodePacket(PacketOpcode code, String data) {
switch(code) { switch(code) {
case Echo: case Echo: return EchoPacket.parse(data);
return EchoPacket.parse(data); case Authorize: return AuthorizePacket.parse(data);
case Authorize:
return AuthorizePacket.parse(data); default: return UnknownPacket.parse(data);
default:
return UnknownPacket.parse(data);
} }
} }
} }