a0bc1f05e4c3eb6f792112c57b723687c60fdebf
[brisk.git] / web / xynt-http-streaming-ifra.js
1 var ctx_new      = "";
2 var ctx_old_len  = 0;
3 var last_clean   = 0;
4 var script_clean = -1;
5
6 function push(s) {
7     var i;
8
9     for (i = last_clean ; i < script_clean ; i++) {
10         if (typeof($('hs'+i)) != 'undefined' && $('hs'+i) != null) {
11             document.body.removeChild($('hs'+i));
12             // if (typeof(CollectGarbage) == "function") {
13             // CollectGarbage();
14             // }
15
16             last_clean = i;
17         }
18         else {
19             // window.parent.console.log('ifra: hs'+i+" NOT FOUND");
20         }
21     }
22     // FIXME: remove this barbarian log
23     // window.parent.console.log("ifra: ctx_new.length: "+ctx_new.length+"  ctx_old_len: "+ctx_old_len);
24     if (ctx_new.length == ctx_old_len && ctx_old_len > 0) {
25         // FIXME: remove this barbarian log
26         // window.parent.console.log("ifra: NOW clean");
27         // alert("cleanna");
28         ctx_new = "";
29         ctx_old_len = 0;
30     }
31     if (s != null) {
32         ctx_new = ctx_new + "@BEGIN@" + s + "@END@";
33         // FIXME: remove this barbarian log
34         window.parent.console.log("ifra: CTX_NEW: ["+ctx_new+"]");
35         
36     }
37     else {
38         ctx_new = ctx_new + "_";
39     }
40     return;
41 }