From 7e34cbaacf679fb0683751d6adfe731b225a7754 Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Tue, 29 Dec 2020 13:15:21 -0600 Subject: Clean: add ES6 modernizations to video jump script --- templates/page.tmpl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'templates/page.tmpl') diff --git a/templates/page.tmpl b/templates/page.tmpl index 1b694bd5..3f3044a9 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -65,22 +65,22 @@ This could be extended to accept hours in the time stamp as well, but currently does not. */ - var mainVideo; - var timestamps; + let mainVideo; + let timestamps; // expects a string like "mm:ss" function parseSeconds(timeString) { - times = timeString.split(":"); - minutes = parseFloat(times[0]); - seconds = parseFloat(times[1]); + const times = timeString.split(":"); + const minutes = parseFloat(times[0]); + const seconds = parseFloat(times[1]); return (minutes * 60) + seconds; } window.onload = function initScript() { mainVideo = document.getElementById("mainVideo"); timestamps = document.getElementsByClassName("time-link"); - len = timestamps.length; - for (i = 0; i < len; i++) { + let len = timestamps.length; + for (let i = 0; i < len; i++) { timestamps[i].onclick = function () { mainVideo.currentTime = parseSeconds(this.innerText) }; -- cgit v1.2.3