فهرست منبع

Fix css and racing bug

Toby Chui 1 هفته پیش
والد
کامیت
1db102497a
2فایلهای تغییر یافته به همراه32 افزوده شده و 9 حذف شده
  1. 5 8
      src/web/Musicify/index.html
  2. 27 1
      src/web/Musicify/musicify.js

+ 5 - 8
src/web/Musicify/index.html

@@ -3,7 +3,7 @@
 <head>
     <meta charset="utf-8">
     <link rel="icon" type="image/png" href="img/module_icon.png" />
-    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, height=device-height, minimum-scale=1.0, user-scalable=0">
     <meta name="theme-color" content="#a855f7">
     <meta name="mobile-web-app-capable" content="yes">
     <meta name="apple-mobile-web-app-capable" content="yes">
@@ -164,9 +164,6 @@
             }
             .sidebar.open { transform: translateX(0); }
             .sidebar-overlay { display: block; }
-            .queue-panel{
-                bottom: calc(var(--player-h-mobile)) !important;
-            }
         }
 
         /* ── Main Content ────────────────────────────────────────────────── */
@@ -1456,7 +1453,7 @@
                     <div class="settings-section">
                         <div class="settings-section-title">Transcode</div>
                         <div class="settings-section-desc">
-                            Automatically transcode audio formats not supported by your browser (FLAC, OGG, WMA, Opus, WebM) to MP3 using the server's FFmpeg. Recommended for iPhone and Safari users.
+                            Automatically transcode audio formats not supported by your browser (FLAC, OGG, WMA, Opus, WebM) to MP3 using the server's FFmpeg. Recommended for mobile users.
                         </div>
 
                         <label class="transcode-option" :class="{selected: transcodeMode==='disabled'}">
@@ -1503,7 +1500,7 @@
                     <div class="settings-section">
                         <div class="settings-section-title">Full Buffer Mode</div>
                         <div class="settings-section-desc">
-                            Buffer the entire track on the server before playback begins. This prevents iOS from resetting the audio stream mid-track, at the cost of a short wait before the song starts. Enabled automatically on iPhone &amp; iPad.
+                            Buffer the entire track on the server before playback begins. This prevents iOS from resetting the audio stream mid-track, at the cost of a short wait before the song starts. Enabled automatically on iPhone and iPad.
                         </div>
                         <div class="settings-toggle-row">
                             <div>
@@ -1529,7 +1526,7 @@
         </main><!-- /.main-content -->
 
         <!-- ═══ QUEUE PANEL ════════════════════════════════════════════════ -->
-        <aside class="queue-panel" x-show="showQueue">
+        <aside id="queue-panel" class="queue-panel" x-show="showQueue">
             <div class="queue-header">
                 <span>Queue <span style="color:var(--text3);font-size:12px;" x-text="'(' + queue.length + ')'"></span></span>
                 <button class="ctrl-btn" style="width:26px;height:26px;font-size:13px;" x-on:click="showQueue=false">
@@ -1650,7 +1647,7 @@
                 x-on:input="setVolume($event.target.value)">
 
             <!-- Queue toggle -->
-            <button class="ctrl-btn" :class="{active: showQueue}" x-on:click="showQueue = !showQueue" title="Queue">
+            <button class="ctrl-btn" :class="{active: showQueue}" x-on:click="toggleQueue()" title="Queue">
                 <i class="ui list icon" style="margin:0;"></i>
             </button>
 

+ 27 - 1
src/web/Musicify/musicify.js

@@ -884,7 +884,8 @@ function musicifyApp() {
             if (this.shuffle) this._buildShuffledQueue(startIndex);
             this._loadTrack(this._effectiveQueue()[this._effectiveIndex(startIndex)]);
             // Starting playback brings up the full-screen Now Playing view
-            this.openNowPlaying();
+            // only in mobile / small-screen mode, not on desktop.
+            if (window.innerWidth <= 768) this.openNowPlaying();
         },
 
         playSong(song, sourceList, event) {
@@ -1082,6 +1083,21 @@ function musicifyApp() {
             this._audio.muted = this.isMuted;
         },
 
+        toggleQueue(){
+            this.showQueue = !this.showQueue;
+            this.updateQueuePanelPosition();
+        },
+
+        updateQueuePanelPosition(){
+            var bottomPos = window.innerHeight - document.getElementsByClassName("player-bar")[0].getBoundingClientRect().top;
+            var queueEl = document.getElementById("queue-panel");
+            if (this.showQueue) {
+                queueEl.style.bottom = bottomPos + "px";
+            } else {
+                queueEl.style.bottom = -queueEl.offsetHeight + "px";
+            }
+        },
+
         toggleShuffle() {
             this.shuffle = !this.shuffle;
             ao_module_storage.setStorage("Musicify", "shuffle", String(this.shuffle));
@@ -1146,6 +1162,11 @@ function musicifyApp() {
                 body: JSON.stringify({ file: song.filepath, samplerate: self.transcodeMode })
             }).then(r => r.json()).then(data => {
                 self._fullBufferLoading = false;
+                this.$nextTick(() => {
+                     this.$nextTick(() => {
+                        _fullBufferLoading = false; // prevent racing for cached media file
+                    });
+                }); 
                 // Abort if the user already switched to a different track
                 if (!self.currentTrack || self.currentTrack.filepath !== _bufSong.filepath) return;
                 if (data.error || !data.path) {
@@ -1500,7 +1521,9 @@ function musicifyApp() {
                 var c = overlay ? overlay.querySelector('.np-content') : null;
                 if (c) c.scrollTop = 0;
                 if (overlay) overlay.style.top = (mc.scrollTop) + 'px'; // readjust after content is revealed
+                this.updateQueuePanelPosition();
             });
+            
         },
 
         toggleNowPlaying() {
@@ -1517,6 +1540,9 @@ function musicifyApp() {
             this._npSwipeDir = '';
             var mc = document.getElementById('mainContent');
             if (mc) mc.style.overflow = '';
+            this.$nextTick(() => {
+                this.updateQueuePanelPosition();
+            });
         },
 
         npTouchStart(e) {