aboutsummaryrefslogtreecommitdiff
path: root/assets/js
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2023-10-15 17:17:20 -0400
committertdro <tdro@noreply.example.com>2023-10-15 17:17:20 -0400
commitb196e28e5faad6bf5c73f1bbbc60b8e138c63dfc (patch)
tree9083ba331a1118a7a6ae33649380b4b766242198 /assets/js
parentc6c6d4b5972be57d2505be3251b5930e107c0f0f (diff)
downloadcanory-b196e28e5faad6bf5c73f1bbbc60b8e138c63dfc.tar.gz
canory-b196e28e5faad6bf5c73f1bbbc60b8e138c63dfc.tar.bz2
canory-b196e28e5faad6bf5c73f1bbbc60b8e138c63dfc.zip
static/js/timeago: Allow default pass through
Diffstat (limited to 'assets/js')
-rw-r--r--assets/js/index.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/assets/js/index.js b/assets/js/index.js
index 3d133fd..c2b6fb5 100644
--- a/assets/js/index.js
+++ b/assets/js/index.js
@@ -574,9 +574,6 @@
const view = element.getBoundingClientRect();
return view.top >= -options.offset && view.left >= -options.offset && view.bottom <= (window.innerHeight || self.documentElement.clientHeight) + options.offset && view.right <= (window.innerWidth || self.documentElement.clientWidth) + options.offset;
}
- function tiny(string, place) {
- return string.split(" ").slice(0, place).join(" ") + string.split(" ")[place].charAt(0);
- }
const date = function(update) {
const elements = document.querySelectorAll("time");
for(let i = 0; i < elements.length; ++i){
@@ -593,6 +590,14 @@
const days = Math.round(hours / 24);
const past = Math.sign(seconds) === 1;
const future = Math.sign(seconds) === -1;
+ let tiny = function(string, place) {
+ return string.split(" ").slice(0, place).join(" ") + string.split(" ")[place].charAt(0);
+ };
+ if (element.dataset.type === "default") {
+ tiny = function(string) {
+ return string;
+ };
+ }
if (element.dataset.type === "localDate") {
return element.textContent = new Intl.DateTimeFormat([], {
dateStyle: "medium"