Software /
code /
prosody-modules
Annotate
mod_http_muc_log/static/timestamps.js @ 5106:630887a50a7d
mod_http_muc_log: Fix error in js when displaying presence is disabled
When the form is hidden, attempting to index forms[0] throws an error,
however this is harmless since the script is finished by that point.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 04 Dec 2022 22:23:56 +0100 |
parent | 5104:d4b0a995e5e3 |
child | 5109:650d04984e0b |
rev | line source |
---|---|
1582
8e282eb0c70c
mod_http_muc_log: Split out template into a configurable file.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 /* |
8e282eb0c70c
mod_http_muc_log: Split out template into a configurable file.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 * Local timestamps |
8e282eb0c70c
mod_http_muc_log: Split out template into a configurable file.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 */ |
8e282eb0c70c
mod_http_muc_log: Split out template into a configurable file.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 (function () { |
8e282eb0c70c
mod_http_muc_log: Split out template into a configurable file.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 var timeTags = document.getElementsByTagName("time"); |
8e282eb0c70c
mod_http_muc_log: Split out template into a configurable file.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 var i = 0, tag, date; |
8e282eb0c70c
mod_http_muc_log: Split out template into a configurable file.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 while(timeTags[i]) { |
8e282eb0c70c
mod_http_muc_log: Split out template into a configurable file.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 tag = timeTags[i++]; |
8e282eb0c70c
mod_http_muc_log: Split out template into a configurable file.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 if(date = tag.getAttribute("datetime")) { |
8e282eb0c70c
mod_http_muc_log: Split out template into a configurable file.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 date = new Date(date); |
1915
5e65c91c07c4
mod_http_muc_log: Produce local timestamps in local format
Kim Alvefur <zash@zash.se>
parents:
1751
diff
changeset
|
11 tag.textContent = date.toLocaleTimeString(navigator.language); |
1582
8e282eb0c70c
mod_http_muc_log: Split out template into a configurable file.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 tag.setAttribute("title", date.toString()); |
8e282eb0c70c
mod_http_muc_log: Split out template into a configurable file.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 } |
8e282eb0c70c
mod_http_muc_log: Split out template into a configurable file.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 } |
5106
630887a50a7d
mod_http_muc_log: Fix error in js when displaying presence is disabled
Kim Alvefur <zash@zash.se>
parents:
5104
diff
changeset
|
15 if(document.forms.length>0){ |
3485
181561d0aae5
mod_http_muc_log: Add functionality for hiding joins and parts
Kim Alvefur <zash@zash.se>
parents:
2083
diff
changeset
|
16 document.forms[0].elements.p.addEventListener("change", function() { |
181561d0aae5
mod_http_muc_log: Add functionality for hiding joins and parts
Kim Alvefur <zash@zash.se>
parents:
2083
diff
changeset
|
17 document.forms[0].submit(); |
5106
630887a50a7d
mod_http_muc_log: Fix error in js when displaying presence is disabled
Kim Alvefur <zash@zash.se>
parents:
5104
diff
changeset
|
18 } |
3485
181561d0aae5
mod_http_muc_log: Add functionality for hiding joins and parts
Kim Alvefur <zash@zash.se>
parents:
2083
diff
changeset
|
19 }); |
1582
8e282eb0c70c
mod_http_muc_log: Split out template into a configurable file.
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 })(); |
5104
d4b0a995e5e3
mod_http_muc_log: Move CSS and JS out of template
Kim Alvefur <zash@zash.se>
parents:
4990
diff
changeset
|
21 |