CasperSecurity
"use strict";
var themeOptionArr = {
typography: "",
version: "",
layout: "",
primary: "",
headerBg: "",
navheaderBg: "",
sidebarBg: "",
sidebarStyle: "",
sidebarPosition: "",
headerPosition: "",
containerLayout: ""
};
function setCookie(e, o, i) {
var r = new Date;
r.setTime(r.getTime() + 18e5);
var a = "expires=" + r.toString();
document.cookie = e + "=" + o + ";" + a + ";path=/"
}
function getCookie(e) {
for (var o = e + "=", i = decodeURIComponent(document.cookie).split(";"), r = 0; r < i.length; r++) {
for (var a = i[r]; " " == a.charAt(0);) a = a.substring(1);
if (0 == a.indexOf(o)) return a.substring(o.length, a.length)
}
return ""
}
function deleteCookie(e) {
var o = new Date;
o.setTime(o.getTime() + 1), o.toString(), document.cookie = e + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/"
}
function deleteAllCookie(e = !0) {
jQuery.each(themeOptionArr, function (e, o) {
deleteCookie(e)
}), e && location.reload()
}
!function ($) {
var theme = getUrlParams("theme"), dzThemeSet0 = {
typography: "poppins",
version: "light",
layout: "vertical",
primary: "color_1",
headerBg: "color_4",
navheaderBg: "color_4",
sidebarBg: "color_1",
sidebarStyle: "full",
sidebarPosition: "fixed",
headerPosition: "fixed",
containerLayout: "full"
}, dzThemeSet1 = {
typography: "poppins",
version: "light",
layout: "vertical",
primary: "color_1",
headerBg: "color_1",
navheaderBg: "color_4",
sidebarBg: "color_4",
sidebarStyle: "full",
sidebarPosition: "fixed",
headerPosition: "fixed",
containerLayout: "full"
}, dzThemeSet2 = {
typography: "poppins",
version: "light",
layout: "horizontal",
primary: "color_2",
headerBg: "color_2",
navheaderBg: "color_2",
sidebarBg: "color_1",
sidebarStyle: "full",
sidebarPosition: "fixed",
headerPosition: "fixed",
containerLayout: "full"
}, dzThemeSet3 = {
typography: "poppins",
version: "light",
layout: "vertical",
primary: "color_8",
headerBg: "color_1",
navheaderBg: "color_8",
sidebarBg: "color_1",
sidebarStyle: "full",
sidebarPosition: "fixed",
headerPosition: "fixed",
containerLayout: "full"
}, dzThemeSet4 = {
typography: "poppins",
version: "light",
layout: "vertical",
primary: "color_5",
headerBg: "color_5",
navheaderBg: "color_5",
sidebarBg: "color_1",
sidebarStyle: "full",
sidebarPosition: "fixed",
headerPosition: "fixed",
containerLayout: "full"
}, dzThemeSet5 = {
typography: "poppins",
version: "light",
layout: "vertical",
primary: "color_11",
headerBg: "color_1",
navheaderBg: "color_11",
sidebarBg: "color_11",
sidebarStyle: "full",
sidebarPosition: "fixed",
headerPosition: "fixed",
containerLayout: "full"
}, dzThemeSet6 = {
typography: "poppins",
version: "light",
layout: "vertical",
primary: "color_5",
headerBg: "color_1",
navheaderBg: "color_1",
sidebarBg: "color_1",
sidebarStyle: "full",
sidebarPosition: "fixed",
headerPosition: "fixed",
containerLayout: "full"
}, dzThemeSet7 = {
typography: "poppins",
version: "light",
layout: "vertical",
primary: "color_9",
headerBg: "color_1",
navheaderBg: "color_9",
sidebarBg: "color_9",
sidebarStyle: "full",
sidebarPosition: "fixed",
headerPosition: "fixed",
containerLayout: "full"
}, dzThemeSet8 = {
typography: "poppins",
version: "light",
layout: "vertical",
primary: "color_10",
headerBg: "color_1",
navheaderBg: "color_10",
sidebarBg: "color_10",
sidebarStyle: "mini",
sidebarPosition: "fixed",
headerPosition: "fixed",
containerLayout: "full"
};
function themeChange(theme) {
var themeSettings = {};
dzSettingsOptions = themeSettings = eval("dzThemeSet" + theme), new dzSettings(themeSettings), setThemeInCookie(themeSettings)
}
function setThemeInCookie(e) {
jQuery.each(e, function (e, o) {
setCookie(e, o)
})
}
function setThemeLogo() {
var e = getCookie("logo_src"), o = getCookie("logo_src2");
"" != e && jQuery(".nav-header .logo-abbr").attr("src", e), "" != o && jQuery(".nav-header .logo-compact, .nav-header .brand-title").attr("src", o)
}
function getElementAttrs(e) {
return [].slice.call(e.attributes).map(e => ({name: e.name, value: e.value}))
}
function handleSetThemeOption(e, o, i) {
var r = e.name.replace("data-", "").replace("-", "_");
if ("sidebarbg" === r || "primary" === r || "headerbg" === r || "nav_headerbg" === r) {
if ("color_1" === e.value) return !1;
var a = r.replace("bg", "");
document.getElementById(a + "_" + e.value).checked = !0
} else if ("navigationbarimg" === r) document.getElementById("sidebar_img_" + e.value.split("sidebar-img/index.html")[1].split(".")[0]).checked = !0; else if ("sidebartext" === r) document.getElementById("sidebar_text_" + e.value).checked = !0; else if ("direction" === r || "nav_headerbg" === r || "headerbg" === r) document.getElementById("theme_direction").value = e.value; else if ("sidebar_style" === r || "sidebar_position" === r || "header_position" === r || "typography" === r || "theme_version" === r) {
if ("cairo" === e.value || "full" === e.value || "fixed" === e.value || "light" === e.value) return !1;
document.getElementById(r).value = e.value
} else if ("layout" === r) {
if ("vertical" === e.value) return !1;
document.getElementById("theme_layout").value = e.value
} else if ("container" === r) {
if ("wide" === e.value) return !1;
document.getElementById("container_layout").value = e.value
}
$(".nice-select").niceSelect("update")
}
function setThemeOptionOnPage() {
"" != getCookie("version") && (jQuery.each(themeOptionArr, function (e, o) {
var i = getCookie(e);
themeOptionArr[e] = "" != i ? i : dzSettingsOptions[e]
}), dzSettingsOptions = themeOptionArr, new dzSettings(dzSettingsOptions), setThemeLogo())
}
jQuery(document).on("click", ".dz_theme_demo", function () {
themeChange(jQuery(this).data("theme"), "ltr")
}), jQuery(document).on("click", ".dz_theme_demo_rtl", function () {
themeChange(jQuery(this).data("theme"), "rtl")
}), jQuery(window).on("load", function () {
void 0 != theme ? themeChange(theme) : "" == getCookie("version") && themeChange(0), setTimeout(() => {
getElementAttrs(document.querySelector("body")).forEach(handleSetThemeOption)
}, 1500), setThemeOptionOnPage()
}), jQuery(window).on("resize", function () {
setThemeOptionOnPage()
})
}(jQuery);