From 24bfc833599b5e98897c7cb6e904d90a55380f5a Mon Sep 17 00:00:00 2001 From: mathieu Date: Tue, 7 Jul 2015 10:54:46 -0400 Subject: [PATCH] Demo input now ranges from -2 to +6 with 10th of second precision. #32 --- assets/js/home.logic.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/js/home.logic.js b/assets/js/home.logic.js index 4ed3123c..65870f1b 100755 --- a/assets/js/home.logic.js +++ b/assets/js/home.logic.js @@ -1,5 +1,5 @@ -var delta = Math.floor((Math.random() * 10) + 1) - 5; +var delta = (Math.random() * 6) + 1 - 2; var d; var activeIndex = 0; @@ -32,7 +32,7 @@ $( document ).ready(function() { $("#demo-pointer").removeAttr('style'); animationUnderWay = true; - var evt = window.event || e //equalize event object + var evt = window.event || e; //equalize event object evt = evt.originalEvent ? evt.originalEvent : evt; //convert to originalEvent if possible var delta = evt.detail ? evt.detail*(-40) : evt.wheelDelta //check for detail first, because it is used by Opera and FF @@ -87,7 +87,7 @@ $( document ).ready(function() { $("#demo-pointer").hide(); $("#demo-third-step").hide(); $("#demo-fourth-step").fadeToggle(); - $(".watch-accuracy").html(result.toFixed(0)); + $(".watch-accuracy").html(result.toFixed(1)); }); @@ -151,7 +151,7 @@ function similateInput(){ $("#inputUserTime").focus(); - var seconds = (d.getSeconds() + Math.abs(delta)); + var seconds = (d.getSeconds() + Math.floor(Math.abs(delta))); if(seconds <= 9){ seconds = "0"+seconds; }