comparison public/viewer/revisionviewer.html @ 123:bb930ac4cfd8 draft

remove createOptionTag method
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Fri, 19 Apr 2013 20:29:44 +0900
parents 9cfb52e94bd0
children 26896f0aed2a
comparison
equal deleted inserted replaced
122:9cfb52e94bd0 123:bb930ac4cfd8
63 } 63 }
64 64
65 function loadRevisionInfo(consensus_id) { 65 function loadRevisionInfo(consensus_id) {
66 $.ajax({ 66 $.ajax({
67 url:BASE_URL+"/claims/get/revision/"+consensus_id, 67 url:BASE_URL+"/claims/get/revision/"+consensus_id,
68 success:function(o){createOptionTag(consensus_id, o); console.log("revision = "+ o) 68 success:function(o){ console.log("revision = "+ o)
69 createSlider(o); 69 createSlider(o);
70 }, 70 },
71 type:"GET",cache:false, 71 type:"GET",cache:false,
72 error:function(o){console.log("ERROR",o)} 72 error:function(o){console.log("ERROR",o)}
73 }); 73 });
74 } 74 }
91 } 91 }
92 var MAX_REV = revisionInfo.length-1; 92 var MAX_REV = revisionInfo.length-1;
93 $('#revisionDisplayId').val("0/"+MAX_REV); 93 $('#revisionDisplayId').val("0/"+MAX_REV);
94 $('#slider').slider({ step:STEP, 94 $('#slider').slider({ step:STEP,
95 max:slideMax, 95 max:slideMax,
96 slide: function(event, ui){ console.log('ui.value = '+ui.value); 96 slide: function(event, ui){ var id = REVISION_INFO[ui.value];
97 var id = REVISION_INFO[ui.value];
98 console.log("id = "+id);
99 $('#revisionDisplayId').val(ui.value/STEP+"/"+MAX_REV); 97 $('#revisionDisplayId').val(ui.value/STEP+"/"+MAX_REV);
100 changeRevision(id); 98 changeRevision(id);
101 }, 99 },
102 // stop: function(event, ui){ console.log(ui.value); } 100 // stop: function(event, ui){ console.log(ui.value); }
103 }); 101 });
104 $('#slider').slider('option','value',0); 102 $('#slider').slider('option','value',0);
105 $('#slider').slider(); 103 $('#slider').slider();
106 }
107
108 function createOptionTag(consensus_id, revisionInfo) {
109 var selectArray = new Array();
110 selectArray.push('<select onchange="changeRevision(this.value)" >');
111 var index = 0;
112 for (var i=0; i<revisionInfo.length; i++) {
113 var revision = revisionInfo.length - i;
114 selectArray.push("<option value='"+revisionInfo[i]+"'>"+revision+"</option>");
115 }
116 selectArray.push("</select>");
117 $('#revisionId')[0].innerHTML = "revision:"+selectArray.join();
118 // $('#revisionId')[0].children[0].value = consensus_id;
119 } 104 }
120 105
121 $(function(){ 106 $(function(){
122 userName=localStorage.userName; 107 userName=localStorage.userName;
123 if(userName)start(); 108 if(userName)start();
493 478
494 </script> 479 </script>
495 <div class='header'> 480 <div class='header'>
496 <nobr id='header_title'><a href='index.html'>Home</a><span id='headertitle_main' style='margin-left:40px;'>loading</span></nobr> 481 <nobr id='header_title'><a href='index.html'>Home</a><span id='headertitle_main' style='margin-left:40px;'>loading</span></nobr>
497 </div> 482 </div>
498 <div class="revision" id="revisionId"></div>
499 <p class='revisionDisplay'> 483 <p class='revisionDisplay'>
500 <label for="revInfo">Revision Number:</label> 484 <label for="revInfo">Revision Number:</label>
501 <input type="text" id="revisionDisplayId" style='background-color:black; border:0; color:white;'/> 485 <input type="text" id="revisionDisplayId" style='background-color:black; border:0; color:white;'/>
502 </p> 486 </p>
503 <div class="revisionSlider" id="slider" style='left:20px;' ></div> 487 <div class="revisionSlider" id="slider" style='left:20px;' ></div>