Prettier formatting
This commit is contained in:
parent
039b57efe7
commit
7dc24646b9
@ -1,11 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
extends: ['eslint:recommended', 'plugin:svelte/recommended', 'prettier'],
|
extends: ['eslint:recommended', 'plugin:svelte/recommended', 'prettier'],
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
"files": ["**/*.svelte"]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
ecmaVersion: 2020,
|
ecmaVersion: 2020,
|
||||||
@ -17,6 +12,6 @@ module.exports = {
|
|||||||
node: true
|
node: true
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
indent: ['error', 2, {SwitchCase: 2}],
|
indent: ['error', 2, { SwitchCase: 2 }]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
{
|
{
|
||||||
"useTabs": true,
|
"useTabs": false,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"semi": true,
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"trailingComma": "none",
|
"trailingComma": "none",
|
||||||
"printWidth": 100,
|
"printWidth": 80,
|
||||||
"plugins": ["prettier-plugin-svelte"],
|
"plugins": ["prettier-plugin-svelte"],
|
||||||
"pluginSearchDirs": ["."],
|
"pluginSearchDirs": ["."],
|
||||||
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
|
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
|
||||||
|
39
src/app.css
39
src/app.css
@ -6,31 +6,31 @@
|
|||||||
url('/font/firamono/firamono-regular.ttf') format('truetype');
|
url('/font/firamono/firamono-regular.ttf') format('truetype');
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'firamono';
|
font-family: 'firamono';
|
||||||
src: url('/font/firamono/firamono-500.woff2') format('woff2'),
|
src: url('/font/firamono/firamono-500.woff2') format('woff2'),
|
||||||
url('/font/firamono/firamono-500.woff') format('woff'),
|
url('/font/firamono/firamono-500.woff') format('woff'),
|
||||||
url('/font/firamono/firamono-500.ttf') format('truetype');
|
url('/font/firamono/firamono-500.ttf') format('truetype');
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'urwgothic';
|
font-family: 'urwgothic';
|
||||||
src: url('/font/urwgothic/urwgothic.woff2') format('woff2'),
|
src: url('/font/urwgothic/urwgothic.woff2') format('woff2'),
|
||||||
url('/font/urwgothic/urwgothic.woff') format('woff'),
|
url('/font/urwgothic/urwgothic.woff') format('woff'),
|
||||||
url('/font/urwgothic/urwgothic.ttf') format('truetype');
|
url('/font/urwgothic/urwgothic.ttf') format('truetype');
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'urwgothic';
|
font-family: 'urwgothic';
|
||||||
src: url('/font/urwgothic/urwgothicDemi.woff2') format('woff2'),
|
src: url('/font/urwgothic/urwgothicDemi.woff2') format('woff2'),
|
||||||
url('/font/urwgothic/urwgothicDemi.woff') format('woff'),
|
url('/font/urwgothic/urwgothicDemi.woff') format('woff'),
|
||||||
url('/font/urwgothic/urwgothicDemi.ttf') format('truetype');
|
url('/font/urwgothic/urwgothicDemi.ttf') format('truetype');
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* COLOR VARS */
|
/* COLOR VARS */
|
||||||
:root {
|
:root {
|
||||||
@ -49,24 +49,27 @@
|
|||||||
--second-alert-color: #e77f00; /* Use as second arg in radial gradient */
|
--second-alert-color: #e77f00; /* Use as second arg in radial gradient */
|
||||||
--main-warning-color: orange;
|
--main-warning-color: orange;
|
||||||
--board-name-color: #fcfc09;
|
--board-name-color: #fcfc09;
|
||||||
}
|
}
|
||||||
|
|
||||||
html{
|
html {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: var(--main-bg-color);
|
background-color: var(--main-bg-color);
|
||||||
background-image: radial-gradient(var(--second-bg-color), var(--main-bg-color));
|
background-image: radial-gradient(
|
||||||
|
var(--second-bg-color),
|
||||||
|
var(--main-bg-color)
|
||||||
|
);
|
||||||
color: var(--second-text-color);
|
color: var(--second-text-color);
|
||||||
font-family: urwgothic, sans-serif;
|
font-family: urwgothic, sans-serif;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding-bottom: 60px; /*Footer height*/
|
padding-bottom: 60px; /*Footer height*/
|
||||||
}
|
}
|
||||||
a {
|
a {
|
||||||
color: var(--link-color)
|
color: var(--link-color);
|
||||||
}
|
}
|
||||||
button:hover {
|
button:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<img src="/images/logo/wide_logo.svg" alt="Logo">
|
<img src="/images/logo/wide_logo.svg" alt="Logo" />
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
img {
|
img {
|
||||||
|
@ -1,19 +1,26 @@
|
|||||||
<script>
|
<script>
|
||||||
import Island from "$lib/islands/island.svelte";
|
import Island from '$lib/islands/island.svelte';
|
||||||
export let variables = {
|
export let variables = {
|
||||||
title: "Uninitialised",
|
title: 'Uninitialised',
|
||||||
action: "/",
|
action: '/',
|
||||||
placeholder: "Uninitialised",
|
placeholder: 'Uninitialised',
|
||||||
queryName: "uninitiailsed"
|
queryName: 'uninitiailsed'
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Island {variables}>
|
<Island {variables}>
|
||||||
<form action={variables.action}>
|
<form action={variables.action}>
|
||||||
<input class="form-input" type="text" id="input-headcode" name={variables.queryName} placeholder={variables.placeholder} autocomplete="off">
|
<input
|
||||||
<br>
|
class="form-input"
|
||||||
|
type="text"
|
||||||
|
id="input-headcode"
|
||||||
|
name={variables.queryName}
|
||||||
|
placeholder={variables.placeholder}
|
||||||
|
autocomplete="off"
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
<button type="submit">Submit</button>
|
<button type="submit">Submit</button>
|
||||||
</form>
|
</form>
|
||||||
</Island>
|
</Island>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@ -25,7 +32,8 @@
|
|||||||
border-radius: 50px;
|
border-radius: 50px;
|
||||||
border: none;
|
border: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
|
||||||
|
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
@ -36,7 +44,8 @@
|
|||||||
border: none;
|
border: none;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
|
||||||
|
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
background-color: var(--main-bg-color);
|
background-color: var(--main-bg-color);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
export let variables = {title:""}
|
export let variables = { title: '' };
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@ -8,13 +8,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
span {
|
span {
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
|
||||||
|
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
color: var(--main-text-color)
|
color: var(--main-text-color);
|
||||||
}
|
}
|
||||||
div {
|
div {
|
||||||
width: 85%;
|
width: 85%;
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
@ -22,5 +23,5 @@ div {
|
|||||||
padding: 10px;
|
padding: 10px;
|
||||||
background-color: var(--overlay-color);
|
background-color: var(--overlay-color);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -1,22 +1,23 @@
|
|||||||
<script>
|
<script>
|
||||||
import { fade } from "svelte/transition";
|
import { fade } from 'svelte/transition';
|
||||||
|
|
||||||
export let variables = {title:""}
|
export let variables = { title: '' };
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div in:fade={{duration: 150}} out:fade={{duration: 150}}>
|
<div in:fade={{ duration: 150 }} out:fade={{ duration: 150 }}>
|
||||||
<span>{variables.title}</span>
|
<span>{variables.title}</span>
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
span {
|
span {
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
|
||||||
|
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
||||||
color: var(--main-text-color);
|
color: var(--main-text-color);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
div {
|
div {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
@ -32,5 +33,5 @@ div {
|
|||||||
background-color: var(--overlay-color);
|
background-color: var(--overlay-color);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -1,14 +1,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import Island from "$lib/islands/island.svelte";
|
import Island from '$lib/islands/island.svelte';
|
||||||
import { ql } from "$lib/stores/quick-links.js"
|
import { ql } from '$lib/stores/quick-links.js';
|
||||||
export let variables = {
|
export let variables = {
|
||||||
title: "Quick Links",
|
title: 'Quick Links'
|
||||||
};
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Island {variables}>
|
<Island {variables}>
|
||||||
|
|
||||||
{#if $ql.length === 0}
|
{#if $ql.length === 0}
|
||||||
<p>Go to <a href="/more/settings">settings</a> to add your Quick Links</p>
|
<p>Go to <a href="/more/settings">settings</a> to add your Quick Links</p>
|
||||||
{/if}
|
{/if}
|
||||||
@ -25,7 +23,6 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</Island>
|
</Island>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@ -46,7 +43,8 @@
|
|||||||
border: none;
|
border: none;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
|
||||||
|
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
@ -54,4 +52,3 @@
|
|||||||
color: var(--link-color);
|
color: var(--link-color);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
@ -1,73 +1,72 @@
|
|||||||
<script>
|
<script>
|
||||||
import Island from "$lib/islands/island.svelte";
|
import Island from '$lib/islands/island.svelte';
|
||||||
import { ql } from "$lib/stores/quick-links.js";
|
import { ql } from '$lib/stores/quick-links.js';
|
||||||
export let variables = {
|
export let variables = {
|
||||||
title: "Quick Links",
|
title: 'Quick Links'
|
||||||
};
|
};
|
||||||
|
|
||||||
let qlData =[]
|
let qlData = [];
|
||||||
$: {
|
$: {
|
||||||
qlData = $ql;
|
qlData = $ql;
|
||||||
console.log(qlData);
|
console.log(qlData);
|
||||||
}
|
}
|
||||||
|
|
||||||
let saveButton = "Save"
|
let saveButton = 'Save';
|
||||||
|
|
||||||
async function timeout(ms) {
|
async function timeout(ms) {
|
||||||
return new Promise(resolve => setTimeout(resolve, ms));
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveQl() {
|
async function saveQl() {
|
||||||
// Fetch the content of all text entries within the island then run ql.set([ARRAY OF INPUT CONTENT])
|
// Fetch the content of all text entries within the island then run ql.set([ARRAY OF INPUT CONTENT])
|
||||||
const inputs = document.getElementsByClassName('qlInput');
|
const inputs = document.getElementsByClassName('qlInput');
|
||||||
let inputLinks = []
|
let inputLinks = [];
|
||||||
for (let item of inputs) {
|
for (let item of inputs) {
|
||||||
let text = item?.value;
|
let text = item?.value;
|
||||||
if (text !== '') {
|
if (text !== '') {
|
||||||
inputLinks.push(text);
|
inputLinks.push(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(inputLinks)
|
console.log(inputLinks);
|
||||||
ql.set(inputLinks)
|
ql.set(inputLinks);
|
||||||
saveButton = "✔"
|
saveButton = '✔';
|
||||||
await timeout(3000);
|
await timeout(3000);
|
||||||
saveButton = "Saved"
|
saveButton = 'Saved';
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearQl() {
|
function clearQl() {
|
||||||
ql.set([]);
|
ql.set([]);
|
||||||
saveButton = "Saved"
|
saveButton = 'Saved';
|
||||||
}
|
}
|
||||||
|
|
||||||
function addQlBox() {
|
function addQlBox() {
|
||||||
saveButton = "Save"
|
saveButton = 'Save';
|
||||||
const updatedQl = [...$ql, ""];
|
const updatedQl = [...$ql, ''];
|
||||||
$ql = updatedQl;
|
$ql = updatedQl;
|
||||||
ql.set(updatedQl);
|
ql.set(updatedQl);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleClick(event) {
|
function handleClick(event) {
|
||||||
// Handle the click event here
|
// Handle the click event here
|
||||||
console.log("Island Clicked");
|
console.log('Island Clicked');
|
||||||
// You can access the `variables` passed to the Island component here if needed
|
// You can access the `variables` passed to the Island component here if needed
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Island on:click={handleClick} {variables}>
|
<Island on:click={handleClick} {variables}>
|
||||||
{#if $ql.length === 0}
|
{#if $ql.length === 0}
|
||||||
<p>Click the + button to add links</p>
|
<p>Click the + button to add links</p>
|
||||||
{/if}
|
{/if}
|
||||||
<div id="buttons" class="buttons">
|
<div id="buttons" class="buttons">
|
||||||
<p>Quick links can be CRS Codes or Headcodes</p>
|
<p>Quick links can be CRS Codes or Headcodes</p>
|
||||||
{#each qlData as link}
|
{#each qlData as link}
|
||||||
<input class="qlInput" type="text" value={link}>
|
<input class="qlInput" type="text" value={link} />
|
||||||
{/each}
|
{/each}
|
||||||
<button on:click={addQlBox} id="qlAdd">+</button>
|
<button on:click={addQlBox} id="qlAdd">+</button>
|
||||||
</div>
|
</div>
|
||||||
<button on:click={saveQl}>{@html saveButton}</button>
|
<button on:click={saveQl}>{@html saveButton}</button>
|
||||||
<button on:click={clearQl}>Clear</button>
|
<button on:click={clearQl}>Clear</button>
|
||||||
</Island>
|
</Island>
|
||||||
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
p {
|
p {
|
||||||
@ -93,7 +92,8 @@
|
|||||||
border: none;
|
border: none;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
|
||||||
|
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
@ -107,7 +107,8 @@
|
|||||||
border: none;
|
border: none;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
|
||||||
|
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
background-color: var(--main-bg-color);
|
background-color: var(--main-bg-color);
|
||||||
|
@ -1,23 +1,20 @@
|
|||||||
<script>
|
<script>
|
||||||
import Island from "$lib/islands/island.svelte";
|
import Island from '$lib/islands/island.svelte';
|
||||||
export let resultObject = {
|
export let resultObject = {
|
||||||
results: true,
|
results: true,
|
||||||
title: "",
|
title: '',
|
||||||
resultLines: []
|
resultLines: []
|
||||||
};
|
};
|
||||||
|
|
||||||
let variables = {
|
let variables = {
|
||||||
title: resultObject.title
|
title: resultObject.title
|
||||||
}
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Island {variables}>
|
<Island {variables}>
|
||||||
|
|
||||||
{#each resultObject.resultLines as line}
|
{#each resultObject.resultLines as line}
|
||||||
<p>{line}</p>
|
<p>{line}</p>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
</Island>
|
</Island>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { fly } from "svelte/transition";
|
import { fly } from 'svelte/transition';
|
||||||
|
|
||||||
export let alerts = [];
|
export let alerts = [];
|
||||||
$: uniqueAlerts = [...new Set(alerts)];
|
$: uniqueAlerts = [...new Set(alerts)];
|
||||||
@ -7,11 +7,21 @@
|
|||||||
let displayAlerts = false;
|
let displayAlerts = false;
|
||||||
|
|
||||||
async function alertsToggle() {
|
async function alertsToggle() {
|
||||||
displayAlerts = !displayAlerts
|
displayAlerts = !displayAlerts;
|
||||||
}
|
}
|
||||||
|
|
||||||
function numberAsWord(number) {
|
function numberAsWord(number) {
|
||||||
const words = ['zero', 'one', 'two','three','four','five','six','seven','eight'];
|
const words = [
|
||||||
|
'zero',
|
||||||
|
'one',
|
||||||
|
'two',
|
||||||
|
'three',
|
||||||
|
'four',
|
||||||
|
'five',
|
||||||
|
'six',
|
||||||
|
'seven',
|
||||||
|
'eight'
|
||||||
|
];
|
||||||
let word = words[number];
|
let word = words[number];
|
||||||
if (word) {
|
if (word) {
|
||||||
return word;
|
return word;
|
||||||
@ -22,18 +32,24 @@
|
|||||||
|
|
||||||
<div id="block"><!--Prevent content slipping underneath the bar--></div>
|
<div id="block"><!--Prevent content slipping underneath the bar--></div>
|
||||||
<div id="bar" on:click={alertsToggle} on:keypress={alertsToggle}>
|
<div id="bar" on:click={alertsToggle} on:keypress={alertsToggle}>
|
||||||
<img src="/images/navigation/alert.svg" alt="">
|
<img src="/images/navigation/alert.svg" alt="" />
|
||||||
{#if uniqueAlerts.length == 1}
|
{#if uniqueAlerts.length == 1}
|
||||||
<p id="bartext">There is one active alert</p>
|
<p id="bartext">There is one active alert</p>
|
||||||
{:else if uniqueAlerts.length > 1}
|
{:else if uniqueAlerts.length > 1}
|
||||||
<p id="bartext">There are {numberAsWord(uniqueAlerts.length)} active alerts</p>
|
<p id="bartext">
|
||||||
|
There are {numberAsWord(uniqueAlerts.length)} active alerts
|
||||||
|
</p>
|
||||||
{:else}
|
{:else}
|
||||||
<p id="bartext">There are no active alerts</p>
|
<p id="bartext">There are no active alerts</p>
|
||||||
{/if}
|
{/if}
|
||||||
<p id="arrow" class:displayAlerts>V</p>
|
<p id="arrow" class:displayAlerts>V</p>
|
||||||
</div>
|
</div>
|
||||||
{#if displayAlerts}
|
{#if displayAlerts}
|
||||||
<div id="alerts" in:fly={{ y:-200, duration: 500}} out:fly={{ y: -200, duration: 800 }}>
|
<div
|
||||||
|
id="alerts"
|
||||||
|
in:fly={{ y: -200, duration: 500 }}
|
||||||
|
out:fly={{ y: -200, duration: 800 }}
|
||||||
|
>
|
||||||
{#each uniqueAlerts as msg}
|
{#each uniqueAlerts as msg}
|
||||||
<p class="alert">{@html msg}</p>
|
<p class="alert">{@html msg}</p>
|
||||||
{/each}
|
{/each}
|
||||||
@ -72,7 +88,7 @@
|
|||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}
|
||||||
#arrow{
|
#arrow {
|
||||||
color: white;
|
color: white;
|
||||||
font-family: Arial, Helvetica, sans-serif;
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
@ -103,7 +119,7 @@
|
|||||||
color: white;
|
color: white;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
margin:auto;
|
margin: auto;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
export let station = "";
|
export let station = '';
|
||||||
export let title = "Loading...";
|
export let title = 'Loading...';
|
||||||
import { onMount } from 'svelte'
|
import { onMount } from 'svelte';
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from '$lib/navigation/loading.svelte';
|
||||||
import OverlayIsland from '$lib/islands/overlay-island.svelte';
|
import OverlayIsland from '$lib/islands/overlay-island.svelte';
|
||||||
import AlertBar from './alert-bar.svelte';
|
import AlertBar from './alert-bar.svelte';
|
||||||
@ -43,9 +43,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (jsonData?.GetStationBoardResult?.locationName) {
|
if (jsonData?.GetStationBoardResult?.locationName) {
|
||||||
title = jsonData.GetStationBoardResult.locationName
|
title = jsonData.GetStationBoardResult.locationName;
|
||||||
} else {
|
} else {
|
||||||
title = requestedStation.toUpperCase()
|
title = requestedStation.toUpperCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,62 +54,64 @@
|
|||||||
isLoading = true; // Set loading state
|
isLoading = true; // Set loading state
|
||||||
try {
|
try {
|
||||||
console.log(`Requested Station: ${requestedStation}`);
|
console.log(`Requested Station: ${requestedStation}`);
|
||||||
const data = await fetch(`https://owlboard.info/api/v1/ldb/${requestedStation}`);
|
const data = await fetch(
|
||||||
|
`https://owlboard.info/api/v1/ldb/${requestedStation}`
|
||||||
|
);
|
||||||
jsonData = await data.json();
|
jsonData = await data.json();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching data:", error);
|
console.error('Error fetching data:', error);
|
||||||
dataExists = false;
|
dataExists = false;
|
||||||
title = "Not Found";
|
title = 'Not Found';
|
||||||
} finally {
|
} finally {
|
||||||
isLoading = false; // Clear loading state
|
isLoading = false; // Clear loading state
|
||||||
}
|
}
|
||||||
prepareNrcc()
|
prepareNrcc();
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseTime(string){
|
function parseTime(string) {
|
||||||
let output
|
let output;
|
||||||
let change
|
let change;
|
||||||
switch (string) {
|
switch (string) {
|
||||||
case 'Delayed':
|
case 'Delayed':
|
||||||
output = 'LATE'
|
output = 'LATE';
|
||||||
change = "changed"
|
change = 'changed';
|
||||||
break
|
break;
|
||||||
case 'Cancelled':
|
case 'Cancelled':
|
||||||
output = 'CANC'
|
output = 'CANC';
|
||||||
change = "cancelled"
|
change = 'cancelled';
|
||||||
break
|
break;
|
||||||
case 'On Time':
|
case 'On Time':
|
||||||
case 'On time':
|
case 'On time':
|
||||||
output = 'RT'
|
output = 'RT';
|
||||||
change = ""
|
change = '';
|
||||||
break
|
break;
|
||||||
case '':
|
case '':
|
||||||
output = '-'
|
output = '-';
|
||||||
change = ""
|
change = '';
|
||||||
break
|
break;
|
||||||
case undefined:
|
case undefined:
|
||||||
output = '-'
|
output = '-';
|
||||||
change = ""
|
change = '';
|
||||||
break
|
break;
|
||||||
case 'No report':
|
case 'No report':
|
||||||
output = '-'
|
output = '-';
|
||||||
change = ""
|
change = '';
|
||||||
break
|
break;
|
||||||
case 'undefined':
|
case 'undefined':
|
||||||
output = false
|
output = false;
|
||||||
change = ""
|
change = '';
|
||||||
break
|
break;
|
||||||
default:
|
default:
|
||||||
output = string
|
output = string;
|
||||||
change = "changed"
|
change = 'changed';
|
||||||
}
|
}
|
||||||
return {data: output, changed: change}
|
return { data: output, changed: change };
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadService(sid) {
|
async function loadService(sid) {
|
||||||
for (const service of services) {
|
for (const service of services) {
|
||||||
if (service.serviceID == sid) {
|
if (service.serviceID == sid) {
|
||||||
serviceDetail = service
|
serviceDetail = service;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -117,7 +119,7 @@
|
|||||||
async function loadBusService(sid) {
|
async function loadBusService(sid) {
|
||||||
for (const service of busServices) {
|
for (const service of busServices) {
|
||||||
if (service.serviceID == sid) {
|
if (service.serviceID == sid) {
|
||||||
serviceDetail = service
|
serviceDetail = service;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,7 +132,7 @@
|
|||||||
if (jsonData?.GetStationBoardResult?.nrccMessages?.message) {
|
if (jsonData?.GetStationBoardResult?.nrccMessages?.message) {
|
||||||
const nrcc = jsonData.GetStationBoardResult.nrccMessages.message;
|
const nrcc = jsonData.GetStationBoardResult.nrccMessages.message;
|
||||||
if (Array.isArray(nrcc)) {
|
if (Array.isArray(nrcc)) {
|
||||||
alerts = nrcc
|
alerts = nrcc;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
alerts.push(nrcc);
|
alerts.push(nrcc);
|
||||||
@ -146,13 +148,12 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if alerts.length}
|
{#if alerts.length}
|
||||||
<AlertBar {alerts}/>
|
<AlertBar {alerts} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if isLoading}
|
{#if isLoading}
|
||||||
<Loading />
|
<Loading />
|
||||||
{:else}
|
{:else if dataAge}
|
||||||
{#if dataAge}
|
|
||||||
<p id="timestamp">Updated: {dataAge.toLocaleTimeString()}</p>
|
<p id="timestamp">Updated: {dataAge.toLocaleTimeString()}</p>
|
||||||
{#if services.length}
|
{#if services.length}
|
||||||
<table class="ldbTable">
|
<table class="ldbTable">
|
||||||
@ -167,19 +168,27 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{#each services as service}
|
{#each services as service}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="origdest from" on:click={loadService(service.serviceID)} on:keypress={loadService(service.serviceID)}>
|
<td
|
||||||
|
class="origdest from"
|
||||||
|
on:click={loadService(service.serviceID)}
|
||||||
|
on:keypress={loadService(service.serviceID)}
|
||||||
|
>
|
||||||
{#if Array.isArray(service.origin?.location)}
|
{#if Array.isArray(service.origin?.location)}
|
||||||
{service.origin.location[0]['locationName'] +
|
{service.origin.location[0]['locationName'] +
|
||||||
" & " +
|
' & ' +
|
||||||
service.origin.location[1]['locationName']}
|
service.origin.location[1]['locationName']}
|
||||||
{:else}
|
{:else}
|
||||||
{service.origin?.location?.locationName || ''}
|
{service.origin?.location?.locationName || ''}
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
<td class="origdest to" on:click={loadService(service.serviceID)} on:keypress={loadService(service.serviceID)}>
|
<td
|
||||||
|
class="origdest to"
|
||||||
|
on:click={loadService(service.serviceID)}
|
||||||
|
on:keypress={loadService(service.serviceID)}
|
||||||
|
>
|
||||||
{#if Array.isArray(service.destination?.location)}
|
{#if Array.isArray(service.destination?.location)}
|
||||||
{service.destination.location[0]['locationName'] +
|
{service.destination.location[0]['locationName'] +
|
||||||
" & " +
|
' & ' +
|
||||||
service.destination.location[0]['locationName']}
|
service.destination.location[0]['locationName']}
|
||||||
{:else}
|
{:else}
|
||||||
{service.destination?.location?.locationName || ''}
|
{service.destination?.location?.locationName || ''}
|
||||||
@ -187,12 +196,17 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="plat">{service.platform || '-'}</td>
|
<td class="plat">{service.platform || '-'}</td>
|
||||||
<td class="time">{parseTime(service.sta).data}</td>
|
<td class="time">{parseTime(service.sta).data}</td>
|
||||||
<td class="time {parseTime(service.eta).changed}">{parseTime(service.eta).data}</td>
|
<td class="time {parseTime(service.eta).changed}"
|
||||||
|
>{parseTime(service.eta).data}</td
|
||||||
|
>
|
||||||
<td class="time">{parseTime(service.std).data}</td>
|
<td class="time">{parseTime(service.std).data}</td>
|
||||||
<td class="time {parseTime(service.etd).changed}">{parseTime(service.etd).data}</td>
|
<td class="time {parseTime(service.etd).changed}"
|
||||||
|
>{parseTime(service.etd).data}</td
|
||||||
|
>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr><td colspan="7">
|
<tr
|
||||||
|
><td colspan="7">
|
||||||
<p class="service-detail">
|
<p class="service-detail">
|
||||||
A {service.operator || 'Unknown'} service
|
A {service.operator || 'Unknown'} service
|
||||||
{#if service['length']}
|
{#if service['length']}
|
||||||
@ -205,15 +219,20 @@
|
|||||||
{#if service.cancelReason}
|
{#if service.cancelReason}
|
||||||
<p class="service-detail">{service.cancelReason}</p>
|
<p class="service-detail">{service.cancelReason}</p>
|
||||||
{/if}
|
{/if}
|
||||||
</td></tr>
|
</td></tr
|
||||||
|
>
|
||||||
{/each}
|
{/each}
|
||||||
</table>
|
</table>
|
||||||
{:else}
|
{:else}
|
||||||
<p class="table-head-text">No Scheduled Train Services</p>
|
<p class="table-head-text">No Scheduled Train Services</p>
|
||||||
{/if}
|
{/if}
|
||||||
{#if busServices.length}
|
{#if busServices.length}
|
||||||
<br>
|
<br />
|
||||||
<img class="transport-mode" src="/images/transport-modes/bus.svg" alt="Bus services"><br>
|
<img
|
||||||
|
class="transport-mode"
|
||||||
|
src="/images/transport-modes/bus.svg"
|
||||||
|
alt="Bus services"
|
||||||
|
/><br />
|
||||||
<span class="table-head-text">Bus Services</span>
|
<span class="table-head-text">Bus Services</span>
|
||||||
<table class="ldbTable">
|
<table class="ldbTable">
|
||||||
<tr>
|
<tr>
|
||||||
@ -226,15 +245,30 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{#each busServices as service}
|
{#each busServices as service}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="origdest from" on:click={loadBusService(service.serviceID)} on:keypress={loadBusService(service.serviceID)}>{service.origin?.location?.locationName || ''}</td>
|
<td
|
||||||
<td class="origdest to" on:click={loadBusService(service.serviceID)} on:keypress={loadBusService(service.serviceID)}>{service.destination?.location?.locationName || ''}</td>
|
class="origdest from"
|
||||||
|
on:click={loadBusService(service.serviceID)}
|
||||||
|
on:keypress={loadBusService(service.serviceID)}
|
||||||
|
>{service.origin?.location?.locationName || ''}</td
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
class="origdest to"
|
||||||
|
on:click={loadBusService(service.serviceID)}
|
||||||
|
on:keypress={loadBusService(service.serviceID)}
|
||||||
|
>{service.destination?.location?.locationName || ''}</td
|
||||||
|
>
|
||||||
<td class="time">{parseTime(service.sta).data}</td>
|
<td class="time">{parseTime(service.sta).data}</td>
|
||||||
<td class="time {parseTime(service.eta).changed}">{parseTime(service.eta).data}</td>
|
<td class="time {parseTime(service.eta).changed}"
|
||||||
|
>{parseTime(service.eta).data}</td
|
||||||
|
>
|
||||||
<td class="time">{parseTime(service.std).data}</td>
|
<td class="time">{parseTime(service.std).data}</td>
|
||||||
<td class="time {parseTime(service.etd).changed}">{parseTime(service.etd).data}</td>
|
<td class="time {parseTime(service.etd).changed}"
|
||||||
|
>{parseTime(service.etd).data}</td
|
||||||
|
>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr><td colspan="7">
|
<tr
|
||||||
|
><td colspan="7">
|
||||||
<p class="service-detail">
|
<p class="service-detail">
|
||||||
A {service.operator || 'Unknown'} service
|
A {service.operator || 'Unknown'} service
|
||||||
</p>
|
</p>
|
||||||
@ -244,13 +278,18 @@
|
|||||||
{#if service.cancelReason}
|
{#if service.cancelReason}
|
||||||
<p class="service-detail">{service.cancelReason}</p>
|
<p class="service-detail">{service.cancelReason}</p>
|
||||||
{/if}
|
{/if}
|
||||||
</td></tr>
|
</td></tr
|
||||||
|
>
|
||||||
{/each}
|
{/each}
|
||||||
</table>
|
</table>
|
||||||
{/if}
|
{/if}
|
||||||
{#if ferryServices.length}
|
{#if ferryServices.length}
|
||||||
<br>
|
<br />
|
||||||
<img class="transport-mode" src="/images/transport-modes/ferry.svg" alt="Bus services"><br>
|
<img
|
||||||
|
class="transport-mode"
|
||||||
|
src="/images/transport-modes/ferry.svg"
|
||||||
|
alt="Bus services"
|
||||||
|
/><br />
|
||||||
<span class="table-head-text">Ferry Services</span>
|
<span class="table-head-text">Ferry Services</span>
|
||||||
<table class="ldbTable">
|
<table class="ldbTable">
|
||||||
<tr>
|
<tr>
|
||||||
@ -263,28 +302,37 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{#each ferryServices as service}
|
{#each ferryServices as service}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="origdest from">{service.origin?.location?.locationName || ''}</td>
|
<td class="origdest from"
|
||||||
<td class="origdest to">{service.destination?.location?.locationName || ''}</td>
|
>{service.origin?.location?.locationName || ''}</td
|
||||||
|
>
|
||||||
|
<td class="origdest to"
|
||||||
|
>{service.destination?.location?.locationName || ''}</td
|
||||||
|
>
|
||||||
<td class="time">{parseTime(service.sta).data}</td>
|
<td class="time">{parseTime(service.sta).data}</td>
|
||||||
<td class="time {parseTime(service.eta).changed}">{parseTime(service.eta).data}</td>
|
<td class="time {parseTime(service.eta).changed}"
|
||||||
|
>{parseTime(service.eta).data}</td
|
||||||
|
>
|
||||||
<td class="time">{parseTime(service.std).data}</td>
|
<td class="time">{parseTime(service.std).data}</td>
|
||||||
<td class="time {parseTime(service.etd).changed}">{parseTime(service.etd).data}</td>
|
<td class="time {parseTime(service.etd).changed}"
|
||||||
|
>{parseTime(service.etd).data}</td
|
||||||
|
>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr><td colspan="7">
|
<tr
|
||||||
|
><td colspan="7">
|
||||||
{#if service.delayReason}
|
{#if service.delayReason}
|
||||||
<p class="service-detail">{service.delayReason}</p>
|
<p class="service-detail">{service.delayReason}</p>
|
||||||
{/if}
|
{/if}
|
||||||
{#if service.cancelReason}
|
{#if service.cancelReason}
|
||||||
<p class="service-detail">{service.cancelReason}</p>
|
<p class="service-detail">{service.cancelReason}</p>
|
||||||
{/if}
|
{/if}
|
||||||
</td></tr>
|
</td></tr
|
||||||
|
>
|
||||||
{/each}
|
{/each}
|
||||||
</table>
|
</table>
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<p>Unable to find this station</p>
|
<p>Unable to find this station</p>
|
||||||
{/if}
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if serviceDetail}
|
{#if serviceDetail}
|
||||||
@ -304,21 +352,47 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{prevPoint.locationName}</td>
|
<td>{prevPoint.locationName}</td>
|
||||||
<td>{prevPoint.st}</td>
|
<td>{prevPoint.st}</td>
|
||||||
<td class="time {parseTime(prevPoint.at || prevPoint.et).changed}">{parseTime(prevPoint.at || prevPoint.et).data}</td>
|
<td
|
||||||
|
class="time {parseTime(prevPoint.at || prevPoint.et).changed}"
|
||||||
|
>{parseTime(prevPoint.at || prevPoint.et).data}</td
|
||||||
|
>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
{:else}
|
{:else}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{serviceDetail.previousCallingPoints.callingPointList.callingPoint.locationName}</td>
|
<td
|
||||||
<td>{serviceDetail.previousCallingPoints.callingPointList.callingPoint.st}</td>
|
>{serviceDetail.previousCallingPoints.callingPointList
|
||||||
<td class="time {parseTime(serviceDetail.previousCallingPoints.callingPointList.callingPoint.at || serviceDetail.previousCallingPoints.callingPointList.callingPoint.et).changed}">{parseTime(serviceDetail.previousCallingPoints.callingPointList.callingPoint.at || serviceDetail.previousCallingPoints.callingPointList.callingPoint.et).data}</td>
|
.callingPoint.locationName}</td
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
>{serviceDetail.previousCallingPoints.callingPointList
|
||||||
|
.callingPoint.st}</td
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
class="time {parseTime(
|
||||||
|
serviceDetail.previousCallingPoints.callingPointList
|
||||||
|
.callingPoint.at ||
|
||||||
|
serviceDetail.previousCallingPoints.callingPointList
|
||||||
|
.callingPoint.et
|
||||||
|
).changed}"
|
||||||
|
>{parseTime(
|
||||||
|
serviceDetail.previousCallingPoints.callingPointList
|
||||||
|
.callingPoint.at ||
|
||||||
|
serviceDetail.previousCallingPoints.callingPointList
|
||||||
|
.callingPoint.et
|
||||||
|
).data}</td
|
||||||
|
>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
<tr class="thisStop">
|
<tr class="thisStop">
|
||||||
<td>{title}</td>
|
<td>{title}</td>
|
||||||
<td>{serviceDetail.std || serviceDetail.sta}</td>
|
<td>{serviceDetail.std || serviceDetail.sta}</td>
|
||||||
<td class="time {parseTime(serviceDetail.etd || serviceDetail.eta).changed}">{parseTime(serviceDetail.etd || serviceDetail.eta).data}</td>
|
<td
|
||||||
|
class="time {parseTime(serviceDetail.etd || serviceDetail.eta)
|
||||||
|
.changed}"
|
||||||
|
>{parseTime(serviceDetail.etd || serviceDetail.eta).data}</td
|
||||||
|
>
|
||||||
</tr>
|
</tr>
|
||||||
{#if serviceDetail?.subsequentCallingPoints?.callingPointList?.callingPoint}
|
{#if serviceDetail?.subsequentCallingPoints?.callingPointList?.callingPoint}
|
||||||
{#if Array.isArray(serviceDetail?.subsequentCallingPoints?.callingPointList?.callingPoint)}
|
{#if Array.isArray(serviceDetail?.subsequentCallingPoints?.callingPointList?.callingPoint)}
|
||||||
@ -326,14 +400,31 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{nextPoint.locationName}</td>
|
<td>{nextPoint.locationName}</td>
|
||||||
<td>{nextPoint.st}</td>
|
<td>{nextPoint.st}</td>
|
||||||
<td class="time {parseTime(nextPoint.et).changed}">{parseTime(nextPoint.et).data}</td>
|
<td class="time {parseTime(nextPoint.et).changed}"
|
||||||
|
>{parseTime(nextPoint.et).data}</td
|
||||||
|
>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
{:else}
|
{:else}
|
||||||
<tr class="detailRow">
|
<tr class="detailRow">
|
||||||
<td>{serviceDetail.subsequentCallingPoints.callingPointList.callingPoint.locationName}</td>
|
<td
|
||||||
<td>{serviceDetail.subsequentCallingPoints.callingPointList.callingPoint.st}</td>
|
>{serviceDetail.subsequentCallingPoints.callingPointList
|
||||||
<td class="time {parseTime(serviceDetail.subsequentCallingPoints.callingPointList.callingPoint.et).changed}">{parseTime(serviceDetail.subsequentCallingPoints.callingPointList.callingPoint.et).data}</td>
|
.callingPoint.locationName}</td
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
>{serviceDetail.subsequentCallingPoints.callingPointList
|
||||||
|
.callingPoint.st}</td
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
class="time {parseTime(
|
||||||
|
serviceDetail.subsequentCallingPoints.callingPointList
|
||||||
|
.callingPoint.et
|
||||||
|
).changed}"
|
||||||
|
>{parseTime(
|
||||||
|
serviceDetail.subsequentCallingPoints.callingPointList
|
||||||
|
.callingPoint.et
|
||||||
|
).data}</td
|
||||||
|
>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
@ -371,21 +462,40 @@
|
|||||||
color: white;
|
color: white;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
@media (min-width: 800px) {
|
@media (min-width: 800px) {
|
||||||
table {font-size: 15px; max-width: 850px;}
|
table {
|
||||||
.service-detail {font-size: 14px;}
|
font-size: 15px;
|
||||||
.transport-mode {width: 50px;}
|
max-width: 850px;
|
||||||
#timestamp {font-size: 16px;}
|
}
|
||||||
}
|
.service-detail {
|
||||||
@media (min-width: 1000px) {
|
font-size: 14px;
|
||||||
table {font-size: 17px;}
|
}
|
||||||
.service-detail{font-size: 16px;}
|
.transport-mode {
|
||||||
.table-head-text {font-size: 16px;}
|
width: 50px;
|
||||||
}
|
}
|
||||||
@media (min-width: 1600px) {
|
#timestamp {
|
||||||
table {font-size: 19px;}
|
font-size: 16px;
|
||||||
.service-detail {font-size: 18px;}
|
}
|
||||||
}
|
}
|
||||||
|
@media (min-width: 1000px) {
|
||||||
|
table {
|
||||||
|
font-size: 17px;
|
||||||
|
}
|
||||||
|
.service-detail {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
.table-head-text {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 1600px) {
|
||||||
|
table {
|
||||||
|
font-size: 19px;
|
||||||
|
}
|
||||||
|
.service-detail {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
}
|
||||||
.origdest {
|
.origdest {
|
||||||
color: yellow;
|
color: yellow;
|
||||||
}
|
}
|
||||||
@ -398,40 +508,40 @@
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
.plat {
|
.plat {
|
||||||
width: 10%
|
width: 10%;
|
||||||
}
|
}
|
||||||
.time {
|
.time {
|
||||||
width: 10%;
|
width: 10%;
|
||||||
}
|
}
|
||||||
.changed{
|
.changed {
|
||||||
animation: pulse-change 1.5s linear infinite;
|
animation: pulse-change 1.5s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cancelled {
|
.cancelled {
|
||||||
animation: pulse-cancel 1.5s linear infinite;
|
animation: pulse-cancel 1.5s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes pulse-change {
|
@keyframes pulse-change {
|
||||||
50% {
|
50% {
|
||||||
color: var(--main-warning-color);
|
color: var(--main-warning-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes pulse-cancel {
|
@keyframes pulse-cancel {
|
||||||
50% {
|
50% {
|
||||||
color: var(--main-alert-color);
|
color: var(--main-alert-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#detailBox {
|
#detailBox {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
h6 {
|
h6 {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -25px;
|
top: -25px;
|
||||||
left: 20px;
|
left: 20px;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
#closeService {
|
#closeService {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
@ -443,13 +553,13 @@ h6 {
|
|||||||
color: white;
|
color: white;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
#detailTable {
|
#detailTable {
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
color: white;
|
color: white;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
.thisStop {
|
.thisStop {
|
||||||
color: yellow;
|
color: yellow;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
export let station = "";
|
export let station = '';
|
||||||
export let title = "Loading...";
|
export let title = 'Loading...';
|
||||||
import { onMount } from 'svelte'
|
import { onMount } from 'svelte';
|
||||||
import AlertBar from './alert-bar.svelte';
|
import AlertBar from './alert-bar.svelte';
|
||||||
import StaffTrainDetail from '$lib/ldb/staff-train-detail.svelte';
|
import StaffTrainDetail from '$lib/ldb/staff-train-detail.svelte';
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from '$lib/navigation/loading.svelte';
|
||||||
@ -29,13 +29,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (jsonData?.GetBoardResult?.locationName) {
|
if (jsonData?.GetBoardResult?.locationName) {
|
||||||
title = jsonData.GetBoardResult.locationName
|
title = jsonData.GetBoardResult.locationName;
|
||||||
} else {
|
} else {
|
||||||
title = "Loading Board"
|
title = 'Loading Board';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jsonData?.GetBoardResult?.nrccMessages) {
|
if (jsonData?.GetBoardResult?.nrccMessages) {
|
||||||
alerts = processNrcc(jsonData.GetBoardResult?.nrccMessages?.message)
|
alerts = processNrcc(jsonData.GetBoardResult?.nrccMessages?.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,25 +45,25 @@
|
|||||||
console.log(`Requested Station: ${requestedStation}`);
|
console.log(`Requested Station: ${requestedStation}`);
|
||||||
const url = `https://owlboard.info/api/v2/live/station/${requestedStation}/staff`;
|
const url = `https://owlboard.info/api/v2/live/station/${requestedStation}/staff`;
|
||||||
const opt = {
|
const opt = {
|
||||||
method: "GET",
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
"uuid": $uuid
|
uuid: $uuid
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
const data = await fetch(url, opt);
|
const data = await fetch(url, opt);
|
||||||
jsonData = await data.json();
|
jsonData = await data.json();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching data:", error);
|
console.error('Error fetching data:', error);
|
||||||
} finally {
|
} finally {
|
||||||
isLoading = false; // Clear loading state
|
isLoading = false; // Clear loading state
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getReasonCodeData(code) {
|
async function getReasonCodeData(code) {
|
||||||
const url = `https://owlboard.info/api/v2/ref/reasonCode/${code}`
|
const url = `https://owlboard.info/api/v2/ref/reasonCode/${code}`;
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
const json = await res.json();
|
const json = await res.json();
|
||||||
return json
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function generateServiceData(service) {
|
async function generateServiceData(service) {
|
||||||
@ -72,8 +72,8 @@
|
|||||||
from: await parseLocation(service.origin),
|
from: await parseLocation(service.origin),
|
||||||
to: await parseLocation(service.destination),
|
to: await parseLocation(service.destination),
|
||||||
length: await getTrainLength(service),
|
length: await getTrainLength(service),
|
||||||
platform: await parsePlatform(service?.platform || "undefined"),
|
platform: await parsePlatform(service?.platform || 'undefined'),
|
||||||
platformHidden: service?.platformIsHidden === "true",
|
platformHidden: service?.platformIsHidden === 'true',
|
||||||
schArr: timeDetails.schArr,
|
schArr: timeDetails.schArr,
|
||||||
expArr: timeDetails.expArr,
|
expArr: timeDetails.expArr,
|
||||||
schDep: timeDetails.schDep,
|
schDep: timeDetails.schDep,
|
||||||
@ -84,12 +84,12 @@
|
|||||||
isLateDep: timeDetails.delDep,
|
isLateDep: timeDetails.delDep,
|
||||||
isCancelledDep: false,
|
isCancelledDep: false,
|
||||||
isCancelled: Boolean(service?.isCancelled),
|
isCancelled: Boolean(service?.isCancelled),
|
||||||
isDelayed: service?.arrivalType === "Delayed",
|
isDelayed: service?.arrivalType === 'Delayed',
|
||||||
isArrDelayed: service?.arrivalType === "Delayed",
|
isArrDelayed: service?.arrivalType === 'Delayed',
|
||||||
isDepDelayed: service?.departureType === "Delayed",
|
isDepDelayed: service?.departureType === 'Delayed',
|
||||||
isEarly: false,
|
isEarly: false,
|
||||||
isNonPublic: false
|
isNonPublic: false
|
||||||
}
|
};
|
||||||
return serviceData;
|
return serviceData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +97,7 @@
|
|||||||
if (service?.length) {
|
if (service?.length) {
|
||||||
return parseInt(service?.length);
|
return parseInt(service?.length);
|
||||||
} else if (service?.formation?.coaches) {
|
} else if (service?.formation?.coaches) {
|
||||||
return service.formation.coaches.coach.length
|
return service.formation.coaches.coach.length;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -105,34 +105,38 @@
|
|||||||
async function parseLocation(location) {
|
async function parseLocation(location) {
|
||||||
if (!Array.isArray(location.location)) {
|
if (!Array.isArray(location.location)) {
|
||||||
//console.log(location.location?.tiploc)
|
//console.log(location.location?.tiploc)
|
||||||
return location.location?.tiploc
|
return location.location?.tiploc;
|
||||||
}
|
}
|
||||||
let locations = [];
|
let locations = [];
|
||||||
for (const singleLocation of location?.location) {
|
for (const singleLocation of location?.location) {
|
||||||
locations.push(singleLocation?.tiploc)
|
locations.push(singleLocation?.tiploc);
|
||||||
}
|
}
|
||||||
return locations.join(' & ');
|
return locations.join(' & ');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function parsePlatform(platform) {
|
async function parsePlatform(platform) {
|
||||||
if (!platform) {
|
if (!platform) {
|
||||||
return '-'
|
return '-';
|
||||||
}
|
}
|
||||||
if (platform === "TBC" || platform == "undefined") {
|
if (platform === 'TBC' || platform == 'undefined') {
|
||||||
return '-'
|
return '-';
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
number: platform
|
number: platform
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseTimes(service){
|
function parseTimes(service) {
|
||||||
let schArr = new Date(service?.sta);
|
let schArr = new Date(service?.sta);
|
||||||
let expArr = new Date(service?.eta || service?.ata);
|
let expArr = new Date(service?.eta || service?.ata);
|
||||||
let schDep = new Date(service?.std);
|
let schDep = new Date(service?.std);
|
||||||
let expDep = new Date(service?.etd || service?.atd);
|
let expDep = new Date(service?.etd || service?.atd);
|
||||||
let isEarlyArr = false, isDelayedArr = false, isArr = false
|
let isEarlyArr = false,
|
||||||
let isEarlyDep = false, isDelayedDep = false, isDep = false
|
isDelayedArr = false,
|
||||||
|
isArr = false;
|
||||||
|
let isEarlyDep = false,
|
||||||
|
isDelayedDep = false,
|
||||||
|
isDep = false;
|
||||||
const timeDifferenceThreshold = 60 * 1000; // 60 seconds in milliseconds
|
const timeDifferenceThreshold = 60 * 1000; // 60 seconds in milliseconds
|
||||||
if (expArr - schArr < -timeDifferenceThreshold) {
|
if (expArr - schArr < -timeDifferenceThreshold) {
|
||||||
isEarlyArr = true;
|
isEarlyArr = true;
|
||||||
@ -150,26 +154,26 @@
|
|||||||
isDep = true;
|
isDep = true;
|
||||||
}
|
}
|
||||||
let parsedExpArr;
|
let parsedExpArr;
|
||||||
if (expArr instanceof Date && !isNaN(expArr)) {
|
if (expArr instanceof Date && !isNaN(expArr)) {
|
||||||
if (!isEarlyArr && !isDelayedArr) {
|
if (!isEarlyArr && !isDelayedArr) {
|
||||||
parsedExpArr = 'RT';
|
parsedExpArr = 'RT';
|
||||||
} else {
|
} else {
|
||||||
parsedExpArr = parseIndividualTime(expArr);
|
parsedExpArr = parseIndividualTime(expArr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
parsedExpArr = '-';
|
parsedExpArr = '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
let parsedExpDep;
|
let parsedExpDep;
|
||||||
if (expDep instanceof Date && !isNaN(expDep)) {
|
if (expDep instanceof Date && !isNaN(expDep)) {
|
||||||
if (!isEarlyDep && !isDelayedDep) {
|
if (!isEarlyDep && !isDelayedDep) {
|
||||||
parsedExpDep = 'RT';
|
parsedExpDep = 'RT';
|
||||||
} else {
|
} else {
|
||||||
parsedExpDep = parseIndividualTime(expDep);
|
parsedExpDep = parseIndividualTime(expDep);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
parsedExpDep = '-';
|
parsedExpDep = '-';
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
schArr: parseIndividualTime(schArr),
|
schArr: parseIndividualTime(schArr),
|
||||||
expArr: parsedExpArr,
|
expArr: parsedExpArr,
|
||||||
@ -179,19 +183,23 @@ if (expDep instanceof Date && !isNaN(expDep)) {
|
|||||||
delArr: isDelayedArr,
|
delArr: isDelayedArr,
|
||||||
earDep: isEarlyDep,
|
earDep: isEarlyDep,
|
||||||
delDep: isDelayedDep
|
delDep: isDelayedDep
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseIndividualTime(input) {
|
function parseIndividualTime(input) {
|
||||||
const dt = new Date(input);
|
const dt = new Date(input);
|
||||||
const output = dt.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})
|
const output = dt.toLocaleTimeString([], {
|
||||||
if (output !== "Invalid Date") {
|
hour: '2-digit',
|
||||||
return output
|
minute: '2-digit'
|
||||||
|
});
|
||||||
|
if (output !== 'Invalid Date') {
|
||||||
|
return output;
|
||||||
}
|
}
|
||||||
return '-'
|
return '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
function processNrcc(messages) { // Remove newlines and then <p> tags from input and append to array
|
function processNrcc(messages) {
|
||||||
|
// Remove newlines and then <p> tags from input and append to array
|
||||||
let arrMessages;
|
let arrMessages;
|
||||||
if (!Array.isArray(messages)) {
|
if (!Array.isArray(messages)) {
|
||||||
arrMessages = [messages];
|
arrMessages = [messages];
|
||||||
@ -200,8 +208,10 @@ if (expDep instanceof Date && !isNaN(expDep)) {
|
|||||||
}
|
}
|
||||||
let processedMessages = [];
|
let processedMessages = [];
|
||||||
for (const message of arrMessages) {
|
for (const message of arrMessages) {
|
||||||
const msgText = message.xhtmlMessage
|
const msgText = message.xhtmlMessage;
|
||||||
processedMessages.push(msgText.replace(/[\n\r]/g, '').replace(/<\/?p[^>]*>/g, ''));
|
processedMessages.push(
|
||||||
|
msgText.replace(/[\n\r]/g, '').replace(/<\/?p[^>]*>/g, '')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return processedMessages;
|
return processedMessages;
|
||||||
}
|
}
|
||||||
@ -209,16 +219,20 @@ if (expDep instanceof Date && !isNaN(expDep)) {
|
|||||||
onMount(() => {
|
onMount(() => {
|
||||||
fetchData();
|
fetchData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if isLoading}
|
{#if isLoading}
|
||||||
<Loading />
|
<Loading />
|
||||||
{:else}
|
{:else}
|
||||||
{#if alerts.length}
|
{#if alerts.length}
|
||||||
<AlertBar {alerts} />
|
<AlertBar {alerts} />
|
||||||
{/if}
|
{/if}
|
||||||
<table>
|
<table>
|
||||||
<tr><td colspan="8" id="timestamp">Updated: {dataAge.toLocaleTimeString()} - Staff Boards under development</td></tr>
|
<tr
|
||||||
|
><td colspan="8" id="timestamp"
|
||||||
|
>Updated: {dataAge.toLocaleTimeString()} - Staff Boards under development</td
|
||||||
|
></tr
|
||||||
|
>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="id">ID</th>
|
<th class="id">ID</th>
|
||||||
<th class="from">From</th>
|
<th class="from">From</th>
|
||||||
@ -232,35 +246,58 @@ if (expDep instanceof Date && !isNaN(expDep)) {
|
|||||||
{#each services as service}
|
{#each services as service}
|
||||||
{#await generateServiceData(service)}
|
{#await generateServiceData(service)}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="8">
|
<td colspan="8"> Loading... </td>
|
||||||
Loading...
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{:then serviceStats}
|
{:then serviceStats}
|
||||||
|
|
||||||
<!-- Await a 'Generate Stats' function here which can evaluate the data and provide
|
<!-- Await a 'Generate Stats' function here which can evaluate the data and provide
|
||||||
relevant BOOLs like isCancelled, isEarly, isLate, isNonPassenger and calculate train length
|
relevant BOOLs like isCancelled, isEarly, isLate, isNonPassenger and calculate train length
|
||||||
where 'length' is not provided but 'formation' is. -->
|
where 'length' is not provided but 'formation' is. -->
|
||||||
<tr>
|
<tr>
|
||||||
<td class="id id-data data">{service.trainid}</td>
|
<td class="id id-data data">{service.trainid}</td>
|
||||||
<td class="from from-data data {serviceStats.isCancelled && 'can-dat'}">{serviceStats.from}</td>
|
<td
|
||||||
<td class="to to-data data {serviceStats.isCancelled && 'can-dat'}">{serviceStats.to}</td>
|
class="from from-data data {serviceStats.isCancelled && 'can-dat'}"
|
||||||
<td class="plat plat-data data {serviceStats.isCancelled && 'can-dat'} {serviceStats.platformHidden && 'hidden'}">{serviceStats.platform.number || '-'}</td>
|
>{serviceStats.from}</td
|
||||||
<td class="time time-data data {serviceStats.isCancelled && 'can-dat'}">{serviceStats.schArr}</td>
|
>
|
||||||
<td class="time time-data data {serviceStats.isArrDelayed && 'late'} {serviceStats.isEarlyArr && 'early'} {serviceStats.isLateArr && 'late'}">{serviceStats.isArrDelayed ? 'LATE' : serviceStats.expArr}</td>
|
<td class="to to-data data {serviceStats.isCancelled && 'can-dat'}"
|
||||||
<td class="time time-data data {serviceStats.isCancelled && 'can-dat'}">{serviceStats.schDep}</td>
|
>{serviceStats.to}</td
|
||||||
<td class="time time-data data {serviceStats.isDepDelayed && 'late'} {serviceStats.isEarlyDep && 'early'} {serviceStats.isLateDep && 'late'}">{serviceStats.isDepDelayed ? 'LATE' : serviceStats.expDep}</td>
|
>
|
||||||
|
<td
|
||||||
|
class="plat plat-data data {serviceStats.isCancelled &&
|
||||||
|
'can-dat'} {serviceStats.platformHidden && 'hidden'}"
|
||||||
|
>{serviceStats.platform.number || '-'}</td
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
class="time time-data data {serviceStats.isCancelled && 'can-dat'}"
|
||||||
|
>{serviceStats.schArr}</td
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
class="time time-data data {serviceStats.isArrDelayed &&
|
||||||
|
'late'} {serviceStats.isEarlyArr &&
|
||||||
|
'early'} {serviceStats.isLateArr && 'late'}"
|
||||||
|
>{serviceStats.isArrDelayed ? 'LATE' : serviceStats.expArr}</td
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
class="time time-data data {serviceStats.isCancelled && 'can-dat'}"
|
||||||
|
>{serviceStats.schDep}</td
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
class="time time-data data {serviceStats.isDepDelayed &&
|
||||||
|
'late'} {serviceStats.isEarlyDep &&
|
||||||
|
'early'} {serviceStats.isLateDep && 'late'}"
|
||||||
|
>{serviceStats.isDepDelayed ? 'LATE' : serviceStats.expDep}</td
|
||||||
|
>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="text-row">
|
<tr class="text-row">
|
||||||
<td colspan="8" class="text-data">
|
<td colspan="8" class="text-data">
|
||||||
{service.operator} {#if serviceStats.length} | {serviceStats.length} carriages{/if}
|
{service.operator}
|
||||||
<br>
|
{#if serviceStats.length} | {serviceStats.length} carriages{/if}
|
||||||
|
<br />
|
||||||
{#if service.isCancelled}
|
{#if service.isCancelled}
|
||||||
{#await getReasonCodeData(service.cancelReason)}
|
{#await getReasonCodeData(service.cancelReason)}
|
||||||
This train has been cancelled
|
This train has been cancelled
|
||||||
{:then reasonCode}
|
{:then reasonCode}
|
||||||
{reasonCode[0].cancReason}
|
{reasonCode[0].cancReason}
|
||||||
<br>
|
<br />
|
||||||
{/await}
|
{/await}
|
||||||
{/if}
|
{/if}
|
||||||
{#if service?.delayReason}
|
{#if service?.delayReason}
|
||||||
@ -268,7 +305,7 @@ if (expDep instanceof Date && !isNaN(expDep)) {
|
|||||||
This train has been delayed
|
This train has been delayed
|
||||||
{:then reasonCode}
|
{:then reasonCode}
|
||||||
{reasonCode[0].lateReason}
|
{reasonCode[0].lateReason}
|
||||||
<br>
|
<br />
|
||||||
{/await}
|
{/await}
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
@ -280,11 +317,11 @@ if (expDep instanceof Date && !isNaN(expDep)) {
|
|||||||
{/await}
|
{/await}
|
||||||
{/each}
|
{/each}
|
||||||
</table>
|
</table>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<Nav />
|
<Nav />
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
#timestamp {
|
#timestamp {
|
||||||
color: var(--second-text-color);
|
color: var(--second-text-color);
|
||||||
}
|
}
|
||||||
@ -306,7 +343,8 @@ if (expDep instanceof Date && !isNaN(expDep)) {
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.from-data, .to-data {
|
.from-data,
|
||||||
|
.to-data {
|
||||||
color: yellow;
|
color: yellow;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
@ -323,42 +361,42 @@ if (expDep instanceof Date && !isNaN(expDep)) {
|
|||||||
font-size: smaller;
|
font-size: smaller;
|
||||||
}
|
}
|
||||||
|
|
||||||
.can-dat {
|
.can-dat {
|
||||||
color: grey;
|
color: grey;
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden {
|
.hidden {
|
||||||
color: grey;
|
color: grey;
|
||||||
}
|
}
|
||||||
|
|
||||||
.can-time {
|
.can-time {
|
||||||
animation: pulse-cancel 1.5s linear infinite;
|
animation: pulse-cancel 1.5s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
.early {
|
.early {
|
||||||
animation: pulse-early 1.5s linear infinite;
|
animation: pulse-early 1.5s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
.late {
|
.late {
|
||||||
animation: pulse-late 1.5s linear infinite;
|
animation: pulse-late 1.5s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes pulse-late {
|
@keyframes pulse-late {
|
||||||
50% {
|
50% {
|
||||||
color: var(--main-warning-color);
|
color: var(--main-warning-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes pulse-cancel {
|
@keyframes pulse-cancel {
|
||||||
50% {
|
50% {
|
||||||
color: var(--main-alert-color);
|
color: var(--main-alert-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes pulse-early {
|
@keyframes pulse-early {
|
||||||
50% {
|
50% {
|
||||||
color: rgb(136, 164, 255);
|
color: rgb(136, 164, 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -4,28 +4,28 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
#tick {
|
#tick {
|
||||||
font-size: 45px;
|
font-size: 45px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
#container {
|
#container {
|
||||||
position:fixed;
|
position: fixed;
|
||||||
top:50%;
|
top: 50%;
|
||||||
left:50%;
|
left: 50%;
|
||||||
transform:translate(-50%,-50%);
|
transform: translate(-50%, -50%);
|
||||||
margin:auto;
|
margin: auto;
|
||||||
background-color:var(--overlay-color);
|
background-color: var(--overlay-color);
|
||||||
border-radius:15px;
|
border-radius: 15px;
|
||||||
padding:20px;
|
padding: 20px;
|
||||||
padding-bottom:1px;
|
padding-bottom: 1px;
|
||||||
min-width:90px;
|
min-width: 90px;
|
||||||
max-width:90px
|
max-width: 90px;
|
||||||
}
|
}
|
||||||
p {
|
p {
|
||||||
padding-top:0px;
|
padding-top: 0px;
|
||||||
font-weight:bolder;
|
font-weight: bolder;
|
||||||
overflow-wrap:normal;
|
overflow-wrap: normal;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -1,12 +1,12 @@
|
|||||||
<script>
|
<script>
|
||||||
export let title = 'title'
|
export let title = 'title';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="headerBar">
|
<div class="headerBar">
|
||||||
<a href="/">
|
<a href="/">
|
||||||
<picture>
|
<picture>
|
||||||
<source srcset="/images/logo/wide_logo.svg" type="image/svg+xml">
|
<source srcset="/images/logo/wide_logo.svg" type="image/svg+xml" />
|
||||||
<img src="/images/logo/wide_logo_200.png" alt="OwlBoard Logo">
|
<img src="/images/logo/wide_logo_200.png" alt="OwlBoard Logo" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
<header>{title}</header>
|
<header>{title}</header>
|
||||||
@ -14,27 +14,29 @@
|
|||||||
<div class="headerBlock">
|
<div class="headerBlock">
|
||||||
<!-- This exists to prevent the headerBar overlapping anything below it -->
|
<!-- This exists to prevent the headerBar overlapping anything below it -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.headerBar {
|
.headerBar {
|
||||||
background: var(--overlay-color-solid);
|
background: var(--overlay-color-solid);
|
||||||
color: var(--main-text-color);
|
color: var(--main-text-color);
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0; left: 0;
|
top: 0;
|
||||||
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
z-index: 20;
|
z-index: 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
right: 8px;
|
right: 8px;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
header {
|
header {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
top: 3px;
|
top: 3px;
|
||||||
@ -43,11 +45,11 @@ header {
|
|||||||
margin-top: 7px;
|
margin-top: 7px;
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
font-size: 15pt;
|
font-size: 15pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
.headerBlock {
|
.headerBlock {
|
||||||
height: 50px;
|
height: 50px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -1,53 +1,57 @@
|
|||||||
<script>
|
<script>
|
||||||
import { fade } from "svelte/transition";
|
import { fade } from 'svelte/transition';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="container" in:fade={{delay: 150, duration: 250}} out:fade={{duration: 250}}>
|
<div
|
||||||
<div class="spinner"></div>
|
id="container"
|
||||||
|
in:fade={{ delay: 150, duration: 250 }}
|
||||||
|
out:fade={{ duration: 250 }}
|
||||||
|
>
|
||||||
|
<div class="spinner" />
|
||||||
<p>Loading...</p>
|
<p>Loading...</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@keyframes spinner {
|
@keyframes spinner {
|
||||||
0% {
|
0% {
|
||||||
transform:translate3d(-50%,-50%,0) rotate(0)
|
transform: translate3d(-50%, -50%, 0) rotate(0);
|
||||||
}
|
}
|
||||||
100% {
|
100% {
|
||||||
transform:translate3d(-50%,-50%,0) rotate(360deg)
|
transform: translate3d(-50%, -50%, 0) rotate(360deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.spinner::before {
|
.spinner::before {
|
||||||
animation:1.5s linear infinite spinner;
|
animation: 1.5s linear infinite spinner;
|
||||||
animation-play-state:inherit;
|
animation-play-state: inherit;
|
||||||
border:solid 5px var(--overlay-color);
|
border: solid 5px var(--overlay-color);
|
||||||
border-bottom-color: white;
|
border-bottom-color: white;
|
||||||
border-radius:50%;
|
border-radius: 50%;
|
||||||
content:"";
|
content: '';
|
||||||
height:40px;
|
height: 40px;
|
||||||
width:40px;
|
width: 40px;
|
||||||
position:absolute;
|
position: absolute;
|
||||||
top:30%;
|
top: 30%;
|
||||||
margin:auto;
|
margin: auto;
|
||||||
transform:translate3d(-50%,-50%,0);
|
transform: translate3d(-50%, -50%, 0);
|
||||||
will-change:transform
|
will-change: transform;
|
||||||
}
|
}
|
||||||
#container {
|
#container {
|
||||||
position:fixed;
|
position: fixed;
|
||||||
top:50%;
|
top: 50%;
|
||||||
left:50%;
|
left: 50%;
|
||||||
transform:translate(-50%,-50%);
|
transform: translate(-50%, -50%);
|
||||||
margin:auto;
|
margin: auto;
|
||||||
background-color:var(--overlay-color);
|
background-color: var(--overlay-color);
|
||||||
border-radius:15px;
|
border-radius: 15px;
|
||||||
padding:20px;
|
padding: 20px;
|
||||||
padding-bottom:1px;
|
padding-bottom: 1px;
|
||||||
min-width:90px;
|
min-width: 90px;
|
||||||
max-width:90px
|
max-width: 90px;
|
||||||
}
|
}
|
||||||
p {
|
p {
|
||||||
padding-top:50px;
|
padding-top: 50px;
|
||||||
font-weight:bolder;
|
font-weight: bolder;
|
||||||
overflow-wrap:normal;
|
overflow-wrap: normal;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -1,28 +1,36 @@
|
|||||||
<script>
|
<script>
|
||||||
const links = [
|
const links = [
|
||||||
{
|
{
|
||||||
title: "Home",
|
title: 'Home',
|
||||||
path: "/",
|
path: '/',
|
||||||
svgPath: "/images/navigation/home.svg"
|
svgPath: '/images/navigation/home.svg'
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
import { page } from "$app/stores";
|
import { page } from '$app/stores';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
{#each links as item}
|
{#each links as item}
|
||||||
<a class="footerLink" href={item.path} class:active={$page.url.pathname == item.path}>
|
<a
|
||||||
<img src="{item.svgPath}" alt="{item.title}">
|
class="footerLink"
|
||||||
<br>
|
href={item.path}
|
||||||
|
class:active={$page.url.pathname == item.path}
|
||||||
|
>
|
||||||
|
<img src={item.svgPath} alt={item.title} />
|
||||||
|
<br />
|
||||||
<span>{item.title}</span>
|
<span>{item.title}</span>
|
||||||
</a>
|
</a>
|
||||||
{/each}
|
{/each}
|
||||||
<div class="data-source">
|
<div class="data-source">
|
||||||
<a href="https://nationalrail.co.uk" target="_blank">
|
<a href="https://nationalrail.co.uk" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<source srcset="/images/nre/nre-powered_200w.jxl" type="image/jxl">
|
<source srcset="/images/nre/nre-powered_200w.jxl" type="image/jxl" />
|
||||||
<source srcset="/images/nre/nre-powered_200w.webp" type="image/webp">
|
<source srcset="/images/nre/nre-powered_200w.webp" type="image/webp" />
|
||||||
<img id="nre-logo" src="/images/nre/nre-powered_200w.png" alt="Data sourced from National Rail and others">
|
<img
|
||||||
|
id="nre-logo"
|
||||||
|
src="/images/nre/nre-powered_200w.png"
|
||||||
|
alt="Data sourced from National Rail and others"
|
||||||
|
/>
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@ -57,7 +65,7 @@
|
|||||||
}
|
}
|
||||||
.data-source {
|
.data-source {
|
||||||
flex-grow: 2;
|
flex-grow: 2;
|
||||||
background: rgb(255,255,255);
|
background: rgb(255, 255, 255);
|
||||||
}
|
}
|
||||||
#nre-logo {
|
#nre-logo {
|
||||||
width: 150px;
|
width: 150px;
|
||||||
@ -67,8 +75,12 @@
|
|||||||
}
|
}
|
||||||
@media only screen and (min-width: 475px) {
|
@media only screen and (min-width: 475px) {
|
||||||
.data-source {
|
.data-source {
|
||||||
background: rgb(255,255,255);
|
background: rgb(255, 255, 255);
|
||||||
background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 40%);
|
background: linear-gradient(
|
||||||
|
90deg,
|
||||||
|
rgba(255, 255, 255, 0) 0%,
|
||||||
|
rgba(255, 255, 255, 1) 40%
|
||||||
|
);
|
||||||
}
|
}
|
||||||
#nre-logo {
|
#nre-logo {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
<script>
|
<script>
|
||||||
const links = [
|
const links = [
|
||||||
{
|
{
|
||||||
title: "Home",
|
title: 'Home',
|
||||||
path: "/",
|
path: '/',
|
||||||
svgPath: "/images/navigation/home.svg"
|
svgPath: '/images/navigation/home.svg'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "PIS Finder",
|
title: 'PIS Finder',
|
||||||
path: "/pis",
|
path: '/pis',
|
||||||
svgPath: "/images/navigation/info.svg"
|
svgPath: '/images/navigation/info.svg'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "More",
|
title: 'More',
|
||||||
path: "/more",
|
path: '/more',
|
||||||
svgPath: "/images/navigation/more.svg"
|
svgPath: '/images/navigation/more.svg'
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
import { page } from "$app/stores";
|
import { page } from '$app/stores';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
{#each links as item}
|
{#each links as item}
|
||||||
<a href={item.path} class:active={$page.url.pathname == item.path}>
|
<a href={item.path} class:active={$page.url.pathname == item.path}>
|
||||||
<img src="{item.svgPath}" alt="{item.title}">
|
<img src={item.svgPath} alt={item.title} />
|
||||||
<br>
|
<br />
|
||||||
<span>{item.title}</span>
|
<span>{item.title}</span>
|
||||||
</a>
|
</a>
|
||||||
{/each}
|
{/each}
|
||||||
|
@ -1,36 +1,36 @@
|
|||||||
<script>
|
<script>
|
||||||
import OverlayIsland from "$lib/islands/overlay-island.svelte";
|
import OverlayIsland from '$lib/islands/overlay-island.svelte';
|
||||||
|
|
||||||
const variables = {
|
const variables = {
|
||||||
title: "Welcome to OwlBoard"
|
title: 'Welcome to OwlBoard'
|
||||||
}
|
};
|
||||||
const version = "2023.7.1"
|
const version = '2023.7.1';
|
||||||
let pageNum = 0;
|
let pageNum = 0;
|
||||||
|
|
||||||
function pageUp() {
|
function pageUp() {
|
||||||
pageNum ++;
|
pageNum++;
|
||||||
console.log(`Welcome page: ${pageNum}`)
|
console.log(`Welcome page: ${pageNum}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pageDn() {
|
function pageDn() {
|
||||||
pageNum --;
|
pageNum--;
|
||||||
console.log(`Welcome page: ${pageNum}`)
|
console.log(`Welcome page: ${pageNum}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const pageText = [
|
const pageText = [
|
||||||
"<h3>A brand new look</h3>" +
|
'<h3>A brand new look</h3>' +
|
||||||
"<p>OwlBoard has a brand new look, making it even faster for you to access the data</p>" +
|
'<p>OwlBoard has a brand new look, making it even faster for you to access the data</p>' +
|
||||||
"<p>If you have signed up before, you won't have to to it again and any customised Quick Links are here waiting for you</p>",
|
"<p>If you have signed up before, you won't have to to it again and any customised Quick Links are here waiting for you</p>",
|
||||||
"<h3>Faster Access</h3>" +
|
'<h3>Faster Access</h3>' +
|
||||||
"<p>Both live station data, and timetable search is available from the homepage. Making it faster to get the info you need</p>" +
|
'<p>Both live station data, and timetable search is available from the homepage. Making it faster to get the info you need</p>' +
|
||||||
"<p>Search the timetable using a headcode to see a trains details - OwlBoard now shows data for all TOCs and FOCs.</p>" +
|
'<p>Search the timetable using a headcode to see a trains details - OwlBoard now shows data for all TOCs and FOCs.</p>' +
|
||||||
"<p>For GWR services: if a PIS code is available for a service, you'll see it alongside the train details.</p>",
|
"<p>For GWR services: if a PIS code is available for a service, you'll see it alongside the train details.</p>",
|
||||||
"<h3>PIS Finder</h3>" +
|
'<h3>PIS Finder</h3>' +
|
||||||
"<p>Don't worry, the PIS finder hasn't gone away. It has even been moved to the new navigation bar for faster access</p>" +
|
"<p>Don't worry, the PIS finder hasn't gone away. It has even been moved to the new navigation bar for faster access</p>" +
|
||||||
"<p>If there isn't a PIS code available for a given headcode, you can use this tool to search by start and end stations, enabling you to utilise a different code and skipping stops as needed.</p>",
|
"<p>If there isn't a PIS code available for a given headcode, you can use this tool to search by start and end stations, enabling you to utilise a different code and skipping stops as needed.</p>",
|
||||||
"<h3>Everything Else</h3>" +
|
'<h3>Everything Else</h3>' +
|
||||||
"<p>Everything else has moved to the 'More' menu, where you'll find the Reference Code lookup and software details."
|
"<p>Everything else has moved to the 'More' menu, where you'll find the Reference Code lookup and software details."
|
||||||
]
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<OverlayIsland {variables}>
|
<OverlayIsland {variables}>
|
||||||
|
@ -1,29 +1,28 @@
|
|||||||
import { writable } from 'svelte/store'
|
import { writable } from 'svelte/store';
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
|
|
||||||
export const ql = writable(fromLocalStorage('ql', []))
|
export const ql = writable(fromLocalStorage('ql', []));
|
||||||
toLocalStorage(ql, 'ql');
|
toLocalStorage(ql, 'ql');
|
||||||
|
|
||||||
function fromLocalStorage(storageKey, fallback) {
|
function fromLocalStorage(storageKey, fallback) {
|
||||||
if (browser) {
|
if (browser) {
|
||||||
const storedValue = localStorage.getItem(storageKey);
|
const storedValue = localStorage.getItem(storageKey);
|
||||||
if (storedValue !== 'undefined' && storedValue !== null) {
|
if (storedValue !== 'undefined' && storedValue !== null) {
|
||||||
return (typeof fallback === 'object')
|
return typeof fallback === 'object'
|
||||||
? JSON.parse(storedValue)
|
? JSON.parse(storedValue)
|
||||||
: storedValue
|
: storedValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fallback
|
return fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toLocalStorage(store, storageKey) {
|
function toLocalStorage(store, storageKey) {
|
||||||
if (browser) {
|
if (browser) {
|
||||||
store.subscribe(value => {
|
store.subscribe((value) => {
|
||||||
let storageValue = (typeof value === 'object')
|
let storageValue =
|
||||||
? JSON.stringify(value)
|
typeof value === 'object' ? JSON.stringify(value) : value;
|
||||||
: value
|
|
||||||
|
|
||||||
localStorage.setItem(storageKey, storageValue)
|
localStorage.setItem(storageKey, storageValue);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,23 +1,23 @@
|
|||||||
import { writable } from 'svelte/store'
|
import { writable } from 'svelte/store';
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
|
|
||||||
export const uuid = writable(fromLocalStorage('uuid', null))
|
export const uuid = writable(fromLocalStorage('uuid', null));
|
||||||
toLocalStorage(uuid, 'uuid');
|
toLocalStorage(uuid, 'uuid');
|
||||||
|
|
||||||
function fromLocalStorage(storageKey, fallback) {
|
function fromLocalStorage(storageKey, fallback) {
|
||||||
if (browser) {
|
if (browser) {
|
||||||
const storedValue = localStorage.getItem(storageKey);
|
const storedValue = localStorage.getItem(storageKey);
|
||||||
if (storedValue !== 'undefined') {
|
if (storedValue !== 'undefined') {
|
||||||
return storedValue
|
return storedValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fallback
|
return fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toLocalStorage(store, storageKey) {
|
function toLocalStorage(store, storageKey) {
|
||||||
if (browser) {
|
if (browser) {
|
||||||
store.subscribe(value => {
|
store.subscribe((value) => {
|
||||||
localStorage.setItem(storageKey, value)
|
localStorage.setItem(storageKey, value);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,29 +1,48 @@
|
|||||||
<script>
|
<script>
|
||||||
import { fly } from "svelte/transition";
|
import { fly } from 'svelte/transition';
|
||||||
|
|
||||||
export let service = ""
|
export let service = '';
|
||||||
|
|
||||||
let isExpanded = false;
|
let isExpanded = false;
|
||||||
|
|
||||||
async function expand() {
|
async function expand() {
|
||||||
isExpanded = !isExpanded
|
isExpanded = !isExpanded;
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="container-header" on:click={expand} on:keypress={expand}>
|
<div class="container-header" on:click={expand} on:keypress={expand}>
|
||||||
<span class="header">{service.operator || "GW"}: {service.stops[0]['publicDeparture'] || service.stops[0]['wttDeparture']} {service.stops[0]['tiploc']} to {service.stops[service['stops'].length -1]['tiploc']}</span>
|
<span class="header"
|
||||||
|
>{service.operator || 'GW'}: {service.stops[0]['publicDeparture'] ||
|
||||||
|
service.stops[0]['wttDeparture']}
|
||||||
|
{service.stops[0]['tiploc']} to {service.stops[
|
||||||
|
service['stops'].length - 1
|
||||||
|
]['tiploc']}</span
|
||||||
|
>
|
||||||
<span id="container-arrow" class:isExpanded>V</span>
|
<span id="container-arrow" class:isExpanded>V</span>
|
||||||
</div>
|
</div>
|
||||||
{#if isExpanded}
|
{#if isExpanded}
|
||||||
<div class="container-detail" in:fly={{ y: -20, duration: 200}}>
|
<div class="container-detail" in:fly={{ y: -20, duration: 200 }}>
|
||||||
{#if service.pis}
|
{#if service.pis}
|
||||||
<p class="pis">PIS: {service.pis}</p>
|
<p class="pis">PIS: {service.pis}</p>
|
||||||
{/if}
|
{/if}
|
||||||
<p class="svc-detail">Planned Type: {parseInt(service.planSpeed) || 68 }mph {service.powerType || "Bus" }</p>
|
<p class="svc-detail">
|
||||||
<p class="svc-detail">Days Run: {service.daysRun.join(", ").toUpperCase()}</p>
|
Planned Type: {parseInt(service.planSpeed) || 68}mph {service.powerType ||
|
||||||
<p class="svc-detail validity">Valid From: {new Date(service.scheduleStartDate).toLocaleDateString('en-GB', {timeZone: 'UTC'})} - {new Date(service.scheduleEndDate).toLocaleDateString('en-GB', {timeZone: 'UTC'})}</p>
|
'Bus'}
|
||||||
|
</p>
|
||||||
|
<p class="svc-detail">
|
||||||
|
Days Run: {service.daysRun.join(', ').toUpperCase()}
|
||||||
|
</p>
|
||||||
|
<p class="svc-detail validity">
|
||||||
|
Valid From: {new Date(service.scheduleStartDate).toLocaleDateString(
|
||||||
|
'en-GB',
|
||||||
|
{
|
||||||
|
timeZone: 'UTC'
|
||||||
|
}
|
||||||
|
)} - {new Date(service.scheduleEndDate).toLocaleDateString('en-GB', {
|
||||||
|
timeZone: 'UTC'
|
||||||
|
})}
|
||||||
|
</p>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Location</th>
|
<th>Location</th>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from '$lib/navigation/header.svelte';
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from '$lib/navigation/nav.svelte';
|
||||||
const title = "OwlBoard - Error"
|
const title = 'OwlBoard - Error';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
@ -10,15 +10,22 @@
|
|||||||
<h1>{$page.status}: {$page?.error?.message}</h1>
|
<h1>{$page.status}: {$page?.error?.message}</h1>
|
||||||
|
|
||||||
{#if $page.status === 404}
|
{#if $page.status === 404}
|
||||||
<p>This is not the page you're looking for.</p>
|
<p>This is not the page you're looking for.</p>
|
||||||
<p>The page you are looking for doesn't exist, use the tabs below to find another page.</p>
|
<p>
|
||||||
|
The page you are looking for doesn't exist, use the tabs below to find
|
||||||
|
another page.
|
||||||
|
</p>
|
||||||
{:else if $page.status === 500}
|
{:else if $page.status === 500}
|
||||||
<p>Something went wrong loading the app.<br>
|
<p>
|
||||||
Try going <a href="/">home</a> and try again.</p>
|
Something went wrong loading the app.<br />
|
||||||
<p>If the problem persists, you can report an issue from the 'More' menu.</p>
|
Try going <a href="/">home</a> and try again.
|
||||||
|
</p>
|
||||||
|
<p>If the problem persists, you can report an issue from the 'More' menu.</p>
|
||||||
{:else}
|
{:else}
|
||||||
<p>Not sure what went wrong, please try again later or report an issue from
|
<p>
|
||||||
the 'More' menu.</p>
|
Not sure what went wrong, please try again later or report an issue from the
|
||||||
|
'More' menu.
|
||||||
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<Nav />
|
<Nav />
|
@ -1,16 +1,20 @@
|
|||||||
<script>
|
<script>
|
||||||
import '../app.css'
|
import '../app.css';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8" />
|
||||||
<meta name="application-name" content="OwlBoard">
|
<meta name="application-name" content="OwlBoard" />
|
||||||
<meta name="author" content="Frederick Boniface">
|
<meta name="author" content="Frederick Boniface" />
|
||||||
<meta name="description" content="Live train data, PIS Codes & reference data. Built by railway staff, for railway staff.">
|
<meta
|
||||||
<meta name="viewport" content="width=device-width">
|
name="description"
|
||||||
<meta name="theme-color" content="#00b7b7">
|
content="Live train data, PIS Codes & reference data. Built by railway staff, for railway staff."
|
||||||
<link rel="icon" href="/images/icon.svg" type="image/svg+xml">
|
/>
|
||||||
<link rel="apple-touch-icon" href="/images/app-icons/any/apple-192.png">
|
<meta name="viewport" content="width=device-width" />
|
||||||
<link rel="manifest" href="/manifest.json">
|
<meta name="theme-color" content="#00b7b7" />
|
||||||
|
<link rel="icon" href="/images/icon.svg" type="image/svg+xml" />
|
||||||
|
<link rel="apple-touch-icon" href="/images/app-icons/any/apple-192.png" />
|
||||||
|
<link rel="manifest" href="/manifest.json" />
|
||||||
<title>OwlBoard</title>
|
<title>OwlBoard</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
<slot />
|
<slot />
|
@ -1,28 +1,27 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte'
|
import Header from '$lib/navigation/header.svelte';
|
||||||
import Nav from '$lib/navigation/nav.svelte'
|
import Nav from '$lib/navigation/nav.svelte';
|
||||||
import InputIsland from '$lib/islands/input-island-form.svelte'
|
import InputIsland from '$lib/islands/input-island-form.svelte';
|
||||||
import QuickLinkIsland from '$lib/islands/quick-link-island.svelte';
|
import QuickLinkIsland from '$lib/islands/quick-link-island.svelte';
|
||||||
import Welcome from '$lib/overlays/welcome.svelte';
|
import Welcome from '$lib/overlays/welcome.svelte';
|
||||||
|
|
||||||
const title = "OwlBoard"
|
const title = 'OwlBoard';
|
||||||
const inputIslands = [
|
const inputIslands = [
|
||||||
{
|
{
|
||||||
title: "Live Departure Boards",
|
title: 'Live Departure Boards',
|
||||||
action: "/ldb",
|
action: '/ldb',
|
||||||
placeholder: "Enter CRS/TIPLOC",
|
placeholder: 'Enter CRS/TIPLOC',
|
||||||
queryName: "station"
|
queryName: 'station'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Train Details & PIS",
|
title: 'Train Details & PIS',
|
||||||
action: "/train",
|
action: '/train',
|
||||||
placeholder: "Enter Headcode",
|
placeholder: 'Enter Headcode',
|
||||||
queryName: "headcode"
|
queryName: 'headcode'
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
|
|
||||||
const isWelcomed = "false"; // Usually a bool - <Welcome /> is incomplete so should be hidden for now.
|
|
||||||
|
|
||||||
|
const isWelcomed = 'false'; // Usually a bool - <Welcome /> is incomplete so should be hidden for now.
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if !isWelcomed}
|
{#if !isWelcomed}
|
||||||
|
@ -1,43 +1,42 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte'
|
import Header from '$lib/navigation/header.svelte';
|
||||||
import Nav from '$lib/navigation/nav-ldb.svelte'
|
import Nav from '$lib/navigation/nav-ldb.svelte';
|
||||||
import PublicLdb from '$lib/ldb/public-ldb.svelte';
|
import PublicLdb from '$lib/ldb/public-ldb.svelte';
|
||||||
import StaffLdb from '$lib/ldb/staff-ldb.svelte';
|
import StaffLdb from '$lib/ldb/staff-ldb.svelte';
|
||||||
import { uuid } from '$lib/stores/uuid.js';
|
import { uuid } from '$lib/stores/uuid.js';
|
||||||
import {onMount} from 'svelte'
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
let title = "Loading"
|
let title = 'Loading';
|
||||||
|
|
||||||
async function getHeadcode() {
|
async function getHeadcode() {
|
||||||
return new URLSearchParams(window.location.search).get('station');
|
return new URLSearchParams(window.location.search).get('station');
|
||||||
}
|
}
|
||||||
|
|
||||||
let station = "";
|
let station = '';
|
||||||
let staff = false;
|
let staff = false;
|
||||||
let uuidValue = "";
|
let uuidValue = '';
|
||||||
|
|
||||||
$: uuidValue = $uuid;
|
$: uuidValue = $uuid;
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
station = await getHeadcode() || "";
|
station = (await getHeadcode()) || '';
|
||||||
if (uuidValue !== null && uuidValue !== "" && uuidValue !== "null") {
|
if (uuidValue !== null && uuidValue !== '' && uuidValue !== 'null') {
|
||||||
staff = true;
|
staff = true;
|
||||||
title = "Staff Board"
|
title = 'Staff Board';
|
||||||
} else {
|
} else {
|
||||||
title = "Public Board"
|
title = 'Public Board';
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
|
|
||||||
<!-- If 'uuid' exists in store then load StaffLdb else load PublicLdb -->
|
<!-- If 'uuid' exists in store then load StaffLdb else load PublicLdb -->
|
||||||
{#if !staff}
|
{#if !staff}
|
||||||
<PublicLdb {station} bind:title={title} />
|
<PublicLdb {station} bind:title />
|
||||||
{:else}
|
{:else}
|
||||||
<StaffLdb {station} bind:title={title} />
|
<StaffLdb {station} bind:title />
|
||||||
<!--<StaffLdb {station} bind:title={title} /> -- Temporary, Disable StaffLdb - it isn't implemented -->
|
<!--<StaffLdb {station} bind:title={title} /> -- Temporary, Disable StaffLdb - it isn't implemented -->
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<Nav />
|
<Nav />
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte'
|
import Header from '$lib/navigation/header.svelte';
|
||||||
import Nav from '$lib/navigation/nav.svelte'
|
import Nav from '$lib/navigation/nav.svelte';
|
||||||
const title = "More"
|
const title = 'More';
|
||||||
|
|
||||||
const links = [
|
const links = [
|
||||||
{title: "Your Data", path: "/more/data"},
|
{ title: 'Your Data', path: '/more/data' },
|
||||||
{title: "Registration", path: "/more/reg"},
|
{ title: 'Registration', path: '/more/reg' },
|
||||||
{title: "Location Reference Code Lookup", path: "/more/corpus"},
|
{ title: 'Location Reference Code Lookup', path: '/more/corpus' },
|
||||||
{title: "Reason Code Lookup", path: "/more/reasons"},
|
{ title: 'Reason Code Lookup', path: '/more/reasons' },
|
||||||
{title: "Privacy Policy", path: "/more/privacy"},
|
{ title: 'Privacy Policy', path: '/more/privacy' },
|
||||||
{title: "Component Versions", path: "/more/versions"},
|
{ title: 'Component Versions', path: '/more/versions' },
|
||||||
{title: "Statictics", path: "/more/statistics"},
|
{ title: 'Statictics', path: '/more/statistics' },
|
||||||
{title: "Settings", path: "/more/settings"},
|
{ title: 'Settings', path: '/more/settings' },
|
||||||
{title: "Report Issue", path: "/more/report"},
|
{ title: 'Report Issue', path: '/more/report' },
|
||||||
{title: "About", path: "/more/about"}
|
{ title: 'About', path: '/more/about' }
|
||||||
]
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
|
|
||||||
{#each links as item}
|
{#each links as item}
|
||||||
<a href={item.path}>
|
<a href={item.path}>
|
||||||
<div>
|
<div>
|
||||||
<p>{item.title}</p>
|
<p>{item.title}</p>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
<Nav />
|
<Nav />
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
div {
|
div {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: rgba(0, 0, 0, 0.226);
|
background: rgba(0, 0, 0, 0.226);
|
||||||
@ -65,4 +65,4 @@
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,18 +1,24 @@
|
|||||||
<script>
|
<script>
|
||||||
import LargeLogo from "$lib/images/large-logo.svelte";
|
import LargeLogo from '$lib/images/large-logo.svelte';
|
||||||
import Header from "$lib/navigation/header.svelte";
|
import Header from '$lib/navigation/header.svelte';
|
||||||
import Nav from "$lib/navigation/nav.svelte";
|
import Nav from '$lib/navigation/nav.svelte';
|
||||||
|
|
||||||
const title = "About";
|
const title = 'About';
|
||||||
</script>
|
</script>
|
||||||
<Header {title}/>
|
|
||||||
|
<Header {title} />
|
||||||
<LargeLogo />
|
<LargeLogo />
|
||||||
<p class="neg">© 2022-2023 Frederick Boniface</p>
|
<p class="neg">© 2022-2023 Frederick Boniface</p>
|
||||||
<p>OwlBoard was created by train-crew for train-crew</p>
|
<p>OwlBoard was created by train-crew for train-crew</p>
|
||||||
<p>I created OwlBoard in 2022 to freely give fast and easy access to the information
|
<p>
|
||||||
that we need every day.</p>
|
I created OwlBoard in 2022 to freely give fast and easy access to the
|
||||||
<p>Data sourced from: National Rail Enquiries, OwlBoard Project and Network Rail.</p>
|
information that we need every day.
|
||||||
<p>OwlBoard components are available under various Open Source licenses, see the
|
</p>
|
||||||
|
<p>
|
||||||
|
Data sourced from: National Rail Enquiries, OwlBoard Project and Network Rail.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
OwlBoard components are available under various Open Source licenses, see the
|
||||||
<a href="https://git.fjla.uk/OwlBoard" target="_blank">code repository</a>
|
<a href="https://git.fjla.uk/OwlBoard" target="_blank">code repository</a>
|
||||||
for more information.
|
for more information.
|
||||||
</p>
|
</p>
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte'
|
import Header from '$lib/navigation/header.svelte';
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from '$lib/navigation/loading.svelte';
|
||||||
import Nav from '$lib/navigation/nav.svelte'
|
import Nav from '$lib/navigation/nav.svelte';
|
||||||
const title = "Location Codes"
|
const title = 'Location Codes';
|
||||||
|
|
||||||
let val = {
|
let val = {
|
||||||
crs: "",
|
crs: '',
|
||||||
tiploc: "",
|
tiploc: '',
|
||||||
stanox: "",
|
stanox: '',
|
||||||
nlc: "",
|
nlc: '',
|
||||||
name: "",
|
name: '',
|
||||||
uic: ""
|
uic: ''
|
||||||
}
|
};
|
||||||
|
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
|
|
||||||
async function getData(type = "", value = "") {
|
async function getData(type = '', value = '') {
|
||||||
const url = `https://owlboard.info/api/v2/ref/locationCode/${type}/${value}`
|
const url = `https://owlboard.info/api/v2/ref/locationCode/${type}/${value}`;
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
@ -25,17 +25,17 @@
|
|||||||
|
|
||||||
async function processData(data) {
|
async function processData(data) {
|
||||||
//console.log("data",JSON.stringify(data))
|
//console.log("data",JSON.stringify(data))
|
||||||
if (data.ERROR == "Offline") {
|
if (data.ERROR == 'Offline') {
|
||||||
return;
|
return;
|
||||||
};
|
|
||||||
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"
|
|
||||||
}
|
}
|
||||||
|
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));
|
//console.log("val",JSON.stringify(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,13 +43,13 @@
|
|||||||
isLoading = true;
|
isLoading = true;
|
||||||
let data = [];
|
let data = [];
|
||||||
if (val?.crs) {
|
if (val?.crs) {
|
||||||
data = await getData("crs", val.crs);
|
data = await getData('crs', val.crs);
|
||||||
} else if (val?.tiploc) {
|
} else if (val?.tiploc) {
|
||||||
data = await getData("tiploc", val.tiploc);
|
data = await getData('tiploc', val.tiploc);
|
||||||
} else if (val?.stanox) {
|
} else if (val?.stanox) {
|
||||||
data = await getData("stanox", val.stanox);
|
data = await getData('stanox', val.stanox);
|
||||||
} else if (val?.nlc) {
|
} else if (val?.nlc) {
|
||||||
data = await getData("nlc", val.nlc);
|
data = await getData('nlc', val.nlc);
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -58,15 +58,14 @@
|
|||||||
|
|
||||||
async function reset() {
|
async function reset() {
|
||||||
val = {
|
val = {
|
||||||
crs: "",
|
crs: '',
|
||||||
tiploc: "",
|
tiploc: '',
|
||||||
stanox: "",
|
stanox: '',
|
||||||
nlc: "",
|
nlc: '',
|
||||||
name: "",
|
name: '',
|
||||||
uic: "",
|
uic: ''
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
@ -81,18 +80,49 @@
|
|||||||
|
|
||||||
<div class="inputs">
|
<div class="inputs">
|
||||||
<form on:submit={submit}>
|
<form on:submit={submit}>
|
||||||
<input type="text" readonly placeholder="Name" bind:value={val.name}>
|
<input type="text" readonly placeholder="Name" bind:value={val.name} />
|
||||||
<br>
|
<br />
|
||||||
<input type="text" maxlength="3" autocomplete="off" placeholder="CRS/3ALPHA" bind:value={val.crs}>
|
<input
|
||||||
<br>
|
type="text"
|
||||||
<input type="text" maxlength="7" autocomplete="off" placeholder="TIPLOC" bind:value={val.tiploc}>
|
maxlength="3"
|
||||||
<br>
|
autocomplete="off"
|
||||||
<input type="text" maxlength="10" autocomplete="off" placeholder="STANOX" bind:value={val.stanox}>
|
placeholder="CRS/3ALPHA"
|
||||||
<br>
|
bind:value={val.crs}
|
||||||
<input type="number" maxlength="6" min="0" autocomplete="off" placeholder="NLC" bind:value={val.nlc}>
|
/>
|
||||||
<br>
|
<br />
|
||||||
<input type="text" readonly autocomplete="off" placeholder="UIC" bind:value={val.uic}>
|
<input
|
||||||
<br>
|
type="text"
|
||||||
|
maxlength="7"
|
||||||
|
autocomplete="off"
|
||||||
|
placeholder="TIPLOC"
|
||||||
|
bind:value={val.tiploc}
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
maxlength="10"
|
||||||
|
autocomplete="off"
|
||||||
|
placeholder="STANOX"
|
||||||
|
bind:value={val.stanox}
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
maxlength="6"
|
||||||
|
min="0"
|
||||||
|
autocomplete="off"
|
||||||
|
placeholder="NLC"
|
||||||
|
bind:value={val.nlc}
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
readonly
|
||||||
|
autocomplete="off"
|
||||||
|
placeholder="UIC"
|
||||||
|
bind:value={val.uic}
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
<button type="submit">Submit</button>
|
<button type="submit">Submit</button>
|
||||||
<button type="reset" on:click={reset}>Reset</button>
|
<button type="reset" on:click={reset}>Reset</button>
|
||||||
</form>
|
</form>
|
||||||
|
@ -4,24 +4,24 @@
|
|||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from '$lib/navigation/nav.svelte';
|
||||||
import { uuid } from '$lib/stores/uuid.js';
|
import { uuid } from '$lib/stores/uuid.js';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
const title = "Your Data";
|
const title = 'Your Data';
|
||||||
|
|
||||||
let data = [
|
let data = [
|
||||||
{
|
{
|
||||||
"domain": "User not Found",
|
domain: 'User not Found',
|
||||||
"atime": "User not Found"
|
atime: 'User not Found'
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
|
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
|
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
if ($uuid != "null") {
|
if ($uuid != 'null') {
|
||||||
const url = `https://owlboard.info/api/v2/user/${$uuid}`
|
const url = `https://owlboard.info/api/v2/user/${$uuid}`;
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
const json = await res.json();
|
const json = await res.json();
|
||||||
if (json.length) {
|
if (json.length) {
|
||||||
data = json
|
data = json;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -30,25 +30,33 @@
|
|||||||
isLoading = true;
|
isLoading = true;
|
||||||
await fetchData();
|
await fetchData();
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
|
|
||||||
<p>OwlBoard stores as little data about you as possible to offer the service.</p>
|
<p>
|
||||||
<p>Your randomly generated UUID is not displayed, this is stored in your browser and on the OwlBoard server.</p>
|
OwlBoard stores as little data about you as possible to offer the service.
|
||||||
<p>The data below is the entirity of the data we hold about you and constitutes a response to a `Subject Access Request` under GDPR legislation.</p>
|
</p>
|
||||||
<br><br>
|
<p>
|
||||||
|
Your randomly generated UUID is not displayed, this is stored in your browser
|
||||||
|
and on the OwlBoard server.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
The data below is the entirity of the data we hold about you and constitutes a
|
||||||
|
response to a `Subject Access Request` under GDPR legislation.
|
||||||
|
</p>
|
||||||
|
<br /><br />
|
||||||
|
|
||||||
{#if isLoading}
|
{#if isLoading}
|
||||||
<Loading />
|
<Loading />
|
||||||
{:else}
|
{:else if data[0].domain != 'User not Found'}
|
||||||
{#if data[0].domain != "User not Found"}
|
|
||||||
<p class="api_response">Registration Domain: {data[0]['domain']}</p>
|
<p class="api_response">Registration Domain: {data[0]['domain']}</p>
|
||||||
<p class="api_response">Access Time: {data[0]['atime']}</p>
|
<p class="api_response">Access Time: {data[0]['atime']}</p>
|
||||||
{:else}
|
{:else}
|
||||||
<p class="api_response">You are not registered, we don't have any data stored.</p>
|
<p class="api_response">
|
||||||
{/if}
|
You are not registered, we don't have any data stored.
|
||||||
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<Nav />
|
<Nav />
|
||||||
|
@ -1,27 +1,68 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte'
|
import Header from '$lib/navigation/header.svelte';
|
||||||
import Nav from '$lib/navigation/nav.svelte'
|
import Nav from '$lib/navigation/nav.svelte';
|
||||||
const title = "Privacy Policy"
|
const title = 'Privacy Policy';
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
<div>
|
<div>
|
||||||
<p>OwlBoard stores the minimum amount of data necessary to provide its functions for your use. No personal data is stored unless you report an issue. To review the specific data that we store, please visit <a href="/more/data">My Data</a>.</p>
|
<p>
|
||||||
<p>OwlBoard does not utilize any cookies. IP addresses and browser fingerprints are not logged.</p>
|
OwlBoard stores the minimum amount of data necessary to provide its
|
||||||
|
functions for your use. No personal data is stored unless you report an
|
||||||
|
issue. To review the specific data that we store, please visit <a
|
||||||
|
href="/more/data">My Data</a
|
||||||
|
>.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
OwlBoard does not utilize any cookies. IP addresses and browser fingerprints
|
||||||
|
are not logged.
|
||||||
|
</p>
|
||||||
<h2>If You Do Not Sign Up</h2>
|
<h2>If You Do Not Sign Up</h2>
|
||||||
<p>If you choose not to sign up, no personal data will be processed or stored unless you report an issue. Any personal settings are stored locally in your browser and do not leave your device.</p>
|
<p>
|
||||||
|
If you choose not to sign up, no personal data will be processed or stored
|
||||||
|
unless you report an issue. Any personal settings are stored locally in your
|
||||||
|
browser and do not leave your device.
|
||||||
|
</p>
|
||||||
<h2>If You Sign Up</h2>
|
<h2>If You Sign Up</h2>
|
||||||
<p>If you sign up for the rail staff version of OwlBoard, we do require the storage of some data. However, none of this data can be used to personally identify you. Any personal settings are stored locally in your browser and do not leave your device.</p>
|
<p>
|
||||||
<p>During the sign-up process, you will be asked to provide a work email address, which will be checked to confirm its origin from a railway company. Once confirmed, an email containing a registration link will be sent to you. At this point, the username portion of your email address is discarded. For example, if your email address is 'a-user@owlboard.info', only 'owlboard.info' will be stored. This host portion of your email address is stored to filter and display relevant results prominently.</p>
|
If you sign up for the rail staff version of OwlBoard, we do require the
|
||||||
<p>The email server may store the address and message content as part of its regular operation, and your consent to this is implied when you sign up.</p>
|
storage of some data. However, none of this data can be used to personally
|
||||||
<p>In addition to the host portion of your email address, a randomly generated UUID is stored for the purpose of authorizing access to the rail staff data.</p>
|
identify you. Any personal settings are stored locally in your browser and
|
||||||
|
do not leave your device.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
During the sign-up process, you will be asked to provide a work email
|
||||||
|
address, which will be checked to confirm its origin from a railway company.
|
||||||
|
Once confirmed, an email containing a registration link will be sent to you.
|
||||||
|
At this point, the username portion of your email address is discarded. For
|
||||||
|
example, if your email address is 'a-user@owlboard.info', only
|
||||||
|
'owlboard.info' will be stored. This host portion of your email address is
|
||||||
|
stored to filter and display relevant results prominently.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
The email server may store the address and message content as part of its
|
||||||
|
regular operation, and your consent to this is implied when you sign up.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
In addition to the host portion of your email address, a randomly generated
|
||||||
|
UUID is stored for the purpose of authorizing access to the rail staff data.
|
||||||
|
</p>
|
||||||
<h2>Reporting an Issue</h2>
|
<h2>Reporting an Issue</h2>
|
||||||
<p>When you report an issue, certain data is collected, including your browser's User Agent string and the size of the window in which you are viewing the website.</p>
|
<p>
|
||||||
<p>Any data submitted when reporting an issue will be publicly viewable alongside the <a href="https://git.fjla.uk/owlboard/backend/issues" target="_blank">OwlBoard/backend git repository</a>.</p>
|
When you report an issue, certain data is collected, including your
|
||||||
</div>
|
browser's User Agent string and the size of the window in which you are
|
||||||
|
viewing the website.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Any data submitted when reporting an issue will be publicly viewable
|
||||||
|
alongside the <a
|
||||||
|
href="https://git.fjla.uk/owlboard/backend/issues"
|
||||||
|
target="_blank">OwlBoard/backend git repository</a
|
||||||
|
>.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<Nav />
|
<Nav />
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
div {
|
div {
|
||||||
|
@ -5,49 +5,45 @@
|
|||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from '$lib/navigation/loading.svelte';
|
||||||
import ResultIsland from '$lib/islands/result-island.svelte';
|
import ResultIsland from '$lib/islands/result-island.svelte';
|
||||||
|
|
||||||
const title = "Reason Codes";
|
const title = 'Reason Codes';
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
let inputValue = '';
|
let inputValue = '';
|
||||||
let resultObject = {
|
let resultObject = {
|
||||||
results: false,
|
results: false,
|
||||||
title: "",
|
title: '',
|
||||||
resultLines: []
|
resultLines: []
|
||||||
}
|
};
|
||||||
|
|
||||||
function load() {
|
function load() {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
resultObject.results = false;
|
resultObject.results = false;
|
||||||
getData().then(result => {
|
getData().then((result) => {
|
||||||
handleData(result);
|
handleData(result);
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function getData() {
|
async function getData() {
|
||||||
if (inputValue) {
|
if (inputValue) {
|
||||||
const url = `https://owlboard.info/api/v2/ref/reasonCode/${inputValue}`;
|
const url = `https://owlboard.info/api/v2/ref/reasonCode/${inputValue}`;
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
return await res.json();
|
return await res.json();
|
||||||
} else {
|
} else {
|
||||||
return []
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleData(data) {
|
async function handleData(data) {
|
||||||
let resultLines = []
|
let resultLines = [];
|
||||||
if (data.length) {
|
if (data.length) {
|
||||||
resultObject.title = data[0]['code'];
|
resultObject.title = data[0]['code'];
|
||||||
resultLines = [
|
resultLines = [data[0]['lateReason'], data[0]['cancReason']];
|
||||||
data[0]['lateReason'],
|
|
||||||
data[0]['cancReason']
|
|
||||||
]
|
|
||||||
} else {
|
} else {
|
||||||
resultObject = {
|
resultObject = {
|
||||||
results: false,
|
results: false,
|
||||||
title: "Not Found",
|
title: 'Not Found',
|
||||||
resultLines: []
|
resultLines: []
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
resultObject.resultLines = resultLines;
|
resultObject.resultLines = resultLines;
|
||||||
resultObject.results = true;
|
resultObject.results = true;
|
||||||
@ -68,11 +64,20 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
<p>A reason code is a three digit number that maps to a reason for a delay or cancellation</p>
|
<p>
|
||||||
|
A reason code is a three digit number that maps to a reason for a delay or
|
||||||
|
cancellation
|
||||||
|
</p>
|
||||||
<form on:submit={handleSubmit}>
|
<form on:submit={handleSubmit}>
|
||||||
<input type="text" placeholder="Enter Code" autocomplete="off" bind:value={inputValue} on:input={handleInput} />
|
<input
|
||||||
|
type="text"
|
||||||
|
placeholder="Enter Code"
|
||||||
|
autocomplete="off"
|
||||||
|
bind:value={inputValue}
|
||||||
|
on:input={handleInput}
|
||||||
|
/>
|
||||||
|
|
||||||
<br>
|
<br />
|
||||||
|
|
||||||
<button type="submit">Submit</button>
|
<button type="submit">Submit</button>
|
||||||
</form>
|
</form>
|
||||||
@ -100,7 +105,8 @@
|
|||||||
border-radius: 50px;
|
border-radius: 50px;
|
||||||
border: none;
|
border: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
|
||||||
|
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
@ -112,7 +118,8 @@
|
|||||||
border: none;
|
border: none;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
|
||||||
|
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
background-color: var(--overlay-color);
|
background-color: var(--overlay-color);
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from "$lib/navigation/header.svelte";
|
import Header from '$lib/navigation/header.svelte';
|
||||||
import Nav from "$lib/navigation/nav.svelte";
|
import Nav from '$lib/navigation/nav.svelte';
|
||||||
import Loading from "$lib/navigation/loading.svelte";
|
import Loading from '$lib/navigation/loading.svelte';
|
||||||
import { onMount } from "svelte";
|
import { onMount } from 'svelte';
|
||||||
import { uuid } from "$lib/stores/uuid.js";
|
import { uuid } from '$lib/stores/uuid.js';
|
||||||
|
|
||||||
const title = "Register";
|
const title = 'Register';
|
||||||
|
|
||||||
let state = "unreg";
|
let state = 'unreg';
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
let inputValue = "";
|
let inputValue = '';
|
||||||
|
|
||||||
function handleInput(event) {
|
function handleInput(event) {
|
||||||
inputValue = event.target.value;
|
inputValue = event.target.value;
|
||||||
@ -19,31 +19,30 @@
|
|||||||
isLoading = true;
|
isLoading = true;
|
||||||
const url = 'https://owlboard.info/api/v2/user/request';
|
const url = 'https://owlboard.info/api/v2/user/request';
|
||||||
const request = {
|
const request = {
|
||||||
method: "POST",
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
email: inputValue
|
email: inputValue
|
||||||
})
|
})
|
||||||
}
|
};
|
||||||
const res = await fetch(url, request);
|
const res = await fetch(url, request);
|
||||||
if (res.status == 400 || res.status == 403) {
|
if (res.status == 400 || res.status == 403) {
|
||||||
state = "unauth";
|
state = 'unauth';
|
||||||
} else if (res.status == 201) {
|
} else if (res.status == 201) {
|
||||||
state = "sent";
|
state = 'sent';
|
||||||
} else {
|
} else {
|
||||||
state = "error";
|
state = 'error';
|
||||||
}
|
}
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if ($uuid != "null") {
|
if ($uuid != 'null') {
|
||||||
state = "reg"
|
state = 'reg';
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if isLoading}
|
{#if isLoading}
|
||||||
@ -51,7 +50,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
{#if state == "unreg"}
|
{#if state == 'unreg'}
|
||||||
<p>The staff version of OwlBoard offers several extra features:</p>
|
<p>The staff version of OwlBoard offers several extra features:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Access the Train Finder</li>
|
<li>Access the Train Finder</li>
|
||||||
@ -63,31 +62,54 @@
|
|||||||
<li>Display up to 40 services</li>
|
<li>Display up to 40 services</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
<p>To register, you will need to enter a work email address to receive a confirmation email</p>
|
<p>
|
||||||
|
To register, you will need to enter a work email address to receive a
|
||||||
|
confirmation email
|
||||||
|
</p>
|
||||||
<form on:submit={request}>
|
<form on:submit={request}>
|
||||||
<input type="text" autocomplete="email" placeholder="Enter work email" bind:value={inputValue} on:input={handleInput}><br>
|
<input
|
||||||
|
type="text"
|
||||||
|
autocomplete="email"
|
||||||
|
placeholder="Enter work email"
|
||||||
|
bind:value={inputValue}
|
||||||
|
on:input={handleInput}
|
||||||
|
/><br />
|
||||||
<label for="checkbox">
|
<label for="checkbox">
|
||||||
I have read and accept the terms of the <a href="/more/privacy">Privacy Policy</a><br>
|
I have read and accept the terms of the <a href="/more/privacy"
|
||||||
<input id="checkbox" type="checkbox" required>
|
>Privacy Policy</a
|
||||||
</label><br>
|
><br />
|
||||||
|
<input id="checkbox" type="checkbox" required />
|
||||||
|
</label><br />
|
||||||
<button type="submit">Submit</button>
|
<button type="submit">Submit</button>
|
||||||
</form>
|
</form>
|
||||||
|
{:else if state == 'sent'}
|
||||||
{:else if state == "sent"}
|
<p>
|
||||||
<p>An email has been sent, click the link in the email to activate your profile.</p>
|
An email has been sent, click the link in the email to activate your
|
||||||
<p>When you click the link, your authorisation key will be automatically be stored in your browser.</p>
|
profile.
|
||||||
<p>If you use multiple browsers, you will only be logged in using the browser you open the link with.</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
When you click the link, your authorisation key will be automatically be
|
||||||
|
stored in your browser.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
If you use multiple browsers, you will only be logged in using the browser
|
||||||
|
you open the link with.
|
||||||
|
</p>
|
||||||
<p>You will be able to register again using the same email address</p>
|
<p>You will be able to register again using the same email address</p>
|
||||||
{:else if state == "unauth"}
|
{:else if state == 'unauth'}
|
||||||
<p>The email address you entered does not belong to an authorised business.</p>
|
<p>
|
||||||
<p>If you think this is an error, you can report an issue in the 'More' menu.</p>
|
The email address you entered does not belong to an authorised business.
|
||||||
{:else if state == "error"}
|
</p>
|
||||||
|
<p>
|
||||||
|
If you think this is an error, you can report an issue in the 'More' menu.
|
||||||
|
</p>
|
||||||
|
{:else if state == 'error'}
|
||||||
<p>There was an error processing your request.</p>
|
<p>There was an error processing your request.</p>
|
||||||
<p>Check that the email you entered was correct or try again later.</p>
|
<p>Check that the email you entered was correct or try again later.</p>
|
||||||
{:else if state == "reg"}
|
{:else if state == 'reg'}
|
||||||
<p>You are already registered for OwlBoard</p>
|
<p>You are already registered for OwlBoard</p>
|
||||||
{/if}
|
{/if}
|
||||||
<Nav />
|
<Nav />
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
ul {
|
ul {
|
||||||
@ -98,7 +120,8 @@
|
|||||||
height: 40px;
|
height: 40px;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
max-width: 375px;
|
max-width: 375px;
|
||||||
font-family: urwgothic, 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
|
font-family: urwgothic, 'Franklin Gothic Medium', 'Arial Narrow', Arial,
|
||||||
|
sans-serif;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
border-radius: 50px;
|
border-radius: 50px;
|
||||||
|
@ -1,72 +1,73 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from "$lib/navigation/header.svelte";
|
import Header from '$lib/navigation/header.svelte';
|
||||||
import Loading from "$lib/navigation/loading.svelte";
|
import Loading from '$lib/navigation/loading.svelte';
|
||||||
import Nav from "$lib/navigation/nav.svelte";
|
import Nav from '$lib/navigation/nav.svelte';
|
||||||
import { uuid } from "$lib/stores/uuid.js";
|
import { uuid } from '$lib/stores/uuid.js';
|
||||||
import { onMount } from "svelte";
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
const title = "Registration"
|
const title = 'Registration';
|
||||||
let state = "";
|
let state = '';
|
||||||
let isLoading = true
|
let isLoading = true;
|
||||||
|
|
||||||
async function getUUID() {
|
async function getUUID() {
|
||||||
return new URLSearchParams(window.location.search).get('key');
|
return new URLSearchParams(window.location.search).get('key');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function submit(id) {
|
async function submit(id) {
|
||||||
const url = "https://owlboard.info/api/v2/user/register"
|
const url = 'https://owlboard.info/api/v2/user/register';
|
||||||
const request = {
|
const request = {
|
||||||
method: "POST",
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
uuid: id
|
uuid: id
|
||||||
})
|
})
|
||||||
}
|
};
|
||||||
const res = await fetch(url, request);
|
const res = await fetch(url, request);
|
||||||
const body = await res.json();
|
const body = await res.json();
|
||||||
if (body.api_key) {
|
if (body.api_key) {
|
||||||
uuid.set(body.api_key);
|
uuid.set(body.api_key);
|
||||||
return 201
|
return 201;
|
||||||
}
|
}
|
||||||
return res.status;
|
return res.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
const id = await getUUID() || "";
|
const id = (await getUUID()) || '';
|
||||||
if (id == "" || !id) {
|
if (id == '' || !id) {
|
||||||
state = "none"
|
state = 'none';
|
||||||
isLoading = false
|
isLoading = false;
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
const status = await submit(id)
|
const status = await submit(id);
|
||||||
if (status == 201) {
|
if (status == 201) {
|
||||||
console.log("Registered Successfully")
|
console.log('Registered Successfully');
|
||||||
state = "done"
|
state = 'done';
|
||||||
} else if (status == 401) {
|
} else if (status == 401) {
|
||||||
console.log("Invalid Key")
|
console.log('Invalid Key');
|
||||||
state = "unauth"
|
state = 'unauth';
|
||||||
} else {
|
} else {
|
||||||
console.log("Error")
|
console.log('Error');
|
||||||
state = "error"
|
state = 'error';
|
||||||
}
|
}
|
||||||
isLoading = false
|
isLoading = false;
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
{#if isLoading}
|
{#if isLoading}
|
||||||
<Loading />
|
<Loading />
|
||||||
{/if}
|
{/if}
|
||||||
{#if state == "none"}
|
{#if state == 'none'}
|
||||||
<p>Unable to read your access key.</p>
|
<p>Unable to read your access key.</p>
|
||||||
<p>Please click the link in your email again.</p>
|
<p>Please click the link in your email again.</p>
|
||||||
{:else if state == "unauth"}
|
{:else if state == 'unauth'}
|
||||||
<p>Your link is not valid, links expire after 30 minutes.</p>
|
<p>Your link is not valid, links expire after 30 minutes.</p>
|
||||||
<p>You can try to register again.</p>
|
<p>You can try to register again.</p>
|
||||||
{:else if state == "error"}
|
{:else if state == 'error'}
|
||||||
<p>There was an error on our end, please try again later</p>
|
<p>There was an error on our end, please try again later</p>
|
||||||
{:else if state == "done"}
|
{:else if state == 'done'}
|
||||||
<p>You are now logged in</p>
|
<p>You are now logged in</p>
|
||||||
{/if}
|
{/if}
|
||||||
<Nav />
|
<Nav />
|
@ -1,62 +1,66 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from "$lib/navigation/header.svelte";
|
import Header from '$lib/navigation/header.svelte';
|
||||||
import Island from "$lib/islands/island.svelte";
|
import Island from '$lib/islands/island.svelte';
|
||||||
import Nav from "$lib/navigation/nav.svelte";
|
import Nav from '$lib/navigation/nav.svelte';
|
||||||
import { onMount } from "svelte";
|
import { onMount } from 'svelte';
|
||||||
import Loading from "$lib/navigation/loading.svelte";
|
import Loading from '$lib/navigation/loading.svelte';
|
||||||
import Done from "$lib/navigation/done.svelte";
|
import Done from '$lib/navigation/done.svelte';
|
||||||
|
|
||||||
const title = "Report Issue";
|
const title = 'Report Issue';
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
let isDone = false;
|
let isDone = false;
|
||||||
let isError = false;
|
let isError = false;
|
||||||
|
|
||||||
let reportType = "", reportSubject = "", reportMsg = "", reportCollected
|
let reportType = '',
|
||||||
|
reportSubject = '',
|
||||||
|
reportMsg = '',
|
||||||
|
reportCollected;
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
reportCollected = {
|
reportCollected = {
|
||||||
userAgent: navigator.userAgent,
|
userAgent: navigator.userAgent,
|
||||||
browser: navigator.appName,
|
browser: navigator.appName,
|
||||||
version: navigator.appVersion,
|
version: navigator.appVersion,
|
||||||
platform: navigator.platform,
|
platform: navigator.platform,
|
||||||
viewport: `${window.innerWidth} x ${window.innerHeight}`,
|
viewport: `${window.innerWidth} x ${window.innerHeight}`
|
||||||
};
|
};
|
||||||
})
|
});
|
||||||
|
|
||||||
let preFlight = false;
|
let preFlight = false;
|
||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
console.log(reportType,reportSubject,reportMsg)
|
console.log(reportType, reportSubject, reportMsg);
|
||||||
preFlight = true;
|
preFlight = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function send() {
|
async function send() {
|
||||||
console.log("SEND DATA REQUESTED")
|
console.log('SEND DATA REQUESTED');
|
||||||
isLoading = true
|
isLoading = true;
|
||||||
const formData = JSON.stringify({
|
const formData = JSON.stringify({
|
||||||
label: reportType,
|
label: reportType,
|
||||||
subject: reportSubject,
|
subject: reportSubject,
|
||||||
msg: `User Agent: ${reportCollected.userAgent}\n` +
|
msg:
|
||||||
|
`User Agent: ${reportCollected.userAgent}\n` +
|
||||||
`Browser: ${reportCollected.browser}\n` +
|
`Browser: ${reportCollected.browser}\n` +
|
||||||
`BrowserVersion: ${reportCollected.version}\n` +
|
`BrowserVersion: ${reportCollected.version}\n` +
|
||||||
`Platform: ${reportCollected.platform}\n` +
|
`Platform: ${reportCollected.platform}\n` +
|
||||||
`Viewport: ${reportCollected.viewport}\n\n\n` +
|
`Viewport: ${reportCollected.viewport}\n\n\n` +
|
||||||
`User Message:\n` +
|
`User Message:\n` +
|
||||||
`${reportMsg}`
|
`${reportMsg}`
|
||||||
})
|
});
|
||||||
const url = `https://owlboard.info/misc/issue`
|
const url = `https://owlboard.info/misc/issue`;
|
||||||
const options = {
|
const options = {
|
||||||
method: "POST",
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: formData
|
body: formData
|
||||||
}
|
};
|
||||||
const res = await fetch(url, options)
|
const res = await fetch(url, options);
|
||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
isDone = true;
|
isDone = true;
|
||||||
await new Promise(r => setTimeout(r, 2000));
|
await new Promise((r) => setTimeout(r, 2000));
|
||||||
window.location.href = "/";
|
window.location.href = '/';
|
||||||
} else {
|
} else {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
isError = true;
|
isError = true;
|
||||||
@ -69,8 +73,8 @@
|
|||||||
isDone = false;
|
isDone = false;
|
||||||
isError = false;
|
isError = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
|
|
||||||
{#if isLoading}
|
{#if isLoading}
|
||||||
@ -82,31 +86,52 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if !preFlight && !isDone}
|
{#if !preFlight && !isDone}
|
||||||
<p>Any data that you enter here will be visible publicly
|
<p>
|
||||||
<a href="https://git.fjla.uk/OwlBoard/backend/issues" target="_blank">here</a>
|
Any data that you enter here will be visible publicly
|
||||||
|
<a href="https://git.fjla.uk/OwlBoard/backend/issues" target="_blank"
|
||||||
|
>here</a
|
||||||
|
>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
You will be shown all of the collected data before the form is submitted.
|
||||||
</p>
|
</p>
|
||||||
<p>You will be shown all of the collected data before the form is submitted.</p>
|
|
||||||
<form on:submit={submit}>
|
<form on:submit={submit}>
|
||||||
<select class="formInputs" name="type" bind:value={reportType} placeholder="Choose Category">
|
<select
|
||||||
|
class="formInputs"
|
||||||
|
name="type"
|
||||||
|
bind:value={reportType}
|
||||||
|
placeholder="Choose Category"
|
||||||
|
>
|
||||||
<option value="" disabled selected>Choose an Issue Type</option>
|
<option value="" disabled selected>Choose an Issue Type</option>
|
||||||
<option value="bug">Problem</option>
|
<option value="bug">Problem</option>
|
||||||
<option value="enhancement">Feature Request</option>
|
<option value="enhancement">Feature Request</option>
|
||||||
<option value="question">Question</option>
|
<option value="question">Question</option>
|
||||||
<option value="user-support">Unable to sign up</option>
|
<option value="user-support">Unable to sign up</option>
|
||||||
</select>
|
</select>
|
||||||
<br>
|
<br />
|
||||||
<input class="formInputs" type="text" bind:value={reportSubject} placeholder="Subject">
|
<input
|
||||||
<br>
|
class="formInputs"
|
||||||
<textarea class="formInputs" bind:value={reportMsg} placeholder="Enter your message..."/>
|
type="text"
|
||||||
<br>
|
bind:value={reportSubject}
|
||||||
|
placeholder="Subject"
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
|
<textarea
|
||||||
|
class="formInputs"
|
||||||
|
bind:value={reportMsg}
|
||||||
|
placeholder="Enter your message..."
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
<button type="submit">Submit</button>
|
<button type="submit">Submit</button>
|
||||||
<button type="reset">Reset</button>
|
<button type="reset">Reset</button>
|
||||||
</form>
|
</form>
|
||||||
{:else}
|
{:else}
|
||||||
<Island>
|
<Island>
|
||||||
<h2>Device Data:</h2>
|
<h2>Device Data:</h2>
|
||||||
<p><span class="dataType">User Agent: </span>{reportCollected.userAgent}</p>
|
<p><span class="dataType">User Agent: </span>{reportCollected.userAgent}</p>
|
||||||
<p><span class="dataType">Browser: </span>{reportCollected.browser} - {reportCollected.version}</p>
|
<p>
|
||||||
|
<span class="dataType">Browser: </span>{reportCollected.browser} - {reportCollected.version}
|
||||||
|
</p>
|
||||||
<p><span class="dataType">Platform: </span>{reportCollected.platform}</p>
|
<p><span class="dataType">Platform: </span>{reportCollected.platform}</p>
|
||||||
<p><span class="dataType">Viewport: </span> {reportCollected.viewport}</p>
|
<p><span class="dataType">Viewport: </span> {reportCollected.viewport}</p>
|
||||||
<h2>Reported Data:</h2>
|
<h2>Reported Data:</h2>
|
||||||
@ -115,7 +140,7 @@
|
|||||||
<p>{reportMsg}</p>
|
<p>{reportMsg}</p>
|
||||||
<button class="overlayButtons" on:click={send}>Send</button>
|
<button class="overlayButtons" on:click={send}>Send</button>
|
||||||
<button class="overlayButtons" on:click={cancel}>Cancel</button>
|
<button class="overlayButtons" on:click={cancel}>Cancel</button>
|
||||||
</Island>
|
</Island>
|
||||||
{/if}
|
{/if}
|
||||||
<Nav />
|
<Nav />
|
||||||
|
|
||||||
@ -161,8 +186,12 @@
|
|||||||
height: 30px;
|
height: 30px;
|
||||||
max-width: 100px;
|
max-width: 100px;
|
||||||
}
|
}
|
||||||
h2 {color: white;}
|
h2 {
|
||||||
.dataType {color: white;}
|
color: white;
|
||||||
|
}
|
||||||
|
.dataType {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
.overlayButtons {
|
.overlayButtons {
|
||||||
background-color: var(--main-bg-color);
|
background-color: var(--main-bg-color);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte'
|
import Header from '$lib/navigation/header.svelte';
|
||||||
import Nav from '$lib/navigation/nav.svelte'
|
import Nav from '$lib/navigation/nav.svelte';
|
||||||
import QlSet from '$lib/islands/quick-link-set-island.svelte'
|
import QlSet from '$lib/islands/quick-link-set-island.svelte';
|
||||||
const title = "Settings"
|
const title = 'Settings';
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
|
|
||||||
<QlSet />
|
<QlSet />
|
||||||
|
|
||||||
<Nav />
|
<Nav />
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
<script>
|
<script>
|
||||||
import Island from '$lib/islands/island.svelte';
|
import Island from '$lib/islands/island.svelte';
|
||||||
import Header from '$lib/navigation/header.svelte'
|
import Header from '$lib/navigation/header.svelte';
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from '$lib/navigation/loading.svelte';
|
||||||
import Nav from '$lib/navigation/nav.svelte'
|
import Nav from '$lib/navigation/nav.svelte';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
const title = "Statistics"
|
const title = 'Statistics';
|
||||||
let isLoading = true;
|
let isLoading = true;
|
||||||
|
|
||||||
let data, error;
|
let data, error;
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
const url = "https://owlboard.info/misc/server/stats"
|
const url = 'https://owlboard.info/misc/server/stats';
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
data = await res.json();
|
data = await res.json();
|
||||||
@ -18,18 +18,17 @@ import Header from '$lib/navigation/header.svelte'
|
|||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
})
|
});
|
||||||
|
|
||||||
function U2L(input) {
|
function U2L(input) {
|
||||||
try {
|
try {
|
||||||
const datetime = new Date(input*1000)
|
const datetime = new Date(input * 1000);
|
||||||
return datetime.toLocaleString()
|
return datetime.toLocaleString();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
@ -43,7 +42,7 @@ import Header from '$lib/navigation/header.svelte'
|
|||||||
{#if isLoading}
|
{#if isLoading}
|
||||||
<Loading />
|
<Loading />
|
||||||
{:else if !isLoading && !error}
|
{:else if !isLoading && !error}
|
||||||
<p>API Server:<br><span>{data?.hostname}</span></p>
|
<p>API Server:<br /><span>{data?.hostname}</span></p>
|
||||||
<p>Runtime Mode: <span>{data?.runtimeMode}</span></p>
|
<p>Runtime Mode: <span>{data?.runtimeMode}</span></p>
|
||||||
<p>Stats Reset: <span>{U2L(data?.reset) || 'Unknown'}</span></p>
|
<p>Stats Reset: <span>{U2L(data?.reset) || 'Unknown'}</span></p>
|
||||||
<h2>Last Update</h2>
|
<h2>Last Update</h2>
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte'
|
import Header from '$lib/navigation/header.svelte';
|
||||||
import Island from '$lib/islands/island.svelte';
|
import Island from '$lib/islands/island.svelte';
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from '$lib/navigation/loading.svelte';
|
||||||
import Nav from '$lib/navigation/nav.svelte'
|
import Nav from '$lib/navigation/nav.svelte';
|
||||||
import LargeLogo from '$lib/images/large-logo.svelte';
|
import LargeLogo from '$lib/images/large-logo.svelte';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
const title = "Versions"
|
const title = 'Versions';
|
||||||
const variable = {title:""};
|
const variable = { title: '' };
|
||||||
|
|
||||||
let data, isLoading = true;
|
let data,
|
||||||
|
isLoading = true;
|
||||||
|
|
||||||
async function getData() {
|
async function getData() {
|
||||||
const url = 'https://owlboard.info/misc/server/versions'
|
const url = 'https://owlboard.info/misc/server/versions';
|
||||||
const res = await fetch(url)
|
const res = await fetch(url);
|
||||||
data = await res.json();
|
data = await res.json();
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
}
|
}
|
||||||
@ -20,7 +21,6 @@
|
|||||||
onMount(() => {
|
onMount(() => {
|
||||||
getData();
|
getData();
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
@ -28,16 +28,20 @@
|
|||||||
<LargeLogo />
|
<LargeLogo />
|
||||||
|
|
||||||
{#if isLoading}
|
{#if isLoading}
|
||||||
<Loading/>
|
<Loading />
|
||||||
{:else}
|
{:else}
|
||||||
<Island>
|
<Island>
|
||||||
<p>Web-app Version<br><span class="data">{"2023.7.1-Svelte-Dev"}</span></p>
|
<p>
|
||||||
<p>API Server Version<br><span class="data">{data.backend}</span></p>
|
Web-app Version<br /><span class="data">{'2023.7.1-Svelte-Dev'}</span>
|
||||||
<p>DBManager Version<br><span class="data">{data['db-manager']}</span></p>
|
</p>
|
||||||
|
<p>API Server Version<br /><span class="data">{data.backend}</span></p>
|
||||||
|
<p>DBManager Version<br /><span class="data">{data['db-manager']}</span></p>
|
||||||
</Island>
|
</Island>
|
||||||
{/if}
|
{/if}
|
||||||
<Nav />
|
<Nav />
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.data {color: white;}
|
.data {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
@ -1,56 +1,56 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte'
|
import Header from '$lib/navigation/header.svelte';
|
||||||
import Nav from '$lib/navigation/nav.svelte'
|
import Nav from '$lib/navigation/nav.svelte';
|
||||||
import Island from '$lib/islands/island.svelte';
|
import Island from '$lib/islands/island.svelte';
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from '$lib/navigation/loading.svelte';
|
||||||
import { uuid } from '$lib/stores/uuid';
|
import { uuid } from '$lib/stores/uuid';
|
||||||
|
|
||||||
const title = "PIS Finder"
|
const title = 'PIS Finder';
|
||||||
const variables = {title: "Results"}
|
const variables = { title: 'Results' };
|
||||||
let entryPIS = "";
|
let entryPIS = '';
|
||||||
let entryStartCRS = "";
|
let entryStartCRS = '';
|
||||||
let entryEndCRS = "";
|
let entryEndCRS = '';
|
||||||
let data = [];
|
let data = [];
|
||||||
let error = false;
|
let error = false;
|
||||||
let errMsg = "Unknown Error"
|
let errMsg = 'Unknown Error';
|
||||||
let isLoading = false
|
let isLoading = false;
|
||||||
|
|
||||||
async function findByStartEnd() {
|
async function findByStartEnd() {
|
||||||
isLoading = true
|
isLoading = true;
|
||||||
const url = `https://owlboard.info/api/v2/pis/byStartEnd/${entryStartCRS}/${entryEndCRS}`
|
const url = `https://owlboard.info/api/v2/pis/byStartEnd/${entryStartCRS}/${entryEndCRS}`;
|
||||||
await fetchData(url);
|
await fetchData(url);
|
||||||
isLoading = false
|
isLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findByPis() {
|
async function findByPis() {
|
||||||
isLoading = true
|
isLoading = true;
|
||||||
const url = `https://owlboard.info/api/v2/pis/byCode/${entryPIS}`
|
const url = `https://owlboard.info/api/v2/pis/byCode/${entryPIS}`;
|
||||||
await fetchData(url);
|
await fetchData(url);
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchData(url) {
|
async function fetchData(url) {
|
||||||
const options = {
|
const options = {
|
||||||
method: "GET",
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
"uuid": $uuid
|
uuid: $uuid
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
const res = await fetch(url, options); // Enable Auth
|
const res = await fetch(url, options); // Enable Auth
|
||||||
if (res.status == 401) {
|
if (res.status == 401) {
|
||||||
errMsg = "You must be logged in to the staff version"
|
errMsg = 'You must be logged in to the staff version';
|
||||||
error = true
|
error = true;
|
||||||
return false
|
return false;
|
||||||
} else if (res.status == 500) {
|
} else if (res.status == 500) {
|
||||||
errMsg = "Server Error, try again later"
|
errMsg = 'Server Error, try again later';
|
||||||
error = true
|
error = true;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
const jsonData = await res.json();
|
const jsonData = await res.json();
|
||||||
if (jsonData.ERROR == "offline") {
|
if (jsonData.ERROR == 'offline') {
|
||||||
errMsg = "Connection error, check your internet connection and try again"
|
errMsg = 'Connection error, check your internet connection and try again';
|
||||||
error = true
|
error = true;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
data = jsonData;
|
data = jsonData;
|
||||||
}
|
}
|
||||||
@ -58,16 +58,16 @@
|
|||||||
async function reset() {
|
async function reset() {
|
||||||
data = [];
|
data = [];
|
||||||
error = false;
|
error = false;
|
||||||
entryPIS = "";
|
entryPIS = '';
|
||||||
entryStartCRS = "";
|
entryStartCRS = '';
|
||||||
entryEndCRS = "";
|
entryEndCRS = '';
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
|
|
||||||
{#if isLoading}
|
{#if isLoading}
|
||||||
<Loading/>
|
<Loading />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if error}
|
{#if error}
|
||||||
@ -84,9 +84,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{#each data as item}
|
{#each data as item}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="toc toc-data">{item.operator || "-"}</td>
|
<td class="toc toc-data">{item.operator || '-'}</td>
|
||||||
<td class="code">{item.code}</td>
|
<td class="code">{item.code}</td>
|
||||||
<td class="stops stops-data">{item.stops.join(" ")}</td>
|
<td class="stops stops-data">{item.stops.join(' ')}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
</table>
|
</table>
|
||||||
@ -96,16 +96,34 @@
|
|||||||
<p>This feature is only supported for GWR West & Sleeper services</p>
|
<p>This feature is only supported for GWR West & Sleeper services</p>
|
||||||
<p class="label">Find By Start/End CRS:</p>
|
<p class="label">Find By Start/End CRS:</p>
|
||||||
<form on:submit={findByStartEnd}>
|
<form on:submit={findByStartEnd}>
|
||||||
<input type="text" maxlength="3" autocomplete="off" placeholder="Start" bind:value={entryStartCRS}>
|
<input
|
||||||
<input type="text" maxlength="3" autocomplete="off" placeholder="End" bind:value={entryEndCRS}>
|
type="text"
|
||||||
<br>
|
maxlength="3"
|
||||||
|
autocomplete="off"
|
||||||
|
placeholder="Start"
|
||||||
|
bind:value={entryStartCRS}
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
maxlength="3"
|
||||||
|
autocomplete="off"
|
||||||
|
placeholder="End"
|
||||||
|
bind:value={entryEndCRS}
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
<button type="submit">Search</button>
|
<button type="submit">Search</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<p class="label">Find By PIS Code:</p>
|
<p class="label">Find By PIS Code:</p>
|
||||||
<form on:submit={findByPis}>
|
<form on:submit={findByPis}>
|
||||||
<input type="number" max="9999" autocomplete="off" placeholder="PIS" bind:value={entryPIS}>
|
<input
|
||||||
<br>
|
type="number"
|
||||||
|
max="9999"
|
||||||
|
autocomplete="off"
|
||||||
|
placeholder="PIS"
|
||||||
|
bind:value={entryPIS}
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
<button type="submit">Search</button>
|
<button type="submit">Search</button>
|
||||||
</form>
|
</form>
|
||||||
{/if}
|
{/if}
|
||||||
@ -145,7 +163,7 @@
|
|||||||
}
|
}
|
||||||
table {
|
table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin:auto;
|
margin: auto;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
td {
|
td {
|
||||||
@ -170,6 +188,6 @@
|
|||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
#reset {
|
#reset {
|
||||||
margin:25px;
|
margin: 25px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -1,25 +1,25 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte'
|
import Header from '$lib/navigation/header.svelte';
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from '$lib/navigation/loading.svelte';
|
||||||
import Island from '$lib/islands/island.svelte';
|
import Island from '$lib/islands/island.svelte';
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from '$lib/navigation/nav.svelte';
|
||||||
import { uuid } from '$lib/stores/uuid';
|
import { uuid } from '$lib/stores/uuid';
|
||||||
|
|
||||||
import { onMount } from 'svelte'
|
import { onMount } from 'svelte';
|
||||||
import TrainDetail from '$lib/train/train-detail.svelte';
|
import TrainDetail from '$lib/train/train-detail.svelte';
|
||||||
|
|
||||||
let title = "Timetable Results"
|
let title = 'Timetable Results';
|
||||||
let id = ""
|
let id = '';
|
||||||
let data = [];
|
let data = [];
|
||||||
let isLoading = true;
|
let isLoading = true;
|
||||||
let error = false;
|
let error = false;
|
||||||
let errMsg = "";
|
let errMsg = '';
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
if (id) {
|
if (id) {
|
||||||
title = id.toUpperCase();
|
title = id.toUpperCase();
|
||||||
} else {
|
} else {
|
||||||
title = "Querying Timetable"
|
title = 'Querying Timetable';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,52 +29,51 @@
|
|||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
id = await getHeadcode() || "";
|
id = (await getHeadcode()) || '';
|
||||||
const res = await fetchData(id);
|
const res = await fetchData(id);
|
||||||
if (res) {
|
if (res) {
|
||||||
data = res;
|
data = res;
|
||||||
if (!data.length) {
|
if (!data.length) {
|
||||||
error = true;
|
error = true;
|
||||||
errMsg = "No services found"
|
errMsg = 'No services found';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
})
|
});
|
||||||
|
|
||||||
async function fetchData(id = "") {
|
async function fetchData(id = '') {
|
||||||
const date = 'now';
|
const date = 'now';
|
||||||
const searchType = 'headcode'
|
const searchType = 'headcode';
|
||||||
const options = {
|
const options = {
|
||||||
method: "GET",
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
"uuid": $uuid
|
uuid: $uuid
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
const url = `https://owlboard.info/api/v2/timetable/train/${date}/${searchType}/${id}`
|
const url = `https://owlboard.info/api/v2/timetable/train/${date}/${searchType}/${id}`;
|
||||||
const res = await fetch(url, options);
|
const res = await fetch(url, options);
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
return await res.json();
|
return await res.json();
|
||||||
} else if (res.status === 401) {
|
} else if (res.status === 401) {
|
||||||
error = true;
|
error = true;
|
||||||
errMsg = "You must be logged into the staff version for this feature"
|
errMsg = 'You must be logged into the staff version for this feature';
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
error = true;
|
error = true;
|
||||||
errMsg = "Unable to connect, check your connection and try again"
|
errMsg = 'Unable to connect, check your connection and try again';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
<div id="whitespace"></div>
|
<div id="whitespace" />
|
||||||
|
|
||||||
{#if error}
|
{#if error}
|
||||||
<Island>
|
<Island>
|
||||||
<p class="error">{errMsg}</p>
|
<p class="error">{errMsg}</p>
|
||||||
</Island>
|
</Island>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if isLoading}
|
{#if isLoading}
|
||||||
|
@ -4,11 +4,7 @@ import { build, files, version } from '$service-worker';
|
|||||||
|
|
||||||
const cacheName = `ob-${version}`;
|
const cacheName = `ob-${version}`;
|
||||||
|
|
||||||
const assets = [
|
const assets = [...build, ...files, '/service-worker.js'];
|
||||||
...build,
|
|
||||||
...files,
|
|
||||||
"/service-worker.js"
|
|
||||||
];
|
|
||||||
|
|
||||||
self.addEventListener('install', (event) => {
|
self.addEventListener('install', (event) => {
|
||||||
async function addToCache() {
|
async function addToCache() {
|
||||||
@ -17,7 +13,7 @@ self.addEventListener('install', (event) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
event.waitUntil(addToCache());
|
event.waitUntil(addToCache());
|
||||||
})
|
});
|
||||||
|
|
||||||
self.addEventListener('activate', (event) => {
|
self.addEventListener('activate', (event) => {
|
||||||
async function deleteOldCache() {
|
async function deleteOldCache() {
|
||||||
@ -29,22 +25,24 @@ self.addEventListener('activate', (event) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
event.waitUntil(deleteOldCache());
|
event.waitUntil(deleteOldCache());
|
||||||
})
|
});
|
||||||
|
|
||||||
self.addEventListener('fetch', (event) => {
|
self.addEventListener('fetch', (event) => {
|
||||||
if (event.request.method !== 'GET') {return}
|
if (event.request.method !== 'GET') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
async function respond() {
|
async function respond() {
|
||||||
const cacheRes = await caches.match(event.request, {ignoreSearch: true});
|
const cacheRes = await caches.match(event.request, { ignoreSearch: true });
|
||||||
if (cacheRes) {
|
if (cacheRes) {
|
||||||
return cacheRes;
|
return cacheRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return await fetch(event.request)
|
return await fetch(event.request);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return {"error": "OFFLINE", "errorMsg": "You are not online"};
|
return { error: 'OFFLINE', errorMsg: 'You are not online' };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event.respondWith(respond());
|
event.respondWith(respond());
|
||||||
})
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user