mirror of
https://gitea.invidious.io/iv-org/invidious.git
synced 2024-08-15 00:53:41 +00:00
Don't use generic click handler for chapter widget
This commit is contained in:
parent
93a6464bbe
commit
f48aa0a2c2
2 changed files with 13 additions and 7 deletions
|
@ -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'));
|
||||
}))
|
|
@ -10,21 +10,21 @@
|
|||
<div class="description-chapters-content-container">
|
||||
<% chapters.each do | chapter | %>
|
||||
<%- start_in_seconds = chapter.start_ms.total_seconds.to_i %>
|
||||
<a href="/watch?v=<%-= video.id %>&t=<%=start_in_seconds %>">
|
||||
<div class="chapter" data-onclick="jump_to_time" data-jump-time="<%=start_in_seconds%>">
|
||||
<a href="/watch?v=<%-= video.id %>&t=<%=start_in_seconds %>" data-jump-time="<%=start_in_seconds%>" class="chapter-widget-buttons">
|
||||
<div class="chapter">
|
||||
<div class="thumbnail">
|
||||
<%- if !env.get("preferences").as(Preferences).thin_mode -%>
|
||||
<img loading="lazy" class="thumbnail" src="<%-=URI.parse(chapter.thumbnails[-1]["url"].to_s).request_target %>" alt="" data-onclick="jump_to_time" data-jump-time="<%=start_in_seconds%>"/>
|
||||
<img loading="lazy" class="thumbnail" src="<%-=URI.parse(chapter.thumbnails[-1]["url"].to_s).request_target %>" alt="<%=chapter.title%>"/>
|
||||
<%- else -%>
|
||||
<div class="thumbnail-placeholder" data-onclick="jump_to_time" data-jump-time="<%=start_in_seconds%>"></div>
|
||||
<div class="thumbnail-placeholder"></div>
|
||||
<%- end -%>
|
||||
</div>
|
||||
<%- if start_in_seconds > 0 -%>
|
||||
<p data-onclick="jump_to_time" data-jump-time="<%=start_in_seconds%>"><%-= recode_length_seconds(start_in_seconds) -%></p>
|
||||
<p><%-= recode_length_seconds(start_in_seconds) -%></p>
|
||||
<%- else -%>
|
||||
<p data-onclick="jump_to_time" data-jump-time="<%=start_in_seconds%>">0:00</p>
|
||||
<p>0:00</p>
|
||||
<%- end -%>
|
||||
<p data-onclick="jump_to_time" data-jump-time="<%=start_in_seconds%>"><%-=chapter.title-%></p>
|
||||
<p><%-=chapter.title-%></p>
|
||||
</div>
|
||||
</a>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in a new issue