from html_streaming to xynt_streaming object name
[brisk.git] / web / xynt-streaming-ifra.js
diff --git a/web/xynt-streaming-ifra.js b/web/xynt-streaming-ifra.js
new file mode 100644 (file)
index 0000000..d037f10
--- /dev/null
@@ -0,0 +1,42 @@
+var ctx_new      = "";
+var ctx_old_len  = 0;
+var last_clean   = 0;
+var script_clean = -1;
+
+function push(s) {
+    var i;
+
+    // window.parent.console.log('push('+s+');');
+    for (i = last_clean ; i < script_clean ; i++) {
+        if (typeof($('hs'+i)) != 'undefined' && $('hs'+i) != null) {
+            document.body.removeChild($('hs'+i));
+            // if (typeof(CollectGarbage) == "function") {
+            // CollectGarbage();
+            // }
+
+            last_clean = i;
+        }
+        else {
+            // window.parent.console.log('ifra: hs'+i+" NOT FOUND");
+        }
+    }
+    // FIXME: remove this barbarian log
+    // window.parent.console.log("ifra: ctx_new.length: "+ctx_new.length+"  ctx_old_len: "+ctx_old_len);
+    if (ctx_new.length == ctx_old_len && ctx_old_len > 0) {
+        // FIXME: remove this barbarian log
+        // window.parent.console.log("ifra: NOW clean");
+        // alert("cleanna");
+        ctx_new = "";
+        ctx_old_len = 0;
+    }
+    if (s != null) {
+        ctx_new = ctx_new + "@BEGIN@" + s + "@END@";
+        // FIXME: remove this barbarian log
+        // window.parent.console.log("ifra: CTX_NEW: ["+ctx_new+"]");
+        
+    }
+    else {
+        ctx_new = ctx_new + "_";
+    }
+    return;
+}