From 266d4cc998184a8476b52afcc72b60ab233ab99c Mon Sep 17 00:00:00 2001 From: syeopite Date: Mon, 22 Jan 2024 00:06:27 -0800 Subject: [PATCH] Don't use generic click handler for chapter widget --- assets/js/watch.js | 6 ++++++ .../components/description_chapters_widget.ecr | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/assets/js/watch.js b/assets/js/watch.js index 26ad138f..bae4ca38 100644 --- a/assets/js/watch.js +++ b/assets/js/watch.js @@ -191,3 +191,9 @@ addEventListener('load', function (e) { comments.innerHTML = ''; } }); + +const chapter_widget_buttons = document.getElementsByClassName("chapter-widget-buttons") +Array.from(chapter_widget_buttons).forEach(e => e.addEventListener("click", function (event) { + event.preventDefault(); + player.currentTime(e.getAttribute('data-jump-time')); +})) \ No newline at end of file diff --git a/src/invidious/views/components/description_chapters_widget.ecr b/src/invidious/views/components/description_chapters_widget.ecr index 8ff5aa3c..a3bc30cb 100644 --- a/src/invidious/views/components/description_chapters_widget.ecr +++ b/src/invidious/views/components/description_chapters_widget.ecr @@ -10,21 +10,21 @@
<% chapters.each do | chapter | %> <%- start_in_seconds = chapter.start_ms.total_seconds.to_i %> - -