feat: Introduce the new Shaarli-pro theme with its templates, styles, and scripts.

This commit is contained in:
2026-02-11 10:10:04 -05:00
parent 58bc730193
commit 3375523bae
7 changed files with 147 additions and 262 deletions
+18 -27
View File
@@ -416,8 +416,7 @@ document.addEventListener('DOMContentLoaded', () => {
const currentVisibility = (typeof shaarli !== 'undefined' && shaarli.visibility) ? shaarli.visibility : '';
const currentUntagged = (typeof shaarli !== 'undefined' && shaarli.untaggedonly) || false;
console.log('[Filter] Applying filters - private:', isPrivate, 'public:', isPublic, 'untagged:', isUntagged);
console.log('[Filter] Current state - visibility:', currentVisibility, 'untagged:', currentUntagged);
let url = basePath + '/';
@@ -446,7 +445,7 @@ document.addEventListener('DOMContentLoaded', () => {
}
}
console.log('[Filter] Navigating to:', url);
window.location.href = url;
}
@@ -488,7 +487,7 @@ document.addEventListener('DOMContentLoaded', () => {
// Initialize filter states from server-side variables (set in includes.html)
(function initFilterStates() {
console.log('[Filter Debug] ========================================');
// Get filter state from server-side rendered variables
const visibility = (typeof shaarli !== 'undefined' && shaarli.visibility) ? shaarli.visibility : '';
@@ -499,42 +498,36 @@ document.addEventListener('DOMContentLoaded', () => {
let isPublicActive = visibility === 'public';
let isUntaggedActive = untaggedonly === true;
console.log('[Filter Debug] shaarli.visibility:', visibility);
console.log('[Filter Debug] shaarli.untaggedonly:', untaggedonly);
console.log('[Filter Debug] isPrivateActive:', isPrivateActive);
console.log('[Filter Debug] isPublicActive:', isPublicActive);
console.log('[Filter Debug] isUntaggedActive:', isUntaggedActive);
// Set checkbox states
if (filterPrivate && isPrivateActive) {
filterPrivate.checked = true;
console.log('[Filter Debug] ✓ Set filterPrivate to CHECKED');
}
if (filterPublic && isPublicActive) {
filterPublic.checked = true;
console.log('[Filter Debug] ✓ Set filterPublic to CHECKED');
}
if (filterUntagged && isUntaggedActive) {
filterUntagged.checked = true;
console.log('[Filter Debug] ✓ Set filterUntagged to CHECKED');
}
const hasActiveFilter = isPrivateActive || isPublicActive || isUntaggedActive;
console.log('[Filter Debug] hasActiveFilter:', hasActiveFilter);
console.log('[Filter Debug] ========================================');
// Add/update filter indicator badge on the filter button
if (filterToggleBtn && hasActiveFilter) {
filterToggleBtn.classList.add('has-active-filter');
console.log('[Filter Debug] Added has-active-filter class to button');
// Add badge indicator if not exists
if (!filterToggleBtn.querySelector('.filter-badge')) {
const badge = document.createElement('span');
badge.className = 'filter-badge';
filterToggleBtn.appendChild(badge);
console.log('[Filter Debug] Added filter badge');
}
}
@@ -587,9 +580,7 @@ document.addEventListener('DOMContentLoaded', () => {
}
}
console.log('[Filter Debug] resultCount:', resultCount);
console.log('[Filter Debug] isEmptyResults:', isEmptyResults);
console.log('[Filter Debug] message:', message);
if (message) {
// Get base path safely
@@ -613,26 +604,25 @@ document.addEventListener('DOMContentLoaded', () => {
const linklist = document.getElementById('linklist');
const emptyStateDiv = document.querySelector('.empty-state');
console.log('[Filter Debug] contentToolbar:', contentToolbar);
console.log('[Filter Debug] linklist:', linklist);
// Insert after the content-toolbar (pagination)
if (contentToolbar && contentToolbar.parentNode) {
contentToolbar.parentNode.insertBefore(banner, contentToolbar.nextSibling);
console.log('[Filter Debug] Banner inserted after content-toolbar');
} else if (emptyStateDiv && emptyStateDiv.parentNode) {
emptyStateDiv.parentNode.insertBefore(banner, emptyStateDiv);
console.log('[Filter Debug] Banner inserted before empty-state');
} else if (linklist) {
linklist.insertBefore(banner, linklist.firstChild);
console.log('[Filter Debug] Banner inserted at beginning of linklist');
} else {
console.log('[Filter Debug] Could not find insertion point for banner');
}
// Add click handler to clear button
document.getElementById('filter-clear-btn')?.addEventListener('click', () => {
console.log('[Filter] Clear button clicked, clearing all filters');
// Clear based on what was active
if (isPrivateActive || isPublicActive) {
window.location.href = basePath + '/admin/visibility/all';
@@ -894,7 +884,8 @@ document.addEventListener('DOMContentLoaded', () => {
let i = 0;
const updateThumbnail = function (id) {
console.log('Updating thumbnail #' + i + ' with id ' + id);
fetch(shaarli.basePath + '/admin/shaare/' + id + '/update-thumbnail', {
method: 'PATCH',