# HG changeset patch # User Nicholas Jillings # Date 1455200169 0 # Node ID 12ef00ae9dd564cceddfa2fc9fe1ab8638d29cbc # Parent b0340a2f64f2543f7df84b855adbbaf3f318ca9d Bug #1567: AB.js interfaces, the playback toggle now controls both playback start and playback stop commands. Button text updated to reflect. diff -r b0340a2f64f2 -r 12ef00ae9dd5 interfaces/AB.js --- a/interfaces/AB.js Thu Feb 11 14:07:24 2016 +0000 +++ b/interfaces/AB.js Thu Feb 11 14:16:09 2016 +0000 @@ -218,10 +218,17 @@ } console.log("Selected "+id+' ('+time+')'); }; + this.playback.setAttribute("playstate","ready"); this.playback.onclick = function(event) { var id = event.currentTarget.parentElement.getAttribute('track-id'); - audioEngineContext.play(id); + if (event.currentTarget.getAttribute("playstate") == "ready") + { + audioEngineContext.play(id); + } else if (event.currentTarget.getAttribute("playstate") == "playing") { + audioEngineContext.stop(); + } + }; this.enable = function() @@ -240,17 +247,19 @@ progress = progress.split('.')[0]; this.playback.textContent = progress+'%'; } else { - this.playback.textContent = "Listen"; + this.playback.textContent = "Play"; } }; this.startPlayback = function() { $('.comparitor-button').text('Listen'); - $(this.playback).text('Playing'); + $(this.playback).text('Stop'); + this.playback.setAttribute("playstate","playing"); }; this.stopPlayback = function() { $(this.playback).text('Listen'); + this.playback.setAttribute("playstate","ready"); }; this.exportXMLDOM = function(audioObject) {