changeset 3094:95e946ee225b

Merge branch 'vnext' into Dev_main # Conflicts: # interfaces/ape.js JSHinting Project
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Fri, 12 Jan 2018 16:11:20 +0000
parents 30ba1b9ed867 (current diff) 2861ad69b77d (diff)
children 20de79c56ad7
files interfaces/ape.js interfaces/ordinal.js
diffstat 3 files changed, 55 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/interfaces/ape.js	Fri Jan 12 15:46:05 2018 +0000
+++ b/interfaces/ape.js	Fri Jan 12 16:11:20 2018 +0000
@@ -4,7 +4,7 @@
  */
 
 /*globals window,interfaceContext, document, audioEngineContext, console, $, Interface, testState, storage, specification */
-/*globals metricTracker */
+/*globals metricTracker, module, randomiseOrder */
 // Once this is loaded and parsed, begin execution
 loadInterface();
 
@@ -218,10 +218,10 @@
 }
 
 function ape() {
-    var axis = []
+    var axis = [];
     var DOMRoot = document.getElementById("slider-holder");
     var AOIs = [];
-    var page = undefined;
+    var page;
 
     function audioObjectInterface(audioObject, parent) {
         // The audioObject communicates with this object
@@ -231,39 +231,39 @@
             sliders.forEach(function (s) {
                 s.enable();
             });
-        }
+        };
 
         this.updateLoading = function (p) {
             sliders.forEach(function (s) {
                 s.updateLoading(p);
             });
-        }
+        };
 
         this.startPlayback = function () {
             playing = true;
             sliders.forEach(function (s) {
                 s.playing();
             });
-        }
+        };
 
         this.stopPlayback = function () {
             playing = false;
             sliders.forEach(function (s) {
                 s.stopped();
             });
-        }
+        };
 
         this.getValue = function () {
             return sliders[0].value;
-        }
+        };
 
         this.getPresentedId = function () {
             return sliders[0].label;
-        }
+        };
 
         this.canMove = function () {
             return true;
-        }
+        };
 
         this.exportXMLDOM = function (audioObject) {
             var elements = [];
@@ -271,17 +271,17 @@
                 elements.push(s.exportXMLDOM());
             });
             return elements;
-        }
+        };
 
         this.error = function () {
             sliders.forEach(function (s) {
                 s.error();
             });
-        }
+        };
 
         this.addSlider = function (s) {
             sliders.push(s);
-        }
+        };
 
         this.clicked = function (event) {
             if (!playing) {
@@ -290,14 +290,14 @@
                 audioEngineContext.stop();
             }
             playing = !playing;
-        }
+        };
 
         this.pageXMLSave = function (store) {
             var inject = audioObject.storeDOM.getElementsByTagName("metric")[0];
             sliders.forEach(function (s) {
                 s.pageXMLSave(inject);
             });
-        }
+        };
 
     }
 
@@ -316,39 +316,39 @@
             metric.initialise(this.value);
             this.setLabel = function (s) {
                 label = s;
-            }
+            };
             this.resize = function (event) {
                 var width = $(axisInterface.sliderRail).width();
                 var w = Number(value * width);
                 trackObj.style.left = String(w) + "px";
-            }
+            };
             this.playing = function () {
                 trackObj.classList.add("track-slider-playing");
-            }
+            };
             this.stopped = function () {
                 trackObj.classList.remove("track-slider-playing");
-            }
+            };
             this.enable = function () {
                 trackObj.addEventListener("mousedown", this);
                 trackObj.addEventListener("mouseup", this);
                 trackObj.classList.remove("track-slider-disabled");
                 labelHolder.textContent = label;
-            }
+            };
             this.updateLoading = function (progress) {
                 labelHolder.textContent = progress + "%";
-            }
+            };
             this.exportXMLDOM = function () {
                 var node = storage.document.createElement('value');
-                node.setAttribute("interface-name", axisInterface.name)
+                node.setAttribute("interface-name", axisInterface.name);
                 node.textContent = this.value;
                 return node;
-            }
+            };
             this.error = function () {
                 trackObj.classList.add("error-colour");
                 trackObj.removeEventListener("mousedown");
                 trackObj.removeEventListener("mouseup");
-            }
-            var timing = undefined;
+            };
+            var timing;
             this.handleEvent = function (e) {
                 // This is only for the mousedown / touchdown
                 if (e.preventDefault) {
@@ -361,10 +361,10 @@
                     metric.moved(audioEngineContext.timer.getTestTime(), this.value);
                     console.log("Slider " + label + " on axis " + axisInterface.name + " moved to " + this.value);
                 }
-            }
+            };
             this.clicked = function (e) {
                 AOI.clicked();
-            }
+            };
             this.pageXMLSave = function (inject) {
                 var nodes = metric.exportXMLDOM(inject);
                 nodes.forEach(function (elem) {
@@ -375,10 +375,10 @@
                         inject.removeChild(elem);
                     }
                 });
