From 6e49802bf9bc96768072987fe14ed3078670db96 Mon Sep 17 00:00:00 2001
From: lalka2018 <99399973+lalka2016@users.noreply.github.com>
Date: Sat, 14 Oct 2023 22:23:38 +0300
Subject: [PATCH] Make repeat button work

---
 Web/static/js/al_music.js | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/Web/static/js/al_music.js b/Web/static/js/al_music.js
index 9005e314..15865fbb 100644
--- a/Web/static/js/al_music.js
+++ b/Web/static/js/al_music.js
@@ -98,6 +98,12 @@ class bigPlayer {
             }
 
             e.currentTarget.classList.toggle("pressed")
+
+            if(e.currentTarget.classList.contains("pressed")) {
+                this.player().loop = true
+            } else {
+                this.player().loop = false
+            }
         })
 
         u(".bigPlayer .arrowsButtons .nextButton").on("click", (e) => {
@@ -111,14 +117,7 @@ class bigPlayer {
         u(this.player()).on("ended", (e) => {
             e.preventDefault()
 
-            // код не работает, как я понял, оно не хочет нажимать потому что это не действие пользователя
-            if(this.playerNode.querySelector(".repeatButton").classList.contains("pressed")) {
-                this.player().currentTime = 0
-
-                this.player().play()
-            } else {
-                this.showNextTrack()
-            }
+            this.showNextTrack()
         })
 
         this.player().volume = 0.75