Created
June 1, 2014 14:13
-
-
Save quasiyoke/f6ef825da4d04d57291f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setResult(n){ | |
var interval = setInterval( | |
function(){ | |
var qe = $('#question'); | |
var ae = $('#answer'); | |
var q=qe.text(); | |
var m = /^(\d+)\s(.)\s(\d+)/.exec(q); | |
var v1 = m[1] - 0; | |
var op = m[2]; | |
var v2 = m[3] - 0; | |
var a; | |
switch(op){ | |
case 'x': | |
a = v1*v2; | |
break; | |
case '+': | |
a = v1+v2; | |
break; | |
case '-': | |
a = v1-v2; | |
break; | |
case '÷': | |
a = v1/v2; | |
break; | |
} | |
ae.val('' + a); | |
ae.trigger('keyup'); | |
}, | |
30e3/n | |
); | |
$('#runner').on('runnerFinish', function(){ | |
clearInterval(interval); | |
}); | |
} | |
setResult(100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment