trunk/web/index.html
| r24871 | r24872 | |
| 24 | 24 | writeToScreen('<b style="color: green;">Connected</b>'); |
| 25 | 25 | }; |
| 26 | 26 | websocket.onclose = function(ev) { |
| 27 | | writeToScreen('<b style="color: white;">disconnected</b>'); |
| 27 | writeToScreen('<b style="color: white;">Disconnected</b>'); |
| 28 | 28 | }; |
| 29 | 29 | websocket.onmessage = function(ev) { |
| 30 | 30 | if (ev.data=='update_machine') |
| 31 | 31 | { |
| 32 | | $.getJSON('json/game', function(data) { |
| 32 | $.ajax({ |
| 33 | url: "json/game", |
| 34 | cache: false, |
| 35 | dataType: "json", |
| 36 | success: function(data) { |
| 33 | 37 | var items = []; |
| 34 | | if(data.name =='___empty') { |
| 38 | if(data.name =='__empty') { |
| 35 | 39 | items.push('No driver running'); |
| 36 | 40 | } else { |
| 37 | 41 | items.push('<h1>Currently running : ' + data.description + ' [' + data.manufacturer+']</h1>'); |
| 38 | 42 | |
| 39 | 43 | } |
| 40 | 44 | document.getElementById('current').innerHTML = items.join(''); |
| 41 | | }); |
| 45 | }, |
| 46 | error: function (request, status, error) { alert(status + ", " + error); } |
| 47 | }); |
| 42 | 48 | } |
| 43 | 49 | |
| 44 | 50 | }; |