mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-18 00:12:09 +00:00
Add search count indication
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><line x1="5" y1="5" x2="11" y2="11"/><line x1="11" y1="5" x2="5" y2="11"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="dial-count" id="count" hidden></div>
|
||||
</div>
|
||||
<div class="dial-list" id="list"></div>
|
||||
</div>
|
||||
|
||||
@@ -18,7 +18,7 @@ function NormChar(ch) {
|
||||
}
|
||||
|
||||
// element handles, assigned in OnInit (kept null so load-time touches no DOM)
|
||||
var qEl = null, listEl = null, favEl = null, clearEl = null, eyeEl = null;
|
||||
var qEl = null, listEl = null, favEl = null, clearEl = null, eyeEl = null, countEl = null;
|
||||
|
||||
// ---- pure helpers (no DOM; unit-tested) -------------------------------------
|
||||
function fuzzyRanges(text, query) {
|
||||
@@ -239,16 +239,22 @@ function renderList() {
|
||||
// non-empty query with zero hits earns the "No actions match" message.
|
||||
if (!q) {
|
||||
listEl.className = "dial-list empty";
|
||||
if (countEl) countEl.hidden = true;
|
||||
return;
|
||||
}
|
||||
listEl.className = "dial-list" + (!arr.length ? " empty" : "");
|
||||
if (!arr.length) {
|
||||
if (countEl) countEl.hidden = true;
|
||||
var empty = document.createElement("div");
|
||||
empty.className = "dial-empty";
|
||||
empty.textContent = "No actions match";
|
||||
empty.textContent = "No actions match (Total: " + ACTIONS.length + ")";
|
||||
listEl.appendChild(empty);
|
||||
return;
|
||||
}
|
||||
if (countEl) {
|
||||
countEl.hidden = false;
|
||||
countEl.textContent = "Showing " + arr.length + " of " + ACTIONS.length + " actions";
|
||||
}
|
||||
arr.forEach(function (a, i) {
|
||||
var on = FAVS.indexOf(a.id) !== -1;
|
||||
var row = document.createElement("div");
|
||||
@@ -361,7 +367,7 @@ function focusInput() { setTimeout(function () { qEl.focus(); }, 0); }
|
||||
|
||||
// ---- init --------------------------------------------------------------------
|
||||
function OnInit() {
|
||||
qEl = $("q"); listEl = $("list"); favEl = $("favBar"); clearEl = $("clear"); eyeEl = $("favEyebrow");
|
||||
qEl = $("q"); listEl = $("list"); favEl = $("favBar"); clearEl = $("clear"); eyeEl = $("favEyebrow"); countEl = $("count");
|
||||
syncClearButton();
|
||||
|
||||
$("clear").onclick = function () {
|
||||
|
||||
@@ -86,6 +86,13 @@ body {
|
||||
background: rgba(127,127,127,.20);
|
||||
}
|
||||
.plugin-search-clear[hidden] { display: none; }
|
||||
.dial-count {
|
||||
padding: 4px 4px 0;
|
||||
text-align: left;
|
||||
font-size: 11px;
|
||||
color: var(--muted, var(--orca-muted, #6b7280));
|
||||
}
|
||||
.dial-count[hidden] { display: none; }
|
||||
.dial-list {
|
||||
flex: 0 1 auto;
|
||||
min-height: 0;
|
||||
|
||||
Reference in New Issue
Block a user