-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
677 lines (649 loc) · 31.4 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
<!--WaterWand by FRC Team 1540: The Flaming Chickens-->
<!--suppress JSUnresolvedFunction -->
<html>
<head>
<title>WaterWand</title>
<!-- BootStrap, jQuery -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<!-- If jQuery isn't working, try uncommenting this code: <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> -->
<!-- If bootstrap isn't working, try uncommenting this code: <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> -->
<script class="maps_script" type="text/javascript"></script>
<!-- For the plot.ly graphs -->
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<!-- For the fuzzy search -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/3.3.0/fuse.min.js"></script>
<!-- For the google sheets api -->
<script src="https://apis.google.com/js/api.js"></script>
<!-- Locally stored API keys, passwords, etc. -->
<script class="secret_script" type="text/javascript" src="secret.js"></script>
<!-- Functions and such to aid/simplify the Google Sheets API -->
<script type="text/javascript" src="sheets.js"></script>
<!-- CSS -->
<link rel="stylesheet" href="style.css"></link>
<script>
const SPREADSHEET_ID = secret["spreadsheet_id"]; // ID for the specific spreadsheet we are using
const CLIENT_ID = secret["client_sheets_id"]; // Google sheets client ID
const MAPS_API_KEY = secret["maps_api_key"]; // Google maps API key
$(document).ready(function () {
$(".maps_script").attr("src", "//maps.googleapis.com/maps/api/js?key=" + MAPS_API_KEY);
});
let query = ""; // The query in the search bar
let chosen_loc = "Place"; // The current location that is selected
let hover_loc = "Place"; // The previous hovered location.
let focus = "Default"; // The current tab opened on a location page
/* Stores name, lat, and lng of all places with data */
let locations = [];
/* Stores all downloaded data */
let data = {};
/* Today's date */
let today = new Date().getTime();
/* Obtaining cached data */
const cache_date_string = localStorage["cache_date"];
const cache_data_string = localStorage["cache_data"];
const cache_locations_string = localStorage["cache_locations"];
let cache_date;
let cache_data;
let cache_locs;
if (cache_date_string !== undefined) { cache_date = parseInt(cache_date_string); }
if (cache_data_string !== undefined) { cache_data = JSON.parse(cache_data_string); }
if (cache_locations_string !== undefined) { cache_locs = JSON.parse(cache_locations_string); }
/* Descriptions of all of the water quality indicators */
const focus_descriptions = {
Overview: "",
pH: "pH (parts Hydrogen) measures the hydrogen ion concentration of aqueous solutions. The average ocean pH is around 8.1, whereas freshwater bodies generally have a pH of around 6-8. Deeper bodies of water may have a higher pH. For more information, visit this \n <a href='https://www.fondriest.com/environmental-measurements/parameters/water-quality/ph/' target='_blank'>link</a>.",
Turbidity: "Turbidity measures water clarity in nephelometric turbidity units (NTU). Clarity is determined by the depth that sunlight penetrates in water. For more information, visit this \n <a href='https://www.fondriest.com/environmental-measurements/parameters/water-quality/turbidity-total-suspended-solids-water-clarity/#Turbid2/' target='_blank'>link</a>.",
Salinity: "Salinity measures salt concentration in water, and is measured in practical salinity units (PSU). Higher salinity leads to higher conductivity in the water. For more information, visit this \n <a href='https://www.fondriest.com/environmental-measurements/parameters/water-quality/conductivity-salinity-tds/#cond6/' target='_blank'>link</a>.",
Temperature: "Water temperature measures average thermal energy in water, and is measured in degrees celsius. Higher temperatures generally lead to higher fish metabolism. For more information, visit this \n <a href='https://www.fondriest.com/environmental-measurements/parameters/water-quality/water-temperature/' target='_blank'>link</a>."
}
/* returns focus_descriptions */
function getFocusDescriptions() {
return focus_descriptions;
}
/* Passes relevant info to the iFrame */
// noinspection JSUnusedLocalSymbols
function passInformation() {
return {
"chosen_loc" : hover_loc,
"data" : data[hover_loc]
};
}
/* Rounding function */
function round(num, places) {
let multiplier = Math.pow(10, places);
return Math.round(num * multiplier) / multiplier;
}
/* Finds the distance between two points */
function distance(a1, b1, a2, b2) {
return Math.sqrt(Math.pow(a1 - a2, 2) + Math.pow(b1 - b2, 2))
}
/* Compares two data points by their date in milliseconds */
function compareByDate(a, b) {
return a["date"] - b["date"]
}
/* Compares two names */
function compareByName(a, b) {
if (a["name"] > b["name"]) { return 1; }
return -1;
}
/* Checks to see if cache is valid */
/* Returns true if the cache is valid, false if not */
function inspectCache() {
// checks to see if any of the cached data is undefined
if (cache_date === undefined || cache_data === undefined || cache_locs === undefined) {
delete localStorage["cache_date"];
delete localStorage["cache_data"];
delete localStorage["cache_locations"];
return false;
}
// 86400000 is the number of milliseconds in a day
if (today - cache_date >= 86400000) {
return false;
}
return true;
}
/* Sets scrolling settings */
/* "switch_page" is a boolean equal to true if you are switching pages, and false if you are just resizing a page */
function scrollSettings(switch_page) {
/* "main_page" is a boolean equal to true if you are on the home page, and false if you are on an indicator page */
let main_page = focus == "Default";
if (switch_page) { window.scrollTo(0, 0); }
if (!main_page && $(window).width() <= 992) {
$(".location-map").hide();
$(".indicator-left").attr("style", "");
} else if (!main_page) {
if (focus == "Overview") { $(".location-map").show(); }
$(".indicator-left").attr("style", "position:relative;left:18px;");
} else if (main_page && $(window).width() <= 575) {
$(".indicator-display-div").hide();
} else {
$(".indicator-display-div").show();
}
}
/* loadSection() sets the display when a new indicator tab is selected */
function loadSection(new_focus) {
if (focus == new_focus) {
return;
}
// makes sure that the indicator selected is not the previous indicator
focus = new_focus; // sets the new chosen indicator
$(".loc-page-title").text(new_focus); // changes the title of the page
loadDataTable(chosen_loc);
/* Sets the description of the indicator */
$(".wq-information").html(getFocusDescriptions()[focus]);
/* Removes all HTML from the div containing the plot.ly graph. */
$(".graph-container").html("");
if (focus != "Overview") {
loadGraph(chosen_loc);
$(".location-map").hide();
} else {
/* The following creates an embedded Google Map centered on the location */
url = "https://www.google.com/maps/embed/v1/view?key=" + MAPS_API_KEY + "¢er=" + data[chosen_loc][data[chosen_loc].length - 1]["latitude"] + "," + data[chosen_loc][data[chosen_loc].length - 1]["longitude"] + "&zoom=13&maptype=satellite";
$(".location-map").show();
$(".location-map").attr("src", url);
}
// changes the scrolling settings
scrollSettings(true);
}
/* this function loads the data for the data table on overview/indicator pages */
function loadDataTable(loc) {
$(".data-table").show();
$(".table-body").html("");
$(".table-explanation").hide();
$(".last-collected").hide();
// for non-overview tables...
if (focus != "Overview") {
$(".table-head").html(
`<tr>
<th scope="col">Date</th>
<th scope="col">Time</th>
<th class="loc-page-title" scope="col">` + focus + `</th>
<th scope="col">Latitude</th>
<th scope="col">Longitude</th>
<th style="width:10vw" scope="col">Notes</th>
</tr>`
);
// reversing the data
// I use .slice(0) to clone the list, so that I do not reverse the actual list
let reverse_data = data[loc].slice(0).reverse();
// for data_point (dp) in the reversed data
for (let dp in reverse_data) {
let data_point = reverse_data[dp];
let date_obj = new Date(data_point["date"]);
// the following converts Date.getHours() to 12 hour time
let time_of_day = "AM";
let hours = date_obj.getHours();
let minutes = date_obj.getMinutes().toString();
if (hours > 12) {
hours %= 12;
time_of_day = "PM";
} else if (hours == 0) {
hours = 12;
}
if (minutes < 10) {
minutes = "0" + minutes;
}
// converts date to a string-friendly format
let date = (date_obj.getMonth() + 1) + "/" + date_obj.getDate() + "/" + date_obj.getFullYear();
let time = (hours + ":" + minutes + " " + time_of_day);
$(".table-body").append(`
<tr id="data-table-` + dp + `">
<td>` + date + `</td>
<td>` + time + `</td>
<td>` + data_point[focus] + `</td>
<td>` + data_point["latitude"] + `</td>
<td>` + data_point["longitude"] + `</td>
<td>` + data_point["description"] + `</td>
</tr>
`)
}
// for the overview table...
} else {
$(".table-explanation").show();
$(".last-collected").show();
$(".table-head").html(
`<tr>
<th scope="col">Indicator</th>
<th scope="col">Units</th>
<th scope="col">Average Value</th>
<th scope="col">Latest Value</th>
<th scope="col">Trend</th>
</tr>`
);
/* "table_info" is the information that will be displayed into the overview table
increase: the sum total increase in value within the past five readings
avg_increase: the average increase in value within the past five readings
val: the sum total value of the past five readings
avg_val: the average value of the past five readings
total_vals: the number of readings in the past five readings (will be five unless there are less than five total readings)
*/
let table_info = {
pH: {increase: 0, avg_increase: 0, val: 0, avg_val: 0, total_vals: 0},
Turbidity: {increase: 0, avg_increase: 0, val: 0, avg_val: 0, total_vals: 0},
Salinity: {increase: 0, avg_increase: 0, val: 0, avg_val: 0, total_vals: 0},
Temperature: {increase: 0, avg_increase: 0, val: 0, avg_val: 0, total_vals: 0}
}
// a list of all indicators
let indicators = ["Turbidity", "pH", "Salinity", "Temperature"];
// a list of all indicators' respective units
let indicator_units = ["NTU", "--", "PSU", "°C"]
let num_data_points = data[loc].length;
for (let indicator_index in indicators) {
// "indicator" is a string (e.g. "pH")
let indicator = indicators[indicator_index];
// for each of the five most recente data points...
for (let x = num_data_points - 5; x < num_data_points; x += 1) {
if (x < 0) {
continue;
} // continue if x < 0 (i.e. there are less than five recent values)
// "data_point" represents one reading, or any particular row on the Google Sheet
let data_point = data[loc][x];
if (!isNaN(data_point[indicator])) { // if false, that implies this indicator was not measured in this instance
table_info[indicator]["val"] += data_point[indicator];
table_info[indicator]["total_vals"] += 1;
if (x > 0 && x != num_data_points - 5 && !isNaN(data[loc][x - 1][indicator])) { // if there is a valid data point taken before this data point
table_info[indicator]["increase"] += data_point[indicator] - data[loc][x - 1][indicator]; // calculates the increase in value
}
}
if (x == num_data_points - 1) {
let latest_point_date = new Date(data_point["date"]);
let display_date = (latest_point_date.getMonth() + 1) + "/" + latest_point_date.getDate() + "/" + latest_point_date.getFullYear();
$(".last-collected").text("Data last collected " + display_date + ".");
}
}
// calculates "avg_val" and "avg_increase"
table_info[indicator]["avg_val"] = 1.0 * table_info[indicator]["val"] / table_info[indicator]["total_vals"];
table_info[indicator]["avg_increase"] = 1.0 * table_info[indicator]["increase"] / table_info[indicator]["total_vals"];
// appends data to overview data table
$(".table-body").append(`
<tr>
<td>` + indicator + `</td>
<td>` + indicator_units[indicator_index] + `</td>
<td>` + round(table_info[indicator]["avg_val"], 3) + `
<td>` + round(data[loc][num_data_points - 1][indicator], 3) + `</td>
<td>` + round(table_info[indicator]["avg_increase"], 3) + `</td>
</tr>
`);
}
}
}
/* This functions loads all the data from Google Sheets */
function uploadValues() {
// "values" is an array of all location names
getValues('B2:B').then(values => {
if (values.length > 0) {
// "table_rows" is an array of arrays, each array representing a row on the spreadsheet
getValues('A2:J').then(table_rows => {
for (let array in table_rows) {
// "sheet_data" is one data point, or row
let sheet_data = table_rows[array];
if (data[sheet_data[1]] === undefined) { // true if this is a new location
data[sheet_data[1]] = []
locations.push(
{name: sheet_data[1], lat: sheet_data[3], lng: sheet_data[4]}
);
}
data[sheet_data[1]].push(
{
date: sheet_data[0],
name: sheet_data[1],
description: sheet_data[2],
latitude: sheet_data[3],
longitude: sheet_data[4],
accuracy: sheet_data[5],
Salinity: sheet_data[6],
Turbidity: sheet_data[7],
pH: sheet_data[8],
Temperature: sheet_data[9]
}
);
console.log(sheet_data);
}
/* The following sorts all data by date, newest to oldest */
let data_keys = Object.keys(data);
for (let loc in data_keys) {
data[data_keys[loc]].sort(compareByDate);
}
/* Locally stores data */
localStorage["cache_date"] = today.toString();
localStorage["cache_data"] = JSON.stringify(data);
localStorage["cache_locations"] = JSON.stringify(locations);
/* Updates the map and sorts locations */
query = ""
sortLocations();
});
}
});
}
/* */
function loadNewIndicatorDisplay() {
$(".indicator-display-div").html("");
$(".indicator-display-div").append(`
<iframe class="indicator-display" src="indicatorPage.html">
</iframe>
`);
}
/* Loads the plot.ly graph on an indicator page */
function loadGraph(loc) {
/* Sets the graph's default HTML */
$(".graph-container").append(`<div id="tester" style="width:100%;height:300px;position:relative;top:15px;"></div>`);
/* "dates" is a list of all the dates for a location */
/* "values" is a list of all the values of the given indicator for a location */
let dates = []
let values = []
/* runs through each data point (dp) in the data */
for (let dp in data[loc]) {
data_point = data[loc][dp];
if (data_point[focus] !== undefined) {
// pushes the relevant info into the lists
dates.push(new Date(data_point["date"]));
values.push(data_point[focus]);
}
}
// inputs data into plot.ly graph
TESTER = document.getElementById('tester');
Plotly.plot(TESTER, [{
x: dates,
y: values
}], {
margin: {t: 0}
});
}
/* sortLocations() sorts locations by fuzzy search */
function sortLocations() {
/* Erasing everything in the loc-options div */
$(".loc-table-body").html("");
$(".load-message").hide();
/* fuse.js fuzzy search */
let options = {
shouldSort: true,
threshold: 1.0,
location: 0,
distance: 100,
maxPatternLength: 32,
minMatchCharLength: 1,
keys: [
"name",
"lat",
"lng"
]
};
let fuse = new Fuse(locations, options);
// sorts all locations based on the query
let locations_by_query = fuse.search(query);
$(".sort-message").text("Sorted by closest match to query '" + query + "'.");
if (query == "") { // if the query is blank, we will just sort alphabetically
locations_by_query = locations.sort(compareByName);
$(".sort-message").text("Sorted alphabetically.");
}
/* If location not found, sorts by closeness of address. */
/* For each location (sorted by distance)... */
for (let x in locations_by_query) {
// "loc" is any location
let loc = locations_by_query[x];
// the text that will be displayed next to the button
let text = loc["name"];
// the following is the HTML for the row added to loc-options
$(".loc-table-body").append(`
<tr class="loc-table-row" name="` + loc["name"] + `" + style="height:8vh">
<td>
<button class="btn loc-select" lat="` + loc["lat"] + `" lng="` + loc["lng"] + `" name="` + loc["name"] + `">Select</button>
<span>` + text + `</span>
</td>
</tr>
`);
}
/* the EventListener for the buttons */
$(".loc-select").click(function () {
chosen_loc = $(this).attr("name"); // sets the chosen location to be this location
$(".loc-page").show(); // shows the page for the location
$(".home").hide(); // hides the home screen
$(".title").text(chosen_loc); // sets the title of the location page
loadSection("Overview"); // loads the Overview section
});
$(".loc-table-row").mouseover(function () {
if (hover_loc === $(this).attr("name")) { return; }
hover_loc = $(this).attr("name");
loadNewIndicatorDisplay();
});
// sets height of loc-options to fit screen well
// $(".loc-options").css("height",$(window).height()-130);
}
$(document).ready(function () {
$(".loc-page").hide(); // hides the location page
// when the back button is clicked...
$(".back").click(function () {
$(".home").show();
$(".loc-page").hide();
// resets the selected location and the selected indicator
chosen_loc = "Place";
focus = "Default";
// resets scroll position and settings
scrollSettings(true);
// resets the indicator button displays
$(".option").removeClass("selected-option");
$(".overview-btn").addClass("selected-option");
});
// when the reset cache button is pressed
$(".reset-cache").click(function() {
localStorage.clear();
location.reload();
});
// when an indicator-option button is clicked...
$(".option").click(function () {
// resets all indicator button displays, and then sets display for this button
$(".option").removeClass("selected-option");
$(this).addClass("selected-option");
// loads the correct section
loadSection($(this).attr("name"));
});
// exports sheets to excel
$(".excel-export").click(function () {
JSONToCSVConvertor(data[chosen_loc], chosen_loc, true);
});
// exports all data to excel
$(".excel-export-all").click(function () {
allDataToCSV("All Data");
});
// whenever we have the search box selected and we press a key
$('#search-box').keypress(function (e) {
// if the key is "enter"
if (e.keyCode == 13) {
// submit the query
$('.search-submit').click();
}
});
// submit button for searching
$(".search-submit").click(function () {
query = $("#search-box").val();
sortLocations();
});
/* Loads new data from cache or from google sheets */
if (!inspectCache()) {
// uploads all data from Google Sheets
window.setTimeout(uploadValues, 250);
} else {
data = cache_data;
locations = cache_locs;
sortLocations();
// window.setTimeout(sortL, 10);
}
});
// On resize
$(window).resize(function () {
// reloads the graph so that its size fits the screen
if (focus != "Overview" && focus != "Default") {
$(".graph-container").html("");
loadGraph(chosen_loc);
}
// Resets height of loc-options
scrollSettings(false);
});
// reads all data from the Google Sheet, turns it into a JSON, and then dumps everything into the JSONtoCSVConverter
function allDataToCSV(ReportTitle) {
getValues('A1:J').then(values => {
if (values.length > 0) {
JSONToCSVConvertor(values, ReportTitle, false);
}
});
}
// from https://stackoverflow.com/questions/29230518/how-to-export-json-data-to-excel-file-using-javascript
// converts a JSON file to an excel sheet and downloads it
function JSONToCSVConvertor(JSONData, ReportTitle, ShowLabel) {
//If JSONData is not an object then JSON.parse will parse the JSON string in an Object
let arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData;
let CSV = '';
//This condition will generate the Label/Header
let row = "";
if (ShowLabel) {
//This loop will extract the label from 1st index of on array
for (let index in arrData[0]) {
//Now convert each value to string and comma-seprated
row += index.charAt(0).toUpperCase() + index.slice(1) + ',';
}
row = row.slice(0, -1);
CSV += row + '\r\n';
}
//append Label row with line break
//1st loop is to extract each row
for (let i = 0; i < arrData.length; i++) {
let row = "";
//2nd loop will extract each column and convert it in string comma-separated
for (let index in arrData[i]) {
row += '"' + arrData[i][index] + '",';
}
row.slice(0, row.length - 1);
//add a line break after each row
CSV += row + '\r\n';
}
if (CSV == '') {
alert("Invalid data");
return;
}
//Generate a file name
let fileName = "Water_Quality_";
//this will remove the blank-spaces from the title and replace it with an underscore
fileName += ReportTitle.replace(/ /g, "_");
//Initialize file format you want csv or xls
let uri = 'data:text/csv;charset=utf-8,' + escape(CSV);
// Now the little tricky part.
// you can use either>> window.open(uri);
// but this will not work in some browsers
// or you will not get the correct file extension
// this trick will generate a temp <a /> tag
let link = document.createElement("a");
link.href = uri;
//set the visibility hidden so it will not effect on your web-layout
link.style = "visibility:hidden";
link.download = fileName + ".csv";
//this part will append the anchor tag and remove it after automatic click
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
</script>
</head>
<body class="main-body">
<!-- Home Page -->
<div class="home">
<!-- Banner at Top of Home Page -->
<div class="upper-banner">
<!-- Update Data Button -->
<button class="btn btn-dark reset-cache">Update Data</button>
<!-- Export to Excel Button -->
<button class="btn excel-style excel-export-all">Export to Excel</button>
<div style="height:50px;" class="transparent-layer">
<!--<h1 class="banner-title">WaterWand</h1>-->
<img style="height:50px" src="waterwand.png" />
</div>
</div>
<!-- The Rest of Home Page -->
<div class="home-container">
<div style="margin:auto;position:relative;left:3.75vw;" class="row">
<!-- Search Options -->
<input id="search-box" type="text" placeholder="Enter name or address"/>
<button style="position:relative;top:5px;width:15vw;" class="btn coordinates">Submit</button>
<br/>
<br />
</div>
<div class="row">
<!--<div class="col-sm-1"></div>-->
<!-- Location Options -->
<div style="font-family:oxygen" class="loc-options">
<p class="load-message" style="text-align:center">Loading data...</p>
<table style="font-family: Lato" class="table loc-table table-striped table-bordered">
<thead class="thead-dark">
<tr>
<th class="sort-message"></th>
</tr>
</thead>
<tbody class="loc-table-body">
</tbody>
</table>
</div>
<!-- Indicator Display -->
<div class="indicator-display-div">
</div>
</div>
</div>
</div>
<!-- Location Page -->
<div style="text-align:center" class="loc-page">
<!-- Banner at Top of Location Page -->
<div class="upper-banner">
<button class="btn btn-dark back">Back</button>
<button class="btn excel-style excel-export">Export to Excel</button>
<div class="transparent-layer">
<br/>
<h1 class="title banner-title">Place</h1>
<!-- Indicator Options -->
<div class="btn-group mr-2" role="group" aria-label="First group">
<button type="button" name="Overview" class="btn option selected-option overview-btn">Overview</button>
<button type="button" name="Turbidity" class="btn option">Turbidity</button>
<button type="button" name="pH" class="btn option">pH</button>
<button type="button" name="Salinity" class="btn option">Salinity</button>
<button type="button" name="Temperature" class="btn option">Temperature</button>
</div>
</div>
</div>
<!-- The Rest of Location Page -->
<div class="row loc-page-main">
<!-- Left Column -->
<div style="position:relative;left:18px;" class="indicator-left col-lg-6">
<br>
<h1 class="loc-page-title">Overview</h1>
<!-- "Last Collection" Text -->
<h6 class="last-collected">Data last collected a long time ago.</h6>
<!-- Data Table -->
<div class="table-div">
<table class="table table-hover data-table">
<thead class="table-head">
</thead>
<tbody class="table-body">
</tbody>
</table>
</div>
<!-- Table Explanation -->
<span style="font-size:12px;" class="table-explanation">Average Value averages the last five results. Trend shows the average increase/decrease through the last five results.</span>
<br/>
</div>
<!-- Right Column -->
<div style="text-align:left" class="col-lg-6">
<!-- Plot.ly Graph -->
<div class="graph-container"></div>
<!-- Map Embed -->
<iframe style="position:relative;left:23%;top:10px;" class="location-map" width="400" height="350"
frameborder="0" style="border:0" allowfullscreen="">
</iframe>
<!-- Water Quality Information -->
<p style="z-index:20;position:absolute;margin-left:1%;margin-right:5%;" class="wq-information"></p>
</div>
</div>
</div>
<link rel="stylesheet" href="style.css"></link>
</body>
</html>