diff options
Diffstat (limited to 'assets')
| -rw-r--r-- | assets/css/default.css | 38 | ||||
| -rw-r--r-- | assets/js/player.js | 50 |
2 files changed, 80 insertions, 8 deletions
diff --git a/assets/css/default.css b/assets/css/default.css index 5b5f597e..00881253 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -441,16 +441,26 @@ p.video-data { margin: 0; font-weight: bold; font-size: 80%; } */ footer { - color: #919191; margin-top: auto; padding: 1.5em 0; text-align: center; max-height: 30vh; } -footer a { - color: #919191 !important; - text-decoration: underline; +.light-theme footer { + color: #7c7c7c; +} + +.dark-theme footer { + color: #adadad; +} + +.light-theme footer a { + color: #7c7c7c !important; +} + +.dark-theme footer a { + color: #adadad !important; } footer span { @@ -556,6 +566,14 @@ span > select { color: #303030; } + .no-theme footer { + color: #7c7c7c; + } + + .no-theme footer a { + color: #7c7c7c !important; + } + .light-theme .pure-menu-heading { color: #565d64; } @@ -589,7 +607,7 @@ span > select { } .dark-theme a { - color: #a0a0a0; + color: #adadad; text-decoration: none; } @@ -643,7 +661,7 @@ body.dark-theme { } .no-theme a { - color: #a0a0a0; + color: #adadad; text-decoration: none; } @@ -674,6 +692,14 @@ body.dark-theme { background-color: inherit; color: inherit; } + + .no-theme footer { + color: #adadad; + } + + .no-theme footer a { + color: #adadad !important; + } } diff --git a/assets/js/player.js b/assets/js/player.js index bb53ac24..16bb2752 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -98,11 +98,13 @@ if (video_data.params.quality === 'dash') { /** * Function for add time argument to url + * * @param {String} url + * @param {String} [base] * @returns {URL} urlWithTimeArg */ -function addCurrentTimeToURL(url) { - var urlUsed = new URL(url); +function addCurrentTimeToURL(url, base) { + var urlUsed = new URL(url, base); urlUsed.searchParams.delete('start'); var currentTime = Math.ceil(player.currentTime()); if (currentTime > 0) @@ -112,6 +114,50 @@ function addCurrentTimeToURL(url) { return urlUsed; } +/** + * Global variable to save the last timestamp (in full seconds) at which the external + * links were updated by the 'timeupdate' callback below. + * + * It is initialized to 5s so that the video will always restart from the beginning + * if the user hasn't really started watching before switching to the other website. + */ +var timeupdate_last_ts = 5; + +/** + * Callback that updates the timestamp on all external links + */ +player.on('timeupdate', function () { + // Only update once every second + let current_ts = Math.floor(player.currentTime()); + if (current_ts > timeupdate_last_ts) timeupdate_last_ts = current_ts; + else return; + + // YouTube links + + let elem_yt_watch = document.getElementById('link-yt-watch'); + let elem_yt_embed = document.getElementById('link-yt-embed'); + + let base_url_yt_watch = elem_yt_watch.getAttribute('data-base-url'); + let base_url_yt_embed = elem_yt_embed.getAttribute('data-base-url'); + + elem_yt_watch.href = addCurrentTimeToURL(base_url_yt_watch); + elem_yt_embed.href = addCurrentTimeToURL(base_url_yt_embed); + + // Invidious links + + let domain = window.location.origin; + + let elem_iv_embed = document.getElementById('link-iv-embed'); + let elem_iv_other = document.getElementById('link-iv-other'); + + let base_url_iv_embed = elem_iv_embed.getAttribute('data-base-url'); + let base_url_iv_other = elem_iv_other.getAttribute('data-base-url'); + + elem_iv_embed.href = addCurrentTimeToURL(base_url_iv_embed, domain); + elem_iv_other.href = addCurrentTimeToURL(base_url_iv_other, domain); +}); + + var shareOptions = { socials: ['fbFeed', 'tw', 'reddit', 'email'], |
