diff --git a/assets/gwr-completion-map.pdf b/assets/gwr-completion-map.pdf new file mode 100644 index 0000000..8da1307 Binary files /dev/null and b/assets/gwr-completion-map.pdf differ diff --git a/assets/icons/close-circle.png b/assets/icons/close-circle.png new file mode 100644 index 0000000..42b54d1 Binary files /dev/null and b/assets/icons/close-circle.png differ diff --git a/assets/icons/favicon.ico b/assets/icons/favicon.ico new file mode 100644 index 0000000..2f7aec4 Binary files /dev/null and b/assets/icons/favicon.ico differ diff --git a/assets/icons/favicon.png b/assets/icons/favicon.png new file mode 100644 index 0000000..77b43e3 Binary files /dev/null and b/assets/icons/favicon.png differ diff --git a/assets/icons/googley-eye-bird-blue.svg b/assets/icons/googley-eye-bird-blue.svg new file mode 100644 index 0000000..91dfec4 --- /dev/null +++ b/assets/icons/googley-eye-bird-blue.svg @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + Blue googley-eyed bird + 2013-09-11T18:45:29 + A cute blue cartoon bird with big eyes. + https://openclipart.org/detail/183311/blue-googley-eyed-bird-by-anarres-183311 + + + anarres + + + + + bird + cartoon + + + + + + + + + + + diff --git a/assets/icons/icon-128.png b/assets/icons/icon-128.png new file mode 100644 index 0000000..4625f8e Binary files /dev/null and b/assets/icons/icon-128.png differ diff --git a/assets/icons/icon-1500.png b/assets/icons/icon-1500.png new file mode 100644 index 0000000..e7e6bce Binary files /dev/null and b/assets/icons/icon-1500.png differ diff --git a/assets/icons/icon-256.png b/assets/icons/icon-256.png new file mode 100644 index 0000000..a904588 Binary files /dev/null and b/assets/icons/icon-256.png differ diff --git a/assets/icons/icon-512.png b/assets/icons/icon-512.png new file mode 100644 index 0000000..c126c65 Binary files /dev/null and b/assets/icons/icon-512.png differ diff --git a/assets/icons/icon.xcf b/assets/icons/icon.xcf new file mode 100644 index 0000000..57d505a Binary files /dev/null and b/assets/icons/icon.xcf differ diff --git a/assets/icons/menu.png b/assets/icons/menu.png new file mode 100644 index 0000000..f75edb4 Binary files /dev/null and b/assets/icons/menu.png differ diff --git a/assets/tiger_codes.json b/assets/tiger_codes.json new file mode 100644 index 0000000..f33e6fb --- /dev/null +++ b/assets/tiger_codes.json @@ -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"} +} diff --git a/assets/title/title.webp b/assets/title/title.webp new file mode 100644 index 0000000..d3ed6bf Binary files /dev/null and b/assets/title/title.webp differ diff --git a/assets/title/title.xcf b/assets/title/title.xcf new file mode 100644 index 0000000..f0b6573 Binary files /dev/null and b/assets/title/title.xcf differ diff --git a/assets/title/title_355.jxl b/assets/title/title_355.jxl new file mode 100644 index 0000000..32a471f Binary files /dev/null and b/assets/title/title_355.jxl differ diff --git a/assets/title/title_355.png b/assets/title/title_355.png new file mode 100644 index 0000000..73ed4c9 Binary files /dev/null and b/assets/title/title_355.png differ diff --git a/assets/title/title_355.webp b/assets/title/title_355.webp new file mode 100644 index 0000000..d42f9a7 Binary files /dev/null and b/assets/title/title_355.webp differ diff --git a/assets/title/title_600.jxl b/assets/title/title_600.jxl new file mode 100644 index 0000000..f8f026f Binary files /dev/null and b/assets/title/title_600.jxl differ diff --git a/assets/title/title_600.png b/assets/title/title_600.png new file mode 100644 index 0000000..9fa0dff Binary files /dev/null and b/assets/title/title_600.png differ diff --git a/assets/title/title_600.webp b/assets/title/title_600.webp new file mode 100644 index 0000000..c8a3342 Binary files /dev/null and b/assets/title/title_600.webp differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..a20ee95 --- /dev/null +++ b/index.html @@ -0,0 +1,107 @@ + + + + Athena + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+
+ +

Quick Links

+ + + + + + + + + + +
+
+ +

This is an Alpha release and is under testing.

+

Some features may not work and some stations may not be available.

+ + + + + + + + + + + + diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..1e5166c --- /dev/null +++ b/manifest.json @@ -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" + } + ] +} diff --git a/scripts/nav.js b/scripts/nav.js new file mode 100644 index 0000000..e14626c --- /dev/null +++ b/scripts/nav.js @@ -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"; +} diff --git a/scripts/sw.js b/scripts/sw.js new file mode 100644 index 0000000..e69de29 diff --git a/scripts/tiploc-finder.js b/scripts/tiploc-finder.js new file mode 100644 index 0000000..20b601d --- /dev/null +++ b/scripts/tiploc-finder.js @@ -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(); +} diff --git a/styles/style.css b/styles/style.css new file mode 100644 index 0000000..196ef48 --- /dev/null +++ b/styles/style.css @@ -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; +}