From 410fbf3dc6d890438edd0a16dfe4b2c61408cefc Mon Sep 17 00:00:00 2001 From: tobi Date: Sun, 2 Mar 2025 10:27:39 +0100 Subject: [PATCH] [chore] little frontend tweaks --- web/source/frontend/index.js | 33 +++++++++++++---------------- web/template/profile.tmpl | 2 +- web/template/status_attributes.tmpl | 1 - web/template/status_info.tmpl | 4 ++-- 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/web/source/frontend/index.js b/web/source/frontend/index.js index 9ea10a477..9c7183a58 100644 --- a/web/source/frontend/index.js +++ b/web/source/frontend/index.js @@ -182,22 +182,19 @@ Array.from(document.getElementsByClassName("plyr-video")).forEach((video) => { video._plyrContainer = player.elements.container; }); -document.addEventListener('DOMContentLoaded', () => { - const timeTags = document.getElementsByTagName('time'); - Array.from(timeTags).forEach(timeTag => { - const datetime = timeTag.getAttribute('datetime'); - const currentText = timeTag.textContent.trim(); - // Only format if current text contains precise time - if (currentText.match(/\d{2}:\d{2}/)) { - const date = new Date(datetime); - timeTag.textContent = date.toLocaleString(undefined, { - year: 'numeric', - month: 'short', - day: '2-digit', - hour: '2-digit', - minute: '2-digit', - hour12: false - }); - } - }); +Array.from(document.getElementsByTagName('time')).forEach(timeTag => { + const datetime = timeTag.getAttribute('datetime'); + const currentText = timeTag.textContent.trim(); + // Only format if current text contains precise time + if (currentText.match(/\d{2}:\d{2}/)) { + const date = new Date(datetime); + timeTag.textContent = date.toLocaleString(undefined, { + year: 'numeric', + month: 'short', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + hour12: false + }); + } }); diff --git a/web/template/profile.tmpl b/web/template/profile.tmpl index 0456644c9..7518129cb 100644 --- a/web/template/profile.tmpl +++ b/web/template/profile.tmpl @@ -180,7 +180,7 @@ {{- end }} {{- end }} - +
diff --git a/web/template/status_attributes.tmpl b/web/template/status_attributes.tmpl index b356a76e9..92659b6b2 100644 --- a/web/template/status_attributes.tmpl +++ b/web/template/status_attributes.tmpl @@ -52,5 +52,4 @@ id="{{- .ID -}}{{- if .Pinned -}}-pinned{{- end -}}" role="region" aria-label="{{- template "ariaLabel" . -}}" -class="status expanded h-entry" {{- end }} \ No newline at end of file diff --git a/web/template/status_info.tmpl b/web/template/status_info.tmpl index 2f81591a6..194a799f5 100644 --- a/web/template/status_info.tmpl +++ b/web/template/status_info.tmpl @@ -23,14 +23,14 @@
Published
- +
{{- if .EditedAt -}}
Edited
- (edited ) + (edited )
{{ end }}