neddit

the frontend of the frontpage of the internet  https://neddit.ce9e.org
git clone https://git.ce9e.org/neddit.git

commit
4aaedf67707114b962c97d0082357256981b9b7f
parent
2a64e12a9536dabb1fdef9626ecf781296161768
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2026-10-02 18:24
lint video.js

Diffstat

M static/video.js 20 ++++++++++----------

1 files changed, 10 insertions, 10 deletions


diff --git a/static/video.js b/static/video.js

@@ -1,25 +1,25 @@
    1    -1 var thottle = function(fn, timeout) {
   -1     1 function thottle(fn, timeout) {
    2     2 	var blocked = false;
    3     3 
    4    -1 	return function() {
   -1     4 	return () => {
    5     5 		if (!blocked) {
    6     6 			blocked = true;
    7    -1 			setTimeout(function() {
   -1     7 			setTimeout(() => {
    8     8 				blocked = false;
    9     9 			}, timeout);
   10    10 			fn();
   11    11 		}
   12    12 	};
   13    -1 };
   -1    13 }
   14    14 
   15    -1 var addSource = function(audio, url) {
   -1    15 function addSource(audio, url) {
   16    16 	var source = document.createElement('source');
   17    17 	source.src = url;
   18    18 	audio.append(source);
   19    -1 };
   -1    19 }
   20    20 
   21    -1 window.addEventListener('scroll', thottle(function() {
   22    -1 	document.querySelectorAll('video').forEach(function(video) {
   -1    21 window.addEventListener('scroll', thottle(() => {
   -1    22 	document.querySelectorAll('video').forEach(video => {
   23    23 		if (video.paused) {
   24    24 			return;
   25    25 		}
@@ -30,7 +30,7 @@ window.addEventListener('scroll', thottle(function() {
   30    30 	});
   31    31 }, 100), {passive: true});
   32    32 
   33    -1 document.querySelectorAll('video').forEach(function(video) {
   -1    33 document.querySelectorAll('video').forEach(video => {
   34    34 	if (video.canPlayType('audio/mpegurl') || video.canPlayType('application/dash+xml')) {
   35    35 		return;
   36    36 	}
@@ -47,7 +47,7 @@ document.querySelectorAll('video').forEach(function(video) {
   47    47 	audio.loop = true;
   48    48 	video.after(audio);
   49    49 
   50    -1 	var sync = function() {
   -1    50 	var sync = () => {
   51    51 		audio.currentTime = video.currentTime;
   52    52 	};
   53    53 	video.onplay = function() {