Skip to content

Commit 0ec6ab8

Browse files
committed
Fix popup
1 parent d4fa5d6 commit 0ec6ab8

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

Chrome/popup.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,14 @@ document.addEventListener("DOMContentLoaded", async () => {
6161
return targets.some((pattern) => urlMatchesPattern(url, pattern));
6262
});
6363

64+
// Hide empty state by default
65+
emptyState.style.display = "none";
6466

6567
if (matchingScripts.length === 0) {
66-
emptyState.style.display = "flex";
67-
emptyState.innerHTML = scripts.length
68-
? `
69-
<div class="empty-icon">
70-
<svg width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
71-
<circle cx="11" cy="11" r="8"/>
72-
<line x1="21" y1="21" x2="16.65" y2="16.65"/>
73-
</svg>
74-
</div>
75-
<p>No scripts match this page.<br>Create a new script or visit a different page.</p>
76-
`
77-
: `
68+
// Only show empty state if there are no scripts at all
69+
if (scripts.length === 0) {
70+
emptyState.style.display = "flex";
71+
emptyState.innerHTML = `
7872
<div class="empty-icon">
7973
<svg width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
8074
<path d="M14 2H6a2 2 0 0 0-2 2v16c0 1.1.9 2 2 2h12a2 2 0 0 0 2-2V8l-6-6z"/>
@@ -83,6 +77,13 @@ document.addEventListener("DOMContentLoaded", async () => {
8377
</div>
8478
<p><br>Create your first script to get started.</p>
8579
`;
80+
} else {
81+
// Show minimal message when scripts exist but don't match current page
82+
emptyState.style.display = "flex";
83+
emptyState.innerHTML = `
84+
<p>No scripts for this page.<br>Create a new script or visit a different page.</p>
85+
`;
86+
}
8687
return;
8788
}
8889

0 commit comments

Comments
 (0)