<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[14475] trunk: Adopt WP's general JS structure.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/14475">14475</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-05-06 17:11:52 +0000 (Thu, 06 May 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Adopt WP's general JS structure. Remove last of trailing commas. Remove dead code. props koopersmith, see <a href="http://trac.wordpress.org/ticket/13220">#13220</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminjsnavmenudevjs">trunk/wp-admin/js/nav-menu.dev.js</a></li>
<li><a href="#trunkwpadminjsnavmenujs">trunk/wp-admin/js/nav-menu.js</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminjsnavmenudevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.dev.js (14474 => 14475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.dev.js        2010-05-06 15:40:29 UTC (rev 14474)
+++ trunk/wp-admin/js/nav-menu.dev.js        2010-05-06 17:11:52 UTC (rev 14475)
</span><span class="lines">@@ -8,92 +8,26 @@
</span><span class="cx">  * @subpackage Administration
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-var wpNavMenu, WPNavMenuHandler = function ($) {
-        var autoCompleteData = {},
</del><ins>+var wpNavMenu;
</ins><span class="cx"> 
</span><del>-        menuItemDepthPerLevel = 30, // Do not use directly. Use depthToPx and pxToDepth instead.
-        globalMaxDepth = 11,
</del><ins>+(function($) {
+        
+        var api = wpNavMenu = {
+                
+                options : {
+                        menuItemDepthPerLevel : 30, // Do not use directly. Use depthToPx and pxToDepth instead.
+                        globalMaxDepth : 11
+                },
+                
+                menuList : undefined,        // Set in init.
+                targetList : undefined, // Set in init.
+                
+                autoCompleteData : {},
</ins><span class="cx"> 
</span><del>-        formatAutocompleteResponse = function( resultRow, pos, total, queryTerm ) {
-                if ( resultRow &amp;&amp; resultRow[0] ) {
-                        var data = $.parseJSON(resultRow[0]);
-                        if ( data.post_title ) {
-                                if ( data.ID &amp;&amp; data.post_type )
-                                        autoCompleteData[data.post_title] = {ID: data.ID, object_type: data.post_type};
-                                return data.post_title;
-                        }
-                }
-        },
-
-        formatAutocompleteResult = function( resultRow, pos, total, queryTerm ) {
-                if ( resultRow &amp;&amp; resultRow[0] ) {
-                        var data = $.parseJSON(resultRow[0]);
-                        if ( data.post_title )
-                                return data.post_title;
-                }
-        },
-
-        getListDataFromID = function(menuItemID, parentEl) {
-                if ( ! menuItemID )
-                        return false;
-                parentEl = parentEl || document;
-                var fields = [
-                        'menu-item-db-id',
-                        'menu-item-object-id',
-                        'menu-item-object',
-                        'menu-item-parent-id',
-                        'menu-item-position',
-                        'menu-item-type',
-                        'menu-item-append',
-                        'menu-item-title',
-                        'menu-item-url',
-                        'menu-item-description',
-                        'menu-item-attr-title',
-                        'menu-item-target',
-                        'menu-item-classes',
-                        'menu-item-xfn'
-                ],
-                itemData = {},
-                inputs = parentEl.getElementsByTagName('input'),
-                i = inputs.length,
-                j;
-
-                while ( i-- ) {
-                        j = fields.length;
-                        while ( j-- ) {
-                                if (
-                                        inputs[i] &amp;&amp;
-                                        inputs[i].name &amp;&amp;
-                                        'menu-item[' + menuItemID + '][' + fields[j] + ']' == inputs[i].name
-                                ) {
-                                        itemData[fields[j]] = inputs[i].value;
-                                }
-                        }
-                }
-
-                return itemData;
-        },
-
-        recalculateMenuItemPositions = function() {
-                menuList.find('.menu-item-data-position').val( function(index) { return index + 1; } );
-        },
-
-        depthToPx = function(depth) {
-                return depth * menuItemDepthPerLevel;
-        },
-
-        pxToDepth = function(px) {
-                return Math.floor(px / menuItemDepthPerLevel);
-        },
-
-        menuList, targetList, api;
-
-        return api = {
-
</del><span class="cx">                 // Functions that run on init.
</span><span class="cx">                 init : function() {
</span><del>-                        menuList = $('#menu-to-edit');
-                        targetList = menuList;
</del><ins>+                        api.menuList = $('#menu-to-edit');
+                        api.targetList = api.menuList;
</ins><span class="cx"> 
</span><span class="cx">                         this.jQueryExtensions();
</span><span class="cx">                         
</span><span class="lines">@@ -107,7 +41,7 @@
</span><span class="cx"> 
</span><span class="cx">                         this.attachHomeLinkListener();
</span><span class="cx"> 
</span><del>-                        if( menuList.length ) // If no menu, we're in the + tab.
</del><ins>+                        if( api.menuList.length ) // If no menu, we're in the + tab.
</ins><span class="cx">                                 this.initSortables();
</span><span class="cx"> 
</span><span class="cx">                         this.initToggles();
</span><span class="lines">@@ -121,7 +55,7 @@
</span><span class="cx">                         // jQuery extensions
</span><span class="cx">                         $.fn.extend({
</span><span class="cx">                                 menuItemDepth : function() {
</span><del>-                                        return pxToDepth( this.eq(0).css('margin-left').slice(0, -2) );
</del><ins>+                                        return api.pxToDepth( this.eq(0).css('margin-left').slice(0, -2) );
</ins><span class="cx">                                 },
</span><span class="cx">                                 updateDepthClass : function(current, prev) {
</span><span class="cx">                                         return this.each(function(){
</span><span class="lines">@@ -199,7 +133,7 @@
</span><span class="cx">                                                 $(checkboxes).each(function(){
</span><span class="cx">                                                         var listItemDBIDMatch = re.exec( $(this).attr('name') ),
</span><span class="cx">                                                                 listItemDBID = 'undefined' == typeof listItemDBIDMatch[1] ? 0 : parseInt(listItemDBIDMatch[1], 10);
</span><del>-                                                        menuItems[listItemDBID] = getListDataFromID(listItemDBID);
</del><ins>+                                                        menuItems[listItemDBID] = api.getListDataFromID(listItemDBID);
</ins><span class="cx">                                                 });
</span><span class="cx">                                                 // Add the items
</span><span class="cx">                                                 api.addItemToMenu(menuItems, processMethod, function(){
</span><span class="lines">@@ -225,15 +159,15 @@
</span><span class="cx">                                 $('.field-' + field).addClass('hidden-field');
</span><span class="cx">                         }
</span><span class="cx">                         // hide fields
</span><del>-                        menuList.hideAdvancedMenuItemFields();
</del><ins>+                        api.menuList.hideAdvancedMenuItemFields();
</ins><span class="cx">                 },
</span><span class="cx"> 
</span><span class="cx">                 initSortables : function() {
</span><span class="cx">                         var currentDepth = 0, originalDepth, minDepth, maxDepth,
</span><del>-                                menuLeft = menuList.offset().left,
</del><ins>+                                menuLeft = api.menuList.offset().left,
</ins><span class="cx">                                 newItem, transport;
</span><span class="cx"> 
</span><del>-                        menuList.sortable({
</del><ins>+                        api.menuList.sortable({
</ins><span class="cx">                                 handle: '.menu-item-handle',
</span><span class="cx">                                 placeholder: 'sortable-placeholder',
</span><span class="cx">                                 start: function(e, ui) {
</span><span class="lines">@@ -269,7 +203,7 @@
</span><span class="cx">                                                 maxChildDepth = (depth &gt; maxChildDepth) ? depth : maxChildDepth;
</span><span class="cx">                                         });
</span><span class="cx">                                         width = ui.helper.find('.menu-item-handle').outerWidth(); // Get original width
</span><del>-                                        width += depthToPx(maxChildDepth - originalDepth); // Account for children
</del><ins>+                                        width += api.depthToPx(maxChildDepth - originalDepth); // Account for children
</ins><span class="cx">                                         width -= 2; // Subtract 2 for borders
</span><span class="cx">                                         ui.placeholder.width(width);
</span><span class="cx">                                 },
</span><span class="lines">@@ -287,25 +221,25 @@
</span><span class="cx">                                         // Update the item data.
</span><span class="cx">                                         ui.item.updateParentMenuItemDBId();
</span><span class="cx">                                         // Update positions
</span><del>-                                        recalculateMenuItemPositions();
</del><ins>+                                        api.recalculateMenuItemPositions();
</ins><span class="cx">                                 },
</span><span class="cx">                                 change: function(e, ui) {
</span><span class="cx">                                         // Make sure the placeholder is inside the menu.
</span><span class="cx">                                         // Otherwise fix it, or we're in trouble.
</span><span class="cx">                                         if( ! ui.placeholder.parent().hasClass('menu') )
</span><del>-                                                ui.placeholder.appendTo(menuList);
</del><ins>+                                                ui.placeholder.appendTo(api.menuList);
</ins><span class="cx"> 
</span><span class="cx">                                         updateDepthRange(ui);
</span><span class="cx">                                 },
</span><span class="cx">                                 sort: function(e, ui) {
</span><del>-                                        var depth = pxToDepth(ui.helper.offset().left - menuLeft);
</del><ins>+                                        var depth = api.pxToDepth(ui.helper.offset().left - menuLeft);
</ins><span class="cx">                                         // Check and correct if depth is not within range.
</span><span class="cx">                                         if ( depth &lt; minDepth ) depth = minDepth;
</span><span class="cx">                                         else if ( depth &gt; maxDepth ) depth = maxDepth;
</span><span class="cx"> 
</span><span class="cx">                                         if( depth != currentDepth )
</span><span class="cx">                                                 updateCurrentDepth(ui, depth);
</span><del>-                                },
</del><ins>+                                }
</ins><span class="cx">                         });
</span><span class="cx"> 
</span><span class="cx">                         function updateDepthRange(ui) {
</span><span class="lines">@@ -319,7 +253,7 @@
</span><span class="cx">                                 minDepth = (next.length) ? next.menuItemDepth() : 0;
</span><span class="cx"> 
</span><span class="cx">                                 if( prev.length )
</span><del>-                                        maxDepth = ( (depth = prev.menuItemDepth() + 1) &gt; globalMaxDepth ) ? globalMaxDepth : depth;
</del><ins>+                                        maxDepth = ( (depth = prev.menuItemDepth() + 1) &gt; api.options.globalMaxDepth ) ? api.options.globalMaxDepth : depth;
</ins><span class="cx">                                 else
</span><span class="cx">                                         maxDepth = 0;
</span><span class="cx">                         }
</span><span class="lines">@@ -492,16 +426,16 @@
</span><span class="cx">                  * @param object req The request arguments.
</span><span class="cx">                  */
</span><span class="cx">                 addMenuItemToBottom : function( menuMarkup, req ) {
</span><del>-                        $(menuMarkup).hideAdvancedMenuItemFields().appendTo( targetList );
</del><ins>+                        $(menuMarkup).hideAdvancedMenuItemFields().appendTo( api.targetList );
</ins><span class="cx">                 },
</span><span class="cx">         
</span><span class="cx">                 addMenuItemToTop : function( menuMarkup, req ) {
</span><del>-                        $(menuMarkup).hideAdvancedMenuItemFields().prependTo( targetList );
</del><ins>+                        $(menuMarkup).hideAdvancedMenuItemFields().prependTo( api.targetList );
</ins><span class="cx">                 },
</span><span class="cx">         
</span><span class="cx">                 attachHomeLinkListener : function() {
</span><span class="cx">                         $('.add-home-link', '.customlinkdiv').click(function(e) {
</span><del>-                                api.addLinkToMenu( navMenuL10n.homeurl, navMenuL10n.home, api.addMenuItemToTop, recalculateMenuItemPositions );
</del><ins>+                                api.addLinkToMenu( navMenuL10n.homeurl, navMenuL10n.home, api.addMenuItemToTop, api.recalculateMenuItemPositions );
</ins><span class="cx">                                 return false;
</span><span class="cx">                         });
</span><span class="cx">                 },
</span><span class="lines">@@ -666,13 +600,13 @@
</span><span class="cx">                         $(el).autocomplete( ajaxurl + '?action=menu-quick-search&amp;type=' + el.name,
</span><span class="cx">                                 {
</span><span class="cx">                                         delay: 500,
</span><del>-                                        formatItem: formatAutocompleteResponse,
-                                        formatResult: formatAutocompleteResult,
</del><ins>+                                        formatItem: api.formatAutocompleteResponse,
+                                        formatResult: api.formatAutocompleteResult,
</ins><span class="cx">                                         minchars: 2,
</span><span class="cx">                                         multiple: false
</span><span class="cx">                                 }
</span><span class="cx">                         ).bind('blur', function(e) {
</span><del>-                                var changedData = autoCompleteData[this.value],
</del><ins>+                                var changedData = api.autoCompleteData[this.value],
</ins><span class="cx">                                 inputEl = this;
</span><span class="cx">                                 if ( changedData ) {
</span><span class="cx">                                         $.post(
</span><span class="lines">@@ -680,7 +614,7 @@
</span><span class="cx">                                                 changedData,
</span><span class="cx">                                                 function(r) {
</span><span class="cx">                                                         that.processQuickSearchQueryResponse.call(that, r, changedData);
</span><del>-                                                        autoCompleteData[inputEl.value] = false;
</del><ins>+                                                        api.autoCompleteData[inputEl.value] = false;
</ins><span class="cx">                                                 }
</span><span class="cx">                                         );
</span><span class="cx">                                 }
</span><span class="lines">@@ -820,22 +754,92 @@
</span><span class="cx">                         el.addClass('deleting').fadeOut( 350 , function() {
</span><span class="cx">                                 el.remove();
</span><span class="cx">                                 children.shiftDepthClass(-1).updateParentMenuItemDBId();
</span><del>-                                recalculateMenuItemPositions();
</del><ins>+                                api.recalculateMenuItemPositions();
</ins><span class="cx">                                 that.checkForEmptyMenu();
</span><span class="cx">                         });
</span><span class="cx">                 },
</span><span class="cx">         
</span><span class="cx">                 checkForEmptyMenu : function() {
</span><del>-                        if( menuList.children().length ) return;
-                        menuList.height(80).one('sortstop', function(){
</del><ins>+                        if( api.menuList.children().length ) return;
+                        api.menuList.height(80).one('sortstop', function(){
</ins><span class="cx">                                 $(this).height('auto');
</span><span class="cx">                         });
</span><ins>+                },
+                
+                formatAutocompleteResponse : function( resultRow, pos, total, queryTerm ) {
+                        if ( resultRow &amp;&amp; resultRow[0] ) {
+                                var data = $.parseJSON(resultRow[0]);
+                                if ( data.post_title ) {
+                                        if ( data.ID &amp;&amp; data.post_type )
+                                                api.autoCompleteData[data.post_title] = {ID: data.ID, object_type: data.post_type};
+                                        return data.post_title;
+                                }
+                        }
+                },
+
+                formatAutocompleteResult : function( resultRow, pos, total, queryTerm ) {
+                        if ( resultRow &amp;&amp; resultRow[0] ) {
+                                var data = $.parseJSON(resultRow[0]);
+                                if ( data.post_title )
+                                        return data.post_title;
+                        }
+                },
+
+                getListDataFromID : function(menuItemID, parentEl) {
+                        if ( ! menuItemID )
+                                return false;
+                        parentEl = parentEl || document;
+                        var fields = [
+                                'menu-item-db-id',
+                                'menu-item-object-id',
+                                'menu-item-object',
+                                'menu-item-parent-id',
+                                'menu-item-position',
+                                'menu-item-type',
+                                'menu-item-append',
+                                'menu-item-title',
+                                'menu-item-url',
+                                'menu-item-description',
+                                'menu-item-attr-title',
+                                'menu-item-target',
+                                'menu-item-classes',
+                                'menu-item-xfn'
+                        ],
+                        itemData = {},
+                        inputs = parentEl.getElementsByTagName('input'),
+                        i = inputs.length,
+                        j;
+
+                        while ( i-- ) {
+                                j = fields.length;
+                                while ( j-- ) {
+                                        if (
+                                                inputs[i] &amp;&amp;
+                                                inputs[i].name &amp;&amp;
+                                                'menu-item[' + menuItemID + '][' + fields[j] + ']' == inputs[i].name
+                                        ) {
+                                                itemData[fields[j]] = inputs[i].value;
+                                        }
+                                }
+                        }
+
+                        return itemData;
+                },
+
+                recalculateMenuItemPositions : function() {
+                        api.menuList.find('.menu-item-data-position').val( function(index) { return index + 1; } );
+                },
+
+                depthToPx : function(depth) {
+                        return depth * api.options.menuItemDepthPerLevel;
+                },
+
+                pxToDepth : function(px) {
+                        return Math.floor(px / api.options.menuItemDepthPerLevel);
</ins><span class="cx">                 }
</span><del>-        }
-}
</del><span class="cx"> 
</span><del>-wpNavMenu = new WPNavMenuHandler(jQuery);
</del><ins>+        };
</ins><span class="cx"> 
</span><del>-jQuery(function() {
-        wpNavMenu.init();
-});
</del><ins>+        $(document).ready(function(){ wpNavMenu.init(); });
+
+})(jQuery);
</ins></span></pre></div>
<a id="trunkwpadminjsnavmenujs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.js (14474 => 14475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.js        2010-05-06 15:40:29 UTC (rev 14474)
+++ trunk/wp-admin/js/nav-menu.js        2010-05-06 17:11:52 UTC (rev 14475)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var wpNavMenu,WPNavMenuHandler=function(d){var i={},g=30,c=11,l=function(n,r,o,q){if(n&amp;&amp;n[0]){var p=d.parseJSON(n[0]);if(p.post_title){if(p.ID&amp;&amp;p.post_type){i[p.post_title]={ID:p.ID,object_type:p.post_type}}return p.post_title}}},m=function(n,r,o,q){if(n&amp;&amp;n[0]){var p=d.parseJSON(n[0]);if(p.post_title){return p.post_title}}},b=function(t,s){if(!t){return false}s=s||document;var o=[&quot;menu-item-db-id&quot;,&quot;menu-item-object-id&quot;,&quot;menu-item-object&quot;,&quot;menu-item-parent-id&quot;,&quot;menu-item-position&quot;,&quot;menu-item-type&quot;,&quot;menu-item-append&quot;,&quot;menu-item-title&quot;,&quot;menu-item-url&quot;,&quot;menu-item-description&quot;,&quot;menu-item-attr-title&quot;,&quot;menu-item-target&quot;,&quot;menu-item-classes&quot;,&quot;menu-item-xfn&quot;],n={},p=s.getElementsByTagName(&quot;input&quot;),r=p.length,q;while(r--){q=o.length;while(q--){if(p[r]&amp;&amp;p[r].name&amp;&amp;&quot;menu-item[&quot;+t+&quot;][&quot;+o[q]+&quot;]&quot;==p[r].name){n[o[q]]=p[r].value}}}return n},a=function(){h.find(&quot;.menu-item-data-position&quot;).val(function(n){return n+1})},f=function(n){return n*g},j=function(n){return Math.floor(n/g)},h,k,e;return e={init:function(){h=d(&quot;#menu-to-edit&quot;);k=h;this.jQueryExtensions();this.attachMenuEditListeners();this.setupInputWithDefaultTitle();this.attachAddMenuItemListeners();this.attachQuickSearchListeners();this.attachTabsPanelListeners();this.attachHomeLinkListener();if(h.length){this.initSortables()}this.initToggles();this.initTabManager();this.checkForEmptyMenu()},jQueryExtensions:function(){d.fn.extend({menuItemDepth:function(){return j(this.eq(0).css(&quot;margin-left&quot;).slice(0,-2))},updateDepthClass:function(o,n){return this.each(function(){var p=d(this);n=n||p.menuItemDepth();d(this).removeClass(&quot;menu-item-depth-&quot;+n).addClass(&quot;menu-item-depth-&quot;+o)})},shiftDepthClass:function(n){return this.each(function(){var o=d(this),p=o.menuItemDepth();d(this).removeClass(&quot;menu-item-depth-&quot;+p).addClass(&quot;menu-item-depth-&quot;+(p+n))})},childMenuItems:function(){var n=d();this.each(function(){var o=d(this),q=o.menuItemDepth(),p=o.next();while(p.length&amp;&amp;p.menuItemDepth()&gt;q){n=n.add(p);p=p.next()}});return n},updateParentMenuItemDBId:function(){return this.each(function(){var p=d(this),n=p.find(&quot;.menu-item-data-parent-id&quot;),q=p.menuItemDepth(),o=p.prev();if(q==0){n.val(0)}else{while(o.menuItemDepth()!=q-1){o=o.prev()}n.val(o.find(&quot;.menu-item-data-db-id&quot;).val())}})},hideAdvancedMenuItemFields:function(){return this.each(function(){var n=d(this);d(&quot;.hide-column-tog&quot;).not(&quot;:checked&quot;).each(function(){n.find(&quot;.field-&quot;+d(this).val()).addClass(&quot;hidden-field&quot;)})})},addSelectedToMenu:function(n){return this.each(function(){var p=d(this),o={},r=p.find(&quot;.tabs-panel-active .categorychecklist li input:checked&quot;),q=new RegExp(&quot;menu-item\\[([^\\]]*)&quot;);n=n||e.addMenuItemToBottom;if(!r.length){return false}p.find(&quot;img.waiting&quot;).show();d(r).each(function(){var s=q.exec(d(this).attr(&quot;name&quot;)),t=&quot;undefined&quot;==typeof s[1]?0:parseInt(s[1],10);o[t]=b(t)});e.addItemToMenu(o,n,function(){r.removeAttr(&quot;checked&quot;);p.find(&quot;img.waiting&quot;).hide()})})}})},initToggles:function(){postboxes.add_postbox_toggles(&quot;nav-menus&quot;);columns.useCheckboxesForHidden();columns.checked=function(n){d(&quot;.field-&quot;+n).removeClass(&quot;hidden-field&quot;)};columns.unchecked=function(n){d(&quot;.field-&quot;+n).addClass(&quot;hidden-field&quot;)};h.hideAdvancedMenuItemFields()},initSortables:function(){var t=0,s,r,n,q=h.offset().left,u,p;h.sortable({handle:&quot;.menu-item-handle&quot;,placeholder:&quot;sortable-placeholder&quot;,start:function(C,B){var w,A,z,x,y;p=B.item.children(&quot;.menu-item-transport&quot;);s=(u)?0:B.item.menuItemDepth();o(B,s);z=(B.item.next()[0]==B.placeholder[0])?B.item.next():B.item;x=z.childMenuItems();p.append(x);v(B);w=p.outerHeight();w+=(w&gt;0)?(B.placeholder.css(&quot;margin-top&quot;).slice(0,-2)*1):0;w+=B.helper.outerHeight();w-=2;B.placeholder.height(w);y=s;x.each(function(){var D=d(this).menuItemDepth();y=(D&gt;y)?D:y});A=B.helper.find(&quot;.menu-item-handle&quot;).outerWidth();A+=f(y-s);A-=2;B.placeholder.width(A)},stop:function(z,y){var x,w=t-s;x=p.children().insertAfter(y.item);if(w!=0){y.item.updateDepthClass(t);x.shiftDepthClass(w)}y.item.updateParentMenuItemDBId();a()},change:function(x,w){if(!w.placeholder.parent().hasClass(&quot;menu&quot;)){w.placeholder.appendTo(h)}v(w)},sort:function(x,w){var y=j(w.helper.offset().left-q);if(y&lt;r){y=r}else{if(y&gt;n){y=n}}if(y!=t){o(w,y)}},});function v(y){var x=y.placeholder.prev(),w=y.placeholder.next(),z;if(x[0]==y.item[0]){x=x.prev()}if(w[0]==y.item[0]){w=w.next()}r=(w.length)?w.menuItemDepth():0;if(x.length){n=((z=x.menuItemDepth()+1)&gt;c)?c:z}else{n=0}}function o(w,x){w.placeholder.updateDepthClass(x,t);t=x}},attachMenuEditListeners:function(){var n=this;d(&quot;#update-nav-menu&quot;).bind(&quot;click&quot;,function(o){if(o.target&amp;&amp;o.target.className){if(-1!=o.target.className.indexOf(&quot;item-edit&quot;)){return n.eventOnClickEditLink(o.target)}else{if(-1!=o.target.className.indexOf(&quot;menu-delete&quot;)){return n.eventOnClickMenuDelete(o.target)}else{if(-1!=o.target.className.indexOf(&quot;item-delete&quot;)){return n.eventOnClickMenuItemDelete(o.target)}else{if(-1!=o.target.className.indexOf(&quot;item-close&quot;)){return n.eventOnClickCloseLink(o.target)}}}}}})},setupInputWithDefaultTitle:function(){var n=&quot;input-with-default-title&quot;;d(&quot;.&quot;+n).each(function(){var q=d(this),p=q.attr(&quot;title&quot;),o=q.val();q.data(n,p);if(&quot;&quot;==o){q.val(p)}else{if(p==o){return}else{q.removeClass(n)}}}).focus(function(){var o=d(this);if(o.val()==o.data(n)){o.val(&quot;&quot;).removeClass(n)}}).blur(function(){var o=d(this);if(&quot;&quot;==o.val()){o.addClass(n).val(o.data(n))}})},attachAddMenuItemListeners:function(){var n=d(&quot;#nav-menu-meta&quot;);n.find(&quot;.add-to-menu input&quot;).click(function(){d(this).trigger(&quot;wp-add-menu-item&quot;,[e.addMenuItemToBottom]);return false});n.find(&quot;.customlinkdiv&quot;).bind(&quot;wp-add-menu-item&quot;,function(p,o){e.addCustomLink(o)});n.find(&quot;.posttypediv, .taxonomydiv&quot;).bind(&quot;wp-add-menu-item&quot;,function(p,o){d(this).addSelectedToMenu(o)})},attachQuickSearchListeners:function(){var o=this,n=d(&quot;#nav-menu-meta&quot;);d(&quot;input.quick-search&quot;).each(function(p,q){o.setupQuickSearchEventListeners(q)});n.find(&quot;.quick-search-submit&quot;).click(function(){d(this).trigger(&quot;wp-quick-search&quot;);return false});n.find(&quot;.inside&quot;).children().bind(&quot;wp-quick-search&quot;,function(){o.quickSearch(d(this).attr(&quot;id&quot;))})},quickSearch:function(v){var p=d(&quot;#&quot;+v+&quot; .quick-search&quot;).attr(&quot;name&quot;),s=d(&quot;#&quot;+v+&quot; .quick-search&quot;).val(),u=d(&quot;#menu&quot;).val(),o=d(&quot;#menu-settings-column-nonce&quot;).val(),t={},r=this,n=function(){};n=r.processQuickSearchQueryResponse;t={action:&quot;menu-quick-search&quot;,&quot;response-format&quot;:&quot;markup&quot;,menu:u,&quot;menu-settings-column-nonce&quot;:o,q:s,type:p};d.post(ajaxurl,t,function(q){n.call(r,q,t)})},addCustomLink:function(n){var p=d(&quot;#custom-menu-item-url&quot;).val(),o=d(&quot;#custom-menu-item-name&quot;).val();n=n||e.addMenuItemToBottom;if(&quot;&quot;==p||&quot;http://&quot;==p){return false}d(&quot;.customlinkdiv img.waiting&quot;).show();this.addLinkToMenu(p,o,n,function(){d(&quot;.customlinkdiv img.waiting&quot;).hide();d(&quot;#custom-menu-item-name&quot;).val(&quot;&quot;).blur();d(&quot;#custom-menu-item-url&quot;).val(&quot;http://&quot;)})},addLinkToMenu:function(p,o,n,q){n=n||e.addMenuItemToBottom;q=q||function(){};e.addItemToMenu({&quot;-1&quot;:{&quot;menu-item-type&quot;:&quot;custom&quot;,&quot;menu-item-url&quot;:p,&quot;menu-item-title&quot;:o}},n,q)},addItemToMenu:function(p,n,r){var q=d(&quot;#menu&quot;).val(),o=d(&quot;#menu-settings-column-nonce&quot;).val();n=n||function(){};r=r||function(){};params={action:&quot;add-menu-item&quot;,menu:q,&quot;menu-settings-column-nonce&quot;:o,&quot;menu-item&quot;:p};d.post(ajaxurl,params,function(s){n(s,params);r()})},addMenuItemToBottom:function(n,o){d(n).hideAdvancedMenuItemFields().appendTo(k)},addMenuItemToTop:function(n,o){d(n).hideAdvancedMenuItemFields().prependTo(k)},attachHomeLinkListener:function(){d(&quot;.add-home-link&quot;,&quot;.customlinkdiv&quot;).click(function(n){e.addLinkToMenu(navMenuL10n.homeurl,navMenuL10n.home,e.addMenuItemToTop,a);return false})},attachTabsPanelListeners:function(){d(&quot;#menu-settings-column&quot;).bind(&quot;click&quot;,function(s){var r,t,o,u,n,q,p;if(s.target&amp;&amp;s.target.className&amp;&amp;-1!=s.target.className.indexOf(&quot;nav-tab-link&quot;)){o=/#(.*)$/.exec(s.target.href);u=d(s.target).parents(&quot;.inside&quot;).first()[0];n=u?u.getElementsByTagName(&quot;input&quot;):[];q=n.length;while(q--){n[q].checked=false}d(&quot;.tabs-panel&quot;,u).each(function(){if(this.className){this.className=this.className.replace(&quot;tabs-panel-active&quot;,&quot;tabs-panel-inactive&quot;)}});d(&quot;.tabs&quot;,u).each(function(){this.className=this.className.replace(&quot;tabs&quot;,&quot;&quot;)});s.target.parentNode.className+=&quot; tabs&quot;;if(o&amp;&amp;o[1]){t=document.getElementById(o[1]);if(t){t.className=t.className.replace(&quot;tabs-panel-inactive&quot;,&quot;tabs-panel-active&quot;)}}return false}else{if(s.target&amp;&amp;s.target.className&amp;&amp;-1!=s.target.className.indexOf(&quot;select-all&quot;)){r=/#(.*)$/.exec(s.target.href);if(r&amp;&amp;r[1]){p=d(&quot;#&quot;+r[1]+&quot; .tabs-panel-active .menu-item-title input&quot;);if(p.length===p.filter(&quot;:checked&quot;).length){p.removeAttr(&quot;checked&quot;)}else{p.attr(&quot;checked&quot;,&quot;checked&quot;)}return false}}}})},initTabManager:function(){var s=d(&quot;.nav-tabs-wrapper&quot;),t=s.children(&quot;.nav-tabs&quot;),r=t.children(&quot;.nav-tab-active&quot;),w=t.children(&quot;.nav-tab&quot;),p=0,x,q,v,o,u=false;function n(){q=s.offset().left;x=q+s.width();r.makeTabVisible()}d.fn.extend({makeTabVisible:function(){var z=this.eq(0),A,y;if(!z.length){return}A=z.offset().left;y=A+z.outerWidth();if(y&gt;x){t.animate({&quot;margin-left&quot;:&quot;+=&quot;+(x-y)+&quot;px&quot;},&quot;fast&quot;)}else{if(A&lt;q){t.animate({&quot;margin-left&quot;:&quot;-=&quot;+(A-q)+&quot;px&quot;},&quot;fast&quot;)}}return z},isTabVisible:function(){var z=this.eq(0),A=z.offset().left,y=A+z.outerWidth();return(y&lt;=x&amp;&amp;A&gt;=q)?true:false}});w.each(function(){p+=d(this).outerWidth(true)});if(p&lt;=s.width()-t.css(&quot;padding-left&quot;).slice(0,-2)-t.css(&quot;padding-right&quot;).slice(0,-2)){return}t.css({&quot;margin-right&quot;:(-1*p)+&quot;px&quot;,padding:0});v=d('&lt;div class=&quot;nav-tabs-arrow nav-tabs-arrow-left&quot;&gt;&lt;a&gt;&amp;laquo;&lt;/a&gt;&lt;/div&gt;');o=d('&lt;div class=&quot;nav-tabs-arrow nav-tabs-arrow-right&quot;&gt;&lt;a&gt;&amp;raquo;&lt;/a&gt;&lt;/div&gt;');s.wrap('&lt;div class=&quot;nav-tabs-nav&quot;/&gt;').parent().prepend(v).append(o);n();d(window).resize(function(){if(u){return}u=true;setTimeout(function(){n();u=false},1000)});d.each([{arrow:v,next:&quot;next&quot;,last:&quot;first&quot;,operator:&quot;+=&quot;},{arrow:o,next:&quot;prev&quot;,last:&quot;last&quot;,operator:&quot;-=&quot;}],function(){var y=this;this.arrow.mousedown(function(){var A=w[y.last](),z=function(){if(!A.isTabVisible()){t.animate({&quot;margin-left&quot;:y.operator+&quot;90px&quot;},300,&quot;linear&quot;,z)}};z()}).mouseup(function(){var A,z;t.stop(true);A=w[y.last]();while((z=A[y.next]())&amp;&amp;z.length&amp;&amp;!z.isTabVisible()){A=z}A.makeTabVisible()})})},setupQuickSearchEventListeners:function(n){var o=this;d(n).autocomplete(ajaxurl+&quot;?action=menu-quick-search&amp;type=&quot;+n.name,{delay:500,formatItem:l,formatResult:m,minchars:2,multiple:false}).bind(&quot;blur&quot;,function(r){var p=i[this.value],q=this;if(p){d.post(ajaxurl+&quot;?action=menu-quick-search&amp;type=get-post-item&amp;response-format=markup&quot;,p,function(s){o.processQuickSearchQueryResponse.call(o,s,p);i[q.value]=false})}})},eventOnClickEditLink:function(n){var p,o=/#(.*)$/.exec(n.href);if(o&amp;&amp;o[1]){p=d(&quot;#&quot;+o[1]);if(0!=p.length){if(p.hasClass(&quot;menu-item-edit-inactive&quot;)){p.slideDown(&quot;fast&quot;).siblings(&quot;dl&quot;).andSelf().removeClass(&quot;menu-item-edit-inactive&quot;).addClass(&quot;menu-item-edit-active&quot;)}else{p.slideUp(&quot;fast&quot;).siblings(&quot;dl&quot;).andSelf().removeClass(&quot;menu-item-edit-active&quot;).addClass(&quot;menu-item-edit-inactive&quot;)}return false}}},eventOnClickCloseLink:function(n){d(n).closest(&quot;.menu-item-settings&quot;).siblings(&quot;dl&quot;).find(&quot;.item-edit&quot;).click();return false},eventOnClickMenuDelete:function(n){if(confirm(navMenuL10n.warnDeleteMenu)){return true}else{return false}},eventOnClickMenuItemDelete:function(n){var q,p,o=this;if(confirm(navMenuL10n.warnDeleteMenuItem)){p=/_wpnonce=([a-zA-Z0-9]*)$/.exec(n.href);if(p&amp;&amp;p[1]){q=parseInt(n.id.replace(&quot;delete-&quot;,&quot;&quot;),10);d.post(ajaxurl,{action:&quot;delete-menu-item&quot;,&quot;menu-item&quot;:q,_wpnonce:p[1]},function(r){if(&quot;1&quot;==r){o.removeMenuItem(document.getElementById(&quot;menu-item-&quot;+q))}});return false}return true}else{return false}},processQuickSearchQueryResponse:function(r,w){if(!w){w={}}var o=document.createElement(&quot;ul&quot;),n=document.getElementById(&quot;nav-menu-meta&quot;),s,v,p,x,t,u=new RegExp(&quot;menu-item\\[([^\\]]*)&quot;),q;p=u.exec(r);if(p&amp;&amp;p[1]){t=p[1];while(n.elements[&quot;menu-item[&quot;+t+&quot;][menu-item-type]&quot;]){t--}if(t!=p[1]){r=r.replace(new RegExp(&quot;menu-item\\[&quot;+p[1]+&quot;\\]&quot;,&quot;g&quot;),&quot;menu-item[&quot;+t+&quot;]&quot;)}}o.innerHTML=r;v=o.getElementsByTagName(&quot;li&quot;);if(v[0]&amp;&amp;w.object_type){q=document.getElementById(w.object_type+&quot;-search-checklist&quot;);if(q){q.appendChild(v[0])}}else{if(w.type){p=/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*)/.exec(w.type);if(p&amp;&amp;p[2]){q=document.getElementById(p[2]+&quot;-search-checklist&quot;);if(q){s=v.length;if(!s){x=document.createElement(&quot;li&quot;);x.appendChild(document.createTextNode(navMenuL10n.noResultsFound));q.appendChild(x)}while(s--){q.appendChild(v[s])}}}}}},removeMenuItem:function(o){o=d(o);var n=o.childMenuItems(),p=this;o.addClass(&quot;deleting&quot;).fadeOut(350,function(){o.remove();n.shiftDepthClass(-1).updateParentMenuItemDBId();a();p.checkForEmptyMenu()})},checkForEmptyMenu:function(){if(h.children().length){return}h.height(80).one(&quot;sortstop&quot;,function(){d(this).height(&quot;auto&quot;)})}}};wpNavMenu=new WPNavMenuHandler(jQuery);jQuery(function(){wpNavMenu.init()});
</del><span class="cx">\ No newline at end of file
</span><ins>+var wpNavMenu;(function(b){var a=wpNavMenu={options:{menuItemDepthPerLevel:30,globalMaxDepth:11},menuList:undefined,targetList:undefined,autoCompleteData:{},init:function(){a.menuList=b(&quot;#menu-to-edit&quot;);a.targetList=a.menuList;this.jQueryExtensions();this.attachMenuEditListeners();this.setupInputWithDefaultTitle();this.attachAddMenuItemListeners();this.attachQuickSearchListeners();this.attachTabsPanelListeners();this.attachHomeLinkListener();if(a.menuList.length){this.initSortables()}this.initToggles();this.initTabManager();this.checkForEmptyMenu()},jQueryExtensions:function(){b.fn.extend({menuItemDepth:function(){return a.pxToDepth(this.eq(0).css(&quot;margin-left&quot;).slice(0,-2))},updateDepthClass:function(d,c){return this.each(function(){var e=b(this);c=c||e.menuItemDepth();b(this).removeClass(&quot;menu-item-depth-&quot;+c).addClass(&quot;menu-item-depth-&quot;+d)})},shiftDepthClass:function(c){return this.each(function(){var d=b(this),e=d.menuItemDepth();b(this).removeClass(&quot;menu-item-depth-&quot;+e).addClass(&quot;menu-item-depth-&quot;+(e+c))})},childMenuItems:function(){var c=b();this.each(function(){var d=b(this),f=d.menuItemDepth(),e=d.next();while(e.length&amp;&amp;e.menuItemDepth()&gt;f){c=c.add(e);e=e.next()}});return c},updateParentMenuItemDBId:function(){return this.each(function(){var e=b(this),c=e.find(&quot;.menu-item-data-parent-id&quot;),f=e.menuItemDepth(),d=e.prev();if(f==0){c.val(0)}else{while(d.menuItemDepth()!=f-1){d=d.prev()}c.val(d.find(&quot;.menu-item-data-db-id&quot;).val())}})},hideAdvancedMenuItemFields:function(){return this.each(function(){var c=b(this);b(&quot;.hide-column-tog&quot;).not(&quot;:checked&quot;).each(function(){c.find(&quot;.field-&quot;+b(this).val()).addClass(&quot;hidden-field&quot;)})})},addSelectedToMenu:function(c){return this.each(function(){var e=b(this),d={},g=e.find(&quot;.tabs-panel-active .categorychecklist li input:checked&quot;),f=new RegExp(&quot;menu-item\\[([^\\]]*)&quot;);c=c||a.addMenuItemToBottom;if(!g.length){return false}e.find(&quot;img.waiting&quot;).show();b(g).each(function(){var h=f.exec(b(this).attr(&quot;name&quot;)),i=&quot;undefined&quot;==typeof h[1]?0:parseInt(h[1],10);d[i]=a.getListDataFromID(i)});a.addItemToMenu(d,c,function(){g.removeAttr(&quot;checked&quot;);e.find(&quot;img.waiting&quot;).hide()})})}})},initToggles:function(){postboxes.add_postbox_toggles(&quot;nav-menus&quot;);columns.useCheckboxesForHidden();columns.checked=function(c){b(&quot;.field-&quot;+c).removeClass(&quot;hidden-field&quot;)};columns.unchecked=function(c){b(&quot;.field-&quot;+c).addClass(&quot;hidden-field&quot;)};a.menuList.hideAdvancedMenuItemFields()},initSortables:function(){var i=0,h,g,c,f=a.menuList.offset().left,j,e;a.menuList.sortable({handle:&quot;.menu-item-handle&quot;,placeholder:&quot;sortable-placeholder&quot;,start:function(r,q){var l,p,o,m,n;e=q.item.children(&quot;.menu-item-transport&quot;);h=(j)?0:q.item.menuItemDepth();d(q,h);o=(q.item.next()[0]==q.placeholder[0])?q.item.next():q.item;m=o.childMenuItems();e.append(m);k(q);l=e.outerHeight();l+=(l&gt;0)?(q.placeholder.css(&quot;margin-top&quot;).slice(0,-2)*1):0;l+=q.helper.outerHeight();l-=2;q.placeholder.height(l);n=h;m.each(function(){var s=b(this).menuItemDepth();n=(s&gt;n)?s:n});p=q.helper.find(&quot;.menu-item-handle&quot;).outerWidth();p+=a.depthToPx(n-h);p-=2;q.placeholder.width(p)},stop:function(o,n){var m,l=i-h;m=e.children().insertAfter(n.item);if(l!=0){n.item.updateDepthClass(i);m.shiftDepthClass(l)}n.item.updateParentMenuItemDBId();a.recalculateMenuItemPositions()},change:function(m,l){if(!l.placeholder.parent().hasClass(&quot;menu&quot;)){l.placeholder.appendTo(a.menuList)}k(l)},sort:function(m,l){var n=a.pxToDepth(l.helper.offset().left-f);if(n&lt;g){n=g}else{if(n&gt;c){n=c}}if(n!=i){d(l,n)}}});function k(n){var m=n.placeholder.prev(),l=n.placeholder.next(),o;if(m[0]==n.item[0]){m=m.prev()}if(l[0]==n.item[0]){l=l.next()}g=(l.length)?l.menuItemDepth():0;if(m.length){c=((o=m.menuItemDepth()+1)&gt;a.options.globalMaxDepth)?a.options.globalMaxDepth:o}else{c=0}}function d(l,m){l.placeholder.updateDepthClass(m,i);i=m}},attachMenuEditListeners:function(){var c=this;b(&quot;#update-nav-menu&quot;).bind(&quot;click&quot;,function(d){if(d.target&amp;&amp;d.target.className){if(-1!=d.target.className.indexOf(&quot;item-edit&quot;)){return c.eventOnClickEditLink(d.target)}else{if(-1!=d.target.className.indexOf(&quot;menu-delete&quot;)){return c.eventOnClickMenuDelete(d.target)}else{if(-1!=d.target.className.indexOf(&quot;item-delete&quot;)){return c.eventOnClickMenuItemDelete(d.target)}else{if(-1!=d.target.className.indexOf(&quot;item-close&quot;)){return c.eventOnClickCloseLink(d.target)}}}}}})},setupInputWithDefaultTitle:function(){var c=&quot;input-with-default-title&quot;;b(&quot;.&quot;+c).each(function(){var f=b(this),e=f.attr(&quot;title&quot;),d=f.val();f.data(c,e);if(&quot;&quot;==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(&quot;&quot;).removeClass(c)}}).blur(function(){var d=b(this);if(&quot;&quot;==d.val()){d.addClass(c).val(d.data(c))}})},attachAddMenuItemListeners:function(){var c=b(&quot;#nav-menu-meta&quot;);c.find(&quot;.add-to-menu input&quot;).click(function(){b(this).trigger(&quot;wp-add-menu-item&quot;,[a.addMenuItemToBottom]);return false});c.find(&quot;.customlinkdiv&quot;).bind(&quot;wp-add-menu-item&quot;,function(f,d){a.addCustomLink(d)});c.find(&quot;.posttypediv, .taxonomydiv&quot;).bind(&quot;wp-add-menu-item&quot;,function(f,d){b(this).addSelectedToMenu(d)})},attachQuickSearchListeners:function(){var d=this,c=b(&quot;#nav-menu-meta&quot;);b(&quot;input.quick-search&quot;).each(function(e,f){d.setupQuickSearchEventListeners(f)});c.find(&quot;.quick-search-submit&quot;).click(function(){b(this).trigger(&quot;wp-quick-search&quot;);return false});c.find(&quot;.inside&quot;).children().bind(&quot;wp-quick-search&quot;,function(){d.quickSearch(b(this).attr(&quot;id&quot;))})},quickSearch:function(j){var e=b(&quot;#&quot;+j+&quot; .quick-search&quot;).attr(&quot;name&quot;),g=b(&quot;#&quot;+j+&quot; .quick-search&quot;).val(),i=b(&quot;#menu&quot;).val(),d=b(&quot;#menu-settings-column-nonce&quot;).val(),h={},f=this,c=function(){};c=f.processQuickSearchQueryResponse;h={action:&quot;menu-quick-search&quot;,&quot;response-format&quot;:&quot;markup&quot;,menu:i,&quot;menu-settings-column-nonce&quot;:d,q:g,type:e};b.post(ajaxurl,h,function(k){c.call(f,k,h)})},addCustomLink:function(c){var e=b(&quot;#custom-menu-item-url&quot;).val(),d=b(&quot;#custom-menu-item-name&quot;).val();c=c||a.addMenuItemToBottom;if(&quot;&quot;==e||&quot;http://&quot;==e){return false}b(&quot;.customlinkdiv img.waiting&quot;).show();this.addLinkToMenu(e,d,c,function(){b(&quot;.customlinkdiv img.waiting&quot;).hide();b(&quot;#custom-menu-item-name&quot;).val(&quot;&quot;).blur();b(&quot;#custom-menu-item-url&quot;).val(&quot;http://&quot;)})},addLinkToMenu:function(e,d,c,f){c=c||a.addMenuItemToBottom;f=f||function(){};a.addItemToMenu({&quot;-1&quot;:{&quot;menu-item-type&quot;:&quot;custom&quot;,&quot;menu-item-url&quot;:e,&quot;menu-item-title&quot;:d}},c,f)},addItemToMenu:function(e,c,g){var f=b(&quot;#menu&quot;).val(),d=b(&quot;#menu-settings-column-nonce&quot;).val();c=c||function(){};g=g||function(){};params={action:&quot;add-menu-item&quot;,menu:f,&quot;menu-settings-column-nonce&quot;:d,&quot;menu-item&quot;:e};b.post(ajaxurl,params,function(h){c(h,params);g()})},addMenuItemToBottom:function(c,d){b(c).hideAdvancedMenuItemFields().appendTo(a.targetList)},addMenuItemToTop:function(c,d){b(c).hideAdvancedMenuItemFields().prependTo(a.targetList)},attachHomeLinkListener:function(){b(&quot;.add-home-link&quot;,&quot;.customlinkdiv&quot;).click(function(c){a.addLinkToMenu(navMenuL10n.homeurl,navMenuL10n.home,a.addMenuItemToTop,a.recalculateMenuItemPositions);return false})},attachTabsPanelListeners:function(){b(&quot;#menu-settings-column&quot;).bind(&quot;click&quot;,function(j){var h,k,d,l,c,g,f;if(j.target&amp;&amp;j.target.className&amp;&amp;-1!=j.target.className.indexOf(&quot;nav-tab-link&quot;)){d=/#(.*)$/.exec(j.target.href);l=b(j.target).parents(&quot;.inside&quot;).first()[0];c=l?l.getElementsByTagName(&quot;input&quot;):[];g=c.length;while(g--){c[g].checked=false}b(&quot;.tabs-panel&quot;,l).each(function(){if(this.className){this.className=this.className.replace(&quot;tabs-panel-active&quot;,&quot;tabs-panel-inactive&quot;)}});b(&quot;.tabs&quot;,l).each(function(){this.className=this.className.replace(&quot;tabs&quot;,&quot;&quot;)});j.target.parentNode.className+=&quot; tabs&quot;;if(d&amp;&amp;d[1]){k=document.getElementById(d[1]);if(k){k.className=k.className.replace(&quot;tabs-panel-inactive&quot;,&quot;tabs-panel-active&quot;)}}return false}else{if(j.target&amp;&amp;j.target.className&amp;&amp;-1!=j.target.className.indexOf(&quot;select-all&quot;)){h=/#(.*)$/.exec(j.target.href);if(h&amp;&amp;h[1]){f=b(&quot;#&quot;+h[1]+&quot; .tabs-panel-active .menu-item-title input&quot;);if(f.length===f.filter(&quot;:checked&quot;).length){f.removeAttr(&quot;checked&quot;)}else{f.attr(&quot;checked&quot;,&quot;checked&quot;)}return false}}}})},initTabManager:function(){var h=b(&quot;.nav-tabs-wrapper&quot;),i=h.children(&quot;.nav-tabs&quot;),g=i.children(&quot;.nav-tab-active&quot;),l=i.children(&quot;.nav-tab&quot;),e=0,m,f,k,d,j=false;function c(){f=h.offset().left;m=f+h.width();g.makeTabVisible()}b.fn.extend({makeTabVisible:function(){var o=this.eq(0),p,n;if(!o.length){return}p=o.offset().left;n=p+o.outerWidth();if(n&gt;m){i.animate({&quot;margin-left&quot;:&quot;+=&quot;+(m-n)+&quot;px&quot;},&quot;fast&quot;)}else{if(p&lt;f){i.animate({&quot;margin-left&quot;:&quot;-=&quot;+(p-f)+&quot;px&quot;},&quot;fast&quot;)}}return o},isTabVisible:function(){var o=this.eq(0),p=o.offset().left,n=p+o.outerWidth();return(n&lt;=m&amp;&amp;p&gt;=f)?true:false}});l.each(function(){e+=b(this).outerWidth(true)});if(e&lt;=h.width()-i.css(&quot;padding-left&quot;).slice(0,-2)-i.css(&quot;padding-right&quot;).slice(0,-2)){return}i.css({&quot;margin-right&quot;:(-1*e)+&quot;px&quot;,padding:0});k=b('&lt;div class=&quot;nav-tabs-arrow nav-tabs-arrow-left&quot;&gt;&lt;a&gt;&amp;laquo;&lt;/a&gt;&lt;/div&gt;');d=b('&lt;div class=&quot;nav-tabs-arrow nav-tabs-arrow-right&quot;&gt;&lt;a&gt;&amp;raquo;&lt;/a&gt;&lt;/div&gt;');h.wrap('&lt;div class=&quot;nav-tabs-nav&quot;/&gt;').parent().prepend(k).append(d);c();b(window).resize(function(){if(j){return}j=true;setTimeout(function(){c();j=false},1000)});b.each([{arrow:k,next:&quot;next&quot;,last:&quot;first&quot;,operator:&quot;+=&quot;},{arrow:d,next:&quot;prev&quot;,last:&quot;last&quot;,operator:&quot;-=&quot;}],function(){var n=this;this.arrow.mousedown(function(){var p=l[n.last](),o=function(){if(!p.isTabVisible()){i.animate({&quot;margin-left&quot;:n.operator+&quot;90px&quot;},300,&quot;linear&quot;,o)}};o()}).mouseup(function(){var p,o;i.stop(true);p=l[n.last]();while((o=p[n.next]())&amp;&amp;o.length&amp;&amp;!o.isTabVisible()){p=o}p.makeTabVisible()})})},setupQuickSearchEventListeners:function(c){var d=this;b(c).autocomplete(ajaxurl+&quot;?action=menu-quick-search&amp;type=&quot;+c.name,{delay:500,formatItem:a.formatAutocompleteResponse,formatResult:a.formatAutocompleteResult,minchars:2,multiple:false}).bind(&quot;blur&quot;,function(h){var f=a.autoCompleteData[this.value],g=this;if(f){b.post(ajaxurl+&quot;?action=menu-quick-search&amp;type=get-post-item&amp;response-format=markup&quot;,f,function(e){d.processQuickSearchQueryResponse.call(d,e,f);a.autoCompleteData[g.value]=false})}})},eventOnClickEditLink:function(c){var e,d=/#(.*)$/.exec(c.href);if(d&amp;&amp;d[1]){e=b(&quot;#&quot;+d[1]);if(0!=e.length){if(e.hasClass(&quot;menu-item-edit-inactive&quot;)){e.slideDown(&quot;fast&quot;).siblings(&quot;dl&quot;).andSelf().removeClass(&quot;menu-item-edit-inactive&quot;).addClass(&quot;menu-item-edit-active&quot;)}else{e.slideUp(&quot;fast&quot;).siblings(&quot;dl&quot;).andSelf().removeClass(&quot;menu-item-edit-active&quot;).addClass(&quot;menu-item-edit-inactive&quot;)}return false}}},eventOnClickCloseLink:function(c){b(c).closest(&quot;.menu-item-settings&quot;).siblings(&quot;dl&quot;).find(&quot;.item-edit&quot;).click();return false},eventOnClickMenuDelete:function(c){if(confirm(navMenuL10n.warnDeleteMenu)){return true}else{return false}},eventOnClickMenuItemDelete:function(c){var f,e,d=this;if(confirm(navMenuL10n.warnDeleteMenuItem)){e=/_wpnonce=([a-zA-Z0-9]*)$/.exec(c.href);if(e&amp;&amp;e[1]){f=parseInt(c.id.replace(&quot;delete-&quot;,&quot;&quot;),10);b.post(ajaxurl,{action:&quot;delete-menu-item&quot;,&quot;menu-item&quot;:f,_wpnonce:e[1]},function(g){if(&quot;1&quot;==g){d.removeMenuItem(document.getElementById(&quot;menu-item-&quot;+f))}});return false}return true}else{return false}},processQuickSearchQueryResponse:function(g,m){if(!m){m={}}var d=document.createElement(&quot;ul&quot;),c=document.getElementById(&quot;nav-menu-meta&quot;),h,l,e,n,j,k=new RegExp(&quot;menu-item\\[([^\\]]*)&quot;),f;e=k.exec(g);if(e&amp;&amp;e[1]){j=e[1];while(c.elements[&quot;menu-item[&quot;+j+&quot;][menu-item-type]&quot;]){j--}if(j!=e[1]){g=g.replace(new RegExp(&quot;menu-item\\[&quot;+e[1]+&quot;\\]&quot;,&quot;g&quot;),&quot;menu-item[&quot;+j+&quot;]&quot;)}}d.innerHTML=g;l=d.getElementsByTagName(&quot;li&quot;);if(l[0]&amp;&amp;m.object_type){f=document.getElementById(m.object_type+&quot;-search-checklist&quot;);if(f){f.appendChild(l[0])}}else{if(m.type){e=/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*)/.exec(m.type);if(e&amp;&amp;e[2]){f=document.getElementById(e[2]+&quot;-search-checklist&quot;);if(f){h=l.length;if(!h){n=document.createElement(&quot;li&quot;);n.appendChild(document.createTextNode(navMenuL10n.noResultsFound));f.appendChild(n)}while(h--){f.appendChild(l[h])}}}}}},removeMenuItem:function(d){d=b(d);var c=d.childMenuItems(),e=this;d.addClass(&quot;deleting&quot;).fadeOut(350,function(){d.remove();c.shiftDepthClass(-1).updateParentMenuItemDBId();a.recalculateMenuItemPositions();e.checkForEmptyMenu()})},checkForEmptyMenu:function(){if(a.menuList.children().length){return}a.menuList.height(80).one(&quot;sortstop&quot;,function(){b(this).height(&quot;auto&quot;)})},formatAutocompleteResponse:function(c,g,d,f){if(c&amp;&amp;c[0]){var e=b.parseJSON(c[0]);if(e.post_title){if(e.ID&amp;&amp;e.post_type){a.autoCompleteData[e.post_title]={ID:e.ID,object_type:e.post_type}}return e.post_title}}},formatAutocompleteResult:function(c,g,d,f){if(c&amp;&amp;c[0]){var e=b.parseJSON(c[0]);if(e.post_title){return e.post_title}}},getListDataFromID:function(k,h){if(!k){return false}h=h||document;var d=[&quot;menu-item-db-id&quot;,&quot;menu-item-object-id&quot;,&quot;menu-item-object&quot;,&quot;menu-item-parent-id&quot;,&quot;menu-item-position&quot;,&quot;menu-item-type&quot;,&quot;menu-item-append&quot;,&quot;menu-item-title&quot;,&quot;menu-item-url&quot;,&quot;menu-item-description&quot;,&quot;menu-item-attr-title&quot;,&quot;menu-item-target&quot;,&quot;menu-item-classes&quot;,&quot;menu-item-xfn&quot;],c={},e=h.getElementsByTagName(&quot;input&quot;),g=e.length,f;while(g--){f=d.length;while(f--){if(e[g]&amp;&amp;e[g].name&amp;&amp;&quot;menu-item[&quot;+k+&quot;][&quot;+d[f]+&quot;]&quot;==e[g].name){c[d[f]]=e[g].value}}}return c},recalculateMenuItemPositions:function(){a.menuList.find(&quot;.menu-item-data-position&quot;).val(function(c){return c+1})},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);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (14474 => 14475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2010-05-06 15:40:29 UTC (rev 14474)
+++ trunk/wp-includes/script-loader.php        2010-05-06 17:11:52 UTC (rev 14475)
</span><span class="lines">@@ -393,7 +393,7 @@
</span><span class="cx">                 ) );
</span><span class="cx"> 
</span><span class="cx">                 // Custom Navigation
</span><del>-                $scripts-&gt;add( 'nav-menu', &quot;/wp-admin/js/nav-menu$suffix.js&quot;, false, '20100506' );
</del><ins>+                $scripts-&gt;add( 'nav-menu', &quot;/wp-admin/js/nav-menu$suffix.js&quot;, false, '20100506b' );
</ins><span class="cx">                 $scripts-&gt;localize( 'nav-menu', 'navMenuL10n', array(
</span><span class="cx">                         'home' =&gt; _x('Home', 'nav menu home label'),
</span><span class="cx">                         'homeurl' =&gt; home_url('/'),
</span></span></pre>
</div>
</div>

</body>
</html>