Show More
@@ -1,93 +1,99 b'' | |||
|
1 | 1 | /* |
|
2 | 2 | @licstart The following is the entire license notice for the |
|
3 | 3 | JavaScript code in this page. |
|
4 | 4 | |
|
5 | 5 | |
|
6 | 6 | Copyright (C) 2013 neko259 |
|
7 | 7 | |
|
8 | 8 | The JavaScript code in this page is free software: you can |
|
9 | 9 | redistribute it and/or modify it under the terms of the GNU |
|
10 | 10 | General Public License (GNU GPL) as published by the Free Software |
|
11 | 11 | Foundation, either version 3 of the License, or (at your option) |
|
12 | 12 | any later version. The code is distributed WITHOUT ANY WARRANTY; |
|
13 | 13 | without even the implied warranty of MERCHANTABILITY or FITNESS |
|
14 | 14 | FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. |
|
15 | 15 | |
|
16 | 16 | As additional permission under GNU GPL version 3 section 7, you |
|
17 | 17 | may distribute non-source (e.g., minimized or compacted) forms of |
|
18 | 18 | that code without the copy of the GNU GPL normally required by |
|
19 | 19 | section 4, provided you include this license notice and a URL |
|
20 | 20 | through which recipients can access the Corresponding Source. |
|
21 | 21 | |
|
22 | 22 | @licend The above is the entire license notice |
|
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 | ); | |
|
26 | if (window.Intl) { | |
|
27 | var LOCALE = window.navigator.language; | |
|
28 | var FORMATTER = new Intl.DateTimeFormat( | |
|
29 | LOCALE, | |
|
30 | { | |
|
31 | weekday: 'short', year: 'numeric', month: 'short', day: 'numeric', | |
|
32 | hour: 'numeric', minute: '2-digit', second: '2-digit' | |
|
33 | } | |
|
34 | ); | |
|
35 | } | |
|
34 | 36 | |
|
35 | 37 | /** |
|
36 | 38 | * An email is a hidden file to prevent spam bots from posting. It has to be |
|
37 | 39 | * hidden. |
|
38 | 40 | */ |
|
39 | 41 | function hideEmailFromForm() { |
|
40 | 42 | $('.form-email').parent().parent().hide(); |
|
41 | 43 | } |
|
42 | 44 | |
|
43 | 45 | /** |
|
44 | 46 | * Highlight code blocks with code highlighter |
|
45 | 47 | */ |
|
46 | 48 | function highlightCode(node) { |
|
47 | 49 | node.find('pre code').each(function(i, e) { |
|
48 | 50 | hljs.highlightBlock(e); |
|
49 | 51 | }); |
|
50 | 52 | } |
|
51 | 53 | |
|
52 | 54 | /** |
|
53 | 55 | * Translate timestamps to local ones for all <time> tags inside node. |
|
54 | 56 | */ |
|
55 | 57 | function translate_time(node) { |
|
58 | if (window.Intl === null) { | |
|
59 | return; | |
|
60 | } | |
|
61 | ||
|
56 | 62 | var elements; |
|
57 | 63 | |
|
58 | 64 | if (node === null) { |
|
59 | 65 | elements = $('time'); |
|
60 | 66 | } else { |
|
61 | 67 | elements = node.find('time'); |
|
62 | 68 | } |
|
63 | 69 | |
|
64 | 70 | if (!elements.length) { |
|
65 | 71 | return; |
|
66 | 72 | } |
|
67 | 73 | |
|
68 | 74 | elements.each(function() { |
|
69 | 75 | var element = $(this); |
|
70 | 76 | var dateAttr = element.attr('datetime'); |
|
71 | 77 | if (dateAttr) { |
|
72 | 78 | var date = new Date(dateAttr); |
|
73 | 79 | element.text(FORMATTER.format(date)); |
|
74 | 80 | } |
|
75 | 81 | }); |
|
76 | 82 | } |
|
77 | 83 | |
|
78 | 84 | $( document ).ready(function() { |
|
79 | 85 | hideEmailFromForm(); |
|
80 | 86 | |
|
81 | 87 | $("a[href='#top']").click(function() { |
|
82 | 88 | $("html, body").animate({ scrollTop: 0 }, "slow"); |
|
83 | 89 | return false; |
|
84 | 90 | }); |
|
85 | 91 | |
|
86 | 92 | addImgPreview(); |
|
87 | 93 | |
|
88 | 94 | addRefLinkPreview(); |
|
89 | 95 | |
|
90 | 96 | highlightCode($(document)); |
|
91 | 97 | |
|
92 | 98 | translate_time(null); |
|
93 | 99 | }); |
@@ -1,97 +1,97 b'' | |||
|
1 | 1 | {% load i18n %} |
|
2 | 2 | {% load board %} |
|
3 | 3 | {% load cache %} |
|
4 | 4 | |
|
5 | 5 | {% get_current_language as LANGUAGE_CODE %} |
|
6 | 6 | |
|
7 | 7 | {% if thread.archived %} |
|
8 | 8 | <div class="post archive_post" id="{{ post.id }}"> |
|
9 | 9 | {% elif bumpable %} |
|
10 | 10 | <div class="post" id="{{ post.id }}"> |
|
11 | 11 | {% else %} |
|
12 | 12 | <div class="post dead_post" id="{{ post.id }}"> |
|
13 | 13 | {% endif %} |
|
14 | 14 | |
|
15 | 15 | <div class="post-info"> |
|
16 | 16 | <a class="post_id" href="{{ post.get_url }}" |
|
17 | 17 | {% if not truncated and not thread.archived %} |
|
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 | 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 |
|
25 | 25 | (we don't see OP here so we show the death time in the post itself). |
|
26 | 26 | {% endcomment %} |
|
27 | 27 | {% if thread.archived %} |
|
28 | 28 | {% if is_opening %} |
|
29 | β {{ thread.bump_time }} | |
|
29 | β <time datetime="{{ thread.bump_time|date:'c' }}">{{ thread.bump_time|date:'r' }}</time> | |
|
30 | 30 | {% endif %} |
|
31 | 31 | {% endif %} |
|
32 | 32 | {% if is_opening and need_open_link %} |
|
33 | 33 | {% if thread.archived %} |
|
34 | 34 | [<a class="link" href="{% url 'thread' post.id %}">{% trans "Open" %}</a>] |
|
35 | 35 | {% else %} |
|
36 | 36 | [<a class="link" href="{% url 'thread' post.id %}#form">{% trans "Reply" %}</a>] |
|
37 | 37 | {% endif %} |
|
38 | 38 | {% endif %} |
|
39 | 39 | |
|
40 | 40 | {% if moderator %} |
|
41 | 41 | <span class="moderator_info"> |
|
42 | 42 | [<a href="{% url 'admin:boards_post_change' post.id %}">{% trans 'Edit' %}</a>] |
|
43 | 43 | {% if is_opening %} |
|
44 | 44 | [<a href="{% url 'admin:boards_thread_change' thread.id %}">{% trans 'Edit thread' %}</a>] |
|
45 | 45 | {% endif %} |
|
46 | 46 | </span> |
|
47 | 47 | {% endif %} |
|
48 | 48 | </div> |
|
49 | 49 | {% comment %} |
|
50 | 50 | Post images. Currently only 1 image can be posted and shown, but post model |
|
51 | 51 | supports multiple. |
|
52 | 52 | {% endcomment %} |
|
53 | 53 | {% if post.images.exists %} |
|
54 | 54 | {% with post.images.all.0 as image %} |
|
55 | 55 | {% autoescape off %} |
|
56 | 56 | {{ image.get_view }} |
|
57 | 57 | {% endautoescape %} |
|
58 | 58 | {% endwith %} |
|
59 | 59 | {% endif %} |
|
60 | 60 | {% comment %} |
|
61 | 61 | Post message (text) |
|
62 | 62 | {% endcomment %} |
|
63 | 63 | <div class="message"> |
|
64 | 64 | {% autoescape off %} |
|
65 | 65 | {% if truncated %} |
|
66 | 66 | {{ post.get_text|truncatewords_html:50 }} |
|
67 | 67 | {% else %} |
|
68 | 68 | {{ post.get_text }} |
|
69 | 69 | {% endif %} |
|
70 | 70 | {% endautoescape %} |
|
71 | 71 | {% if post.is_referenced %} |
|
72 | 72 | <div class="refmap"> |
|
73 | 73 | {% autoescape off %} |
|
74 | 74 | {% trans "Replies" %}: {{ post.refmap }} |
|
75 | 75 | {% endautoescape %} |
|
76 | 76 | </div> |
|
77 | 77 | {% endif %} |
|
78 | 78 | </div> |
|
79 | 79 | {% comment %} |
|
80 | 80 | Thread metadata: counters, tags etc |
|
81 | 81 | {% endcomment %} |
|
82 | 82 | {% if is_opening %} |
|
83 | 83 | <div class="metadata"> |
|
84 | 84 | {% if is_opening and need_open_link %} |
|
85 | 85 | {{ thread.get_reply_count }} {% trans 'messages' %}, |
|
86 | 86 | {{ thread.get_images_count }} {% trans 'images' %}. |
|
87 | 87 | {% endif %} |
|
88 | 88 | <span class="tags"> |
|
89 | 89 | {% autoescape off %} |
|
90 | 90 | {% for tag in thread.get_tags %} |
|
91 | 91 | {{ tag.get_view }}{% if not forloop.last %},{% endif %} |
|
92 | 92 | {% endfor %} |
|
93 | 93 | {% endautoescape %} |
|
94 | 94 | </span> |
|
95 | 95 | </div> |
|
96 | 96 | {% endif %} |
|
97 | 97 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now