-
+
{{ formattedTime }}
+
`,
@@ -257,6 +351,11 @@ new Vue({
},
},
methods: {
+ setTime: function() {
+ this.initialTime = this.setterTime;
+ this.setter = false;
+ this.reset();
+ },
padToZero: function(a) {
if (a < 10)
return "0" + a;
@@ -269,7 +368,7 @@ new Vue({
},
reset: function(e) {
this.running = false;
- this.time = 5400; //1:30
+ this.time = this.initialTime * 60;
},
start: function() {
if (!this.running)
@@ -280,6 +379,8 @@ new Vue({
this.running = false;
return;
}
+ if (this.time == this.initialTime * 60)
+ new Audio("sounds/gong.mp3").play(); //gong at the beginning
setTimeout(() => {
if (this.running)
this.time--;
@@ -288,8 +389,27 @@ new Vue({
},
},
created: function() {
+ this.setterTime = this.initialTime;
this.reset();
},
+ mounted: function() {
+ let timer = document.getElementById("timer");
+ let keyDict = {
+ 32: () => { this.setter = true; }, //Space
+ 27: () => { this.setter = false; }, //Esc
+ };
+ document.addEventListener("keyup", e => {
+ if (timer.style.display !== "none")
+ {
+ let func = keyDict[e.keyCode];
+ if (!!func)
+ {
+ e.preventDefault();
+ func();
+ }
+ }
+ });
+ },
},
'my-ranking': {
props: ['players','sortByScore','commitScores'],
@@ -408,7 +528,11 @@ new Vue({
.filter( line => { return line.length > 0; }) //remove empty lines
.map( line => {
let parts = line.split(",");
- return {prenom: parts[0], nom: parts[1], pdt: 0, session:0, available: 1};
+ let p = { prenom: parts[0], nom: parts[1] };
+ p.pdt = parts.length > 2 ? parseFloat(parts[2]) : 0;
+ p.session = parts.length > 3 ? parseInt(parts[3]) : 0;
+ p.available = parts.length > 4 ? parts[4] : 1;
+ return p;
});
this.addToto(players);
this.players = players;