Initial commit to new repo.

This commit is contained in:
Fred Boniface 2022-09-08 21:05:49 +01:00
parent ccf27f05c4
commit 3259e03589
26 changed files with 764 additions and 0 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 820 B

BIN
assets/icons/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
assets/icons/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

@ -0,0 +1,231 @@
<?xml version="1.0"?>
<svg
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2000/svg"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:ns1="http://sozi.baierouge.fr"
xmlns:xlink="http://www.w3.org/1999/xlink"
id="svg4053"
viewBox="0 0 96.379 122.71"
version="1.1"
>
<defs
id="defs4055"
>
<filter
id="filter4690"
color-interpolation-filters="sRGB"
>
<feGaussianBlur
id="feGaussianBlur4692"
stdDeviation="3.4203099"
/>
</filter
>
</defs
>
<g
id="layer1"
stroke-linejoin="round"
stroke="#000"
transform="translate(-357.2 -427.16)"
fill-rule="evenodd"
>
<path
id="path4309-78-4-6"
opacity=".57613"
d="m157.28 527.59c-10.774-14.506-8.2002-35.349 5.7481-46.554s33.989-8.5282 44.763 5.978 8.2002 35.349-5.7481 46.554c-13.85 11.126-33.732 8.5752-44.568-5.7173"
transform="matrix(-.23977 -.0049413 -.0057774 .22798 471.21 339.28)"
filter="url(#filter4690)"
stroke-linecap="round"
stroke-width="4.2761"
/>
<path
id="path4309-7-8-9-3"
opacity=".57613"
d="m157.28 527.59c-10.774-14.506-8.2002-35.349 5.7481-46.554s33.989-8.5282 44.763 5.978 8.2002 35.349-5.7481 46.554c-13.85 11.126-33.732 8.5752-44.568-5.7173"
transform="matrix(.23977 .0049413 -.0057774 .22798 346.72 335.16)"
filter="url(#filter4690)"
stroke-linecap="round"
stroke-width="4.2761"
/>
<path
id="path4339-7-8-2"
opacity=".57613"
d="m-49.783 512.41c-30.644 119.17-66.048 129.04-153.93 42.918-87.882-86.123-78.729-121.72 39.797-154.77 118.53-33.047 144.78-7.3216 114.13 111.85z"
transform="matrix(-.091874 .016439 .019893 .076366 382.11 440.92)"
filter="url(#filter4690)"
stroke-linecap="round"
stroke-width="11.67"
fill="#ffc600"
/>
<path
id="path4363-1-2-9"
d="m509.32 458.79c-112.67 4.96-160.3-69.76-108.26-169.81 52.05-100.06 140.57-103.95 201.2-8.85 60.62 95.1 19.73 173.71-92.94 178.66z"
transform="matrix(.10985 -.041842 .051471 .15443 298.79 455.4)"
stroke-linecap="square"
stroke-width="7.2325"
fill="#0280e5"
/>
<path
id="path4363-7-8"
d="m509.32 458.79c-112.67 4.96-160.3-69.76-108.26-169.81 52.05-100.06 140.57-103.95 201.2-8.85 60.62 95.1 19.73 173.71-92.94 178.66z"
transform="matrix(.099940 .032638 -.070011 .18001 412.47 413.01)"
stroke-linecap="square"
stroke-width="7.023"
fill="#0280e5"
/>
<path
id="path4383-5-4"
d="m556.55 466.45c-17.621-0.20253-4.8044-87.421-13.439-102.78-8.6349-15.361-89.808-49.746-80.822-64.905 8.9857-15.159 78.111 39.55 95.732 39.752 17.621 0.20254 87.985-52.903 96.62-37.542 8.6349 15.361-73.307 47.871-82.293 63.03-8.9857 15.159 1.8224 102.65-15.798 102.45z"
transform="matrix(-.16283 .022830 -.025180 -.14915 506.19 579.02)"
stroke-linecap="square"
stroke-width="6.3422"
fill="#e5b302"
/>
<path
id="path4383-1-6-0"
d="m556.55 466.45c-17.621-0.20253-4.8044-87.421-13.439-102.78-8.6349-15.361-89.808-49.746-80.822-64.905 8.9857-15.159 78.111 39.55 95.732 39.752 17.621 0.20254 87.985-52.903 96.62-37.542 8.6349 15.361-73.307 47.871-82.293 63.03-8.9857 15.159 1.8224 102.65-15.798 102.45z"
transform="matrix(-.16776 -.0036826 .0033856 -.15260 486.98 593.32)"
stroke-linecap="square"
stroke-width="6.2485"
fill="#e5b302"
/>
<path
id="path4341-6-1"
d="m412.31 599.21c-116.74 7.07-213.49-139.27-161.24-243.9 52.24-104.64 227.34-115.25 291.84-17.69s-13.87 254.51-130.6 261.59z"
transform="matrix(-.24933 -.0051385 .0065906 -.26007 501.82 594.24)"
stroke-linecap="square"
stroke-width="3.926"
fill="#7cccda"
/>
<path
id="path3799-4-6"
d="m-272.67 524.66c-29.735-39.334-22.633-95.85 15.865-126.23 38.497-30.382 93.811-23.125 123.55 16.21 29.735 39.334 22.633 95.85-15.865 126.23-38.226 30.168-93.101 23.252-123.01-15.503"
transform="matrix(-.24499 -.0052440 -.0054087 .22153 382.69 346.41)"
stroke-linecap="square"
stroke-width="4.2914"
fill="#fff"
/>
<path
id="path4309-78-4"
stroke-width="4.2761"
transform="matrix(-.23977 -.0049413 -.0057774 .22798 470.49 338.17)"
stroke-linecap="square"
d="m157.28 527.59c-10.774-14.506-8.2002-35.349 5.7481-46.554s33.989-8.5282 44.763 5.978 8.2002 35.349-5.7481 46.554c-13.85 11.126-33.732 8.5752-44.568-5.7173"
/>
<path
id="path3799-5-1-1"
d="m-272.67 524.66c-29.735-39.334-22.633-95.85 15.865-126.23 38.497-30.382 93.811-23.125 123.55 16.21 29.735 39.334 22.633 95.85-15.865 126.23-38.226 30.168-93.101 23.252-123.01-15.503"
transform="matrix(.25260 .0053176 -.0058031 .23364 435.23 340.05)"
stroke-linecap="square"
stroke-width="4.1153"
fill="#fff"
/>
<path
id="path4309-7-8-9"
stroke-width="4.2761"
transform="matrix(.23977 .0049413 -.0057774 .22798 346 334.06)"
stroke-linecap="square"
d="m157.28 527.59c-10.774-14.506-8.2002-35.349 5.7481-46.554s33.989-8.5282 44.763 5.978 8.2002 35.349-5.7481 46.554c-13.85 11.126-33.732 8.5752-44.568-5.7173"
/>
<path
id="path4339-7-8"
d="m-49.783 512.41c-30.644 119.17-66.048 129.04-153.93 42.918-87.882-86.123-78.729-121.72 39.797-154.77 118.53-33.047 144.78-7.3216 114.13 111.85z"
transform="matrix(-.091874 .016439 .019893 .076366 381.39 439.82)"
stroke-linecap="square"
stroke-width="11.67"
fill="#ffc600"
/>
</g
>
<metadata
>
<rdf:RDF
>
<cc:Work
>
<dc:format
>image/svg+xml</dc:format
>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage"
/>
<cc:license
rdf:resource="http://creativecommons.org/licenses/publicdomain/"
/>
<dc:publisher
>
<cc:Agent
rdf:about="http://openclipart.org/"
>
<dc:title
>Openclipart</dc:title
>
</cc:Agent
>
</dc:publisher
>
<dc:title
>Blue googley-eyed bird</dc:title
>
<dc:date
>2013-09-11T18:45:29</dc:date
>
<dc:description
>A cute blue cartoon bird with big eyes.</dc:description
>
<dc:source
>https://openclipart.org/detail/183311/blue-googley-eyed-bird-by-anarres-183311</dc:source
>
<dc:creator
>
<cc:Agent
>
<dc:title
>anarres</dc:title
>
</cc:Agent
>
</dc:creator
>
<dc:subject
>
<rdf:Bag
>
<rdf:li
>bird</rdf:li
>
<rdf:li
>cartoon</rdf:li
>
</rdf:Bag
>
</dc:subject
>
</cc:Work
>
<cc:License
rdf:about="http://creativecommons.org/licenses/publicdomain/"
>
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction"
/>
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution"
/>
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks"
/>
</cc:License
>
</rdf:RDF
>
</metadata
>
</svg
>

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
assets/icons/icon-128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

