From 4d5691ba3a4b194a93ba307e4115f31420fe5c3a Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Mon, 11 Nov 2013 17:59:13 +0100 Subject: [PATCH] minor refactor and fix --- public/js/app.js | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 0a8e5ae..ccfa571 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -11,7 +11,7 @@ , pvtmsgto , subscriber = false , roundpoints = 0 - , roomname = window.location.pathname.replace('/', '') + , roomname = window.location.pathname.replace(/\//g, '') , socket , stopanimation = false , touchplay @@ -392,21 +392,19 @@ html += '
GuessedMean time'; html += ''; - for(var i=0;i<3;i++) { - if (podium[i]) { - html += '
'; - html += ''+podium[i].nickname+''; - html += ''+podium[i].points+''; - html += ''+podium[i].golds+''+podium[i].silvers+''; - html += ''+podium[i].bronzes+''+podium[i].guessed+''; - var meantime = "N/A"; - if (podium[i].guessed !== 0) { - meantime = podium[i].totguesstime / podium[i].guessed; - meantime = (meantime / 1000).toFixed(1)+' s'; - } - html += ''+meantime+''; - } - } + podium.forEach(function(player, i) { + html += '
'; + html += ''+player.nickname+''; + html += ''+player.points+''; + html += ''+player.golds+''+player.silvers+''; + html += ''+player.bronzes+''+player.guessed+''; + var meantime = "N/A"; + if (player.guessed !== 0) { + meantime = player.totguesstime / player.guessed; + meantime = (meantime / 1000).toFixed(1)+' s'; + } + html += ''+meantime+''; + }); html +=''; html += '