PageSourceSearch

https://cx-ex.com/wp-content/themes/saga/assets/js/switcher.js?ver=7.1.2

js cx-ex.com collected 2026-10-03 21:15:11 UTC 6,351 bytes, 115 lines download raw bytes

1!(function (s) {
2    var t,
3        i,
4        o = { hasPreview: !0, defaultThemeId: "jssDefault", fullPath: "css/", cookie: { expires: "", isManagingLoad: !0 } },
5        a = "jss_selected";
6    (i = {
7        getItem: function (e) {
8            return (e && decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(e).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1"))) || null;
9        },
10        setItem: function (e, t, o, s, i, a) {
11            if (!e || /^(?:expires|max\-age|path|domain|secure)$/i.test(e)) return !1;
12            var n = "";
13            if (o)
14                switch (o.constructor) {
15                    case Number:
16                        n = o === 1 / 0 ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + o;
17                        break;
18                    case String:
19                        n = "; expires=" + o;
20                        break;
21                    case Date:
22                        n = "; expires=" + o.toUTCString();
23                }
24            return (document.cookie = encodeURIComponent(e) + "=" + encodeURIComponent(t) + n + (i ? "; domain=" + i : "") + (s ? "; path=" + s : "") + (a ? "; secure" : "")), !0;
25        },
26        removeItem: function (e, t, o) {
27            return !!this.hasItem(e) && ((document.cookie = encodeURIComponent(e) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + (o ? "; domain=" + o : "") + (t ? "; path=" + t : "")), !0);
28        },
29        hasItem: function (e) {
30            return !!e && new RegExp("(?:^|;\\s*)" + encodeURIComponent(e).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=").test(document.cookie);
31        },
32        keys: function () {
33            for (var e = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "").split(/\s*(?:\=[^;]*)?;\s*/), t = e.length, o = 0; o < t; o++) e[o] = decodeURIComponent(e[o]);
34            return e;
35        },
36    }),
37        ((t = function (e, t) {
38            return this.init(e, t);
39        }).prototype = {
40            $root: null,
41            config: {},
42            $themeCss: null,
43            defaultTheme: null,
44            init: function (e, t) {
45                (this.$root = e),
46                    (this.config = t || {}),
47                    this.setDefaultTheme(),
48                    this.defaultTheme ? (this.config.cookie && this.checkCookie(), this.config.hasPreview && this.addHoverEvents(), this.addClickEvents()) : this.$root.addClass("jssError error level0");
49            },
50            setDefaultTheme: function () {
51                (this.$themeCss = s("link[id=" + this.config.defaultThemeId + "]")), this.$themeCss.length && (this.defaultTheme = this.$themeCss.attr("href"));
52            },
53            resetStyle: function () {
54                this.updateStyle(this.defaultTheme);
55            },
56            updateStyle: function (e) {
57                this.$themeCss.attr("href", e);
58            },
59            getFullAssetPath: function (e) {
60                return this.config.fullPath + e + ".css";
61            },
62            checkCookie: function () {
63                var e;
64                this.config.cookie && this.config.cookie.isManagingLoad && (e = i.getItem(a)) && ((newStyle = this.getFullAssetPath(e)), this.updateStyle(newStyle), (this.defaultTheme = newStyle));
65            },
66            addHoverEvents: function () {
67                var t = this;
68                this.$root.find("a").hover(
69                    function () {
70                        var e = s(this).data("theme"),
71                            e = t.getFullAssetPath(e);
72                        t.updateStyle(e);
73                    },
74                    function () {
75                        t.resetStyle();
76                    }
77                );
78            },
79            addClickEvents: function () {
80                var o = this;
81                this.$root.find(".setColor").on("click", function () {
82                    var e = s(this).data("theme"),
83                        t = o.getFullAssetPath(e);
84                    o.updateStyle(t), (o.defaultTheme = t), o.config.cookie && i.setItem(a, e, o.config.cookie.expires, "/");
85                });
86            },
87        }),
88        (s.fn.styleSwitcher = function (e) {
89            return new t(this, s.extend(!0, o, e));
90        }),
91        s(function () {
92            function e() {
93                (styleCookieVal = s("body").hasClass("dark-mode-on") ? "dark" : "light"), Cookies.set("styleCookieName", styleCookieVal, { expires: 7 }), Cookies.set("styleCookieName", styleCookieVal);
94            }
95            s("#color-switcher ul").styleSwitcher({ defaultThemeId: "papr-dark-css", hasPreview: !1, fullPath: "css/", cookie
95: { expires: 2628e3, isManagingLoad: !0 } }),
96                "dark" == Cookies.get("styleCookieName") ? s("body").addClass("dark-mode-on") : (Cookies.get("styleCookieName"), s("body").removeClass("active-light-mode"));
97            var t = Cookies.get("styleCookieName");
98            "dark" == t
99                ? (s(".color-switcher").find(".setColor.dark").addClass("active"), s("body").removeClass("active-light-mode").addClass("dark-mode-on"))
100                : "light" == t
101                ? (s(".color-switcher").find(".setColor.light").addClass("active"), s("body").removeClass("dark-mode-on").addClass("active-light-mode"))
102                : s("body").hasClass("dark-mode-on")
103                ? (s(".color-switcher").find(".setColor.light").removeClass("active"), s(".color-switcher").find(".setColor.dark").addClass("active"))
104                : (s(".color-switcher").find(".setColor.dark").removeClass("active"), s(".color-switcher").find(".setColor.light").addClass("active")),
105                s(".color-switcher .setColor").on("click", function () {
106                    s(this).closest("ul").find("li").siblings().find(".active").removeClass("active"), s(this).addClass("active"), e();
107                }),
108                s(".color-switcher .setColor.dark").on("click", function () {
109                    s("body").removeClass("active-light-mode").addClass("dark-mode-on"), e();
110                }),
111                s(".color-switcher .setColor.light").on("click", function () {
112                    s("body").removeClass("dark-mode-on").addClass("active-light-mode"), e();
113                });
114        });
115})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.