From 76d2a0fcd9e1167b97bbc9f988071a9f69a8a3c8 Mon Sep 17 00:00:00 2001 From: kaffem <29717789+kaffem@users.noreply.github.com> Date: Wed, 29 Jul 2020 22:48:49 +0200 Subject: [PATCH] #19 Added displayNotificationsInTitle in notifications --- enhancements/notifications.js | 10 ++++++++++ manifest.json | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 enhancements/notifications.js diff --git a/enhancements/notifications.js b/enhancements/notifications.js new file mode 100644 index 0000000..310dffd --- /dev/null +++ b/enhancements/notifications.js @@ -0,0 +1,10 @@ +runAfterLoad(() => { + displayNotificationsInTitle(); +}, ".*"); + +function displayNotificationsInTitle(){ +let menu = document.getElementById('materialize-menu-dropdown'); +let menuDropdowns = Array.from(menu.querySelectorAll('ul.dropdown')).slice(-1)[0]; +let notificationText = menuDropdowns.innerText.split(" ")[3]; +document.querySelector('head > title').insertAdjacentText('afterbegin', notificationText.split(" ")[1] + ' '); +} \ No newline at end of file diff --git a/manifest.json b/manifest.json index 22d1468..a975e11 100644 --- a/manifest.json +++ b/manifest.json @@ -22,7 +22,8 @@ ], "js": [ "enhancements/quickSearch.js", - "enhancements/animeRequests.js" + "enhancements/animeRequests.js", + "enhancements/notifications.js" ], "run_at": "document_end" }