(function($) { $(function() { var cl_required_data = {}; $('.rwmb-field.required').each(function() { console.log('ketuuu'); var id = $(this).attr('data-actual-id'); var field = {}; var required_id = $(this).attr('data-required-field'); field['value'] = $(this).attr('data-required-value'); field['operator'] = $(this).attr('data-required-operator'); field['id'] = id; if (typeof cl_required_data[required_id] != 'undefined') cl_required_data[required_id].push(field); else { cl_required_data[required_id] = []; cl_required_data[required_id].push(field); } }); console.log(cl_required_data); $.each(cl_required_data, function(key, fields) { var is_active = function($element) { var current_value = $element.val(); console.log($element); if ($element.is('[type="checkbox"]')) current_value = $element.is(':checked'); console.log(current_value); for (index = 0; index < fields.length; ++index) { var active = false; var current_field = fields[index]; if (current_field.operator == '=') { if (current_field.value == current_value) active = true; } console.log(active); if (active) $('[data-actual-id="' + current_field.id + '"]').addClass('show_required'); else $('[data-actual-id="' + current_field.id + '"]').removeClass('show_required'); } }; $('#' + key).each(function() { is_active($(this)); $(this).on('change', function() { is_active($(this)); }) }); }); $('.library_categories li').on('click', function(e) { e.preventDefault(); var sort = $(this).data('sort'); $(this).parent().find('li').removeClass('active'); $(this).addClass('active'); if (sort == 'all') { $('.vc_templates-list-default_templates').find('.vc_ui-template').show(); } else { $('.vc_templates-list-default_templates').find('.vc_ui-template').hide(); $('.vc_templates-list-default_templates').find('.vc_ui-template.' + sort).show(); } }); var myLazyLoad = new LazyLoad({ elements_selector: ".lazy" }); if ($('#vc_templates-editor-button').length > 0) $('#vc_templates-editor-button').append('Aronia Content Blocks'); }); })(jQuery); var _extends = Object.assign || function(t) { for (var e = 1; e < arguments.length; e++) { var n = arguments[e]; for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]) } return t }, _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t }; ! function(t, e) { "object" === ("undefined" == typeof exports ? "undefined" : _typeof(exports)) && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : t.LazyLoad = e() }(this, function() { "use strict"; function t(t, e, n) { var o = e._settings;!n && i(t) || (C(o.callback_enter, t), R.indexOf(t.tagName) > -1 && (N(t, e), I(t, o.class_loading)), E(t, e), a(t), C(o.callback_set, t)) } var e = { elements_selector: "img", container: document, threshold: 300, thresholds: null, data_src: "src", data_srcset: "srcset", data_sizes: "sizes", data_bg: "bg", class_loading: "loading", class_loaded: "loaded", class_error: "error", load_delay: 0, callback_load: null, callback_error: null, callback_set: null, callback_enter: null, callback_finish: null, to_webp: !1 }, n = function(t) { return _extends({}, e, t) }, o = function(t, e) { return t.getAttribute("data-" + e) }, r = function(t, e, n) { var o = "data-" + e; null !== n ? t.setAttribute(o, n) : t.removeAttribute(o) }, a = function(t) { return r(t, "was-processed", "true") }, i = function(t) { return "true" === o(t, "was-processed") }, s = function(t, e) { return r(t, "ll-timeout", e) }, c = function(t) { return o(t, "ll-timeout") }, l = function(t) { return t.filter(function(t) { return !i(t) }) }, u = function(t, e) { return t.filter(function(t) { return t !== e }) }, d = function(t, e) { var n, o = new t(e); try { n = new CustomEvent("LazyLoad::Initialized", { detail: { instance: o } }) } catch (t) { (n = document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized", !1, !1, { instance: o }) } window.dispatchEvent(n) }, f = function(t, e) { return e ? t.replace(/\.(jpe?g|png)/gi, ".webp") : t }, _ = "undefined" != typeof window, v = _ && !("onscroll" in window) || /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent), g = _ && "IntersectionObserver" in window, h = _ && "classList" in document.createElement("p"), b = _ && function() { var t = document.createElement("canvas"); return !(!t.getContext || !t.getContext("2d")) && 0 === t.toDataURL("image/webp").indexOf("data:image/webp") }(), m = function(t, e, n, r) { for (var a, i = 0; a = t.children[i]; i += 1) if ("SOURCE" === a.tagName) { var s = o(a, n); p(a, e, s, r) } }, p = function(t, e, n, o) { n && t.setAttribute(e, f(n, o)) }, y = function(t, e) { var n = b && e.to_webp, r = o(t, e.data_src), a = o(t, e.data_bg); if (r) { var i = f(r, n); t.style.backgroundImage = 'url("' + i + '")' } if (a) { var s = f(a, n); t.style.backgroundImage = s } }, w = { IMG: function(t, e) { var n = b && e.to_webp, r = e.data_srcset, a = t.parentNode; a && "PICTURE" === a.tagName && m(a, "srcset", r, n); var i = o(t, e.data_sizes); p(t, "sizes", i); var s = o(t, r); p(t, "srcset", s, n); var c = o(t, e.data_src); p(t, "src", c, n) }, IFRAME: function(t, e) { var n = o(t, e.data_src); p(t, "src", n) }, VIDEO: function(t, e) { var n = e.data_src, r = o(t, n); m(t, "src", n), p(t, "src", r), t.load() } }, E = function(t, e) { var n = e._settings, o = t.tagName, r = w[o]; if (r) return r(t, n), e._updateLoadingCount(1), void(e._elements = u(e._elements, t)); y(t, n) }, I = function(t, e) { h ? t.classList.add(e) : t.className += (t.className ? " " : "") + e }, L = function(t, e) { h ? t.classList.remove(e) : t.className = t.className.replace(new RegExp("(^|\\s+)" + e + "(\\s+|$)"), " ").replace(/^\s+/, "").replace(/\s+$/, "") }, C = function(t, e) { t && t(e) }, O = function(t, e, n) { t.addEventListener(e, n) }, k = function(t, e, n) { t.removeEventListener(e, n) }, x = function(t, e, n) { O(t, "load", e), O(t, "loadeddata", e), O(t, "error", n) }, A = function(t, e, n) { k(t, "load", e), k(t, "loadeddata", e), k(t, "error", n) }, z = function(t, e, n) { var o = n._settings, r = e ? o.class_loaded : o.class_error, a = e ? o.callback_load : o.callback_error, i = t.target; L(i, o.class_loading), I(i, r), C(a, i), n._updateLoadingCount(-1) }, N = function(t, e) { var n = function n(r) { z(r, !0, e), A(t, n, o) }, o = function o(r) { z(r, !1, e), A(t, n, o) }; x(t, n, o) }, R = ["IMG", "IFRAME", "VIDEO"], S = function(e, n, o) { t(e, o), n.unobserve(e) }, M = function(t) { var e = c(t); e && (clearTimeout(e), s(t, null)) }, j = function(t, e, n) { var o = n._settings.load_delay, r = c(t); r || (r = setTimeout(function() { S(t, e, n), M(t) }, o), s(t, r)) }, D = function(t) { return t.isIntersecting || t.intersectionRatio > 0 }, T = function(t) { return { root: t.container === document ? null : t.container, rootMargin: t.thresholds || t.threshold + "px" } }, U = function(t, e) { this._settings = n(t), this._setObserver(), this._loadingCount = 0, this.update(e) }; return U.prototype = { _manageIntersection: function(t) { var e = this._observer, n = this._settings.load_delay, o = t.target; n ? D(t) ? j(o, e, this) : M(o) : D(t) && S(o, e, this) }, _onIntersection: function(t) { t.forEach(this._manageIntersection.bind(this)) }, _setObserver: function() { g && (this._observer = new IntersectionObserver(this._onIntersection.bind(this), T(this._settings))) }, _updateLoadingCount: function(t) { this._loadingCount += t, 0 === this._elements.length && 0 === this._loadingCount && C(this._settings.callback_finish) }, update: function(t) { var e = this, n = this._settings, o = t || n.container.querySelectorAll(n.elements_selector); this._elements = l(Array.prototype.slice.call(o)), !v && this._observer ? this._elements.forEach(function(t) { e._observer.observe(t) }) : this.loadAll() }, destroy: function() { var t = this; this._observer && (this._elements.forEach(function(e) { t._observer.unobserve(e) }), this._observer = null), this._elements = null, this._settings = null }, load: function(e, n) { t(e, this, n) }, loadAll: function() { var t = this; this._elements.forEach(function(e) { t.load(e) }) } }, _ && function(t, e) { if (e) if (e.length) for (var n, o = 0; n = e[o]; o += 1) d(t, n); else d(t, e) }(U, window.lazyLoadOptions), U }); //# sourceMappingURL=lazyload.min.js.map