updated with 'ready' trick to workaround windows scope reset
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.com>
Sat, 7 Apr 2012 16:17:52 +0000 (18:17 +0200)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.com>
Sat, 7 Apr 2012 16:17:52 +0000 (18:17 +0200)
web/winstream.php
web/winstream_rd.php

index f083907..e2b5ec6 100644 (file)
@@ -2,23 +2,18 @@
 <head>
 <script type="text/javascript" src="xynt/xynt-commons.js"></script>
 <script type="text/javascript" src="xynt/xynt-console.js"></script>
 <head>
 <script type="text/javascript" src="xynt/xynt-commons.js"></script>
 <script type="text/javascript" src="xynt/xynt-console.js"></script>
+<script type="text/javascript" src="xynt/xynt-http-streaming.js"></script>
 <script type="text/javascript"><!--
 <script type="text/javascript"><!--
-     var allmythings="BEGIN";
-     var ifra;
+var allmythings="BEGIN";
 
 
-function check_and_set() {
-    $('cont').innerHTML = allmythings;
-    // console.log(allmythings);
+window.onload = function () {
+    var hs;
+    
+    hs = new http_streaming(document);
+    hs.start('winstream_rd.php');
 }
 }
- window.onload = function () {
-     ifra = document.createElement("iframe");
-     ifra.style.visibility = "hidden";
-     document.body.appendChild(ifra);
-     ifra.contentWindow.location.href = 'winstream_rd.php';
-     setInterval(check_and_set, 500);
- }
-
-     //-->
+    
+//-->
 </script>
 <body>
 <div id="cont">INIT</div>
 </script>
 <body>
 <div id="cont">INIT</div>
index 955269a..67bc876 100644 (file)
@@ -1,9 +1,13 @@
 <html>
 <head>
 <script type="text/javascript" src="xynt/xynt-console.js"></script>
 <html>
 <head>
 <script type="text/javascript" src="xynt/xynt-console.js"></script>
-</head>
-<body>
-</body>
+<!-- <script type="text/javascript">
+window.onload_old = function() {
+    // parent.ifra.contentWindow.location.href = 'winstream_rd.php';     
+     window.location.href = 'winstream_rd.php';     
+}
+
+</script> -->
 <?php
 function mop_flush()
 {
 <?php
 function mop_flush()
 {
@@ -17,20 +21,33 @@ function main()
     for ($i = 0 ; $i < 4096 ; $i++) {
         $s .= rand(0,255);
     }
     for ($i = 0 ; $i < 4096 ; $i++) {
         $s .= rand(0,255);
     }
-    for ($i = 0 ; $i < 20 ; $i++) {
+    for ($i = 0 ; $i < 300 ; $i++) {
         
         /*                    parent.document.getElementById('cont').innerHTML = \"%d\";
                              parent.allmythings =  \"%d\"; */
         
         /*                    parent.document.getElementById('cont').innerHTML = \"%d\";
                              parent.allmythings =  \"%d\"; */
-        printf("<script type=\"text/javascript\">
+        if ($i != 350) {
+            printf("<script id=\"hs%d\" type=\"text/javascript\">
                     parent.allmythings = %d;
                     console.log(\"zorro \"+parent.allmythings);
 
                     parent.allmythings = %d;
                     console.log(\"zorro \"+parent.allmythings);
 
-                </script>", $i);
+                </script>", $i, $i);
+        }
+        else {
+            printf("<script id=\"hs%d\" type=\"text/javascript\">
+                    parent.allmythings = %d;
+                    console.log(\"zorro \"+parent.allmythings);
+                    parent.document.location.assign('winstream2.php');
+                </script>", $i, $i);
+        }
         if ($i == 0)
         if ($i == 0)
-            printf("%s", $s);
+            printf("<!-- %s -->", $s);
         mop_flush();
         mop_flush();
-        sleep(1);
+        usleep(1000000);
     }
 }
 main();
     }
 }
 main();
-?>
\ No newline at end of file
+?>
+</head>
+<body>
+</body>
+</html>
\ No newline at end of file