blob: 7a104c9667f00d4969d53d85b08be94bd70d7e0d [file] [log] [blame]
Jeremy Kerrf403c422018-07-26 12:14:56 +08001<!DOCTYPE html>
2<html>
3 <head>
4 <style type="text/css">
5body, input, #file { font-size: 12px; }
6pre {
7 border: thin solid #c0c0c0;
8 color: #404040;
9 font-family: Inconsolata, Ubuntu mono, fixed;
10 font-size: 9pt;
11 padding: 0.1em 0.4em;
12}
13 </style>
14 <script src="/js/nbd.js" type="text/javascript">
15 </script>
16 <script type="text/javascript">
17var server;
18
19function start_server()
20{
21 var file = document.getElementById("file").files[0];
22
23 server = new NBDServer("ws://" + location.host + "/", file);
24 server.onlog = function(msg) {
25 var container = document.getElementById("log");
26 container.innerText += msg + "\n";
27 }
28 server.start()
29}
30
31function stop_server()
32{
33 if (server)
34 server.stop();
35}
36
37document.addEventListener("DOMContentLoaded", function(event) {
38 document.getElementById("go").focus();
39});
40
41 </script>
42 </head>
43 <body>
44 <div>
45 <input type="file" id="file">
46 <input type="button" id="go" onclick="start_server()" value="Serve Image">
47 <input type="button" id="stop" onclick="stop_server()" value="Stop">
48 </div>
49 <pre id="log"></pre>
50 </body>
51</html>