feat: add theme toggle, mobile sidebar, and spotlight-style live search functionality for tags and bookmarks.

This commit is contained in:
Bruno Charest 2026-02-11 22:27:31 -05:00
parent 59b78ab0b7
commit f3072c3eb6

View File

@ -1186,7 +1186,7 @@ document.addEventListener('DOMContentLoaded', () => {
const theme = isDark ? 'dark' : 'light';
var lines = [];
lines.push('<!DOCTYPE html>');
lines.push('<html>');
lines.push('<html data-theme="' + theme + '">');
lines.push('<head>');
lines.push('<meta charset="utf-8">');
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(' --shadow: 0 1px 3px rgba(0,0,0,0.1);');
lines.push('}');
lines.push('[data-theme="' + theme + '"] {');
lines.push('[data-theme="dark"] {');
lines.push(' --primary: #3b82f6;');
lines.push(' --primary-hover: #60a5fa;');
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)
setTimeout(function() { URL.revokeObjectURL(blobUrl); }, 5000);
setTimeout(function () { URL.revokeObjectURL(blobUrl); }, 5000);
if (!playerPopup) {
// Popup was blocked - fallback to inline player
@ -1767,7 +1767,7 @@ document.addEventListener('DOMContentLoaded', () => {
playerAudio.src = url;
playerAudio.volume = parseFloat(playerVolume ? playerVolume.value : 0.8);
playerAudio.play().catch(function() { });
playerAudio.play().catch(function () { });
updateInlineBar(title, true);
}
@ -1825,7 +1825,7 @@ document.addEventListener('DOMContentLoaded', () => {
// --- Inline bar controls relay to popup via BroadcastChannel ---
if (playerPlayBtn) {
playerPlayBtn.addEventListener('click', function() {
playerPlayBtn.addEventListener('click', function () {
if (playerChannel) {
playerChannel.postMessage({ type: 'player-toggle' });
}
@ -1844,7 +1844,7 @@ document.addEventListener('DOMContentLoaded', () => {
}
if (playerProgress) {
playerProgress.addEventListener('input', function() {
playerProgress.addEventListener('input', function () {
if (playerChannel) {
playerChannel.postMessage({ type: 'player-seek', value: playerProgress.value });
}
@ -1852,7 +1852,7 @@ document.addEventListener('DOMContentLoaded', () => {
}
if (playerVolume) {
playerVolume.addEventListener('input', function() {
playerVolume.addEventListener('input', function () {
if (playerChannel) {
playerChannel.postMessage({ type: 'player-volume', value: playerVolume.value });
}
@ -1861,7 +1861,7 @@ document.addEventListener('DOMContentLoaded', () => {
}
if (playerVolBtn) {
playerVolBtn.addEventListener('click', function() {
playerVolBtn.addEventListener('click', function () {
if (playerChannel) {
playerChannel.postMessage({ type: 'player-mute-toggle' });
}
@ -1870,7 +1870,7 @@ document.addEventListener('DOMContentLoaded', () => {
// --- Listen for state updates from popup via BroadcastChannel ---
if (playerChannel) {
playerChannel.addEventListener('message', function(e) {
playerChannel.addEventListener('message', function (e) {
var msg = e.data;
if (!msg || !msg.type) return;
@ -1905,7 +1905,7 @@ document.addEventListener('DOMContentLoaded', () => {
}
// --- Also listen for localStorage changes (fallback) ---
window.addEventListener('storage', function(e) {
window.addEventListener('storage', function (e) {
if (e.key === 'mediaPopupState' && e.newValue) {
try {
var state = JSON.parse(e.newValue);
@ -1918,7 +1918,7 @@ document.addEventListener('DOMContentLoaded', () => {
});
// --- 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 titleEl = card.querySelector('.link-title');
if (!urlEl) return;
@ -1942,7 +1942,7 @@ document.addEventListener('DOMContentLoaded', () => {
actionsDiv.appendChild(playBtn);
}
playBtn.addEventListener('click', function(e) {
playBtn.addEventListener('click', function (e) {
e.preventDefault();
e.stopPropagation();
var mediaUrl = isMediaUrl(url) ? url : realUrl;