Skip to content

Commit 8dd1c93

Browse files
committed
Search: Handle input being codename
1 parent a3b4fa6 commit 8dd1c93

File tree

1 file changed

+74
-4
lines changed

1 file changed

+74
-4
lines changed

index.php

Lines changed: 74 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,21 @@
7474
{
7575
window.dict = dict;
7676
window.dict_entries = Object.entries(window.dict).sort(([key1, value1], [key2, value2]) => value1.length - value2.length);
77+
window.ExportWarframes = ExportWarframes;
78+
window.ExportWeapons = ExportWeapons;
79+
window.ExportUpgrades = ExportUpgrades;
80+
window.ExportArcanes = ExportArcanes;
81+
window.ExportResources = ExportResources;
82+
window.ExportFlavour = ExportFlavour;
83+
window.ExportCustoms = ExportCustoms;
84+
window.ExportGear = ExportGear;
85+
window.ExportSentinels = ExportSentinels
86+
window.ExportRewards = ExportRewards;
87+
window.ExportRegions = ExportRegions;
88+
window.ExportEnemies = ExportEnemies;
89+
window.ExportTextIcons = ExportTextIcons;
90+
window.supplementalGlyphData = supplementalGlyphData;
91+
7792
window.ExportWarframes_entries = Object.entries(ExportWarframes);
7893
window.ExportWeapons_entries = Object.entries(ExportWeapons);
7994
window.ExportUpgrades_entries = Object.entries(ExportUpgrades);
@@ -84,10 +99,6 @@
8499
window.ExportGear_entries = Object.entries(ExportGear);
85100
window.ExportSentinels_entries = Object.entries(ExportSentinels)
86101
window.ExportRewards_entries = Object.entries(ExportRewards);
87-
window.ExportRegions = ExportRegions;
88-
window.ExportEnemies = ExportEnemies;
89-
window.ExportTextIcons = ExportTextIcons;
90-
window.supplementalGlyphData = supplementalGlyphData;
91102

92103
window.itemToRecipeMap = {};
93104
Object.entries(ExportRecipes).forEach(([uniqueName, recipe]) => {
@@ -191,6 +202,16 @@ function doQuery(query)
191202
});
192203
console.timeEnd("Sort results");
193204

205+
console.time("Try for direct result");
206+
{
207+
const direct_result = getResultFromUniqueName(query);
208+
if (direct_result)
209+
{
210+
results.unshift(direct_result);
211+
}
212+
}
213+
console.timeEnd("Try for direct result");
214+
194215
const tags_shown = {};
195216
document.getElementById("results").textContent = results.length == 0 ? "Found 0 results." : "";
196217
results.forEach(result =>
@@ -679,6 +700,55 @@ function resolveTagsToUses(results)
679700
}
680701
return res;
681702
}
703+
704+
function getResultFromUniqueName(uniqueName)
705+
{
706+
let entry = ExportWarframes[uniqueName];
707+
if (entry)
708+
{
709+
return { type: "warframe", key: uniqueName, value: entry };
710+
}
711+
entry = ExportWeapons[uniqueName];
712+
if (entry)
713+
{
714+
return { type: "weapon", key: uniqueName, value: entry };
715+
}
716+
entry = ExportUpgrades[uniqueName];
717+
if (entry)
718+
{
719+
return { type: "upgrade", key: uniqueName, value: entry };
720+
}
721+
entry = ExportArcanes[uniqueName];
722+
if (entry)
723+
{
724+
return { type: "arcane", key: uniqueName, value: entry };
725+
}
726+
entry = ExportResources[uniqueName];
727+
if (entry)
728+
{
729+
return { type: "resource", key: uniqueName, value: entry };
730+
}
731+
entry = ExportFlavour[uniqueName];
732+
if (entry)
733+
{
734+
return { type: "flavour", key: uniqueName, value: entry };
735+
}
736+
entry = ExportCustoms[uniqueName];
737+
if (entry)
738+
{
739+
return { type: "custom", key: uniqueName, value: entry };
740+
}
741+
entry = ExportGear[uniqueName];
742+
if (entry)
743+
{
744+
return { type: "gear", key: uniqueName, value: entry };
745+
}
746+
entry = ExportSentinels[uniqueName];
747+
if (entry)
748+
{
749+
return { type: "sentinel", key: uniqueName, value: entry };
750+
}
751+
}
682752
</script>
683753
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
684754
</body>

0 commit comments

Comments
 (0)