mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-19 11:28:51 +00:00
Add annotation preferences
This commit is contained in:
@@ -3,26 +3,26 @@
|
||||
onmouseenter='this["data-title"]=this["title"];this["title"]=""'
|
||||
onmouseleave='this["title"]=this["data-title"];this["data-title"]=""'
|
||||
oncontextmenu='this["title"]=this["data-title"]'
|
||||
<% if params[:autoplay] %>autoplay<% end %>
|
||||
<% if params[:video_loop] %>loop<% end %>
|
||||
<% if params[:controls] %>controls<% end %>>
|
||||
<% if params.autoplay %>autoplay<% end %>
|
||||
<% if params.video_loop %>loop<% end %>
|
||||
<% if params.controls %>controls<% end %>>
|
||||
<% if hlsvp %>
|
||||
<source src="<%= hlsvp %>?local=true" type="application/x-mpegURL" label="livestream">
|
||||
<% else %>
|
||||
<% if params[:listen] %>
|
||||
<% if params.listen %>
|
||||
<% audio_streams.each_with_index do |fmt, i| %>
|
||||
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params[:local] %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>">
|
||||
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>">
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if params[:quality] == "dash" %>
|
||||
<% if params.quality == "dash" %>
|
||||
<source src="/api/manifest/dash/id/<%= video.id %>?local=true" type='application/dash+xml' label="dash">
|
||||
<% end %>
|
||||
|
||||
<% fmt_stream.each_with_index do |fmt, i| %>
|
||||
<% if params[:quality] %>
|
||||
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params[:local] %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= params[:quality] == fmt["label"].split(" - ")[0] %>">
|
||||
<% if params.quality %>
|
||||
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= params.quality == fmt["label"].split(" - ")[0] %>">
|
||||
<% else %>
|
||||
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params[:local] %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= i == 0 ? true : false %>">
|
||||
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= i == 0 ? true : false %>">
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -161,7 +161,7 @@ player.on('error', function(event) {
|
||||
}
|
||||
});
|
||||
|
||||
<% if params[:video_start] > 0 || params[:video_end] > 0 %>
|
||||
<% if params.video_start > 0 || params.video_end > 0 %>
|
||||
player.markers({
|
||||
onMarkerReached: function(marker) {
|
||||
if (marker.text === "End") {
|
||||
@@ -173,22 +173,22 @@ player.markers({
|
||||
}
|
||||
},
|
||||
markers: [
|
||||
{ time: <%= params[:video_start] %>, text: "Start" },
|
||||
<% if params[:video_end] < 0 %>
|
||||
{ time: <%= params.video_start %>, text: "Start" },
|
||||
<% if params.video_end < 0 %>
|
||||
{ time: <%= video.info["length_seconds"].to_f - 0.5 %>, text: "End" }
|
||||
<% else %>
|
||||
{ time: <%= params[:video_end] %>, text: "End" }
|
||||
{ time: <%= params.video_end %>, text: "End" }
|
||||
<% end %>
|
||||
]
|
||||
});
|
||||
|
||||
player.currentTime(<%= params[:video_start] %>);
|
||||
player.currentTime(<%= params.video_start %>);
|
||||
<% end %>
|
||||
|
||||
player.volume(<%= params[:volume].to_f / 100 %>);
|
||||
player.playbackRate(<%= params[:speed] %>);
|
||||
player.volume(<%= params.volume.to_f / 100 %>);
|
||||
player.playbackRate(<%= params.speed %>);
|
||||
|
||||
<% if params[:autoplay] %>
|
||||
<% if params.autoplay %>
|
||||
var bpb = player.getChild('bigPlayButton');
|
||||
|
||||
if (bpb) {
|
||||
@@ -211,9 +211,11 @@ if (bpb) {
|
||||
}
|
||||
<% end %>
|
||||
|
||||
<% if !params.listen && params.quality == "dash" %>
|
||||
player.httpSourceSelector();
|
||||
<% end %>
|
||||
|
||||
<% if !params[:listen] %>
|
||||
<% if !params.listen && params.annotations %>
|
||||
var video_container = document.getElementById("player");
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.responseType = "text";
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<script src="/js/videojs-markers.min.js"></script>
|
||||
<script src="/js/videojs-share.min.js"></script>
|
||||
<script src="/js/videojs-youtube-annotations.js"></script>
|
||||
<% if params[:quality] != "dash" %>
|
||||
<% if params.listen || params.quality != "dash" %>
|
||||
<link rel="stylesheet" href="/css/quality-selector.css">
|
||||
<script src="/js/silvermine-videojs-quality-selector.min.js"></script>
|
||||
<% end %>
|
||||
@@ -55,14 +55,14 @@ function get_playlist(timeouts = 0) {
|
||||
location.assign("/embed/"
|
||||
+ xhr.response.nextVideo
|
||||
+ "?list=<%= plid %>"
|
||||
<% if params[:listen] != preferences.listen %>
|
||||
+ "&listen=<%= params[:listen] %>"
|
||||
<% if params.listen != preferences.listen %>
|
||||
+ "&listen=<%= params.listen %>"
|
||||
<% end %>
|
||||
<% if params[:autoplay] || params[:continue_autoplay] %>
|
||||
<% if params.autoplay || params.continue_autoplay %>
|
||||
+ "&autoplay=1"
|
||||
<% end %>
|
||||
<% if params[:speed] != preferences.speed %>
|
||||
+ "&speed=<%= params[:speed] %>"
|
||||
<% if params.speed != preferences.speed %>
|
||||
+ "&speed=<%= params.speed %>"
|
||||
<% end %>
|
||||
);
|
||||
});
|
||||
@@ -85,14 +85,14 @@ player.on('ended', function() {
|
||||
<% if !video_series.empty? %>
|
||||
+ "?playlist=<%= video_series.join(",") %>"
|
||||
<% end %>
|
||||
<% if params[:listen] != preferences.listen %>
|
||||
+ "&listen=<%= params[:listen] %>"
|
||||
<% if params.listen != preferences.listen %>
|
||||
+ "&listen=<%= params.listen %>"
|
||||
<% end %>
|
||||
<% if params[:autoplay] || params[:continue_autoplay] %>
|
||||
<% if params.autoplay || params.continue_autoplay %>
|
||||
+ "&autoplay=1"
|
||||
<% end %>
|
||||
<% if params[:speed] != preferences.speed %>
|
||||
+ "&speed=<%= params[:speed] %>"
|
||||
<% if params.speed != preferences.speed %>
|
||||
+ "&speed=<%= params.speed %>"
|
||||
<% end %>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -94,6 +94,11 @@ function update_value(element) {
|
||||
<input name="related_videos" id="related_videos" type="checkbox" <% if preferences.related_videos %>checked<% end %>>
|
||||
</div>
|
||||
|
||||
<div class="pure-control-group">
|
||||
<label for="annotations"><%= translate(locale, "Show annotations by default? ") %></label>
|
||||
<input name="annotations" id="annotations" type="checkbox" <% if preferences.annotations %>checked<% end %>>
|
||||
</div>
|
||||
|
||||
<legend><%= translate(locale, "Visual preferences") %></legend>
|
||||
|
||||
<div class="pure-control-group">
|
||||
@@ -118,6 +123,11 @@ function update_value(element) {
|
||||
<% if env.get? "user" %>
|
||||
<legend><%= translate(locale, "Subscription preferences") %></legend>
|
||||
|
||||
<div class="pure-control-group">
|
||||
<label for="annotations_subscribed"><%= translate(locale, "Show annotations by default for subscribed channels? ") %></label>
|
||||
<input name="annotations_subscribed" id="annotations_subscribed" type="checkbox" <% if preferences.annotations_subscribed %>checked<% end %>>
|
||||
</div>
|
||||
|
||||
<div class="pure-control-group">
|
||||
<label for="redirect_feed"><%= translate(locale, "Redirect homepage to feed: ") %></label>
|
||||
<input name="redirect_feed" id="redirect_feed" type="checkbox" <% if preferences.redirect_feed %>checked<% end %>>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<div class="h-box">
|
||||
<h1>
|
||||
<%= HTML.escape(video.title) %>
|
||||
<% if params[:listen] %>
|
||||
<% if params.listen %>
|
||||
<a title="<%=translate(locale, "Video mode")%>" href="/watch?<%= env.params.query %>&listen=0">
|
||||
<i class="icon ion-ios-videocam"></i>
|
||||
</a>
|
||||
@@ -56,6 +56,17 @@
|
||||
<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>
|
||||
<% if params.annotations %>
|
||||
<a href="/watch?<%= env.params.query %>&iv_load_policy=3">
|
||||
<%= translate(locale, "Hide annotations") %>
|
||||
</a>
|
||||
<% else %>
|
||||
<a href="/watch?<%= env.params.query %>&iv_load_policy=1">
|
||||
<%=translate(locale, "Show annotations")%>
|
||||
</a>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<% if CONFIG.dmca_content.includes? video.id %>
|
||||
<p>Download is disabled.</p>
|
||||
@@ -122,7 +133,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pure-u-1 <% if params[:related_videos] || plid %>pure-u-lg-3-5<% else %>pure-u-md-4-5<% end %>">
|
||||
<div class="pure-u-1 <% if params.related_videos || plid %>pure-u-lg-3-5<% else %>pure-u-md-4-5<% end %>">
|
||||
<div class="h-box">
|
||||
<p>
|
||||
<a href="/channel/<%= video.ucid %>">
|
||||
@@ -153,21 +164,21 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% if params[:related_videos] || plid %>
|
||||
<% if params.related_videos || plid %>
|
||||
<div class="pure-u-1 pure-u-lg-1-5">
|
||||
<% if plid %>
|
||||
<div id="playlist" class="h-box">
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if params[:related_videos] %>
|
||||
<% if params.related_videos %>
|
||||
<div class="h-box">
|
||||
|
||||
<% if !rvs.empty? %>
|
||||
<div <% if plid %>style="display:none"<% end %>>
|
||||
<div class="pure-control-group">
|
||||
<label for="continue"><%= translate(locale, "Autoplay next video: ") %></label>
|
||||
<input name="continue" onclick="continue_autoplay(this)" id="continue" type="checkbox" <% if params[:continue] %>checked<% end %>>
|
||||
<input name="continue" onclick="continue_autoplay(this)" id="continue" type="checkbox" <% if params.continue %>checked<% end %>>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
@@ -205,19 +216,19 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<% if !rvs.empty? && !plid && params[:continue] %>
|
||||
<% if !rvs.empty? && !plid && params.continue %>
|
||||
player.on('ended', function() {
|
||||
location.assign("/watch?v="
|
||||
+ "<%= rvs.select { |rv| rv["id"]? }[0]?.try &.["id"] %>"
|
||||
+ "&continue=1"
|
||||
<% if params[:listen] != preferences.listen %>
|
||||
+ "&listen=<%= params[:listen] %>"
|
||||
<% if params.listen != preferences.listen %>
|
||||
+ "&listen=<%= params.listen %>"
|
||||
<% end %>
|
||||
<% if params[:autoplay] || params[:continue_autoplay] %>
|
||||
<% if params.autoplay || params.continue_autoplay %>
|
||||
+ "&autoplay=1"
|
||||
<% end %>
|
||||
<% if params[:speed] != preferences.speed %>
|
||||
+ "&speed=<%= params[:speed] %>"
|
||||
<% if params.speed != preferences.speed %>
|
||||
+ "&speed=<%= params.speed %>"
|
||||
<% end %>
|
||||
);
|
||||
});
|
||||
@@ -229,14 +240,14 @@ function continue_autoplay(target) {
|
||||
location.assign("/watch?v="
|
||||
+ "<%= rvs.select { |rv| rv["id"]? }[0]?.try &.["id"] %>"
|
||||
+ "&continue=1"
|
||||
<% if params[:listen] != preferences.listen %>
|
||||
+ "&listen=<%= params[:listen] %>"
|
||||
<% if params.listen != preferences.listen %>
|
||||
+ "&listen=<%= params.listen %>"
|
||||
<% end %>
|
||||
<% if params[:autoplay] || params[:continue_autoplay] %>
|
||||
<% if params.autoplay || params.continue_autoplay %>
|
||||
+ "&autoplay=1"
|
||||
<% end %>
|
||||
<% if params[:speed] != preferences.speed %>
|
||||
+ "&speed=<%= params[:speed] %>"
|
||||
<% if params.speed != preferences.speed %>
|
||||
+ "&speed=<%= params.speed %>"
|
||||
<% end %>
|
||||
);
|
||||
});
|
||||
@@ -295,14 +306,14 @@ function get_playlist(timeouts = 0) {
|
||||
location.assign("/watch?v="
|
||||
+ xhr.response.nextVideo
|
||||
+ "&list=<%= plid %>"
|
||||
<% if params[:listen] != preferences.listen %>
|
||||
+ "&listen=<%= params[:listen] %>"
|
||||
<% if params.listen != preferences.listen %>
|
||||
+ "&listen=<%= params.listen %>"
|
||||
<% end %>
|
||||
<% if params[:autoplay] || params[:continue_autoplay] %>
|
||||
<% if params.autoplay || params.continue_autoplay %>
|
||||
+ "&autoplay=1"
|
||||
<% end %>
|
||||
<% if params[:speed] != preferences.speed %>
|
||||
+ "&speed=<%= params[:speed] %>"
|
||||
<% if params.speed != preferences.speed %>
|
||||
+ "&speed=<%= params.speed %>"
|
||||
<% end %>
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user