Pārlūkot izejas kodu

Update timeline.js

Daniel Supernault 6 gadi atpakaļ
vecāks
revīzija
e0760ff74a
1 mainītis faili ar 12 papildinājumiem un 1 dzēšanām
  1. 12 1
      resources/assets/js/timeline.js

+ 12 - 1
resources/assets/js/timeline.js

@@ -3,7 +3,12 @@ $(document).ready(function() {
   $('.container.timeline-container').removeClass('d-none');
   let elem = document.querySelector('.timeline-feed');
   pixelfed.fetchLikes();
-  
+  $('video').on('play', function() {
+    activated = this;
+    $('video').each(function() {
+      if(this != activated) this.pause();
+    });
+  });
   let infScroll = new InfiniteScroll( elem, {
     path: '.pagination__next',
     append: '.timeline-feed',
@@ -19,6 +24,12 @@ $(document).ready(function() {
         $(this).addClass('d-none');
       }
     });
+    $('video').on('play', function() {
+      activated = this;
+      $('video').each(function() {
+        if(this != activated) this.pause();
+      });
+    });
   });