vomebook commited on
Commit
c8e7ebe
·
1 Parent(s): c35d100

Upload app.js

Browse files
Files changed (1) hide show
  1. static/app.js +8 -2
static/app.js CHANGED
@@ -335,7 +335,7 @@ function applyMobileMode() {
335
  document.body.classList.toggle("mobile", STATE.isMobile);
336
  document.body.classList.toggle("force-desktop", !STATE.isMobile);
337
  if (DOM.mobileToggleIcon) {
338
- DOM.mobileToggleIcon.className = STATE.isMobile ? "ui-icon ui-icon-desktop" : "ui-icon ui-icon-phone";
339
  }
340
  if (DOM.sidebarExpandBtn) {
341
  DOM.sidebarExpandBtn.style.display = (!STATE.isMobile && STATE.source) ? "" : "none";
@@ -408,17 +408,23 @@ function loadUrlState() {
408
  }
409
 
410
  async function ensureFulltextLoaded() {
 
411
  if (!STATE.fulltextManifest) {
 
412
  STATE.fulltextManifest = await API.fulltextManifest();
413
  }
414
  const sourceSlugs = STATE.source ? [STATE.source] : (STATE.selectedSources.length ? STATE.selectedSources : STATE.sources.map((source) => source.slug));
 
 
415
  for (const slug of sourceSlugs) {
416
  if (STATE.fulltextLoaded[slug]) continue;
417
  const item = (STATE.fulltextManifest.sources || []).find((source) => source.slug === slug);
418
  if (!item) continue;
419
- showToast(`加载全文索引: ${slug}`);
420
  STATE.fulltextLoaded[slug] = await API.fulltextIndex(item.path);
 
421
  }
 
422
  }
423
 
424
  function scoreFulltextDoc(docId, payload, queryTokens, exactQuery) {
 
335
  document.body.classList.toggle("mobile", STATE.isMobile);
336
  document.body.classList.toggle("force-desktop", !STATE.isMobile);
337
  if (DOM.mobileToggleIcon) {
338
+ DOM.mobileToggleIcon.className = STATE.isMobile ? "ui-icon ui-icon-phone" : "ui-icon ui-icon-desktop";
339
  }
340
  if (DOM.sidebarExpandBtn) {
341
  DOM.sidebarExpandBtn.style.display = (!STATE.isMobile && STATE.source) ? "" : "none";
 
408
  }
409
 
410
  async function ensureFulltextLoaded() {
411
+ let loadedCount = 0;
412
  if (!STATE.fulltextManifest) {
413
+ showToast("正在加载全文索引,首次可能较慢...", 5000);
414
  STATE.fulltextManifest = await API.fulltextManifest();
415
  }
416
  const sourceSlugs = STATE.source ? [STATE.source] : (STATE.selectedSources.length ? STATE.selectedSources : STATE.sources.map((source) => source.slug));
417
+ const pendingSlugs = sourceSlugs.filter((slug) => !STATE.fulltextLoaded[slug]);
418
+ if (pendingSlugs.length) showToast("正在加载全文索引,首次可能较慢...", 5000);
419
  for (const slug of sourceSlugs) {
420
  if (STATE.fulltextLoaded[slug]) continue;
421
  const item = (STATE.fulltextManifest.sources || []).find((source) => source.slug === slug);
422
  if (!item) continue;
423
+ showToast(`加载全文索引: ${slug}`, 5000);
424
  STATE.fulltextLoaded[slug] = await API.fulltextIndex(item.path);
425
+ loadedCount += 1;
426
  }
427
+ if (loadedCount) showToast("全文索引加载完成");
428
  }
429
 
430
  function scoreFulltextDoc(docId, payload, queryTokens, exactQuery) {