Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor issues with navigation and error-handling #458

Merged
merged 1 commit into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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