How to use MyApp method in Cypress

Best JavaScript code snippet using cypress

content-2.srt.js

Source:content-2.srt.js Github

copy

Full Screen

100:00:00,000 --> 00:00:19,2202/* CAUTION : Each sections of subtitle has independent scope. */3/* Ver1.0 */4doOnce[index] = true;5player.pauseVideo();6//7const myApp = {8 path : {9 answer : "https://raw.githubusercontent.com/t-yokota/quizBattle/master/contents/lamy_abc_12th/answer-2.csv",10 sound : "https://raw.githubusercontent.com/t-yokota/quizBattle/master/sounds/sounds_3", //+ext;11 btn1 : "https://github.com/t-yokota/quizBattle/raw/master/images/button_1.png",12 btn2 : "https://github.com/t-yokota/quizBattle/raw/master/images/button_2.png",13 btn3 : "https://github.com/t-yokota/quizBattle/raw/master/images/button_3.png",14 btn4 : "https://github.com/t-yokota/quizBattle/raw/master/images/button_4.png",15 },16 state : {17 ButtonCheck : 0, //ボタンチェック待機18 Question : 1, //問い読み中(早押し可能)19 MyAnswer : 2, //自分が解答権を所持(解答入力・送信可能)20 OthAnswer : 3, //他者が解答権を所持(早押し不可能)21 Talk : 4, //その他22 },23 videoState : {24 Playing : 1,25 Stopped : 2,26 },27 elem : {28 text : document.createElement("text"),29 subText : document.createElement("text"),30 ansCol : document.createElement("textarea"),31 ansBtn : document.createElement("button"),32 numOX : document.createElement("text"),33 pushBtn : document.createElement("img"),34 imgBtn1 : document.createElement("img"),35 imgBtn2 : document.createElement("img"),36 imgBtn3 : document.createElement("img"),37 imgBtn4 : document.createElement("img"),38 sounds : document.createElement("audio"),39 paramText : document.createElement("text"),40 //41 divUI : document.createElement('div'),42 divElem : document.createElement('div'),43 divBtn : document.createElement('div'),44 },45 val : {46 srtFuncArray : null, //array of functions that are executed in each subtitle47 viewFuncArray : null, //array of functions for setting view elements48 //49 os : null,50 browser : null,51 //52 touchObject : null,53 //54 audioExt : null,55 audioSpriteData : null,56 //57 loadCount : 0,58 initLoadBool : false,59 loadErrorBool : false,60 loadAlertBool : false,61 //62 initOrientation : null,63 orientationAlertBool : false,64 //65 playingCount : 0,66 pageHiddenBool : false,67 processDelayAlertBool : false,68 //69 composingBool : false,70 //71 disableSeekbarBool : false,72 //73 playerWidth : 0,74 playerHeight : 0,75 pushBtnWidth : 0,76 pushBtnHeight : 0,77 //78 prevPlayerWidth : 0,79 prevPlayerHeight : 0,80 prevClientWidth : 0,81 prevClientHeight : 0,82 //83 elemHeight : 0,84 //85 pushBtnArea : {86 left : 0,87 right : 0,88 top : 0,89 bottom : 0,90 },91 //92 divUIHeight : 0,93 divUIWidth : 0,94 divElemWidth : 0,95 divBtnWidth : 0,96 //97 hidePlayerBool : {98 phone : false,99 other : false,100 },101 //102 /* keycode (for keyboard) */103 space : 32, //push buttion104 enter : 13,105 //106 /* button check param */107 btnCheck : {108 sndInterval : 1500, //[ms]109 playInterval : 3000, //[ms]110 },111 //112 /* for question manegament */113 numQues : 1, //問題番号114 ansArray : [], //正答リスト115 cntO : 0, //正答数116 cntX : 0, //誤答数117 cntPush : 0, //1問あたりの解答回数118 limPush : 1, //1問あたりの上限解答回数119 correctBool : false, //答え合わせ結果(結果に応じて状態遷移)120 ansFile : new XMLHttpRequest(), //正答ファイル.csv121 //122 /* for status management */123 status : null,124 cntIndex : 0, //(index value has current section of subtitle)125 //126 /* for time management */127 ansTime : {128 limit : 20000, //解答制限時間[ms]129 elapsed : 0, //解答経過時間[ms]130 },131 currTime : {132 playing : 0, //be updated during the video is playing133 stopped : 0, //be updated when the video is stopped134 },135 watchedTime : 0, //136 diffTime : 0, //difference between watchedTime and currentTime (for preventing to jump playback position by seekbar)137 //138 ansIndex: 0,139 ansIndexStartTime : 0,140 jumpToAnsBool: false,141 //142 firstQuesStartTime : 0,143 },144};145//146/* get os type */147myApp.val.os = fetchOSType();148myApp.val.browser = fetchBrowserType();149//150/* set id to the elements */151myApp.elem.ansCol.id = 'anscol';152myApp.elem.ansBtn.id = 'ansbtn';153myApp.elem.pushBtn.id = 'pushbtn';154myApp.elem.divUI.id = 'divui';155myApp.elem.divElem.id = 'divelem';156myApp.elem.divBtn.id = 'divbtn';157//158/* set init value to the elements */159myApp.elem.ansCol.value = "ここに解答を入力";160myApp.elem.ansBtn.innerHTML = "1問目まで移動";161myApp.elem.ansCol.disabled = true;162myApp.elem.ansBtn.disabled = true;163myApp.elem.numOX.innerHTML = "⭕️:"+myApp.val.cntO+" ❌:"+myApp.val.cntX;164//165if(myApp.val.os != 'other'){166 myApp.elem.text.innerHTML = "早押しボタンをタップして動画を開始する";167}else{168 myApp.elem.text.innerHTML = "QuizBattle on YouTube";169 /* set tabindex for adding focus */170 myApp.elem.pushBtn.tabIndex = 0;171}172//173/* set initial state (button check) */174myApp.val.status = myApp.state.ButtonCheck;175//176/* VIEW */177resizePlayer();178//179/* set style sheets */180document.styleSheets.item(0).insertRule('html { touch-action: manipulation; }'); //disable double tap gesture181document.styleSheets.item(0).insertRule('body { text-align: center; margin: auto; background: #EFEFEF; }');182document.styleSheets.item(0).insertRule('.blinkImg { animation: blinkImg 0.7s infinite alternate; }');183document.styleSheets.item(0).insertRule('@keyframes blinkImg{ 0% { opacity: 0.3; } 100% { opacity: 1; }}');184document.styleSheets.item(0).insertRule('.blinkText { animation: blinkText 0.7s infinite alternate; }');185document.styleSheets.item(0).insertRule('@keyframes blinkText{ 0% { opacity: 0; } 100% { opacity: 1; }}');186//187/* set elements */188if(myApp.val.os != 'other'){189 myApp.elem.text.style.fontSize = '42px';190 myApp.elem.text.style.lineHeight = '60px';191 myApp.elem.text.style.fontWeight = 'bold';192 myApp.elem.text.style.display = 'block';193 myApp.elem.text.style.marginTop = '32px';194 myApp.elem.text.style.marginBottom = '32px';195 myApp.elem.text.style.padding = '0px 10px';196 myApp.elem.subText.style.fontSize = '42px';197 myApp.elem.subText.style.lineHeight = '60px';198 myApp.elem.subText.style.display = 'block';199 myApp.elem.ansCol.style.fontSize = '50px';200 myApp.elem.ansCol.style.height = '100px';201 myApp.elem.ansCol.style.textAlign = 'center';202 myApp.elem.ansCol.style.marginBottom = '10px';203 myApp.elem.ansCol.style.marginLeft = 'auto';204 myApp.elem.ansCol.style.marginRight = 'auto';205 myApp.elem.ansCol.style.display = 'block'206 myApp.elem.ansBtn.style.fontSize = '42px';207 myApp.elem.ansBtn.style.width = parseInt(myApp.elem.ansBtn.style.fontSize, 10)*10+'px';208 myApp.elem.ansBtn.style.height = parseInt(myApp.elem.ansBtn.style.fontSize, 10)*2+'px';209 myApp.elem.ansBtn.style.marginBottom = '20px';210 myApp.elem.ansBtn.style.marginLeft = 'auto';211 myApp.elem.ansBtn.style.marginRight = 'auto';212 myApp.elem.ansBtn.style.display = 'block';213 myApp.elem.numOX.style.fontSize = '42px';214 myApp.elem.numOX.style.lineHeight = '80px';215 myApp.elem.numOX.style.fontWeight = 'bold';216 myApp.elem.numOX.style.display = 'block';217 //218 myApp.val.elemHeight = (function(e){219 let res = 0;220 res += parseInt(e.text.style.lineHeight, 10);221 res += parseInt(e.text.style.marginTop, 10);222 res += parseInt(e.text.style.marginBottom, 10);223 res += parseInt(e.ansCol.style.height, 10);224 res += parseInt(e.ansCol.style.marginBottom, 10);225 res += parseInt(e.ansBtn.style.height, 10);226 res += parseInt(e.ansBtn.style.marginBottom, 10);227 res += parseInt(e.numOX.style.lineHeight, 10);228 return res229 })(myApp.elem);230 //231 myApp.val.viewFuncArray = [232 function(){233 document.getElementsByTagName("body")[0].appendChild(myApp.elem.text);234 document.getElementsByTagName("body")[0].appendChild(myApp.elem.ansBtn);235 document.getElementsByTagName("body")[0].appendChild(myApp.elem.pushBtn);236 document.getElementsByTagName("body")[0].appendChild(myApp.elem.numOX);237 document.getElementsByTagName("body")[0].appendChild(myApp.elem.paramText);238 },239 function(){240 myApp.elem.text.style.marginTop = '40px';241 myApp.elem.text.style.marginBottom = '20px';242 myApp.elem.subText.style.marginBottom = '40px';243 myApp.elem.subText.style.padding = '0px 10px';244 document.getElementsByTagName("body")[0].insertBefore(myApp.elem.subText, myApp.elem.text.nextSibling);245 },246 function(){247 myApp.elem.text.style.marginTop = '32px';248 myApp.elem.text.style.marginBottom = '32px';249 myApp.elem.text.parentNode.removeChild(myApp.elem.subText);250 document.getElementsByTagName("body")[0].insertBefore(myApp.elem.ansCol, myApp.elem.text.nextSibling);251 },252 ];253 myApp.val.viewFuncArray.shift()();254}else{255 myApp.val.divUIHeight = myApp.val.playerHeight*0.9;256 myApp.val.divUIWidth = myApp.val.playerWidth;257 myApp.val.divElemWidth = myApp.val.playerWidth*2/3;258 myApp.val.divBtnWidth = myApp.val.playerWidth*1/3;259 document.styleSheets.item(0).insertRule('body { width:'+myApp.val.playerWidth+'px; }');260 document.styleSheets.item(0).insertRule('div#divui { width:'+myApp.val.divUIWidth +'px; height:'+myApp.val.divUIHeight+'px; }');261 document.styleSheets.item(0).insertRule('div#divelem { width:'+myApp.val.divElemWidth+'px; height:'+myApp.val.divUIHeight+'px; float: left; display: flex; align-items: center; justify-content: center; flex-direction: column; }');262 document.styleSheets.item(0).insertRule('div#divbtn { width:'+myApp.val.divBtnWidth +'px; height:'+myApp.val.divUIHeight+'px; float: left; display: flex; align-items: center; justify-content: center; }');263 document.getElementsByTagName("body")[0].appendChild(myApp.elem.divUI);264 myApp.elem.divUI.appendChild(myApp.elem.divElem); //divElem is assigned to ('div')[4]265 myApp.elem.divUI.appendChild(myApp.elem.divBtn); //divBtn is assigned to ('div')[5]266 //267 myApp.elem.text.style.fontSize = '25px';268 myApp.elem.text.style.lineHeight = '45px';269 myApp.elem.text.style.fontWeight = 'bold';270 myApp.elem.text.style.display = 'block';271 myApp.elem.subText.style.fontSize = '20px';272 myApp.elem.subText.style.lineHeight = '30px';273 myApp.elem.subText.style.display = 'block';274 myApp.elem.ansCol.style.fontSize = '23px';275 myApp.elem.ansCol.style.textAlign = 'center';276 myApp.elem.ansCol.style.width = myApp.val.divElemWidth*0.75+'px';277 myApp.elem.ansCol.style.margin = '0px ' +(myApp.val.divElemWidth-parseInt(myApp.elem.ansCol.style.width, 10))/2+'px 15px';278 myApp.elem.ansBtn.style.fontSize = '23px';279 myApp.elem.ansBtn.style.width = parseInt(myApp.elem.ansBtn.style.fontSize, 10)*8+'px';280 myApp.elem.ansBtn.style.margin = '0px '+(myApp.val.divElemWidth-parseInt(myApp.elem.ansBtn.style.width, 10))/2+'px 20px';281 myApp.elem.numOX.style.fontSize = '25px';282 myApp.elem.numOX.style.lineHeight = '45px';283 myApp.elem.numOX.style.fontWeight = 'bold';284 myApp.elem.numOX.style.display = 'block';285 //286 myApp.val.viewFuncArray = [287 function(){288 myApp.elem.text.style.margin = '0px auto';289 myApp.elem.text.style.padding = '0px 40px';290 document.getElementsByTagName("div")[4].appendChild(myApp.elem.text);291 document.getElementsByTagName("div")[4].appendChild(myApp.elem.paramText);292 },293 function(){294 myApp.elem.text.style.margin = '0px auto 30px';295 myApp.elem.subText.style.margin = '0px auto 50px';296 myApp.elem.subText.style.padding = '0px 40px';297 document.getElementsByTagName("div")[4].insertBefore(myApp.elem.subText, myApp.elem.text.nextSibling);298 document.getElementsByTagName("div")[5].appendChild(myApp.elem.pushBtn);299 },300 function(){301 document.getElementsByTagName("div")[4].insertBefore(myApp.elem.ansBtn, myApp.elem.subText.nextSibling);302 },303 function(){304 myApp.elem.text.style.margin = '0px auto 15px';305 myApp.elem.text.parentNode.removeChild(myApp.elem.subText);306 document.getElementsByTagName("div")[4].insertBefore(myApp.elem.ansCol, myApp.elem.text.nextSibling);307 document.getElementsByTagName("div")[4].appendChild(myApp.elem.numOX);308 },309 ];310 myApp.val.viewFuncArray.shift()();311}312//313const num_of_materials = 6;314myApp.elem.sounds.onloadedmetadata = function(){ myApp.val.loadCount += 1; };315myApp.elem.imgBtn1.onload = function(){ myApp.val.loadCount += 1; };316myApp.elem.imgBtn2.onload = function(){ myApp.val.loadCount += 1; };317myApp.elem.imgBtn3.onload = function(){ myApp.val.loadCount += 1; };318myApp.elem.imgBtn4.onload = function(){ myApp.val.loadCount += 1; };319myApp.val.ansFile.onload = function(){ myApp.val.loadCount += 1; myApp.val.ansArray = CSVtoArray(myApp.val.ansFile.responseText); };320//321myApp.elem.sounds.onerror = function(){ myApp.val.loadErrorBool = true; };322myApp.elem.imgBtn1.onerror = function(){ myApp.val.loadErrorBool = true; };323myApp.elem.imgBtn2.onerror = function(){ myApp.val.loadErrorBool = true; };324myApp.elem.imgBtn3.onerror = function(){ myApp.val.loadErrorBool = true; };325myApp.elem.imgBtn4.onerror = function(){ myApp.val.loadErrorBool = true; };326myApp.val.ansFile.onerror = function(){ myApp.val.loadErrorBool = true; };327//328/* load audio data */329if (myApp.elem.sounds.canPlayType('audio/mp3') == 'probably'){ myApp.val.audioExt = '.mp3'; }330else if(myApp.elem.sounds.canPlayType('audio/aac') == 'probably'){ myApp.val.audioExt = '.aac'; }331else if(myApp.elem.sounds.canPlayType('audio/wav') == 'probably'){ myApp.val.audioExt = '.wav'; }332else if(myApp.elem.sounds.canPlayType('audio/mp3') == 'maybe' ){ myApp.val.audioExt = '.mp3'; }333else if(myApp.elem.sounds.canPlayType('audio/aac') == 'maybe' ){ myApp.val.audioExt = '.aac'; }334else if(myApp.elem.sounds.canPlayType('audio/wav') == 'maybe' ){ myApp.val.audioExt = '.wav'; }335myApp.elem.sounds.src = myApp.path.sound+myApp.val.audioExt;336//337/* load push button image */338myApp.elem.imgBtn1.src = myApp.path.btn1;339myApp.elem.imgBtn2.src = myApp.path.btn2;340myApp.elem.imgBtn3.src = myApp.path.btn3;341myApp.elem.imgBtn4.src = myApp.path.btn4;342if(myApp.val.os != 'other'){343 myApp.elem.pushBtn.className = "blinkImg";344}345//346/* load answer file */347myApp.val.ansFile.open("get", myApp.path.answer, true);348myApp.val.ansFile.send(null);349//350/* set audio sprite */351myApp.val.audioSpriteData = {352 pushBtn : { start : 0.0, end : 2.0 }, //[sec]353 sndO : { start : 3.0, end : 5.0 }, 354 sndX : { start : 6.0, end : 8.0 },355};356myApp.elem.sounds.addEventListener('timeupdate', spriteHandler, false);357function spriteHandler(){358 if(Math.abs(myApp.val.audioSpriteData.pushBtn.end - this.currentTime) < 0.25){359 this.pause();360 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.pushBtn.start;361 }362 if(Math.abs(myApp.val.audioSpriteData.sndO.end - this.currentTime) < 0.25){363 this.pause();364 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.pushBtn.start;365 }366 if(Math.abs(myApp.val.audioSpriteData.sndX.end - this.currentTime) < 0.25){367 this.pause();368 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.pushBtn.start;369 }370};371//372/* set function executed after initial loading */373myApp.elem.pushBtn.onerror = function(){374 myApp.val.loadErrorBool = true;375 myApp.val.loadAlertBool = true;376 alert("画像の読み込みに失敗しました。ページを再読み込みしてください。" );377};378myApp.elem.pushBtn.onload = function(){379 if(myApp.val.initLoadBool == false){380 /* change player and push button size after loading image */381 resizePlayer();382 resizePushButton();383 myApp.val.initLoadBool = true;384 if(myApp.val.os == 'other'){ myApp.val.viewFuncArray.shift()(); }385 }386};387function materialCheckFunction(){388 if(myApp.val.loadErrorBool == false){389 if(myApp.val.initLoadBool == false && myApp.val.loadCount == num_of_materials){390 myApp.val.loadCount = 0;391 /* assign push button image and main text */392 myApp.elem.pushBtn.width = document.documentElement.clientWidth/5; /* init size before loading */393 if(myApp.val.os != "other"){394 if(Math.abs(window.orientation) != 90){395 myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src;396 myApp.elem.text.innerHTML = "早押しボタンをタップして動画を開始する";397 myApp.val.initOrientation = 'portrait';398 }else{399 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;400 myApp.elem.text.innerHTML = "端末を縦向きにしてクイズをはじめる";401 myApp.val.initOrientation = 'landscape';402 alert("このサイトはスマートフォン/タブレットを縦向きにしてお楽しみください。");403 }404 }else{405 myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src;406 if(detectTouchPanel() == true){407 myApp.elem.subText.innerHTML = "<span class='blinkText'>スペースキーを押して動画を開始する</span>";408 }else{409 myApp.elem.subText.innerHTML = "<span class='blinkText'>スペースキーを押して動画を開始する</span>";410 }411 }412 }else if(myApp.val.initLoadBool == true && myApp.val.loadAlertBool == false){413 if(myApp.val.os != 'other'){414 if(Math.abs(myApp.elem.numOX.getBoundingClientRect().top - myApp.elem.ansBtn.getBoundingClientRect().bottom) < 50){415 myApp.val.loadErrorBool = true;416 myApp.val.loadAlertBool = true;417 player.pauseVideo();418 alert("画像の表示に失敗しました。ページを再読み込みしてください。");419 }420 }421 }422 }else{423 if(myApp.val.loadAlertBool == false){424 myApp.val.loadAlertBool = true;425 alert("ページの読み込みに失敗しました。ページを再読み込みしてください。");426 }427 }428}429//430/* EVENT */431/* orientation change event function */432window.addEventListener('orientationchange', myOrientationChangeEvent);433function myOrientationChangeEvent(){434 setTimeout(function(){435 resizePlayer();436 resizePushButton();437 if(myApp.val.status == myApp.state.MyAnswer){438 if(myApp.val.hidePlayerBool.phone == true){439 hidePlayer();440 }441 }442 if(Math.abs(window.orientation) != 90){443 if(myApp.val.status == myApp.state.MyAnswer){444 myApp.elem.pushBtn.src = myApp.elem.imgBtn3.src;445 }else{446 myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src;447 }448 if(myApp.val.status == myApp.state.ButtonCheck){449 myApp.elem.text.innerHTML = "早押しボタンをタップして動画を開始する";450 }451 }else{452 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;453 if(myApp.val.status == myApp.state.ButtonCheck){454 myApp.elem.text.innerHTML = "端末を縦向きにしてクイズをはじめる";455 }456 if(myApp.val.orientationAlertBool == false && myApp.val.initOrientation == 'portrait'){457 myApp.val.playingCount = -10;458 myApp.val.orientationAlertBool = true;459 alert("このサイトはスマートフォン/タブレットを縦向きにしてお楽しみください。");460 }461 }462 }, 800);463}464//465/* page hidden check event function */466document.addEventListener('webkitvisibilitychange', myPageHiddenCheckEvent, false);467function myPageHiddenCheckEvent(){468 if(document.webkitHidden){469 myApp.val.pageHiddenBool = true;470 // console.log('Hidden.');471 }else{472 myApp.val.pageHiddenBool = false;473 myApp.val.currTime.playing = player.getCurrentTime();474 myApp.val.watchedTime = myApp.val.currTime.playing;475 myApp.val.playingCount = 0;476 // console.log('Opened.');477 }478}479//480/* keydown event function */481document.onkeydown = myKeyDownEvent;482//483document.addEventListener("compositionstart", function(){ myApp.val.composingBool = true; });484document.addEventListener('compositionend', function(){ myApp.val.composingBool = false; });485function myKeyDownEvent(){486 if(myApp.val.loadErrorBool == false && myApp.val.initLoadBool == true && Math.abs(window.orientation) != 90){487 if(event.keyCode == myApp.val.space){488 myButtonAction();489 }490 /* prevent to start new line in text area */491 if(event.keyCode == myApp.val.enter){492 if(myApp.val.composingBool == false){493 return false;494 }495 }496 }497}498//499/* touchstart event function (for smartphonea and tablet) */500document.addEventListener("touchstart", myTouchEvent);501function myTouchEvent(event){502 if(myApp.val.loadErrorBool == false && myApp.val.initLoadBool == true && Math.abs(window.orientation) != 90){503 myApp.val.touchObject = event.changedTouches[0];504 if(myApp.val.pushBtnArea.left < myApp.val.touchObject.pageX && myApp.val.touchObject.pageX < myApp.val.pushBtnArea.right){505 if(myApp.val.pushBtnArea.top < myApp.val.touchObject.pageY && myApp.val.touchObject.pageY < myApp.val.pushBtnArea.bottom){506 myButtonAction();507 }508 }509 }510}511//512/* common button action */513function myButtonAction(){514 if(myApp.val.status == myApp.state.ButtonCheck){515 myApp.val.status = myApp.state.Talk;516 myApp.elem.pushBtn.className = "";517 buttonCheck(myApp.val.btnCheck.sndInterval);518 setTimeout(function(){519 player.playVideo();520 myApp.elem.ansBtn.disabled = false;521 if(myApp.val.os != 'other'){522 myApp.val.viewFuncArray.shift()();523 myApp.elem.text.innerHTML = "< 遊び方 >";524 myApp.elem.subText.innerHTML = "画面上の早押しボタンで<br>動画内のクイズに参加することができます";525 }else{526 myApp.val.viewFuncArray.shift()();527 myApp.elem.text.innerHTML = "< 遊び方 >"528 myApp.elem.subText.innerHTML = "スペースキーを早押しボタンにして<br>動画内のクイズに参加することができます";529 }530 }, myApp.val.btnCheck.playInterval);531 }532 if(myApp.val.status == myApp.state.Question){533 myApp.val.status = myApp.state.MyAnswer;534 player.pauseVideo();535 pushButton();536 }537}538//539/* player's state change event function */540player.addEventListener('onStateChange', myPlayerStateChangeEvent);541function myPlayerStateChangeEvent(){542 if(player.getPlayerState() == myApp.videoState.Playing){543 myApp.val.currTime.playing = player.getCurrentTime();544 myApp.val.watchedTime = updateWatchedTime(myApp.val.currTime.playing, myApp.val.watchedTime);545 /* check answer if the video is restarted manually without sending answer */546 if(myApp.val.status == myApp.state.MyAnswer){547 player.pauseVideo();548 checkAnswer();549 if(myApp.val.correctBool == true || myApp.val.limPush - myApp.val.cntPush == 0){550 myApp.val.status = myApp.state.Talk;551 }else{552 myApp.val.status = myApp.state.Question;553 }554 player.playVideo();555 }556 if(myApp.val.disableSeekbarBool == true){557 /* prevent to jump playback position by seekbar */558 if(myApp.val.status == myApp.state.Question){559 myApp.val.diffTime = Math.abs(myApp.val.currTime.playing - myApp.val.watchedTime);560 if(myApp.val.diffTime > 1.0){561 player.seekTo(myApp.val.watchedTime);562 }563 }else{564 myApp.val.diffTime = Math.abs(myApp.val.currTime.playing - myApp.val.watchedTime);565 // myApp.val.diffTime = myApp.val.currTime.playing - myApp.val.watchedTime; /* allow to jump to previous positon on timeline */566 if(myApp.val.diffTime > 1.0){567 player.seekTo(myApp.val.watchedTime);568 }569 }570 }571 }572 if(player.getPlayerState() == myApp.videoState.Stopped){573 myApp.val.currTime.stopped = player.getCurrentTime();574 if(myApp.val.disableSeekbarBool == true){575 /* prevent to jump video playback position by seekbar */576 /* and prevent to pause video during each question */577 if(myApp.val.status == myApp.state.Question || myApp.val.status == myApp.state.OthAnswer){578 myApp.val.diffTime = Math.abs(myApp.val.currTime.stopped - myApp.val.watchedTime);579 if(myApp.val.diffTime > 1.0){580 player.seekTo(myApp.val.watchedTime);581 }582 player.playVideo();583 }else{584 myApp.val.diffTime = Math.abs(myApp.val.currTime.stopped - myApp.val.watchedTime);585 // myApp.val.diffTime = myApp.val.currTime.stopped - myApp.val.watchedTime; /* allow to jump to previous position on timeline */586 if(myApp.val.diffTime > 1.0){587 player.seekTo(myApp.val.watchedTime);588 player.playVideo(); /* allow to pause video except during the question status */589 }590 // player.playVideo();591 }592 }593 }594}595//596/* interval event function that are executed at a certain interval */597setInterval(myIntervalEvent, interval = 10);598function myIntervalEvent(){599 if(myApp.val.pageHiddenBool == false){600 if(player.getPlayerState() == myApp.videoState.Playing){601 myApp.val.currTime.playing = player.getCurrentTime();602 myApp.val.watchedTime = updateWatchedTime(myApp.val.currTime.playing, myApp.val.watchedTime);603 if(myApp.val.disableSeekbarBool == true){604 /* check delay of processing */605 if(myApp.val.playingCount < 0 ){ myApp.val.watchedTime = myApp.val.currTime.playing; } // fix delay of watchedTime caused by showing orientation alert.606 if(myApp.val.playingCount < 10){ myApp.val.playingCount += 1; } // allow initial delay of watchedTime just after playing video.607 if(myApp.val.currTime.playing - myApp.val.watchedTime > 1.0 && myApp.val.playingCount >= 10){608 if(myApp.val.processDelayAlertBool == false){609 myApp.val.processDelayAlertBool = true;610 alert('ページ内の処理が遅くなっています。早押しの判定に支障が出る可能性があるため、他のプロセスを終了してから改めてクイズをお楽しみください。このポップアップは一度のみ表示されます。');611 }612 myApp.val.watchedTime = myApp.val.currTime.playing;613 }614 }615 /* prevent to play video before button check */616 if(myApp.val.status == myApp.state.ButtonCheck){617 player.pauseVideo();618 }619 /* execute srt function in each sections of subtitle */620 if(myApp.val.status != myApp.state.MyAnswer){621 if(myApp.val.disableSeekbarBool == true){622 if(index - myApp.val.cntIndex == 1){623 myApp.val.srtFuncArray.shift()();624 myApp.val.cntIndex += 1;625 }626 }else{627 if(index - myApp.val.cntIndex >= 1){628 for(let i = 0; i < index-myApp.val.cntIndex; i++){629 myApp.val.srtFuncArray.shift()();630 }631 myApp.val.cntIndex = index;632 // console.log(myApp.val.cntIndex);633 }634 }635 }636 }else if(player.getPlayerState() == myApp.videoState.Stopped){637 myApp.val.playingCount = 0;638 }639 if(myApp.val.status == myApp.state.ButtonCheck){640 if(myApp.val.cntIndex > 0 && myApp.val.loadAlertBool == false){641 myApp.val.loadErrorBool = true;642 myApp.val.loadAlertBool = true;643 player.pauseVideo();644 alert('ページの読み込みに失敗しました。ページを再読み込みしてください。');645 }646 }647 if(myApp.val.status == myApp.state.MyAnswer){648 /* reforcus when anscol is blank */649 // if(document.activeElement.id != "anscol" && myApp.elem.ansCol.value.valueOf() === ""){650 // myApp.elem.ansCol.focus();651 // }652 /* answer time managemant */653 if(document.activeElement.id == "anscol" || myApp.val.ansTime.elapsed != 0){654 myApp.val.ansTime.elapsed += interval;655 myApp.elem.text.innerHTML = "のこり"+Math.floor((myApp.val.ansTime.limit-myApp.val.ansTime.elapsed)/1000+1)+"秒";656 if(myApp.val.ansTime.elapsed >= myApp.val.ansTime.limit){657 checkAnswer();658 if(myApp.val.correctBool == true || myApp.val.limPush - myApp.val.cntPush == 0){659 myApp.val.status = myApp.state.Talk;660 }else{661 myApp.val.status = myApp.state.Question;662 }663 player.playVideo();664 }665 }666 }else{667 if(myApp.val.os == 'other' && document.activeElement.id == "player"){668 /* preparation of js keydown event */669 instantFocusToElement(myApp.elem.pushBtn);670 }671 myApp.val.ansTime.elapsed = 0;672 }673 /* check results of importing material */674 materialCheckFunction();675 /* update push button area (mainly for when the window is zoomed in iOS)*/676 updatePushButtonArea();677 /* print parameters for debug */678 printParams();679 }680}681//682/* onclick event function of send answer button */683myApp.elem.ansBtn.onclick = myOnClickEvent;684function myOnClickEvent(){685 /* jump to init question */686 if(index == 0){687 let tmpTime = myApp.val.firstQuesStartTime-0.1;688 if(myApp.val.currTime.playing < tmpTime){689 myApp.elem.ansBtn.disabled = true;690 myApp.val.watchedTime = tmpTime;691 player.seekTo(tmpTime);692 }693 }694 /* send answer */695 if(myApp.val.status == myApp.state.MyAnswer){696 checkAnswer();697 if(myApp.val.correctBool == true || myApp.val.limPush - myApp.val.cntPush == 0){698 myApp.val.status = myApp.state.Talk;699 }else{700 myApp.val.status = myApp.state.Question;701 }702 player.playVideo();703 }704}705//706/* onfocus event function of answer column */707myApp.elem.ansCol.onfocus = function(){ myApp.elem.ansCol.val = ""; }708//709/* FUNCTION */710function detectTouchPanel(){711 return window.ontouchstart === null;712}713//714function fetchOSType(){715 let osType = null;716 const ua = navigator.userAgent;717 if(ua.match(/Android/)){718 osType = "Android";719 return osType;720 }else if(ua.match(/iPhone/)) {721 osType = "iOS"; // iPhone OS722 return osType;723 }else if(ua.match(/iPad/)) {724 osType = "iOS"; // iPad OS725 return osType;726 }else if(ua.match(/Macintosh/) && detectTouchPanel() == true){727 osType = 'iOS'; // iPad OS with Safari728 return osType;729 }else{730 osType = "other";731 return osType;732 }733}734//735function fetchBrowserType(){736 let bwType = null;737 const ua = navigator.userAgent;738 if(ua.match(/Firefox/)){739 bwType = "Firefox";740 return bwType;741 }else if(ua.match(/EdgiOS/) || ua.match(/EdgA/)){742 bwType = "Edge";743 return bwType;744 }else if(ua.match(/OPR/)){745 bwType = "Opera";746 return bwType;747 }else if(ua.match(/OPT/)){748 bwType = "OperaTouch";749 return bwType;750 }else if(ua.match(/YJApp/)){751 bwType = "Yahoo";752 return bwType;753 }else if(ua.match(/Smooz/)){754 bwType = "Smooz";755 return bwType;756 }else if(ua.match(/CriOS/) || ua.match(/Chrome/)){757 //Chrome or Others ...758 bwType = "Chrome";759 return bwType;760 }else{761 //Safari, Firefox(iOS), Brave or Others ...762 bwType = "Other";763 return bwType;764 }765}766/**767 * @param {string} str768 * @returns {array} (rows: num of question, columns: num of patterns of answer)769 */770function CSVtoArray(str){771 const array = new Array();772 const tmp = str.split("\r\n");773 for(let i = 0; i < tmp.length; i++){774 array[i] = tmp[i].split(",");775 }776 return array;777}778//779function resizePlayer(){780 if(myApp.val.os != 'other'){781 if(Math.abs(window.orientation) != 90){782 // myApp.val.playerWidth = document.documentElement.clientWidth;783 if(myApp.val.os == 'Android'){ myApp.val.playerWidth = window.innerWidth; } // In Android, clientWidth doesn't include scrollbar.784 if(myApp.val.os == 'iOS'){ myApp.val.playerWidth = document.documentElement.clientWidth; } // In iOS, innerWidth isn't static (it changes with device orientation).785 myApp.val.playerHeight = myApp.val.playerWidth/16*9;786 }else{787 myApp.val.playerWidth = document.documentElement.clientWidth*2/3;788 myApp.val.playerHeight = myApp.val.playerWidth/16*9;789 }790 /* set special width of anscol to prevent the window is zoomed when the focus moveds to anscol */791 if(myApp.val.os == 'Android' && myApp.val.browser == "Firefox"){792 myApp.elem.ansCol.style.width = myApp.val.playerWidth*0.98+'px';793 }else{794 myApp.elem.ansCol.style.width = myApp.val.playerWidth*0.9+'px';795 }796 }else{797 const tmpPlayerHeight = document.documentElement.clientHeight/2;798 const tmpPlayerWidth = tmpPlayerHeight/9*16;799 if(tmpPlayerWidth < document.documentElement.clientWidth){800 myApp.val.playerHeight = tmpPlayerHeight;801 myApp.val.playerWidth = tmpPlayerWidth;802 }else{803 myApp.val.playerWidth = document.documentElement.clientWidth;804 myApp.val.playerHeight = myApp.val.playerWidth/16*9;805 }806 }807 if(myApp.val.initLoadBool == false || myApp.val.prevPlayerWidth != myApp.val.playerWidth){808 player.setSize(myApp.val.playerWidth, myApp.val.playerHeight);809 //810 myApp.val.prevPlayerWidth = myApp.val.playerWidth;811 myApp.val.prevPlayerHeight = myApp.val.playerHeight;812 }813}814//815function resizePushButton(){816 if(myApp.val.os != "other"){817 if(Math.abs(window.orientation) != 90){818 const tmpImgHeight = document.documentElement.clientHeight-myApp.val.playerHeight-myApp.val.elemHeight-20;819 const tmpImgWidth = myApp.elem.pushBtn.naturalWidth*tmpImgHeight/myApp.elem.pushBtn.naturalHeight;820 if(tmpImgWidth < document.documentElement.clientWidth){821 if(tmpImgHeight <= myApp.val.playerHeight){822 myApp.val.pushBtnWidth = tmpImgWidth;823 myApp.val.pushBtnHeight = tmpImgHeight;824 }else{825 myApp.val.pushBtnWidth = myApp.elem.pushBtn.naturalWidth*myApp.val.playerHeight*1.25/myApp.elem.pushBtn.naturalHeight;826 myApp.val.pushBtnHeight = myApp.val.playerHeight*1.25;827 }828 }else{829 myApp.val.pushBtnWidth = document.documentElement.clientWidth/5;830 myApp.val.pushBtnHeight = myApp.elem.pushBtn.naturalHeight*myApp.val.pushBtnWidth/myApp.elem.pushBtn.naturalWidth;831 }832 }else{833 myApp.val.pushBtnWidth = document.documentElement.clientWidth/5;834 myApp.val.pushBtnHeight = myApp.elem.pushBtn.naturalHeight*myApp.val.pushBtnWidth/myApp.elem.pushBtn.naturalWidth;835 }836 myApp.elem.pushBtn.style.margin = 'auto '+(document.documentElement.clientWidth-myApp.val.pushBtnWidth)/2+'px';837 }else{838 myApp.val.pushBtnWidth = myApp.val.divBtnWidth;839 myApp.val.pushBtnHeight = myApp.elem.pushBtn.naturalHeight*myApp.val.pushBtnWidth/myApp.elem.pushBtn.naturalWidth;840 } 841 if(myApp.val.initLoadBool == false || myApp.val.prevClientHeight != document.documentElement.clientHeight){842 myApp.elem.pushBtn.width = myApp.val.pushBtnWidth;843 myApp.elem.pushBtn.height = myApp.val.pushBtnHeight;844 updatePushButtonArea();845 //846 myApp.val.prevClientWidth = document.documentElement.clientWidth;847 myApp.val.prevClientHeight = document.documentElement.clientHeight;848 }849}850//851function updatePushButtonArea(){852 myApp.val.pushBtnArea.left = myApp.elem.pushBtn.getBoundingClientRect().left;853 myApp.val.pushBtnArea.right = myApp.elem.pushBtn.getBoundingClientRect().right;854 myApp.val.pushBtnArea.top = myApp.elem.pushBtn.getBoundingClientRect().top;855 myApp.val.pushBtnArea.bottom = myApp.elem.pushBtn.getBoundingClientRect().bottom;856 //857 /* In iOS, value of getBoundingClientRect is changed when the window is zoomed */858 if(myApp.val.os == 'iOS'){859 myApp.val.pushBtnArea.left += window.pageXOffset;860 myApp.val.pushBtnArea.right += window.pageXOffset;861 myApp.val.pushBtnArea.top += window.pageYOffset;862 myApp.val.pushBtnArea.bottom += window.pageYOffset;863 }864}865//866function instantFocusToElement(focusUsableElement){867 /* keydown event is ready during the focus is in a js element */868 focusUsableElement.disabled = false;869 focusUsableElement.focus();870 focusUsableElement.blur();871 focusUsableElement.disabled = true;872}873//874function updateWatchedTime(currentPlayingTime, watchedTime){875 if(0.0 < currentPlayingTime - watchedTime && currentPlayingTime - watchedTime < 1.0){876 watchedTime = currentPlayingTime;877 }878 return watchedTime;879}880//881function playSndPushBtn(){882 if(myApp.elem.sounds.currentTime != myApp.val.audioSpriteData.pushBtn.start){883 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.pushBtn.start;884 }885 myApp.elem.sounds.play();886}887//888function playSndO(){889 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.sndO.start;890 myApp.elem.sounds.play();891}892//893function playSndX(){894 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.sndX.start;895 myApp.elem.sounds.play();896}897//898function hidePlayer(){899 player.setSize(myApp.val.playerWidth, 0);900}901//902function opposePlayer(){903 player.setSize(myApp.val.playerWidth, myApp.val.playerHeight);904}905//906function buttonCheck(responseInterval){907 playSndPushBtn();908 if(myApp.val.os == 'iOS'){909 myApp.elem.pushBtn.src = myApp.elem.imgBtn3.src;910 }else{911 myApp.elem.pushBtn.src = myApp.elem.imgBtn2.src;912 setTimeout(function(){ myApp.elem.pushBtn.src = myApp.elem.imgBtn3.src; }, 100);913 }914 setTimeout(function(){915 playSndO();916 myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src;917 }, responseInterval);918}919//920function pushButton(){921 // hide player during answer.922 if(myApp.val.os != 'other'){923 if(myApp.val.hidePlayerBool.phone == true){924 hidePlayer();925 }926 }else{927 if(myApp.val.hidePlayerBool.other == true){928 hidePlayer();929 }930 }931 playSndPushBtn();932 if(myApp.val.os == 'iOS'){933 myApp.elem.pushBtn.src = myApp.elem.imgBtn3.src;934 if(myApp.val.browser == 'Chrome' || myApp.val.browser == 'Edge' || myApp.val.browser == 'Smooz'){935 setTimeout(function(){ focusToAnsCol(); }, 500); // In above browsers, focus() doesn't work by the script below.936 }else{937 focusToAnsCol(); // In iOS, focus() doesn't work properly in setTimeout (keyboard doesn't appear).938 }939 }else{940 myApp.elem.pushBtn.src = myApp.elem.imgBtn2.src;941 setTimeout(function(){ myApp.elem.pushBtn.src = myApp.elem.imgBtn3.src; }, 100); 942 setTimeout(function(){ focusToAnsCol(); }, 500);943 }944 myApp.val.cntPush = myApp.val.cntPush+1;945}946//947function focusToAnsCol(){948 myApp.elem.ansBtn.disabled = false;949 myApp.elem.ansCol.disabled = false;950 myApp.elem.ansCol.value = "";951 myApp.elem.ansCol.focus();952}953//954function checkAnswer(){955 myApp.val.correctBool = false;956 myApp.elem.ansCol.blur();957 myApp.elem.ansCol.disabled = true;958 myApp.elem.ansBtn.disabled = true;959 const answer = myApp.elem.ansCol.value;960 const length = myApp.val.ansArray[myApp.val.numQues-1].length;961 for(let i = 0; i < length; i++){962 if(answer.valueOf() === myApp.val.ansArray[myApp.val.numQues-1][i].valueOf()){963 myApp.val.correctBool = true;964 }965 }966 if(myApp.val.correctBool == true){967 playSndO();968 myApp.val.cntO += 1;969 myApp.elem.text.innerHTML = "正解!";970 if(myApp.val.jumpToAnsBool){ jumpToAnswerIndex(myApp.val.ansIndex, myApp.val.ansIndexStartTime); }971 }else{972 playSndX();973 myApp.val.cntX += 1;974 myApp.elem.text.innerHTML = "不正解!"; //あと"+(myApp.val.limPush-myApp.val.cntPush)+"回解答できます。";975 if(myApp.val.jumpToAnsBool){ jumpToAnswerIndex(myApp.val.ansIndex, myApp.val.ansIndexStartTime); }976 }977 myApp.elem.numOX.innerHTML = "⭕️:"+myApp.val.cntO+" ❌:"+myApp.val.cntX;978 if(window.orientation != 90){979 if(myApp.val.correctBool == false && myApp.val.limPush - myApp.val.cntPush == 0){980 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;981 }else{982 myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src;983 }984 }else{985 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;986 }987 // oppose player after answer.988 if(myApp.val.os != 'other'){989 if(myApp.val.hidePlayerBool.phone == true){990 opposePlayer();991 }992 }else{993 if(myApp.val.hidePlayerBool.other == true){994 opposePlayer();995 }996 }997}998//999function jumpToAnswerIndex(index, time){1000 myApp.val.cntIndex = index-1;1001 myApp.val.watchedTime = time-0.1;1002 player.seekTo(time-0.1);1003}1004//1005function printParams(){1006 // myApp.elem.paramText.innerHTML = "timePlay: " + myApp.val.currTime.playing.toFixed(3)+"<br>"+1007 // "timeStop: " +myApp.val.currTime.stopped.toFixed(3)+"<br>"+1008 // "WatchedTime: " + myApp.val.watchedTime.toFixed(3)+"<br>"+1009 // "diffTime: " + myApp.val.diffTime.toFixed(3);1010 // myApp.elem.paramText.innerHTML = myApp.val.browser;1011 // myApp.elem.paramText.innerHTML = myApp.val.os + ', ' + navigator.userAgent;1012 // myApp.elem.paramText.innerHTML = document.styleSheets.item(0).cssRules;1013 // myApp.elem.subText.innerHTML = "sounds.currentTime: " + Math.abs(Math.floor(myApp.elem.sounds.currentTime*1000)/1000);1014 // myApp.elem.subText.innerHTML = Math.floor(myApp.val.touchObject.pageX) +', '+ Math.floor(myApp.val.touchObject.pageY) +' '+1015 // '[' + Math.floor(myApp.val.pushBtnArea.left) +', '+ Math.floor(myApp.val.pushBtnArea.right) +'] '+1016 // '[' + Math.floor(myApp.val.pushBtnArea.top) +', '+ Math.floor(myApp.val.pushBtnArea.bottom)+'] '+1017 // '| '+ window.pageXOffset +', '+ window.pageYOffset;1018 // myApp.elem.subText.innerHTML = myApp.elem.numOX.getBoundingClientRect().top - myApp.elem.ansBtn.getBoundingClientRect().bottom;1019 // myApp.elem.subText.innerHTML = 'loadErrorBool: ' + myApp.val.loadErrorBool + ', initLoadBool: ' + myApp.val.initLoadBool + ', loadCount: ' + myApp.val.loadCount;1020 // myApp.elem.subText.innerHTML = 'playerWidth: ' + myApp.val.playerWidth + ', innerWidth: ' + window.innerWidth;1021 // myApp.elem.paramText.innerHTML = "<br>"+ 1022 // "device: " + myApp.val.os+"<br>"+1023 // "browser: " + myApp.val.browser+"<br>"+1024 // "activeElem: " + document.activeElement.id+"<br>"+ 1025 // "status: " + myApp.val.status+"<br>"+1026 // "timePlay: " + myApp.val.currTime.playing.toFixed(3)+"<br>"+1027 // "timeStop: " + myApp.val.currTime.stopped.toFixed(3)+"<br>"+1028 // "WatchedTime: " + myApp.val.watchedTime.toFixed(3)+"<br>"+1029 // "diffTime: " + myApp.val.diffTime.toFixed(3)+"<br>"+1030 // "limPush: " + myApp.val.limPush+"<br>"+ 1031 // "cntPush: " + myApp.val.cntPush+"<br>"+1032 // "remainingAnsTime: " + Math.floor((myApp.val.ansTime.limit-myApp.val.ansTime.elapsed)/1000)+"<br>"+1033 // "answer: " + myApp.val.ansArray[myApp.val.numQues-1][0].valueOf()+", "+1034 // myApp.val.ansArray[myApp.val.numQues-1][1].valueOf()+", "+1035 // myApp.val.ansArray[myApp.val.numQues-1][2].valueOf()+", "+1036 // myApp.val.ansArray[myApp.val.numQues-1][3].valueOf()+", "+1037 // myApp.val.ansArray[myApp.val.numQues-1][4].valueOf()+", "+1038 // myApp.val.ansArray[myApp.val.numQues-1][5].valueOf()+"<br>"+1039 // "numAnswer: " + myApp.val.ansArray.length+"<br>"+1040 // "answerLength: " + myApp.val.ansArray[myApp.val.numQues-1].length+"<br>"+1041 // "correctBool: " + myApp.val.correctBool+"<br>"+1042 // "composing: " + myApp.val.composingBool+"<br>"+1043 // "index: " + index+"<br>"+1044 // "cntIndex: " + myApp.val.cntIndex+"<br>"+1045 // "cssRules: " + document.styleSheets.item(0).cssRules.item(0).selectorText;1046}1047//1048//---------------------------------------------------------------------------------------------------------------1049/* set functions executed in each subtitle */1050myApp.val.jumpToAnsBool = true;1051myApp.val.disableSeekbarBool = false;1052myApp.val.hidePlayerBool.phone = true;1053myApp.val.hidePlayerBool.other = false;1054myApp.val.firstQuesStartTime = 19.22;1055myApp.val.srtFuncArray = [1056 function(){1057 myApp.val.viewFuncArray.shift()();1058 myApp.elem.ansBtn.innerHTML = "解答を送信";1059 /* 第1問 */1060 myApp.val.ansIndex = 2;1061 myApp.val.ansIndexStartTime = 30.26;1062 //1063 myApp.val.status = myApp.state.Question;1064 myApp.val.numQues = 1;1065 myApp.val.cntPush = 0;1066 myApp.val.correctBool = false;1067 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1068 myApp.elem.ansCol.value = "ここに解答を入力";1069 myApp.elem.ansCol.disabled = true;1070 myApp.elem.ansBtn.disabled = true;1071 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1072 },1073 function(){1074 myApp.val.status = myApp.state.Talk;1075 myApp.elem.ansCol.disabled = true;1076 myApp.elem.ansBtn.disabled = true;1077 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1078 },1079 function(){1080 /* 第2問 */1081 myApp.val.ansIndex = 4;1082 myApp.val.ansIndexStartTime = 46.69;1083 //1084 myApp.val.status = myApp.state.Question;1085 myApp.val.numQues = 2;1086 myApp.val.cntPush = 0;1087 myApp.val.correctBool = false;1088 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1089 myApp.elem.ansCol.value = "ここに解答を入力";1090 myApp.elem.ansCol.disabled = true;1091 myApp.elem.ansBtn.disabled = true;1092 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1093 },1094 function(){1095 myApp.val.status = myApp.state.Talk;1096 myApp.elem.ansCol.disabled = true;1097 myApp.elem.ansBtn.disabled = true;1098 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1099 },1100 function(){1101 /* 第3問 */1102 myApp.val.ansIndex = 6;1103 myApp.val.ansIndexStartTime = 61.83;1104 //1105 myApp.val.status = myApp.state.Question;1106 myApp.val.numQues = 3;1107 myApp.val.cntPush = 0;1108 myApp.val.correctBool = false;1109 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1110 myApp.elem.ansCol.value = "ここに解答を入力";1111 myApp.elem.ansCol.disabled = true;1112 myApp.elem.ansBtn.disabled = true;1113 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1114 },1115 function(){1116 myApp.val.status = myApp.state.Talk;1117 myApp.elem.ansCol.disabled = true;1118 myApp.elem.ansBtn.disabled = true;1119 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1120 },1121 function(){1122 /* 第4問 */1123 myApp.val.ansIndex = 8;1124 myApp.val.ansIndexStartTime = 77.83;1125 //1126 myApp.val.status = myApp.state.Question;1127 myApp.val.numQues = 4;1128 myApp.val.cntPush = 0;1129 myApp.val.correctBool = false;1130 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1131 myApp.elem.ansCol.value = "ここに解答を入力";1132 myApp.elem.ansCol.disabled = true;1133 myApp.elem.ansBtn.disabled = true;1134 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1135 },1136 function(){1137 myApp.val.status = myApp.state.Talk;1138 myApp.elem.ansCol.disabled = true;1139 myApp.elem.ansBtn.disabled = true;1140 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1141 },1142 function(){1143 /* 第5問 */1144 myApp.val.ansIndex = 10;1145 myApp.val.ansIndexStartTime = 93.07;1146 //1147 myApp.val.status = myApp.state.Question;1148 myApp.val.numQues = 5;1149 myApp.val.cntPush = 0;1150 myApp.val.correctBool = false;1151 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1152 myApp.elem.ansCol.value = "ここに解答を入力";1153 myApp.elem.ansCol.disabled = true;1154 myApp.elem.ansBtn.disabled = true;1155 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1156 },1157 function(){1158 myApp.val.status = myApp.state.Talk;1159 myApp.elem.ansCol.disabled = true;1160 myApp.elem.ansBtn.disabled = true;1161 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1162 },1163 function(){1164 /* 第6問 */1165 myApp.val.ansIndex = 12;1166 myApp.val.ansIndexStartTime = 104.11;1167 //1168 myApp.val.status = myApp.state.Question;1169 myApp.val.numQues = 6;1170 myApp.val.cntPush = 0;1171 myApp.val.correctBool = false;1172 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1173 myApp.elem.ansCol.value = "ここに解答を入力";1174 myApp.elem.ansCol.disabled = true;1175 myApp.elem.ansBtn.disabled = true;1176 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1177 },1178 function(){1179 myApp.val.status = myApp.state.Talk;1180 myApp.elem.ansCol.disabled = true;1181 myApp.elem.ansBtn.disabled = true;1182 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1183 },1184 function(){1185 /* 第7問 */1186 myApp.val.ansIndex = 14;1187 myApp.val.ansIndexStartTime = 120.2;1188 //1189 myApp.val.status = myApp.state.Question;1190 myApp.val.numQues = 7;1191 myApp.val.cntPush = 0;1192 myApp.val.correctBool = false;1193 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1194 myApp.elem.ansCol.value = "ここに解答を入力";1195 myApp.elem.ansCol.disabled = true;1196 myApp.elem.ansBtn.disabled = true;1197 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1198 },1199 function(){1200 myApp.val.status = myApp.state.Talk;1201 myApp.elem.ansCol.disabled = true;1202 myApp.elem.ansBtn.disabled = true;1203 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1204 },1205 function(){1206 /* 第8問 */1207 myApp.val.ansIndex = 16;1208 myApp.val.ansIndexStartTime = 136.73;1209 //1210 myApp.val.status = myApp.state.Question;1211 myApp.val.numQues = 8;1212 myApp.val.cntPush = 0;1213 myApp.val.correctBool = false;1214 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1215 myApp.elem.ansCol.value = "ここに解答を入力";1216 myApp.elem.ansCol.disabled = true;1217 myApp.elem.ansBtn.disabled = true;1218 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1219 },1220 function(){1221 myApp.val.status = myApp.state.Talk;1222 myApp.elem.ansCol.disabled = true;1223 myApp.elem.ansBtn.disabled = true;1224 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1225 },1226 function(){1227 /* 第9問 */1228 myApp.val.ansIndex = 18;1229 myApp.val.ansIndexStartTime = 152.22;1230 //1231 myApp.val.status = myApp.state.Question;1232 myApp.val.numQues = 9;1233 myApp.val.cntPush = 0;1234 myApp.val.correctBool = false;1235 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1236 myApp.elem.ansCol.value = "ここに解答を入力";1237 myApp.elem.ansCol.disabled = true;1238 myApp.elem.ansBtn.disabled = true;1239 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1240 },1241 function(){1242 myApp.val.status = myApp.state.Talk;1243 myApp.elem.ansCol.disabled = true;1244 myApp.elem.ansBtn.disabled = true;1245 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1246 },1247 function(){1248 /* 第10問 */1249 myApp.val.ansIndex = 20;1250 myApp.val.ansIndexStartTime = 166.8;1251 //1252 myApp.val.status = myApp.state.Question;1253 myApp.val.numQues = 10;1254 myApp.val.cntPush = 0;1255 myApp.val.correctBool = false;1256 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1257 myApp.elem.ansCol.value = "ここに解答を入力";1258 myApp.elem.ansCol.disabled = true;1259 myApp.elem.ansBtn.disabled = true;1260 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1261 },1262 function(){1263 myApp.val.status = myApp.state.Talk;1264 myApp.elem.ansCol.disabled = true;1265 myApp.elem.ansBtn.disabled = true;1266 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1267 },1268 function(){1269 /* 第11問 */1270 myApp.val.ansIndex = 22;1271 myApp.val.ansIndexStartTime = 180.54;1272 //1273 myApp.val.status = myApp.state.Question;1274 myApp.val.numQues = 11;1275 myApp.val.cntPush = 0;1276 myApp.val.correctBool = false;1277 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1278 myApp.elem.ansCol.value = "ここに解答を入力";1279 myApp.elem.ansCol.disabled = true;1280 myApp.elem.ansBtn.disabled = true;1281 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1282 },1283 function(){1284 myApp.val.status = myApp.state.Talk;1285 myApp.elem.ansCol.disabled = true;1286 myApp.elem.ansBtn.disabled = true;1287 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1288 },1289 function(){1290 /* 第12問 */1291 myApp.val.ansIndex = 24;1292 myApp.val.ansIndexStartTime = 195.26;1293 //1294 myApp.val.status = myApp.state.Question;1295 myApp.val.numQues = 12;1296 myApp.val.cntPush = 0;1297 myApp.val.correctBool = false;1298 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1299 myApp.elem.ansCol.value = "ここに解答を入力";1300 myApp.elem.ansCol.disabled = true;1301 myApp.elem.ansBtn.disabled = true;1302 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1303 },1304 function(){1305 myApp.val.status = myApp.state.Talk;1306 myApp.elem.ansCol.disabled = true;1307 myApp.elem.ansBtn.disabled = true;1308 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1309 },1310 function(){1311 /* 第13問 */1312 myApp.val.ansIndex = 26;1313 myApp.val.ansIndexStartTime = 211.41;1314 //1315 myApp.val.status = myApp.state.Question;1316 myApp.val.numQues = 13;1317 myApp.val.cntPush = 0;1318 myApp.val.correctBool = false;1319 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1320 myApp.elem.ansCol.value = "ここに解答を入力";1321 myApp.elem.ansCol.disabled = true;1322 myApp.elem.ansBtn.disabled = true;1323 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1324 },1325 function(){1326 myApp.val.status = myApp.state.Talk;1327 myApp.elem.ansCol.disabled = true;1328 myApp.elem.ansBtn.disabled = true;1329 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1330 },1331 function(){1332 /* 第14問 */1333 myApp.val.ansIndex = 28;1334 myApp.val.ansIndexStartTime = 226.77;1335 //1336 myApp.val.status = myApp.state.Question;1337 myApp.val.numQues = 14;1338 myApp.val.cntPush = 0;1339 myApp.val.correctBool = false;1340 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1341 myApp.elem.ansCol.value = "ここに解答を入力";1342 myApp.elem.ansCol.disabled = true;1343 myApp.elem.ansBtn.disabled = true;1344 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1345 },1346 function(){1347 myApp.val.status = myApp.state.Talk;1348 myApp.elem.ansCol.disabled = true;1349 myApp.elem.ansBtn.disabled = true;1350 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1351 },1352 function(){1353 /* 第15問 */1354 myApp.val.ansIndex = 30;1355 myApp.val.ansIndexStartTime = 241.76;1356 //1357 myApp.val.status = myApp.state.Question;1358 myApp.val.numQues = 15;1359 myApp.val.cntPush = 0;1360 myApp.val.correctBool = false;1361 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1362 myApp.elem.ansCol.value = "ここに解答を入力";1363 myApp.elem.ansCol.disabled = true;1364 myApp.elem.ansBtn.disabled = true;1365 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1366 },1367 function(){1368 myApp.val.status = myApp.state.Talk;1369 myApp.elem.ansCol.disabled = true;1370 myApp.elem.ansBtn.disabled = true;1371 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1372 },1373 function(){1374 /* 第16問 */1375 myApp.val.ansIndex = 32;1376 myApp.val.ansIndexStartTime = 257.99;1377 //1378 myApp.val.status = myApp.state.Question;1379 myApp.val.numQues = 16;1380 myApp.val.cntPush = 0;1381 myApp.val.correctBool = false;1382 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1383 myApp.elem.ansCol.value = "ここに解答を入力";1384 myApp.elem.ansCol.disabled = true;1385 myApp.elem.ansBtn.disabled = true;1386 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1387 },1388 function(){1389 myApp.val.status = myApp.state.Talk;1390 myApp.elem.ansCol.disabled = true;1391 myApp.elem.ansBtn.disabled = true;1392 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1393 },1394 function(){1395 /* 第17問 */1396 myApp.val.ansIndex = 34;1397 myApp.val.ansIndexStartTime = 274.94;1398 //1399 myApp.val.status = myApp.state.Question;1400 myApp.val.numQues = 17;1401 myApp.val.cntPush = 0;1402 myApp.val.correctBool = false;1403 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1404 myApp.elem.ansCol.value = "ここに解答を入力";1405 myApp.elem.ansCol.disabled = true;1406 myApp.elem.ansBtn.disabled = true;1407 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1408 },1409 function(){1410 myApp.val.status = myApp.state.Talk;1411 myApp.elem.ansCol.disabled = true;1412 myApp.elem.ansBtn.disabled = true;1413 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1414 },1415 function(){1416 /* 第18問 */1417 myApp.val.ansIndex = 36;1418 myApp.val.ansIndexStartTime = 290.35;1419 //1420 myApp.val.status = myApp.state.Question;1421 myApp.val.numQues = 18;1422 myApp.val.cntPush = 0;1423 myApp.val.correctBool = false;1424 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1425 myApp.elem.ansCol.value = "ここに解答を入力";1426 myApp.elem.ansCol.disabled = true;1427 myApp.elem.ansBtn.disabled = true;1428 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1429 },1430 function(){1431 myApp.val.status = myApp.state.Talk;1432 myApp.elem.ansCol.disabled = true;1433 myApp.elem.ansBtn.disabled = true;1434 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1435 },1436 function(){1437 /* 第19問 */1438 myApp.val.ansIndex = 38;1439 myApp.val.ansIndexStartTime = 302.48;1440 //1441 myApp.val.status = myApp.state.Question;1442 myApp.val.numQues = 19;1443 myApp.val.cntPush = 0;1444 myApp.val.correctBool = false;1445 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1446 myApp.elem.ansCol.value = "ここに解答を入力";1447 myApp.elem.ansCol.disabled = true;1448 myApp.elem.ansBtn.disabled = true;1449 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1450 },1451 function(){1452 myApp.val.status = myApp.state.Talk;1453 myApp.elem.ansCol.disabled = true;1454 myApp.elem.ansBtn.disabled = true;1455 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1456 },1457 function(){1458 /* 第20問 */1459 myApp.val.ansIndex = 40;1460 myApp.val.ansIndexStartTime = 317.07;1461 //1462 myApp.val.status = myApp.state.Question;1463 myApp.val.numQues = 20;1464 myApp.val.cntPush = 0;1465 myApp.val.correctBool = false;1466 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1467 myApp.elem.ansCol.value = "ここに解答を入力";1468 myApp.elem.ansCol.disabled = true;1469 myApp.elem.ansBtn.disabled = true;1470 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1471 },1472 function(){1473 myApp.val.status = myApp.state.Talk;1474 myApp.elem.ansCol.disabled = true;1475 myApp.elem.ansBtn.disabled = true;1476 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1477 },1478 function(){1479 /* 第21問 */1480 myApp.val.ansIndex = 42;1481 myApp.val.ansIndexStartTime = 333.88;1482 //1483 myApp.val.status = myApp.state.Question;1484 myApp.val.numQues = 21;1485 myApp.val.cntPush = 0;1486 myApp.val.correctBool = false;1487 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1488 myApp.elem.ansCol.value = "ここに解答を入力";1489 myApp.elem.ansCol.disabled = true;1490 myApp.elem.ansBtn.disabled = true;1491 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1492 },1493 function(){1494 myApp.val.status = myApp.state.Talk;1495 myApp.elem.ansCol.disabled = true;1496 myApp.elem.ansBtn.disabled = true;1497 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1498 },1499 function(){1500 /* 第22問 */1501 myApp.val.ansIndex = 44;1502 myApp.val.ansIndexStartTime = 349.54;1503 //1504 myApp.val.status = myApp.state.Question;1505 myApp.val.numQues = 22;1506 myApp.val.cntPush = 0;1507 myApp.val.correctBool = false;1508 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1509 myApp.elem.ansCol.value = "ここに解答を入力";1510 myApp.elem.ansCol.disabled = true;1511 myApp.elem.ansBtn.disabled = true;1512 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1513 },1514 function(){1515 myApp.val.status = myApp.state.Talk;1516 myApp.elem.ansCol.disabled = true;1517 myApp.elem.ansBtn.disabled = true;1518 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1519 },1520 function(){1521 /* 第23問 */1522 myApp.val.ansIndex = 46;1523 myApp.val.ansIndexStartTime = 365.93;1524 //1525 myApp.val.status = myApp.state.Question;1526 myApp.val.numQues = 23;1527 myApp.val.cntPush = 0;1528 myApp.val.correctBool = false;1529 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1530 myApp.elem.ansCol.value = "ここに解答を入力";1531 myApp.elem.ansCol.disabled = true;1532 myApp.elem.ansBtn.disabled = true;1533 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1534 },1535 function(){1536 myApp.val.status = myApp.state.Talk;1537 myApp.elem.ansCol.disabled = true;1538 myApp.elem.ansBtn.disabled = true;1539 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1540 },1541 function(){1542 /* 第24問 */1543 myApp.val.ansIndex = 48;1544 myApp.val.ansIndexStartTime = 381.07;1545 //1546 myApp.val.status = myApp.state.Question;1547 myApp.val.numQues = 24;1548 myApp.val.cntPush = 0;1549 myApp.val.correctBool = false;1550 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1551 myApp.elem.ansCol.value = "ここに解答を入力";1552 myApp.elem.ansCol.disabled = true;1553 myApp.elem.ansBtn.disabled = true;1554 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1555 },1556 function(){1557 myApp.val.status = myApp.state.Talk;1558 myApp.elem.ansCol.disabled = true;1559 myApp.elem.ansBtn.disabled = true;1560 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1561 },1562 function(){1563 /* 第25問 */1564 myApp.val.ansIndex = 50;1565 myApp.val.ansIndexStartTime = 394.07;1566 //1567 myApp.val.status = myApp.state.Question;1568 myApp.val.numQues = 25;1569 myApp.val.cntPush = 0;1570 myApp.val.correctBool = false;1571 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1572 myApp.elem.ansCol.value = "ここに解答を入力";1573 myApp.elem.ansCol.disabled = true;1574 myApp.elem.ansBtn.disabled = true;1575 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1576 },1577 function(){1578 myApp.val.status = myApp.state.Talk;1579 myApp.elem.ansCol.disabled = true;1580 myApp.elem.ansBtn.disabled = true;1581 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1582 },1583 function(){1584 /* 第26問 */1585 myApp.val.ansIndex = 52;1586 myApp.val.ansIndexStartTime = 408.43;1587 //1588 myApp.val.status = myApp.state.Question;1589 myApp.val.numQues = 26;1590 myApp.val.cntPush = 0;1591 myApp.val.correctBool = false;1592 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1593 myApp.elem.ansCol.value = "ここに解答を入力";1594 myApp.elem.ansCol.disabled = true;1595 myApp.elem.ansBtn.disabled = true;1596 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1597 },1598 function(){1599 myApp.val.status = myApp.state.Talk;1600 myApp.elem.ansCol.disabled = true;1601 myApp.elem.ansBtn.disabled = true;1602 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1603 },1604 function(){1605 /* 第27問 */1606 myApp.val.ansIndex = 54;1607 myApp.val.ansIndexStartTime = 424.86;1608 //1609 myApp.val.status = myApp.state.Question;1610 myApp.val.numQues = 27;1611 myApp.val.cntPush = 0;1612 myApp.val.correctBool = false;1613 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1614 myApp.elem.ansCol.value = "ここに解答を入力";1615 myApp.elem.ansCol.disabled = true;1616 myApp.elem.ansBtn.disabled = true;1617 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1618 },1619 function(){1620 myApp.val.status = myApp.state.Talk;1621 myApp.elem.ansCol.disabled = true;1622 myApp.elem.ansBtn.disabled = true;1623 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1624 },1625 function(){1626 /* 第28問 */1627 myApp.val.ansIndex = 56;1628 myApp.val.ansIndexStartTime = 437.53;1629 //1630 myApp.val.status = myApp.state.Question;1631 myApp.val.numQues = 28;1632 myApp.val.cntPush = 0;1633 myApp.val.correctBool = false;1634 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1635 myApp.elem.ansCol.value = "ここに解答を入力";1636 myApp.elem.ansCol.disabled = true;1637 myApp.elem.ansBtn.disabled = true;1638 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1639 },1640 function(){1641 myApp.val.status = myApp.state.Talk;1642 myApp.elem.ansCol.disabled = true;1643 myApp.elem.ansBtn.disabled = true;1644 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1645 },1646 function(){1647 /* 第29問 */1648 myApp.val.ansIndex = 58;1649 myApp.val.ansIndexStartTime = 453.19;1650 //1651 myApp.val.status = myApp.state.Question;1652 myApp.val.numQues = 29;1653 myApp.val.cntPush = 0;1654 myApp.val.correctBool = false;1655 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1656 myApp.elem.ansCol.value = "ここに解答を入力";1657 myApp.elem.ansCol.disabled = true;1658 myApp.elem.ansBtn.disabled = true;1659 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1660 },1661 function(){1662 myApp.val.status = myApp.state.Talk;1663 myApp.elem.ansCol.disabled = true;1664 myApp.elem.ansBtn.disabled = true;1665 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1666 },1667 function(){1668 /* 第30問 */1669 myApp.val.ansIndex = 60;1670 myApp.val.ansIndexStartTime = 468.93;1671 //1672 myApp.val.status = myApp.state.Question;1673 myApp.val.numQues = 30;1674 myApp.val.cntPush = 0;1675 myApp.val.correctBool = false;1676 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1677 myApp.elem.ansCol.value = "ここに解答を入力";1678 myApp.elem.ansCol.disabled = true;1679 myApp.elem.ansBtn.disabled = true;1680 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1681 },1682 function(){1683 myApp.val.status = myApp.state.Talk;1684 myApp.elem.ansCol.disabled = true;1685 myApp.elem.ansBtn.disabled = true;1686 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1687 },1688];16891169000:00:19,220 --> 00:00:30,26016912169200:00:30,260 --> 00:00:33,44016933169400:00:33,440 --> 00:00:46,69016954169600:00:46,690 --> 00:00:49,66016975169800:00:49,660 --> 00:01:01,83016996170000:01:01,830 --> 00:01:05,74017017170200:01:05,740 --> 00:01:17,83017038170400:01:17,830 --> 00:01:20,78017059170600:01:20,780 --> 00:01:33,070170710170800:01:33,070 --> 00:01:36,200170911171000:01:36,200 --> 00:01:44,110171112171200:01:44,110 --> 00:01:47,400171313171400:01:47,400 --> 00:02:00,200171514171600:02:00,200 --> 00:02:03,770171715171800:02:03,770 --> 00:02:16,730171916172000:02:16,730 --> 00:02:21,210172117172200:02:21,210 --> 00:02:32,220172318172400:02:32,220 --> 00:02:35,370172519172600:02:35,370 --> 00:02:46,800172720172800:02:46,800 --> 00:02:50,380172921173000:02:50,380 --> 00:03:00,540173122173200:03:00,540 --> 00:03:04,260173323173400:03:04,260 --> 00:03:15,260173524173600:03:15,260 --> 00:03:18,590173725173800:03:18,590 --> 00:03:31,410173926174000:03:31,410 --> 00:03:34,350174127174200:03:34,350 --> 00:03:46,770174328174400:03:46,770 --> 00:03:50,870174529174600:03:50,870 --> 00:04:01,760174730174800:04:01,760 --> 00:04:05,000174931175000:04:05,000 --> 00:04:17,990175132175200:04:17,990 --> 00:04:21,420175333175400:04:21,420 --> 00:04:34,940175534175600:04:34,940 --> 00:04:39,260175735175800:04:39,260 --> 00:04:50,350175936176000:04:50,350 --> 00:04:53,800176137176200:04:53,800 --> 00:05:02,480176338176400:05:02,480 --> 00:05:05,480176539176600:05:05,480 --> 00:05:17,070176740176800:05:17,070 --> 00:05:20,480176941177000:05:20,480 --> 00:05:33,880177142177200:05:33,880 --> 00:05:37,350177343177400:05:37,350 --> 00:05:49,540177544177600:05:49,540 --> 00:05:53,840177745177800:05:53,840 --> 00:06:05,930177946178000:06:05,930 --> 00:06:08,870178147178200:06:08,870 --> 00:06:21,070178348178400:06:21,070 --> 00:06:24,450178549178600:06:24,450 --> 00:06:34,070178750178800:06:34,070 --> 00:06:37,080178951179000:06:37,080 --> 00:06:48,430179152179200:06:48,430 --> 00:06:52,010179353179400:06:52,010 --> 00:07:04,860179554179600:07:04,860 --> 00:07:07,780179755179800:07:07,780 --> 00:07:17,530179956180000:07:17,530 --> 00:07:20,170180157180200:07:20,170 --> 00:07:33,190180358180400:07:33,190 --> 00:07:36,930180559180600:07:36,930 --> 00:07:48,930180760...

