changeset 3055:95af70fef794

Merge branch 'vnext' into Dev_main # Conflicts: # js/core.js
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Tue, 31 Oct 2017 10:00:19 +0000
parents 3f34bb9c4762 (current diff) aa1ceca04519 (diff)
children 05fa3ce95015
files js/core.js
diffstat 1 files changed, 6 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/js/core.js	Mon Oct 30 15:36:47 2017 +0000
+++ b/js/core.js	Tue Oct 31 10:00:19 2017 +0000
@@ -1115,7 +1115,7 @@
         } else {
             this.buttonProceed.textContent = 'Next';
         }
-        if (this.currentIndex > 0 && this.node.showBackButton)
+        if (this.currentIndex > 0)
             this.buttonPrevious.style.visibility = 'visible';
         else
             this.buttonPrevious.style.visibility = 'hidden';
@@ -2644,12 +2644,6 @@
             this.textArea.style.width = boxwidth - 6 + "px";
         };
         this.resize();
-        this.check = function () {
-            if (this.specification.mandatory && this.textArea.value.length == 0) {
-                return false;
-            }
-            return true;
-        }
     };
 
     this.radioBox = function (commentQuestion) {
@@ -2725,17 +2719,6 @@
             this.holder.style.width = boxwidth + "px";
         };
         this.resize();
-        this.check = function () {
-            if (this.specification.mandatory) {
-                var selected = this.options.find(function (o) {
-                    return o.checked;
-                });
-                if (selected === undefined) {
-                    return false;
-                }
-            }
-            return true;
-        };
     };
 
     this.checkboxBox = function (commentQuestion) {
@@ -2802,17 +2785,6 @@
             this.holder.style.width = boxwidth + "px";
         };
         this.resize();
-        this.check = function () {
-            if (this.specification.mandatory) {
-                var selected = this.options.filter(function (o) {
-                    return o.checked;
-                });
-                if (selected.length === 0) {
-                    return false;
-                }
-            }
-            return true;
-        };
     };
 
     this.sliderBox = function (commentQuestion) {
@@ -2870,9 +2842,6 @@
             this.slider.style.width = boxwidth - 24 + "px";
         };
         this.resize();
-        this.check = function () {
-            return true;
-        };
     };
 
     this.createCommentQuestion = function (element) {
@@ -2894,17 +2863,6 @@
         this.commentQuestions = [];
     };
 
-    this.checkCommentQuestions = function () {
-        var failed = this.commentQuestions.filter(function (a) {
-            return a.check() === false;
-        });
-        if (failed.length === 0) {
-            return true;
-        }
-        this.lightbox.post("Error", "Please answer the questions on the page.");
-        return false;
-    }
-
     this.outsideReferenceDOM = function (audioObject, index, inject) {
         this.parent = audioObject;
         this.outsideReferenceHolder = document.createElement('button');
@@ -3066,21 +3024,17 @@
         volume.slider.max = 12;
         volume.slider.value = 0;
         volume.slider.step = 1;
-        volume.captured = false;
         volume.handleEvent = function (event) {
-            if (event.type == "mousedown") {
-                volume.captured = true;
-            } else if (event.type == "mousemove" && volume.captured) {
+            if (event.type == "mousemove" || event.type == "mouseup") {
                 this.valueDB = Number(this.slider.value);
                 this.valueLin = decibelToLinear(this.valueDB);
                 this.valueText.textContent = this.valueDB + 'dB';
                 audioEngineContext.outputGain.gain.value = this.valueLin;
-                console.log(this.valueDB);
-            } else if (event.type == "mouseup") {
-                volume.captured = false;
+            }
+            if (event.type == "mouseup") {
                 this.onmouseup();
             }
-            //this.slider.value = this.valueDB;
+            this.slider.value = this.valueDB;
 
             if (event.stopPropagation) {
                 event.stopPropagation();
@@ -3103,7 +3057,6 @@
         };
         volume.slider.addEventListener("mousemove", volume);
         volume.root.addEventListener("mouseup", volume);
-        volume.root.addEventListener("mousedown", volume);
 
         var title = document.createElement('div');
         title.innerHTML = '<span>Master Volume Control</span>';
@@ -3675,7 +3628,7 @@
                     returnURL = specification.projectReturn;
                 }
             }
-            xmlhttp.open("POST", returnURL + "php/save.php?key=" + this.key + "&saveFilenamePrefix=" + this.parent.filenamePrefix + "&state=update");
+            xmlhttp.open("POST", returnURL + "php/save.php?key=" + this.key + "&saveFilenamePrefix=" + this.parent.filenamePrefix);
             xmlhttp.setRequestHeader('Content-Type', 'text/xml');
             xmlhttp.onerror = function () {
                 console.log('Error updating file to server!');
@@ -3713,7 +3666,6 @@
             } else {
                 saveURL += this.parent.filenamePrefix;
             }
-            saveURL += "&state=finish";
             return new Promise(function (resolve, reject) {
                 var xmlhttp = new XMLHttpRequest();
                 xmlhttp.open("POST", saveURL);