";$(".pixflow-custom-sections").append(userSections)};mBuilder.prototype.saveSection=function(selector,sectionName){if(!this.sectionExists(sectionName)){document.getElementsByClassName("popupSaveSection-error")[0].innerHTML="section is already exists please choose another name";return}this.update_meditor_models();var that=this,getShortocdeTag=that.shortcodeTag(selector),regex=that.shortcodeRegex("vc_row"),params=regex.exec(getShortocdeTag),rowAttrs=wp.shortcode.attrs(params[3]),sectionContent=params[5];rowAttrs.named["content"]=sectionContent;sectionName=sectionName.trim();document.getElementsByClassName("popupSaveSection-button")[0].innerHTML="SAVING";$.ajax({type:"post",url:mBuilderValues.ajax_url,data:{action:"mBuilder_save_custom_section",section:rowAttrs.named,section_name:sectionName},success:function(response){if(response==1){that.customSection[sectionName]=rowAttrs.named;document.getElementsByClassName("popupSaveSection-button")[0].innerHTML="SAVED";setTimeout(function(){that.closeSaveSectionPopup()},500);that.addToSectionPanel(sectionName);that.applyDragForce('.pixflow-custom-section[data-section-id="'+sectionName+'"]');setTimeout(function(){$(".pixflow-add-element-button").click();var down=$(".pixflow-sections-container");down.scrollTop(down.prop("scrollHeight"));$('.panel-tab[data-tab="sections"]').click()},500);return}document.getElementsByClassName("popupSaveSection-button")[0].innerHTML="CREATE";document.getElementsByClassName("popupSaveSection-error")[0].innerHTML="Oops! Something went wrong with Saving!"},error:function(){document.getElementsByClassName("popupSaveSection-button")[0].innerHTML="CREATE";document.getElementsByClassName("popupSaveSection-error")[0].innerHTML="Network error!"}})};mBuilder.prototype.closeSaveSectionPopup=function(){$(".popupSaveSection-container").fadeOut(500,function(){$(this).css({opacity:"1"});document.getElementsByClassName("popupSaveSection-field")[0].value="";document.getElementsByClassName("popupSaveSection-button")[0].innerHTML="CREATE"});document.getElementsByClassName("popupSaveSection-error")[0].innerHTML=""};mBuilder.prototype.deleteSection=function(sectionName){var that=this;if(that.sectionExists(sectionName)){alert("section is not exists ");return}sectionName=sectionName.trim();$.ajax({type:"post",url:mBuilderValues.ajax_url,data:{action:"mBuilder_delete_custom_section",section_name:sectionName},success:function(response){if(response==1){delete that.customSection[sectionName];$("body").trigger("delete_section",[sectionName]);return}alert("Error on delete section")},error:function(){alert("Network error")}})};mBuilder.prototype.shortcodeTag=function(obj,onlyChildren,depth){var t=this,el=$(obj),id=el.attr("data-mbuilder-id");if(!el.length){return""}if(!depth){depth=0}var model=t.models.models[id];model.attr=model.attr!=undefined?model.attr:"";model.content=model.content!=undefined?model.content:"";if(!onlyChildren){var tag="["+model.type+" "+model.attr+' mbuilder-id="'+id+'"]'+model.content}depth++;el.find(".mBuilder-element").each(function(){for(var i in t.compiledTags){if(t.compiledTags[i]==this)return}tag+=t.shortcodeTag(this,false,depth)});t.compiledTags.push(el.get(0));depth--;if(!onlyChildren){tag+="[/"+model.type+"]"}if(depth==0){t.compiledTags=[]}return tag};mBuilder.prototype.saveContent=function(){var t=this;$("body").addClass("content-saving");this.set_parents();$(".mBuilder-element").each(function(){var $el=$(this),id=$el.attr("data-mBuilder-id");var order=1;$el.siblings(".mBuilder-element").addBack().each(function(){t.models.models[$(this).attr("data-mbuilder-id")]["order"]=order++})});t.update_meditor_models();var models={};for(i in t.models.models){if(t.models.models[i]!=null){models[i]=t.models.models[i]}}this.save_button_animation_start();$.ajax({type:"post",url:mBuilderValues.ajax_url,data:{action:"mBuilder_saveContent",nonce:mBuilderValues.ajax_nonce,models:JSON.stringify(models),id:$('meta[name="post-id"]').attr("content"),mbuilder_editor:true},success:function(response){$("body").removeClass("content-saving changed");t.save_button_animation_end();if(typeof t.save_callback_function=="function"){t.save_callback_function()}}})};var dependChange=[];mBuilder.prototype.dependencyInjection=function(){var tabs=this.settingPanel.find("#mBuilderTabs > ul li");this.settingPanel.find("[data-mBuilder-dependency]").each(function(){var json=JSON.parse($(this).attr("data-mBuilder-dependency"));var el=$(this);if(typeof json.element=="undefined")return;var depend=$("[name="+json.element+"]");dependChange.push(depend);if(depend.attr("type")!="hidden"||depend.attr("data-type")=="dropdown"){if(typeof json.value!="object"){json.value=[json.value]}if($.inArray($(depend).val(),json.value)!=-1&&!$(depend).closest(".vc_column").hasClass("dependency-hide")){el.removeClass("dependency-hide")}else{el.addClass("dependency-hide")}el.find("select,input").trigger("change");tabs.each(function(){var id=$(this).attr("aria-controls");var result=false;var element=document.getElementById(id);$(element).find(">.vc_column").each(function(){if(!$(this).hasClass("dependency-hide")){result=true;return false}});if(!result){$(this).addClass("dependency-hide")}else{$(this).removeClass("dependency-hide")}});depend.change(function(){if(typeof json.value!="object"){json.value=[json.value]}if($.inArray($(this).val(),json.value)!=-1&&!$(this).closest(".vc_column").hasClass("dependency-hide")){el.removeClass("dependency-hide")}else{el.addClass("dependency-hide")}el.find("select,input").trigger("change");el.find(".dropdown-title").click();tabs.each(function(){var id=$(this).attr("aria-controls");var result=false;var element=document.getElementById(id);$(element).find(">.vc_column").each(function(){if(!$(this).hasClass("dependency-hide")){result=true;return false}});if(!result){$(this).addClass("dependency-hide")}else{$(this).removeClass("dependency-hide")}})})}else{if(typeof json.value!="object"){json.value=[json.value]}if($.inArray(depend.val(),json.value)!=-1&&!depend.closest(".vc_column").hasClass("dependency-hide")){el.removeClass("dependency-hide")}else{el.addClass("dependency-hide")}el.find("select,input").trigger("change");tabs.each(function(){var id=$(this).attr("aria-controls");var result=false;var element=document.getElementById(id);$(element).find(">.vc_column").each(function(){if(!$(this).hasClass("dependency-hide")){result=true;return false}});if(!result){$(this).addClass("dependency-hide")}else{$(this).removeClass("dependency-hide")}});depend.siblings("[data-name="+depend.attr("name")+"]").change(function(){setTimeout(function(){if(typeof json.value!="object"){json.value=[json.value]}if($.inArray(depend.val(),json.value)!=-1&&!depend.closest(".vc_column").hasClass("dependency-hide")){el.removeClass("dependency-hide")}else{el.addClass("dependency-hide")}el.find("select,input").trigger("change");tabs.each(function(){var id=$(this).attr("aria-controls");var result=false;var element=document.getElementById(id);$(element).find(">.vc_column").each(function(){if(!$(this).hasClass("dependency-hide")){result=true;return false}});if(!result){$(this).addClass("dependency-hide")}else{$(this).removeClass("dependency-hide")}})},1)})}});setTimeout(function(){$(".setting-panel-container").css("display","block")},50)};mBuilder.prototype.mediaPanel=function(){var frame;$("body").on("click",".mBuilder-upload-img.single",function(event){event.preventDefault();$(this).addClass("active-upload");if(frame){frame.open();return}frame=window.top.wp.media({title:"Select or Upload Media Of Your Chosen Persuasion",button:{text:"Use this media"},multiple:false});var t=this;frame.on("select",function(){var $this=$(".mBuilder-upload-img.single.active-upload");var attachment=frame.state().get("selection").first().toJSON();$this.css("background-image",'url("'+attachment.url+'")').css("background-size","100% 100%");$this.find("input").val(attachment.id);$this.find(".remove-img").removeClass("mBuilder-hidden");$(".mBuilder-upload-img.single").removeClass("active-upload")});frame.open()});$("body").on("click",".mBuilder-upload-img.single .remove-img",function(event){event.preventDefault();event.stopPropagation();$(this).closest(".mBuilder-upload-img").css({"background-image":"","background-size":""});$(this).parent().removeClass("has-img");$(this).addClass("mBuilder-hidden");$(this).siblings("input").val("")})};mBuilder.prototype.set_parents=function(){var t=this;for(var index in t.models.models){var $el=$("div[data-mBuilder-id="+index+"]"),$parent=$el.parent().closest(".mBuilder-element");if(!$el.length){delete t.models.models[index]}if($parent.length){var parentId=$parent.attr("data-mBuilder-id");t.models.models[index].parentId=parentId}}};mBuilder.prototype.dropdown=function(){$("body").on("click",".dropdown-title",function(){var $dropdown=$(this).parent(),this_tab=$(this).closest(".mBuilder-edit-el");$("#mBuilderTabs .mbuilder-dropdown").not($dropdown).removeClass("open");if($dropdown.hasClass("open")){$dropdown.removeClass("open")}else{$dropdown.addClass("open");var last_dropdown=this_tab.find(".mbuilder-controller").last();if(last_dropdown.is(".dropdown")&&last_dropdown.find(".mbuilder-dropdown.open").length){this_tab.scrollTop(this_tab[0].scrollHeight)}}});$("body").on("click",".dropdown-option",function(){var $dropdown=$(this).closest(".mbuilder-dropdown"),$selected_element=$(this).closest(".mbuilder-dropdown").find(".mbilder-dropdown-selected");$dropdown.find(".dropdown-option").removeClass("selected-option");$(this).addClass("selected-option");$selected_element.html($(this).text());$dropdown.find("input").val($(this).attr("data-dropdown-value"));$dropdown.find("input").trigger("change_font_family");$dropdown.find("input").trigger("change");$dropdown.find(".dropdown-title").click()});$("body").on("click",".mBuilder-edit-el",function(e){if($(e.target).hasClass("dropdown-title")||$(e.target).closest(".dropdown-title").length){return}$(".mbuilder-dropdown").removeClass("open")})};mBuilder.prototype.multiMediaPanel=function(){var frame;$("body").on("click",".mBuilder-upload-imgs .mBuilder-upload-img",function(event){event.preventDefault();frame=window.top.wp.media({title:"Select or Upload Media Of Your Chosen Persuasion",button:{text:"Use this media"},multiple:"add"});var t=this,$container=$(t).parent();frame.on("select",function(){var attachment=frame.state().get("selection").toJSON();var attachments="";$container.find(".mBuilder-upload-img").remove();for(var i=0;i')}$container.append('