/home/arranoyd/telegastro/wp-content/themes/dt-the7/inc/admin/assets/js/the7-mega-menu.min.js
"use strict";jQuery(function(a){var b={tb_icon_bar_open:!1,tb_unload_binded:!1,origin_tb_position:null,appendToBottom:"",init:function(a){this.appendToBottom=a||"",this.extendTBPosition()},calculateHeight:function(b){return a(window).height()-2*b},openTB:function(a){this.tb_icon_bar_open=!0,tb_show(a,"#TB_inline?width=1024&height=768")},extendTBPosition:function(){var b=this;b.origin_tb_position=window.tb_position,window.tb_position=function(){if(b.tb_icon_bar_open){var c=a("#TB_window"),d=a(window).width(),e=20,f=840;f>d&&(f=d-10);var g=a("#TB_title",c).height(),h=a(".the7-mega-menu-popup-bottom-bar",c).height(),i=b.calculateHeight(e);c.hasClass("presscore-microwidget-modal")||c.addClass("presscore-microwidget-modal"),b.tb_unload_binded||(b.tb_unload_binded=!0,a("#TB_ajaxContent",c).wrapInner('<div class="the7-mega-menu-popup-content"></div>'),c.append('<div class="the7-mega-menu-popup-bottom-bar">'+b.appendToBottom+"</div>"),h=a(".the7-mega-menu-popup-bottom-bar",c).height()+10,c.on("tb_unload",function(){b.tb_icon_bar_open=!1,b.tb_unload_binded=!1,a(window).off("resize.the7MegaMenu")}),a(window).on("resize.the7MegaMenu",function(){var d=b.calculateHeight(e);c.height(d),a(".the7-mega-menu-popup-content",c).height(d-g-h)})),c.size()&&(c.width(f).height(i),a("#TB_ajaxContent",c).removeAttr("style"),c.css({left:parseInt((d-f)/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&c.css({top:e+"px","margin-top":"0"}),a(".the7-mega-menu-popup-content",c).height(i-g-h))}else b.origin_tb_position()}}};b.init(the7MegaMenuTemplates.popupBottomBar),a("body").on("click.the7MegaMenu",".optionsframework-submit > .button-primary",function(b){b.preventDefault();var c=a(this).parents("#TB_window").find(".the7-mega-menu-popup-content"),d=c.data("the7SettingsStorageElement"),e={};a("input, textarea, select",c).serializeArray().forEach(function(a){for(var b,c=a.name.split("[").slice(1).map(function(a){return a.replace("]","")}),d=e,f=c.length-1,g=0;g<=f;g++)b=c[g],"undefined"==typeof d[b]&&(d[b]=g===f?a.value:{}),d=d[b]}),d.val(JSON.stringify(e)),tb_remove()}),a("#menu-to-edit .field-description").after(the7MegaMenuTemplates.megaMenuButton),a(document).on("menu-item-added",function(a,b){b.find(".field-description").after(the7MegaMenuTemplates.megaMenuButton)}),a("#post-body").on("click",".the7-options-tb-popup",function(c){c.preventDefault(),b.openTB(the7MegaMenuTemplates.popupTitle);var d=a(this).closest(".menu-item"),e=a(".the7-mega-menu-popup-content");e.empty().html('<span class="spinner is-active" style="float: none; position: absolute; top: 50%; left: calc(50% - 20px)"></span>');var f=d.attr("class").replace(/.*menu-item-depth-([0-9]).*/,"$1"),g="",h=0;if(f>0){var i=d.attr("id"),j=null;a("#menu-to-edit .menu-item").each(function(){var b=a(this);if(b.hasClass("menu-item-depth-0")&&(j=b),b.attr("id")===i){if(j){var c=j.find(".the7-mega-menu-settings");if(c.length&&c.val()){var d=JSON.parse(c.val());g=d["mega-menu"]}h=j.find(".menu-item-data-db-id").val()}return!1}})}var k=d.find(".the7-mega-menu-settings").val()||"",l=d.find(".menu-item-data-db-id").val();a.post(ajaxurl,{action:"the7_render_mega_menu_settings",item_id:l,item_settings:k,item_depth:f,parent_id:h,parent_mega_menu:g}).done(function(b){e.html(b);var c=d.find(".the7-mega-menu-settings");c.length||(c=a(the7MegaMenuTemplates.itemSettingsStorageElement.replace("%itemID%",l)).appendTo(d.find(".menu-item-settings"))),e.data("the7SettingsStorageElement",c),"function"==typeof window.the7OptionsBootstrap&&window.the7OptionsBootstrap(),"function"==typeof window.optionsframework_file_bindings&&window.optionsframework_file_bindings()})})});