X-Git-Url: http://mop.ddnsfree.com/gitweb/?p=xynt.git;a=blobdiff_plain;f=web%2Fxynt%2Fxynt-http-streaming.js;h=130af82250f7e4cd955f3e9e910d4a71e9d5f892;hp=f6b0a0bd46ee1c9247ea4d406e440b9d24f77049;hb=HEAD;hpb=e34d9bc4d332a1421383cc4614b5e461ef207dfa diff --git a/web/xynt/xynt-http-streaming.js b/web/xynt/xynt-http-streaming.js index f6b0a0b..130af82 100644 --- a/web/xynt/xynt-http-streaming.js +++ b/web/xynt/xynt-http-streaming.js @@ -60,9 +60,6 @@ http_streaming.prototype = { cmdproc: null, comm_match: /_*@BEGIN@(.*?)@END@/g, comm_clean: /_*@BEGIN@(.*?)@END@/, - ctx_old_len: 0, - // ctx_new: "", - ctx_new_len: 0, stream: "", start: function(page) { @@ -125,16 +122,17 @@ http_streaming.prototype = { do { // CHECK: maybe again here isn't needed again = 0; - if (typeof(this.ifra.contentWindow.ctx_new) == 'undefined') + if (typeof(this.ifra.contentWindow.ctx_new) == 'undefined' || + typeof(this.ifra.contentWindow.ctx_old_len) == 'undefined') break; - ctx_new_length = this.ifra.contentWindow.ctx_new.length; - if (ctx_new_length == this.ctx_old_len) { + ctx_new_len = this.ifra.contentWindow.ctx_new.length; + if (ctx_new_len <= this.ifra.contentWindow.ctx_old_len) { break; } - this.log("new: "+ ctx_new_length + " old: "+this.ctx_old_len); + this.log("new: "+ ctx_new_len + " old: "+this.ifra.contentWindow.ctx_old_len); this.keepalive_new++; - for (i = this.ctx_old_len ; i < ctx_new_length ; i++) { + for (i = this.ifra.contentWindow.ctx_old_len ; i < ctx_new_len ; i++) { if (this.ifra.contentWindow.ctx_new.charAt(i) != '_') { this.log("ctx_new.char(i) != '_' ["+this.ifra.contentWindow.ctx_new.charAt(i)+"]"); break; @@ -143,15 +141,15 @@ http_streaming.prototype = { this.log("ctx_new.charAt(i) == '_'"); } } - this.ctx_old_len = i; - if (i == ctx_new_length) { + this.ifra.contentWindow.ctx_old_len = i; + if (i == ctx_new_len) { this.log("old_len == i"); break; } else { this.log("old_len != i: "+i); } - comm_newpart = this.ifra.contentWindow.ctx_new.substr(this.ctx_old_len); + comm_newpart = this.ifra.contentWindow.ctx_new.substr(this.ifra.contentWindow.ctx_old_len); comm_len = 0; comm_arr = comm_newpart.match(this.comm_match); @@ -165,7 +163,7 @@ http_streaming.prototype = { } again = 1; } - this.ctx_old_len += comm_len; + this.ifra.contentWindow.ctx_old_len += comm_len; } while (again); @@ -226,7 +224,6 @@ http_streaming.prototype = { delete this.ifra; this.ifra = null; } - this.ctx_old_len = 0; }, reload: function () {