Skip to content

Commit

Permalink
#457 #456 minor issues with navigation if not logged int + if wordpre…
Browse files Browse the repository at this point in the history
…ss is down
  • Loading branch information
fcaps authored and Brutus5000 committed Nov 12, 2023
1 parent dcde321 commit 65936e0
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 40 deletions.
77 changes: 39 additions & 38 deletions public/js/app/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,23 @@ document.addEventListener("DOMContentLoaded", () => {
//When you mouseover/click, menu appears
navList[i].addEventListener("mouseout", () => {
stillHere = 1;
navAbsolute[i].classList.remove("navAbsoluteActive");
setTimeout(() => {
if (stillHere === 1) {
navAbsolute.forEach(list => list.style.opacity = "0%");
}
}, 0);

if (navAbsolute[i]) {
navAbsolute[i].classList.remove("navAbsoluteActive");
setTimeout(() => {
if (stillHere === 1) {
navAbsolute.forEach(list => list.style.opacity = "0%");
}
}, 0);
}
});
navList[i].addEventListener("mouseover", () => {
stillHere = 0;
navAbsolute[i].classList.add("navAbsoluteActive");
setTimeout(() => {
navAbsolute[i].style.opacity = "100%";
}, 10);
if (navAbsolute[i]) {
navAbsolute[i].classList.add("navAbsoluteActive");
setTimeout(() => {
navAbsolute[i].style.opacity = "100%";
}, 10);
}
});
//when you mouseout/leave, menu dissapears
}
Expand Down Expand Up @@ -100,36 +103,31 @@ document.addEventListener("DOMContentLoaded", () => {


let loginList = document.getElementById("loginList");
let loginAbsolute = document.getElementById("loginAbsolute");
let stillHovering = 0;


//when you mouse is over the login, it should appear
loginList.addEventListener("mouseover", () => {
stillHovering = 0;

setTimeout(() => {
loginAbsolute.style.display = "block";
//console.log('timeout done');
}, 0);
});
if (loginList) {
let loginAbsolute = document.getElementById("loginAbsolute");
let stillHovering = 0;
//when you mouse is over the login, it should appear
loginList.addEventListener("mouseover", () => {
stillHovering = 0;

setTimeout(() => {
loginAbsolute.style.display = "block";
//console.log('timeout done');
}, 0);
});
//When you mouseover/click, menu appears
//when you mouseout/leave, menu dissapears
loginList.addEventListener("mouseout", () => {
stillHovering = 1;

setTimeout(() => {
if (stillHovering === 1) {
loginAbsolute.style.display = "none";
}
}, 0);

});





}

//function to make highligthed text change colors/pulsate (it goes from white to gold and viceversa)
let highlightText = document.querySelectorAll(".highlightText");
Expand All @@ -151,15 +149,18 @@ document.addEventListener("DOMContentLoaded", () => {

});

let pages = htmlElement.split(',');
if (pages[0] === '/all') {
document.getElementById('flashMessageContainer').style.display = 'block';
} else {
pages.forEach(route => {
if (typeof htmlElement !== 'undefined') {
let pages = htmlElement.split(',');
if (pages[0] === '/all') {
document.getElementById('flashMessageContainer').style.display = 'block';
} else {
pages.forEach(route => {

if (window.location.href.includes(route) && window.innerWidth > 900) {
document.getElementById('flashMessageContainer').style.display = 'block';
}
});
if (window.location.href.includes(route) && window.innerWidth > 900) {
document.getElementById('flashMessageContainer').style.display = 'block';
}
});
}
}


6 changes: 4 additions & 2 deletions templates/layouts/default.pug
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,10 @@ html(lang='en')

//- Add scripts that are globally required by your site here.
// This script here adss what our flash message requirements are.
script(type='text/javascript').
var htmlElement = !{JSON.stringify(flashRoutes)}
if flashRoutes
script(type='text/javascript').
var htmlElement = !{JSON.stringify(flashRoutes)}

script(src="../../js/app/navigation.js")


Expand Down

0 comments on commit 65936e0

Please sign in to comment.