mirror of
https://github.com/iv-org/invidious.git
synced 2025-11-11 09:38:30 -06:00
refactor: pass mark_watched_after_duration preference to frontend
This commit is contained in:
parent
0320b8a5a4
commit
1db6bd6c0e
@ -201,7 +201,9 @@ player.on('timeupdate', function () {
|
|||||||
// Only increase time watched when the time difference is one second or the video is not already marked as watched
|
// Only increase time watched when the time difference is one second or the video is not already marked as watched
|
||||||
const isOneSecondDifference = current_ts - last_player_time === 1;
|
const isOneSecondDifference = current_ts - last_player_time === 1;
|
||||||
const exceedsMarkWatchedAfterDuration = time_watched > MARK_WATCHED_AFTER_DURATION;
|
const exceedsMarkWatchedAfterDuration = time_watched > MARK_WATCHED_AFTER_DURATION;
|
||||||
const markWatchedAfterDuration = helpers.storage.get(STORAGE_MARK_WATCHED_AFTER_DURATION) ?? false;
|
|
||||||
|
const $markWatchedAfterDuration = document.getElementById(`${STORAGE_MARK_WATCHED_AFTER_DURATION}_pref`);
|
||||||
|
const markWatchedAfterDuration = $markWatchedAfterDuration.innerText === "true" ?? false;
|
||||||
|
|
||||||
if (!isOneSecondDifference || exceedsMarkWatchedAfterDuration || markWatchedAfterDuration === false) return;
|
if (!isOneSecondDifference || exceedsMarkWatchedAfterDuration || markWatchedAfterDuration === false) return;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<%
|
<%
|
||||||
locale = env.get("preferences").as(Preferences).locale
|
locale = env.get("preferences").as(Preferences).locale
|
||||||
dark_mode = env.get("preferences").as(Preferences).dark_mode
|
dark_mode = env.get("preferences").as(Preferences).dark_mode
|
||||||
|
mark_watched_after_duration = env.get("preferences").as(Preferences).mark_watched_after_duration
|
||||||
%>
|
%>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="<%= locale %>">
|
<html lang="<%= locale %>">
|
||||||
@ -27,6 +28,9 @@
|
|||||||
|
|
||||||
<body class="<%= dark_mode.blank? ? "no" : dark_mode %>-theme">
|
<body class="<%= dark_mode.blank? ? "no" : dark_mode %>-theme">
|
||||||
<span style="display:none" id="dark_mode_pref"><%= dark_mode %></span>
|
<span style="display:none" id="dark_mode_pref"><%= dark_mode %></span>
|
||||||
|
<% if env.get? "user" %>
|
||||||
|
<span style="display:none" id="mark_watched_after_duration_pref"><%= mark_watched_after_duration %></span>
|
||||||
|
<% end %>
|
||||||
<div class="pure-g">
|
<div class="pure-g">
|
||||||
<div class="pure-u-1 pure-u-xl-20-24" id="contents">
|
<div class="pure-u-1 pure-u-xl-20-24" id="contents">
|
||||||
<div class="pure-g navbar h-box">
|
<div class="pure-g navbar h-box">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user