/
Main.html
178 lines (151 loc) · 3.18 KB
/
Main.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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<title>Cel calendar gadget</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
* { margin: 0; padding: 0; }
body { width: 120px; height: 115px; }
input { width: 100%; }
</style>
<script type="text/javascript">
var CelKrCykk = function(){
function JulianDay(year, month, day)
{
if(month < 3) {
month += 12;
year -= 1;
}
var a, b, c, d, e;
a = Math.floor(year / 100);
b = 2 - a + Math.floor(a / 4);
c = Math.floor(365.25 * (year + 4716));
d = Math.floor(30.6001 * (month + 1));
e = Math.floor(day + b - 1524.5) + 1;
//R020314追記 この関数、どっかから拾ってきた奴のはずなんだけど出典を忘れちゃった。テヘ
return (c + d + e);
}
var today = new Date();
var year = today.getFullYear();
var month = today.getMonth()+1;
var day = today.getDate();
var hor = today.getHours();
var min = today.getMinutes();
var sec = today.getSeconds();
var yurius;
yurius = JulianDay(year, month, day);
var x;
x = yurius-1526862;
var dec=x-931376;
var celYear=1;
var celMonth=1;
var celDay=1;
while(x>0){
x=x-1;
if(celMonth==14){
if(celDay==1){
if(celYear%4==0){
if(celYear%100==0){
if(celYear%400==0){
celDay=celDay+1;
}else{
celDay=1;
celMonth=1;
celYear=celYear+1;
}
}else{
celDay=celDay+1;
}
}else{
celDay=1;
celMonth=1;
celYear=celYear+1;
}
}else{
celDay=1;
celMonth=1;
celYear=celYear+1;
}
}else{
if(celDay==28){
celDay=1;
celMonth=celMonth+1;
}else{
celDay=celDay+1;
}
}
}
var time=(hor*60+min)*60+sec;
var celtime=time-20000;
var flag=1;
if(celtime<0){
celtime=86400+celtime;
celDay=celDay-1;
flag=2;
if(celDay==0){
celDay=28
celMonth=celMonth-1
if(celMonth==0){
celMonth=14;
celYear=celYear-1;
if((year%4==0 && year%100!=0) || (year%400==0)){
celDay=2;
}else{
celDay=1;
}
}
}
}
var celhor =celtime/3600|0;
var celmin =celtime%3600/60|0;
var celsec =celtime%60;
//改元処理
if(year<=2019){
if(month<=4){
era='H';year=year-1988;
}else{if(month>4)
era="R";year=year-2018;
}
}else{
if(year>2019){era="R";year=year-2018;}
}
//ひとけた対応
if(year<10){year='0'+year;}
if(day<10){day='0'+day;}
if(month<10){month='0'+month;}
if(celYear<10){
celYear='000'+celYear;
}else{
if(celYear<100){
celYear='00'+celYear;
}else{
if(celYear<1000){
celYea='0'+celYear;
}
}
}
if(celMonth<10){celMonth='0'+celMonth;}
if(celDay<10){celDay='0'+celDay;}
if(hor<10){hor='0'+hor;}
if(min<10){min='0'+min;}
if(sec<10){sec='0'+sec;}
if(celhor<10){celhor='0'+celhor;}
if(celmin<10){celmin='0'+celmin;}
if(celsec<10){celsec='0'+celsec;}
if(flag==2){dec=dec-1;}
return (era+year+month+day+'<br>'+hor+'-'+min+'-'+sec+'<br>C'+celYear+'-'+celMonth+celDay+'<br>'+celhor+'-'+celmin+'-'+celsec+'<br>dec '+dec);
}
</script>
<body>
<div id=result>
<br>
<br>
<input type="button" value="起動/wogluy" onclick="akcino()"style="position: absolute; bottom: 0px"/>
</div>
<script>
var akcino = function(){
var result = document.getElementById("result");
result.innerHTML = CelKrCykk();
setTimeout(akcino, 100);
}
</script>
</body>
</html>