Remove code lookup feature

This commit is contained in:
Fred Boniface 2022-09-17 21:39:42 +01:00
parent 93f3939428
commit 7c219235c0
2 changed files with 2 additions and 58 deletions

View File

@ -26,7 +26,6 @@
</div> </div>
<div id="menu" class="menu"> <div id="menu" class="menu">
<button class="menuitem" onclick="openAboutPopup(),closeMenu()">Help</button> <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> <img onclick="closeMenu()" class="popup-close" src="/assets/icons/close-circle.png"></img>
</div> </div>
@ -69,32 +68,12 @@
incorrect or unavailable on Tiger, you will be redirected to a incorrect or unavailable on Tiger, you will be redirected to a
blank board. CRS codes will be verified against a lookup file blank board. CRS codes will be verified against a lookup file
before redirecting.</p> 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 <p>Some stations are not on Tiger and these stations are not supported
here either. Notably TfW and Chiltern stations that border the GWR here either. Notably TfW and Chiltern stations that border the GWR
network. Most GWR Central served stations are now available to network. Most GWR Central served stations are now available to
lookup.</p> lookup.</p>
<p>Until there is a more modern public API offering access to Darwin, <p>I am working on a new version that will provide data for every
I have no interest in supporting any more than simply linking to station in the National Rail database.</p>
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> </div>
<!-- Footer --> <!-- Footer -->

View File

@ -88,38 +88,3 @@ function gotoInfoBoard(station) {
console.groupEnd(); console.groupEnd();
return 0; 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();
}