Browse Source

Fix new thread notifications title, fix thread body breaking script

Tried to access invalid child.
main
tmp-server 3 years ago
committed by discomrade
parent
commit
7876df0a50
  1. 9
      js/mod/recent-posts-auto-reload.js

9
js/mod/recent-posts-auto-reload.js

@ -191,8 +191,13 @@ $(document).ready(function(){
// check that this post doesn't already exist
if($('#' + id).length == 0) {
if (notify) {
var body = $(this).children('.body').html().replace(/<br\s*[\/]?>/gi, "\n");
var n = new Notification("New reply to "+ title, {body: $('<div/>').html(body).text()});
if ($(this).hasClass('thread')){
var body = $(this).children('.post').children('.body').html().replace(/<br\s*[\/]?>/gi, "\n");
var n = new Notification("New thread in "+ title, {body: $('<div/>').html(body).text()});
} else {
var body = $(this).children('.body').html().replace(/<br\s*[\/]?>/gi, "\n");
var n = new Notification("New reply to "+ title, {body: $('<div/>').html(body).text()});
}
}
$(this).parent().insertBefore($('.post-wrapper:first'));
new_posts++;

Loading…
Cancel
Save