|
|
|
@ -44,18 +44,26 @@
|
|
|
|
|
</a>
|
|
|
|
|
<% end %>
|
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
|
|
<% if !video.is_listed %>
|
|
|
|
|
<h3><i class="icon ion-ios-lock"></i> <%= translate(locale, "Unlisted") %></h3>
|
|
|
|
|
<h3>
|
|
|
|
|
<i class="icon ion-ios-lock"></i> <%= translate(locale, "Unlisted") %>
|
|
|
|
|
</h3>
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
<% if !reason.empty? %>
|
|
|
|
|
<h3><%= reason %></h3>
|
|
|
|
|
<h3>
|
|
|
|
|
<%= reason %>
|
|
|
|
|
</h3>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="pure-g">
|
|
|
|
|
<div class="pure-u-1 pure-u-lg-1-5">
|
|
|
|
|
<div class="h-box">
|
|
|
|
|
<p><a href="https://www.youtube.com/watch?v=<%= video.id %>"><%= translate(locale, "Watch on YouTube") %></a></p>
|
|
|
|
|
<p>
|
|
|
|
|
<a href="https://www.youtube.com/watch?v=<%= video.id %>"><%= translate(locale, "Watch on YouTube") %></a>
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
<% if params.annotations %>
|
|
|
|
|
<a href="/watch?<%= env.params.query %>&iv_load_policy=3">
|
|
|
|
@ -69,7 +77,7 @@
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<% if CONFIG.dmca_content.includes? video.id %>
|
|
|
|
|
<p>Download is disabled.</p>
|
|
|
|
|
<p><%= translate(locale, "Download is disabled.") %></p>
|
|
|
|
|
<% else %>
|
|
|
|
|
<form class="pure-form pure-form-stacked" action="/latest_version" method="get" rel="noopener" target="_blank">
|
|
|
|
|
<div class="pure-control-group">
|
|
|
|
@ -107,7 +115,7 @@
|
|
|
|
|
<p><i class="icon ion-ios-eye"></i> <%= number_with_separator(video.views) %></p>
|
|
|
|
|
<p><i class="icon ion-ios-thumbs-up"></i> <%= number_with_separator(video.likes) %></p>
|
|
|
|
|
<p><i class="icon ion-ios-thumbs-down"></i> <%= number_with_separator(video.dislikes) %></p>
|
|
|
|
|
<p id="Genre"><%= translate(locale, "Genre: ") %>
|
|
|
|
|
<p id="genre"><%= translate(locale, "Genre: ") %>
|
|
|
|
|
<% if video.genre_url.empty? %>
|
|
|
|
|
<%= video.genre %>
|
|
|
|
|
<% else %>
|
|
|
|
@ -115,14 +123,14 @@
|
|
|
|
|
<% end %>
|
|
|
|
|
</p>
|
|
|
|
|
<% if !video.license.empty? %>
|
|
|
|
|
<p id="License"><%= translate(locale, "License: ") %><%= video.license %></p>
|
|
|
|
|
<p id="license"><%= translate(locale, "License: ") %><%= video.license %></p>
|
|
|
|
|
<% end %>
|
|
|
|
|
<p id="FamilyFriendly"><%= translate(locale, "Family friendly? ") %><%= translate_bool(locale, video.is_family_friendly) %></p>
|
|
|
|
|
<p id="Wilson"><%= translate(locale, "Wilson score: ") %><%= video.wilson_score.round(4) %></p>
|
|
|
|
|
<p id="Rating"><%= translate(locale, "Rating: ") %><%= rating.round(4) %> / 5</p>
|
|
|
|
|
<p id="Engagement"><%= translate(locale, "Engagement: ") %><%= engagement.round(2) %>%</p>
|
|
|
|
|
<p id="family_friendly"><%= translate(locale, "Family friendly? ") %><%= translate_bool(locale, video.is_family_friendly) %></p>
|
|
|
|
|
<p id="wilson"><%= translate(locale, "Wilson score: ") %><%= video.wilson_score.round(4) %></p>
|
|
|
|
|
<p id="rating"><%= translate(locale, "Rating: ") %><%= rating.round(4) %> / 5</p>
|
|
|
|
|
<p id="engagement"><%= translate(locale, "Engagement: ") %><%= engagement.round(2) %>%</p>
|
|
|
|
|
<% if video.allowed_regions.size != REGIONS.size %>
|
|
|
|
|
<p id="AllowedRegions">
|
|
|
|
|
<p id="allowed_regions">
|
|
|
|
|
<% if video.allowed_regions.size < REGIONS.size / 2 %>
|
|
|
|
|
<%= translate(locale, "Whitelisted regions: ") %><%= video.allowed_regions.join(", ") %>
|
|
|
|
|
<% else %>
|
|
|
|
@ -140,17 +148,22 @@
|
|
|
|
|
<h3><%= video.author %></h3>
|
|
|
|
|
</a>
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<% ucid = video.ucid %>
|
|
|
|
|
<% author = video.author %>
|
|
|
|
|
<% sub_count_text = video.sub_count_text %>
|
|
|
|
|
<%= rendered "components/subscribe_widget" %>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
<b><%= translate(locale, "Shared `x`", video.published.to_s("%B %-d, %Y")) %></b>
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<%= video.description %>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
|
|
|
|
|
|
<div id="comments">
|
|
|
|
|
<% if nojs %>
|
|
|
|
|
<%= comment_html %>
|
|
|
|
@ -164,16 +177,15 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<% if params.related_videos || plid %>
|
|
|
|
|
<div class="pure-u-1 pure-u-lg-1-5">
|
|
|
|
|
<% if plid %>
|
|
|
|
|
<div id="playlist" class="h-box">
|
|
|
|
|
</div>
|
|
|
|
|
<div id="playlist" class="h-box"></div>
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
<% if params.related_videos %>
|
|
|
|
|
<div class="h-box">
|
|
|
|
|
|
|
|
|
|
<% if !rvs.empty? %>
|
|
|
|
|
<div <% if plid %>style="display:none"<% end %>>
|
|
|
|
|
<div class="pure-control-group">
|
|
|
|
@ -187,8 +199,7 @@
|
|
|
|
|
<% rvs.each do |rv| %>
|
|
|
|
|
<% if rv["id"]? %>
|
|
|
|
|
<a href="/watch?v=<%= rv["id"] %>">
|
|
|
|
|
<% if env.get("preferences").as(Preferences).thin_mode %>
|
|
|
|
|
<% else %>
|
|
|
|
|
<% if !env.get("preferences").as(Preferences).thin_mode %>
|
|
|
|
|
<div class="thumbnail">
|
|
|
|
|
<img class="thumbnail" src="/vi/<%= rv["id"] %>/mqdefault.jpg">
|
|
|
|
|
<p class="length"><%= recode_length_seconds(rv["length_seconds"]?.try &.to_i? || 0) %></p>
|
|
|
|
@ -218,18 +229,19 @@
|
|
|
|
|
<script>
|
|
|
|
|
<% if !rvs.empty? && !plid && params.continue %>
|
|
|
|
|
player.on('ended', function() {
|
|
|
|
|
location.assign("/watch?v="
|
|
|
|
|
+ "<%= rvs.select { |rv| rv["id"]? }[0]?.try &.["id"] %>"
|
|
|
|
|
+ "&continue=1"
|
|
|
|
|
location.assign('/watch?v=' +
|
|
|
|
|
'<%= rvs.select { |rv| rv["id"]? }[0]?.try &.["id"] %>' +
|
|
|
|
|
'&continue=1' +
|
|
|
|
|
<% if params.listen != preferences.listen %>
|
|
|
|
|
+ "&listen=<%= params.listen %>"
|
|
|
|
|
'&listen=<%= params.listen %>' +
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if params.autoplay || params.continue_autoplay %>
|
|
|
|
|
+ "&autoplay=1"
|
|
|
|
|
'&autoplay=1' +
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if params.speed != preferences.speed %>
|
|
|
|
|
+ "&speed=<%= params.speed %>"
|
|
|
|
|
'&speed=<%= params.speed %>' +
|
|
|
|
|
<% end %>
|
|
|
|
|
''
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
<% end %>
|
|
|
|
@ -237,18 +249,19 @@ player.on('ended', function() {
|
|
|
|
|
function continue_autoplay(target) {
|
|
|
|
|
if (target.checked) {
|
|
|
|
|
player.on('ended', function() {
|
|
|
|
|
location.assign("/watch?v="
|
|
|
|
|
+ "<%= rvs.select { |rv| rv["id"]? }[0]?.try &.["id"] %>"
|
|
|
|
|
+ "&continue=1"
|
|
|
|
|
location.assign('/watch?v=' +
|
|
|
|
|
'<%= rvs.select { |rv| rv["id"]? }[0]?.try &.["id"] %>' +
|
|
|
|
|
'&continue=1' +
|
|
|
|
|
<% if params.listen != preferences.listen %>
|
|
|
|
|
+ "&listen=<%= params.listen %>"
|
|
|
|
|
'&listen=<%= params.listen %>' +
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if params.autoplay || params.continue_autoplay %>
|
|
|
|
|
+ "&autoplay=1"
|
|
|
|
|
'&autoplay=1' +
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if params.speed != preferences.speed %>
|
|
|
|
|
+ "&speed=<%= params.speed %>"
|
|
|
|
|
'&speed=<%= params.speed %>' +
|
|
|
|
|
<% end %>
|
|
|
|
|
''
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
@ -269,12 +282,12 @@ function number_with_separator(val) {
|
|
|
|
|
<%= rendered "components/subscribe_widget_script" %>
|
|
|
|
|
|
|
|
|
|
<% if plid %>
|
|
|
|
|
function get_playlist(timeouts = 0) {
|
|
|
|
|
playlist = document.getElementById("playlist");
|
|
|
|
|
function get_playlist(plid, timeouts = 0) {
|
|
|
|
|
playlist = document.getElementById('playlist');
|
|
|
|
|
|
|
|
|
|
if (timeouts > 10) {
|
|
|
|
|
console.log("Failed to pull playlist");
|
|
|
|
|
playlist.innerHTML = "";
|
|
|
|
|
console.log('Failed to pull playlist');
|
|
|
|
|
playlist.innerHTML = '';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -282,18 +295,20 @@ function get_playlist(timeouts = 0) {
|
|
|
|
|
<h3 style="text-align:center"><div class="loading"><i class="icon ion-ios-refresh"></i></div></h3> \
|
|
|
|
|
<hr>'
|
|
|
|
|
|
|
|
|
|
var plid = "<%= plid %>"
|
|
|
|
|
|
|
|
|
|
if (plid.startsWith("RD")) {
|
|
|
|
|
var plid_url = "/api/v1/mixes/<%= plid %>?continuation=<%= video.id %>&format=html&hl=<%= env.get("preferences").as(Preferences).locale %>";
|
|
|
|
|
if (plid.startsWith('RD')) {
|
|
|
|
|
var plid_url = '/api/v1/mixes/' + plid +
|
|
|
|
|
'?continuation=<%= video.id %>' +
|
|
|
|
|
'&format=html&hl=<%= env.get("preferences").as(Preferences).locale %>';
|
|
|
|
|
} else {
|
|
|
|
|
var plid_url = "/api/v1/playlists/<%= plid %>?continuation=<%= video.id %>&format=html&hl=<%= env.get("preferences").as(Preferences).locale %>";
|
|
|
|
|
var plid_url = '/api/v1/playlists/' + plid +
|
|
|
|
|
'?continuation=<%= video.id %>' +
|
|
|
|
|
'&format=html&hl=<%= env.get("preferences").as(Preferences).locale %>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
xhr.responseType = "json";
|
|
|
|
|
xhr.responseType = 'json';
|
|
|
|
|
xhr.timeout = 20000;
|
|
|
|
|
xhr.open("GET", plid_url, true);
|
|
|
|
|
xhr.open('GET', plid_url, true);
|
|
|
|
|
xhr.send();
|
|
|
|
|
|
|
|
|
|
xhr.onreadystatechange = function() {
|
|
|
|
@ -303,47 +318,46 @@ function get_playlist(timeouts = 0) {
|
|
|
|
|
|
|
|
|
|
if (xhr.response.nextVideo) {
|
|
|
|
|
player.on('ended', function() {
|
|
|
|
|
location.assign("/watch?v="
|
|
|
|
|
+ xhr.response.nextVideo
|
|
|
|
|
+ "&list=<%= plid %>"
|
|
|
|
|
location.assign('/watch?v=' + xhr.response.nextVideo +
|
|
|
|
|
'&list=' + plid +
|
|
|
|
|
<% if params.listen != preferences.listen %>
|
|
|
|
|
+ "&listen=<%= params.listen %>"
|
|
|
|
|
'&listen=<%= params.listen %>' +
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if params.autoplay || params.continue_autoplay %>
|
|
|
|
|
+ "&autoplay=1"
|
|
|
|
|
'&autoplay=1' +
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if params.speed != preferences.speed %>
|
|
|
|
|
+ "&speed=<%= params.speed %>"
|
|
|
|
|
'&speed=<%= params.speed %>' +
|
|
|
|
|
<% end %>
|
|
|
|
|
''
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
playlist.innerHTML = "";
|
|
|
|
|
document.getElementById('continue').style.display = "";
|
|
|
|
|
playlist.innerHTML = '';
|
|
|
|
|
document.getElementById('continue').style.display = '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
xhr.ontimeout = function() {
|
|
|
|
|
console.log("Pulling playlist timed out.");
|
|
|
|
|
|
|
|
|
|
playlist = document.getElementById("playlist");
|
|
|
|
|
console.log('Pulling playlist timed out.');
|
|
|
|
|
playlist = document.getElementById('playlist');
|
|
|
|
|
playlist.innerHTML =
|
|
|
|
|
'<h3 style="text-align:center"><div class="loading"><i class="icon ion-ios-refresh"></i></div></h3><hr>';
|
|
|
|
|
get_playlist(timeouts + 1);
|
|
|
|
|
get_playlist(plid, timeouts + 1);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get_playlist();
|
|
|
|
|
get_playlist('<%= plid %>');
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
function get_reddit_comments(timeouts = 0) {
|
|
|
|
|
comments = document.getElementById("comments");
|
|
|
|
|
comments = document.getElementById('comments');
|
|
|
|
|
|
|
|
|
|
if (timeouts > 10) {
|
|
|
|
|
console.log("Failed to pull comments");
|
|
|
|
|
comments.innerHTML = "";
|
|
|
|
|
console.log('Failed to pull comments');
|
|
|
|
|
comments.innerHTML = '';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -351,11 +365,13 @@ function get_reddit_comments(timeouts = 0) {
|
|
|
|
|
comments.innerHTML =
|
|
|
|
|
'<h3 style="text-align:center"><div class="loading"><i class="icon ion-ios-refresh"></i></div></h3>';
|
|
|
|
|
|
|
|
|
|
var url = "/api/v1/comments/<%= video.id %>?source=reddit&format=html&hl=<%= env.get("preferences").as(Preferences).locale %>";
|
|
|
|
|
var url = '/api/v1/comments/<%= video.id %>' +
|
|
|
|
|
'?source=reddit&format=html' +
|
|
|
|
|
'&hl=<%= env.get("preferences").as(Preferences).locale %>';
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
xhr.responseType = "json";
|
|
|
|
|
xhr.responseType = 'json';
|
|
|
|
|
xhr.timeout = 20000;
|
|
|
|
|
xhr.open("GET", url, true);
|
|
|
|
|
xhr.open('GET', url, true);
|
|
|
|
|
xhr.send();
|
|
|
|
|
|
|
|
|
|
xhr.onreadystatechange = function() {
|
|
|
|
@ -395,18 +411,17 @@ function get_reddit_comments(timeouts = 0) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
xhr.ontimeout = function() {
|
|
|
|
|
console.log("Pulling comments timed out.");
|
|
|
|
|
|
|
|
|
|
console.log('Pulling comments timed out.');
|
|
|
|
|
get_reddit_comments(timeouts + 1);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function get_youtube_comments(timeouts = 0) {
|
|
|
|
|
comments = document.getElementById("comments");
|
|
|
|
|
comments = document.getElementById('comments');
|
|
|
|
|
|
|
|
|
|
if (timeouts > 10) {
|
|
|
|
|
console.log("Failed to pull comments");
|
|
|
|
|
comments.innerHTML = "";
|
|
|
|
|
console.log('Failed to pull comments');
|
|
|
|
|
comments.innerHTML = '';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -414,11 +429,14 @@ function get_youtube_comments(timeouts = 0) {
|
|
|
|
|
comments.innerHTML =
|
|
|
|
|
'<h3 style="text-align:center"><div class="loading"><i class="icon ion-ios-refresh"></i></div></h3>';
|
|
|
|
|
|
|
|
|
|
var url = "/api/v1/comments/<%= video.id %>?format=html&hl=<%= env.get("preferences").as(Preferences).locale %>&thin_mode=<%= env.get("preferences").as(Preferences).thin_mode %>";
|
|
|
|
|
var url = '/api/v1/comments/<%= video.id %>' +
|
|
|
|
|
'?format=html' +
|
|
|
|
|
'&hl=<%= env.get("preferences").as(Preferences).locale %>' +
|
|
|
|
|
'&thin_mode=<%= env.get("preferences").as(Preferences).thin_mode %>';
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
xhr.responseType = "json";
|
|
|
|
|
xhr.responseType = 'json';
|
|
|
|
|
xhr.timeout = 20000;
|
|
|
|
|
xhr.open("GET", url, true);
|
|
|
|
|
xhr.open('GET', url, true);
|
|
|
|
|
xhr.send();
|
|
|
|
|
|
|
|
|
|
xhr.onreadystatechange = function() {
|
|
|
|
@ -449,15 +467,14 @@ function get_youtube_comments(timeouts = 0) {
|
|
|
|
|
<% if preferences && preferences.comments[1] == "youtube" %>
|
|
|
|
|
get_youtube_comments(timeouts + 1);
|
|
|
|
|
<% else %>
|
|
|
|
|
comments.innerHTML = "";
|
|
|
|
|
comments.innerHTML = '';
|
|
|
|
|
<% end %>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
xhr.ontimeout = function() {
|
|
|
|
|
console.log("Pulling comments timed out.");
|
|
|
|
|
|
|
|
|
|
console.log('Pulling comments timed out.');
|
|
|
|
|
comments.innerHTML =
|
|
|
|
|
'<h3 style="text-align:center"><div class="loading"><i class="icon ion-ios-refresh"></i></div></h3>';
|
|
|
|
|
get_youtube_comments(timeouts + 1);
|
|
|
|
@ -472,8 +489,11 @@ function get_youtube_replies(target, load_more) {
|
|
|
|
|
body.innerHTML =
|
|
|
|
|
'<h3 style="text-align:center"><div class="loading"><i class="icon ion-ios-refresh"></i></div></h3>';
|
|
|
|
|
|
|
|
|
|
var url = '/api/v1/comments/<%= video.id %>?format=html&hl=<%= env.get("preferences").as(Preferences).locale %>&thin_mode=<%= env.get("preferences").as(Preferences).thin_mode %>&continuation=' +
|
|
|
|
|
continuation;
|
|
|
|
|
var url = '/api/v1/comments/<%= video.id %>' +
|
|
|
|
|
'?format=html' +
|
|
|
|
|
'&hl=<%= env.get("preferences").as(Preferences).locale %>' +
|
|
|
|
|
'&thin_mode=<%= env.get("preferences").as(Preferences).thin_mode %>' +
|
|
|
|
|
'&continuation=' + continuation;
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
xhr.responseType = 'json';
|
|
|
|
|
xhr.timeout = 20000;
|
|
|
|
@ -504,7 +524,6 @@ function get_youtube_replies(target, load_more) {
|
|
|
|
|
|
|
|
|
|
xhr.ontimeout = function() {
|
|
|
|
|
console.log('Pulling comments timed out.');
|
|
|
|
|
|
|
|
|
|
body.innerHTML = fallback;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
@ -520,8 +539,8 @@ function get_youtube_replies(target, load_more) {
|
|
|
|
|
<% elsif preferences.comments[1] == "reddit" %>
|
|
|
|
|
get_reddit_comments();
|
|
|
|
|
<% else %>
|
|
|
|
|
comments = document.getElementById("comments");
|
|
|
|
|
comments.innerHTML = "";
|
|
|
|
|
comments = document.getElementById('comments');
|
|
|
|
|
comments.innerHTML = '';
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% else %>
|
|
|
|
|