Some performance fixes (lol)
This commit is contained in:
parent
684fa5dbc1
commit
94a7ea581c
1 changed files with 23 additions and 16 deletions
|
@ -37,18 +37,25 @@
|
||||||
|
|
||||||
var data=[];
|
var data=[];
|
||||||
var good=-1;
|
var good=-1;
|
||||||
var reader = new FileReader();
|
var loaded=false; //For some reason previously loaded videos are kept so loading takes some time
|
||||||
reader.onload = function(progressEvent){
|
function doLoad() {
|
||||||
// By lines
|
if(loaded) return;
|
||||||
var lines = this.result.split('\n');
|
loaded=true;
|
||||||
for(var i = 0; i < lines.length; i++){
|
var reader = new FileReader();
|
||||||
var line = lines[i];
|
reader.onload = function(progressEvent){
|
||||||
data[i] = line.split('\t');
|
// By lines
|
||||||
if(data[i].length<3) data.splice(i, 1);
|
var lines = this.result.split('\n');
|
||||||
}
|
for(var i = 0; i < lines.length; i++){
|
||||||
getPhrase();
|
var line = lines[i];
|
||||||
};
|
data[i] = line.split('\t');
|
||||||
getFile(reader);
|
if(data[i].length<3) data.splice(i, 1);
|
||||||
|
}
|
||||||
|
getPhrase();
|
||||||
|
};
|
||||||
|
getFile(reader);
|
||||||
|
}
|
||||||
|
window.onload = ()=>doLoad();
|
||||||
|
doLoad(); //So let's try loading ASAP, and if that fails then wait for the load event
|
||||||
|
|
||||||
function checkResp() {
|
function checkResp() {
|
||||||
var val=document.getElementById("response").value;
|
var val=document.getElementById("response").value;
|
||||||
|
@ -114,7 +121,7 @@
|
||||||
<p>So you know those "info sections" in most of Tiffany's videos? Here you can see a word, phrase or sometimes a
|
<p>So you know those "info sections" in most of Tiffany's videos? Here you can see a word, phrase or sometimes a
|
||||||
sentence to comment on one of the videos. Can you guess which video it belongs to?</p>
|
sentence to comment on one of the videos. Can you guess which video it belongs to?</p>
|
||||||
<h4>Score: <span id="score">20</span></h4>
|
<h4>Score: <span id="score">20</span></h4>
|
||||||
<h3 id="phrase">Please enable JavaScript :P</h3>
|
<h3 id="phrase">Please enable JavaScript or wait :P</h3>
|
||||||
<select id="response" style="max-width: 500px">
|
<select id="response" style="max-width: 500px">
|
||||||
<option value="-1" default>-- Choose a video --</option>
|
<option value="-1" default>-- Choose a video --</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -125,13 +132,13 @@
|
||||||
<h3 id="resultH"></h3>
|
<h3 id="resultH"></h3>
|
||||||
<p id="resultP"></p>
|
<p id="resultP"></p>
|
||||||
<p>Your response:</p>
|
<p>Your response:</p>
|
||||||
<iframe id="respyt" width="496" height="279" src="https://www.youtube.com/embed/" frameborder="0"
|
<iframe id="respyt" width="496" height="279" src="about:blank" frameborder="0"
|
||||||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||||
allowfullscreen></iframe>
|
allowfullscreen></iframe>
|
||||||
</div>
|
</div>
|
||||||
<div id="goodBlock" style="display: none">
|
<div id="goodBlock" style="display: none">
|
||||||
<p>Correct video:</p>
|
<p>Correct video:</p>
|
||||||
<iframe id="goodyt" width="496" height="279" src="https://www.youtube.com/embed/" frameborder="0"
|
<iframe id="goodyt" width="496" height="279" src="about:blank" frameborder="0"
|
||||||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||||
allowfullscreen></iframe>
|
allowfullscreen></iframe>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue