feat: améliorer la recherche de tags avec extraction via data-attributes, ajouter raccourci clavier T pour mode tags direct, styles thème clair pour tag cloud avec gradients bleus optimisés, et correction syntaxe Smarty tag.list.html

This commit is contained in:
2026-02-20 09:19:01 -05:00
parent 5ba43fa9d2
commit 1ea13ff16b
4 changed files with 92 additions and 10 deletions
+22 -6
View File
@@ -129,14 +129,23 @@ document.addEventListener('DOMContentLoaded', () => {
function fetchTags() {
if (cachedTags) return cachedTags;
try {
const tagElements = document.querySelectorAll('.link-tag, .tag-link, [class*="tag"]');
const tagsSet = new Set();
tagElements.forEach(el => {
const tagText = el.textContent.trim();
if (tagText && tagText.length > 0 && !tagText.includes('•')) {
tagsSet.add(tagText);
}
const addTag = (value) => {
if (typeof value !== 'string') return;
const cleaned = value.trim();
if (!cleaned || cleaned.includes('•')) return;
tagsSet.add(cleaned);
};
// Prefer explicit tag data attributes to avoid polluted text values (e.g. remove buttons)
document.querySelectorAll('.link-tag[data-tag], .tag-item[data-tag], [data-tag-name]').forEach((el) => {
addTag(el.getAttribute('data-tag') || el.getAttribute('data-tag-name'));
});
// Fallback selectors with reliable text content
document.querySelectorAll('.link-tag-link, .tag-link, .cloud-tag').forEach((el) => {
addTag(el.textContent);
});
// Convert to array and sort alphabetically
@@ -428,6 +437,13 @@ document.addEventListener('DOMContentLoaded', () => {
e.preventDefault();
openSearch();
}
// T to open search directly in tags mode (when not typing)
if (!isTyping && !e.ctrlKey && !e.metaKey && !e.altKey && (e.key === 't' || e.key === 'T')) {
e.preventDefault();
openSearch();
setSearchMode('tags');
}
});
// ===== Filter Panel =====