Show More
@@ -4,6 +4,7 b' var MIN_INPUT_LENGTH = 3;' | |||||
4 | var URL_DELIMITER = '\n'; |
|
4 | var URL_DELIMITER = '\n'; | |
5 | // TODO This needs to be the same for attachment download time limit. |
|
5 | // TODO This needs to be the same for attachment download time limit. | |
6 | var POST_AJAX_TIMEOUT = 30000; |
|
6 | var POST_AJAX_TIMEOUT = 30000; | |
|
7 | var REPLY_TO_MSG = '.reply-to-message'; | |||
7 |
|
8 | |||
8 | var pastedImages = []; |
|
9 | var pastedImages = []; | |
9 |
|
10 | |||
@@ -198,6 +199,32 b' function initAjaxForm(openingPostId) {' | |||||
198 | } |
|
199 | } | |
199 | } |
|
200 | } | |
200 |
|
201 | |||
|
202 | function getForm() { | |||
|
203 | return $('.post-form-w'); | |||
|
204 | } | |||
|
205 | ||||
|
206 | /** | |||
|
207 | * Clear all entered values in the form fields | |||
|
208 | */ | |||
|
209 | function resetForm() { | |||
|
210 | var form = getForm(); | |||
|
211 | ||||
|
212 | form.find('input:text, input:password, input:file, textarea').val(''); | |||
|
213 | form.find('input:radio, input:checkbox').removeAttr('checked').removeAttr('selected'); | |||
|
214 | pastedImages = []; | |||
|
215 | $('#pasted-images').remove(); | |||
|
216 | $('.file_wrap').find('.file-thumb').remove(); | |||
|
217 | $('#preview-text').hide(); | |||
|
218 | ||||
|
219 | resetFormPosition(form); | |||
|
220 | } | |||
|
221 | ||||
|
222 | function resetFormPosition(form) { | |||
|
223 | form.insertBefore($('footer')); | |||
|
224 | ||||
|
225 | $(REPLY_TO_MSG).hide(); | |||
|
226 | } | |||
|
227 | ||||
201 | $(document).ready(function() { |
|
228 | $(document).ready(function() { | |
202 | var powDifficulty = parseInt($('body').attr('data-pow-difficulty')); |
|
229 | var powDifficulty = parseInt($('body').attr('data-pow-difficulty')); | |
203 | if (powDifficulty > 0 && typeof SharedWorker != 'undefined') { |
|
230 | if (powDifficulty > 0 && typeof SharedWorker != 'undefined') { |
@@ -33,31 +33,6 b' function moveCaretToEnd(el) {' | |||||
33 | el[0].setSelectionRange(newPos, newPos); |
|
33 | el[0].setSelectionRange(newPos, newPos); | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | function getForm() { |
|
|||
37 | return $('.post-form-w'); |
|
|||
38 | } |
|
|||
39 |
|
||||
40 | /** |
|
|||
41 | * Clear all entered values in the form fields |
|
|||
42 | */ |
|
|||
43 | function resetForm() { |
|
|||
44 | var form = getForm(); |
|
|||
45 |
|
||||
46 | form.find('input:text, input:password, input:file, textarea').val(''); |
|
|||
47 | form.find('input:radio, input:checkbox').removeAttr('checked').removeAttr('selected'); |
|
|||
48 | pastedImages = []; |
|
|||
49 | $('#pasted-images').remove(); |
|
|||
50 | $('.file_wrap').find('.file-thumb').remove(); |
|
|||
51 | $('#preview-text').hide(); |
|
|||
52 |
|
||||
53 | resetFormPosition(form); |
|
|||
54 | } |
|
|||
55 |
|
||||
56 | function resetFormPosition(form) { |
|
|||
57 | form.insertAfter($('.thread')); |
|
|||
58 |
|
||||
59 | $(REPLY_TO_MSG).hide(); |
|
|||
60 | } |
|
|||
61 |
|
36 | |||
62 | function showFormAfter(blockToInsertAfter) { |
|
37 | function showFormAfter(blockToInsertAfter) { | |
63 | var form = getForm(); |
|
38 | var form = getForm(); |
@@ -23,6 +23,8 b'' | |||||
23 | </form> |
|
23 | </form> | |
24 | </div> |
|
24 | </div> | |
25 |
|
25 | |||
|
26 | <div><a href="#" onClick="resetForm(); return false;">{% trans 'Reset form' %}</a></div> | |||
|
27 | ||||
26 | <div> |
|
28 | <div> | |
27 | {% if new_thread %} |
|
29 | {% if new_thread %} | |
28 | {% trans 'Tags must be delimited by spaces. Text or image is required.' %}<br /> |
|
30 | {% trans 'Tags must be delimited by spaces. Text or image is required.' %}<br /> |
General Comments 0
You need to be logged in to leave comments.
Login now