1 line
7.0 KiB
JavaScript
1 line
7.0 KiB
JavaScript
|
(()=>{var e={436:()=>{!function(e){var t=acf.FieldSetting.extend({type:"clone",name:"display",render:function(){var e=this.field.val();this.$fieldObject.attr("data-display",e)}});acf.registerFieldSetting(t);var a=acf.FieldSetting.extend({type:"clone",name:"prefix_label",render:function(){var e="";this.field.val()&&(e=this.fieldObject.prop("label")+" "),this.$("code").html(e+"%field_label%")}});acf.registerFieldSetting(a);var l=acf.FieldSetting.extend({type:"clone",name:"prefix_name",render:function(){var e="";this.field.val()&&(e=this.fieldObject.prop("name")+"_"),this.$("code").html(e+"%field_name%")}});acf.registerFieldSetting(l),new acf.Model({filters:{select2_args:"select2Args"},select2Args:function(e,t,a,l,i){return"acf/fields/clone/query"==a.ajaxAction&&(e.closeOnSelect=!1,i.data.ajaxData=this.ajaxData),e},ajaxData:function(t){return t.fields={},acf.getFieldObjects().map((function(e){t.fields[e.prop("key")]={key:e.prop("key"),type:e.prop("type"),label:e.prop("label"),ancestors:e.getParents().length}})),t.title=e("#title").val(),t}})}(jQuery)},309:()=>{var e,t;e=jQuery,t=acf.FieldSetting.extend({type:"flexible_content",name:"fc_layout",events:{"blur .layout-label":"onChangeLabel","blur .layout-name":"onChangeName","click .add-layout":"onClickAdd","click .acf-field-settings-fc_head":"onClickEdit","click .acf-field-setting-fc-duplicate":"onClickDuplicate","click .acf-field-setting-fc-delete":"onClickDelete","changed:layoutLabel":"updateLayoutTitles","changed:layoutName":"updateLayoutTitles"},$input:function(t){return e("#"+this.getInputId()+"-"+t)},$list:function(){return this.$(".acf-field-list:first")},getInputId:function(){return this.fieldObject.getInputId()+"-layouts-"+this.field.get("id")},getFields:function(){return acf.getFieldObjects({parent:this.$el})},getChildren:function(){return acf.getFieldObjects({list:this.$list()})},initialize:function(){var e=this.$el.parent();e.hasClass("ui-sortable")||e.sortable({items:"> .acf-field-setting-fc_layout",handle:".acf-fc_draggable",forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,stop:this.proxy((function(e,t){this.fieldObject.save()}))}),this.updateFieldLayouts(),this.updateLayoutTitles()},updateFieldLayouts:function(){this.getChildren().map(this.updateFieldLayout,this)},updateFieldLayout:function(e){e.prop("parent_layout",this.get("id"))},updateLayoutTitles:function(){const e=this.get("layoutLabel"),t=this.get("layoutName"),a=this.$el.find("> .acf-label .acf-fc-layout-label");e&&a.html(e);const l=this.$el.find("> .acf-label .acf-fc-layout-name span");t?(l.html(t),l.parent().css("display","")):l.parent().css("display","none")},onClickEdit:function(t){const a=e(t.target);a.hasClass("acf-btn")||a.hasClass("copyable")||a.parent().hasClass("acf-btn")||a.parent().hasClass("copyable")||(this.isOpen()?this.close():this.open())},isOpen:function(e){return this.$el.children(".acf-field-layout-settings").hasClass("open")},open:function(e,t){const a=e?e.children(".acf-field-layout-settings"):this.$el.children(".acf-field-layout-settings"),l=e?e.find(".toggle-indicator").first():this.$el.find(".toggle-indicator").first();acf.doAction("show",a),t?a.slideDown({complete:function(){a.find(".layout-label").trigger("focus")}}):a.slideDown(),l.addClass("open"),l.hasClass("closed")&&l.removeClass("closed"),a.addClass("open")},close:function(){const e=this.$el.children(".acf-field-layout-settings"),t=this.$el.find(".toggle-indicator").first();e.slideUp(),e.removeClass("open"),t.removeClass("open"),t.hasClass("closed")||t.addClass("closed"),acf.doAction("hide",e)},onChangeLabel:function(e,t){var a=t.val();this.set("layoutLabel",a),this.$el.attr("data-layout-label",a);var l=this.$input("name");""==l.val()&&(acf.val(l,acf.strSanitize(a)),this.$el.find(".layout-name").trigger("blur"))},onChangeName:function(e,t){var a=t.val();this.set("layoutName",a),this.$el.attr("data-layout-name",a)},onClickAdd:function(e,t){e.preventDefault();var a=this.get("id"),l=acf.uniqid("layout_");$layout=acf.duplicate({$el:this.$el,search:a,replace:l,after:function(e,t){var a=t.find(".acf-field-list:first");a.c
|