move timesince to lib folder
This commit is contained in:
parent
3f8d2c60bf
commit
16a80bf80c
|
@ -1,34 +1,7 @@
|
||||||
extends layout/main.pug
|
extends layout/main.pug
|
||||||
block root
|
block root
|
||||||
- var title = 'Guestbook'
|
- var title = 'Guestbook'
|
||||||
-
|
include lib/since.pug
|
||||||
function TimeSince(date) {
|
|
||||||
|
|
||||||
var seconds = Math.floor((new Date() - date) / 1000);
|
|
||||||
|
|
||||||
var interval = seconds / 31536000;
|
|
||||||
|
|
||||||
if (interval > 1) {
|
|
||||||
return Math.floor(interval) + " years";
|
|
||||||
}
|
|
||||||
interval = seconds / 2592000;
|
|
||||||
if (interval > 1) {
|
|
||||||
return Math.floor(interval) + " months";
|
|
||||||
}
|
|
||||||
interval = seconds / 86400;
|
|
||||||
if (interval > 1) {
|
|
||||||
return Math.floor(interval) + " days";
|
|
||||||
}
|
|
||||||
interval = seconds / 3600;
|
|
||||||
if (interval > 1) {
|
|
||||||
return Math.floor(interval) + " hours";
|
|
||||||
}
|
|
||||||
interval = seconds / 60;
|
|
||||||
if (interval > 1) {
|
|
||||||
return Math.floor(interval) + " minutes";
|
|
||||||
}
|
|
||||||
return Math.floor(seconds) + " seconds";
|
|
||||||
}
|
|
||||||
block head
|
block head
|
||||||
<link rel='stylesheet' href='/static/ui/send_button.css'>
|
<link rel='stylesheet' href='/static/ui/send_button.css'>
|
||||||
<link rel='stylesheet' href='/static/ui/gb_ui.css'>
|
<link rel='stylesheet' href='/static/ui/gb_ui.css'>
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
-
|
||||||
|
function TimeSince(date) {
|
||||||
|
|
||||||
|
var seconds = Math.floor((new Date() - date) / 1000);
|
||||||
|
|
||||||
|
var interval = seconds / 31536000;
|
||||||
|
|
||||||
|
if (interval > 1) {
|
||||||
|
return Math.floor(interval) + " years";
|
||||||
|
}
|
||||||
|
interval = seconds / 2592000;
|
||||||
|
if (interval > 1) {
|
||||||
|
return Math.floor(interval) + " months";
|
||||||
|
}
|
||||||
|
interval = seconds / 86400;
|
||||||
|
if (interval > 1) {
|
||||||
|
return Math.floor(interval) + " days";
|
||||||
|
}
|
||||||
|
interval = seconds / 3600;
|
||||||
|
if (interval > 1) {
|
||||||
|
return Math.floor(interval) + " hours";
|
||||||
|
}
|
||||||
|
interval = seconds / 60;
|
||||||
|
if (interval > 1) {
|
||||||
|
return Math.floor(interval) + " minutes";
|
||||||
|
}
|
||||||
|
return Math.floor(seconds) + " seconds";
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
extends ../layout/project.pug
|
extends ../layout/project.pug
|
||||||
block root
|
block root
|
||||||
- var title = 'blek! Bin'
|
- var title = 'blek! Bin'
|
||||||
|
include ../lib/since.pug
|
||||||
|
|
||||||
block append content
|
block append content
|
||||||
h2 blek! Bin
|
h2 blek! Bin
|
||||||
|
@ -17,5 +18,6 @@ block append content
|
||||||
a(href='https://github.com/hnhx/librebin') Librebin
|
a(href='https://github.com/hnhx/librebin') Librebin
|
||||||
| , which is built on bare PHP and the code is barely readable or maintainable.
|
| , which is built on bare PHP and the code is barely readable or maintainable.
|
||||||
br
|
br
|
||||||
| Also, Librebin has only 8 commits and the last commit was on May 30 2022 (at this moment).
|
| Also, Librebin has only 8 commits and the last commit was on May 30 2022 (at this moment), or
|
||||||
|
span(style='background:#30303010;padding:2px 4px;border:1px solid #c2c4c2;font-size:10pt;border-radius:8px')
|
||||||
|
| #{TimeSince(new Date(2022, 6, 30))} ago
|
Loading…
Reference in New Issue