annotate interfaces/AB.js @ 2694:1ccc083552d5

Minor fixed for AB
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Sat, 11 Mar 2017 18:14:59 +0000
parents 31af72ea5e61
children 536cb44c7292
rev   line source
nickjillings@1341 1 // Once this is loaded and parsed, begin execution
nickjillings@1341 2 loadInterface();
nicholas@2691 3 /*globals window, interfaceContext, testState, Interface, audioEngineContext, console, document, specification, $, storage*/
nickjillings@1341 4 function loadInterface() {
nicholas@2538 5 // Get the dimensions of the screen available to the page
nicholas@2538 6 var width = window.innerWidth;
nicholas@2538 7 var height = window.innerHeight;
nicholas@2538 8 interfaceContext.insertPoint.innerHTML = ""; // Clear the current schema
nicholas@2538 9
nicholas@2538 10 // Custom comparator Object
nicholas@2538 11 Interface.prototype.comparator = null;
nicholas@2538 12
nicholas@2538 13 Interface.prototype.checkScaleRange = function (min, max) {
nicholas@2359 14 var page = testState.getCurrentTestPage();
nicholas@2359 15 var audioObjects = audioEngineContext.audioObjects;
nicholas@2359 16 var state = true;
nicholas@2359 17 var str = "Please keep listening. ";
nicholas@2359 18 var minRanking = Infinity;
nicholas@2359 19 var maxRanking = -Infinity;
nicholas@2359 20 for (var ao of audioObjects) {
nicholas@2359 21 var rank = ao.interfaceDOM.getValue();
nicholas@2538 22 if (rank < minRanking) {
nicholas@2538 23 minRanking = rank;
nicholas@2538 24 }
nicholas@2538 25 if (rank > maxRanking) {
nicholas@2538 26 maxRanking = rank;
nicholas@2538 27 }
nicholas@2359 28 }
nicholas@2538 29 if (maxRanking * 100 < max) {
nicholas@2691 30 str += "At least one fragment must be selected.";
nicholas@2359 31 state = false;
nicholas@2359 32 }
nicholas@2359 33 if (!state) {
nicholas@2359 34 console.log(str);
nicholas@2359 35 this.storeErrorNode(str);
nicholas@2538 36 interfaceContext.lightbox.post("Message", str);
nicholas@2359 37 }
nicholas@2359 38 return state;
nicholas@2691 39 };
nicholas@2538 40
nicholas@2538 41 // The injection point into the HTML page
nicholas@2538 42 interfaceContext.insertPoint = document.getElementById("topLevelBody");
nicholas@2538 43 var testContent = document.createElement('div');
nicholas@2538 44 testContent.id = 'testContent';
nicholas@2538 45
nicholas@2538 46 // Create the top div for the Title element
nicholas@2538 47 var titleAttr = specification.title;
nicholas@2538 48 var title = document.createElement('div');
nicholas@2538 49 title.className = "title";
nicholas@2538 50 title.align = "center";
nicholas@2538 51 var titleSpan = document.createElement('span');
nicholas@2470 52 titleSpan.id = "test-title";
nicholas@2538 53
nicholas@2538 54 // Set title to that defined in XML, else set to default
nicholas@2691 55 if (titleAttr !== undefined) {
nicholas@2538 56 titleSpan.textContent = titleAttr;
nicholas@2538 57 } else {
nicholas@2538 58 titleSpan.textContent = 'Listening test';
nicholas@2538 59 }
nicholas@2538 60 // Insert the titleSpan element into the title div element.
nicholas@2538 61 title.appendChild(titleSpan);
nicholas@2538 62
nicholas@2538 63 var pagetitle = document.createElement('div');
nicholas@2538 64 pagetitle.className = "pageTitle";
nicholas@2538 65 pagetitle.align = "center";
nicholas@2691 66
nicholas@2691 67 titleSpan = document.createElement('span');
nicholas@2538 68 titleSpan.id = "pageTitle";
nicholas@2538 69 pagetitle.appendChild(titleSpan);
nicholas@2538 70
nicholas@2538 71 // Create Interface buttons!
nicholas@2538 72 var interfaceButtons = document.createElement('div');
nicholas@2538 73 interfaceButtons.id = 'interface-buttons';
nicholas@2538 74 interfaceButtons.style.height = '25px';
nicholas@2538 75
nicholas@2538 76 // Create playback start/stop points
nicholas@2538 77 var playback = document.createElement("button");
nicholas@2538 78 playback.innerHTML = 'Stop';
nicholas@2538 79 playback.id = 'playback-button';
nicholas@2538 80 playback.style.float = 'left';
nicholas@2538 81 // onclick function. Check if it is playing or not, call the correct function in the
nicholas@2538 82 // audioEngine, change the button text to reflect the next state.
nicholas@2538 83 playback.onclick = function () {
nicholas@2538 84 if (audioEngineContext.status == 1) {
nicholas@2538 85 audioEngineContext.stop();
nicholas@2538 86 this.innerHTML = 'Stop';
nickjillings@1341 87 var time = audioEngineContext.timer.getTestTime();
nickjillings@1341 88 console.log('Stopped at ' + time); // DEBUG/SAFETY
nicholas@2538 89 }
nicholas@2538 90 };
nicholas@2538 91 // Append the interface buttons into the interfaceButtons object.
nicholas@2538 92 interfaceButtons.appendChild(playback);
nicholas@2538 93
nicholas@2538 94 // Global parent for the comment boxes on the page
nicholas@2538 95 var feedbackHolder = document.createElement('div');
nicholas@2538 96 feedbackHolder.id = 'feedbackHolder';
nicholas@2538 97
nicholas@2396 98 // Create outside reference holder
nicholas@2396 99 var outsideRef = document.createElement("div");
nicholas@2396 100 outsideRef.id = "outside-reference-holder";
nicholas@2538 101
nicholas@2538 102 // Construct the AB Boxes
nicholas@2538 103 var boxes = document.createElement('div');
nicholas@2538 104 boxes.align = "center";
nicholas@2538 105 boxes.id = "box-holders";
nickjillings@1341 106 boxes.style.float = "left";
nicholas@2538 107
nicholas@2538 108 var submit = document.createElement('button');
nicholas@2538 109 submit.id = "submit";
nicholas@2538 110 submit.onclick = buttonSubmitClick;
nicholas@2538 111 submit.className = "big-button";
nicholas@2538 112 submit.textContent = "submit";
nicholas@2538 113 submit.style.position = "relative";
nicholas@2538 114 submit.style.left = (window.innerWidth - 250) / 2 + 'px';
nicholas@2538 115
nicholas@2538 116 feedbackHolder.appendChild(boxes);
nicholas@2538 117
nicholas@2475 118 // Create holder for comment boxes
nicholas@2475 119 var comments = document.createElement("div");
nicholas@2475 120 comments.id = "comment-box-holder";
nicholas@2538 121
nicholas@2538 122 // Inject into HTML
nicholas@2538 123 testContent.appendChild(title); // Insert the title
nicholas@2538 124 testContent.appendChild(pagetitle);
nicholas@2538 125 testContent.appendChild(interfaceButtons);
nicholas@2396 126 testContent.appendChild(outsideRef);
nicholas@2538 127 testContent.appendChild(feedbackHolder);
nicholas@2538 128 testContent.appendChild(submit);
nicholas@2475 129 testContent.appendChild(comments);
nicholas@2538 130 interfaceContext.insertPoint.appendChild(testContent);
nickjillings@1341 131
nicholas@2538 132 // Load the full interface
nicholas@2538 133 testState.initialise();
nicholas@2538 134 testState.advanceState();
nickjillings@1341 135 }
nickjillings@1341 136
nicholas@2538 137 function loadTest(audioHolderObject) {
nicholas@2538 138 var feedbackHolder = document.getElementById('feedbackHolder');
nicholas@2651 139 var interfaceObj = interfaceContext.getCombinedInterfaces(audioHolderObject);
nicholas@2538 140 if (interfaceObj.length > 1) {
nicholas@2538 141 console.log("WARNING - This interface only supports one <interface> node per page. Using first interface node");
nicholas@2538 142 }
nicholas@2538 143 interfaceObj = interfaceObj[0];
nicholas@2538 144
nicholas@2475 145 var commentHolder = document.getElementById('comment-box-holder');
nicholas@2475 146 commentHolder.innerHTML = "";
nicholas@2538 147
nicholas@2396 148 // Delete outside reference
nicholas@2538 149 var outsideReferenceHolder = document.getElementById("outside-reference-holder");
nicholas@2396 150 outsideReferenceHolder.innerHTML = "";
nicholas@2538 151
nicholas@2470 152 // Set the page title
nicholas@2470 153 if (typeof audioHolderObject.title == "string" && audioHolderObject.title.length > 0) {
nicholas@2691 154 document.getElementById("test-title").textContent = audioHolderObject.title;
nicholas@2470 155 }
nicholas@2538 156
nicholas@2691 157 if (interfaceObj.title !== null) {
nicholas@2538 158 document.getElementById("pageTitle").textContent = interfaceObj.title;
nicholas@2538 159 }
nicholas@2538 160
nicholas@2651 161 var interfaceOptions = interfaceObj.options;
nicholas@2394 162 // Clear the interfaceElements
nicholas@2394 163 {
nicholas@2394 164 var node = document.getElementById('playback-holder');
nicholas@2538 165 if (node) {
nicholas@2538 166 feedbackHolder.removeChild(node);
nicholas@2538 167 }
nicholas@2394 168 node = document.getElementById('page-count');
nicholas@2538 169 if (node) {
nicholas@2538 170 document.getElementById('interface-buttons').removeChild(node);
nicholas@2538 171 }
nicholas@2394 172 node = document.getElementById('master-volume-holder-float');
nicholas@2538 173 if (node) {
nicholas@2538 174 feedbackHolder.removeChild(node);
nicholas@2538 175 }
nicholas@2394 176 }
nicholas@2538 177
n@2407 178 // Populate the comparator object
nicholas@2538 179 interfaceContext.comparator = new comparator(audioHolderObject);
nicholas@2538 180
nicholas@2538 181 for (var option of interfaceOptions) {
nicholas@2538 182 if (option.type == "show") {
nicholas@2538 183 switch (option.name) {
nickjillings@1356 184 case "playhead":
nickjillings@1356 185 var playbackHolder = document.getElementById('playback-holder');
nicholas@2691 186 if (playbackHolder === null) {
nickjillings@1356 187 playbackHolder = document.createElement('div');
nicholas@2394 188 playbackHolder.id = 'playback-holder';
nickjillings@1356 189 playbackHolder.style.width = "100%";
nickjillings@1356 190 playbackHolder.style.float = "left";
nickjillings@1356 191 playbackHolder.align = 'center';
nickjillings@1356 192 playbackHolder.appendChild(interfaceContext.playhead.object);
nickjillings@1356 193 feedbackHolder.appendChild(playbackHolder);
nickjillings@1356 194 }
nickjillings@1356 195 break;
nickjillings@1356 196 case "page-count":
nickjillings@1356 197 var pagecountHolder = document.getElementById('page-count');
nicholas@2691 198 if (pagecountHolder === null) {
nickjillings@1356 199 pagecountHolder = document.createElement('div');
nickjillings@1356 200 pagecountHolder.id = 'page-count';
nicholas@2393 201 document.getElementById('interface-buttons').appendChild(pagecountHolder);
nickjillings@1356 202 }
nicholas@2538 203 pagecountHolder.innerHTML = '<span>Page ' + (testState.stateIndex + 1) + ' of ' + testState.stateMap.length + '</span>';
nickjillings@1356 204 break;
nickjillings@1356 205 case "volume":
nicholas@2691 206 if (document.getElementById('master-volume-holder-float') === null) {
nickjillings@1356 207 feedbackHolder.appendChild(interfaceContext.volume.object);
nickjillings@1356 208 }
nickjillings@1356 209 break;
n@2407 210 case "comments":
n@2407 211 // Generate one comment box per presented page
nicholas@2538 212 for (var element of audioEngineContext.audioObjects) {
n@2407 213 interfaceContext.commentBoxes.createCommentBox(element);
n@2407 214 }
nicholas@2538 215 interfaceContext.commentBoxes.showCommentBoxes(commentHolder, true);
n@2407 216 break;
nickjillings@1356 217 }
nickjillings@1356 218 }
nickjillings@1356 219 }
nicholas@2538 220
nicholas@2538 221 $(audioHolderObject.commentQuestions).each(function (index, element) {
nicholas@2538 222 var node = interfaceContext.createCommentQuestion(element);
nicholas@2538 223 commentHolder.appendChild(node.holder);
nicholas@2538 224 });
nicholas@2538 225
nicholas@2538 226 resizeWindow(null);
nickjillings@1341 227 }
nickjillings@1341 228
nicholas@2538 229 function comparator(audioHolderObject) {
nicholas@2538 230 this.comparatorBox = function (audioElement, id, text) {
nicholas@2538 231 this.parent = audioElement;
nicholas@2538 232 this.id = id;
nicholas@2538 233 this.value = 0;
nicholas@2538 234 this.disabled = true;
nicholas@2538 235 this.box = document.createElement('div');
nicholas@2538 236 this.box.className = 'comparator-holder';
nicholas@2538 237 this.box.setAttribute('track-id', audioElement.id);
nicholas@2538 238 this.box.id = 'comparator-' + text;
nicholas@2538 239 this.selector = document.createElement('div');
nicholas@2538 240 this.selector.className = 'comparator-selector disabled';
nicholas@2538 241 var selectorText = document.createElement('span');
nicholas@2538 242 selectorText.textContent = text;
nicholas@2538 243 this.selector.appendChild(selectorText);
nicholas@2538 244 this.playback = document.createElement('button');
nicholas@2538 245 this.playback.className = 'comparator-button';
nicholas@2538 246 this.playback.disabled = true;
nicholas@2538 247 this.playback.textContent = "Listen";
nicholas@2538 248 this.box.appendChild(this.selector);
nicholas@2538 249 this.box.appendChild(this.playback);
nicholas@2691 250 this.selectorClicked = function () {
nicholas@2691 251 var i;
nicholas@2538 252 var time = audioEngineContext.timer.getTestTime();
nicholas@2691 253 if (this.parent.state !== 1) {
nicholas@2691 254 interfaceContext.lightbox.post("Message", "Please wait for the sample to load");
nicholas@2538 255 console.log("Please wait until sample has loaded");
nicholas@2538 256 return;
nickjillings@2112 257 }
nicholas@2691 258 if (audioEngineContext.status === 0) {
nicholas@2538 259 interfaceContext.lightbox.post("Message", "Please listen to the samples before making a selection");
nicholas@2538 260 console.log("Please listen to the samples before making a selection");
nicholas@2538 261 return;
nicholas@2538 262 }
nicholas@2691 263 interfaceContext.comparator.selected = this.id;
nicholas@2691 264 $(".comparator-selector").removeClass('selected');
nicholas@2691 265 $(this.selector).addClass('selected');
nicholas@2691 266 this.comparator.comparators.forEach(function (a) {
nicholas@2691 267 if (a !== this) {
nicholas@2691 268 a.value = 0;
nicholas@2691 269 } else {
nicholas@2691 270 a.value = 1;
nickjillings@2112 271 }
nicholas@2693 272 a.parent.metric.moved(time, a.value);
nicholas@2691 273 }, this);
nicholas@2691 274 console.log("Selected " + this.id + ' (' + time + ')');
nicholas@2538 275 };
nicholas@2538 276 this.playback.setAttribute("playstate", "ready");
nicholas@2691 277 this.playbackClicked = function () {
n@2694 278 if (this.playback.getAttribute("playstate") == "ready") {
nicholas@2691 279 audioEngineContext.play(this.id);
n@2694 280 } else if (this.playback.getAttribute("playstate") == "playing") {
nickjillings@1376 281 audioEngineContext.stop();
nickjillings@1376 282 }
nicholas@2538 283
nicholas@2538 284 };
nicholas@2691 285 this.handleEvent = function (event) {
nicholas@2691 286 if (event.currentTarget === this.selector) {
nicholas@2691 287 this.selectorClicked();
nicholas@2691 288 } else if (event.currentTarget === this.playback) {
nicholas@2691 289 this.playbackClicked();
nicholas@2691 290 }
nicholas@2691 291 }
nicholas@2691 292 this.playback.addEventListener("click", this);
nicholas@2691 293 this.selector.addEventListener("click", this);
nicholas@2538 294
nicholas@2538 295 this.enable = function () {
nicholas@2538 296 if (this.parent.state == 1) {
nicholas@2538 297 $(this.selector).removeClass('disabled');
nicholas@2538 298 this.playback.disabled = false;
nicholas@2538 299 }
nicholas@2538 300 };
nicholas@2538 301 this.updateLoading = function (progress) {
nicholas@2538 302 if (progress != 100) {
nicholas@2538 303 progress = String(progress);
nicholas@2538 304 progress = progress.split('.')[0];
nicholas@2538 305 this.playback.textContent = progress + '%';
nicholas@2538 306 } else {
nicholas@2538 307 this.playback.textContent = "Play";
nicholas@2538 308 }
nicholas@2538 309 };
nicholas@2538 310 this.error = function () {
nickjillings@2113 311 // audioObject has an error!!
nickjillings@2113 312 this.playback.textContent = "Error";
nickjillings@2113 313 $(this.playback).addClass("error-colour");
nicholas@2691 314 };
nicholas@2538 315 this.startPlayback = function () {
n@2426 316 if (this.parent.specification.parent.playOne || specification.playOne) {
n@2426 317 $('.comparator-button').text('Wait');
nicholas@2538 318 $('.comparator-button').attr("disabled", "true");
nicholas@2576 319 $(this.playback).css("disabled", "false");
n@2426 320 } else {
n@2426 321 $('.comparator-button').text('Listen');
n@2426 322 }
nickjillings@1376 323 $(this.playback).text('Stop');
nicholas@2538 324 this.playback.setAttribute("playstate", "playing");
nickjillings@1360 325 };
nicholas@2538 326 this.stopPlayback = function () {
n@2426 327 if (this.playback.getAttribute("playstate") == "playing") {
n@2426 328 $('.comparator-button').text('Listen');
n@2426 329 $('.comparator-button').removeAttr("disabled");
nicholas@2538 330 this.playback.setAttribute("playstate", "ready");
n@2426 331 }
nickjillings@1360 332 };
nicholas@2538 333 this.exportXMLDOM = function (audioObject) {
nicholas@2538 334 var node = storage.document.createElement('value');
nicholas@2538 335 node.textContent = this.value;
nicholas@2538 336 return node;
nicholas@2538 337 };
nicholas@2538 338 this.getValue = function () {
nicholas@2538 339 return this.value;
nicholas@2538 340 };
nicholas@2538 341 this.getPresentedId = function () {
nicholas@2538 342 return this.selector.children[0].textContent;
nicholas@2538 343 };
nicholas@2538 344 this.canMove = function () {
nicholas@2538 345 return false;
nicholas@2538 346 };
nicholas@2538 347 };
nicholas@2538 348
nicholas@2538 349 this.boxHolders = document.getElementById('box-holders');
nicholas@2538 350 this.boxHolders.innerHTML = "";
nicholas@2538 351 this.comparators = [];
nicholas@2538 352 this.selected = null;
nicholas@2538 353
nicholas@2607 354 var labelType = audioHolderObject.label;
nicholas@2607 355 if (labelType == "default") {
nicholas@2607 356 labelType = "capital";
nicholas@2607 357 }
nicholas@2607 358
nicholas@2538 359 // First generate the Audio Objects for the Audio Engine
nicholas@2538 360 for (var index = 0; index < audioHolderObject.audioElements.length; index++) {
nicholas@2538 361 var element = audioHolderObject.audioElements[index];
nickjillings@2177 362 var audioObject = audioEngineContext.newTrack(element);
nicholas@2538 363 if (index == audioHolderObject.outsideReference || element.type == 'outside-reference') {
nicholas@2538 364 var orNode = new interfaceContext.outsideReferenceDOM(audioObject, index, document.getElementById("outside-reference-holder"));
nicholas@2538 365 audioObject.bindInterface(orNode);
nickjillings@2177 366 } else {
nicholas@2607 367 var label = interfaceContext.getLabel(labelType, index, audioHolderObject.labelStart);
nicholas@2538 368 var node = new this.comparatorBox(audioObject, index, label);
nicholas@2691 369 Object.defineProperties(node, {
nicholas@2691 370 'comparator': {
nicholas@2691 371 'value': this
nicholas@2691 372 }
nicholas@2691 373 });
nickjillings@2177 374 audioObject.bindInterface(node);
nickjillings@2177 375 this.comparators.push(node);
nickjillings@2177 376 this.boxHolders.appendChild(node.box);
nickjillings@1295 377 }
nicholas@2538 378 }
nicholas@2538 379 return this;
nickjillings@1341 380 }
nickjillings@1341 381
nicholas@2538 382 function resizeWindow(event) {
nicholas@2538 383 document.getElementById('submit').style.left = (window.innerWidth - 250) / 2 + 'px';
nicholas@2538 384 var numObj = interfaceContext.comparator.comparators.length;
nicholas@2538 385 var boxW = numObj * 312;
nickjillings@1341 386 var diff = window.innerWidth - boxW;
nicholas@2538 387 while (diff < 0) {
nicholas@2538 388 numObj = Math.ceil(numObj / 2);
nicholas@2538 389 boxW = numObj * 312;
nickjillings@1341 390 diff = window.innerWidth - boxW;
nickjillings@1341 391 }
nicholas@2538 392 document.getElementById('box-holders').style.marginLeft = diff / 2 + 'px';
nicholas@2538 393 document.getElementById('box-holders').style.marginRight = diff / 2 + 'px';
nickjillings@1341 394 document.getElementById('box-holders').style.width = boxW + 'px';
nicholas@2538 395
nickjillings@2177 396 var outsideRef = document.getElementById('outside-reference');
nicholas@2691 397 if (outsideRef !== null) {
nicholas@2538 398 outsideRef.style.left = (window.innerWidth - 120) / 2 + 'px';
nicholas@2538 399 }
nickjillings@1341 400 }
nickjillings@1341 401
nicholas@2538 402 function buttonSubmitClick() {
nicholas@2651 403 var checks = testState.currentStateMap.interfaces[0].options,
nicholas@2651 404 canContinue = true;
nickjillings@1341 405
nicholas@2538 406 for (var i = 0; i < checks.length; i++) {
nicholas@2538 407 if (checks[i].type == 'check') {
nicholas@2691 408 var checkState;
nicholas@2538 409 switch (checks[i].name) {
nicholas@2538 410 case 'fragmentPlayed':
nicholas@2538 411 // Check if all fragments have been played
nicholas@2691 412 checkState = interfaceContext.checkAllPlayed();
nicholas@2691 413 if (checkState === false) {
nicholas@2538 414 canContinue = false;
nicholas@2538 415 }
nicholas@2538 416 break;
nicholas@2538 417 case 'fragmentFullPlayback':
nicholas@2538 418 // Check all fragments have been played to their full length
nicholas@2691 419 checkState = interfaceContext.checkFragmentsFullyPlayed();
nicholas@2691 420 if (checkState === false) {
nicholas@2538 421 canContinue = false;
nicholas@2538 422 }
nicholas@2538 423 break;
nicholas@2538 424 case 'fragmentMoved':
nicholas@2538 425 // Check all fragment sliders have been moved.
nicholas@2691 426 checkState = interfaceContext.checkAllMoved();
nicholas@2691 427 if (checkState === false) {
nicholas@2538 428 canContinue = false;
nicholas@2538 429 }
nicholas@2538 430 break;
nicholas@2538 431 case 'fragmentComments':
nicholas@2538 432 // Check all fragment sliders have been moved.
nicholas@2691 433 checkState = interfaceContext.checkAllCommented();
nicholas@2691 434 if (checkState === false) {
nicholas@2538 435 canContinue = false;
nicholas@2538 436 }
nicholas@2538 437 break;
nicholas@2538 438 case 'scalerange':
nicholas@2538 439 // Check the scale has been used effectively
nicholas@2691 440 checkState = interfaceContext.checkScaleRange(checks[i].min, checks[i].max);
nicholas@2691 441 if (checkState === false) {
nicholas@2538 442 canContinue = false;
nicholas@2538 443 }
nicholas@2538 444 break;
nicholas@2538 445 default:
nicholas@2538 446 console.log("WARNING - Check option " + checks[i].check + " is not supported on this interface");
nicholas@2538 447 break;
nicholas@2538 448 }
nicholas@2538 449
nicholas@2538 450 }
nicholas@2538 451 if (!canContinue) {
nicholas@2538 452 break;
nicholas@2538 453 }
nicholas@2538 454 }
nicholas@2538 455 if (canContinue) {
nicholas@2538 456 if (audioEngineContext.status == 1) {
nicholas@2538 457 var playback = document.getElementById('playback-button');
nicholas@2538 458 playback.click();
nicholas@2538 459 // 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 460 } else {
nicholas@2691 461 if (audioEngineContext.timer.testStarted === false) {
nicholas@2538 462 interfaceContext.lightbox.post("Warning", 'You have not started the test! Please click play on a sample to begin the test!');
nicholas@2538 463 return;
nicholas@2538 464 }
nicholas@2538 465 }
nicholas@2538 466 testState.advanceState();
nicholas@2538 467 }
nickjillings@1341 468 }
nickjillings@1341 469
nicholas@2538 470 function pageXMLSave(store, pageSpecification) {
nicholas@2538 471 // MANDATORY
nicholas@2538 472 // Saves a specific test page
nicholas@2538 473 // You can use this space to add any extra nodes to your XML <audioHolder> saves
nicholas@2538 474 // Get the current <page> information in store (remember to appendChild your data to it)
nicholas@2538 475 // pageSpecification is the current page node configuration
nicholas@2538 476 // To create new XML nodes, use storage.document.createElement();
nicholas@2538 477 }