summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Shangreaux <grant@unabridgedsoftware.com>2020-12-29 12:22:21 -0600
committerGrant Shangreaux <grant@unabridgedsoftware.com>2020-12-29 12:22:21 -0600
commit88a2c4b653ba7f73ba18375ec4596efbd62c6ff4 (patch)
tree50e53e59d317773f5c5e78a4488253cd2081e957
parentc2dc60a601e14cb2c8fd9a17177508c20b632a72 (diff)
downloademacsconf-wiki-88a2c4b653ba7f73ba18375ec4596efbd62c6ff4.tar.xz
emacsconf-wiki-88a2c4b653ba7f73ba18375ec4596efbd62c6ff4.zip
Fix: event handler scoping
-rw-r--r--templates/page.tmpl11
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>