fix
This commit is contained in:
parent
0b1467a53b
commit
a1d62756b1
5 changed files with 56 additions and 14 deletions
BIN
assets/appicon.png
Normal file
BIN
assets/appicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
|
|
@ -357,7 +357,7 @@
|
||||||
|
|
||||||
<footer class="now-playing-bar">
|
<footer class="now-playing-bar">
|
||||||
<div class="track-info">
|
<div class="track-info">
|
||||||
<img src="https://resources.tidal.com/images/03b50002/d6f9/40e7/8b2e/0e9093cba2ac/80x80.jpg" alt="Current Track Cover" class="cover">
|
<img src="./assets/appicon.png" alt="Current Track Cover" class="cover">
|
||||||
<div class="details">
|
<div class="details">
|
||||||
<div class="title">Select a song</div>
|
<div class="title">Select a song</div>
|
||||||
<div class="artist"></div>
|
<div class="artist"></div>
|
||||||
|
|
|
||||||
55
js/app.js
55
js/app.js
|
|
@ -396,6 +396,49 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
|
|
||||||
window.loadHomeFeed = loadHomeFeed;
|
window.loadHomeFeed = loadHomeFeed;
|
||||||
|
|
||||||
|
function positionContextMenu(menu, x, y, preferLeft = false) {
|
||||||
|
menu.style.display = 'block';
|
||||||
|
menu.style.visibility = 'hidden';
|
||||||
|
|
||||||
|
const menuRect = menu.getBoundingClientRect();
|
||||||
|
const viewportWidth = window.innerWidth;
|
||||||
|
const viewportHeight = window.innerHeight;
|
||||||
|
|
||||||
|
let finalX = x;
|
||||||
|
let finalY = y;
|
||||||
|
|
||||||
|
if (preferLeft || (x + menuRect.width > viewportWidth)) {
|
||||||
|
finalX = x - menuRect.width;
|
||||||
|
if (finalX < 0) {
|
||||||
|
finalX = Math.min(x, viewportWidth - menuRect.width - 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (finalX < 10) {
|
||||||
|
finalX = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (finalX + menuRect.width > viewportWidth - 10) {
|
||||||
|
finalX = viewportWidth - menuRect.width - 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y + menuRect.height > viewportHeight) {
|
||||||
|
finalY = Math.max(10, y - menuRect.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (finalY + menuRect.height > viewportHeight - 10) {
|
||||||
|
finalY = viewportHeight - menuRect.height - 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (finalY < 10) {
|
||||||
|
finalY = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
menu.style.left = `${finalX}px`;
|
||||||
|
menu.style.top = `${finalY}px`;
|
||||||
|
menu.style.visibility = 'visible';
|
||||||
|
}
|
||||||
|
|
||||||
function updateLastFMUI() {
|
function updateLastFMUI() {
|
||||||
if (scrobbler.isAuthenticated()) {
|
if (scrobbler.isAuthenticated()) {
|
||||||
lastfmStatus.textContent = `Connected as ${scrobbler.username}`;
|
lastfmStatus.textContent = `Connected as ${scrobbler.username}`;
|
||||||
|
|
@ -808,11 +851,11 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
|
|
||||||
function showQueueTrackMenu(e, trackIndex) {
|
function showQueueTrackMenu(e, trackIndex) {
|
||||||
const menu = document.getElementById('queue-track-menu');
|
const menu = document.getElementById('queue-track-menu');
|
||||||
menu.style.top = `${e.pageY}px`;
|
|
||||||
menu.style.left = `${e.pageX}px`;
|
|
||||||
menu.classList.add('show');
|
menu.classList.add('show');
|
||||||
menu.dataset.trackIndex = trackIndex;
|
menu.dataset.trackIndex = trackIndex;
|
||||||
|
|
||||||
|
positionContextMenu(menu, e.pageX, e.pageY, true);
|
||||||
|
|
||||||
document.addEventListener('click', hideQueueTrackMenu);
|
document.addEventListener('click', hideQueueTrackMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -845,9 +888,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
contextTrack = trackDataStore.get(trackItem);
|
contextTrack = trackDataStore.get(trackItem);
|
||||||
if (contextTrack) {
|
if (contextTrack) {
|
||||||
const rect = menuBtn.getBoundingClientRect();
|
const rect = menuBtn.getBoundingClientRect();
|
||||||
contextMenu.style.top = `${rect.bottom + 5}px`;
|
positionContextMenu(contextMenu, rect.left, rect.bottom + 5, true);
|
||||||
contextMenu.style.left = `${rect.left}px`;
|
|
||||||
contextMenu.style.display = 'block';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
@ -877,9 +918,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
contextTrack = trackDataStore.get(trackItem);
|
contextTrack = trackDataStore.get(trackItem);
|
||||||
|
|
||||||
if (contextTrack) {
|
if (contextTrack) {
|
||||||
contextMenu.style.top = `${e.pageY}px`;
|
positionContextMenu(contextMenu, e.pageX, e.pageY, true);
|
||||||
contextMenu.style.left = `${e.pageX}px`;
|
|
||||||
contextMenu.style.display = 'block';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -9,19 +9,19 @@
|
||||||
"orientation": "portrait-primary",
|
"orientation": "portrait-primary",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/assets/192.png",
|
"src": "/assets/appicon.png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any"
|
"purpose": "any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/assets/512.png",
|
"src": "/assets/appicon.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any"
|
"purpose": "any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/assets/512.png",
|
"src": "/assets/appicon.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "maskable"
|
"purpose": "maskable"
|
||||||
|
|
|
||||||
|
|
@ -589,7 +589,10 @@ a {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
.track-item:hover .track-menu-btn,
|
.track-item:hover .track-menu-btn {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
@media (hover: none) {
|
@media (hover: none) {
|
||||||
.track-menu-btn {
|
.track-menu-btn {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue