removed moment.js dependency
This commit is contained in:
@@ -64,20 +64,20 @@ if (typeof(sw) == 'undefined') {
|
||||
var playforwords = 10;
|
||||
sw.correctWords = 0;
|
||||
sw.wrongWords = 0;
|
||||
sw.time = moment();
|
||||
sw.time = Math.round((new Date()).getTime() / 1000);
|
||||
sw.gameover = false;
|
||||
|
||||
var updateBadges = function() {
|
||||
$('.num-of-words-wrong').html(sw.wrongWords + (sw.wrongWords == 1 ? ' word' : ' words'));
|
||||
$('.num-of-words').html(sw.correctWords + (sw.correctWords == 1 ? ' word' : ' words'));
|
||||
$('.time-words').html(moment.duration(moment() - sw.time).seconds());
|
||||
$('.time-words').html(Math.round((new Date()).getTime() / 1000) - sw.time);
|
||||
|
||||
if(playforwords > sw.correctWords + sw.wrongWords) {
|
||||
setTimeout(function() {
|
||||
updateBadges();
|
||||
}, 100);
|
||||
} else {
|
||||
sw.finaltime = moment.duration(moment() - sw.time).seconds();
|
||||
sw.finaltime = Math.round((new Date()).getTime() / 1000) - sw.time;
|
||||
sw.gameover = true;
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user