| Current File : /home/tekstore/public_html/wp-content/themes/cerato/core/assets/js/customize-preview.min.js |
!function(c,s){"use strict";if(!window.wp||!window.wp.customize)throw new ReferenceError("WordPress Customizer Javascript API is not accessible!");s.zoo=s.zoo||{};var o=window.wp.customize,e=c(window.document),n=top||window.parent,t=function(){function e(e){this.mods=e,this.devices=["desktop","mobile"],this.typo={fonts:{},subsets:{},variants:{}},this.css={devices:{all:"",desktop:"",mobile:""},queries:{all:"%s",desktop:"%s",mobile:"@media screen and (max-width: 992px) { %s }"}},this.lastMods=e}return e.prototype.parseFields=function(e,s,n,i){_.isUndefined(n)&&(n=!1),_.isObject(s)||(s={});var a=this,o={};return _.each(e,function(e){var t=_.isUndefined(s[e.name])?null:s[e.name];if((!_.isNull(t)||!n)&&e.selector&&e.css_format)switch(e.type){case"css_rule":o[e.name]=a.parseDevicesData(e,"setup_css_rule",t,i);break;case"slider":o[e.name]=a.parseDevicesData(e,"setup_slider",t,i);break;case"color":o[e.name]=a.parseDevicesData(e,"setup_color",t,i);break;case"shadow":o[e.name]=a.parseDevicesData(e,"setup_shadow",t,i);break;case"checkbox":"html_class"==e.css_format?a.html_class(e,t):o[e.name]=a.parseDevicesData(e,"setup_checkbox",t,i);break;case"image":o[e.name]=a.parseDevicesData(e,"setup_image",t,i);break;case"text_align":case"text_align_no_justify":o[e.name]=a.parseDevicesData(e,"setup_text_align",t,i);break;case"font":o[e.name]=a.font(e,t,i);break;case"styling":o[e.name]=a.styling(e,t,i);break;case"typography":o[e.name]=a.typography(e,t,i);break;case"modal":a.modal(e,t);break;default:switch(e.css_format){case"background":case"styling":o[e.name]=a.styling(e,t,i);break;case"typography":o[e.name]=a.typography(e,t,i);break;case"html_class":a.html_class(e,t);break;case"html_replace":a.html_replace(e,t);break;default:o[e.name]=a.parseDevicesData(e,"setup_default",t,i)}}}),o},e.prototype.render=function(e){if(e){this.lastMods=this.mods,this.mods=o.get(),this.typo={fonts:{},subsets:{},variants:{}},this.css={devices:{all:"",desktop:"",mobile:""},queries:{all:"%s",desktop:"%s",mobile:"@media screen and (max-width: 992px) { %s }"}},ZooCustomizePreviewData.cssMediaQueries&&(this.css.queries=ZooCustomizePreviewData.cssMediaQueries),this.parseFields(ZooCustomizePreviewData.fields);var n=this,i="",a=0;_.each(this.css.devices,function(e,t){var s="";0<a&&(s="\r\n\r\n\r\n\r\n\r"),i+=s+n.css.queries[t].replace(/%s/g,e)+"\r\n",a++});var t=this.getGoogleFontsUrl();c("#zoo-google-font-css").length<=0&&c("head").prepend('<link rel="stylesheet" id="zoo-google-font-css" href="" media="all">'),t?c("#zoo-google-font-css").attr("href",t):c("#zoo-google-font-css").remove(),i=i.trim(),c("#zoo-style-inline-css").length<=0&&c("head").append("<style id='zoo-style-inline-css' type='text/css'></style>"),c("#zoo-style-inline-css").html(i),c(document).trigger("header_builder_panel_changed",["auto_render_css",e]),c(document).trigger("after_auto_render_css",["after_auto_render_css",e])}},e.prototype.getFieldData=function(e,t,s){t||(t="desktop"),s||(s=!1);var n,i=null,a=!1;if(!_.isUndefined(ZooCustomizePreviewData.fields["setting|"+e])){var o=ZooCustomizePreviewData.fields["setting|"+e];a=!_.isUndefined(o.default)&&o.default}if(n=_.isUndefined(this.mods[e])?a:this.mods[e],_.isString(n))try{var r=JSON.parse(decodeURI(n));_.isNull(r)||(n=r)}catch(e){}if(s){var l=!!_.isUndefined(n[s])&&n[s];i="all"!==t&&_.isObject(l)&&_.isObject(l)&&!_.isUndefined(l[t])?l[t]:l}else"all"!==t?_.isObject(n)&&!_.isUndefined(n[t])&&(i=n[t]):i=n;return i},e.prototype.getGoogleFontsUrl=function(e){e=e||this.typo.fonts;var t="//fonts.googleapis.com/css?family=",s="",n=this;return!_.isEmpty(e)&&(_.each(e,function(e){s&&(s+="|"),s+=e.replace(/\s/g,"+");var t={};_.isUndefined(n.typo.variants[e])||_.each(n.typo.variants[e],function(e){if("regular"!==e)switch(e){case"italic":t[e]="400i";break;default:_.isString(e)?t[e]=e.replace("italic","i"):t[e]=e}else t[e]="400"}),_.isEmpty(t)||(s+=":"+n.join(t,","))}),t+=s,_.isEmpty(n.typo.subsets)||(t+="&subset="+n.join(n.typo.subsets,",")),t)},e.prototype.join=function(e,t){return _.isUndefined(t)&&(t=""),_.isArray(e)?e.join(t):!_.isObject(e)||_.isEmpty(e)?"":_.values(e).join(t)},e.prototype.str_value=function(e,t,s){if(_.isEmpty(e))return"";if(!_.isString(t))return"";_.isUndefined(s)&&(s="");var n=new RegExp("{{value}}","g"),i=t.replace(n,e),a=new RegExp("{{value_no_unit}}","g");return i=i.replace(a,s)},e.prototype.setup_color=function(e,t){return!(!t||!e)&&this.str_value(e,t)},e.prototype.setup_checkbox=function(e,t){return!(!t||!e)&&t},e.prototype.setup_image=function(e,t){var s=this.sanitize_media(e);return!(!s.url||!t)&&this.str_value(s.url,t)},e.prototype.setup_slider=function(e,t){_.isObject(e)||(e={}),(e=_.defaults(e,{unit:"px",value:null})).unit||(e.unit="px");var s="",n="";return t&&e.value&&(n=e.value+e.unit,s=this.str_value(n,t,e.value)),s},e.prototype.setup_shadow=function(e,t){if(!_.isObject(e))return"";var s=_.defaults(e,{color:null,x:0,y:0,blur:0,spread:0,inset:null}),n=this.sanitize_color(s.color),i=s.inset?"inset":"";if(!n)return"";s.blur||(s.blur=0),s.spread||(s.spread=0),s.x||(s.x=0),s.y||(s.y=0);var a=s.x+"px "+s.y+"px "+s.blur+"px "+s.spread+"px "+n+" "+i;return this.str_value(a,t)},e.prototype.setup_default=function(e,t){return!(!t||!e)&&this.str_value(e,t)},e.prototype.setup_css_rule=function(n,e){_.isObject(n)||(n={}),n=_.defaults(n,{unit:"",top:"",right:"",bottom:"",left:""}),_.isUndefined(n.unit)||(n.unit="px"),e=_.defaults(e,{top:"",right:"",bottom:"",left:""});var i=this,a={};return _.each(e,function(e,t){var s=n[t];s&&e&&e&&(s+=n.unit,a[t]=i.str_value(s,e))}),i.join(a,"\n\t")},e.prototype.setup_text_align=function(e,t){return!(!t||!e)&&this.str_value(e,t)},e.prototype.sanitize_color=function(e){return e},e.prototype.sanitize_slider=function(e){return e=_.defaults(e,{unit:"px",value:null})},e.prototype.sanitize_media=function(e){return _.isObject(e)||(e={}),_.defaults(e,{id:null,url:null,mime:null})},e.prototype.parseDevicesData=function(n,i,a,e){var t="",o={},s=!1,r=!_.isEmpty(n.css_format)&&n.css_format,l=this;_.isUndefined(e)&&(e=!1);var c=!1;return(_.isUndefined(a)||_.isNull(a))&&(a={},c=!0),!_.isUndefined(n.device_settings)&&n.device_settings?(s=!0,_.each(l.devices,function(e){var t=null;c?t=l.getFieldData(n.name,e):_.isUndefined(a[e])||(t=a[e]);var s=!1;l[i]&&(s=l[i](t,r)),s&&(o[e]=s)})):(c&&(a=l.getFieldData(n.name,"all")),l[i]&&(t=l[i](a,r)),o.no_devices=t),t="",e?o:(s?_.each(l.devices,function(e){if(!_.isUndefined(o[e])){var t=o[e];t&&("format"===n.selector?l.css.devices[e]+="\r\n"+t+"\r\n":l.css.devices[e]+="\r\n"+n.selector+" {\r\n\t"+t+"\r\n}\r\n")}}):o.no_devices&&("format"===n.selector?l.css.devices.all+="\r\n"+o.no_devices+"\r\n":l.css.devices.all+="\r\n"+n.selector+" {\r\n\t"+o.no_devices+"\r\n}\r\n"),t)},e.prototype.setup_font=function(e){if(_.isObject(e)||(e={}),!(e=_.defaults(e,{font:null,type:null,variant:null,subsets:null,font_data:null})).font)return"";if("google"==e.type){var t;if(this.typo.fonts[e.font]=e.font,e.variant)if(_.isUndefined(this.typo.variants[e.font]))if(this.typo.variants[e.font]={},_.isString(e.variant))(t={})[e.variant]=e.variant,this.typo.variants[e.font]=_.extend(this.typo.variants[e.font],t);else this.typo.variants[e.font]=_.extend(this.typo.variants[e.font],e.variant);e.typo&&e.typo.subsets&&(this.typo.subsets=_.extend(this.typo.subsets,e.typo.subsets))}return'font-family: "'+e.font+'";'},e.prototype.font=function(n,i){var a="",o=this;return n.device_settings?_.each(this.devices,function(e){var t=null;_.isEmpty(i)?t=o.getFieldData(n.name,e):_.isUndefined(i[e])||(e=i[e]);var s=o.setup_font(t);s&&(o.css.devices[e]="\r\n"+n.selector+" {\r\n\t"+s+"\r\n}\r\n",a+="desktop"===e?"\r\n"+n.selector+" {\r\n\t"+s+"\r\n}":"\r\n."+e+" "+n.selector+" {\r\n\t"+s+"\r\n}\r\n")}):(_.isEmpty(i)&&(i=o.getFieldData(n.name)),a=o.setup_font(i),o.css.devices.all+=" "+n.selector+" {\r\n\t"+a+"\r\n}\r\n",a+=" "+n.selector+" {\r\n\t"+a+"\r\n}\r\n"),a},e.prototype.setup_styling_fields=function(t,e,s,n){var i,a={color:null,x:0,y:0,blur:0,spread:0,inset:null};return _.isObject(s)||(s={}),_.isUndefined(n)&&(n="normal"),!1===t?null:(_.isObject(t)||(t={}),i={},0,_.each(e,function(e){_.isUndefined(a[e.name])?(_.isUndefined(t[e.name])||t[e.name])&&(i[e.name]=e,_.isUndefined(s[n+"_"+e.name])?i[e.name].selector=s[n]:i[e.name].selector=s[n+"_"+e.name],0):(_.isUndefined(t[e.name])||t[e.name])&&(i[e.name]=e,i[e.name].selector=null)}),i)},e.prototype.styling=function(e){var n=this,t=this.getFieldData(e.name,"all");t=_.defaults(t,{normal:{},hover:{}});var s={};_.isString(e.selector)?(s.normal=e.selector,s.hover=e.selector):s=_.defaults(e.selector,{normal:null,hover:null});var i=null,a=-1,o=-1;!_.isUndefined(e.fields)&&_.isObject(e.fields)&&(_.isUndefined(e.fields.tabs)||(i=e.tabs),_.isUndefined(e.fields.normal_fields)||(a=e.normal_fields),_.isUndefined(e.fields.hover_fields)||(o=e.hover_fields));var r=n.setup_styling_fields(a,ZooCustomizePreviewData.styling_config.normal_fields,s,"normal"),l=n.setup_styling_fields(o,ZooCustomizePreviewData.styling_config.hover_fields,s,"hover"),c=_.clone(ZooCustomizePreviewData.styling_config.tabs);!1===i?c.hover=!1:_.isObject(i)&&(c=i);var d=function(e,t){_.each(e,function(s,e){_.isUndefined(u[s.selector])&&(u[s.selector]=""),_.isUndefined(t[e])||(_.isUndefined(t[e].no_devices)?_.each(t[e],function(e,t){_.isUndefined(f[t])&&(f[t]={}),_.isUndefined(f[t][s.selector])&&(f[t][s.selector]=""),e&&(f[t][s.selector]+=e)}):t[e].no_devices&&(u[s.selector]+=t[e].no_devices))})},u={},f={},p=n.parseFields(r,t.normal,!0,!0),v=n.parseFields(l,t.hover,!0,!0);d(r,p),d(l,v),_.each(u,function(e,t){n.css.devices.all+="\r\n"+t+" {\r\n\t"+e+"\r\n}\r\n"}),_.each(n.devices,function(e){var s="";if(!_.isUndefined(f[e])){var t=f[e];_.each(t,function(e,t){_.isString(e)?s+="\r\n"+t+" {\r\n\t"+e+"\r\n}\r\n":s+="\r\n"+t+" {\r\n\t"+n.join(e,"\n")+"\r\n}\r\n"})}n.css.devices[e]+=s})},e.prototype.modal=function(s){var n=this,i=this.getFieldData(s.name,"all");_.isObject(i)||(i={}),_.isObject(s.fields.tabs)&&_.each(s.fields.tabs,function(e,t){_.isObject(s.fields[t+"_fields"])&&n.parseFields(s.fields[t+"_fields"],i[t])})},e.prototype.setup_font_style=function(e){_.isObject(e)||(e={});var t={};(e=_.defaults(e,{b:null,i:null,u:null,s:null,t:null})).b&&(t.b="font-weight: bold;"),e.i&&(t.i="font-style: italic;");var s={};return e.u&&(s.underline="underline"),e.s&&(s["line-through"]="line-through"),_.isEmpty(s)||(t.d="text-decoration: "+this.join(s," ")+";"),e.t&&(t.t="text-transform: uppercase;"),this.join(t,"\r\n\t")},e.prototype.html_replace=function(e,t){var s=e.selector,n=_.clone(t);(_.isUndefined(n)||_.isEmpty(n))&&(n=e.default),c(s).html(n)},e.prototype.html_class=function(n,e){var t;t=_.isUndefined(e)?_.clone(e):this.getFieldData(n.name,"all");var i=n.selector,s=null,a="checkbox"===n.type;if(_.isUndefined(this.lastMods[n.name])||(s=this.lastMods[n.name]),_.isString(s))try{var o=JSON.parse(decodeURI(s));_.isNull(o)||(s=o)}catch(e){}if(a&&(_.isUndefined(n.device_settings)||!n.device_settings)){var r,l=n.name.split("__");return r=1<l.length?l[1]+"-active":n.name+"-active",void(t?c(i).addClass(r):c(i).removeClass(r))}_.isString(s)&&!_.isEmpty(s)?c(i).removeClass(s):_.isObject(s)&&_.each(s,function(e,t){if(e){var s=t+"--"+e;a&&(s=n.name+"-"+s),c(i).removeClass(s)}}),_.isString(t)?c(i).addClass(t):_.isObject(t)&&_.each(t,function(e,t){if(e){var s=t+"--"+e;a&&(s=n.name+"-"+s),c(i).addClass(s)}})},e.prototype.typography=function(s,e){!_.isUndefined(e)&&_.isObject(e)||(e=this.getFieldData(s.name,"all"));var n=this;_.isObject(e)||(e={}),e=_.defaults(e,{font:null,font_type:null,languages:null,font_size:null,font_weight:null,line_height:null,letter_spacing:null,style:null,text_decoration:null,text_transform:null});var i={},t={},a={};if(_.each(ZooCustomizePreviewData.typo_fields,function(e){t[e.name]=e}),_.isUndefined(t.font)||(i.font=this.setup_font({font:e.font,type:e.font_type,subsets:e.languages,variant:e.variant})),_.isUndefined(t.style)||e.style&&"default"!==e.style&&(i.style="font-style: "+e.style+";"),_.isUndefined(t.font_weight)||e.font_weight&&"default"!==e.font_weight&&"default"!==e.font_weight&&("regular"===e.font_weight&&(e.font_weight="normal"),i.font_weight="font-weight: "+e.font_weight+";"),_.isUndefined(t.text_decoration)||e.text_decoration&&"default"!==e.text_decoration&&(i.text_decoration="text-decoration: "+e.text_decoration+";"),_.isUndefined(t.text_transform)||e.text_transform&&"default"!==e.text_transform&&(i.text_transform="text-transform: "+e.text_transform+";"),!_.isUndefined(t.font_size)){t.font_size.css_format="font-size: {{value}};";var o=this.parseDevicesData(t.font_size,"setup_slider",e.font_size,!0);_.isEmpty(o)||(_.isUndefined(o.no_devices)?_.each(o,function(e,t){"desktop"==t?i.font_size=e:(_.isUndefined(a[t])&&(a[t]={}),a[t].font_size=e)}):i.font_size=o.no_devices)}if(!_.isUndefined(t.line_height)){t.line_height.css_format="line-height: {{value}};";var r=this.parseDevicesData(t.line_height,"setup_slider",e.line_height,!0);_.isEmpty(r)||(_.isUndefined(r.no_devices)?_.each(r,function(e,t){"desktop"==t?i.line_height=e:(_.isUndefined(a[t])&&(a[t]={}),a[t].line_height=e)}):i.line_height=r.no_devices)}if(!_.isUndefined(t.letter_spacing)){t.letter_spacing.css_format="letter-spacing: {{value}};";var l=this.parseDevicesData(t.letter_spacing,"setup_slider",e.letter_spacing,!0);l&&(_.isUndefined(l.no_devices)?_.each(l,function(e,t){"desktop"==t?i.letter_spacing=e:(_.isUndefined(a[t])&&(a[t]={}),a[t].letter_spacing=e)}):i.letter_spacing=l.no_devices)}_.each(a,function(e,t){n.css.devices[t]+=" "+s.selector+" {\r\n\t"+n.join(e,"\r\n\t")+"\r\n}"}),n.css.devices.all+=" "+s.selector+" {\r\n\t"+n.join(i,"\r\n\t")+"\r\n}"},e}();o.bind("preview-ready",function(){s.zoo.customizePreview=new t(o.get()),_.each(ZooCustomizePreviewData.fields,function(t){(t.selector&&t.css_format||"modal"===t.type)&&wp.customize(t.name,function(e){e.bind(function(e){s.zoo.customizePreview.render(t.name)})})}),e.on("click",".builder-item-focus .item-preview-name",function(e){e.preventDefault();var t=c(this).closest(".builder-item-focus").attr("data-section")||"";t&&n.wp.customize.section(t)&&n.wp.customize.section(t).focus()})})}(jQuery,window);