<!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>[14464] trunk: Consolidate nav menu item ajax.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/14464">14464</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-05-05 20:29:50 +0000 (Wed, 05 May 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Consolidate nav menu item ajax. Other misc fixes. props koopersmith, see <a href="http://trac.wordpress.org/ticket/13204">#13204</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 (14463 => 14464)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.dev.js        2010-05-05 18:43:54 UTC (rev 14463)
+++ trunk/wp-admin/js/nav-menu.dev.js        2010-05-05 20:29:50 UTC (rev 14464)
</span><span class="lines">@@ -87,7 +87,7 @@
</span><span class="cx">                 return Math.floor(px / menuItemDepthPerLevel);
</span><span class="cx">         },
</span><span class="cx">
</span><del>-        menuList, targetList;
</del><ins>+        menuList, targetList, api;
</ins><span class="cx">
</span><span class="cx">         // jQuery extensions
</span><span class="cx">         $.fn.extend({
</span><span class="lines">@@ -166,10 +166,50 @@
</span><span class="cx">                                 else
</span><span class="cx">                                         t.selectItem();
</span><span class="cx">                         });
</span><del>-                }
</del><ins>+                },
+                /**
+                 * Adds selected menu items to the menu.
+                 *
+                 * @param jQuery metabox The metabox jQuery object.
+                 */
+                addSelectedToMenu : function(processMethod) {
+                        return this.each(function() {
+                                var t = $(this),
+                                        checked = t.find('.tabs-panel-active .categorychecklist li input:checked'),
+                                        re = new RegExp('menu-item\\[(\[^\\]\]*)');
+                        
+                                processMethod = processMethod || api.addMenuItemToBottom;
+                        
+                                // If no items are checked, bail.
+                                if ( !checked.length )
+                                        return false;
+                        
+                                // Show the ajax spinner
+                                t.find('img.waiting').show();
+
+                                // Retrieve menu item data
+                                $(checked).each(function(){
+                                        var checkbox = $(this),
+                                                item = checkbox.parent().prev();
+                                        listItemDBIDMatch = re.exec( checkbox.attr('name') );
+                                        listItemDBID = 'undefined' == typeof listItemDBIDMatch[1] ? 0 : parseInt(listItemDBIDMatch[1], 10);
+                                        listItemData = getListDataFromID(listItemDBID);
+
+                                        menuItem = {};
+                                        menuItem[listItemDBID] = listItemData;
+
+                                        api.addItemToMenu(menuItem, processMethod, function(){
+                                                item.deselectItem();
+                                        });
+                                });
+
+                                // Remove the ajax spinner
+                                t.find('img.waiting').hide();
+                        });
+                },
</ins><span class="cx">         });
</span><span class="cx">
</span><del>-        return {
</del><ins>+        return api = {
</ins><span class="cx">
</span><span class="cx">                 // Functions that run on init.
</span><span class="cx">                 init : function() {
</span><span class="lines">@@ -177,9 +217,11 @@
</span><span class="cx">                         targetList = menuList;
</span><span class="cx">
</span><span class="cx">                         this.attachMenuEditListeners();
</span><ins>+                        
+                        this.setupInputWithDefaultTitle();
+                        this.attachAddMenuItemListeners();
+                        this.attachQuickSearchListeners();
</ins><span class="cx">
</span><del>-                        this.attachMenuMetaListeners(document.getElementById('nav-menu-meta'));
-
</del><span class="cx">                         this.attachTabsPanelListeners();
</span><span class="cx">
</span><span class="cx">                         this.attachHomeLinkListener();
</span><span class="lines">@@ -422,39 +464,40 @@
</span><span class="cx">                         }).blur( function(){
</span><span class="cx">                                 var $t = $(this);
</span><span class="cx">                                 if( '' == $t.val() )
</span><del>-                                        $t.val( $t.data(name) ).addClass( name );
</del><ins>+                                        $t.addClass( name ).val( $t.data(name) );
</ins><span class="cx">                         });
</span><span class="cx">                 },
</span><span class="cx">
</span><del>-                attachMenuMetaListeners : function(formEL) {
-                        if ( ! formEL )
-                                return;
-
-                        var that = this;
-                        this.setupInputWithDefaultTitle();
-
</del><ins>+                attachAddMenuItemListeners : function() {
+                        var form = $('#nav-menu-meta');
+                        
+                        form.find('.add-to-menu input').click(function(){
+                                $(this).trigger('wp-add-menu-item', [api.addMenuItemToBottom]);
+                                return false;
+                        });
+                        form.find('.customlinkdiv').bind('wp-add-menu-item', function(e, processMethod) {
+                                api.addCustomLink( processMethod );
+                        });
+                        form.find('.posttypediv, .taxonomydiv').bind('wp-add-menu-item', function(e, processMethod) {
+                                $(this).addSelectedToMenu( processMethod );
+                        });        
+                },
+                
+                attachQuickSearchListeners : function() {
+                        var that = this,
+                                form = $('#nav-menu-meta');
+                                
</ins><span class="cx">                         // auto-suggest for the quick-search boxes
</span><span class="cx">                         $('input.quick-search').each(function(i, el) {
</span><span class="cx">                                 that.setupQuickSearchEventListeners(el);
</span><span class="cx">                         });
</span><del>-
-                        // If a "Add to Menu" button was clicked, submit that metabox ajax style.
-                        $(formEL).click(function(e) {
-                                // based on the input, call that function
-                                var divcontainer = $(e.target).parent().parent().parent();
-                        
-                                if ( $(e.target).is('input') && $(e.target).hasClass('button-secondary') && !$(e.target).hasClass('quick-search-submit') ) {
-                                        if ( $(divcontainer).hasClass('customlinkdiv') ) {
-                                                that.addCustomLink();
-                                        } else if ( $(divcontainer).hasClass('posttypediv') || $(divcontainer).hasClass('taxonomydiv') ) {
-                                                that.addItemsToMenu( $(divcontainer).attr('id') );
-                                        };
-                                        return false;
-                                } else if ( $(e.target).is('input') && $(e.target).hasClass('quick-search-submit') ) {
-                                        that.quickSearch( $(divcontainer).attr('id') );
-                                        return false;
-                                };
</del><ins>+                        form.find('.quick-search-submit').click(function() {
+                                $(this).trigger('wp-quick-search');
+                                return false;
</ins><span class="cx">                         });
</span><ins>+                        form.find('.inside').children().bind('wp-quick-search', function() {
+                                that.quickSearch( $(this).attr('id') );
+                        });
</ins><span class="cx">                 },
</span><span class="cx">                 
</span><span class="cx">                 quickSearch : function(id) {
</span><span class="lines">@@ -482,57 +525,76 @@
</span><span class="cx">                         });
</span><span class="cx">                 },
</span><span class="cx">                 
</span><del>-                addCustomLink : function(url, label, addToTop) {
-                        var url = url || $('#custom-menu-item-url').val(),
-                        label = label || $('#custom-menu-item-name').val(),
-                        addToTop = addToTop || false,
-                        menu = $('#menu').val(),
-                        nonce = $('#menu-settings-column-nonce').val(),
-                        params = {},
-                        that = this,
-                        processMethod = function(){};
</del><ins>+                addCustomLink : function( processMethod ) {
+                        var url = $('#custom-menu-item-url').val(),
+                                label = $('#custom-menu-item-name').val();
+                                
+                        processMethod = processMethod || api.addMenuItemToBottom;
</ins><span class="cx">                         
</span><span class="cx">                         if ( '' == url || 'http://' == url )
</span><span class="cx">                                 return false;
</span><span class="cx">                         
</span><span class="cx">                         // Show the ajax spinner
</span><span class="cx">                         $('.customlinkdiv img.waiting').show();
</span><ins>+                        this.addLinkToMenu( url, label, processMethod, function() {
+                                // Remove the ajax spinner
+                                $('.customlinkdiv img.waiting').hide();
+                                // Set custom link form back to defaults
+                                $('#custom-menu-item-name').val('').blur();
+                                $('#custom-menu-item-url').val('http://');
+                        });
+                },
+                
+                addLinkToMenu : function(url, label, processMethod, callback) {
+                        processMethod = processMethod || api.addMenuItemToBottom;
+                        callback = callback || function(){};
</ins><span class="cx">                         
</span><ins>+                        api.addItemToMenu({
+                                '-1': {
+                                        'menu-item-type': 'custom',
+                                        'menu-item-url': url,
+                                        'menu-item-title': label
+                                }
+                        }, processMethod, callback);
+                },
+                
+                addItemToMenu : function(menuItem, processMethod, callback) {
+                        var menu = $('#menu').val(),
+                                nonce = $('#menu-settings-column-nonce').val();
+                                
+                        processMethod = processMethod || function(){};
+                        callback = callback || function(){};
+                        
</ins><span class="cx">                         params = {
</span><span class="cx">                                 'action': 'add-menu-item',
</span><span class="cx">                                 'menu': menu,
</span><span class="cx">                                 'menu-settings-column-nonce': nonce,
</span><del>-                                'menu-item': {
-                                        '-1': {
-                                                'menu-item-type': 'custom',
-                                                'menu-item-url': url,
-                                                'menu-item-title': label
-                                        }
-                                }
</del><ins>+                                'menu-item': menuItem,
</ins><span class="cx">                         };
</span><span class="cx">                         
</span><del>-                        processMethod = addToTop ? that.addMenuItemToTop : that.addMenuItemToBottom;
-
</del><span class="cx">                         $.post( ajaxurl, params, function(menuMarkup) {
</span><del>-                                processMethod.call(that, menuMarkup, params);
-                                
-                                // Remove the ajax spinner
-                                $('.customlinkdiv img.waiting').hide();
-
-                                // Reset the form
-                                wpNavMenu.resetCustomLinkForm();
</del><ins>+                                processMethod(menuMarkup, params);
+                                callback();
</ins><span class="cx">                         });
</span><span class="cx">                 },
</span><ins>+
+                /**
+                 * Process the add menu item request response into menu list item.
+                 *
+                 * @param string menuMarkup The text server response of menu item markup.
+                 * @param object req The request arguments.
+                 */
+                addMenuItemToBottom : function( menuMarkup, req ) {
+                        $(menuMarkup).hideAdvancedMenuItemFields().appendTo( targetList );
+                },
</ins><span class="cx">                 
</span><del>-                resetCustomLinkForm : function() {
-                        // set custom link form back to defaults
-                        $('#custom-menu-item-name').val('').blur();
-                        $('#custom-menu-item-url').val('http://');
</del><ins>+                addMenuItemToTop : function( menuMarkup, req ) {
+                        $(menuMarkup).hideAdvancedMenuItemFields().prependTo( 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>-                                wpNavMenu.addCustomLink( navMenuL10n.homeurl, navMenuL10n.home, true);
</del><ins>+                                api.addLinkToMenu( navMenuL10n.homeurl, navMenuL10n.home, api.addMenuItemToTop, recalculateMenuItemPositions );
</ins><span class="cx">                                 return false;
</span><span class="cx">                         });
</span><span class="cx">                 },
</span><span class="lines">@@ -784,71 +846,6 @@
</span><span class="cx">                 },
</span><span class="cx">
</span><span class="cx">                 /**
</span><del>-                 * Adds menu items to the menu.
-                 *
-                 * @param string id The id of the metabox
-                 */
-                addItemsToMenu : function(id, addToTop) {
-                        var items = $( '.tabs-panel-active .categorychecklist li input:checked', '#' + id),
-                        menu = $('#menu').val(),
-                        nonce = $('#menu-settings-column-nonce').val(),
-                        params = {},
-                        that = this,
-                        addToTop = addToTop || false,
-                        processMethod = function(){},
-                        re = new RegExp('menu-item\\[(\[^\\]\]*)');
-                        
-                        processMethod = addToTop ? that.addMenuItemToTop : that.addMenuItemToBottom;
-                        
-                        // If no items are checked, bail.
-                        if ( !items.length )
-                                return false;
-                        
-                        // Show the ajax spinner
-                        $('#' + id + ' img.waiting').show();
-
-                        // do stuff
-                        $(items).each(function(){
-                                listItemDBIDMatch = re.exec( $(this).attr('name') );
-                                listItemDBID = 'undefined' == typeof listItemDBIDMatch[1] ? 0 : parseInt(listItemDBIDMatch[1], 10);
-                                listItemData = getListDataFromID(listItemDBID);
-
-                                params = {
-                                        'action': 'add-menu-item',
-                                        'menu': menu,
-                                        'menu-settings-column-nonce': nonce,
-                                        'menu-item': {}
-                                };
-
-                                params['menu-item'][listItemDBID] = listItemData;
-
-                                $.post( ajaxurl, params, function(menuMarkup) {
-                                        processMethod.call(that, menuMarkup, params);
-                                });
-
-                                // Uncheck the item
-                                $(this).parent().prev().deselectItem();
-                        });
-
-                        // Remove the ajax spinner
-                        $('#' + id + ' img.waiting').hide();
-                },
-
-                /**
-                 * Process the add menu item request response into menu list item.
-                 *
-                 * @param string menuMarkup The text server response of menu item markup.
-                 * @param object req The request arguments.
-                 */
-                addMenuItemToBottom : function( menuMarkup, req ) {
-                        $(menuMarkup).hideAdvancedMenuItemFields().appendTo( targetList );
-                },
-                
-                addMenuItemToTop : function( menuMarkup, req ) {
-                        $(menuMarkup).hideAdvancedMenuItemFields().prependTo( targetList );
-                },
-
-                /**
</del><span class="cx">                  * Process the quick search response into a search result
</span><span class="cx">                  *
</span><span class="cx">                  * @param string resp The server response to the query.
</span></span></pre></div>
<a id="trunkwpadminjsnavmenujs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.js (14463 => 14464)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.js        2010-05-05 18:43:54 UTC (rev 14463)
+++ trunk/wp-admin/js/nav-menu.js        2010-05-05 20:29:50 UTC (rev 14464)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var WPNavMenuHandler=function(d){var h={},f=30,c=11,k=function(m,q,n,p){if(m&&m[0]){var o=d.parseJSON(m[0]);if(o.post_title){if(o.ID&&o.post_type){h[o.post_title]={ID:o.ID,object_type:o.post_type}}return o.post_title}}},l=function(m,q,n,p){if(m&&m[0]){var o=d.parseJSON(m[0]);if(o.post_title){return o.post_title}}},b=function(s,r){if(!s){return false}r=r||document;var n=["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"],m={},o=r.getElementsByTagName("input"),q=o.length,p,t=document.getElementById("nav-menu-meta-object-id").value;while(q--){p=n.length;while(p--){if(o[q]&&o[q].name&&"menu-item["+s+"]["+n[p]+"]"==o[q].name){m[n[p]]=o[q].value}}}return m},a=function(){g.find(".menu-item-data-position").val(function(m){return m+1})},e=function(m){return m*f},i=function(m){return Math.floor(m/f)},g,j;d.fn.extend({menuItemDepth:function(){return i(this.eq(0).css("margin-left").slice(0,-2))},updateDepthClass:function(n,m){return this.each(function(){var o=d(this);m=m||o.menuItemDepth();d(this).removeClass("menu-item-depth-"+m).addClass("menu-item-depth-"+n)})},shiftDepthClass:function(m){return this.each(function(){var n=d(this),o=n.menuItemDepth();d(this).removeClass("menu-item-depth-"+o).addClass("menu-item-depth-"+(o+m))})},childMenuItems:function(){var m=d();this.each(function(){var n=d(this),p=n.menuItemDepth(),o=n.next();while(o.length&&o.menuItemDepth()>p){m=m.add(o);o=o.next()}});return m},updateParentMenuItemDBId:function(){return this.each(function(){var o=d(this),m=o.find(".menu-item-data-parent-id"),p=o.menuItemDepth(),n=o.prev();if(p==0){m.val(0)}else{while(n.menuItemDepth()!=p-1){n=n.prev()}m.val(n.find(".menu-item-data-db-id").val())}})},hideAdvancedMenuItemFields:function(){return this.each(function(){var m=d(this);d(".hide-column-tog").not(":checked").each(function(){m.find(".field-"+d(this).val()).addClass("hidden-field")})})},selectItem:function(){return this.each(function(){d(this).addClass("selected-menu-item").next().children("input").attr("checked","checked")})},deselectItem:function(){return this.each(function(){d(this).removeClass("selected-menu-item").next().children("input").removeAttr("checked")})},toggleItem:function(){return this.each(function(){var m=d(this);if(m.hasClass("selected-menu-item")){m.deselectItem()}else{m.selectItem()}})}});return{init:function(){g=d("#menu-to-edit");j=g;this.attachMenuEditListeners();this.attachMenuMetaListeners(document.getElementById("nav-menu-meta"));this.attachTabsPanelListeners();this.attachHomeLinkListener();if(g.length){this.initSortables()}this.initToggles();this.initTabManager();this.initAddMenuItemDraggables();this.checkForEmptyMenu()},initToggles:function(){postboxes.add_postbox_toggles("nav-menus");columns.useCheckboxesForHidden();columns.checked=function(m){d(".field-"+m).removeClass("hidden-field")};columns.unchecked=function(m){d(".field-"+m).addClass("hidden-field")};g.hideAdvancedMenuItemFields()},initSortables:function(){var s=0,r,q,m,p=g.offset().left,t,o;g.sortable({handle:".menu-item-handle",placeholder:"sortable-placeholder",start:function(C,B){var A,v,z,y,w,x;o=B.item.children(".menu-item-transport");t=(B.helper.hasClass("new-menu-item"));r=(t)?0:B.item.menuItemDepth();n(B,r);if(!t){y=(B.item.next()[0]==B.placeholder[0])?B.item.next():B.item;w=y.childMenuItems();o.append(w)}u(B);v=o.outerHeight();v+=(v>0)?(B.placeholder.css("margin-top").slice(0,-2)*1):0;v+=B.helper.outerHeight();v-=2;B.placeholder.height(v);x=r;if(!t){w.each(function(){var D=d(this).menuItemDepth();x=(D>x)?D:x})}z=B.helper.find(".menu-item-handle").outerWidth();z+=e(x-r);z-=2;B.placeholder.width(z)},stop:function(y,x){var w,v=s-r;w=o.children().insertAfter(x.item);if(t){x.item.remove();if(v!=0){w.shiftDepthClass(v)}w.updateParentMenuItemDBId()}else{if(v!=0){x.item.updateDepthClass(s);w.shiftDepthClass(v)}x.item.updateParentMenuItemDBId()}a()},change:function(w,v){if(!v.placeholder.parent().hasClass("menu")){v.placeholder.appendTo(g)}u(v)},sort:function(w,v){var x=i(v.helper.offset().left-p);if(x<q){x=q}else{if(x>m){x=m}}if(x!=s){n(v,x)}},receive:function(w,v){o=v.sender.children(".menu-item-transport")}});function u(x){var w=x.placeholder.prev(),v=x.placeholder.next(),y;if(w[0]==x.item[0]){w=w.prev()}if(v[0]==x.item[0]){v=v.next()}q=(v.length)?v.menuItemDepth():0;if(w.length){m=((y=w.menuItemDepth()+1)>c)?c:y}else{m=0}}function n(v,w){v.placeholder.updateDepthClass(w,s);s=w}},initAddMenuItemDraggables:function(){var m=d(".potential-menu-item");m.click(function(n){d(this).toggleItem()}).children().draggable({helper:"clone",connectToSortable:"ul#menu-to-edit",distance:5,zIndex:100,start:function(s,q){var r=d(s.target),p=r.parent(),n=p.parent(),o;p.selectItem();j=r.children(".menu-item-transport");o=n.parents(".tabs-panel").find(".selected-menu-item").children().not(q.helper).clone();q.helper.children(".additional-menu-items").append(o);q.helper.addClass("new-menu-item");q.helper.children("div").hide();o.first().css("margin-top",0);o.children("div").addClass("menu-item-handle");q.helper.children("div").addClass("hidden-handle");n.parents(".inside").find(".add-to-menu input").click();q.helper.width(q.helper.width());q.helper.height(q.helper.height())},stop:function(o,n){j=g;d(o.target).parents(".tabs-panel").find(".selected-menu-item").deselectItem()}})},attachMenuEditListeners:function(){var m=this;d("#update-nav-menu").bind("click",function(n){if(n.target&&n.target.className){if(-1!=n.target.className.indexOf("item-edit")){return m.eventOnClickEditLink(n.target)}else{if(-1!=n.target.className.indexOf("menu-delete")){return m.eventOnClickMenuDelete(n.target)}else{if(-1!=n.target.className.indexOf("item-delete")){return m.eventOnClickMenuItemDelete(n.target)}else{if(-1!=n.target.className.indexOf("item-close")){return m.eventOnClickCloseLink(n.target)}}}}}})},setupInputWithDefaultTitle:function(){var m="input-with-default-title";d("."+m).each(function(){var p=d(this),o=p.attr("title"),n=p.val();p.data(m,o);if(""==n){p.val(o)}else{if(o==n){return}else{p.removeClass(m)}}}).focus(function(){var n=d(this);if(n.val()==n.data(m)){n.val("").removeClass(m)}}).blur(function(){var n=d(this);if(""==n.val()){n.val(n.data(m)).addClass(m)}})},attachMenuMetaListeners:function(m){if(!m){return}var n=this;this.setupInputWithDefaultTitle();d("input.quick-search").each(function(o,p){n.setupQuickSearchEventListeners(p)});d(m).click(function(p){var o=d(p.target).parent().parent().parent();if(d(p.target).is("input")&&d(p.target).hasClass("button-secondary")&&!d(p.target).hasClass("quick-search-submit")){if(d(o).hasClass("customlinkdiv")){n.addCustomLink()}else{if(d(o).hasClass("posttypediv")||d(o).hasClass("taxonomydiv")){n.addItemsToMenu(d(o).attr("id"))}}return false}else{if(d(p.target).is("input")&&d(p.target).hasClass("quick-search-submit")){n.quickSearch(d(o).attr("id"));return false}}})},quickSearch:function(u){var o=d("#"+u+" .quick-search").attr("name"),r=d("#"+u+" .quick-search").val(),t=d("#menu").val(),n=d("#menu-settings-column-nonce").val(),s={},p=this,m=function(){};m=p.processQuickSearchQueryResponse;s={action:"menu-quick-search","response-format":"markup",menu:t,"menu-settings-column-nonce":n,q:r,type:o};d.post(ajaxurl,s,function(q){m.call(p,q,s)})},addCustomLink:function(o,n,p){var o=o||d("#custom-menu-item-url").val(),n=n||d("#custom-menu-item-name").val(),p=p||false,t=d("#menu").val(),q=d("#menu-settings-column-nonce").val(),s={},r=this,m=function(){};if(""==o||"http://"==o){return false}d(".customlinkdiv img.waiting").show();s={action:"add-menu-item",menu:t,"menu-settings-column-nonce":q,"menu-item":{"-1":{"menu-item-type":"custom","menu-item-url":o,"menu-item-title":n}}};m=p?r.addMenuItemToTop:r.addMenuItemToBottom;d.post(ajaxurl,s,function(u){m.call(r,u,s);d(".customlinkdiv img.waiting").hide();wpNavMenu.resetCustomLinkForm()})},resetCustomLinkForm:function(){d("#custom-menu-item-name").val("").blur();d("#custom-menu-item-url").val("http://")},attachHomeLinkListener:function(){d(".add-home-link",".customlinkdiv").click(function(m){wpNavMenu.addCustomLink(navMenuL10n.homeurl,navMenuL10n.home,true);return false})},attachTabsPanelListeners:function(){d("#menu-settings-column").bind("click",function(r){if(r.target&&r.target.className&&-1!=r.target.className.indexOf("nav-tab-link")){var o,u=/#(.*)$/.exec(r.target.href),t,m=d(r.target).parents(".inside").first()[0],q=m?m.getElementsByTagName("input"):[],p=q.length;while(p--){q[p].checked=false}d(".tabs-panel",m).each(function(){if(this.className){this.className=this.className.replace("tabs-panel-active","tabs-panel-inactive")}});d(".tabs",m).each(function(){this.className=this.className.replace("tabs","")});r.target.parentNode.className+=" tabs";if(u&&u[1]){o=document.getElementById(u[1]);if(o){o.className=o.className.replace("tabs-panel-inactive","tabs-panel-active")}}return false}else{if(r.target&&r.target.className&&-1!=r.target.className.indexOf("select-all")){var n=/#(.*)$/.exec(r.target.href),s;if(n&&n[1]){s=d("#"+n[1]+" .tabs-panel-active .potential-menu-item");if(s.length===s.filter(".selected-menu-item").length){s.deselectItem()}else{s.selectItem()}return false}}}})},initTabManager:function(){var r=d(".nav-tabs-wrapper"),s=r.children(".nav-tabs"),q=s.children(".nav-tab-active"),u=s.children(".nav-tab"),o=0,v,p,t,n;resizing=false;function m(){p=r.offset().left;v=p+r.width();q.makeTabVisible()}d.fn.extend({makeTabVisible:function(){var x=this.eq(0),y,w;if(!x.length){return}y=x.offset().left;w=y+x.outerWidth();if(w>v){s.animate({"margin-left":"+="+(v-w)+"px",},"fast")}else{if(y<p){s.animate({"margin-left":"-="+(y-p)+"px",},"fast")}}return x},isTabVisible:function(){var x=this.eq(0),y=x.offset().left,w=y+x.outerWidth();return(w<=v&&y>=p)?true:false}});u.each(function(){o+=d(this).outerWidth(true)});if(o<=r.width()-s.css("padding-left").slice(0,-2)-s.css("padding-right").slice(0,-2)){return}s.css({"margin-right":(-1*o)+"px",padding:0,});t=d('<div class="nav-tabs-arrow nav-tabs-arrow-left"><a>&laquo;</a></div>');n=d('<div class="nav-tabs-arrow nav-tabs-arrow-right"><a>&raquo;</a></div>');r.wrap('<div class="nav-tabs-nav"/>').parent().prepend(t).append(n);m();d(window).resize(function(){if(resizing){return}resizing=true;setTimeout(function(){m();resizing=false},1000)});d.each([{arrow:t,next:"next",last:"first",operator:"+=",},{arrow:n,next:"prev",last:"last",operator:"-=",}],function(){var w=this;this.arrow.mousedown(function(){var y=u[w.last](),x=function(){if(!y.isTabVisible()){s.animate({"margin-left":w.operator+"90px",},300,"linear",x)}};x()}).mouseup(function(){var y,x;s.stop(true);y=u[w.last]();while((x=y[w.next]())&&x.length&&!x.isTabVisible()){y=x}y.makeTabVisible()})})},setupQuickSearchEventListeners:function(m){var n=this;d(m).autocomplete(ajaxurl+"?action=menu-quick-search&type="+m.name,{delay:500,formatItem:k,formatResult:l,minchars:2,multiple:false}).bind("blur",function(q){var o=h[this.value],p=this;if(o){d.post(ajaxurl+"?action=menu-quick-search&type=get-post-item&response-format=markup",o,function(s){n.processQuickSearchQueryResponse.call(n,s,o);h[p.value]=false})}})},eventOnClickEditLink:function(m){var o,n=/#(.*)$/.exec(m.href);if(n&&n[1]){o=d("#"+n[1]);if(0!=o.length){if(o.hasClass("menu-item-edit-inactive")){o.slideDown("fast").siblings("dl").andSelf().removeClass("menu-item-edit-inactive").addClass("menu-item-edit-active")}else{o.slideUp("fast").siblings("dl").andSelf().removeClass("menu-item-edit-active").addClass("menu-item-edit-inactive")}return false}}},eventOnClickCloseLink:function(m){d(m).closest(".menu-item-settings").siblings("dl").find(".item-edit").click();return false},eventOnClickMenuDelete:function(m){if(confirm(navMenuL10n.warnDeleteMenu)){return true}else{return false}},eventOnClickMenuItemDelete:function(m){var p,o,n=this;if(confirm(navMenuL10n.warnDeleteMenuItem)){o=/_wpnonce=([a-zA-Z0-9]*)$/.exec(m.href);if(o&&o[1]){p=parseInt(m.id.replace("delete-",""),10);d.post(ajaxurl,{action:"delete-menu-item","menu-item":p,_wpnonce:o[1]},function(q){if("1"==q){n.removeMenuItem(document.getElementById("menu-item-"+p))}});return false}return true}else{return false}},addItemsToMenu:function(n,m){var s=d(".tabs-panel-active .categorychecklist li input:checked","#"+n),o=d("#menu").val(),r=d("#menu-settings-column-nonce").val(),p={},q=this,m=m||false,t=function(){},u=new RegExp("menu-item\\[([^\\]]*)");t=m?q.addMenuItemToTop:q.addMenuItemToBottom;if(!s.length){return false}d("#"+n+" img.waiting").show();d(s).each(function(){listItemDBIDMatch=u.exec(d(this).attr("name"));listItemDBID="undefined"==typeof listItemDBIDMatch[1]?0:parseInt(listItemDBIDMatch[1],10);listItemData=b(listItemDBID);p={action:"add-menu-item",menu:o,"menu-settings-column-nonce":r,"menu-item":{}};p["menu-item"][listItemDBID]=listItemData;d.post(ajaxurl,p,function(v){t.call(q,v,p)});d(this).parent().prev().deselectItem()});d("#"+n+" img.waiting").hide()},addMenuItemToBottom:function(m,n){d(m).hideAdvancedMenuItemFields().appendTo(j)},addMenuItemToTop:function(m,n){d(m).hideAdvancedMenuItemFields().prependTo(j)},processQuickSearchQueryResponse:function(q,v){if(!v){v={}}var n=document.createElement("ul"),m=document.getElementById("nav-menu-meta"),r,u,o,w,s,t=new RegExp("menu-item\\[([^\\]]*)"),p;o=t.exec(q);if(o&&o[1]){s=o[1];while(m.elements["menu-item["+s+"][menu-item-type]"]){s--}if(s!=o[1]){q=q.replace(new RegExp("menu-item\\["+o[1]+"\\]","g"),"menu-item["+s+"]")}}n.innerHTML=q;u=n.getElementsByTagName("li");if(u[0]&&v.object_type){p=document.getElementById(v.object_type+"-search-checklist");if(p){p.appendChild(u[0])}}else{if(v.type){o=/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*)/.exec(v.type);if(o&&o[2]){p=document.getElementById(o[2]+"-search-checklist");if(p){r=u.length;if(!r){w=document.createElement("li");w.appendChild(document.createTextNode(navMenuL10n.noResultsFound));p.appendChild(w)}while(r--){p.appendChild(u[r])}}}}}},removeMenuItem:function(n){n=d(n);var m=n.childMenuItems();var o=this;n.addClass("deleting").fadeOut(350,function(){n.remove();m.shiftDepthClass(-1).updateParentMenuItemDBId();a();o.checkForEmptyMenu()})},checkForEmptyMenu:function(){if(g.children().length){return}g.height(80).one("sortstop",function(){d(this).height("auto")})}}};var wpNavMenu=new WPNavMenuHandler(jQuery);jQuery(function(){wpNavMenu.init()});
</del><span class="cx">\ No newline at end of file
</span><ins>+var WPNavMenuHandler=function(d){var i={},g=30,c=11,l=function(n,r,o,q){if(n&&n[0]){var p=d.parseJSON(n[0]);if(p.post_title){if(p.ID&&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&&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=["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"],n={},p=s.getElementsByTagName("input"),r=p.length,q,u=document.getElementById("nav-menu-meta-object-id").value;while(r--){q=o.length;while(q--){if(p[r]&&p[r].name&&"menu-item["+t+"]["+o[q]+"]"==p[r].name){n[o[q]]=p[r].value}}}return n},a=function(){h.find(".menu-item-data-position").val(function(n){return n+1})},f=function(n){return n*g},j=function(n){return Math.floor(n/g)},h,k,e;d.fn.extend({menuItemDepth:function(){return j(this.eq(0).css("margin-left").slice(0,-2))},updateDepthClass:function(o,n){return this.each(function(){var p=d(this);n=n||p.menuItemDepth();d(this).removeClass("menu-item-depth-"+n).addClass("menu-item-depth-"+o)})},shiftDepthClass:function(n){return this.each(function(){var o=d(this),p=o.menuItemDepth();d(this).removeClass("menu-item-depth-"+p).addClass("menu-item-depth-"+(p+n))})},childMenuItems:function(){var n=d();this.each(function(){var o=d(this),q=o.menuItemDepth(),p=o.next();while(p.length&&p.menuItemDepth()>q){n=n.add(p);p=p.next()}});return n},updateParentMenuItemDBId:function(){return this.each(function(){var p=d(this),n=p.find(".menu-item-data-parent-id"),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(".menu-item-data-db-id").val())}})},hideAdvancedMenuItemFields:function(){return this.each(function(){var n=d(this);d(".hide-column-tog").not(":checked").each(function(){n.find(".field-"+d(this).val()).addClass("hidden-field")})})},selectItem:function(){return this.each(function(){d(this).addClass("selected-menu-item").next().children("input").attr("checked","checked")})},deselectItem:function(){return this.each(function(){d(this).removeClass("selected-menu-item").next().children("input").removeAttr("checked")})},toggleItem:function(){return this.each(function(){var n=d(this);if(n.hasClass("selected-menu-item")){n.deselectItem()}else{n.selectItem()}})},addSelectedToMenu:function(n){return this.each(function(){var o=d(this),q=o.find(".tabs-panel-active .categorychecklist li input:checked"),p=new RegExp("menu-item\\[([^\\]]*)");n=n||e.addMenuItemToBottom;if(!q.length){return false}o.find("img.waiting").show();d(q).each(function(){var s=d(this),r=s.parent().prev();listItemDBIDMatch=p.exec(s.attr("name"));listItemDBID="undefined"==typeof listItemDBIDMatch[1]?0:parseInt(listItemDBIDMatch[1],10);listItemData=b(listItemDBID);menuItem={};menuItem[listItemDBID]=listItemData;e.addItemToMenu(menuItem,n,function(){r.deselectItem()})});o.find("img.waiting").hide()})},});return e={init:function(){h=d("#menu-to-edit");k=h;this.attachMenuEditListeners();this.setupInputWithDefaultTitle();this.attachAddMenuItemListeners();this.attachQuickSearchListeners();this.attachTabsPanelListeners();this.attachHomeLinkListener();if(h.length){this.initSortables()}this.initToggles();this.initTabManager();this.initAddMenuItemDraggables();this.checkForEmptyMenu()},initToggles:function(){postboxes.add_postbox_toggles("nav-menus");columns.useCheckboxesForHidden();columns.checked=function(n){d(".field-"+n).removeClass("hidden-field")};columns.unchecked=function(n){d(".field-"+n).addClass("hidden-field")};h.hideAdvancedMenuItemFields()},initSortables:function(){var t=0,s,r,n,q=h.offset().left,u,p;h.sortable({handle:".menu-item-handle",placeholder:"sortable-placeholder",start:function(D,C){var B,w,A,z,x,y;p=C.item.children(".menu-item-transport");u=(C.helper.hasClass("new-menu-item"));s=(u)?0:C.item.menuItemDepth();o(C,s);if(!u){z=(C.item.next()[0]==C.placeholder[0])?C.item.next():C.item;x=z.childMenuItems();p.append(x)}v(C);w=p.outerHeight();w+=(w>0)?(C.placeholder.css("margin-top").slice(0,-2)*1):0;w+=C.helper.outerHeight();w-=2;C.placeholder.height(w);y=s;if(!u){x.each(function(){var E=d(this).menuItemDepth();y=(E>y)?E:y})}A=C.helper.find(".menu-item-handle").outerWidth();A+=f(y-s);A-=2;C.placeholder.width(A)},stop:function(z,y){var x,w=t-s;x=p.children().insertAfter(y.item);if(u){y.item.remove();if(w!=0){x.shiftDepthClass(w)}x.updateParentMenuItemDBId()}else{if(w!=0){y.item.updateDepthClass(t);x.shiftDepthClass(w)}y.item.updateParentMenuItemDBId()}a()},change:function(x,w){if(!w.placeholder.parent().hasClass("menu")){w.placeholder.appendTo(h)}v(w)},sort:function(x,w){var y=j(w.helper.offset().left-q);if(y<r){y=r}else{if(y>n){y=n}}if(y!=t){o(w,y)}},receive:function(x,w){p=w.sender.children(".menu-item-transport")}});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)>c)?c:z}else{n=0}}function o(w,x){w.placeholder.updateDepthClass(x,t);t=x}},initAddMenuItemDraggables:function(){var n=d(".potential-menu-item");n.click(function(o){d(this).toggleItem()}).children().draggable({helper:"clone",connectToSortable:"ul#menu-to-edit",distance:5,zIndex:100,start:function(t,r){var s=d(t.target),q=s.parent(),o=q.parent(),p;q.selectItem();k=s.children(".menu-item-transport");p=o.parents(".tabs-panel").find(".selected-menu-item").children().not(r.helper).clone();r.helper.children(".additional-menu-items").append(p);r.helper.addClass("new-menu-item");r.helper.children("div").hide();p.first().css("margin-top",0);p.children("div").addClass("menu-item-handle");r.helper.children("div").addClass("hidden-handle");o.parents(".inside").find(".add-to-menu input").click();r.helper.width(r.helper.width());r.helper.height(r.helper.height())},stop:function(p,o){k=h;d(p.target).parents(".tabs-panel").find(".selected-menu-item").deselectItem()}})},attachMenuEditListeners:function(){var n=this;d("#update-nav-menu").bind("click",function(o){if(o.target&&o.target.className){if(-1!=o.target.className.indexOf("item-edit")){return n.eventOnClickEditLink(o.target)}else{if(-1!=o.target.className.indexOf("menu-delete")){return n.eventOnClickMenuDelete(o.target)}else{if(-1!=o.target.className.indexOf("item-delete")){return n.eventOnClickMenuItemDelete(o.target)}else{if(-1!=o.target.className.indexOf("item-close")){return n.eventOnClickCloseLink(o.target)}}}}}})},setupInputWithDefaultTitle:function(){var n="input-with-default-title";d("."+n).each(function(){var q=d(this),p=q.attr("title"),o=q.val();q.data(n,p);if(""==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("").removeClass(n)}}).blur(function(){var o=d(this);if(""==o.val()){o.addClass(n).val(o.data(n))}})},attachAddMenuItemListeners:function(){var n=d("#nav-menu-meta");n.find(".add-to-menu input").click(function(){d(this).trigger("wp-add-menu-item",[e.addMenuItemToBottom]);return false});n.find(".customlinkdiv").bind("wp-add-menu-item",function(p,o){e.addCustomLink(o)});n.find(".posttypediv, .taxonomydiv").bind("wp-add-menu-item",function(p,o){d(this).addSelectedToMenu(o)})},attachQuickSearchListeners:function(){var o=this,n=d("#nav-menu-meta");d("input.quick-search").each(function(p,q){o.setupQuickSearchEventListeners(q)});n.find(".quick-search-submit").click(function(){d(this).trigger("wp-quick-search");return false});n.find(".inside").children().bind("wp-quick-search",function(){o.quickSearch(d(this).attr("id"))})},quickSearch:function(v){var p=d("#"+v+" .quick-search").attr("name"),s=d("#"+v+" .quick-search").val(),u=d("#menu").val(),o=d("#menu-settings-column-nonce").val(),t={},r=this,n=function(){};n=r.processQuickSearchQueryResponse;t={action:"menu-quick-search","response-format":"markup",menu:u,"menu-settings-column-nonce":o,q:s,type:p};d.post(ajaxurl,t,function(q){n.call(r,q,t)})},addCustomLink:function(n){var p=d("#custom-menu-item-url").val(),o=d("#custom-menu-item-name").val();n=n||e.addMenuItemToBottom;if(""==p||"http://"==p){return false}d(".customlinkdiv img.waiting").show();this.addLinkToMenu(p,o,n,function(){d(".customlinkdiv img.waiting").hide();d("#custom-menu-item-name").val("").blur();d("#custom-menu-item-url").val("http://")})},addLinkToMenu:function(p,o,n,q){n=n||e.addMenuItemToBottom;q=q||function(){};e.addItemToMenu({"-1":{"menu-item-type":"custom","menu-item-url":p,"menu-item-title":o}},n,q)},addItemToMenu:function(p,n,r){var q=d("#menu").val(),o=d("#menu-settings-column-nonce").val();n=n||function(){};r=r||function(){};params={action:"add-menu-item",menu:q,"menu-settings-column-nonce":o,"menu-item":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(".add-home-link",".customlinkdiv").click(function(n){e.addLinkToMenu(navMenuL10n.homeurl,navMenuL10n.home,e.addMenuItemToTop,a);return false})},attachTabsPanelListeners:function(){d("#menu-settings-column").bind("click",function(s){if(s.target&&s.target.className&&-1!=s.target.className.indexOf("nav-tab-link")){var p,v=/#(.*)$/.exec(s.target.href),u,n=d(s.target).parents(".inside").first()[0],r=n?n.getElementsByTagName("input"):[],q=r.length;while(q--){r[q].checked=false}d(".tabs-panel",n).each(function(){if(this.className){this.className=this.className.replace("tabs-panel-active","tabs-panel-inactive")}});d(".tabs",n).each(function(){this.className=this.className.replace("tabs","")});s.target.parentNode.className+=" tabs";if(v&&v[1]){p=document.getElementById(v[1]);if(p){p.className=p.className.replace("tabs-panel-inactive","tabs-panel-active")}}return false}else{if(s.target&&s.target.className&&-1!=s.target.className.indexOf("select-all")){var o=/#(.*)$/.exec(s.target.href),t;if(o&&o[1]){t=d("#"+o[1]+" .tabs-panel-active .potential-menu-item");if(t.length===t.filter(".selected-menu-item").length){t.deselectItem()}else{t.selectItem()}return false}}}})},initTabManager:function(){var s=d(".nav-tabs-wrapper"),t=s.children(".nav-tabs"),r=t.children(".nav-tab-active"),v=t.children(".nav-tab"),p=0,w,q,u,o;resizing=false;function n(){q=s.offset().left;w=q+s.width();r.makeTabVisible()}d.fn.extend({makeTabVisible:function(){var y=this.eq(0),z,x;if(!y.length){return}z=y.offset().left;x=z+y.outerWidth();if(x>w){t.animate({"margin-left":"+="+(w-x)+"px",},"fast")}else{if(z<q){t.animate({"margin-left":"-="+(z-q)+"px",},"fast")}}return y},isTabVisible:function(){var y=this.eq(0),z=y.offset().left,x=z+y.outerWidth();return(x<=w&&z>=q)?true:false}});v.each(function(){p+=d(this).outerWidth(true)});if(p<=s.width()-t.css("padding-left").slice(0,-2)-t.css("padding-right").slice(0,-2)){return}t.css({"margin-right":(-1*p)+"px",padding:0,});u=d('<div class="nav-tabs-arrow nav-tabs-arrow-left"><a>&laquo;</a></div>');o=d('<div class="nav-tabs-arrow nav-tabs-arrow-right"><a>&raquo;</a></div>');s.wrap('<div class="nav-tabs-nav"/>').parent().prepend(u).append(o);n();d(window).resize(function(){if(resizing){return}resizing=true;setTimeout(function(){n();resizing=false},1000)});d.each([{arrow:u,next:"next",last:"first",operator:"+=",},{arrow:o,next:"prev",last:"last",operator:"-=",}],function(){var x=this;this.arrow.mousedown(function(){var z=v[x.last](),y=function(){if(!z.isTabVisible()){t.animate({"margin-left":x.operator+"90px",},300,"linear",y)}};y()}).mouseup(function(){var z,y;t.stop(true);z=v[x.last]();while((y=z[x.next]())&&y.length&&!y.isTabVisible()){z=y}z.makeTabVisible()})})},setupQuickSearchEventListeners:function(n){var o=this;d(n).autocomplete(ajaxurl+"?action=menu-quick-search&type="+n.name,{delay:500,formatItem:l,formatResult:m,minchars:2,multiple:false}).bind("blur",function(r){var p=i[this.value],q=this;if(p){d.post(ajaxurl+"?action=menu-quick-search&type=get-post-item&response-format=markup",p,function(s){o.processQuickSearchQueryResponse.call(o,s,p);i[q.value]=false})}})},eventOnClickEditLink:function(n){var p,o=/#(.*)$/.exec(n.href);if(o&&o[1]){p=d("#"+o[1]);if(0!=p.length){if(p.hasClass("menu-item-edit-inactive")){p.slideDown("fast").siblings("dl").andSelf().removeClass("menu-item-edit-inactive").addClass("menu-item-edit-active")}else{p.slideUp("fast").siblings("dl").andSelf().removeClass("menu-item-edit-active").addClass("menu-item-edit-inactive")}return false}}},eventOnClickCloseLink:function(n){d(n).closest(".menu-item-settings").siblings("dl").find(".item-edit").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&&p[1]){q=parseInt(n.id.replace("delete-",""),10);d.post(ajaxurl,{action:"delete-menu-item","menu-item":q,_wpnonce:p[1]},function(r){if("1"==r){o.removeMenuItem(document.getElementById("menu-item-"+q))}});return false}return true}else{return false}},processQuickSearchQueryResponse:function(r,w){if(!w){w={}}var o=document.createElement("ul"),n=document.getElementById("nav-menu-meta"),s,v,p,x,t,u=new RegExp("menu-item\\[([^\\]]*)"),q;p=u.exec(r);if(p&&p[1]){t=p[1];while(n.elements["menu-item["+t+"][menu-item-type]"]){t--}if(t!=p[1]){r=r.replace(new RegExp("menu-item\\["+p[1]+"\\]","g"),"menu-item["+t+"]")}}o.innerHTML=r;v=o.getElementsByTagName("li");if(v[0]&&w.object_type){q=document.getElementById(w.object_type+"-search-checklist");if(q){q.appendChild(v[0])}}else{if(w.type){p=/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*)/.exec(w.type);if(p&&p[2]){q=document.getElementById(p[2]+"-search-checklist");if(q){s=v.length;if(!s){x=document.createElement("li");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();var p=this;o.addClass("deleting").fadeOut(350,function(){o.remove();n.shiftDepthClass(-1).updateParentMenuItemDBId();a();p.checkForEmptyMenu()})},checkForEmptyMenu:function(){if(h.children().length){return}h.height(80).one("sortstop",function(){d(this).height("auto")})}}};var wpNavMenu=new WPNavMenuHandler(jQuery);jQuery(function(){wpNavMenu.init()});
</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 (14463 => 14464)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2010-05-05 18:43:54 UTC (rev 14463)
+++ trunk/wp-includes/script-loader.php        2010-05-05 20:29:50 UTC (rev 14464)
</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->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", false, '20100504' );
</del><ins>+                $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", false, '20100505' );
</ins><span class="cx">                 $scripts->localize( 'nav-menu', 'navMenuL10n', array(
</span><span class="cx">                         'home' => _x('Home', 'nav menu home label'),
</span><span class="cx">                         'homeurl' => home_url('/'),
</span></span></pre>
</div>
</div>
</body>
</html>