곽교린

Merge branch 'hotfix' into develop

Showing 1 changed file with 5 additions and 2 deletions
...@@ -13,6 +13,7 @@ let videoNum = "TpPwI_Lo0YY"; //비디오 주소(예시) ...@@ -13,6 +13,7 @@ let videoNum = "TpPwI_Lo0YY"; //비디오 주소(예시)
13 var videoLang = 'all'; //설정 언어 13 var videoLang = 'all'; //설정 언어
14 const serverIP = "http://localhost:3000" //서버의 주소 14 const serverIP = "http://localhost:3000" //서버의 주소
15 var commentList = new Array(); 15 var commentList = new Array();
16 +var AllcommentNum = 0;
16 var commentNum = 0; 17 var commentNum = 0;
17 var korNum = 0; 18 var korNum = 0;
18 var savednpt = ''; 19 var savednpt = '';
...@@ -75,7 +76,7 @@ function showcomment(response, VideoNum){ ...@@ -75,7 +76,7 @@ function showcomment(response, VideoNum){
75 <br> 76 <br>
76 <div id="liveAlertPlaceholder"></div> 77 <div id="liveAlertPlaceholder"></div>
77 <a class="btn btn-dark" href="${serverIP}/search?videourl=${VideoNum}&nextpage=${savednpt}&languages=${videoLang}" role="button">Show more comments</a> 78 <a class="btn btn-dark" href="${serverIP}/search?videourl=${VideoNum}&nextpage=${savednpt}&languages=${videoLang}" role="button">Show more comments</a>
78 - <button type="button" class="btn btn-danger" onclick="alert('Korean Percent: ${Math.floor((korNum/commentNum)*10000)/100}%')">Get Kor Percent</button> 79 + <button type="button" class="btn btn-danger" onclick="alert('Korean Percent: ${Math.floor((korNum/AllcommentNum)*10000)/100}%')">Get Kor Percent</button>
79 <br> 80 <br>
80 ${commentDisplay} 81 ${commentDisplay}
81 </body> 82 </body>
...@@ -110,6 +111,7 @@ function loadcomment(ApiKey, VideoNum, npt, n, res){ ...@@ -110,6 +111,7 @@ function loadcomment(ApiKey, VideoNum, npt, n, res){
110 } 111 }
111 tempcommentList.push(tempComment); 112 tempcommentList.push(tempComment);
112 tempListLen += 1; 113 tempListLen += 1;
114 + AllcommentNum ++;
113 } 115 }
114 for(let iter = 0; iter < tempListLen; iter++){ 116 for(let iter = 0; iter < tempListLen; iter++){
115 let langPromise = tempcommentList[iter].lang.then(langData=>{ 117 let langPromise = tempcommentList[iter].lang.then(langData=>{
...@@ -118,9 +120,9 @@ function loadcomment(ApiKey, VideoNum, npt, n, res){ ...@@ -118,9 +120,9 @@ function loadcomment(ApiKey, VideoNum, npt, n, res){
118 templang = await langPromise; 120 templang = await langPromise;
119 if(videoLang == 'all' || videoLang == templang){ 121 if(videoLang == 'all' || videoLang == templang){
120 commentList.push(tempcommentList[iter]); 122 commentList.push(tempcommentList[iter]);
121 - if(templang=="ko"){korNum++;}
122 commentNum++; 123 commentNum++;
123 } 124 }
125 + if(templang=="ko"){korNum++;}
124 } 126 }
125 127
126 //console.log(response.data.items[0].snippet.topLevelComment.snippet.textDisplay); 128 //console.log(response.data.items[0].snippet.topLevelComment.snippet.textDisplay);
...@@ -194,6 +196,7 @@ var app = http.createServer(function(request,response){ // request는 브라우 ...@@ -194,6 +196,7 @@ var app = http.createServer(function(request,response){ // request는 브라우
194 commentList.splice(0); 196 commentList.splice(0);
195 commentNum = 0; //코멘트 리스트 초기화 197 commentNum = 0; //코멘트 리스트 초기화
196 korNum = 0; 198 korNum = 0;
199 + AllcommentNum = 0;
197 200
198 videoNum = queryData.videourl; 201 videoNum = queryData.videourl;
199 videoLang = queryData.languages; 202 videoLang = queryData.languages;
......