Full Screen

Full Screen

content-3.srt.js

Source:content-3.srt.js Github

copy

Full Screen

100:00:00,000 --> 00:00:16,2402/* CAUTION : Each sections of subtitle has independent scope. */3/* Ver1.0 */4doOnce[index] = true;5player.pauseVideo();6//7const myApp = {8 path : {9 answer : "https://raw.githubusercontent.com/t-yokota/quizBattle/master/contents/lamy_abc_12th/answer-1.csv",10 sound : "https://raw.githubusercontent.com/t-yokota/quizBattle/master/sounds/sounds_3", //+ext;11 btn1 : "https://github.com/t-yokota/quizBattle/raw/master/images/button_1.png",12 btn2 : "https://github.com/t-yokota/quizBattle/raw/master/images/button_2.png",13 btn3 : "https://github.com/t-yokota/quizBattle/raw/master/images/button_3.png",14 btn4 : "https://github.com/t-yokota/quizBattle/raw/master/images/button_4.png",15 },16 state : {17 ButtonCheck : 0, //ボタンチェック待機18 Question : 1, //問い読み中(早押し可能)19 MyAnswer : 2, //自分が解答権を所持(解答入力・送信可能)20 OthAnswer : 3, //他者が解答権を所持(早押し不可能)21 Talk : 4, //その他22 },23 videoState : {24 Playing : 1,25 Stopped : 2,26 },27 elem : {28 text : document.createElement("text"),29 subText : document.createElement("text"),30 ansCol : document.createElement("textarea"),31 ansBtn : document.createElement("button"),32 numOX : document.createElement("text"),33 pushBtn : document.createElement("img"),34 imgBtn1 : document.createElement("img"),35 imgBtn2 : document.createElement("img"),36 imgBtn3 : document.createElement("img"),37 imgBtn4 : document.createElement("img"),38 sounds : document.createElement("audio"),39 paramText : document.createElement("text"),40 //41 divUI : document.createElement('div'),42 divElem : document.createElement('div'),43 divBtn : document.createElement('div'),44 },45 val : {46 srtFuncArray : null, //array of functions that are executed in each subtitle47 viewFuncArray : null, //array of functions for setting view elements48 //49 os : null,50 browser : null,51 //52 touchObject : null,53 //54 audioExt : null,55 audioSpriteData : null,56 //57 loadCount : 0,58 initLoadBool : false,59 loadErrorBool : false,60 loadAlertBool : false,61 //62 initOrientation : null,63 orientationAlertBool : false,64 //65 playingCount : 0,66 pageHiddenBool : false,67 processDelayAlertBool : false,68 //69 composingBool : false,70 //71 disableSeekbarBool : false,72 //73 playerWidth : 0,74 playerHeight : 0,75 pushBtnWidth : 0,76 pushBtnHeight : 0,77 //78 prevPlayerWidth : 0,79 prevPlayerHeight : 0,80 prevClientWidth : 0,81 prevClientHeight : 0,82 //83 elemHeight : 0,84 //85 pushBtnArea : {86 left : 0,87 right : 0,88 top : 0,89 bottom : 0,90 },91 //92 divUIHeight : 0,93 divUIWidth : 0,94 divElemWidth : 0,95 divBtnWidth : 0,96 //97 hidePlayerBool : {98 phone : false,99 other : false,100 },101 //102 /* keycode (for keyboard) */103 space : 32, //push buttion104 enter : 13,105 //106 /* button check param */107 btnCheck : {108 sndInterval : 1500, //[ms]109 playInterval : 3000, //[ms]110 },111 //112 /* for question manegament */113 numQues : 1, //問題番号114 ansArray : [], //正答リスト115 cntO : 0, //正答数116 cntX : 0, //誤答数117 cntPush : 0, //1問あたりの解答回数118 limPush : 1, //1問あたりの上限解答回数119 correctBool : false, //答え合わせ結果(結果に応じて状態遷移)120 ansFile : new XMLHttpRequest(), //正答ファイル.csv121 //122 /* for status management */123 status : null,124 cntIndex : 0, //(index value has current section of subtitle)125 //126 /* for time management */127 ansTime : {128 limit : 20000, //解答制限時間[ms]129 elapsed : 0, //解答経過時間[ms]130 },131 currTime : {132 playing : 0, //be updated during the video is playing133 stopped : 0, //be updated when the video is stopped134 },135 watchedTime : 0, //136 diffTime : 0, //difference between watchedTime and currentTime (for preventing to jump playback position by seekbar)137 //138 ansIndex: 0,139 ansIndexStartTime : 0,140 jumpToAnsBool: false,141 //142 firstQuesStartTime : 0,143 },144};145//146/* get os type */147myApp.val.os = fetchOSType();148myApp.val.browser = fetchBrowserType();149//150/* set id to the elements */151myApp.elem.ansCol.id = 'anscol';152myApp.elem.ansBtn.id = 'ansbtn';153myApp.elem.pushBtn.id = 'pushbtn';154myApp.elem.divUI.id = 'divui';155myApp.elem.divElem.id = 'divelem';156myApp.elem.divBtn.id = 'divbtn';157//158/* set init value to the elements */159myApp.elem.ansCol.value = "ここに解答を入力";160myApp.elem.ansBtn.innerHTML = "1問目まで移動";161myApp.elem.ansCol.disabled = true;162myApp.elem.ansBtn.disabled = true;163myApp.elem.numOX.innerHTML = "⭕️:"+myApp.val.cntO+" ❌:"+myApp.val.cntX;164//165if(myApp.val.os != 'other'){166 myApp.elem.text.innerHTML = "早押しボタンをタップして動画を開始する";167}else{168 myApp.elem.text.innerHTML = "QuizBattle on YouTube";169 /* set tabindex for adding focus */170 myApp.elem.pushBtn.tabIndex = 0;171}172//173/* set initial state (button check) */174myApp.val.status = myApp.state.ButtonCheck;175//176/* VIEW */177resizePlayer();178//179/* set style sheets */180document.styleSheets.item(0).insertRule('html { touch-action: manipulation; }'); //disable double tap gesture181document.styleSheets.item(0).insertRule('body { text-align: center; margin: auto; background: #EFEFEF; }');182document.styleSheets.item(0).insertRule('.blinkImg { animation: blinkImg 0.7s infinite alternate; }');183document.styleSheets.item(0).insertRule('@keyframes blinkImg{ 0% { opacity: 0.3; } 100% { opacity: 1; }}');184document.styleSheets.item(0).insertRule('.blinkText { animation: blinkText 0.7s infinite alternate; }');185document.styleSheets.item(0).insertRule('@keyframes blinkText{ 0% { opacity: 0; } 100% { opacity: 1; }}');186//187/* set elements */188if(myApp.val.os != 'other'){189 myApp.elem.text.style.fontSize = '42px';190 myApp.elem.text.style.lineHeight = '60px';191 myApp.elem.text.style.fontWeight = 'bold';192 myApp.elem.text.style.display = 'block';193 myApp.elem.text.style.marginTop = '32px';194 myApp.elem.text.style.marginBottom = '32px';195 myApp.elem.text.style.padding = '0px 10px';196 myApp.elem.subText.style.fontSize = '42px';197 myApp.elem.subText.style.lineHeight = '60px';198 myApp.elem.subText.style.display = 'block';199 myApp.elem.ansCol.style.fontSize = '50px';200 myApp.elem.ansCol.style.height = '100px';201 myApp.elem.ansCol.style.textAlign = 'center';202 myApp.elem.ansCol.style.marginBottom = '10px';203 myApp.elem.ansCol.style.marginLeft = 'auto';204 myApp.elem.ansCol.style.marginRight = 'auto';205 myApp.elem.ansCol.style.display = 'block'206 myApp.elem.ansBtn.style.fontSize = '42px';207 myApp.elem.ansBtn.style.width = parseInt(myApp.elem.ansBtn.style.fontSize, 10)*10+'px';208 myApp.elem.ansBtn.style.height = parseInt(myApp.elem.ansBtn.style.fontSize, 10)*2+'px';209 myApp.elem.ansBtn.style.marginBottom = '20px';210 myApp.elem.ansBtn.style.marginLeft = 'auto';211 myApp.elem.ansBtn.style.marginRight = 'auto';212 myApp.elem.ansBtn.style.display = 'block';213 myApp.elem.numOX.style.fontSize = '42px';214 myApp.elem.numOX.style.lineHeight = '80px';215 myApp.elem.numOX.style.fontWeight = 'bold';216 myApp.elem.numOX.style.display = 'block';217 //218 myApp.val.elemHeight = (function(e){219 let res = 0;220 res += parseInt(e.text.style.lineHeight, 10);221 res += parseInt(e.text.style.marginTop, 10);222 res += parseInt(e.text.style.marginBottom, 10);223 res += parseInt(e.ansCol.style.height, 10);224 res += parseInt(e.ansCol.style.marginBottom, 10);225 res += parseInt(e.ansBtn.style.height, 10);226 res += parseInt(e.ansBtn.style.marginBottom, 10);227 res += parseInt(e.numOX.style.lineHeight, 10);228 return res229 })(myApp.elem);230 //231 myApp.val.viewFuncArray = [232 function(){233 document.getElementsByTagName("body")[0].appendChild(myApp.elem.text);234 document.getElementsByTagName("body")[0].appendChild(myApp.elem.ansBtn);235 document.getElementsByTagName("body")[0].appendChild(myApp.elem.pushBtn);236 document.getElementsByTagName("body")[0].appendChild(myApp.elem.numOX);237 document.getElementsByTagName("body")[0].appendChild(myApp.elem.paramText);238 },239 function(){240 myApp.elem.text.style.marginTop = '40px';241 myApp.elem.text.style.marginBottom = '20px';242 myApp.elem.subText.style.marginBottom = '40px';243 myApp.elem.subText.style.padding = '0px 10px';244 document.getElementsByTagName("body")[0].insertBefore(myApp.elem.subText, myApp.elem.text.nextSibling);245 },246 function(){247 myApp.elem.text.style.marginTop = '32px';248 myApp.elem.text.style.marginBottom = '32px';249 myApp.elem.text.parentNode.removeChild(myApp.elem.subText);250 document.getElementsByTagName("body")[0].insertBefore(myApp.elem.ansCol, myApp.elem.text.nextSibling);251 },252 ];253 myApp.val.viewFuncArray.shift()();254}else{255 myApp.val.divUIHeight = myApp.val.playerHeight*0.9;256 myApp.val.divUIWidth = myApp.val.playerWidth;257 myApp.val.divElemWidth = myApp.val.playerWidth*2/3;258 myApp.val.divBtnWidth = myApp.val.playerWidth*1/3;259 document.styleSheets.item(0).insertRule('body { width:'+myApp.val.playerWidth+'px; }');260 document.styleSheets.item(0).insertRule('div#divui { width:'+myApp.val.divUIWidth +'px; height:'+myApp.val.divUIHeight+'px; }');261 document.styleSheets.item(0).insertRule('div#divelem { width:'+myApp.val.divElemWidth+'px; height:'+myApp.val.divUIHeight+'px; float: left; display: flex; align-items: center; justify-content: center; flex-direction: column; }');262 document.styleSheets.item(0).insertRule('div#divbtn { width:'+myApp.val.divBtnWidth +'px; height:'+myApp.val.divUIHeight+'px; float: left; display: flex; align-items: center; justify-content: center; }');263 document.getElementsByTagName("body")[0].appendChild(myApp.elem.divUI);264 myApp.elem.divUI.appendChild(myApp.elem.divElem); //divElem is assigned to ('div')[4]265 myApp.elem.divUI.appendChild(myApp.elem.divBtn); //divBtn is assigned to ('div')[5]266 //267 myApp.elem.text.style.fontSize = '25px';268 myApp.elem.text.style.lineHeight = '45px';269 myApp.elem.text.style.fontWeight = 'bold';270 myApp.elem.text.style.display = 'block';271 myApp.elem.subText.style.fontSize = '20px';272 myApp.elem.subText.style.lineHeight = '30px';273 myApp.elem.subText.style.display = 'block';274 myApp.elem.ansCol.style.fontSize = '23px';275 myApp.elem.ansCol.style.textAlign = 'center';276 myApp.elem.ansCol.style.width = myApp.val.divElemWidth*0.75+'px';277 myApp.elem.ansCol.style.margin = '0px ' +(myApp.val.divElemWidth-parseInt(myApp.elem.ansCol.style.width, 10))/2+'px 15px';278 myApp.elem.ansBtn.style.fontSize = '23px';279 myApp.elem.ansBtn.style.width = parseInt(myApp.elem.ansBtn.style.fontSize, 10)*8+'px';280 myApp.elem.ansBtn.style.margin = '0px '+(myApp.val.divElemWidth-parseInt(myApp.elem.ansBtn.style.width, 10))/2+'px 20px';281 myApp.elem.numOX.style.fontSize = '25px';282 myApp.elem.numOX.style.lineHeight = '45px';283 myApp.elem.numOX.style.fontWeight = 'bold';284 myApp.elem.numOX.style.display = 'block';285 //286 myApp.val.viewFuncArray = [287 function(){288 myApp.elem.text.style.margin = '0px auto';289 myApp.elem.text.style.padding = '0px 40px';290 document.getElementsByTagName("div")[4].appendChild(myApp.elem.text);291 document.getElementsByTagName("div")[4].appendChild(myApp.elem.paramText);292 },293 function(){294 myApp.elem.text.style.margin = '0px auto 30px';295 myApp.elem.subText.style.margin = '0px auto 50px';296 myApp.elem.subText.style.padding = '0px 40px';297 document.getElementsByTagName("div")[4].insertBefore(myApp.elem.subText, myApp.elem.text.nextSibling);298 document.getElementsByTagName("div")[5].appendChild(myApp.elem.pushBtn);299 },300 function(){301 document.getElementsByTagName("div")[4].insertBefore(myApp.elem.ansBtn, myApp.elem.subText.nextSibling);302 },303 function(){304 myApp.elem.text.style.margin = '0px auto 15px';305 myApp.elem.text.parentNode.removeChild(myApp.elem.subText);306 document.getElementsByTagName("div")[4].insertBefore(myApp.elem.ansCol, myApp.elem.text.nextSibling);307 document.getElementsByTagName("div")[4].appendChild(myApp.elem.numOX);308 },309 ];310 myApp.val.viewFuncArray.shift()();311}312//313const num_of_materials = 6;314myApp.elem.sounds.onloadedmetadata = function(){ myApp.val.loadCount += 1; };315myApp.elem.imgBtn1.onload = function(){ myApp.val.loadCount += 1; };316myApp.elem.imgBtn2.onload = function(){ myApp.val.loadCount += 1; };317myApp.elem.imgBtn3.onload = function(){ myApp.val.loadCount += 1; };318myApp.elem.imgBtn4.onload = function(){ myApp.val.loadCount += 1; };319myApp.val.ansFile.onload = function(){ myApp.val.loadCount += 1; myApp.val.ansArray = CSVtoArray(myApp.val.ansFile.responseText); };320//321myApp.elem.sounds.onerror = function(){ myApp.val.loadErrorBool = true; };322myApp.elem.imgBtn1.onerror = function(){ myApp.val.loadErrorBool = true; };323myApp.elem.imgBtn2.onerror = function(){ myApp.val.loadErrorBool = true; };324myApp.elem.imgBtn3.onerror = function(){ myApp.val.loadErrorBool = true; };325myApp.elem.imgBtn4.onerror = function(){ myApp.val.loadErrorBool = true; };326myApp.val.ansFile.onerror = function(){ myApp.val.loadErrorBool = true; };327//328/* load audio data */329if (myApp.elem.sounds.canPlayType('audio/mp3') == 'probably'){ myApp.val.audioExt = '.mp3'; }330else if(myApp.elem.sounds.canPlayType('audio/aac') == 'probably'){ myApp.val.audioExt = '.aac'; }331else if(myApp.elem.sounds.canPlayType('audio/wav') == 'probably'){ myApp.val.audioExt = '.wav'; }332else if(myApp.elem.sounds.canPlayType('audio/mp3') == 'maybe' ){ myApp.val.audioExt = '.mp3'; }333else if(myApp.elem.sounds.canPlayType('audio/aac') == 'maybe' ){ myApp.val.audioExt = '.aac'; }334else if(myApp.elem.sounds.canPlayType('audio/wav') == 'maybe' ){ myApp.val.audioExt = '.wav'; }335myApp.elem.sounds.src = myApp.path.sound+myApp.val.audioExt;336//337/* load push button image */338myApp.elem.imgBtn1.src = myApp.path.btn1;339myApp.elem.imgBtn2.src = myApp.path.btn2;340myApp.elem.imgBtn3.src = myApp.path.btn3;341myApp.elem.imgBtn4.src = myApp.path.btn4;342if(myApp.val.os != 'other'){343 myApp.elem.pushBtn.className = "blinkImg";344}345//346/* load answer file */347myApp.val.ansFile.open("get", myApp.path.answer, true);348myApp.val.ansFile.send(null);349//350/* set audio sprite */351myApp.val.audioSpriteData = {352 pushBtn : { start : 0.0, end : 2.0 }, //[sec]353 sndO : { start : 3.0, end : 5.0 }, 354 sndX : { start : 6.0, end : 8.0 },355};356myApp.elem.sounds.addEventListener('timeupdate', spriteHandler, false);357function spriteHandler(){358 if(Math.abs(myApp.val.audioSpriteData.pushBtn.end - this.currentTime) < 0.25){359 this.pause();360 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.pushBtn.start;361 }362 if(Math.abs(myApp.val.audioSpriteData.sndO.end - this.currentTime) < 0.25){363 this.pause();364 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.pushBtn.start;365 }366 if(Math.abs(myApp.val.audioSpriteData.sndX.end - this.currentTime) < 0.25){367 this.pause();368 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.pushBtn.start;369 }370};371//372/* set function executed after initial loading */373myApp.elem.pushBtn.onerror = function(){374 myApp.val.loadErrorBool = true;375 myApp.val.loadAlertBool = true;376 alert("画像の読み込みに失敗しました。ページを再読み込みしてください。" );377};378myApp.elem.pushBtn.onload = function(){379 if(myApp.val.initLoadBool == false){380 /* change player and push button size after loading image */381 resizePlayer();382 resizePushButton();383 myApp.val.initLoadBool = true;384 if(myApp.val.os == 'other'){ myApp.val.viewFuncArray.shift()(); }385 }386};387function materialCheckFunction(){388 if(myApp.val.loadErrorBool == false){389 if(myApp.val.initLoadBool == false && myApp.val.loadCount == num_of_materials){390 myApp.val.loadCount = 0;391 /* assign push button image and main text */392 myApp.elem.pushBtn.width = document.documentElement.clientWidth/5; /* init size before loading */393 if(myApp.val.os != "other"){394 if(Math.abs(window.orientation) != 90){395 myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src;396 myApp.elem.text.innerHTML = "早押しボタンをタップして動画を開始する";397 myApp.val.initOrientation = 'portrait';398 }else{399 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;400 myApp.elem.text.innerHTML = "端末を縦向きにしてクイズをはじめる";401 myApp.val.initOrientation = 'landscape';402 alert("このサイトはスマートフォン/タブレットを縦向きにしてお楽しみください。");403 }404 }else{405 myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src;406 if(detectTouchPanel() == true){407 myApp.elem.subText.innerHTML = "<span class='blinkText'>スペースキーを押して動画を開始する</span>";408 }else{409 myApp.elem.subText.innerHTML = "<span class='blinkText'>スペースキーを押して動画を開始する</span>";410 }411 }412 }else if(myApp.val.initLoadBool == true && myApp.val.loadAlertBool == false){413 if(myApp.val.os != 'other'){414 if(Math.abs(myApp.elem.numOX.getBoundingClientRect().top - myApp.elem.ansBtn.getBoundingClientRect().bottom) < 50){415 myApp.val.loadErrorBool = true;416 myApp.val.loadAlertBool = true;417 player.pauseVideo();418 alert("画像の表示に失敗しました。ページを再読み込みしてください。");419 }420 }421 }422 }else{423 if(myApp.val.loadAlertBool == false){424 myApp.val.loadAlertBool = true;425 alert("ページの読み込みに失敗しました。ページを再読み込みしてください。");426 }427 }428}429//430/* EVENT */431/* orientation change event function */432window.addEventListener('orientationchange', myOrientationChangeEvent);433function myOrientationChangeEvent(){434 setTimeout(function(){435 resizePlayer();436 resizePushButton();437 if(myApp.val.status == myApp.state.MyAnswer){438 if(myApp.val.hidePlayerBool.phone == true){439 hidePlayer();440 }441 }442 if(Math.abs(window.orientation) != 90){443 if(myApp.val.status == myApp.state.MyAnswer){444 myApp.elem.pushBtn.src = myApp.elem.imgBtn3.src;445 }else{446 myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src;447 }448 if(myApp.val.status == myApp.state.ButtonCheck){449 myApp.elem.text.innerHTML = "早押しボタンをタップして動画を開始する";450 }451 }else{452 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;453 if(myApp.val.status == myApp.state.ButtonCheck){454 myApp.elem.text.innerHTML = "端末を縦向きにしてクイズをはじめる";455 }456 if(myApp.val.orientationAlertBool == false && myApp.val.initOrientation == 'portrait'){457 myApp.val.playingCount = -10;458 myApp.val.orientationAlertBool = true;459 alert("このサイトはスマートフォン/タブレットを縦向きにしてお楽しみください。");460 }461 }462 }, 800);463}464//465/* page hidden check event function */466document.addEventListener('webkitvisibilitychange', myPageHiddenCheckEvent, false);467function myPageHiddenCheckEvent(){468 if(document.webkitHidden){469 myApp.val.pageHiddenBool = true;470 // console.log('Hidden.');471 }else{472 myApp.val.pageHiddenBool = false;473 myApp.val.currTime.playing = player.getCurrentTime();474 myApp.val.watchedTime = myApp.val.currTime.playing;475 myApp.val.playingCount = 0;476 // console.log('Opened.');477 }478}479//480/* keydown event function */481document.onkeydown = myKeyDownEvent;482//483document.addEventListener("compositionstart", function(){ myApp.val.composingBool = true; });484document.addEventListener('compositionend', function(){ myApp.val.composingBool = false; });485function myKeyDownEvent(){486 if(myApp.val.loadErrorBool == false && myApp.val.initLoadBool == true && Math.abs(window.orientation) != 90){487 if(event.keyCode == myApp.val.space){488 myButtonAction();489 }490 /* prevent to start new line in text area */491 if(event.keyCode == myApp.val.enter){492 if(myApp.val.composingBool == false){493 return false;494 }495 }496 }497}498//499/* touchstart event function (for smartphonea and tablet) */500document.addEventListener("touchstart", myTouchEvent);501function myTouchEvent(event){502 if(myApp.val.loadErrorBool == false && myApp.val.initLoadBool == true && Math.abs(window.orientation) != 90){503 myApp.val.touchObject = event.changedTouches[0];504 if(myApp.val.pushBtnArea.left < myApp.val.touchObject.pageX && myApp.val.touchObject.pageX < myApp.val.pushBtnArea.right){505 if(myApp.val.pushBtnArea.top < myApp.val.touchObject.pageY && myApp.val.touchObject.pageY < myApp.val.pushBtnArea.bottom){506 myButtonAction();507 }508 }509 }510}511//512/* common button action */513function myButtonAction(){514 if(myApp.val.status == myApp.state.ButtonCheck){515 myApp.val.status = myApp.state.Talk;516 myApp.elem.pushBtn.className = "";517 buttonCheck(myApp.val.btnCheck.sndInterval);518 setTimeout(function(){519 player.playVideo();520 myApp.elem.ansBtn.disabled = false;521 if(myApp.val.os != 'other'){522 myApp.val.viewFuncArray.shift()();523 myApp.elem.text.innerHTML = "< 遊び方 >";524 myApp.elem.subText.innerHTML = "画面上の早押しボタンで<br>動画内のクイズに参加することができます";525 }else{526 myApp.val.viewFuncArray.shift()();527 myApp.elem.text.innerHTML = "< 遊び方 >"528 myApp.elem.subText.innerHTML = "スペースキーを早押しボタンにして<br>動画内のクイズに参加することができます";529 }530 }, myApp.val.btnCheck.playInterval);531 }532 if(myApp.val.status == myApp.state.Question){533 myApp.val.status = myApp.state.MyAnswer;534 player.pauseVideo();535 pushButton();536 }537}538//539/* player's state change event function */540player.addEventListener('onStateChange', myPlayerStateChangeEvent);541function myPlayerStateChangeEvent(){542 if(player.getPlayerState() == myApp.videoState.Playing){543 myApp.val.currTime.playing = player.getCurrentTime();544 myApp.val.watchedTime = updateWatchedTime(myApp.val.currTime.playing, myApp.val.watchedTime);545 /* check answer if the video is restarted manually without sending answer */546 if(myApp.val.status == myApp.state.MyAnswer){547 player.pauseVideo();548 checkAnswer();549 if(myApp.val.correctBool == true || myApp.val.limPush - myApp.val.cntPush == 0){550 myApp.val.status = myApp.state.Talk;551 }else{552 myApp.val.status = myApp.state.Question;553 }554 player.playVideo();555 }556 if(myApp.val.disableSeekbarBool == true){557 /* prevent to jump playback position by seekbar */558 if(myApp.val.status == myApp.state.Question){559 myApp.val.diffTime = Math.abs(myApp.val.currTime.playing - myApp.val.watchedTime);560 if(myApp.val.diffTime > 1.0){561 player.seekTo(myApp.val.watchedTime);562 }563 }else{564 myApp.val.diffTime = Math.abs(myApp.val.currTime.playing - myApp.val.watchedTime);565 // myApp.val.diffTime = myApp.val.currTime.playing - myApp.val.watchedTime; /* allow to jump to previous positon on timeline */566 if(myApp.val.diffTime > 1.0){567 player.seekTo(myApp.val.watchedTime);568 }569 }570 }571 }572 if(player.getPlayerState() == myApp.videoState.Stopped){573 myApp.val.currTime.stopped = player.getCurrentTime();574 if(myApp.val.disableSeekbarBool == true){575 /* prevent to jump video playback position by seekbar */576 /* and prevent to pause video during each question */577 if(myApp.val.status == myApp.state.Question || myApp.val.status == myApp.state.OthAnswer){578 myApp.val.diffTime = Math.abs(myApp.val.currTime.stopped - myApp.val.watchedTime);579 if(myApp.val.diffTime > 1.0){580 player.seekTo(myApp.val.watchedTime);581 }582 player.playVideo();583 }else{584 myApp.val.diffTime = Math.abs(myApp.val.currTime.stopped - myApp.val.watchedTime);585 // myApp.val.diffTime = myApp.val.currTime.stopped - myApp.val.watchedTime; /* allow to jump to previous position on timeline */586 if(myApp.val.diffTime > 1.0){587 player.seekTo(myApp.val.watchedTime);588 player.playVideo(); /* allow to pause video except during the question status */589 }590 // player.playVideo();591 }592 }593 }594}595//596/* interval event function that are executed at a certain interval */597setInterval(myIntervalEvent, interval = 10);598function myIntervalEvent(){599 if(myApp.val.pageHiddenBool == false){600 if(player.getPlayerState() == myApp.videoState.Playing){601 myApp.val.currTime.playing = player.getCurrentTime();602 myApp.val.watchedTime = updateWatchedTime(myApp.val.currTime.playing, myApp.val.watchedTime);603 if(myApp.val.disableSeekbarBool == true){604 /* check delay of processing */605 if(myApp.val.playingCount < 0 ){ myApp.val.watchedTime = myApp.val.currTime.playing; } // fix delay of watchedTime caused by showing orientation alert.606 if(myApp.val.playingCount < 10){ myApp.val.playingCount += 1; } // allow initial delay of watchedTime just after playing video.607 if(myApp.val.currTime.playing - myApp.val.watchedTime > 1.0 && myApp.val.playingCount >= 10){608 if(myApp.val.processDelayAlertBool == false){609 myApp.val.processDelayAlertBool = true;610 alert('ページ内の処理が遅くなっています。早押しの判定に支障が出る可能性があるため、他のプロセスを終了してから改めてクイズをお楽しみください。このポップアップは一度のみ表示されます。');611 }612 myApp.val.watchedTime = myApp.val.currTime.playing;613 }614 }615 /* prevent to play video before button check */616 if(myApp.val.status == myApp.state.ButtonCheck){617 player.pauseVideo();618 }619 /* execute srt function in each sections of subtitle */620 if(myApp.val.status != myApp.state.MyAnswer){621 if(myApp.val.disableSeekbarBool == true){622 if(index - myApp.val.cntIndex == 1){623 myApp.val.srtFuncArray.shift()();624 myApp.val.cntIndex += 1;625 }626 }else{627 if(index - myApp.val.cntIndex >= 1){628 for(let i = 0; i < index-myApp.val.cntIndex; i++){629 myApp.val.srtFuncArray.shift()();630 }631 myApp.val.cntIndex = index;632 // console.log(myApp.val.cntIndex);633 }634 }635 }636 }else if(player.getPlayerState() == myApp.videoState.Stopped){637 myApp.val.playingCount = 0;638 }639 if(myApp.val.status == myApp.state.ButtonCheck){640 if(myApp.val.cntIndex > 0 && myApp.val.loadAlertBool == false){641 myApp.val.loadErrorBool = true;642 myApp.val.loadAlertBool = true;643 player.pauseVideo();644 alert('ページの読み込みに失敗しました。ページを再読み込みしてください。');645 }646 }647 if(myApp.val.status == myApp.state.MyAnswer){648 /* reforcus when anscol is blank */649 // if(document.activeElement.id != "anscol" && myApp.elem.ansCol.value.valueOf() === ""){650 // myApp.elem.ansCol.focus();651 // }652 /* answer time managemant */653 if(document.activeElement.id == "anscol" || myApp.val.ansTime.elapsed != 0){654 myApp.val.ansTime.elapsed += interval;655 myApp.elem.text.innerHTML = "のこり"+Math.floor((myApp.val.ansTime.limit-myApp.val.ansTime.elapsed)/1000+1)+"秒";656 if(myApp.val.ansTime.elapsed >= myApp.val.ansTime.limit){657 checkAnswer();658 if(myApp.val.correctBool == true || myApp.val.limPush - myApp.val.cntPush == 0){659 myApp.val.status = myApp.state.Talk;660 }else{661 myApp.val.status = myApp.state.Question;662 }663 player.playVideo();664 }665 }666 }else{667 if(myApp.val.os == 'other' && document.activeElement.id == "player"){668 /* preparation of js keydown event */669 instantFocusToElement(myApp.elem.pushBtn);670 }671 myApp.val.ansTime.elapsed = 0;672 }673 /* check results of importing material */674 materialCheckFunction();675 /* update push button area (mainly for when the window is zoomed in iOS)*/676 updatePushButtonArea();677 /* print parameters for debug */678 printParams();679 }680}681//682/* onclick event function of send answer button */683myApp.elem.ansBtn.onclick = myOnClickEvent;684function myOnClickEvent(){685 /* jump to init question */686 if(index == 0){687 let tmpTime = myApp.val.firstQuesStartTime-0.1;688 if(myApp.val.currTime.playing < tmpTime){689 myApp.elem.ansBtn.disabled = true;690 myApp.val.watchedTime = tmpTime;691 player.seekTo(tmpTime);692 }693 }694 /* send answer */695 if(myApp.val.status == myApp.state.MyAnswer){696 checkAnswer();697 if(myApp.val.correctBool == true || myApp.val.limPush - myApp.val.cntPush == 0){698 myApp.val.status = myApp.state.Talk;699 }else{700 myApp.val.status = myApp.state.Question;701 }702 player.playVideo();703 }704}705//706/* onfocus event function of answer column */707myApp.elem.ansCol.onfocus = function(){ myApp.elem.ansCol.val = ""; }708//709/* FUNCTION */710function detectTouchPanel(){711 return window.ontouchstart === null;712}713//714function fetchOSType(){715 let osType = null;716 const ua = navigator.userAgent;717 if(ua.match(/Android/)){718 osType = "Android";719 return osType;720 }else if(ua.match(/iPhone/)) {721 osType = "iOS"; // iPhone OS722 return osType;723 }else if(ua.match(/iPad/)) {724 osType = "iOS"; // iPad OS725 return osType;726 }else if(ua.match(/Macintosh/) && detectTouchPanel() == true){727 osType = 'iOS'; // iPad OS with Safari728 return osType;729 }else{730 osType = "other";731 return osType;732 }733}734//735function fetchBrowserType(){736 let bwType = null;737 const ua = navigator.userAgent;738 if(ua.match(/Firefox/)){739 bwType = "Firefox";740 return bwType;741 }else if(ua.match(/EdgiOS/) || ua.match(/EdgA/)){742 bwType = "Edge";743 return bwType;744 }else if(ua.match(/OPR/)){745 bwType = "Opera";746 return bwType;747 }else if(ua.match(/OPT/)){748 bwType = "OperaTouch";749 return bwType;750 }else if(ua.match(/YJApp/)){751 bwType = "Yahoo";752 return bwType;753 }else if(ua.match(/Smooz/)){754 bwType = "Smooz";755 return bwType;756 }else if(ua.match(/CriOS/) || ua.match(/Chrome/)){757 //Chrome or Others ...758 bwType = "Chrome";759 return bwType;760 }else{761 //Safari, Firefox(iOS), Brave or Others ...762 bwType = "Other";763 return bwType;764 }765}766/**767 * @param {string} str768 * @returns {array} (rows: num of question, columns: num of patterns of answer)769 */770function CSVtoArray(str){771 const array = new Array();772 const tmp = str.split("\r\n");773 for(let i = 0; i < tmp.length; i++){774 array[i] = tmp[i].split(",");775 }776 return array;777}778//779function resizePlayer(){780 if(myApp.val.os != 'other'){781 if(Math.abs(window.orientation) != 90){782 // myApp.val.playerWidth = document.documentElement.clientWidth;783 if(myApp.val.os == 'Android'){ myApp.val.playerWidth = window.innerWidth; } // In Android, clientWidth doesn't include scrollbar.784 if(myApp.val.os == 'iOS'){ myApp.val.playerWidth = document.documentElement.clientWidth; } // In iOS, innerWidth isn't static (it changes with device orientation).785 myApp.val.playerHeight = myApp.val.playerWidth/16*9;786 }else{787 myApp.val.playerWidth = document.documentElement.clientWidth*2/3;788 myApp.val.playerHeight = myApp.val.playerWidth/16*9;789 }790 /* set special width of anscol to prevent the window is zoomed when the focus moveds to anscol */791 if(myApp.val.os == 'Android' && myApp.val.browser == "Firefox"){792 myApp.elem.ansCol.style.width = myApp.val.playerWidth*0.98+'px';793 }else{794 myApp.elem.ansCol.style.width = myApp.val.playerWidth*0.9+'px';795 }796 }else{797 const tmpPlayerHeight = document.documentElement.clientHeight/2;798 const tmpPlayerWidth = tmpPlayerHeight/9*16;799 if(tmpPlayerWidth < document.documentElement.clientWidth){800 myApp.val.playerHeight = tmpPlayerHeight;801 myApp.val.playerWidth = tmpPlayerWidth;802 }else{803 myApp.val.playerWidth = document.documentElement.clientWidth;804 myApp.val.playerHeight = myApp.val.playerWidth/16*9;805 }806 }807 if(myApp.val.initLoadBool == false || myApp.val.prevPlayerWidth != myApp.val.playerWidth){808 player.setSize(myApp.val.playerWidth, myApp.val.playerHeight);809 //810 myApp.val.prevPlayerWidth = myApp.val.playerWidth;811 myApp.val.prevPlayerHeight = myApp.val.playerHeight;812 }813}814//815function resizePushButton(){816 if(myApp.val.os != "other"){817 if(Math.abs(window.orientation) != 90){818 const tmpImgHeight = document.documentElement.clientHeight-myApp.val.playerHeight-myApp.val.elemHeight-20;819 const tmpImgWidth = myApp.elem.pushBtn.naturalWidth*tmpImgHeight/myApp.elem.pushBtn.naturalHeight;820 if(tmpImgWidth < document.documentElement.clientWidth){821 if(tmpImgHeight <= myApp.val.playerHeight){822 myApp.val.pushBtnWidth = tmpImgWidth;823 myApp.val.pushBtnHeight = tmpImgHeight;824 }else{825 myApp.val.pushBtnWidth = myApp.elem.pushBtn.naturalWidth*myApp.val.playerHeight*1.25/myApp.elem.pushBtn.naturalHeight;826 myApp.val.pushBtnHeight = myApp.val.playerHeight*1.25;827 }828 }else{829 myApp.val.pushBtnWidth = document.documentElement.clientWidth/5;830 myApp.val.pushBtnHeight = myApp.elem.pushBtn.naturalHeight*myApp.val.pushBtnWidth/myApp.elem.pushBtn.naturalWidth;831 }832 }else{833 myApp.val.pushBtnWidth = document.documentElement.clientWidth/5;834 myApp.val.pushBtnHeight = myApp.elem.pushBtn.naturalHeight*myApp.val.pushBtnWidth/myApp.elem.pushBtn.naturalWidth;835 }836 myApp.elem.pushBtn.style.margin = 'auto '+(document.documentElement.clientWidth-myApp.val.pushBtnWidth)/2+'px';837 }else{838 myApp.val.pushBtnWidth = myApp.val.divBtnWidth;839 myApp.val.pushBtnHeight = myApp.elem.pushBtn.naturalHeight*myApp.val.pushBtnWidth/myApp.elem.pushBtn.naturalWidth;840 } 841 if(myApp.val.initLoadBool == false || myApp.val.prevClientHeight != document.documentElement.clientHeight){842 myApp.elem.pushBtn.width = myApp.val.pushBtnWidth;843 myApp.elem.pushBtn.height = myApp.val.pushBtnHeight;844 updatePushButtonArea();845 //846 myApp.val.prevClientWidth = document.documentElement.clientWidth;847 myApp.val.prevClientHeight = document.documentElement.clientHeight;848 }849}850//851function updatePushButtonArea(){852 myApp.val.pushBtnArea.left = myApp.elem.pushBtn.getBoundingClientRect().left;853 myApp.val.pushBtnArea.right = myApp.elem.pushBtn.getBoundingClientRect().right;854 myApp.val.pushBtnArea.top = myApp.elem.pushBtn.getBoundingClientRect().top;855 myApp.val.pushBtnArea.bottom = myApp.elem.pushBtn.getBoundingClientRect().bottom;856 //857 /* In iOS, value of getBoundingClientRect is changed when the window is zoomed */858 if(myApp.val.os == 'iOS'){859 myApp.val.pushBtnArea.left += window.pageXOffset;860 myApp.val.pushBtnArea.right += window.pageXOffset;861 myApp.val.pushBtnArea.top += window.pageYOffset;862 myApp.val.pushBtnArea.bottom += window.pageYOffset;863 }864}865//866function instantFocusToElement(focusUsableElement){867 /* keydown event is ready during the focus is in a js element */868 focusUsableElement.disabled = false;869 focusUsableElement.focus();870 focusUsableElement.blur();871 focusUsableElement.disabled = true;872}873//874function updateWatchedTime(currentPlayingTime, watchedTime){875 if(0.0 < currentPlayingTime - watchedTime && currentPlayingTime - watchedTime < 1.0){876 watchedTime = currentPlayingTime;877 }878 return watchedTime;879}880//881function playSndPushBtn(){882 if(myApp.elem.sounds.currentTime != myApp.val.audioSpriteData.pushBtn.start){883 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.pushBtn.start;884 }885 myApp.elem.sounds.play();886}887//888function playSndO(){889 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.sndO.start;890 myApp.elem.sounds.play();891}892//893function playSndX(){894 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.sndX.start;895 myApp.elem.sounds.play();896}897//898function hidePlayer(){899 player.setSize(myApp.val.playerWidth, 0);900}901//902function opposePlayer(){903 player.setSize(myApp.val.playerWidth, myApp.val.playerHeight);904}905//906function buttonCheck(responseInterval){907 playSndPushBtn();908 if(myApp.val.os == 'iOS'){909 myApp.elem.pushBtn.src = myApp.elem.imgBtn3.src;910 }else{911 myApp.elem.pushBtn.src = myApp.elem.imgBtn2.src;912 setTimeout(function(){ myApp.elem.pushBtn.src = myApp.elem.imgBtn3.src; }, 100);913 }914 setTimeout(function(){915 playSndO();916 myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src;917 }, responseInterval);918}919//920function pushButton(){921 // hide player during answer.922 if(myApp.val.os != 'other'){923 if(myApp.val.hidePlayerBool.phone == true){924 hidePlayer();925 }926 }else{927 if(myApp.val.hidePlayerBool.other == true){928 hidePlayer();929 }930 }931 playSndPushBtn();932 if(myApp.val.os == 'iOS'){933 myApp.elem.pushBtn.src = myApp.elem.imgBtn3.src;934 if(myApp.val.browser == 'Chrome' || myApp.val.browser == 'Edge' || myApp.val.browser == 'Smooz'){935 setTimeout(function(){ focusToAnsCol(); }, 500); // In above browsers, focus() doesn't work by the script below.936 }else{937 focusToAnsCol(); // In iOS, focus() doesn't work properly in setTimeout (keyboard doesn't appear).938 }939 }else{940 myApp.elem.pushBtn.src = myApp.elem.imgBtn2.src;941 setTimeout(function(){ myApp.elem.pushBtn.src = myApp.elem.imgBtn3.src; }, 100); 942 setTimeout(function(){ focusToAnsCol(); }, 500);943 }944 myApp.val.cntPush = myApp.val.cntPush+1;945}946//947function focusToAnsCol(){948 myApp.elem.ansBtn.disabled = false;949 myApp.elem.ansCol.disabled = false;950 myApp.elem.ansCol.value = "";951 myApp.elem.ansCol.focus();952}953//954function checkAnswer(){955 myApp.val.correctBool = false;956 myApp.elem.ansCol.blur();957 myApp.elem.ansCol.disabled = true;958 myApp.elem.ansBtn.disabled = true;959 const answer = myApp.elem.ansCol.value;960 const length = myApp.val.ansArray[myApp.val.numQues-1].length;961 for(let i = 0; i < length; i++){962 if(answer.valueOf() === myApp.val.ansArray[myApp.val.numQues-1][i].valueOf()){963 myApp.val.correctBool = true;964 }965 }966 if(myApp.val.correctBool == true){967 playSndO();968 myApp.val.cntO += 1;969 myApp.elem.text.innerHTML = "正解!";970 if(myApp.val.jumpToAnsBool){ jumpToAnswerIndex(myApp.val.ansIndex, myApp.val.ansIndexStartTime); }971 }else{972 playSndX();973 myApp.val.cntX += 1;974 myApp.elem.text.innerHTML = "不正解!"; //あと"+(myApp.val.limPush-myApp.val.cntPush)+"回解答できます。";975 if(myApp.val.jumpToAnsBool){ jumpToAnswerIndex(myApp.val.ansIndex, myApp.val.ansIndexStartTime); }976 }977 myApp.elem.numOX.innerHTML = "⭕️:"+myApp.val.cntO+" ❌:"+myApp.val.cntX;978 if(window.orientation != 90){979 if(myApp.val.correctBool == false && myApp.val.limPush - myApp.val.cntPush == 0){980 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;981 }else{982 myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src;983 }984 }else{985 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;986 }987 // oppose player after answer.988 if(myApp.val.os != 'other'){989 if(myApp.val.hidePlayerBool.phone == true){990 opposePlayer();991 }992 }else{993 if(myApp.val.hidePlayerBool.other == true){994 opposePlayer();995 }996 }997}998//999function jumpToAnswerIndex(index, time){1000 myApp.val.cntIndex = index-1;1001 myApp.val.watchedTime = time-0.1;1002 player.seekTo(time-0.1);1003}1004//1005function printParams(){1006 // myApp.elem.paramText.innerHTML = "timePlay: " + myApp.val.currTime.playing.toFixed(3)+"<br>"+1007 // "timeStop: " +myApp.val.currTime.stopped.toFixed(3)+"<br>"+1008 // "WatchedTime: " + myApp.val.watchedTime.toFixed(3)+"<br>"+1009 // "diffTime: " + myApp.val.diffTime.toFixed(3);1010 // myApp.elem.paramText.innerHTML = myApp.val.browser;1011 // myApp.elem.paramText.innerHTML = myApp.val.os + ', ' + navigator.userAgent;1012 // myApp.elem.paramText.innerHTML = document.styleSheets.item(0).cssRules;1013 // myApp.elem.subText.innerHTML = "sounds.currentTime: " + Math.abs(Math.floor(myApp.elem.sounds.currentTime*1000)/1000);1014 // myApp.elem.subText.innerHTML = Math.floor(myApp.val.touchObject.pageX) +', '+ Math.floor(myApp.val.touchObject.pageY) +' '+1015 // '[' + Math.floor(myApp.val.pushBtnArea.left) +', '+ Math.floor(myApp.val.pushBtnArea.right) +'] '+1016 // '[' + Math.floor(myApp.val.pushBtnArea.top) +', '+ Math.floor(myApp.val.pushBtnArea.bottom)+'] '+1017 // '| '+ window.pageXOffset +', '+ window.pageYOffset;1018 // myApp.elem.subText.innerHTML = myApp.elem.numOX.getBoundingClientRect().top - myApp.elem.ansBtn.getBoundingClientRect().bottom;1019 // myApp.elem.subText.innerHTML = 'loadErrorBool: ' + myApp.val.loadErrorBool + ', initLoadBool: ' + myApp.val.initLoadBool + ', loadCount: ' + myApp.val.loadCount;1020 // myApp.elem.subText.innerHTML = 'playerWidth: ' + myApp.val.playerWidth + ', innerWidth: ' + window.innerWidth;1021 // myApp.elem.paramText.innerHTML = "<br>"+ 1022 // "device: " + myApp.val.os+"<br>"+1023 // "browser: " + myApp.val.browser+"<br>"+1024 // "activeElem: " + document.activeElement.id+"<br>"+ 1025 // "status: " + myApp.val.status+"<br>"+1026 // "timePlay: " + myApp.val.currTime.playing.toFixed(3)+"<br>"+1027 // "timeStop: " + myApp.val.currTime.stopped.toFixed(3)+"<br>"+1028 // "WatchedTime: " + myApp.val.watchedTime.toFixed(3)+"<br>"+1029 // "diffTime: " + myApp.val.diffTime.toFixed(3)+"<br>"+1030 // "limPush: " + myApp.val.limPush+"<br>"+ 1031 // "cntPush: " + myApp.val.cntPush+"<br>"+1032 // "remainingAnsTime: " + Math.floor((myApp.val.ansTime.limit-myApp.val.ansTime.elapsed)/1000)+"<br>"+1033 // "answer: " + myApp.val.ansArray[myApp.val.numQues-1][0].valueOf()+", "+1034 // myApp.val.ansArray[myApp.val.numQues-1][1].valueOf()+", "+1035 // myApp.val.ansArray[myApp.val.numQues-1][2].valueOf()+", "+1036 // myApp.val.ansArray[myApp.val.numQues-1][3].valueOf()+", "+1037 // myApp.val.ansArray[myApp.val.numQues-1][4].valueOf()+", "+1038 // myApp.val.ansArray[myApp.val.numQues-1][5].valueOf()+"<br>"+1039 // "numAnswer: " + myApp.val.ansArray.length+"<br>"+1040 // "answerLength: " + myApp.val.ansArray[myApp.val.numQues-1].length+"<br>"+1041 // "correctBool: " + myApp.val.correctBool+"<br>"+1042 // "composing: " + myApp.val.composingBool+"<br>"+1043 // "index: " + index+"<br>"+1044 // "cntIndex: " + myApp.val.cntIndex+"<br>"+1045 // "cssRules: " + document.styleSheets.item(0).cssRules.item(0).selectorText;1046}1047//1048//---------------------------------------------------------------------------------------------------------------1049/* set functions executed in each subtitle */1050myApp.val.jumpToAnsBool = true;1051myApp.val.disableSeekbarBool = false;1052myApp.val.hidePlayerBool.phone = true;1053myApp.val.hidePlayerBool.other = false;1054myApp.val.firstQuesStartTime = 16.24;1055myApp.val.srtFuncArray = [1056 function(){1057 myApp.val.viewFuncArray.shift()();1058 myApp.elem.ansBtn.innerHTML = "解答を送信";1059 /* 第1問 */1060 myApp.val.ansIndex = 2;1061 myApp.val.ansIndexStartTime = 26.78;1062 //1063 myApp.val.status = myApp.state.Question;1064 myApp.val.numQues = 1;1065 myApp.val.cntPush = 0;1066 myApp.val.correctBool = false;1067 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1068 myApp.elem.ansCol.value = "ここに解答を入力";1069 myApp.elem.ansCol.disabled = true;1070 myApp.elem.ansBtn.disabled = true;1071 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1072 },1073 function(){1074 myApp.val.status = myApp.state.Talk;1075 myApp.elem.ansCol.disabled = true;1076 myApp.elem.ansBtn.disabled = true;1077 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1078 },1079 function(){1080 /* 第2問 */1081 myApp.val.ansIndex = 4;1082 myApp.val.ansIndexStartTime = 40.56;1083 //1084 myApp.val.status = myApp.state.Question;1085 myApp.val.numQues = 2;1086 myApp.val.cntPush = 0;1087 myApp.val.correctBool = false;1088 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1089 myApp.elem.ansCol.value = "ここに解答を入力";1090 myApp.elem.ansCol.disabled = true;1091 myApp.elem.ansBtn.disabled = true;1092 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1093 },1094 function(){1095 myApp.val.status = myApp.state.Talk;1096 myApp.elem.ansCol.disabled = true;1097 myApp.elem.ansBtn.disabled = true;1098 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1099 },1100 function(){1101 /* 第3問 */1102 myApp.val.ansIndex = 6;1103 myApp.val.ansIndexStartTime = 52.79;1104 //1105 myApp.val.status = myApp.state.Question;1106 myApp.val.numQues = 3;1107 myApp.val.cntPush = 0;1108 myApp.val.correctBool = false;1109 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1110 myApp.elem.ansCol.value = "ここに解答を入力";1111 myApp.elem.ansCol.disabled = true;1112 myApp.elem.ansBtn.disabled = true;1113 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1114 },1115 function(){1116 myApp.val.status = myApp.state.Talk;1117 myApp.elem.ansCol.disabled = true;1118 myApp.elem.ansBtn.disabled = true;1119 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1120 },1121 function(){1122 /* 第4問 */1123 myApp.val.ansIndex = 8;1124 myApp.val.ansIndexStartTime = 67.43;1125 //1126 myApp.val.status = myApp.state.Question;1127 myApp.val.numQues = 4;1128 myApp.val.cntPush = 0;1129 myApp.val.correctBool = false;1130 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1131 myApp.elem.ansCol.value = "ここに解答を入力";1132 myApp.elem.ansCol.disabled = true;1133 myApp.elem.ansBtn.disabled = true;1134 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1135 },1136 function(){1137 myApp.val.status = myApp.state.Talk;1138 myApp.elem.ansCol.disabled = true;1139 myApp.elem.ansBtn.disabled = true;1140 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1141 },1142 function(){1143 /* 第5問 */1144 myApp.val.ansIndex = 10;1145 myApp.val.ansIndexStartTime = 81.34;1146 //1147 myApp.val.status = myApp.state.Question;1148 myApp.val.numQues = 5;1149 myApp.val.cntPush = 0;1150 myApp.val.correctBool = false;1151 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1152 myApp.elem.ansCol.value = "ここに解答を入力";1153 myApp.elem.ansCol.disabled = true;1154 myApp.elem.ansBtn.disabled = true;1155 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1156 },1157 function(){1158 myApp.val.status = myApp.state.Talk;1159 myApp.elem.ansCol.disabled = true;1160 myApp.elem.ansBtn.disabled = true;1161 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1162 },1163 function(){1164 /* 第6問 */1165 myApp.val.ansIndex = 12;1166 myApp.val.ansIndexStartTime = 95.69;1167 //1168 myApp.val.status = myApp.state.Question;1169 myApp.val.numQues = 6;1170 myApp.val.cntPush = 0;1171 myApp.val.correctBool = false;1172 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1173 myApp.elem.ansCol.value = "ここに解答を入力";1174 myApp.elem.ansCol.disabled = true;1175 myApp.elem.ansBtn.disabled = true;1176 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1177 },1178 function(){1179 myApp.val.status = myApp.state.Talk;1180 myApp.elem.ansCol.disabled = true;1181 myApp.elem.ansBtn.disabled = true;1182 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1183 },1184 function(){1185 /* 第7問 */1186 myApp.val.ansIndex = 14;1187 myApp.val.ansIndexStartTime = 109.59;1188 //1189 myApp.val.status = myApp.state.Question;1190 myApp.val.numQues = 7;1191 myApp.val.cntPush = 0;1192 myApp.val.correctBool = false;1193 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1194 myApp.elem.ansCol.value = "ここに解答を入力";1195 myApp.elem.ansCol.disabled = true;1196 myApp.elem.ansBtn.disabled = true;1197 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1198 },1199 function(){1200 myApp.val.status = myApp.state.Talk;1201 myApp.elem.ansCol.disabled = true;1202 myApp.elem.ansBtn.disabled = true;1203 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1204 },1205 function(){1206 /* 第8問 */1207 myApp.val.ansIndex = 16;1208 myApp.val.ansIndexStartTime = 124.87;1209 //1210 myApp.val.status = myApp.state.Question;1211 myApp.val.numQues = 8;1212 myApp.val.cntPush = 0;1213 myApp.val.correctBool = false;1214 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1215 myApp.elem.ansCol.value = "ここに解答を入力";1216 myApp.elem.ansCol.disabled = true;1217 myApp.elem.ansBtn.disabled = true;1218 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1219 },1220 function(){1221 myApp.val.status = myApp.state.Talk;1222 myApp.elem.ansCol.disabled = true;1223 myApp.elem.ansBtn.disabled = true;1224 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1225 },1226 function(){1227 /* 第9問 */1228 myApp.val.ansIndex = 18;1229 myApp.val.ansIndexStartTime = 140.3;1230 //1231 myApp.val.status = myApp.state.Question;1232 myApp.val.numQues = 9;1233 myApp.val.cntPush = 0;1234 myApp.val.correctBool = false;1235 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1236 myApp.elem.ansCol.value = "ここに解答を入力";1237 myApp.elem.ansCol.disabled = true;1238 myApp.elem.ansBtn.disabled = true;1239 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1240 },1241 function(){1242 myApp.val.status = myApp.state.Talk;1243 myApp.elem.ansCol.disabled = true;1244 myApp.elem.ansBtn.disabled = true;1245 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1246 },1247 function(){1248 /* 第10問 */1249 myApp.val.ansIndex = 20;1250 myApp.val.ansIndexStartTime = 154.49;1251 //1252 myApp.val.status = myApp.state.Question;1253 myApp.val.numQues = 10;1254 myApp.val.cntPush = 0;1255 myApp.val.correctBool = false;1256 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1257 myApp.elem.ansCol.value = "ここに解答を入力";1258 myApp.elem.ansCol.disabled = true;1259 myApp.elem.ansBtn.disabled = true;1260 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1261 },1262 function(){1263 myApp.val.status = myApp.state.Talk;1264 myApp.elem.ansCol.disabled = true;1265 myApp.elem.ansBtn.disabled = true;1266 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1267 },1268 function(){1269 /* 第11問 */1270 myApp.val.ansIndex = 22;1271 myApp.val.ansIndexStartTime = 170.45;1272 //1273 myApp.val.status = myApp.state.Question;1274 myApp.val.numQues = 11;1275 myApp.val.cntPush = 0;1276 myApp.val.correctBool = false;1277 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1278 myApp.elem.ansCol.value = "ここに解答を入力";1279 myApp.elem.ansCol.disabled = true;1280 myApp.elem.ansBtn.disabled = true;1281 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1282 },1283 function(){1284 myApp.val.status = myApp.state.Talk;1285 myApp.elem.ansCol.disabled = true;1286 myApp.elem.ansBtn.disabled = true;1287 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1288 },1289 function(){1290 /* 第12問 */1291 myApp.val.ansIndex = 24;1292 myApp.val.ansIndexStartTime = 182.92;1293 //1294 myApp.val.status = myApp.state.Question;1295 myApp.val.numQues = 12;1296 myApp.val.cntPush = 0;1297 myApp.val.correctBool = false;1298 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1299 myApp.elem.ansCol.value = "ここに解答を入力";1300 myApp.elem.ansCol.disabled = true;1301 myApp.elem.ansBtn.disabled = true;1302 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1303 },1304 function(){1305 myApp.val.status = myApp.state.Talk;1306 myApp.elem.ansCol.disabled = true;1307 myApp.elem.ansBtn.disabled = true;1308 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1309 },1310 function(){1311 /* 第13問 */1312 myApp.val.ansIndex = 26;1313 myApp.val.ansIndexStartTime = 196.26;1314 //1315 myApp.val.status = myApp.state.Question;1316 myApp.val.numQues = 13;1317 myApp.val.cntPush = 0;1318 myApp.val.correctBool = false;1319 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1320 myApp.elem.ansCol.value = "ここに解答を入力";1321 myApp.elem.ansCol.disabled = true;1322 myApp.elem.ansBtn.disabled = true;1323 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1324 },1325 function(){1326 myApp.val.status = myApp.state.Talk;1327 myApp.elem.ansCol.disabled = true;1328 myApp.elem.ansBtn.disabled = true;1329 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1330 },1331 function(){1332 /* 第14問 */1333 myApp.val.ansIndex = 28;1334 myApp.val.ansIndexStartTime = 211.85;1335 //1336 myApp.val.status = myApp.state.Question;1337 myApp.val.numQues = 14;1338 myApp.val.cntPush = 0;1339 myApp.val.correctBool = false;1340 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1341 myApp.elem.ansCol.value = "ここに解答を入力";1342 myApp.elem.ansCol.disabled = true;1343 myApp.elem.ansBtn.disabled = true;1344 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1345 },1346 function(){1347 myApp.val.status = myApp.state.Talk;1348 myApp.elem.ansCol.disabled = true;1349 myApp.elem.ansBtn.disabled = true;1350 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1351 },1352 function(){1353 /* 第15問 */1354 myApp.val.ansIndex = 30;1355 myApp.val.ansIndexStartTime = 227.15;1356 //1357 myApp.val.status = myApp.state.Question;1358 myApp.val.numQues = 15;1359 myApp.val.cntPush = 0;1360 myApp.val.correctBool = false;1361 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1362 myApp.elem.ansCol.value = "ここに解答を入力";1363 myApp.elem.ansCol.disabled = true;1364 myApp.elem.ansBtn.disabled = true;1365 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1366 },1367 function(){1368 myApp.val.status = myApp.state.Talk;1369 myApp.elem.ansCol.disabled = true;1370 myApp.elem.ansBtn.disabled = true;1371 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1372 },1373 function(){1374 /* 第16問 */1375 myApp.val.ansIndex = 32;1376 myApp.val.ansIndexStartTime = 241.59;1377 //1378 myApp.val.status = myApp.state.Question;1379 myApp.val.numQues = 16;1380 myApp.val.cntPush = 0;1381 myApp.val.correctBool = false;1382 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1383 myApp.elem.ansCol.value = "ここに解答を入力";1384 myApp.elem.ansCol.disabled = true;1385 myApp.elem.ansBtn.disabled = true;1386 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1387 },1388 function(){1389 myApp.val.status = myApp.state.Talk;1390 myApp.elem.ansCol.disabled = true;1391 myApp.elem.ansBtn.disabled = true;1392 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1393 },1394 function(){1395 /* 第17問 */1396 myApp.val.ansIndex = 34;1397 myApp.val.ansIndexStartTime = 253.65;1398 //1399 myApp.val.status = myApp.state.Question;1400 myApp.val.numQues = 17;1401 myApp.val.cntPush = 0;1402 myApp.val.correctBool = false;1403 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1404 myApp.elem.ansCol.value = "ここに解答を入力";1405 myApp.elem.ansCol.disabled = true;1406 myApp.elem.ansBtn.disabled = true;1407 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1408 },1409 function(){1410 myApp.val.status = myApp.state.Talk;1411 myApp.elem.ansCol.disabled = true;1412 myApp.elem.ansBtn.disabled = true;1413 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1414 },1415 function(){1416 /* 第18問 */1417 myApp.val.ansIndex = 36;1418 myApp.val.ansIndexStartTime = 271.24;1419 //1420 myApp.val.status = myApp.state.Question;1421 myApp.val.numQues = 18;1422 myApp.val.cntPush = 0;1423 myApp.val.correctBool = false;1424 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1425 myApp.elem.ansCol.value = "ここに解答を入力";1426 myApp.elem.ansCol.disabled = true;1427 myApp.elem.ansBtn.disabled = true;1428 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1429 },1430 function(){1431 myApp.val.status = myApp.state.Talk;1432 myApp.elem.ansCol.disabled = true;1433 myApp.elem.ansBtn.disabled = true;1434 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1435 },1436 function(){1437 /* 第19問 */1438 myApp.val.ansIndex = 38;1439 myApp.val.ansIndexStartTime = 287.54;1440 //1441 myApp.val.status = myApp.state.Question;1442 myApp.val.numQues = 19;1443 myApp.val.cntPush = 0;1444 myApp.val.correctBool = false;1445 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1446 myApp.elem.ansCol.value = "ここに解答を入力";1447 myApp.elem.ansCol.disabled = true;1448 myApp.elem.ansBtn.disabled = true;1449 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1450 },1451 function(){1452 myApp.val.status = myApp.state.Talk;1453 myApp.elem.ansCol.disabled = true;1454 myApp.elem.ansBtn.disabled = true;1455 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1456 },1457 function(){1458 /* 第20問 */1459 myApp.val.ansIndex = 40;1460 myApp.val.ansIndexStartTime = 304.24;1461 //1462 myApp.val.status = myApp.state.Question;1463 myApp.val.numQues = 20;1464 myApp.val.cntPush = 0;1465 myApp.val.correctBool = false;1466 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1467 myApp.elem.ansCol.value = "ここに解答を入力";1468 myApp.elem.ansCol.disabled = true;1469 myApp.elem.ansBtn.disabled = true;1470 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1471 },1472 function(){1473 myApp.val.status = myApp.state.Talk;1474 myApp.elem.ansCol.disabled = true;1475 myApp.elem.ansBtn.disabled = true;1476 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1477 },1478 function(){1479 /* 第21問 */1480 myApp.val.ansIndex = 42;1481 myApp.val.ansIndexStartTime = 319.91;1482 //1483 myApp.val.status = myApp.state.Question;1484 myApp.val.numQues = 21;1485 myApp.val.cntPush = 0;1486 myApp.val.correctBool = false;1487 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1488 myApp.elem.ansCol.value = "ここに解答を入力";1489 myApp.elem.ansCol.disabled = true;1490 myApp.elem.ansBtn.disabled = true;1491 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1492 },1493 function(){1494 myApp.val.status = myApp.state.Talk;1495 myApp.elem.ansCol.disabled = true;1496 myApp.elem.ansBtn.disabled = true;1497 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1498 },1499 function(){1500 /* 第22問 */1501 myApp.val.ansIndex = 44;1502 myApp.val.ansIndexStartTime = 332.52;1503 //1504 myApp.val.status = myApp.state.Question;1505 myApp.val.numQues = 22;1506 myApp.val.cntPush = 0;1507 myApp.val.correctBool = false;1508 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1509 myApp.elem.ansCol.value = "ここに解答を入力";1510 myApp.elem.ansCol.disabled = true;1511 myApp.elem.ansBtn.disabled = true;1512 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1513 },1514 function(){1515 myApp.val.status = myApp.state.Talk;1516 myApp.elem.ansCol.disabled = true;1517 myApp.elem.ansBtn.disabled = true;1518 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1519 },1520 function(){1521 /* 第23問 */1522 myApp.val.ansIndex = 46;1523 myApp.val.ansIndexStartTime = 346.66;1524 //1525 myApp.val.status = myApp.state.Question;1526 myApp.val.numQues = 23;1527 myApp.val.cntPush = 0;1528 myApp.val.correctBool = false;1529 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1530 myApp.elem.ansCol.value = "ここに解答を入力";1531 myApp.elem.ansCol.disabled = true;1532 myApp.elem.ansBtn.disabled = true;1533 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1534 },1535 function(){1536 myApp.val.status = myApp.state.Talk;1537 myApp.elem.ansCol.disabled = true;1538 myApp.elem.ansBtn.disabled = true;1539 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1540 },1541 function(){1542 /* 第24問 */1543 myApp.val.ansIndex = 48;1544 myApp.val.ansIndexStartTime = 359.28;1545 //1546 myApp.val.status = myApp.state.Question;1547 myApp.val.numQues = 24;1548 myApp.val.cntPush = 0;1549 myApp.val.correctBool = false;1550 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1551 myApp.elem.ansCol.value = "ここに解答を入力";1552 myApp.elem.ansCol.disabled = true;1553 myApp.elem.ansBtn.disabled = true;1554 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1555 },1556 function(){1557 myApp.val.status = myApp.state.Talk;1558 myApp.elem.ansCol.disabled = true;1559 myApp.elem.ansBtn.disabled = true;1560 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1561 },1562 function(){1563 /* 第25問 */1564 myApp.val.ansIndex = 50;1565 myApp.val.ansIndexStartTime = 374.81;1566 //1567 myApp.val.status = myApp.state.Question;1568 myApp.val.numQues = 25;1569 myApp.val.cntPush = 0;1570 myApp.val.correctBool = false;1571 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1572 myApp.elem.ansCol.value = "ここに解答を入力";1573 myApp.elem.ansCol.disabled = true;1574 myApp.elem.ansBtn.disabled = true;1575 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1576 },1577 function(){1578 myApp.val.status = myApp.state.Talk;1579 myApp.elem.ansCol.disabled = true;1580 myApp.elem.ansBtn.disabled = true;1581 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1582 },1583 function(){1584 /* 第26問 */1585 myApp.val.ansIndex = 52;1586 myApp.val.ansIndexStartTime = 392.68;1587 //1588 myApp.val.status = myApp.state.Question;1589 myApp.val.numQues = 26;1590 myApp.val.cntPush = 0;1591 myApp.val.correctBool = false;1592 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1593 myApp.elem.ansCol.value = "ここに解答を入力";1594 myApp.elem.ansCol.disabled = true;1595 myApp.elem.ansBtn.disabled = true;1596 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1597 },1598 function(){1599 myApp.val.status = myApp.state.Talk;1600 myApp.elem.ansCol.disabled = true;1601 myApp.elem.ansBtn.disabled = true;1602 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1603 },1604 function(){1605 /* 第27問 */1606 myApp.val.ansIndex = 54;1607 myApp.val.ansIndexStartTime = 407.35;1608 //1609 myApp.val.status = myApp.state.Question;1610 myApp.val.numQues = 27;1611 myApp.val.cntPush = 0;1612 myApp.val.correctBool = false;1613 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1614 myApp.elem.ansCol.value = "ここに解答を入力";1615 myApp.elem.ansCol.disabled = true;1616 myApp.elem.ansBtn.disabled = true;1617 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1618 },1619 function(){1620 myApp.val.status = myApp.state.Talk;1621 myApp.elem.ansCol.disabled = true;1622 myApp.elem.ansBtn.disabled = true;1623 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1624 },1625 function(){1626 /* 第28問 */1627 myApp.val.ansIndex = 56;1628 myApp.val.ansIndexStartTime = 420.25;1629 //1630 myApp.val.status = myApp.state.Question;1631 myApp.val.numQues = 28;1632 myApp.val.cntPush = 0;1633 myApp.val.correctBool = false;1634 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1635 myApp.elem.ansCol.value = "ここに解答を入力";1636 myApp.elem.ansCol.disabled = true;1637 myApp.elem.ansBtn.disabled = true;1638 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1639 },1640 function(){1641 myApp.val.status = myApp.state.Talk;1642 myApp.elem.ansCol.disabled = true;1643 myApp.elem.ansBtn.disabled = true;1644 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1645 },1646 function(){1647 /* 第29問 */1648 myApp.val.ansIndex = 58;1649 myApp.val.ansIndexStartTime = 437.49;1650 //1651 myApp.val.status = myApp.state.Question;1652 myApp.val.numQues = 29;1653 myApp.val.cntPush = 0;1654 myApp.val.correctBool = false;1655 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1656 myApp.elem.ansCol.value = "ここに解答を入力";1657 myApp.elem.ansCol.disabled = true;1658 myApp.elem.ansBtn.disabled = true;1659 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1660 },1661 function(){1662 myApp.val.status = myApp.state.Talk;1663 myApp.elem.ansCol.disabled = true;1664 myApp.elem.ansBtn.disabled = true;1665 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1666 },1667 function(){1668 /* 第30問 */1669 myApp.val.ansIndex = 60;1670 myApp.val.ansIndexStartTime = 454.63;1671 //1672 myApp.val.status = myApp.state.Question;1673 myApp.val.numQues = 30;1674 myApp.val.cntPush = 0;1675 myApp.val.correctBool = false;1676 myApp.elem.text.innerHTML = "第"+myApp.val.numQues+"問";1677 myApp.elem.ansCol.value = "ここに解答を入力";1678 myApp.elem.ansCol.disabled = true;1679 myApp.elem.ansBtn.disabled = true;1680 if(Math.abs(window.orientation) != 90){ myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src; }1681 },1682 function(){1683 myApp.val.status = myApp.state.Talk;1684 myApp.elem.ansCol.disabled = true;1685 myApp.elem.ansBtn.disabled = true;1686 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;1687 },1688];16891169000:00:16,240 --> 00:00:26,78016912169200:00:26,780 --> 00:00:30,64016933169400:00:30,640 --> 00:00:40,56016954169600:00:40,560 --> 00:00:43,57016975169800:00:43,570 --> 00:00:52,79016996170000:00:52,790 --> 00:00:55,74017017170200:00:55,740 --> 00:01:07,43017038170400:01:07,430 --> 00:01:11,25017059170600:01:11,250 --> 00:01:21,340170710170800:01:21,340 --> 00:01:24,560170911171000:01:24,560 --> 00:01:35,690171112171200:01:35,690 --> 00:01:39,040171313171400:01:39,040 --> 00:01:49,590171514171600:01:49,590 --> 00:01:52,830171715171800:01:52,830 --> 00:02:04,870171916172000:02:04,870 --> 00:02:07,990172117172200:02:07,990 --> 00:02:20,300172318172400:02:20,300 --> 00:02:23,220172519172600:02:23,220 --> 00:02:34,490172720172800:02:34,490 --> 00:02:37,640172921173000:02:37,640 --> 00:02:50,450173122173200:02:50,450 --> 00:02:54,760173323173400:02:54,760 --> 00:03:02,920173524173600:03:02,920 --> 00:03:06,230173725173800:03:06,230 --> 00:03:16,260173926174000:03:16,260 --> 00:03:20,840174127174200:03:20,840 --> 00:03:31,850174328174400:03:31,850 --> 00:03:36,440174529174600:03:36,440 --> 00:03:47,150174730174800:03:47,150 --> 00:03:50,820174931175000:03:50,820 --> 00:04:01,590175132175200:04:01,590 --> 00:04:05,090175333175400:04:05,090 --> 00:04:13,650175534175600:04:13,650 --> 00:04:16,680175735175800:04:16,680 --> 00:04:31,240175936176000:04:31,240 --> 00:04:35,510176137176200:04:35,510 --> 00:04:47,540176338176400:04:47,540 --> 00:04:51,410176539176600:04:51,410 --> 00:05:04,240176740176800:05:04,240 --> 00:05:07,450176941177000:05:07,450 --> 00:05:19,910177142177200:05:19,910 --> 00:05:23,470177343177400:05:23,470 --> 00:05:32,520177544177600:05:32,520 --> 00:05:35,880177745177800:05:35,880 --> 00:05:46,660177946178000:05:46,660 --> 00:05:49,890178147178200:05:49,890 --> 00:05:59,280178348178400:05:59,280 --> 00:06:02,540178549178600:06:02,540 --> 00:06:14,810178750178800:06:14,810 --> 00:06:19,190178951179000:06:19,190 --> 00:06:32,680179152179200:06:32,680 --> 00:06:36,060179353179400:06:36,060 --> 00:06:47,350179554179600:06:47,350 --> 00:06:50,450179755179800:06:50,450 --> 00:07:00,250179956180000:07:00,250 --> 00:07:03,610180157180200:07:03,610 --> 00:07:17,490180358180400:07:17,490 --> 00:07:22,620180559180600:07:22,620 --> 00:07:34,630180760...

