2018-08-27 14:37:06 +00:00
|
|
|
import "bootstrap";
|
2018-08-31 09:17:26 +00:00
|
|
|
|
2018-08-31 10:55:03 +00:00
|
|
|
import { triggerModalEvent } from "../components/modal.js";
|
|
|
|
|
2018-09-04 10:52:10 +00:00
|
|
|
import { loadDynamicBannerText } from '../components/banner';
|
|
|
|
loadDynamicBannerText();
|
|
|
|
|
2018-08-31 10:55:03 +00:00
|
|
|
triggerModalEvent();
|
|
|
|
|
2018-09-01 17:27:12 +00:00
|
|
|
const settingsPage = document.getElementById('settings-page');
|
|
|
|
const contactsPage = document.getElementById('contacts-page');
|
2018-08-31 10:55:03 +00:00
|
|
|
|
2018-09-01 17:27:12 +00:00
|
|
|
const getSiblings = (element) => {
|
2018-09-01 16:36:46 +00:00
|
|
|
const siblings = [];
|
2018-09-01 17:27:12 +00:00
|
|
|
let sibling = element.parentNode.firstChild;
|
|
|
|
const skipMe = element;
|
2018-09-01 16:36:46 +00:00
|
|
|
for ( ; sibling; sibling = sibling.nextSibling )
|
2018-09-01 17:27:12 +00:00
|
|
|
if ( sibling.nodeType == 1 && sibling != element )
|
2018-09-01 16:36:46 +00:00
|
|
|
siblings.push( sibling );
|
|
|
|
return siblings;
|
|
|
|
}
|
|
|
|
|
2018-09-01 17:27:12 +00:00
|
|
|
const removeActiveClass = (element) => {
|
|
|
|
const siblings = getSiblings(element);
|
|
|
|
siblings.forEach(sibling => {
|
|
|
|
sibling.classList.remove('active');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (settingsPage) {
|
|
|
|
const settings = document.getElementById('settings')
|
|
|
|
settings.classList.add('active');
|
|
|
|
removeActiveClass(settings);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (contactsPage) {
|
|
|
|
const contacts = document.getElementById('contacts')
|
|
|
|
contacts.classList.add('active');
|
|
|
|
removeActiveClass(contacts);
|
|
|
|
}
|
|
|
|
|