ENHANCEMENT: adding focus
This commit is contained in:
parent
8ae179876a
commit
3bd684a99f
16080
package-lock.json
generated
16080
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -31,7 +31,7 @@
|
||||
<img src="joker.png" alt="joker">
|
||||
</p>
|
||||
</div>
|
||||
<button v-on:click="restartTimer" class="timerBtn"><span class="timerBtn-inner"></span></button>
|
||||
<button v-on:click="restartTimer()" v-on:keyup.space="restartTimer" v-on:keyup.enter="restartTimer" ref="timerBtn" class="timerBtn"><span class="timerBtn-inner"></span></button>
|
||||
<div class="timer-item">
|
||||
<p v-if="warning == false" v-bind:class="{ danger: danger == true }" class="timeleft">{{ countDown.toString() }}</p>
|
||||
<p v-if="warning == true || (typeof warning == 'undefined')" class="timeout">
|
||||
@ -84,6 +84,9 @@ export default {
|
||||
sfxNext: this.playsound ? new Audio('sfx/next.wav') : null,
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
this.$refs['timerBtn'].focus();
|
||||
},
|
||||
methods: {
|
||||
resetTime: function() {
|
||||
clearInterval(this.interval);
|
||||
@ -92,11 +95,6 @@ export default {
|
||||
timeleft: function(){
|
||||
this.countDown--;
|
||||
switch (this.countDown) {
|
||||
case 6:
|
||||
if(this.playsound) {
|
||||
this.sfxWarning = new Audio('sfx/warning.wav');
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if(this.playsound) {
|
||||
this.sfxWarning.play();
|
||||
@ -132,6 +130,7 @@ export default {
|
||||
clearInterval(this.interval);
|
||||
break;
|
||||
}
|
||||
this.$refs['timerBtn'].focus();
|
||||
},
|
||||
restartTimer: function() {
|
||||
if(this.wakeLock == null && 'wakeLock' in navigator) {
|
||||
|
Loading…
Reference in New Issue
Block a user