[chore] little frontend tweaks

This commit is contained in:
tobi 2025-03-02 10:27:39 +01:00
commit 410fbf3dc6
4 changed files with 18 additions and 22 deletions

View file

@ -182,22 +182,19 @@ Array.from(document.getElementsByClassName("plyr-video")).forEach((video) => {
video._plyrContainer = player.elements.container; video._plyrContainer = player.elements.container;
}); });
document.addEventListener('DOMContentLoaded', () => { Array.from(document.getElementsByTagName('time')).forEach(timeTag => {
const timeTags = document.getElementsByTagName('time'); const datetime = timeTag.getAttribute('datetime');
Array.from(timeTags).forEach(timeTag => { const currentText = timeTag.textContent.trim();
const datetime = timeTag.getAttribute('datetime'); // Only format if current text contains precise time
const currentText = timeTag.textContent.trim(); if (currentText.match(/\d{2}:\d{2}/)) {
// Only format if current text contains precise time const date = new Date(datetime);
if (currentText.match(/\d{2}:\d{2}/)) { timeTag.textContent = date.toLocaleString(undefined, {
const date = new Date(datetime); year: 'numeric',
timeTag.textContent = date.toLocaleString(undefined, { month: 'short',
year: 'numeric', day: '2-digit',
month: 'short', hour: '2-digit',
day: '2-digit', minute: '2-digit',
hour: '2-digit', hour12: false
minute: '2-digit', });
hour12: false }
});
}
});
}); });

View file

@ -180,7 +180,7 @@
{{- end }} {{- end }}
{{- end }} {{- end }}
</dl> </dl>
<a class="u-url u-uid" rel="me" href="/@{{- .account.Username -}}" class="hidden"></a> <a class="u-url u-uid hidden" rel="me" href="/@{{- .account.Username -}}"></a>
</div> </div>
</section> </section>
<div class="column-split"> <div class="column-split">

View file

@ -52,5 +52,4 @@
id="{{- .ID -}}{{- if .Pinned -}}-pinned{{- end -}}" id="{{- .ID -}}{{- if .Pinned -}}-pinned{{- end -}}"
role="region" role="region"
aria-label="{{- template "ariaLabel" . -}}" aria-label="{{- template "ariaLabel" . -}}"
class="status expanded h-entry"
{{- end }} {{- end }}

View file

@ -23,14 +23,14 @@
<div class="stats-item published-at text-cutoff"> <div class="stats-item published-at text-cutoff">
<dt class="sr-only">Published</dt> <dt class="sr-only">Published</dt>
<dd> <dd>
<time class="dt-published" datetime="{{- .CreatedAt -}}">{{- .CreatedAt -}}</time> <time class="dt-published" datetime="{{- .CreatedAt -}}">{{- .CreatedAt | timestampPrecise -}}</time>
</dd> </dd>
</div> </div>
{{- if .EditedAt -}} {{- if .EditedAt -}}
<div class="stats-item edited-at text-cutoff"> <div class="stats-item edited-at text-cutoff">
<dt class="sr-only">Edited</dt> <dt class="sr-only">Edited</dt>
<dd> <dd>
(edited <time class="dt-updated" datetime="{{- .EditedAt -}}">{{- .EditedAt -}}</time>) (edited <time class="dt-updated" datetime="{{- .EditedAt -}}">{{- .EditedAt | timestampPrecise -}}</time>)
</dd> </dd>
</div> </div>
{{ end }} {{ end }}