Show More
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -88,3 +88,6 b' msgstr "\xd0\x98\xd0\xb7\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb8\xd1\x82\xd1\x8c"' | |||||
88 |
|
88 | |||
89 | msgid "Edit thread" |
|
89 | msgid "Edit thread" | |
90 | msgstr "Изменить тему" |
|
90 | msgstr "Изменить тему" | |
|
91 | ||||
|
92 | msgid "Hide/show" | |||
|
93 | msgstr "Скрыть/показать" |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -88,3 +88,6 b' msgstr "\xd0\x97\xd0\xbc\xd1\x96\xd0\xbd\xd0\xb8\xd1\x82\xd0\xb8"' | |||||
88 |
|
88 | |||
89 | msgid "Edit thread" |
|
89 | msgid "Edit thread" | |
90 | msgstr "Змінити нитку" |
|
90 | msgstr "Змінити нитку" | |
|
91 | ||||
|
92 | msgid "Hide/show" | |||
|
93 | msgstr "Приховати/відобразити" |
@@ -24,6 +24,8 b'' | |||||
24 | */ |
|
24 | */ | |
25 |
|
25 | |||
26 | var ITEM_VOLUME_LEVEL = 'volumeLevel'; |
|
26 | var ITEM_VOLUME_LEVEL = 'volumeLevel'; | |
|
27 | var ITEM_HIDDEN_POSTS = 'hiddenPosts'; | |||
|
28 | ||||
27 | var IMAGE_TYPES = ['image/png', 'image/jpg', 'image/jpeg', 'image/bmp', 'image/gif']; |
|
29 | var IMAGE_TYPES = ['image/png', 'image/jpg', 'image/jpeg', 'image/bmp', 'image/gif']; | |
28 |
|
30 | |||
29 | /** |
|
31 | /** | |
@@ -132,6 +134,22 b' function processVolumeUser(node) {' | |||||
132 | }); |
|
134 | }); | |
133 | } |
|
135 | } | |
134 |
|
136 | |||
|
137 | function getHiddenPosts() { | |||
|
138 | var arr = Array(); | |||
|
139 | var hiddenPosts = localStorage.getItem(ITEM_HIDDEN_POSTS); | |||
|
140 | if (hiddenPosts) { | |||
|
141 | arr = JSON.parse(hiddenPosts); | |||
|
142 | } | |||
|
143 | return arr; | |||
|
144 | } | |||
|
145 | ||||
|
146 | function processPostHiding(post) { | |||
|
147 | var hiddenPosts = getHiddenPosts(); | |||
|
148 | if (hiddenPosts.indexOf(post.attr("id")) > -1) { | |||
|
149 | post.toggleClass("hidden_post"); | |||
|
150 | } | |||
|
151 | } | |||
|
152 | ||||
135 | /** |
|
153 | /** | |
136 | * Add all scripts than need to work on post, when the post is added to the |
|
154 | * Add all scripts than need to work on post, when the post is added to the | |
137 | * document. |
|
155 | * document. | |
@@ -140,6 +158,7 b' function addScriptsToPost(post) {' | |||||
140 | addRefLinkPreview(post[0]); |
|
158 | addRefLinkPreview(post[0]); | |
141 | highlightCode(post); |
|
159 | highlightCode(post); | |
142 | processVolumeUser(post.find("video,audio")); |
|
160 | processVolumeUser(post.find("video,audio")); | |
|
161 | processPostHiding(post); | |||
143 | } |
|
162 | } | |
144 |
|
163 | |||
145 | /** |
|
164 | /** | |
@@ -151,6 +170,20 b' function compatibilityCrutches() {' | |||||
151 | } |
|
170 | } | |
152 | } |
|
171 | } | |
153 |
|
172 | |||
|
173 | function togglePostHidden(postId) { | |||
|
174 | var hiddenPosts = getHiddenPosts(); | |||
|
175 | ||||
|
176 | var elIndex = hiddenPosts.indexOf(postId); | |||
|
177 | if (elIndex > -1) { | |||
|
178 | hiddenPosts.splice(elIndex, 1); | |||
|
179 | } else { | |||
|
180 | hiddenPosts.push(postId); | |||
|
181 | } | |||
|
182 | localStorage.setItem(ITEM_HIDDEN_POSTS, JSON.stringify(hiddenPosts)); | |||
|
183 | ||||
|
184 | $('#' + postId).toggleClass("hidden_post"); | |||
|
185 | } | |||
|
186 | ||||
154 | function addContextMenu() { |
|
187 | function addContextMenu() { | |
155 | $.contextMenu({ |
|
188 | $.contextMenu({ | |
156 | selector: '.file-menu', |
|
189 | selector: '.file-menu', | |
@@ -205,7 +238,7 b' function addContextMenu() {' | |||||
205 | }); |
|
238 | }); | |
206 |
|
239 | |||
207 | $.contextMenu({ |
|
240 | $.contextMenu({ | |
208 |
selector: '.post . |
|
241 | selector: '.post .post-menu', | |
209 | trigger: 'left', |
|
242 | trigger: 'left', | |
210 | build: function($trigger, e) { |
|
243 | build: function($trigger, e) { | |
211 | var canEditPost = PERMS['change_post']; |
|
244 | var canEditPost = PERMS['change_post']; | |
@@ -226,6 +259,12 b' function addContextMenu() {' | |||||
226 |
|
259 | |||
227 | return { |
|
260 | return { | |
228 | items: { |
|
261 | items: { | |
|
262 | hide: { | |||
|
263 | name: gettext('Hide/show'), | |||
|
264 | callback: function(key, opt) { | |||
|
265 | togglePostHidden(postId); | |||
|
266 | } | |||
|
267 | }, | |||
229 | edit: { |
|
268 | edit: { | |
230 | name: gettext('Edit'), |
|
269 | name: gettext('Edit'), | |
231 | callback: function(key, opt) { |
|
270 | callback: function(key, opt) { | |
@@ -259,14 +298,14 b' function addContextMenu() {' | |||||
259 | callback: function(key, opt) { |
|
298 | callback: function(key, opt) { | |
260 | window.location = '/feed/?ip=' + posterIp; |
|
299 | window.location = '/feed/?ip=' + posterIp; | |
261 | }, |
|
300 | }, | |
262 | visible: hasIp |
|
301 | visible: canEditPost && hasIp | |
263 | }, |
|
302 | }, | |
264 | raw: { |
|
303 | raw: { | |
265 | name: 'RAW', |
|
304 | name: 'RAW', | |
266 | callback: function(key, opt) { |
|
305 | callback: function(key, opt) { | |
267 | window.location = '/post_xml/' + postId; |
|
306 | window.location = '/post_xml/' + postId; | |
268 | }, |
|
307 | }, | |
269 | visible: hasGlobalId |
|
308 | visible: canEditPost && hasGlobalId | |
270 | }, |
|
309 | }, | |
271 | ban: { |
|
310 | ban: { | |
272 | name: gettext('Ban'), |
|
311 | name: gettext('Ban'), | |
@@ -275,7 +314,7 b' function addContextMenu() {' | |||||
275 | window.location = '/utils?method=ban&post_id=' + postId; |
|
314 | window.location = '/utils?method=ban&post_id=' + postId; | |
276 | } |
|
315 | } | |
277 | }, |
|
316 | }, | |
278 | visible: hasIp |
|
317 | visible: canEditPost && hasIp | |
279 | }, |
|
318 | }, | |
280 | banAndDelete: { |
|
319 | banAndDelete: { | |
281 | name: gettext('Ban and delete'), |
|
320 | name: gettext('Ban and delete'), | |
@@ -314,4 +353,8 b' function addContextMenu() {' | |||||
314 | addContextMenu(); |
|
353 | addContextMenu(); | |
315 |
|
354 | |||
316 | compatibilityCrutches(); |
|
355 | compatibilityCrutches(); | |
|
356 | ||||
|
357 | $('.post').each(function(index) { | |||
|
358 | processPostHiding($(this)); | |||
|
359 | }); | |||
317 | }); |
|
360 | }); |
@@ -56,9 +56,7 b'' | |||||
56 | <a href="#form" onclick="addQuickReply('{{ post.id }}'); return false;">{% trans 'Reply' %}</a> |
|
56 | <a href="#form" onclick="addQuickReply('{{ post.id }}'); return false;">{% trans 'Reply' %}</a> | |
57 | {% endif %} |
|
57 | {% endif %} | |
58 |
|
58 | |||
59 | {% if perms.boards.change_post or perms.boards.delete_post or perms.boards.change_thread or perms_boards.delete_thread %} |
|
59 | <a class="post-menu" href="#">⋮</a> | |
60 | <a class="moderation-menu" href="#">🔒</a> |
|
|||
61 | {% endif %} |
|
|||
62 | </div> |
|
60 | </div> | |
63 | {% for file in post.attachments.all %} |
|
61 | {% for file in post.attachments.all %} | |
64 | {{ file.get_view|safe }} |
|
62 | {{ file.get_view|safe }} |
General Comments 0
You need to be logged in to leave comments.
Login now