Show More
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -1,39 +1,43 b'' | |||
|
1 | 1 | # SOME DESCRIPTIVE TITLE. |
|
2 | 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER |
|
3 | 3 | # This file is distributed under the same license as the PACKAGE package. |
|
4 | 4 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
|
5 | 5 | # |
|
6 | 6 | #, fuzzy |
|
7 | 7 | msgid "" |
|
8 | 8 | msgstr "" |
|
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
|
10 | 10 | "Report-Msgid-Bugs-To: \n" |
|
11 |
"POT-Creation-Date: 2013-1 |
|
|
11 | "POT-Creation-Date: 2013-12-21 21:45+0200\n" | |
|
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
|
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
|
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
|
15 | 15 | "Language: \n" |
|
16 | 16 | "MIME-Version: 1.0\n" |
|
17 | 17 | "Content-Type: text/plain; charset=UTF-8\n" |
|
18 | 18 | "Content-Transfer-Encoding: 8bit\n" |
|
19 | 19 | "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" |
|
20 | 20 | "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" |
|
21 | 21 | |
|
22 |
#: static/js/refpopup.js: |
|
|
22 | #: static/js/refpopup.js:57 | |
|
23 | 23 | msgid "Loading..." |
|
24 | 24 | msgstr "Загрузка..." |
|
25 | 25 | |
|
26 |
#: static/js/refpopup.js: |
|
|
26 | #: static/js/refpopup.js:76 | |
|
27 | 27 | msgid "Post not found" |
|
28 | 28 | msgstr "Сообщение не найдено" |
|
29 | 29 | |
|
30 | 30 | #: static/js/thread.js:32 |
|
31 | 31 | msgid "Normal" |
|
32 | 32 | msgstr "Нормальный" |
|
33 | 33 | |
|
34 | 34 | #: static/js/thread.js:33 |
|
35 | 35 | msgid "Gallery" |
|
36 | 36 | msgstr "Галерея" |
|
37 | 37 | |
|
38 | #: static/js/thread_update.js:177 | |
|
39 | msgid "[new posts]" | |
|
40 | msgstr "[новые посты]" | |
|
41 | ||
|
38 | 42 | #~ msgid "Replies" |
|
39 | 43 | #~ msgstr "Ответы" |
@@ -1,164 +1,188 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 | 26 | var THREAD_UPDATE_DELAY = 10000; |
|
27 | 27 | |
|
28 | 28 | var loading = false; |
|
29 | 29 | var lastUpdateTime = null; |
|
30 | 30 | |
|
31 | 31 | function blink(node) { |
|
32 | 32 | var blinkCount = 2; |
|
33 | 33 | var blinkDelay = 250; |
|
34 | 34 | |
|
35 | 35 | var nodeToAnimate = node; |
|
36 | 36 | for (var i = 0; i < blinkCount; i++) { |
|
37 | 37 | nodeToAnimate = nodeToAnimate.fadeOut(blinkDelay).fadeIn(blinkDelay); |
|
38 | 38 | } |
|
39 | 39 | } |
|
40 | 40 | |
|
41 | 41 | function updateThread() { |
|
42 | 42 | if (loading) { |
|
43 | 43 | return; |
|
44 | 44 | } |
|
45 | 45 | |
|
46 | 46 | loading = true; |
|
47 | 47 | |
|
48 | 48 | var threadPosts = $('div.thread').children('.post'); |
|
49 | 49 | |
|
50 | 50 | var lastPost = threadPosts.last(); |
|
51 | 51 | var threadId = threadPosts.first().attr('id'); |
|
52 | 52 | |
|
53 | 53 | var diffUrl = '/api/diff_thread/' + threadId + '/' + lastUpdateTime + '/'; |
|
54 | 54 | $.getJSON(diffUrl) |
|
55 | 55 | .success(function(data) { |
|
56 | 56 | var bottom = isPageBottom(); |
|
57 | 57 | |
|
58 | 58 | var addedPosts = data.added; |
|
59 | 59 | for (var i = 0; i < addedPosts.length; i++) { |
|
60 | 60 | var postText = addedPosts[i]; |
|
61 | 61 | |
|
62 | 62 | var post = $(postText); |
|
63 | 63 | post.appendTo(lastPost.parent()); |
|
64 | 64 | addRefLinkPreview(post[0]); |
|
65 | 65 | |
|
66 | 66 | lastPost = post; |
|
67 | 67 | blink(post); |
|
68 | 68 | } |
|
69 | 69 | |
|
70 | 70 | var updatedPosts = data.updated; |
|
71 | 71 | for (var i = 0; i < updatedPosts.length; i++) { |
|
72 | 72 | var postText = updatedPosts[i]; |
|
73 | 73 | |
|
74 | 74 | var post = $(postText); |
|
75 | 75 | var postId = post.attr('id'); |
|
76 | 76 | |
|
77 | 77 | var oldPost = $('div.thread').children('.post[id=' + postId + ']'); |
|
78 | 78 | |
|
79 | 79 | oldPost.replaceWith(post); |
|
80 | 80 | addRefLinkPreview(post[0]); |
|
81 | 81 | |
|
82 | 82 | blink(post); |
|
83 | 83 | } |
|
84 | 84 | |
|
85 | 85 | // TODO Process deleted posts |
|
86 | 86 | |
|
87 | 87 | lastUpdateTime = data.last_update; |
|
88 | 88 | loading = false; |
|
89 | 89 | |
|
90 | 90 | if (bottom) { |
|
91 | 91 | var $target = $('html,body'); |
|
92 | 92 | $target.animate({scrollTop: $target.height()}, 1000); |
|
93 | 93 | } |
|
94 | 94 | |
|
95 | 95 | $('#reply-count').text(getReplyCount()); |
|
96 | 96 | $('#image-count').text(getImageCount()); |
|
97 | 97 | |
|
98 | 98 | updateBumplimitProgress(data.added.length); |
|
99 | 99 | updatePostBumpableStatus(); |
|
100 | ||
|
101 | if (data.added.length + data.updated.length > 0) { | |
|
102 | showNewPostsTitle(); | |
|
103 | } | |
|
100 | 104 | }) |
|
101 | 105 | .error(function(data) { |
|
102 | 106 | // TODO Show error message that server is unavailable? |
|
103 | 107 | |
|
104 | 108 | loading = false; |
|
105 | 109 | }); |
|
106 | 110 | } |
|
107 | 111 | |
|
108 | 112 | function isPageBottom() { |
|
109 | 113 | var scroll = $(window).scrollTop() / ($(document).height() |
|
110 | 114 | - $(window).height()) |
|
111 | 115 | |
|
112 | 116 | return scroll == 1 |
|
113 | 117 | } |
|
114 | 118 | |
|
115 | 119 | function initAutoupdate() { |
|
116 | 120 | loading = false; |
|
117 | 121 | |
|
118 | 122 | lastUpdateTime = $('.metapanel').attr('data-last-update'); |
|
119 | 123 | |
|
120 | 124 | setInterval(updateThread, THREAD_UPDATE_DELAY); |
|
121 | 125 | } |
|
122 | 126 | |
|
123 | 127 | function getReplyCount() { |
|
124 | 128 | return $('.thread').children('.post').length |
|
125 | 129 | } |
|
126 | 130 | |
|
127 | 131 | function getImageCount() { |
|
128 | 132 | return $('.thread').find('img').length |
|
129 | 133 | } |
|
130 | 134 | |
|
131 | 135 | /** |
|
132 | 136 | * Update bumplimit progress bar |
|
133 | 137 | */ |
|
134 | 138 | function updateBumplimitProgress(postDelta) { |
|
135 | 139 | var progressBar = $('#bumplimit_progress'); |
|
136 | 140 | if (progressBar) { |
|
137 | 141 | var postsToLimitElement = $('#left_to_limit'); |
|
138 | 142 | |
|
139 | 143 | var oldPostsToLimit = parseInt(postsToLimitElement.text()); |
|
140 | 144 | var postCount = getReplyCount(); |
|
141 | 145 | var bumplimit = postCount - postDelta + oldPostsToLimit; |
|
142 | 146 | |
|
143 | 147 | var newPostsToLimit = bumplimit - postCount; |
|
144 | 148 | if (newPostsToLimit <= 0) { |
|
145 | 149 | $('.bar-bg').remove(); |
|
146 | 150 | } else { |
|
147 | 151 | postsToLimitElement.text(newPostsToLimit); |
|
148 | 152 | progressBar.width((100 - postCount / bumplimit * 100.0) + '%'); |
|
149 | 153 | } |
|
150 | 154 | } |
|
151 | 155 | } |
|
152 | 156 | |
|
153 | 157 | /** |
|
154 | 158 | * If the bumplimit is reached, add dead_post class to all posts |
|
155 | 159 | */ |
|
156 | 160 | function updatePostBumpableStatus() { |
|
157 | 161 | var postCount = getReplyCount(); |
|
158 | 162 | var postsToLimitElement = $('#left_to_limit'); |
|
159 | 163 | var postsToLimit = parseInt(postsToLimitElement.text()); |
|
160 | 164 | |
|
161 | 165 | if (postsToLimit <= 0) { |
|
162 | 166 | $('.thread').find('.post').addClass('dead_post'); |
|
163 | 167 | } |
|
164 | 168 | } |
|
169 | ||
|
170 | var documentOriginalTitle = ''; | |
|
171 | /** | |
|
172 | * Show 'new posts' text in the title if the document is not visible to a user | |
|
173 | */ | |
|
174 | function showNewPostsTitle() { | |
|
175 | if (document.hidden) { | |
|
176 | documentOriginalTitle = document.title; | |
|
177 | document.title = gettext('[new posts]') + ' ' + document.title; | |
|
178 | ||
|
179 | document.addEventListener('visibilitychange', function() { | |
|
180 | if (documentOriginalTitle !== '') { | |
|
181 | document.title = documentOriginalTitle; | |
|
182 | documentOriginalTitle = ''; | |
|
183 | } | |
|
184 | ||
|
185 | document.removeEventListener('visibilitychange', null); | |
|
186 | }); | |
|
187 | } | |
|
188 | } No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now