diff options
author | Grant Shangreaux <grant@unabridgedsoftware.com> | 2020-12-29 12:22:21 -0600 |
---|---|---|
committer | Grant Shangreaux <grant@unabridgedsoftware.com> | 2020-12-29 12:22:21 -0600 |
commit | 88a2c4b653ba7f73ba18375ec4596efbd62c6ff4 (patch) | |
tree | 50e53e59d317773f5c5e78a4488253cd2081e957 | |
parent | c2dc60a601e14cb2c8fd9a17177508c20b632a72 (diff) | |
download | emacsconf-wiki-88a2c4b653ba7f73ba18375ec4596efbd62c6ff4.tar.xz emacsconf-wiki-88a2c4b653ba7f73ba18375ec4596efbd62c6ff4.zip |
Fix: event handler scoping
Diffstat (limited to '')
-rw-r--r-- | templates/page.tmpl | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/templates/page.tmpl b/templates/page.tmpl index 6d223308..cafc6835 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -49,17 +49,20 @@ return (minutes * 60) + seconds; } + function seekToTime(seconds) { + console.log("handler", seconds) + mainVideo.currentTime = seconds; + } + window.onload = function initScript() { - console.log("initializing seek to time script"); mainVideo = document.getElementById("mainVideo"); timestamps = document.getElementsByClassName("time-link"); len = timestamps.length; for (i = 0; i < len; i++) { seconds = parseSeconds(timestamps[i].innerText); + console.log("seconds: ", seconds); - timestamps[i].onclick = function () { - mainVideo.currentTime = seconds; - } + timestamps[i].onclick = seekToTime(seconds); } } </script> |