changeset 3095:20de79c56ad7

JSHinted Dev_main
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Fri, 12 Jan 2018 16:39:39 +0000
parents 95e946ee225b
children 90c7b42264d4
files interfaces/AB.js interfaces/ABX.js interfaces/ape.js interfaces/discrete.js js/core.js
diffstat 5 files changed, 23 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/interfaces/AB.js	Fri Jan 12 16:11:20 2018 +0000
+++ b/interfaces/AB.js	Fri Jan 12 16:39:39 2018 +0000
@@ -76,7 +76,7 @@
     boxes.id = "box-holders";
 
     var submitHolder = document.createElement("div");
-    submitHolder.id = "submit-holder"
+    submitHolder.id = "submit-holder";
     var submit = document.createElement('button');
     submit.id = "submit";
     submit.onclick = buttonSubmitClick;
--- a/interfaces/ABX.js	Fri Jan 12 16:11:20 2018 +0000
+++ b/interfaces/ABX.js	Fri Jan 12 16:39:39 2018 +0000
@@ -79,7 +79,7 @@
     boxes.id = "box-holders";
 
     var submitHolder = document.createElement("div");
-    submitHolder.id = "submit-holder"
+    submitHolder.id = "submit-holder";
     var submit = document.createElement('button');
     submit.id = "submit";
     submit.onclick = buttonSubmitClick;
--- a/interfaces/ape.js	Fri Jan 12 16:11:20 2018 +0000
+++ b/interfaces/ape.js	Fri Jan 12 16:39:39 2018 +0000
@@ -562,12 +562,14 @@
             UI.startTime = undefined;
         };
         this.handleEvent = function (event) {
+            // TODO: Functionalise and scope
             function getTargetSlider(target) {
                 return sliders.find(function (a) {
                     return a.DOM == target;
                 });
             }
             var time = audioEngineContext.timer.getTestTime();
+            var move, w;
             if (event.preventDefault) {
                 event.preventDefault();
             }
@@ -583,14 +585,13 @@
                 return;
             }
             if (event.type == "mousemove") {
-                var move = event.clientX - 6;
-                var w = $(sliderRail).width();
+                move = event.clientX - 6;
+                w = $(sliderRail).width();
                 move = Math.max(50, move);
                 move = Math.min(w, move);
                 UI.selected.value = (move / w);
             } else if (event.type == "touchmove") {
                 if (UI.selected == getTargetSlider(event.target)) {
-                    var move;
                     if (event.targetTouches) {
                         move = event.targetTouches[0].clientX - 6;
                     } else if (event.originalEvent.targetTouches) {
@@ -598,7 +599,7 @@
                     } else {
                         return;
                     }
-                    var w = $(event.currentTarget).width();
+                    w = $(event.currentTarget).width();
                     move = Math.max(50, move);
                     move = Math.min(w, move);
                     UI.selected.value = (move / w);
--- a/interfaces/discrete.js	Fri Jan 12 16:11:20 2018 +0000
+++ b/interfaces/discrete.js	Fri Jan 12 16:39:39 2018 +0000
@@ -2,7 +2,7 @@
  * WAET Blank Template
  * Use this to start building your custom interface
  */
-
+/*globals window, interfaceContext, testState, Interface, audioEngineContext, console, document, specification, $, storage*/
 // Once this is loaded and parsed, begin execution
 loadInterface();
 
@@ -115,7 +115,7 @@
     // Load the full interface
     testState.initialise();
     testState.advanceState();
-};
+}
 
 function loadTest(page) {
     // Called each time a new test page is to be build. The page specification node is the only item passed in
@@ -186,7 +186,7 @@
         text.textContent = a.text;
         h.appendChild(text);
         scaleTextHolder.appendChild(h);
-    })
+    });
 
     // Find all the audioElements from the audioHolder
     var index = 0;
@@ -268,13 +268,13 @@
         } else {
             audioEngineContext.stop();
         }
-    };
+    }
 
     function radioSelected(event) {
         var time = audioEngineContext.timer.getTestTime();
         audioObject.metric.moved(time, event.currentTarget.value);
         console.log("slider " + audioObject.id + " moved to " + event.currentTarget.value + "(" + time + ")");
-    };
+    }
 
     var root = document.createElement("div"),
         labelHolder = document.createElement("div"),
@@ -309,7 +309,7 @@
         } else if (event.currentTarget.type === "radio") {
             radioSelected(event);
         }
-    }
+    };
     this.enable = function () {
         // This is used to tell the interface object that playback of this node is ready
         button.disabled = "";
@@ -372,7 +372,7 @@
             "value": root
         }
     });
-};
+}
 
 function resizeWindow(event) {
     // Called on every window resize event, use this to scale your page properly
--- a/js/core.js	Fri Jan 12 16:11:20 2018 +0000
+++ b/js/core.js	Fri Jan 12 16:39:39 2018 +0000
@@ -2727,11 +2727,11 @@
         };
         this.resize();
         this.check = function () {
-            if (this.specification.mandatory && this.textArea.value.length == 0) {
+            if (this.specification.mandatory && this.textArea.value.length === 0) {
                 return false;
             }
             return true;
-        }
+        };
     };
 
     this.radioBox = function (commentQuestion) {
@@ -2810,11 +2810,11 @@
             var anyChecked = this.options.some(function (a) {
                 return a.checked;
             });
-            if (this.specification.mandatory && anyChecked == false) {
+            if (this.specification.mandatory && anyChecked === false) {
                 return false;
             }
             return true;
-        }
+        };
         this.resize();
     };
 
@@ -2885,7 +2885,7 @@
             var anyChecked = this.options.some(function (a) {
                 return a.checked;
             });
-            if (this.specification.mandatory && anyChecked == false) {
+            if (this.specification.mandatory && anyChecked === false) {
                 return false;
             }
             return true;
@@ -2949,7 +2949,7 @@
         };
         this.check = function () {
             return true;
-        }
+        };
         this.resize();
     };
 
@@ -2974,16 +2974,16 @@
 
     this.checkCommentQuestions = function () {
         var errored = this.commentQuestions.reduce(function (a, cq) {
-            if (cq.check() == false) {
+            if (cq.check() === false) {
                 a.push(cq);
             }
             return a;
         }, []);
-        if (errored.length == 0) {
+        if (errored.length === 0) {
             return true;
         }
         interfaceContext.lightbox.post("Message", "Not all the mandatory comment boxes below have been filled.");
-    }
+    };
 
     this.outsideReferenceDOM = function (audioObject, index, inject) {
         this.parent = audioObject;