Changeset 13567
- Timestamp:
- 05/04/12 23:53:54 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/www/index.js
r13565 r13567 34 34 function onload() 35 35 { 36 try { xmlHttp = new XMLHttpRequest(); } 37 catch(e) 38 { 39 alert("Your browser doesn't support dynamic reload."); 40 return; 41 } 42 36 43 /* 37 44 alert("0 -- "+navigator.appCodeName+"\n"+ … … 52 59 function loadPage(name, z) 53 60 { 54 var xmlHttp = null; 55 56 try { xmlHttp = new XMLHttpRequest(); } 57 catch(e) 58 { 59 alert("Your browser doesn't support dynamic reload."); 60 return; 61 } 62 61 var xmlHttp = new XMLHttpRequest(); 63 62 xmlHttp.open('POST', name+'.table', true); 64 65 xmlHttp.onreadystatechange = 66 function () 67 { 68 if (xmlHttp.readyState == 4) 69 { 70 if (xmlHttp.status!=0 && xmlHttp.status!=200) 71 { 72 alert("ERROR[0] - HTTP request '"+name+".table': "+xmlHttp.statusText+" ["+xmlHttp.status+"]"); 73 //setTimeout("loadPage('+name+')", 5000); 74 /****** invalidate ******/ 75 return; 76 } 77 78 buildPage(name, xmlHttp.responseText, (z+1)%2); 79 changePage(z); 80 81 //changePage(name, xmlHttp.resposeText); 82 //slideOut(name, xmlHttp.responseText); 83 //displayPage(name, xmlHttp.responseText); 84 //onresize(true); 85 } 86 }; 63 xmlHttp.onload = function () 64 { 65 if (xmlHttp.status!=200) 66 { 67 alert("ERROR[0] - HTTP request '"+name+".table': "+xmlHttp.statusText+" ["+xmlHttp.status+"]"); 68 //setTimeout("loadPage('+name+')", 5000); 69 /****** invalidate ******/ 70 return; 71 } 72 73 buildPage(name, xmlHttp.responseText, (z+1)%2); 74 changePage(z); 75 76 //changePage(name, xmlHttp.resposeText); 77 //slideOut(name, xmlHttp.responseText); 78 //displayPage(name, xmlHttp.responseText); 79 //onresize(true); 80 }; 87 81 88 82 xmlHttp.send(null); … … 136 130 } 137 131 138 if (cols[1].substring(0, 7)=="canvas=") 139 { 132 /* 133 <span class="ui-icon ui-icon-arrow-r ui-icon-shadow"> 134 -webkit-box-shadow: rgba(255, 255, 255, 0.398438) 0px 1px 0px 0px; 135 background-attachment: scroll; 136 background-clip: border-box; 137 background-color: rgba(0, 0, 0, 0.398438); 138 background-image: url(http://code.jquery.com/mobile/1.1.0/images/icons-18-white.png); 139 background-origin: padding-box; 140 background-position: -60px 50%; 141 background-repeat: no-repeat; 142 box-shadow: rgba(255, 255, 255, 0.398438) 0px 1px 0px 0px; 143 margin-bottom: 0px; 144 margin-left: 0px; 145 margin-right: 0px; 146 margin-top: -9px; 147 padding: 0; 148 position: absolute; 149 right: 10px; 150 top: 50%; 151 white-space: nowrap; 152 width: 18px; 153 height: 18px; 154 zoom: 1; 155 </span> 156 */ 157 158 var check = cols[1].split("="); 159 160 if (check.length>1 && (check[0]=="camera" || check[0]=="hist")) 161 { 162 var data = cols[1].substring(check[0].length+1).split("/"); 163 140 164 var tr = document.createElement("tr"); 141 165 tr.setAttribute("class", "row"); … … 153 177 canv.setAttribute("width", "1"); 154 178 canv.setAttribute("height", "1"); 155 canv.setAttribute("data-file", cols[1].substring(7)); 179 canv.setAttribute("data-type", check[0]); 180 canv.setAttribute("data-file", data[0]); 181 canv.setAttribute("data-data", cols[1].substring(check[0].length+data[0].length+2)); 156 182 canv.setAttribute("style", "display:none;"); 157 183 td.appendChild(canv); … … 281 307 282 308 doresize(1); 309 310 //setInterval(refresh_text, 1000); 311 //setInterval(refresh_graphics, 5000); 283 312 284 313 refresh_text(); … … 302 331 303 332 $("body").setAttribute("data-visible", (z+1)%2); 304 intervalSlide = setInterval( "doShift("+z+")", 75);333 intervalSlide = setInterval(doShift, 75, z); 305 334 } 306 335 … … 456 485 if (isSliding() || !valid(fname)) 457 486 { 458 setTimeout("refresh_text()", 1000); 459 return; 460 } 461 462 var xmlHttp = null; 463 464 try { xmlHttp = new XMLHttpRequest(); } 465 catch(e) 466 { 467 alert("Your browser doesn't support dynamic reload."); 468 return; 469 } 470 487 setTimeout(refresh_text, 1000); 488 return; 489 } 490 491 var xmlHttp = new XMLHttpRequest(); 471 492 xmlHttp.open('POST', fname+'.txt', true); 472 473 xmlHttp.onreadystatechange = 474 function () 475 { 476 if (xmlHttp.readyState == 4) 477 { 478 if (xmlHttp.status!=0 && xmlHttp.status!=200) 479 { 480 alert("ERROR[1] - HTTP request '"+fname+".txt': "+xmlHttp.statusText+" ["+xmlHttp.status+"]"); 481 setTimeout("refresh_text()", 10000); 482 return; 483 } 484 485 if (!isSliding()) 486 { 487 cycleCol($("ldot"+z)); 488 update_text(fname, xmlHttp.responseText); 489 } 490 setTimeout("refresh_text()", 3000); 491 } 492 }; 493 493 xmlHttp.onload = function () 494 { 495 if (xmlHttp.status!=200) 496 { 497 alert("ERROR[1] - HTTP request '"+fname+".txt': "+xmlHttp.statusText+" ["+xmlHttp.status+"]"); 498 setTimeout(refresh_text, 10000); 499 return; 500 } 501 502 if (!isSliding()) 503 { 504 cycleCol($("ldot"+z)); 505 update_text(fname, xmlHttp.responseText); 506 } 507 setTimeout(refresh_text, 3000); 508 }; 494 509 xmlHttp.send(null); 495 510 } … … 612 627 if (isSliding() || !valid(fname)) 613 628 { 614 setTimeout("refresh_graphics()", 1000); 615 return; 616 } 617 618 var xmlHttp = null; 619 620 try { xmlHttp = new XMLHttpRequest(); } 621 catch(e) 622 { 623 alert("Your browser doesn't support dynamic reload."); 624 return; 625 } 626 629 setTimeout(refresh_graphics, 1000); 630 return; 631 } 632 633 var xmlHttp = new XMLHttpRequest(); 627 634 xmlHttp.open('POST', fname, true); 628 xmlHttp.onload = 629 function () 630 { 631 if (xmlHttp.readyState == 4) 632 { 633 if (xmlHttp.status!=0 && xmlHttp.status!=200) 634 { 635 alert("ERROR[2] - Request '"+fname+"': "+xmlHttp.statusText+" ["+xmlHttp.status+"]"); 636 setTimeout("refresh_text()", 10000); 637 //****** invalidate ****** 638 return; 639 } 640 641 if (!isSliding()) 642 { 643 cycleCol($("rdot"+z)); 644 process_eventdata(xmlHttp.responseText); 645 } 646 setTimeout("refresh_graphics()", 5000) 647 } 648 }; 649 635 xmlHttp.onload = function() 636 { 637 if (xmlHttp.status!=200) 638 { 639 alert("ERROR[2] - Request '"+fname+"': "+xmlHttp.statusText+" ["+xmlHttp.status+"]"); 640 setTimeout(refresh_text, 10000); 641 //****** invalidate ****** 642 return; 643 } 644 645 if (!isSliding()) 646 { 647 cycleCol($("rdot"+z)); 648 process_eventdata(xmlHttp.responseText); 649 } 650 setTimeout(refresh_graphics, 5000) 651 }; 650 652 xmlHttp.send(null); 651 653 } … … 841 843 function drawCamLegend(canv) 842 844 { 845 //alert(canv.getAttribute("data-data")); 846 847 var vals = canv.getAttribute("data-data").split("/"); 848 var diff = vals[1]-vals[0]; 849 843 850 var cw = canv.width; 844 851 var ch = canv.height; … … 850 857 ctx.textBaseline = "top"; 851 858 852 ctx.strokeStyle = "#"+color(0); 853 ctx.strokeText("-2.0V", cw-5, 135); 854 859 for (var i=0; i<9; i++) 860 { 861 ctx.strokeStyle = "#"+color(16*i); 862 ctx.strokeText((vals[1]-diff*i/8)+vals[2], cw-5, 135-i*15); 863 } 864 /* 855 865 ctx.strokeStyle = "#"+color(16); 856 866 ctx.strokeText("-1.5V", cw-5, 120); … … 875 885 876 886 ctx.strokeStyle = "#"+color(127); 877 ctx.strokeText("2.0V", cw-5, 5); 887 ctx.strokeText("2.0V", cw-5, 5); */ 878 888 } 879 889 … … 929 939 ctx.stroke(); 930 940 ctx.closePath(); 941 931 942 } 932 943 … … 941 952 return; 942 953 954 var type = canv.getAttribute("data-type"); 955 943 956 var ctx = canv.getContext("2d"); 944 957 ctx.clearRect(0, 0, canv.width, canv.height); 945 958 946 // drawGraph(canv, result); 947 948 // drawCam(result);949 drawFullCam(result);950 // drawFullCam(result);951 // drawCamLegend(canv); 959 switch (type) 960 { 961 case "hist": drawGraph(canv, result); break; 962 //case "camera": drawCam(result); break; 963 case "camera": drawFullCam(result); drawCamLegend(canv); break; 964 } 952 965 953 966 $("image"+z).src = canv.toDataURL("image/png");
Note:
See TracChangeset
for help on using the changeset viewer.