vomebook commited on
Commit
dc91f34
Β·
1 Parent(s): 7142394

Upload 2 files

Browse files
Files changed (2) hide show
  1. static/app.js +13 -0
  2. static/index.html +8 -0
static/app.js CHANGED
@@ -87,6 +87,7 @@ const STATE = {
87
  isLoading: false,
88
  hasMore: false,
89
  searchFolders: true,
 
90
  browserPath: "",
91
  repoList: [],
92
  extensionList: [],
@@ -155,6 +156,7 @@ function cacheDOM() {
155
  DOM.extDeselectAll = $("#ext-deselect-all");
156
  DOM.sidebarExpandBtn = $("#sidebar-expand-btn");
157
  DOM.searchFoldersToggle = $("#search-folders-toggle");
 
158
  }
159
 
160
  /* ═══════════════════════════════════════════════════════════
@@ -225,6 +227,7 @@ const API = {
225
  if (STATE.filterMaxSize !== null) body.max_size = STATE.filterMaxSize;
226
  body.sort = DOM.sortSelect.value;
227
  if (!STATE.searchFolders) body.search_folders = false;
 
228
 
229
  const fetchOptions = {
230
  method: "POST",
@@ -373,6 +376,7 @@ function syncStateToURL(replace = true) {
373
  if (STATE.filterMinSize !== null) params.set("min_size", STATE.filterMinSize);
374
  if (STATE.filterMaxSize !== null) params.set("max_size", STATE.filterMaxSize);
375
  if (!STATE.searchFolders) params.set("search_folders", "false");
 
376
 
377
  const qs = params.toString();
378
  const path = STATE.mode === "global" ? "/" : `/${STATE.repo}`;
@@ -413,6 +417,9 @@ function syncURLToState() {
413
  STATE.searchFolders = searchFolders !== "false";
414
  DOM.searchFoldersToggle.checked = STATE.searchFolders;
415
 
 
 
 
416
  if (params.get("wide") === "1") {
417
  DOM.leftSidebar.classList.add("expanded-wide");
418
  DOM.sidebarExpandBtn.textContent = "β†’";
@@ -1246,6 +1253,12 @@ async function init() {
1246
  STATE.results = [];
1247
  doSearch();
1248
  });
 
 
 
 
 
 
1249
  DOM.sortSelect.addEventListener("change", () => {
1250
  STATE.page = 1;
1251
  STATE.results = [];
 
87
  isLoading: false,
88
  hasMore: false,
89
  searchFolders: true,
90
+ exact: false,
91
  browserPath: "",
92
  repoList: [],
93
  extensionList: [],
 
156
  DOM.extDeselectAll = $("#ext-deselect-all");
157
  DOM.sidebarExpandBtn = $("#sidebar-expand-btn");
158
  DOM.searchFoldersToggle = $("#search-folders-toggle");
159
+ DOM.exactSearchToggle = $("#exact-search-toggle");
160
  }
161
 
162
  /* ═══════════════════════════════════════════════════════════
 
227
  if (STATE.filterMaxSize !== null) body.max_size = STATE.filterMaxSize;
228
  body.sort = DOM.sortSelect.value;
229
  if (!STATE.searchFolders) body.search_folders = false;
230
+ if (STATE.exact) body.exact = true;
231
 
232
  const fetchOptions = {
233
  method: "POST",
 
376
  if (STATE.filterMinSize !== null) params.set("min_size", STATE.filterMinSize);
377
  if (STATE.filterMaxSize !== null) params.set("max_size", STATE.filterMaxSize);
378
  if (!STATE.searchFolders) params.set("search_folders", "false");
379
+ if (STATE.exact) params.set("exact", "1");
380
 
381
  const qs = params.toString();
382
  const path = STATE.mode === "global" ? "/" : `/${STATE.repo}`;
 
417
  STATE.searchFolders = searchFolders !== "false";
418
  DOM.searchFoldersToggle.checked = STATE.searchFolders;
419
 
420
+ STATE.exact = params.get("exact") === "1";
421
+ DOM.exactSearchToggle.checked = STATE.exact;
422
+
423
  if (params.get("wide") === "1") {
424
  DOM.leftSidebar.classList.add("expanded-wide");
425
  DOM.sidebarExpandBtn.textContent = "β†’";
 
1253
  STATE.results = [];
1254
  doSearch();
1255
  });
1256
+ DOM.exactSearchToggle.addEventListener("change", () => {
1257
+ STATE.exact = DOM.exactSearchToggle.checked;
1258
+ STATE.page = 1;
1259
+ STATE.results = [];
1260
+ doSearch();
1261
+ });
1262
  DOM.sortSelect.addEventListener("change", () => {
1263
  STATE.page = 1;
1264
  STATE.results = [];
static/index.html CHANGED
@@ -171,6 +171,14 @@
171
  <span class="toggle-switch"></span>
172
  </label>
173
  </div>
 
 
 
 
 
 
 
 
174
 
175
  <!-- Repo Filter -->
176
  <div id="filter-repo-section" class="filter-section">
 
171
  <span class="toggle-switch"></span>
172
  </label>
173
  </div>
174
+ <!-- η²Ύε‡†ζœη΄’εΌ€ε…³οΌšεΌ€ε―εŽθ·³θΏ‡ζ¨‘η³ŠεŒΉι…οΌŒη›΄ζŽ₯子串搜紒 -->
175
+ <div class="filter-section" id="exact-search-section">
176
+ <label class="toggle-row">
177
+ <span class="toggle-label">η²Ύε‡†ζœη΄’</span>
178
+ <input type="checkbox" id="exact-search-toggle">
179
+ <span class="toggle-switch"></span>
180
+ </label>
181
+ </div>
182
 
183
  <!-- Repo Filter -->
184
  <div id="filter-repo-section" class="filter-section">