Mercurial > hg > webaudioevaluationtool
diff js/core.js @ 2596:2d820b7413a7
#37: Completed interfaceContext.getLabel. APE uses this getLabel for creating the page labels.
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Thu, 10 Nov 2016 16:46:47 +0000 |
parents | 4fdaed765674 |
children | 8188efa9415d |
line wrap: on
line diff
--- a/js/core.js Thu Nov 10 16:31:01 2016 +0000 +++ b/js/core.js Thu Nov 10 16:46:47 2016 +0000 @@ -3250,9 +3250,9 @@ } switch (labelType) { case "letter": - return String.fromCharCode((index + offset) % 26 + 96); + return String.fromCharCode((index + offset) % 26 + 97); case "capital": - return String.fromCharCode((index + offset) % 26 + 65); + return String.fromCharCode((index + offset) % 26 + 66); case "number": return String(index + offset); default: @@ -3260,33 +3260,33 @@ } } - if (typeof labelStart !== "string") { + if (typeof labelStart !== "string" || labelStart.length == 0) { labelStart = String.fromCharCode(0); } switch (labelType) { case "letter": labelStart = labelStart.charCodeAt(0); - if (labelStart.charCodeAt(0) < 97 || label.charCodeAt(0) > 122) { + if (labelStart < 97 || labelStart > 122) { labelStart = 97; } labelStart -= 97; break; case "capital": labelStart = labelStart.charCodeAt(0); - if (labelStart.charCodeAt(0) < 65 || label.charCodeAt(0) > 90) { + if (labelStart < 65 || labelStart > 90) { labelStart = 65; } labelStart -= 65; break; case "number": - if (!isFinite(Number(label))) { + if (!isFinite(Number(labelStart))) { labelStart = 1; } break; case "none": default: - labelStart = ""; + labelStart = 0; } if (typeof index == "number") { return calculateLabel(labelType, index, labelStart);