From 94a7ea581cafc69806900c227f72b2525f4f7a0c Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sun, 9 Dec 2018 23:44:57 +0100 Subject: [PATCH] Some performance fixes (lol) --- docs/index.html | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/docs/index.html b/docs/index.html index fc74348..374ad16 100644 --- a/docs/index.html +++ b/docs/index.html @@ -37,19 +37,26 @@ var data=[]; var good=-1; - var reader = new FileReader(); - reader.onload = function(progressEvent){ - // By lines - var lines = this.result.split('\n'); - for(var i = 0; i < lines.length; i++){ - var line = lines[i]; - data[i] = line.split('\t'); - if(data[i].length<3) data.splice(i, 1); - } - getPhrase(); - }; - getFile(reader); - + var loaded=false; //For some reason previously loaded videos are kept so loading takes some time + function doLoad() { + if(loaded) return; + loaded=true; + var reader = new FileReader(); + reader.onload = function(progressEvent){ + // By lines + var lines = this.result.split('\n'); + for(var i = 0; i < lines.length; i++){ + var line = lines[i]; + data[i] = line.split('\t'); + 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() { var val=document.getElementById("response").value; if(val<0) return; @@ -114,7 +121,7 @@

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?

Score: 20

-

Please enable JavaScript :P

+

Please enable JavaScript or wait :P

@@ -125,13 +132,13 @@

Your response:

-