invidious-copy-2022-08-14/src/views/watch.ecr

226 lines
7.2 KiB
Text
Raw Normal View History

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-03-09 19:39:13 +00:00
<link rel="stylesheet" href="https://vjs.zencdn.net/6.6.3/video-js.css">
<link rel="stylesheet" href="https://unpkg.com/silvermine-videojs-quality-selector/dist/css/quality-selector.css">
2018-03-09 19:39:13 +00:00
<script src="https://vjs.zencdn.net/6.6.3/video.js"></script>
<script src="https://cdn.sc.gl/videojs-hotkeys/latest/videojs.hotkeys.min.js"></script>
<script src="https://unpkg.com/silvermine-videojs-quality-selector/dist/js/silvermine-videojs-quality-selector.min.js"></script>
2018-04-06 01:46:32 +00:00
<script src="https://cdn.jsdelivr.net/npm/videojs-offset/dist/videojs-offset.min.js"></script>
2018-01-28 02:10:08 +00:00
<title><%= 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-03-13 23:37:56 +00:00
<% if listen %>
<%= render "src/views/player/audio.ecr" %>
<% else %>
<%= render "src/views/player/video.ecr" %>
<% end %>
2018-03-11 17:05:56 +00:00
</div>
2018-01-16 19:58:08 +00:00
<script>
var options = {
preload: "auto",
2018-03-13 23:37:56 +00:00
playbackRates: [0.5, 1, 1.5, 2],
controlBar: {
children: [
'playToggle',
'volumePanel',
'progressControl',
'remainingTimeDisplay',
'qualitySelector',
'playbackRateMenuButton',
'fullscreenToggle',
],
},
2018-01-16 19:58:08 +00:00
};
var player = videojs('player', options, function() {
this.hotkeys({
volumeStep: 0.1,
seekStep: 5,
2018-02-06 00:36:16 +00:00
enableModifiersForNumbers: false,
enableVolumeScroll: false,
customKeys: {
play: {
key: function(e) {
// Toggle play with K Key
return (e.which === 75);
},
handler: function(player, options, e) {
if (player.paused()) {
player.play();
} else {
player.pause();
}
}
},
backward: {
key: function(e) {
// Go backward 5 seconds
return (e.which === 74);
},
handler: function(player, options, e) {
player.currentTime(player.currentTime() - 5);
}
},
forward: {
key: function(e) {
// Go forward 5 seconds
return (e.which === 76);
},
handler: function(player, options, e) {
player.currentTime(player.currentTime() + 5);
}
}
}
2018-01-16 19:58:08 +00:00
});
});
2018-04-06 01:46:32 +00:00
player.offset({
start: <%= video_start %>,
end: <%= video_end %>
2018-04-06 01:46:32 +00:00
});
2018-03-03 21:06:14 +00:00
function toggle(target) {
body = target.parentNode.parentNode.children[1];
if (body.style.display === null || body.style.display === '') {
target.innerHTML = '[ + ]';
body.style.display = 'none';
} else {
target.innerHTML = '[ - ]';
body.style.display = '';
}
2018-03-12 23:36:08 +00:00
};
function toggle_comments(target) {
body = target.parentNode.parentNode.parentNode.children[1];
if (body.style.display === null || body.style.display === '') {
target.innerHTML = '[ + ]';
body.style.display = 'none';
} else {
target.innerHTML = '[ - ]';
body.style.display = '';
2018-03-13 23:37:56 +00:00
}
2018-03-12 23:36:08 +00:00
};
2018-04-11 22:24:50 +00:00
<% if !listen %>
var currentSources = player.currentSources();
for ( var i = 0; i < currentSources.length; i++ ) {
if (player.canPlayType(currentSources[i]["type"].split(";")[0]) === "") {
currentSources.splice(i);
i--;
}
}
player.src(currentSources);
2018-04-11 22:24:50 +00:00
<% end %>
2018-01-16 19:58:08 +00:00
</script>
2018-01-16 02:30:57 +00:00
2018-03-12 23:37:01 +00:00
<div class="h-box">
2018-01-16 19:58:08 +00:00
<h1>
<%= video.info["title"] %>
2018-02-11 23:01:32 +00:00
<% if listen %>
<a href="/watch?<%= env.params.query %>">
2018-02-11 23:01:32 +00:00
<i class="fa fa-video" aria-hidden="true"></i>
2018-01-16 19:58:08 +00:00
</a>
<% else %>
<a href="/watch?<%= env.params.query %>&listen=true">
2018-01-16 19:58:08 +00:00
<i class="fa fa-volume-up" aria-hidden="true"></i>
</a>
<% end %>
</h1>
2018-03-11 17:05:56 +00:00
</div>
2018-01-16 02:30:57 +00:00
2018-01-16 19:58:08 +00:00
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-5">
2018-04-17 20:53:12 +00:00
<div class="h-box">
<p><i class="fa fa-eye" aria-hidden="true"></i> <%= number_with_separator(video.views) %></p>
<p><i class="fa fa-thumbs-up" aria-hidden="true"></i> <%= number_with_separator(video.likes) %></p>
<p><i class="fa fa-thumbs-down" aria-hidden="true"></i> <%= number_with_separator(video.dislikes) %></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>
2018-04-08 01:09:20 +00:00
<% if ad_slots %>
2018-04-11 02:09:31 +00:00
<p id="Slots">Ad Slots : <%= ad_slots %></p>
2018-04-08 01:09:20 +00:00
<% end %>
<% if engage_types %>
2018-04-11 02:09:31 +00:00
<p id="Engage">Engage Types : <%= engage_types %></p>
2018-04-08 01:09:20 +00:00
<% end %>
<% if ad_tag %>
2018-04-11 02:09:31 +00:00
<p id="Category">Ad Category : <%= ad_category %></p>
<p id="Tags">Ad Tags(?) : <%= k2 %></p>
2018-04-08 01:09:20 +00:00
<% end %>
</div>
2018-03-11 17:05:56 +00:00
</div>
2018-01-16 02:30:57 +00:00
2018-01-16 19:58:08 +00:00
<div class="pure-u-1 pure-u-md-3-5">
2018-04-17 20:53:12 +00:00
<div class="h-box">
<p>
<a href="https://youtube.com/channel/<%= video.info["ucid"] %>">
<h3><%= video.info["author"] %></h3>
</a>
</p>
2018-03-31 14:51:14 +00:00
<% if authorized %>
<% if subscriptions.includes? video.info["ucid"] %>
<p>
<a href="/subscription_ajax?action_remove_subscriptions=1&c=<%= video.info["ucid"] %>">
<b>Unsubscribe from <%= video.info["author"] %></b>
</a>
</p>
<% else %>
<p>
<a href="/subscription_ajax?action_create_subscription_to_channel=1&c=<%= video.info["ucid"] %>">
<b>Subscribe to <%= video.info["author"] %></b>
</a>
</p>
<% end %>
2018-05-04 01:36:27 +00:00
<% else %>
<p>
<a href="/login">
<b>Login to subscribe to <%= video.info["author"] %></b>
</a>
</p>
2018-03-31 14:51:14 +00:00
<% end %>
<p>
<b>Shared <%= video.published.to_s("%B %-d, %Y") %></b>
</p>
2018-04-17 20:53:12 +00:00
<div>
<%= video.description %>
</div>
2018-03-11 17:05:56 +00:00
<hr style="margin-left:1em; margin-right:1em;">
2018-03-07 04:00:35 +00:00
<% if reddit_thread && !reddit_html.empty? %>
2018-04-11 02:09:31 +00:00
<div id="Comments">
2018-03-17 03:18:55 +00:00
<div>
2018-03-12 23:36:08 +00:00
<h3>
<a href="javascript:void(0)" onclick="toggle_comments(this)">[ - ]</a>
2018-04-21 23:04:01 +00:00
<%= reddit_thread.title %>
2018-03-12 23:36:08 +00:00
</h3>
2018-03-13 23:37:56 +00:00
<b>
2018-04-21 23:04:01 +00:00
<a target="_blank" href="https://reddit.com<%= reddit_thread.permalink %>">View more comments on Reddit</a>
2018-03-13 23:37:56 +00:00
</b>
2018-03-12 23:36:08 +00:00
</div>
<div>
2018-03-13 23:37:56 +00:00
<%= reddit_html %>
</div>
2018-03-12 23:36:08 +00:00
</div>
2018-03-26 03:24:49 +00:00
<hr style="margin-left:1em; margin-right:1em;">
<% end %>
2018-03-13 23:37:56 +00:00
</div>
2018-03-11 17:05:56 +00:00
</div>
2018-01-16 02:30:57 +00:00
2018-01-16 19:58:08 +00:00
<div class="pure-u-1 pure-u-md-1-5">
2018-04-17 20:53:12 +00:00
<div class="h-box">
<% rvs.each do |rv| %>
<% if rv.has_key?("id") %>
<a href="/watch?v=<%= rv["id"] %>">
<img style="width:100%;" alt="thumbnail" src="<%= rv["iurlmq"] %>">
<p style="width:100%"><%= rv["title"] %></p>
<p>
<b style="width: 100%"><%= rv["author"] %></b>
</p>
</a>
<% end %>
2018-01-15 03:16:09 +00:00
<% end %>
</div>
2018-01-07 17:50:04 +00:00
</div>
2018-01-16 19:58:08 +00:00
</div>