1
var at = document.documentElement.getAttribute("data-layout");
2
if ((at = "vertical")) {
9
window.location != window.parent.location
11
: document.location.href;
13
var link = document.getElementById("get-url");
15
if (currentURL.includes("/main/index.html")) {
16
link.setAttribute("href", "../main/index.html");
17
} else if (currentURL.includes("/index.html")) {
18
link.setAttribute("href", "./index.html");
20
link.setAttribute("href", "./");
23
function findMatchingElement() {
24
var currentUrl = window.location.href;
25
var anchors = document.querySelectorAll("#sidebarnav a");
26
for (var i = 0; i < anchors.length; i++) {
27
if (anchors[i].href === currentUrl) {
34
var elements = findMatchingElement();
38
elements.classList.add("active");
42
.querySelectorAll("ul#sidebarnav ul li a.active")
43
.forEach(function (link) {
44
link.closest("ul").classList.add("in");
45
link.closest("ul").parentElement.classList.add("selected");
48
document.querySelectorAll("#sidebarnav li").forEach(function (li) {
49
const isActive = li.classList.contains("selected");
51
const anchor = li.querySelector("a");
53
anchor.classList.add("active");
57
document.querySelectorAll("#sidebarnav a").forEach(function (link) {
58
link.addEventListener("click", function (e) {
59
const isActive = this.classList.contains("active");
60
const parentUl = this.closest("ul");
63
parentUl.querySelectorAll("ul").forEach(function (submenu) {
64
submenu.classList.remove("in");
66
parentUl.querySelectorAll("a").forEach(function (navLink) {
67
navLink.classList.remove("active");
71
const submenu = this.nextElementSibling;
73
submenu.classList.add("in");
76
this.classList.add("active");
78
this.classList.remove("active");
79
parentUl.classList.remove("active");
80
const submenu = this.nextElementSibling;
82
submenu.classList.remove("in");
88
if ((at = "horizontal")) {
89
function findMatchingElement() {
90
var currentUrl = window.location.href;
91
var anchors = document.querySelectorAll("#sidebarnavh ul#sidebarnav a");
92
for (var i = 0; i < anchors.length; i++) {
93
if (anchors[i].href === currentUrl) {
100
var elements = findMatchingElement();
103
elements.classList.add("active");
106
.querySelectorAll("#sidebarnavh ul#sidebarnav a.active")
107
.forEach(function (link) {
108
link.closest("a").parentElement.classList.add("selected");
109
link.closest("ul").parentElement.classList.add("selected");