diff options
Diffstat (limited to 'web')
| -rw-r--r-- | web/source/frontend/index.js | 24 | ||||
| -rw-r--r-- | web/template/profile.tmpl | 2 | ||||
| -rw-r--r-- | web/template/status_attributes.tmpl | 3 | ||||
| -rw-r--r-- | web/template/status_info.tmpl | 4 | ||||
| -rw-r--r-- | web/template/status_poll.tmpl | 4 |
5 files changed, 18 insertions, 19 deletions
diff --git a/web/source/frontend/index.js b/web/source/frontend/index.js index 9ea10a477..310d149ed 100644 --- a/web/source/frontend/index.js +++ b/web/source/frontend/index.js @@ -182,22 +182,22 @@ 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, { +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 }} </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> </section> <div class="column-split"> diff --git a/web/template/status_attributes.tmpl b/web/template/status_attributes.tmpl index b356a76e9..a99775d59 100644 --- a/web/template/status_attributes.tmpl +++ b/web/template/status_attributes.tmpl @@ -18,7 +18,7 @@ */ -}} {{- define "ariaLabel" -}} -@{{ .Account.Acct -}}, {{ timestamp .CreatedAt -}} +@{{ .Account.Acct -}}, {{ .CreatedAt | timestampPrecise -}} (server time) {{- if .LanguageTag -}} , language {{ .LanguageTag.DisplayStr -}} {{- end -}} @@ -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 @@ <div class="stats-item published-at text-cutoff"> <dt class="sr-only">Published</dt> <dd> - <time class="dt-published" datetime="{{- .CreatedAt -}}">{{- .CreatedAt -}}</time> + <time class="dt-published" datetime="{{- .CreatedAt -}}">{{- .CreatedAt | timestampPrecise -}}</time> </dd> </div> {{- if .EditedAt -}} <div class="stats-item edited-at text-cutoff"> <dt class="sr-only">Edited</dt> <dd> - (edited <time class="dt-updated" datetime="{{- .EditedAt -}}">{{- .EditedAt -}}</time>) + (edited <time class="dt-updated" datetime="{{- .EditedAt -}}">{{- .EditedAt | timestampPrecise -}}</time>) </dd> </div> {{ end }} diff --git a/web/template/status_poll.tmpl b/web/template/status_poll.tmpl index 8b3f0c60a..9c2d29166 100644 --- a/web/template/status_poll.tmpl +++ b/web/template/status_poll.tmpl @@ -40,9 +40,9 @@ Poll {{- end -}} {{- if .Poll.Expired -}} - closed <time datetime="{{- .Poll.ExpiresAt -}}">{{- .Poll.ExpiresAt -}}</time> + closed <time datetime="{{- .Poll.ExpiresAt -}}">{{- .Poll.ExpiresAt | timestampPrecise -}}</time> {{- else if .Poll.ExpiresAt -}} - open until <time datetime="{{- .Poll.ExpiresAt -}}">{{- .Poll.ExpiresAt -}}</time> + open until <time datetime="{{- .Poll.ExpiresAt -}}">{{- .Poll.ExpiresAt | timestampPrecise -}}</time> {{- else -}} open forever {{- end -}} |
