abdelhaqueidali commited on
Commit
e39bd11
·
verified ·
1 Parent(s): 9ef0e3e

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +10 -42
index.html CHANGED
@@ -110,7 +110,7 @@
110
  <label><input type="radio" name="searchType" value="contains" checked>Contains</label>
111
  <label><input type="radio" name="searchType" value="startsWith">Starts With</label>
112
  <label><input type="radio" name="searchType" value="exact">Exact</label>
113
- <label><input type="checkbox" id="wordBoundary">Word Boundary</label>
114
  </div>
115
 
116
 
@@ -128,7 +128,7 @@
128
  const resultsList = document.getElementById('results');
129
  const errorMessageContainer = document.getElementById('errorMessageContainer');
130
  const searchTypeRadios = document.getElementsByName('searchType');
131
- const wordBoundaryCheckbox = document.getElementById('wordBoundary');
132
 
133
  let excelData = [];
134
  let mapping = {};
@@ -289,7 +289,7 @@ function performSearch() {
289
  }
290
 
291
  const searchType = Array.from(searchTypeRadios).find(radio => radio.checked).value;
292
- const useWordBoundary = wordBoundaryCheckbox.checked;
293
 
294
  let filteredData = [];
295
 
@@ -308,27 +308,9 @@ function performSearch() {
308
  if(columnIndex === mainWordColumn || mapping[columnIndex]){ //Prioritize the main columns
309
 
310
  const normalizedCell = normalizeText(cell);
311
- if (useWordBoundary) {
312
- const regex = new RegExp(`\\b${searchTerm}\\b`, 'i');
313
- if (regex.test(normalizedCell)) {
314
- if (normalizedCell === searchTerm) {
315
- exactMatches.push(row);
316
- }
317
- else if(normalizedCell.startsWith(searchTerm)){
318
- startsWithMatches.push(row);
319
- }
320
- else if(normalizedCell.endsWith(searchTerm)){
321
- endsWithMatches.push(row)
322
- }
323
- else{
324
- otherContainsMatches.push(row)
325
- }
326
- rowMatches = true;
327
 
328
- }
329
- }
330
- else
331
- {
332
  if (normalizedCell.includes(searchTerm)) {
333
  if (normalizedCell === searchTerm) {
334
  exactMatches.push(row);
@@ -344,11 +326,9 @@ function performSearch() {
344
  }
345
  rowMatches = true;
346
  }
347
-
348
- }
349
  }
350
  });
351
- // if(rowMatches) filteredData.push(row)
352
 
353
  });
354
  filteredData = [...new Set([...exactMatches, ...startsWithMatches,...endsWithMatches, ...otherContainsMatches])]; // Remove duplicates, and combine
@@ -360,15 +340,8 @@ function performSearch() {
360
  const columnIndex = String.fromCharCode('A'.charCodeAt(0) + index);
361
  if(columnIndex === mainWordColumn || mapping[columnIndex]){ //Prioritize the main columns
362
  const normalizedCell = normalizeText(cell);
363
- if (useWordBoundary) {
364
- const regex = new RegExp(`^\\b${searchTerm}`, 'i');
365
- return regex.test(normalizedCell);
366
-
367
- }
368
- else
369
- {
370
  return normalizedCell.startsWith(searchTerm);
371
- }
372
  }
373
  return false;
374
  }));
@@ -380,14 +353,9 @@ function performSearch() {
380
  if(columnIndex === mainWordColumn || mapping[columnIndex]){ //Prioritize the main columns
381
 
382
  const normalizedCell = normalizeText(cell);
383
-
384
- if (useWordBoundary) {
385
- const regex = new RegExp(`^\\b${searchTerm}\\b$`, 'i'); // ^ and $ for start and end
386
- return regex.test(normalizedCell);
387
- }
388
- else {
389
  return normalizedCell === searchTerm; // Strict equality
390
- }
391
  }
392
  return false;
393
  }));
@@ -407,7 +375,7 @@ function performSearch() {
407
  searchTypeRadios.forEach(radio => {
408
  radio.addEventListener('change', performSearch);
409
  });
410
- wordBoundaryCheckbox.addEventListener('change', performSearch);
411
 
412
 
413
 
 
110
  <label><input type="radio" name="searchType" value="contains" checked>Contains</label>
111
  <label><input type="radio" name="searchType" value="startsWith">Starts With</label>
112
  <label><input type="radio" name="searchType" value="exact">Exact</label>
113
+ <!-- Word Boundary checkbox removed -->
114
  </div>
115
 
116
 
 
128
  const resultsList = document.getElementById('results');
129
  const errorMessageContainer = document.getElementById('errorMessageContainer');
130
  const searchTypeRadios = document.getElementsByName('searchType');
131
+ // const wordBoundaryCheckbox = document.getElementById('wordBoundary'); // Removed
132
 
133
  let excelData = [];
134
  let mapping = {};
 
289
  }
290
 
291
  const searchType = Array.from(searchTypeRadios).find(radio => radio.checked).value;
292
+ // const useWordBoundary = wordBoundaryCheckbox.checked; // Removed
293
 
294
  let filteredData = [];
295
 
 
308
  if(columnIndex === mainWordColumn || mapping[columnIndex]){ //Prioritize the main columns
309
 
310
  const normalizedCell = normalizeText(cell);
311
+ // Removed word boundary logic
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
312
 
313
+
 
 
 
314
  if (normalizedCell.includes(searchTerm)) {
315
  if (normalizedCell === searchTerm) {
316
  exactMatches.push(row);
 
326
  }
327
  rowMatches = true;
328
  }
 
 
329
  }
330
  });
331
+
332
 
333
  });
334
  filteredData = [...new Set([...exactMatches, ...startsWithMatches,...endsWithMatches, ...otherContainsMatches])]; // Remove duplicates, and combine
 
340
  const columnIndex = String.fromCharCode('A'.charCodeAt(0) + index);
341
  if(columnIndex === mainWordColumn || mapping[columnIndex]){ //Prioritize the main columns
342
  const normalizedCell = normalizeText(cell);
343
+ // Removed word boundary logic
 
 
 
 
 
 
344
  return normalizedCell.startsWith(searchTerm);
 
345
  }
346
  return false;
347
  }));
 
353
  if(columnIndex === mainWordColumn || mapping[columnIndex]){ //Prioritize the main columns
354
 
355
  const normalizedCell = normalizeText(cell);
356
+ // Removed word boundary logic
 
 
 
 
 
357
  return normalizedCell === searchTerm; // Strict equality
358
+
359
  }
360
  return false;
361
  }));
 
375
  searchTypeRadios.forEach(radio => {
376
  radio.addEventListener('change', performSearch);
377
  });
378
+ // wordBoundaryCheckbox.addEventListener('change', performSearch); // Removed
379
 
380
 
381