summaryrefslogtreecommitdiff
path: root/http
diff options
context:
space:
mode:
Diffstat (limited to 'http')
-rw-r--r--http/_res/ranking.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/http/_res/ranking.js b/http/_res/ranking.js
index c85df2b..2038e71 100644
--- a/http/_res/ranking.js
+++ b/http/_res/ranking.js
@@ -100,15 +100,31 @@ var ranking = {
filterRows : function(params) {
$('table.data-table tbody tr').remove();
var displayRows = [];
+ const collator = new Intl.Collator('pl', {sensitivity: 'base', usage: 'search'});
+ var contains = function(haystack, needle) {
+ if (needle.length === 0) {
+ return true;
+ }
+ haystack = haystack.normalize('NFC');
+ needle = needle.normalize('NFC');
+ let scan = 0;
+ for (; scan + needle.length <= haystack.length; scan += 1) {
+ const slice = haystack.slice(scan, scan + needle.length);
+ if (collator.compare(needle, slice) === 0) {
+ return true;
+ }
+ }
+ return false;
+ };
ranking.rankingData.forEach(function(row) {
var hidden = false;
params.forEach(function(value, param) {
if (param == 'name') {
- if (row['player'].trim().toLowerCase().search(value.join('')) == -1) {
+ if (!contains(row['player'].trim(), value.join(''))) {
hidden = true;
}
} else if (param == 'club') {
- if (row['club'].trim().toLowerCase().search(value.join('')) == -1) {
+ if (!contains(row['club'].trim(), value.join(''))) {
hidden = true;
}
} else if (param.substr(0, 4) != 'page') {