This repository has been archived by the owner on Sep 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
267 lines (242 loc) · 8.22 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/ico" href="noah-favicon.ico" />
<link rel="stylesheet" href="css/reset.css" />
<link rel="stylesheet" href="css/style.css" />
<title>Contour Archive | Project NOAH</title>
<link rel="stylesheet" href="jquery-ui/jquery-ui.css" />
<script src="jquery-ui/jquery-1.11.2.min.js"></script>
<script src="jquery-ui/jquery-ui.js"></script>
<script type="text/javascript">
var chosenDate;
var monthtext = new Array();
monthtext[0] = "January";
monthtext[1] = "February";
monthtext[2] = "March";
monthtext[3] = "April";
monthtext[4] = "May";
monthtext[5] = "June";
monthtext[6] = "July";
monthtext[7] = "August";
monthtext[8] = "September";
monthtext[9] = "October";
monthtext[10] = "November";
monthtext[11] = "December";
$(function () {
$(".datepicker").datepicker({
dateFormat: "dd-mm-yy",
//dateFormat: "yy-mm-dd",
// minDate: new Date("Mon Dec 18 2014"),
// maxDate: new Date("Mon Dec 31 2014"),
});
$("#slider-range").slider({
range: true,
min: 0,
max: 500,
values: [75, 300],
slide: function (event, ui) {
$("#amount").val(ui.values[0] + " - " + ui.values[1]);
},
});
$("#amount").val(
$("#slider-range").slider("values", 0) +
" - " +
$("#slider-range").slider("values", 1)
);
});
function formatDate(date) {
var datearr = date.split("-");
var month = datearr[1];
var day = datearr[0];
var year = datearr[2];
chosenDate = new Date(year, month - 1, day);
return chosenDate;
}
function FormatNumberLength(num, length) {
var r = "" + num;
while (r.length < length) {
r = "0" + r;
}
return r;
}
function capitalize(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
function listFiles() {
var operationsHTML = XML.getFile("images").responseText;
var linkStart = 0;
var linkEnd = 0;
while (linkStart <= linkEnd) {
linkStart = operationsHTML.indexOf("<a", linkEnd);
if (linkStart > -1) {
linkEnd = operationsHTML.indexOf("</a>", linkStart) + 4;
if (linkEnd > -1) {
var hvs = operationsHTML.indexOf('href="', linkStart) + 6;
var hve = operationsHTML.indexOf('"', hvs) - 1;
var tnvs = operationsHTML.indexOf(">", linkStart) + 1;
var tnve = operationsHTML.indexOf("<", tnvs) - 1;
if (
operationsHTML.substring(hvs, hve) ==
operationsHTML.substring(tnvs, tnve)
) {
alert(operationsHTML.substring(tnvs, tnve));
operations[operationsHTML.substring(tnvs, tnve)] = null;
}
}
}
}
}
function updateImageByFilename(filename) {}
function updateDownloadLink(date) {
$(".downloadlink").remove();
var datearr = date.split("-");
var month = datearr[1];
var day = datearr[0];
var year = datearr[2];
var foldername = "latest_contours_" + year + "-" + month + "-" + day;
//show download link or archive file
$("#downloaddiv").append(
"<a title='" +
monthtext[month - 1] +
" " +
day +
", " +
year +
"' class='buttonlink downloadlink' href='archive/" +
foldername +
".tar.bz2'>Download Contours</a>"
);
}
function updateTimeDiv(type, date) {
//list all files in directory "yyyy-mm-dd"
$("#linksplaceholder").append("<h2 class='timeh2'>Time</h2>");
$("#linksplaceholder").append("<ul class='linklist'>");
for (i = 0; i < 24; i++) {
var tempfilename = FormatNumberLength(i, 2) + ":20";
$(".linklist").append(
"<li><a href='#' onclick=\"updateImage('" +
type +
"', '" +
date +
"', '" +
FormatNumberLength(i, 2) +
"-20-00')\">" +
tempfilename +
"</a></li>"
);
}
$("#linksplaceholder").append("</ul>");
}
function updateImage(type, date, time) {
$(".timeh2").remove();
$(".contourh1").remove();
$(".contourh3").remove();
$(".contourimage").remove();
$(".linklist").remove();
$(".errormessage").remove();
var errormessage = "";
if (type == "") {
errormessage =
errormessage + "*Please choose a Contour Type first.<br />";
}
if (date == "") {
errormessage = errormessage + "*Please choose a Date first.<br />";
}
if (errormessage != "") {
$("#errordiv").append(
"<p class='errormessage'>" + errormessage + "</p>"
);
return 1;
}
var datearr = date.split("-");
var month = datearr[1];
var day = datearr[0];
var year = datearr[2];
chosenDate = new Date(year, month - 1, day);
var typearr = type.split("_");
var timearr = time.split("-");
var foldername = "latest_contours_" + year + "-" + month + "-" + day;
var filename =
foldername + "/" + type + "_" + date + "_" + time + ".png";
//alert(filename);
// alert(type+"_"+date+"_"+FormatNumberLength(0,2)+"-20-00.png");
$("#imageplaceholder").append(
"<h1 class='contourh1'>" +
capitalize(typearr[0]) +
" " +
capitalize(typearr[1]) +
" " +
capitalize(typearr[2]) +
"</h1><h3 class='contourh3'>" +
monthtext[month - 1] +
" " +
day +
", " +
year +
" | " +
timearr[0] +
":" +
timearr[1] +
"</h3>"
);
$("#imageplaceholder").append(
"<img src='images/" + filename + "' class='contourimage' />"
);
updateTimeDiv(type, date);
}
</script>
</head>
<body>
<div id="sidemenu" class="float-left">
<h1>Project NOAH Contours</h1>
<form action="index.php" method="get">
<div id="inner-form">
<label for="contourtype">Contour Type: </label>
<select name="contourtype" id="contourtype">
<option></option>
<option value="air_temperature_contour">Temperature</option>
<option value="air_pressure_contour">Pressure</option>
<option value="air_humidity_contour">Humidity</option>
<option value="rain_value_contour">Rainfall</option>
<!--option value="3-ho">3-Hour Rainfall</option>
<option value="6-ho">6-Hour Rainfall</option>
<option value="12-h">12-Hour Rainfall</option>
<option value="24-h">24-Hour Rainfall</option--></select
><br />
<label for="date">Date: </label>
<input
readonly="true"
onchange="updateDownloadLink($(this).val())"
type="text"
name="date"
id="date"
class="datepicker"
/>
</div>
<!--label class="float-left" for="amount">Range:</label>
<div class="float-left" id="slider-range"></div>
<input class="float-left" type="text" id="amount" readonly style="border:0; font-weight:bold;">
<div class="clear-both"></div-->
</form>
<div id="downloaddiv">
<a
class="buttonlink"
id="loadbutton"
href="#"
onclick="updateImage($('#contourtype').val(), $('#date').val(), '00-20-00')"
>
Load
</a>
</div>
<div id="errordiv"></div>
</div>
<div id="content" class="float-left">
<div class="float-left" id="imageplaceholder"></div>
</div>
<div id="rightmenu" class="float-right">
<div class="float-left" id="linksplaceholder"></div>
</div>
</body>
</html>