BIN
assets/icons/icon-1500.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

BIN
assets/icons/icon-256.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
assets/icons/icon-512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
assets/icons/icon.xcf Normal file

Binary file not shown.

BIN
assets/icons/menu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

117
assets/tiger_codes.json Normal file
View File

@ -0,0 +1,117 @@
{
"abw":{"name":"abbey wood","tiploc":"abwd"},
"apf":{"name":"appleford","tiploc":"applefd"},
"asc":{"name":"Ashchurch for Tewkesbury","tiploc":"ashchrc"},
"auw":{"name":"Ascott-under-Wynchwood","tiploc":"asctuwd"},
"avf":{"name":"avoncliff","tiploc":"avnclff"},
"avn":{"name":"avonmouth","tiploc":"avonmth"},
"bte":{"name":"bitterne","tiploc":"biterne","stanme":"bitterne","stanox":"86216"},
"bth":{"name":"bath spa","tiploc":"bathspa"},
"bmt":{"name":"bedminster","tiploc":"bdmnstr"},
"boa":{"name":"bradford on avon","tiploc":"brdfdoa"},
"boe":{"name":"botley","tiploc":"botley","stanme":"botley","stanox":"86202"},
"bri":{"name":"bristol temple meads","tiploc":"brstltm"},
"bru":{"name":"bruton","tiploc":"bruton","stanme":"bruton","stanox":"82299"},
"bpw":{"name":"bristol parkway","tiploc":"brstpwy"},
"buo":{"name":"bursledon","tiploc":"bursldn","stanme":"bursledon","stanox":"86223"},
"bwt":{"name":"bridgewater","tiploc":"brdgwtr","stanme":"bridgwatr","stanox":"81924"},
"cby":{"name":"charlbury","tiploc":"chbury"},
"cdf":{"name":"cardiff central","tiploc":"crdfcen"},
"cdu":{"name":"cam & dursley","tiploc":"dursley"},
"cfn":{"name":"clifton down","tiploc":"clfdown"},
"clc":{"name":"castle cary","tiploc":"ccary","stanme":"castlcary","stanox":"82301"},
"cme":{"name":"combe","tiploc":"combe"},
"cmn":{"name":"carmarthen","tiploc":"cmthn"},
"cnm":{"name":"cheltenham spa","tiploc":"chltnhm"},
"cno":{"name":"chetnole","tiploc":"chetnol","stanme":"chetnole","stanox":"82315"},
"csa":{"name":"cosham","tiploc":"cosham","stanme":"cosham","stanox":"86301"},
"cum":{"name":"culham","tiploc":"culham"},
"cwl":{"name":"colwall","tiploc":"clwall"},
"dbg":{"name":"dunbridge","tiploc":"motfont","stanme":"dunbridge","stanox":"86107"},
"mtd":{"name":"mottisfont & dunbridge (now dunbridge)","tiploc":"motfont"},
"dcw":{"name":"dorchester west","tiploc":"drchw","stanme":"dorchstrw","stanox":"86977"},
"den":{"name":"dean (wilts)","tiploc":"dean","stanme":"dean","stanox":"86112"},
"dmh":{"name":"dilton marsh","tiploc":"diltonm","stanme":"diltonmsh","stanox":"82105"},
"esl":{"name":"eastleigh","tiploc":"elgh","stanme":"eastleigh","stanox":"86087"},
"eve":{"name":"evesham","tiploc":"evesham"},
"faw":{"name":"filton abbey wood","tiploc":"filtnew"},
"ffd":{"name":"freshford","tiploc":"freshfd"},
"fin":{"name":"finstock","tiploc":"finstck"},
"fit":{"name":"filton abbey wood","tiploc":"filtnew"},
"frm":{"name":"fareham","tiploc":"fareham","stanme":"fareham","stanox":"86241"},
"fro":{"name":"frome","tiploc":"frome","stanme":"frome","stanox":"82204"},
"ftm":{"name":"fratton","tiploc":"fratton","stanme":"fratton","stanox":"86321"},
"gcr":{"name":"gloucester","tiploc":"gloster"},
"gmv":{"name":"great malvern","tiploc":"gtmlvrn"},
"hde":{"name":"hedge end","tiploc":"hedgend","stanme":"hedge end","stanox":"86201"},
"hfd":{"name":"hereford","tiploc":"herefrd"},
"hig":{"name":"highbridge & burnham","tiploc":"hghbrdg","stanme":"highbridg","stanox":"81915"},
"hls":{"name":"hilsea","tiploc":"hilsea","stanme":"hilsea","stanox":"86332"},
"hme":{"name":"hamble","tiploc":"hmble","stanme":"hamble","stanox":"86222"},
"hnd":{"name":"hanborough","tiploc":"handbro"},
"hyb":{"name":"honeybourne","tiploc":"honybrn"},
"hyd":{"name":"heyford","tiploc":"heyford"},
"kem":{"name":"kemble","tiploc":"kemble"},
"kgm":{"name":"kingham","tiploc":"kingham"},
"kgs":{"name":"kings sutton","tiploc":"kinsstn"},
"kyn":{"name":"keynsham","tiploc":"keynshm"},
"led":{"name":"ledbury","tiploc":"ldbury"},
"lwh":{"name":"lawrence hill","tiploc":"lawrnch"},
"mdn":{"name":"maiden newton","tiploc":"mdnnwtn","stanme":"maidenntn","stanox":"82316"},
"mim":{"name":"moreton-in-marsh","tiploc":"minmars"},
"mtp":{"name":"montpelier","tiploc":"monpelr"},
"mvl":{"name":"malvern link","tiploc":"mlvrnlk"},
"nls":{"name":"nailsea & backwell","tiploc":"nailsea","stanme":"nailsea b","stanox":"81903"},
"ntl":{"name":"netley","tiploc":"netley","stanme":"netley","stanox":"86219"},
"nwp":{"name":"newport (south wales)","tiploc":"nwptrtg"},
"olf":{"name":"oldfield park","tiploc":"oldfldp"},
"oxf":{"name":"oxford","tiploc":"oxfd"},
"pil":{"name":"pilning","tiploc":"pilning"},
"pmh":{"name":"portsmouth harbour","tiploc":"phbr"},
"pms":{"name":"porsmouth & southsea","tiploc":"psea"},
"pri":{"name":"portway park and ride","tiploc":"ptwypr"},
"psh":{"name":"pershore","tiploc":"pershor"},
"psn":{"name":"parson street","tiploc":"parsnst"},
"ptc":{"name":"portchester","tiploc":"pchestr","stanme":"ptchester","stanox":"86248"},
"pwy":{"name":"patchway","tiploc":"patchwy"},
"rad":{"name":"radley","tiploc":"rdley"},
"rda":{"name":"redland","tiploc":"redland"},
"rom":{"name":"romsey","tiploc":"romsey","stanme":"romsey","stanox":"86101"},
"sal":{"name":"salisbury","tiploc":"slsbry","stanme":"salisbury","stanox":"86122"},
"sar":{"name":"st andrews road","tiploc":"sadwrd"},
"sdn":{"name":"st denys","tiploc":"stdenys","stanme":"st denys","stanox":"86499"},
"shh":{"name":"shirahampton","tiploc":"shamptn"},
"sho":{"name":"sholing","tiploc":"sholing","stanme":"sholing","stanox":"86218"},
"shu":{"name":"stonehouse","tiploc":"stnhse"},
"sip":{"name":"shipton","tiploc":"sptn"},
"sml":{"name":"sea mills","tiploc":"semills"},
"snw":{"name":"swanwick","tiploc":"swnwick","stanme":"swanwick","stanox":"86225"},
"soa":{"name":"southampton airport parkway","tiploc":"sotpkwy","stanme":"sotonpway","stanox":"86495"},
"sou":{"name":"southampton central","tiploc":"soton"},
"srd":{"name":"stapleton road","tiploc":"stpltnr"},
"std":{"name":"stroud (gloucs)","tiploc":"strud"},
"svb":{"name":"severn beach","tiploc":"svrnbch"},
"swa":{"name":"swansea","tiploc":"swansea"},
"swg":{"name":"swaythling","tiploc":"swythln","stanme":"swaythlng","stanox":"86497"},
"swi":{"name":"swindon (wilts)","tiploc":"sdon"},
"tac":{"name":"tackley","tiploc":"tackley"},
"tau":{"name":"taunton","tiploc":"taunton","stanme":"taunton","stanox":"83009"},
"tho":{"name":"thornford","tiploc":"thford","stanme":"thornford","stanox":"82313"},
"tro":{"name":"trowbridge","tiploc":"twrbrdg"},
"upw":{"name":"upwey","tiploc":"upwey","stanme":"upwey","stanox":"86978"},
"wey":{"name":"weymouth","tiploc":"weymth","stanox":"86981"},
"wls":{"name":"woolston","tiploc":"wolston","stanme":"woolston","stanox":"86205"},
"wmn":{"name":"warminster","tiploc":"wrmnstr","stanme":"warminstr","stanox":"82114"},
"wnm":{"name":"weston milton","tiploc":"wmilton","stanme":"westonmln","stanox":"81909"},
"wsb":{"name":"westbury","tiploc":"wstbryw"},
"wsm":{"name":"weston-super-mare","tiploc":"wsmare"},
"wof":{"name":"worcester foregate street","tiploc":"worcsfs"},
"wop":{"name":"worcestershire parkway","tiploc":"worcpwy"},
"wph":{"name":"worcestershite parkway","tiploc":"worcpwy"},
"wor":{"name":"worle","tiploc":"worle","stanme":"worle","stannox":"81906"},
"wos":{"name":"worcester shrub hill","tiploc":"worcssh"},
"yae":{"name":"yate","tiploc":"yate"},
"yat":{"name":"yatton","tiploc":"yatton","stanme":"yatton","stanox":"81905"},
"yet":{"name":"yetminster","tiploc":"ytmnstr","stanme":"yetminstr","stanox":"82314"},
"yvp":{"name":"yeovil pen mill","tiploc":"yovilpm","stanme":"yeovilpml","stanox":"82311"}
}

