This commit is contained in:
ivan 2020-03-04 13:50:48 +03:00
parent d0f5615550
commit 4df8ec6b0e
2 changed files with 176 additions and 1 deletions

View File

@ -1,3 +1,4 @@
# dtime-js
dtime - Erisian (Discordian) time and date
dtime - Erisian (Discordian) time and date
based on REAL-TIME CLOCK by Tiago Madeira

174
index.html Normal file
View File

@ -0,0 +1,174 @@
<!doctype html public "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
REAL-TIME CLOCK (c) 2009 por Tiago Madeira (http://tiagomadeira.com/)
Idealizado por Santaum (http://santaum.org/)
All Hail Eris!
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<script type="text/javascript">
function az(x) {
if (x < 10)
return "0"+x;
return x;
}
function ly(Y) {
return (Y % 4 == 0 && !(Y % 100 == 0 && Y % 400 != 0));
}
function dy(D, M, Y) {
var dm = Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if (ly(Y)) {
dm[1] = 29;
}
var d = D;
for (var i = 0; i < M-1; i++) {
d+= dm[i]
}
return d;
}
function go() {
var iddate = document.getElementById("ddate");
var idtime = document.getElementById("dtime");
var date = new Date();
var D = date.getDate();
var M = date.getMonth()+1;
var Y = date.getFullYear();
var d = dy(D, M, Y);
var sttiby = 0;
if (ly(Y)) {
if (d == 60) {
sttiby = 1;
} else if (d > 60) {
d--;
}
}
M = Math.floor(d/73);
D = d % 73;
if (D == 0) {
M--;
D = 73;
}
switch (M) {
case 0:
M = "Caos";
break;
case 1:
M = "DiscÃ&#179;rdia";
break;
case 2:
M = "ConfusÃ&#163;o";
break;
case 3:
M = "Burocracia";
break;
case 4:
M = "Consequências";
break;
default:
M = "fnord";
}
Y+= 1166;
if (sttiby) {
iddate.innerHTML = "Dia de SÃ&#163;o Tiby, "+Y+" YOLD";
} else {
iddate.innerHTML = az(D)+" de "+M+" de "+Y+" YOLD";
}
var h = date.getHours();
var m = date.getMinutes();
var s = date.getSeconds();
var e = h*3600+m*60+s;
var ds = Math.round(e*1000/864);
h = Math.floor(ds/10000);
ds%= 10000;
m = Math.floor(ds/100);
ds%= 100;
s = ds;
idtime.innerHTML = az(h)+":"+az(m)+":"+az(s);
}
window.onload = function() {
go();
setInterval(go, 100);
}
</script>
<style type="text/css">
* {
margin:0;
padding:0;
}
html {
width:100%;
height:100%;
position:relative;
background:#f1f1f1;
color:#326f0c;
font:14px "Luxi Sans", "Lucida Sans", "Trebuchet MS", "Bitstream Vera Sans", serif;
}
#wrap {
position:absolute;
width:240px;
height:100px;
/* left:50%; */
/* top:50%; */
margin-top:5px;
text-align:center;
}
#ddate {
text-transform:uppercase;
}
#dtime {
font:40px "Bitstream Vera Sans Mono", "Courier New", monospace;
}
#license {
position:absolute;
bottom:5px;
left:50%;
margin-left:-300px;
width:600px;
text-align:center;
font-size:0.8em;
line-height:1.4em;
}
a {
color:#aaa;
text-decoration:underline;
}
a:hover {
text-decoration:none;
}
</style>
<div id="wrap">
<p id="ddate">Ative o JavaScript.</p>
<p id="dtime">00:00:00</p>
</div>
<br /><br /><br /><br /><br />
</!doctype>