From 6980ed89cbbe372138167cf1263f154fff67a201 Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Tue, 29 Dec 2020 11:50:05 -0600 Subject: Add: timestamp seek script to main template page, test talk05 links --- templates/page.tmpl | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'templates/page.tmpl') diff --git a/templates/page.tmpl b/templates/page.tmpl index 28d650ad..3e94e1ae 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -37,6 +37,24 @@ + @@ -48,7 +66,7 @@ -/ +/ @@ -221,6 +239,5 @@ Last edited - -- cgit v1.2.3 From 6740f652e528840df09d414fd18a05b1550d4dd9 Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Tue, 29 Dec 2020 11:53:26 -0600 Subject: Fix: time variable not being set in loop --- templates/page.tmpl | 1 + 1 file changed, 1 insertion(+) (limited to 'templates/page.tmpl') diff --git a/templates/page.tmpl b/templates/page.tmpl index 3e94e1ae..de7d488a 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -46,6 +46,7 @@ mainVideo = document.getElementById("mainVideo"); timestamps = document.getElementsByClassName("time-link"); len = timestamps.length; + var seconds; for (i = 0; i < len; i++) { seconds = parseFloat(timestamps[i].dataset["timestamp"]); -- cgit v1.2.3 From dd9c9e4225b220a30c132effba1bca2482dfa8cb Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Tue, 29 Dec 2020 12:09:57 -0600 Subject: Fix: use parsing of html instead of data attribute for timestamp --- templates/page.tmpl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'templates/page.tmpl') diff --git a/templates/page.tmpl b/templates/page.tmpl index de7d488a..722fa45b 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -41,14 +41,21 @@ var mainVideo; var timestamps; + // expects a string like "mm:ss" + function parseSeconds(timeString) { + times = timesString.split(":"); + minutes = parseFloat(times[0]); + seconds = parseFloat(times[1]); + return (minutes * 60) + seconds; + } + window.onload = function initScript() { console.log("initializing seek to time script"); mainVideo = document.getElementById("mainVideo"); timestamps = document.getElementsByClassName("time-link"); len = timestamps.length; - var seconds; for (i = 0; i < len; i++) { - seconds = parseFloat(timestamps[i].dataset["timestamp"]); + seconds = parseSeconds(timestamps[i].innerText); timestamps[i].onclick = function () { mainVideo.currentTime = seconds; -- cgit v1.2.3 From c2dc60a601e14cb2c8fd9a17177508c20b632a72 Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Tue, 29 Dec 2020 12:13:15 -0600 Subject: Fix: typo >:( --- templates/page.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates/page.tmpl') diff --git a/templates/page.tmpl b/templates/page.tmpl index 722fa45b..6d223308 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -43,7 +43,7 @@ // expects a string like "mm:ss" function parseSeconds(timeString) { - times = timesString.split(":"); + times = timeString.split(":"); minutes = parseFloat(times[0]); seconds = parseFloat(times[1]); return (minutes * 60) + seconds; -- cgit v1.2.3 From 88a2c4b653ba7f73ba18375ec4596efbd62c6ff4 Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Tue, 29 Dec 2020 12:22:21 -0600 Subject: Fix: event handler scoping --- templates/page.tmpl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'templates/page.tmpl') 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); } } -- cgit v1.2.3 From 184bf700f10dc43068c4d8d8fddd9f0b9d10ffcf Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Tue, 29 Dec 2020 12:26:51 -0600 Subject: Fix: callback function --- templates/page.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates/page.tmpl') diff --git a/templates/page.tmpl b/templates/page.tmpl index cafc6835..ec95256d 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -62,7 +62,7 @@ seconds = parseSeconds(timestamps[i].innerText); console.log("seconds: ", seconds); - timestamps[i].onclick = seekToTime(seconds); + timestamps[i].onclick = function () { seekToTime(seconds) }; } } -- cgit v1.2.3 From 0b4f9b035fcf204b8ce65076b84f55e297fa909b Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Tue, 29 Dec 2020 12:32:35 -0600 Subject: Fix: attempt fat arrow binding for callback time --- templates/page.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates/page.tmpl') diff --git a/templates/page.tmpl b/templates/page.tmpl index ec95256d..f380dc8d 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -62,7 +62,7 @@ seconds = parseSeconds(timestamps[i].innerText); console.log("seconds: ", seconds); - timestamps[i].onclick = function () { seekToTime(seconds) }; + timestamps[i].onclick = () => { seekToTime(seconds) }; } } -- cgit v1.2.3 From 6698f95f92d4adbd06a9dc302b4ccbe77bb760be Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Tue, 29 Dec 2020 12:40:21 -0600 Subject: Fix: bind callback properly (i hope) --- templates/page.tmpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'templates/page.tmpl') diff --git a/templates/page.tmpl b/templates/page.tmpl index f380dc8d..b71d7d19 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -62,7 +62,9 @@ seconds = parseSeconds(timestamps[i].innerText); console.log("seconds: ", seconds); - timestamps[i].onclick = () => { seekToTime(seconds) }; + timestamps[i].onclick = function () { + seekToTime(this.innerText) + }; } } -- cgit v1.2.3 From 3e0f5fb62efc3de9c6c0139500f0d20e9f2c381f Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Tue, 29 Dec 2020 12:41:43 -0600 Subject: Fix: missing string parsing in callback --- templates/page.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates/page.tmpl') diff --git a/templates/page.tmpl b/templates/page.tmpl index b71d7d19..e4a1c9f2 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -63,7 +63,7 @@ console.log("seconds: ", seconds); timestamps[i].onclick = function () { - seekToTime(this.innerText) + seekToTime(parseSeconds(this.innerText)) }; } } -- cgit v1.2.3 From 4626daf2d0f224d8654916ac03975ba21e431372 Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Tue, 29 Dec 2020 12:50:04 -0600 Subject: Clean: add some docs, clean up console logs, add LibreJS tag --- templates/page.tmpl | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'templates/page.tmpl') diff --git a/templates/page.tmpl b/templates/page.tmpl index e4a1c9f2..58f18640 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -38,6 +38,17 @@ -- cgit v1.2.3 From a06133c5976c8e20efa4b755d7c05f0faad2b843 Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Tue, 29 Dec 2020 12:52:55 -0600 Subject: Fix: LibreJS tag --- templates/page.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates/page.tmpl') diff --git a/templates/page.tmpl b/templates/page.tmpl index 58f18640..b04a8dc0 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -38,8 +38,8 @@ -- cgit v1.2.3 From 0fd8e72b8249e9001aa7119c7df4baa6d1d2909b Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Tue, 29 Dec 2020 13:08:55 -0600 Subject: Add: agpl-3.0 or later descriptor, additinoal AGPL notice in script --- templates/page.tmpl | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'templates/page.tmpl') diff --git a/templates/page.tmpl b/templates/page.tmpl index c8becae7..1b694bd5 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -38,16 +38,32 @@