pis #2

Merged
fred.boniface merged 76 commits from pis into main 2023-05-06 21:53:45 +01:00
4 changed files with 20 additions and 16 deletions
Showing only changes of commit 8335365bbf - Show all commits

View File

@ -7,7 +7,9 @@ async function findByOrigDest() {
const formData = await fetchOrigDest()
log(`findByOrigDest: Searching for PIS Code for ${JSON.stringify(formData)}`)
const endpoint = `pis/origdest/${formData.origin}/${formData.destination}`
console.time('findByOrigDest-GET')
const json = await getApi(endpoint, auth = true)
console.timeEnd('findByOrigDest-GET')
if (json == false) {
await displayNoData()
} else if (json == 401) {
@ -30,6 +32,7 @@ async function insertData(json) {
// Receives the JSON Respose ([{},{}]) containing one or more possible
// PIS codes. Display the code and the stops with a method of scrolling between them.
// Maybe as a table or a carousel?
console.time('insertData')
const div = document.getElementById('result-box')
let tableData = `<table id="result-table">
<tr>
@ -45,6 +48,7 @@ async function insertData(json) {
tableData += '</table>'
div.insertAdjacentHTML('beforeend', tableData)
document.getElementById('result-count').textContent = results.toString()
console.timeEnd('insertData')
}
async function displayNoData() {

View File

@ -57,7 +57,7 @@
<input type="text" class="small-lookup-box pis-input" id="destination" name="destination" maxlength="3"><br><br>
</div>
</div>
<input type="submit" value="Find" class="lookup-button">
<button type="submit" value="Find" class="lookup-button">Submit</button>
</form>
</div>
@ -67,7 +67,7 @@
and destination individually with a previous and next arrow. -->
</div>
<button id="reset" class="lookup-button" onclick="reset()">Reset</button>
<button type="reset" id="reset" class="lookup-button" onclick="reset()">Reset</button>
<!-- Footer -->
<footer>
<p>Created by <a href="https://fredboniface.co.uk" target="_blank" rel="noreferrer noopener">Fred Boniface</a> - <span id="ver_str">d</span></p>

View File

@ -1,18 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="description" content="OwlBoard - Personalise your OwlBoard."/>
<meta name="robots" content="noindex"/>
<meta charset="UTF-8">
<meta name="description" content="OwlBoard - Personalise your OwlBoard.">
<meta name="robots" content="noindex">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="application-name" content="OwlBoard">
<meta name="author" content="Frederick Boniface">
<meta name="theme-color" content="#00b7b7">
<link rel="apple-touch-icon" href="/images/app-icons/any/apple-192.png">
<link rel="stylesheet" type="text/css" href="./styles/main.css"/>
<link rel="stylesheet" type="text/css" href="./styles/settings.css"/>
<link rel="icon" type="image/svg+xml" href="./images/icon.svg"/>
<link rel="manifest" type="application/json" href="./manifest.json"/>
<link rel="stylesheet" type="text/css" href="./styles/main.css">
<link rel="stylesheet" type="text/css" href="./styles/settings.css">
<link rel="icon" type="image/svg+xml" href="./images/icon.svg">
<link rel="manifest" type="application/json" href="./manifest.json">
<title>OwlBoard - Settings</title>
<script src="./js/lib.main.js" defer></script>
<script src="./js/settings.js" defer></script>
@ -66,16 +66,16 @@
<input type="text" maxlength="3" id="ql9" name="ql9" autocomplete="off" class="small-lookup-box"><br>
<input type="text" maxlength="3" id="ql10" name="ql10" autocomplete="off" class="small-lookup-box">
<input type="text" maxlength="3" id="ql11" name="ql11" autocomplete="off" class="small-lookup-box"><br>
<button onclick="setQl()" class="lookup-button">Apply</button>
<button onclick="clearQl()" class="lookup-button">Defaults</button>
<button type="submit" onclick="setQl()" class="lookup-button">Apply</button>
<button type="reset" onclick="clearQl()" class="lookup-button">Defaults</button>
<br><br><br>
<label>Register for Rail Staff Version:</label>
<p id="reg_text">Enter your work email address:</p>
<input type="text" maxlength="128" id="eml" name="eml" autocomplete="email" class="lookup-box"><br>
<input type="text" maxlength="128" id="eml" name="eml" autocomplete="email" class="lookup-box" placeholder="email"><br>
<p>One registration confirmation email will be sent which will include more details about your account</p>
<p>Your address will not be stored</p>
<p>If your domain is not authorised and you are a using a railway company email address,
<a href="./issue.html">submit an issue</a> and it can be added.</p>
<button onclick="register()" class="lookup-button" id="reg_button">Register</button>
<p>If your domain is not authorised and you are a using a railway company email address,
<a href="./issue.html">submit an issue</a> and it can be added.</p>
<button type="submit" onclick="register()" class="lookup-button" id="reg_button">Register</button>
</body>
</html>

2
sw.js
View File

@ -1,6 +1,6 @@
/* Service Worker */
const appVersion = 'PIS-DEV-0105001'
const appVersion = 'PIS-DEV-0105002'
const cacheName = `owlboard-${appVersion}`
const cacheIDs = [cacheName]
const cacheFiles = [