From e59cf6e45b494a996089d0e2af3fceef7d6b7689 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Mon, 19 Nov 2018 15:08:51 +0100 Subject: [PATCH] Update ReadAllNotificationsButton.plugin.js --- .../ReadAllNotificationsButton.plugin.js | 43 +++++++++---------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js b/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js index 8f5f75380d..46e6e413b1 100644 --- a/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js +++ b/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js @@ -12,8 +12,8 @@ class ReadAllNotificationsButton { `; this.RAMbuttonMarkup = - ``; this.defaults = { @@ -79,27 +79,24 @@ class ReadAllNotificationsButton { if (change.addedNodes) { change.addedNodes.forEach((node) => { var mentionspopout = null; - if (node && node.tagName && (mentionspopout = node.querySelector(BDFDB.dotCN.recentmentionspopout)) != null) { - let filter = node.querySelector(BDFDB.dotCN.recentmentionsmentionfilter); - if (filter) { - $(this.RAMbuttonMarkup).insertBefore(filter, mentionspopout) - .on("click", () => { - var loadinterval = setInterval(() => { - if (!mentionspopout || !mentionspopout.parentElement) clearInterval(loadinterval); - var loadbutton = mentionspopout.querySelector(BDFDB.dotCNS.messagespopouthasmore + "button"); - var closebuttons = mentionspopout.querySelectorAll(BDFDB.dotCN.messagespopoutclosebutton); - if (!loadbutton) { - closebuttons.forEach((btn) => {btn.click();}); - clearInterval(loadinterval); - } - else { - closebuttons.forEach((btn,i) => {if (closebuttons.length-1 > i) btn.click();}); - loadbutton.click(); - } - },2000); - }); - mentionspopout.classList.add("RAM-added"); - } + if (node.tagName && (mentionspopout = node.querySelector(BDFDB.dotCN.recentmentionspopout)) != null && node.querySelector(BDFDB.dotCN.recentmentionsmentionfilter)) { + $(this.RAMbuttonMarkup).appendTo(BDFDB.dotCN.recentmentionstitle, mentionspopout) + .on("click", () => { + var loadinterval = setInterval(() => { + if (!mentionspopout || !mentionspopout.parentElement) clearInterval(loadinterval); + var loadbutton = mentionspopout.querySelector(BDFDB.dotCNS.messagespopouthasmore + "button"); + var closebuttons = mentionspopout.querySelectorAll(BDFDB.dotCN.messagespopoutclosebutton); + if (!loadbutton) { + closebuttons.forEach((btn) => {btn.click();}); + clearInterval(loadinterval); + } + else { + closebuttons.forEach((btn,i) => {if (closebuttons.length-1 > i) btn.click();}); + loadbutton.click(); + } + },2000); + }); + mentionspopout.classList.add("RAM-added"); } }); }