changeset 1845:320c8b0458fe

Bug #1615 Fixed. Also set hostURL in schema to default to an empty string if not specified in <page>
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Mon, 22 Feb 2016 15:05:39 +0000
parents 8424449cd11d
children 43a4dbca4471
files interfaces/AB.js test-schema.xsd
diffstat 2 files changed, 24 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/interfaces/AB.js	Mon Feb 22 14:55:16 2016 +0000
+++ b/interfaces/AB.js	Mon Feb 22 15:05:39 2016 +0000
@@ -201,22 +201,31 @@
 				alert("Please listen to the samples before making a selection");
 				console.log("Please listen to the samples before making a selection");
 				return;
-			}
-			$(".comparator-selector").removeClass('selected');
+            }
 			var id = event.currentTarget.parentElement.getAttribute('track-id');
 			interfaceContext.comparator.selected = id;
-			$(event.currentTarget).addClass('selected');
-			for (var i=0; i<interfaceContext.comparator.comparators.length; i++)
-			{
-				var obj = interfaceContext.comparator.comparators[i];
-				if (i == id) {
-					obj.value = 1;
-				} else {
-					obj.value = 0;
-				}
-				obj.parent.metric.moved(time,obj.value);
-			}
-			console.log("Selected "+id+' ('+time+')');
+            if ($(event.currentTarget).hasClass("selected")) {
+                $(".comparator-selector").removeClass('selected');
+                for (var i=0; i<interfaceContext.comparator.comparators.length; i++)
+                {
+                     var obj = interfaceContext.comparator.comparators[i];
+                    obj.parent.metric.moved(time,0);
+                }
+            } else {
+                $(".comparator-selector").removeClass('selected');
+                $(event.currentTarget).addClass('selected');
+                for (var i=0; i<interfaceContext.comparator.comparators.length; i++)
+                {
+                    var obj = interfaceContext.comparator.comparators[i];
+                    if (i == id) {
+                        obj.value = 1;
+                    } else {
+                        obj.value = 0;
+                    }
+                    obj.parent.metric.moved(time,obj.value);
+                }
+                console.log("Selected "+id+' ('+time+')');
+            }
 		};
         this.playback.setAttribute("playstate","ready");
 		this.playback.onclick = function(event)
--- a/test-schema.xsd	Mon Feb 22 14:55:16 2016 +0000
+++ b/test-schema.xsd	Mon Feb 22 15:05:39 2016 +0000
@@ -47,7 +47,7 @@
         <xs:element ref="survey" minOccurs="0" maxOccurs="2"/>
       </xs:sequence>
       <xs:attribute ref="id" use="required"/>
-      <xs:attribute name="hostURL" type="xs:anyURI"/>
+      <xs:attribute name="hostURL" type="xs:anyURI" default=""/>
       <xs:attribute name="randomiseOrder" type="xs:boolean" default="false"/>
       <xs:attribute name="repeatCount" type="xs:nonNegativeInteger" default="0"/>
       <xs:attribute name="loop" type="xs:boolean" default="false"/>