BIN
assets/title/title.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
assets/title/title.xcf Normal file

Binary file not shown.

BIN
assets/title/title_355.jxl Normal file

Binary file not shown.

BIN
assets/title/title_355.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

BIN
assets/title/title_355.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
assets/title/title_600.jxl Normal file

Binary file not shown.

BIN
assets/title/title_600.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
assets/title/title_600.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

107
index.html Normal file
View File

@ -0,0 +1,107 @@
<!DOCTYPE html>
<html>
<head>
<title>Athena</title>
<meta charset="UTF-8"/>
<meta name="description" content="Athena - Quick links to live train departures for traincrew."/>
<meta name="viewport" content="width=device-width, initial=scale=1.0">
<meta name="application-name" content="Athena">
<meta name="author" content="Frederick Boniface">
<link rel="stylesheet" type="text/css" href="./styles/style.css"/>
<link rel="icon" type="image/png" href="./assets/icons/favicon.ico"/>
<link rel="manifest" type="application/json" href="./manifest.json"/>
<script src="./scripts/tiploc-finder.js"></script>
<script src="./scripts/nav.js"></script>
</head>
<body>
<!-- Popup Menu -->
<div id="menu-button" class="menu-button">
<img onclick="openMenu()" src="./assets/icons/menu.png"></img>
</div>
<div id="menu" class="menu">
<button class="menuitem" onclick="openAboutPopup(),closeMenu()">Help</button>
<button class="menuitem" onclick="openTiplocPopup(),closeMenu()">Code Lookup</button>
<img onclick="closeMenu()" class="popup-close" src="./assets/icons/close-circle.png"></img>
</div>
<!-- Main Content Begins -->
<img class="titleimg" src="./assets/title/title.webp"></img>
<br>
<input class="lookup-box" type="text" id="crs-lookup" name="crs-lookup" placeholder="Enter CRS/TIPLOC"/>
<br>
<button class="lookup-button" onclick="getTextEntry()">Lookup Departure Board</button>
<br>
<br>
<h2>Quick Links</h2>
<button class="quicklink" onclick="gotoInfoBoard('bathspa')">BTH</button>
<button class="quicklink" onclick="gotoInfoBoard('brstltm')">BRI</button>
<button class="quicklink" onclick="gotoInfoBoard('brstpwy')">BPW</button>
<button class="quicklink" onclick="gotoInfoBoard('crdfcen')">CDF</button>
<button class="quicklink" onclick="gotoInfoBoard('gloster')">GCR</button>
<button class="quicklink" onclick="gotoInfoBoard('oldfldp')">OLF</button>
<button class="quicklink" onclick="gotoInfoBoard('soton')">SOU</button>
<button class="quicklink" onclick="gotoInfoBoard('wstbryw')">WSB</button>
<button class="quicklink" onclick="gotoInfoBoard('wsmare')">WSM</button>
<br>
<br>
<p>This is an Alpha release and is under testing.</p>
<p>Some features may not work and some stations may not be available.</p>
<!-- Popup Boxes (Usually Hidden with CSS) -->
<div id="popup-about" class="popup-info">
<img onclick="closeAboutPopup()" class="popup-close" src="./assets/icons/close-circle.png"></img>
<h2>Help</h2>
<p>Just type in a three character CRS code or a TIPLOC into the text
box and tap the Lookup button.</p>
<p>If you enter a TIPLOC, this will not be verified - if it is
incorrect or unavailable on Tiger, you will be redirected to a
blank board. CRS codes will be verified against a lookup file
before redirecting.</p>
<p>Use the TIPLOC Lookup option from the menu to look up a TIPLOC from
a given CRS code.</p>
<p>Some stations are not on Tiger and these stations are not supported
here either. Notably TfW and Chiltern stations that border the GWR
network. Most GWR Central served stations are now available to
lookup.</p>
<p>Until there is a more modern public API offering access to Darwin,
I have no interest in supporting any more than simply linking to
the relevent Tiger page.</p>
</div>
<div id="popup-tiploc" class="popup-info">
<img onclick="closeTiplocPopup()" class="popup-close" src="./assets/icons/close-circle.png"></img>
<h2>Code Lookup</h2>
<p hidden>Enter a CRS Code in the textbox and tap Go.</p>
<p hidden>All GWR managed stations can be looked up but others cannot be
gauranteed.</p>
<p>THIS FEATURE IS NOT YET IMPLEMENTED</p>
<input type="text" id="lookup-tiploc" name="lookup-tiploc" placeholder="Enter CRS"/>
<button onclick="tiplocFinder()">Go</button>
<br>
<p id="resultCRS">CRS: </p>
<p id="resultName">Name: </p>
<p id="resultTIPLOC">TIPLOC: </p>
<p id="resultSTANME">STANME: </p>
<p id="resultSTANOX">STANOX: </p>
</div>
<!-- Footer -->
<footer>
<p>Created by Fred Boniface - v0.1.13-alpha</p>
</footer>
</body>
</html>

