mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-24 01:08:10 +02:00
Move video markup into a separate file
This commit is contained in:
39
docs/_static/timestamps.js
vendored
39
docs/_static/timestamps.js
vendored
@@ -1,30 +1,29 @@
|
||||
/*jshint esversion: 6 */
|
||||
|
||||
(function() {
|
||||
function init_timestamps() {
|
||||
var loc = document.getElementById('timestamps-for-intro-video');
|
||||
if (loc) {
|
||||
var dl = loc.querySelector('dl');
|
||||
dl.querySelectorAll('dt').forEach(dt => {
|
||||
dt.innerHTML = '<a href="javascript:void(0)" style="text-decoration: none"><time>' + dt.innerHTML + '</time></a>';
|
||||
dt.style.display = 'inline';
|
||||
function init_timestamps() {
|
||||
document.querySelectorAll('.timestamp-list').forEach(loc => {
|
||||
var dl = loc.querySelector('dl');
|
||||
dl.querySelectorAll('dt').forEach(dt => {
|
||||
dt.innerHTML = '<a href="javascript:void(0)" style="text-decoration: none"><time>' + dt.innerHTML + '</time></a>';
|
||||
dt.style.display = 'inline';
|
||||
});
|
||||
dl.addEventListener('click', handle_timestamp_click);
|
||||
});
|
||||
dl.addEventListener('click', handle_timestamp_click);
|
||||
}
|
||||
}
|
||||
|
||||
function handle_timestamp_click(e) {
|
||||
if (e.target.tagName.toUpperCase() === 'TIME') {
|
||||
const timestamp = e.target.textContent;
|
||||
if (timestamp) {
|
||||
const [minutes, seconds] = timestamp.split(':');
|
||||
const totalSeconds = parseInt(minutes) * 60 + parseInt(seconds);
|
||||
const video = document.querySelector('video');
|
||||
video.currentTime = totalSeconds;
|
||||
video.play();
|
||||
function handle_timestamp_click(e) {
|
||||
if (e.target.tagName.toUpperCase() === 'TIME') {
|
||||
const timestamp = e.target.textContent;
|
||||
if (timestamp) {
|
||||
const [minutes, seconds] = timestamp.split(':');
|
||||
const totalSeconds = parseInt(minutes) * 60 + parseInt(seconds);
|
||||
const video = document.querySelector('video');
|
||||
video.currentTime = totalSeconds;
|
||||
video.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('load', init_timestamps);
|
||||
window.addEventListener('load', init_timestamps);
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user