-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
183 lines (181 loc) · 5.93 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
<!DOCTYPE html>
<!--
https://sankhara.net/kasina/ - Kasina disc images
https://github.com/hughpyle/kasina - source code repository
You may copy, modify and distribute this code as desired.
TODO:
- rotate the 'earth' picture to reflect the ecliptic (earth orbit path should be horizontal)
-->
<html style="overflow:hidden; background-color: black; cursor:none; color-scheme: light dark;">
<head>
<meta charset="UTF-8">
<title>Kasiṇa</title>
<link rel="manifest" href="manifest.json">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="viewport-fit=cover, user-scalable=yes, minimal-ui, width=device-width, initial-scale=0.5">
<meta name="twitter:site" content="@hughpyle" />
<meta name="twitter:title" content="Kasiṇa" />
<meta name="twitter:description" content="Kasina disc images" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:image" content="https://sankhara.net/kasina/kasina.gif" />
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script type="text/JavaScript" src="current_moon.js"></script>
<script type="text/JavaScript" src="current_earth.js"></script>
<script type="text/JavaScript" src="current_sun.js"></script>
<style type="text/css">
.color {
width: 548px;
height: 548px;
padding: 30px;
position: absolute;
overflow: hidden;
border-radius: 50%;
top: 50%;
left: 50%;
margin: -304px 0 0 -300px;
}
.moon {
width: 522px;
height: 522px;
padding: 180px;
position: absolute;
overflow: hidden;
border-radius: 50%;
top: 50%;
left: 50%;
margin: -440px 0 0 -440px;
}
.earth {
width: 660px;
height: 660px;
padding: 180px;
position: absolute;
overflow: hidden;
border-radius: 50%;
top: 50%;
left: 50%;
margin: -507px 0 0 -510px;
}
.sun {
width: 675px;
height: 675px;
padding: 150px;
position: absolute;
overflow: hidden;
top: 50%;
left: 50%;
margin: -516px 0px 0px -512px;
}
.sun2 {
width: 525px;
height: 525px;
padding: 0px;
position: absolute;
overflow: hidden;
border-radius: 50%;
top: 50%;
left: 50%;
margin: -234px 0px 0px -234px;
}
.moon img {width:100%; height:100%;}
.earth img {width:100%; height:100%;}
.sun2 img {width:100%; height:100%;}
</style>
</head>
<body style="width:100%; height:100%; overflow:hidden; cursor:crosshair" onload="load()">
<div id="outer" style="background-color: black; width:100%; height:100%">
<div id="earth" class="earth" style="display:none" title="Daily imagery collected by DSCOVR's Earth Polychromatic Imaging Camera (EPIC).">
<img id="earth_image" src="" onclick="press()" title=""/>
</div>
<div id="moon" class="moon" style="display:none" title="Hourly visualization of the current lunar phase and libration by NASA's SVS.">
<img id="moon_image" style="transform:rotate(30deg)" src="" onclick="press()" title=""/>
</div>
<div id="sun" class="sun" style="display:none" title="Near-Live image of the solar surface as seen by NASA's SDO.">
<div id="sun2" class="sun2">
<img id="sun_image" src="" onclick="press()" title=""/>
</div>
</div>
<div id="blue" class="color" style="display:none" onclick="press()">
<svg style="background:black; width:100%; height:100%">
<circle r="240px" cx="273px" cy="273px" style="fill:blue; stroke:blue"/>
</svg>
</div>
<div id="yellow" class="color" style="display:none" onclick="press()">
<svg style="background:black; width:100%; height:100%">
<circle r="240px" cx="273px" cy="273px" style="fill:yellow; stroke:yellow"/>
</svg>
</div>
<div id="red" class="color" style="display:none" onclick="press()">
<svg style="background:black; width:100%; height:100%">
<circle r="240px" cx="273px" cy="273px" style="fill:red; stroke:red"/>
</svg>
</div>
<div id="white" class="color" style="display:none" onclick="press()">
<svg style="background:black; width:100%; height:100%">
<circle r="240px" cx="273px" cy="273px" style="fill:white; stroke:white"/>
</svg>
</div>
<div id="data" style="display:none">
<div id="latitude">-42.74</div>
<div id="longitude">-73.20</div>
</div>
</div>
</body>
<script type="text/JavaScript">
showing=6
const labels = ["earth", "moon", "sun", "blue", "yellow", "red", "white"];
function geo(position) {
// Used to rotate the apparent angle of the moon depending on your latitude
const latitude = position.coords.latitude;
const longitude = position.coords.longitude;
$("#latitude").text(`${latitude}`)
$("#longitude").text(`${longitude}`)
refresh()
}
function load() {
if(window.location.search) {
window.location.replace(window.location.pathname + "#" + window.location.search.substr(1));
}
$(window).on('orientationchange', ohc);
$(window).on('hashchange', ohc);
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(geo);
}
ohc();
refresh();
}
function refresh() {
get_earth_image();
get_sun_image();
replace_moon_image();
setTimeout(refresh, 600000);
}
function ohc() {
showing = labels.indexOf(window.location.hash.substr(1));
if(showing < 0) {
showing = 6;
}
show();
}
function show() {
for(var i=0; i<labels.length; i++) {
document.getElementById(labels[i]).style.display = showing==i ? "block" : "none";
}
window.scrollTo(0, 1);
window.location.hash = "#" + labels[showing];
}
function press() {
showing = (showing + 1) % 7;
console.log(labels[showing]);
show();
try {
var doc = window.document;
var docEl = doc.documentElement;
var requestFullScreen = docEl.requestFullscreen || docEl.mozRequestFullScreen || docEl.webkitRequestFullScreen || docEl.msRequestFullscreen;
requestFullScreen.call(docEl, {navigationUI: "hide"});
} catch(err) {}
}
</script>
</html>