Commit c95292be authored by i❤computers's avatar i❤computers

Replace class with data-cue-position

parent 1a427b32
This diff is collapsed.
......@@ -5,14 +5,14 @@ document.addEventListener('DOMContentLoaded', function initializePage() {
var cues = [0.33, 0.57, 0.71, 1.38, 2.17, 2.36, 2.64, 3.88, 4.02, 4.32, 4.65, 5.1, 5.27, 5.52, 5.92, 6.28, 6.55, 7.37, 8.62, 9.48, 10.09, 10.36, 11.01, 11.82, 12.32, 13.15, 13.72, 14.01, 14.19, 14.65, 15.03, 15.37, 15.72, 16.14, 16.44, 16.74, 17.53, 17.91, 18.23, 18.9, 19.16, 19.52, 20.02, 21.29, 21.65, 21.94, 22.46, 23.28, 23.63, 23.88, 24.46, 24.75, 25.09, 25.59, 26.0, 26.48, 26.96, 27.26, 27.77, 28.21, 28.74, 29.58, 30.8, 31.58, 32.4, 32.77, 33.09, 33.82, 34.44, 34.68, 35.39, 35.89, 36.28, 37.03, 37.47, 37.97, 38.23, 38.63, 39.92, 40.18, 41.08, 42.11, 43.16, 43.64, 44.27, 45.1, 45.45, 46.09, 46.6, 46.87, 47.23, 48.06, 48.37, 48.91, 49.32, 49.76, 50.16, 50.52, 50.76, 51.04, 51.7, 52.44, 53.38, 54.3, 54.58, 55.04, 55.71, 56.16, 56.49, 57.02, 57.88, 58.46, 59.02, 59.45, 60.02];
var MAX_TRANSITION_TIME = 0.4; //make sure transition time matches in index.html's styling
var CUE_POSITION_PREFIX = '.cue-position-';
var cue_position_selector = function(index) { return "[data-cue-position='" + index + "']"};
cues.forEach(function setTransitionTimes(cue, index) {
if (index + 1 === cues.length){
return;
}
var cueDuration = cues[index + 1] - cue;
if (cueDuration < MAX_TRANSITION_TIME) {
$(CUE_POSITION_PREFIX + index).forEach(function (cueElement) {
$(cue_position_selector(index)).forEach(function (cueElement) {
cueElement.style.transitionDuration = cueDuration + "s";
});
}
......@@ -39,7 +39,7 @@ document.addEventListener('DOMContentLoaded', function initializePage() {
}
if (audio.currentTime >= cues[currentIndex]) {
$(CUE_POSITION_PREFIX + currentIndex).forEach(function (cueElement) {
$(cue_position_selector(currentIndex)).forEach(function (cueElement) {
cueElement.classList.add(HIGHLIGHTED_CLASS);
});
currentIndex++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment