Spaces:
Running
Running
Add copy button, dynamic logprob range, base/logprob bg tints, examples-above-input layout
Browse files- index.html +34 -1
index.html
CHANGED
|
@@ -34,7 +34,19 @@
|
|
| 34 |
text-transform: uppercase; letter-spacing: 2px; color: #444;
|
| 35 |
margin-top: 24px; margin-bottom: 8px;
|
| 36 |
border-bottom: 1px solid #ccc; padding-bottom: 4px;
|
|
|
|
| 37 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
/* --- Examples --- */
|
| 40 |
.examples {
|
|
@@ -262,7 +274,10 @@
|
|
| 262 |
|
| 263 |
<div class="status" id="status"><span class="dot"></span><span id="status-text">idle</span></div>
|
| 264 |
|
| 265 |
-
<div class="section-title">
|
|
|
|
|
|
|
|
|
|
| 266 |
|
| 267 |
<div class="output-row">
|
| 268 |
<div>
|
|
@@ -298,6 +313,7 @@ const els = {
|
|
| 298 |
stop: document.getElementById("stop-btn"),
|
| 299 |
clear: document.getElementById("clear-btn"),
|
| 300 |
modeBtns: document.getElementById("mode-btns"),
|
|
|
|
| 301 |
seq: document.getElementById("seq"),
|
| 302 |
meta: document.getElementById("meta"),
|
| 303 |
status: document.getElementById("status"),
|
|
@@ -434,6 +450,7 @@ function rgbForBase(absIdx, base) {
|
|
| 434 |
function renderSequence() {
|
| 435 |
if (colorMode === "logprob") recomputeLpRange();
|
| 436 |
const total = promptBases + genText;
|
|
|
|
| 437 |
if (!total) {
|
| 438 |
els.seq.classList.add("empty");
|
| 439 |
els.seq.textContent = "prompt + generated bases will stream here";
|
|
@@ -614,6 +631,22 @@ els.generate.addEventListener("click", generate);
|
|
| 614 |
els.stop.addEventListener("click", stop);
|
| 615 |
els.clear.addEventListener("click", clearAll);
|
| 616 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 617 |
els.prompt.addEventListener("keydown", e => {
|
| 618 |
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
|
| 619 |
e.preventDefault();
|
|
|
|
| 34 |
text-transform: uppercase; letter-spacing: 2px; color: #444;
|
| 35 |
margin-top: 24px; margin-bottom: 8px;
|
| 36 |
border-bottom: 1px solid #ccc; padding-bottom: 4px;
|
| 37 |
+
display: flex; align-items: center; justify-content: space-between;
|
| 38 |
}
|
| 39 |
+
.copy-btn {
|
| 40 |
+
font-family: "JetBrains Mono", monospace;
|
| 41 |
+
font-size: 9px; font-weight: 400;
|
| 42 |
+
padding: 2px 8px; border: 1px solid #ddd; border-radius: 3px;
|
| 43 |
+
background: #fff; color: #666; cursor: pointer;
|
| 44 |
+
text-transform: uppercase; letter-spacing: 1px;
|
| 45 |
+
transition: all 0.15s;
|
| 46 |
+
}
|
| 47 |
+
.copy-btn:hover { border-color: #888; color: #1a1a1a; }
|
| 48 |
+
.copy-btn:disabled { opacity: 0.4; cursor: not-allowed; }
|
| 49 |
+
.copy-btn.copied { background: #1a8a3a; color: #fff; border-color: #1a8a3a; }
|
| 50 |
|
| 51 |
/* --- Examples --- */
|
| 52 |
.examples {
|
|
|
|
| 274 |
|
| 275 |
<div class="status" id="status"><span class="dot"></span><span id="status-text">idle</span></div>
|
| 276 |
|
| 277 |
+
<div class="section-title">
|
| 278 |
+
<span>Sequence</span>
|
| 279 |
+
<button id="copy-btn" class="copy-btn" disabled>copy</button>
|
| 280 |
+
</div>
|
| 281 |
|
| 282 |
<div class="output-row">
|
| 283 |
<div>
|
|
|
|
| 313 |
stop: document.getElementById("stop-btn"),
|
| 314 |
clear: document.getElementById("clear-btn"),
|
| 315 |
modeBtns: document.getElementById("mode-btns"),
|
| 316 |
+
copy: document.getElementById("copy-btn"),
|
| 317 |
seq: document.getElementById("seq"),
|
| 318 |
meta: document.getElementById("meta"),
|
| 319 |
status: document.getElementById("status"),
|
|
|
|
| 450 |
function renderSequence() {
|
| 451 |
if (colorMode === "logprob") recomputeLpRange();
|
| 452 |
const total = promptBases + genText;
|
| 453 |
+
els.copy.disabled = total.length === 0;
|
| 454 |
if (!total) {
|
| 455 |
els.seq.classList.add("empty");
|
| 456 |
els.seq.textContent = "prompt + generated bases will stream here";
|
|
|
|
| 631 |
els.stop.addEventListener("click", stop);
|
| 632 |
els.clear.addEventListener("click", clearAll);
|
| 633 |
|
| 634 |
+
els.copy.addEventListener("click", async () => {
|
| 635 |
+
const text = promptBases + genText;
|
| 636 |
+
if (!text) return;
|
| 637 |
+
try {
|
| 638 |
+
await navigator.clipboard.writeText(text);
|
| 639 |
+
els.copy.classList.add("copied");
|
| 640 |
+
els.copy.textContent = "copied";
|
| 641 |
+
} catch {
|
| 642 |
+
els.copy.textContent = "failed";
|
| 643 |
+
}
|
| 644 |
+
setTimeout(() => {
|
| 645 |
+
els.copy.classList.remove("copied");
|
| 646 |
+
els.copy.textContent = "copy";
|
| 647 |
+
}, 1200);
|
| 648 |
+
});
|
| 649 |
+
|
| 650 |
els.prompt.addEventListener("keydown", e => {
|
| 651 |
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
|
| 652 |
e.preventDefault();
|