DaxDuckDex - enhance search function

When searching, match also accented letter

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         DaxDuckDex - enhance search function
// @namespace    https://github.com/Procyon-b
// @version      0.9.1
// @description  When searching, match also accented letter
// @author       Achernar
// @match        https://makdulac.com/daxduckdex*
// @grant        none
// @run-at  document-end
// ==/UserScript==

(function() {

function new_filterAndSortCharacters() {
  const searchTerm = this.dom.searchInput.value.toLowerCase();
  this.currentPage = 1;
  let RE=new RegExp(searchTerm.trim().replace(/([\\\.\?\[\]\(\)])/g, '\\$1' ).replace(/[aäâáàã]/g,'[aäâáàã]').replace(/[eëêéè]/g,'[eëêéè]').replace(/[iìíîï]/g,'[iìíîï]').replace(/[oôöóòõ]/g,'[oôöóòõ]').replace(/[uûüúù]/g,'[uûüúù]').replace(/[yÿý]/g,'[yÿý]').replace(/[nñ]/g,'[nñ]'), 'i');

  let filtered = this.allCharacters.filter(character => {
    const nameMatch = RE.test(character.name);
    const discovererMatch = character.discoverer && RE.test(character.discoverer);
    const tagsMatch = character.tags && character.tags.some(tag => RE.test(tag));
    return nameMatch || discovererMatch || tagsMatch;
    });

  this.filteredCharacters = this.sortCharacters(filtered);

  // Track search for analytics (privacy-first)
  if (searchTerm.length > 0 && window.daxAnalytics) {
    window.daxAnalytics.trackSearch(searchTerm, this.filteredCharacters.length);
    }

  this.displayCharacters();
  this.updateStats();
  this.toggleClearButton();
  this.addDiscovererSearchFeedback(searchTerm);
}


DaxDuckDex.prototype.filterAndSortCharacters = new_filterAndSortCharacters;

})();