36
manifest.json Normal file
View File

@ -0,0 +1,36 @@
{
"name": "Athena",
"short_name": "Athena",
"start_url": "/athena/index.html",
"scope": "/athena/",
"display": "standalone",
"background_color": "#7fa7e6",
"description": "Quick links for live train departure boards - aimed at train-crew.",
"dir": "ltr",
"categories": "travel,utilities",
"lang": "en",
"orientation": "portrait",
"theme_color": "#3c78d8",
"icons": [
{
"src": "/athena/assets/icons/icon-1500.png",
"sizes": "1500x1500",
"type": "image/png"
},
{
"src": "/athena/assets/icons/icon-512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "/athena/assets/icons/icon-256.png",
"sizes": "256x256",
"type": "image/png"
},
{
"src": "/athena/assets/icons/icon-128.png",
"sizes": "128x128",
"type": "image/png"
}
]
}

23
scripts/nav.js Normal file
View File

@ -0,0 +1,23 @@
function openMenu() {
document.getElementById("menu").style.display = "block";
}
function closeMenu() {
document.getElementById("menu").style.display = "none";
}
function closeAboutPopup() {
document.getElementById("popup-about").style.display = "none";
}
function openAboutPopup() {
document.getElementById("popup-about").style.display = "block";
}
function closeTiplocPopup() {
document.getElementById("popup-tiploc").style.display = "none";
}
function openTiplocPopup() {
document.getElementById("popup-tiploc").style.display = "block";
}

