|
|
|
@ -53,6 +53,34 @@
|
|
|
|
|
<div class="pure-u-1 pure-u-md-1-5">
|
|
|
|
|
<div class="h-box">
|
|
|
|
|
<p><a href="https://www.youtube.com/watch?v=<%= video.id %>"><%= translate(locale, "Watch video on Youtube") %></a></p>
|
|
|
|
|
|
|
|
|
|
<form class="pure-form pure-form-stacked">
|
|
|
|
|
<div class="pure-control-group">
|
|
|
|
|
<label for="download_widget"><%= translate(locale, "Download as: ") %></label>
|
|
|
|
|
<select style="width:100%" name="download_widget" id="download_widget">
|
|
|
|
|
<% video_streams.each do |option| %>
|
|
|
|
|
<option data-url="<%= option["url"] %>"><%= option["quality_label"] %> - <%= option["type"].split(";")[0] %> @ <%= option["fps"] %>fps - video only</option>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% audio_streams.each do |option| %>
|
|
|
|
|
<option data-url="<%= option["url"] %>"><%= option["type"].split(";")[0] %> @ <%= option["bitrate"] %>k - audio only</option>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% fmt_stream.each do |option| %>
|
|
|
|
|
<option data-url="<%= option["url"] %>"><%= itag_to_metadata?(option["itag"]).try &.["height"]? || "~240" %>p - <%= option["type"].split(";")[0] %></option>
|
|
|
|
|
<% end %>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id="progress-container" style="width:100%; display:none">
|
|
|
|
|
<div id="download-progress">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<button type="button" data-title="<%= video.title.dump_unquoted %>-<%= video.id %>.mp4" onclick="download_video(this)"
|
|
|
|
|
class="pure-button pure-button-primary">
|
|
|
|
|
<%= translate(locale, "Download") %>
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
<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>
|
|
|
|
@ -268,8 +296,15 @@ function unsubscribe() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
<% if plid %>
|
|
|
|
|
function get_playlist() {
|
|
|
|
|
function get_playlist(timeouts = 0) {
|
|
|
|
|
playlist = document.getElementById("playlist");
|
|
|
|
|
|
|
|
|
|
if (timeouts > 10) {
|
|
|
|
|
console.log("Failed to pull playlist");
|
|
|
|
|
playlist.innerHTML = "";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
playlist.innerHTML = ' \
|
|
|
|
|
<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3> \
|
|
|
|
|
<hr>'
|
|
|
|
@ -323,15 +358,22 @@ function get_playlist() {
|
|
|
|
|
comments = document.getElementById("playlist");
|
|
|
|
|
comments.innerHTML =
|
|
|
|
|
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3><hr>';
|
|
|
|
|
get_playlist();
|
|
|
|
|
get_playlist(timeouts + 1);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get_playlist();
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
function get_reddit_comments() {
|
|
|
|
|
function get_reddit_comments(timeouts = 0) {
|
|
|
|
|
comments = document.getElementById("comments");
|
|
|
|
|
|
|
|
|
|
if (timeouts > 10) {
|
|
|
|
|
console.log("Failed to pull comments");
|
|
|
|
|
comments.innerHTML = "";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var fallback = comments.innerHTML;
|
|
|
|
|
comments.innerHTML =
|
|
|
|
|
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>';
|
|
|
|
@ -382,12 +424,19 @@ function get_reddit_comments() {
|
|
|
|
|
xhr.ontimeout = function() {
|
|
|
|
|
console.log("Pulling comments timed out.");
|
|
|
|
|
|
|
|
|
|
get_reddit_comments();
|
|
|
|
|
get_reddit_comments(timeouts + 1);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function get_youtube_comments() {
|
|
|
|
|
function get_youtube_comments(timeouts = 0) {
|
|
|
|
|
comments = document.getElementById("comments");
|
|
|
|
|
|
|
|
|
|
if (timeouts > 10) {
|
|
|
|
|
console.log("Failed to pull comments");
|
|
|
|
|
comments.innerHTML = "";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var fallback = comments.innerHTML;
|
|
|
|
|
comments.innerHTML =
|
|
|
|
|
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>';
|
|
|
|
@ -438,7 +487,7 @@ function get_youtube_comments() {
|
|
|
|
|
|
|
|
|
|
comments.innerHTML =
|
|
|
|
|
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>';
|
|
|
|
|
get_youtube_comments();
|
|
|
|
|
get_youtube_comments(timeouts + 1);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|