Show More
@@ -23,6 +23,15 b'' | |||
|
23 | 23 | for the JavaScript code in this page. |
|
24 | 24 | */ |
|
25 | 25 | |
|
26 | var LOCALE = window.navigator.language; | |
|
27 | var FORMATTER = new Intl.DateTimeFormat( | |
|
28 | LOCALE, | |
|
29 | { | |
|
30 | weekday: 'short', year: 'numeric', month: 'short', day: 'numeric', | |
|
31 | hour: 'numeric', minute: '2-digit', second: '2-digit' | |
|
32 | } | |
|
33 | ); | |
|
34 | ||
|
26 | 35 | /** |
|
27 | 36 | * An email is a hidden file to prevent spam bots from posting. It has to be |
|
28 | 37 | * hidden. |
@@ -40,6 +49,32 b' function highlightCode(node) {' | |||
|
40 | 49 | }); |
|
41 | 50 | } |
|
42 | 51 | |
|
52 | /** | |
|
53 | * Translate timestamps to local ones for all <time> tags inside node. | |
|
54 | */ | |
|
55 | function translate_time(node) { | |
|
56 | var elements; | |
|
57 | ||
|
58 | if (node === null) { | |
|
59 | elements = $('time'); | |
|
60 | } else { | |
|
61 | elements = node.find('time'); | |
|
62 | } | |
|
63 | ||
|
64 | if (!elements.length) { | |
|
65 | return; | |
|
66 | } | |
|
67 | ||
|
68 | elements.each(function() { | |
|
69 | var element = $(this); | |
|
70 | var dateAttr = element.attr('datetime'); | |
|
71 | if (dateAttr) { | |
|
72 | var date = new Date(dateAttr); | |
|
73 | element.text(FORMATTER.format(date)); | |
|
74 | } | |
|
75 | }); | |
|
76 | } | |
|
77 | ||
|
43 | 78 | $( document ).ready(function() { |
|
44 | 79 | hideEmailFromForm(); |
|
45 | 80 | |
@@ -53,4 +88,6 b' function highlightCode(node) {' | |||
|
53 | 88 | addRefLinkPreview(); |
|
54 | 89 | |
|
55 | 90 | highlightCode($(document)); |
|
91 | ||
|
92 | translate_time(null); | |
|
56 | 93 | }); |
@@ -52,6 +52,7 b' function showPostPreview(e) {' | |||
|
52 | 52 | |
|
53 | 53 | highlightCode($(cln)); |
|
54 | 54 | addRefLinkPreview(cln); |
|
55 | translate_time($(cln)); | |
|
55 | 56 | }; |
|
56 | 57 | |
|
57 | 58 |
@@ -140,7 +140,7 b' function updatePost(postHtml) {' | |||
|
140 | 140 | showNewPostsTitle(1); |
|
141 | 141 | |
|
142 | 142 | lastUpdate = post.children('.post-info').first() |
|
143 |
.children('.pub_time').first(). |
|
|
143 | .children('.pub_time').first().html(); | |
|
144 | 144 | |
|
145 | 145 | if (bottom) { |
|
146 | 146 | scrollToBottom(); |
@@ -195,7 +195,8 b' function updateMetadataPanel(lastUpdate)' | |||
|
195 | 195 | |
|
196 | 196 | if (lastUpdate !== '') { |
|
197 | 197 | var lastUpdateField = $('#last-update'); |
|
198 |
lastUpdateField. |
|
|
198 | lastUpdateField.html(lastUpdate); | |
|
199 | translate_time(lastUpdateField); | |
|
199 | 200 | blink(lastUpdateField); |
|
200 | 201 | } |
|
201 | 202 | |
@@ -305,6 +306,7 b' function showAsErrors(form, text) {' | |||
|
305 | 306 | function processNewPost(post) { |
|
306 | 307 | addRefLinkPreview(post[0]); |
|
307 | 308 | highlightCode(post); |
|
309 | translate_time(post); | |
|
308 | 310 | blink(post); |
|
309 | 311 | } |
|
310 | 312 |
@@ -18,7 +18,7 b'' | |||
|
18 | 18 | onclick="javascript:addQuickReply('{{ post.id }}'); return false;" |
|
19 | 19 | title="{% trans 'Quote' %}" {% endif %}>({{ post.get_absolute_id }})</a> |
|
20 | 20 | <span class="title">{{ post.title }}</span> |
|
21 | <span class="pub_time">{{ post.pub_time|date:'r' }}</span> | |
|
21 | <span class="pub_time"><time datetime="{{ post.pub_time|date:'c' }}">{{ post.pub_time|date:'r' }}</time></span> | |
|
22 | 22 | {% comment %} |
|
23 | 23 | Thread death time needs to be shown only if the thread is alredy archived |
|
24 | 24 | and this is an opening post (thread death time) or a post for popup |
@@ -68,7 +68,7 b'' | |||
|
68 | 68 | <div class="message"> |
|
69 | 69 | {% autoescape off %} |
|
70 | 70 | {% if truncated %} |
|
71 |
{{ post.get_text|truncatewords_html:50 |
|
|
71 | {{ post.get_text|truncatewords_html:50 }} | |
|
72 | 72 | {% else %} |
|
73 | 73 | {{ post.get_text }} |
|
74 | 74 | {% endif %} |
@@ -85,7 +85,7 b'' | |||
|
85 | 85 | <button id="autoupdate">{% trans 'Update' %}</button> |
|
86 | 86 | <span id="reply-count">{{ thread.get_reply_count }}</span>/{{ max_replies }} {% trans 'messages' %}, |
|
87 | 87 | <span id="image-count">{{ thread.get_images_count }}</span> {% trans 'images' %}. |
|
88 | {% trans 'Last update: ' %}<span id="last-update">{{ thread.last_edit_time|date:'r' }}</span> | |
|
88 | {% trans 'Last update: ' %}<span id="last-update"><time datetime="{{ thread.last_edit_time|date:'c' }}">{{ thread.last_edit_time|date:'r' }}</time></span> | |
|
89 | 89 | [<a href="rss/">RSS</a>] |
|
90 | 90 | {% endcache %} |
|
91 | 91 | </span> |
@@ -58,7 +58,7 b'' | |||
|
58 | 58 | <span id="reply-count">{{ thread.get_reply_count }}</span>/{{ max_replies }} |
|
59 | 59 | {% trans 'messages' %}, |
|
60 | 60 | <span id="image-count">{{ thread.get_images_count }}</span> {% trans 'images' %}. |
|
61 | {% trans 'Last update: ' %}{{ thread.last_edit_time|date:'r' }} | |
|
61 | {% trans 'Last update: ' %}<time datetime="{{ thread.last_edit_time|date:'c' }}">{{ thread.last_edit_time|date:'r' }}</time> | |
|
62 | 62 | [<a href="rss/">RSS</a>] |
|
63 | 63 | {% endcache %} |
|
64 | 64 | </span> |
General Comments 0
You need to be logged in to leave comments.
Login now