]> git.pond.sub.org Git - eow/commitdiff
add basic Ajax test
authorGerd Flaig <gefla@gefla-mac-zrh>
Sun, 23 Nov 2008 00:47:56 +0000 (01:47 +0100)
committerGerd Flaig <gefla@gefla-mac-zrh>
Sun, 23 Nov 2008 00:47:56 +0000 (01:47 +0100)
static/ajax.txt [new file with mode: 0644]
static/eow.js [new file with mode: 0644]
static/style.css [new file with mode: 0644]
static/test.html [new file with mode: 0644]

diff --git a/static/ajax.txt b/static/ajax.txt
new file mode 100644 (file)
index 0000000..e671beb
--- /dev/null
@@ -0,0 +1 @@
+eowOut("Hello, Ajax world!");
diff --git a/static/eow.js b/static/eow.js
new file mode 100644 (file)
index 0000000..f856075
--- /dev/null
@@ -0,0 +1,29 @@
+function eowOut(output) {
+  var t = document.createTextNode(output);
+  var p = document.createElement("p");
+  p.appendChild(t);
+  dojo.byId("output").appendChild(p);
+}
+
+function hello() {
+  dojo.xhrGet( {
+    // The following URL must match that used to test the server.
+    url: "/eow/static/ajax.txt", 
+    handleAs: "javascript",
+
+    timeout: 5000, // Time in milliseconds
+
+    // The LOAD function will be called on a successful response.
+    load: function(response, ioArgs) {
+      console.log(response);
+      return response;
+    },
+
+    // The ERROR function will be called in an error case.
+    error: function(response, ioArgs) {
+      console.error("HTTP status code: ", ioArgs.xhr.status);
+      return response;
+    }
+  });
+}
+
diff --git a/static/style.css b/static/style.css
new file mode 100644 (file)
index 0000000..cc60f10
--- /dev/null
@@ -0,0 +1,18 @@
+html { height: 100%; }
+body { background: #fff; font-size: 12px; font-family: monospace; height: 99%; margin:0px; padding: 0px; }
+form { padding: 0px; margin: 0px; }
+pre { font-size: 12px; }
+br { clear: both; }
+:focus { outline: 0; }
+input.cmdline { border: none; border: 0px; font-size: 12px; font-family: monospace; padding: 0px; margin:0px; width:100%; }
+table.inputtable { width:100%; vertical-align:top; }
+td.inputtd { width:100%; }
+#input { margin-left: 8px; color: #666; overflow: hidden; }
+#output{ margin-left: 8px; margin-top: 8px; }
+.less { color: #666; }
+.info { color: #090; }
+table { padding: 0px; margin: 0px; border-collapse: collapse; border-spacing: 0px; }
+td { padding: 0px; margin: 0px; vertical-align: top; font-size: 12px; font-family: monospace; }
+.help td { padding-right: 25px; font-size: 12px; }
+div#prompt { display: inline; white-space:nowrap; padding:0px; margin:0px; }
+img { border: none; }
diff --git a/static/test.html b/static/test.html
new file mode 100644 (file)
index 0000000..3f6cc9f
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html> <head>
+<link rel="stylesheet" type="text/css" href="style.css">
+<title>Empire Web Client</title>
+
+<script type="text/javascript" src="dojo-release-1.1.1/dojo/dojo.js"
+  djConfig="parseOnLoad:true, isDebug:false"></script>
+<script type="text/javascript" src="eow.js"></script>
+<script type="text/javascript">
+var init = function(){
+  console.log("I run after the page is ready. See this in the console");
+  hello();
+};
+dojo.addOnLoad(init);
+</script>
+
+</head>
+
+<body>
+<div id="output">
+<span class="less">EOW alpha0 Empire/Ajax</span>
+<br/>
+<br/>
+<span class="info">Welcome to the Empire over the Web client (EOW).</span>
+</div>
+<div id="input">
+<form name='f' onsubmit='return false;' class='cmdline' action=''>
+<table class="inputtable"><tr><td><div id='prompt' class='less'>> </div></td><td class="inputtd"><input id='inputfield' name='q' type='text' class='cmdline' autocomplete='off' value="" /></td></tr></table>
+</form>
+</div>
+
+<hr>
+<address></address>
+<!-- hhmts start --> Last modified: Sun Nov 23 01:38:22 CET 2008 <!-- hhmts end -->
+</body> </html>