Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var q1a,q2a,q3a,q4a,q5a,q6a,q7a,q8a,q9a,q10a,q11a,q12a,q13a,q14a,q15a = false;
- var progress = 0;
- var current_time = Date.parse(new Date());
- var deadline = new Date(current_time + 15*60*1000);
- function increaseProgress(question) {
- if (question == 1 && q1a != true) progress++;
- if (question == 2 && q2a != true) progress++;
- if (question == 3 && q3a != true) progress++;
- if (question == 4 && q4a != true) progress++;
- if (question == 5 && q5a != true) progress++;
- if (question == 6 && q6a != true) progress++;
- if (question == 7 && q7a != true) progress++;
- if (question == 8 && q8a != true) progress++;
- if (question == 9 && q9a != true) progress++;
- if (question == 10 && q10a != true) progress++;
- if (question == 11 && q11a != true) progress++;
- if (question == 12 && q12a != true) progress++;
- if (question == 13 && q13a != true) progress++;
- if (question == 14 && q14a != true) progress++;
- if (question == 15 && q15a != true) progress++;
- if (question == 1) q1a = true;
- if (question == 2) q2a = true;
- if (question == 3) q3a = true;
- if (question == 4) q4a = true;
- if (question == 5) q5a = true;
- if (question == 6) q6a = true;
- if (question == 7) q7a = true;
- if (question == 8) q8a = true;
- if (question == 9) q9a = true;
- if (question == 10) q10a = true;
- if (question == 11) q11a = true;
- if (question == 12) q12a = true;
- if (question == 13) q13a = true;
- if (question == 14) q14a = true;
- if (question == 15) q15a = true;
- $("#progress").css("width", progress * 6.66666 + "%");
- if (Math.floor(progress * 6.66666) == 99) $("#progressText").html("100%");
- else $("#progressText").html(Math.floor(progress * 6.66666) + "%");
- }
- function time_remaining(endtime){
- var t = Date.parse(endtime) - Date.parse(new Date());
- var seconds = Math.floor( (t/1000) % 60 );
- var minutes = Math.floor( (t/1000/60) % 60 );
- var hours = Math.floor( (t/(1000*60*60)) % 24 );
- var days = Math.floor( t/(1000*60*60*24) );
- return {'total':t, 'days':days, 'hours':hours, 'minutes':minutes, 'seconds':seconds};
- }
- function run_clock(endtime){
- function update_clock(){
- var t = time_remaining(endtime);
- document.getElementById("timer").innerHTML = t.minutes + ":" + t.seconds;
- if(t.total<=0){ clearInterval(timeinterval); }
- }
- update_clock(); // run function once at first to avoid delay
- var timeinterval = setInterval(update_clock,1000);
- }
- $(document).ready(function(){
- run_clock(deadline);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement