# HG changeset patch # User Nicholas Jillings # Date 1455200169 0 # Node ID fbba14d4e21cb232f0d1460594b89c74d7d9f0e4 # Parent 1dbc6d3e6fb5bb0edf96236eebf69263e10a552d Bug #1567: AB.js interfaces, the playback toggle now controls both playback start and playback stop commands. Button text updated to reflect. diff -r 1dbc6d3e6fb5 -r fbba14d4e21c 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) {