Feature/#19 notifications tab title #31
10
enhancements/notifications.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
![]()
>
>
> Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:
> 
Yeah the 3 is the correct index here, your split is missing another space.

![]() Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether
![]()
> There probably also has to be a check if user is logged in and if there even is a notification I think.
9fe2668c3afec7a4b100cffc9ae722d1baa13fe7 adds checks for logged in + notifications
![]() Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think: There probably also has to be a check if user is logged in and if there even is a notification I think.
Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:

There probably also has to be a check if user is logged in and if there even is a notification I think.
You may try getting it via regular expression:
```js
menuDropdowns.querySelector('li a[href="notification"]')?.innerText?.match('\\d+')[0] ?? ''
```
![]() We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert. We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert.
![]()
>
>
> Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:
> 
Yeah the 3 is the correct index here, your split is missing another space.

![]() Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether
![]()
> There probably also has to be a check if user is logged in and if there even is a notification I think.
9fe2668c3afec7a4b100cffc9ae722d1baa13fe7 adds checks for logged in + notifications
|
||||
runAfterLoad(() => {
|
||||
![]() Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think: There probably also has to be a check if user is logged in and if there even is a notification I think.
Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:

There probably also has to be a check if user is logged in and if there even is a notification I think.
You may try getting it via regular expression:
```js
menuDropdowns.querySelector('li a[href="notification"]')?.innerText?.match('\\d+')[0] ?? ''
```
![]() We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert. We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert.
![]()
>
>
> Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:
> 
Yeah the 3 is the correct index here, your split is missing another space.

![]() Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether
![]()
> There probably also has to be a check if user is logged in and if there even is a notification I think.
9fe2668c3afec7a4b100cffc9ae722d1baa13fe7 adds checks for logged in + notifications
|
||||
displayNotificationsInTitle();
|
||||
![]() Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think: There probably also has to be a check if user is logged in and if there even is a notification I think.
Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:

There probably also has to be a check if user is logged in and if there even is a notification I think.
You may try getting it via regular expression:
```js
menuDropdowns.querySelector('li a[href="notification"]')?.innerText?.match('\\d+')[0] ?? ''
```
![]() We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert. We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert.
![]()
>
>
> Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:
> 
Yeah the 3 is the correct index here, your split is missing another space.

![]() Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether
![]()
> There probably also has to be a check if user is logged in and if there even is a notification I think.
9fe2668c3afec7a4b100cffc9ae722d1baa13fe7 adds checks for logged in + notifications
|
||||
}, ".*");
|
||||
![]() Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think: There probably also has to be a check if user is logged in and if there even is a notification I think.
Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:

There probably also has to be a check if user is logged in and if there even is a notification I think.
You may try getting it via regular expression:
```js
menuDropdowns.querySelector('li a[href="notification"]')?.innerText?.match('\\d+')[0] ?? ''
```
![]() We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert. We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert.
![]()
>
>
> Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:
> 
Yeah the 3 is the correct index here, your split is missing another space.

![]() Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether
![]()
> There probably also has to be a check if user is logged in and if there even is a notification I think.
9fe2668c3afec7a4b100cffc9ae722d1baa13fe7 adds checks for logged in + notifications
|
||||
|
||||
![]() Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think: There probably also has to be a check if user is logged in and if there even is a notification I think.
Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:

There probably also has to be a check if user is logged in and if there even is a notification I think.
You may try getting it via regular expression:
```js
menuDropdowns.querySelector('li a[href="notification"]')?.innerText?.match('\\d+')[0] ?? ''
```
![]() We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert. We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert.
![]()
>
>
> Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:
> 
Yeah the 3 is the correct index here, your split is missing another space.