-            }
+            };
             this.hasMoved = function () {
                 return metric.wasMoved;
-            }
+            };
             Object.defineProperties(this, {
                 "DOM": {
                     "value": trackObj
@@ -450,13 +450,12 @@
         var UI = {
             selected: undefined,
             startTime: undefined
-        }
+        };
         this.name = interfaceObject.name;
         var DOMRoot = document.createElement("div");
         parent.getDOMRoot().appendChild(DOMRoot);
         DOMRoot.className = "sliderCanvasDiv";
         DOMRoot.id = "sliderCanvasHolder-" + this.name;
-        var sliders = [];
 
         var axisTitle = document.createElement("div");
         axisTitle.className = "pageTitle";
@@ -527,7 +526,7 @@
             tickCanvas.width = $(sliderRail).width();
             tickCanvas.style.width = tickCanvas.width + "px";
             createScaleMarkers(interfaceObject, scale, $(sliderRail).width());
-        }
+        };
         this.playing = function (id) {
             var node = audioEngineContext.audioObjects.find(function (a) {
                 return a.id == id;
@@ -538,20 +537,20 @@
             }
             var imgurl = node.specification.image || interfaceObject.image || "";
             this.imageHolder.setImage(imgurl);
-        }
+        };
         this.stopped = function () {
             var imgurl = interfaceObject.image || "";
             this.imageHolder.setImage(imgurl);
-        }
+        };
         this.addSlider = function (aoi) {
             var node = new sliderInterface(aoi, this);
             sliders.push(node);
             return node;
-        }
+        };
         this.mousedown = function (sliderUI) {
             UI.selected = sliderUI;
             UI.startTime = new Date();
-        }
+        };
         this.mouseup = function (event) {
             var delta = new Date() - UI.startTime;
             if (delta < 200) {
@@ -561,7 +560,7 @@
             }
             UI.selected = undefined;
             UI.startTime = undefined;
-        }
+        };
         this.handleEvent = function (event) {
             function getTargetSlider(target) {
                 return sliders.find(function (a) {
@@ -609,7 +608,7 @@
                     this.mouseup(event);
                 }
             }
-        }
+        };
         this.checkAllMoved = function () {
             var notMoved = sliders.filter(function (s) {
                 return !s.hasMoved();
@@ -618,7 +617,7 @@
                 var ls = [];
                 notMoved.forEach(function (s) {
                     ls.push(s.label);
-                })
+                });
                 var str = "On axis \"" + interfaceObject.title + "\", ";
                 if (ls.length == 1) {
                     str += "slider " + ls[0];
@@ -630,7 +629,7 @@
             } else {
                 return "";
             }
-        }
+        };
         this.checkScaleRange = function () {
             var scaleRange = interfaceObject.options.find(function (a) {
                 return a.name == "scalerange";
@@ -652,7 +651,7 @@
                 return "On axis \"" + interfaceObject.title + "\", you have not used the required width of the scales";
             }
             return "";
-        }
+        };
         sliderRail.addEventListener("mousemove", this);
         sliderRail.addEventListener("touchstart", this);
         sliderRail.addEventListener("touchmove", this);
@@ -666,16 +665,16 @@
     }
     this.getDOMRoot = function () {
         return DOMRoot;
-    }
+    };
     this.getPage = function () {
         return page;
-    }
+    };
     this.clear = function () {
         page = undefined;
         axis = [];
         AOIs = [];
         DOMRoot.innerHTML = "";
-    }
+    };
     this.initialisePage = function (page_init) {
         this.clear();
         page = page_init;
@@ -723,9 +722,9 @@
                 }
             }
         });
-    }
+    };
     this.checkAllMoved = function () {
-        var str = "You have not moved the following sliders. "
+        var str = "You have not moved the following sliders. ";
         var cont = true;
         axis.forEach(function (a) {
             var msg = a.checkAllMoved();
@@ -740,7 +739,7 @@
             console.log(str);
         }
         return cont;
-    }
+    };
     this.checkScaleRange = function () {
         var str = "";
         var cont = true;
@@ -757,19 +756,19 @@
             console.log(str);
         }
         return cont;
-    }
+    };
     this.pageXMLSave = function (store, pageSpecification) {
         if (axis.length > 1) {
             AOIs.forEach(function (ao) {
                 ao.pageXMLSave(store);
             });
         }
-    }
+    };
     this.resize = function (event) {
         axis.forEach(function (a) {
             a.resize(event);
         });
-    }
+    };
 }
 
 function outsideReferenceDOM(audioObject, index, inject) {
--- a/interfaces/blank.js	Fri Jan 12 15:46:05 2018 +0000
+++ b/interfaces/blank.js	Fri Jan 12 16:11:20 2018 +0000
@@ -9,7 +9,7 @@
 function loadInterface() {
     // Use this to do any one-time page / element construction. For instance, placing any stationary text objects,
     // holding div's, or setting up any nodes which are present for the entire test sequence
-};
+}
 
 function loadTest(page) {
     // Called each time a new test page is to be build. The page specification node is the only item passed in
@@ -50,8 +50,8 @@
     };
     this.error = function () {
         // If there is an error with the audioObject, this will be called to indicate a failure
-    }
-};
+    };
+}
 
 function resizeWindow(event) {
     // Called on every window resize event, use this to scale your page properly
--- a/interfaces/ordinal.js	Fri Jan 12 15:46:05 2018 +0000
+++ b/interfaces/ordinal.js	Fri Jan 12 16:11:20 2018 +0000
@@ -2,7 +2,7 @@
  * WAET Blank Template
  * Use this to start building your custom interface
  */
-/*globals interfaceContext, window, document, specification, audioEngineContext, console, testState, $, storage */
+/*globals interfaceContext, window, document, specification, audioEngineContext, console, testState, $, storage, sessionStorage */
 // Once this is loaded and parsed, begin execution
 loadInterface();
 
@@ -271,11 +271,11 @@
 
         e.dataTransfer.dropEffect = 'move'; // See the section on the DataTransfer object.
         var srcid = e.dataTransfer.getData('text/plain');
-        if (srcid == "") {
+        if (srcid === "") {
             srcid = sessionStorage.getItem("drag-object");
         }
         console.log(srcid);
-        var srcid = Number(srcid);
+        srcid = Number(srcid);
         var elements = container.childNodes;
         var srcObject = audioEngineContext.audioObjects.find(function (ao) {
             return ao.id === srcid;