full historical timestamps on chat (not doing it for new messages for performance reasons)

pull/228/head
Aevann 2024-06-27 17:01:06 +03:00
parent 60f7f8cf0c
commit c466a01608
2 changed files with 4 additions and 4 deletions

View File

@ -1,9 +1,9 @@
function formatDate(d) {
function formatSmallerDate(d) {
return d.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})
}
for (const e of timestamps) {
e.innerHTML = formatDate(new Date(e.dataset.time*1000));
e.innerHTML = formatSmallerDate(new Date(e.dataset.time*1000));
};
const ua = window.navigator.userAgent
@ -87,7 +87,7 @@ socket.on('speak', function(json) {
document.getElementsByClassName('user_id')[0].value = json.user_id
document.getElementsByClassName('time')[0].innerHTML = formatDate(new Date(json.created_utc*1000))
document.getElementsByClassName('time')[0].innerHTML = formatSmallerDate(new Date(json.created_utc*1000))
}
document.getElementsByClassName('chat-line')[0].id = json.id

View File

@ -285,7 +285,7 @@
</div>
<span {% if m and m.patron %}class="username patron" style="background-color:#{{m.namecolor}}"{% else %}class="username"{% endif %} {% if m and m.pride_username %}pride_username{% endif %}>{% if m %}{{m.username}}{% endif %}</span>
</a>
<span class="text-black time ml-1 mb-3 text-center" {% if m %}data-time="{{m.created_utc}}"{% endif %}></span>
<span class="text-black time ml-1 mb-3 text-center" {% if m %}data-time="{{m.created_utc}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-nonce="{{g.nonce}}" data-onmouseover="timestamp(this, '{{m.created_utc}}')"{% endif %}></span>
<input hidden class="user_id" {% if m %}value="{{m.user_id}}"{% endif %}>
{% endmacro %}