forked from weewx/website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweewx.js
More file actions
174 lines (170 loc) · 5.78 KB
/
Copy pathweewx.js
File metadata and controls
174 lines (170 loc) · 5.78 KB
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
/* javascript for weewx.com web site */
/* author: matthew wall, 2013 */
/* list of weather stations displayed on the showcase page. */
/* for each station specify a description, url, and screenshot. */
var sites = [
{ description: 'Hood River, Oregon',
url: 'http://www.threefools.org/weewx/',
screenshot: 'hoodriver.png' },
{ description: 'ruskers.com',
url: 'http://wx.ruskers.com/',
screenshot: 'ruskers.png' },
{ description: 'Royston, UK',
url: 'http://www.dajda.net/',
screenshot: 'royston.png' },
{ description: 'Wetter-Pattensen',
url: 'http://wetter-pattensen.de',
screenshot: 'pattensen.png' },
{ description: 'Solås, Ålgård, Norway',
url: 'http://www.kanonbra.com/veret/',
screenshot: 'solas.png' },
{ description: 'AmatYr - Naustvika',
url: 'http://yr.hveem.no',
screenshot: 'amatyr.png' },
{ description: 'Nishinomiya Hyogo Japan',
url: 'http://www.swetake.com/weather/site/index.html',
screenshot: 'nishinomiya.png' },
{ description: 'Tinos Wetterseite',
url: 'https://tino.cc',
screenshot: 'tino.png' },
{ description: 'Yubileyny Moscow',
url: 'http://yubileyny.meteoweb.ru/',
screenshot: 'yubileyny.png' },
{ description: 'Narangba, Queensland, Australia',
url: 'http://www.therodericks.id.au/saratoga/wxindex.php',
screenshot: 'narangba.png' },
{ description: 'Ballymote, Sligo, Ireland',
url: 'http://goodsquishy.com/weather/',
screenshot: 'ballymote.png' },
{ description: 'Berkeley, California',
url: 'http://weather.mindfart.com/',
screenshot: 'berkeley.png' },
{ description: 'Palo Alto, California',
url: 'http://kj6etn.palo-alto.ca.us/',
screenshot: 'paloalto.png' },
{ description: 'Palomino Valley, Nevada',
url: 'http://www.palominovalleyweather.com/',
screenshot: 'palominovalley.png' },
{ description: 'Penfield, New York',
url: 'http://weather.mulveyfamily.com/',
screenshot: 'penfield.png' },
{ description: 'Sønderstrand, Sæby, Danmark',
url: 'http://jensjk.dk/saeby/',
screenshot: 'sonderstrand.png' },
{ description: 'Kongsvinger, Norway',
url: 'http://www.bogeraasen.net/index-en.php',
screenshot: 'kongsvinger.png' },
{ description: 'Trout River, Quebec',
url: 'http://www.scratchypants.com/wx/',
screenshot: 'troutriver.png' },
{ description: 'eMBeZon, Ypenburg, Holland',
url: 'http://www.embezon.nl/embezon/WEATHER_data/',
screenshot: 'ypenburg.png' },
{ description: 'Meteo Saint-Sulpice',
url: 'http://meteosaintsulpice.free.fr/now.php',
screenshot: 'meteosaintsulpice.png' },
{ description: 'Harper, Texas',
url: 'http://weather.janeandjohn.org/',
screenshot: 'harper.png' },
{ description: 'Grayson Highlands, Virginia',
url: 'http://weather.graysonfriends.org/',
screenshot: 'grayson-highlands.png' },
{ description: 'Surry, Virginia',
url: 'http://weather.chippokes.com/',
screenshot: 'surry.png' },
{ description: 'Bacchus Marsh, Victoria, AU',
url: 'http://wotid.dyndns.org/weather/',
screenshot: 'bacchusmarsh.png' },
{ description: 'Мичуринское',
url: 'http://meteo.slaval.ru/',
screenshot: 'slavalru.png'},
{ description: 'Belchertown, MA',
url: 'http://belchertownweather.com/',
screenshot: 'belchertown.png'},
];
/* inject navigation links into the navigation div */
function populate_header(page) {
var navbar = document.getElementById('navigation');
if(navbar) {
var navbar_html = "\
<div class='navitem'>\
<a href='/'><img src='/weewx-logo-128x128.png' class='logo' alt='weewx' /></a>\
</div>\
<div class='navitem'>\
<a href='/stations.html'>MAP</a>\
</div>\
<div class='navitem'>\
<a href='/showcase.html'>SHOWCASE</a>\
</div>\
<div class='navitem'>\
<a href='/code.html'>CODE</a>\
</div>\
<div class='navitem'>\
<a href='/hardware.html'>HARDWARE</a>\
</div>\
<div class='navitem'>\
<a href='/support.html'>SUPPORT</a>\
</div>\
<div class='navitem'>\
<a href='/docs.html'>DOCS</a>\
</div>\
<div class='navitem'>\
<a href='/downloads'>DOWNLOAD</a>\
</div>";
tmp = document.createElement('div');
tmp.setAttribute('class', 'nav');
tmp.innerHTML = navbar_html;
navbar.appendChild(tmp);
}
}
/* inject the showcase web sites into the showcase div */
function populate_showcase() {
var elem = document.getElementById('showcase');
if(!elem) {
return;
}
html = '';
for(var i=0; i<sites.length; i++) {
html += "<div class='showcase_item'>";
html += "<a href='" + sites[i].url + "'>" + sites[i].description;
html += "</a><br/>";
html += "<a href='screenshots/" + sites[i].screenshot + "'>";
html += "<img src='screenshots/" + sites[i].screenshot + "'";
html += " class='screenshot' /></a>";
html += "</div>";
}
elem.innerHTML = html;
}
/* inject a subset of showcase web sites into the screenshots div. */
/* maxnum is the maximum number of thumbnails to display. */
/* if rnd is specified, then choose randomly. */
function populate_screenshots(maxnum, rnd) {
var elem = document.getElementById('screenshots');
if(!elem) {
return;
}
if(!maxnum) {
maxnum = sites.length;
}
var indices = Array();
if(rnd) {
var n = 0;
for(var i=0; i<sites.length && n<maxnum; i++) {
if(Math.random() > 0.5) {
indices[n] = i;
n += 1;
}
}
} else {
for(var i=0; i<maxnum; i++) {
indices[i] = i;
}
}
html = '';
for(var i=0; i<indices.length; i++) {
html += "<a href='screenshots/"+sites[indices[i]].screenshot+"'>";
html += "<img src='screenshots/"+sites[indices[i]].screenshot+"'";
html += " class='screenshot' /></a><br/>";
}
elem.innerHTML = html;
}