Series as a dropdown and filter, fix genre list in details modal

This commit is contained in:
advplyr 2021-08-22 08:52:37 -05:00
parent f70e1beca1
commit c3fd9045a8
11 changed files with 310 additions and 65 deletions

View file

@ -23,4 +23,21 @@ const levenshteinDistance = (str1, str2, caseSensitive = false) => {
}
return track[str2.length][str1.length];
}
module.exports.levenshteinDistance = levenshteinDistance
module.exports.levenshteinDistance = levenshteinDistance
const cleanString = (str) => {
if (!str) return ''
// replace accented characters: https://stackoverflow.com/a/49901740/7431543
str = str.normalize('NFD').replace(/[\u0300-\u036f]/g, "")
const availableChars = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
const cleanChar = (char) => availableChars.indexOf(char) < 0 ? '?' : char
var cleaned = ''
for (let i = 0; i < str.length; i++) {
cleaned += cleanChar(str[i])
}
return cleaned
}
module.exports.cleanString = cleanString