summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorsostler <sbostler@gmail.com>2010-01-11 03:00:40 -0500
committersostler <sbostler@gmail.com>2010-01-11 03:00:40 -0500
commit16dce906d7f4bd4bbe4b4b00b9375d42d5d85beb (patch)
treecd490e7aedaf15b1b489649a1676c24bfa15b143 /static
parent953b0041bf74bb410902b664458b21159ff6a8c7 (diff)
added test page
Diffstat (limited to 'static')
-rwxr-xr-xstatic/test.html48
1 files changed, 35 insertions, 13 deletions
diff --git a/static/test.html b/static/test.html
index 965132d..8cffc8d 100755
--- a/static/test.html
+++ b/static/test.html
@@ -1,14 +1,36 @@
<html>
- <head>
- <style>
- #test img {
- border: 2px solid pink;
- }
- </style>
- </head>
- <body>
- <div id="test">
- <img src="/static/cat.jpeg">
- </div>
- </body>
-</html> \ No newline at end of file
+ <head>
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
+
+ <script>
+ Start = new Date().getTime();
+ Timestamp = new Date().getTime();
+
+ function refresh() {
+ var onSuccess = function(json) {
+ Timestamp = json.timestamp;
+ $('body').prepend('<div>' + (Timestamp - Start) + ": " + json.messages.length + " messages</div>");
+ setTimeout(refresh, 1000);
+ };
+ var onError = function(resp, textStatus, errorThrown) {
+ $('body').prepend('<div style="color: red">' + textStatus + ', ' + errorThrown + '</div>');
+ setTimeout(refresh, 1000);
+ };
+
+ $.ajax({
+ type: 'GET',
+ timeout: 5000,
+ url: "/refresh",
+ data: { 'room': "RoomA", 'since': Timestamp },
+ cache: false,
+ dataType: 'json',
+ success: onSuccess,
+ error: onError
+ });
+ }
+ $(document).ready(refresh);
+ </script>
+ </head>
+ <body>
+ </body>
+</html>