annotate interfaces/discrete.js @ 3141:335bc77627e0 tip

fixing discrete interface to allow labels to display
author Dave Moffat <me@davemoffat.com>
date Mon, 26 Jul 2021 12:15:24 +0100
parents 20de79c56ad7
children
rev   line source
nicholas@3045 1 /**
nicholas@3045 2 * WAET Blank Template
nicholas@3045 3 * Use this to start building your custom interface
nicholas@3045 4 */
n@3095 5 /*globals window, interfaceContext, testState, Interface, audioEngineContext, console, document, specification, $, storage*/
nickjillings@1345 6 // Once this is loaded and parsed, begin execution
nickjillings@1345 7 loadInterface();
nickjillings@1345 8
nickjillings@1345 9 function loadInterface() {
nicholas@2538 10 // Use this to do any one-time page / element construction. For instance, placing any stationary text objects,
nicholas@2538 11 // holding div's, or setting up any nodes which are present for the entire test sequence
nicholas@2538 12
nicholas@2538 13 // The injection point into the HTML page
nicholas@2538 14 interfaceContext.insertPoint = document.getElementById("topLevelBody");
nicholas@2538 15 var testContent = document.createElement('div');
nicholas@2538 16 testContent.id = 'testContent';
nicholas@2538 17
nicholas@2538 18 // Create the top div for the Title element
nicholas@2538 19 var titleAttr = specification.title;
nicholas@2538 20 var title = document.createElement('div');
nicholas@2538 21 title.className = "title";
nicholas@2538 22 title.align = "center";
nicholas@2538 23 var titleSpan = document.createElement('span');
nicholas@2470 24 titleSpan.id = "test-title";
nicholas@2538 25
nicholas@2538 26 // Set title to that defined in XML, else set to default
nicholas@2699 27 if (titleAttr !== undefined) {
nicholas@2538 28 titleSpan.textContent = titleAttr;
nicholas@2538 29 } else {
nicholas@2538 30 titleSpan.textContent = 'Listening test';
nicholas@2538 31 }
nicholas@2538 32 // Insert the titleSpan element into the title div element.
nicholas@2538 33 title.appendChild(titleSpan);
nicholas@2538 34
nicholas@2538 35 var pagetitle = document.createElement('div');
nicholas@2538 36 pagetitle.className = "pageTitle";
nicholas@2538 37 pagetitle.align = "center";
nicholas@2699 38
nicholas@2699 39 titleSpan = document.createElement('span');
nicholas@2538 40 titleSpan.id = "pageTitle";
nicholas@2538 41 pagetitle.appendChild(titleSpan);
nicholas@2538 42
nicholas@2538 43 // Create Interface buttons!
nicholas@2538 44 var interfaceButtons = document.createElement('div');
nicholas@2538 45 interfaceButtons.id = 'interface-buttons';
nicholas@2538 46 interfaceButtons.style.height = '25px';
nicholas@2538 47
nicholas@2538 48 // Create playback start/stop points
nicholas@2538 49 var playback = document.createElement("button");
nicholas@2538 50 playback.innerHTML = 'Stop';
nicholas@2538 51 playback.id = 'playback-button';
nicholas@2538 52 playback.style.float = 'left';
nicholas@2538 53 // onclick function. Check if it is playing or not, call the correct function in the
nicholas@2538 54 // audioEngine, change the button text to reflect the next state.
nicholas@2538 55 playback.onclick = function () {
nicholas@2538 56 if (audioEngineContext.status == 1) {
nicholas@2538 57 audioEngineContext.stop();
nicholas@2538 58 this.innerHTML = 'Stop';
nickjillings@1345 59 var time = audioEngineContext.timer.getTestTime();
nickjillings@1345 60 console.log('Stopped at ' + time); // DEBUG/SAFETY
nicholas@2538 61 }
nicholas@2538 62 };
nicholas@2538 63 // Create Submit (save) button
nicholas@2538 64 var submit = document.createElement("button");
nicholas@2538 65 submit.innerHTML = 'Next';
nicholas@2538 66 submit.onclick = buttonSubmitClick;
nicholas@2538 67 submit.id = 'submit-button';
nicholas@2538 68 submit.style.float = 'left';
n@3007 69
n@3007 70 // Create the sort button
n@3007 71 var sort = document.createElement("button");
n@3007 72 sort.id = "sort-fragments";
n@3007 73 sort.textContent = "Sort";
n@3007 74 sort.style.display = "inline-block";
n@3007 75 sort.style.visibility = "hidden";
n@3007 76 sort.onclick = buttonSortFragmentClick;
n@3007 77
nicholas@2538 78 // Append the interface buttons into the interfaceButtons object.
nicholas@2538 79 interfaceButtons.appendChild(playback);
nicholas@2538 80 interfaceButtons.appendChild(submit);
n@3007 81 interfaceButtons.appendChild(sort);
nicholas@2538 82
nicholas@3045 83
nicholas@3045 84 // Create outside reference holder
nicholas@3045 85 var outsideRef = document.createElement("div");
nicholas@3045 86 outsideRef.id = "outside-reference-holder";
nicholas@3045 87
nicholas@3045 88 // Create a holder for the slider rows
nicholas@3045 89 var sliderBox = document.createElement("div");
nicholas@3045 90 sliderBox.id = 'slider-box';
nicholas@3045 91 var sliderGrid = document.createElement("div");
nicholas@3045 92 sliderGrid.id = "slider-grid";
nicholas@3045 93 sliderBox.appendChild(sliderGrid);
nicholas@2538 94 var scaleText = document.createElement('div');
nicholas@2538 95 scaleText.id = "scale-text-holder";
nicholas@3045 96 sliderGrid.appendChild(scaleText);
nicholas@3045 97
nicholas@2538 98
nicholas@2538 99 // Global parent for the comment boxes on the page
nicholas@2538 100 var feedbackHolder = document.createElement('div');
nicholas@2538 101 feedbackHolder.id = 'feedbackHolder';
nicholas@2538 102
nicholas@2538 103 testContent.style.zIndex = 1;
nicholas@2538 104 interfaceContext.insertPoint.innerHTML = ""; // Clear the current schema
nicholas@2538 105
nicholas@2538 106 // Inject into HTML
nicholas@2538 107 testContent.appendChild(title); // Insert the title
nicholas@2538 108 testContent.appendChild(pagetitle);
nicholas@2538 109 testContent.appendChild(interfaceButtons);
nicholas@2396 110 testContent.appendChild(outsideRef);
nicholas@2538 111 testContent.appendChild(sliderBox);
nicholas@2538 112 testContent.appendChild(feedbackHolder);
nicholas@2538 113 interfaceContext.insertPoint.appendChild(testContent);
nickjillings@1345 114
nicholas@2538 115 // Load the full interface
nicholas@2538 116 testState.initialise();
nicholas@2538 117 testState.advanceState();
n@3095 118 }
nickjillings@1345 119
nicholas@2538 120 function loadTest(page) {
nicholas@2538 121 // Called each time a new test page is to be build. The page specification node is the only item passed in
nicholas@2538 122
nicholas@2538 123 var feedbackHolder = document.getElementById('feedbackHolder');
nicholas@3045 124 var sliderBox = document.getElementById('slider-box');
nicholas@3045 125 var sliderGrid = document.getElementById("slider-grid");
nicholas@3045 126 var scaleTextHolder = document.getElementById("scale-text-holder");
nicholas@3045 127 var interfaceObj = interfaceContext.getCombinedInterfaces(page);
nicholas@3045 128 var commentBoxPrefix = "Comment on track";
nicholas@3045 129 var loopPlayback = page.loop;
nicholas@2381 130 feedbackHolder.innerHTML = "";
nicholas@3045 131
nicholas@2538 132 if (interfaceObj.length > 1) {
nicholas@2538 133 console.log("WARNING - This interface only supports one <interface> node per page. Using first interface node");
nicholas@2538 134 }
nicholas@2538 135 interfaceObj = interfaceObj[0];
nicholas@2538 136
nicholas@2470 137 // Set the page title
nicholas@2470 138 if (typeof page.title == "string" && page.title.length > 0) {
nicholas@2699 139 document.getElementById("test-title").textContent = page.title;
nicholas@2470 140 }
nicholas@3045 141 // Set the axis title
nicholas@2699 142 if (interfaceObj.title !== null) {
nicholas@2538 143 document.getElementById("pageTitle").textContent = interfaceObj.title;
nicholas@2538 144 }
nicholas@2538 145
nicholas@2801 146 if (interfaceObj.image !== undefined || page.audioElements.some(function (elem) {
n@2793 147 return elem.image !== undefined;
n@2793 148 })) {
nicholas@2781 149 document.getElementById("testContent").insertBefore(interfaceContext.imageHolder.root, document.getElementById("slider"));
nicholas@2781 150 interfaceContext.imageHolder.setImage(interfaceObj.image);
nicholas@2781 151 }
nicholas@2781 152
nicholas@2538 153 // Delete outside reference
nicholas@2396 154 document.getElementById("outside-reference-holder").innerHTML = "";
nicholas@2538 155
nicholas@3045 156 // Get the comment box prefix
nicholas@2699 157 if (interfaceObj.commentBoxPrefix !== undefined) {
nicholas@2538 158 commentBoxPrefix = interfaceObj.commentBoxPrefix;
nicholas@2538 159 }
nicholas@2538 160
nicholas@3045 161 // Populate the comment questions
nicholas@3045 162 $(page.commentQuestions).each(function (index, element) {
nicholas@3045 163 var node = interfaceContext.createCommentQuestion(element);
nicholas@3045 164 feedbackHolder.appendChild(node.holder);
nicholas@3045 165 });
nicholas@3045 166
nicholas@3045 167 // Configure the grid
nicholas@3045 168 var numRows = page.audioElements.filter(function (a) {
nicholas@3045 169 return (a.type !== "outside-reference");
nicholas@3045 170 }).length;
nicholas@3045 171 var numColumns = page.interfaces[0].scales.length;
nicholas@3045 172 sliderGrid.style.gridTemplateRows = "50px repeat(" + numRows + ", 72px)";
nicholas@3045 173 scaleTextHolder.style.gridTemplateColumns = "100px repeat(" + numColumns + ", 1fr) 100px";
nicholas@3045 174 page.interfaces[0].scales.sort(function (a, b) {
nicholas@3045 175 if (a.position > b.position) {
nicholas@3045 176 return 1;
nicholas@3045 177 } else if (a.position < b.position) {
nicholas@3045 178 return -1;
nicholas@3045 179 }
nicholas@3045 180 return 0;
nicholas@3045 181 }).forEach(function (a, i) {
nicholas@3045 182 var h = document.createElement("div");
nicholas@3045 183 var text = document.createElement("span");
nicholas@3045 184 h.className = "scale-text";
nicholas@3045 185 h.style.gridColumn = String(i + 2) + "/" + String(i + 3);
nicholas@3045 186 text.textContent = a.text;
nicholas@3045 187 h.appendChild(text);
nicholas@3045 188 scaleTextHolder.appendChild(h);
n@3095 189 });
nicholas@3045 190
nicholas@3045 191 // Find all the audioElements from the audioHolder
nicholas@3045 192 var index = 0;
nicholas@3045 193 var labelType = page.label;
nicholas@3045 194 if (labelType == "default") {
nicholas@3045 195 labelType = "number";
nicholas@3045 196 }
nicholas@3045 197 $(page.audioElements).each(function (pageIndex, element) {
nicholas@3045 198 // Find URL of track
nicholas@3045 199 // In this jQuery loop, variable 'this' holds the current audioElement.
nicholas@3045 200
nicholas@3045 201 var audioObject = audioEngineContext.newTrack(element);
nicholas@3045 202 if (element.type == 'outside-reference') {
nicholas@3045 203 // Construct outside reference;
nicholas@3045 204 var orNode = new interfaceContext.outsideReferenceDOM(audioObject, index, document.getElementById("outside-reference-holder"));
nicholas@3045 205 audioObject.bindInterface(orNode);
nicholas@3045 206 } else {
nicholas@3045 207 // Create a slider per track
me@3141 208 console.log('in discrete')
me@3141 209 if (this.label == ""){
me@3141 210 var label = interfaceContext.getLabel(labelType, index, page.labelStart);
me@3141 211 index += 1;
me@3141 212 }
me@3141 213 else {
me@3141 214 var label = this.label
me@3141 215 }
nicholas@3045 216 var sliderObj = new discreteObject(audioObject, label);
nicholas@3045 217 sliderGrid.appendChild(sliderObj.DOMRoot);
nicholas@3045 218 audioObject.bindInterface(sliderObj);
nicholas@3045 219 interfaceContext.commentBoxes.createCommentBox(audioObject);
nicholas@3045 220 }
nicholas@3045 221
nicholas@3045 222 });
nicholas@2699 223 interfaceObj.options.forEach(function (option) {
nicholas@2538 224 if (option.type == "show") {
nicholas@2538 225 switch (option.name) {
n@2407 226 case "playhead":
n@2407 227 var playbackHolder = document.getElementById('playback-holder');
nicholas@2699 228 if (playbackHolder === null) {
n@2407 229 playbackHolder = document.createElement('div');
n@2407 230 playbackHolder.style.width = "100%";
n@2407 231 playbackHolder.align = 'center';
n@2407 232 playbackHolder.appendChild(interfaceContext.playhead.object);
n@2407 233 feedbackHolder.appendChild(playbackHolder);
n@2407 234 }
n@2407 235 break;
n@2407 236 case "page-count":
n@2407 237 var pagecountHolder = document.getElementById('page-count');
nicholas@2699 238 if (pagecountHolder === null) {
n@2407 239 pagecountHolder = document.createElement('div');
n@2407 240 pagecountHolder.id = 'page-count';
n@2407 241 }
nicholas@2538 242 pagecountHolder.innerHTML = '<span>Page ' + (testState.stateIndex + 1) + ' of ' + testState.stateMap.length + '</span>';
n@2407 243 var inject = document.getElementById('interface-buttons');
n@2407 244 inject.appendChild(pagecountHolder);
n@2407 245 break;
n@2407 246 case "volume":
nicholas@2699 247 if (document.getElementById('master-volume-holder') === null) {
n@2407 248 feedbackHolder.appendChild(interfaceContext.volume.object);
n@2407 249 }
n@2407 250 break;
n@2407 251 case "comments":
nicholas@2538 252 interfaceContext.commentBoxes.showCommentBoxes(feedbackHolder, true);
n@2407 253 break;
n@3007 254 case "fragmentSort":
n@3007 255 var button = document.getElementById('sort-fragments');
n@3007 256 button.style.visibility = "visible";
n@3007 257 break;
n@2407 258 }
n@2407 259 }
nicholas@2699 260 });
nicholas@2538 261 // Auto-align
nicholas@2538 262 resizeWindow(null);
nickjillings@1345 263 }
nickjillings@1345 264
nicholas@3045 265 function discreteObject(audioObject, label) {
nicholas@2538 266 // An example node, you can make this however you want for each audioElement.
nicholas@2538 267 // However, every audioObject (audioEngineContext.audioObject) MUST have an interface object with the following
nicholas@2538 268 // You attach them by calling audioObject.bindInterface( )
nicholas@3045 269 var playing = false;
nicholas@2538 270
nicholas@3045 271 function buttonClicked(event) {
nicholas@3045 272 if (!playing) {
nicholas@3045 273 audioEngineContext.play(audioObject.id);
nicholas@3045 274 } else {
nicholas@3045 275 audioEngineContext.stop();
nicholas@2699 276 }
n@3095 277 }
nicholas@3045 278
nicholas@3045 279 function radioSelected(event) {
nicholas@3045 280 var time = audioEngineContext.timer.getTestTime();
nicholas@3045 281 audioObject.metric.moved(time, event.currentTarget.value);
nicholas@3045 282 console.log("slider " + audioObject.id + " moved to " + event.currentTarget.value + "(" + time + ")");
n@3095 283 }
nicholas@3045 284
nicholas@3045 285 var root = document.createElement("div"),
nicholas@3045 286 labelHolder = document.createElement("div"),
nicholas@3045 287 button = document.createElement("button");
nicholas@3045 288 root.className = "discrete-row";
nicholas@3045 289 labelHolder.className = "discrete-label";
nicholas@3045 290 button.className = "discrete-button";
nicholas@3045 291 root.appendChild(labelHolder);
nicholas@3045 292
nicholas@3045 293 var labelSpan = document.createElement("span");
nicholas@3045 294 labelHolder.appendChild(labelSpan);
nicholas@3045 295 labelSpan.textContent = label;
nicholas@3045 296 button.textContent = "Listen";
nicholas@3045 297 button.disabled = "true";
nicholas@3045 298 button.addEventListener("click", this);
nicholas@3045 299
nicholas@3045 300 var numScales = audioObject.specification.parent.interfaces[0].scales.length;
nicholas@3045 301 root.style.gridTemplateColumns = "100px repeat(" + numScales + ", 1fr) 100px";
nicholas@3045 302 for (var n = 0; n < numScales; n++) {
nicholas@3045 303 var input = document.createElement("input");
nicholas@3045 304 input.type = "radio";
nicholas@3045 305 input.disabled = "true";
nicholas@3045 306 input.value = n / (numScales - 1);
nicholas@3045 307 input.addEventListener("click", this);
nicholas@3045 308 input.name = audioObject.specification.id;
nicholas@3045 309 root.appendChild(input);
nicholas@2538 310 }
nicholas@3045 311 root.appendChild(button);
nicholas@3045 312 this.handleEvent = function (event) {
nicholas@3045 313 if (event.currentTarget === button) {
nicholas@3045 314 buttonClicked(event);
nicholas@3045 315 } else if (event.currentTarget.type === "radio") {
nicholas@3045 316 radioSelected(event);
nicholas@2538 317 }
n@3095 318 };
nicholas@2538 319 this.enable = function () {
nicholas@2538 320 // This is used to tell the interface object that playback of this node is ready
nicholas@3045 321 button.disabled = "";
nicholas@3045 322 var a = root.querySelectorAll("input[type=\"radio\"]");
nicholas@3045 323 for (var n = 0; n < a.length; n++) {
nicholas@3045 324 a[n].disabled = false;
nicholas@3045 325 }
nicholas@3045 326 button.textContent = "Listen";
nicholas@2538 327 };
nicholas@2538 328 this.updateLoading = function (progress) {
nicholas@2538 329 // progress is a value from 0 to 100 indicating the current download state of media files
nicholas@3045 330 button.textContent = progress + "%";
nicholas@2538 331 };
nicholas@2538 332 this.startPlayback = function () {
nicholas@3045 333 // Called when playback has begun
nicholas@3045 334 playing = true;
nicholas@3045 335 $(root).addClass("discrete-row-playing");
nicholas@3045 336 button.textContent = "Stop";
nicholas@2699 337 };
nicholas@2538 338 this.stopPlayback = function () {
nicholas@3045 339 // Called when playback has stopped. This gets called even if playback never started!
nicholas@3045 340 playing = false;
nicholas@3045 341 $(root).removeClass("discrete-row-playing");
nicholas@3045 342 button.textContent = "Listen";
nicholas@3045 343 };
nicholas@3045 344 this.getValue = function () {
nicholas@3045 345 // Return the current value of the object. If there is no value, return 0
nicholas@3045 346 var a = root.querySelectorAll("input[type=\"radio\"]");
nicholas@3045 347 for (var n = 0; n < a.length; n++) {
nicholas@3045 348 if (a[n].checked) {
nicholas@3045 349 return Number(a[n].value);
n@2793 350 }
n@2428 351 }
nicholas@3045 352 return -1;
nicholas@2538 353 };
nicholas@2538 354 this.getPresentedId = function () {
nicholas@2538 355 // Return the presented ID of the object. For instance, the APE has sliders starting from 0. Whilst AB has alphabetical scale
nicholas@3045 356 return label;
nicholas@2538 357 };
nicholas@2538 358 this.canMove = function () {
nicholas@2538 359 // Return either true or false if the interface object can be moved. AB / Reference cannot, whilst sliders can and therefore have a continuous scale.
nicholas@2538 360 // These are checked primarily if the interface check option 'fragmentMoved' is enabled.
nicholas@2538 361 return true;
nicholas@2538 362 };
nicholas@2538 363 this.exportXMLDOM = function (audioObject) {
nicholas@2538 364 // Called by the audioObject holding this element to export the interface <value> node.
nicholas@2538 365 // If there is no value node (such as outside reference), return null
nicholas@2538 366 // If there are multiple value nodes (such as multiple scale / 2D scales), return an array of nodes with each value node having an 'interfaceName' attribute
nicholas@2538 367 // Use storage.document.createElement('value'); to generate the XML node.
nicholas@2538 368 var node = storage.document.createElement('value');
nicholas@2538 369 node.textContent = this.getValue();
nicholas@2538 370 return node;
nicholas@3045 371
nicholas@2538 372 };
nicholas@2538 373 this.error = function () {
nicholas@3045 374 // If there is an error with the audioObject, this will be called to indicate a failure
nicholas@2699 375 };
nicholas@3045 376 Object.defineProperties(this, {
nicholas@3045 377 "DOMRoot": {
nicholas@3045 378 "value": root
nicholas@3045 379 }
nicholas@3045 380 });
n@3095 381 }
nickjillings@1345 382
nicholas@2538 383 function resizeWindow(event) {
nicholas@2538 384 // Called on every window resize event, use this to scale your page properly
nickjillings@1345 385 }
nickjillings@1345 386
nicholas@3045 387 function buttonSortFragmentClick() {
nicholas@3045 388 var sortIndex = interfaceContext.sortFragmentsByScore();
nicholas@3045 389 var sliderBox = document.getElementById("slider-holder");
nicholas@3045 390 var nodes = audioEngineContext.audioObjects.filter(function (ao) {
nicholas@3045 391 return ao.specification.type !== "outside-reference";
nicholas@3040 392 });
nicholas@3045 393 var i;
nicholas@3045 394 nodes.forEach(function (ao) {
nicholas@3045 395 sliderBox.removeChild(ao.interfaceDOM.holder);
nicholas@3045 396 });
nicholas@3045 397 for (i = 0; i < nodes.length; i++) {
nicholas@3045 398 var j = sortIndex[i];
nicholas@3045 399 sliderBox.appendChild(nodes[j].interfaceDOM.holder);
nicholas@3040 400 }
nickjillings@1345 401 }
nickjillings@1345 402
nickjillings@1345 403 function buttonSubmitClick() // TODO: Only when all songs have been played!
nickjillings@1345 404 {
nicholas@2651 405 var checks = testState.currentStateMap.interfaces[0].options,
nicholas@2651 406 canContinue = true;
nickjillings@1345 407
nicholas@2538 408 // Check that the anchor and reference objects are correctly placed
nicholas@2699 409 if (interfaceContext.checkHiddenAnchor() === false) {
nicholas@2538 410 return;
nicholas@2538 411 }
nicholas@2699 412 if (interfaceContext.checkHiddenReference() === false) {
nicholas@2538 413 return;
nicholas@2538 414 }
nicholas@2825 415 if (interfaceContext.checkFragmentMinPlays() === false) {
nicholas@2825 416 return;
nicholas@2825 417 }
nicholas@3035 418 if (interfaceContext.checkCommentQuestions() === false) {
nicholas@3035 419 return;
nicholas@3035 420 }
nicholas@2538 421
nicholas@2538 422 for (var i = 0; i < checks.length; i++) {
nicholas@3045 423 var checkState = true;
nicholas@2538 424 if (checks[i].type == 'check') {
nicholas@2538 425 switch (checks[i].name) {
nicholas@2538 426 case 'fragmentPlayed':
nicholas@2538 427 // Check if all fragments have been played
n@2790 428 checkState = interfaceContext.checkAllPlayed(checks[i].errorMessage);
nicholas@2538 429 break;
nicholas@2538 430 case 'fragmentFullPlayback':
nicholas@2538 431 // Check all fragments have been played to their full length
n@2790 432 checkState = interfaceContext.checkAllPlayed(checks[i].errorMessage);
nicholas@2538 433 console.log('NOTE: fragmentFullPlayback not currently implemented, performing check fragmentPlayed instead');
nicholas@2538 434 break;
nicholas@2538 435 case 'fragmentMoved':
nicholas@2538 436 // Check all fragment sliders have been moved.
n@2790 437 checkState = interfaceContext.checkAllMoved(checks[i].errorMessage);
nicholas@2538 438 break;
nicholas@2538 439 case 'fragmentComments':
nicholas@2538 440 // Check all fragment sliders have been moved.
n@2790 441 checkState = interfaceContext.checkAllCommented(checks[i].errorMessage);
nicholas@2538 442 break;
nicholas@2538 443 case 'scalerange':
nicholas@2538 444 // Check the scale has been used effectively
n@2790 445 checkState = interfaceContext.checkScaleRange(checks[i].errorMessage);
nicholas@3045 446
nicholas@2538 447 break;
nicholas@2538 448 default:
nicholas@2538 449 console.log("WARNING - Check option " + checks[i].check + " is not supported on this interface");
nicholas@2538 450 break;
nicholas@2538 451 }
nicholas@2538 452 }
nicholas@3045 453 if (checkState === false) {
nicholas@3045 454 canContinue = false;
nicholas@2538 455 break;
nicholas@2538 456 }
nicholas@2538 457 }
nicholas@2538 458
nickjillings@1345 459 if (canContinue) {
nicholas@2538 460 if (audioEngineContext.status == 1) {
nicholas@2538 461 var playback = document.getElementById('playback-button');
nicholas@2538 462 playback.click();
nicholas@2538 463 // This function is called when the submit button is clicked. Will check for any further tests to perform, or any post-test options
nicholas@2538 464 } else {
nicholas@2699 465 if (audioEngineContext.timer.testStarted === false) {
nicholas@2538 466 interfaceContext.lightbox.post("Warning", 'You have not started the test! Please press start to begin the test!');
nicholas@2538 467 return;
nicholas@2538 468 }
nicholas@2538 469 }
nicholas@2538 470 testState.advanceState();
nicholas@2538 471 }
nickjillings@1345 472 }
nickjillings@1345 473
nicholas@2538 474 function pageXMLSave(store, pageSpecification) {
nicholas@2538 475 // MANDATORY
nicholas@2538 476 // Saves a specific test page
nicholas@2538 477 // You can use this space to add any extra nodes to your XML <audioHolder> saves
nicholas@2538 478 // Get the current <page> information in store (remember to appendChild your data to it)
nicholas@2538 479 // pageSpecification is the current page node configuration
nicholas@2538 480 // To create new XML nodes, use storage.document.createElement();
nicholas@2538 481 }