2018-01-07 17:40:03 +00:00
|
|
|
<% content_for "header" do %>
|
2018-03-07 22:48:26 +00:00
|
|
|
<meta name="thumbnail" content="<%= thumbnail %>">
|
2018-07-31 16:33:25 +00:00
|
|
|
<meta name="description" content="<%= description %>">
|
|
|
|
<meta name="keywords" content="<%= video.info["keywords"] %>">
|
2018-07-23 01:02:49 +00:00
|
|
|
<meta property="og:site_name" content="Invidious">
|
2018-08-01 15:45:45 +00:00
|
|
|
<meta property="og:url" content="<%= host_url %>/watch?v=<%= video.id %>">
|
2018-08-01 21:07:47 +00:00
|
|
|
<meta property="og:title" content="<%= HTML.escape(video.title) %>">
|
2018-07-24 22:05:02 +00:00
|
|
|
<meta property="og:image" content="https://i.ytimg.com/vi/<%= video.id %>/hqdefault.jpg">
|
2018-07-23 13:07:24 +00:00
|
|
|
<meta property="og:description" content="<%= description %>">
|
2018-07-23 01:02:49 +00:00
|
|
|
<meta property="og:type" content="video.other">
|
2018-08-01 15:45:45 +00:00
|
|
|
<meta property="og:video:url" content="<%= host_url %>/embed/<%= video.id %>">
|
|
|
|
<meta property="og:video:secure_url" content="<%= host_url %>/embed/<%= video.id %>">
|
2018-07-23 01:02:49 +00:00
|
|
|
<meta property="og:video:type" content="text/html">
|
|
|
|
<meta property="og:video:width" content="1280">
|
|
|
|
<meta property="og:video:height" content="720">
|
|
|
|
<meta name="twitter:card" content="player">
|
2018-08-13 18:24:10 +00:00
|
|
|
<meta name="twitter:site" content="@omarroth1">
|
2018-08-01 15:45:45 +00:00
|
|
|
<meta name="twitter:url" content="<%= host_url %>/watch?v=<%= video.id %>">
|
2018-08-01 21:07:47 +00:00
|
|
|
<meta name="twitter:title" content="<%= HTML.escape(video.title) %>">
|
2018-07-23 13:07:24 +00:00
|
|
|
<meta name="twitter:description" content="<%= description %>">
|
2018-08-04 14:50:24 +00:00
|
|
|
<meta name="twitter:image" content="<%= thumbnail %>">
|
2018-08-01 15:45:45 +00:00
|
|
|
<meta name="twitter:player" content="<%= host_url %>/embed/<%= video.id %>">
|
2018-07-23 04:20:49 +00:00
|
|
|
<meta name="twitter:player:width" content="1280">
|
|
|
|
<meta name="twitter:player:height" content="720">
|
2018-08-11 15:52:13 +00:00
|
|
|
<%= rendered "components/player_sources" %>
|
2018-08-01 21:07:47 +00:00
|
|
|
<title><%= HTML.escape(video.title) %> - Invidious</title>
|
2018-01-07 17:40:03 +00:00
|
|
|
<% end %>
|
2018-01-15 03:16:09 +00:00
|
|
|
|
2018-03-12 23:37:01 +00:00
|
|
|
<div class="h-box">
|
2018-08-11 15:52:13 +00:00
|
|
|
<%= rendered "components/player" %>
|
2018-03-11 17:05:56 +00:00
|
|
|
</div>
|
2018-01-16 19:58:08 +00:00
|
|
|
|
2018-08-25 23:33:15 +00:00
|
|
|
<div class="h-box">
|
|
|
|
<h1>
|
|
|
|
<%= HTML.escape(video.title) %>
|
2018-08-26 01:05:51 +00:00
|
|
|
<% if params[:listen] %>
|
2018-08-25 23:33:15 +00:00
|
|
|
<a href="/watch?<%= env.params.query %>">
|
|
|
|
<i class="icon ion-ios-videocam"></i>
|
|
|
|
</a>
|
|
|
|
<% else %>
|
|
|
|
<a href="/watch?<%= env.params.query %>&listen=1">
|
|
|
|
<i class="icon ion-ios-volume-high"></i>
|
|
|
|
</a>
|
|
|
|
<% end %>
|
|
|
|
</h1>
|
|
|
|
<% if !reason.empty? %>
|
|
|
|
<h3><%= reason %></h3>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="pure-g">
|
|
|
|
<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 %>">Watch video on YouTube</a></p>
|
|
|
|
<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">Genre: <%= video.genre %></p>
|
|
|
|
<p id="FamilyFriendly">Family Friendly? <%= video.is_family_friendly %></p>
|
|
|
|
<p id="Wilson">Wilson Score: <%= video.wilson_score.round(4) %></p>
|
|
|
|
<p id="Rating">Rating: <%= rating.round(4) %> / 5</p>
|
|
|
|
<p id="Engagement">Engagement: <%= engagement.round(2) %>%</p>
|
|
|
|
<% if video.allowed_regions.size != REGIONS.size %>
|
|
|
|
<p id="AllowedRegions">
|
|
|
|
<% if video.allowed_regions.size < REGIONS.size / 2 %>
|
|
|
|
Whitelisted regions: <%= video.allowed_regions.join(", ") %>
|
|
|
|
<% else %>
|
|
|
|
Blacklisted regions: <%= (REGIONS.to_a - video.allowed_regions).join(", ") %>
|
|
|
|
<% end %>
|
|
|
|
</p>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="pure-u-1 pure-u-md-3-5">
|
|
|
|
<div class="h-box">
|
|
|
|
<p>
|
|
|
|
<a href="/channel/<%= video.ucid %>">
|
|
|
|
<h3><%= video.author %></h3>
|
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
<% if user %>
|
|
|
|
<% if subscriptions.includes? video.ucid %>
|
|
|
|
<p>
|
|
|
|
<a href="/subscription_ajax?action_remove_subscriptions=1&c=<%= video.ucid %>&referer=<%= env.get("current_page") %>">
|
|
|
|
<b>Unsubscribe from <%= video.author %></b>
|
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
<% else %>
|
|
|
|
<p>
|
|
|
|
<a href="/subscription_ajax?action_create_subscription_to_channel=1&c=<%= video.ucid %>&referer=<%= env.get("current_page") %>">
|
|
|
|
<b>Subscribe to <%= video.author %></b>
|
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
<% end %>
|
|
|
|
<% else %>
|
|
|
|
<p>
|
|
|
|
<a href="/login?referer=<%= env.get("current_page") %>">
|
|
|
|
<b>Login to subscribe to <%= video.author %></b>
|
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
<% end %>
|
|
|
|
<p>
|
|
|
|
<b>Shared <%= video.published.to_s("%B %-d, %Y") %></b>
|
|
|
|
</p>
|
|
|
|
<div>
|
|
|
|
<%= video.description %>
|
|
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
<div id="comments">
|
|
|
|
<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="pure-u-1 pure-u-md-1-5">
|
2018-08-30 21:49:38 +00:00
|
|
|
<% if preferences && preferences.related_videos %>
|
2018-08-25 23:33:15 +00:00
|
|
|
<div class="h-box">
|
|
|
|
<% rvs.each do |rv| %>
|
|
|
|
<% if rv.has_key?("id") %>
|
|
|
|
<a href="/watch?v=<%= rv["id"] %>">
|
|
|
|
<% if preferences && preferences.thin_mode %>
|
|
|
|
<% else %>
|
|
|
|
<img style="width:100%;" src="<%= rv["iurlmq"] %>">
|
|
|
|
<% end %>
|
|
|
|
<p style="width:100%"><%= rv["title"] %></p>
|
|
|
|
<p>
|
|
|
|
<b style="width: 100%"><%= rv["author"] %></b>
|
|
|
|
</p>
|
|
|
|
</a>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2018-08-30 21:49:38 +00:00
|
|
|
<% end %>
|
2018-08-25 23:33:15 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2018-01-16 19:58:08 +00:00
|
|
|
<script>
|
2018-07-28 14:49:58 +00:00
|
|
|
function toggle(target) {
|
|
|
|
body = target.parentNode.parentNode.children[1];
|
2018-08-09 21:01:39 +00:00
|
|
|
if (body.style.display === null || body.style.display === "") {
|
|
|
|
target.innerHTML = "[ + ]";
|
|
|
|
body.style.display = "none";
|
2018-07-28 14:49:58 +00:00
|
|
|
} else {
|
2018-08-09 21:01:39 +00:00
|
|
|
target.innerHTML = "[ - ]";
|
|
|
|
body.style.display = "";
|
2018-07-28 14:49:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function toggle_comments(target) {
|
|
|
|
body = target.parentNode.parentNode.parentNode.children[1];
|
2018-08-09 21:01:39 +00:00
|
|
|
if (body.style.display === null || body.style.display === "") {
|
|
|
|
target.innerHTML = "[ + ]";
|
|
|
|
body.style.display = "none";
|
2018-07-28 14:49:58 +00:00
|
|
|
} else {
|
2018-08-09 21:01:39 +00:00
|
|
|
target.innerHTML = "[ - ]";
|
|
|
|
body.style.display = "";
|
2018-07-28 14:49:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-23 21:55:26 +00:00
|
|
|
function get_youtube_replies(target) {
|
2018-08-09 21:01:39 +00:00
|
|
|
var continuation = target.getAttribute("data-continuation");
|
2018-07-28 14:49:58 +00:00
|
|
|
|
|
|
|
var body = target.parentNode.parentNode;
|
|
|
|
var fallback = body.innerHTML;
|
|
|
|
body.innerHTML =
|
2018-07-30 23:38:55 +00:00
|
|
|
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>';
|
2018-07-28 14:49:58 +00:00
|
|
|
|
2018-08-09 21:01:39 +00:00
|
|
|
var url =
|
|
|
|
"/api/v1/comments/<%= video.id %>?format=html&continuation=" + continuation;
|
2018-08-04 19:39:41 +00:00
|
|
|
var xhr = new XMLHttpRequest();
|
2018-08-09 21:01:39 +00:00
|
|
|
xhr.responseType = "json";
|
2018-08-13 14:58:02 +00:00
|
|
|
xhr.timeout = 20000;
|
2018-08-04 19:39:41 +00:00
|
|
|
xhr.open("GET", url, true);
|
|
|
|
xhr.send();
|
|
|
|
|
|
|
|
xhr.onreadystatechange = function() {
|
2018-08-09 21:01:39 +00:00
|
|
|
if (xhr.readyState == 4) {
|
2018-08-11 14:36:39 +00:00
|
|
|
if (xhr.status == 200) {
|
2018-08-17 14:25:47 +00:00
|
|
|
body.innerHTML = xhr.response.contentHtml;
|
2018-08-09 21:07:11 +00:00
|
|
|
} else {
|
|
|
|
body.innerHTML = fallback;
|
|
|
|
}
|
2018-08-04 19:39:41 +00:00
|
|
|
}
|
2018-08-09 21:01:39 +00:00
|
|
|
};
|
2018-08-04 19:39:41 +00:00
|
|
|
|
|
|
|
xhr.ontimeout = function() {
|
2018-08-23 21:55:26 +00:00
|
|
|
console.log("Pulling comments timed out.");
|
|
|
|
|
2018-08-09 21:07:11 +00:00
|
|
|
body.innerHTML = fallback;
|
2018-08-09 21:01:39 +00:00
|
|
|
};
|
2018-07-28 14:49:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function get_reddit_comments() {
|
2018-08-09 21:01:39 +00:00
|
|
|
var url = "/api/v1/comments/<%= video.id %>?source=reddit";
|
2018-08-04 19:39:41 +00:00
|
|
|
var xhr = new XMLHttpRequest();
|
2018-08-09 21:01:39 +00:00
|
|
|
xhr.responseType = "json";
|
2018-08-13 14:58:02 +00:00
|
|
|
xhr.timeout = 20000;
|
2018-08-04 19:39:41 +00:00
|
|
|
xhr.open("GET", url, true);
|
|
|
|
xhr.send();
|
2018-07-20 19:36:23 +00:00
|
|
|
|
2018-08-04 19:39:41 +00:00
|
|
|
xhr.onreadystatechange = function() {
|
2018-08-09 21:01:39 +00:00
|
|
|
if (xhr.readyState == 4)
|
|
|
|
if (xhr.status == 200) {
|
|
|
|
comments = document.getElementById("comments");
|
2018-08-09 21:07:11 +00:00
|
|
|
comments.innerHTML = `
|
|
|
|
<div>
|
|
|
|
<h3>
|
|
|
|
<a href="javascript:void(0)" onclick="toggle_comments(this)">[ - ]</a>
|
|
|
|
{title}
|
|
|
|
</h3>
|
|
|
|
<b>
|
|
|
|
<a target="_blank" href="https://reddit.com{permalink}">View more comments on Reddit</a>
|
|
|
|
</b>
|
|
|
|
</div>
|
2018-08-17 14:25:47 +00:00
|
|
|
<div>{contentHtml}</div>
|
2018-08-09 21:07:11 +00:00
|
|
|
|
|
|
|
<hr>`.supplant({
|
2018-08-04 19:39:41 +00:00
|
|
|
title: xhr.response.title,
|
|
|
|
permalink: xhr.response.permalink,
|
2018-08-17 14:25:47 +00:00
|
|
|
contentHtml: xhr.response.contentHtml
|
2018-08-09 21:07:11 +00:00
|
|
|
});
|
|
|
|
} else {
|
2018-08-25 23:33:15 +00:00
|
|
|
<% if preferences && preferences.comments[1] == "youtube" %>
|
2018-08-09 21:07:11 +00:00
|
|
|
get_youtube_comments();
|
2018-08-25 23:33:15 +00:00
|
|
|
<% else %>
|
|
|
|
comments = document.getElementById("comments");
|
|
|
|
comments.innerHTML = "";
|
|
|
|
<% end %>
|
2018-08-09 21:07:11 +00:00
|
|
|
}
|
2018-08-04 19:39:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
xhr.ontimeout = function() {
|
2018-08-23 21:55:26 +00:00
|
|
|
console.log("Pulling comments timed out.");
|
|
|
|
|
2018-08-09 21:07:11 +00:00
|
|
|
get_reddit_comments();
|
2018-08-09 21:01:39 +00:00
|
|
|
};
|
2018-07-28 14:49:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function get_youtube_comments() {
|
2018-08-09 21:01:39 +00:00
|
|
|
var url = "/api/v1/comments/<%= video.id %>?format=html";
|
2018-08-04 19:39:41 +00:00
|
|
|
var xhr = new XMLHttpRequest();
|
2018-08-09 21:01:39 +00:00
|
|
|
xhr.responseType = "json";
|
2018-08-13 14:58:02 +00:00
|
|
|
xhr.timeout = 20000;
|
2018-08-04 19:39:41 +00:00
|
|
|
xhr.open("GET", url, true);
|
|
|
|
xhr.send();
|
|
|
|
|
|
|
|
xhr.onreadystatechange = function() {
|
2018-08-09 21:01:39 +00:00
|
|
|
if (xhr.readyState == 4)
|
|
|
|
if (xhr.status == 200) {
|
|
|
|
comments = document.getElementById("comments");
|
2018-09-04 13:52:39 +00:00
|
|
|
if (xhr.response.commentCount > 0) {
|
|
|
|
comments.innerHTML = `
|
|
|
|
<div>
|
|
|
|
<h3>
|
|
|
|
<a href="javascript:void(0)" onclick="toggle_comments(this)">[ - ]</a>
|
|
|
|
View {commentCount} comments
|
|
|
|
</h3>
|
|
|
|
</div>
|
|
|
|
<div>{contentHtml}</div>
|
|
|
|
<hr>`.supplant({
|
|
|
|
contentHtml: xhr.response.contentHtml,
|
|
|
|
commentCount: commaSeparateNumber(xhr.response.commentCount)
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
comments.innerHTML = "";
|
|
|
|
}
|
2018-08-04 19:39:41 +00:00
|
|
|
} else {
|
2018-08-25 23:33:15 +00:00
|
|
|
<% if preferences && preferences.comments[1] == "youtube" %>
|
|
|
|
get_youtube_comments();
|
|
|
|
<% else %>
|
2018-08-09 21:01:39 +00:00
|
|
|
comments = document.getElementById("comments");
|
|
|
|
comments.innerHTML = "";
|
2018-08-25 23:33:15 +00:00
|
|
|
<% end %>
|
2018-08-09 21:07:11 +00:00
|
|
|
}
|
2018-08-09 21:01:39 +00:00
|
|
|
};
|
2018-08-04 19:39:41 +00:00
|
|
|
|
2018-08-09 21:01:39 +00:00
|
|
|
xhr.ontimeout = function() {
|
2018-08-23 21:55:26 +00:00
|
|
|
console.log("Pulling comments timed out.");
|
|
|
|
|
2018-08-13 14:58:02 +00:00
|
|
|
comments = document.getElementById("comments");
|
|
|
|
comments.innerHTML =
|
|
|
|
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>';
|
2018-08-04 19:39:41 +00:00
|
|
|
get_youtube_comments();
|
2018-08-09 21:01:39 +00:00
|
|
|
};
|
2018-07-28 14:49:58 +00:00
|
|
|
}
|
|
|
|
|
2018-08-17 14:25:47 +00:00
|
|
|
function commaSeparateNumber(val){
|
|
|
|
while (/(\d+)(\d{3})/.test(val.toString())){
|
|
|
|
val = val.toString().replace(/(\d+)(\d{3})/, '$1'+','+'$2');
|
|
|
|
}
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2018-07-28 14:49:58 +00:00
|
|
|
String.prototype.supplant = function(o) {
|
|
|
|
return this.replace(/{([^{}]*)}/g, function(a, b) {
|
|
|
|
var r = o[b];
|
2018-08-09 21:01:39 +00:00
|
|
|
return typeof r === "string" || typeof r === "number" ? r : a;
|
2018-07-28 14:49:58 +00:00
|
|
|
});
|
2018-07-20 19:36:23 +00:00
|
|
|
};
|
|
|
|
|
2018-08-25 23:33:15 +00:00
|
|
|
<% if preferences %>
|
|
|
|
<% if preferences.comments[0] == "youtube" %>
|
|
|
|
get_youtube_comments();
|
|
|
|
<% elsif preferences.comments[0] == "reddit" %>
|
|
|
|
get_reddit_comments();
|
2018-01-16 19:58:08 +00:00
|
|
|
<% else %>
|
2018-08-25 23:33:15 +00:00
|
|
|
<% if preferences.comments[1] == "youtube" %>
|
|
|
|
get_youtube_comments();
|
|
|
|
<% elsif preferences.comments[1] == "reddit" %>
|
|
|
|
get_reddit_comments();
|
|
|
|
<% else %>
|
|
|
|
comments = document.getElementById("comments");
|
|
|
|
comments.innerHTML = "";
|
|
|
|
<% end %>
|
2018-01-16 19:58:08 +00:00
|
|
|
<% end %>
|
2018-08-25 23:33:15 +00:00
|
|
|
<% else %>
|
|
|
|
get_youtube_comments();
|
2018-08-18 16:47:16 +00:00
|
|
|
<% end %>
|
2018-01-16 02:30:57 +00:00
|
|
|
|
2018-08-25 23:33:15 +00:00
|
|
|
</script>
|