mirror of https://github.com/iv-org/invidious.git
Rename 'remember_position' to 'save_player_pos' for clarity
This commit is contained in:
parent
b6792cf02e
commit
5abe7fe123
|
@ -38,7 +38,7 @@ embed_url.searchParams.delete('v');
|
||||||
short_url = location.origin + '/' + video_data.id + embed_url.search;
|
short_url = location.origin + '/' + video_data.id + embed_url.search;
|
||||||
embed_url = location.origin + '/embed/' + video_data.id + embed_url.search;
|
embed_url = location.origin + '/embed/' + video_data.id + embed_url.search;
|
||||||
|
|
||||||
var remember_position_key = "remember_position";
|
var save_player_pos_key = "save_player_pos";
|
||||||
|
|
||||||
var shareOptions = {
|
var shareOptions = {
|
||||||
socials: ['fbFeed', 'tw', 'reddit', 'email'],
|
socials: ['fbFeed', 'tw', 'reddit', 'email'],
|
||||||
|
@ -201,7 +201,7 @@ if (video_data.premiere_timestamp && Math.round(new Date() / 1000) < video_data.
|
||||||
player.getChild('bigPlayButton').hide();
|
player.getChild('bigPlayButton').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (video_data.params.remember_position) {
|
if (video_data.params.save_player_pos) {
|
||||||
const remeberedTime = get_video_time();
|
const remeberedTime = get_video_time();
|
||||||
let lastUpdated = 0;
|
let lastUpdated = 0;
|
||||||
|
|
||||||
|
@ -384,12 +384,12 @@ function get_video_time() {
|
||||||
function set_all_video_times(times) {
|
function set_all_video_times(times) {
|
||||||
const json = JSON.stringify(times);
|
const json = JSON.stringify(times);
|
||||||
|
|
||||||
localStorage.setItem(remember_position_key, json);
|
localStorage.setItem(save_player_pos_key, json);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_all_video_times() {
|
function get_all_video_times() {
|
||||||
try {
|
try {
|
||||||
const raw = localStorage.getItem(remember_position_key);
|
const raw = localStorage.getItem(save_player_pos_key);
|
||||||
const times = JSON.parse(raw);
|
const times = JSON.parse(raw);
|
||||||
|
|
||||||
return times || {};
|
return times || {};
|
||||||
|
@ -400,7 +400,7 @@ function get_all_video_times() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_all_video_times() {
|
function remove_all_video_times() {
|
||||||
localStorage.removeItem(remember_position_key);
|
localStorage.removeItem(save_player_pos_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_time_percent(percent) {
|
function set_time_percent(percent) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct ConfigPreferences
|
||||||
property volume : Int32 = 100
|
property volume : Int32 = 100
|
||||||
property vr_mode : Bool = true
|
property vr_mode : Bool = true
|
||||||
property show_nick : Bool = true
|
property show_nick : Bool = true
|
||||||
property remember_position : Bool = false
|
property save_player_pos : Bool = false
|
||||||
|
|
||||||
def to_tuple
|
def to_tuple
|
||||||
{% begin %}
|
{% begin %}
|
||||||
|
|
|
@ -70,9 +70,9 @@ module Invidious::Routes::PreferencesRoute
|
||||||
vr_mode ||= "off"
|
vr_mode ||= "off"
|
||||||
vr_mode = vr_mode == "on"
|
vr_mode = vr_mode == "on"
|
||||||
|
|
||||||
remember_position = env.params.body["remember_position"]?.try &.as(String)
|
save_player_pos = env.params.body["save_player_pos"]?.try &.as(String)
|
||||||
remember_position ||= "off"
|
save_player_pos ||= "off"
|
||||||
remember_position = remember_position == "on"
|
save_player_pos = save_player_pos == "on"
|
||||||
|
|
||||||
show_nick = env.params.body["show_nick"]?.try &.as(String)
|
show_nick = env.params.body["show_nick"]?.try &.as(String)
|
||||||
show_nick ||= "off"
|
show_nick ||= "off"
|
||||||
|
@ -169,7 +169,7 @@ module Invidious::Routes::PreferencesRoute
|
||||||
extend_desc: extend_desc,
|
extend_desc: extend_desc,
|
||||||
vr_mode: vr_mode,
|
vr_mode: vr_mode,
|
||||||
show_nick: show_nick,
|
show_nick: show_nick,
|
||||||
remember_position: remember_position,
|
save_player_pos: save_player_pos,
|
||||||
}.to_json).to_json
|
}.to_json).to_json
|
||||||
|
|
||||||
if user = env.get? "user"
|
if user = env.get? "user"
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct Preferences
|
||||||
property video_loop : Bool = CONFIG.default_user_preferences.video_loop
|
property video_loop : Bool = CONFIG.default_user_preferences.video_loop
|
||||||
property extend_desc : Bool = CONFIG.default_user_preferences.extend_desc
|
property extend_desc : Bool = CONFIG.default_user_preferences.extend_desc
|
||||||
property volume : Int32 = CONFIG.default_user_preferences.volume
|
property volume : Int32 = CONFIG.default_user_preferences.volume
|
||||||
property remember_position : Bool = CONFIG.default_user_preferences.remember_position
|
property save_player_pos : Bool = CONFIG.default_user_preferences.save_player_pos
|
||||||
|
|
||||||
module BoolToString
|
module BoolToString
|
||||||
def self.to_json(value : String, json : JSON::Builder)
|
def self.to_json(value : String, json : JSON::Builder)
|
||||||
|
|
|
@ -246,7 +246,7 @@ struct VideoPreferences
|
||||||
property video_start : Float64 | Int32
|
property video_start : Float64 | Int32
|
||||||
property volume : Int32
|
property volume : Int32
|
||||||
property vr_mode : Bool
|
property vr_mode : Bool
|
||||||
property remember_position : Bool
|
property save_player_pos : Bool
|
||||||
end
|
end
|
||||||
|
|
||||||
struct Video
|
struct Video
|
||||||
|
@ -1091,7 +1091,7 @@ def process_video_params(query, preferences)
|
||||||
extend_desc = query["extend_desc"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
extend_desc = query["extend_desc"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
||||||
volume = query["volume"]?.try &.to_i?
|
volume = query["volume"]?.try &.to_i?
|
||||||
vr_mode = query["vr_mode"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
vr_mode = query["vr_mode"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
||||||
remember_position = query["remember_position"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
save_player_pos = query["save_player_pos"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
||||||
|
|
||||||
if preferences
|
if preferences
|
||||||
# region ||= preferences.region
|
# region ||= preferences.region
|
||||||
|
@ -1112,7 +1112,7 @@ def process_video_params(query, preferences)
|
||||||
extend_desc ||= preferences.extend_desc.to_unsafe
|
extend_desc ||= preferences.extend_desc.to_unsafe
|
||||||
volume ||= preferences.volume
|
volume ||= preferences.volume
|
||||||
vr_mode ||= preferences.vr_mode.to_unsafe
|
vr_mode ||= preferences.vr_mode.to_unsafe
|
||||||
remember_position ||= preferences.remember_position.to_unsafe
|
save_player_pos ||= preferences.save_player_pos.to_unsafe
|
||||||
end
|
end
|
||||||
|
|
||||||
annotations ||= CONFIG.default_user_preferences.annotations.to_unsafe
|
annotations ||= CONFIG.default_user_preferences.annotations.to_unsafe
|
||||||
|
@ -1132,7 +1132,7 @@ def process_video_params(query, preferences)
|
||||||
extend_desc ||= CONFIG.default_user_preferences.extend_desc.to_unsafe
|
extend_desc ||= CONFIG.default_user_preferences.extend_desc.to_unsafe
|
||||||
volume ||= CONFIG.default_user_preferences.volume
|
volume ||= CONFIG.default_user_preferences.volume
|
||||||
vr_mode ||= CONFIG.default_user_preferences.vr_mode.to_unsafe
|
vr_mode ||= CONFIG.default_user_preferences.vr_mode.to_unsafe
|
||||||
remember_position ||= CONFIG.default_user_preferences.remember_position.to_unsafe
|
save_player_pos ||= CONFIG.default_user_preferences.save_player_pos.to_unsafe
|
||||||
|
|
||||||
annotations = annotations == 1
|
annotations = annotations == 1
|
||||||
autoplay = autoplay == 1
|
autoplay = autoplay == 1
|
||||||
|
@ -1144,7 +1144,7 @@ def process_video_params(query, preferences)
|
||||||
video_loop = video_loop == 1
|
video_loop = video_loop == 1
|
||||||
extend_desc = extend_desc == 1
|
extend_desc = extend_desc == 1
|
||||||
vr_mode = vr_mode == 1
|
vr_mode = vr_mode == 1
|
||||||
remember_position = remember_position == 1
|
save_player_pos = save_player_pos == 1
|
||||||
|
|
||||||
if CONFIG.disabled?("dash") && quality == "dash"
|
if CONFIG.disabled?("dash") && quality == "dash"
|
||||||
quality = "high"
|
quality = "high"
|
||||||
|
@ -1195,7 +1195,7 @@ def process_video_params(query, preferences)
|
||||||
video_start: video_start,
|
video_start: video_start,
|
||||||
volume: volume,
|
volume: volume,
|
||||||
vr_mode: vr_mode,
|
vr_mode: vr_mode,
|
||||||
remember_position: remember_position,
|
save_player_pos: save_player_pos,
|
||||||
})
|
})
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
|
@ -117,8 +117,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pure-control-group">
|
<div class="pure-control-group">
|
||||||
<label for="remember_position">Remember the current video time:</label>
|
<label for="save_player_pos">Remember the current video time:</label>
|
||||||
<input name="remember_position" id="remember_position" type="checkbox" <% if preferences.remember_position %>checked<% end %>>
|
<input name="save_player_pos" id="save_player_pos" type="checkbox" <% if preferences.save_player_pos %>checked<% end %>>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<legend><%= translate(locale, "preferences_category_visual") %></legend>
|
<legend><%= translate(locale, "preferences_category_visual") %></legend>
|
||||||
|
|
Loading…
Reference in New Issue