| 18 |
eval("function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\njQuery(function ($) {\n var Adminify_Theme_Presetter = /*#__PURE__*/function () {\n function Adminify_Theme_Presetter() {\n _classCallCheck(this, Adminify_Theme_Presetter);\n this.prev_preset = $('input[data-depend-id=\"adminify_theme\"]:checked').parent().parent();\n this.themes = this.get_themes();\n this.$dom = $(\"body.wp-adminify\");\n this.set_events();\n this.set_custom_theme();\n this.get_prev_preset();\n this.set_parent_colors();\n this.pro_theme_name_remove();\n }\n return _createClass(Adminify_Theme_Presetter, [{\n key: \"pro_theme_name_remove\",\n value: function pro_theme_name_remove() {\n var strip = function strip() {\n $('.adminify-field-image_select .adminify-pro-notice').find('input[name=\"_wpadminify[adminify_theme]\"]').removeAttr('name');\n };\n var attempt = function attempt() {\n var tries = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n if ($('.adminify-field-image_select .adminify-pro-notice').length) {\n strip();\n return;\n }\n if (tries < 30) setTimeout(function () {\n return attempt(tries + 1);\n }, 100);\n };\n attempt();\n $(window).on('load', strip);\n }\n }, {\n key: \"get_prev_preset\",\n value: function get_prev_preset() {\n return this.prev_preset;\n }\n }, {\n key: \"set_prev_preset\",\n value: function set_prev_preset(prev_theme) {\n this.prev_preset = prev_theme;\n }\n }, {\n key: \"get_themes\",\n value: function get_themes() {\n return PXLBSADMINIFY_PRESET_THEMES;\n }\n }, {\n key: \"set_theme\",\n value: function set_theme(theme) {\n var _theme = this.themes[theme];\n this.set_colors(_theme);\n this.set_parent_colors(_theme);\n }\n\n // iframe parent style change\n }, {\n key: \"set_parent_colors\",\n value: function set_parent_colors(colors) {\n var attrs = \"\";\n for (var color in colors) {\n attrs += \"\".concat(color, \": \").concat(colors[color], \";\");\n }\n this.set_parent_color(attrs);\n }\n }, {\n key: \"set_parent_color\",\n value: function set_parent_color(attrs) {\n window.parent.document.body.setAttribute(\"style\", attrs);\n }\n //End parent style\n }, {\n key: \"set_colors\",\n value: function set_colors(colors) {\n for (var color in colors) this.set_color(color, colors[color]);\n }\n }, {\n key: \"set_custom_theme\",\n value: function set_custom_theme() {\n if ($('input[data-depend-id=\"adminify_theme\"]:checked').val() != \"custom\") return;\n var $customPallete = $('input[name=\"_wpadminify[adminify_theme_custom_colors][--adminify-preset-background]\"]');\n this.set_color(\"--adminify-preset-background\", $customPallete.val());\n var $customPallete = $('input[name=\"_wpadminify[adminify_theme_custom_colors][--adminify-primary]\"]');\n this.set_color(\"--adminify-primary\", $customPallete.val());\n // For manage variables\n this.set_color(\"--adminify-menu-hover-bg\", $customPallete.val());\n this.set_color(\"--adminify-menu-active-bg\", $customPallete.val());\n this.set_color(\"--adminify-submenu-text-hover-color\", $customPallete.val());\n this.set_color(\"--adminify-submenu-active-color\", $customPallete.val());\n this.set_color(\"--adminify-notif-bg-color\", $customPallete.val());\n // this.set_color(\"--adminify-menu-active-color\", $customPallete.val());\n\n $customPallete = $('input[name=\"_wpadminify[adminify_theme_custom_colors][--adminify-menu-bg]\"]');\n this.set_color(\"--adminify-menu-bg\", $customPallete.val());\n // For manage variables\n this.set_color(\"--adminify-submenu-wrapper-bg\", $customPallete.val());\n $customPallete = $('input[name=\"_wpadminify[adminify_theme_custom_colors][--adminify-menu-text-color]\"]');\n this.set_color(\"--adminify-menu-text-color\", $customPallete.val());\n // For manage variables\n this.set_color(\"--adminify-submenu-text-color\", $customPallete.val());\n $customPallete = $('input[name=\"_wpadminify[adminify_theme_custom_colors][--adminify-notif-bg-color]\"]');\n this.set_color(\"--adminify-notif-bg-color\", $customPallete.val());\n\n // $customPallete = $(\n // 'input[name=\"_wpadminify[adminify_theme_custom_colors][--adminify-text-color]\"]'\n // );\n // this.set_color(\"--adminify-text-color\", $customPallete.val());\n\n // Transparent Color\n this.set_color(\"--adminify-submenu-hover-bg\", \"transparent\");\n this.set_color(\"--adminify-submenu-active-bg\", \"transparent\");\n // White Color\n this.set_color(\"--adminify-menu-text-hover-color\", \"#ffffff\");\n }\n }, {\n key: \"set_color\",\n value: function set_color(prop, val) {\n this.$dom.css(prop, val);\n }\n }, {\n key: \"set_events\",\n value: function set_events() {\n var that = this;\n $('input[name=\"_wpadminify[adminify_theme_custom_colors][--adminify-preset-background]\"]').on(\"change\", function () {\n that.set_color(\"--adminify-preset-background\", $(this).val());\n });\n $('input[name=\"_wpadminify[adminify_theme_custom_colors][--adminify-primary]\"]').on(\"change\", function () {\n that.set_color(\"--adminify-primary\", $(this).val());\n // For manage variables\n that.set_color(\"--adminify-menu-hover-bg\", $(this).val());\n that.set_color(\"--adminify-menu-active-bg\", $(this).val());\n that.set_color(\"--adminify-submenu-text-hover-color\", $(this).val());\n that.set_color(\"--adminify-submenu-active-color\", $(this).val());\n that.set_color(\"--adminify-notif-bg-color\", $(this).val());\n // that.set_color(\"--adminify-menu-active-color\", $(this).val());\n });\n $('input[name=\"_wpadminify[adminify_theme_custom_colors][--adminify-menu-bg]\"]').on(\"change\", function () {\n that.set_color(\"--adminify-menu-bg\", $(this).val());\n // For manage variables\n that.set_color(\"--adminify-submenu-wrapper-bg\", $(this).val());\n });\n $('input[name=\"_wpadminify[adminify_theme_custom_colors][--adminify-menu-text-color]\"]').on(\"change\", function () {\n that.set_color(\"--adminify-menu-text-color\", $(this).val());\n });\n $('input[name=\"_wpadminify[adminify_theme_custom_colors][--adminify-notif-bg-color]\"]').on(\"change\", function () {\n that.set_color(\"--adminify-notif-bg-color\", $(this).val());\n });\n\n // $('input[name=\"_wpadminify[adminify_theme_custom_colors][--adminify-text-color]\"]').on(\n // \"change\",\n // function () {\n // that.set_color(\"--adminify-text-color\", $(this).val());\n // }\n // );\n\n $('input[data-depend-id=\"adminify_theme\"]').on(\"change\", function () {\n var selected_preset = $(this).filter(\":checked\").val();\n var preset_wrapper = $(this).parent().parent();\n if (preset_wrapper.hasClass(\"adminify-pro-notice\")) {\n setTimeout(function () {\n preset_wrapper.removeClass(\"adminify--active\");\n that.get_prev_preset().addClass(\"adminify--active\");\n }, 1);\n return;\n }\n if (!Object.keys(PXLBSADMINIFY_PRESET_THEMES).includes(selected_preset)) return;\n that.set_prev_preset(preset_wrapper);\n if (selected_preset == \"custom\") {\n that.set_custom_theme();\n } else {\n that.set_theme(selected_preset);\n }\n });\n }\n }]);\n }();\n new Adminify_Theme_Presetter();\n});\n\n//# sourceURL=webpack://adminify/./dev/admin/wp-adminify-theme-presetter.js?"); |