set date on load
Anirudh Oppiliappan x@icyphox.sh
Tue, 08 Nov 2022 20:33:44 +0530
2 files changed,
6 insertions(+),
4 deletions(-)
M
views/honk.html
→
views/honk.html
@@ -27,7 +27,7 @@ <a class="honkerlink" href="/h?xid={{ .Honker }}" data-xid="{{ .Honker }}">{{ .Username }}</a>
{{ else }} <a href="{{ .Honker }}" rel=noreferrer>{{ .Username }}</a> {{ end }} -<span class="clip"><a href="{{ .URL }}" rel=noreferrer>{{ .What }}</a> <span style="float: right;" id="honkdate">{{ .Date.Local.Format "02 Jan 2006 15:04 MST" }}</span> </span> +<span class="clip"><a href="{{ .URL }}" rel=noreferrer>{{ .What }}</a> <span onload="setDate()" style="float: right;" id="honkdate">{{ .Date.Local.Format "02 Jan 2006 15:04 MST" }}</span> </span> {{ if .Oonker }} <br> <span class="left1em clip">
M
views/local.js
→
views/local.js
@@ -18,6 +18,8 @@ return day + " " + month + year;
} } -var honkdate = document.getElementById("honkdate").textContent; -const ts = Date.parse(honkdate); -honkdate.textContent = timeSince(ts); +function setDate() { + var honkdate = document.getElementById("honkdate").textContent; + const ts = Date.parse(honkdate); + honkdate.textContent = timeSince(ts); +}