Compare commits
No commits in common. "4b47f303e9e6424d225d9572444fe1c1164668b3" and "f3a488752e594e779a76ba17f8d85e30f3f17cac" have entirely different histories.
4b47f303e9
...
f3a488752e
|
@ -1 +0,0 @@
|
||||||
# Build and push docker container to repository
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
/* All Page Init */
|
/* All Page Init */
|
||||||
const version = '2023.5.9'
|
const version = '2023.5.8'
|
||||||
|
|
||||||
/* Feature Detectors */
|
/* Feature Detectors */
|
||||||
|
|
||||||
|
|
44
js/pis.js
44
js/pis.js
|
@ -23,55 +23,12 @@ async function findByOrigDest() {
|
||||||
hideLoading()
|
hideLoading()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findByPisCode() {
|
|
||||||
showLoading()
|
|
||||||
const formData = await fetchPisCode()
|
|
||||||
log(`findByPisCode: Searching for PIS Code ${formData}`)
|
|
||||||
const endpoint = `pis/code/${formData}`
|
|
||||||
console.time('findByPisCode-GET')
|
|
||||||
const json = await getApi(endpoint, auth = true)
|
|
||||||
console.timeEnd('findByPisCode-GET')
|
|
||||||
if (json == false) {
|
|
||||||
await displayNoData()
|
|
||||||
} else if (json == 401) {
|
|
||||||
await displayUnauthorised()
|
|
||||||
} else {
|
|
||||||
await insertData(json)
|
|
||||||
}
|
|
||||||
document.getElementById('crs-box').style = 'display:none'
|
|
||||||
document.getElementById('result-box').style = 'display:block'
|
|
||||||
hideLoading()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function findRandomCode() {
|
|
||||||
showLoading()
|
|
||||||
log('findRandomCode: Fetching random PIS codes')
|
|
||||||
const endpoint = 'pis/random'
|
|
||||||
console.time('findRandomCode-GET')
|
|
||||||
const json = await getApi(endpoint, auth = true)
|
|
||||||
console.timeEnd('findRandomCode-GET')
|
|
||||||
if (json == false) {
|
|
||||||
await displayNoData()
|
|
||||||
} else if (json == 401) {
|
|
||||||
await displayUnauthorised()
|
|
||||||
} else {
|
|
||||||
await insertData(json)
|
|
||||||
}
|
|
||||||
document.getElementById('crs-box').style = 'display:none'
|
|
||||||
document.getElementById('result-box').style = 'display:block'
|
|
||||||
hideLoading()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function fetchOrigDest() {
|
async function fetchOrigDest() {
|
||||||
var orig = document.getElementById('origin').value
|
var orig = document.getElementById('origin').value
|
||||||
var dest = document.getElementById('destination').value
|
var dest = document.getElementById('destination').value
|
||||||
return {origin: orig, destination: dest}
|
return {origin: orig, destination: dest}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchPisCode() {
|
|
||||||
return document.getElementById('pis').value
|
|
||||||
}
|
|
||||||
|
|
||||||
async function insertData(json) {
|
async function insertData(json) {
|
||||||
// Receives the JSON Respose ([{},{}]) containing one or more possible
|
// Receives the JSON Respose ([{},{}]) containing one or more possible
|
||||||
// PIS codes. Display the code and the stops with a method of scrolling between them.
|
// PIS codes. Display the code and the stops with a method of scrolling between them.
|
||||||
|
@ -109,7 +66,6 @@ async function reset() {
|
||||||
try {
|
try {
|
||||||
document.getElementById('origin').value = ''
|
document.getElementById('origin').value = ''
|
||||||
document.getElementById('destination').value = ''
|
document.getElementById('destination').value = ''
|
||||||
document.getElementById('pis').value = ''
|
|
||||||
document.getElementById('result-box').style = 'display:none'
|
document.getElementById('result-box').style = 'display:none'
|
||||||
document.getElementById('result-table').remove()
|
document.getElementById('result-table').remove()
|
||||||
document.getElementById('crs-box').style = 'display:block'
|
document.getElementById('crs-box').style = 'display:block'
|
||||||
|
|
12
pis.html
12
pis.html
|
@ -43,9 +43,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="crs-box">
|
<div id="crs-box">
|
||||||
|
<p>Enter a services start and end station CRS codes to see code options and stopping patterns.</p>
|
||||||
<p>Currently supported (Beta): GWR: ex-Wessex, HEx<br>Duplicate stopping patterns have been removed.</p>
|
<p>Currently supported (Beta): GWR: ex-Wessex, HEx<br>Duplicate stopping patterns have been removed.</p>
|
||||||
<p id="auth-required">You need to be logged into a free <a href="./settings.html#railstaff">rail staff version</a> account for this feature.</p>
|
<p id="auth-required">You need to be logged into a free <a href="./settings.html#railstaff">rail staff version</a> account for this feature.</p>
|
||||||
<h3>Search by CRS Codes</h3>
|
|
||||||
<form action="javascript:findByOrigDest();">
|
<form action="javascript:findByOrigDest();">
|
||||||
<div id="crs-inputs">
|
<div id="crs-inputs">
|
||||||
<div class="crs-input">
|
<div class="crs-input">
|
||||||
|
@ -59,16 +59,6 @@
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" value="Find" class="lookup-button">Submit</button>
|
<button type="submit" value="Find" class="lookup-button">Submit</button>
|
||||||
</form>
|
</form>
|
||||||
<h3>Search by PIS Code</h3>
|
|
||||||
<form action="javascript:findByPisCode();">
|
|
||||||
<div id="crs-inputs">
|
|
||||||
<div class="crs-input">
|
|
||||||
<label for="pis">PIS Code:</label><br>
|
|
||||||
<input type="number" class="small-lookup-box pis-input" id="pis" name="pis" maxlength="4" autocomplete="off"><br><br>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button type="submit" value="Find" class="lookup-button">Submit</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="result-box">
|
<div id="result-box">
|
||||||
|
|
2
sw.js
2
sw.js
|
@ -1,6 +1,6 @@
|
||||||
/* Service Worker */
|
/* Service Worker */
|
||||||
|
|
||||||
const swVersion = '2023.5.9-1'
|
const swVersion = '2023.5.8-1'
|
||||||
const cacheName = `owlboard-${swVersion}`
|
const cacheName = `owlboard-${swVersion}`
|
||||||
const cacheIDs = [cacheName]
|
const cacheIDs = [cacheName]
|
||||||
let staticCache = [
|
let staticCache = [
|
||||||
|
|
Reference in New Issue