dev merge (#163)
All checks were successful
continuous-integration/drone/push Build is passing

Co-authored-by: soraefir
Co-authored-by: sora-ext
Reviewed-on: #163
This commit is contained in:
2025-03-05 00:11:11 +01:00
parent 78b080dc05
commit 803dd84858
34 changed files with 749 additions and 336 deletions

View File

@ -1,4 +1,4 @@
export const throttle = (func: () => void, wait: number) => {
export const throttle = (func: (...args: any[]) => any, wait: number) => {
var lastTime = 0;
var timeoutId: ReturnType<typeof setTimeout> | undefined;
var lastArgs: any[];
@ -54,7 +54,7 @@ export const save = (id: string, v: journey) =>
export const query_nominatim = (
q: string,
bb: any,
f: (v: string) => Boolean = () => true
f: (v: NominatimResult) => Boolean = () => true
) => {
if (q.length == 0) return Promise.resolve([])
let url = new URL("/api/place/" + q, window.location.origin);
@ -141,7 +141,7 @@ export const icon_type = (item: string | NominatimResult): string => {
"nature_reserve",
],
"dice-five": ["water_park", "theme_park", "casino"],
"": ["?", "neighbourhood", "quarter", "highway"],
"": ["?", "neighbourhood", "quarter", "highway", "place"],
};
for (let k in types) {
@ -150,3 +150,13 @@ export const icon_type = (item: string | NominatimResult): string => {
console.log(item.display_name, item.category, item.type);
return "question";
};
export const get_filter = function (f: string) {
switch (f) {
case "hotel": return is_hotel_type;
case "restaurant": return is_restauration_type;
case "place": return is_attraction_type;
case "other":
default: return () => true;
}
}