- commit
- b65c3d286ac0fb48089a5b5864daa0bf8a4e6532
- parent
- 6c1ef9d1cba95e525d6c7a49f75e1d7fd72735ef
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2025-02-14 22:27
automatically skip to next video
Diffstat
| M | static/style.css | 7 | +++++++ |
| M | static/video.js | 12 | ++++++++++++ |
| M | templates/video.html | 2 | +- |
3 files changed, 20 insertions, 1 deletions
diff --git a/static/style.css b/static/style.css
@@ -169,6 +169,9 @@ video {
169 169 }
170 170 .next {
171 171 inset-block-start: 0.5em;
-1 172 background-image: linear-gradient(to right, var(--border) 50%, transparent 50%);
-1 173 background-size: 200% 100%;
-1 174 background-position: 100% 0;
172 175 }
173 176 .next::before {
174 177 content: "";
@@ -178,6 +181,10 @@ video {
178 181 border-inline-end: 0;
179 182 margin-inline-end: 0.4em;
180 183 }
-1 184 .next.loading {
-1 185 transition: background-position 5s;
-1 186 background-position: 0 0;
-1 187 }
181 188
182 189 .quality {
183 190 display: flex;
diff --git a/static/video.js b/static/video.js
@@ -62,6 +62,15 @@ var createMenu = function() {
62 62 return ul;
63 63 };
64 64
-1 65 video.addEventListener('ended', event => {
-1 66 document.exitFullscreen();
-1 67 var a = document.querySelector('a[rel="next"]');
-1 68 if (a) {
-1 69 a.classList.add('loading');
-1 70 setTimeout(() => a.click(), 5000);
-1 71 }
-1 72 });
-1 73
65 74 var menu = createMenu();
66 75 video.after(menu);
67 76 applyQuality(localStorage.getItem('quality'), true);
@@ -69,3 +78,6 @@ applyQuality(localStorage.getItem('quality'), true);
69 78 if (query.has('t')) {
70 79 video.currentTime = parseInt(query.get('t'), 10);
71 80 }
-1 81 if (query.has('autoplay')) {
-1 82 video.play();
-1 83 }
diff --git a/templates/video.html b/templates/video.html
@@ -13,7 +13,7 @@ 13 13 {% endfor %} 14 14 </video> 15 15 {% if next %}16 -1 <a href="/video/{{ next }}/" class="next" rel="next">Next episode</a>-1 16 <a href="/video/{{ next }}/?autoplay" class="next" rel="next">Next episode</a> 17 17 {% endif %} 18 18 </div> 19 19 <div class="wrapper">