0
scripts/sw.js Normal file
View File

125
scripts/tiploc-finder.js Normal file
View File

@ -0,0 +1,125 @@
const url = "https://tiger.worldline.global/";
const view = "/staff;scrollbar=true";
console.group("Athena - v0.1.13-alpha")
console.info("Initialising");
/* Get lookup data from JSON file */
let dataGlobal;
const getData = async () => {
console.info("Loading Tiger lookup file");
// Probably put a loading wheel here!
const response = await fetch("./assets/tiger_codes.json");
const data = await response.json();
dataGlobal = data;
return data;
};
(async () => {
await getData();
console.info("Lookup file loaded");
console.info(dataGlobal);
console.info("Initialisation complete");
// Probably end the loading wheel here.
console.groupEnd();
})();
/* Read Lookup textbox entry and call the gotoInfoBoard() function */
function getTextEntry() {
console.group("Athena: function: getTextEntry()");
console.info("Getting contents of textbox 'crs-lookup'");
let forLookup = document.getElementById("crs-lookup").value;
console.info("You have entered: " + forLookup.toUpperCase());
console.info("Calling gotoInfoBoard(" + forLookup.toLowerCase() + ")");
console.groupEnd()
gotoInfoBoard(forLookup);
};
/* Runs basic validation of data type and then process that and finally
redirects to Tiger using a built URL */
function gotoInfoBoard(station) {
// Firstly start a console group for the function
console.group("Athena: function: gotoInfoBoard(" + station.toLowerCase() + ")");
//Determins if code is TIPLOC and if so redirects immediately
if (station.length > 3 && station.length < 8) {
console.info(station.length + "characters, presumed to be tiploc.");
console.info("Redirecting to " + station + " departure board");
window.location = url + station.toUpperCase() + view;
//If code is CRS then process further to determine the TIPLOC then redirect
} else if (station.length == 3) {
console.info("CRS entered: " + station.toUpperCase() + ", required lookup");
console.info("Finding object");
let crs_to_find = station.toLowerCase();
console.debug("Converted string to lower case:" + crs_to_find);
//Check if the entered CRS exists in the lookup file
console.info("Checking if CRS code exists in lookup data")
let hasKey = dataGlobal.hasOwnProperty(crs_to_find);
if (hasKey) { //If key exists then log and continue
console.info(crs_to_find.toUpperCase() + " does exist in lookup file");
} else { //If key does not exist then stop further processing
console.warn(crs_to_find.toUpperCase() + "does not exist in lookup file");
console.error(crs_to_find.toUpperCase() + " is an incorrect code or not supported.");
alert(crs_to_find.toUpperCase() + " is not a valid or supported CRS, " +
"please see the help section for more information");
console.groupEnd();
return 0;
}
let crs_obj = dataGlobal[crs_to_find];
console.info("Isolating TIPLOC from Object");
let tiploc = crs_obj['tiploc']; // crs_obj['tiploc']??
console.info("TIPLOC: " + tiploc);
console.info("Redirecting to " + tiploc + " departure board");
window.location = url + tiploc.toUpperCase() + view;
//If the code cannot be validated as CRS or TIPLOC then throw an alert and log
} else {
console.error("Please only enter:\n - A 3 character CRS code,\n - A 4-7 " +
"character TIPLOC code.\n\nPartial codes or station names cannot be looked "+
"up.");
alert("Please only enter:\n - A 3 character CRS code,\n - A 4-7 " +
"character TIPLOC code.\n\nPartial codes or station names cannot be looked "+
"up.");
}
// Lastly close the log group at the end of the Function and return.
console.groupEnd();
return 0;
}
/*This function provides the Lookup TIPLOC from CRS function from the menu*/
function tiplocFinder() {
console.group("Athena: function: tiplocFinder()");
let crs_to_find = document.getElementById("lookup-tiploc").value;
console.info("You are trying to lookup the TIPLOC for:" + crs_to_find.toUpperCase());
console.info("Checking if CRS code exists in look up data");
let hasKey = dataGlobal.hasOwnProperty(crs_to_find);
if (hasKey) { //If key exists then log and continue
console.info(crs_to_find.toUpperCase() + " does exist in lookup file");
} else { //If key does not exist then stop further processing
console.warn(crs_to_find.toUpperCase() + "does not exist in lookup file");
console.error(crs_to_find.toUpperCase() + " is an incorrect code or not supported.");
alert(crs_to_find.toUpperCase() + " is not a valid or supported CRS, " +
"please see the help section for more information");
console.groupEnd();
return 0;
}
let crs_obj = dataGlobal[crs_to_find];
let name = crs_obj['name'].toUpperCase();
let crs = crs_to_find.toUpperCase();
let stanme = crs_obj['stanme'].toUpperCase();
let stanox = crs_obj['stanox'];
let tiploc = crs_obj['tiploc'];
console.info("Found Data for " + crs +": Name: " + name + ", STANME: " + stanme +
", STANOX: " + stanox + ", TIPLOC: " + tiploc);
console.warn("Attempt writing to DOM, feature incomplete");
document.getElementById("resultCRS").innerHTML = "CRS: " + crs_to_find.toUpperCase();
document.getElementById("resultTIPLOC").innerHTML = "TIPLOC: " + tiploc.toUpperCase();
document.getElementById("resultSTANME").innerHTML = "STANME: " + stanme.toUpperCase();
document.getElementById("resultName").innerHTML = "Name: " + name.toUpperCase();
document.getElementById("resultSTANOX").innerHTML = "STANOX: " + stanox;
console.info("Writing to DOM Complete")
console.groupEnd();
}

