|
59 | 59 | #sDot.ok { background:#69F0AE; } |
60 | 60 | #sDot.err { background:#FF5252; } |
61 | 61 | #sDot.loading { background:#FFD740; animation:blink 0.8s infinite; } |
62 | | -@keyframes blink{0%,100%{opacity:1}50%{opacity:0.2}} |
63 | 62 |
|
64 | 63 | #patTopBtn { |
65 | 64 | display:flex; align-items:center; gap:5px; |
66 | 65 | background:rgba(255,255,255,0.15); border:none; color:white; |
67 | 66 | border-radius:8px; padding:5px 10px; font-family:'Roboto',sans-serif; |
68 | 67 | font-size:12px; font-weight:500; cursor:pointer; white-space:nowrap; |
69 | 68 | } |
70 | | -#patTopBtn:active { opacity:0.7; } |
71 | 69 | #patDot { width:10px;height:10px;border-radius:50%;background:#FF5252;flex-shrink:0;transition:background 0.3s; } |
72 | 70 | #patDot.set { background:#69F0AE; } |
73 | 71 |
|
|
85 | 83 | display:inline-flex; align-items:center; gap:4px; |
86 | 84 | } |
87 | 85 | .btn:active { opacity:0.75; transform:scale(0.96); } |
88 | | -.btn-flat { background:transparent; color:var(--primary); } |
89 | | -.btn-flat:hover { background:var(--primary-light); } |
| 86 | +.btn-flat { background:transparent; color:var(--primary); } |
90 | 87 | .btn-raised { background:var(--primary); color:white; box-shadow:var(--shadow); } |
91 | | -.btn-green { background:#388E3C; color:white; box-shadow:var(--shadow); } |
| 88 | +.btn-green { background:#388E3C; color:white; box-shadow:var(--shadow); } |
92 | 89 | .btn:disabled { opacity:0.3; pointer-events:none; } |
93 | 90 |
|
94 | 91 | #modBadge { |
|
98 | 95 | } |
99 | 96 | #modBadge.show { display:inline-block; } |
100 | 97 |
|
101 | | -/* ── SEARCH PANEL (top-anchored, Material) ────── */ |
| 98 | +/* ── SEARCH PANEL ────────────────────────────────────── */ |
102 | 99 | #searchPanel { |
103 | 100 | display:none; flex-shrink:0; |
104 | 101 | background:#FFFFFF; |
|
118 | 115 | background:var(--surface2); color:var(--text); outline:none; |
119 | 116 | } |
120 | 117 | .sp-field input:focus { border-color:var(--primary); background:#fff; } |
121 | | -.sp-match-count { position:absolute; right:8px; font-size:11px; font-weight:600; color:var(--primary); pointer-events:none; } |
122 | 118 | .sp-toggles { display:flex; gap:2px; position:absolute; right:8px; } |
123 | 119 | .sp-tog { |
124 | 120 | font-family:'Roboto Mono',monospace; font-size:10px; font-weight:700; |
@@ -306,9 +302,8 @@ <h2>GitHub Token (PAT)</h2> |
306 | 302 | openSearchPanel as cmOpenPanel, closeSearchPanel as cmClosePanel, |
307 | 303 | getSearchQuery, selectNextOccurrence |
308 | 304 | } from '@codemirror/search'; |
309 | | -import { HighlightStyle, syntaxHighlighting } from '@codemirror/language'; |
310 | 305 |
|
311 | | -// ── GitHub config ────────────────────────────────────── |
| 306 | +// GitHub config |
312 | 307 | const OWNER = 'BlazeFTL'; |
313 | 308 | const REPO = 'Link-Shortner-uBlockOrigin'; |
314 | 309 | const FILE = 'Ubo-LinkShortners.txt'; |
@@ -464,9 +459,25 @@ <h2>GitHub Token (PAT)</h2> |
464 | 459 |
|
465 | 460 | window.spSearch = function() { |
466 | 461 | const q = document.getElementById('spFind').value; |
467 | | - if (!q) { view.dispatch({ effects: setSearchQuery.of(buildSearchQuery('')) }); document.getElementById('spCount').textContent = ''; return; } |
468 | | - view.dispatch({ effects: setSearchQuery.of(buildSearchQuery(q)) }); |
| 462 | + const query = buildSearchQuery(q); |
| 463 | + |
| 464 | + // Update internal CM search state |
| 465 | + view.dispatch({ effects: setSearchQuery.of(query) }); |
469 | 466 | updateMatchCount(); |
| 467 | + |
| 468 | + if (!q) return; |
| 469 | + |
| 470 | + // Jump to first match immediately |
| 471 | + if (query.valid) { |
| 472 | + const cursor = query.getCursor(view.state.doc); |
| 473 | + const firstMatch = cursor.next(); |
| 474 | + if (!firstMatch.done) { |
| 475 | + view.dispatch({ |
| 476 | + selection: { anchor: firstMatch.value.from, head: firstMatch.value.to }, |
| 477 | + scrollIntoView: true |
| 478 | + }); |
| 479 | + } |
| 480 | + } |
470 | 481 | }; |
471 | 482 |
|
472 | 483 | window.spNext = function() { findNext(view); updateMatchCount(); }; |
|
0 commit comments