Teambuilder: Support searching by middle word

Previously, you could search by the first or last word in a three-word
phrase, but not the middle so "High" and "Kick" but not "Jump" in
"High Jump Kick". This lets you search by all three.
This commit is contained in:
Guangcong Luo
2016-09-12 17:14:10 -07:00
parent b76912b407
commit 9f361be5df

View File

@@ -89,6 +89,12 @@ function requireNoCache(pathSpec) {
if (acronym && !(acronym in Tools.data.Aliases) || toId(Tools.data.Aliases[acronym]) !== id) {
index.push('' + acronym + ' ' + type + ' ' + id + ' 0');
}
let i2 = name.lastIndexOf(' ', i - 1);
if (i2 < 0) i2 = name.lastIndexOf('-', i - 1);
if (i2 >= 0) {
index.push('' + toId(name.slice(i2)) + ' ' + type + ' ' + id + ' ' + toId(name.slice(0, i2)).length);
}
}
for (const id in Tools.data.Pokedex) {
const name = Tools.data.Pokedex[id].species;