From b5918a47cb50bd2f216406e9c84d15c509afda56 Mon Sep 17 00:00:00 2001 From: sora-ext Date: Mon, 10 Mar 2025 17:23:07 +0100 Subject: [PATCH] Update src/client/helper/journey.ts --- src/client/helper/journey.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/client/helper/journey.ts b/src/client/helper/journey.ts index a919a2e..60cb5c1 100644 --- a/src/client/helper/journey.ts +++ b/src/client/helper/journey.ts @@ -1,4 +1,4 @@ -import journey_wrapper from './types/wrapper'; +import journey_wrapper from '../types/wrapper'; /* LIST HELPERS */ export const filter_selected = function (journey: journey_wrapper, list: geoloc[], step: boolean) { @@ -38,4 +38,15 @@ export const journey_del_place = function (journey: journey_wrapper, tpe: String case "flight": return journey.leg_get().travel.splice(idx, 1); default: return true; } +} + +export const journey_from_url = function () { + const path = window.location.pathname.slice(1).split('/') + const hash = window.location.hash.slice(1).split('_') + return { + edit: ["view", "short"].indexOf(path.at(0) || "") == -1, + id: path.at(-1) || String.gen_id(16).toString(), + leg: parseInt(hash.at(0) || '0'), + day: parseInt(hash.at(1) || '0') + } } \ No newline at end of file