-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscripts.js
69 lines (67 loc) · 2.53 KB
/
scripts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
function copyIP() {
var copyText = document.getElementById("serverIP");
copyText.select();
copyText.setSelectionRange(0, 99999)
document.execCommand("copy");
document.getElementById('serverIPtooltip').innerHTML = "Copied!";
setTimeout(resetCopiedHoverText,2000);
console.log("User copied text: ")
console.log(copyText.value);
}
function resetCopiedHoverText(){
document.getElementById('serverIPtooltip').innerHTML = "Click to copy!";
}
/* ======================== Dropdown ======================== */
// function fromDropdown() {document.getElementById("fromDropdown").classList.toggle("show");}
// function fromBlur() {document.getElementById("fromDropdown").classList.toggle("show");}
//
// function toDropdown() {document.getElementById("toDropdown").classList.toggle("show");}
// function toBlur() {document.getElementById("toDropdown").classList.toggle("show");}
//
// function fromFilterFunction() {
// var input, filter, ul, li, a, i;
// input = document.getElementById("fromInput");
// filter = input.value.toUpperCase();
// div = document.getElementById("fromDropdown");
// a = div.getElementsByTagName("input").getAttribute("value");
// document.getElementById("demo").innerHTML = a;
// for (i = 0; i < a.length; i++) {
// txtValue = a[i].textContent || a[i].innerText;
// if (txtValue.toUpperCase().indexOf(filter) > -1) {
// a[i].style.display = "";
// } else {
// a[i].style.display = "none";
// }
// }
// }
//
// function toFilterFunction() {
// var input, filter, ul, li, a, i;
// input = document.getElementById("toInput");
// filter = input.value.toUpperCase();
// div = document.getElementById("toDropdown");
// a = div.getElementsByTagName("a");
// for (i = 0; i < a.length; i++) {
// txtValue = a[i].textContent || a[i].innerText;
// if (txtValue.toUpperCase().indexOf(filter) > -1) {
// a[i].style.display = "";
// } else {
// a[i].style.display = "none";
// }
// }
// }
// To/From train stations
function evalStation() {
var from, to;
from = document.getElementById("fromInput").value;
to = document.getElementById("toInput").value;
from1 = from.replace("","");
to1 = to.replace("","")
var farechart = JSON.parse(fares);
if (farechart[from1][to1] != null) {
document.getElementById("SearchResult").innerHTML = "Fare from " + from + " to " + to + " is £"+farechart[from1][to1];
} else {
// Error code
document.getElementById("SearchResult").innerHTML = "Sorry, but we could not find the stations specified. Please try again.";
}
}