Adjustments

This commit is contained in:
Fred Boniface 2023-05-01 21:27:31 +01:00
parent 2d2ee0f259
commit 8335365bbf
4 changed files with 20 additions and 16 deletions

View File

@ -7,7 +7,9 @@ async function findByOrigDest() {
const formData = await fetchOrigDest() const formData = await fetchOrigDest()
log(`findByOrigDest: Searching for PIS Code for ${JSON.stringify(formData)}`) log(`findByOrigDest: Searching for PIS Code for ${JSON.stringify(formData)}`)
const endpoint = `pis/origdest/${formData.origin}/${formData.destination}` const endpoint = `pis/origdest/${formData.origin}/${formData.destination}`
console.time('findByOrigDest-GET')
const json = await getApi(endpoint, auth = true) const json = await getApi(endpoint, auth = true)
console.timeEnd('findByOrigDest-GET')
if (json == false) { if (json == false) {
await displayNoData() await displayNoData()
} else if (json == 401) { } else if (json == 401) {
@ -30,6 +32,7 @@ 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.
// Maybe as a table or a carousel? // Maybe as a table or a carousel?
console.time('insertData')
const div = document.getElementById('result-box') const div = document.getElementById('result-box')
let tableData = `<table id="result-table"> let tableData = `<table id="result-table">
<tr> <tr>
@ -45,6 +48,7 @@ async function insertData(json) {
tableData += '</table>' tableData += '</table>'
div.insertAdjacentHTML('beforeend', tableData) div.insertAdjacentHTML('beforeend', tableData)
document.getElementById('result-count').textContent = results.toString() document.getElementById('result-count').textContent = results.toString()
console.timeEnd('insertData')
} }
async function displayNoData() { 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> <input type="text" class="small-lookup-box pis-input" id="destination" name="destination" maxlength="3"><br><br>
</div> </div>
</div> </div>
<input type="submit" value="Find" class="lookup-button"> <button type="submit" value="Find" class="lookup-button">Submit</button>
</form> </form>
</div> </div>
@ -67,7 +67,7 @@
and destination individually with a previous and next arrow. --> and destination individually with a previous and next arrow. -->
</div> </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 -->
<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> <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> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"/> <meta charset="UTF-8">
<meta name="description" content="OwlBoard - Personalise your OwlBoard."/> <meta name="description" content="OwlBoard - Personalise your OwlBoard.">
<meta name="robots" content="noindex"/> <meta name="robots" content="noindex">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="application-name" content="OwlBoard"> <meta name="application-name" content="OwlBoard">
<meta name="author" content="Frederick Boniface"> <meta name="author" content="Frederick Boniface">
<meta name="theme-color" content="#00b7b7"> <meta name="theme-color" content="#00b7b7">
<link rel="apple-touch-icon" href="/images/app-icons/any/apple-192.png"> <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/main.css">
<link rel="stylesheet" type="text/css" href="./styles/settings.css"/> <link rel="stylesheet" type="text/css" href="./styles/settings.css">
<link rel="icon" type="image/svg+xml" href="./images/icon.svg"/> <link rel="icon" type="image/svg+xml" href="./images/icon.svg">
<link rel="manifest" type="application/json" href="./manifest.json"/> <link rel="manifest" type="application/json" href="./manifest.json">
<title>OwlBoard - Settings</title> <title>OwlBoard - Settings</title>
<script src="./js/lib.main.js" defer></script> <script src="./js/lib.main.js" defer></script>
<script src="./js/settings.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="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="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> <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 type="submit" onclick="setQl()" class="lookup-button">Apply</button>
<button onclick="clearQl()" class="lookup-button">Defaults</button> <button type="reset" onclick="clearQl()" class="lookup-button">Defaults</button>
<br><br><br> <br><br><br>
<label>Register for Rail Staff Version:</label> <label>Register for Rail Staff Version:</label>
<p id="reg_text">Enter your work email address:</p> <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>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>Your address will not be stored</p>
<p>If your domain is not authorised and you are a using a railway company email address, <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> <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> <button type="submit" onclick="register()" class="lookup-button" id="reg_button">Register</button>
</body> </body>
</html> </html>

2
sw.js
View File

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