-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.js
More file actions
41 lines (33 loc) · 1.38 KB
/
main.js
File metadata and controls
41 lines (33 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import './assets/scss/all.scss';
// import 'bootstrap/dist/js/bootstrap.min.js';
import 'loaders.css/loaders.min.css';
import bootstrapMin from 'bootstrap/dist/js/bootstrap.min.js';
export const currentBase = '/iRun/';
const currentRoot = window.location.pathname.replace(currentBase, '').split('/')[0];
const navLinks = document.querySelectorAll('.nav-link');
navLinks.forEach((navLink) => {
if (navLink.getAttribute('href') === currentRoot) {
navLink.classList.add('text-warning-100');
navLink.classList.remove('text-secondary-300');
navLink.firstElementChild.classList.add('bg-warning-100');
navLink.firstElementChild.classList.remove('bg-secondary-300');
} else {
navLink.classList.remove('text-warning-100');
navLink.classList.add('text-secondary-300');
navLink.firstElementChild.classList.remove('bg-warning-100');
navLink.firstElementChild.classList.add('bg-secondary-300');
}
navLink.addEventListener('click', (event) => {
event.preventDefault();
const to = navLink.getAttribute('href');
if (to === currentRoot) return;
window.location.href = `${currentBase}${to}/`;
});
});
const notificationModalEl = document.getElementById('notification-modal');
if (notificationModalEl) {
const notificationModal = new bootstrapMin.Modal(notificationModalEl);
window.addEventListener('DOMContentLoaded', () => {
notificationModal.show();
});
}