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:
@@ -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 =====
|
||||
|
||||
Reference in New Issue
Block a user