Prettier formatting

This commit is contained in:
Fred Boniface 2023-07-07 11:27:28 +01:00
parent 039b57efe7
commit 7dc24646b9
49 changed files with 2796 additions and 2419 deletions

View File

@ -1,11 +1,6 @@
module.exports = {
root: true,
extends: ['eslint:recommended', 'plugin:svelte/recommended', 'prettier'],
overrides: [
{
"files": ["**/*.svelte"]
}
],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
@ -17,6 +12,6 @@ module.exports = {
node: true
},
rules: {
indent: ['error', 2, {SwitchCase: 2}],
indent: ['error', 2, { SwitchCase: 2 }]
}
};

View File

@ -1,9 +1,11 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
"useTabs": false,
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 80,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}

View File

@ -1,17 +1,17 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias and https://kit.svelte.dev/docs/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias and https://kit.svelte.dev/docs/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}

View File

@ -1,29 +1,29 @@
{
"name": "owlboard-svelte",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write ."
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/adapter-static": "^2.0.2",
"@sveltejs/kit": "^1.5.0",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte": "^2.26.0",
"prettier": "^2.8.0",
"prettier-plugin-svelte": "^2.8.1",
"svelte": "^3.54.0",
"svelte-check": "^3.0.1",
"typescript": "^5.0.0",
"vite": "^4.3.0"
},
"type": "module"
"name": "owlboard-svelte",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write ."
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/adapter-static": "^2.0.2",
"@sveltejs/kit": "^1.5.0",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte": "^2.26.0",
"prettier": "^2.8.0",
"prettier-plugin-svelte": "^2.8.1",
"svelte": "^3.54.0",
"svelte-check": "^3.0.1",
"typescript": "^5.0.0",
"vite": "^4.3.0"
},
"type": "module"
}

View File

@ -1,72 +1,75 @@
/* FONTS */
@font-face {
font-family: 'firamono';
src: url('/font/firamono/firamono-regular.woff2') format('woff2'),
url('/font/firamono/firamono-regular.woff') format('woff'),
url('/font/firamono/firamono-regular.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'firamono';
src: url('/font/firamono/firamono-500.woff2') format('woff2'),
url('/font/firamono/firamono-500.woff') format('woff'),
url('/font/firamono/firamono-500.ttf') format('truetype');
font-weight: 500;
font-style: normal;
}
@font-face {
font-family: 'urwgothic';
src: url('/font/urwgothic/urwgothic.woff2') format('woff2'),
url('/font/urwgothic/urwgothic.woff') format('woff'),
url('/font/urwgothic/urwgothic.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'urwgothic';
src: url('/font/urwgothic/urwgothicDemi.woff2') format('woff2'),
url('/font/urwgothic/urwgothicDemi.woff') format('woff'),
url('/font/urwgothic/urwgothicDemi.ttf') format('truetype');
font-weight: 900;
font-style: normal;
}
font-family: 'firamono';
src: url('/font/firamono/firamono-regular.woff2') format('woff2'),
url('/font/firamono/firamono-regular.woff') format('woff'),
url('/font/firamono/firamono-regular.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'firamono';
src: url('/font/firamono/firamono-500.woff2') format('woff2'),
url('/font/firamono/firamono-500.woff') format('woff'),
url('/font/firamono/firamono-500.ttf') format('truetype');
font-weight: 500;
font-style: normal;
}
@font-face {
font-family: 'urwgothic';
src: url('/font/urwgothic/urwgothic.woff2') format('woff2'),
url('/font/urwgothic/urwgothic.woff') format('woff'),
url('/font/urwgothic/urwgothic.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'urwgothic';
src: url('/font/urwgothic/urwgothicDemi.woff2') format('woff2'),
url('/font/urwgothic/urwgothicDemi.woff') format('woff'),
url('/font/urwgothic/urwgothicDemi.ttf') format('truetype');
font-weight: 900;
font-style: normal;
}
/* COLOR VARS */
:root {
--main-bg-color: #404c55;
--second-bg-color: #2b343c; /* Use as first arg in radial gradient */
--accent-color: #007979;
--overlay-color: #3c6f79de;
--overlay-color-solid: #3c6f79;
--main-text-color: #00b7b7;
--second-text-color: #0afdfd;
--note-text-color: #9de7ff;
--link-color: azure;
--box-border-color: ;
--link-visited-color: azure;
--main-alert-color: #ed6d00;
--second-alert-color: #e77f00; /* Use as second arg in radial gradient */
--main-warning-color: orange;
--board-name-color: #fcfc09;
}
--main-bg-color: #404c55;
--second-bg-color: #2b343c; /* Use as first arg in radial gradient */
--accent-color: #007979;
--overlay-color: #3c6f79de;
--overlay-color-solid: #3c6f79;
--main-text-color: #00b7b7;
--second-text-color: #0afdfd;
--note-text-color: #9de7ff;
--link-color: azure;
--box-border-color: ;
--link-visited-color: azure;
--main-alert-color: #ed6d00;
--second-alert-color: #e77f00; /* Use as second arg in radial gradient */
--main-warning-color: orange;
--board-name-color: #fcfc09;
}
html{
width: 100%;
height: 100%;
}
html {
width: 100%;
height: 100%;
}
body {
background-color: var(--main-bg-color);
background-image: radial-gradient(var(--second-bg-color), var(--main-bg-color));
color: var(--second-text-color);
font-family: urwgothic, sans-serif;
text-align: center;
padding-bottom: 60px; /*Footer height*/
}
a {
color: var(--link-color)
}
button:hover {
cursor: pointer;
}
body {
background-color: var(--main-bg-color);
background-image: radial-gradient(
var(--second-bg-color),
var(--main-bg-color)
);
color: var(--second-text-color);
font-family: urwgothic, sans-serif;
text-align: center;
padding-bottom: 60px; /*Footer height*/
}
a {
color: var(--link-color);
}
button:hover {
cursor: pointer;
}

12
src/app.d.ts vendored
View File

@ -1,12 +1,12 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface Platform {}
}
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface Platform {}
}
}
export {};

View File

@ -1,9 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
<head>
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

View File

@ -1,10 +1,10 @@
<img src="/images/logo/wide_logo.svg" alt="Logo">
<img src="/images/logo/wide_logo.svg" alt="Logo" />
<style>
img {
width: 50%;
max-width: 250px;
margin-top: 55px;
margin-bottom: 55px;
}
img {
width: 50%;
max-width: 250px;
margin-top: 55px;
margin-bottom: 55px;
}
</style>

View File

@ -1,45 +1,54 @@
<script>
import Island from "$lib/islands/island.svelte";
export let variables = {
title: "Uninitialised",
action: "/",
placeholder: "Uninitialised",
queryName: "uninitiailsed"
};
import Island from '$lib/islands/island.svelte';
export let variables = {
title: 'Uninitialised',
action: '/',
placeholder: 'Uninitialised',
queryName: 'uninitiailsed'
};
</script>
<Island {variables}>
<form action={variables.action}>
<input class="form-input" type="text" id="input-headcode" name={variables.queryName} placeholder={variables.placeholder} autocomplete="off">
<br>
<form action={variables.action}>
<input
class="form-input"
type="text"
id="input-headcode"
name={variables.queryName}
placeholder={variables.placeholder}
autocomplete="off"
/>
<br />
<button type="submit">Submit</button>
</form>
</form>
</Island>
<style>
.form-input {
width: 75%;
height: 32px;
margin-top: 5px;
margin-bottom: 5px;
border-radius: 50px;
border: none;
text-align: center;
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
text-transform: uppercase;
font-size: 15px;
}
button {
width: 50%;
margin-bottom: 5px;
margin-top: 5px;
border: none;
border-radius: 20px;
padding: 5px;
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-size: 16px;
font-weight: 400;
background-color: var(--main-bg-color);
color: var(--link-color);
}
.form-input {
width: 75%;
height: 32px;
margin-top: 5px;
margin-bottom: 5px;
border-radius: 50px;
border: none;
text-align: center;
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
text-transform: uppercase;
font-size: 15px;
}
button {
width: 50%;
margin-bottom: 5px;
margin-top: 5px;
border: none;
border-radius: 20px;
padding: 5px;
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-size: 16px;
font-weight: 400;
background-color: var(--main-bg-color);
color: var(--link-color);
}
</style>

View File

