Commit 27457db468115bea7c3572f465a37d41cbb3aa67

Authored by Georg Hopp
1 parent d4b1c3fd

be somewhat more verbose in frontend and update session live bar every 10th seco…

…nd (looks much more fluent *G*)
@@ -42,7 +42,21 @@ ServerVal.prototype.process = function() @@ -42,7 +42,21 @@ ServerVal.prototype.process = function()
42 { 42 {
43 if (0 >= this.vnext) { 43 if (0 >= this.vnext) {
44 $.getJSON("/randval/", $.proxy(this.loadJSON, this)) 44 $.getJSON("/randval/", $.proxy(this.loadJSON, this))
45 - .error($.proxy(function() {this.stop();}, this)); 45 + .error($.proxy(function(xhr) {
  46 + this.stop();
  47 + $("#msg").append("AJAX error (" + xhr.status + "): ");
  48 + switch(xhr.status) {
  49 + case 403:
  50 + $("#msg").append(
  51 + "Please log in to access this function.<br />");
  52 + break;
  53 +
  54 + default:
  55 + $("#msg").append(
  56 + "Unhandled - " + xhr.responseText + "<br />");
  57 + break;
  58 + }
  59 + }, this));
46 $.getJSON("/sessinfo/", $.proxy(sess.loadJSON, sess)); 60 $.getJSON("/sessinfo/", $.proxy(sess.loadJSON, sess));
47 } 61 }
48 62
@@ -15,8 +15,8 @@ function Session(sId) @@ -15,8 +15,8 @@ function Session(sId)
15 Session.prototype.loadJSON = function(data) 15 Session.prototype.loadJSON = function(data)
16 { 16 {
17 this.id = ("0" == data.id)? "none" : data.id; 17 this.id = ("0" == data.id)? "none" : data.id;
18 - this.timeout = data.timeout;  
19 - this.timeleft = data.timeleft; 18 + this.timeout = data.timeout * 10;
  19 + this.timeleft = data.timeleft * 10;
20 20
21 this.draw(); 21 this.draw();
22 if (0 < this.timeleft) 22 if (0 < this.timeleft)
@@ -39,7 +39,7 @@ Session.prototype.draw = function() @@ -39,7 +39,7 @@ Session.prototype.draw = function()
39 Session.prototype.start = function() 39 Session.prototype.start = function()
40 { 40 {
41 if (null === this.interval) { 41 if (null === this.interval) {
42 - this.interval = setInterval($.proxy(this.process, this), 1000); 42 + this.interval = setInterval($.proxy(this.process, this), 100);
43 } 43 }
44 } 44 }
45 45
Please register or login to post a comment