Compare commits
1 Commits
84b985e6df
...
65b513ca17
| Author | SHA1 | Date | |
|---|---|---|---|
| 65b513ca17 |
@@ -108,16 +108,15 @@
|
|||||||
.container {
|
.container {
|
||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 2rem;
|
padding: 2rem 2rem 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
header {
|
header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 0.75rem;
|
||||||
padding-bottom: 1rem;
|
padding-bottom: 0.5rem;
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
@@ -148,27 +147,27 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.theme-toggle {
|
.theme-toggle {
|
||||||
background: var(--bg-tertiary);
|
background: transparent;
|
||||||
border: 1px solid var(--border);
|
border: none;
|
||||||
border-radius: 8px;
|
padding: 0.3rem;
|
||||||
padding: 0.5rem;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
transition: all 0.3s;
|
transition: opacity 0.3s;
|
||||||
width: 40px;
|
width: 32px;
|
||||||
height: 40px;
|
height: 32px;
|
||||||
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.theme-toggle:hover {
|
.theme-toggle:hover {
|
||||||
background: var(--border);
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.theme-toggle svg {
|
.theme-toggle svg {
|
||||||
width: 20px;
|
width: 16px;
|
||||||
height: 20px;
|
height: 16px;
|
||||||
fill: var(--text-primary);
|
fill: currentColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
#locale-select {
|
#locale-select {
|
||||||
@@ -176,9 +175,9 @@
|
|||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
padding: 6px 12px;
|
padding: 4px 8px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 14px;
|
font-size: 12px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
}
|
}
|
||||||
@@ -343,11 +342,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.album-art-container.vinyl.spinning #album-art {
|
.album-art-container.vinyl.spinning #album-art {
|
||||||
animation: vinylSpin 4s linear infinite;
|
animation: vinylSpin 12s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
.album-art-container.vinyl.paused #album-art {
|
.album-art-container.vinyl.paused #album-art {
|
||||||
animation: vinylSpin 4s linear infinite;
|
animation: vinylSpin 12s linear infinite;
|
||||||
animation-play-state: paused;
|
animation-play-state: paused;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,6 +470,7 @@
|
|||||||
|
|
||||||
button:hover:not(:disabled) {
|
button:hover:not(:disabled) {
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
|
color: #fff;
|
||||||
transform: scale(1.05);
|
transform: scale(1.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -487,6 +487,7 @@
|
|||||||
|
|
||||||
button.primary:hover:not(:disabled) {
|
button.primary:hover:not(:disabled) {
|
||||||
background: var(--accent-hover);
|
background: var(--accent-hover);
|
||||||
|
color: #fff;
|
||||||
transform: scale(1.1);
|
transform: scale(1.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -640,6 +641,7 @@
|
|||||||
.script-btn:hover:not(:disabled) {
|
.script-btn:hover:not(:disabled) {
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
border-color: var(--accent);
|
border-color: var(--accent);
|
||||||
|
color: #fff;
|
||||||
transform: translateY(-2px);
|
transform: translateY(-2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -657,6 +659,11 @@
|
|||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
transition: color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.script-btn:hover:not(:disabled) .script-description {
|
||||||
|
color: rgba(255, 255, 255, 0.85);
|
||||||
}
|
}
|
||||||
|
|
||||||
.script-btn.executing {
|
.script-btn.executing {
|
||||||
@@ -679,28 +686,38 @@
|
|||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.script-management-header {
|
.add-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 1.5rem;
|
justify-content: center;
|
||||||
}
|
border: 2px dashed var(--border);
|
||||||
|
border-radius: 8px;
|
||||||
.add-script-btn {
|
padding: 1.5rem;
|
||||||
padding: 0.5rem 1.5rem;
|
margin-top: 1rem;
|
||||||
border-radius: 6px;
|
|
||||||
background: var(--accent);
|
|
||||||
border: none;
|
|
||||||
color: var(--text-primary);
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 0.875rem;
|
transition: border-color 0.2s, background 0.2s;
|
||||||
font-weight: 600;
|
|
||||||
transition: background 0.2s;
|
|
||||||
min-width: 140px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.add-script-btn:hover {
|
.add-card:hover {
|
||||||
background: var(--accent-hover);
|
border-color: var(--text-muted);
|
||||||
|
background: var(--bg-tertiary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-card-icon {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-weight: 300;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-card-grid {
|
||||||
|
border: 2px dashed var(--border);
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-card-grid:hover:not(:disabled) {
|
||||||
|
border-color: var(--text-muted);
|
||||||
|
background: var(--bg-tertiary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.scripts-table {
|
.scripts-table {
|
||||||
@@ -762,12 +779,14 @@
|
|||||||
.action-btn:hover {
|
.action-btn:hover {
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
border-color: var(--accent);
|
border-color: var(--accent);
|
||||||
|
color: #fff;
|
||||||
transform: translateY(-1px);
|
transform: translateY(-1px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-btn.delete:hover {
|
.action-btn.delete:hover {
|
||||||
background: var(--error);
|
background: var(--error);
|
||||||
border-color: var(--error);
|
border-color: var(--error);
|
||||||
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-buttons {
|
.action-buttons {
|
||||||
@@ -779,6 +798,7 @@
|
|||||||
.action-btn.execute:hover {
|
.action-btn.execute:hover {
|
||||||
background: #3b82f6;
|
background: #3b82f6;
|
||||||
border-color: #3b82f6;
|
border-color: #3b82f6;
|
||||||
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Execution Result Dialog */
|
/* Execution Result Dialog */
|
||||||
@@ -862,6 +882,7 @@
|
|||||||
/* Dialog Styles */
|
/* Dialog Styles */
|
||||||
dialog {
|
dialog {
|
||||||
background: var(--bg-secondary);
|
background: var(--bg-secondary);
|
||||||
|
color: var(--text-primary);
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
@@ -882,7 +903,7 @@
|
|||||||
|
|
||||||
.dialog-header {
|
.dialog-header {
|
||||||
padding: 1.5rem;
|
padding: 1.5rem;
|
||||||
background: var(--bg-tertiary);
|
background: var(--bg-secondary);
|
||||||
border-bottom: 1px solid var(--border);
|
border-bottom: 1px solid var(--border);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1135,9 +1156,9 @@
|
|||||||
.clear-token-btn {
|
.clear-token-btn {
|
||||||
width: auto;
|
width: auto;
|
||||||
height: auto;
|
height: auto;
|
||||||
padding: 6px 12px;
|
padding: 4px 10px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
font-size: 14px;
|
font-size: 12px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
background: var(--bg-tertiary);
|
background: var(--bg-tertiary);
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
@@ -1317,6 +1338,7 @@
|
|||||||
.mini-control-btn:hover {
|
.mini-control-btn:hover {
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
border-color: var(--accent);
|
border-color: var(--accent);
|
||||||
|
color: #fff;
|
||||||
transform: scale(1.05);
|
transform: scale(1.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1415,11 +1437,10 @@
|
|||||||
/* Footer */
|
/* Footer */
|
||||||
footer {
|
footer {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 2rem 1rem;
|
padding: 0.75rem 1rem;
|
||||||
margin-top: 3rem;
|
margin-top: 0.5rem;
|
||||||
border-top: 1px solid var(--border);
|
color: var(--text-muted);
|
||||||
color: var(--text-secondary);
|
font-size: 0.75rem;
|
||||||
font-size: 0.875rem;
|
|
||||||
transition: padding-bottom 0.3s ease-in-out;
|
transition: padding-bottom 0.3s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2092,6 +2113,7 @@
|
|||||||
.pagination button:hover:not(:disabled) {
|
.pagination button:hover:not(:disabled) {
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
border-color: var(--accent);
|
border-color: var(--accent);
|
||||||
|
color: #fff;
|
||||||
transform: none;
|
transform: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
<span class="status-dot" id="status-dot"></span>
|
<span class="status-dot" id="status-dot"></span>
|
||||||
<span class="version-label" id="version-label"></span>
|
<span class="version-label" id="version-label"></span>
|
||||||
</div>
|
</div>
|
||||||
<div style="display: flex; align-items: center; gap: 1rem;">
|
<div style="display: flex; align-items: center; gap: 0.5rem;">
|
||||||
<button class="theme-toggle" onclick="toggleTheme()" data-i18n-title="player.theme" title="Toggle theme" id="theme-toggle">
|
<button class="theme-toggle" onclick="toggleTheme()" data-i18n-title="player.theme" title="Toggle theme" id="theme-toggle">
|
||||||
<svg id="theme-icon-sun" viewBox="0 0 24 24" style="display: none;">
|
<svg id="theme-icon-sun" viewBox="0 0 24 24" style="display: none;">
|
||||||
<path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"/>
|
<path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"/>
|
||||||
@@ -177,8 +177,6 @@
|
|||||||
|
|
||||||
<!-- Media Browser Section -->
|
<!-- Media Browser Section -->
|
||||||
<div class="browser-container" data-tab-content="browser" >
|
<div class="browser-container" data-tab-content="browser" >
|
||||||
<h2 data-i18n="browser.title">Media Browser</h2>
|
|
||||||
|
|
||||||
<!-- Breadcrumb Navigation -->
|
<!-- Breadcrumb Navigation -->
|
||||||
<div class="breadcrumb" id="breadcrumb"></div>
|
<div class="breadcrumb" id="breadcrumb"></div>
|
||||||
|
|
||||||
@@ -246,21 +244,19 @@
|
|||||||
|
|
||||||
<!-- Scripts Section (Quick Actions) -->
|
<!-- Scripts Section (Quick Actions) -->
|
||||||
<div class="scripts-container" id="scripts-container" data-tab-content="quick-actions" >
|
<div class="scripts-container" id="scripts-container" data-tab-content="quick-actions" >
|
||||||
<h2 data-i18n="scripts.quick_actions">Quick Actions</h2>
|
|
||||||
<div class="scripts-grid" id="scripts-grid">
|
<div class="scripts-grid" id="scripts-grid">
|
||||||
<div class="scripts-empty empty-state-illustration">
|
<div class="scripts-empty empty-state-illustration">
|
||||||
<svg viewBox="0 0 64 64"><path d="M20 8l-8 48"/><path d="M44 8l8 48"/><path d="M10 24h44"/><path d="M8 40h44"/></svg>
|
<svg viewBox="0 0 64 64"><path d="M20 8l-8 48"/><path d="M44 8l8 48"/><path d="M10 24h44"/><path d="M8 40h44"/></svg>
|
||||||
<p data-i18n="scripts.no_scripts">No scripts configured</p>
|
<p data-i18n="scripts.no_scripts">No scripts configured</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="script-btn add-card-grid" onclick="showAddScriptDialog()">
|
||||||
|
<span class="add-card-icon">+</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Script Management Section -->
|
<!-- Script Management Section -->
|
||||||
<div class="script-management" data-tab-content="scripts" >
|
<div class="script-management" data-tab-content="scripts" >
|
||||||
<div class="script-management-header">
|
|
||||||
<h2 data-i18n="scripts.management">Script Management</h2>
|
|
||||||
<button class="add-script-btn" onclick="showAddScriptDialog()" data-i18n="scripts.add">+ Add</button>
|
|
||||||
</div>
|
|
||||||
<table class="scripts-table">
|
<table class="scripts-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -282,14 +278,13 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<div class="add-card" onclick="showAddScriptDialog()">
|
||||||
|
<span class="add-card-icon">+</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Callback Management Section -->
|
<!-- Callback Management Section -->
|
||||||
<div class="script-management" id="callbacksSection" data-tab-content="callbacks" >
|
<div class="script-management" id="callbacksSection" data-tab-content="callbacks" >
|
||||||
<div class="script-management-header">
|
|
||||||
<h2 data-i18n="callbacks.management">Callback Management</h2>
|
|
||||||
<button class="add-script-btn" onclick="showAddCallbackDialog()" data-i18n="callbacks.add">+ Add</button>
|
|
||||||
</div>
|
|
||||||
<p style="color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 1rem;" data-i18n="callbacks.description">
|
<p style="color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 1rem;" data-i18n="callbacks.description">
|
||||||
Callbacks are scripts triggered automatically by media control events (play, pause, stop, etc.)
|
Callbacks are scripts triggered automatically by media control events (play, pause, stop, etc.)
|
||||||
</p>
|
</p>
|
||||||
@@ -313,6 +308,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<div class="add-card" onclick="showAddCallbackDialog()">
|
||||||
|
<span class="add-card-icon">+</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -364,7 +364,7 @@
|
|||||||
let volumeUpdateTimer = null; // Timer for throttling volume updates
|
let volumeUpdateTimer = null; // Timer for throttling volume updates
|
||||||
let scripts = [];
|
let scripts = [];
|
||||||
let lastStatus = null; // Store last status for locale switching
|
let lastStatus = null; // Store last status for locale switching
|
||||||
let lastArtworkSource = null; // Track artwork source to skip redundant loads
|
let lastArtworkKey = null; // Track artwork identity to skip redundant loads
|
||||||
|
|
||||||
// Dialog dirty state tracking
|
// Dialog dirty state tracking
|
||||||
let scriptFormDirty = false;
|
let scriptFormDirty = false;
|
||||||
@@ -656,11 +656,12 @@
|
|||||||
currentState = status.state;
|
currentState = status.state;
|
||||||
updatePlaybackState(status.state);
|
updatePlaybackState(status.state);
|
||||||
|
|
||||||
// Update album art (skip if same source to avoid redundant network requests)
|
// Update album art (skip if same track to avoid redundant network requests)
|
||||||
const artworkSource = status.album_art_url || null;
|
const artworkSource = status.album_art_url || null;
|
||||||
|
const artworkKey = `${status.title || ''}|${status.artist || ''}|${artworkSource || ''}`;
|
||||||
|
|
||||||
if (artworkSource !== lastArtworkSource) {
|
if (artworkKey !== lastArtworkKey) {
|
||||||
lastArtworkSource = artworkSource;
|
lastArtworkKey = artworkKey;
|
||||||
const artworkUrl = artworkSource
|
const artworkUrl = artworkSource
|
||||||
? `/api/media/artwork?token=${encodeURIComponent(localStorage.getItem('media_server_token'))}&_=${Date.now()}`
|
? `/api/media/artwork?token=${encodeURIComponent(localStorage.getItem('media_server_token'))}&_=${Date.now()}`
|
||||||
: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 300'%3E%3Crect fill='%23282828' width='300' height='300'/%3E%3Cpath fill='%236a6a6a' d='M150 80c-38.66 0-70 31.34-70 70s31.34 70 70 70 70-31.34 70-70-31.34-70-70-70zm0 20c27.614 0 50 22.386 50 50s-22.386 50-50 50-50-22.386-50-50 22.386-50 50-50zm0 30a20 20 0 100 40 20 20 0 000-40z'/%3E%3C/svg%3E";
|
: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 300'%3E%3Crect fill='%23282828' width='300' height='300'/%3E%3Cpath fill='%236a6a6a' d='M150 80c-38.66 0-70 31.34-70 70s31.34 70 70 70 70-31.34 70-70-31.34-70-70-70zm0 20c27.614 0 50 22.386 50 50s-22.386 50-50 50-50-22.386-50-50 22.386-50 50-50zm0 30a20 20 0 100 40 20 20 0 000-40z'/%3E%3C/svg%3E";
|
||||||
@@ -886,33 +887,39 @@
|
|||||||
const container = document.getElementById('scripts-container');
|
const container = document.getElementById('scripts-container');
|
||||||
const grid = document.getElementById('scripts-grid');
|
const grid = document.getElementById('scripts-grid');
|
||||||
|
|
||||||
if (scripts.length === 0) {
|
|
||||||
grid.innerHTML = `<div class="scripts-empty empty-state-illustration"><svg viewBox="0 0 64 64"><path d="M20 8l-8 48"/><path d="M44 8l8 48"/><path d="M10 24h44"/><path d="M8 40h44"/></svg><p>${t('scripts.no_scripts')}</p></div>`;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
grid.innerHTML = '';
|
grid.innerHTML = '';
|
||||||
|
|
||||||
scripts.forEach(script => {
|
if (scripts.length === 0) {
|
||||||
const button = document.createElement('button');
|
grid.innerHTML = `<div class="scripts-empty empty-state-illustration"><svg viewBox="0 0 64 64"><path d="M20 8l-8 48"/><path d="M44 8l8 48"/><path d="M10 24h44"/><path d="M8 40h44"/></svg><p>${t('scripts.no_scripts')}</p></div>`;
|
||||||
button.className = 'script-btn';
|
} else {
|
||||||
button.onclick = () => executeScript(script.name, button);
|
scripts.forEach(script => {
|
||||||
|
const button = document.createElement('button');
|
||||||
|
button.className = 'script-btn';
|
||||||
|
button.onclick = () => executeScript(script.name, button);
|
||||||
|
|
||||||
const label = document.createElement('div');
|
const label = document.createElement('div');
|
||||||
label.className = 'script-label';
|
label.className = 'script-label';
|
||||||
label.textContent = script.label || script.name;
|
label.textContent = script.label || script.name;
|
||||||
|
|
||||||
button.appendChild(label);
|
button.appendChild(label);
|
||||||
|
|
||||||
if (script.description) {
|
if (script.description) {
|
||||||
const description = document.createElement('div');
|
const description = document.createElement('div');
|
||||||
description.className = 'script-description';
|
description.className = 'script-description';
|
||||||
description.textContent = script.description;
|
description.textContent = script.description;
|
||||||
button.appendChild(description);
|
button.appendChild(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
grid.appendChild(button);
|
grid.appendChild(button);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add "+" card at the end
|
||||||
|
const addCard = document.createElement('div');
|
||||||
|
addCard.className = 'script-btn add-card-grid';
|
||||||
|
addCard.onclick = () => showAddScriptDialog();
|
||||||
|
addCard.innerHTML = '<span class="add-card-icon">+</span>';
|
||||||
|
grid.appendChild(addCard);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function executeScript(scriptName, buttonElement) {
|
async function executeScript(scriptName, buttonElement) {
|
||||||
|
|||||||
Reference in New Issue
Block a user