diff --git a/src/routes/more/+page.svelte b/src/routes/more/+page.svelte index 198751c..b355628 100644 --- a/src/routes/more/+page.svelte +++ b/src/routes/more/+page.svelte @@ -58,4 +58,9 @@ text-align: center; } } + @media (max-width: 380px) { + p { + font-size: 16px; + } + } \ No newline at end of file diff --git a/src/routes/more/corpus/+page.svelte b/src/routes/more/corpus/+page.svelte index 5e09942..6a23e8c 100644 --- a/src/routes/more/corpus/+page.svelte +++ b/src/routes/more/corpus/+page.svelte @@ -3,10 +3,117 @@ import Nav from '$lib/navigation/nav.svelte' const title = "Location Codes" + let val = { + crs: "", + tiploc: "", + stanox: "", + nlc: "", + name: "", + uic: "" + } + + async function getData(type = "", value = "") { + const url = `https://owlboard.info/api/v2/ref/locationCode/${type}/${value}` + const res = await fetch(url); + const data = await res.json(); + return data; + } + + async function processData(data) { + //console.log("data",JSON.stringify(data)) + val = { + crs: data[0]['3ALPHA'] || "None", + tiploc: data[0]['TIPLOC'] || "None", + stanox: data[0]['STANOX'] || "None", + nlc: data[0]['NLC'] || "None", + name: data[0]['NLCDESC'] || "None", + uic: data[0]['UIC'] || "None" + } + //console.log("val",JSON.stringify(val)); + } + + async function submit() { + let data = []; + if (val?.crs) { + data = await getData("crs", val.crs); + } else if (val?.tiploc) { + data = await getData("tiploc", val.tiploc); + } else if (val?.stanox) { + data = await getData("stanox", val.stanox); + } else if (val?.nlc) { + data = await getData("nlc", val.nlc); + } else { + return; + } + processData(data); + } + + async function reset() { + val = { + crs: "", + tiploc: "", + stanox: "", + nlc: "", + name: "", + uic: "", + } + } + -
+
+

Enter one of the codes below and press submit.

+

OwlBoard doesn't currently support searching by name or UIC.

+

Some locations only have some applicable location codes.

+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ + +
+
-