DaxDuckDex - enhance search function

When searching, match also accented letter

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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;

})();