-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIndex.html
737 lines (672 loc) · 33.1 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
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
<!DOCTYPE html>
<html>
<head>
<title>WeeWX Weather34 Pre-install Web Services Settings Page</title>
<style>
* {
box-sizing: border-box;
font: 18px Arial;
padding: 5px;
}
div {
padding: 2px;
background-color: lightblue;
overflow: hidden;
}
input[type=text], textarea, select {
font: 12px Arial;
width: 100%;
padding: 6px;
border: 2px solid #ccc;
border-radius: 4px;
}
input[type=select]{
font: 12px Arial;
width: 100%;
cursor: pointer;
padding: 6px;
border: 2px solid #ccc;
border-radius: 4px;
}
input[type=button]{
font: 12px Arial;
width: auto;
float: left;
cursor: pointer;
padding: 6px;
}
input[type=submit] {
background-color: #4CAF50;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
float: left;
width: 100%;
}
label[for=text]{
font: 12px Arial;
text-align: right;
width: 100%;
float: left;
cursor: pointer;
padding: 6px;
}
.container {
border-radius: 5px;
border: 2px solid rgba(86,95,103,1);
background-color: grey;
padding: 5px;
}
.col-25 {
float: left;
width: 25%;
margin-top: 6px;
}
.col-75 {
float: left;
width: 75%;
margin-top: 6px;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
/* Responsive layout - when the screen is less than 600px wide, make the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
.col-25, .col-75, input[type=submit] {
width: 100%;
margin-top: 0;
}
</style>
</head>
<body>
<h2>WeeWX Weather 34</h2>
<p>Pre-install settings page for Web Services. After completing the form click the download bar. This will automatically save a file settings.txt to your default Download folder. No data is retained on this server after the process is complete.</p>
<div class="container">
<div class="row">
<div class="col-25">
<label for="text">Latitude</label>
</div>
<div class="col-75">
<input type="text" id="txtLat" placeholder="Enter your Latitude">
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Longitude</label>
</div>
<div class="col-75">
<input type="text" id="txtLon" placeholder="Enter your Longitude">
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Language</label>
</div>
<div class="col-75">
<input type="text" id="txtLang" placeholder="Enter your Language">
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">AQI Key</label>
</div>
<div class="col-75">
<input type="text" id="txtAqkey" placeholder="Enter your AQI Key" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">DarkSky Key</label>
</div>
<div class="col-75">
<input type="text" id="txtDskey" placeholder="Enter your DarkSky Key" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">DarkSky Units</label>
</div>
<div class="col-75">
<select id="selDsunits">
<option selected value="">-- Choose the units --</option>
<option value="us">US</option>
<option value="si">SI Metric</option>
<option value="ca">Canada</option>
<option value="uk2">UK (Metric with mph and miles)</option>
<option value="auto">auto</option>
</select>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Weather Underground Key</label>
</div>
<div class="col-75">
<input type="text" id="txtWukey" placeholder="Enter your Weather Underground Key" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Weather Underground Units</label>
</div>
<div class="col-75">
<select id="selWuunits">
<option selected value="">-- Choose the units --</option>
<option value="e">Imperial</option>
<option value="m">Metric</option>
<option value="s">Scandinavia</option>
<option value="h">United Kingdom</option>
</select>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">METAR Key</label>
</div>
<div class="col-75">
<input type="text" id="txtMekey" placeholder="Enter your METAR Key" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">METAR Code</label>
</div>
<div class="col-75">
<input type="text" id="txtMecode" placeholder="Enter your METAR Code" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">PurpleAir ID</label>
</div>
<div class="col-75">
<input type="text" id="txtPuid" placeholder="Enter your PurpleAir ID" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Local Web Server IP Address</label>
</div>
<div class="col-75">
<input type="text" id="txtAlip" placeholder="Enter Local Web Server IP Address" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Meteoalarm Country</label>
</div>
<div class="col-75">
<input type="text" id="txtAlcountry" placeholder="Enter your Meteoalarm Country (European users only)" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Meteoalarm Region</label>
</div>
<div class="col-75">
<input type="text" id="txtAlregion" placeholder="Enter your Meteoalarm Region (European users only)" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Active Web Services Code String</label>
</div>
<div class="col-75">
<input type="text" id="txtServices" placeholder="Enter your Active Web Services Code String (Minimum requirement me.wu.eq.ki)" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Enable Cloud Cover</label>
</div>
<div class="col-75">
<select id="selCloud">
<option selected value="">-- Choose True or False --</option>
<option value="True">True</option>
<option value="False">False</option>
</select>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Land Mass</label>
</div>
<div class="col-75">
<select id="selContinent">
<option selected value="">-- Choose Land Mass --</option>
<option value="eu">Europe</option>
<option value="af">Africa, Middle East</option>
<option value="ana">North America</option>
<option value="ama">Central America</option>
<option value="asa">South America</option>
<option value="seasia">South East Asia</option>
<option value="oce">Oceania</option>
</select>
</div>
</div>
<div>
<input type="submit" id="bt" value="Download services.txt" onclick="saveFile()" />
</div>
</div>
</body>
<script>
let saveFile = () => {
// Get the data from each element on the form.
const lat = document.getElementById('txtLat');
const lon = document.getElementById('txtLon');
const lang = document.getElementById('txtLang');
const continent = document.getElementById('selContinent');
const aq_apikey = document.getElementById('txtAqkey');
const ds_apikey = document.getElementById('txtDskey');
const ds_units = document.getElementById('selDsunits');
const wu_apikey = document.getElementById('txtWukey');
const wu_units = document.getElementById('selWuunits');
const me_apikey = document.getElementById('txtMekey');
const me_code = document.getElementById('txtMecode');
const pu_id = document.getElementById('txtPuid');
const al_ip = document.getElementById('txtAlip');
const al_country = document.getElementById('txtAlcountry');
const al_region = document.getElementById('txtAlregion');
const services = document.getElementById('txtServices');
const enable = document.getElementById('selCloud');
// This variable stores all the data.
let data =
'\r {' + ' \r\n ' +
'"##'+'Start of user fields' +'",'+ ' \r\n ' +
'"' + 'lat'+'"' + ':' +"'" + lat.value +"',"+ ' \r\n ' +
'"' + 'lon'+'"' + ':' +"'" +lon.value +"'," + ' \r\n ' +
'"' + 'lang'+'"' + ':' +"'" + lang.value +"'," + ' \r\n ' +
'"' + 'continent'+'"' + ':' +"'" + continent.value +"'," + ' \r\n ' +
'"' + 'aq_apikey'+'"' + ':' +"'" + aq_apikey.value +"'," + ' \r\n ' +
'"' + 'ds_apikey'+'"' + ':' +"'" + ds_apikey.value +"'," + ' \r\n ' +
'"' + 'ds_units'+'"' + ':' +"'" + ds_units.value +"'," + ' \r\n ' +
'"' + 'wu_apikey'+'"' + ':' +"'" + wu_apikey.value +"'," + ' \r\n ' +
'"' + 'wu_units'+'"' + ':' +"'" + wu_units.value +"'," + ' \r\n ' +
'"' + 'me_apikey'+'"' + ':' +"'" + me_apikey.value +"'," + ' \r\n ' +
'"' + 'me_code'+'"' + ':' +"'" + me_code.value +"'," + ' \r\n ' +
'"' + 'pu_id'+'"' + ':' +"'" + pu_id.value +"'," + ' \r\n ' +
'"' + 'al_ip'+'"' + ':' +"'" + al_ip.value +"'," + ' \r\n ' +
'"' + 'al_country'+'"' + ':' +"'" + al_country.value +"'," + ' \r\n ' +
'"' + 'al_region'+'"' + ':' +"'" + al_region.value +"'," + ' \r\n ' +
'"##'+'List of all user fields above to be replaced in strings below' +'",'+ ' \r\n ' +
'"sub_fields"'+':'+"'lat,lon,lang,continent,aq_apikey,ds_apikey,ds_units,wu_apikey,wu_units,me_apikey,me_code,pu_id,al_ip,al_country,al_region'," + ' \r\n ' +
'"config_entries3"'+':'+"'''="+ ' \r\n ' +
"'Weather34WebServices' "+':'+ ' \r\n ' +
'"# Air quality, your own latitude, longitude, token and interval in seconds are required\\n"' + ' \r\n ' +
'"# Dark Sky, your own latitude, longitude, API key, language, units and interval in seconds required\\n"' + ' \r\n ' +
'"# DarkSky Units key us = US Units, ca = METRIC Units, si = METRICWX Units, uk2 = UK(metric with mph) Units\\n"' + ' \r\n ' +
'"# Example https://api.forecast.io/forecast/yourtokenhere/51.94,-0.987?lang=en&units=uk2\\n"' + ' \r\n ' +
'"# Weather Underground, your own latitude, longitude, API key, language, units and interval in seconds required\\n"' + ' \r\n ' +
'"# Weather Underground Units key e = US, m = METRIC, s = SI(with m/s Scandinavia), h = UK(with mph)\\n"' + ' \r\n ' +
'"# Example https://api.weather.com/v3/wx/forecast/daily/5day?geocode=51.94,-0.987&language=en&format=json&units=h&apiKey=yourapikeyhere\\n"' + ' \r\n ' +
'"# Earthquake reports interval in seconds required\\n"' + ' \r\n ' +
'"# K-Index reports interval in seconds required\\n"' + ' \r\n ' +
'"# Metar reports airport code, API Key and interval in seconds required\\n"' + ' \r\n ' +
'"# Example https://api.checkwx.com/metar/EGTK/decoded\\n"' + ' \r\n ' +
'"# Example X-API-Key:yourapikeyhere\\n"' + ' \r\n ' +
'"# Purpleair reports device ID and interval in seconds required\\n"' + ' \r\n ' +
'"# Example https://www.purpleair.com/json?show=38365\\n"' + ' \r\n ' +
'"# Meteoalrm European weather warnings country code, region code and interval in seconds required\\n"' + ' \r\n ' +
'"# Example http://192.168.1.232/weewx/weather34/eualert.php?country=UK®ion=013\\n"' + ' \r\n ' +
'"# Select the services you require by creating a string of the services above\\n"' + ' \r\n ' +
'"# Example services = ds.me.eq.ki.wu.aq.al.ah.ao.aa.pu\\n"' + ' \r\n ' +
'"# Select your prefered time interval in seconds for each service\\n"' + ' \r\n ' +
'{' + ' \r\n ' +
" 'aq_url':'https://api.waqi.info/feed/geo:"+lat.value+';'+lon.value+'/?token='+aq_apikey.value+"'"+','+ ' \r\n ' +
" 'aq_interval':'3600'"+','+ ' \r\n ' +
" 'aq_filename':'/var/www/html/weewx/weather34/jsondata/aqi.txt'"+','+ ' \r\n ' +
" 'ds_url':'https://api.forecast.io/forecast/"+ds_apikey.value+'/'+lat.value+','+lon.value+'?lang='+lang.value+'&units'+'='+ds_units.value+"'"+','+ ' \r\n ' +
" 'ds_interval':'3600'"+','+ ' \r\n ' +
" 'ds_filename':'/var/www/html/weewx/weather34/jsondata/darksky.txt'"+','+ ' \r\n ' +
" 'wu_url':'https://api.weather.com/v3/wx/forecast/daily/5day?geocode="+lat.value+','+lon.value+'&language='+lang.value+'&format=json&units='+wu_units.value+'&apiKey='+wu_apikey.value+"'"+','+ ' \r\n ' +
" 'wu_interval':'3600'"+','+ ' \r\n ' +
" 'wu_filename':'/var/www/html/weewx/weather34/jsondata/wuforecast.txt'"+','+ ' \r\n ' +
" 'eq_url':'https://earthquake-report.com/feeds/recent-eq?json'"+','+ ' \r\n ' +
" 'eq_interval':'3600'"+','+ ' \r\n ' +
" 'eq_filename':'/var/www/html/weewx/weather34/jsondata/eqnotification.txt'"+','+ ' \r\n ' +
" 'ki_url':'https://services.swpc.noaa.gov/products/geospace/planetary-k-index-dst.json'"+','+ ' \r\n ' +
" 'ki_interval':'43200'"+','+ ' \r\n ' +
" 'ki_filename':'/var/www/html/weewx/weather34/jsondata/kindex.txt'"+','+ ' \r\n ' +
" 'me_url':'https://api.checkwx.com/metar/"+me_code.value+'/decoded'+"',"+ ' \r\n ' +
" 'me_header':'X-API-Key:"+me_apikey.value+"'"+','+ ' \r\n ' +
" 'me_interval':'3600'"+','+ ' \r\n ' +
" 'me_filename':'/var/www/html/weewx/weather34/jsondata/metar34.txt'"+','+ ' \r\n ' +
" 'pu_url':'https://www.purpleair.com/json?show="+pu_id.value+"'"+','+ ' \r\n ' +
" 'pu_interval':'3600'"+','+ ' \r\n ' +
" 'pu_filename':'/var/www/html/weewx/weather34/jsondata/purpleair.txt'"+','+ ' \r\n ' +
" 'al_url':'http://"+al_ip.value+'/weewx/weather34/eualert.php?country='+al_country.value+'®ion='+al_region.value+"'"+','+ ' \r\n ' +
" 'al_interval':'3600'"+','+ ' \r\n ' +
" 'al_filename':'/var/www/html/weewx/weather34/jsondata/meteoalarm.txt'"+','+ ' \r\n ' +
" 'services':'"+services.value+"'"+ ' \r\n ' +
" }'''"+','+ ' \r\n ' +
'"config_entries4"'+":'''="+ ' \r\n ' +
"'Weather34CloudCover' :"+ ' \r\n ' +
'"# Apply your own latitude and longitude and continent to the URLs in this section\\n"' + ' \r\n ' +
'{' + ' \r\n ' +
" 'enable':'"+enable.value+"'"+','+ ' \r\n ' +
" 'db_field':'signal8'"+','+ ' \r\n ' +
" 'cc_interval':'300'"+','+ ' \r\n ' +
" 'cc1_url':'https://api.sat24.com/crop?type=visual5hdcomplete&lat="+lat.value+'&lon='+lon.value+'&width=300&height=300&zoom=1.00&continent='+continent.value+"'"+','+ ' \r\n ' +
" 'cc1_filename':'/tmp/sat1.png'"+','+ ' \r\n ' +
" 'cc2_url':'https://api.sat24.com/crop?type=infraPolair&lat="+lat.value+'&lon='+lon.value+'&width=300&height=300&zoom=1.00&continent='+continent.value+"'"+','+ ' \r\n ' +
" 'cc2_filename':'/tmp/sat2.png'"+','+ ' \r\n ' +
" }'''"+','+ ' \r\n ' +
'}'
// Convert the text to BLOB.
const textToBLOB = new Blob([data], { type: 'text/plain' });
const sFileName = 'services.txt'; // The file to save the data.
let newLink = document.createElement("a");
newLink.download = sFileName;
if (window.webkitURL != null) {
newLink.href = window.webkitURL.createObjectURL(textToBLOB);
}
else {
newLink.href = window.URL.createObjectURL(textToBLOB);
newLink.style.display = "none";
document.body.appendChild(newLink);
}
newLink.click();
}
</script>
</html>
<!DOCTYPE html>
<html>
<head>
<title>WeeWX Weather34 Pre-install Web Services Settings Page</title>
</head>
<body>
<h2>WeeWX Weather 34</h2>
<p>Pre-install settings page for Web Services. After completing the form click the download bar. This will automatically save a file settings.txt to your default Download folder. No data is retained on this server after the process is complete.</p>
<div class="container">
<div class="row">
<div class="col-25">
<label for="text">Latitude</label>
</div>
<div class="col-75">
<input type="text" id="txtLat" placeholder="Enter your Latitude">
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Longitude</label>
</div>
<div class="col-75">
<input type="text" id="txtLon" placeholder="Enter your Longitude">
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Language</label>
</div>
<div class="col-75">
<input type="text" id="txtLang" placeholder="Enter your Language">
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">AQI Key</label>
</div>
<div class="col-75">
<input type="text" id="txtAqkey" placeholder="Enter your AQI Key" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">DarkSky Key</label>
</div>
<div class="col-75">
<input type="text" id="txtDskey" placeholder="Enter your DarkSky Key" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">DarkSky Units</label>
</div>
<div class="col-75">
<select id="selDsunits">
<option selected value="">-- Choose the units --</option>
<option value="us">US</option>
<option value="si">SI Metric</option>
<option value="ca">Canada</option>
<option value="uk2">UK (Metric with mph and miles)</option>
<option value="auto">auto</option>
</select>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Weather Underground Key</label>
</div>
<div class="col-75">
<input type="text" id="txtWukey" placeholder="Enter your Weather Underground Key" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Weather Underground Units</label>
</div>
<div class="col-75">
<select id="selWuunits">
<option selected value="">-- Choose the units --</option>
<option value="e">Imperial</option>
<option value="m">Metric</option>
<option value="s">Scandinavia</option>
<option value="h">United Kingdom</option>
</select>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">METAR Key</label>
</div>
<div class="col-75">
<input type="text" id="txtMekey" placeholder="Enter your METAR Key" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">METAR Code</label>
</div>
<div class="col-75">
<input type="text" id="txtMecode" placeholder="Enter your METAR Code" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">PurpleAir ID</label>
</div>
<div class="col-75">
<input type="text" id="txtPuid" placeholder="Enter your PurpleAir ID" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Local Web Server IP Address</label>
</div>
<div class="col-75">
<input type="text" id="txtAlip" placeholder="Enter Local Web Server IP Address" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Meteoalarm Country</label>
</div>
<div class="col-75">
<input type="text" id="txtAlcountry" placeholder="Enter your Meteoalarm Country (European users only)" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Meteoalarm Region</label>
</div>
<div class="col-75">
<input type="text" id="txtAlregion" placeholder="Enter your Meteoalarm Region (European users only)" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Active Web Services Code String</label>
</div>
<div class="col-75">
<input type="text" id="txtServices" placeholder="Enter your Active Web Services Code String (Minimum requirement me.wu.eq.ki)" />
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Enable Cloud Cover</label>
</div>
<div class="col-75">
<select id="selCloud">
<option selected value="">-- Choose True or False --</option>
<option value="True">True</option>
<option value="False">False</option>
</select>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="text">Land Mass</label>
</div>
<div class="col-75">
<select id="selContinent">
<option selected value="">-- Choose Land Mass --</option>
<option value="eu">Europe</option>
<option value="af">Africa, Middle East</option>
<option value="ana">North America</option>
<option value="ama">Central America</option>
<option value="asa">South America</option>
<option value="seasia">South East Asia</option>
<option value="oce">Oceania</option>
</select>
</div>
</div>
<div>
<input type="submit" id="bt" value="Download settings1.php" onclick="saveFile()" />
</div>
</div>
</body>
<script>
let saveFile = () => {
// Get the data from each element on the form.
const lat = document.getElementById('txtLat');
const lon = document.getElementById('txtLon');
const lang = document.getElementById('txtLang');
const continent = document.getElementById('selContinent');
const aq_apikey = document.getElementById('txtAqkey');
const ds_apikey = document.getElementById('txtDskey');
const ds_units = document.getElementById('selDsunits');
const wu_apikey = document.getElementById('txtWukey');
const wu_units = document.getElementById('selWuunits');
const me_apikey = document.getElementById('txtMekey');
const me_code = document.getElementById('txtMecode');
const pu_id = document.getElementById('txtPuid');
const al_ip = document.getElementById('txtAlip');
const al_country = document.getElementById('txtAlcountry');
const al_region = document.getElementById('txtAlregion');
const services = document.getElementById('txtServices');
const enable = document.getElementById('selCloud');
// This variable stores all the data.
let data =
'\r {' + ' \r\n ' +
'"##'+'Start of user fields' +'",'+ ' \r\n ' +
'"' + 'lat'+'"' + ':' +"'" + lat.value +"',"+ ' \r\n ' +
'"' + 'lon'+'"' + ':' +"'" +lon.value +"'," + ' \r\n ' +
'"' + 'lang'+'"' + ':' +"'" + lang.value +"'," + ' \r\n ' +
'"' + 'continent'+'"' + ':' +"'" + continent.value +"'," + ' \r\n ' +
'"' + 'aq_apikey'+'"' + ':' +"'" + aq_apikey.value +"'," + ' \r\n ' +
'"' + 'ds_apikey'+'"' + ':' +"'" + ds_apikey.value +"'," + ' \r\n ' +
'"' + 'ds_units'+'"' + ':' +"'" + ds_units.value +"'," + ' \r\n ' +
'"' + 'wu_apikey'+'"' + ':' +"'" + wu_apikey.value +"'," + ' \r\n ' +
'"' + 'wu_units'+'"' + ':' +"'" + wu_units.value +"'," + ' \r\n ' +
'"' + 'me_apikey'+'"' + ':' +"'" + me_apikey.value +"'," + ' \r\n ' +
'"' + 'me_code'+'"' + ':' +"'" + me_code.value +"'," + ' \r\n ' +
'"' + 'pu_id'+'"' + ':' +"'" + pu_id.value +"'," + ' \r\n ' +
'"' + 'al_ip'+'"' + ':' +"'" + al_ip.value +"'," + ' \r\n ' +
'"' + 'al_country'+'"' + ':' +"'" + al_country.value +"'," + ' \r\n ' +
'"' + 'al_region'+'"' + ':' +"'" + al_region.value +"'," + ' \r\n ' +
'"##'+'List of all user fields above to be replaced in strings below' +'",'+ ' \r\n ' +
'"sub_fields"'+':'+"'lat,lon,lang,continent,aq_apikey,ds_apikey,ds_units,wu_apikey,wu_units,me_apikey,me_code,pu_id,al_ip,al_country,al_region'," + ' \r\n ' +
'"config_entries3"'+':'+"'''="+ ' \r\n ' +
"'Weather34WebServices' "+':'+ ' \r\n ' +
'"# Air quality, your own latitude, longitude, token and interval in seconds are required\\n"' + ' \r\n ' +
'"# Dark Sky, your own latitude, longitude, API key, language, units and interval in seconds required\\n"' + ' \r\n ' +
'"# DarkSky Units key us = US Units, ca = METRIC Units, si = METRICWX Units, uk2 = UK(metric with mph) Units\\n"' + ' \r\n ' +
'"# Example https://api.forecast.io/forecast/yourtokenhere/51.94,-0.987?lang=en&units=uk2\\n"' + ' \r\n ' +
'"# Weather Underground, your own latitude, longitude, API key, language, units and interval in seconds required\\n"' + ' \r\n ' +
'"# Weather Underground Units key e = US, m = METRIC, s = SI(with m/s Scandinavia), h = UK(with mph)\\n"' + ' \r\n ' +
'"# Example https://api.weather.com/v3/wx/forecast/daily/5day?geocode=51.94,-0.987&language=en&format=json&units=h&apiKey=yourapikeyhere\\n"' + ' \r\n ' +
'"# Earthquake reports interval in seconds required\\n"' + ' \r\n ' +
'"# K-Index reports interval in seconds required\\n"' + ' \r\n ' +
'"# Metar reports airport code, API Key and interval in seconds required\\n"' + ' \r\n ' +
'"# Example https://api.checkwx.com/metar/EGTK/decoded\\n"' + ' \r\n ' +
'"# Example X-API-Key:yourapikeyhere\\n"' + ' \r\n ' +
'"# Purpleair reports device ID and interval in seconds required\\n"' + ' \r\n ' +
'"# Example https://www.purpleair.com/json?show=38365\\n"' + ' \r\n ' +
'"# Meteoalrm European weather warnings country code, region code and interval in seconds required\\n"' + ' \r\n ' +
'"# Example http://192.168.1.232/weewx/weather34/eualert.php?country=UK®ion=013\\n"' + ' \r\n ' +
'"# Select the services you require by creating a string of the services above\\n"' + ' \r\n ' +
'"# Example services = ds.me.eq.ki.wu.aq.al.ah.ao.aa.pu\\n"' + ' \r\n ' +
'"# Select your prefered time interval in seconds for each service\\n"' + ' \r\n ' +
'{' + ' \r\n ' +
" 'aq_url':'https://api.waqi.info/feed/geo:"+lat.value+';'+lon.value+'/?token='+aq_apikey.value+"'"+','+ ' \r\n ' +
" 'aq_interval':'3600'"+','+ ' \r\n ' +
" 'aq_filename':'/var/www/html/weewx/weather34/jsondata/aqi.txt'"+','+ ' \r\n ' +
" 'ds_url':'https://api.forecast.io/forecast/"+ds_apikey.value+'/'+lat.value+','+lon.value+'?lang='+lang.value+'&units'+'='+ds_units.value+"'"+','+ ' \r\n ' +
" 'ds_interval':'3600'"+','+ ' \r\n ' +
" 'ds_filename':'/var/www/html/weewx/weather34/jsondata/darksky.txt'"+','+ ' \r\n ' +
" 'wu_url':'https://api.weather.com/v3/wx/forecast/daily/5day?geocode="+lat.value+','+lon.value+'&language='+lang.value+'&format=json&units='+wu_units.value+'&apiKey='+wu_apikey.value+"'"+','+ ' \r\n ' +
" 'wu_interval':'3600'"+','+ ' \r\n ' +
" 'wu_filename':'/var/www/html/weewx/weather34/jsondata/wuforecast.txt'"+','+ ' \r\n ' +
" 'eq_url':'https://earthquake-report.com/feeds/recent-eq?json'"+','+ ' \r\n ' +
" 'eq_interval':'3600'"+','+ ' \r\n ' +
" 'eq_filename':'/var/www/html/weewx/weather34/jsondata/eqnotification.txt'"+','+ ' \r\n ' +
" 'ki_url':'https://services.swpc.noaa.gov/products/geospace/planetary-k-index-dst.json'"+','+ ' \r\n ' +
" 'ki_interval':'43200'"+','+ ' \r\n ' +
" 'ki_filename':'/var/www/html/weewx/weather34/jsondata/kindex.txt'"+','+ ' \r\n ' +
" 'me_url':'https://api.checkwx.com/metar/"+me_code.value+'/decoded'+"',"+ ' \r\n ' +
" 'me_header':'X-API-Key:"+me_apikey.value+"'"+','+ ' \r\n ' +
" 'me_interval':'3600'"+','+ ' \r\n ' +
" 'me_filename':'/var/www/html/weewx/weather34/jsondata/metar34.txt'"+','+ ' \r\n ' +
" 'pu_url':'https://www.purpleair.com/json?show="+pu_id.value+"'"+','+ ' \r\n ' +
" 'pu_interval':'3600'"+','+ ' \r\n ' +
" 'pu_filename':'/var/www/html/weewx/weather34/jsondata/purpleair.txt'"+','+ ' \r\n ' +
" 'al_url':'http://"+al_ip.value+'/weewx/weather34/eualert.php?country='+al_country.value+'®ion='+al_region.value+"'"+','+ ' \r\n ' +
" 'al_interval':'3600'"+','+ ' \r\n ' +
" 'al_filename':'/var/www/html/weewx/weather34/jsondata/meteoalarm.txt'"+','+ ' \r\n ' +
" 'services':'"+services.value+"'"+ ' \r\n ' +
" }'''"+','+ ' \r\n ' +
'"config_entries4"'+":'''="+ ' \r\n ' +
"'Weather34CloudCover' :"+ ' \r\n ' +
'"# Apply your own latitude and longitude and continent to the URLs in this section\\n"' + ' \r\n ' +
'{' + ' \r\n ' +
" 'enable':'"+enable.value+"'"+','+ ' \r\n ' +
" 'db_field':'signal8'"+','+ ' \r\n ' +
" 'cc_interval':'300'"+','+ ' \r\n ' +
" 'cc1_url':'https://api.sat24.com/crop?type=visual5hdcomplete&lat="+lat.value+'&lon='+lon.value+'&width=300&height=300&zoom=1.00&continent='+continent.value+"'"+','+ ' \r\n ' +
" 'cc1_filename':'/tmp/sat1.png'"+','+ ' \r\n ' +
" 'cc2_url':'https://api.sat24.com/crop?type=infraPolair&lat="+lat.value+'&lon='+lon.value+'&width=300&height=300&zoom=1.00&continent='+continent.value+"'"+','+ ' \r\n ' +
" 'cc2_filename':'/tmp/sat2.png'"+','+ ' \r\n ' +
" }'''"+','+ ' \r\n ' +
'}'
// Convert the text to BLOB.
const textToBLOB = new Blob([data], { type: 'text/plain' });
const sFileName = 'settings1.php'; // The file to save the data.
let newLink = document.createElement("a");
newLink.download = sFileName;
if (window.webkitURL != null) {
newLink.href = window.webkitURL.createObjectURL(textToBLOB);
}
else {
newLink.href = window.URL.createObjectURL(textToBLOB);
newLink.style.display = "none";
document.body.appendChild(newLink);
}
newLink.click();
}
</script>
</html>