<!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>[14686] trunk: First pass at fixing search for add menu item boxes.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/14686">14686</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-05-16 05:39:53 +0000 (Sun, 16 May 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>First pass at fixing search for add menu item boxes. props koopersmith, see <a href="http://trac.wordpress.org/ticket/13283">#13283</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesnavmenuphp">trunk/wp-admin/includes/nav-menu.php</a></li>
<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="#trunkwpadminnavmenusphp">trunk/wp-admin/nav-menus.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesnavmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/nav-menu.php (14685 => 14686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/nav-menu.php        2010-05-16 05:38:14 UTC (rev 14685)
+++ trunk/wp-admin/includes/nav-menu.php        2010-05-16 05:39:53 UTC (rev 14686)
</span><span class="lines">@@ -406,7 +406,7 @@
</span><span class="cx">         $mods = get_nav_menu_locations();
</span><span class="cx">         $menus = wp_get_nav_menus();
</span><span class="cx">         $menu_locations = get_nav_menu_locations();
</span><del>-        //var_dump( $menus );
</del><ins>+
</ins><span class="cx">         foreach ( $locations as $location =&gt; $description ) {
</span><span class="cx">                 ?&gt;
</span><span class="cx">                 &lt;p&gt;
</span><span class="lines">@@ -619,8 +619,9 @@
</span><span class="cx">                         }
</span><span class="cx">                         ?&gt;
</span><span class="cx">                         &lt;p class=&quot;quick-search-wrap&quot;&gt;
</span><del>-                                &lt;input type=&quot;text&quot; class=&quot;quick-search regular-text&quot; value=&quot;&lt;?php echo $searched; ?&gt;&quot; name=&quot;quick-search-posttype-&lt;?php echo $post_type_name; ?&gt;&quot; /&gt;
-                                &lt;input type=&quot;submit&quot; class=&quot;quick-search-submit button-secondary&quot; value=&quot;&lt;?php esc_attr_e('Search'); ?&gt;&quot; /&gt;
</del><ins>+                                &lt;input type=&quot;text&quot; class=&quot;quick-search regular-text input-with-default-title&quot; title=&quot;&lt;?php esc_attr_e('Search'); ?&gt;&quot; value=&quot;&lt;?php echo $searched; ?&gt;&quot; name=&quot;quick-search-posttype-&lt;?php echo $post_type_name; ?&gt;&quot; /&gt;
+                                &lt;img class=&quot;waiting&quot; src=&quot;&lt;?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?&gt;&quot; alt=&quot;&quot; /&gt;
+                                &lt;input type=&quot;submit&quot; class=&quot;quick-search-submit button-secondary hide-if-js&quot; value=&quot;&lt;?php esc_attr_e('Search'); ?&gt;&quot; /&gt;
</ins><span class="cx">                         &lt;/p&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;ul id=&quot;&lt;?php echo $post_type_name; ?&gt;-search-checklist&quot; class=&quot;list:&lt;?php echo $post_type_name?&gt; categorychecklist form-no-clear&quot;&gt;
</span><span class="lines">@@ -794,8 +795,9 @@
</span><span class="cx">                         }
</span><span class="cx">                         ?&gt;
</span><span class="cx">                         &lt;p class=&quot;quick-search-wrap&quot;&gt;
</span><del>-                                &lt;input type=&quot;text&quot; class=&quot;quick-search regular-text&quot; value=&quot;&lt;?php echo $searched; ?&gt;&quot; name=&quot;quick-search-taxonomy-&lt;?php echo $taxonomy_name; ?&gt;&quot; /&gt;
-                                &lt;input type=&quot;submit&quot; class=&quot;quick-search-submit button-secondary&quot; value=&quot;&lt;?php esc_attr_e('Search'); ?&gt;&quot; /&gt;
</del><ins>+                                &lt;input type=&quot;text&quot; class=&quot;quick-search regular-text input-with-default-title&quot; title=&quot;&lt;?php esc_attr_e('Search'); ?&gt;&quot; value=&quot;&lt;?php echo $searched; ?&gt;&quot; name=&quot;quick-search-taxonomy-&lt;?php echo $taxonomy_name; ?&gt;&quot; /&gt;
+                                &lt;img class=&quot;waiting&quot; src=&quot;&lt;?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?&gt;&quot; alt=&quot;&quot; /&gt;
+                                &lt;input type=&quot;submit&quot; class=&quot;quick-search-submit button-secondary hide-if-js&quot; value=&quot;&lt;?php esc_attr_e('Search'); ?&gt;&quot; /&gt;
</ins><span class="cx">                         &lt;/p&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;ul id=&quot;&lt;?php echo $taxonomy_name; ?&gt;-search-checklist&quot; class=&quot;list:&lt;?php echo $taxonomy_name?&gt; categorychecklist form-no-clear&quot;&gt;
</span></span></pre></div>
<a id="trunkwpadminjsnavmenudevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.dev.js (14685 => 14686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.dev.js        2010-05-16 05:38:14 UTC (rev 14685)
+++ trunk/wp-admin/js/nav-menu.dev.js        2010-05-16 05:39:53 UTC (rev 14686)
</span><span class="lines">@@ -21,8 +21,6 @@
</span><span class="cx">                 
</span><span class="cx">                 menuList : undefined,        // Set in init.
</span><span class="cx">                 targetList : undefined, // Set in init.
</span><del>-                
-                autoCompleteData : {},
</del><span class="cx"> 
</span><span class="cx">                 // Functions that run on init.
</span><span class="cx">                 init : function() {
</span><span class="lines">@@ -346,44 +344,45 @@
</span><span class="cx">                 },
</span><span class="cx">         
</span><span class="cx">                 attachQuickSearchListeners : function() {
</span><del>-                        var that = this,
-                                form = $('#nav-menu-meta');
</del><ins>+                        var searchTimer;
</ins><span class="cx">                         
</span><del>-                        // auto-suggest for the quick-search boxes
-                        $('input.quick-search').each(function(i, el) {
-                                that.setupQuickSearchEventListeners(el);
-                        });
-                        form.find('.quick-search-submit').click(function() {
-                                $(this).trigger('wp-quick-search');
-                                return false;
-                        });
-                        form.find('.inside').children().bind('wp-quick-search', function() {
-                                that.quickSearch( $(this).attr('id') );
-                        });
</del><ins>+                        $('.quick-search').keypress(function(e){
+                                var t = $(this);
+                                
+                                if( 13 == e.which ) {
+                                        api.updateQuickSearchResults( t );
+                                        return false;
+                                }
+                                
+                                if( searchTimer ) clearTimeout(searchTimer);
+                                
+                                searchTimer = setTimeout(function(){
+                                        api.updateQuickSearchResults( t );
+                                }, 400);
+                        }).attr('autocomplete','off');
</ins><span class="cx">                 },
</span><del>-        
-                quickSearch : function(id) {
-                        var type = $('#' + id + ' .quick-search').attr('name'),
-                        q = $('#' + id + ' .quick-search').val(),
-                        menu = $('#menu').val(),
-                        nonce = $('#menu-settings-column-nonce').val(),
-                        params = {},
-                        that = this,
-                        processMethod = function(){};
-
-                        processMethod = that.processQuickSearchQueryResponse;
-
</del><ins>+                
+                updateQuickSearchResults : function(input) {
+                        var panel, params,
+                        minSearchLength = 2,
+                        q = input.val();
+                        
+                        if( q.length &lt; minSearchLength ) return;
+                        
+                        panel = input.parents('.tabs-panel');
</ins><span class="cx">                         params = {
</span><span class="cx">                                 'action': 'menu-quick-search',
</span><span class="cx">                                 'response-format': 'markup',
</span><del>-                                'menu': menu,
-                                'menu-settings-column-nonce': nonce,
</del><ins>+                                'menu': $('#menu').val(),
+                                'menu-settings-column-nonce': $('#menu-settings-column-nonce').val(),
</ins><span class="cx">                                 'q': q,
</span><del>-                                'type': type
</del><ins>+                                'type': input.attr('name')
</ins><span class="cx">                         };
</span><span class="cx"> 
</span><ins>+                        $('img.waiting', panel).show();
+
</ins><span class="cx">                         $.post( ajaxurl, params, function(menuMarkup) {
</span><del>-                                processMethod.call(that, menuMarkup, params);
</del><ins>+                                api.processQuickSearchQueryResponse(menuMarkup, params, panel);
</ins><span class="cx">                         });
</span><span class="cx">                 },
</span><span class="cx">         
</span><span class="lines">@@ -463,38 +462,32 @@
</span><span class="cx"> 
</span><span class="cx">                 attachTabsPanelListeners : function() {
</span><span class="cx">                         $('#menu-settings-column').bind('click', function(e) {
</span><del>-                                var selectAreaMatch, activePanel, panelIdMatch, wrapper, inputs, i, items;
</del><ins>+                                var selectAreaMatch, activePanel, panelId, wrapper, items,
+                                        target = $(e.target);
</ins><span class="cx">                                 
</span><del>-                                if ( e.target &amp;&amp; e.target.className &amp;&amp; -1 != e.target.className.indexOf('nav-tab-link') ) {
-                                        panelIdMatch = /#(.*)$/.exec(e.target.href);
-                                        wrapper = $(e.target).parents('.inside').first()[0];
-                                        inputs = wrapper ? wrapper.getElementsByTagName('input') : [];
-                                        i = inputs.length;
</del><ins>+                                if ( target.hasClass('nav-tab-link') ) {
+                                        panelId = /#(.*)$/.exec(e.target.href);
+                                        if ( panelId &amp;&amp; panelId[1] )
+                                                panelId = panelId[1]
+                                        else
+                                                return false;
+                                                
+                                        wrapper = target.parents('.inside').first();
</ins><span class="cx"> 
</span><span class="cx">                                         // upon changing tabs, we want to uncheck all checkboxes
</span><del>-                                        while( i-- )
-                                                inputs[i].checked = false;
</del><ins>+                                        $('input', wrapper).removeAttr('checked');
+                                        
+                                        $('.tabs-panel-active', wrapper).removeClass('tabs-panel-active').addClass('tabs-panel-inactive');
+                                        $('#' + panelId, wrapper).removeClass('tabs-panel-inactive').addClass('tabs-panel-active');
</ins><span class="cx"> 
</span><del>-                                        $('.tabs-panel', wrapper).each(function() {
-                                                if ( this.className )
-                                                        this.className = this.className.replace('tabs-panel-active', 'tabs-panel-inactive');
-                                        });
</del><ins>+                                        $('.tabs', wrapper).removeClass('tabs');
+                                        target.parent().addClass('tabs');
</ins><span class="cx"> 
</span><del>-                                        $('.tabs', wrapper).each(function() {
-                                                this.className = this.className.replace('tabs', '');
-                                        });
</del><ins>+                                        // select the search bar
+                                        $('.quick-search', wrapper).focus();
</ins><span class="cx"> 
</span><del>-                                        e.target.parentNode.className += ' tabs';
-
-                                        if ( panelIdMatch &amp;&amp; panelIdMatch[1] ) {
-                                                activePanel = document.getElementById(panelIdMatch[1]);
-                                                if ( activePanel ) {
-                                                        activePanel.className = activePanel.className.replace('tabs-panel-inactive', 'tabs-panel-active');
-                                                }
-                                        }
-
</del><span class="cx">                                         return false;
</span><del>-                                } else if ( e.target &amp;&amp; e.target.className &amp;&amp; -1 != e.target.className.indexOf('select-all') ) {
</del><ins>+                                } else if ( target.hasClass('select-all') ) {
</ins><span class="cx">                                         selectAreaMatch = /#(.*)$/.exec(e.target.href);
</span><span class="cx">                                         if ( selectAreaMatch &amp;&amp; selectAreaMatch[1] ) {
</span><span class="cx">                                                 items = $('#' + selectAreaMatch[1] + ' .tabs-panel-active .menu-item-title input');
</span><span class="lines">@@ -611,37 +604,6 @@
</span><span class="cx">                         });
</span><span class="cx">                 },
</span><span class="cx"> 
</span><del>-                /**
-                 * Set up quick-search input fields' events.
-                 *
-                 * @param object el The input element.
-                 */
-                setupQuickSearchEventListeners : function(el) {
-                        var that = this;
-                        $(el).autocomplete( ajaxurl + '?action=menu-quick-search&amp;type=' + el.name,
-                                {
-                                        delay: 500,
-                                        formatItem: api.formatAutocompleteResponse,
-                                        formatResult: api.formatAutocompleteResult,
-                                        minchars: 2,
-                                        multiple: false
-                                }
-                        ).bind('blur', function(e) {
-                                var changedData = api.autoCompleteData[this.value],
-                                inputEl = this;
-                                if ( changedData ) {
-                                        $.post(
-                                                ajaxurl + '?action=menu-quick-search&amp;type=get-post-item&amp;response-format=markup',
-                                                changedData,
-                                                function(r) {
-                                                        that.processQuickSearchQueryResponse.call(that, r, changedData);
-                                                        api.autoCompleteData[inputEl.value] = false;
-                                                }
-                                        );
-                                }
-                        });
-                },
-
</del><span class="cx">                 eventOnClickEditLink : function(clickedEl) {
</span><span class="cx">                         var activeEdit,
</span><span class="cx">                         matchedSection = /#(.*)$/.exec(clickedEl.href);
</span><span class="lines">@@ -718,59 +680,40 @@
</span><span class="cx">                  *
</span><span class="cx">                  * @param string resp The server response to the query.
</span><span class="cx">                  * @param object req The request arguments.
</span><ins>+                 * @param jQuery panel The tabs panel we're searching in.
</ins><span class="cx">                  */
</span><del>-                processQuickSearchQueryResponse : function(resp, req) {
-                        if ( ! req )
-                                req = {};
-                        var wrap = document.createElement('ul'),
</del><ins>+                processQuickSearchQueryResponse : function(resp, req, panel) {
+                        var i, matched, newID,
+                        takenIDs = {},
</ins><span class="cx">                         form = document.getElementById('nav-menu-meta'),
</span><del>-                        i,
-                        items,
-                        matched,
-                        message,
-                        newID,
-                        pattern = new RegExp('menu-item\\[(\[^\\]\]*)'),
-                        resultList;
</del><ins>+                        pattern = new RegExp('menu-item\\[(\[^\\]\]*)', 'g'),
+                        items = resp.match(/&lt;li&gt;.*&lt;\/li&gt;/g);
</ins><span class="cx"> 
</span><del>-                        // make a unique DB ID number
-                        matched = pattern.exec(resp);
-                        if ( matched &amp;&amp; matched[1] ) {
-                                newID = matched[1];
-                                while( form.elements['menu-item[' + newID + '][menu-item-type]'] ) {
-                                        newID--;
-                                }
-
-                                if ( newID != matched[1] ) {
-                                        resp = resp.replace(new RegExp('menu-item\\[' + matched[1] + '\\]', 'g'), 'menu-item[' + newID + ']');
-                                }
</del><ins>+                        if( ! items ) {                                
+                                $('.categorychecklist', panel).html( '&lt;li&gt;&lt;p&gt;' + navMenuL10n.noResultsFound + '&lt;/p&gt;&lt;/li&gt;' );
+                                $('img.waiting', panel).hide();
+                                return;
</ins><span class="cx">                         }
</span><span class="cx"> 
</span><del>-                        wrap.innerHTML = resp;
</del><ins>+                        i = items.length;
+                        while( i-- ) {
+                                // make a unique DB ID number
+                                matched = pattern.exec(items[i]);
+                                if ( matched &amp;&amp; matched[1] ) {
+                                        newID = matched[1];
+                                        while( form.elements['menu-item[' + newID + '][menu-item-type]'] || takenIDs[ newID ] ) {
+                                                newID--;
+                                        }
</ins><span class="cx"> 
</span><del>-                        items = wrap.getElementsByTagName('li');
-
-                        if ( items[0] &amp;&amp; req.object_type ) {
-                                resultList = document.getElementById(req.object_type + '-search-checklist');
-                                if ( resultList ) {
-                                        resultList.appendChild(items[0]);
-                                }
-                        } else if ( req.type ) {
-                                matched = /quick-search-(posttype|taxonomy)-([a-zA-Z_-]*)/.exec(req.type);
-                                if ( matched &amp;&amp; matched[2] ) {
-                                        resultList = document.getElementById(matched[2] + '-search-checklist');
-                                        if ( resultList ) {
-                                                i = items.length;
-                                                if ( ! i ) {
-                                                        message = document.createElement('li');
-                                                        message.appendChild(document.createTextNode(navMenuL10n.noResultsFound));
-                                                        resultList.appendChild(message);
-                                                }
-                                                while( i-- ) {
-                                                        resultList.appendChild(items[i]);
-                                                }
</del><ins>+                                        takenIDs[newID] = true;
+                                        if ( newID != matched[1] ) {
+                                                items[i] = items[i].replace(new RegExp('menu-item\\[' + matched[1] + '\\]', 'g'), 'menu-item[' + newID + ']');
</ins><span class="cx">                                         }
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><ins>+
+                        $('.categorychecklist', panel).html( items.join('') );
+                        $('img.waiting', panel).hide();
</ins><span class="cx">                 },
</span><span class="cx"> 
</span><span class="cx">                 removeMenuItem : function(el) {
</span><span class="lines">@@ -783,26 +726,7 @@
</span><span class="cx">                                 children.shiftDepthClass(-1).updateParentMenuItemDBId();
</span><span class="cx">                         });
</span><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 )
-                                                api.autoCompleteData[data.post_title] = {ID: data.ID, object_type: data.post_type};
-                                        return data.post_title;
-                                }
-                        }
-                },
</del><span class="cx"> 
</span><del>-                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;
-                        }
-                },
-
</del><span class="cx">                 getListDataFromID : function(menuItemID, parentEl) {
</span><span class="cx">                         if ( ! menuItemID )
</span><span class="cx">                                 return false;
</span></span></pre></div>
<a id="trunkwpadminjsnavmenujs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.js (14685 => 14686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.js        2010-05-16 05:38:14 UTC (rev 14685)
+++ trunk/wp-admin/js/nav-menu.js        2010-05-16 05:39:53 UTC (rev 14686)
</span><span class="lines">@@ -1 +1 @@
</span><del>-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()},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 m=0,l,j,e,h,n,k,o,d,g,i=a.menuList.offset().left;a.menuList.sortable({handle:&quot;.menu-item-handle&quot;,placeholder:&quot;sortable-placeholder&quot;,start:function(w,v){var p,t,s,q,r,u;g=v.item.children(&quot;.menu-item-transport&quot;);l=v.item.menuItemDepth();f(v,l);s=(v.item.next()[0]==v.placeholder[0])?v.item.next():v.item;q=s.childMenuItems();g.append(q);p=g.outerHeight();p+=(p&gt;0)?(v.placeholder.css(&quot;margin-top&quot;).slice(0,-2)*1):0;p+=v.helper.outerHeight();d=p;p-=2;v.placeholder.height(p);r=l;q.each(function(){var x=b(this).menuItemDepth();r=(x&gt;r)?x:r});t=v.helper.find(&quot;.menu-item-handle&quot;).outerWidth();t+=a.depthToPx(r-l);t-=2;v.placeholder.width(t);u=v.placeholder.next();u.css(&quot;margin-top&quot;,d+&quot;px&quot;);v.placeholder.detach();b(this).sortable(&quot;refresh&quot;);v.item.after(v.placeholder);u.css(&quot;margin-top&quot;,0);c(v)},stop:function(s,r){var q,p=m-l;q=g.children().insertAfter(r.item);if(p!=0){r.item.updateDepthClass(m);q.shiftDepthClass(p)}r.item.updateParentMenuItemDBId()},change:function(q,p){if(!p.placeholder.parent().hasClass(&quot;menu&quot;)){(h.length)?h.after(p.placeholder):a.menuList.prepend(p.placeholder)}c(p)},sort:function(q,p){var s=p.helper.offset(),r=a.pxToDepth(s.left-i);if(r&gt;e||s.top&lt;k){r=e}else{if(r&lt;j){r=j}}if(r!=m){f(p,r)}if(o&amp;&amp;s.top+d&gt;o){n.after(p.placeholder);c(p);b(this).sortable(&quot;refreshPositions&quot;)}}});function c(p){var q;h=p.placeholder.prev();n=p.placeholder.next();if(h[0]==p.item[0]){h=h.prev()}if(n[0]==p.item[0]){n=n.next()}k=(h.length)?h.offset().top+h.height():0;o=(n.length)?n.offset().top+n.height()/3:0;j=(n.length)?n.menuItemDepth():0;if(h.length){e=((q=h.menuItemDepth()+1)&gt;a.options.globalMaxDepth)?a.options.globalMaxDepth:q}else{e=0}}function f(p,q){p.placeholder.updateDepthClass(q,m);m=q}},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-save&quot;)){return c.eventOnClickMenuSave(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);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},eventOnClickMenuSave:function(c){a.menuList.find(&quot;.menu-item-data-position&quot;).val(function(d){return d+1});return true},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()})},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-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},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);
</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,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()},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 m=0,l,j,e,h,n,k,o,d,g,i=a.menuList.offset().left;a.menuList.sortable({handle:&quot;.menu-item-handle&quot;,placeholder:&quot;sortable-placeholder&quot;,start:function(w,v){var p,t,s,q,r,u;g=v.item.children(&quot;.menu-item-transport&quot;);l=v.item.menuItemDepth();f(v,l);s=(v.item.next()[0]==v.placeholder[0])?v.item.next():v.item;q=s.childMenuItems();g.append(q);p=g.outerHeight();p+=(p&gt;0)?(v.placeholder.css(&quot;margin-top&quot;).slice(0,-2)*1):0;p+=v.helper.outerHeight();d=p;p-=2;v.placeholder.height(p);r=l;q.each(function(){var x=b(this).menuItemDepth();r=(x&gt;r)?x:r});t=v.helper.find(&quot;.menu-item-handle&quot;).outerWidth();t+=a.depthToPx(r-l);t-=2;v.placeholder.width(t);u=v.placeholder.next();u.css(&quot;margin-top&quot;,d+&quot;px&quot;);v.placeholder.detach();b(this).sortable(&quot;refresh&quot;);v.item.after(v.placeholder);u.css(&quot;margin-top&quot;,0);c(v)},stop:function(s,r){var q,p=m-l;q=g.children().insertAfter(r.item);if(p!=0){r.item.updateDepthClass(m);q.shiftDepthClass(p)}r.item.updateParentMenuItemDBId()},change:function(q,p){if(!p.placeholder.parent().hasClass(&quot;menu&quot;)){(h.length)?h.after(p.placeholder):a.menuList.prepend(p.placeholder)}c(p)},sort:function(q,p){var s=p.helper.offset(),r=a.pxToDepth(s.left-i);if(r&gt;e||s.top&lt;k){r=e}else{if(r&lt;j){r=j}}if(r!=m){f(p,r)}if(o&amp;&amp;s.top+d&gt;o){n.after(p.placeholder);c(p);b(this).sortable(&quot;refreshPositions&quot;)}}});function c(p){var q;h=p.placeholder.prev();n=p.placeholder.next();if(h[0]==p.item[0]){h=h.prev()}if(n[0]==p.item[0]){n=n.next()}k=(h.length)?h.offset().top+h.height():0;o=(n.length)?n.offset().top+n.height()/3:0;j=(n.length)?n.menuItemDepth():0;if(h.length){e=((q=h.menuItemDepth()+1)&gt;a.options.globalMaxDepth)?a.options.globalMaxDepth:q}else{e=0}}function f(p,q){p.placeholder.updateDepthClass(q,m);m=q}},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-save&quot;)){return c.eventOnClickMenuSave(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 c;b(&quot;.quick-search&quot;).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(&quot;autocomplete&quot;,&quot;off&quot;)},updateQuickSearchResults:function(d){var c,g,e=2,f=d.val();if(f.length&lt;e){return}c=d.parents(&quot;.tabs-panel&quot;);g={action:&quot;menu-quick-search&quot;,&quot;response-format&quot;:&quot;markup&quot;,menu:b(&quot;#menu&quot;).val(),&quot;menu-settings-column-nonce&quot;:b(&quot;#menu-settings-column-nonce&quot;).val(),q:f,type:d.attr(&quot;name&quot;)};b(&quot;img.waiting&quot;,c).show();b.post(ajaxurl,g,function(h){a.processQuickSearchQueryResponse(h,g,c)})},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);return false})},attachTabsPanelListeners:function(){b(&quot;#menu-settings-column&quot;).bind(&quot;click&quot;,function(h){var f,i,d,j,c,g=b(h.target);if(g.hasClass(&quot;nav-tab-link&quot;)){d=/#(.*)$/.exec(h.target.href);if(d&amp;&amp;d[1]){d=d[1]}else{return false}j=g.parents(&quot;.inside&quot;).first();b(&quot;input&quot;,j).removeAttr(&quot;checked&quot;);b(&quot;.tabs-panel-active&quot;,j).removeClass(&quot;tabs-panel-active&quot;).addClass(&quot;tabs-panel-inactive&quot;);b(&quot;#&quot;+d,j).removeClass(&quot;tabs-panel-inactive&quot;).addClass(&quot;tabs-panel-active&quot;);b(&quot;.tabs&quot;,j).removeClass(&quot;tabs&quot;);g.parent().addClass(&quot;tabs&quot;);b(&quot;.quick-search&quot;,j).focus();return false}else{if(g.hasClass(&quot;select-all&quot;)){f=/#(.*)$/.exec(h.target.href);if(f&amp;&amp;f[1]){c=b(&quot;#&quot;+f[1]+&quot; .tabs-panel-active .menu-item-title input&quot;);if(c.length===c.filter(&quot;:checked&quot;).length){c.removeAttr(&quot;checked&quot;)}else{c.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()})})},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},eventOnClickMenuSave:function(c){a.menuList.find(&quot;.menu-item-data-position&quot;).val(function(d){return d+1});return true},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,c){var h,e,j,f={},d=document.getElementById(&quot;nav-menu-meta&quot;),l=new RegExp(&quot;menu-item\\[([^\\]]*)&quot;,&quot;g&quot;),k=g.match(/&lt;li&gt;.*&lt;\/li&gt;/g);if(!k){b(&quot;.categorychecklist&quot;,c).html(&quot;&lt;li&gt;&lt;p&gt;&quot;+navMenuL10n.noResultsFound+&quot;&lt;/p&gt;&lt;/li&gt;&quot;);b(&quot;img.waiting&quot;,c).hide();return}h=k.length;while(h--){e=l.exec(k[h]);if(e&amp;&amp;e[1]){j=e[1];while(d.elements[&quot;menu-item[&quot;+j+&quot;][menu-item-type]&quot;]||f[j]){j--}f[j]=true;if(j!=e[1]){k[h]=k[h].replace(new RegExp(&quot;menu-item\\[&quot;+e[1]+&quot;\\]&quot;,&quot;g&quot;),&quot;menu-item[&quot;+j+&quot;]&quot;)}}}b(&quot;.categorychecklist&quot;,c).html(k.join(&quot;&quot;));b(&quot;img.waiting&quot;,c).hide()},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()})},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-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},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="trunkwpadminnavmenusphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/nav-menus.php (14685 => 14686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/nav-menus.php        2010-05-16 05:38:14 UTC (rev 14685)
+++ trunk/wp-admin/nav-menus.php        2010-05-16 05:39:53 UTC (rev 14686)
</span><span class="lines">@@ -27,7 +27,6 @@
</span><span class="cx"> wp_enqueue_script( 'jquery-ui-draggable' );
</span><span class="cx"> wp_enqueue_script( 'jquery-ui-droppable' );
</span><span class="cx"> wp_enqueue_script( 'jquery-ui-sortable' );
</span><del>-wp_enqueue_script( 'jquery-autocomplete' );
</del><span class="cx"> 
</span><span class="cx"> // Nav Menu functions
</span><span class="cx"> wp_enqueue_script( 'nav-menu' );
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (14685 => 14686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2010-05-16 05:38:14 UTC (rev 14685)
+++ trunk/wp-includes/script-loader.php        2010-05-16 05:39:53 UTC (rev 14686)
</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, '20100513' );
</del><ins>+                $scripts-&gt;add( 'nav-menu', &quot;/wp-admin/js/nav-menu$suffix.js&quot;, false, '20100515' );
</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>