XylotrechusZ
($=>{$(()=>{$(document).find(".gv-grid").sortable({handle:".gv-grid-row-handle",items:"> .gv-grid-row.is-sortable",distance:2,revert:75,placeholder:"grid-row-placeholder",forcePlaceholderSize:!0}),$(document).on("click",".gv-grid-row-delete",function(){const $row=$(this).closest(".gv-grid-row"),$fields=$row.find(".gv-fields");0<$fields.length&&!confirm($(this).data("confirm"))||$row.fadeOut("fast",()=>{$fields.each(function(){$(this).remove(),$(document.body).trigger("gravityview/field-removed",$(this))}),$row.remove(),$(document.body).trigger("gravityview/row-removed",$row)})}),$(document).on("click",".gv-grid-add-row .gv-toggle",function(e){const $add_row=$(this).closest(".gv-grid-add-row");$add_row.toggleClass("open"),$(this).attr("aria-expanded",$add_row.hasClass("open"))}).on("click",".gv-grid-add-row [data-add-row]",function(e){const $add_row_button=$(this),$add_row=$(this).closest(".gv-grid-add-row"),zone=$add_row_button.data("add-row"),template_id=$add_row_button.data("template-id"),type=$add_row_button.data("type"),row_type=$add_row_button.data("row-type");$.post(ajaxurl,{action:"gv_create_row",template_id:template_id,nonce:gvGlobals.nonce,zone:zone,type:type,row_type:row_type,dataType:"json"}).always(()=>{$add_row.removeClass("open"),$add_row.find(".gv-toggle").attr("aria-expanded",!1)}).done(result=>{result=JSON.parse(result);const $row=$(result?.row);$row.insertBefore($add_row),$(document.body).trigger("gravityview/row-added",$row,{type:type,row_type:row_type,zone:zone,template_id:template_id}),window?.gvAdminActions?.initTooltips(),window?.gvAdminActions?.initDroppables($row)})})})})(jQuery);