Update editor.js

This commit is contained in:
Aleksandr Statciuk 2022-11-17 09:21:00 +03:00
parent 42153d6b45
commit 9e7a3611be

View file

@ -90,7 +90,8 @@ async function getOptions(channel) {
let variants = [] let variants = []
variants.push(`${channel.name.trim()} | ${generateCode(channel.name, defaultCountry)}${newLabel}`) variants.push(`${channel.name.trim()} | ${generateCode(channel.name, defaultCountry)}${newLabel}`)
similar.forEach(i => { similar.forEach(i => {
variants.push(`${i.name} | ${i.id} [api]`) let alt_names = i.alt_names.length ? ` (${i.alt_names.join(',')})` : ''
variants.push(`${i.name}${alt_names} | ${i.id} [api]`)
}) })
variants.push(`Overwrite...`) variants.push(`Overwrite...`)
variants.push(`Skip...`) variants.push(`Skip...`)
@ -102,10 +103,10 @@ async function getSimilar(list, channel) {
return list.filter(i => return list.filter(i =>
i.name i.name
.toLowerCase() .toLowerCase()
.replace(/\s|-|:/gi, '') .replace(/[^a-z0-9]/gi, '')
.startsWith( .startsWith(
channel.name channel.name
.replace(/(\s|-|:)/gi, '') .replace(/[^a-z0-9]/gi, '')
.slice(0, 8) .slice(0, 8)
.toLowerCase() .toLowerCase()
) )