forked from YiQuang/IWG_Leaflet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
191 lines (171 loc) · 6.69 KB
/
index.html
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!DOCTYPE html>
<html>
<head>
<title>Compare Maps Blind</title>
<link rel="stylesheet" href="css/indexStyle.css">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-07I2e+7D8p6he1SIM+1twR5TIrhUQn9+I6yjqD53JQjFiMf8EtC93ty0/5vJTZGF8aAocvHYNEDJajGdNx1IsQ=="
crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha512-A7vV8IFfih/D732iSSKi20u/ooOfj/AGehOKq0f4vLT1Zr2Y+RX7C+w8A1gaSasGtRUZpF/NZgzSAu4/Gc41Lg=="
crossorigin=""></script>
</head>
<body>
<div onmouseleave = "mouseOut()" onmouseenter = "mouseIn()" id="showMap"></div>
<audio id="borderAudio" src="sound/border.mp3"></audio>
<input onclick = "searches()" onfocusout="notSearching()" type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for names..">
<table id="myTable" class="clickable-row">
<tr class="header">
<th align="left" onclick="sortTable(0)" style="width:40%;">ID</th>
<th align="left" onclick="sortTable(1)" style="width:60%;">Name</th>
<th align="left" onclick="sortTable(2)" style="width:40%;">First Map</th>
<th align="left" onclick="sortTable(3)" style="width:40%;">Secound Map</th>
<th align="left" onclick="sortTable(4)" style="width:40%;">Difference</th>
</tr>
</table>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src='https://code.responsivevoice.org/responsivevoice.js'></script>
<script src="js/styleGeoJSON.js"></script>
<script src="js/us-states.js"></script>
<script src="sound/Pizzicato.js"></script>
<script src="sound/initiateSound.js"></script>
<script src="sound/initiate2Sounds.js"></script>
<script src="sound/soundComparisonfacade.js"></script>
<script src="js/setupComparisonGeoJson.js"></script>
<script src="sound/soundOnBorderCrossing.js"></script>
<script src="sound/soundNavigation.js"></script>
<script src="js/voiceOutput.js"></script>
<script src="js/pointInPolygin.js"></script>
<script src="js/mapInteraction.js"></script>
<script src="js/mapInteractionHandler.js"></script>
<script src="js/calculation.js"></script>
<script src="js/setupMap.js"></script>
<script> $(document).ready(function () {
var tr;
for (var i = 0; i < statesData.features.length; i++) {
var difference = statesData.features[i].properties.value-statesData.features[i].properties.bottomValue;
difference = Math.round(difference);
id= statesData.features[i].id;
tr = $('<tr/>');
tr.append("<td>" + id + "</td>");
tr.append("<td onclick = "+"test("+i+")"+">" + statesData.features[i].properties.name + "</td>");
tr.append("<td>" + statesData.features[i].properties.value + "</td>");
tr.append("<td>" + statesData.features[i].properties.bottomValue + "</td>");
tr.append("<td>" + difference + "</td>");
$('table').append(tr);
}
});
var test = function(i){
var valueStringOne = statesData.features[i].properties.value.toString();
var valueStringTwo = statesData.features[i].properties.bottomValue.toString();
var difference = (statesData.features[i].properties.bottomValue - statesData.features[i].properties.value).toString();
responsiveVoice.speak(statesData.features[i].properties.name);
console.log(statesData.features[i].properties.value);
responsiveVoice.speak(valueStringOne);
responsiveVoice.speak(valueStringTwo);
responsiveVoice.speak("The Difference is "+difference);
};
</script>
<script>
function myFunction() {
// Declare variables
var input, filter, table, tr, td, i;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
// Loop through all table rows, and hide those who don't match the search query
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[1];
if (td) {
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
jQuery(document).ready(function($) {
$(".clickable-row").click(function() {
//console.log(statesData.features);
});
});
function sortTable(n) {
var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;
table = document.getElementById("myTable");
switching = true;
//Set the sorting direction to ascending:
dir = "asc";
/*Make a loop that will continue until
no switching has been done:*/
while (switching) {
//start by saying: no switching is done:
switching = false;
rows = table.getElementsByTagName("TR");
/*Loop through all table rows (except the
first, which contains table headers):*/
for (i = 1; i < (rows.length - 1); i++) {
//start by saying there should be no switching:
shouldSwitch = false;
/*Get the two elements you want to compare,
one from current row and one from the next:*/
x = rows[i].getElementsByTagName("TD")[n];
y = rows[i + 1].getElementsByTagName("TD")[n];
/*check if the two rows should switch place,
based on the direction, asc or desc:*/
if (dir == "asc") {
if($.isNumeric(x.innerHTML)){
c= parseFloat(x.innerHTML);
v= parseFloat(y.innerHTML);
if(c>v){
//console.log(parseFloat(x.innerHTML));
shouldSwitch= true;
break;
}
}
x = x.toString();
y = y.toString();
if (x.toLowerCase() > y.toLowerCase()) {
//if so, mark as a switch and break the loop:
shouldSwitch= true;
break;
}
} else if (dir == "desc") {
if($.isNumeric(x.innerHTML)){
c= parseFloat(x.innerHTML);
v= parseFloat(y.innerHTML);
if(c<v){
shouldSwitch= true;
break;
}
}
x = x.toString();
y = y.toString();
if (x.toLowerCase() < y.toLowerCase()) {
//if so, mark as a switch and break the loop:
shouldSwitch= true;
break;
}
}
}
if (shouldSwitch) {
/*If a switch has been marked, make the switch
and mark that a switch has been done:*/
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
switching = true;
//Each time a switch is done, increase this count by 1:
switchcount ++;
} else {
/*If no switching has been done AND the direction is "asc",
set the direction to "desc" and run the while loop again.*/
if (switchcount == 0 && dir == "asc") {
dir = "desc";
switching = true;
}
}
}
}
</script>
</html>