Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 3rd, 2010  |  syntax: None  |  size: 2.72 KB  |  views: 98  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <script type="text/javascript">
  2.   var height_array = new Array();
  3.   var width_array = new Array();
  4.   width_array[1] = 640;
  5.   height_array[1] = 480;
  6. </script>
  7. <img src="http://EEEPC:8080/loading.jpg" class="webcam" id="webcam1" onmousedown="PTZMouseDown1(event)" width="640" height="480" alt="Live Stream" />
  8. <script type="text/javascript">
  9. <!--
  10. currentCamera1= 1;
  11. errorimg1= 0;
  12. document.images.webcam1.onload = DoIt1;
  13. document.images.webcam1.onerror = ErrorImage1;
  14. function LoadImage1()
  15. {
  16.         uniq1 = Math.random();
  17.         document.images.webcam1.src = "http://EEEPC:8080/cam_" + currentCamera1 + ".jpg?uniq="+uniq1;
  18.         document.images.webcam1.onload = DoIt1;
  19. }
  20. function PTZMouseDown1(e)
  21. {
  22.         var IE = document.all?true:false;
  23.         var x,y;
  24.         var myx,myy;
  25.         var myifr = document.getElementById("_iframe-ptz");
  26.         tp = getElPos1();
  27.         myx = tp[0];
  28.         myy = tp[1];
  29.         if(IE){
  30.         var scrollX = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft;
  31.         var scrollY = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
  32.         x = event.clientX - myx + scrollX;
  33.         y = event.clientY - myy + scrollY;
  34.         } else {
  35.         x = e.pageX - myx;
  36.         y = e.pageY - myy;
  37.         }
  38.         if ((width_array[currentCamera1] != null) && (width_array[currentCamera1] > 0)) x = Math.round((x * 400) / width_array[currentCamera1]);
  39.         if ((height_array[currentCamera1] != null) && (height_array[currentCamera1] > 0)) y = Math.round((y * 300) / height_array[currentCamera1]);
  40.         if (x > 400) x = 400;
  41.         if (y > 300) y = 300;
  42.         if (myifr != null) myifr.src = "http://EEEPC:8080/ptz?src=" + currentCamera1 + "&moveto_x=" + x + "&moveto_y=" + y +"";
  43.         return true;
  44. }
  45. function getElPos1()
  46. {
  47.             el = document.images.webcam1;
  48.             x = el.offsetLeft;
  49.             y = el.offsetTop;
  50.             elp = el.offsetParent;
  51.             while(elp!=null)
  52.               { x+=elp.offsetLeft;
  53.                 y+=elp.offsetTop;
  54.                 elp=elp.offsetParent;
  55.               }
  56.             return new Array(x,y);
  57. }
  58. function ErrorImage1()
  59. {
  60.         errorimg1++;
  61.         if (errorimg1>3){
  62.               document.images.webcam1.onload = "";
  63.               document.images.webcam1.onerror = "";
  64.               document.images.webcam1.src = "offline.jpg";
  65.               }else{
  66.                 uniq1 = Math.random();
  67.             document.images.webcam1.src = "http://EEEPC:8080/cam_" + currentCamera1 + ".jpg?uniq="+uniq1;
  68.               }
  69. }
  70. function DoIt1()
  71. {
  72.         errorimg1=0;
  73.         window.setTimeout("LoadImage1();", 40);
  74. }
  75. //-->
  76. </script>
clone this paste RAW Paste Data