mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-19 19:38:51 +00:00
Add continuous playback
This commit is contained in:
@@ -23,6 +23,11 @@ function update_value(element) {
|
||||
<input name="autoplay" id="autoplay" type="checkbox" <% if user.preferences.autoplay %>checked<% end %>>
|
||||
</div>
|
||||
|
||||
<div class="pure-control-group">
|
||||
<label for="continue">Automatically play next video: </label>
|
||||
<input name="continue" id="continue" type="checkbox" <% if user.preferences.continue %>checked<% end %>>
|
||||
</div>
|
||||
|
||||
<div class="pure-control-group">
|
||||
<label for="listen">Listen by default: </label>
|
||||
<input name="listen" id="listen" type="checkbox" <% if user.preferences.listen %>checked<% end %>>
|
||||
|
||||
@@ -140,6 +140,15 @@
|
||||
|
||||
<% if !preferences || preferences && preferences.related_videos %>
|
||||
<div class="h-box">
|
||||
|
||||
<% if !plid && !rvs.empty? %>
|
||||
<div class="pure-control-group">
|
||||
<label for="continue">Autoplay next video: </label>
|
||||
<input name="continue" onclick="continue_autoplay(this)" id="continue" type="checkbox" <% if params[:continue] %>checked<% end %>>
|
||||
</div>
|
||||
<hr>
|
||||
<% end %>
|
||||
|
||||
<% rvs.each do |rv| %>
|
||||
<% if rv.has_key?("id") %>
|
||||
<a href="/watch?v=<%= rv["id"] %>">
|
||||
@@ -163,6 +172,46 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<% if !rvs.empty? && !plid && params[:continue] %>
|
||||
player.on('ended', function() {
|
||||
window.location.replace("/watch?v="
|
||||
+ "<%= rvs[0]?.try &.["id"] %>"
|
||||
+ "&continue=1"
|
||||
<% if params[:listen] %>
|
||||
+ "&listen=1"
|
||||
<% end %>
|
||||
<% if params[:autoplay] %>
|
||||
+ "&autoplay=1"
|
||||
<% end %>
|
||||
<% if params[:speed] %>
|
||||
+ "&speed=<%= params[:speed] %>"
|
||||
<% end %>
|
||||
);
|
||||
});
|
||||
<% end %>
|
||||
|
||||
function continue_autoplay(target) {
|
||||
if (target.checked) {
|
||||
player.on('ended', function() {
|
||||
window.location.replace("/watch?v="
|
||||
+ "<%= rvs[0]?.try &.["id"] %>"
|
||||
+ "&continue=1"
|
||||
<% if params[:listen] %>
|
||||
+ "&listen=1"
|
||||
<% end %>
|
||||
<% if params[:autoplay] %>
|
||||
+ "&autoplay=1"
|
||||
<% end %>
|
||||
<% if params[:speed] %>
|
||||
+ "&speed=<%= params[:speed] %>"
|
||||
<% end %>
|
||||
);
|
||||
});
|
||||
} else {
|
||||
player.off('ended');
|
||||
}
|
||||
}
|
||||
|
||||
function number_with_separator(val) {
|
||||
while (/(\d+)(\d{3})/.test(val.toString())) {
|
||||
val = val.toString().replace(/(\d+)(\d{3})/, "$1" + "," + "$2");
|
||||
|
||||
Reference in New Issue
Block a user