Mercurial > hg > webaudioevaluationtool
diff js/core.js @ 2725:9c01d5dd22a2
#163. Made comment box highlighting a core function
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Sat, 15 Apr 2017 11:59:21 +0100 |
parents | 2e1cafe93c78 |
children | a13adc8f8d3d |
line wrap: on
line diff
--- a/js/core.js Sat Apr 15 11:35:59 2017 +0100 +++ b/js/core.js Sat Apr 15 11:59:21 2017 +0100 @@ -2454,6 +2454,13 @@ this.trackCommentBox.style.width = boxwidth - 6 + "px"; }; this.resize(); + this.highlight = function (state) { + if (state === true) { + $(this.trackComment).addClass("comment-box-playing"); + } else { + $(this.trackComment).removeClass("comment-box-playing"); + } + }; }; commentBoxes.createCommentBox = function (audioObject) { var node = new this.elementCommentBox(audioObject); @@ -2486,6 +2493,19 @@ } this.boxes = []; }; + commentBoxes.highlightById = function (id) { + if (id === undefined || typeof id !== "number" || id >= this.boxes.length) { + console.log("Error - Invalid id"); + id = -1; + } + this.boxes.forEach(function (a) { + if (a.id === id) { + a.highlight(true); + } else { + a.highlight(false); + } + }); + }; return commentBoxes; })(); @@ -3669,7 +3689,7 @@ return value; } } - }) + }); } var window_depedancy_callback;