Show More
@@ -1,85 +1,85 b'' | |||||
1 | /* |
|
1 | /* | |
2 | @licstart The following is the entire license notice for the |
|
2 | @licstart The following is the entire license notice for the | |
3 | JavaScript code in this page. |
|
3 | JavaScript code in this page. | |
4 |
|
4 | |||
5 |
|
5 | |||
6 | Copyright (C) 2013 neko259 |
|
6 | Copyright (C) 2013 neko259 | |
7 |
|
7 | |||
8 | The JavaScript code in this page is free software: you can |
|
8 | The JavaScript code in this page is free software: you can | |
9 | redistribute it and/or modify it under the terms of the GNU |
|
9 | redistribute it and/or modify it under the terms of the GNU | |
10 | General Public License (GNU GPL) as published by the Free Software |
|
10 | General Public License (GNU GPL) as published by the Free Software | |
11 | Foundation, either version 3 of the License, or (at your option) |
|
11 | Foundation, either version 3 of the License, or (at your option) | |
12 | any later version. The code is distributed WITHOUT ANY WARRANTY; |
|
12 | any later version. The code is distributed WITHOUT ANY WARRANTY; | |
13 | without even the implied warranty of MERCHANTABILITY or FITNESS |
|
13 | without even the implied warranty of MERCHANTABILITY or FITNESS | |
14 | FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. |
|
14 | FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. | |
15 |
|
15 | |||
16 | As additional permission under GNU GPL version 3 section 7, you |
|
16 | As additional permission under GNU GPL version 3 section 7, you | |
17 | may distribute non-source (e.g., minimized or compacted) forms of |
|
17 | may distribute non-source (e.g., minimized or compacted) forms of | |
18 | that code without the copy of the GNU GPL normally required by |
|
18 | that code without the copy of the GNU GPL normally required by | |
19 | section 4, provided you include this license notice and a URL |
|
19 | section 4, provided you include this license notice and a URL | |
20 | through which recipients can access the Corresponding Source. |
|
20 | through which recipients can access the Corresponding Source. | |
21 |
|
21 | |||
22 | @licend The above is the entire license notice |
|
22 | @licend The above is the entire license notice | |
23 | for the JavaScript code in this page. |
|
23 | for the JavaScript code in this page. | |
24 | */ |
|
24 | */ | |
25 |
|
25 | |||
26 | var $html = $("html, body"); |
|
26 | var $html = $("html, body"); | |
27 |
|
27 | |||
28 | function moveCaretToEnd(el) { |
|
28 | function moveCaretToEnd(el) { | |
29 | if (typeof el.selectionStart == "number") { |
|
29 | if (typeof el.selectionStart == "number") { | |
30 | el.selectionStart = el.selectionEnd = el.value.length; |
|
30 | el.selectionStart = el.selectionEnd = el.value.length; | |
31 | } else if (typeof el.createTextRange != "undefined") { |
|
31 | } else if (typeof el.createTextRange != "undefined") { | |
32 | el.focus(); |
|
32 | el.focus(); | |
33 | var range = el.createTextRange(); |
|
33 | var range = el.createTextRange(); | |
34 | range.collapse(false); |
|
34 | range.collapse(false); | |
35 | range.select(); |
|
35 | range.select(); | |
36 | } |
|
36 | } | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | function getForm() { |
|
39 | function getForm() { | |
40 | return $('.post-form-w'); |
|
40 | return $('.post-form-w'); | |
41 | } |
|
41 | } | |
42 |
|
42 | |||
43 | function closeForm() { |
|
43 | function closeForm() { | |
44 | var form = getForm(); |
|
44 | var form = getForm(); | |
45 | form.hide(); |
|
45 | //form.hide(); | |
46 | form.insertAfter($('.thread')); |
|
46 | form.insertAfter($('.thread')); | |
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 | function addQuickReply(postId) { |
|
49 | function addQuickReply(postId) { | |
50 | var textToAdd = ''; |
|
50 | var textToAdd = ''; | |
51 | var blockToInsert = null; |
|
51 | var blockToInsert = null; | |
52 |
|
52 | |||
53 | if (postId != null) { |
|
53 | if (postId != null) { | |
54 | var post = $('#' + postId); |
|
54 | var post = $('#' + postId); | |
55 |
|
55 | |||
56 | // If this is not OP, add reflink to the post |
|
56 | // If this is not OP, add reflink to the post | |
57 | if (!post.is(':first-child')) { |
|
57 | if (!post.is(':first-child')) { | |
58 | textToAdd += '[post]' + postId + '[/post]\n'; |
|
58 | textToAdd += '[post]' + postId + '[/post]\n'; | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | blockToInsert = post; |
|
61 | blockToInsert = post; | |
62 | } else { |
|
62 | } else { | |
63 | blockToInsert = $('.thread'); |
|
63 | blockToInsert = $('.thread'); | |
64 | } |
|
64 | } | |
65 |
|
65 | |||
66 | var selection = window.getSelection().toString(); |
|
66 | var selection = window.getSelection().toString(); | |
67 | if (selection.length > 0) { |
|
67 | if (selection.length > 0) { | |
68 | textToAdd += '[quote]' + selection + '[/quote]\n'; |
|
68 | textToAdd += '[quote]' + selection + '[/quote]\n'; | |
69 | } |
|
69 | } | |
70 |
|
70 | |||
71 | var textAreaId = 'textarea'; |
|
71 | var textAreaId = 'textarea'; | |
72 | $(textAreaId).val($(textAreaId).val()+ textToAdd); |
|
72 | $(textAreaId).val($(textAreaId).val()+ textToAdd); | |
73 |
|
73 | |||
74 | var form = getForm(); |
|
74 | var form = getForm(); | |
75 | form.insertAfter(blockToInsert); |
|
75 | form.insertAfter(blockToInsert); | |
76 | form.show(); |
|
76 | form.show(); | |
77 |
|
77 | |||
78 | var textarea = document.getElementsByTagName('textarea')[0]; |
|
78 | var textarea = document.getElementsByTagName('textarea')[0]; | |
79 | $(textAreaId).focus(); |
|
79 | $(textAreaId).focus(); | |
80 | moveCaretToEnd(textarea); |
|
80 | moveCaretToEnd(textarea); | |
81 | } |
|
81 | } | |
82 |
|
82 | |||
83 | function scrollToBottom() { |
|
83 | function scrollToBottom() { | |
84 | $html.animate({scrollTop: $html.height()}, "fast"); |
|
84 | $html.animate({scrollTop: $html.height()}, "fast"); | |
85 | } |
|
85 | } |
@@ -1,91 +1,95 b'' | |||||
1 | {% load i18n %} |
|
1 | {% load i18n %} | |
2 | {% load board %} |
|
2 | {% load board %} | |
3 | {% load cache %} |
|
3 | {% load cache %} | |
4 |
|
4 | |||
5 | {% get_current_language as LANGUAGE_CODE %} |
|
5 | {% get_current_language as LANGUAGE_CODE %} | |
6 |
|
6 | |||
7 | {% if thread.archived %} |
|
7 | {% if thread.archived %} | |
8 | <div class="post archive_post" id="{{ post.id }}"> |
|
8 | <div class="post archive_post" id="{{ post.id }}"> | |
9 | {% elif bumpable %} |
|
9 | {% elif bumpable %} | |
10 | <div class="post" id="{{ post.id }}"> |
|
10 | <div class="post" id="{{ post.id }}"> | |
11 | {% else %} |
|
11 | {% else %} | |
12 | <div class="post dead_post" id="{{ post.id }}"> |
|
12 | <div class="post dead_post" id="{{ post.id }}"> | |
13 | {% endif %} |
|
13 | {% endif %} | |
14 |
|
14 | |||
15 | <div class="post-info"> |
|
15 | <div class="post-info"> | |
16 | <a class="post_id" href="{{ post.get_url }}">({{ post.get_absolute_id }})</a> |
|
16 | <a class="post_id" href="{{ post.get_url }}">({{ post.get_absolute_id }})</a> | |
17 | <span class="title">{{ post.title }}</span> |
|
17 | <span class="title">{{ post.title }}</span> | |
18 | <span class="pub_time"><time datetime="{{ post.pub_time|date:'c' }}">{{ post.pub_time|date:'r' }}</time></span> |
|
18 | <span class="pub_time"><time datetime="{{ post.pub_time|date:'c' }}">{{ post.pub_time|date:'r' }}</time></span> | |
19 | {% comment %} |
|
19 | {% comment %} | |
20 | Thread death time needs to be shown only if the thread is alredy archived |
|
20 | Thread death time needs to be shown only if the thread is alredy archived | |
21 | and this is an opening post (thread death time) or a post for popup |
|
21 | and this is an opening post (thread death time) or a post for popup | |
22 | (we don't see OP here so we show the death time in the post itself). |
|
22 | (we don't see OP here so we show the death time in the post itself). | |
23 | {% endcomment %} |
|
23 | {% endcomment %} | |
24 | {% if thread.archived %} |
|
24 | {% if thread.archived %} | |
25 | {% if is_opening %} |
|
25 | {% if is_opening %} | |
26 | β <time datetime="{{ thread.bump_time|date:'c' }}">{{ thread.bump_time|date:'r' }}</time> |
|
26 | β <time datetime="{{ thread.bump_time|date:'c' }}">{{ thread.bump_time|date:'r' }}</time> | |
27 | {% endif %} |
|
27 | {% endif %} | |
28 | {% endif %} |
|
28 | {% endif %} | |
29 | {% if is_opening and need_open_link %} |
|
29 | {% if is_opening and need_open_link %} | |
|
30 | {% if thread.archived %} | |||
30 | <a class="link" href="{% url 'thread' post.id %}">{% trans "Open" %}</a> |
|
31 | <a class="link" href="{% url 'thread' post.id %}">{% trans "Open" %}</a> | |
|
32 | {% else %} | |||
|
33 | <a class="link" href="{% url 'thread' post.id %}#form">{% trans "Reply" %}</a> | |||
|
34 | {% endif %} | |||
31 | {% endif %} |
|
35 | {% endif %} | |
32 | {% if reply_link and not thread.archived %} |
|
36 | {% if reply_link and not thread.archived %} | |
33 | <a href="#form" onclick="addQuickReply('{{ post.id }}'); return false;">{% trans 'Reply' %}</a> |
|
37 | <a href="#form" onclick="addQuickReply('{{ post.id }}'); return false;">{% trans 'Reply' %}</a> | |
34 | {% endif %} |
|
38 | {% endif %} | |
35 |
|
39 | |||
36 | {% if moderator %} |
|
40 | {% if moderator %} | |
37 | <span class="moderator_info"> |
|
41 | <span class="moderator_info"> | |
38 | <a href="{% url 'admin:boards_post_change' post.id %}">{% trans 'Edit' %}</a> |
|
42 | <a href="{% url 'admin:boards_post_change' post.id %}">{% trans 'Edit' %}</a> | |
39 | {% if is_opening %} |
|
43 | {% if is_opening %} | |
40 | | <a href="{% url 'admin:boards_thread_change' thread.id %}">{% trans 'Edit thread' %}</a> |
|
44 | | <a href="{% url 'admin:boards_thread_change' thread.id %}">{% trans 'Edit thread' %}</a> | |
41 | {% endif %} |
|
45 | {% endif %} | |
42 | </span> |
|
46 | </span> | |
43 | {% endif %} |
|
47 | {% endif %} | |
44 | </div> |
|
48 | </div> | |
45 | {% comment %} |
|
49 | {% comment %} | |
46 | Post images. Currently only 1 image can be posted and shown, but post model |
|
50 | Post images. Currently only 1 image can be posted and shown, but post model | |
47 | supports multiple. |
|
51 | supports multiple. | |
48 | {% endcomment %} |
|
52 | {% endcomment %} | |
49 | {% if post.images.exists %} |
|
53 | {% if post.images.exists %} | |
50 | {% with post.images.all.0 as image %} |
|
54 | {% with post.images.all.0 as image %} | |
51 | {% autoescape off %} |
|
55 | {% autoescape off %} | |
52 | {{ image.get_view }} |
|
56 | {{ image.get_view }} | |
53 | {% endautoescape %} |
|
57 | {% endautoescape %} | |
54 | {% endwith %} |
|
58 | {% endwith %} | |
55 | {% endif %} |
|
59 | {% endif %} | |
56 | {% comment %} |
|
60 | {% comment %} | |
57 | Post message (text) |
|
61 | Post message (text) | |
58 | {% endcomment %} |
|
62 | {% endcomment %} | |
59 | <div class="message"> |
|
63 | <div class="message"> | |
60 | {% autoescape off %} |
|
64 | {% autoescape off %} | |
61 | {% if truncated %} |
|
65 | {% if truncated %} | |
62 | {{ post.get_text|truncatewords_html:50 }} |
|
66 | {{ post.get_text|truncatewords_html:50 }} | |
63 | {% else %} |
|
67 | {% else %} | |
64 | {{ post.get_text }} |
|
68 | {{ post.get_text }} | |
65 | {% endif %} |
|
69 | {% endif %} | |
66 | {% endautoescape %} |
|
70 | {% endautoescape %} | |
67 | {% if post.is_referenced %} |
|
71 | {% if post.is_referenced %} | |
68 | <div class="refmap"> |
|
72 | <div class="refmap"> | |
69 | {% autoescape off %} |
|
73 | {% autoescape off %} | |
70 | {% trans "Replies" %}: {{ post.refmap }} |
|
74 | {% trans "Replies" %}: {{ post.refmap }} | |
71 | {% endautoescape %} |
|
75 | {% endautoescape %} | |
72 | </div> |
|
76 | </div> | |
73 | {% endif %} |
|
77 | {% endif %} | |
74 | </div> |
|
78 | </div> | |
75 | {% comment %} |
|
79 | {% comment %} | |
76 | Thread metadata: counters, tags etc |
|
80 | Thread metadata: counters, tags etc | |
77 | {% endcomment %} |
|
81 | {% endcomment %} | |
78 | {% if is_opening %} |
|
82 | {% if is_opening %} | |
79 | <div class="metadata"> |
|
83 | <div class="metadata"> | |
80 | {% if is_opening and need_open_link %} |
|
84 | {% if is_opening and need_open_link %} | |
81 | {{ thread.get_reply_count }} {% trans 'messages' %}, |
|
85 | {{ thread.get_reply_count }} {% trans 'messages' %}, | |
82 | {{ thread.get_images_count }} {% trans 'images' %}. |
|
86 | {{ thread.get_images_count }} {% trans 'images' %}. | |
83 | {% endif %} |
|
87 | {% endif %} | |
84 | <span class="tags"> |
|
88 | <span class="tags"> | |
85 | {% autoescape off %} |
|
89 | {% autoescape off %} | |
86 | {{ thread.get_tag_url_list }} |
|
90 | {{ thread.get_tag_url_list }} | |
87 | {% endautoescape %} |
|
91 | {% endautoescape %} | |
88 | </span> |
|
92 | </span> | |
89 | </div> |
|
93 | </div> | |
90 | {% endif %} |
|
94 | {% endif %} | |
91 | </div> |
|
95 | </div> |
@@ -1,68 +1,68 b'' | |||||
1 | {% extends "boards/thread.html" %} |
|
1 | {% extends "boards/thread.html" %} | |
2 |
|
2 | |||
3 | {% load i18n %} |
|
3 | {% load i18n %} | |
4 | {% load cache %} |
|
4 | {% load cache %} | |
5 | {% load static from staticfiles %} |
|
5 | {% load static from staticfiles %} | |
6 | {% load board %} |
|
6 | {% load board %} | |
7 |
|
7 | |||
8 | {% block content %} |
|
8 | {% block content %} | |
9 | {% get_current_language as LANGUAGE_CODE %} |
|
9 | {% get_current_language as LANGUAGE_CODE %} | |
10 |
|
10 | |||
11 | {% cache 600 thread_view thread.id thread.last_edit_time moderator LANGUAGE_CODE %} |
|
11 | {% cache 600 thread_view thread.id thread.last_edit_time moderator LANGUAGE_CODE %} | |
12 |
|
12 | |||
13 | <div class="image-mode-tab"> |
|
13 | <div class="image-mode-tab"> | |
14 | <a class="current_mode" href="{% url 'thread' opening_post.id %}">{% trans 'Normal mode' %}</a>, |
|
14 | <a class="current_mode" href="{% url 'thread' opening_post.id %}">{% trans 'Normal mode' %}</a>, | |
15 | <a href="{% url 'thread_gallery' opening_post.id %}">{% trans 'Gallery mode' %}</a> |
|
15 | <a href="{% url 'thread_gallery' opening_post.id %}">{% trans 'Gallery mode' %}</a> | |
16 | </div> |
|
16 | </div> | |
17 |
|
17 | |||
18 | {% if bumpable and thread.has_post_limit %} |
|
18 | {% if bumpable and thread.has_post_limit %} | |
19 | <div class="bar-bg"> |
|
19 | <div class="bar-bg"> | |
20 | <div class="bar-value" style="width:{{ bumplimit_progress }}%" id="bumplimit_progress"> |
|
20 | <div class="bar-value" style="width:{{ bumplimit_progress }}%" id="bumplimit_progress"> | |
21 | </div> |
|
21 | </div> | |
22 | <div class="bar-text"> |
|
22 | <div class="bar-text"> | |
23 | <span id="left_to_limit">{{ posts_left }}</span> {% trans 'posts to bumplimit' %} |
|
23 | <span id="left_to_limit">{{ posts_left }}</span> {% trans 'posts to bumplimit' %} | |
24 | </div> |
|
24 | </div> | |
25 | </div> |
|
25 | </div> | |
26 | {% endif %} |
|
26 | {% endif %} | |
27 |
|
27 | |||
28 | <div class="thread"> |
|
28 | <div class="thread"> | |
29 | {% for post in thread.get_replies %} |
|
29 | {% for post in thread.get_replies %} | |
30 | {% post_view post moderator=moderator reply_link=True %} |
|
30 | {% post_view post moderator=moderator reply_link=True %} | |
31 | {% endfor %} |
|
31 | {% endfor %} | |
32 | </div> |
|
32 | </div> | |
33 |
|
33 | |||
34 | {% if not thread.archived %} |
|
34 | {% if not thread.archived %} | |
35 | <div class="post-form-w"> |
|
35 | <div class="post-form-w"> | |
36 | <script src="{% static 'js/panel.js' %}"></script> |
|
36 | <script src="{% static 'js/panel.js' %}"></script> | |
37 | <div class="form-title">{% trans "Reply to thread" %} #{{ opening_post.id }}</div> |
|
37 | <div class="form-title">{% trans "Reply to thread" %} #{{ opening_post.id }}</div> | |
38 | <div class="post-form" id="compact-form"> |
|
38 | <div class="post-form" id="compact-form"> | |
39 | <div class="swappable-form-full"> |
|
39 | <div class="swappable-form-full"> | |
40 | <form enctype="multipart/form-data" method="post" id="form">{% csrf_token %} |
|
40 | <form enctype="multipart/form-data" method="post" id="form">{% csrf_token %} | |
41 | <div class="compact-form-text"></div> |
|
41 | <div class="compact-form-text"></div> | |
42 | {{ form.as_div }} |
|
42 | {{ form.as_div }} | |
43 | <div class="form-submit"> |
|
43 | <div class="form-submit"> | |
44 | <input type="submit" value="{% trans "Post" %}"/> |
|
44 | <input type="submit" value="{% trans "Post" %}"/> | |
45 | </div> |
|
45 | </div> | |
46 | (ctrl-enter) |
|
46 | (ctrl-enter) | |
47 | </form> |
|
47 | </form> | |
48 | </div> |
|
48 | </div> | |
49 | <div><a href="{% url "staticpage" name="help" %}"> |
|
49 | <div><a href="{% url "staticpage" name="help" %}"> | |
50 | {% trans 'Text syntax' %}</a></div> |
|
50 | {% trans 'Text syntax' %}</a></div> | |
51 |
<div><a href="#" onClick=" |
|
51 | <div><a href="#" onClick="closeForm(); return false;">{% trans 'Close form' %}</a></div> | |
52 | </div> |
|
52 | </div> | |
53 | </div> |
|
53 | </div> | |
54 |
|
54 | |||
55 | <script src="{% static 'js/jquery.form.min.js' %}"></script> |
|
55 | <script src="{% static 'js/jquery.form.min.js' %}"></script> | |
56 | {% endif %} |
|
56 | {% endif %} | |
57 |
|
57 | |||
58 | <script src="{% static 'js/form.js' %}"></script> |
|
58 | <script src="{% static 'js/form.js' %}"></script> | |
59 | <script src="{% static 'js/thread.js' %}"></script> |
|
59 | <script src="{% static 'js/thread.js' %}"></script> | |
60 | <script src="{% static 'js/thread_update.js' %}"></script> |
|
60 | <script src="{% static 'js/thread_update.js' %}"></script> | |
61 | <script src="{% static 'js/3party/centrifuge.js' %}"></script> |
|
61 | <script src="{% static 'js/3party/centrifuge.js' %}"></script> | |
62 |
|
62 | |||
63 | {% endcache %} |
|
63 | {% endcache %} | |
64 | {% endblock %} |
|
64 | {% endblock %} | |
65 |
|
65 | |||
66 | {% block thread_meta_panel %} |
|
66 | {% block thread_meta_panel %} | |
67 | <button id="autoupdate">{% trans 'Update' %}</button> |
|
67 | <button id="autoupdate">{% trans 'Update' %}</button> | |
68 | {% endblock %} |
|
68 | {% endblock %} |
General Comments 0
You need to be logged in to leave comments.
Login now