From 7535aad664b84718f498669ca4ca6d6818dcba4c Mon Sep 17 00:00:00 2001 From: discomrade Date: Fri, 15 Oct 2021 00:06:24 +0000 Subject: [PATCH] Make all notifications show, not just the first unread Removal of unused varable --- js/auto-reload.js | 16 ++++++++++++---- js/mod/recent-posts-auto-reload.js | 9 +++------ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/js/auto-reload.js b/js/auto-reload.js index 7908af45..10f2f0f5 100644 --- a/js/auto-reload.js +++ b/js/auto-reload.js @@ -49,9 +49,8 @@ $(document).ready(function(){ var end_of_page = false; - var new_posts = 0; - var first_new_post = null; - + var new_posts = 0; + var title = document.title; if (typeof update_title == "undefined") { @@ -112,7 +111,6 @@ $(document).ready(function(){ new_posts = 0; } update_title(); - first_new_post = null; }; // automatically updates the thread after a specified delay @@ -153,8 +151,18 @@ $(document).ready(function(){ var id = $(this).attr('id'); if($('#' + id).length == 0) { if (!new_posts) { +<<<<<<< HEAD first_new_post = this; } +======= + 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()}); + } + +>>>>>>> 5e4e27bc... Make all notifications show, not just the first unread $(this).insertAfter($('div.post:not(.post-hover,.inline):last').next()).after('
'); new_posts++; loaded_posts++; diff --git a/js/mod/recent-posts-auto-reload.js b/js/mod/recent-posts-auto-reload.js index 821b1e54..0e5a5f27 100644 --- a/js/mod/recent-posts-auto-reload.js +++ b/js/mod/recent-posts-auto-reload.js @@ -190,12 +190,9 @@ $(document).ready(function(){ var id = $(this).attr('id'); // check that this post doesn't already exist if($('#' + id).length == 0) { - if (!new_posts) { - first_new_post = this; - if (notify) { - var body = $(this).children('.body').html().replace(//gi, "\n"); - var n = new Notification("New reply to "+$('title').text(), {body: $('
').html(body).text()}); - } + if (notify) { + var body = $(this).children('.body').html().replace(//gi, "\n"); + var n = new Notification("New reply to "+$('title').text(), {body: $('
').html(body).text()}); } $(this).parent().insertBefore($('.post-wrapper:first')); new_posts++;