Skip to content

Commit 08964e9

Browse files
committed
Merge branch 'master' of github.com:DataManager-Go/DataManagerServer into master
2 parents fb79c26 + 3912e34 commit 08964e9

3 files changed

Lines changed: 61 additions & 13 deletions

File tree

html/index.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,15 @@ <h3 class="header">And there is literally nothing to be seen here either</h3>
256256

257257
<br>
258258
<h2 class="header">Time you have already wasted on this page</h2>
259-
260259
<br>
261260

261+
<div id = "innerDIV">
262+
263+
</div>
264+
262265
<!-- CLOCK -->
263266

264-
<div class="clock">
267+
<div class="clock" id = "clockDIV">
265268
<div class="container-fluid">
266269
<div class="row">
267270

@@ -322,7 +325,7 @@ <h2 class="header">Time you have already wasted on this page</h2>
322325

323326
<!-- DECIMAL -->
324327

325-
<div class="dec">
328+
<div class="dec" id = "numberDIV">
326329
<div class="container-fluid">
327330
<div class="row">
328331

html/static/index/js/app.js

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
// Prevent text marking on this page
22
onselectstart = (e) => {e.preventDefault()}
33

4-
/* this JS handles the binary clock */
5-
var startTime = new Date().getTime();
4+
// Start date
5+
var d = new Date();
6+
// Covert current time to UTC
7+
var startTime = d.getTime() + d.getTimezoneOffset() * 60000;
8+
9+
// Timer
10+
var timer;
611

712
var main = function() {
813

9-
window.setInterval(function() {clock()}, 1000);
14+
// Update everys 1000 ms
15+
timer = window.setInterval(function() {clock()}, 1000);
1016

17+
// Pre-Setup to make everything nice and dark
1118
var lighting = function(n,t) {
1219
if(n == 1) {
1320
$('.'+t+'-1').addClass('on').removeClass('off');
@@ -73,27 +80,65 @@ var main = function() {
7380
};
7481

7582
var clock = function() {
76-
77-
var currentTime = new Date(new Date().getTime() - startTime)
7883

79-
var hours = currentTime.getHours()-1;
80-
var minutes = currentTime.getMinutes();
81-
var seconds = currentTime.getSeconds();
82-
84+
// Current Time
85+
var d2 = new Date();
86+
var currentTime = d2.getTime() + (d2.getTimezoneOffset() * 60000) - startTime;
87+
88+
// Convert miliseconds
89+
var seconds = currentTime / 1000;
90+
var minutes = seconds / 60;
91+
var hours = minutes / 60;
92+
93+
// Get within current limits
94+
seconds = Math.floor(seconds % 60);
95+
minutes = Math.floor(minutes % 60);
96+
hours = Math.floor(hours);
97+
98+
// Negative time protection
99+
if (hours < 0 || minutes < 0 || seconds < 0) {
100+
d = new Date();
101+
startTime = d.getTime() + d.getTimezoneOffset() * 60000;
102+
return;
103+
}
104+
105+
// No-Life protection
106+
if (hours >= 30) {
107+
document.getElementById("clockDIV").innerHTML = "";
108+
document.getElementById("numberDIV").innerHTML = "";
109+
110+
// Get some help.
111+
var timeMsg = document.createElement("h1");
112+
timeMsg.innerHTML = " > 30 GODDAMNED HOURS!";
113+
114+
var helpMsg = document.createElement("h3");
115+
helpMsg.innerHTML = "If you didn't cheat on achieving this amount of time<br> you should really go out and get some help."
116+
helpMsg.style.textAlign = "center";
117+
helpMsg.style.color = "#4f4f66"
118+
119+
document.getElementById("innerDIV").appendChild(timeMsg);
120+
document.getElementById("innerDIV").appendChild(helpMsg);
121+
122+
window.clearInterval(timer);
123+
}
124+
125+
// Calculate the binary lights
83126
var s2 = seconds % 10;
84127
var s1 = (seconds - s2) / 10 % 10;
85128
var m2 = minutes % 10;
86129
var m1 = (minutes - m2) / 10 % 10;
87130
var h2 = hours % 10;
88131
var h1 = (hours - h2) / 10 % 10;
89132

133+
// Make it bright (or dark lol)
90134
lighting(s2, 's-2');
91135
lighting(s1, 's-1');
92136
lighting(m2, 'm-2');
93137
lighting(m1, 'm-1');
94138
lighting(h2, 'h-2');
95139
lighting(h1, 'h-1');
96140

141+
// Display time number
97142
$('.dec-hour1 p').text(h1);
98143
$('.dec-hour2 p').text(h2);
99144
$('.dec-minute1 p').text(m1);

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
_ "gorm.io/driver/postgres"
1919
)
2020

21-
const version = "v3.12.0"
21+
const version = "v3.12.8"
2222

2323
var (
2424
app = kingpin.New("dmserver", "The data manager server")

0 commit comments

Comments
 (0)