##// END OF EJS Templates
Use thread autoupdate only if websockets available
neko259 -
r856:a65846d0 default
parent child Browse files
Show More
@@ -124,7 +124,7 b' function isPageBottom() {'
124 124 }
125 125
126 126 function initAutoupdate() {
127 connectWebsocket()
127 connectWebsocket();
128 128 }
129 129
130 130 function getReplyCount() {
@@ -257,22 +257,24 b' function processNewPost(post) {'
257 257 }
258 258
259 259 $(document).ready(function(){
260 initAutoupdate();
260 if ('WebSocket' in window) {
261 initAutoupdate();
261 262
262 // Post form data over AJAX
263 var threadId = $('div.thread').children('.post').first().attr('id');
263 // Post form data over AJAX
264 var threadId = $('div.thread').children('.post').first().attr('id');
264 265
265 var form = $('#form');
266 var form = $('#form');
266 267
267 var options = {
268 beforeSubmit: function(arr, $form, options) {
269 showAsErrors($('form'), gettext('Sending message...'));
270 },
271 success: updateOnPost,
272 url: '/api/add_post/' + threadId + '/'
273 };
268 var options = {
269 beforeSubmit: function(arr, $form, options) {
270 showAsErrors($('form'), gettext('Sending message...'));
271 },
272 success: updateOnPost,
273 url: '/api/add_post/' + threadId + '/'
274 };
274 275
275 form.ajaxForm(options);
276 form.ajaxForm(options);
276 277
277 resetForm(form);
278 resetForm(form);
279 }
278 280 });
General Comments 0
You need to be logged in to leave comments. Login now