Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix: correct CSS class prefix bugs in news.js and pdf.js, improve hook (#3080)

LearningCircuit2dd7edc05166
diff --git a/.pre-commit-hooks/check-css-class-prefix.py b/.pre-commit-hooks/check-css-class-prefix.py
index 4ba86cf3d2..b180231acf 100755
--- a/.pre-commit-hooks/check-css-class-prefix.py
+++ b/.pre-commit-hooks/check-css-class-prefix.py
@@ -342,6 +342,10 @@ def check_js_file(file_path: Path) -> List[Tuple[int, str, str]]:
),
]
+ # Pattern for template literal className assignments:
+ # className = `some-class ${dynamic}` or className: `some-class`
+ template_literal_pattern = re.compile(r"className\s*[:=]\s*`([^`]+)`")
+
# Special patterns for querySelector and jQuery that need different handling
querySelector_pattern = re.compile(
r'querySelector(?:All)?\s*\(\s*["\']([^"\']+)["\']'
@@ -386,6 +390,24 @@ def check_js_file(file_path: Path) -> List[Tuple[int, str, str]]:
)
)
+ # Handle template literal className assignments
+ for tl_match in template_literal_pattern.findall(line):
+ # Extract static class tokens by removing ${...} expressions
+ static_part = re.sub(r"\$\{[^}]*\}", " ", tl_match)
+ for cls in static_part.split():
+ # Skip partial tokens that are fragments of dynamic
+ # class names (e.g. "alert-" from "alert-${type}")
+ if cls.endswith("-") or cls.startswith("-"):
+ continue
+ if not is_allowed_class(cls):
+ errors.append(
+ (
+ line_num,
+ cls,
+ f"JavaScript class '{cls}' should be prefixed with 'ldr-'",
+ )
+ )
+
# Handle other patterns
for pattern in patterns:
matches = pattern.findall(line)
diff --git a/src/local_deep_research/web/static/js/pages/news.js b/src/local_deep_research/web/static/js/pages/news.js
index 08b28b1c0c..a11c0077df 100644
--- a/src/local_deep_research/web/static/js/pages/news.js
+++ b/src/local_deep_research/web/static/js/pages/news.js
@@ -2059,7 +2059,7 @@ async function createSubscription() {
// Utility functions
function showAlert(message, type = 'info') {
const alertContainer = document.getElementById('news-alert');
- alertContainer.className = `settings-alert-container alert-${type}`;
+ alertContainer.className = `ldr-settings-alert-container alert-${type}`;
alertContainer.textContent = message;
alertContainer.style.display = 'block';