From 1ea13ff16b36e3a13273fa4121a20224a3ead9f1 Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Fri, 20 Feb 2026 09:19:01 -0500 Subject: [PATCH] =?UTF-8?q?feat:=20am=C3=A9liorer=20la=20recherche=20de=20?= =?UTF-8?q?tags=20avec=20extraction=20via=20data-attributes,=20ajouter=20r?= =?UTF-8?q?accourci=20clavier=20T=20pour=20mode=20tags=20direct,=20styles?= =?UTF-8?q?=20th=C3=A8me=20clair=20pour=20tag=20cloud=20avec=20gradients?= =?UTF-8?q?=20bleus=20optimis=C3=A9s,=20et=20correction=20syntaxe=20Smarty?= =?UTF-8?q?=20tag.list.html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shaarli-pro/js/script.js | 28 +++++++++++---- shaarli-pro/page.header.html | 1 + shaarli-pro/tag.cloud.html | 70 ++++++++++++++++++++++++++++++++++-- shaarli-pro/tag.list.html | 3 +- 4 files changed, 92 insertions(+), 10 deletions(-) diff --git a/shaarli-pro/js/script.js b/shaarli-pro/js/script.js index 81156e8..e6e6036 100644 --- a/shaarli-pro/js/script.js +++ b/shaarli-pro/js/script.js @@ -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 ===== diff --git a/shaarli-pro/page.header.html b/shaarli-pro/page.header.html index c812c5f..6881c74 100644 --- a/shaarli-pro/page.header.html +++ b/shaarli-pro/page.header.html @@ -286,6 +286,7 @@ Bookmarklet detection logic