125
styles/style.css Normal file
View File

@ -0,0 +1,125 @@
body {
background-color: #aac4ee;
color: #359aff;
font-family: sans-serif;
text-align: center;
padding-bottom: 60px; /*Footer height*/
}
.titleimg {
width: 80%;
padding-top: 50px;
padding-bottom: 50px;
max-width: 500px;
}
.lookup-box {
text-align: center;
border: black;
border-radius: 40px;
padding: 10px;
margin-bottom: 5px;
font-size: 18px;
text-transform: uppercase;
}
.lookup-button {
background-color: #3c78d8;
color: #f6f5f4;
border: none;
border-radius: 18px;
font-size: 16px;
font-weight: bold;
padding: 5px;
padding-left: 15px;
padding-right: 15px;
cursor: pointer;
}
a {
display: float;
background-color: #3c78d8;
color: #f6f5f4;
padding: 7px;
border-radius: 5px;
text-decoration: none;
margin-bottom: 10px;
line-height: 3;
}
.quicklink {
display: inline-block;
cursor: pointer;
background-color: #3c78d8;
border: none;
border-radius: 10px;
color: #f6f5f4;
padding: 7px;
margin-bottom: 10px;
font-size: 16px;
}
.menu {
display: none;
background-color: #3c78d8;
width: 100%;
position: fixed;
top: 0;
left: 0;
padding-top: 10px;
padding-bottom: 10px;
}
.menu-button {
position: absolute;
background-color: #aac4ee;
border: none;
right: 30px;
cursor: pointer;
}
.menuitem {
background-color: #2256aa;
color: #f6f5f4;
border: none;
border-radius: 18px;
font-size: 16px;
font-weight: bold;
padding: 3px;
padding-left: 8px;
padding-right: 8px;
cursor: pointer;
}
.menuitem:hover {
background-color: #112b55;
}
.popup-info {
display: none;
position: absolute;
margin: 0 auto;
left: 0;
right: 0;
top: 20px;
width: 80%;
background-color: rgba(41,106,163,0.9);
color: white;
border-radius: 50px;
padding: 30px;
}
.popup-close {
position: absolute;
right: 30px;
cursor: pointer;
}
footer {
background-color: #7fa7e6;
color: white;
width: 100%;
position: fixed;
bottom: 0;
left: 0;
}