Wordpress/wp-admin/js/nav-menu.min.js
2013-03-27 12:58:43 +00:00

1 line
21 KiB
JavaScript

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