Show More
@@ -5,7 +5,7 b" ATTRIBUTE_PLACEHOLDER = 'placeholder'" | |||||
5 | ATTRIBUTE_ROWS = 'rows' |
|
5 | ATTRIBUTE_ROWS = 'rows' | |
6 |
|
6 | |||
7 | URL_ROWS = 2 |
|
7 | URL_ROWS = 2 | |
8 | URL_PLACEHOLDER = _('Insert URLs on separate lines.') |
|
8 | URL_PLACEHOLDER = _('Insert URLs on separate lines. Paste images from clipboard here.') | |
9 |
|
9 | |||
10 |
|
10 | |||
11 | class MultipleFileInput(forms.FileInput): |
|
11 | class MultipleFileInput(forms.FileInput): |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -553,8 +553,8 b' msgstr "\xd0\x90\xd0\xba\xd1\x82\xd0\xb8\xd0\xb2\xd0\xbd\xd1\x8b\xd0\xb5 \xd1\x82\xd0\xb5\xd0\xbc\xd1\x8b:"' | |||||
553 | msgid "No active threads today." |
|
553 | msgid "No active threads today." | |
554 | msgstr "Сегодня нет активных тем." |
|
554 | msgstr "Сегодня нет активных тем." | |
555 |
|
555 | |||
556 | msgid "Insert URLs on separate lines." |
|
556 | msgid "Insert URLs on separate lines. Paste images from clipboard here." | |
557 | msgstr "Вставляйте ссылки на отдельных строках." |
|
557 | msgstr "Вставляйте ссылки на отдельных строках. Вставляйте изображения из буфера сюда." | |
558 |
|
558 | |||
559 | msgid "You can post no more than %(files)d file." |
|
559 | msgid "You can post no more than %(files)d file." | |
560 | msgid_plural "You can post no more than %(files)d files." |
|
560 | msgid_plural "You can post no more than %(files)d files." |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -65,3 +65,5 b' msgstr "\xd0\x94\xd0\xbe\xd0\xb1\xd0\xb0\xd0\xb2\xd0\xb8\xd1\x82\xd1\x8c \xd0\xbb\xd0\xbe\xd0\xba\xd0\xb0\xd0\xbb\xd1\x8c\xd0\xbd\xd1\x8b\xd0\xb9 \xd1\x81\xd1\x82\xd0\xb8\xd0\xba\xd0\xb5\xd1\x80"' | |||||
65 | msgid "Input sticker name" |
|
65 | msgid "Input sticker name" | |
66 | msgstr "Введите название стикера" |
|
66 | msgstr "Введите название стикера" | |
67 |
|
67 | |||
|
68 | msgid "Images posted: " | |||
|
69 | msgstr "Вставленных изображений: " |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -553,8 +553,8 b' msgstr "\xd0\x90\xd0\xba\xd1\x82\xd0\xb8\xd0\xb2\xd0\xbd\xd1\x96 \xd0\xbd\xd0\xb8\xd1\x82\xd0\xba\xd0\xb8:"' | |||||
553 | msgid "No active threads today." |
|
553 | msgid "No active threads today." | |
554 | msgstr "Щось усі замовкли." |
|
554 | msgstr "Щось усі замовкли." | |
555 |
|
555 | |||
556 | msgid "Insert URLs on separate lines." |
|
556 | msgid "Insert URLs on separate lines. Paste images from clipboard here." | |
557 | msgstr "Вставляйте посилання окремими рядками." |
|
557 | msgstr "Вставляйте посилання окремими рядками. Вставляйте зображення з буферу сюди." | |
558 |
|
558 | |||
559 | msgid "You can post no more than %(files)d file." |
|
559 | msgid "You can post no more than %(files)d file." | |
560 | msgid_plural "You can post no more than %(files)d files." |
|
560 | msgid_plural "You can post no more than %(files)d files." |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -65,3 +65,5 b' msgstr "\xd0\x94\xd0\xbe\xd0\xb4\xd0\xb0\xd1\x82\xd0\xb8 \xd0\xbb\xd0\xbe\xd0\xba\xd0\xb0\xd0\xbb\xd1\x8c\xd0\xbd\xd0\xb8\xd0\xb9 \xd1\x81\xd1\x82\xd1\x96\xd0\xba\xd0\xb5\xd1\x80"' | |||||
65 | msgid "Input sticker name" |
|
65 | msgid "Input sticker name" | |
66 | msgstr "Введіть назву стікера" |
|
66 | msgstr "Введіть назву стікера" | |
67 |
|
67 | |||
|
68 | msgid "Images posted: " | |||
|
69 | msgstr "Вставлених зображень: " |
@@ -3,6 +3,8 b" var URL_STICKERS = '/api/stickers';" | |||||
3 | var MIN_INPUT_LENGTH = 3; |
|
3 | var MIN_INPUT_LENGTH = 3; | |
4 | var URL_DELIMITER = '\n'; |
|
4 | var URL_DELIMITER = '\n'; | |
5 |
|
5 | |||
|
6 | var pastedImages = []; | |||
|
7 | ||||
6 | $('input[name=image]').wrap($('<div class="file_wrap"></div>')); |
|
8 | $('input[name=image]').wrap($('<div class="file_wrap"></div>')); | |
7 |
|
9 | |||
8 | $('body').on('change', 'input[name=image]', function(event) { |
|
10 | $('body').on('change', 'input[name=image]', function(event) { | |
@@ -92,6 +94,28 b' function getPostTextarea() {' | |||||
92 | return $('textarea#id_text'); |
|
94 | return $('textarea#id_text'); | |
93 | } |
|
95 | } | |
94 |
|
96 | |||
|
97 | function addOnImagePaste() { | |||
|
98 | $('#id_file_1').on('paste', function(event) { | |||
|
99 | var items = (event.clipboardData || event.originalEvent.clipboardData).items; | |||
|
100 | for (index in items) { | |||
|
101 | var item = items[index]; | |||
|
102 | if (item.kind === 'file') { | |||
|
103 | var blob = item.getAsFile(); | |||
|
104 | ||||
|
105 | pastedImages.push(blob); | |||
|
106 | ||||
|
107 | var pastedImagesList = $('#pasted-images'); | |||
|
108 | if (pastedImagesList.length === 0) { | |||
|
109 | pastedImagesList = $('<div id="pasted-images" />'); | |||
|
110 | $('#id_file_1').parent().append(pastedImagesList); | |||
|
111 | } | |||
|
112 | ||||
|
113 | pastedImagesList.text(gettext('Images posted: ') + pastedImages.length); | |||
|
114 | } | |||
|
115 | } | |||
|
116 | }); | |||
|
117 | } | |||
|
118 | ||||
95 | $(document).ready(function() { |
|
119 | $(document).ready(function() { | |
96 | var powDifficulty = parseInt($('body').attr('data-pow-difficulty')); |
|
120 | var powDifficulty = parseInt($('body').attr('data-pow-difficulty')); | |
97 | if (powDifficulty > 0 && typeof SharedWorker != 'undefined') { |
|
121 | if (powDifficulty > 0 && typeof SharedWorker != 'undefined') { | |
@@ -148,6 +172,8 b' function getPostTextarea() {' | |||||
148 | $fileSourceButton.hide(); |
|
172 | $fileSourceButton.hide(); | |
149 | } |
|
173 | } | |
150 |
|
174 | |||
|
175 | addOnImagePaste(); | |||
|
176 | ||||
151 | // Stickers autocomplete |
|
177 | // Stickers autocomplete | |
152 | function split( val ) { |
|
178 | function split( val ) { | |
153 | return val.split(URL_DELIMITER); |
|
179 | return val.split(URL_DELIMITER); |
@@ -45,6 +45,8 b' function resetForm() {' | |||||
45 |
|
45 | |||
46 | form.find('input:text, input:password, input:file, textarea').val(''); |
|
46 | form.find('input:text, input:password, input:file, textarea').val(''); | |
47 | form.find('input:radio, input:checkbox').removeAttr('checked').removeAttr('selected'); |
|
47 | form.find('input:radio, input:checkbox').removeAttr('checked').removeAttr('selected'); | |
|
48 | pastedImages = []; | |||
|
49 | $('#pasted-images').remove(); | |||
48 | $('.file_wrap').find('.file-thumb').remove(); |
|
50 | $('.file_wrap').find('.file-thumb').remove(); | |
49 | $('#preview-text').hide(); |
|
51 | $('#preview-text').hide(); | |
50 |
|
52 |
@@ -366,6 +366,13 b' function updateNodeAttr(oldNode, newNode' | |||||
366 | var options = { |
|
366 | var options = { | |
367 | beforeSubmit: function(arr, form, options) { |
|
367 | beforeSubmit: function(arr, form, options) { | |
368 | $('.post-form-w').block({ message: gettext('Sending message...') }); |
|
368 | $('.post-form-w').block({ message: gettext('Sending message...') }); | |
|
369 | ||||
|
370 | $.each(pastedImages, function(i, blob) { | |||
|
371 | arr.push({ | |||
|
372 | name: "file_0", | |||
|
373 | value: blob | |||
|
374 | }); | |||
|
375 | }); | |||
369 | }, |
|
376 | }, | |
370 | success: updateOnPost, |
|
377 | success: updateOnPost, | |
371 | error: function(xhr, textStatus, errorString) { |
|
378 | error: function(xhr, textStatus, errorString) { |
General Comments 0
You need to be logged in to leave comments.
Login now