Show More
@@ -23,6 +23,15 b'' | |||||
23 | for the JavaScript code in this page. |
|
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 | * An email is a hidden file to prevent spam bots from posting. It has to be |
|
36 | * An email is a hidden file to prevent spam bots from posting. It has to be | |
28 | * hidden. |
|
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 | $( document ).ready(function() { |
|
78 | $( document ).ready(function() { | |
44 | hideEmailFromForm(); |
|
79 | hideEmailFromForm(); | |
45 |
|
80 | |||
@@ -53,4 +88,6 b' function highlightCode(node) {' | |||||
53 | addRefLinkPreview(); |
|
88 | addRefLinkPreview(); | |
54 |
|
89 | |||
55 | highlightCode($(document)); |
|
90 | highlightCode($(document)); | |
|
91 | ||||
|
92 | translate_time(null); | |||
56 | }); |
|
93 | }); |
@@ -52,6 +52,7 b' function showPostPreview(e) {' | |||||
52 |
|
52 | |||
53 | highlightCode($(cln)); |
|
53 | highlightCode($(cln)); | |
54 | addRefLinkPreview(cln); |
|
54 | addRefLinkPreview(cln); | |
|
55 | translate_time($(cln)); | |||
55 | }; |
|
56 | }; | |
56 |
|
57 | |||
57 |
|
58 |
@@ -140,7 +140,7 b' function updatePost(postHtml) {' | |||||
140 | showNewPostsTitle(1); |
|
140 | showNewPostsTitle(1); | |
141 |
|
141 | |||
142 | lastUpdate = post.children('.post-info').first() |
|
142 | lastUpdate = post.children('.post-info').first() | |
143 |
.children('.pub_time').first(). |
|
143 | .children('.pub_time').first().html(); | |
144 |
|
144 | |||
145 | if (bottom) { |
|
145 | if (bottom) { | |
146 | scrollToBottom(); |
|
146 | scrollToBottom(); | |
@@ -195,7 +195,8 b' function updateMetadataPanel(lastUpdate)' | |||||
195 |
|
195 | |||
196 | if (lastUpdate !== '') { |
|
196 | if (lastUpdate !== '') { | |
197 | var lastUpdateField = $('#last-update'); |
|
197 | var lastUpdateField = $('#last-update'); | |
198 |
lastUpdateField. |
|
198 | lastUpdateField.html(lastUpdate); | |
|
199 | translate_time(lastUpdateField); | |||
199 | blink(lastUpdateField); |
|
200 | blink(lastUpdateField); | |
200 | } |
|
201 | } | |
201 |
|
202 | |||
@@ -305,6 +306,7 b' function showAsErrors(form, text) {' | |||||
305 | function processNewPost(post) { |
|
306 | function processNewPost(post) { | |
306 | addRefLinkPreview(post[0]); |
|
307 | addRefLinkPreview(post[0]); | |
307 | highlightCode(post); |
|
308 | highlightCode(post); | |
|
309 | translate_time(post); | |||
308 | blink(post); |
|
310 | blink(post); | |
309 | } |
|
311 | } | |
310 |
|
312 |
@@ -18,7 +18,7 b'' | |||||
18 | onclick="javascript:addQuickReply('{{ post.id }}'); return false;" |
|
18 | onclick="javascript:addQuickReply('{{ post.id }}'); return false;" | |
19 | title="{% trans 'Quote' %}" {% endif %}>({{ post.get_absolute_id }})</a> |
|
19 | title="{% trans 'Quote' %}" {% endif %}>({{ post.get_absolute_id }})</a> | |
20 | <span class="title">{{ post.title }}</span> |
|
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 | {% comment %} |
|
22 | {% comment %} | |
23 | Thread death time needs to be shown only if the thread is alredy archived |
|
23 | Thread death time needs to be shown only if the thread is alredy archived | |
24 | and this is an opening post (thread death time) or a post for popup |
|
24 | and this is an opening post (thread death time) or a post for popup | |
@@ -68,7 +68,7 b'' | |||||
68 | <div class="message"> |
|
68 | <div class="message"> | |
69 | {% autoescape off %} |
|
69 | {% autoescape off %} | |
70 | {% if truncated %} |
|
70 | {% if truncated %} | |
71 |
{{ post.get_text|truncatewords_html:50 |
|
71 | {{ post.get_text|truncatewords_html:50 }} | |
72 | {% else %} |
|
72 | {% else %} | |
73 | {{ post.get_text }} |
|
73 | {{ post.get_text }} | |
74 | {% endif %} |
|
74 | {% endif %} |
@@ -127,7 +127,7 b'' | |||||
127 | <div class="post-form"> |
|
127 | <div class="post-form"> | |
128 | <div class="form-title">{% trans "Create new thread" %}</div> |
|
128 | <div class="form-title">{% trans "Create new thread" %}</div> | |
129 | <div class="swappable-form-full"> |
|
129 | <div class="swappable-form-full"> | |
130 | <form enctype="multipart/form-data" method="post"id="form">{% csrf_token %} |
|
130 | <form enctype="multipart/form-data" method="post" id="form">{% csrf_token %} | |
131 | {{ form.as_div }} |
|
131 | {{ form.as_div }} | |
132 | <div class="form-submit"> |
|
132 | <div class="form-submit"> | |
133 | <input type="submit" value="{% trans "Post" %}"/> |
|
133 | <input type="submit" value="{% trans "Post" %}"/> |
@@ -85,7 +85,7 b'' | |||||
85 | <button id="autoupdate">{% trans 'Update' %}</button> |
|
85 | <button id="autoupdate">{% trans 'Update' %}</button> | |
86 | <span id="reply-count">{{ thread.get_reply_count }}</span>/{{ max_replies }} {% trans 'messages' %}, |
|
86 | <span id="reply-count">{{ thread.get_reply_count }}</span>/{{ max_replies }} {% trans 'messages' %}, | |
87 | <span id="image-count">{{ thread.get_images_count }}</span> {% trans 'images' %}. |
|
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 | [<a href="rss/">RSS</a>] |
|
89 | [<a href="rss/">RSS</a>] | |
90 | {% endcache %} |
|
90 | {% endcache %} | |
91 | </span> |
|
91 | </span> |
@@ -58,7 +58,7 b'' | |||||
58 | <span id="reply-count">{{ thread.get_reply_count }}</span>/{{ max_replies }} |
|
58 | <span id="reply-count">{{ thread.get_reply_count }}</span>/{{ max_replies }} | |
59 | {% trans 'messages' %}, |
|
59 | {% trans 'messages' %}, | |
60 | <span id="image-count">{{ thread.get_images_count }}</span> {% trans 'images' %}. |
|
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 | [<a href="rss/">RSS</a>] |
|
62 | [<a href="rss/">RSS</a>] | |
63 | {% endcache %} |
|
63 | {% endcache %} | |
64 | </span> |
|
64 | </span> |
General Comments 0
You need to be logged in to leave comments.
Login now