nestabilnější
This commit is contained in:
@ -20,6 +20,7 @@ app.get("/", async (req, res) => {
|
||||
}).from(personTable)
|
||||
.leftJoin(pointsTable, eq(personTable.personId, pointsTable.personId))
|
||||
.groupBy(personTable.personId)
|
||||
.orderBy(sql`rand()`);
|
||||
|
||||
ejs.renderFile('src/templates/index.ejs', { people: people }, function (err, str) {
|
||||
if (err) {
|
||||
@ -95,7 +96,7 @@ app.get("/gamble/:id", async (req, res) => {
|
||||
if (person.gambleTime == null) {
|
||||
sendError(res, 423, "Gamble není dostupný");
|
||||
} else {
|
||||
sendError(res, 423, "Gamble nelze, gej nebudeš až v " + new Date(getNextGambleTime(person.gambleTime).getTime()).toLocaleString('cs', {
|
||||
sendError(res, 423, "Na prolomení časoprostoru kvůli závislosti na gamblingu přijde čas až v " + new Date(getNextGambleTime(person.gambleTime).getTime()).toLocaleString('cs', {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
timeZone: "Europe/Prague"
|
||||
@ -142,7 +143,7 @@ app.post("/gamble/:id", upload.none(), async (req, res) => {
|
||||
}
|
||||
|
||||
if (person.secret != req.body['secret']) {
|
||||
sendError(res, 423, "Nesprávé heslo. Also tvoje máma je gej.");
|
||||
sendError(res, 423, "Heslo ti zjevně zapadlo do bariéry");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -5,20 +5,42 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<link rel="stylesheet" href="/bootstrap.min.css" />
|
||||
<meta http-equiv="refresh" content="36000">
|
||||
<script src="/bootstrap.bundle.min.js"></script>
|
||||
<title>Nestabilní body</title>
|
||||
<title>Nestabilnější body</title>
|
||||
</head>
|
||||
|
||||
<%
|
||||
function hsl2rgb(h,s,l) {
|
||||
let a=s*Math.min(l,1-l);
|
||||
let f= (n,k=(n+h/30)%12) => l - a*Math.max(Math.min(k-3,9-k,1),-1);
|
||||
return [f(0),f(8),f(4)];
|
||||
}
|
||||
|
||||
function getRandomHoverBg() {
|
||||
let rgb = hsl2rgb(Math.random()*360,0.4,0.2)
|
||||
let hex = '#'
|
||||
for (let i = 0; i < 3; i++) {
|
||||
let subcolorValue = rgb[i];
|
||||
subcolorValue *= 255;
|
||||
subcolorValue = Math.round(subcolorValue);
|
||||
hex += subcolorValue.toString(16);
|
||||
}
|
||||
return hex;
|
||||
}
|
||||
%>
|
||||
|
||||
<body data-bs-theme="dark">
|
||||
<div class="w-100 text-center p-5">
|
||||
<h1>Nestabilní body</h1>
|
||||
<h1>Nestabilnější body</h1>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="row p-5">
|
||||
<% people.forEach((person) => {%>
|
||||
<div class="col-12 col-md-6 col-lg-3">
|
||||
<div class="col-12 col-md-6 col-lg-3 col-xxl-2">
|
||||
<a href='/gamble/<%= person.personId %>'
|
||||
class="btn btn-outline-secondary w-100 m-2 text-body fw-bold">
|
||||
class="btn btn-outline-secondary w-100 m-2 text-body fw-bold"
|
||||
style="--bs-btn-hover-bg: <%= getRandomHoverBg()%>">
|
||||
<%= person.name %>
|
||||
</a>
|
||||
</div>
|
||||
@ -26,7 +48,7 @@
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<div><strong>Hlášení dne:</strong></div>
|
||||
<div id="news-text" class="display-3 mb-3 fw-normal"></div>
|
||||
<div id="news-text" class="display-4 mb-3 fw-normal"></div>
|
||||
<div id="news-countdown" class="display-6 fw-bold"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user