<?php
// argument_to_setTimeout.php
// RJM Programming
// March, 2017
// Show progress of argument_to_setTimeout.html execution
$htmlis="";
if (isset($_GET['trace'])) {
  $htmlis=@file_get_contents(urldecode($_GET['trace']));
  if (strpos($htmlis, "</head>") !== false) {
   if (strpos($htmlis, "argument_to_setTim" . "eout.js") === false) {
    $htmlis=str_replace("</head>", "<script type='text/javascript' src='argument_to_setTimeout.js'></script></head>", $htmlis);
   }
  }
  if (strpos($htmlis, "'myt" . "a'") === false && strpos($htmlis, '"myt' . 'a"') === false) {
   if (strpos($htmlis, "</body>") !== false) {
    $htmlis=str_replace("</body>", "<div style='background-color:lightgray;width:100%;height:575px;' id='myta'></div></body>", $htmlis);
   }
  }
  if (strpos(str_replace("setTimeout()","setXimeout()", str_replace("call of setTimeout(","call of setXimeout(", $htmlis)), "highlightspan(") === false) {
   $sts=explode("setTimeout(", str_replace("setTimeout()","setXimeout()", str_replace("call of setTimeout(","call of setXimeout(", $htmlis)));
   $cdelay="0";
   if (sizeof($sts) > 1) {
     for ($ii=1; $ii<sizeof($sts); $ii++) {
       $thisib=explode(");", $sts[$ii])[0];
       $cdelay=explode(",", $thisib)[-1 + sizeof(explode(",", $thisib))];
       $thissi="setTimeout(" . str_replace('"','\"',$thisib) . ");";
       $htmlis=str_replace(str_replace("setXimeout","setTimeout",$sts[-1 + $ii]), str_replace("setXimeout","setTimeout",$sts[-1 + $ii]) . "\n" . ' highlightspan("' . $thissi . '",0);' . "\n", $htmlis);
     }
   }
  }
} else {
  $htmlis=@file_get_contents("argument_to_setTimeout.htm");
}
echo $htmlis;
?>