Full Screen

Full Screen

content-1.srt.js

Source:content-1.srt.js Github

copy

Full Screen

100:00:00,000 --> 00:00:37,3402/* CAUTION : Each sections of subtitle has independent scope. */3/* Ver1.0 */4doOnce[index] = true;5player.pauseVideo();6//7const myApp = {8 path : {9 answer : "https://raw.githubusercontent.com/t-yokota/quizBattle/master/contents/lamy_abc_12th/answer-1.csv",10 sound : "https://raw.githubusercontent.com/t-yokota/quizBattle/master/sounds/sounds_3", //+ext;11 btn1 : "https://github.com/t-yokota/quizBattle/raw/master/images/button_1.png",12 btn2 : "https://github.com/t-yokota/quizBattle/raw/master/images/button_2.png",13 btn3 : "https://github.com/t-yokota/quizBattle/raw/master/images/button_3.png",14 btn4 : "https://github.com/t-yokota/quizBattle/raw/master/images/button_4.png",15 },16 state : {17 ButtonCheck : 0, //ボタンチェック待機18 Question : 1, //問い読み中(早押し可能)19 MyAnswer : 2, //自分が解答権を所持(解答入力・送信可能)20 OthAnswer : 3, //他者が解答権を所持(早押し不可能)21 Talk : 4, //その他22 },23 videoState : {24 Playing : 1,25 Stopped : 2,26 },27 elem : {28 text : document.createElement("text"),29 subText : document.createElement("text"),30 ansCol : document.createElement("textarea"),31 ansBtn : document.createElement("button"),32 numOX : document.createElement("text"),33 pushBtn : document.createElement("img"),34 imgBtn1 : document.createElement("img"),35 imgBtn2 : document.createElement("img"),36 imgBtn3 : document.createElement("img"),37 imgBtn4 : document.createElement("img"),38 sounds : document.createElement("audio"),39 paramText : document.createElement("text"),40 //41 divUI : document.createElement('div'),42 divElem : document.createElement('div'),43 divBtn : document.createElement('div'),44 },45 val : {46 srtFuncArray : null, //array of functions that are executed in each subtitle47 viewFuncArray : null, //array of functions for setting view elements48 //49 os : null,50 browser : null,51 //52 touchObject : null,53 //54 audioExt : null,55 audioSpriteData : null,56 //57 loadCount : 0,58 initLoadBool : false,59 loadErrorBool : false,60 loadAlertBool : false,61 //62 initOrientation : null,63 orientationAlertBool : false,64 //65 playingCount : 0,66 pageHiddenBool : false,67 processDelayAlertBool : false,68 //69 composingBool : false,70 //71 disableSeekbarBool : false,72 //73 playerWidth : 0,74 playerHeight : 0,75 pushBtnWidth : 0,76 pushBtnHeight : 0,77 //78 prevPlayerWidth : 0,79 prevPlayerHeight : 0,80 prevClientWidth : 0,81 prevClientHeight : 0,82 //83 elemHeight : 0,84 //85 pushBtnArea : {86 left : 0,87 right : 0,88 top : 0,89 bottom : 0,90 },91 //92 divUIHeight : 0,93 divUIWidth : 0,94 divElemWidth : 0,95 divBtnWidth : 0,96 //97 hidePlayerBool : {98 phone : false,99 other : false,100 },101 //102 /* keycode (for keyboard) */103 space : 32, //push buttion104 enter : 13,105 //106 /* button check param */107 btnCheck : {108 sndInterval : 1500, //[ms]109 playInterval : 3000, //[ms]110 },111 //112 /* for question manegament */113 numQues : 1, //問題番号114 ansArray : [], //正答リスト115 cntO : 0, //正答数116 cntX : 0, //誤答数117 cntPush : 0, //1問あたりの解答回数118 limPush : 1, //1問あたりの上限解答回数119 correctBool : false, //答え合わせ結果(結果に応じて状態遷移)120 ansFile : new XMLHttpRequest(), //正答ファイル.csv121 //122 /* for status management */123 status : null,124 cntIndex : 0, //(index value has current section of subtitle)125 //126 /* for time management */127 ansTime : {128 limit : 20000, //解答制限時間[ms]129 elapsed : 0, //解答経過時間[ms]130 },131 currTime : {132 playing : 0, //be updated during the video is playing133 stopped : 0, //be updated when the video is stopped134 },135 watchedTime : 0, //136 diffTime : 0, //difference between watchedTime and currentTime (for preventing to jump playback position by seekbar)137 //138 ansIndex: 0,139 ansIndexStartTime : 0,140 jumpToAnsBool: false,141 //142 firstQuesStartTime : 0,143 },144};145//146/* get os type */147myApp.val.os = fetchOSType();148myApp.val.browser = fetchBrowserType();149//150/* set id to the elements */151myApp.elem.ansCol.id = 'anscol';152myApp.elem.ansBtn.id = 'ansbtn';153myApp.elem.pushBtn.id = 'pushbtn';154myApp.elem.divUI.id = 'divui';155myApp.elem.divElem.id = 'divelem';156myApp.elem.divBtn.id = 'divbtn';157//158/* set init value to the elements */159myApp.elem.ansCol.value = "ここに解答を入力";160myApp.elem.ansBtn.innerHTML = "1問目まで移動";161myApp.elem.ansCol.disabled = true;162myApp.elem.ansBtn.disabled = true;163myApp.elem.numOX.innerHTML = "⭕️:"+myApp.val.cntO+" ❌:"+myApp.val.cntX;164//165if(myApp.val.os != 'other'){166 myApp.elem.text.innerHTML = "早押しボタンをタップして動画を開始する";167}else{168 myApp.elem.text.innerHTML = "QuizBattle on YouTube";169 /* set tabindex for adding focus */170 myApp.elem.pushBtn.tabIndex = 0;171}172//173/* set initial state (button check) */174myApp.val.status = myApp.state.ButtonCheck;175//176/* VIEW */177resizePlayer();178//179/* set style sheets */180document.styleSheets.item(0).insertRule('html { touch-action: manipulation; }'); //disable double tap gesture181document.styleSheets.item(0).insertRule('body { text-align: center; margin: auto; background: #EFEFEF; }');182document.styleSheets.item(0).insertRule('.blinkImg { animation: blinkImg 0.7s infinite alternate; }');183document.styleSheets.item(0).insertRule('@keyframes blinkImg{ 0% { opacity: 0.3; } 100% { opacity: 1; }}');184document.styleSheets.item(0).insertRule('.blinkText { animation: blinkText 0.7s infinite alternate; }');185document.styleSheets.item(0).insertRule('@keyframes blinkText{ 0% { opacity: 0; } 100% { opacity: 1; }}');186//187/* set elements */188if(myApp.val.os != 'other'){189 myApp.elem.text.style.fontSize = '42px';190 myApp.elem.text.style.lineHeight = '60px';191 myApp.elem.text.style.fontWeight = 'bold';192 myApp.elem.text.style.display = 'block';193 myApp.elem.text.style.marginTop = '32px';194 myApp.elem.text.style.marginBottom = '32px';195 myApp.elem.text.style.padding = '0px 10px';196 myApp.elem.subText.style.fontSize = '42px';197 myApp.elem.subText.style.lineHeight = '60px';198 myApp.elem.subText.style.display = 'block';199 myApp.elem.ansCol.style.fontSize = '50px';200 myApp.elem.ansCol.style.height = '100px';201 myApp.elem.ansCol.style.textAlign = 'center';202 myApp.elem.ansCol.style.marginBottom = '10px';203 myApp.elem.ansCol.style.marginLeft = 'auto';204 myApp.elem.ansCol.style.marginRight = 'auto';205 myApp.elem.ansCol.style.display = 'block'206 myApp.elem.ansBtn.style.fontSize = '42px';207 myApp.elem.ansBtn.style.width = parseInt(myApp.elem.ansBtn.style.fontSize, 10)*10+'px';208 myApp.elem.ansBtn.style.height = parseInt(myApp.elem.ansBtn.style.fontSize, 10)*2+'px';209 myApp.elem.ansBtn.style.marginBottom = '20px';210 myApp.elem.ansBtn.style.marginLeft = 'auto';211 myApp.elem.ansBtn.style.marginRight = 'auto';212 myApp.elem.ansBtn.style.display = 'block';213 myApp.elem.numOX.style.fontSize = '42px';214 myApp.elem.numOX.style.lineHeight = '80px';215 myApp.elem.numOX.style.fontWeight = 'bold';216 myApp.elem.numOX.style.display = 'block';217 //218 myApp.val.elemHeight = (function(e){219 let res = 0;220 res += parseInt(e.text.style.lineHeight, 10);221 res += parseInt(e.text.style.marginTop, 10);222 res += parseInt(e.text.style.marginBottom, 10);223 res += parseInt(e.ansCol.style.height, 10);224 res += parseInt(e.ansCol.style.marginBottom, 10);225 res += parseInt(e.ansBtn.style.height, 10);226 res += parseInt(e.ansBtn.style.marginBottom, 10);227 res += parseInt(e.numOX.style.lineHeight, 10);228 return res229 })(myApp.elem);230 //231 myApp.val.viewFuncArray = [232 function(){233 document.getElementsByTagName("body")[0].appendChild(myApp.elem.text);234 document.getElementsByTagName("body")[0].appendChild(myApp.elem.ansBtn);235 document.getElementsByTagName("body")[0].appendChild(myApp.elem.pushBtn);236 document.getElementsByTagName("body")[0].appendChild(myApp.elem.numOX);237 document.getElementsByTagName("body")[0].appendChild(myApp.elem.paramText);238 },239 function(){240 myApp.elem.text.style.marginTop = '40px';241 myApp.elem.text.style.marginBottom = '20px';242 myApp.elem.subText.style.marginBottom = '40px';243 myApp.elem.subText.style.padding = '0px 10px';244 document.getElementsByTagName("body")[0].insertBefore(myApp.elem.subText, myApp.elem.text.nextSibling);245 },246 function(){247 myApp.elem.text.style.marginTop = '32px';248 myApp.elem.text.style.marginBottom = '32px';249 myApp.elem.text.parentNode.removeChild(myApp.elem.subText);250 document.getElementsByTagName("body")[0].insertBefore(myApp.elem.ansCol, myApp.elem.text.nextSibling);251 },252 ];253 myApp.val.viewFuncArray.shift()();254}else{255 myApp.val.divUIHeight = myApp.val.playerHeight*0.9;256 myApp.val.divUIWidth = myApp.val.playerWidth;257 myApp.val.divElemWidth = myApp.val.playerWidth*2/3;258 myApp.val.divBtnWidth = myApp.val.playerWidth*1/3;259 document.styleSheets.item(0).insertRule('body { width:'+myApp.val.playerWidth+'px; }');260 document.styleSheets.item(0).insertRule('div#divui { width:'+myApp.val.divUIWidth +'px; height:'+myApp.val.divUIHeight+'px; }');261 document.styleSheets.item(0).insertRule('div#divelem { width:'+myApp.val.divElemWidth+'px; height:'+myApp.val.divUIHeight+'px; float: left; display: flex; align-items: center; justify-content: center; flex-direction: column; }');262 document.styleSheets.item(0).insertRule('div#divbtn { width:'+myApp.val.divBtnWidth +'px; height:'+myApp.val.divUIHeight+'px; float: left; display: flex; align-items: center; justify-content: center; }');263 document.getElementsByTagName("body")[0].appendChild(myApp.elem.divUI);264 myApp.elem.divUI.appendChild(myApp.elem.divElem); //divElem is assigned to ('div')[4]265 myApp.elem.divUI.appendChild(myApp.elem.divBtn); //divBtn is assigned to ('div')[5]266 //267 myApp.elem.text.style.fontSize = '25px';268 myApp.elem.text.style.lineHeight = '45px';269 myApp.elem.text.style.fontWeight = 'bold';270 myApp.elem.text.style.display = 'block';271 myApp.elem.subText.style.fontSize = '20px';272 myApp.elem.subText.style.lineHeight = '30px';273 myApp.elem.subText.style.display = 'block';274 myApp.elem.ansCol.style.fontSize = '23px';275 myApp.elem.ansCol.style.textAlign = 'center';276 myApp.elem.ansCol.style.width = myApp.val.divElemWidth*0.75+'px';277 myApp.elem.ansCol.style.margin = '0px ' +(myApp.val.divElemWidth-parseInt(myApp.elem.ansCol.style.width, 10))/2+'px 15px';278 myApp.elem.ansBtn.style.fontSize = '23px';279 myApp.elem.ansBtn.style.width = parseInt(myApp.elem.ansBtn.style.fontSize, 10)*8+'px';280 myApp.elem.ansBtn.style.margin = '0px '+(myApp.val.divElemWidth-parseInt(myApp.elem.ansBtn.style.width, 10))/2+'px 20px';281 myApp.elem.numOX.style.fontSize = '25px';282 myApp.elem.numOX.style.lineHeight = '45px';283 myApp.elem.numOX.style.fontWeight = 'bold';284 myApp.elem.numOX.style.display = 'block';285 //286 myApp.val.viewFuncArray = [287 function(){288 myApp.elem.text.style.margin = '0px auto';289 myApp.elem.text.style.padding = '0px 40px';290 document.getElementsByTagName("div")[4].appendChild(myApp.elem.text);291 document.getElementsByTagName("div")[4].appendChild(myApp.elem.paramText);292 },293 function(){294 myApp.elem.text.style.margin = '0px auto 30px';295 myApp.elem.subText.style.margin = '0px auto 50px';296 myApp.elem.subText.style.padding = '0px 40px';297 document.getElementsByTagName("div")[4].insertBefore(myApp.elem.subText, myApp.elem.text.nextSibling);298 document.getElementsByTagName("div")[5].appendChild(myApp.elem.pushBtn);299 },300 function(){301 document.getElementsByTagName("div")[4].insertBefore(myApp.elem.ansBtn, myApp.elem.subText.nextSibling);302 },303 function(){304 myApp.elem.text.style.margin = '0px auto 15px';305 myApp.elem.text.parentNode.removeChild(myApp.elem.subText);306 document.getElementsByTagName("div")[4].insertBefore(myApp.elem.ansCol, myApp.elem.text.nextSibling);307 document.getElementsByTagName("div")[4].appendChild(myApp.elem.numOX);308 },309 ];310 myApp.val.viewFuncArray.shift()();311}312//313const num_of_materials = 6;314myApp.elem.sounds.onloadedmetadata = function(){ myApp.val.loadCount += 1; };315myApp.elem.imgBtn1.onload = function(){ myApp.val.loadCount += 1; };316myApp.elem.imgBtn2.onload = function(){ myApp.val.loadCount += 1; };317myApp.elem.imgBtn3.onload = function(){ myApp.val.loadCount += 1; };318myApp.elem.imgBtn4.onload = function(){ myApp.val.loadCount += 1; };319myApp.val.ansFile.onload = function(){ myApp.val.loadCount += 1; myApp.val.ansArray = CSVtoArray(myApp.val.ansFile.responseText); };320//321myApp.elem.sounds.onerror = function(){ myApp.val.loadErrorBool = true; };322myApp.elem.imgBtn1.onerror = function(){ myApp.val.loadErrorBool = true; };323myApp.elem.imgBtn2.onerror = function(){ myApp.val.loadErrorBool = true; };324myApp.elem.imgBtn3.onerror = function(){ myApp.val.loadErrorBool = true; };325myApp.elem.imgBtn4.onerror = function(){ myApp.val.loadErrorBool = true; };326myApp.val.ansFile.onerror = function(){ myApp.val.loadErrorBool = true; };327//328/* load audio data */329if (myApp.elem.sounds.canPlayType('audio/mp3') == 'probably'){ myApp.val.audioExt = '.mp3'; }330else if(myApp.elem.sounds.canPlayType('audio/aac') == 'probably'){ myApp.val.audioExt = '.aac'; }331else if(myApp.elem.sounds.canPlayType('audio/wav') == 'probably'){ myApp.val.audioExt = '.wav'; }332else if(myApp.elem.sounds.canPlayType('audio/mp3') == 'maybe' ){ myApp.val.audioExt = '.mp3'; }333else if(myApp.elem.sounds.canPlayType('audio/aac') == 'maybe' ){ myApp.val.audioExt = '.aac'; }334else if(myApp.elem.sounds.canPlayType('audio/wav') == 'maybe' ){ myApp.val.audioExt = '.wav'; }335myApp.elem.sounds.src = myApp.path.sound+myApp.val.audioExt;336//337/* load push button image */338myApp.elem.imgBtn1.src = myApp.path.btn1;339myApp.elem.imgBtn2.src = myApp.path.btn2;340myApp.elem.imgBtn3.src = myApp.path.btn3;341myApp.elem.imgBtn4.src = myApp.path.btn4;342if(myApp.val.os != 'other'){343 myApp.elem.pushBtn.className = "blinkImg";344}345//346/* load answer file */347myApp.val.ansFile.open("get", myApp.path.answer, true);348myApp.val.ansFile.send(null);349//350/* set audio sprite */351myApp.val.audioSpriteData = {352 pushBtn : { start : 0.0, end : 2.0 }, //[sec]353 sndO : { start : 3.0, end : 5.0 }, 354 sndX : { start : 6.0, end : 8.0 },355};356myApp.elem.sounds.addEventListener('timeupdate', spriteHandler, false);357function spriteHandler(){358 if(Math.abs(myApp.val.audioSpriteData.pushBtn.end - this.currentTime) < 0.25){359 this.pause();360 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.pushBtn.start;361 }362 if(Math.abs(myApp.val.audioSpriteData.sndO.end - this.currentTime) < 0.25){363 this.pause();364 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.pushBtn.start;365 }366 if(Math.abs(myApp.val.audioSpriteData.sndX.end - this.currentTime) < 0.25){367 this.pause();368 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.pushBtn.start;369 }370};371//372/* set function executed after initial loading */373myApp.elem.pushBtn.onerror = function(){374 myApp.val.loadErrorBool = true;375 myApp.val.loadAlertBool = true;376 alert("画像の読み込みに失敗しました。ページを再読み込みしてください。" );377};378myApp.elem.pushBtn.onload = function(){379 if(myApp.val.initLoadBool == false){380 /* change player and push button size after loading image */381 resizePlayer();382 resizePushButton();383 myApp.val.initLoadBool = true;384 if(myApp.val.os == 'other'){ myApp.val.viewFuncArray.shift()(); }385 }386};387function materialCheckFunction(){388 if(myApp.val.loadErrorBool == false){389 if(myApp.val.initLoadBool == false && myApp.val.loadCount == num_of_materials){390 myApp.val.loadCount = 0;391 /* assign push button image and main text */392 myApp.elem.pushBtn.width = document.documentElement.clientWidth/5; /* init size before loading */393 if(myApp.val.os != "other"){394 if(Math.abs(window.orientation) != 90){395 myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src;396 myApp.elem.text.innerHTML = "早押しボタンをタップして動画を開始する";397 myApp.val.initOrientation = 'portrait';398 }else{399 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;400 myApp.elem.text.innerHTML = "端末を縦向きにしてクイズをはじめる";401 myApp.val.initOrientation = 'landscape';402 alert("このサイトはスマートフォン/タブレットを縦向きにしてお楽しみください。");403 }404 }else{405 myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src;406 if(detectTouchPanel() == true){407 myApp.elem.subText.innerHTML = "<span class='blinkText'>スペースキーを押して動画を開始する</span>";408 }else{409 myApp.elem.subText.innerHTML = "<span class='blinkText'>スペースキーを押して動画を開始する</span>";410 }411 }412 }else if(myApp.val.initLoadBool == true && myApp.val.loadAlertBool == false){413 if(myApp.val.os != 'other'){414 if(Math.abs(myApp.elem.numOX.getBoundingClientRect().top - myApp.elem.ansBtn.getBoundingClientRect().bottom) < 50){415 myApp.val.loadErrorBool = true;416 myApp.val.loadAlertBool = true;417 player.pauseVideo();418 alert("画像の表示に失敗しました。ページを再読み込みしてください。");419 }420 }421 }422 }else{423 if(myApp.val.loadAlertBool == false){424 myApp.val.loadAlertBool = true;425 alert("ページの読み込みに失敗しました。ページを再読み込みしてください。");426 }427 }428}429//430/* EVENT */431/* orientation change event function */432window.addEventListener('orientationchange', myOrientationChangeEvent);433function myOrientationChangeEvent(){434 setTimeout(function(){435 resizePlayer();436 resizePushButton();437 if(myApp.val.status == myApp.state.MyAnswer){438 if(myApp.val.hidePlayerBool.phone == true){439 hidePlayer();440 }441 }442 if(Math.abs(window.orientation) != 90){443 if(myApp.val.status == myApp.state.MyAnswer){444 myApp.elem.pushBtn.src = myApp.elem.imgBtn3.src;445 }else{446 myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src;447 }448 if(myApp.val.status == myApp.state.ButtonCheck){449 myApp.elem.text.innerHTML = "早押しボタンをタップして動画を開始する";450 }451 }else{452 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;453 if(myApp.val.status == myApp.state.ButtonCheck){454 myApp.elem.text.innerHTML = "端末を縦向きにしてクイズをはじめる";455 }456 if(myApp.val.orientationAlertBool == false && myApp.val.initOrientation == 'portrait'){457 myApp.val.playingCount = -10;458 myApp.val.orientationAlertBool = true;459 alert("このサイトはスマートフォン/タブレットを縦向きにしてお楽しみください。");460 }461 }462 }, 800);463}464//465/* page hidden check event function */466document.addEventListener('webkitvisibilitychange', myPageHiddenCheckEvent, false);467function myPageHiddenCheckEvent(){468 if(document.webkitHidden){469 myApp.val.pageHiddenBool = true;470 // console.log('Hidden.');471 }else{472 myApp.val.pageHiddenBool = false;473 myApp.val.currTime.playing = player.getCurrentTime();474 myApp.val.watchedTime = myApp.val.currTime.playing;475 myApp.val.playingCount = 0;476 // console.log('Opened.');477 }478}479//480/* keydown event function */481document.onkeydown = myKeyDownEvent;482//483document.addEventListener("compositionstart", function(){ myApp.val.composingBool = true; });484document.addEventListener('compositionend', function(){ myApp.val.composingBool = false; });485function myKeyDownEvent(){486 if(myApp.val.loadErrorBool == false && myApp.val.initLoadBool == true && Math.abs(window.orientation) != 90){487 if(event.keyCode == myApp.val.space){488 myButtonAction();489 }490 /* prevent to start new line in text area */491 if(event.keyCode == myApp.val.enter){492 if(myApp.val.composingBool == false){493 return false;494 }495 }496 }497}498//499/* touchstart event function (for smartphonea and tablet) */500document.addEventListener("touchstart", myTouchEvent);501function myTouchEvent(event){502 if(myApp.val.loadErrorBool == false && myApp.val.initLoadBool == true && Math.abs(window.orientation) != 90){503 myApp.val.touchObject = event.changedTouches[0];504 if(myApp.val.pushBtnArea.left < myApp.val.touchObject.pageX && myApp.val.touchObject.pageX < myApp.val.pushBtnArea.right){505 if(myApp.val.pushBtnArea.top < myApp.val.touchObject.pageY && myApp.val.touchObject.pageY < myApp.val.pushBtnArea.bottom){506 myButtonAction();507 }508 }509 }510}511//512/* common button action */513function myButtonAction(){514 if(myApp.val.status == myApp.state.ButtonCheck){515 myApp.val.status = myApp.state.Talk;516 myApp.elem.pushBtn.className = "";517 buttonCheck(myApp.val.btnCheck.sndInterval);518 setTimeout(function(){519 player.playVideo();520 myApp.elem.ansBtn.disabled = false;521 if(myApp.val.os != 'other'){522 myApp.val.viewFuncArray.shift()();523 myApp.elem.text.innerHTML = "< 遊び方 >";524 myApp.elem.subText.innerHTML = "画面上の早押しボタンで<br>動画内のクイズに参加することができます";525 }else{526 myApp.val.viewFuncArray.shift()();527 myApp.elem.text.innerHTML = "< 遊び方 >"528 myApp.elem.subText.innerHTML = "スペースキーを早押しボタンにして<br>動画内のクイズに参加することができます";529 }530 }, myApp.val.btnCheck.playInterval);531 }532 if(myApp.val.status == myApp.state.Question){533 myApp.val.status = myApp.state.MyAnswer;534 player.pauseVideo();535 pushButton();536 }537}538//539/* player's state change event function */540player.addEventListener('onStateChange', myPlayerStateChangeEvent);541function myPlayerStateChangeEvent(){542 if(player.getPlayerState() == myApp.videoState.Playing){543 myApp.val.currTime.playing = player.getCurrentTime();544 myApp.val.watchedTime = updateWatchedTime(myApp.val.currTime.playing, myApp.val.watchedTime);545 /* check answer if the video is restarted manually without sending answer */546 if(myApp.val.status == myApp.state.MyAnswer){547 player.pauseVideo();548 checkAnswer();549 if(myApp.val.correctBool == true || myApp.val.limPush - myApp.val.cntPush == 0){550 myApp.val.status = myApp.state.Talk;551 }else{552 myApp.val.status = myApp.state.Question;553 }554 player.playVideo();555 }556 if(myApp.val.disableSeekbarBool == true){557 /* prevent to jump playback position by seekbar */558 if(myApp.val.status == myApp.state.Question){559 myApp.val.diffTime = Math.abs(myApp.val.currTime.playing - myApp.val.watchedTime);560 if(myApp.val.diffTime > 1.0){561 player.seekTo(myApp.val.watchedTime);562 }563 }else{564 myApp.val.diffTime = Math.abs(myApp.val.currTime.playing - myApp.val.watchedTime);565 // myApp.val.diffTime = myApp.val.currTime.playing - myApp.val.watchedTime; /* allow to jump to previous positon on timeline */566 if(myApp.val.diffTime > 1.0){567 player.seekTo(myApp.val.watchedTime);568 }569 }570 }571 }572 if(player.getPlayerState() == myApp.videoState.Stopped){573 myApp.val.currTime.stopped = player.getCurrentTime();574 if(myApp.val.disableSeekbarBool == true){575 /* prevent to jump video playback position by seekbar */576 /* and prevent to pause video during each question */577 if(myApp.val.status == myApp.state.Question || myApp.val.status == myApp.state.OthAnswer){578 myApp.val.diffTime = Math.abs(myApp.val.currTime.stopped - myApp.val.watchedTime);579 if(myApp.val.diffTime > 1.0){580 player.seekTo(myApp.val.watchedTime);581 }582 player.playVideo();583 }else{584 myApp.val.diffTime = Math.abs(myApp.val.currTime.stopped - myApp.val.watchedTime);585 // myApp.val.diffTime = myApp.val.currTime.stopped - myApp.val.watchedTime; /* allow to jump to previous position on timeline */586 if(myApp.val.diffTime > 1.0){587 player.seekTo(myApp.val.watchedTime);588 player.playVideo(); /* allow to pause video except during the question status */589 }590 // player.playVideo();591 }592 }593 }594}595//596/* interval event function that are executed at a certain interval */597setInterval(myIntervalEvent, interval = 10);598function myIntervalEvent(){599 if(myApp.val.pageHiddenBool == false){600 if(player.getPlayerState() == myApp.videoState.Playing){601 myApp.val.currTime.playing = player.getCurrentTime();602 myApp.val.watchedTime = updateWatchedTime(myApp.val.currTime.playing, myApp.val.watchedTime);603 if(myApp.val.disableSeekbarBool == true){604 /* check delay of processing */605 if(myApp.val.playingCount < 0 ){ myApp.val.watchedTime = myApp.val.currTime.playing; } // fix delay of watchedTime caused by showing orientation alert.606 if(myApp.val.playingCount < 10){ myApp.val.playingCount += 1; } // allow initial delay of watchedTime just after playing video.607 if(myApp.val.currTime.playing - myApp.val.watchedTime > 1.0 && myApp.val.playingCount >= 10){608 if(myApp.val.processDelayAlertBool == false){609 myApp.val.processDelayAlertBool = true;610 alert('ページ内の処理が遅くなっています。早押しの判定に支障が出る可能性があるため、他のプロセスを終了してから改めてクイズをお楽しみください。このポップアップは一度のみ表示されます。');611 }612 myApp.val.watchedTime = myApp.val.currTime.playing;613 }614 }615 /* prevent to play video before button check */616 if(myApp.val.status == myApp.state.ButtonCheck){617 player.pauseVideo();618 }619 /* execute srt function in each sections of subtitle */620 if(myApp.val.status != myApp.state.MyAnswer){621 if(myApp.val.disableSeekbarBool == true){622 if(index - myApp.val.cntIndex == 1){623 myApp.val.srtFuncArray.shift()();624 myApp.val.cntIndex += 1;625 }626 }else{627 if(index - myApp.val.cntIndex >= 1){628 for(let i = 0; i < index-myApp.val.cntIndex; i++){629 myApp.val.srtFuncArray.shift()();630 }631 myApp.val.cntIndex = index;632 // console.log(myApp.val.cntIndex);633 }634 }635 }636 }else if(player.getPlayerState() == myApp.videoState.Stopped){637 myApp.val.playingCount = 0;638 }639 if(myApp.val.status == myApp.state.ButtonCheck){640 if(myApp.val.cntIndex > 0 && myApp.val.loadAlertBool == false){641 myApp.val.loadErrorBool = true;642 myApp.val.loadAlertBool = true;643 player.pauseVideo();644 alert('ページの読み込みに失敗しました。ページを再読み込みしてください。');645 }646 }647 if(myApp.val.status == myApp.state.MyAnswer){648 /* reforcus when anscol is blank */649 // if(document.activeElement.id != "anscol" && myApp.elem.ansCol.value.valueOf() === ""){650 // myApp.elem.ansCol.focus();651 // }652 /* answer time managemant */653 if(document.activeElement.id == "anscol" || myApp.val.ansTime.elapsed != 0){654 myApp.val.ansTime.elapsed += interval;655 myApp.elem.text.innerHTML = "のこり"+Math.floor((myApp.val.ansTime.limit-myApp.val.ansTime.elapsed)/1000+1)+"秒";656 if(myApp.val.ansTime.elapsed >= myApp.val.ansTime.limit){657 checkAnswer();658 if(myApp.val.correctBool == true || myApp.val.limPush - myApp.val.cntPush == 0){659 myApp.val.status = myApp.state.Talk;660 }else{661 myApp.val.status = myApp.state.Question;662 }663 player.playVideo();664 }665 }666 }else{667 if(myApp.val.os == 'other' && document.activeElement.id == "player"){668 /* preparation of js keydown event */669 instantFocusToElement(myApp.elem.pushBtn);670 }671 myApp.val.ansTime.elapsed = 0;672 }673 /* check results of importing material */674 materialCheckFunction();675 /* update push button area (mainly for when the window is zoomed in iOS)*/676 updatePushButtonArea();677 /* print parameters for debug */678 printParams();679 }680}681//682/* onclick event function of send answer button */683myApp.elem.ansBtn.onclick = myOnClickEvent;684function myOnClickEvent(){685 /* jump to init question */686 if(index == 0){687 let tmpTime = myApp.val.firstQuesStartTime-0.1;688 if(myApp.val.currTime.playing < tmpTime){689 myApp.elem.ansBtn.disabled = true;690 myApp.val.watchedTime = tmpTime;691 player.seekTo(tmpTime);692 }693 }694 /* send answer */695 if(myApp.val.status == myApp.state.MyAnswer){696 checkAnswer();697 if(myApp.val.correctBool == true || myApp.val.limPush - myApp.val.cntPush == 0){698 myApp.val.status = myApp.state.Talk;699 }else{700 myApp.val.status = myApp.state.Question;701 }702 player.playVideo();703 }704}705//706/* onfocus event function of answer column */707myApp.elem.ansCol.onfocus = function(){ myApp.elem.ansCol.val = ""; }708//709/* FUNCTION */710function detectTouchPanel(){711 return window.ontouchstart === null;712}713//714function fetchOSType(){715 let osType = null;716 const ua = navigator.userAgent;717 if(ua.match(/Android/)){718 osType = "Android";719 return osType;720 }else if(ua.match(/iPhone/)) {721 osType = "iOS"; // iPhone OS722 return osType;723 }else if(ua.match(/iPad/)) {724 osType = "iOS"; // iPad OS725 return osType;726 }else if(ua.match(/Macintosh/) && detectTouchPanel() == true){727 osType = 'iOS'; // iPad OS with Safari728 return osType;729 }else{730 osType = "other";731 return osType;732 }733}734//735function fetchBrowserType(){736 let bwType = null;737 const ua = navigator.userAgent;738 if(ua.match(/Firefox/)){739 bwType = "Firefox";740 return bwType;741 }else if(ua.match(/EdgiOS/) || ua.match(/EdgA/)){742 bwType = "Edge";743 return bwType;744 }else if(ua.match(/OPR/)){745 bwType = "Opera";746 return bwType;747 }else if(ua.match(/OPT/)){748 bwType = "OperaTouch";749 return bwType;750 }else if(ua.match(/YJApp/)){751 bwType = "Yahoo";752 return bwType;753 }else if(ua.match(/Smooz/)){754 bwType = "Smooz";755 return bwType;756 }else if(ua.match(/CriOS/) || ua.match(/Chrome/)){757 //Chrome or Others ...758 bwType = "Chrome";759 return bwType;760 }else{761 //Safari, Firefox(iOS), Brave or Others ...762 bwType = "Other";763 return bwType;764 }765}766/**767 * @param {string} str768 * @returns {array} (rows: num of question, columns: num of patterns of answer)769 */770function CSVtoArray(str){771 const array = new Array();772 const tmp = str.split("\r\n");773 for(let i = 0; i < tmp.length; i++){774 array[i] = tmp[i].split(",");775 }776 return array;777}778//779function resizePlayer(){780 if(myApp.val.os != 'other'){781 if(Math.abs(window.orientation) != 90){782 // myApp.val.playerWidth = document.documentElement.clientWidth;783 if(myApp.val.os == 'Android'){ myApp.val.playerWidth = window.innerWidth; } // In Android, clientWidth doesn't include scrollbar.784 if(myApp.val.os == 'iOS'){ myApp.val.playerWidth = document.documentElement.clientWidth; } // In iOS, innerWidth isn't static (it changes with device orientation).785 myApp.val.playerHeight = myApp.val.playerWidth/16*9;786 }else{787 myApp.val.playerWidth = document.documentElement.clientWidth*2/3;788 myApp.val.playerHeight = myApp.val.playerWidth/16*9;789 }790 /* set special width of anscol to prevent the window is zoomed when the focus moveds to anscol */791 if(myApp.val.os == 'Android' && myApp.val.browser == "Firefox"){792 myApp.elem.ansCol.style.width = myApp.val.playerWidth*0.98+'px';793 }else{794 myApp.elem.ansCol.style.width = myApp.val.playerWidth*0.9+'px';795 }796 }else{797 const tmpPlayerHeight = document.documentElement.clientHeight/2;798 const tmpPlayerWidth = tmpPlayerHeight/9*16;799 if(tmpPlayerWidth < document.documentElement.clientWidth){800 myApp.val.playerHeight = tmpPlayerHeight;801 myApp.val.playerWidth = tmpPlayerWidth;802 }else{803 myApp.val.playerWidth = document.documentElement.clientWidth;804 myApp.val.playerHeight = myApp.val.playerWidth/16*9;805 }806 }807 if(myApp.val.initLoadBool == false || myApp.val.prevPlayerWidth != myApp.val.playerWidth){808 player.setSize(myApp.val.playerWidth, myApp.val.playerHeight);809 //810 myApp.val.prevPlayerWidth = myApp.val.playerWidth;811 myApp.val.prevPlayerHeight = myApp.val.playerHeight;812 }813}814//815function resizePushButton(){816 if(myApp.val.os != "other"){817 if(Math.abs(window.orientation) != 90){818 const tmpImgHeight = document.documentElement.clientHeight-myApp.val.playerHeight-myApp.val.elemHeight-20;819 const tmpImgWidth = myApp.elem.pushBtn.naturalWidth*tmpImgHeight/myApp.elem.pushBtn.naturalHeight;820 if(tmpImgWidth < document.documentElement.clientWidth){821 if(tmpImgHeight <= myApp.val.playerHeight){822 myApp.val.pushBtnWidth = tmpImgWidth;823 myApp.val.pushBtnHeight = tmpImgHeight;824 }else{825 myApp.val.pushBtnWidth = myApp.elem.pushBtn.naturalWidth*myApp.val.playerHeight*1.25/myApp.elem.pushBtn.naturalHeight;826 myApp.val.pushBtnHeight = myApp.val.playerHeight*1.25;827 }828 }else{829 myApp.val.pushBtnWidth = document.documentElement.clientWidth/5;830 myApp.val.pushBtnHeight = myApp.elem.pushBtn.naturalHeight*myApp.val.pushBtnWidth/myApp.elem.pushBtn.naturalWidth;831 }832 }else{833 myApp.val.pushBtnWidth = document.documentElement.clientWidth/5;834 myApp.val.pushBtnHeight = myApp.elem.pushBtn.naturalHeight*myApp.val.pushBtnWidth/myApp.elem.pushBtn.naturalWidth;835 }836 myApp.elem.pushBtn.style.margin = 'auto '+(document.documentElement.clientWidth-myApp.val.pushBtnWidth)/2+'px';837 }else{838 myApp.val.pushBtnWidth = myApp.val.divBtnWidth;839 myApp.val.pushBtnHeight = myApp.elem.pushBtn.naturalHeight*myApp.val.pushBtnWidth/myApp.elem.pushBtn.naturalWidth;840 } 841 if(myApp.val.initLoadBool == false || myApp.val.prevClientHeight != document.documentElement.clientHeight){842 myApp.elem.pushBtn.width = myApp.val.pushBtnWidth;843 myApp.elem.pushBtn.height = myApp.val.pushBtnHeight;844 updatePushButtonArea();845 //846 myApp.val.prevClientWidth = document.documentElement.clientWidth;847 myApp.val.prevClientHeight = document.documentElement.clientHeight;848 }849}850//851function updatePushButtonArea(){852 myApp.val.pushBtnArea.left = myApp.elem.pushBtn.getBoundingClientRect().left;853 myApp.val.pushBtnArea.right = myApp.elem.pushBtn.getBoundingClientRect().right;854 myApp.val.pushBtnArea.top = myApp.elem.pushBtn.getBoundingClientRect().top;855 myApp.val.pushBtnArea.bottom = myApp.elem.pushBtn.getBoundingClientRect().bottom;856 //857 /* In iOS, value of getBoundingClientRect is changed when the window is zoomed */858 if(myApp.val.os == 'iOS'){859 myApp.val.pushBtnArea.left += window.pageXOffset;860 myApp.val.pushBtnArea.right += window.pageXOffset;861 myApp.val.pushBtnArea.top += window.pageYOffset;862 myApp.val.pushBtnArea.bottom += window.pageYOffset;863 }864}865//866function instantFocusToElement(focusUsableElement){867 /* keydown event is ready during the focus is in a js element */868 focusUsableElement.disabled = false;869 focusUsableElement.focus();870 focusUsableElement.blur();871 focusUsableElement.disabled = true;872}873//874function updateWatchedTime(currentPlayingTime, watchedTime){875 if(0.0 < currentPlayingTime - watchedTime && currentPlayingTime - watchedTime < 1.0){876 watchedTime = currentPlayingTime;877 }878 return watchedTime;879}880//881function playSndPushBtn(){882 if(myApp.elem.sounds.currentTime != myApp.val.audioSpriteData.pushBtn.start){883 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.pushBtn.start;884 }885 myApp.elem.sounds.play();886}887//888function playSndO(){889 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.sndO.start;890 myApp.elem.sounds.play();891}892//893function playSndX(){894 myApp.elem.sounds.currentTime = myApp.val.audioSpriteData.sndX.start;895 myApp.elem.sounds.play();896}897//898function hidePlayer(){899 player.setSize(myApp.val.playerWidth, 0);900}901//902function opposePlayer(){903 player.setSize(myApp.val.playerWidth, myApp.val.playerHeight);904}905//906function buttonCheck(responseInterval){907 playSndPushBtn();908 if(myApp.val.os == 'iOS'){909 myApp.elem.pushBtn.src = myApp.elem.imgBtn3.src;910 }else{911 myApp.elem.pushBtn.src = myApp.elem.imgBtn2.src;912 setTimeout(function(){ myApp.elem.pushBtn.src = myApp.elem.imgBtn3.src; }, 100);913 }914 setTimeout(function(){915 playSndO();916 myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src;917 }, responseInterval);918}919//920function pushButton(){921 // hide player during answer.922 if(myApp.val.os != 'other'){923 if(myApp.val.hidePlayerBool.phone == true){924 hidePlayer();925 }926 }else{927 if(myApp.val.hidePlayerBool.other == true){928 hidePlayer();929 }930 }931 playSndPushBtn();932 if(myApp.val.os == 'iOS'){933 myApp.elem.pushBtn.src = myApp.elem.imgBtn3.src;934 if(myApp.val.browser == 'Chrome' || myApp.val.browser == 'Edge' || myApp.val.browser == 'Smooz'){935 setTimeout(function(){ focusToAnsCol(); }, 500); // In above browsers, focus() doesn't work by the script below.936 }else{937 focusToAnsCol(); // In iOS, focus() doesn't work properly in setTimeout (keyboard doesn't appear).938 }939 }else{940 myApp.elem.pushBtn.src = myApp.elem.imgBtn2.src;941 setTimeout(function(){ myApp.elem.pushBtn.src = myApp.elem.imgBtn3.src; }, 100); 942 setTimeout(function(){ focusToAnsCol(); }, 500);943 }944 myApp.val.cntPush = myApp.val.cntPush+1;945}946//947function focusToAnsCol(){948 myApp.elem.ansBtn.disabled = false;949 myApp.elem.ansCol.disabled = false;950 myApp.elem.ansCol.value = "";951 myApp.elem.ansCol.focus();952}953//954function checkAnswer(){955 myApp.val.correctBool = false;956 myApp.elem.ansCol.blur();957 myApp.elem.ansCol.disabled = true;958 myApp.elem.ansBtn.disabled = true;959 const answer = myApp.elem.ansCol.value;960 const length = myApp.val.ansArray[myApp.val.numQues-1].length;961 for(let i = 0; i < length; i++){962 if(answer.valueOf() === myApp.val.ansArray[myApp.val.numQues-1][i].valueOf()){963 myApp.val.correctBool = true;964 }965 }966 if(myApp.val.correctBool == true){967 playSndO();968 myApp.val.cntO += 1;969 myApp.elem.text.innerHTML = "正解!";970 if(myApp.val.jumpToAnsBool){ jumpToAnswerIndex(myApp.val.ansIndex, myApp.val.ansIndexStartTime); }971 }else{972 playSndX();973 myApp.val.cntX += 1;974 myApp.elem.text.innerHTML = "不正解!"; //あと"+(myApp.val.limPush-myApp.val.cntPush)+"回解答できます。";975 if(myApp.val.jumpToAnsBool){ jumpToAnswerIndex(myApp.val.ansIndex, myApp.val.ansIndexStartTime); }976 }977 myApp.elem.numOX.innerHTML = "⭕️:"+myApp.val.cntO+" ❌:"+myApp.val.cntX;978 if(window.orientation != 90){979 if(myApp.val.correctBool == false && myApp.val.limPush - myApp.val.cntPush == 0){980 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;981 }else{982 myApp.elem.pushBtn.src = myApp.elem.imgBtn1.src;983 }984 }else{985 myApp.elem.pushBtn.src = myApp.elem.imgBtn4.src;986 }987 // oppose player after answer.988 if(myApp.val.os != 'other'){989 if(myApp.val.hidePlayerBool.phone == true){990 opposePlayer();991 }992 }else{993 if(myApp.val.hidePlayerBool.other == true){994 opposePlayer();995 }996 }997}998//999function jumpToAnswerIndex(index, time){1000 myApp.val.cntIndex = index-1;1001 myApp.val.watchedTime = time-0.1;1002 player.seekTo(time-0.1);1003}1004//1005function printParams(){1006 // myApp.elem.paramText.innerHTML = "timePlay: " + myApp.val.currTime.playing.toFixed(3)+"<br>"+1007 // "timeStop: " +myApp.val.currTime.stopped.toFixed(3)+"<br>"+1008 // "WatchedTime: " + myApp.val.watchedTime.toFixed(3)+"<br>"+1009 // "diffTime: " + myApp.val.diffTime.toFixed(3);1010 // myApp.elem.paramText.innerHTML = myApp.val.browser;1011 // myApp.elem.paramText.innerHTML = myApp.val.os + ', ' + navigator.userAgent;1012 // myApp.elem.paramText.innerHTML = document.styleSheets.item(0).cssRules;1013 // myApp.elem.subText.innerHTML = "sounds.currentTime: " + Math.abs(Math.floor(myApp.elem.sounds.currentTime*1000)/1000);1014 // myApp.elem.subText.innerHTML = Math.floor(myApp.val.touchObject.pageX) +', '+ Math.floor(myApp.val.touchObject.pageY) +' '+1015 // '[' + Math.floor(myApp.val.pushBtnArea.left) +', '+ Math.floor(myApp.val.pushBtnArea.right) +'] '+1016 // '[' + Math.floor(myApp.val.pushBtnArea.top) +', '+ Math.floor(myApp.val.pushBtnArea.bottom)+'] '+1017 // '| '+ window.pageXOffset +', '+ window.pageYOffset;1018 // myApp.elem.subText.innerHTML = myApp.elem.numOX.getBoundingClientRect().top - myApp.elem.ansBtn.getBoundingClientRect().bottom;1019 // myApp.elem.subText.innerHTML = 'loadErrorBool: ' + myApp.val.loadErrorBool + ', initLoadBool: ' + myApp.val.initLoadBool + ', loadCount: ' + myApp.val.loadCount;1020 // myApp.elem.subText.innerHTML = 'playerWidth: ' + myApp.val.playerWidth + ', innerWidth: ' + window.innerWidth;1021 // myApp.elem.paramText.innerHTML = "<br>"+ 1022 // "device: " + myApp.val.os+"<br>"+1023 // "browser: " + myApp.val.browser+"<br>"+1024 // "activeElem: " + document.activeElement.id+"<br>"+ 1025 // "status: " + myApp.val.status+"<br>"+1026 // "timePlay: " + myApp.val.currTime.playing.toFixed(3)+"<br>"+1027 // "timeStop: " + myApp.val.currTime.stopped.toFixed(3)+"<br>"+1028 // "WatchedTime: " + myApp.val.watchedTime.toFixed(3)+"<br>"+1029 // "diffTime: " + myApp.val.diffTime.toFixed(3)+"<br>"+1030 // "limPush: " + myApp.val.limPush+"<br>"+ 1031 // "cntPush: " + myApp.val.cntPush+"<br>"+1032 // "remainingAnsTime: " + Math.floor((myApp.val.ansTime.limit-myApp.val.ansTime.elapsed)/1000)+"<br>"+1033 // "answer: " + myApp.val.ansArray[myApp.val.numQues-1][0].valueOf()+", "+1034 // myApp.val.ansArray[myApp.val.numQues-1][1].valueOf()+", "+1035 // myApp.val.ansArray[myApp.val.numQues-1][2].valueOf()+", "+1036 // myApp.val.ansArray[myApp.val.numQues-1][3].valueOf()+", "+1037 // myApp.val.ansArray[myApp.val.numQues-1][4].valueOf()+", "+1038 // myApp.val.ansArray[myApp.val.numQues-1][5].valueOf()+"<br>"+1039 // "numAnswer: " + myApp.val.ansArray.length+"<br>"+1040 // "answerLength: " + myApp.val.ansArray[myApp.val.numQues-1].length+"<br>"+1041 // "correctBool: " + myApp.val.correctBool+"<br>"+1042 // "composing: " + myApp.val.composingBool+"<br>"+1043 // "index: " + index+"<br>"+1044 // "cntIndex: " + myApp.val.cntIndex+"<br>"+1045 // "cssRules: " + document.styleSheets.item(0).cssRules.item(0).selectorText;1046}1047//1048//---------------------------------------------------------------------------------------------------------------1049/* set functions executed in each subtitle */1050myApp.val.jumpToAnsBool = true;1051myApp.val.disableSeekbarBool = false;1052myApp.val.hidePlayerBool.phone = true;1053myApp.val.hidePlayerBool.other = false;1054myApp.val.firstQuesStartTime = 36;1055myApp.val.srtFuncArray = [1056 function(){1057 myApp.val.viewFuncArray.shift()();1058 myApp.elem.ansBtn.innerHTML = "解答を送信";1059 /* 第1問 */1060 myApp.val.ansIndex = 2;1061 myApp.val.ansIndexStartTime = 47.86;1062 //1063 myApp