From 6189cfe9c5b910c10c50600da61c3e9020e20eba Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Sat, 18 Jan 2020 20:27:35 -0600 Subject: Fix: toddler proof buttons --- tape-deck.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'tape-deck.js') diff --git a/tape-deck.js b/tape-deck.js index 057c96b..8c0a2b1 100644 --- a/tape-deck.js +++ b/tape-deck.js @@ -37,6 +37,16 @@ let TapeDeck = { this.go(); Cassette.play(); }, + disableButtons: function() { + this.playButton.disable(); + this.ffButton.disable(); + this.rewindButton.disable(); + }, + enableButtons: function() { + this.playButton.enable(); + this.ffButton.enable(); + this.rewindButton.enable(); + } }; ffSound.onended = (event) => { @@ -45,8 +55,9 @@ ffSound.onended = (event) => { } else { TapeDeck.rewindButton.toggle(); } - TapeDeck.playButton.toggle({sound: false}); + TapeDeck.enableButtons(); TapeDeck.resume(); + TapeDeck.playButton.toggle({sound: false}); }; // button onclick points here @@ -59,6 +70,7 @@ window.play = function () { window.ff = function () { if (TapeDeck.isPlaying) TapeDeck.pause(); + TapeDeck.disableButtons(); TapeDeck.ffButton.toggle(); Cassette.currentTime = Cassette.currentTime + 20; ffSound.play(); @@ -66,6 +78,7 @@ window.ff = function () { window.rewind = function () { if (TapeDeck.isPlaying) TapeDeck.pause(); + TapeDeck.disableButtons(); TapeDeck.rewindButton.toggle(); Cassette.currentTime = Cassette.currentTime - 20; ffSound.play(); -- cgit v1.2.3