1
0
mirror of https://github.com/funamitech/mastodon synced 2024-11-23 22:57:05 +09:00

cybrespace to 1.4.2

This commit is contained in:
Chronister 2017-06-14 22:25:10 +00:00 committed by beatrix-bitrot
parent 65528fc54e
commit 39b6b37b74
3 changed files with 39 additions and 19 deletions

View File

@ -12,24 +12,12 @@ body {
@media screen and (min-width: 1300px) { @media screen and (min-width: 1300px) {
.column { .column {
flex-grow: 1 !important; flex-grow: 1 !important;
max-width: 500px; max-width: 400px;
} }
.drawer { .drawer {
width: 20%; width: 17%;
} max-width: 400px;
.columns-area {
justify-content: center;
}
}
@media screen and (min-width: 1900px) {
.column, .drawer {
width: 400px;
border-radius: 4px;
height: 96vh;
margin-top: 2vh;
} }
} }

View File

@ -3,14 +3,46 @@ document.addEventListener("DOMContentLoaded", function(event) {
setInterval(updateClock, 1000); setInterval(updateClock, 1000);
}); });
function getNextOpen(now) {
var days = [[0, 14], [4, 18], [8, 22], [12], [2, 16], [6, 20], [10]]
var nowday = now.getUTCDay();
var nour = now.getUTCHours();
var open_hour = -1;
var d = 0;
while (open_hour == -1) {
var times = days[(nowday + d) % 7];
for (var i = 0; i < times.length; ++i) {
var time = times[i];
if (time == nour) {
return "refresh";
} else if (time > nour || d > 0) {
open_hour = time;
break;
}
}
if (open_hour == -1) {
d += 1;
nour = -1;
}
}
var open = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate() + d));
var ts = open.setUTCHours(open_hour);
return open;
}
function updateClock() { function updateClock() {
var clock = document.querySelector(".closed-registrations-message .clock"); var clock = document.querySelector(".closed-registrations-message .clock");
var now = new Date(); var now = new Date();
var open = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()); var open = getNextOpen(now);
var ts = open.setUTCHours(19);
if (open - now < 0) { if (open == "refresh") {
open = new Date(ts + 24*60*60*1000); location.reload();
return;
} }
var until = open - now; var until = open - now;
var ms = until % 1000; var ms = until % 1000;
var s = Math.floor((until / 1000)) % 60; var s = Math.floor((until / 1000)) % 60;

BIN
public/riot-glitch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB