refactor: refresh aster-webui dashboard layout
Build And Push Container / build-and-push (push) Successful in 57s
Build And Push Container / build-and-push (push) Successful in 57s
This commit is contained in:
+391
-116
@@ -26,166 +26,428 @@ const INDEX_HTML: &str = r##"<!DOCTYPE html>
|
||||
<title>aster-webui</title>
|
||||
<style>
|
||||
:root {
|
||||
--bg: #0d1117;
|
||||
--panel: #121821;
|
||||
--line: #243243;
|
||||
--text: #edf2f7;
|
||||
--muted: #92a3b5;
|
||||
--accent: #7ce7bf;
|
||||
--accent-2: #d8fd72;
|
||||
--danger: #ff7f73;
|
||||
--bg: #090d12;
|
||||
--surface: #10161d;
|
||||
--surface-2: #141b24;
|
||||
--surface-3: #0c1117;
|
||||
--line: #223042;
|
||||
--line-soft: #182333;
|
||||
--text: #eef3f8;
|
||||
--muted: #95a7ba;
|
||||
--faint: #667789;
|
||||
--accent: #6ee7b7;
|
||||
--accent-2: #b9f66a;
|
||||
--warn: #f6c65b;
|
||||
--danger: #f18479;
|
||||
--shadow: 0 18px 60px rgba(0, 0, 0, .28);
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
body {
|
||||
margin: 0;
|
||||
background:
|
||||
radial-gradient(circle at top left, rgba(124,231,191,.15), transparent 30%),
|
||||
radial-gradient(circle at bottom right, rgba(216,253,114,.12), transparent 25%),
|
||||
var(--bg);
|
||||
background: linear-gradient(180deg, #0a1112 0, var(--bg) 210px);
|
||||
color: var(--text);
|
||||
font-family: "IBM Plex Sans", sans-serif;
|
||||
font-family: Inter, "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
main { width: min(1320px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 36px; }
|
||||
.hero, .content, .status-grid { display: grid; gap: 18px; }
|
||||
.hero { grid-template-columns: 1.4fr 1fr; margin-bottom: 18px; }
|
||||
.status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
||||
.card {
|
||||
background: linear-gradient(180deg, rgba(16,22,30,.98), rgba(19,25,35,.9));
|
||||
main {
|
||||
width: min(1320px, calc(100% - 32px));
|
||||
margin: 0 auto;
|
||||
padding: 18px 0 32px;
|
||||
}
|
||||
.topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
.brand-mark {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
border: 1px solid rgba(110, 231, 183, .36);
|
||||
border-radius: 8px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: #0d1719;
|
||||
color: var(--accent);
|
||||
font-weight: 800;
|
||||
}
|
||||
.brand h1 {
|
||||
margin: 0;
|
||||
font-size: 1.55rem;
|
||||
line-height: 1.05;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
.brand p { margin: 3px 0 0; color: var(--muted); font-size: .9rem; }
|
||||
.layout { display: grid; grid-template-columns: minmax(0, 1.45fr) 520px; gap: 14px; }
|
||||
.stack { display: grid; gap: 16px; }
|
||||
.panel, .card {
|
||||
background: linear-gradient(180deg, rgba(18, 25, 34, .98), rgba(13, 18, 25, .98));
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 26px;
|
||||
padding: 22px;
|
||||
border-radius: 8px;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
.hero h1 { margin: 0 0 8px; font-size: clamp(2rem, 3vw, 3.4rem); line-height: 1; }
|
||||
.hero p, .muted { color: var(--muted); }
|
||||
.status strong { display: block; margin-top: 8px; font-size: 1.3rem; }
|
||||
.status small { display: block; margin-top: 6px; color: var(--muted); }
|
||||
.controls { display: grid; grid-template-columns: 180px 1fr auto; gap: 12px; align-items: end; margin-top: 16px; }
|
||||
.toggle-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
|
||||
.toggle-pill {
|
||||
display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px;
|
||||
border: 1px solid var(--line); border-radius: 999px; background: rgba(9,14,20,.7);
|
||||
color: var(--text); font-size: .95rem;
|
||||
.panel { padding: 16px; }
|
||||
.card { padding: 14px; }
|
||||
.section-head {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.toggle-pill input { margin: 0; width: 18px; height: 18px; accent-color: var(--accent); }
|
||||
label { display: grid; gap: 8px; color: var(--muted); font-size: .9rem; }
|
||||
h2 {
|
||||
margin: 0;
|
||||
font-size: 1.05rem;
|
||||
line-height: 1.2;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
.muted { color: var(--muted); }
|
||||
.subtle { color: var(--faint); font-size: .82rem; }
|
||||
.controls {
|
||||
display: grid;
|
||||
grid-template-columns: 132px minmax(220px, 1fr) auto;
|
||||
gap: 10px;
|
||||
align-items: end;
|
||||
}
|
||||
label { display: grid; gap: 7px; color: var(--muted); font-size: .82rem; }
|
||||
input, button {
|
||||
border-radius: 14px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid var(--line);
|
||||
padding: 12px 14px;
|
||||
padding: 10px 12px;
|
||||
font: inherit;
|
||||
min-height: 42px;
|
||||
}
|
||||
input { background: rgba(6,10,15,.8); color: var(--text); }
|
||||
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
|
||||
button { cursor: pointer; }
|
||||
.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #071016; font-weight: 700; }
|
||||
.ghost { background: rgba(9,14,20,.7); color: var(--text); }
|
||||
.danger { background: rgba(255,127,115,.14); color: #ffc7c1; }
|
||||
.content { grid-template-columns: 1.45fr 1fr; }
|
||||
.metrics-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
|
||||
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
|
||||
.tile {
|
||||
input {
|
||||
background: var(--surface-3);
|
||||
color: var(--text);
|
||||
min-width: 0;
|
||||
}
|
||||
input:focus-visible, button:focus-visible {
|
||||
outline: 2px solid rgba(110, 231, 183, .65);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
button {
|
||||
cursor: pointer;
|
||||
color: var(--text);
|
||||
background: var(--surface-2);
|
||||
transition: transform .12s ease, border-color .12s ease, background .12s ease;
|
||||
}
|
||||
button:hover {
|
||||
transform: translateY(-1px);
|
||||
border-color: #38516c;
|
||||
background: #182231;
|
||||
}
|
||||
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
|
||||
.primary {
|
||||
background: linear-gradient(135deg, var(--accent), var(--accent-2));
|
||||
color: #071016;
|
||||
border-color: transparent;
|
||||
font-weight: 800;
|
||||
}
|
||||
.ghost { background: var(--surface-3); color: var(--text); }
|
||||
.danger {
|
||||
background: rgba(241, 132, 121, .14);
|
||||
color: #ffd2cd;
|
||||
border-color: rgba(241, 132, 121, .24);
|
||||
}
|
||||
.toggle-row {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 12px;
|
||||
}
|
||||
.toggle-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 9px;
|
||||
min-height: 38px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 20px;
|
||||
border-radius: 8px;
|
||||
background: rgba(9, 14, 20, .72);
|
||||
color: var(--text);
|
||||
font-size: .88rem;
|
||||
}
|
||||
.toggle-pill input {
|
||||
margin: 0;
|
||||
min-height: auto;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
accent-color: var(--accent);
|
||||
}
|
||||
.status-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
.status {
|
||||
min-height: 84px;
|
||||
display: grid;
|
||||
align-content: space-between;
|
||||
background: rgba(16, 22, 30, .86);
|
||||
}
|
||||
.status span, .metric-label {
|
||||
color: var(--muted);
|
||||
font-size: .78rem;
|
||||
letter-spacing: .02em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.status strong {
|
||||
display: block;
|
||||
margin-top: 6px;
|
||||
font-size: 1.1rem;
|
||||
line-height: 1.18;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.status small { display: block; margin-top: 5px; color: var(--muted); }
|
||||
.metrics-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
.metric-card {
|
||||
min-height: 104px;
|
||||
border-left: 3px solid var(--accent);
|
||||
}
|
||||
.metric-card:nth-child(2) { border-left-color: #78bdf7; }
|
||||
.metric-card:nth-child(3) { border-left-color: var(--warn); }
|
||||
.metric-card:nth-child(4) { border-left-color: #b99cff; }
|
||||
.metric-card:nth-child(5) { border-left-color: #f2a65a; }
|
||||
.metric-card:nth-child(6) { border-left-color: var(--danger); }
|
||||
.metric-card strong {
|
||||
display: block;
|
||||
margin-top: 8px;
|
||||
font-size: 1.25rem;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.metric-card small {
|
||||
display: block;
|
||||
margin-top: 6px;
|
||||
color: var(--muted);
|
||||
line-height: 1.35;
|
||||
}
|
||||
.workbench {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.35fr) minmax(340px, .75fr);
|
||||
gap: 14px;
|
||||
}
|
||||
.gallery {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
.tile {
|
||||
border: 1px solid var(--line-soft);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
background: #0b1016;
|
||||
min-width: 0;
|
||||
}
|
||||
.tile.selected {
|
||||
border-color: var(--accent-2);
|
||||
box-shadow: inset 0 0 0 1px rgba(185, 246, 106, .8);
|
||||
}
|
||||
.tile:hover { border-color: #32465d; }
|
||||
.tile img {
|
||||
width: 100%;
|
||||
aspect-ratio: 960 / 376;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
background: #020409;
|
||||
}
|
||||
.tile-body {
|
||||
padding: 10px;
|
||||
display: grid;
|
||||
gap: 9px;
|
||||
}
|
||||
.tile-title {
|
||||
min-height: 2.5em;
|
||||
line-height: 1.28;
|
||||
word-break: break-word;
|
||||
color: var(--text);
|
||||
}
|
||||
.tile-meta {
|
||||
color: var(--faint);
|
||||
font-size: .82rem;
|
||||
line-height: 1.25;
|
||||
}
|
||||
.mini { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
|
||||
.mini button {
|
||||
min-height: 34px;
|
||||
padding: 7px 10px;
|
||||
font-size: .86rem;
|
||||
}
|
||||
.order {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
.order-item {
|
||||
display: grid;
|
||||
grid-template-columns: 28px minmax(0, 1fr) auto;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
border: 1px solid var(--line-soft);
|
||||
border-radius: 8px;
|
||||
padding: 10px;
|
||||
background: rgba(8, 12, 18, .78);
|
||||
}
|
||||
.tile.selected { outline: 2px solid var(--accent-2); }
|
||||
.tile img { width: 100%; aspect-ratio: 960 / 376; object-fit: cover; display: block; }
|
||||
.tile-body { padding: 12px; display: grid; gap: 10px; }
|
||||
.tile-title { word-break: break-word; }
|
||||
.mini { display: flex; gap: 8px; flex-wrap: wrap; }
|
||||
.order { display: grid; gap: 10px; }
|
||||
.order-item {
|
||||
display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
|
||||
border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; background: rgba(8,12,18,.78);
|
||||
.order-item.current {
|
||||
border-color: rgba(110, 231, 183, .7);
|
||||
background: rgba(16, 36, 39, .72);
|
||||
}
|
||||
.index {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border-radius: 6px;
|
||||
background: rgba(185, 246, 106, .12);
|
||||
color: var(--accent-2);
|
||||
font-weight: 800;
|
||||
}
|
||||
.meta {
|
||||
display: grid;
|
||||
gap: 3px;
|
||||
min-width: 0;
|
||||
}
|
||||
.meta > div:first-child {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.index { color: var(--accent-2); font-weight: 700; }
|
||||
.meta { display: grid; gap: 4px; }
|
||||
.toast {
|
||||
position: fixed; bottom: 16px; right: 16px; min-width: 260px; max-width: 420px;
|
||||
padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line);
|
||||
background: rgba(10,14,20,.94); display: none;
|
||||
}
|
||||
@media (max-width: 1024px) {
|
||||
.hero, .content, .controls, .status-grid, .metrics-grid { grid-template-columns: 1fr; }
|
||||
position: fixed;
|
||||
bottom: 16px;
|
||||
right: 16px;
|
||||
min-width: 260px;
|
||||
max-width: 420px;
|
||||
padding: 12px 14px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid var(--line);
|
||||
background: rgba(10, 14, 20, .96);
|
||||
display: none;
|
||||
box-shadow: var(--shadow);
|
||||
z-index: 50;
|
||||
}
|
||||
.nyan-wrap {
|
||||
position: fixed;
|
||||
right: 24px;
|
||||
bottom: 18px;
|
||||
width: 260px;
|
||||
right: 14px;
|
||||
bottom: 10px;
|
||||
width: 132px;
|
||||
pointer-events: none;
|
||||
z-index: 30;
|
||||
opacity: 0.98;
|
||||
filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.35));
|
||||
opacity: .42;
|
||||
filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .26));
|
||||
}
|
||||
.nyan-wrap img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.nyan-wrap {
|
||||
right: 14px;
|
||||
bottom: 12px;
|
||||
width: 180px;
|
||||
@media (max-width: 1180px) {
|
||||
.layout, .workbench { grid-template-columns: 1fr; }
|
||||
.status-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
||||
}
|
||||
@media (max-width: 1024px) {
|
||||
.controls, .metrics-grid { grid-template-columns: 1fr; }
|
||||
.status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
||||
.actions { justify-content: flex-start; }
|
||||
}
|
||||
@media (max-width: 720px) {
|
||||
main { width: min(100% - 20px, 1320px); padding-top: 12px; }
|
||||
.topbar { align-items: flex-start; }
|
||||
.brand h1 { font-size: 1.28rem; }
|
||||
.panel, .card { padding: 12px; }
|
||||
.gallery { grid-template-columns: 1fr; }
|
||||
.order-item { grid-template-columns: 28px minmax(0, 1fr); }
|
||||
.order-item .mini { grid-column: 2; }
|
||||
.nyan-wrap { width: 96px; opacity: .32; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<section class="hero">
|
||||
<div class="card">
|
||||
<p class="muted">aoostar-rs fork</p>
|
||||
<header class="topbar">
|
||||
<div class="brand">
|
||||
<div class="brand-mark">A</div>
|
||||
<div>
|
||||
<h1>aster-webui</h1>
|
||||
<p>Eigene Rust-WebUI mit nativer Display-Logik. Bilder werden auf 960x376 normalisiert, GIFs als animierte Frame-Sets importiert; die Rotation laeuft direkt ueber `aoostar-rs` ohne Vendor-Binary.</p>
|
||||
<p>AOOSTAR display control</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button id="apply" class="primary" type="button">Apply Rotation</button>
|
||||
<button id="refresh" class="ghost" type="button">Refresh</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="layout">
|
||||
<div class="stack">
|
||||
<div class="panel">
|
||||
<div class="section-head">
|
||||
<h2>Rotation Setup</h2>
|
||||
<span class="subtle">/config/Monitor3.json</span>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<label>
|
||||
<span>Switch Time</span>
|
||||
<input id="switchTime" type="number" min="1" max="600" value="10">
|
||||
</label>
|
||||
<label>
|
||||
<span>Upload New Source</span>
|
||||
<span>Upload Source</span>
|
||||
<input id="upload" type="file" accept="image/*">
|
||||
</label>
|
||||
<div class="actions">
|
||||
<button id="apply" class="primary" type="button">Apply Rotation</button>
|
||||
<button id="disable" class="danger" type="button">Disable</button>
|
||||
<button id="refresh" class="ghost" type="button">Refresh</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="toggle-row">
|
||||
<label class="toggle-pill"><input id="specsEnabled" type="checkbox"> System Specs on LCD</label>
|
||||
<label class="toggle-pill"><input id="memesEnabled" type="checkbox"> Memes on LCD</label>
|
||||
<label class="toggle-pill"><input id="gifsEnabled" type="checkbox"> GIFs on LCD</label>
|
||||
<label class="toggle-pill"><input id="specsEnabled" type="checkbox"> System Specs</label>
|
||||
<label class="toggle-pill"><input id="memesEnabled" type="checkbox"> Memes</label>
|
||||
<label class="toggle-pill"><input id="gifsEnabled" type="checkbox"> GIFs</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="status-grid">
|
||||
<div class="card status"><span class="muted">Custom Panel</span><strong id="customPanelValue">-</strong></div>
|
||||
<div class="card status"><span class="muted">Active Images</span><strong id="imageCountValue">-</strong></div>
|
||||
<div class="card status"><span class="muted">Display Status</span><strong id="displayStatusValue">-</strong></div>
|
||||
<div class="card status"><span class="muted">Current Frame</span><strong id="currentImageValue" style="font-size: 1rem;">-</strong></div>
|
||||
<div class="card status"><span class="muted">Display Target</span><strong id="displayTargetValue" style="font-size: 1rem;">-</strong></div>
|
||||
<div class="card status"><span class="muted">Config Path</span><strong id="configPathValue" style="font-size: 1rem;">-</strong></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="metrics-grid">
|
||||
<div class="card status"><span class="muted">CPU</span><strong id="cpuUsageValue">-</strong><small id="cpuMetaValue">-</small></div>
|
||||
<div class="card status"><span class="muted">Memory</span><strong id="memUsageValue">-</strong><small id="memMetaValue">-</small></div>
|
||||
<div class="card status"><span class="muted">Storage</span><strong id="diskUsageValue">-</strong><small id="diskMetaValue">-</small></div>
|
||||
<div class="card status"><span class="muted">Swap</span><strong id="swapUsageValue">-</strong><small id="swapMetaValue">-</small></div>
|
||||
<div class="card status"><span class="muted">Load Avg</span><strong id="loadValue">-</strong><small id="uptimeValue">-</small></div>
|
||||
<div class="card status"><span class="muted">Temperatures</span><strong id="tempCpuValue">-</strong><small id="tempGpuValue">-</small></div>
|
||||
<div class="card metric-card"><span class="metric-label">CPU</span><strong id="cpuUsageValue">-</strong><small id="cpuMetaValue">-</small></div>
|
||||
<div class="card metric-card"><span class="metric-label">Memory</span><strong id="memUsageValue">-</strong><small id="memMetaValue">-</small></div>
|
||||
<div class="card metric-card"><span class="metric-label">Storage</span><strong id="diskUsageValue">-</strong><small id="diskMetaValue">-</small></div>
|
||||
<div class="card metric-card"><span class="metric-label">Swap</span><strong id="swapUsageValue">-</strong><small id="swapMetaValue">-</small></div>
|
||||
<div class="card metric-card"><span class="metric-label">Load Avg</span><strong id="loadValue">-</strong><small id="uptimeValue">-</small></div>
|
||||
<div class="card metric-card"><span class="metric-label">Temperatures</span><strong id="tempCpuValue">-</strong><small id="tempGpuValue">-</small></div>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="card">
|
||||
</div>
|
||||
|
||||
<aside class="status-grid">
|
||||
<div class="card status"><span>Panel</span><strong id="customPanelValue">-</strong></div>
|
||||
<div class="card status"><span>Images</span><strong id="imageCountValue">-</strong></div>
|
||||
<div class="card status"><span>Display</span><strong id="displayStatusValue">-</strong></div>
|
||||
<div class="card status"><span>Frame</span><strong id="currentImageValue">-</strong></div>
|
||||
<div class="card status"><span>Target</span><strong id="displayTargetValue">-</strong></div>
|
||||
<div class="card status"><span>Config</span><strong id="configPathValue">-</strong></div>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
<section class="workbench">
|
||||
<div class="panel">
|
||||
<div class="section-head">
|
||||
<h2>Available Images</h2>
|
||||
<span class="subtle">960 x 376</span>
|
||||
</div>
|
||||
<div id="gallery" class="gallery"></div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="panel">
|
||||
<div class="section-head">
|
||||
<h2>Rotation Order</h2>
|
||||
<span class="subtle">Live queue</span>
|
||||
</div>
|
||||
<div id="order" class="order"></div>
|
||||
<p id="displayErrorValue" class="muted"></p>
|
||||
</div>
|
||||
@@ -251,6 +513,15 @@ const INDEX_HTML: &str = r##"<!DOCTYPE html>
|
||||
return (n / 1024 / 1024).toFixed(1) + " MB";
|
||||
}
|
||||
|
||||
function escapeHtml(value) {
|
||||
return String(value)
|
||||
.replaceAll("&", "&")
|
||||
.replaceAll("<", "<")
|
||||
.replaceAll(">", ">")
|
||||
.replaceAll('"', """)
|
||||
.replaceAll("'", "'");
|
||||
}
|
||||
|
||||
function move(index, delta) {
|
||||
const target = index + delta;
|
||||
if (target < 0 || target >= state.activeImages.length) return;
|
||||
@@ -406,14 +677,17 @@ const INDEX_HTML: &str = r##"<!DOCTYPE html>
|
||||
for (const image of state.images) {
|
||||
const selected = state.activeImages.includes(image.name);
|
||||
const tile = document.createElement("article");
|
||||
const safeLabel = escapeHtml(image.label);
|
||||
const safeName = escapeHtml(image.name);
|
||||
const safeUrl = escapeHtml(image.url);
|
||||
tile.className = "tile" + (selected ? " selected" : "");
|
||||
tile.innerHTML = `
|
||||
<img src="${image.url}" alt="${image.name}">
|
||||
<img src="${safeUrl}" alt="${safeName}">
|
||||
<div class="tile-body">
|
||||
<div class="tile-title">${image.label}</div>
|
||||
<div class="muted">${bytes(image.size)}${image.animated ? ` • GIF • ${image.frame_count} Frames` : ""}</div>
|
||||
<div class="tile-title">${safeLabel}</div>
|
||||
<div class="tile-meta">${bytes(image.size)}${image.animated ? ` • GIF • ${image.frame_count} Frames` : ""}</div>
|
||||
<div class="mini">
|
||||
<button class="ghost" type="button">${selected ? "Remove" : "Add"}</button>
|
||||
<button class="ghost" type="button" title="${selected ? "Remove" : "Add"}">${selected ? "Remove" : "Add"}</button>
|
||||
<button class="danger" type="button">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -427,14 +701,14 @@ const INDEX_HTML: &str = r##"<!DOCTYPE html>
|
||||
el.order.innerHTML = "";
|
||||
if (state.setup.specs_enabled && !state.activeImages.length) {
|
||||
const row = document.createElement("div");
|
||||
row.className = "order-item";
|
||||
row.className = "order-item" + (state.display.current_image === "System Specs" ? " current" : "");
|
||||
row.innerHTML = `
|
||||
<div class="index">S</div>
|
||||
<div class="meta">
|
||||
<div>System Specs</div>
|
||||
<div class="muted">${state.display.current_image === "System Specs" ? "Currently shown" : "Fixed first frame when enabled"}</div>
|
||||
<div class="muted">${state.display.current_image === "System Specs" ? "Currently shown" : "Enabled"}</div>
|
||||
</div>
|
||||
<div class="mini"><span class="muted">Toggle above</span></div>
|
||||
<div class="mini"><span class="muted">Specs</span></div>
|
||||
`;
|
||||
el.order.appendChild(row);
|
||||
}
|
||||
@@ -446,9 +720,9 @@ const INDEX_HTML: &str = r##"<!DOCTYPE html>
|
||||
<div class="index">S</div>
|
||||
<div class="meta">
|
||||
<div>System Specs Overlay</div>
|
||||
<div class="muted">Live stats are drawn over every meme while enabled.</div>
|
||||
<div class="muted">Overlay active</div>
|
||||
</div>
|
||||
<div class="mini"><span class="muted">Toggle above</span></div>
|
||||
<div class="mini"><span class="muted">Specs</span></div>
|
||||
`;
|
||||
el.order.appendChild(row);
|
||||
}
|
||||
@@ -460,19 +734,20 @@ const INDEX_HTML: &str = r##"<!DOCTYPE html>
|
||||
state.activeImages.forEach((name, index) => {
|
||||
const image = imageMap.get(name);
|
||||
const label = image ? image.label : name;
|
||||
const safeLabel = escapeHtml(label);
|
||||
const row = document.createElement("div");
|
||||
row.className = "order-item";
|
||||
const isCurrent = state.display.current_image === name || state.display.current_image === label;
|
||||
row.className = "order-item" + (isCurrent ? " current" : "");
|
||||
row.innerHTML = `
|
||||
<div class="index">${index + 1}</div>
|
||||
<div class="meta">
|
||||
<div>${label}</div>
|
||||
<div>${safeLabel}</div>
|
||||
<div class="muted">${isCurrent ? "Currently shown" : (image && image.animated ? `Animated • ${image.frame_count} Frames` : "")}</div>
|
||||
</div>
|
||||
<div class="mini">
|
||||
<button class="ghost" type="button">Up</button>
|
||||
<button class="ghost" type="button">Down</button>
|
||||
<button class="danger" type="button">Remove</button>
|
||||
<button class="ghost" type="button" title="Move up" aria-label="Move ${safeLabel} up">↑</button>
|
||||
<button class="ghost" type="button" title="Move down" aria-label="Move ${safeLabel} down">↓</button>
|
||||
<button class="danger" type="button" title="Remove" aria-label="Remove ${safeLabel}">Remove</button>
|
||||
</div>
|
||||
`;
|
||||
const [up, down, remove] = row.querySelectorAll("button");
|
||||
|
||||
Reference in New Issue
Block a user