1 line
20 KiB
JavaScript
1 line
20 KiB
JavaScript
var wpNavMenu;!function(k){var y;y=wpNavMenu={options:{menuItemDepthPerLevel:30,globalMaxDepth:11,sortableItems:"> *",targetTolerance:0},menuList:void 0,targetList:void 0,menusChanged:!1,isRTL:!("undefined"==typeof isRtl||!isRtl),negateIfRTL:"undefined"!=typeof isRtl&&isRtl?-1:1,lastSearch:"",init:function(){y.menuList=k("#menu-to-edit"),y.targetList=y.menuList,this.jQueryExtensions(),this.attachMenuEditListeners(),this.attachQuickSearchListeners(),this.attachThemeLocationsListeners(),this.attachMenuSaveSubmitListeners(),this.attachTabsPanelListeners(),this.attachUnsavedChangesListener(),y.menuList.length&&this.initSortables(),menus.oneThemeLocationNoMenus&&k("#posttype-page").addSelectedToMenu(y.addMenuItemToBottom),this.initManageLocations(),this.initAccessibility(),this.initToggles(),this.initPreviewing()},jQueryExtensions:function(){k.fn.extend({menuItemDepth:function(){var e=y.isRTL?this.eq(0).css("margin-right"):this.eq(0).css("margin-left");return y.pxToDepth(e&&-1!=e.indexOf("px")?e.slice(0,-2):0)},updateDepthClass:function(t,n){return this.each(function(){var e=k(this);n=n||e.menuItemDepth(),k(this).removeClass("menu-item-depth-"+n).addClass("menu-item-depth-"+t)})},shiftDepthClass:function(i){return this.each(function(){var e=k(this),t=e.menuItemDepth(),n=t+i;e.removeClass("menu-item-depth-"+t).addClass("menu-item-depth-"+n),0===n&&e.find(".is-submenu").hide()})},childMenuItems:function(){var i=k();return this.each(function(){for(var e=k(this),t=e.menuItemDepth(),n=e.next(".menu-item");n.length&&n.menuItemDepth()>t;)i=i.add(n),n=n.next(".menu-item")}),i},shiftHorizontally:function(i){return this.each(function(){var e=k(this),t=e.menuItemDepth(),n=t+i;e.moveHorizontally(n,t)})},moveHorizontally:function(a,s){return this.each(function(){var e=k(this),t=e.childMenuItems(),i=a-s,n=e.find(".is-submenu");e.updateDepthClass(a,s).updateParentMenuItemDBId(),t&&t.each(function(){var e=k(this),t=e.menuItemDepth(),n=t+i;e.updateDepthClass(n,t).updateParentMenuItemDBId()}),0===a?n.hide():n.show()})},updateParentMenuItemDBId:function(){return this.each(function(){var e=k(this),t=e.find(".menu-item-data-parent-id"),n=parseInt(e.menuItemDepth(),10),i=n-1,a=e.prevAll(".menu-item-depth-"+i).first();0===n?t.val(0):t.val(a.find(".menu-item-data-db-id").val())})},hideAdvancedMenuItemFields:function(){return this.each(function(){var e=k(this);k(".hide-column-tog").not(":checked").each(function(){e.find(".field-"+k(this).val()).addClass("hidden-field")})})},addSelectedToMenu:function(s){return 0!==k("#menu-to-edit").length&&this.each(function(){var e=k(this),i={},t=menus.oneThemeLocationNoMenus&&0===e.find(".tabs-panel-active .categorychecklist li input:checked").length?e.find('#page-all li input[type="checkbox"]'):e.find(".tabs-panel-active .categorychecklist li input:checked"),a=/menu-item\[([^\]]*)/;if(s=s||y.addMenuItemToBottom,!t.length)return!1;e.find(".button-controls .spinner").addClass("is-active"),k(t).each(function(){var e=k(this),t=a.exec(e.attr("name")),n=void 0===t[1]?0:parseInt(t[1],10);this.className&&-1!=this.className.indexOf("add-to-top")&&(s=y.addMenuItemToTop),i[n]=e.closest("li").getItemData("add-menu-item",n)}),y.addItemToMenu(i,s,function(){t.removeAttr("checked"),e.find(".button-controls .spinner").removeClass("is-active")})})},getItemData:function(t,n){t=t||"menu-item";var i,a={},s=["menu-item-db-id","menu-item-object-id","menu-item-object","menu-item-parent-id","menu-item-position","menu-item-type","menu-item-title","menu-item-url","menu-item-description","menu-item-attr-title","menu-item-target","menu-item-classes","menu-item-xfn"];return n||"menu-item"!=t||(n=this.find(".menu-item-data-db-id").val()),n&&this.find("input").each(function(){var e;for(i=s.length;i--;)"menu-item"==t?e=s[i]+"["+n+"]":"add-menu-item"==t&&(e="menu-item["+n+"]["+s[i]+"]"),this.name&&e==this.name&&(a[s[i]]=this.value)}),a},setItemData:function(e,a,s){return a=a||"menu-item",s||"menu-item"!=a||(s=k(".menu-item-data-db-id",this).val()),s&&this.find("input").each(function(){var n,i=k(this);k.each(e,function(e,t){"menu-item"==a?n=e+"["+s+"]":"add-menu-item"==a&&(n="menu-item["+s+"]["+e+"]"),n==i.attr("name")&&i.val(t)})}),this}})},countMenuItems:function(e){return k(".menu-item-depth-"+e).length},moveMenuItem:function(e,t){var n,i,a,s=k("#menu-to-edit li"),m=s.length,u=e.parents("li.menu-item"),r=u.childMenuItems(),o=u.getItemData(),c=parseInt(u.menuItemDepth(),10),d=parseInt(u.index(),10),l=u.next(),h=l.childMenuItems(),f=parseInt(l.menuItemDepth(),10)+1,p=u.prev(),v=parseInt(p.menuItemDepth(),10),g=p.getItemData()["menu-item-db-id"];switch(t){case"up":if(i=d-1,0===d)break;0===i&&0!==c&&u.moveHorizontally(0,c),0!==v&&u.moveHorizontally(v,c),r?(n=u.add(r)).detach().insertBefore(s.eq(i)).updateParentMenuItemDBId():u.detach().insertBefore(s.eq(i)).updateParentMenuItemDBId();break;case"down":if(r){if(n=u.add(r),(h=0!==(l=s.eq(n.length+d)).childMenuItems().length)&&(a=parseInt(l.menuItemDepth(),10)+1,u.moveHorizontally(a,c)),m===d+n.length)break;n.detach().insertAfter(s.eq(d+n.length)).updateParentMenuItemDBId()}else{if(0!==h.length&&u.moveHorizontally(f,c),m===d+1)break;u.detach().insertAfter(s.eq(d+1)).updateParentMenuItemDBId()}break;case"top":if(0===d)break;r?(n=u.add(r)).detach().insertBefore(s.eq(0)).updateParentMenuItemDBId():u.detach().insertBefore(s.eq(0)).updateParentMenuItemDBId();break;case"left":if(0===c)break;u.shiftHorizontally(-1);break;case"right":if(0===d)break;if(o["menu-item-parent-id"]===g)break;u.shiftHorizontally(1)}e.focus(),y.registerChange(),y.refreshKeyboardAccessibility(),y.refreshAdvancedAccessibility()},initAccessibility:function(){var e=k("#menu-to-edit");y.refreshKeyboardAccessibility(),y.refreshAdvancedAccessibility(),e.on("mouseenter.refreshAccessibility focus.refreshAccessibility touchstart.refreshAccessibility",".menu-item",function(){y.refreshAdvancedAccessibilityOfItem(k(this).find("a.item-edit"))}),e.on("click","a.item-edit",function(){y.refreshAdvancedAccessibilityOfItem(k(this))}),e.on("click",".menus-move",function(){var e=k(this).data("dir");void 0!==e&&y.moveMenuItem(k(this).parents("li.menu-item").find("a.item-edit"),e)})},refreshAdvancedAccessibilityOfItem:function(e){if(!0===k(e).data("needs_accessibility_refresh")){var t,n,i,a,s,m,u,r,o,c=k(e),d=c.closest("li.menu-item").first(),l=d.menuItemDepth(),h=0===l,f=c.closest(".menu-item-handle").find(".menu-item-title").text(),p=parseInt(d.index(),10),v=h?l:parseInt(l-1,10),g=d.prevAll(".menu-item-depth-"+v).first().find(".menu-item-title").text(),b=d.prevAll(".menu-item-depth-"+l).first().find(".menu-item-title").text(),I=k("#menu-to-edit li").length,y=d.nextAll(".menu-item-depth-"+l).length;d.find(".field-move").toggle(1<I),0!==p&&(t=d.find(".menus-move-up")).attr("aria-label",menus.moveUp).css("display","inline"),0!==p&&h&&(t=d.find(".menus-move-top")).attr("aria-label",menus.moveToTop).css("display","inline"),p+1!==I&&0!==p&&(t=d.find(".menus-move-down")).attr("aria-label",menus.moveDown).css("display","inline"),0===p&&0!==y&&(t=d.find(".menus-move-down")).attr("aria-label",menus.moveDown).css("display","inline"),h||(t=d.find(".menus-move-left"),n=menus.outFrom.replace("%s",g),t.attr("aria-label",menus.moveOutFrom.replace("%s",g)).text(n).css("display","inline")),0!==p&&d.find(".menu-item-data-parent-id").val()!==d.prev().find(".menu-item-data-db-id").val()&&(t=d.find(".menus-move-right"),n=menus.under.replace("%s",b),t.attr("aria-label",menus.moveUnder.replace("%s",b)).text(n).css("display","inline")),s=h?(a=(i=k(".menu-item-depth-0")).index(d)+1,I=i.length,menus.menuFocus.replace("%1$s",f).replace("%2$d",a).replace("%3$d",I)):(u=(m=d.prevAll(".menu-item-depth-"+parseInt(l-1,10)).first()).find(".menu-item-data-db-id").val(),r=m.find(".menu-item-title").text(),o=k('.menu-item .menu-item-data-parent-id[value="'+u+'"]'),a=k(o.parents(".menu-item").get().reverse()).index(d)+1,menus.subMenuFocus.replace("%1$s",f).replace("%2$d",a).replace("%3$s",r)),c.attr("aria-label",s),c.data("needs_accessibility_refresh",!1)}},refreshAdvancedAccessibility:function(){k(".menu-item-settings .field-move .menus-move").hide(),k("a.item-edit").data("needs_accessibility_refresh",!0),k(".menu-item-edit-active a.item-edit").each(function(){y.refreshAdvancedAccessibilityOfItem(this)})},refreshKeyboardAccessibility:function(){k("a.item-edit").off("focus").on("focus",function(){k(this).off("keydown").on("keydown",function(e){var t,n=k(this),i=n.parents("li.menu-item").getItemData();if((37==e.which||38==e.which||39==e.which||40==e.which)&&(n.off("keydown"),1!==k("#menu-to-edit li").length)){switch(t={38:"up",40:"down",37:"left",39:"right"},k("body").hasClass("rtl")&&(t={38:"up",40:"down",39:"left",37:"right"}),t[e.which]){case"up":y.moveMenuItem(n,"up");break;case"down":y.moveMenuItem(n,"down");break;case"left":y.moveMenuItem(n,"left");break;case"right":y.moveMenuItem(n,"right")}return k("#edit-"+i["menu-item-db-id"]).focus(),!1}})})},initPreviewing:function(){k("#menu-to-edit").on("change input",".edit-menu-item-title",function(e){var t,n,i=k(e.currentTarget);t=i.val(),n=i.closest(".menu-item").find(".menu-item-title"),t?n.text(t).removeClass("no-title"):n.text(navMenuL10n.untitled).addClass("no-title")})},initToggles:function(){postboxes.add_postbox_toggles("nav-menus"),columns.useCheckboxesForHidden(),columns.checked=function(e){k(".field-"+e).removeClass("hidden-field")},columns.unchecked=function(e){k(".field-"+e).addClass("hidden-field")},y.menuList.hideAdvancedMenuItemFields(),k(".hide-postbox-tog").click(function(){var e=k(".accordion-container li.accordion-section").filter(":hidden").map(function(){return this.id}).get().join(",");k.post(ajaxurl,{action:"closed-postboxes",hidden:e,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:"nav-menus"})})},initSortables:function(){var m,s,u,n,r,o,c,d,l,h,f=0,p=y.menuList.offset().left,v=k("body"),g=function(){if(!v[0].className)return 0;var e=v[0].className.match(/menu-max-depth-(\d+)/);return e&&e[1]?parseInt(e[1],10):0}();function b(e){var t;n=e.placeholder.prev(".menu-item"),r=e.placeholder.next(".menu-item"),n[0]==e.item[0]&&(n=n.prev(".menu-item")),r[0]==e.item[0]&&(r=r.next(".menu-item")),o=n.length?n.offset().top+n.height():0,c=r.length?r.offset().top+r.height()/3:0,s=r.length?r.menuItemDepth():0,u=n.length?(t=n.menuItemDepth()+1)>y.options.globalMaxDepth?y.options.globalMaxDepth:t:0}function I(e,t){e.placeholder.updateDepthClass(t,f),f=t}0!==k("#menu-to-edit li").length&&k(".drag-instructions").show(),p+=y.isRTL?y.menuList.width():0,y.menuList.sortable({handle:".menu-item-handle",placeholder:"sortable-placeholder",items:y.options.sortableItems,start:function(e,t){var n,i,a,s;y.isRTL&&(t.item[0].style.right="auto"),l=t.item.children(".menu-item-transport"),I(t,m=t.item.menuItemDepth()),a=(t.item.next()[0]==t.placeholder[0]?t.item.next():t.item).childMenuItems(),l.append(a),n=l.outerHeight(),n+=0<n?1*t.placeholder.css("margin-top").slice(0,-2):0,n+=t.helper.outerHeight(),d=n,n-=2,t.placeholder.height(n),h=m,a.each(function(){var e=k(this).menuItemDepth();h=h<e?e:h}),i=t.helper.find(".menu-item-handle").outerWidth(),i+=y.depthToPx(h-m),i-=2,t.placeholder.width(i),(s=t.placeholder.next(".menu-item")).css("margin-top",d+"px"),t.placeholder.detach(),k(this).sortable("refresh"),t.item.after(t.placeholder),s.css("margin-top",0),b(t)},stop:function(e,t){var n,i,a=f-m;n=l.children().insertAfter(t.item),i=t.item.find(".item-title .is-submenu"),0<f?i.show():i.hide(),0!==a&&(t.item.updateDepthClass(f),n.shiftDepthClass(a),function(e){var t,n=g;{if(0===e)return;if(0<e)g<(t=h+e)&&(n=t);else if(e<0&&h==g)for(;!k(".menu-item-depth-"+n,y.menuList).length&&0<n;)n--}v.removeClass("menu-max-depth-"+g).addClass("menu-max-depth-"+n),g=n}(a)),y.registerChange(),t.item.updateParentMenuItemDBId(),t.item[0].style.top=0,y.isRTL&&(t.item[0].style.left="auto",t.item[0].style.right=0),y.refreshKeyboardAccessibility(),y.refreshAdvancedAccessibility()},change:function(e,t){t.placeholder.parent().hasClass("menu")||(n.length?n.after(t.placeholder):y.menuList.prepend(t.placeholder)),b(t)},sort:function(e,t){var n=t.helper.offset(),i=y.isRTL?n.left+t.helper.width():n.left,a=y.negateIfRTL*y.pxToDepth(i-p);u<a||n.top<o-y.options.targetTolerance?a=u:a<s&&(a=s),a!=f&&I(t,a),c&&n.top+d>c&&(r.after(t.placeholder),b(t),k(this).sortable("refreshPositions"))}})},initManageLocations:function(){k("#menu-locations-wrap form").submit(function(){window.onbeforeunload=null}),k(".menu-location-menus select").on("change",function(){var e=k(this).closest("tr").find(".locations-edit-menu-link");k(this).find("option:selected").data("orig")?e.show():e.hide()})},attachMenuEditListeners:function(){var t=this;k("#update-nav-menu").bind("click",function(e){if(e.target&&e.target.className){if(-1!=e.target.className.indexOf("item-edit"))return t.eventOnClickEditLink(e.target);if(-1!=e.target.className.indexOf("menu-save"))return t.eventOnClickMenuSave(e.target);if(-1!=e.target.className.indexOf("menu-delete"))return t.eventOnClickMenuDelete(e.target);if(-1!=e.target.className.indexOf("item-delete"))return t.eventOnClickMenuItemDelete(e.target);if(-1!=e.target.className.indexOf("item-cancel"))return t.eventOnClickCancelLink(e.target)}}),k('#add-custom-links input[type="text"]').keypress(function(e){k("#customlinkdiv").removeClass("form-invalid"),13===e.keyCode&&(e.preventDefault(),k("#submit-customlinkdiv").click())})},attachMenuSaveSubmitListeners:function(){k("#update-nav-menu").submit(function(){var e=k("#update-nav-menu").serializeArray();k('[name="nav-menu-data"]').val(JSON.stringify(e))})},attachThemeLocationsListeners:function(){var e=k("#nav-menu-theme-locations"),t={action:"menu-locations-save"};t["menu-settings-column-nonce"]=k("#menu-settings-column-nonce").val(),e.find('input[type="submit"]').click(function(){return e.find("select").each(function(){t[this.name]=k(this).val()}),e.find(".spinner").addClass("is-active"),k.post(ajaxurl,t,function(){e.find(".spinner").removeClass("is-active")}),!1})},attachQuickSearchListeners:function(){var t,e;k("#nav-menu-meta").on("submit",function(e){e.preventDefault()}),e="oninput"in document.createElement("input")?"input":"keyup",k("#nav-menu-meta").on(e,".quick-search",function(){var e=k(this);e.attr("autocomplete","off"),t&&clearTimeout(t),t=setTimeout(function(){y.updateQuickSearchResults(e)},500)}).on("blur",".quick-search",function(){y.lastSearch=""})},updateQuickSearchResults:function(e){var t,n,i=e.val();i.length<2||y.lastSearch==i||(y.lastSearch=i,t=e.parents(".tabs-panel"),n={action:"menu-quick-search","response-format":"markup",menu:k("#menu").val(),"menu-settings-column-nonce":k("#menu-settings-column-nonce").val(),q:i,type:e.attr("name")},k(".spinner",t).addClass("is-active"),k.post(ajaxurl,n,function(e){y.processQuickSearchQueryResponse(e,n,t)}))},addCustomLink:function(e){var t=k("#custom-menu-item-url").val(),n=k("#custom-menu-item-name").val();if(e=e||y.addMenuItemToBottom,""===t||"http://"==t)return k("#customlinkdiv").addClass("form-invalid"),!1;k(".customlinkdiv .spinner").addClass("is-active"),this.addLinkToMenu(t,n,e,function(){k(".customlinkdiv .spinner").removeClass("is-active"),k("#custom-menu-item-name").val("").blur(),k("#custom-menu-item-url").val("http://")})},addLinkToMenu:function(e,t,n,i){n=n||y.addMenuItemToBottom,i=i||function(){},y.addItemToMenu({"-1":{"menu-item-type":"custom","menu-item-url":e,"menu-item-title":t}},n,i)},addItemToMenu:function(e,n,i){var a,t=k("#menu").val(),s=k("#menu-settings-column-nonce").val();n=n||function(){},i=i||function(){},a={action:"add-menu-item",menu:t,"menu-settings-column-nonce":s,"menu-item":e},k.post(ajaxurl,a,function(e){var t=k("#menu-instructions");e=k.trim(e),n(e,a),k("li.pending").hide().fadeIn("slow"),k(".drag-instructions").show(),!t.hasClass("menu-instructions-inactive")&&t.siblings().length&&t.addClass("menu-instructions-inactive"),i()})},addMenuItemToBottom:function(e){var t=k(e);t.hideAdvancedMenuItemFields().appendTo(y.targetList),y.refreshKeyboardAccessibility(),y.refreshAdvancedAccessibility(),k(document).trigger("menu-item-added",[t])},addMenuItemToTop:function(e){var t=k(e);t.hideAdvancedMenuItemFields().prependTo(y.targetList),y.refreshKeyboardAccessibility(),y.refreshAdvancedAccessibility(),k(document).trigger("menu-item-added",[t])},attachUnsavedChangesListener:function(){k("#menu-management input, #menu-management select, #menu-management, #menu-management textarea, .menu-location-menus select").change(function(){y.registerChange()}),0!==k("#menu-to-edit").length||0!==k(".menu-location-menus select").length?window.onbeforeunload=function(){if(y.menusChanged)return navMenuL10n.saveAlert}:k("#menu-settings-column").find("input,select").end().find("a").attr("href","#").unbind("click")},registerChange:function(){y.menusChanged=!0},attachTabsPanelListeners:function(){k("#menu-settings-column").bind("click",function(e){var t,n,i,a,s=k(e.target);if(s.hasClass("nav-tab-link"))n=s.data("type"),i=s.parents(".accordion-section-content").first(),k("input",i).removeAttr("checked"),k(".tabs-panel-active",i).removeClass("tabs-panel-active").addClass("tabs-panel-inactive"),k("#"+n,i).removeClass("tabs-panel-inactive").addClass("tabs-panel-active"),k(".tabs",i).removeClass("tabs"),s.parent().addClass("tabs"),k(".quick-search",i).focus(),i.find(".tabs-panel-active .menu-item-title").length?i.removeClass("has-no-menu-item"):i.addClass("has-no-menu-item"),e.preventDefault();else if(s.hasClass("select-all")){if((t=/#(.*)$/.exec(e.target.href))&&t[1])return(a=k("#"+t[1]+" .tabs-panel-active .menu-item-title input")).length===a.filter(":checked").length?a.removeAttr("checked"):a.prop("checked",!0),!1}else if(s.hasClass("submit-add-to-menu"))return y.registerChange(),e.target.id&&"submit-customlinkdiv"==e.target.id?y.addCustomLink(y.addMenuItemToBottom):e.target.id&&-1!=e.target.id.indexOf("submit-")&&k("#"+e.target.id.replace(/submit-/,"")).addSelectedToMenu(y.addMenuItemToBottom),!1}),k("#nav-menu-meta").on("click","a.page-numbers",function(){var i=k(this).closest(".inside");return k.post(ajaxurl,this.href.replace(/.*\?/,"").replace(/action=([^&]*)/,"")+"&action=menu-get-metabox",function(e){var t,n=k.parseJSON(e);-1!==e.indexOf("replace-id")&&(t=document.getElementById(n["replace-id"]),n.markup&&t&&i.html(n.markup))}),!1})},eventOnClickEditLink:function(e){var t,n,i=/#(.*)$/.exec(e.href);if(i&&i[1]&&0!==(n=(t=k("#"+i[1])).parent()).length)return n.hasClass("menu-item-edit-inactive")?(t.data("menu-item-data")||t.data("menu-item-data",t.getItemData()),t.slideDown("fast"),n.removeClass("menu-item-edit-inactive").addClass("menu-item-edit-active")):(t.slideUp("fast"),n.removeClass("menu-item-edit-active").addClass("menu-item-edit-inactive")),!1},eventOnClickCancelLink:function(e){var t=k(e).closest(".menu-item-settings");return k(e).closest(".menu-item").removeClass("menu-item-edit-active").addClass("menu-item-edit-inactive"),t.setItemData(t.data("menu-item-data")).hide(),!1},eventOnClickMenuSave:function(){var e="",t=k("#menu-name"),n=t.val();return n&&n!=t.attr("title")&&n.replace(/\s+/,"")?(k("#nav-menu-theme-locations select").each(function(){e+='<input type="hidden" name="'+this.name+'" value="'+k(this).val()+'" />'}),k("#update-nav-menu").append(e),y.menuList.find(".menu-item-data-position").val(function(e){return e+1}),!(window.onbeforeunload=null)):(t.parent().addClass("form-invalid"),!1)},eventOnClickMenuDelete:function(){return!!window.confirm(navMenuL10n.warnDeleteMenu)&&!(window.onbeforeunload=null)},eventOnClickMenuItemDelete:function(e){var t=parseInt(e.id.replace("delete-",""),10);return y.removeMenuItem(k("#menu-item-"+t)),y.registerChange(),!1},processQuickSearchQueryResponse:function(e,t,n){var i,a,s,m={},u=document.getElementById("nav-menu-meta"),r=/menu-item[(\[^]\]*/,o=k("<div>").html(e).find("li"),c=n.closest(".accordion-section-content");if(!o.length)return k(".categorychecklist",n).html("<li><p>"+navMenuL10n.noResultsFound+"</p></li>"),k(".spinner",n).removeClass("is-active"),void c.addClass("has-no-menu-item");o.each(function(){if(s=k(this),(i=r.exec(s.html()))&&i[1]){for(a=i[1];u.elements["menu-item["+a+"][menu-item-type]"]||m[a];)a--;m[a]=!0,a!=i[1]&&s.html(s.html().replace(new RegExp("menu-item\\["+i[1]+"\\]","g"),"menu-item["+a+"]"))}}),k(".categorychecklist",n).html(o),k(".spinner",n).removeClass("is-active"),c.removeClass("has-no-menu-item")},removeMenuItem:function(t){var n=t.childMenuItems();k(document).trigger("menu-removing-item",[t]),t.addClass("deleting").animate({opacity:0,height:0},350,function(){var e=k("#menu-instructions");t.remove(),n.shiftDepthClass(-1).updateParentMenuItemDBId(),0===k("#menu-to-edit li").length&&(k(".drag-instructions").hide(),e.removeClass("menu-instructions-inactive")),y.refreshAdvancedAccessibility()})},depthToPx:function(e){return e*y.options.menuItemDepthPerLevel},pxToDepth:function(e){return Math.floor(e/y.options.menuItemDepthPerLevel)}},k(document).ready(function(){wpNavMenu.init()})}(jQuery); |