@ -1,20 +1,21 @@
<script>
export let variables = {title:""}
export let variables = { title: '' };
</script>
<div>
<span>{variables.title}</span>
<slot />
<span>{variables.title}</span>
<slot />
</div>
<style>
span {
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
span {
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-weight: 600;
font-size: 20px;
color: var(--main-text-color)
}
div {
color: var(--main-text-color);
}
div {
width: 85%;
max-width: 400px;
margin: auto;
@ -22,5 +23,5 @@ div {
padding: 10px;
background-color: var(--overlay-color);
border-radius: 10px;
}
}
</style>

View File

@ -1,22 +1,23 @@
<script>
import { fade } from "svelte/transition";
import { fade } from 'svelte/transition';
export let variables = {title:""}
export let variables = { title: '' };
</script>
<div in:fade={{duration: 150}} out:fade={{duration: 150}}>
<span>{variables.title}</span>
<slot />
<div in:fade={{ duration: 150 }} out:fade={{ duration: 150 }}>
<span>{variables.title}</span>
<slot />
</div>
<style>
span {
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
span {
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
color: var(--main-text-color);
font-weight: 600;
font-size: 20px;
}
div {
}
div {
position: fixed;
top: 50%;
left: 50%;
@ -32,5 +33,5 @@ div {
background-color: var(--overlay-color);
border-radius: 10px;
z-index: 1000;
}
}
</style>

View File

@ -1,57 +1,54 @@
<script>
import Island from "$lib/islands/island.svelte";
import { ql } from "$lib/stores/quick-links.js"
export let variables = {
title: "Quick Links",
};
import Island from '$lib/islands/island.svelte';
import { ql } from '$lib/stores/quick-links.js';
export let variables = {
title: 'Quick Links'
};
</script>
<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>
{/if}
<div class="buttons">
{#each $ql as link}
{#if link.length === 3}
<a class="link" href="/ldb?station={link}">
{link.toUpperCase()}
</a>
{:else if link.length === 4}
<a class="link" href="/train?headcode={link}">
{link.toUpperCase()}
</a>
{/if}
{/each}
</div>
{/if}
<div class="buttons">
{#each $ql as link}
{#if link.length === 3}
<a class="link" href="/ldb?station={link}">
{link.toUpperCase()}
</a>
{:else if link.length === 4}
<a class="link" href="/train?headcode={link}">
{link.toUpperCase()}
</a>
{/if}
{/each}
</div>
</Island>
<style>
.buttons {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
width: 90%;
margin: auto;
padding-top: 5px;
}
.link {
flex: 1;
width: 20%;
min-width: 50px;
margin: 5px;
border: none;
border-radius: 20px;
padding: 5px;
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-size: 16px;
font-weight: 400;
text-decoration: none;
background-color: var(--main-bg-color);
color: var(--link-color);
}
.buttons {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
width: 90%;
margin: auto;
padding-top: 5px;
}
.link {
flex: 1;
width: 20%;
min-width: 50px;
margin: 5px;
border: none;
border-radius: 20px;
padding: 5px;
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-size: 16px;
font-weight: 400;
text-decoration: none;
background-color: var(--main-bg-color);
color: var(--link-color);
}
</style>

View File

@ -1,116 +1,117 @@
<script>
import Island from "$lib/islands/island.svelte";
import { ql } from "$lib/stores/quick-links.js";
export let variables = {
title: "Quick Links",
};
import Island from '$lib/islands/island.svelte';
import { ql } from '$lib/stores/quick-links.js';
export let variables = {
title: 'Quick Links'
};
let qlData =[]
$: {
qlData = $ql;
console.log(qlData);
}
let qlData = [];
$: {
qlData = $ql;
console.log(qlData);
}
let saveButton = "Save"
let saveButton = 'Save';
async function timeout(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function timeout(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
async function saveQl() {
// Fetch the content of all text entries within the island then run ql.set([ARRAY OF INPUT CONTENT])
const inputs = document.getElementsByClassName('qlInput');
let inputLinks = []
for (let item of inputs) {
let text = item?.value;
if (text !== '') {
inputLinks.push(text);
}
async function saveQl() {
// Fetch the content of all text entries within the island then run ql.set([ARRAY OF INPUT CONTENT])
const inputs = document.getElementsByClassName('qlInput');
let inputLinks = [];
for (let item of inputs) {
let text = item?.value;
if (text !== '') {
inputLinks.push(text);
}
console.log(inputLinks)
ql.set(inputLinks)
saveButton = "&#10004;"
await timeout(3000);
saveButton = "Saved"
}
console.log(inputLinks);
ql.set(inputLinks);
saveButton = '&#10004;';
await timeout(3000);
saveButton = 'Saved';
}
function clearQl() {
ql.set([]);
saveButton = "Saved"
}
function clearQl() {
ql.set([]);
saveButton = 'Saved';
}
function addQlBox() {
saveButton = "Save"
const updatedQl = [...$ql, ""];
$ql = updatedQl;
ql.set(updatedQl);
}
function addQlBox() {
saveButton = 'Save';
const updatedQl = [...$ql, ''];
$ql = updatedQl;
ql.set(updatedQl);
}
function handleClick(event) {
// Handle the click event here
console.log("Island Clicked");
// You can access the `variables` passed to the Island component here if needed
}
</script>
<Island on:click={handleClick} {variables}>
{#if $ql.length === 0}
<p>Click the + button to add links</p>
{/if}
<div id="buttons" class="buttons">
<p>Quick links can be CRS Codes or Headcodes</p>
{#each qlData as link}
<input class="qlInput" type="text" value={link}>
{/each}
<button on:click={addQlBox} id="qlAdd">+</button>
</div>
<button on:click={saveQl}>{@html saveButton}</button>
<button on:click={clearQl}>Clear</button>
</Island>
function handleClick(event) {
// Handle the click event here
console.log('Island Clicked');
// You can access the `variables` passed to the Island component here if needed
}
</script>
<Island on:click={handleClick} {variables}>
{#if $ql.length === 0}
<p>Click the + button to add links</p>
{/if}
<div id="buttons" class="buttons">
<p>Quick links can be CRS Codes or Headcodes</p>
{#each qlData as link}
<input class="qlInput" type="text" value={link} />
{/each}
<button on:click={addQlBox} id="qlAdd">+</button>
</div>
<button on:click={saveQl}>{@html saveButton}</button>
<button on:click={clearQl}>Clear</button>
</Island>
<style>
p {
margin-bottom: 0;
}
#qlAdd {
width: 40px;
}
.buttons {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
width: 90%;
margin: auto;
padding-top: 5px;
}
input {
flex: 1;
width: 20%;
min-width: 50px;
margin: 5px;
border: none;
border-radius: 20px;
padding: 5px;
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-size: 16px;
font-weight: 400;
text-decoration: none;
text-align: center;
text-transform: uppercase;
}
button {
width: 30%;
margin-bottom: 5px;
margin-top: 10px;
border: none;
border-radius: 20px;
padding: 5px;
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-size: 16px;
font-weight: 400;
background-color: var(--main-bg-color);
color: var(--link-color);
}
p {
margin-bottom: 0;
}
#qlAdd {
width: 40px;
}
.buttons {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
width: 90%;
margin: auto;
padding-top: 5px;
}
input {
flex: 1;
width: 20%;
min-width: 50px;
margin: 5px;
border: none;
border-radius: 20px;
padding: 5px;
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-size: 16px;
font-weight: 400;
text-decoration: none;
text-align: center;
text-transform: uppercase;
}
button {
width: 30%;
margin-bottom: 5px;
margin-top: 10px;
border: none;
border-radius: 20px;
padding: 5px;
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-size: 16px;
font-weight: 400;
background-color: var(--main-bg-color);
color: var(--link-color);
}
</style>

View File

@ -1,27 +1,24 @@
<script>
import Island from "$lib/islands/island.svelte";
export let resultObject = {
results: true,
title: "",
resultLines: []
};
let variables = {
title: resultObject.title
}
import Island from '$lib/islands/island.svelte';
export let resultObject = {
results: true,
title: '',
resultLines: []
};
let variables = {
title: resultObject.title
};
</script>
<Island {variables}>
{#each resultObject.resultLines as line}
<p>{line}</p>
{/each}
{#each resultObject.resultLines as line}
<p>{line}</p>
{/each}
</Island>
<style>
p {
color: white;
}
p {
color: white;
}
</style>

View File

@ -1,116 +1,132 @@
<script>
import { fly } from "svelte/transition";
import { fly } from 'svelte/transition';
export let alerts = [];
$: uniqueAlerts = [...new Set(alerts)];
export let alerts = [];
$: uniqueAlerts = [...new Set(alerts)];
let displayAlerts = false;
let displayAlerts = false;
async function alertsToggle() {
displayAlerts = !displayAlerts
}
function numberAsWord(number) {
const words = ['zero', 'one', 'two','three','four','five','six','seven','eight'];
let word = words[number];
if (word) {
return word;
}
return number;
async function alertsToggle() {
displayAlerts = !displayAlerts;
}
function numberAsWord(number) {
const words = [
'zero',
'one',
'two',
'three',
'four',
'five',
'six',
'seven',
'eight'
];
let word = words[number];
if (word) {
return word;
}
return number;
}
</script>
<div id="block"><!--Prevent content slipping underneath the bar--></div>
<div id="bar" on:click={alertsToggle} on:keypress={alertsToggle}>
<img src="/images/navigation/alert.svg" alt="">
{#if uniqueAlerts.length == 1}
<p id="bartext">There is one active alert</p>
{:else if uniqueAlerts.length > 1}
<p id="bartext">There are {numberAsWord(uniqueAlerts.length)} active alerts</p>
{:else}
<p id="bartext">There are no active alerts</p>
{/if}
<p id="arrow" class:displayAlerts>V</p>
<img src="/images/navigation/alert.svg" alt="" />
{#if uniqueAlerts.length == 1}
<p id="bartext">There is one active alert</p>
{:else if uniqueAlerts.length > 1}
<p id="bartext">
There are {numberAsWord(uniqueAlerts.length)} active alerts
</p>
{:else}
<p id="bartext">There are no active alerts</p>
{/if}
<p id="arrow" class:displayAlerts>V</p>
</div>
{#if displayAlerts}
<div id="alerts" in:fly={{ y:-200, duration: 500}} out:fly={{ y: -200, duration: 800 }}>
{#each uniqueAlerts as msg}
<p class="alert">{@html msg}</p>
{/each}
</div>
<div
id="alerts"
in:fly={{ y: -200, duration: 500 }}
out:fly={{ y: -200, duration: 800 }}
>
{#each uniqueAlerts as msg}
<p class="alert">{@html msg}</p>
{/each}
</div>
{/if}
<style>
#block {
height: 40px;
}
#bar {
width: 100%;
height: 40px;
background-color: var(--main-alert-color);
opacity: 1;
position: fixed;
width: 100%;
top: 50px;
left: 0px;
z-index: 10;
}
img {
height: 25px;
width: 25px;
position: absolute;
left: 8px;
top: 8px;
margin: 0;
padding: 0;
}
#bartext {
color: white;
margin: auto;
font-weight: 600;
margin-top: 8px;
margin-bottom: 0px;
padding: 0px;
}
#arrow{
color: white;
font-family: Arial, Helvetica, sans-serif;
font-weight: 900;
position: absolute;
margin-top: 0;
right: 15px;
top: 11px;
border: none;
background-color: transparent;
transition-duration: 500ms;
transition-delay: 00ms;
}
#arrow:focus {
background-color: transparent;
}
#alerts {
position: fixed;
background-color: var(--main-alert-color);
opacity: 0.9;
width: 100%;
max-height: 80vh;
overflow-y: auto;
overflow-x: clip;
left: 0;
top: 89px;
}
.alert {
color: white;
text-align: center;
width: 80%;
margin:auto;
margin-top: 10px;
margin-bottom: 10px;
font-weight: 600;
}
.displayAlerts {
transition-duration: 500ms;
transition-delay: 400ms;
transform: rotate(180deg);
}
#block {
height: 40px;
}
#bar {
width: 100%;
height: 40px;
background-color: var(--main-alert-color);
opacity: 1;
position: fixed;
width: 100%;
top: 50px;
left: 0px;
z-index: 10;
}
img {
height: 25px;
width: 25px;
position: absolute;
left: 8px;
top: 8px;
margin: 0;
padding: 0;
}
#bartext {
color: white;
margin: auto;
font-weight: 600;
margin-top: 8px;
margin-bottom: 0px;
padding: 0px;
}
#arrow {
color: white;
font-family: Arial, Helvetica, sans-serif;
font-weight: 900;
position: absolute;
margin-top: 0;
right: 15px;
top: 11px;
border: none;
background-color: transparent;
transition-duration: 500ms;
transition-delay: 00ms;
}
#arrow:focus {
background-color: transparent;
}
#alerts {
position: fixed;
background-color: var(--main-alert-color);
opacity: 0.9;
width: 100%;
max-height: 80vh;
overflow-y: auto;
overflow-x: clip;
left: 0;
top: 89px;
}
.alert {
color: white;
text-align: center;
width: 80%;
margin: auto;
margin-top: 10px;
margin-bottom: 10px;
font-weight: 600;
}
.displayAlerts {
transition-duration: 500ms;
transition-delay: 400ms;
transform: rotate(180deg);
}
</style>

View File

@ -1,10 +1,10 @@
<script>
export let station = "";
export let title = "Loading...";
import { onMount } from 'svelte'
export let station = '';
export let title = 'Loading...';
import { onMount } from 'svelte';
import Loading from '$lib/navigation/loading.svelte';
import OverlayIsland from '$lib/islands/overlay-island.svelte';
import AlertBar from './alert-bar.svelte';
import OverlayIsland from '$lib/islands/overlay-island.svelte';
import AlertBar from './alert-bar.svelte';
let requestedStation;
$: requestedStation = station;
@ -20,96 +20,98 @@
let serviceDetail;
$: {
if (jsonData === null && requestedStation) {
fetchData();
}
if (jsonData?.GetStationBoardResult?.generatedAt) {
dataAge = new Date(jsonData.GetStationBoardResult.generatedAt);
}
if (jsonData?.GetStationBoardResult?.trainServices?.service) {
services = jsonData.GetStationBoardResult.trainServices.service;
} else {
services = [];
}
if (jsonData?.GetStationBoardResult?.busServices?.service) {
busServices = jsonData.GetStationBoardResult.busServices.service;
}
if (jsonData?.GetStationBoardResult?.ferryServices?.service) {
ferryServices = jsonData.GetStationBoardResult.ferryServices.service;
}
if (jsonData?.GetStationBoardResult?.locationName) {
title = jsonData.GetStationBoardResult.locationName
} else {
title = requestedStation.toUpperCase()
}
if (jsonData === null && requestedStation) {
fetchData();
}
if (jsonData?.GetStationBoardResult?.generatedAt) {
dataAge = new Date(jsonData.GetStationBoardResult.generatedAt);
}
if (jsonData?.GetStationBoardResult?.trainServices?.service) {
services = jsonData.GetStationBoardResult.trainServices.service;
} else {
services = [];
}
if (jsonData?.GetStationBoardResult?.busServices?.service) {
busServices = jsonData.GetStationBoardResult.busServices.service;
}
if (jsonData?.GetStationBoardResult?.ferryServices?.service) {
ferryServices = jsonData.GetStationBoardResult.ferryServices.service;
}
if (jsonData?.GetStationBoardResult?.locationName) {
title = jsonData.GetStationBoardResult.locationName;
} else {
title = requestedStation.toUpperCase();
}
}
async function fetchData() {
dataExists = true;
isLoading = true; // Set loading state
try {
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();
} catch (error) {
console.error("Error fetching data:", error);
console.error('Error fetching data:', error);
dataExists = false;
title = "Not Found";
title = 'Not Found';
} finally {
isLoading = false; // Clear loading state
}
prepareNrcc()
prepareNrcc();
}
function parseTime(string){
let output
let change
function parseTime(string) {
let output;
let change;
switch (string) {
case 'Delayed':
output = 'LATE'
change = "changed"
break
case 'Cancelled':
output = 'CANC'
change = "cancelled"
break
case 'On Time':
case 'On time':
output = 'RT'
change = ""
break
case '':
output = '-'
change = ""
break
case undefined:
output = '-'
change = ""
break
case 'No report':
output = '-'
change = ""
break
case 'undefined':
output = false
change = ""
break
default:
output = string
change = "changed"
case 'Delayed':
output = 'LATE';
change = 'changed';
break;
case 'Cancelled':
output = 'CANC';
change = 'cancelled';
break;
case 'On Time':
case 'On time':
output = 'RT';
change = '';
break;
case '':
output = '-';
change = '';
break;
case undefined:
output = '-';
change = '';
break;
case 'No report':
output = '-';
change = '';
break;
case 'undefined':
output = false;
change = '';
break;
default:
output = string;
change = 'changed';
}
return {data: output, changed: change}
return { data: output, changed: change };
}
async function loadService(sid) {
for (const service of services) {
if (service.serviceID == sid) {
serviceDetail = service
serviceDetail = service;
}
}
}
@ -117,7 +119,7 @@
async function loadBusService(sid) {
for (const service of busServices) {
if (service.serviceID == sid) {
serviceDetail = service
serviceDetail = service;
}
}
}
@ -130,7 +132,7 @@
if (jsonData?.GetStationBoardResult?.nrccMessages?.message) {
const nrcc = jsonData.GetStationBoardResult.nrccMessages.message;
if (Array.isArray(nrcc)) {
alerts = nrcc
alerts = nrcc;
return;
}
alerts.push(nrcc);
@ -146,53 +148,65 @@
</script>
{#if alerts.length}
<AlertBar {alerts}/>
<AlertBar {alerts} />
{/if}
{#if isLoading}
<Loading />
{:else}
{#if dataAge}
<p id="timestamp">Updated: {dataAge.toLocaleTimeString()}</p>
{#if services.length}
<table class="ldbTable">
{:else if dataAge}
<p id="timestamp">Updated: {dataAge.toLocaleTimeString()}</p>
{#if services.length}
<table class="ldbTable">
<tr>
<th class="from">From</th>
<th class="to">To</th>
<th class="plat">Plat.</th>
<th class="time">Sch Arr.</th>
<th class="time">Exp Arr.</th>
<th class="time">Sch Dep.</th>
<th class="time">Exp Dep.</th>
</tr>
{#each services as service}
<tr>
<th class="from">From</th>
<th class="to">To</th>
<th class="plat">Plat.</th>
<th class="time">Sch Arr.</th>
<th class="time">Exp Arr.</th>
<th class="time">Sch Dep.</th>
<th class="time">Exp Dep.</th>
<td
class="origdest from"
on:click={loadService(service.serviceID)}
on:keypress={loadService(service.serviceID)}
>
{#if Array.isArray(service.origin?.location)}
{service.origin.location[0]['locationName'] +
' & ' +
service.origin.location[1]['locationName']}
{:else}
{service.origin?.location?.locationName || ''}
{/if}
</td>
<td
class="origdest to"
on:click={loadService(service.serviceID)}
on:keypress={loadService(service.serviceID)}
>
{#if Array.isArray(service.destination?.location)}
{service.destination.location[0]['locationName'] +
' & ' +
service.destination.location[0]['locationName']}
{:else}
{service.destination?.location?.locationName || ''}
{/if}
</td>
<td class="plat">{service.platform || '-'}</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.std).data}</td>
<td class="time {parseTime(service.etd).changed}"
>{parseTime(service.etd).data}</td
>
</tr>
{#each services as service}
<tr>
<td class="origdest from" on:click={loadService(service.serviceID)} on:keypress={loadService(service.serviceID)}>
{#if Array.isArray(service.origin?.location)}
{service.origin.location[0]['locationName'] +
" & " +
service.origin.location[1]['locationName']}
{:else}
{service.origin?.location?.locationName || ''}
{/if}
</td>
<td class="origdest to" on:click={loadService(service.serviceID)} on:keypress={loadService(service.serviceID)}>
{#if Array.isArray(service.destination?.location)}
{service.destination.location[0]['locationName'] +
" & " +
service.destination.location[0]['locationName']}
{:else}
{service.destination?.location?.locationName || ''}
{/if}
</td>
<td class="plat">{service.platform || '-'}</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.std).data}</td>
<td class="time {parseTime(service.etd).changed}">{parseTime(service.etd).data}</td>
</tr>
<tr><td colspan="7">
<tr
><td colspan="7">
<p class="service-detail">
A {service.operator || 'Unknown'} service
{#if service['length']}
@ -205,36 +219,56 @@
{#if service.cancelReason}
<p class="service-detail">{service.cancelReason}</p>
{/if}
</td></tr>
{/each}
</table>
{:else}
<p class="table-head-text">No Scheduled Train Services</p>
{/if}
{#if busServices.length}
<br>
<img class="transport-mode" src="/images/transport-modes/bus.svg" alt="Bus services"><br>
<span class="table-head-text">Bus Services</span>
<table class="ldbTable">
</td></tr
>
{/each}
</table>
{:else}
<p class="table-head-text">No Scheduled Train Services</p>
{/if}
{#if busServices.length}
<br />
<img
class="transport-mode"
src="/images/transport-modes/bus.svg"
alt="Bus services"
/><br />
<span class="table-head-text">Bus Services</span>
<table class="ldbTable">
<tr>
<th class="from">From</th>
<th class="to">To</th>
<th class="time">Sch Arr.</th>
<th class="time">Exp Arr.</th>
<th class="time">Sch Dep.</th>
<th class="time">Exp Dep.</th>
</tr>
{#each busServices as service}
<tr>
<th class="from">From</th>
<th class="to">To</th>
<th class="time">Sch Arr.</th>
<th class="time">Exp Arr.</th>
<th class="time">Sch Dep.</th>
<th class="time">Exp Dep.</th>
<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.eta).changed}"
>{parseTime(service.eta).data}</td
>
<td class="time">{parseTime(service.std).data}</td>
<td class="time {parseTime(service.etd).changed}"
>{parseTime(service.etd).data}</td
>
</tr>
{#each busServices as service}
<tr>
<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.eta).changed}">{parseTime(service.eta).data}</td>
<td class="time">{parseTime(service.std).data}</td>
<td class="time {parseTime(service.etd).changed}">{parseTime(service.etd).data}</td>
</tr>
<tr><td colspan="7">
<tr
><td colspan="7">
<p class="service-detail">
A {service.operator || 'Unknown'} service
</p>
@ -244,47 +278,61 @@
{#if service.cancelReason}
<p class="service-detail">{service.cancelReason}</p>
{/if}
</td></tr>
{/each}
</table>
{/if}
{#if ferryServices.length}
<br>
<img class="transport-mode" src="/images/transport-modes/ferry.svg" alt="Bus services"><br>
<span class="table-head-text">Ferry Services</span>
<table class="ldbTable">
</td></tr
>
{/each}
</table>
{/if}
{#if ferryServices.length}
<br />
<img
class="transport-mode"
src="/images/transport-modes/ferry.svg"
alt="Bus services"
/><br />
<span class="table-head-text">Ferry Services</span>
<table class="ldbTable">
<tr>
<th class="from">From</th>
<th class="to">To</th>
<th class="time">Sch Arr.</th>
<th class="time">Exp Arr.</th>
<th class="time">Sch Dep.</th>
<th class="time">Exp Dep.</th>
</tr>
{#each ferryServices as service}
<tr>
<th class="from">From</th>
<th class="to">To</th>
<th class="time">Sch Arr.</th>
<th class="time">Exp Arr.</th>
<th class="time">Sch Dep.</th>
<th class="time">Exp Dep.</th>
<td class="origdest from"
>{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.eta).changed}"
>{parseTime(service.eta).data}</td
>
<td class="time">{parseTime(service.std).data}</td>
<td class="time {parseTime(service.etd).changed}"
>{parseTime(service.etd).data}</td
>
</tr>
{#each ferryServices as service}
<tr>
<td class="origdest from">{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.eta).changed}">{parseTime(service.eta).data}</td>
<td class="time">{parseTime(service.std).data}</td>
<td class="time {parseTime(service.etd).changed}">{parseTime(service.etd).data}</td>
</tr>
<tr><td colspan="7">
<tr
><td colspan="7">
{#if service.delayReason}
<p class="service-detail">{service.delayReason}</p>
{/if}
{#if service.cancelReason}
<p class="service-detail">{service.cancelReason}</p>
{/if}
</td></tr>
{/each}
</table>
{/if}
{:else}
<p>Unable to find this station</p>
</td></tr
>
{/each}
</table>
{/if}
{:else}
<p>Unable to find this station</p>
{/if}
{#if serviceDetail}
@ -304,21 +352,47 @@
<tr>
<td>{prevPoint.locationName}</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>
{/each}
{:else}
<tr>
<td>{serviceDetail.previousCallingPoints.callingPointList.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>
<td
>{serviceDetail.previousCallingPoints.callingPointList
.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>
{/if}
{/if}
<tr class="thisStop">
<td>{title}</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>
{#if serviceDetail?.subsequentCallingPoints?.callingPointList?.callingPoint}
{#if Array.isArray(serviceDetail?.subsequentCallingPoints?.callingPointList?.callingPoint)}
@ -326,14 +400,31 @@
<tr>
<td>{nextPoint.locationName}</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>
{/each}
{:else}
<tr class="detailRow">
<td>{serviceDetail.subsequentCallingPoints.callingPointList.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>
<td
>{serviceDetail.subsequentCallingPoints.callingPointList
.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>
{/if}
{/if}
@ -371,21 +462,40 @@
color: white;
font-size: 14px;
}
@media (min-width: 800px) {
table {font-size: 15px; max-width: 850px;}
.service-detail {font-size: 14px;}
.transport-mode {width: 50px;}
#timestamp {font-size: 16px;}
}
@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;}
}
@media (min-width: 800px) {
table {
font-size: 15px;
max-width: 850px;
}
.service-detail {
font-size: 14px;
}
.transport-mode {
width: 50px;
}
#timestamp {
font-size: 16px;
}
}
@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 {
color: yellow;
}
@ -398,58 +508,58 @@
text-align: left;
}
.plat {
width: 10%
width: 10%;
}
.time {
width: 10%;
}
.changed{
.changed {
animation: pulse-change 1.5s linear infinite;
}
}
.cancelled {
.cancelled {
animation: pulse-cancel 1.5s linear infinite;
}
}
@keyframes pulse-change {
@keyframes pulse-change {
50% {
color: var(--main-warning-color);
color: var(--main-warning-color);
}
}
}
@keyframes pulse-cancel {
@keyframes pulse-cancel {
50% {
color: var(--main-alert-color);
color: var(--main-alert-color);
}
}
#detailBox {
width: 100%;
}
h6 {
position: absolute;
top: -25px;
left: 20px;
font-size: 18px;
}
#closeService {
position: absolute;
top: 10px;
right: 10px;
border: none;
border-radius: 60px;
width: 35px;
height: 35px;
background-color: var(--main-bg-color);
color: white;
font-weight: 700;
font-size: 16px;
}
#detailTable {
margin-top: 40px;
color: white;
font-size: 15px;
}
.thisStop {
color: yellow;
}
}
#detailBox {
width: 100%;
}
h6 {
position: absolute;
top: -25px;
left: 20px;
font-size: 18px;
}
#closeService {
position: absolute;
top: 10px;
right: 10px;
border: none;
border-radius: 60px;
width: 35px;
height: 35px;
background-color: var(--main-bg-color);
color: white;
font-weight: 700;
font-size: 16px;
}
#detailTable {
margin-top: 40px;
color: white;
font-size: 15px;
}
.thisStop {
color: yellow;
}
</style>

View File

@ -1,290 +1,327 @@
<script>
export let station = "";
export let title = "Loading...";
import { onMount } from 'svelte'
import AlertBar from './alert-bar.svelte';
import StaffTrainDetail from '$lib/ldb/staff-train-detail.svelte';
import Loading from '$lib/navigation/loading.svelte';
import Nav from '$lib/navigation/nav.svelte';
import { uuid } from '$lib/stores/uuid';
export let station = '';
export let title = 'Loading...';
import { onMount } from 'svelte';
import AlertBar from './alert-bar.svelte';
import StaffTrainDetail from '$lib/ldb/staff-train-detail.svelte';
import Loading from '$lib/navigation/loading.svelte';
import Nav from '$lib/navigation/nav.svelte';
import { uuid } from '$lib/stores/uuid';
let requestedStation;
$: requestedStation = station;
let requestedStation;
$: requestedStation = station;
let jsonData = {};
let services = [];
let dataAge = null;
let isLoading = true;
let alerts = [];
let jsonData = {};
let services = [];
let dataAge = null;
let isLoading = true;
let alerts = [];
$: {
if (jsonData?.GetBoardResult?.generatedAt) {
dataAge = new Date(jsonData.GetBoardResult.generatedAt);
}
if (jsonData?.GetBoardResult?.trainServices?.service) {
services = jsonData.GetBoardResult.trainServices.service;
} else {
services = [];
}
if (jsonData?.GetBoardResult?.locationName) {
title = jsonData.GetBoardResult.locationName
} else {
title = "Loading Board"
}
if (jsonData?.GetBoardResult?.nrccMessages) {
alerts = processNrcc(jsonData.GetBoardResult?.nrccMessages?.message)
}
$: {
if (jsonData?.GetBoardResult?.generatedAt) {
dataAge = new Date(jsonData.GetBoardResult.generatedAt);
}
async function fetchData() {
isLoading = true; // Set loading state
try {
console.log(`Requested Station: ${requestedStation}`);
const url = `https://owlboard.info/api/v2/live/station/${requestedStation}/staff`;
const opt = {
method: "GET",
headers: {
"uuid": $uuid
}
if (jsonData?.GetBoardResult?.trainServices?.service) {
services = jsonData.GetBoardResult.trainServices.service;
} else {
services = [];
}
if (jsonData?.GetBoardResult?.locationName) {
title = jsonData.GetBoardResult.locationName;
} else {
title = 'Loading Board';
}
if (jsonData?.GetBoardResult?.nrccMessages) {
alerts = processNrcc(jsonData.GetBoardResult?.nrccMessages?.message);
}
}
async function fetchData() {
isLoading = true; // Set loading state
try {
console.log(`Requested Station: ${requestedStation}`);
const url = `https://owlboard.info/api/v2/live/station/${requestedStation}/staff`;
const opt = {
method: 'GET',
headers: {
uuid: $uuid
}
const data = await fetch(url, opt);
jsonData = await data.json();
} catch (error) {
console.error("Error fetching data:", error);
} finally {
isLoading = false; // Clear loading state
}
};
const data = await fetch(url, opt);
jsonData = await data.json();
} catch (error) {
console.error('Error fetching data:', error);
} finally {
isLoading = false; // Clear loading state
}
async function getReasonCodeData(code) {
const url = `https://owlboard.info/api/v2/ref/reasonCode/${code}`
const res = await fetch(url);
const json = await res.json();
return json
}
async function generateServiceData(service) {
const timeDetails = await parseTimes(service);
let serviceData = {
from: await parseLocation(service.origin),
to: await parseLocation(service.destination),
length: await getTrainLength(service),
platform: await parsePlatform(service?.platform || "undefined"),
platformHidden: service?.platformIsHidden === "true",
schArr: timeDetails.schArr,
expArr: timeDetails.expArr,
schDep: timeDetails.schDep,
expDep: timeDetails.expDep,
isEarlyArr: timeDetails.earArr,
isLateArr: timeDetails.delArr,
isEarlyDep: timeDetails.earDep,
isLateDep: timeDetails.delDep,
isCancelledDep: false,
isCancelled: Boolean(service?.isCancelled),
isDelayed: service?.arrivalType === "Delayed",
isArrDelayed: service?.arrivalType === "Delayed",
isDepDelayed: service?.departureType === "Delayed",
isEarly: false,
isNonPublic: false
}
return serviceData;
}
async function getTrainLength(service) {
if (service?.length) {
return parseInt(service?.length);
} else if (service?.formation?.coaches) {
return service.formation.coaches.coach.length
}
return null;
}
async function parseLocation(location) {
if (!Array.isArray(location.location)) {
//console.log(location.location?.tiploc)
return location.location?.tiploc
}
let locations = [];
for (const singleLocation of location?.location) {
locations.push(singleLocation?.tiploc)
}
return locations.join(' & ');
}
async function parsePlatform(platform) {
if (!platform) {
return '-'
}
if (platform === "TBC" || platform == "undefined") {
return '-'
}
return {
number: platform
}
}
function parseTimes(service){
let schArr = new Date(service?.sta);
let expArr = new Date(service?.eta || service?.ata);
let schDep = new Date(service?.std);
let expDep = new Date(service?.etd || service?.atd);
let isEarlyArr = false, isDelayedArr = false, isArr = false
let isEarlyDep = false, isDelayedDep = false, isDep = false
const timeDifferenceThreshold = 60 * 1000; // 60 seconds in milliseconds
if (expArr - schArr < -timeDifferenceThreshold) {
isEarlyArr = true;
isArr = true;
} else if (expArr - schArr > timeDifferenceThreshold) {
isDelayedArr = true;
isArr = true;
}
if (expDep - schDep < -timeDifferenceThreshold) {
isEarlyDep = true;
isDep = true;
} else if (expDep - schDep > timeDifferenceThreshold) {
isDelayedDep = true;
isDep = true;
}
let parsedExpArr;
if (expArr instanceof Date && !isNaN(expArr)) {
if (!isEarlyArr && !isDelayedArr) {
parsedExpArr = 'RT';
} else {
parsedExpArr = parseIndividualTime(expArr);
}
} else {
parsedExpArr = '-';
}
let parsedExpDep;
if (expDep instanceof Date && !isNaN(expDep)) {
if (!isEarlyDep && !isDelayedDep) {
parsedExpDep = 'RT';
} else {
parsedExpDep = parseIndividualTime(expDep);
async function getReasonCodeData(code) {
const url = `https://owlboard.info/api/v2/ref/reasonCode/${code}`;
const res = await fetch(url);
const json = await res.json();
return json;
}
} else {
parsedExpDep = '-';
}
return {
schArr: parseIndividualTime(schArr),
expArr: parsedExpArr,
schDep: parseIndividualTime(schDep),
expDep: parsedExpDep,
earArr: isEarlyArr,
delArr: isDelayedArr,
earDep: isEarlyDep,
delDep: isDelayedDep
}
async function generateServiceData(service) {
const timeDetails = await parseTimes(service);
let serviceData = {
from: await parseLocation(service.origin),
to: await parseLocation(service.destination),
length: await getTrainLength(service),
platform: await parsePlatform(service?.platform || 'undefined'),
platformHidden: service?.platformIsHidden === 'true',
schArr: timeDetails.schArr,
expArr: timeDetails.expArr,
schDep: timeDetails.schDep,
expDep: timeDetails.expDep,
isEarlyArr: timeDetails.earArr,
isLateArr: timeDetails.delArr,
isEarlyDep: timeDetails.earDep,
isLateDep: timeDetails.delDep,
isCancelledDep: false,
isCancelled: Boolean(service?.isCancelled),
isDelayed: service?.arrivalType === 'Delayed',
isArrDelayed: service?.arrivalType === 'Delayed',
isDepDelayed: service?.departureType === 'Delayed',
isEarly: false,
isNonPublic: false
};
return serviceData;
}
async function getTrainLength(service) {
if (service?.length) {
return parseInt(service?.length);
} else if (service?.formation?.coaches) {
return service.formation.coaches.coach.length;
}
return null;
}
async function parseLocation(location) {
if (!Array.isArray(location.location)) {
//console.log(location.location?.tiploc)
return location.location?.tiploc;
}
let locations = [];
for (const singleLocation of location?.location) {
locations.push(singleLocation?.tiploc);
}
return locations.join(' & ');
}
async function parsePlatform(platform) {
if (!platform) {
return '-';
}
if (platform === 'TBC' || platform == 'undefined') {
return '-';
}
return {
number: platform
};
}
function parseTimes(service) {
let schArr = new Date(service?.sta);
let expArr = new Date(service?.eta || service?.ata);
let schDep = new Date(service?.std);
let expDep = new Date(service?.etd || service?.atd);
let isEarlyArr = false,
isDelayedArr = false,
isArr = false;
let isEarlyDep = false,
isDelayedDep = false,
isDep = false;
const timeDifferenceThreshold = 60 * 1000; // 60 seconds in milliseconds
if (expArr - schArr < -timeDifferenceThreshold) {
isEarlyArr = true;
isArr = true;
} else if (expArr - schArr > timeDifferenceThreshold) {
isDelayedArr = true;
isArr = true;
}
function parseIndividualTime(input) {
const dt = new Date(input);
const output = dt.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})
if (output !== "Invalid Date") {
return output
}
return '-'
if (expDep - schDep < -timeDifferenceThreshold) {
isEarlyDep = true;
isDep = true;
} else if (expDep - schDep > timeDifferenceThreshold) {
isDelayedDep = true;
isDep = true;
}
function processNrcc(messages) { // Remove newlines and then <p> tags from input and append to array
let arrMessages;
if (!Array.isArray(messages)) {
arrMessages = [messages];
let parsedExpArr;
if (expArr instanceof Date && !isNaN(expArr)) {
if (!isEarlyArr && !isDelayedArr) {
parsedExpArr = 'RT';
} else {
arrMessages = messages;
parsedExpArr = parseIndividualTime(expArr);
}
let processedMessages = [];
for (const message of arrMessages) {
const msgText = message.xhtmlMessage
processedMessages.push(msgText.replace(/[\n\r]/g, '').replace(/<\/?p[^>]*>/g, ''));
}
return processedMessages;
} else {
parsedExpArr = '-';
}
onMount(() => {
fetchData();
let parsedExpDep;
if (expDep instanceof Date && !isNaN(expDep)) {
if (!isEarlyDep && !isDelayedDep) {
parsedExpDep = 'RT';
} else {
parsedExpDep = parseIndividualTime(expDep);
}
} else {
parsedExpDep = '-';
}
return {
schArr: parseIndividualTime(schArr),
expArr: parsedExpArr,
schDep: parseIndividualTime(schDep),
expDep: parsedExpDep,
earArr: isEarlyArr,
delArr: isDelayedArr,
earDep: isEarlyDep,
delDep: isDelayedDep
};
}
function parseIndividualTime(input) {
const dt = new Date(input);
const output = dt.toLocaleTimeString([], {
hour: '2-digit',
minute: '2-digit'
});
</script>
if (output !== 'Invalid Date') {
return output;
}
return '-';
}
{#if isLoading}
<Loading />
{:else}
{#if alerts.length}
<AlertBar {alerts} />
{/if}
<table>
<tr><td colspan="8" id="timestamp">Updated: {dataAge.toLocaleTimeString()} - Staff Boards under development</td></tr>
<tr>
<th class="id">ID</th>
<th class="from">From</th>
<th class="to">To</th>
<th class="plat">Plat</th>
<th class="time">Sch Arr</th>
<th class="time">Exp Arr</th>
<th class="time">Sch Dep</th>
<th class="time">Exp Dep</th>
</tr>
{#each services as service}
{#await generateServiceData(service)}
<tr>
<td colspan="8">
Loading...
</td>
</tr>
{:then serviceStats}
function processNrcc(messages) {
// Remove newlines and then <p> tags from input and append to array
let arrMessages;
if (!Array.isArray(messages)) {
arrMessages = [messages];
} else {
arrMessages = messages;
}
let processedMessages = [];
for (const message of arrMessages) {
const msgText = message.xhtmlMessage;
processedMessages.push(
msgText.replace(/[\n\r]/g, '').replace(/<\/?p[^>]*>/g, '')
);
}
return processedMessages;
}
<!-- Await a 'Generate Stats' function here which can evaluate the data and provide
onMount(() => {
fetchData();
});
</script>
{#if isLoading}
<Loading />
{:else}
{#if alerts.length}
<AlertBar {alerts} />
{/if}
<table>
<tr
><td colspan="8" id="timestamp"
>Updated: {dataAge.toLocaleTimeString()} - Staff Boards under development</td
></tr
>
<tr>
<th class="id">ID</th>
<th class="from">From</th>
<th class="to">To</th>
<th class="plat">Plat</th>
<th class="time">Sch Arr</th>
<th class="time">Exp Arr</th>
<th class="time">Sch Dep</th>
<th class="time">Exp Dep</th>
</tr>
{#each services as service}
{#await generateServiceData(service)}
<tr>
<td colspan="8"> Loading... </td>
</tr>
{:then serviceStats}
<!-- Await a 'Generate Stats' function here which can evaluate the data and provide
relevant BOOLs like isCancelled, isEarly, isLate, isNonPassenger and calculate train length
where 'length' is not provided but 'formation' is. -->
<tr>
<td class="id id-data data">{service.trainid}</td>
<td class="from from-data data {serviceStats.isCancelled && 'can-dat'}">{serviceStats.from}</td>
<td class="to to-data data {serviceStats.isCancelled && 'can-dat'}">{serviceStats.to}</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 class="text-row">
<td colspan="8" class="text-data">
{service.operator} {#if serviceStats.length} | {serviceStats.length} carriages{/if}
<br>
{#if service.isCancelled}
{#await getReasonCodeData(service.cancelReason)}
This train has been cancelled
{:then reasonCode}
{reasonCode[0].cancReason}
<br>
{/await}
{/if}
{#if service?.delayReason}
{#await getReasonCodeData(service.delayReason)}
This train has been delayed
{:then reasonCode}
{reasonCode[0].lateReason}
<br>
{/await}
{/if}
</td>
</tr>
{:catch}
<tr>
<td colspan="8">Unable to load service</td>
</tr>
{/await}
{/each}
</table>
{/if}
<tr>
<td class="id id-data data">{service.trainid}</td>
<td
class="from from-data data {serviceStats.isCancelled && 'can-dat'}"
>{serviceStats.from}</td
>
<td class="to to-data data {serviceStats.isCancelled && 'can-dat'}"
>{serviceStats.to}</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 class="text-row">
<td colspan="8" class="text-data">
{service.operator}
{#if serviceStats.length} | {serviceStats.length} carriages{/if}
<br />
{#if service.isCancelled}
{#await getReasonCodeData(service.cancelReason)}
This train has been cancelled
{:then reasonCode}
{reasonCode[0].cancReason}
<br />
{/await}
{/if}
{#if service?.delayReason}
{#await getReasonCodeData(service.delayReason)}
This train has been delayed
{:then reasonCode}
{reasonCode[0].lateReason}
<br />
{/await}
{/if}
</td>
</tr>
{:catch}
<tr>
<td colspan="8">Unable to load service</td>
</tr>
{/await}
{/each}
</table>
{/if}
<Nav />
<Nav />
<style>
<style>
#timestamp {
color: var(--second-text-color);
}
@ -306,7 +343,8 @@ if (expDep instanceof Date && !isNaN(expDep)) {
text-align: left;
}
.from-data, .to-data {
.from-data,
.to-data {
color: yellow;
text-decoration: none;
text-align: left;
@ -323,42 +361,42 @@ if (expDep instanceof Date && !isNaN(expDep)) {
font-size: smaller;
}
.can-dat {
color: grey;
text-decoration: line-through;
}
.can-dat {
color: grey;
text-decoration: line-through;
}
.hidden {
color: grey;
}
.hidden {
color: grey;
}
.can-time {
.can-time {
animation: pulse-cancel 1.5s linear infinite;
}
}
.early {
animation: pulse-early 1.5s linear infinite;
}
.early {
animation: pulse-early 1.5s linear infinite;
}
.late {
animation: pulse-late 1.5s linear infinite;
}
.late {
animation: pulse-late 1.5s linear infinite;
}
@keyframes pulse-late {
@keyframes pulse-late {
50% {
color: var(--main-warning-color);
color: var(--main-warning-color);
}
}
}
@keyframes pulse-cancel {
@keyframes pulse-cancel {
50% {
color: var(--main-alert-color);
color: var(--main-alert-color);
}
}
}
@keyframes pulse-early {
@keyframes pulse-early {
50% {
color: rgb(136, 164, 255);
color: rgb(136, 164, 255);
}
}
</style>
}
</style>

View File

@ -1,31 +1,31 @@
<div id="container">
<p id="tick">&#10004;</p>
<p>Done</p>
<p id="tick">&#10004;</p>
<p>Done</p>
</div>
<style>
#tick {
#tick {
font-size: 45px;
margin: 0;
padding: 0;
}
#container {
position:fixed;
top:50%;
left:50%;
transform:translate(-50%,-50%);
margin:auto;
background-color:var(--overlay-color);
border-radius:15px;
padding:20px;
padding-bottom:1px;
min-width:90px;
max-width:90px
}
p {
padding-top:0px;
font-weight:bolder;
overflow-wrap:normal;
color: white;
}
}
#container {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
margin: auto;
background-color: var(--overlay-color);
border-radius: 15px;
padding: 20px;
padding-bottom: 1px;
min-width: 90px;
max-width: 90px;
}
p {
padding-top: 0px;
font-weight: bolder;
overflow-wrap: normal;
color: white;
}
</style>

View File

@ -1,40 +1,42 @@
<script>
export let title = 'title'
export let title = 'title';
</script>
<div class="headerBar">
<a href="/">
<picture>
<source srcset="/images/logo/wide_logo.svg" type="image/svg+xml">
<img src="/images/logo/wide_logo_200.png" alt="OwlBoard Logo">
</picture>
</a>
<header>{title}</header>
<a href="/">
<picture>
<source srcset="/images/logo/wide_logo.svg" type="image/svg+xml" />
<img src="/images/logo/wide_logo_200.png" alt="OwlBoard Logo" />
</picture>
</a>
<header>{title}</header>
</div>
<div class="headerBlock">
<!-- This exists to prevent the headerBar overlapping anything below it -->
<!-- This exists to prevent the headerBar overlapping anything below it -->
</div>
<style>
.headerBar {
.headerBar {
background: var(--overlay-color-solid);
color: var(--main-text-color);
position: fixed;
top: 0; left: 0;
top: 0;
left: 0;
width: 100%;
margin: 0;
padding: 0;
height: 50px;
z-index: 20;
}
}
img {
img {
position: absolute;
height: 40px;
right: 8px;
top: 5px;
}
}
header {
header {
position: absolute;
left: 0px;
top: 3px;
@ -43,11 +45,11 @@ header {
margin-top: 7px;
margin-left: 20px;
font-size: 15pt;
}
}
.headerBlock {
.headerBlock {
height: 50px;
margin: 0;
padding: 0;
}
}
</style>

View File

@ -1,53 +1,57 @@
<script>
import { fade } from "svelte/transition";
import { fade } from 'svelte/transition';
</script>
<div id="container" in:fade={{delay: 150, duration: 250}} out:fade={{duration: 250}}>
<div class="spinner"></div>
<p>Loading...</p>
<div
id="container"
in:fade={{ delay: 150, duration: 250 }}
out:fade={{ duration: 250 }}
>
<div class="spinner" />
<p>Loading...</p>
</div>
<style>
@keyframes spinner {
0% {
transform:translate3d(-50%,-50%,0) rotate(0)
}
100% {
transform:translate3d(-50%,-50%,0) rotate(360deg)
}
}
.spinner::before {
animation:1.5s linear infinite spinner;
animation-play-state:inherit;
border:solid 5px var(--overlay-color);
border-bottom-color: white;
border-radius:50%;
content:"";
height:40px;
width:40px;
position:absolute;
top:30%;
margin:auto;
transform:translate3d(-50%,-50%,0);
will-change:transform
}
#container {
position:fixed;
top:50%;
left:50%;
transform:translate(-50%,-50%);
margin:auto;
background-color:var(--overlay-color);
border-radius:15px;
padding:20px;
padding-bottom:1px;
min-width:90px;
max-width:90px
}
p {
padding-top:50px;
font-weight:bolder;
overflow-wrap:normal;
color: white;
}
@keyframes spinner {
0% {
transform: translate3d(-50%, -50%, 0) rotate(0);
}
100% {
transform: translate3d(-50%, -50%, 0) rotate(360deg);
}
}
.spinner::before {
animation: 1.5s linear infinite spinner;
animation-play-state: inherit;
border: solid 5px var(--overlay-color);
border-bottom-color: white;
border-radius: 50%;
content: '';
height: 40px;
width: 40px;
position: absolute;
top: 30%;
margin: auto;
transform: translate3d(-50%, -50%, 0);
will-change: transform;
}
#container {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
margin: auto;
background-color: var(--overlay-color);
border-radius: 15px;
padding: 20px;
padding-bottom: 1px;
min-width: 90px;
max-width: 90px;
}
p {
padding-top: 50px;
font-weight: bolder;
overflow-wrap: normal;
color: white;
}
</style>

View File

@ -1,91 +1,103 @@
<script>
const links = [
{
title: "Home",
path: "/",
svgPath: "/images/navigation/home.svg"
}
]
import { page } from "$app/stores";
const links = [
{
title: 'Home',
path: '/',
svgPath: '/images/navigation/home.svg'
}
];
import { page } from '$app/stores';
</script>
<footer>
{#each links as item}
<a class="footerLink" href={item.path} class:active={$page.url.pathname == item.path}>
<img src="{item.svgPath}" alt="{item.title}">
<br>
<span>{item.title}</span>
</a>
<a
class="footerLink"
href={item.path}
class:active={$page.url.pathname == item.path}
>
<img src={item.svgPath} alt={item.title} />
<br />
<span>{item.title}</span>
</a>
{/each}
<div class="data-source">
<a href="https://nationalrail.co.uk" target="_blank">
<picture>
<source srcset="/images/nre/nre-powered_200w.jxl" type="image/jxl">
<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">
<source srcset="/images/nre/nre-powered_200w.jxl" type="image/jxl" />
<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"
/>
</picture>
</a>
</div>
</footer>
<style>
footer {
position: fixed;
display: flex;
bottom: 0;
left: 0;
width: 100%;
height: 50px;
background-color: var(--overlay-color);
}
footer {
position: fixed;
display: flex;
bottom: 0;
left: 0;
width: 100%;
height: 50px;
background-color: var(--overlay-color);
}
.footerLink {
width: 30%;
height: 100%;
background-color: var(--overlay-color);
border-style: solid;
border-width: 1px;
border-top: none;
border-bottom: none;
border-color: rgba(0, 0, 0, 0.24);
text-decoration: double;
font-weight: 600;
}
.footerLink {
width: 30%;
height: 100%;
background-color: var(--overlay-color);
border-style: solid;
border-width: 1px;
border-top: none;
border-bottom: none;
border-color: rgba(0, 0, 0, 0.24);
text-decoration: double;
font-weight: 600;
}
footer a.active {
background-color: transparent;
}
footer a.active {
background-color: transparent;
}
.data-source {
flex-grow: 2;
background: rgb(255, 255, 255);
}
#nre-logo {
width: 150px;
height: auto;
margin: auto;
margin-top: 13px;
}
@media only screen and (min-width: 475px) {
.data-source {
flex-grow: 2;
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%
);
}
#nre-logo {
width: 150px;
height: auto;
margin: auto;
margin-top: 13px;
}
@media only screen and (min-width: 475px) {
.data-source {
background: rgb(255,255,255);
background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 40%);
}
#nre-logo {
position: absolute;
right: 0;
right: 20px;
}
}
img {
height: 20px;
width: 20px;
margin: 0;
margin-top: 3px;
padding: 0;
}
span {
margin: 0;
margin-bottom: 3px;
padding: 0;
position: absolute;
right: 0;
right: 20px;
}
}
img {
height: 20px;
width: 20px;
margin: 0;
margin-top: 3px;
padding: 0;
}
span {
margin: 0;
margin-bottom: 3px;
padding: 0;
}
</style>

View File

@ -1,74 +1,74 @@
<script>
const links = [
{
title: "Home",
path: "/",
svgPath: "/images/navigation/home.svg"
},
{
title: "PIS Finder",
path: "/pis",
svgPath: "/images/navigation/info.svg"
},
{
title: "More",
path: "/more",
svgPath: "/images/navigation/more.svg"
}
]
import { page } from "$app/stores";
const links = [
{
title: 'Home',
path: '/',
svgPath: '/images/navigation/home.svg'
},
{
title: 'PIS Finder',
path: '/pis',
svgPath: '/images/navigation/info.svg'
},
{
title: 'More',
path: '/more',
svgPath: '/images/navigation/more.svg'
}
];
import { page } from '$app/stores';
</script>
<footer>
{#each links as item}
<a href={item.path} class:active={$page.url.pathname == item.path}>
<img src="{item.svgPath}" alt="{item.title}">
<br>
<span>{item.title}</span>
</a>
<a href={item.path} class:active={$page.url.pathname == item.path}>
<img src={item.svgPath} alt={item.title} />
<br />
<span>{item.title}</span>
</a>
{/each}
</footer>
<style>
footer {
position: fixed;
display: flex;
bottom: 0;
left: 0;
width: 100%;
height: 50px;
background-color: rgb(54, 54, 54);
}
footer {
position: fixed;
display: flex;
bottom: 0;
left: 0;
width: 100%;
height: 50px;
background-color: rgb(54, 54, 54);
}
footer a {
flex: 12;
width: 30%;
height: 100%;
background-color: var(--overlay-color);
border-style: solid;
border-width: 1px;
border-top: none;
border-bottom: none;
border-color: rgba(0, 0, 0, 0.24);
text-decoration: double;
font-weight: 600;
}
footer a {
flex: 12;
width: 30%;
height: 100%;
background-color: var(--overlay-color);
border-style: solid;
border-width: 1px;
border-top: none;
border-bottom: none;
border-color: rgba(0, 0, 0, 0.24);
text-decoration: double;
font-weight: 600;
}
footer a.active {
background-color: transparent;
}
footer a.active {
background-color: transparent;
}
img {
height: 20px;
width: 20px;
margin: 0;
margin-top: 3px;
padding: 0;
}
img {
height: 20px;
width: 20px;
margin: 0;
margin-top: 3px;
padding: 0;
}
span {
margin: 0;
margin-bottom: 3px;
padding: 0;
}
span {
margin: 0;
margin-bottom: 3px;
padding: 0;
}
</style>

View File

@ -1,49 +1,49 @@
<script>
import OverlayIsland from "$lib/islands/overlay-island.svelte";
import OverlayIsland from '$lib/islands/overlay-island.svelte';
const variables = {
title: "Welcome to OwlBoard"
}
const version = "2023.7.1"
let pageNum = 0;
const variables = {
title: 'Welcome to OwlBoard'
};
const version = '2023.7.1';
let pageNum = 0;
function pageUp() {
pageNum ++;
console.log(`Welcome page: ${pageNum}`)
}
function pageUp() {
pageNum++;
console.log(`Welcome page: ${pageNum}`);
}
function pageDn() {
pageNum --;
console.log(`Welcome page: ${pageNum}`)
}
function pageDn() {
pageNum--;
console.log(`Welcome page: ${pageNum}`);
}
const pageText = [
"<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>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>" +
"<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>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>" +
"<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>",
"<h3>Everything Else</h3>" +
"<p>Everything else has moved to the 'More' menu, where you'll find the Reference Code lookup and software details."
]
const pageText = [
'<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>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>' +
'<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>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>' +
"<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>",
'<h3>Everything Else</h3>' +
"<p>Everything else has moved to the 'More' menu, where you'll find the Reference Code lookup and software details."
];
</script>
<OverlayIsland {variables}>
<h2>What's new in OwlBoard {version}</h2>
<div>
{@html pageText[pageNum]}
</div>
<button type="button" on:click={pageDn}>&lt;</button>
<button type="button" on:click={pageUp}>&gt;</button>
<div>
{@html pageText[pageNum]}
</div>
<button type="button" on:click={pageDn}>&lt;</button>
<button type="button" on:click={pageUp}>&gt;</button>
</OverlayIsland>
<style>
div {
color: white;
}
div {
color: white;
}
</style>

View File

@ -1,29 +1,28 @@
import { writable } from 'svelte/store'
import { writable } from 'svelte/store';
import { browser } from '$app/environment';
export const ql = writable(fromLocalStorage('ql', []))
export const ql = writable(fromLocalStorage('ql', []));
toLocalStorage(ql, 'ql');
function fromLocalStorage(storageKey, fallback) {
if (browser) {
const storedValue = localStorage.getItem(storageKey);
if (storedValue !== 'undefined' && storedValue !== null) {
return (typeof fallback === 'object')
? JSON.parse(storedValue)
: storedValue
}
if (browser) {
const storedValue = localStorage.getItem(storageKey);
if (storedValue !== 'undefined' && storedValue !== null) {
return typeof fallback === 'object'
? JSON.parse(storedValue)
: storedValue;
}
return fallback
}
return fallback;
}
function toLocalStorage(store, storageKey) {
if (browser) {
store.subscribe(value => {
let storageValue = (typeof value === 'object')
? JSON.stringify(value)
: value
if (browser) {
store.subscribe((value) => {
let storageValue =
typeof value === 'object' ? JSON.stringify(value) : value;
localStorage.setItem(storageKey, storageValue)
})
}
localStorage.setItem(storageKey, storageValue);
});
}
}

View File

@ -1,23 +1,23 @@
import { writable } from 'svelte/store'
import { writable } from 'svelte/store';
import { browser } from '$app/environment';
export const uuid = writable(fromLocalStorage('uuid', null))
export const uuid = writable(fromLocalStorage('uuid', null));
toLocalStorage(uuid, 'uuid');
function fromLocalStorage(storageKey, fallback) {
if (browser) {
const storedValue = localStorage.getItem(storageKey);
if (storedValue !== 'undefined') {
return storedValue
}
if (browser) {
const storedValue = localStorage.getItem(storageKey);
if (storedValue !== 'undefined') {
return storedValue;
}
return fallback
}
return fallback;
}
function toLocalStorage(store, storageKey) {
if (browser) {
store.subscribe(value => {
localStorage.setItem(storageKey, value)
})
}
if (browser) {
store.subscribe((value) => {
localStorage.setItem(storageKey, value);
});
}
}

View File

@ -1,114 +1,133 @@
<script>
import { fly } from "svelte/transition";
import { fly } from 'svelte/transition';
export let service = ""
export let service = '';
let isExpanded = false;
async function expand() {
isExpanded = !isExpanded
}
let isExpanded = false;
async function expand() {
isExpanded = !isExpanded;
}
</script>
<div class="container">
<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 id="container-arrow" class:isExpanded>V</span>
</div>
{#if isExpanded}
<div class="container-detail" in:fly={{ y: -20, duration: 200}}>
{#if service.pis}
<p class="pis">PIS: {service.pis}</p>
<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 id="container-arrow" class:isExpanded>V</span>
</div>
{#if isExpanded}
<div class="container-detail" in:fly={{ y: -20, duration: 200 }}>
{#if service.pis}
<p class="pis">PIS: {service.pis}</p>
{/if}
<p class="svc-detail">
Planned Type: {parseInt(service.planSpeed) || 68}mph {service.powerType ||
'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>
<tr>
<th>Location</th>
<th>Sch Arr.</th>
<th>Sch Dep.</th>
</tr>
{#if service.stops[0]['publicDeparture']}
{#each service.stops as stop}
{#if stop.publicArrival || stop.publicDeparture}
<tr>
<td>{stop.tiploc}</td>
<td>{stop.publicArrival || '-'}</td>
<td>{stop.publicDeparture || '-'}</td>
</tr>
{/if}
<p class="svc-detail">Planned Type: {parseInt(service.planSpeed) || 68 }mph {service.powerType || "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>
<tr>
<th>Location</th>
<th>Sch Arr.</th>
<th>Sch Dep.</th>
</tr>
{#if service.stops[0]['publicDeparture']}
{#each service.stops as stop}
{#if stop.publicArrival || stop.publicDeparture}
<tr>
<td>{stop.tiploc}</td>
<td>{stop.publicArrival || '-'}</td>
<td>{stop.publicDeparture || '-'}</td>
</tr>
{/if}
{/each}
{:else}
{#each service.stops as stop}
<tr>
<td>{stop.tiploc}</td>
<td>{stop.wttArrival || '-'}</td>
<td>{stop.wttDeparture || '-'}</td>
</tr>
{/each}
{/if}
</table>
</div>
{/if}
{/each}
{:else}
{#each service.stops as stop}
<tr>
<td>{stop.tiploc}</td>
<td>{stop.wttArrival || '-'}</td>
<td>{stop.wttDeparture || '-'}</td>
</tr>
{/each}
{/if}
</table>
</div>
{/if}
</div>
<style>
.container {
position: relative;
margin: auto;
margin-bottom: 20px;
width: 95%;
max-width: 600px;
height: auto;
background-color: var(--overlay-color);
border-radius: 10px;
overflow: hidden;
transition: height 500ms ease-in-out;
}
.container-header {
text-align: left;
padding-left: 10px;
font-size: 14px;
font-weight: 600;
padding-top: 12px;
padding-bottom: 10px;
}
#container-arrow {
font-family: Arial, Helvetica, sans-serif;
font-weight: 600;
color: white;
margin: 0;
padding: 0;
position: absolute;
right: 16px;
top: 13px;
transition-duration: 300ms;
z-index: 2;
}
.isExpanded {
transform: rotate(180deg);
}
.pis {
font-size: 18px;
font-weight: 600;
color: azure;
margin-top: 10px;
margin-bottom: 5px;
}
.svc-detail {
margin-top: 2px;
margin-bottom: 2px;
color: white;
}
.validity {
font-size: 14px;
}
table {
margin: auto;
padding-top: 10px;
padding-bottom: 10px;
color: white;
}
.container {
position: relative;
margin: auto;
margin-bottom: 20px;
width: 95%;
max-width: 600px;
height: auto;
background-color: var(--overlay-color);
border-radius: 10px;
overflow: hidden;
transition: height 500ms ease-in-out;
}
.container-header {
text-align: left;
padding-left: 10px;
font-size: 14px;
font-weight: 600;
padding-top: 12px;
padding-bottom: 10px;
}
#container-arrow {
font-family: Arial, Helvetica, sans-serif;
font-weight: 600;
color: white;
margin: 0;
padding: 0;
position: absolute;
right: 16px;
top: 13px;
transition-duration: 300ms;
z-index: 2;
}
.isExpanded {
transform: rotate(180deg);
}
.pis {
font-size: 18px;
font-weight: 600;
color: azure;
margin-top: 10px;
margin-bottom: 5px;
}
.svc-detail {
margin-top: 2px;
margin-bottom: 2px;
color: white;
}
.validity {
font-size: 14px;
}
table {
margin: auto;
padding-top: 10px;
padding-bottom: 10px;
color: white;
}
</style>

View File

@ -1,8 +1,8 @@
<script>
import { page } from '$app/stores';
import Header from '$lib/navigation/header.svelte';
import Nav from '$lib/navigation/nav.svelte';
const title = "OwlBoard - Error"
import { page } from '$app/stores';
import Header from '$lib/navigation/header.svelte';
import Nav from '$lib/navigation/nav.svelte';
const title = 'OwlBoard - Error';
</script>
<Header {title} />
@ -10,15 +10,22 @@
<h1>{$page.status}: {$page?.error?.message}</h1>
{#if $page.status === 404}
<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>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>
{:else if $page.status === 500}
<p>Something went wrong loading the app.<br>
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>
<p>
Something went wrong loading the app.<br />
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}
<p>Not sure what went wrong, please try again later or report an issue from
the 'More' menu.</p>
<p>
Not sure what went wrong, please try again later or report an issue from the
'More' menu.
</p>
{/if}
<Nav />

View File

@ -1,16 +1,20 @@
<script>
import '../app.css'
import '../app.css';
</script>
<svelte:head>
<meta charset="utf-8">
<meta name="application-name" content="OwlBoard">
<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 name="viewport" content="width=device-width">
<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>
<meta charset="utf-8" />
<meta name="application-name" content="OwlBoard" />
<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 name="viewport" content="width=device-width" />
<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>
</svelte:head>
<slot />

View File

@ -1,28 +1,27 @@
<script>
import Header from '$lib/navigation/header.svelte'
import Nav from '$lib/navigation/nav.svelte'
import InputIsland from '$lib/islands/input-island-form.svelte'
import QuickLinkIsland from '$lib/islands/quick-link-island.svelte';
import Welcome from '$lib/overlays/welcome.svelte';
import Header from '$lib/navigation/header.svelte';
import Nav from '$lib/navigation/nav.svelte';
import InputIsland from '$lib/islands/input-island-form.svelte';
import QuickLinkIsland from '$lib/islands/quick-link-island.svelte';
import Welcome from '$lib/overlays/welcome.svelte';
const title = "OwlBoard"
const inputIslands = [
const title = 'OwlBoard';
const inputIslands = [
{
title: "Live Departure Boards",
action: "/ldb",
placeholder: "Enter CRS/TIPLOC",
queryName: "station"
title: 'Live Departure Boards',
action: '/ldb',
placeholder: 'Enter CRS/TIPLOC',
queryName: 'station'
},
{
title: "Train Details & PIS",
action: "/train",
placeholder: "Enter Headcode",
queryName: "headcode"
title: 'Train Details & PIS',
action: '/train',
placeholder: 'Enter 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>
{#if !isWelcomed}
@ -31,7 +30,7 @@ const isWelcomed = "false"; // Usually a bool - <Welcome /> is incomplete so sho
<Header {title} />
{#each inputIslands as variables}
<InputIsland {variables} />
<InputIsland {variables} />
{/each}
<QuickLinkIsland />

View File

@ -1,43 +1,42 @@
<script>
import Header from '$lib/navigation/header.svelte'
import Nav from '$lib/navigation/nav-ldb.svelte'
import PublicLdb from '$lib/ldb/public-ldb.svelte';
import StaffLdb from '$lib/ldb/staff-ldb.svelte';
import { uuid } from '$lib/stores/uuid.js';
import {onMount} from 'svelte'
import Header from '$lib/navigation/header.svelte';
import Nav from '$lib/navigation/nav-ldb.svelte';
import PublicLdb from '$lib/ldb/public-ldb.svelte';
import StaffLdb from '$lib/ldb/staff-ldb.svelte';
import { uuid } from '$lib/stores/uuid.js';
import { onMount } from 'svelte';
let title = "Loading"
let title = 'Loading';
async function getHeadcode() {
return new URLSearchParams(window.location.search).get('station');
async function getHeadcode() {
return new URLSearchParams(window.location.search).get('station');
}
let station = '';
let staff = false;
let uuidValue = '';
$: uuidValue = $uuid;
onMount(async () => {
station = (await getHeadcode()) || '';
if (uuidValue !== null && uuidValue !== '' && uuidValue !== 'null') {
staff = true;
title = 'Staff Board';
} else {
title = 'Public Board';
}
let station = "";
let staff = false;
let uuidValue = "";
$: uuidValue = $uuid;
onMount(async () => {
station = await getHeadcode() || "";
if (uuidValue !== null && uuidValue !== "" && uuidValue !== "null") {
staff = true;
title = "Staff Board"
} else {
title = "Public Board"
}
})
});
</script>
<Header {title} />
<!-- If 'uuid' exists in store then load StaffLdb else load PublicLdb -->
{#if !staff}
<PublicLdb {station} bind:title={title} />
<PublicLdb {station} bind:title />
{:else}
<StaffLdb {station} bind:title={title} />
<!--<StaffLdb {station} bind:title={title} /> -- Temporary, Disable StaffLdb - it isn't implemented -->
<StaffLdb {station} bind:title />
<!--<StaffLdb {station} bind:title={title} /> -- Temporary, Disable StaffLdb - it isn't implemented -->
{/if}
<Nav />

View File

@ -1,68 +1,68 @@
<script>
import Header from '$lib/navigation/header.svelte'
import Nav from '$lib/navigation/nav.svelte'
const title = "More"
import Header from '$lib/navigation/header.svelte';
import Nav from '$lib/navigation/nav.svelte';
const title = 'More';
const links = [
{title: "Your Data", path: "/more/data"},
{title: "Registration", path: "/more/reg"},
{title: "Location Reference Code Lookup", path: "/more/corpus"},
{title: "Reason Code Lookup", path: "/more/reasons"},
{title: "Privacy Policy", path: "/more/privacy"},
{title: "Component Versions", path: "/more/versions"},
{title: "Statictics", path: "/more/statistics"},
{title: "Settings", path: "/more/settings"},
{title: "Report Issue", path: "/more/report"},
{title: "About", path: "/more/about"}
]
</script>
const links = [
{ title: 'Your Data', path: '/more/data' },
{ title: 'Registration', path: '/more/reg' },
{ title: 'Location Reference Code Lookup', path: '/more/corpus' },
{ title: 'Reason Code Lookup', path: '/more/reasons' },
{ title: 'Privacy Policy', path: '/more/privacy' },
{ title: 'Component Versions', path: '/more/versions' },
{ title: 'Statictics', path: '/more/statistics' },
{ title: 'Settings', path: '/more/settings' },
{ title: 'Report Issue', path: '/more/report' },
{ title: 'About', path: '/more/about' }
];
</script>
<Header {title} />
<Header {title} />
{#each links as item}
<a href={item.path}>
<div>
<p>{item.title}</p>
</div>
</a>
<a href={item.path}>
<div>
<p>{item.title}</p>
</div>
</a>
{/each}
<Nav />
<Nav />
<style>
div {
width: 100%;
background: rgba(0, 0, 0, 0.226);
border-color: aliceblue;
border-width: 1px;
border-style: solid;
border-left: none;
border-right: none;
height: 50px;
}
a {
text-decoration: none;
height: 100%;
vertical-align: middle;
}
<style>
div {
width: 100%;
background: rgba(0, 0, 0, 0.226);
border-color: aliceblue;
border-width: 1px;
border-style: solid;
border-left: none;
border-right: none;
height: 50px;
}
a {
text-decoration: none;
height: 100%;
vertical-align: middle;
}
p {
color: white;
margin: 0;
padding-left: 10px;
text-align: left;
line-height: 50px;
vertical-align: middle;
font-weight: 600;
font-size: 20px;
}
@media (min-width: 600px) {
p {
color: white;
margin: 0;
padding-left: 10px;
text-align: left;
line-height: 50px;
vertical-align: middle;
font-weight: 600;
font-size: 20px;
text-align: center;
}
@media (min-width: 600px) {
p {
text-align: center;
}
}
@media (max-width: 380px) {
p {
font-size: 16px;
}
@media (max-width: 380px) {
p {
font-size: 16px;
}
}
</style>
}
</style>

View File

@ -1,26 +1,32 @@
<script>
import LargeLogo from "$lib/images/large-logo.svelte";
import Header from "$lib/navigation/header.svelte";
import Nav from "$lib/navigation/nav.svelte";
import LargeLogo from '$lib/images/large-logo.svelte';
import Header from '$lib/navigation/header.svelte';
import Nav from '$lib/navigation/nav.svelte';
const title = "About";
const title = 'About';
</script>
<Header {title}/>
<Header {title} />
<LargeLogo />
<p class="neg">&copy; 2022-2023 Frederick Boniface</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
that we need every day.</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>
for more information.
<p>
I created OwlBoard in 2022 to freely give fast and easy access to the
information that we need every day.
</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>
for more information.
</p>
<Nav />
<style>
.neg {
margin-top: -40px;
margin-bottom: 40px;
}
.neg {
margin-top: -40px;
margin-bottom: 40px;
}
</style>

View File

@ -1,72 +1,71 @@
<script>
import Header from '$lib/navigation/header.svelte'
import Loading from '$lib/navigation/loading.svelte';
import Nav from '$lib/navigation/nav.svelte'
const title = "Location Codes"
import Header from '$lib/navigation/header.svelte';
import Loading from '$lib/navigation/loading.svelte';
import Nav from '$lib/navigation/nav.svelte';
const title = 'Location Codes';
let val = {
crs: "",
tiploc: "",
stanox: "",
nlc: "",
name: "",
uic: ""
let val = {
crs: '',
tiploc: '',
stanox: '',
nlc: '',
name: '',
uic: ''
};
let isLoading = false;
async function getData(type = '', value = '') {
const url = `https://owlboard.info/api/v2/ref/locationCode/${type}/${value}`;
const res = await fetch(url);
const data = await res.json();
isLoading = false;
return data;
}
async function processData(data) {
//console.log("data",JSON.stringify(data))
if (data.ERROR == 'Offline') {
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'
};
//console.log("val",JSON.stringify(val));
}
let isLoading = false;
async function getData(type = "", value = "") {
const url = `https://owlboard.info/api/v2/ref/locationCode/${type}/${value}`
const res = await fetch(url);
const data = await res.json();
isLoading = false;
return data;
}
async function processData(data) {
//console.log("data",JSON.stringify(data))
if (data.ERROR == "Offline") {
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"
}
//console.log("val",JSON.stringify(val));
}
async function submit() {
isLoading = true;
let data = [];
if (val?.crs) {
data = await getData("crs", val.crs);
} else if (val?.tiploc) {
data = await getData("tiploc", val.tiploc);
} else if (val?.stanox) {
data = await getData("stanox", val.stanox);
} else if (val?.nlc) {
data = await getData("nlc", val.nlc);
} else {
return;
}
processData(data);
}
async function reset() {
val = {
crs: "",
tiploc: "",
stanox: "",
nlc: "",
name: "",
uic: "",
}
async function submit() {
isLoading = true;
let data = [];
if (val?.crs) {
data = await getData('crs', val.crs);
} else if (val?.tiploc) {
data = await getData('tiploc', val.tiploc);
} else if (val?.stanox) {
data = await getData('stanox', val.stanox);
} else if (val?.nlc) {
data = await getData('nlc', val.nlc);
} else {
return;
}
processData(data);
}
async function reset() {
val = {
crs: '',
tiploc: '',
stanox: '',
nlc: '',
name: '',
uic: ''
};
}
</script>
<Header {title} />
@ -80,54 +79,85 @@
<p class="desc">Some locations only have some applicable location codes.</p>
<div class="inputs">
<form on:submit={submit}>
<input type="text" readonly placeholder="Name" bind:value={val.name}>
<br>
<input type="text" maxlength="3" autocomplete="off" placeholder="CRS/3ALPHA" bind:value={val.crs}>
<br>
<input 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="reset" on:click={reset}>Reset</button>
</form>
<form on:submit={submit}>
<input type="text" readonly placeholder="Name" bind:value={val.name} />
<br />
<input
type="text"
maxlength="3"
autocomplete="off"
placeholder="CRS/3ALPHA"
bind:value={val.crs}
/>
<br />
<input
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="reset" on:click={reset}>Reset</button>
</form>
</div>
<Nav />
<style>
input {
font-family: urwgothic, sans-serif;
border-radius: 50px;
border: none;
width: 60%;
max-width: 200px;
min-width: 130px;
height: 30px;
margin-bottom: 10px;
text-transform: uppercase;
}
button {
border-radius: 50px;
font-family: urwgothic, sans-serif;
background-color: var(--overlay-color);
border: none;
color: white;
height: 30px;
width: 20%;
max-width: 100px;
min-width: 75px;
font-size: 18px;
}
.desc {
color: white;
}
input {
text-align: center;
}
input {
font-family: urwgothic, sans-serif;
border-radius: 50px;
border: none;
width: 60%;
max-width: 200px;
min-width: 130px;
height: 30px;
margin-bottom: 10px;
text-transform: uppercase;
}
button {
border-radius: 50px;
font-family: urwgothic, sans-serif;
background-color: var(--overlay-color);
border: none;
color: white;
height: 30px;
width: 20%;
max-width: 100px;
min-width: 75px;
font-size: 18px;
}
.desc {
color: white;
}
input {
text-align: center;
}
</style>

View File

@ -1,60 +1,68 @@
<script>
import Header from '$lib/navigation/header.svelte';
import Loading from '$lib/navigation/loading.svelte';
import Nav from '$lib/navigation/nav.svelte';
import { uuid } from '$lib/stores/uuid.js';
import { onMount } from 'svelte';
const title = "Your Data";
import Header from '$lib/navigation/header.svelte';
import Loading from '$lib/navigation/loading.svelte';
import Nav from '$lib/navigation/nav.svelte';
import { uuid } from '$lib/stores/uuid.js';
import { onMount } from 'svelte';
const title = 'Your Data';
let data = [
{
"domain": "User not Found",
"atime": "User not Found"
}
]
let isLoading = false;
async function fetchData() {
if ($uuid != "null") {
const url = `https://owlboard.info/api/v2/user/${$uuid}`
const res = await fetch(url);
const json = await res.json();
if (json.length) {
data = json
}
}
let data = [
{
domain: 'User not Found',
atime: 'User not Found'
}
];
onMount(async () => {
isLoading = true;
await fetchData();
isLoading = false;
})
let isLoading = false;
async function fetchData() {
if ($uuid != 'null') {
const url = `https://owlboard.info/api/v2/user/${$uuid}`;
const res = await fetch(url);
const json = await res.json();
if (json.length) {
data = json;
}
}
}
onMount(async () => {
isLoading = true;
await fetchData();
isLoading = false;
});
</script>
<Header {title} />
<p>OwlBoard stores as little data about you as possible to offer the service.</p>
<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>
<p>
OwlBoard stores as little data about you as possible to offer the service.
</p>
<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}
<Loading />
{:else if data[0].domain != 'User not Found'}
<p class="api_response">Registration Domain: {data[0]['domain']}</p>
<p class="api_response">Access Time: {data[0]['atime']}</p>
{:else}
{#if data[0].domain != "User not Found"}
<p class="api_response">Registration Domain: {data[0]['domain']}</p>
<p class="api_response">Access Time: {data[0]['atime']}</p>
{:else}
<p class="api_response">You are not registered, we don't have any data stored.</p>
{/if}
<p class="api_response">
You are not registered, we don't have any data stored.
</p>
{/if}
<Nav />
<style>
.api_response {
color: white;
}
.api_response {
color: white;
}
</style>

View File

@ -1,41 +1,82 @@
<script>
import Header from '$lib/navigation/header.svelte'
import Nav from '$lib/navigation/nav.svelte'
const title = "Privacy Policy"
import Header from '$lib/navigation/header.svelte';
import Nav from '$lib/navigation/nav.svelte';
const title = 'Privacy Policy';
</script>
<Header {title} />
<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>OwlBoard does not utilize any cookies. IP addresses and browser fingerprints are not logged.</p>
<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>
<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>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>
<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>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>
<Header {title} />
<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>
OwlBoard does not utilize any cookies. IP addresses and browser fingerprints
are not logged.
</p>
<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>
<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>
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>
<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>
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>
div {
text-align: left;
}
div {
text-align: left;
}
h2 {
color: var(--second-text-color);
margin: 10px;
padding-top: 20px;
}
h2 {
color: var(--second-text-color);
margin: 10px;
padding-top: 20px;
}
p {
color: white;
margin: 10px;
}
p {
color: white;
margin: 10px;
}
</style>

View File

@ -5,49 +5,45 @@
import Loading from '$lib/navigation/loading.svelte';
import ResultIsland from '$lib/islands/result-island.svelte';
const title = "Reason Codes";
const title = 'Reason Codes';
let isLoading = false;
let inputValue = '';
let resultObject = {
results: false,
title: "",
title: '',
resultLines: []
}
};
function load() {
isLoading = true;
resultObject.results = false;
getData().then(result => {
getData().then((result) => {
handleData(result);
isLoading = false;
});
}
async function getData() {
if (inputValue) {
const url = `https://owlboard.info/api/v2/ref/reasonCode/${inputValue}`;
const res = await fetch(url);
return await res.json();
} else {
return []
return [];
}
}
async function handleData(data) {
let resultLines = []
let resultLines = [];
if (data.length) {
resultObject.title = data[0]['code'];
resultLines = [
data[0]['lateReason'],
data[0]['cancReason']
]
resultLines = [data[0]['lateReason'], data[0]['cancReason']];
} else {
resultObject = {
results: false,
title: "Not Found",
title: 'Not Found',
resultLines: []
}
};
}
resultObject.resultLines = resultLines;
resultObject.results = true;
@ -68,11 +64,20 @@
</script>
<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}>
<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>
</form>
@ -88,34 +93,36 @@
<Nav />
<style>
p {
margin-top: 20px;
}
input {
width: 25%;
min-width: 150px;
height: 32px;
margin-top: 10px;
margin-bottom: 5px;
border-radius: 50px;
border: none;
text-align: center;
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
text-transform: uppercase;
font-size: 15px;
}
button {
width: 15%;
min-width: 100px;
margin-bottom: 5px;
margin-top: 5px;
border: none;
border-radius: 20px;
padding: 5px;
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-size: 16px;
font-weight: 400;
background-color: var(--overlay-color);
color: var(--link-color);
}
p {
margin-top: 20px;
}
input {
width: 25%;
min-width: 150px;
height: 32px;
margin-top: 10px;
margin-bottom: 5px;
border-radius: 50px;
border: none;
text-align: center;
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
text-transform: uppercase;
font-size: 15px;
}
button {
width: 15%;
min-width: 100px;
margin-bottom: 5px;
margin-top: 5px;
border: none;
border-radius: 20px;
padding: 5px;
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular',
'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-size: 16px;
font-weight: 400;
background-color: var(--overlay-color);
color: var(--link-color);
}
</style>

View File

@ -1,49 +1,48 @@
<script>
import Header from "$lib/navigation/header.svelte";
import Nav from "$lib/navigation/nav.svelte";
import Loading from "$lib/navigation/loading.svelte";
import { onMount } from "svelte";
import { uuid } from "$lib/stores/uuid.js";
import Header from '$lib/navigation/header.svelte';
import Nav from '$lib/navigation/nav.svelte';
import Loading from '$lib/navigation/loading.svelte';
import { onMount } from 'svelte';
import { uuid } from '$lib/stores/uuid.js';
const title = "Register";
const title = 'Register';
let state = "unreg";
let isLoading = false;
let inputValue = "";
let state = 'unreg';
let isLoading = false;
let inputValue = '';
function handleInput(event) {
inputValue = event.target.value;
function handleInput(event) {
inputValue = event.target.value;
}
async function request() {
isLoading = true;
const url = 'https://owlboard.info/api/v2/user/request';
const request = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: inputValue
})
};
const res = await fetch(url, request);
if (res.status == 400 || res.status == 403) {
state = 'unauth';
} else if (res.status == 201) {
state = 'sent';
} else {
state = 'error';
}
isLoading = false;
}
async function request() {
isLoading = true;
const url = 'https://owlboard.info/api/v2/user/request';
const request = {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
email: inputValue
})
}
const res = await fetch(url, request);
if (res.status == 400 || res.status == 403) {
state = "unauth";
} else if (res.status == 201) {
state = "sent";
} else {
state = "error";
}
isLoading = false;
onMount(async () => {
if ($uuid != 'null') {
state = 'reg';
}
onMount(async () => {
if ($uuid != "null") {
state = "reg"
}
})
});
</script>
{#if isLoading}
@ -51,71 +50,95 @@
{/if}
<Header {title} />
{#if state == "unreg"}
{#if state == 'unreg'}
<p>The staff version of OwlBoard offers several extra features:</p>
<ul>
<li>Access the Train Finder</li>
<li>Access the PIS Finder</li>
<li>More detailed departure boards:</li>
<ul>
<li>Non-Passenger movements</li>
<li>Hidden platform numbers</li>
<li>Display up to 40 services</li>
</ul>
<li>Access the Train Finder</li>
<li>Access the PIS Finder</li>
<li>More detailed departure boards:</li>
<ul>
<li>Non-Passenger movements</li>
<li>Hidden platform numbers</li>
<li>Display up to 40 services</li>
</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}>
<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">
I have read and accept the terms of the <a href="/more/privacy">Privacy Policy</a><br>
<input id="checkbox" type="checkbox" required>
</label><br>
I have read and accept the terms of the <a href="/more/privacy"
>Privacy Policy</a
><br />
<input id="checkbox" type="checkbox" required />
</label><br />
<button type="submit">Submit</button>
</form>
{:else if state == "sent"}
<p>An email has been sent, click the link in the email to activate your profile.</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>
{:else if state == 'sent'}
<p>
An email has been sent, click the link in the email to activate your
profile.
</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>
{:else if state == "unauth"}
<p>The email address you entered does not belong to an authorised business.</p>
<p>If you think this is an error, you can report an issue in the 'More' menu.</p>
{:else if state == "error"}
{:else if state == 'unauth'}
<p>
The email address you entered does not belong to an authorised business.
</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>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>
{/if}
<Nav />
<Nav />
<style>
ul {
text-align: left;
color: white;
}
input {
height: 40px;
width: 80%;
max-width: 375px;
font-family: urwgothic, 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
text-align: center;
font-size: 20px;
border-radius: 50px;
border: none;
margin-bottom: 20px;
}
#checkbox {
height: 30px;
width: 30px;
}
button {
border: none;
background-color: var(--overlay-color);
color: white;
width: 35%;
height: 30px;
border-radius: 50px;
font-size: 18px;
}
ul {
text-align: left;
color: white;
}
input {
height: 40px;
width: 80%;
max-width: 375px;
font-family: urwgothic, 'Franklin Gothic Medium', 'Arial Narrow', Arial,
sans-serif;
text-align: center;
font-size: 20px;
border-radius: 50px;
border: none;
margin-bottom: 20px;
}
#checkbox {
height: 30px;
width: 30px;
}
button {
border: none;
background-color: var(--overlay-color);
color: white;
width: 35%;
height: 30px;
border-radius: 50px;
font-size: 18px;
}
</style>

View File

@ -1,72 +1,73 @@
<script>
import Header from "$lib/navigation/header.svelte";
import Loading from "$lib/navigation/loading.svelte";
import Nav from "$lib/navigation/nav.svelte";
import { uuid } from "$lib/stores/uuid.js";
import { onMount } from "svelte";
import Header from '$lib/navigation/header.svelte';
import Loading from '$lib/navigation/loading.svelte';
import Nav from '$lib/navigation/nav.svelte';
import { uuid } from '$lib/stores/uuid.js';
import { onMount } from 'svelte';
const title = "Registration"
let state = "";
let isLoading = true
const title = 'Registration';
let state = '';
let isLoading = true;
async function getUUID() {
return new URLSearchParams(window.location.search).get('key');
async function getUUID() {
return new URLSearchParams(window.location.search).get('key');
}
async function submit(id) {
const url = 'https://owlboard.info/api/v2/user/register';
const request = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
uuid: id
})
};
const res = await fetch(url, request);
const body = await res.json();
if (body.api_key) {
uuid.set(body.api_key);
return 201;
}
return res.status;
}
async function submit(id) {
const url = "https://owlboard.info/api/v2/user/register"
const request = {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
uuid: id
})
}
const res = await fetch(url, request);
const body = await res.json();
if (body.api_key) {
uuid.set(body.api_key);
return 201
}
return res.status;
onMount(async () => {
const id = (await getUUID()) || '';
if (id == '' || !id) {
state = 'none';
isLoading = false;
return;
}
onMount(async () => {
const id = await getUUID() || "";
if (id == "" || !id) {
state = "none"
isLoading = false
return
}
const status = await submit(id)
if (status == 201) {
console.log("Registered Successfully")
state = "done"
} else if (status == 401) {
console.log("Invalid Key")
state = "unauth"
} else {
console.log("Error")
state = "error"
}
isLoading = false
})
const status = await submit(id);
if (status == 201) {
console.log('Registered Successfully');
state = 'done';
} else if (status == 401) {
console.log('Invalid Key');
state = 'unauth';
} else {
console.log('Error');
state = 'error';
}
isLoading = false;
});
</script>
<Header {title} />
{#if isLoading}
<Loading />
{/if}
{#if state == "none"}
{#if state == 'none'}
<p>Unable to read your access key.</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>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>
{:else if state == "done"}
{:else if state == 'done'}
<p>You are now logged in</p>
{/if}
<Nav />

View File

@ -1,76 +1,80 @@
<script>
import Header from "$lib/navigation/header.svelte";
import Island from "$lib/islands/island.svelte";
import Nav from "$lib/navigation/nav.svelte";
import { onMount } from "svelte";
import Loading from "$lib/navigation/loading.svelte";
import Done from "$lib/navigation/done.svelte";
import Header from '$lib/navigation/header.svelte';
import Island from '$lib/islands/island.svelte';
import Nav from '$lib/navigation/nav.svelte';
import { onMount } from 'svelte';
import Loading from '$lib/navigation/loading.svelte';
import Done from '$lib/navigation/done.svelte';
const title = "Report Issue";
let isLoading = false;
let isDone = false;
let isError = false;
const title = 'Report Issue';
let isLoading = false;
let isDone = false;
let isError = false;
let reportType = "", reportSubject = "", reportMsg = "", reportCollected
onMount(async () => {
reportCollected = {
userAgent: navigator.userAgent,
browser: navigator.appName,
version: navigator.appVersion,
platform: navigator.platform,
viewport: `${window.innerWidth} x ${window.innerHeight}`,
let reportType = '',
reportSubject = '',
reportMsg = '',
reportCollected;
onMount(async () => {
reportCollected = {
userAgent: navigator.userAgent,
browser: navigator.appName,
version: navigator.appVersion,
platform: navigator.platform,
viewport: `${window.innerWidth} x ${window.innerHeight}`
};
})
});
let preFlight = false;
let preFlight = false;
async function submit() {
console.log(reportType,reportSubject,reportMsg)
preFlight = true;
}
async function send() {
console.log("SEND DATA REQUESTED")
isLoading = true
const formData = JSON.stringify({
label: reportType,
subject: reportSubject,
msg: `User Agent: ${reportCollected.userAgent}\n` +
`Browser: ${reportCollected.browser}\n` +
`BrowserVersion: ${reportCollected.version}\n` +
`Platform: ${reportCollected.platform}\n` +
`Viewport: ${reportCollected.viewport}\n\n\n` +
`User Message:\n` +
`${reportMsg}`
})
const url = `https://owlboard.info/misc/issue`
const options = {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: formData
}
const res = await fetch(url, options)
if (res.status == 200) {
isLoading = false;
isDone = true;
await new Promise(r => setTimeout(r, 2000));
window.location.href = "/";
} else {
isLoading = false;
isError = true;
}
}
async function cancel() {
preFlight = false;
isLoading = false;
isDone = false;
isError = false;
async function submit() {
console.log(reportType, reportSubject, reportMsg);
preFlight = true;
}
async function send() {
console.log('SEND DATA REQUESTED');
isLoading = true;
const formData = JSON.stringify({
label: reportType,
subject: reportSubject,
msg:
`User Agent: ${reportCollected.userAgent}\n` +
`Browser: ${reportCollected.browser}\n` +
`BrowserVersion: ${reportCollected.version}\n` +
`Platform: ${reportCollected.platform}\n` +
`Viewport: ${reportCollected.viewport}\n\n\n` +
`User Message:\n` +
`${reportMsg}`
});
const url = `https://owlboard.info/misc/issue`;
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: formData
};
const res = await fetch(url, options);
if (res.status == 200) {
isLoading = false;
isDone = true;
await new Promise((r) => setTimeout(r, 2000));
window.location.href = '/';
} else {
isLoading = false;
isError = true;
}
}
async function cancel() {
preFlight = false;
isLoading = false;
isDone = false;
isError = false;
}
</script>
<Header {title} />
{#if isLoading}
@ -82,88 +86,113 @@
{/if}
{#if !preFlight && !isDone}
<p>Any data that you enter here will be visible publicly
<a href="https://git.fjla.uk/OwlBoard/backend/issues" target="_blank">here</a>
<p>
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>You will be shown all of the collected data before the form is submitted.</p>
<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="bug">Problem</option>
<option value="enhancement">Feature Request</option>
<option value="question">Question</option>
<option value="user-support">Unable to sign up</option>
</select>
<br>
<input class="formInputs" type="text" bind:value={reportSubject} placeholder="Subject">
<br>
<textarea class="formInputs" bind:value={reportMsg} placeholder="Enter your message..."/>
<br>
<br />
<input
class="formInputs"
type="text"
bind:value={reportSubject}
placeholder="Subject"
/>
<br />
<textarea
class="formInputs"
bind:value={reportMsg}
placeholder="Enter your message..."
/>
<br />
<button type="submit">Submit</button>
<button type="reset">Reset</button>
</form>
{:else}
<Island>
<Island>
<h2>Device Data:</h2>
<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">Platform: </span>{reportCollected.platform}</p>
<p><span class="dataType">Viewport: </span> {reportCollected.viewport}</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">Platform: </span>{reportCollected.platform}</p>
<p><span class="dataType">Viewport: </span> {reportCollected.viewport}</p>
<h2>Reported Data:</h2>
<p><span class="dataType">Report Type: </span>{reportType}</p>
<p>{reportSubject}</p>
<p>{reportMsg}</p>
<p><span class="dataType">Report Type: </span>{reportType}</p>
<p>{reportSubject}</p>
<p>{reportMsg}</p>
<button class="overlayButtons" on:click={send}>Send</button>
<button class="overlayButtons" on:click={cancel}>Cancel</button>
</Island>
</Island>
{/if}
<Nav />
<style>
select {
text-align: center;
border: none;
border-radius: 50px;
height: 30px;
background-color: white;
}
.formInputs {
margin: 10px;
font-family: urwgothic, sans-serif;
font-size: 16px;
border: none;
width: 50%;
max-width: 250px;
min-width: 100px;
}
input {
text-align: center;
border-radius: 50px;
height: 30px;
}
textarea {
text-align: left;
border-radius: 10px;
padding-left: 5px;
padding-right: 5px;
height: 30vh;
min-height: 150px;
max-height: 400px;
}
button {
background-color: var(--overlay-color);
color: white;
font-family: urwgothic, sans-serif;
font-size: 16px;
border: none;
border-radius: 50px;
width: 25%;
height: 30px;
max-width: 100px;
}
h2 {color: white;}
.dataType {color: white;}
.overlayButtons {
background-color: var(--main-bg-color);
}
select {
text-align: center;
border: none;
border-radius: 50px;
height: 30px;
background-color: white;
}
.formInputs {
margin: 10px;
font-family: urwgothic, sans-serif;
font-size: 16px;
border: none;
width: 50%;
max-width: 250px;
min-width: 100px;
}
input {
text-align: center;
border-radius: 50px;
height: 30px;
}
textarea {
text-align: left;
border-radius: 10px;
padding-left: 5px;
padding-right: 5px;
height: 30vh;
min-height: 150px;
max-height: 400px;
}
button {
background-color: var(--overlay-color);
color: white;
font-family: urwgothic, sans-serif;
font-size: 16px;
border: none;
border-radius: 50px;
width: 25%;
height: 30px;
max-width: 100px;
}
h2 {
color: white;
}
.dataType {
color: white;
}
.overlayButtons {
background-color: var(--main-bg-color);
}
</style>

View File

@ -1,13 +1,12 @@
<script>
import Header from '$lib/navigation/header.svelte'
import Nav from '$lib/navigation/nav.svelte'
import QlSet from '$lib/islands/quick-link-set-island.svelte'
const title = "Settings"
import Header from '$lib/navigation/header.svelte';
import Nav from '$lib/navigation/nav.svelte';
import QlSet from '$lib/islands/quick-link-set-island.svelte';
const title = 'Settings';
</script>
<Header {title} />
<Header {title} />
<QlSet />
<QlSet />
<Nav />
<Nav />

View File

@ -1,35 +1,34 @@
<script>
import Island from '$lib/islands/island.svelte';
import Header from '$lib/navigation/header.svelte'
import Loading from '$lib/navigation/loading.svelte';
import Nav from '$lib/navigation/nav.svelte'
import { onMount } from 'svelte';
const title = "Statistics"
let isLoading = true;
import Island from '$lib/islands/island.svelte';
import Header from '$lib/navigation/header.svelte';
import Loading from '$lib/navigation/loading.svelte';
import Nav from '$lib/navigation/nav.svelte';
import { onMount } from 'svelte';
const title = 'Statistics';
let isLoading = true;
let data, error;
let data, error;
onMount(async () => {
const url = "https://owlboard.info/misc/server/stats"
const res = await fetch(url);
if (res.status == 200) {
data = await res.json();
} else {
error = true;
}
isLoading = false;
})
function U2L(input) {
try {
const datetime = new Date(input*1000)
return datetime.toLocaleString()
} catch (err) {
console.log(err);
return false;
}
onMount(async () => {
const url = 'https://owlboard.info/misc/server/stats';
const res = await fetch(url);
if (res.status == 200) {
data = await res.json();
} else {
error = true;
}
isLoading = false;
});
function U2L(input) {
try {
const datetime = new Date(input * 1000);
return datetime.toLocaleString();
} catch (err) {
console.log(err);
return false;
}
}
</script>
<Header {title} />
@ -43,7 +42,7 @@ import Header from '$lib/navigation/header.svelte'
{#if isLoading}
<Loading />
{: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>Stats Reset: <span>{U2L(data?.reset) || 'Unknown'}</span></p>
<h2>Last Update</h2>

View File

@ -1,26 +1,26 @@
<script>
import Header from '$lib/navigation/header.svelte'
import Island from '$lib/islands/island.svelte';
import Loading from '$lib/navigation/loading.svelte';
import Nav from '$lib/navigation/nav.svelte'
import LargeLogo from '$lib/images/large-logo.svelte';
import { onMount } from 'svelte';
const title = "Versions"
const variable = {title:""};
import Header from '$lib/navigation/header.svelte';
import Island from '$lib/islands/island.svelte';
import Loading from '$lib/navigation/loading.svelte';
import Nav from '$lib/navigation/nav.svelte';
import LargeLogo from '$lib/images/large-logo.svelte';
import { onMount } from 'svelte';
const title = 'Versions';
const variable = { title: '' };
let data, isLoading = true;
let data,
isLoading = true;
async function getData() {
const url = 'https://owlboard.info/misc/server/versions'
const res = await fetch(url)
data = await res.json();
isLoading = false;
}
onMount(() => {
getData();
});
async function getData() {
const url = 'https://owlboard.info/misc/server/versions';
const res = await fetch(url);
data = await res.json();
isLoading = false;
}
onMount(() => {
getData();
});
</script>
<Header {title} />
@ -28,16 +28,20 @@
<LargeLogo />
{#if isLoading}
<Loading/>
<Loading />
{:else}
<Island>
<p>Web-app Version<br><span class="data">{"2023.7.1-Svelte-Dev"}</span></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>
<p>
Web-app Version<br /><span class="data">{'2023.7.1-Svelte-Dev'}</span>
</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>
{/if}
<Nav />
<style>
.data {color: white;}
.data {
color: white;
}
</style>

View File

@ -1,73 +1,73 @@
<script>
import Header from '$lib/navigation/header.svelte'
import Nav from '$lib/navigation/nav.svelte'
import Island from '$lib/islands/island.svelte';
import Loading from '$lib/navigation/loading.svelte';
import { uuid } from '$lib/stores/uuid';
import Header from '$lib/navigation/header.svelte';
import Nav from '$lib/navigation/nav.svelte';
import Island from '$lib/islands/island.svelte';
import Loading from '$lib/navigation/loading.svelte';
import { uuid } from '$lib/stores/uuid';
const title = "PIS Finder"
const variables = {title: "Results"}
let entryPIS = "";
let entryStartCRS = "";
let entryEndCRS = "";
let data = [];
let error = false;
let errMsg = "Unknown Error"
let isLoading = false
const title = 'PIS Finder';
const variables = { title: 'Results' };
let entryPIS = '';
let entryStartCRS = '';
let entryEndCRS = '';
let data = [];
let error = false;
let errMsg = 'Unknown Error';
let isLoading = false;
async function findByStartEnd() {
isLoading = true
const url = `https://owlboard.info/api/v2/pis/byStartEnd/${entryStartCRS}/${entryEndCRS}`
await fetchData(url);
isLoading = false
async function findByStartEnd() {
isLoading = true;
const url = `https://owlboard.info/api/v2/pis/byStartEnd/${entryStartCRS}/${entryEndCRS}`;
await fetchData(url);
isLoading = false;
}
async function findByPis() {
isLoading = true;
const url = `https://owlboard.info/api/v2/pis/byCode/${entryPIS}`;
await fetchData(url);
isLoading = false;
}
async function fetchData(url) {
const options = {
method: 'GET',
headers: {
uuid: $uuid
}
};
const res = await fetch(url, options); // Enable Auth
if (res.status == 401) {
errMsg = 'You must be logged in to the staff version';
error = true;
return false;
} else if (res.status == 500) {
errMsg = 'Server Error, try again later';
error = true;
return false;
}
async function findByPis() {
isLoading = true
const url = `https://owlboard.info/api/v2/pis/byCode/${entryPIS}`
await fetchData(url);
isLoading = false;
const jsonData = await res.json();
if (jsonData.ERROR == 'offline') {
errMsg = 'Connection error, check your internet connection and try again';
error = true;
return false;
}
data = jsonData;
}
async function fetchData(url) {
const options = {
method: "GET",
headers: {
"uuid": $uuid
}
}
const res = await fetch(url, options); // Enable Auth
if (res.status == 401) {
errMsg = "You must be logged in to the staff version"
error = true
return false
} else if (res.status == 500) {
errMsg = "Server Error, try again later"
error = true
return false
}
const jsonData = await res.json();
if (jsonData.ERROR == "offline") {
errMsg = "Connection error, check your internet connection and try again"
error = true
return false
}
data = jsonData;
}
async function reset() {
data = [];
error = false;
entryPIS = "";
entryStartCRS = "";
entryEndCRS = "";
}
async function reset() {
data = [];
error = false;
entryPIS = '';
entryStartCRS = '';
entryEndCRS = '';
}
</script>
<Header {title} />
{#if isLoading}
<Loading/>
<Loading />
{/if}
{#if error}
@ -75,101 +75,119 @@
<p class="error">{errMsg}</p>
</Island>
{:else if data.length}
<Island {variables}>
<table>
<tr>
<th class="toc">TOC</th>
<th class="code">Code</th>
<th class="stops">Stops</th>
</tr>
{#each data as item}
<tr>
<td class="toc toc-data">{item.operator || "-"}</td>
<td class="code">{item.code}</td>
<td class="stops stops-data">{item.stops.join(" ")}</td>
</tr>
{/each}
</table>
</Island>
<Island {variables}>
<table>
<tr>
<th class="toc">TOC</th>
<th class="code">Code</th>
<th class="stops">Stops</th>
</tr>
{#each data as item}
<tr>
<td class="toc toc-data">{item.operator || '-'}</td>
<td class="code">{item.code}</td>
<td class="stops stops-data">{item.stops.join(' ')}</td>
</tr>
{/each}
</table>
</Island>
{:else}
<p>To search by headcode use the Train Finder on the homepage</p>
<p>This feature is only supported for GWR West & Sleeper services</p>
<p class="label">Find By Start/End CRS:</p>
<form on:submit={findByStartEnd}>
<input type="text" maxlength="3" autocomplete="off" placeholder="Start" bind:value={entryStartCRS}>
<input type="text" maxlength="3" autocomplete="off" placeholder="End" bind:value={entryEndCRS}>
<br>
<input
type="text"
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>
</form>
<p class="label">Find By PIS Code:</p>
<form on:submit={findByPis}>
<input type="number" max="9999" autocomplete="off" placeholder="PIS" bind:value={entryPIS}>
<br>
<button type="submit">Search</button>
<input
type="number"
max="9999"
autocomplete="off"
placeholder="PIS"
bind:value={entryPIS}
/>
<br />
<button type="submit">Search</button>
</form>
{/if}
<button id="reset" type="reset" on:click={reset}>Reset</button>
<Nav />
<style>
.label {
font-weight: 600;
color: var(--main-text-color);
}
input {
border: none;
border-radius: 50px;
font-family: urwgothic, sans-serif;
text-align: center;
text-transform: uppercase;
width: 30%;
max-width: 250px;
height: 30px;
font-size: 16px;
margin-bottom: 15px;
}
button {
border: none;
border-radius: 50px;
font-family: urwgothic, sans-serif;
width: 25%;
max-width: 175px;
margin: 0px;
margin-left: 10px;
margin-right: 10px;
height: 30px;
background-color: var(--overlay-color);
color: white;
font-size: 16px;
}
table {
width: 100%;
margin:auto;
color: white;
}
td {
padding-top: 5px;
padding-bottom: 5px;
}
.toc {
width: 15%;
}
.code {
width: 20%;
}
.toc-data {
text-transform: uppercase;
}
.stops-data {
text-align: left;
font-family: firamono, monospace;
text-transform: uppercase;
}
.error {
color: white;
}
#reset {
margin:25px;
}
.label {
font-weight: 600;
color: var(--main-text-color);
}
input {
border: none;
border-radius: 50px;
font-family: urwgothic, sans-serif;
text-align: center;
text-transform: uppercase;
width: 30%;
max-width: 250px;
height: 30px;
font-size: 16px;
margin-bottom: 15px;
}
button {
border: none;
border-radius: 50px;
font-family: urwgothic, sans-serif;
width: 25%;
max-width: 175px;
margin: 0px;
margin-left: 10px;
margin-right: 10px;
height: 30px;
background-color: var(--overlay-color);
color: white;
font-size: 16px;
}
table {
width: 100%;
margin: auto;
color: white;
}
td {
padding-top: 5px;
padding-bottom: 5px;
}
.toc {
width: 15%;
}
.code {
width: 20%;
}
.toc-data {
text-transform: uppercase;
}
.stops-data {
text-align: left;
font-family: firamono, monospace;
text-transform: uppercase;
}
.error {
color: white;
}
#reset {
margin: 25px;
}
</style>

View File

@ -1,80 +1,79 @@
<script>
import Header from '$lib/navigation/header.svelte'
import Loading from '$lib/navigation/loading.svelte';
import Island from '$lib/islands/island.svelte';
import Nav from '$lib/navigation/nav.svelte';
import { uuid } from '$lib/stores/uuid';
import Header from '$lib/navigation/header.svelte';
import Loading from '$lib/navigation/loading.svelte';
import Island from '$lib/islands/island.svelte';
import Nav from '$lib/navigation/nav.svelte';
import { uuid } from '$lib/stores/uuid';
import { onMount } from 'svelte'
import TrainDetail from '$lib/train/train-detail.svelte';
import { onMount } from 'svelte';
import TrainDetail from '$lib/train/train-detail.svelte';
let title = "Timetable Results"
let id = ""
let data = [];
let isLoading = true;
let error = false;
let errMsg = "";
let title = 'Timetable Results';
let id = '';
let data = [];
let isLoading = true;
let error = false;
let errMsg = '';
$: {
if (id) {
title = id.toUpperCase();
} else {
title = "Querying Timetable"
$: {
if (id) {
title = id.toUpperCase();
} else {
title = 'Querying Timetable';
}
}
async function getHeadcode() {
return new URLSearchParams(window.location.search).get('headcode');
}
onMount(async () => {
isLoading = true;
id = (await getHeadcode()) || '';
const res = await fetchData(id);
if (res) {
data = res;
if (!data.length) {
error = true;
errMsg = 'No services found';
}
}
isLoading = false;
});
async function getHeadcode() {
return new URLSearchParams(window.location.search).get('headcode');
async function fetchData(id = '') {
const date = 'now';
const searchType = 'headcode';
const options = {
method: 'GET',
headers: {
uuid: $uuid
}
};
const url = `https://owlboard.info/api/v2/timetable/train/${date}/${searchType}/${id}`;
const res = await fetch(url, options);
isLoading = false;
if (res.status == 200) {
return await res.json();
} else if (res.status === 401) {
error = true;
errMsg = 'You must be logged into the staff version for this feature';
return false;
} else {
error = true;
errMsg = 'Unable to connect, check your connection and try again';
return false;
}
onMount(async () => {
isLoading = true;
id = await getHeadcode() || "";
const res = await fetchData(id);
if (res) {
data = res;
if (!data.length) {
error = true;
errMsg = "No services found"
}
}
isLoading = false;
})
async function fetchData(id = "") {
const date = 'now';
const searchType = 'headcode'
const options = {
method: "GET",
headers: {
"uuid": $uuid
}
}
const url = `https://owlboard.info/api/v2/timetable/train/${date}/${searchType}/${id}`
const res = await fetch(url, options);
isLoading = false;
if (res.status == 200) {
return await res.json();
} else if (res.status === 401) {
error = true;
errMsg = "You must be logged into the staff version for this feature"
return false;
} else {
error = true;
errMsg = "Unable to connect, check your connection and try again"
return false;
}
}
}
</script>
<Header {title} />
<div id="whitespace"></div>
<div id="whitespace" />
{#if error}
<Island>
<p class="error">{errMsg}</p>
</Island>
<Island>
<p class="error">{errMsg}</p>
</Island>
{/if}
{#if isLoading}

View File

@ -4,47 +4,45 @@ import { build, files, version } from '$service-worker';
const cacheName = `ob-${version}`;
const assets = [
...build,
...files,
"/service-worker.js"
];
const assets = [...build, ...files, '/service-worker.js'];
self.addEventListener('install', (event) => {
async function addToCache() {
const cache = await caches.open(cacheName);
await cache.addAll(assets);
}
async function addToCache() {
const cache = await caches.open(cacheName);
await cache.addAll(assets);
}
event.waitUntil(addToCache());
})
event.waitUntil(addToCache());
});
self.addEventListener('activate', (event) => {
async function deleteOldCache() {
for (const key of await caches.keys()) {
if (key !== cacheName) {
await caches.delete(key);
}
}
async function deleteOldCache() {
for (const key of await caches.keys()) {
if (key !== cacheName) {
await caches.delete(key);
}
}
}
event.waitUntil(deleteOldCache());
})
event.waitUntil(deleteOldCache());
});
self.addEventListener('fetch', (event) => {
if (event.request.method !== 'GET') {return}
async function respond() {
const cacheRes = await caches.match(event.request, {ignoreSearch: true});
if (cacheRes) {
return cacheRes;
}
try {
return await fetch(event.request)
} catch (err) {
return {"error": "OFFLINE", "errorMsg": "You are not online"};
}
if (event.request.method !== 'GET') {
return;
}
async function respond() {
const cacheRes = await caches.match(event.request, { ignoreSearch: true });
if (cacheRes) {
return cacheRes;
}
event.respondWith(respond());
})
try {
return await fetch(event.request);
} catch (err) {
return { error: 'OFFLINE', errorMsg: 'You are not online' };
}
}
event.respondWith(respond());
});

View File

@ -1,33 +1,33 @@
{
"name": "OwlBoard",
"short_name": "OwlBoard",
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#404c55",
"description": "Live station departures, PIS Code Lookup, Reference Data, Timetable search, with enhanced data for staff.",
"categories": "travel,utilities",
"lang": "en",
"orientation": "portrait",
"theme_color": "#00b7b7",
"icons": [
{
"src": "/images/app-icons/maskable/mask-icon.svg",
"sizes": "any",
"type": "image/svg+xml",
"purpose": "maskable"
},
{
"src": "/images/app-icons/any/plain-logo.svg",
"sizes": "any",
"type": "image/svg+xml",
"purpose": "any"
},
{
"src": "/images/app-icons/any/plain-logo-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
}
]
"name": "OwlBoard",
"short_name": "OwlBoard",
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#404c55",
"description": "Live station departures, PIS Code Lookup, Reference Data, Timetable search, with enhanced data for staff.",
"categories": "travel,utilities",
"lang": "en",
"orientation": "portrait",
"theme_color": "#00b7b7",
"icons": [
{
"src": "/images/app-icons/maskable/mask-icon.svg",
"sizes": "any",
"type": "image/svg+xml",
"purpose": "maskable"
},
{
"src": "/images/app-icons/any/plain-logo.svg",
"sizes": "any",
"type": "image/svg+xml",
"purpose": "any"
},
{
"src": "/images/app-icons/any/plain-logo-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
}
]
}

View File

@ -1,13 +1,13 @@
import adapter from '@sveltejs/adapter-static';
export default {
kit: {
adapter: adapter({
pages: 'build',
assets: 'build',
fallback: 'index.html',
precompress: true,
strict: true
})
}
kit: {
adapter: adapter({
pages: 'build',
assets: 'build',
fallback: 'index.html',
precompress: true,
strict: true
})
}
};

View File

@ -2,5 +2,5 @@ import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()]
plugins: [sveltekit()]
});