display currently running driver and update on change on server side (nw)

This commit is contained in:
Miodrag Milanovic 2013-08-13 13:28:07 +00:00
parent 5a511c644f
commit 3fafdaae30
4 changed files with 30 additions and 23 deletions

1
.gitattributes vendored
View file

@ -8901,3 +8901,4 @@ web/images/nav-arrow-right.png -text svneol=unset#image/png
web/images/nav-arrow-right2.png -text svneol=unset#image/png
web/images/nav-sub-press.png -text svneol=unset#image/png
web/index.html svneol=native#text/html
web/js/jquery.js svneol=native#text/javascript

View file

@ -1,14 +1,2 @@
@charset "UTF-8";
* { margin: 0; padding: 0; outline: none; }
body { padding: 50px; border-top: none; background: #4c4c4c url(../images/grad1.png) 0 0 repeat-x; color: #d9d9d9; color: #000; font: 14px/normal Tahoma, Arial, Helvetica, sans-serif; }
p { margin-bottom: 1em; }
body > p, .container > p { margin-bottom: 0; }
h1,h2,h3 { margin-bottom: .5em; font-family: Arial, Helvetica, sans-serif; line-height: normal; }
h1 { margin-bottom: .5em; padding-bottom: 4px; border-bottom: solid 1px #d9d9d9; font-family: Arial, Helvetica, sans-serif; font-weight: normal; font-size: 180%; text-indent: 5px; letter-spacing: -1px; }
cite { float: right; }
fieldset { border: none; }
ul.classic { list-style: disc; margin-bottom: 1em; padding-left: 2em; }
div.section { clear: both; padding-top: 50px; }
.dropdown-upward { margin-top: 400px !important; }
body { color: white; padding: 50px; border-top: none; background: #4c4c4c url(../images/grad1.png) 0 0 repeat-x; font: 12px/normal Tahoma, Arial, Helvetica, sans-serif; }

View file

@ -9,36 +9,47 @@
<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) {
var div = document.createElement('div');
div.innerHTML = message;
document.getElementById('output').appendChild(div);
document.getElementById('output').innerHTML = message;
};
window.onload = function() {
var url = 'ws://localhost:8080/foo';
websocket = new WebSocket(url);
websocket.onopen = function(ev) {
writeToScreen('<span style="color: green;">CONNECTED</span>');
writeToScreen('<b style="color: green;">Connected</b>');
};
websocket.onclose = function(ev) {
writeToScreen('<span style="color: white;">DISCONNECTED</span>');
writeToScreen('<b style="color: white;">disconnected</b>');
};
websocket.onmessage = function(ev) {
writeToScreen('<span style="color: blue;">RESPONSE: ' + ev.data +
' </span>');
if (ev.data=='update_machine')
{
$.getJSON('json/game', 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('');
});
}
};
websocket.onerror = function(ev) {
writeToScreen('<span style="color: red; ">ERROR: </span> ' + ev.data);
writeToScreen('<b style="color: red; ">Error</b>');
};
};
</script>
<div data-role="page">
<div data-role="header">
<img src="images/logo-mame-small.png"/>
<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">
@ -71,7 +82,8 @@
</li>
<li id="n-debugger"><a href="./">Debugger</a></li>
</ul>
<br/><br/><div id="output"></div>
<br/><br/><br/><br/>
<div id="current"></div>
</div>
</body>
</html>

6
web/js/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long