forked from mirror/invidious
Don't use generic click handler for chapter widget
This commit is contained in:
parent
dc7811f9bc
commit
266d4cc998
2 changed files with 13 additions and 7 deletions
|
@ -191,3 +191,9 @@ addEventListener('load', function (e) {
|
||||||
comments.innerHTML = '';
|
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">
|
<div class="description-chapters-content-container">
|
||||||
<% chapters.each do | chapter | %>
|
<% chapters.each do | chapter | %>
|
||||||
<%- start_in_seconds = chapter.start_ms.total_seconds.to_i %>
|
<%- start_in_seconds = chapter.start_ms.total_seconds.to_i %>
|
||||||
<a href="/watch?v=<%-= video.id %>&t=<%=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" data-onclick="jump_to_time" data-jump-time="<%=start_in_seconds%>">
|
<div class="chapter">
|
||||||
<div class="thumbnail">
|
<div class="thumbnail">
|
||||||
<%- if !env.get("preferences").as(Preferences).thin_mode -%>
|
<%- 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 -%>
|
<%- else -%>
|
||||||
<div class="thumbnail-placeholder" data-onclick="jump_to_time" data-jump-time="<%=start_in_seconds%>"></div>
|
<div class="thumbnail-placeholder"></div>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
</div>
|
</div>
|
||||||
<%- if start_in_seconds > 0 -%>
|
<%- 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 -%>
|
<%- else -%>
|
||||||
<p data-onclick="jump_to_time" data-jump-time="<%=start_in_seconds%>">0:00</p>
|
<p>0:00</p>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
<p data-onclick="jump_to_time" data-jump-time="<%=start_in_seconds%>"><%-=chapter.title-%></p>
|
<p><%-=chapter.title-%></p>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in a new issue