곽교린

Merge branch 'hotfix' into develop

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