Mercurial > hg > webaudioevaluationtool
diff ape.js @ 1750:1365362c12d5
Merge from 156:402bb0f56dc4
author | Nicholas Jillings <nickjillings@users.noreply.github.com> |
---|---|
date | Mon, 01 Jun 2015 12:56:15 +0100 |
parents | 9771f65eec66 |
children | 3a77fed8a32c |
line wrap: on
line diff
--- a/ape.js Mon Jun 01 08:55:53 2015 +0100 +++ b/ape.js Mon Jun 01 12:56:15 2015 +0100 @@ -267,7 +267,6 @@ testState.initialise(); testState.advanceState(); - testWaitIndicator(); } function loadTest(textXML) @@ -408,6 +407,7 @@ // Create document objects to hold the comment boxes var trackComment = document.createElement('div'); trackComment.className = 'comment-div'; + trackComment.id = 'comment-div-'+index; // Create a string next to each comment asking for a comment var trackString = document.createElement('span'); trackString.innerHTML = 'Comment on track '+index; @@ -430,6 +430,11 @@ var trackSliderObj = document.createElement('div'); trackSliderObj.className = 'track-slider'; trackSliderObj.id = 'track-slider-'+index; + + var trackSliderAOIndex = document.createAttribute('trackIndex'); + trackSliderAOIndex.nodeValue = index; + trackSliderObj.setAttributeNode(trackSliderAOIndex); + // Distribute it randomnly var w = window.innerWidth - (offset+8)*2; w = Math.random()*w; @@ -440,7 +445,7 @@ trackSliderObj.ondragend = dragEnd; trackSliderObj.ondragstart = function() { - var id = Number(this.id.substr(13,2)); // Maximum theoretical tracks is 99! + var id = Number(event.srcElement.attributes['trackIndex'].value); audioEngineContext.metric.sliderMoveStart(id); }; @@ -451,19 +456,16 @@ if (audioEngineContext.audioObjectsReady) { // Cannot continue to issue play command until audioObjects reported as ready! // Get the track ID from the object ID - var id = Number(this.id.substr(13,2)); // Maximum theoretical tracks is 99! + var id = Number(event.srcElement.attributes['trackIndex'].value); //audioEngineContext.metric.sliderPlayed(id); audioEngineContext.selectedTrack(id); // Currently playing track red, rest green - document.getElementById('track-slider-'+index).style.backgroundColor = "#FF0000"; - for (var i = 0; i<$(currentTrackOrder).length; i++) - { - if (i!=index) // Make all other sliders green - { - document.getElementById('track-slider-'+i).style.backgroundColor = "rgb(100,200,100)"; - } - - } + + //document.getElementById('track-slider-'+index).style.backgroundColor = "#FF0000"; + $('.track-slider').removeClass('track-slider-playing'); + $(event.srcElement).addClass('track-slider-playing'); + $('.comment-div').removeClass('comment-box-playing'); + $('#comment-div-'+id).addClass('comment-box-playing'); } }; @@ -495,6 +497,9 @@ trackComment.appendChild(trackCommentBox); feedbackHolder.appendChild(trackComment); }); + + + testWaitIndicator(); }