WordPress/wp-admin/js/nav-menu.min.js
desrosj 968d57a6b3 Build/Test Tools: Support NodeJS 14.x in the 4.5 branch.
This updates the 4.5 branch to support the latest LTS version of NodeJS (currently 14.x), allowing the same version to be used across all WordPress branches that receive security updates as a courtesy.

Because older branches use (really) old versions of NodeJS, the local Docker environment cannot be backported since the needed dependencies will not run on these older versions (see #48301). This also blocks the ability to move automated testing over to GitHub Actions (see #50401).

This also replaces the `npm-shrinkwrap.json` with a `package-lock.json` file. Lock files were not supported in earlier versions of NPM, but can now be used.

In addition to backporting the package updates that happened after branching 4.5, dependencies that were removed in future releases have also been updated to their latest versions.

Props desrosj, dd32, netweb, jorbin.
Merges [37185,37212,37612,38111,38688,39110,39113-39119,39478,42460-42461,42463,42887,43320,43323,43977,44219,44233,44728,45321,45765,46404,46408-46409,47404,47867-47869,47872-47873,48705,49636,49933,49937,49939,50017,50126,50176,50185,50192] to the 4.5 branch.
See #52341.
Built from https://develop.svn.wordpress.org/branches/4.5@50208


git-svn-id: http://core.svn.wordpress.org/branches/4.5@49880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-05 04:20:44 +00:00

1 line
20 KiB
JavaScript

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