![]() Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether
![]()
> There probably also has to be a check if user is logged in and if there even is a notification I think.
9fe2668c3afec7a4b100cffc9ae722d1baa13fe7 adds checks for logged in + notifications
|
||||
function displayNotificationsInTitle(){
|
||||
![]() Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think: There probably also has to be a check if user is logged in and if there even is a notification I think.
Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:

There probably also has to be a check if user is logged in and if there even is a notification I think.
You may try getting it via regular expression:
```js
menuDropdowns.querySelector('li a[href="notification"]')?.innerText?.match('\\d+')[0] ?? ''
```
![]() We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert. We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert.
![]()
>
>
> Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:
> 
Yeah the 3 is the correct index here, your split is missing another space.

![]() Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether
![]()
> There probably also has to be a check if user is logged in and if there even is a notification I think.
9fe2668c3afec7a4b100cffc9ae722d1baa13fe7 adds checks for logged in + notifications
|
||||
let menu = document.getElementById('materialize-menu-dropdown');
|
||||
![]() Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think: There probably also has to be a check if user is logged in and if there even is a notification I think.
Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:

There probably also has to be a check if user is logged in and if there even is a notification I think.
You may try getting it via regular expression:
```js
menuDropdowns.querySelector('li a[href="notification"]')?.innerText?.match('\\d+')[0] ?? ''
```
![]() We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert. We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert.
![]()
>
>
> Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:
> 
Yeah the 3 is the correct index here, your split is missing another space.

![]() Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether
![]()
> There probably also has to be a check if user is logged in and if there even is a notification I think.
9fe2668c3afec7a4b100cffc9ae722d1baa13fe7 adds checks for logged in + notifications
|
||||
let menuDropdowns = Array.from(menu.querySelectorAll('ul.dropdown')).slice(-1)[0];
|
||||
![]() Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think: There probably also has to be a check if user is logged in and if there even is a notification I think.
Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:

There probably also has to be a check if user is logged in and if there even is a notification I think.
You may try getting it via regular expression:
```js
menuDropdowns.querySelector('li a[href="notification"]')?.innerText?.match('\\d+')[0] ?? ''
```
![]() We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert. We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert.
![]()
>
>
> Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:
> 
Yeah the 3 is the correct index here, your split is missing another space.

![]() Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether
![]()
> There probably also has to be a check if user is logged in and if there even is a notification I think.
9fe2668c3afec7a4b100cffc9ae722d1baa13fe7 adds checks for logged in + notifications
|
||||
let notificationText = menuDropdowns.innerText.split(" ")[3];
|
||||
![]() Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think: There probably also has to be a check if user is logged in and if there even is a notification I think.
Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:

There probably also has to be a check if user is logged in and if there even is a notification I think.
You may try getting it via regular expression:
```js
menuDropdowns.querySelector('li a[href="notification"]')?.innerText?.match('\\d+')[0] ?? ''
```
![]() We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert. We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert.
![]()
>
>
> Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:
> 
Yeah the 3 is the correct index here, your split is missing another space.

![]() Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether
![]()
> There probably also has to be a check if user is logged in and if there even is a notification I think.
9fe2668c3afec7a4b100cffc9ae722d1baa13fe7 adds checks for logged in + notifications
|
||||
document.querySelector('head > title').insertAdjacentText('afterbegin', notificationText.split(" ")[1] + ' ');
|
||||
![]() Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think: There probably also has to be a check if user is logged in and if there even is a notification I think.
Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:

There probably also has to be a check if user is logged in and if there even is a notification I think.
You may try getting it via regular expression:
```js
menuDropdowns.querySelector('li a[href="notification"]')?.innerText?.match('\\d+')[0] ?? ''
```
![]() We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert. We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert.
![]()
>
>
> Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:
> 
Yeah the 3 is the correct index here, your split is missing another space.

![]() Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether
![]()
> There probably also has to be a check if user is logged in and if there even is a notification I think.
9fe2668c3afec7a4b100cffc9ae722d1baa13fe7 adds checks for logged in + notifications
|
||||
}
|
||||
![]() Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think: There probably also has to be a check if user is logged in and if there even is a notification I think.
Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:

There probably also has to be a check if user is logged in and if there even is a notification I think.
You may try getting it via regular expression:
```js
menuDropdowns.querySelector('li a[href="notification"]')?.innerText?.match('\\d+')[0] ?? ''
```
![]() We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert. We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert.
![]()
>
>
> Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:
> 
Yeah the 3 is the correct index here, your split is missing another space.

![]() Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether Right now there is a space added after the number in line 16; however I'll take a look into retrieving the notificationCount via regex since its not always working on pathnames like /watch2gether
![]()
> There probably also has to be a check if user is logged in and if there even is a notification I think.
9fe2668c3afec7a4b100cffc9ae722d1baa13fe7 adds checks for logged in + notifications
|
|
@ -22,7 +22,8 @@
|
|||
],
|
||||
"js": [
|
||||
"enhancements/quickSearch.js",
|
||||
"enhancements/animeRequests.js"
|
||||
"enhancements/animeRequests.js",
|
||||
"enhancements/notifications.js"
|
||||
],
|
||||
"run_at": "document_end"
|
||||
}
|
||||
|
|
Is 3 the correct index here? I just executed this via console and it wasn´t working correctly I think:

There probably also has to be a check if user is logged in and if there even is a notification I think.
You may try getting it via regular expression:
We should also insert a space after the number (at least the code I put in the other comment is without space). Also only add the space if there are notifications to insert.