New-OMIS/public/assets/js/app.js

1 line
53 KiB
JavaScript
Raw Normal View History

2024-04-04 07:23:00 +00:00
!function(){var d=document.querySelector(".navbar-menu").innerHTML,M=7,t="en",a=localStorage.getItem("language");function o(){n(null===a?t:a);var e=document.getElementsByClassName("language");e&&Array.from(e).forEach(function(t){t.addEventListener("click",function(e){n(t.getAttribute("data-lang"))})})}function n(e){document.getElementById("header-lang-img")&&("en"==e?document.getElementById("header-lang-img").src="assets/images/flags/us.svg":"sp"==e?document.getElementById("header-lang-img").src="assets/images/flags/spain.svg":"gr"==e?document.getElementById("header-lang-img").src="assets/images/flags/germany.svg":"it"==e?document.getElementById("header-lang-img").src="assets/images/flags/italy.svg":"ru"==e?document.getElementById("header-lang-img").src="assets/images/flags/russia.svg":"ch"==e?document.getElementById("header-lang-img").src="assets/images/flags/china.svg":"fr"==e?document.getElementById("header-lang-img").src="assets/images/flags/french.svg":"ar"==e&&(document.getElementById("header-lang-img").src="assets/images/flags/ae.svg"),localStorage.setItem("language",e),null==(a=localStorage.getItem("language"))&&n(t),(e=new XMLHttpRequest).open("GET","assets/lang/"+a+".json"),e.onreadystatechange=function(){var a;4===this.readyState&&200===this.status&&(a=JSON.parse(this.responseText),Object.keys(a).forEach(function(t){var e=document.querySelectorAll("[data-key='"+t+"']");Array.from(e).forEach(function(e){e.textContent=a[t]})}))},e.send())}function s(){var e;document.querySelectorAll(".navbar-nav .collapse")&&(e=document.querySelectorAll(".navbar-nav .collapse"),Array.from(e).forEach(function(t){var a=new bootstrap.Collapse(t,{toggle:!1});t.addEventListener("show.bs.collapse",function(e){e.stopPropagation();var e=t.parentElement.closest(".collapse");e?(e=e.querySelectorAll(".collapse"),Array.from(e).forEach(function(e){e=bootstrap.Collapse.getInstance(e);e!==a&&e.hide()})):(e=function(e){for(var t=[],a=e.parentNode.firstChild;a;)1===a.nodeType&&a!==e&&t.push(a),a=a.nextSibling;return t}(t.parentElement),Array.from(e).forEach(function(e){2<e.childNodes.length&&e.firstElementChild.setAttribute("aria-expanded","false");e=e.querySelectorAll("*[id]");Array.from(e).forEach(function(e){e.classList.remove("show"),2<e.childNodes.length&&(e=e.querySelectorAll("ul li a"),Array.from(e).forEach(function(e){e.hasAttribute("aria-expanded")&&e.setAttribute("aria-expanded","false")}))})}))}),t.addEventListener("hide.bs.collapse",function(e){e.stopPropagation();e=t.querySelectorAll(".collapse");Array.from(e).forEach(function(e){(childCollapseInstance=bootstrap.Collapse.getInstance(e)).hide()})})}))}function i(){var n,e=document.documentElement.getAttribute("data-layout"),t=sessionStorage.getItem("defaultAttribute"),t=JSON.parse(t);!t||"twocolumn"!=e&&"twocolumn"!=t["data-layout"]||(document.querySelector(".navbar-menu")&&(document.querySelector(".navbar-menu").innerHTML=d),(n=document.createElement("ul")).innerHTML='<a href="#" class="logo"><img src="assets/images/logo-sm.png" alt="" height="22"></a>',Array.from(document.getElementById("navbar-nav").querySelectorAll(".menu-link")).forEach(function(e){n.className="twocolumn-iconview";var t=document.createElement("li"),a=e;a.querySelectorAll("span").forEach(function(e){e.classList.add("d-none")}),e.parentElement.classList.contains("twocolumn-item-show")&&e.classList.add("active"),t.appendChild(a),n.appendChild(t),a.classList.contains("nav-link")&&a.classList.replace("nav-link","nav-icon"),a.classList.remove("collapsed","menu-link")}),(e=(e="/"==location.pathname?"index.html":location.pathname.substring(1)).substring(e.lastIndexOf("/")+1))&&(t=document.getElementById("navbar-nav").querySelector('[href="'+e+'"]'))&&(e=t.closest(".collapse.menu-dropdown"))&&(e.classList.add("show"),e.parentElement.children[0].classList.add("active"),e.parentElement.children[0].setAttribute("aria-expanded","true"),e.parentElement.closest(".collapse.menu-dropdown"))&&(e.parentElement.closest(".collapse").classList.add("show"),e.parentElement.closest(".collapse").previousElementSibling&&e.parentElement.c