ruidiao commited on
Commit
3409b6b
·
1 Parent(s): d635592

Upload 3 files

Browse files
Files changed (2) hide show
  1. index.html +14 -2
  2. main.js +10 -9
index.html CHANGED
@@ -3,7 +3,18 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Client-Side Quote Search</title>
 
 
 
 
 
 
 
 
 
 
 
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  </head>
9
  <body class="bg-gray-100 flex items-center justify-center min-h-screen">
@@ -26,7 +37,8 @@
26
  <button id="delete-data-button" class="bg-red-500 text-white px-3 py-1 rounded-lg text-sm hover:bg-red-600 focus:outline-none focus:ring-2 focus:ring-red-500">Delete Cached Data</button>
27
  </div>
28
  </div>
29
- <h1 class="text-3xl font-bold text-center text-gray-800 mb-4">Client-Side Quote Search</h1>
 
30
 
31
  <div id="data-info" class="text-center text-gray-600 mb-2"></div>
32
  <div id="status" class="text-center text-gray-600 mb-4"></div>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Quote Search — Client-side, Offline</title>
7
+ <meta name="description" content="Quote Search: Fast, private quote search that runs entirely in your browser. Embeddings-based, client-side, and offline-capable for secure local usage.">
8
+ <meta name="keywords" content="quote search, client-side search, offline search, embeddings, privacy, local model, quotes">
9
+ <meta name="author" content="Rui Diao">
10
+ <!-- Open Graph / Facebook -->
11
+ <meta property="og:title" content="Quote Search — Client-side, Offline">
12
+ <meta property="og:description" content="Fast, private quote search that runs in your browser. No data leaves your device.">
13
+ <meta property="og:type" content="website">
14
+ <!-- Twitter -->
15
+ <meta name="twitter:card" content="summary">
16
+ <meta name="twitter:title" content="Quote Search — Client-side, Offline">
17
+ <meta name="twitter:description" content="Fast, private quote search that runs in your browser. No data leaves your device.">
18
  <script src="https://cdn.tailwindcss.com"></script>
19
  </head>
20
  <body class="bg-gray-100 flex items-center justify-center min-h-screen">
 
37
  <button id="delete-data-button" class="bg-red-500 text-white px-3 py-1 rounded-lg text-sm hover:bg-red-600 focus:outline-none focus:ring-2 focus:ring-red-500">Delete Cached Data</button>
38
  </div>
39
  </div>
40
+ <h1 class="text-3xl font-bold text-center text-gray-800 mb-2">Quote Search</h1>
41
+ <p class="text-center text-sm text-gray-600 mb-4">Runs locally in your browser — Private &amp; Offline</p>
42
 
43
  <div id="data-info" class="text-center text-gray-600 mb-2"></div>
44
  <div id="status" class="text-center text-gray-600 mb-4"></div>
main.js CHANGED
@@ -65,15 +65,16 @@ worker.onmessage = (event) => {
65
  searchButton.disabled = false; // Ensure button is enabled
66
  // Render message with an inline info icon that has an accessible tooltip
67
  const sizeMB = formatBytesToMB(payload.size);
68
- const tooltip = `This download contains the local model and pre-built index (~${sizeMB} MB). It enables fast, private, offline-capable searches entirely in your browser. It's a one-time download and you can delete the files anytime to free space.`;
69
- statusDiv.innerHTML = `Download <strong>~${sizeMB} MB</strong> once for fast, private searches deletable anytime.` +
70
- ` <span class="inline-block ml-2 align-middle cursor-help" role="img" aria-label="More info" title="${tooltip}">
71
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4 text-gray-500" style="vertical-align:middle;">
72
- <circle cx="12" cy="12" r="10"></circle>
73
- <line x1="12" y1="8" x2="12" y2="12"></line>
74
- <circle cx="12" cy="16" r="1"></circle>
75
- </svg>
76
- </span>`;
 
77
  }
78
  } else if (type === 'dataDeleted') {
79
  // Show confirmation message briefly and then reload the page so the UI and worker state fully reset
 
65
  searchButton.disabled = false; // Ensure button is enabled
66
  // Render message with an inline info icon that has an accessible tooltip
67
  const sizeMB = formatBytesToMB(payload.size);
68
+ const exactSize = (payload.size / (1024 * 1024)).toFixed(2);
69
+ const tooltip = `Exact download size: ${exactSize} MB. Contains the local model + pre-built index for offline, client-side searches. Estimated download time depends on your connection.`;
70
+ // Friendly, non-scary message with accessible tooltip
71
+ statusDiv.innerHTML = `Heads‑up: one‑time download <strong>~${Math.round(sizeMB)} MB</strong> to enable fast, private searches in your browser. Runs locally delete anytime.` +
72
+ ` <button class="inline-block ml-2 align-middle text-gray-500" aria-label="More info" title="${tooltip}">` +
73
+ `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4" style="vertical-align:middle;">
74
+ <circle cx="12" cy="12" r="10"></circle>
75
+ <line x1="12" y1="8" x2="12" y2="12"></line>
76
+ <circle cx="12" cy="16" r="1"></circle>
77
+ </svg></button>`;
78
  }
79
  } else if (type === 'dataDeleted') {
80
  // Show confirmation message briefly and then reload the page so the UI and worker state fully reset