From 47ac8c7ae9aeabda129344fecd2bf0287f3146c9 Mon Sep 17 00:00:00 2001 From: discomrade Date: Fri, 15 Oct 2021 00:52:23 +0000 Subject: [PATCH] Use stored title instead of document.title in notifications Prevents number of unreads being added to notificaiton thread name --- js/auto-reload.js | 4 ++-- js/mod/recent-posts-auto-reload.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/auto-reload.js b/js/auto-reload.js index 5cdf12ae..3e291f01 100644 --- a/js/auto-reload.js +++ b/js/auto-reload.js @@ -242,8 +242,8 @@ $(document).ready(function(){ makeIcon('reply'); } if (notify === "all" || (notify === "mention" && $(this).find('.own_post').length)) { - var body = $(this).children('.body').html().replace(//gi, "\n"); - var n = new Notification("New reply to "+$('title').text(), {body: $('
').html(body).text()}); + var body = $(this).children('.body').html().replace(//gi, "\n"); + var n = new Notification("New reply to "+title, {body: $('
').html(body).text()}); } if ($("div.post").length > 1){ $(this).insertAfter($('div.post:not(.post-hover):last').next()).after('
'); diff --git a/js/mod/recent-posts-auto-reload.js b/js/mod/recent-posts-auto-reload.js index e2d661d2..0bad51bd 100644 --- a/js/mod/recent-posts-auto-reload.js +++ b/js/mod/recent-posts-auto-reload.js @@ -221,7 +221,7 @@ $(document).ready(function(){ // Notify on all posts, not just the first unread if (notify === "all") { var body = $(this).children('.body').html().replace(//gi, "\n"); - var n = new Notification("New reply to "+$('title').text(), {body: $('
').html(body).text()}); + var n = new Notification("New reply to "+title, {body: $('
').html(body).text()}); } if ($("div.post,div.thread").length > 1){ $(this).parent().insertBefore($($('div.post,div.thread').not('.post-hover').first()).parent());