jasmine-headless-webkit-pre.../file/presentation.js

29 lines
795 B
JavaScript
Raw Normal View History

2011-12-12 14:47:15 +00:00
$(function() {
var delay, isTiming, time, timer;
isTiming = false;
time = 0;
delay = 1000;
timer = null;
timer = function() {
var minute, output, second;
$('#footer span#timeInfo').remove();
$('#footer').append('<span id="timeInfo" />');
minute = ("00" + (Math.floor(time / 60))).substr(-2);
second = ("00" + (time % 60)).substr(-2);
output = "" + minute + ":" + second;
if (isTiming) output += " (running)";
$('#footer #timeInfo').text(output);
if (isTiming) time += 1;
return setTimeout(timer, delay);
};
timer();
return $(document).keyup(function(event) {
if (event.keyCode === 77) {
isTiming = !isTiming;
if (isTiming) time = 0;
}
return true;
});
});