feat: add theme toggle, mobile sidebar, and spotlight-style live search functionality for tags and bookmarks.
This commit is contained in:
parent
59b78ab0b7
commit
f3072c3eb6
@ -1186,7 +1186,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
const theme = isDark ? 'dark' : 'light';
|
const theme = isDark ? 'dark' : 'light';
|
||||||
var lines = [];
|
var lines = [];
|
||||||
lines.push('<!DOCTYPE html>');
|
lines.push('<!DOCTYPE html>');
|
||||||
lines.push('<html>');
|
lines.push('<html data-theme="' + theme + '">');
|
||||||
lines.push('<head>');
|
lines.push('<head>');
|
||||||
lines.push('<meta charset="utf-8">');
|
lines.push('<meta charset="utf-8">');
|
||||||
lines.push('<meta name="viewport" content="width=device-width, initial-scale=1.0">');
|
lines.push('<meta name="viewport" content="width=device-width, initial-scale=1.0">');
|
||||||
@ -1206,7 +1206,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
lines.push(' --danger: #ef4444;');
|
lines.push(' --danger: #ef4444;');
|
||||||
lines.push(' --shadow: 0 1px 3px rgba(0,0,0,0.1);');
|
lines.push(' --shadow: 0 1px 3px rgba(0,0,0,0.1);');
|
||||||
lines.push('}');
|
lines.push('}');
|
||||||
lines.push('[data-theme="' + theme + '"] {');
|
lines.push('[data-theme="dark"] {');
|
||||||
lines.push(' --primary: #3b82f6;');
|
lines.push(' --primary: #3b82f6;');
|
||||||
lines.push(' --primary-hover: #60a5fa;');
|
lines.push(' --primary-hover: #60a5fa;');
|
||||||
lines.push(' --primary-light: rgba(59,130,246,0.12);');
|
lines.push(' --primary-light: rgba(59,130,246,0.12);');
|
||||||
@ -1744,7 +1744,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Revoke the blob URL after a short delay (popup already loaded)
|
// Revoke the blob URL after a short delay (popup already loaded)
|
||||||
setTimeout(function() { URL.revokeObjectURL(blobUrl); }, 5000);
|
setTimeout(function () { URL.revokeObjectURL(blobUrl); }, 5000);
|
||||||
|
|
||||||
if (!playerPopup) {
|
if (!playerPopup) {
|
||||||
// Popup was blocked - fallback to inline player
|
// Popup was blocked - fallback to inline player
|
||||||
@ -1767,7 +1767,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
|
|
||||||
playerAudio.src = url;
|
playerAudio.src = url;
|
||||||
playerAudio.volume = parseFloat(playerVolume ? playerVolume.value : 0.8);
|
playerAudio.volume = parseFloat(playerVolume ? playerVolume.value : 0.8);
|
||||||
playerAudio.play().catch(function() { });
|
playerAudio.play().catch(function () { });
|
||||||
updateInlineBar(title, true);
|
updateInlineBar(title, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1825,7 +1825,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
|
|
||||||
// --- Inline bar controls relay to popup via BroadcastChannel ---
|
// --- Inline bar controls relay to popup via BroadcastChannel ---
|
||||||
if (playerPlayBtn) {
|
if (playerPlayBtn) {
|
||||||
playerPlayBtn.addEventListener('click', function() {
|
playerPlayBtn.addEventListener('click', function () {
|
||||||
if (playerChannel) {
|
if (playerChannel) {
|
||||||
playerChannel.postMessage({ type: 'player-toggle' });
|
playerChannel.postMessage({ type: 'player-toggle' });
|
||||||
}
|
}
|
||||||
@ -1844,7 +1844,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (playerProgress) {
|
if (playerProgress) {
|
||||||
playerProgress.addEventListener('input', function() {
|
playerProgress.addEventListener('input', function () {
|
||||||
if (playerChannel) {
|
if (playerChannel) {
|
||||||
playerChannel.postMessage({ type: 'player-seek', value: playerProgress.value });
|
playerChannel.postMessage({ type: 'player-seek', value: playerProgress.value });
|
||||||
}
|
}
|
||||||
@ -1852,7 +1852,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (playerVolume) {
|
if (playerVolume) {
|
||||||
playerVolume.addEventListener('input', function() {
|
playerVolume.addEventListener('input', function () {
|
||||||
if (playerChannel) {
|
if (playerChannel) {
|
||||||
playerChannel.postMessage({ type: 'player-volume', value: playerVolume.value });
|
playerChannel.postMessage({ type: 'player-volume', value: playerVolume.value });
|
||||||
}
|
}
|
||||||
@ -1861,7 +1861,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (playerVolBtn) {
|
if (playerVolBtn) {
|
||||||
playerVolBtn.addEventListener('click', function() {
|
playerVolBtn.addEventListener('click', function () {
|
||||||
if (playerChannel) {
|
if (playerChannel) {
|
||||||
playerChannel.postMessage({ type: 'player-mute-toggle' });
|
playerChannel.postMessage({ type: 'player-mute-toggle' });
|
||||||
}
|
}
|
||||||
@ -1870,7 +1870,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
|
|
||||||
// --- Listen for state updates from popup via BroadcastChannel ---
|
// --- Listen for state updates from popup via BroadcastChannel ---
|
||||||
if (playerChannel) {
|
if (playerChannel) {
|
||||||
playerChannel.addEventListener('message', function(e) {
|
playerChannel.addEventListener('message', function (e) {
|
||||||
var msg = e.data;
|
var msg = e.data;
|
||||||
if (!msg || !msg.type) return;
|
if (!msg || !msg.type) return;
|
||||||
|
|
||||||
@ -1905,7 +1905,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --- Also listen for localStorage changes (fallback) ---
|
// --- Also listen for localStorage changes (fallback) ---
|
||||||
window.addEventListener('storage', function(e) {
|
window.addEventListener('storage', function (e) {
|
||||||
if (e.key === 'mediaPopupState' && e.newValue) {
|
if (e.key === 'mediaPopupState' && e.newValue) {
|
||||||
try {
|
try {
|
||||||
var state = JSON.parse(e.newValue);
|
var state = JSON.parse(e.newValue);
|
||||||
@ -1918,7 +1918,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// --- Inject play buttons into bookmark cards with media URLs ---
|
// --- Inject play buttons into bookmark cards with media URLs ---
|
||||||
document.querySelectorAll('.link-outer').forEach(function(card) {
|
document.querySelectorAll('.link-outer').forEach(function (card) {
|
||||||
var urlEl = card.querySelector('.link-url');
|
var urlEl = card.querySelector('.link-url');
|
||||||
var titleEl = card.querySelector('.link-title');
|
var titleEl = card.querySelector('.link-title');
|
||||||
if (!urlEl) return;
|
if (!urlEl) return;
|
||||||
@ -1942,7 +1942,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
actionsDiv.appendChild(playBtn);
|
actionsDiv.appendChild(playBtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
playBtn.addEventListener('click', function(e) {
|
playBtn.addEventListener('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
var mediaUrl = isMediaUrl(url) ? url : realUrl;
|
var mediaUrl = isMediaUrl(url) ? url : realUrl;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user