diff --git a/index.html b/index.html
index 51eaf38..b01d5d3 100644
--- a/index.html
+++ b/index.html
@@ -73,8 +73,12 @@
// 用 pako 解壓縮
var csvData = pako.inflate(uintArray, { to: 'string' });
- // 文字框改變時 call searchCSV()
+ // CSV 資料預處理
+ var lines = csvData.split('\n').map(line => {
+ return [removeAccents(line.toLowerCase()), line];
+ });
+ // 文字框改變時 call searchCSV()
function searchCSV() {
var input = removeAccents(document.getElementById('searchInput').value.toLowerCase());
@@ -84,14 +88,12 @@
return;
}
- var lines = csvData.split('\n');
var matchingLines = '';
// 搜尋每一行
for (var i = 0; i < lines.length; i++) {
- var line = removeAccents(lines[i].toLowerCase());
- if (line.includes(input)) {
- matchingLines += lines[i] + '
';
+ if (lines[i][0].includes(input)) {
+ matchingLines += lines[i][1] + '
';
}
}