summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorGravatarGravatar Miodrag Milanovic <mmicko@gmail.com>2013-08-15 08:57:26 +0000
committerGravatarGravatar Miodrag Milanovic <mmicko@gmail.com>2013-08-15 08:57:26 +0000
commit961c8d924a7472cb1165cf57dadb8ebbb4f9da51 (patch) (github)
treebdb30eb6e0288a8b50f7d0b4a6cbf156cf19e7b4 /web
parentdb652360161bf56f19de7c28879ae8850c451f0f (diff)
downloadmame-961c8d924a7472cb1165cf57dadb8ebbb4f9da51.tar.bz2
mame-961c8d924a7472cb1165cf57dadb8ebbb4f9da51.zip
Implemented first commands for web interface (nw)
Diffstat (limited to 'web')
-rw-r--r--web/commands.html3
-rw-r--r--web/index.html25
2 files changed, 25 insertions, 3 deletions
diff --git a/web/commands.html b/web/commands.html
new file mode 100644
index 00000000000..1a38f257688
--- /dev/null
+++ b/web/commands.html
@@ -0,0 +1,3 @@
+<a href="javascript:executeCommands('softreset');" data-role="button">Soft reset</a>
+<a href="javascript:executeCommands('hardreset');" data-role="button">Hard reset</a>
+<a href="javascript:executeCommands('exit');" data-role="button">Exit</a>
diff --git a/web/index.html b/web/index.html
index d733b190bb3..0bfda89104d 100644
--- a/web/index.html
+++ b/web/index.html
@@ -23,9 +23,28 @@
function takeScreenshot()
{
- document.getElementById('content').innerHTML = '<center><img src="/screenshot.png"/></center>';
+ document.getElementById('main').innerHTML = '<center><img src="/screenshot.png"/></center>';
}
+ function loadCommands()
+ {
+ $("#main").load('commands.html', function () {
+ $(this).trigger('create');
+ });
+ }
+ function executeCommands(command)
+ {
+ $.ajax({
+ url: "/cmd?name="+command,
+ cache: false,
+ dataType: "text",
+ success: function(data) {
+ },
+ error: function (request, status, error) { alert(status + ", " + error); }
+ });
+ }
+
+
function startWebSocket() {
var url = 'ws://localhost:8080/foo';
websocket = new WebSocket(url);
@@ -85,12 +104,12 @@
<a href="#page1" data-transition="fade" data-icon="grid">Image</a>
</li>
<li>
- <a href="#page1" data-transition="fade" data-icon="star">Commands</a>
+ <a href="javascript:loadCommands();" data-transition="fade" data-icon="star">Commands</a>
</li>
</ul>
</div>
</div>
- <div data-role="content" id ="content">
+ <div data-role="content" id ="main">
</div>
<div data-theme="a" data-role="footer" data-position="fixed">
<div data-role="navbar" data-iconpos="top">