Advertisement
Guest User

CCTV

a guest
May 18th, 2011
919
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. <html>
  3.  
  4. <head>
  5.  
  6. <script language="JavaScript" type="text/javascript">
  7.  
  8. var id_pos = location.href.search("id");
  9.  
  10. var chnr_pos = location.href.search("all");
  11.  
  12. var chsel_pos = location.href.search("sel");
  13.  
  14. var pal_pos = location.href.search("pal");
  15.  
  16. var thd_id = location.href.substring(id_pos+3, chnr_pos-1);
  17.  
  18. var ch_nr = location.href.substring(chnr_pos+4, chsel_pos-1);
  19.  
  20. var ch_sel = location.href.substring(chsel_pos+4, pal_pos-1);
  21.  
  22. var b_pal = location.href.substring(pal_pos+4);
  23.  
  24. var pic_cnt = 1;
  25.  
  26. var time_past = 0;
  27.  
  28. var bImgLoaded = 0;
  29.  
  30. var img_idx = 0;
  31.  
  32. var prev_time = 0;
  33.  
  34. live_date = new Date();
  35.  
  36. img_buf = new Array(new Image(), new Image());
  37.  
  38. ajax_req = new XMLHttpRequest();
  39.  
  40.  
  41.  
  42. function ImageLoaded()
  43.  
  44. {
  45.  
  46.     bImgLoaded = 1;
  47.  
  48. }
  49.  
  50.  
  51.  
  52. function ChgChannel()
  53.  
  54. {
  55.  
  56.     document.form1.THREAD_ID.value = thd_id;
  57.  
  58.     document.form1.submit();
  59.  
  60. }
  61.  
  62. /*
  63.  
  64. window.onunload=function()
  65.  
  66. {
  67.  
  68.     document.form2.THREAD_ID.value = thd_id;
  69.  
  70.     document.form2.submit();
  71.  
  72. }
  73.  
  74. */
  75.  
  76. img_buf[0].onload = ImageLoaded;
  77.  
  78. img_buf[0].onabort = ImageLoaded;
  79.  
  80. img_buf[0].onerror = ImageLoaded;
  81.  
  82. img_buf[1].onload = ImageLoaded;
  83.  
  84. img_buf[1].onabort = ImageLoaded;
  85.  
  86. img_buf[1].onerror = ImageLoaded;
  87.  
  88. img_buf[0].src = "ivop.get?action=live&piccnt=0&THREAD_ID=" + thd_id;
  89.  
  90.  
  91.  
  92. </script>
  93.  
  94. </head>
  95.  
  96.  
  97.  
  98. <body>
  99.  
  100. <div align="center">
  101.  
  102.   <table width="200" style="height: 36px">
  103.  
  104.     <tr>
  105.  
  106.       <td width="125" scope="col"><form action="showch.set" method="get" name="form1">
  107.  
  108.         <select name="channel" id="channel" onChange="ChgChannel()">
  109.  
  110.           <option value="1">CH1</option>
  111.  
  112.           <option value="2">CH2</option>
  113.  
  114.           <option value="3">CH3</option>
  115.  
  116.           <option value="4">CH4</option>
  117.  
  118.           <option value="5">CH5</option>
  119.  
  120.           <option value="6">CH6</option>
  121.  
  122.           <option value="7">CH7</option>
  123.  
  124.           <option value="8">CH8</option>
  125.  
  126.           <option value="9">CH9</option>
  127.  
  128.           <option value="10">CH10</option>
  129.  
  130.           <option value="11">CH11</option>
  131.  
  132.           <option value="12">CH12</option>
  133.  
  134.           <option value="13">CH13/option>
  135.  
  136.           <option value="14">CH14</option>
  137.  
  138.           <option value="15">CH15</option>
  139.  
  140.           <option value="16">CH16</option>
  141.  
  142.         </select>
  143.  
  144.           <input name="THREAD_ID" type="hidden">
  145.  
  146.           &nbsp;</form>      </td>
  147.  
  148.       <td width="150" scope="col">&nbsp;</td>
  149.  
  150.       <th width="61" scope="col"><form name="form2" method="get" action="Forcekick.set" >
  151.  
  152.         <div align="right">
  153.  
  154.           <input name="ITSELF" type="hidden" value="1">
  155.  
  156.           <input name="THREAD_ID" type="hidden">
  157.  
  158.           <input name="Logout" type="submit" value="Logout"
  159.  
  160.             onClick="document.form2.THREAD_ID.value = thd_id">
  161.  
  162.           </div>
  163.  
  164.       </form>      </th>
  165.  
  166.     </tr>
  167.  
  168.   </table>
  169.  
  170.   <hr>
  171.  
  172.   <form name="form3" method="get" action="">
  173.  
  174.     <input name="livetime" type="text" id="livetime" size="28" readonly="true" style="border:none">
  175.  
  176.   </form>
  177.  
  178.   <p><img name="liveview" id="liveview" width="352" height="240" border="1" alt="Live View"></p>
  179.  
  180. </div>
  181.  
  182.  
  183.  
  184. <script>
  185.  
  186. function RefreshLiveView()
  187.  
  188. {
  189.  
  190.     //
  191.  
  192.     // pic_cnt is just to avoid caching in some browser, like Firefox
  193.  
  194.     // URL to get live video: "ivop.get?action=live&piccnt=" + pic_cnt + "&THREAD_ID=" + thd_id
  195.  
  196.     //
  197.  
  198.     time_past++;
  199.  
  200.     if (bImgLoaded || time_past>5)
  201.  
  202.     {
  203.  
  204.         bImgLoaded = 0;
  205.  
  206.         time_past = 0;
  207.  
  208.         document.liveview.src = img_buf[img_idx].src;
  209.  
  210.         img_idx ^= 1; // next one
  211.  
  212.  
  213.  
  214.         img_buf[img_idx].src = "ivop.get?action=live&piccnt=" + pic_cnt + "&THREAD_ID=" + thd_id;
  215.  
  216.         pic_cnt++;
  217.  
  218.     }
  219.  
  220.     setTimeout("RefreshLiveView()", 1000);
  221.  
  222. }
  223.  
  224.  
  225.  
  226. function UpdateContents()
  227.  
  228. {
  229.  
  230.     for (opt=document.form1.channel.length; opt>0; opt--)
  231.  
  232.     {
  233.  
  234.         if (opt>ch_nr)
  235.  
  236.             document.form1.channel.options[opt-1].text = "N.A.";
  237.  
  238.     }
  239.  
  240.     document.form1.channel.selectedIndex = ch_sel - 1;
  241.  
  242.     document.form1.channel.length = ch_nr;
  243.  
  244.     if (b_pal==1)
  245.  
  246.         document.liveview.height = 288;
  247.  
  248. }
  249.  
  250.  
  251.  
  252. function RefreshLiveTime()
  253.  
  254. {
  255.  
  256.     ajax_req.open("GET", "livetime.get?THREAD_ID="+thd_id, false);
  257.  
  258.     ajax_req.send(null);
  259.  
  260.     if (ajax_req.responseText>0 && prev_time!=ajax_req.responseText)
  261.  
  262.     {
  263.  
  264.         prev_time = ajax_req.responseText;
  265.  
  266.         live_date.setTime(prev_time*1000);
  267.  
  268.         document.form3.livetime.size = live_date.toLocaleString().length + 2;
  269.  
  270.         document.form3.livetime.value = live_date.toLocaleString();
  271.  
  272.     }
  273.  
  274.     setTimeout("RefreshLiveTime()", 500);
  275.  
  276. }
  277.  
  278.  
  279.  
  280. UpdateContents();
  281.  
  282. RefreshLiveView();
  283.  
  284. RefreshLiveTime();
  285.  
  286. </script>
  287.  
  288.  
  289.  
  290. </body>
  291.  
  292.  
  293.  
  294. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement