Add 'comments' as URL parameter
This commit is contained in:
parent
2aca57cb82
commit
efd54b7523
@ -237,7 +237,7 @@ function get_reddit_comments(timeouts = 0) {
|
|||||||
comments.children[0].children[0].children[0].onclick = toggle_comments;
|
comments.children[0].children[0].children[0].onclick = toggle_comments;
|
||||||
comments.children[0].children[1].children[0].onclick = swap_comments;
|
comments.children[0].children[1].children[0].onclick = swap_comments;
|
||||||
} else {
|
} else {
|
||||||
if (video_data.preferences.comments[1] === 'youtube') {
|
if (video_data.params.comments[1] === 'youtube') {
|
||||||
get_youtube_comments(timeouts + 1);
|
get_youtube_comments(timeouts + 1);
|
||||||
} else {
|
} else {
|
||||||
comments.innerHTML = fallback;
|
comments.innerHTML = fallback;
|
||||||
@ -278,7 +278,6 @@ function get_youtube_comments(timeouts = 0) {
|
|||||||
xhr.onreadystatechange = function () {
|
xhr.onreadystatechange = function () {
|
||||||
if (xhr.readyState == 4) {
|
if (xhr.readyState == 4) {
|
||||||
if (xhr.status == 200) {
|
if (xhr.status == 200) {
|
||||||
if (xhr.response.commentCount > 0) {
|
|
||||||
comments.innerHTML = ' \
|
comments.innerHTML = ' \
|
||||||
<div> \
|
<div> \
|
||||||
<h3> \
|
<h3> \
|
||||||
@ -303,10 +302,7 @@ function get_youtube_comments(timeouts = 0) {
|
|||||||
comments.children[0].children[0].children[0].onclick = toggle_comments;
|
comments.children[0].children[0].children[0].onclick = toggle_comments;
|
||||||
comments.children[0].children[1].children[0].onclick = swap_comments;
|
comments.children[0].children[1].children[0].onclick = swap_comments;
|
||||||
} else {
|
} else {
|
||||||
comments.innerHTML = '';
|
if (video_data.params.comments[1] === 'youtube') {
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (video_data.preferences[1] === 'youtube') {
|
|
||||||
get_youtube_comments(timeouts + 1);
|
get_youtube_comments(timeouts + 1);
|
||||||
} else {
|
} else {
|
||||||
comments.innerHTML = '';
|
comments.innerHTML = '';
|
||||||
@ -409,13 +405,13 @@ if (video_data.plid) {
|
|||||||
get_playlist(video_data.plid);
|
get_playlist(video_data.plid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (video_data.preferences.comments[0] === 'youtube') {
|
if (video_data.params.comments[0] === 'youtube') {
|
||||||
get_youtube_comments();
|
get_youtube_comments();
|
||||||
} else if (video_data.preferences.comments[0] === 'reddit') {
|
} else if (video_data.params.comments[0] === 'reddit') {
|
||||||
get_reddit_comments();
|
get_reddit_comments();
|
||||||
} else if (video_data.preferences.comments[1] === 'youtube') {
|
} else if (video_data.params.comments[1] === 'youtube') {
|
||||||
get_youtube_comments();
|
get_youtube_comments();
|
||||||
} else if (video_data.preferences.comments[1] === 'reddit') {
|
} else if (video_data.params.comments[1] === 'reddit') {
|
||||||
get_reddit_comments();
|
get_reddit_comments();
|
||||||
} else {
|
} else {
|
||||||
comments = document.getElementById('comments');
|
comments = document.getElementById('comments');
|
||||||
|
@ -245,6 +245,7 @@ struct VideoPreferences
|
|||||||
json_mapping({
|
json_mapping({
|
||||||
annotations: Bool,
|
annotations: Bool,
|
||||||
autoplay: Bool,
|
autoplay: Bool,
|
||||||
|
comments: Array(String),
|
||||||
continue: Bool,
|
continue: Bool,
|
||||||
continue_autoplay: Bool,
|
continue_autoplay: Bool,
|
||||||
controls: Bool,
|
controls: Bool,
|
||||||
@ -1228,6 +1229,7 @@ end
|
|||||||
def process_video_params(query, preferences)
|
def process_video_params(query, preferences)
|
||||||
annotations = query["iv_load_policy"]?.try &.to_i?
|
annotations = query["iv_load_policy"]?.try &.to_i?
|
||||||
autoplay = query["autoplay"]?.try &.to_i?
|
autoplay = query["autoplay"]?.try &.to_i?
|
||||||
|
comments = query["comments"]?.try &.split(",").map { |a| a.downcase }
|
||||||
continue = query["continue"]?.try &.to_i?
|
continue = query["continue"]?.try &.to_i?
|
||||||
continue_autoplay = query["continue_autoplay"]?.try &.to_i?
|
continue_autoplay = query["continue_autoplay"]?.try &.to_i?
|
||||||
listen = query["listen"]? && (query["listen"] == "true" || query["listen"] == "1").to_unsafe
|
listen = query["listen"]? && (query["listen"] == "true" || query["listen"] == "1").to_unsafe
|
||||||
@ -1244,6 +1246,7 @@ def process_video_params(query, preferences)
|
|||||||
# region ||= preferences.region
|
# region ||= preferences.region
|
||||||
annotations ||= preferences.annotations.to_unsafe
|
annotations ||= preferences.annotations.to_unsafe
|
||||||
autoplay ||= preferences.autoplay.to_unsafe
|
autoplay ||= preferences.autoplay.to_unsafe
|
||||||
|
comments ||= preferences.comments
|
||||||
continue ||= preferences.continue.to_unsafe
|
continue ||= preferences.continue.to_unsafe
|
||||||
continue_autoplay ||= preferences.continue_autoplay.to_unsafe
|
continue_autoplay ||= preferences.continue_autoplay.to_unsafe
|
||||||
listen ||= preferences.listen.to_unsafe
|
listen ||= preferences.listen.to_unsafe
|
||||||
@ -1258,6 +1261,7 @@ def process_video_params(query, preferences)
|
|||||||
|
|
||||||
annotations ||= CONFIG.default_user_preferences.annotations.to_unsafe
|
annotations ||= CONFIG.default_user_preferences.annotations.to_unsafe
|
||||||
autoplay ||= CONFIG.default_user_preferences.autoplay.to_unsafe
|
autoplay ||= CONFIG.default_user_preferences.autoplay.to_unsafe
|
||||||
|
comments ||= CONFIG.default_user_preferences.comments
|
||||||
continue ||= CONFIG.default_user_preferences.continue.to_unsafe
|
continue ||= CONFIG.default_user_preferences.continue.to_unsafe
|
||||||
continue_autoplay ||= CONFIG.default_user_preferences.continue_autoplay.to_unsafe
|
continue_autoplay ||= CONFIG.default_user_preferences.continue_autoplay.to_unsafe
|
||||||
listen ||= CONFIG.default_user_preferences.listen.to_unsafe
|
listen ||= CONFIG.default_user_preferences.listen.to_unsafe
|
||||||
@ -1306,6 +1310,7 @@ def process_video_params(query, preferences)
|
|||||||
params = VideoPreferences.new(
|
params = VideoPreferences.new(
|
||||||
annotations: annotations,
|
annotations: annotations,
|
||||||
autoplay: autoplay,
|
autoplay: autoplay,
|
||||||
|
comments: comments,
|
||||||
continue: continue,
|
continue: continue,
|
||||||
continue_autoplay: continue_autoplay,
|
continue_autoplay: continue_autoplay,
|
||||||
controls: controls,
|
controls: controls,
|
||||||
|
Loading…
Reference in New Issue
Block a user