aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/templates
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-06-29 19:07:40 -0500
committerJesús <heckyel@hyperbola.info>2021-06-29 19:07:40 -0500
commitc6fe980a7a4941bca69f8b82ff54bb73ce2bec6d (patch)
tree48a8440a674aab413bf3b75e2e4d9e09abbd4e5d /youtube/templates
parent8d45ca855ae5f5e37e572d0071133c0227a161f4 (diff)
downloadyt-local-c6fe980a7a4941bca69f8b82ff54bb73ce2bec6d.tar.lz
yt-local-c6fe980a7a4941bca69f8b82ff54bb73ce2bec6d.tar.xz
yt-local-c6fe980a7a4941bca69f8b82ff54bb73ce2bec6d.zip
autoplay-toggle: use label tag
from upstream: <label> is semantic and makes clicking the text activate in checkbox
Diffstat (limited to 'youtube/templates')
-rw-r--r--youtube/templates/watch.html31
1 files changed, 24 insertions, 7 deletions
diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html
index 3b2c2da..9a80c68 100644
--- a/youtube/templates/watch.html
+++ b/youtube/templates/watch.html
@@ -154,7 +154,7 @@
<div class="playlist-header">
<a href="{{ playlist['url'] }}" title="{{ playlist['title'] }}"><h3>{{ playlist['title'] }}</h3></a>
<ul class="playlist-metadata">
- <li>Autoplay: <input type="checkbox" id="autoplay-toggle"></li>
+ <li><label for="playlist-autoplay-toggle">Autoplay: </label><input type="checkbox" id="playlist-autoplay-toggle"></li>
{% if playlist['current_index'] is none %}
<li>[Error!]/{{ playlist['video_count'] }}</li>
{% else %}
@@ -214,7 +214,7 @@
{% endif %}
</div>
{% elif settings.related_videos_mode != 0 %}
- <li class="related-autoplay">Autoplay: <input type="checkbox" id="autoplay-toggle"></li>
+ <div class="related-autoplay"><label for="related-autoplay-toggle">Autoplay: </label><input type="checkbox" id="related-autoplay-toggle"></div>
{% endif %}
{% if settings.related_videos_mode != 0 or playlist %}
@@ -252,18 +252,34 @@
autoplayEnabled = Number(cookieValue);
}
- // check the checkbox if autoplay is on
- let checkbox = document.querySelector('#autoplay-toggle');
+ // check the autoplay checkbox if autoplay is on
+ {% if isPlaylist %}
+ let PlaylistAutoplayCheck = document.getElementById('playlist-autoplay-toggle');
+ if(autoplayEnabled){
+ PlaylistAutoplayCheck.checked = true;
+ }
+ {% else %}
+ let RelatedAutoplayCheck = document.getElementById('related-autoplay-toggle');
if(autoplayEnabled){
- checkbox.checked = true;
+ RelatedAutoplayCheck.checked = true;
}
+ {% endif %}
// listen for checkbox to turn autoplay on and off
let cookie = 'autoplay'
{% if isPlaylist %}
cookie += '_' + playlist_id;
- {% endif %}
- checkbox.addEventListener( 'change', function() {
+ PlaylistAutoplayCheck.addEventListener( 'change', function() {
+ if(this.checked) {
+ autoplayEnabled = 1;
+ document.cookie = cookie + '=1; SameSite=Strict';
+ } else {
+ autoplayEnabled = 0;
+ document.cookie = cookie + '=0; SameSite=Strict';
+ }
+ });
+ {% else %}
+ RelatedAutoplayCheck.addEventListener( 'change', function() {
if(this.checked) {
autoplayEnabled = 1;
document.cookie = cookie + '=1; SameSite=Strict';
@@ -272,6 +288,7 @@
document.cookie = cookie + '=0; SameSite=Strict';
}
});
+ {% endif %}
const vid = document.getElementById('js-video-player');
if(!playability_error){