-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make applog interface a little more robust
- Loading branch information
Showing
2 changed files
with
72 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||
<title>fischertechnik TXT community firmware</title> | ||
<link rel="stylesheet" href="txt.css"> | ||
<link rel="icon" href="/favicon.ico" type="image/x-icon" /> | ||
</head><body> | ||
<h1><div class="outline"><font color="red">fischer</font><font color="#046ab4">technik</font> <font color="#fcce04">TXT</font></div></h1> | ||
|
||
<h1>Application log</h1> | ||
<div id='file'></div> | ||
<script type="text/javascript" charset="utf-8"> | ||
function write_line(l) { | ||
var obj = document.getElementById('file'); | ||
obj.innerHTML += l; | ||
obj.scrollTop = obj.scrollHeight; | ||
} | ||
|
||
function launch() { | ||
var http = new XMLHttpRequest(); | ||
http.open("GET", "./applog.py"); | ||
http.onreadystatechange = function() { } | ||
http.send(); | ||
} | ||
|
||
if ("MozWebSocket" in window) { | ||
WebSocket = MozWebSocket; | ||
} | ||
|
||
function ws_start() { | ||
var ws = new WebSocket("ws://"+document.location.hostname+":8999/"); | ||
ws.onopen = function() { | ||
}; | ||
ws.onmessage = function(evt) { | ||
write_line(evt.data); | ||
}; | ||
ws.onclose = function() { | ||
write_line("."); | ||
setTimeout(function(){ ws_start() }, 1000); | ||
}; | ||
} | ||
|
||
if (WebSocket) { | ||
launch(); | ||
ws_start(); | ||
} else { | ||
alert("WebSocket not supported;") | ||
} | ||
</script> | ||
</body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters