diff interfaces/horizontal-sliders.js @ 2607:342ef7948c47

#37. All interfaces use interfaceContext.getLabel to generate labels
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Mon, 14 Nov 2016 16:12:34 +0000
parents 464c6c6692d6
children 22efb2d04bc9
line wrap: on
line diff
--- a/interfaces/horizontal-sliders.js	Mon Nov 14 15:48:26 2016 +0000
+++ b/interfaces/horizontal-sliders.js	Mon Nov 14 16:12:34 2016 +0000
@@ -154,7 +154,11 @@
 
     // Find all the audioElements from the audioHolder
     var index = 0;
-    $(page.audioElements).each(function (index, element) {
+    var labelType = page.label;
+    if (labelType == "default") {
+        labelType = "number";
+    }
+    $(page.audioElements).each(function (pageIndex, element) {
         // Find URL of track
         // In this jQuery loop, variable 'this' holds the current audioElement.
 
@@ -165,20 +169,7 @@
             audioObject.bindInterface(orNode);
         } else {
             // Create a slider per track
-            switch (audioObject.specification.parent.label) {
-                case "none":
-                    label = "";
-                    break;
-                case "letter":
-                    label = String.fromCharCode(97 + index);
-                    break;
-                case "capital":
-                    label = String.fromCharCode(65 + index);
-                    break;
-                default:
-                    label = "" + index;
-                    break;
-            }
+            var label = interfaceContext.getLabel(labelType, index, page.labelStart);
             var sliderObj = new sliderObject(audioObject, label);
 
             if (typeof page.initialPosition === "number") {