summaryrefslogtreecommitdiffstatshomepage
path: root/web/index.html
blob: 13280cb640572cb1bc4099ab37336146142c11d4 (plain) (blame)
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
<!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" xml:lang="en" lang="en">
<head>
	<title>MAME</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="expires" content="-1">
	<link rel="shortcut icon" href="favicon.ico">
	<link href="css/main.css" media="screen" rel="stylesheet" type="text/css" />
	<link href="css/dropdown.css" media="screen" rel="stylesheet" type="text/css" />
	<link href="css/default.ultimate.css" media="screen" rel="stylesheet" type="text/css" />
	<script src="js/jquery.js"></script>
</head>
<body>
<script language="javascript" type="text/javascript">

  var writeToScreen = function(message) {
    document.getElementById('output').innerHTML = message;
  };
  window.onload = function() {
    var url = 'ws://localhost:8080/foo';
    websocket = new WebSocket(url);
    websocket.onopen = function(ev) {
	  writeToScreen('<b style="color: green;">Connected</b>');
    };
    websocket.onclose = function(ev) {      
      writeToScreen('<b style="color: white;">Disconnected</b>');
    };
    websocket.onmessage = function(ev) {
	if (ev.data=='update_machine') 
	{
		$.ajax({
		  url: "json/game",
		  cache: false,
		  dataType: "json",
		  success: function(data) {
			var items = [];
			if(data.name =='__empty') {
				items.push('No driver running');
			} else {
				items.push('<h1>Currently running : ' + data.description + ' [' + data.manufacturer+']</h1>');

			}
			document.getElementById('current').innerHTML = items.join('');
		  },
		  error: function (request, status, error) { alert(status + ", " + error); }
		});	
	}

    };
    websocket.onerror = function(ev) {
      writeToScreen('<b style="color: red; ">Error</b>');
    };
  };
</script>
<div data-role="page">
    <div data-role="header">
		<img src="images/logo-mame-small.png"/><div id="output" style="display: inline;"><b style="color:white;">Connecting...</b></div>
    </div>

<ul id="nav" class="dropdown dropdown-horizontal">
	<li id="n-home"><a href="./">Home</a></li>
	<li id="n-logs"><a href="./" class="dir">Logs</a>
		<ul>
			<li class="first"><a href="./"><strong>OS log</strong></a></li>
			<li><a href="./">Verbose</a></li>
			<li><a href="./">Driver log</a></li>
		</ul>
	</li>
	<li id="n-options"><a href="./" class="dir">Options</a>
		<ul>
			<li class="first"><span class="dir">Video</span>
				<ul>
					<li class="first"><a href="./">Option 1</a></li>
					<li><a href="./">Option 2</a></li>
					<li><a href="./">Option 3</a></li>
					<li><a href="./">Option 4</a></li>
					<li><a href="./">Option 5</a></li>
				</ul>
			</li>
			<li><span class="dir">Sound</span>
				<ul>
					<li class="first"><a href="./">Option 1</a></li>
					<li><a href="./">Option 2</a></li>
				</ul>
			</li>
		</ul>
	</li>
	<li id="n-debugger"><a href="./">Debugger</a></li>
</ul>
<br/><br/><br/><br/>
<div id="current"></div>
</div>
</body>
</html>