-
Notifications
You must be signed in to change notification settings - Fork 94
/
custom.html
452 lines (399 loc) · 17.7 KB
/
custom.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
<!DOCTYPE html>
<html>
<head>
<title>VirtualSky Custom Embed</title>
<!--
Virtual Sky <canvas> application
(c) 2010-2012 Stuart Lowe (Las Cumbras Observatory Global Telescope)
-->
<style>
body {
background: #fff;
font-family: 'Trebuchet MS',Tahoma,Helvetica,Verdana,sans-serif;
color: black;
padding: 2em;
margin: 0px;
}
li.options .i {
clear: both;
min-height: 2em;
}
li.options .p {
display: inline-block;
width: 10em;
}
li.options .o {
display: inline-block;
margin-right: 16px;
}
li.options .h {
margin-bottom: 1em;
display: inline-block;
opacity: 0.2;
filter: alpha(20);
}
li.options .i:hover .h {
opacity: 0.7;
filter: alpha(70);
}
</style>
<script src="stuquery.min.js"></script>
<script src="virtualsky.js" type="text/javascript"></script>
<script>
var planetarium;
S(document).ready(function(){
skydefault = S.virtualsky();
planetarium = S.virtualsky({id:'preview',width:500,height:350});
planetarium.draw();
update();
S('.version').html(planetarium.version)
});
var changedtime = false;
function update(el) {
property = (el) ? el.name : "";
value = (el) ? el.value : "";
if(property == 'projection') planetarium.selectProjection(value);
if(property == 'mouse') planetarium.mouse = (value == "true") ? true : false;
if(property == 'keyboard') planetarium.keyboard = (value == "true") ? true : false;
if(property == 'gradient') planetarium.gradient = (value == "true") ? true : false;
if(property == 'negative') planetarium.negative = (value == "true") ? true : false;
if(property == 'cardinalpoints') planetarium.cardinalpoints = (value == "true") ? true : false;
if(property == 'constellations') planetarium.constellation.lines = (value == "true") ? true : false;
if(property == 'constellationlabels') planetarium.constellation.labels = (value == "true") ? true : false;
if(property == 'constellationboundaries') planetarium.constellation.boundaries = (value == "true") ? true : false;
if(property == 'meteorshowers') planetarium.meteorshowers = (value == "true") ? true : false;
if(property == 'showstars') planetarium.showstars = (value == "true") ? true : false;
if(property == 'showstarlabels') planetarium.showstarlabels = (value == "true") ? true : false;
if(property == 'showplanets') planetarium.showplanets = (value == "true") ? true : false;
if(property == 'showplanetlabels') planetarium.showplanetlabels = (value == "true") ? true : false;
if(property == 'showorbits') planetarium.showorbits = (value == "true") ? true : false;
if(property == 'showdate') planetarium.showdate = (value == "true") ? true : false;
if(property == 'showposition') planetarium.showposition = (value == "true") ? true : false;
if(property == 'gridlines_az') planetarium.grid.az = (value == "true") ? true : false;
if(property == 'gridlines_eq') planetarium.grid.eq = (value == "true") ? true : false;
if(property == 'gridlines_gal') planetarium.grid.gal = (value == "true") ? true : false;
if(property == 'clock'){
if(value){
planetarium.clock = new Date(value);
changedtime = true;
}else{
planetarium.clock = new Date();
changedtime = false;
}
}
if(property == 'dimensions'){
dim = value.split('x');
if(dim.length == 2){
planetarium.resize(dim[0],dim[1]);
el = document.getElementById(planetarium.id);
S('#'+planetarium.id).css({'height':planetarium.tall+'px','width':planetarium.wide+'px'})
}
}
el = document.getElementById('dimensions');
el.value = planetarium.wide+'x'+planetarium.tall;
var langcode = planetarium.langcode;
if(property == 'position') planetarium.setGeo(value);
if(property == 'background') planetarium.background = value;
if(property == 'color') planetarium.color = value;
if(property == 'magnitude') planetarium.magnitude = parseFloat(value);
if(property == 'scalestars') planetarium.scalestars = parseFloat(value);
if(property == 'lang'){ langcode = value; planetarium.loadLanguage(value); }
if(property == 'az_off') planetarium.az_off = value;
el = document.getElementById('az_off');
el.value = ((planetarium.az_off+180)%360);
el = document.getElementById('position');
el.value = planetarium.latitude.deg+','+planetarium.longitude.deg;
planetarium.updateColours();
planetarium.draw();
planetarium.setClock(0);
if(property == 'live') planetarium.liveSky();
var str = "<iframe width=\""+planetarium.wide+"\" height=\""+planetarium.tall+"\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\"";
var uri = "http://slowe.github.io/VirtualSky/embed?";
if(skydefault.longitude.deg != planetarium.longitude.deg) uri += "longitude="+planetarium.longitude.deg;
if(skydefault.latitude.deg != planetarium.latitude.deg) uri += "&latitude="+planetarium.latitude.deg;
if(skydefault.gradient != planetarium.gradient) uri += "&gradient="+planetarium.gradient;
if(skydefault.projection != planetarium.projection) uri += "&projection="+planetarium.projection.id;
if(skydefault.negative != planetarium.negative) uri += "&negative="+planetarium.negative;
if(skydefault.mouse != planetarium.mouse) uri += "&mouse="+planetarium.mouse;
if(skydefault.keyboard != planetarium.keyboard) uri += "&keyboard="+planetarium.keyboard;
if(skydefault.cardinalpoints != planetarium.cardinalpoints) uri += "&cardinalpoints="+planetarium.cardinalpoints;
if(skydefault.constellation.lines != planetarium.constellation.lines) uri += "&constellations="+planetarium.constellation.lines;
if(skydefault.constellation.labels != planetarium.constellation.labels) uri += "&constellationlabels="+planetarium.constellation.labels;
if(skydefault.constellation.boundaries != planetarium.constellation.boundaries) uri += "&constellationboundaries="+planetarium.constellation.boundaries;
if(skydefault.meteorshowers != planetarium.meteorshowers) uri += "&meteorshowers="+planetarium.meteorshowers;
if(skydefault.showstars != planetarium.showstars) uri += "&showstars="+planetarium.showstars;
if(skydefault.showstarlabels != planetarium.showstarlabels) uri += "&showstarlabels="+planetarium.showstarlabels;
if(skydefault.scalestars != planetarium.scalestars) uri += "&scalestars="+planetarium.scalestars;
if(skydefault.showplanets != planetarium.showplanets) uri += "&showplanets="+planetarium.showplanets;
if(skydefault.showplanetlabels != planetarium.showplanetlabels) uri += "&showplanetlabels="+planetarium.showplanetlabels;
if(skydefault.showorbits != planetarium.showorbits) uri += "&showorbits="+planetarium.showorbits;
if(skydefault.showdate != planetarium.showdate) uri += "&showdate="+planetarium.showdate;
if(skydefault.showposition != planetarium.showposition) uri += "&showposition="+planetarium.showposition;
if(skydefault.grid.az != planetarium.grid.az) uri += "&gridlines_az="+planetarium.grid.az;
if(skydefault.grid.eq != planetarium.grid.eq) uri += "&gridlines_eq="+planetarium.grid.eq;
if(skydefault.grid.gal != planetarium.grid.gal) uri += "&gridlines_gal="+planetarium.grid.gal;
if(skydefault.background != planetarium.background) uri += "&background="+planetarium.background;
if(skydefault.color != planetarium.color) uri += "&color="+planetarium.color;
if(skydefault.magnitude != planetarium.magnitude) uri += "&magnitude="+planetarium.magnitude;
if(skydefault.islive != planetarium.islive) uri += "&live="+planetarium.islive;
if(skydefault.az_off != planetarium.az_off) uri += "&az="+((planetarium.az_off+180)%360);
if(skydefault.langcode != langcode) uri += "&lang="+langcode;
if(changedtime) uri += "&clock="+planetarium.clock;
str += encodeURI(uri);
str += "\" allowTransparency=\"true\"></iframe>";
el = document.getElementById('embedcode');
el.value = str
}
</script>
</head>
<body>
<h1>VirtualSky <span class="version">v</span> - Custom Embed</h1>
<p><a href="https://slowe.github.io/VirtualSky/">VirtualSky</a> is a browser-based planetarium for embedding in websites. Choose from the options below, check the preview is how you'd like, and then cut-and-paste the code into your web page.</p>
<form>
<ol>
<li class="options">
<h2>Customize</h2>
<div class="i">
<label class="p" for="projection">Projection</label>
<div class="o">
<select name="projection" id="projection" onChange="update(this)">
<option selected>polar</option>
<option>stereo</option>
<option>lambert</option>
<option>equirectangular</option>
<option>mollweide</option>
<option>planechart</option>
</select>
</div>
</div>
<div class="i">
<label class="p" for="lang">Language</label>
<div class="o">
<select name="lang" id="lang" onChange="update(this)">
<option value="" selected>---</option>
<option value="ar">العربية</option>
<option value="cs">Čeština</option>
<option value="de">Deutsch</option>
<option value="en">English</option>
<option value="es">Español</option>
<option value="fr">Français</option>
<option value="gl">Galego</option>
<option value="it">Italiano</option>
<option value="nl">Nederlands</option>
<option value="pl">Polski</option>
<option value="pt">Português</option>
</select> only set this if you <em>have</em> to explicitly specify a language.
</div>
</div>
<div class="i">
<label class="p" for="dimensions">Width/Height</label>
<div class="o">
<input type="text" name="dimensions" id="dimensions" value="" onChange="update(this)" /> e.g. 500x400
</div>
</div>
<div class="i">
<label class="p" for="clock">Specific date?</label>
<div class="o">
<input type="text" name="clock" id="clock" value="" onChange="update(this)" /> e.g. Sun, 02 Jan 2011 14:46:28 +0000 (leave blank for the current time)
</div>
</div>
<div class="i">
<label class="p" for="position">Latitude/longitude</label>
<div class="o">
<input type="text" name="position" id="position" value="" onChange="update(this)" /> in decimal degrees
</div>
</div>
<div class="i">
<div class="p">Azimuthal offset</div>
<div class="o">
<input type="text" name="az_off" id="az_off" value="" onChange="update(this)" /> in decimal degrees with north=0, east=90
</div>
</div>
<div class="i">
<label class="p" for="background">Background color</label>
<div class="o">
<input type="text" name="background" id="background" value="rgba(0,0,0,0)" onChange="update(this)" /> default is transparent (only relevant in polar/mollweide projections)
</div>
</div>
<div class="i">
<label for="color" class="p">Text color</label>
<div class="o">
<input type="text" name="color" id="color" value="" onChange="update(this)" /> leave blank for automatic
</div>
</div>
<div class="i">
<label class="p" for="magnitude">Magnitude Limit</label>
<div class="o">
<input type="text" name="magnitude" id="magnitude" value="5" onChange="update(this)" /> larger number is fainter
</div>
</div>
<div class="i">
<label for="scalestars" class="p">Scale stars</label>
<div class="o">
<input type="text" name="scalestars" id="scalestars" value="1" onChange="update(this)" /> a scale factor by which to change the star sizes
</div>
</div>
<div class="i">
<div class="p">Sky gradient?</div>
<div class="o">
<input type="radio" name="gradient" id="gradient-yes" value="true" onChange="update(this)" checked /> <label for="gradient-yes">Yes</label>
<input type="radio" name="gradient" id="gradient-no" value="false" onChange="update(this)" /> <label for="gradient-no">No</label>
</div>
</div>
<div class="i">
<div class="p">Mouse control?</div>
<div class="o">
<input type="radio" name="mouse" value="true" onChange="update(this)" checked /> Yes
<input type="radio" name="mouse" value="false" onChange="update(this)" /> No
</div>
<div class="h">Allow the user to use their mouse to drag the sky.</div>
</div>
<div class="i">
<div class="p">Keyboard control?</div>
<div class="o">
<input type="radio" name="keyboard" value="true" onChange="update(this)" checked /> Yes
<input type="radio" name="keyboard" value="false" onChange="update(this)" /> No
</div>
<div class="h">Allow the user to make use of the keyboard shortcuts when their cursor is over the sky.</div>
</div>
<div class="i">
<div class="p">Invert sky colors?</div>
<div class="o">
<input type="radio" name="negative" value="true" onChange="update(this)" /> Yes
<input type="radio" name="negative" value="false" onChange="update(this)" checked /> No
</div>
<div class="h">Display black stars on a white sky. Useful for printing.</div>
</div>
<div class="i">
<div class="p">Cardinal points?</div>
<div class="o">
<input type="radio" name="cardinalpoints" value="true" onChange="update(this)" checked /> Yes
<input type="radio" name="cardinalpoints" value="false" onChange="update(this)" /> No
</div>
<div class="h">e.g. "N", "S", "E" and "W"</div>
</div>
<div class="i">
<div class="p">Constellation lines?</div>
<div class="o">
<input type="radio" name="constellations" value="true" onChange="update(this)" /> Yes
<input type="radio" name="constellations" value="false" onChange="update(this)" checked /> No
</div>
</div>
<div class="i">
<div class="p">Constellation labels?</div>
<div class="o">
<input type="radio" name="constellationlabels" value="true" onChange="update(this)" /> Yes
<input type="radio" name="constellationlabels" value="false" onChange="update(this)" checked /> No
</div>
</div>
<div class="i">
<div class="p">Const. boundaries?</div>
<div class="o">
<input type="radio" name="constellationboundaries" value="true" onChange="update(this)" /> Yes
<input type="radio" name="constellationboundaries" value="false" onChange="update(this)" checked /> No
</div>
</div>
<div class="i">
<div class="p">Meteor showers?</div>
<div class="o">
<input type="radio" name="meteorshowers" value="true" onChange="update(this)" /> Yes
<input type="radio" name="meteorshowers" value="false" onChange="update(this)" checked /> No
</div>
<div class="h">Labels the radiants of current meteor showers</div>
</div>
<div class="i">
<div class="p">Show planets?</div>
<div class="o">
<input type="radio" name="showplanets" value="true" onChange="update(this)" checked /> Yes
<input type="radio" name="showplanets" value="false" onChange="update(this)" /> No
</div>
<div class="h">Will also show the Sun and Moon</div>
</div>
<div class="i">
<div class="p">Show planet labels</div>
<div class="o">
<input type="radio" name="showplanetlabels" value="true" onChange="update(this)" checked /> Yes
<input type="radio" name="showplanetlabels" value="false" onChange="update(this)" /> No
</div>
</div>
<div class="i">
<div class="p">Show stars?</div>
<div class="o">
<input type="radio" name="showstars" value="true" onChange="update(this)" checked /> Yes
<input type="radio" name="showstars" value="false" onChange="update(this)" /> No
</div>
<div class="h">Will also show the Sun and Moon</div>
</div>
<div class="i">
<div class="p">Show star labels</div>
<div class="o">
<input type="radio" name="showstarlabels" value="true" onChange="update(this)" /> Yes
<input type="radio" name="showstarlabels" value="false" onChange="update(this)" checked /> No
</div>
<div class="h">Display labels for the brightest stars e.g. "Sirius", "Deneb", "Pollux" etc?</div>
</div>
<div class="i">
<div class="p">Show orbits?</div>
<div class="o">
<input type="radio" name="showorbits" value="true" onChange="update(this)" /> Yes
<input type="radio" name="showorbits" value="false" onChange="update(this)" checked /> No
</div>
</div>
<div class="i">
<div class="p">Show date?</div>
<div class="o">
<input type="radio" name="showdate" value="true" onChange="update(this)" checked /> Yes
<input type="radio" name="showdate" value="false" onChange="update(this)" /> No
</div>
<div class="h">Displays the date and time in the top left corner.</div>
</div>
<div class="i">
<div class="p">Show position?</div>
<div class="o">
<input type="radio" name="showposition" value="true" onChange="update(this)" checked /> Yes
<input type="radio" name="showposition" value="false" onChange="update(this)" /> No
</div>
<div class="h">Displays the longitude and latitude in the top left corner.</div>
</div>
<div class="i">
<div class="p">Azimuth gridlines?</div>
<div class="o">
<input type="radio" name="gridlines_az" value="true" onChange="update(this)" /> Yes
<input type="radio" name="gridlines_az" value="false" onChange="update(this)" checked /> No
</div>
</div>
<div class="i">
<div class="p">Equatorial gridlines?</div>
<div class="o">
<input type="radio" name="gridlines_eq" value="true" onChange="update(this)" /> Yes
<input type="radio" name="gridlines_eq" value="false" onChange="update(this)" checked /> No
</div>
</div>
<div class="i">
<div class="p">Galactic gridlines?</div>
<div class="o">
<input type="radio" name="gridlines_gal" value="true" onChange="update(this)" /> Yes
<input type="radio" name="gridlines_gal" value="false" onChange="update(this)" checked /> No
</div>
</div>
<div class="i">
<div class="p">Live?</div>
<div class="o">
<input type="radio" name="live" value="true" onChange="update(this)" /> Yes
<input type="radio" name="live" value="false" onChange="update(this)" checked /> No
</div>
<div class="h">The sky will update every second.</div>
</div>
</li>
<li>
<h2>Preview</h2>
<div id="preview"></div>
</li>
<li>
<h2>Embed</h2>
<textarea name="embed" id="embedcode" rows="8" cols="50" onFocus="this.select()"></textarea>
</li>
</ol>
</form>
</body>
</html>