window.addEventListener("DOMContentLoaded", event => {
	const sidebarToggle = document.body.querySelector("#sidebarToggle");
	if (sidebarToggle) {
		sidebarToggle.addEventListener("click", event => {
			event.preventDefault();
			document.body.classList.toggle("sb-sidenav-toggled");
			localStorage.setItem("sb|sidebar-toggle", document.body.classList.contains("sb-sidenav-toggled"));
		});
	}
});

$(function(){
	$(".sb-sidenav-menu > .nav > .nav-link").each(function(){
		if ($(this).attr("href") == window.location.pathname) {
			$(this).addClass("active");
		}
	});

	$(".navbar-nav > .nav-item").each(function(){
		if ($(this).find("a").attr("href") == window.location.pathname) {
			$(this).addClass("active");
		}
	});
});