-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathxcodeConsole.html
More file actions
156 lines (127 loc) · 3.71 KB
/
xcodeConsole.html
File metadata and controls
156 lines (127 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>TestNSlog[39888]</title>
<style>
body {
margin: 0px;
font-family: Courier, monospace;
font-size: 0.8em;
}
table {
width: 100%;
border-collapse: collapse;
}
tr {
vertical-align: top;
}
tr:nth-child(odd) {
background-color: #eeeeee;
}
td {
padding: 2px 10px;
}
#footer {
text-align: center;
margin: 20px 0px;
color: darkgray;
}
.error {
color: red;
font-weight: bold;
}
</style>
<script src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></script>
<script>
var refreshDelay = 500;
var footerElement = null;
function updateTimestamp() {
var now = new Date();
footerElement.innerHTML = "Last updated on " + now.toLocaleDateString() + " " + now.toLocaleTimeString();
}
$( window ).load(function() {
footerElement = document.getElementById("footer");
updateTimestamp();
init();
});
var ipAddress = getUrlParameter('ip');
var wsUri ="ws://" + ipAddress + ":8080";
var output;
function init() {
output = document.getElementById("content");
testWebSocket();
}
function testWebSocket() {
var websocket = new WebSocket(wsUri);
websocket.onopen = function(evt) {
onOpen(evt)
};
websocket.onclose = function(evt) {
onClose(evt)
};
websocket.onmessage = function(evt) {
onMessage(evt)
};
websocket.onerror = function(evt) {
onError(evt)
};
}
function onOpen(evt) {
writeToScreen("CONNECTED");
// doSend("WebSocket rocks");
}
function onClose(evt) {
writeToScreen("DISCONNECTED");
}
function onMessage(evt) {
writeToScreen(evt.data);
}
function onError(evt) {
writeToScreen( evt.data);
}
function doSend(message) {
writeToScreen("SENT: " + message);
websocket.send(message);
}
function writeToScreen(message) {
var tr = document.createElement('tr');
var pre = document.createElement('pre');
var td1 = document.createElement('td');
var text1 = document.createTextNode(message);
pre.appendChild(text1)
td1.appendChild(pre);
tr.appendChild(td1);
var lowerM = message.toLowerCase()
if (lowerM.indexOf("code = 0") >= 0 || lowerM.indexOf("error") >= 0 || lowerM.indexOf("exception") >= 0) {
tr.style.background = "#E97E60"
} else if (lowerM.indexOf("warning") >= 0) {
tr.style.background = "#FACC9A"
} else if (lowerM.indexOf("-- response") >= 0) {
tr.style.color = "#5BBB7B"
}
output.appendChild(tr);
footerElement.scrollIntoView(false);
updateTimestamp();
}
function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
}
</script>
</head>
<body>
<table>
<tbody id="content"></tbody>
</table>
<div id="footer">Last updated on 1/10/2017 5:51:18 PM</div>
</body>
</html>