Feature/#19 notifications tab title #31
|
@ -7,6 +7,7 @@ import { initHelpers } from './utils/helpers';
|
||||||
// enhancements
|
// enhancements
|
||||||
import { init as animeRequests } from './enhancements/animeRequests';
|
import { init as animeRequests } from './enhancements/animeRequests';
|
||||||
import { init as lists } from './enhancements/lists';
|
import { init as lists } from './enhancements/lists';
|
||||||
|
import { init as notifications } from './enhancements/notifications';
|
||||||
import { init as quickSearch } from './enhancements/quickSearch';
|
import { init as quickSearch } from './enhancements/quickSearch';
|
||||||
|
|
||||||
// core
|
// core
|
||||||
|
@ -18,4 +19,5 @@ initHelpers();
|
||||||
// enhancements
|
// enhancements
|
||||||
animeRequests();
|
animeRequests();
|
||||||
lists();
|
lists();
|
||||||
|
notifications();
|
||||||
quickSearch();
|
quickSearch();
|
|
@ -72,10 +72,22 @@ function awaitPageLoaded() {
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
We should rename this, if we keep using the pushState event. We should rename this, if we keep using the pushState event.
What would you suggest? Maybe location change? I think each pushstate also always could be a location change maybe? What would you suggest? Maybe location change? I think each pushstate also always could be a location change maybe?
would be fine imo ```suggestion
export function runAfterLocationChange(func, pattern = '.*') {
```
would be fine imo
Renamed this with commit Renamed this with commit a840f644b723cb885232f4184698db2a27bc5f7d
|
|||||||
|
|
||||||
function runAfterPathnameChange(func, pattern = '.*') {
|
export function runAfterPathnameChange(func, pattern = '.*') {
|
||||||
__afterPathnameChangeScripts.push({ "function": func, "pattern": pattern });
|
__afterPathnameChangeScripts.push({ "function": func, "pattern": pattern });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isLoggedIn() {
|
||||||
|
let menu = document.getElementById('materialize-menu-dropdown');
|
||||||
|
let result = true;
|
||||||
|
|
||||||
|
menu.innerText.split('\n').forEach(item => {
|
||||||
|
if (item === 'Login') {
|
||||||
|
result = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let locationPath = location.pathname;
|
let locationPath = location.pathname;
|
||||||
let __loop = setInterval(() => {
|
let __loop = setInterval(() => {
|
||||||
if (locationPath != location.pathname) {
|
if (locationPath != location.pathname) {
|
||||||
|
|
|
@ -18,6 +18,10 @@ export function onReady(fn) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function assigned(obj) {
|
||||||
|
return !(typeof obj === 'undefined' || obj === null);
|
||||||
|
}
|
||||||
|
|
||||||
function handleKeyDown(event) {
|
function handleKeyDown(event) {
|
||||||
handleKeyToggle(event, true);
|
handleKeyToggle(event, true);
|
||||||
}
|
}
|
||||||
|
@ -33,15 +37,3 @@ function handleKeyToggle(event, isPressed) {
|
||||||
isCtrlPressed = isPressed;
|
isCtrlPressed = isPressed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function retrieveLoginStatus() {
|
|
||||||
let menu = document.getElementById('materialize-menu-dropdown');
|
|
||||||
let menuItem = menu.innerText.split('\n')[4];
|
|
||||||
if (menuItem === 'Login') {
|
|
||||||
isLoggedIn = false;
|
|
||||||
console.log(isLoggedIn);
|
|
||||||
} else if (menuItem.includes('User')) {
|
|
||||||
isLoggedIn = true;
|
|
||||||
console.log(isLoggedIn);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue
Getting the NotificationCount on every pushState event increases the chance of it failing. With this solution it fails for every item of the Community and Anime dropdownmenus. With the old solution it failed when inserting the Count into the title for the stats, jobs, seasonal, airing, random, profile, watchlist and notifications. 10 vs 8 pathnames where it doesn't work.
Furthermore with this solution we run into problems on the profile pathname:
We are adding the NotificationCount to the old count whenever we switch from one tab under profile to another; this did not happen with the old solution.
This seems to be related to #42 tho, if you enable Low-end mobile and check the pathnames after visting /home first, you'll see the notification count appear for a while and then disappear once the site is fully shown. With the new solution its definitely because of #42; we are trying to access the menu while the page isn't fully loaded.