Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. var q1a,q2a,q3a,q4a,q5a,q6a,q7a,q8a,q9a,q10a,q11a,q12a,q13a,q14a,q15a = false;
  2. var progress = 0;
  3. var current_time = Date.parse(new Date());
  4. var deadline = new Date(current_time + 15*60*1000);
  5.  
  6. function increaseProgress(question) {
  7. if (question == 1 && q1a != true) progress++;
  8. if (question == 2 && q2a != true) progress++;
  9. if (question == 3 && q3a != true) progress++;
  10. if (question == 4 && q4a != true) progress++;
  11. if (question == 5 && q5a != true) progress++;
  12. if (question == 6 && q6a != true) progress++;
  13. if (question == 7 && q7a != true) progress++;
  14. if (question == 8 && q8a != true) progress++;
  15. if (question == 9 && q9a != true) progress++;
  16. if (question == 10 && q10a != true) progress++;
  17. if (question == 11 && q11a != true) progress++;
  18. if (question == 12 && q12a != true) progress++;
  19. if (question == 13 && q13a != true) progress++;
  20. if (question == 14 && q14a != true) progress++;
  21. if (question == 15 && q15a != true) progress++;
  22.  
  23. if (question == 1) q1a = true;
  24. if (question == 2) q2a = true;
  25. if (question == 3) q3a = true;
  26. if (question == 4) q4a = true;
  27. if (question == 5) q5a = true;
  28. if (question == 6) q6a = true;
  29. if (question == 7) q7a = true;
  30. if (question == 8) q8a = true;
  31. if (question == 9) q9a = true;
  32. if (question == 10) q10a = true;
  33. if (question == 11) q11a = true;
  34. if (question == 12) q12a = true;
  35. if (question == 13) q13a = true;
  36. if (question == 14) q14a = true;
  37. if (question == 15) q15a = true;
  38.  
  39. $("#progress").css("width", progress * 6.66666 + "%");
  40. if (Math.floor(progress * 6.66666) == 99) $("#progressText").html("100%");
  41. else $("#progressText").html(Math.floor(progress * 6.66666) + "%");
  42. }
  43.  
  44. function time_remaining(endtime){
  45. var t = Date.parse(endtime) - Date.parse(new Date());
  46. var seconds = Math.floor( (t/1000) % 60 );
  47. var minutes = Math.floor( (t/1000/60) % 60 );
  48. var hours = Math.floor( (t/(1000*60*60)) % 24 );
  49. var days = Math.floor( t/(1000*60*60*24) );
  50. return {'total':t, 'days':days, 'hours':hours, 'minutes':minutes, 'seconds':seconds};
  51. }
  52. function run_clock(endtime){
  53. function update_clock(){
  54. var t = time_remaining(endtime);
  55. document.getElementById("timer").innerHTML = t.minutes + ":" + t.seconds;
  56. if(t.total<=0){ clearInterval(timeinterval); }
  57. }
  58. update_clock(); // run function once at first to avoid delay
  59. var timeinterval = setInterval(update_clock,1000);
  60. }
  61.  
  62.  
  63. $(document).ready(function(){
  64. run_clock(deadline);
  65. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement