From ac33d37a53497542ef6080c7b8bef20db88a5ca3 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Sun, 25 Oct 2020 11:26:49 +0100 Subject: [PATCH] Revert "#19 Fallback for badly loaded pages added" This reverts commit f0eebd28037a3a4e48bd80c2999f19113cf33b34. --- src/javascript/enhancements/notifications.js | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/javascript/enhancements/notifications.js b/src/javascript/enhancements/notifications.js index f58ec56..e97e530 100644 --- a/src/javascript/enhancements/notifications.js +++ b/src/javascript/enhancements/notifications.js @@ -13,22 +13,7 @@ export function init() { function getNotificationCount() { if (core.isLoggedIn()) { - let menus = document.getElementById('materialize-menu-dropdown').innerText.split('\n'); - - // On some pages there is an issue if the website is loaded using them as entry point (eg. /Search). - // They don´t have their menu build completly directly and the above code does not return the "User" element :/ - // If this happens the menu is splitted into many more (~20) items than only 5. - // So if there are more, we just try again later. - // Additionally, if the element is there correctly it´s not updated with the notification count directly, so we wait a bit longer before retrying. - if (menus.length > 5) { - setTimeout(() => { - updateNotificationsInTitle(); - }, 2000); - - return undefined; - } - - let menuUserText = menus[4]; + let menuUserText = document.getElementById('materialize-menu-dropdown').innerText.split('\n')[4]; let notificationCount = menuUserText.match(/\d+/)?.[0] ?? 0; return notificationCount; } else {