<!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>[14286] trunk/wp-admin/js: Nav menu UI updates.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/14286">14286</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-04-29 03:43:11 +0000 (Thu, 29 Apr 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Nav menu UI updates. props koopersmith, see <a href="http://trac.wordpress.org/ticket/13134">#13134</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminjscommondevjs">trunk/wp-admin/js/common.dev.js</a></li>
<li><a href="#trunkwpadminjscommonjs">trunk/wp-admin/js/common.js</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>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminjscommondevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/common.dev.js (14285 => 14286)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/common.dev.js        2010-04-28 20:44:08 UTC (rev 14285)
+++ trunk/wp-admin/js/common.dev.js        2010-04-29 03:43:11 UTC (rev 14286)
</span><span class="lines">@@ -123,26 +123,48 @@
</span><span class="cx"> // show/hide/save table columns
</span><span class="cx"> columns = {
</span><span class="cx">         init : function() {
</span><ins>+                var that = this;
</ins><span class="cx">                 $('.hide-column-tog', '#adv-settings').click( function() {
</span><del>-                        var column = $(this).val();
-                        if ( $(this).attr('checked') )
-                                $('.column-' + column).show();
</del><ins>+                        var $t = $(this), column = $t.val();
+                        if ( $t.attr('checked') )
+                                that.checked(column);
</ins><span class="cx">                         else
</span><del>-                                $('.column-' + column).hide();
</del><ins>+                                that.unchecked(column);
</ins><span class="cx">
</span><del>-                        columns.save_manage_columns_state();
</del><ins>+                        columns.saveManageColumnsState();
</ins><span class="cx">                 });
</span><span class="cx">         },
</span><span class="cx">
</span><del>-        save_manage_columns_state : function() {
-                var hidden = $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(',');
</del><ins>+        saveManageColumnsState : function() {
+                var hidden = this.hidden();
</ins><span class="cx">                 $.post(ajaxurl, {
</span><span class="cx">                         action: 'hidden-columns',
</span><span class="cx">                         hidden: hidden,
</span><span class="cx">                         screenoptionnonce: $('#screenoptionnonce').val(),
</span><span class="cx">                         page: pagenow
</span><span class="cx">                 });
</span><del>-        }
</del><ins>+        },
+        
+        checked : function(column) {
+                $('.column-' + column).show();
+        },
+        
+        unchecked : function(column) {
+                $('.column-' + column).hide();
+        },
+        
+        hidden : function() {
+                return $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(',');
+        },
+        
+        useCheckboxesForHidden : function() {
+                this.hidden = function(){
+                        return $('.hide-column-tog').not(':checked').map(function() {
+                                var id = this.id;
+                                return id.substring( id, id.length - 5 );
+                        }).get().join(',');
+                };
+        },
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $(document).ready(function(){columns.init();});
</span></span></pre></div>
<a id="trunkwpadminjscommonjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/common.js (14285 => 14286)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/common.js        2010-04-28 20:44:08 UTC (rev 14285)
+++ trunk/wp-admin/js/common.js        2010-04-29 03:43:11 UTC (rev 14286)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var showNotice,adminMenu,columns,validateForm;(function(a){adminMenu={init:function(){var b=a("#adminmenu");a(".wp-menu-toggle",b).each(function(){var c=a(this),d=c.siblings(".wp-submenu");if(d.length){c.click(function(){adminMenu.toggle(d)})}else{c.hide()}});this.favorites();a(".separator",b).click(function(){if(a("body").hasClass("folded")){adminMenu.fold(1);deleteUserSetting("mfold")}else{adminMenu.fold();setUserSetting("mfold","f")}return false});if(a("body").hasClass("folded")){this.fold()}this.restoreMenuState()},restoreMenuState:function(){a("li.wp-has-submenu","#adminmenu").each(function(c,d){var b=getUserSetting("m"+c);if(a(d).hasClass("wp-has-current-submenu")){return true}if("o"==b){a(d).addClass("wp-menu-open")}else{if("c"==b){a(d).removeClass("wp-menu-open")}}})},toggle:function(b){var c=b.slideToggle(150,function(){b.css("display","")}).parent().toggleClass("wp-menu-open").attr("id");if(c){a("li.wp-has-submenu","#adminmenu").each(function(f,g){if(c==g.id){var d=a(g).hasClass("wp-menu-open")?"o":"c";setUserSetting("m"+f,d)}})}return false},fold:function(b){if(b){a("body").removeClass("folded");a("#adminmenu li.wp-has-submenu").unbind()}else{a("body").addClass("folded");a("#adminmenu li.wp-has-submenu").hoverIntent({over:function(j){var d,c,g,k,i;d=a(this).find(".wp-submenu");c=a(this).offset().top+d.height()+1;g=a("#wpwrap").height();k=60+c-g;i=a(window).height()+a(window).scrollTop()-15;if(i<(c-k)){k=c-i}if(k>1){d.css({marginTop:"-"+k+"px"})}else{if(d.css("marginTop")){d.css({marginTop:""})}}d.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open").css({marginTop:""})},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a("#favorite-inside").width(a("#favorite-actions").width()-4);a("#favorite-toggle, #favorite-inside").bind("mouseenter",function(){a("#favorite-inside").removeClass("slideUp").addClass("slideDown");setTimeout(function(){if(a("#favorite-inside").hasClass("slideDown")){a("#favorite-inside").slideDown(100);a("#favorite-first").addClass("slide-down")}},200)}).bind("mouseleave",function(){a("#favorite-inside").removeClass("slideDown").addClass("slideUp");setTimeout(function(){if(a("#favorite-inside").hasClass("slideUp")){a("#favorite-inside").slideUp(100,function(){a("#favorite-first").removeClass("slide-down")})}},300)})}};a(document).ready(function(){adminMenu.init()});columns={init:function(){a(".hide-column-tog","#adv-settings").click(function(){var b=a(this).val();if(a(this).attr("checked")){a(".column-"+b).show()}else{a(".column-"+b).hide()}columns.save_manage_columns_state()})},save_manage_columns_state:function(){var b=a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"hidden-columns",hidden:b,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})}};a(document).ready(function(){columns.init()});validateForm=function(b){return !a(b).find(".form-required").filter(function(){return a("input:visible",this).val()==""}).addClass("form-invalid").find("input:visible").change(function(){a(this).closest(".form-invalid").removeClass("form-invalid")}).size()}})(jQuery);showNotice={warn:function(){var a=commonL10n.warnDelete||"";if(confirm(a)){return true}return false},note:function(a){alert(a)}};jQuery(document).ready(function(d){var f=false,a,e,c,b;d("div.wrap h2:first").nextAll("div.updated, div.error").addClass("below-h2");d("div.updated, div.error").not(".below-h2, .inline").insertAfter(d("div.wrap h2:first"));d("#show-settings-link").click(function(){if(!d("#screen-options-wrap").hasClass("screen-options-open")){d("#contextual-help-link-wrap").css("visibility","hidden")}d("#screen-options-wrap").slideToggle("fast",function(){if(d(this).hasClass("screen-options-open")){d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#contextual-help-link-wrap").css("visibility","");d(this).removeClass("screen-options-open")}else{d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("screen-options-open")}});return false});d("#contextual-help-link").click(function(){if(!d("#contextual-help-wrap").hasClass("contextual-help-open")){d("#screen-options-link-wrap").css("visibility","hidden")}d("#contextual-help-wrap").slideToggle("fast",function(){if(d(this).hasClass("contextual-help-open")){d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#screen-options-link-wrap").css("visibility","");d(this).removeClass("contextual-help-open")}else{d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("contextual-help-open")}});return false});d("tbody").children().children(".check-column").find(":checkbox").click(function(g){if("undefined"==g.shiftKey){return true}if(g.shiftKey){if(!f){return true}a=d(f).closest("form").find(":checkbox");e=a.index(f);c=a.index(this);b=d(this).attr("checked");if(0<e&&0<c&&e!=c){a.slice(e,c).attr("checked",function(){if(d(this).closest("tr").is(":visible")){return b?"checked":""}return""})}}f=this;return true});d("thead, tfoot").find(":checkbox").click(function(i){var j=d(this).attr("checked"),h="undefined"==typeof toggleWithKeyboard?false:toggleWithKeyboard,g=i.shiftKey||h;d(this).closest("table").children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").attr("checked",function(){if(d(this).closest("tr").is(":hidden")){return""}if(g){return d(this).attr("checked")?"":"checked"}else{if(j){return"checked"}}return""});d(this).closest("table").children("thead, tfoot").filter(":visible").children().children(".check-column").find(":checkbox").attr("checked",function(){if(g){return""}else{if(j){return"checked"}}return""})});d("#default-password-nag-no").click(function(){setUserSetting("default_password_nag","hide");d("div.default-password-nag").hide();return false});d("#newcontent").keydown(function(l){if(l.keyCode!=9){return true}var i=l.target,n=i.selectionStart,h=i.selectionEnd,m=i.value,g,k;try{this.lastKey=9}catch(j){}if(document.selection){i.focus();k=document.selection.createRange();k.text="\t"}else{if(n>=0){g=this.scrollTop;i.value=m.substring(0,n).concat("\t",m.substring(h));i.selectionStart=i.selectionEnd=n+1;this.scrollTop=g}}if(l.stopPropagation){l.stopPropagation()}if(l.preventDefault){l.preventDefault()}});d("#newcontent").blur(function(g){if(this.lastKey&&9==this.lastKey){this.focus()}})});
</del><span class="cx">\ No newline at end of file
</span><ins>+var showNotice,adminMenu,columns,validateForm;(function(a){adminMenu={init:function(){var b=a("#adminmenu");a(".wp-menu-toggle",b).each(function(){var c=a(this),d=c.siblings(".wp-submenu");if(d.length){c.click(function(){adminMenu.toggle(d)})}else{c.hide()}});this.favorites();a(".separator",b).click(function(){if(a("body").hasClass("folded")){adminMenu.fold(1);deleteUserSetting("mfold")}else{adminMenu.fold();setUserSetting("mfold","f")}return false});if(a("body").hasClass("folded")){this.fold()}this.restoreMenuState()},restoreMenuState:function(){a("li.wp-has-submenu","#adminmenu").each(function(c,d){var b=getUserSetting("m"+c);if(a(d).hasClass("wp-has-current-submenu")){return true}if("o"==b){a(d).addClass("wp-menu-open")}else{if("c"==b){a(d).removeClass("wp-menu-open")}}})},toggle:function(b){var c=b.slideToggle(150,function(){b.css("display","")}).parent().toggleClass("wp-menu-open").attr("id");if(c){a("li.wp-has-submenu","#adminmenu").each(function(f,g){if(c==g.id){var d=a(g).hasClass("wp-menu-open")?"o":"c";setUserSetting("m"+f,d)}})}return false},fold:function(b){if(b){a("body").removeClass("folded");a("#adminmenu li.wp-has-submenu").unbind()}else{a("body").addClass("folded");a("#adminmenu li.wp-has-submenu").hoverIntent({over:function(j){var d,c,g,k,i;d=a(this).find(".wp-submenu");c=a(this).offset().top+d.height()+1;g=a("#wpwrap").height();k=60+c-g;i=a(window).height()+a(window).scrollTop()-15;if(i<(c-k)){k=c-i}if(k>1){d.css({marginTop:"-"+k+"px"})}else{if(d.css("marginTop")){d.css({marginTop:""})}}d.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open").css({marginTop:""})},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a("#favorite-inside").width(a("#favorite-actions").width()-4);a("#favorite-toggle, #favorite-inside").bind("mouseenter",function(){a("#favorite-inside").removeClass("slideUp").addClass("slideDown");setTimeout(function(){if(a("#favorite-inside").hasClass("slideDown")){a("#favorite-inside").slideDown(100);a("#favorite-first").addClass("slide-down")}},200)}).bind("mouseleave",function(){a("#favorite-inside").removeClass("slideDown").addClass("slideUp");setTimeout(function(){if(a("#favorite-inside").hasClass("slideUp")){a("#favorite-inside").slideUp(100,function(){a("#favorite-first").removeClass("slide-down")})}},300)})}};a(document).ready(function(){adminMenu.init()});columns={init:function(){var b=this;a(".hide-column-tog","#adv-settings").click(function(){var d=a(this),c=d.val();if(d.attr("checked")){b.checked(c)}else{b.unchecked(c)}columns.saveManageColumnsState()})},saveManageColumnsState:function(){var b=this.hidden();a.post(ajaxurl,{action:"hidden-columns",hidden:b,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})},checked:function(b){a(".column-"+b).show()},unchecked:function(b){a(".column-"+b).hide()},hidden:function(){return a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",")},useCheckboxesForHidden:function(){this.hidden=function(){return a(".hide-column-tog").not(":checked").map(function(){var b=this.id;return b.substring(b,b.length-5)}).get().join(",")}},};a(document).ready(function(){columns.init()});validateForm=function(b){return !a(b).find(".form-required").filter(function(){return a("input:visible",this).val()==""}).addClass("form-invalid").find("input:visible").change(function(){a(this).closest(".form-invalid").removeClass("form-invalid")}).size()}})(jQuery);showNotice={warn:function(){var a=commonL10n.warnDelete||"";if(confirm(a)){return true}return false},note:function(a){alert(a)}};jQuery(document).ready(function(d){var f=false,a,e,c,b;d("div.wrap h2:first").nextAll("div.updated, div.error").addClass("below-h2");d("div.updated, div.error").not(".below-h2, .inline").insertAfter(d("div.wrap h2:first"));d("#show-settings-link").click(function(){if(!d("#screen-options-wrap").hasClass("screen-options-open")){d("#contextual-help-link-wrap").css("visibility","hidden")}d("#screen-options-wrap").slideToggle("fast",function(){if(d(this).hasClass("screen-options-open")){d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#contextual-help-link-wrap").css("visibility","");d(this).removeClass("screen-options-open")}else{d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("screen-options-open")}});return false});d("#contextual-help-link").click(function(){if(!d("#contextual-help-wrap").hasClass("contextual-help-open")){d("#screen-options-link-wrap").css("visibility","hidden")}d("#contextual-help-wrap").slideToggle("fast",function(){if(d(this).hasClass("contextual-help-open")){d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#screen-options-link-wrap").css("visibility","");d(this).removeClass("contextual-help-open")}else{d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("contextual-help-open")}});return false});d("tbody").children().children(".check-column").find(":checkbox").click(function(g){if("undefined"==g.shiftKey){return true}if(g.shiftKey){if(!f){return true}a=d(f).closest("form").find(":checkbox");e=a.index(f);c=a.index(this);b=d(this).attr("checked");if(0<e&&0<c&&e!=c){a.slice(e,c).attr("checked",function(){if(d(this).closest("tr").is(":visible")){return b?"checked":""}return""})}}f=this;return true});d("thead, tfoot").find(":checkbox").click(function(i){var j=d(this).attr("checked"),h="undefined"==typeof toggleWithKeyboard?false:toggleWithKeyboard,g=i.shiftKey||h;d(this).closest("table").children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").attr("checked",function(){if(d(this).closest("tr").is(":hidden")){return""}if(g){return d(this).attr("checked")?"":"checked"}else{if(j){return"checked"}}return""});d(this).closest("table").children("thead, tfoot").filter(":visible").children().children(".check-column").find(":checkbox").attr("checked",function(){if(g){return""}else{if(j){return"checked"}}return""})});d("#default-password-nag-no").click(function(){setUserSetting("default_password_nag","hide");d("div.default-password-nag").hide();return false});d("#newcontent").keydown(function(l){if(l.keyCode!=9){return true}var i=l.target,n=i.selectionStart,h=i.selectionEnd,m=i.value,g,k;try{this.lastKey=9}catch(j){}if(document.selection){i.focus();k=document.selection.createRange();k.text="\t"}else{if(n>=0){g=this.scrollTop;i.value=m.substring(0,n).concat("\t",m.substring(h));i.selectionStart=i.selectionEnd=n+1;this.scrollTop=g}}if(l.stopPropagation){l.stopPropagation()}if(l.preventDefault){l.preventDefault()}});d("#newcontent").blur(function(g){if(this.lastKey&&9==this.lastKey){this.focus()}})});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminjsnavmenudevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.dev.js (14285 => 14286)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.dev.js        2010-04-28 20:44:08 UTC (rev 14285)
+++ trunk/wp-admin/js/nav-menu.dev.js        2010-04-29 03:43:11 UTC (rev 14286)
</span><span class="lines">@@ -111,28 +111,6 @@
</span><span class="cx">                 }
</span><span class="cx">         },
</span><span class="cx">
</span><del>-        /**
-         * Get the parent element with the matching class, but go no higher than the form.
-         *
-         * @param DOM-element el The descendant element up from which we'll be searching
-         * @param string parentClass The class name of the desired parent element.
-         * @return DOM-element The parent element.
-         */
-        getParentWrapper = function( el, parentClass ) {
-                var form = document.getElementById('nav-menu-meta'),
-                i;
-
-                while (
-                        el.parentNode &&
-                        ( ! el.className || -1 == el.className.indexOf(parentClass) ) &&
-                        el.parentNode != form
-                ) {
-                        el = el.parentNode;
-                }
-
-                return el;
-        },
-
</del><span class="cx">         makeDroppable = function(el) {
</span><span class="cx">                 var that = this;
</span><span class="cx">
</span><span class="lines">@@ -189,9 +167,32 @@
</span><span class="cx">                         // init drag and drop
</span><span class="cx">                         setupListItemsDragAndDrop.call(this, menuList);
</span><span class="cx">
</span><ins>+                        this.initToggles();
+                },
+                
+                initToggles : function() {
+                        // init postboxes
</ins><span class="cx">                         postboxes.add_postbox_toggles('nav-menus');
</span><ins>+                        
+                        // adjust columns functions for menus UI
+                        columns.useCheckboxesForHidden();
+                        columns.checked = function(field) {
+                                $('.field-' + field).removeClass('hidden-field');
+                        }
+                        columns.unchecked = function(field) {
+                                $('.field-' + field).addClass('hidden-field');
+                        }
+                        // hide fields
+                        this.hideAdvancedMenuItemFields();
</ins><span class="cx">                 },
</span><span class="cx">                 
</span><ins>+                hideAdvancedMenuItemFields : function(container) {
+                        container = container || '.menu';
+                        $('.hide-column-tog').not(':checked').each(function(){
+                                $(container).find('.field-' + $(this).val() ).addClass('hidden-field');
+                        });
+                },
+                
</ins><span class="cx">                 attachMenuEditListeners : function() {
</span><span class="cx">                         var that = this;
</span><span class="cx">                         $('#update-nav-menu').bind('click', function(e) {
</span><span class="lines">@@ -202,6 +203,8 @@
</span><span class="cx">                                                 return that.eventOnClickMenuDelete(e.target);
</span><span class="cx">                                         } else if ( -1 != e.target.className.indexOf('item-delete') ) {
</span><span class="cx">                                                 return that.eventOnClickMenuItemDelete(e.target);
</span><ins>+                                        } else if ( -1 != e.target.className.indexOf('item-close') ) {
+                                                return that.eventOnClickCloseLink(e.target);
</ins><span class="cx">                                         }
</span><span class="cx">                                 }
</span><span class="cx">                         });
</span><span class="lines">@@ -211,24 +214,24 @@
</span><span class="cx">                         if ( ! formEL )
</span><span class="cx">                                 return;
</span><span class="cx">
</span><del>-                        var that = this;
</del><ins>+                        var that = this, lwd = 'label-with-default-title';
+                        
+                        $('.'+lwd).each(function(){
+                                var $t = $(this), title = $t.attr('title'), val = $t.val();
+                                $t.data(lwd, title);
+                                if( '' == val ) $t.val(title);
+                                else if ( title == val ) return;
+                                else $t.removeClass(lwd);
+                        }).focus(function(){
+                                var $t = $(this);
+                                if( $t.val() == $t.data(lwd) )
+                                        $t.val('').removeClass(lwd);
+                        }).blur(function(){
+                                var $t = $(this);
+                                if( '' == $t.val() )
+                                        $t.val( $t.data(lwd) ).addClass(lwd);
+                        });
</ins><span class="cx">
</span><del>-                        // set default value for custom link name
-                        customLinkNameInput = document.getElementById('custom-menu-item-name');
-                        customLinkURLInput = document.getElementById('custom-menu-item-url');
-
-                        if ( customLinkNameInput ) {
-                                customLinkNameDefault = 'undefined' != typeof customLinkNameInput.defaultValue ? customLinkNameInput.defaultValue : customLinkNameInput.getAttribute('value');
-                                customLinkURLDefault = 'undefined' != typeof customLinkURLInput.defaultValue ? customLinkURLInput.defaultValue : customLinkURLInput.getAttribute('value');
-                                $(customLinkNameInput).bind('focus', function(e) {
-                                        this.value = customLinkNameDefault == this.value ? '' : this.value;
-                                });
-                                
-                                $(customLinkNameInput).bind('blur', function(e) {
-                                        this.value = '' == this.value ? customLinkNameDefault : this.value;
-                                });
-                        }
-
</del><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="lines">@@ -241,7 +244,7 @@
</span><span class="cx">
</span><span class="cx">                 attachTabsPanelListeners : function() {
</span><span class="cx">                         $('#menu-settings-column').bind('click', function(e) {
</span><del>-                                if ( e.target && e.target.className && -1 != e.target.className.indexOf('menu-tab-link') ) {
</del><ins>+                                if ( e.target && e.target.className && -1 != e.target.className.indexOf('nav-tab-link') ) {
</ins><span class="cx">                                         var activePanel,
</span><span class="cx">                                         panelIdMatch = /#(.*)$/.exec(e.target.href),
</span><span class="cx">                                         tabPanels,
</span><span class="lines">@@ -330,18 +333,29 @@
</span><span class="cx">                         var activeEdit,
</span><span class="cx">                         matchedSection = /#(.*)$/.exec(clickedEl.href);
</span><span class="cx">                         if ( matchedSection && matchedSection[1] ) {
</span><del>-                                activeEdit = document.getElementById(matchedSection[1]);
-                                if ( activeEdit ) {
-                                        if ( -1 != activeEdit.className.indexOf('menu-item-edit-inactive') ) {
-                                                activeEdit.className = activeEdit.className.replace('menu-item-edit-inactive', 'menu-item-edit-active');
-                                        } else {
-                                                activeEdit.className = activeEdit.className.replace('menu-item-edit-active', 'menu-item-edit-inactive');
</del><ins>+                                activeEdit = $('#'+matchedSection[1]);
+                                if( 0 != activeEdit.length ) {
+                                        if( activeEdit.hasClass('menu-item-edit-inactive') ) {
+                                                activeEdit.slideDown('fast')
+                                                        .siblings('dl').andSelf()
+                                                        .removeClass('menu-item-edit-inactive')
+                                                        .addClass('menu-item-edit-active');
+                                        } else {
+                                                activeEdit.slideUp('fast')
+                                                        .siblings('dl').andSelf()
+                                                        .removeClass('menu-item-edit-active')
+                                                        .addClass('menu-item-edit-inactive');
</ins><span class="cx">                                         }
</span><span class="cx">                                         return false;
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="cx">                 },
</span><span class="cx">                 
</span><ins>+                eventOnClickCloseLink : function(clickedEl) {
+                        $(clickedEl).closest('.menu-item-settings').siblings('dl').find('.item-edit').click();
+                        return false;
+                },
+                
</ins><span class="cx">                 eventOnClickMenuDelete : function(clickedEl) {
</span><span class="cx">                         // Delete warning AYS
</span><span class="cx">                         if ( confirm( navMenuL10n.warnDeleteMenu ) ) {
</span><span class="lines">@@ -460,8 +474,7 @@
</span><span class="cx">                  * @param object e The event object.
</span><span class="cx">                  */
</span><span class="cx">                 eventSubmitMetaForm : function(thisForm, e) {
</span><del>-                        var ancestor,
-                        inputs = thisForm.getElementsByTagName('input'),
</del><ins>+                        var inputs = thisForm.getElementsByTagName('input'),
</ins><span class="cx">                         i = inputs.length,
</span><span class="cx">                         j,
</span><span class="cx">                         listItemData,
</span><span class="lines">@@ -471,6 +484,7 @@
</span><span class="cx">                         processMethod = function(){},
</span><span class="cx">                         re = new RegExp('menu-item\\[(\[^\\]\]*)');
</span><span class="cx">
</span><ins>+                        thisForm.className = thisForm.className + ' processing',
</ins><span class="cx">                         that = this;
</span><span class="cx">
</span><span class="cx">                         params['action'] = '';
</span><span class="lines">@@ -498,7 +512,6 @@
</span><span class="cx">                                                 params['menu-item[' + listItemDBID + '][' + j + ']'] = listItemData[j];
</span><span class="cx">                                         }
</span><span class="cx">
</span><del>-                                        ancestor = getParentWrapper(inputs[i], 'inside');
</del><span class="cx">                                         inputs[i].checked = false;
</span><span class="cx">
</span><span class="cx">                                 // we're submitting a search term
</span><span class="lines">@@ -508,7 +521,6 @@
</span><span class="cx">                                         inputs[i].className &&
</span><span class="cx">                                         -1 != inputs[i].className.search(/quick-search\b[^-]/)
</span><span class="cx">                                 ) {
</span><del>-                                        ancestor = getParentWrapper(inputs[i], 'inside');
</del><span class="cx">                                         params['action'] = 'menu-quick-search';
</span><span class="cx">                                         params['q'] = inputs[i].value;
</span><span class="cx">                                         params['response-format'] = 'markup';
</span><span class="lines">@@ -516,16 +528,12 @@
</span><span class="cx">                                         processMethod = that.processQuickSearchQueryResponse;
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><del>-
-                        if ( ancestor )
-                                ancestor.className = ancestor.className + ' processing',
-
</del><span class="cx">                         params['menu'] = thisForm.elements['menu'].value;
</span><span class="cx">                         params['menu-settings-column-nonce'] = thisForm.elements['menu-settings-column-nonce'].value;
</span><span class="cx">
</span><span class="cx">                         $.post( ajaxurl, params, function(menuMarkup) {
</span><span class="cx">                                 processMethod.call(that, menuMarkup, params);        
</span><del>-                                ancestor.className = ancestor.className.replace(/processing/g, '');
</del><ins>+                                thisForm.className = thisForm.className.replace(/processing/g, '');
</ins><span class="cx">                         });
</span><span class="cx">
</span><span class="cx">                         return false;
</span><span class="lines">@@ -592,12 +600,11 @@
</span><span class="cx">                         }
</span><span class="cx">
</span><span class="cx">                         this.recalculateSortOrder(menuList);
</span><ins>+                        this.hideAdvancedMenuItemFields(menuList);
</ins><span class="cx">
</span><span class="cx">                         /* set custom link form back to defaults */
</span><del>-                        if ( customLinkNameInput && customLinkURLInput ) {
-                                customLinkNameInput.value = customLinkNameDefault;
-                                customLinkURLInput.value = customLinkURLDefault;
-                        }
</del><ins>+                        $('#custom-menu-item-name').val('').blur();
+                        $('#custom-menu-item-url').val('http://');
</ins><span class="cx">                 },
</span><span class="cx">
</span><span class="cx">                 /**
</span><span class="lines">@@ -639,7 +646,6 @@
</span><span class="cx">                         if ( items[0] && req.object_type ) {
</span><span class="cx">                                 resultList = document.getElementById(req.object_type + '-search-checklist');
</span><span class="cx">                                 if ( resultList ) {
</span><del>-                                        resultList.innerHTML = '';
</del><span class="cx">                                         resultList.appendChild(items[0]);
</span><span class="cx">                                 }
</span><span class="cx">                         } else if ( req.type ) {
</span><span class="lines">@@ -647,7 +653,6 @@
</span><span class="cx">                                 if ( matched && matched[2] ) {
</span><span class="cx">                                         resultList = document.getElementById(matched[2] + '-search-checklist');
</span><span class="cx">                                         if ( resultList ) {
</span><del>-                                                resultList.innerHTML = '';
</del><span class="cx">                                                 i = items.length;
</span><span class="cx">                                                 if ( ! i ) {
</span><span class="cx">                                                         message = document.createElement('li');
</span></span></pre></div>
<a id="trunkwpadminjsnavmenujs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.js (14285 => 14286)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.js        2010-04-28 20:44:08 UTC (rev 14285)
+++ trunk/wp-admin/js/nav-menu.js        2010-04-29 03:43:11 UTC (rev 14286)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var WPNavMenuHandler=function(){var i=jQuery,a=false,k=null,h,d,n,j,m={},o=function(q,u,r,t){if(q&&q[0]){var s=i.parseJSON(q[0]);if(s.post_title){if(s.ID&&s.post_type){m[s.post_title]={ID:s.ID,object_type:s.post_type}}return s.post_title}}},p=function(q,u,r,t){if(q&&q[0]){var s=i.parseJSON(q[0]);if(s.post_title){return s.post_title}}},b=function(w,v){if(!w){return false}v=v||document;var r=["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"],q={},s=v.getElementsByTagName("input"),u=s.length,t,x=document.getElementById("nav-menu-meta-object-id").value;while(u--){t=r.length;while(t--){if(s[u]&&s[u].name&&"menu-item["+w+"]["+r[t]+"]"==s[u].name){q[r[t]]=s[u].value}}}return q},c=function(){var u=this.getElementsByTagName("input"),r=u.length,q,t,s;while(r--){if(-1!=u[r].name.indexOf("menu-item-parent-id["+parseInt(this.id.replace("menu-item-",""),10)+"]")){if(!this.parentNode.className||-1==this.parentNode.className.indexOf("sub-menu")){u[r].value=0}else{if("LI"==this.parentNode.parentNode.nodeName&&-1!=this.parentNode.parentNode.id.indexOf("menu-item-")){t=this.parentNode.parentNode;s=t.getElementsByTagName("input");q=s.length;while(q--){if(s[q].name&&-1!=s[q].name.indexOf("menu-item-object-id["+parseInt(t.id.replace("menu-item-",""),10)+"]")){u[r].value=parseInt(s[q].value,10);break}}}}break}}},e=function(r,t){var s=document.getElementById("nav-menu-meta"),q;while(r.parentNode&&(!r.className||-1==r.className.indexOf(t))&&r.parentNode!=s){r=r.parentNode}return r},f=function(q){var r=this;i(q).droppable({accept:".menu li",tolerance:"pointer",drop:function(t,s){r.eventOnDrop(s.draggable[0],this,s,t)},over:function(t,s){r.eventOnDragOver(s.draggable[0],this,s,t)},out:function(t,s){r.eventOnDragOut(s.draggable[0],this,s,t)}})},l,g=function(t){if(!t){return}var r=document.getElementById(t.id+"-dummy-list-item"),q=t.getElementsByTagName("li"),s=q.length;if(!r){r=document.createElement("li");r.id=t.id+"-dummy-list-item";t.appendChild(r);this.setupListItemDragAndDrop(r)}while(s--){this.setupListItemDragAndDrop(q[s])}};return{init:function(){l=document.getElementById("menu-to-edit");this.attachMenuEditListeners();this.attachMenuMetaListeners(document.getElementById("nav-menu-meta"));this.attachTabsPanelListeners();g.call(this,l);postboxes.add_postbox_toggles("nav-menus")},attachMenuEditListeners:function(){var q=this;i("#update-nav-menu").bind("click",function(r){if(r.target&&r.target.className){if(-1!=r.target.className.indexOf("item-edit")){return q.eventOnClickEditLink(r.target)}else{if(-1!=r.target.className.indexOf("menu-delete")){return q.eventOnClickMenuDelete(r.target)}else{if(-1!=r.target.className.indexOf("item-delete")){return q.eventOnClickMenuItemDelete(r.target)}}}}})},attachMenuMetaListeners:function(q){if(!q){return}var r=this;h=document.getElementById("custom-menu-item-name");d=document.getElementById("custom-menu-item-url");if(h){n="undefined"!=typeof h.defaultValue?h.defaultValue:h.getAttribute("value");j="undefined"!=typeof d.defaultValue?d.defaultValue:d.getAttribute("value");i(h).bind("focus",function(s){this.value=n==this.value?"":this.value});i(h).bind("blur",function(s){this.value=""==this.value?n:this.value})}i("input.quick-search").each(function(s,t){r.setupQuickSearchEventListeners(t)});i(q).bind("submit",function(s){return r.eventSubmitMetaForm.call(r,this,s)})},attachTabsPanelListeners:function(){i("#menu-settings-column").bind("click",function(v){if(v.target&&v.target.className&&-1!=v.target.className.indexOf("menu-tab-link")){var w,r=/#(.*)$/.exec(v.target.href),u,x=e(v.target,"inside"),q=x?x.getElementsByTagName("input"):[],s=q.length;while(s--){q[s].checked=false}i(".tabs-panel",x).each(function(){if(this.className){this.className=this.className.replace("tabs-panel-active","tabs-panel-inactive")}});i(".tabs",x).each(function(){this.className=this.className.replace("tabs","")});v.target.parentNode.className+=" tabs";if(r&&r[1]){w=document.getElementById(r[1]);if(w){w.className=w.className.replace("tabs-panel-inactive","tabs-panel-active")}}return false}else{if(v.target&&v.target.className&&-1!=v.target.className.indexOf("select-all")){var t=/#(.*)$/.exec(v.target.href);if(t&&t[1]){i("#"+t[1]+" .tabs-panel-active input[type=checkbox]").attr("checked","checked");return false}}}})},setupListItemDragAndDrop:function(s){var q=s.getElementsByTagName("dl"),t=this.makeListItemDropzone(s),r=q.length;f.call(this,t);this.makeListItemDraggable(s);while(r--){f.call(this,q[r])}},setupQuickSearchEventListeners:function(q){var r=this;i(q).autocomplete(ajaxurl+"?action=menu-quick-search&type="+q.name,{delay:500,formatItem:o,formatResult:p,minchars:2,multiple:false}).bind("blur",function(u){var s=m[this.value],t=this;if(s){i.post(ajaxurl+"?action=menu-quick-search&type=get-post-item&response-format=markup",s,function(v){r.processQuickSearchQueryResponse.call(r,v,s);m[t.value]=false})}})},eventOnClickEditLink:function(q){var s,r=/#(.*)$/.exec(q.href);if(r&&r[1]){s=document.getElementById(r[1]);if(s){if(-1!=s.className.indexOf("menu-item-edit-inactive")){s.className=s.className.replace("menu-item-edit-inactive","menu-item-edit-active")}else{s.className=s.className.replace("menu-item-edit-active","menu-item-edit-inactive")}return false}}},eventOnClickMenuDelete:function(q){if(confirm(navMenuL10n.warnDeleteMenu)){return true}else{return false}},eventOnClickMenuItemDelete:function(q){var t,s,r=this;if(confirm(navMenuL10n.warnDeleteMenuItem)){s=/_wpnonce=([a-zA-Z0-9]*)$/.exec(q.href);if(s&&s[1]){t=parseInt(q.id.replace("delete-",""),10);i.post(ajaxurl,{action:"delete-menu-item","menu-item":t,_wpnonce:s[1]},function(u){if("1"==u){r.removeMenuItem(document.getElementById("menu-item-"+t))}});return false}return true}else{return false}},eventOnDragOver:function(q,r){a=true;k=r;r.className+=" sortable-placeholder"},eventOnDragOut:function(q,r){a=false;(function(s){setTimeout(function(){if(s!=k||(!a&&s.className&&-1!=s.className.indexOf("sortable-placeholder"))){s.className=s.className.replace(/sortable-placeholder/g,"")}},800)})(r)},eventOnDrop:function(t,w){var u=!!(-1==w.className.indexOf("dropzone")),r=w.parentNode.getElementsByTagName("ul"),v=false,s=r.length,q;a=false;w.className=w.className.replace(/sortable-placeholder/g,"");if(u){while(s--){if(r[s]&&1!=r[s].className.indexOf("sub-menu")){v=true;q=r[s]}}if(!v){q=document.createElement("ul");q.className="sub-menu";w.parentNode.appendChild(q)}q.appendChild(t)}else{w.parentNode.parentNode.insertBefore(t,w.parentNode)}this.recalculateSortOrder(l);c.call(t)},eventSubmitMetaForm:function(r,y){var v,w=r.getElementsByTagName("input"),u=w.length,t,A,q,x,s={},z=function(){},B=new RegExp("menu-item\\[([^\\]]*)");that=this;s.action="";while(u--){if(w[u].name&&-1!=w[u].name.indexOf("menu-item-object-id")&&w[u].checked||("undefined"!=typeof w[u].id&&"custom-menu-item-url"==w[u].id&&""!=w[u].value&&"http://"!=w[u].value)){s.action="add-menu-item";z=that.processAddMenuItemResponse;x=B.exec(w[u].name);q="undefined"==typeof x[1]?0:parseInt(x[1],10);A=b(q);for(t in A){s["menu-item["+q+"]["+t+"]"]=A[t]}v=e(w[u],"inside");w[u].checked=false}else{if(""==s.action&&""!=w[u].value&&w[u].className&&-1!=w[u].className.search(/quick-search\b[^-]/)){v=e(w[u],"inside");s.action="menu-quick-search";s.q=w[u].value;s["response-format"]="markup";s.type=w[u].name;z=that.processQuickSearchQueryResponse}}}if(v){v.className=v.className+" processing",s.menu=r.elements.menu.value}s["menu-settings-column-nonce"]=r.elements["menu-settings-column-nonce"].value;i.post(ajaxurl,s,function(C){z.call(that,C,s);v.className=v.className.replace(/processing/g,"")});return false},makeListItemDraggable:function(q){i(q).draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100})},makeListItemDropzone:function(s){if(!s){return false}var r=s.getElementsByTagName("div"),q=r.length,t=document.createElement("div");while(q--){if(r[q].className&&-1!=r[q].className.indexOf("dropzone")&&(s==r[q].parentNode)){return r[q]}}t.className="dropzone";s.insertBefore(t,s.firstChild);return t},processAddMenuItemResponse:function(q,v){if(!v){v={}}var w,r=document.getElementById(l.id+"-dummy-list-item"),t,s,u=document.createElement("ul");u.innerHTML=q;s=u.getElementsByTagName("li");t=s.length;while(t--){this.setupListItemDragAndDrop(s[t]);if(r){l.insertBefore(s[t],r)}else{l.appendChild(s[t])}}this.recalculateSortOrder(l);if(h&&d){h.value=n;d.value=j}},processQuickSearchQueryResponse:function(u,z){if(!z){z={}}var r=document.createElement("ul"),q=document.getElementById("nav-menu-meta"),v,y,s,A,w,x=new RegExp("menu-item\\[([^\\]]*)"),t;s=x.exec(u);if(s&&s[1]){w=s[1];while(q.elements["menu-item["+w+"][menu-item-type]"]){w--}if(w!=s[1]){u=u.replace(new RegExp("menu-item\\["+s[1]+"\\]","g"),"menu-item["+w+"]")}}r.innerHTML=u;y=r.getElementsByTagName("li");if(y[0]&&z.object_type){t=document.getElementById(z.object_type+"-search-checklist");if(t){t.innerHTML="";t.appendChild(y[0])}}else{if(z.type){s=/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*)/.exec(z.type);if(s&&s[2]){t=document.getElementById(s[2]+"-search-checklist");if(t){t.innerHTML="";v=y.length;if(!v){A=document.createElement("li");A.appendChild(document.createTextNode(navMenuL10n.noResultsFound));t.appendChild(A)}while(v--){t.appendChild(y[v])}}}}}},recalculateSortOrder:function(s){var t=s.getElementsByTagName("input"),r,q=0;for(r=0;r<t.length;r++){if(t[r].name&&-1!=t[r].name.indexOf("menu-item-position")){t[r].value=++q}}},removeMenuItem:function(s){if(!s){return false}var t=s.getElementsByTagName("ul"),r,q;if(t[0]){r=t[0].getElementsByTagName("li");for(q=0;q<r.length;q++){if(r[q].id&&-1!=r[q].id.indexOf("menu-item-")&&r[q].parentNode==t[0]){s.parentNode.insertBefore(r[q],s)}}}s.className+=" deleting";i(s).fadeOut(350,function(){this.parentNode.removeChild(this)});this.recalculateSortOrder(l)}}};var wpNavMenu=new WPNavMenuHandler();jQuery(function(){wpNavMenu.init()});
</del><span class="cx">\ No newline at end of file
</span><ins>+var WPNavMenuHandler=function(){var h=jQuery,a=false,j=null,g,d,m,i,l={},n=function(p,t,q,s){if(p&&p[0]){var r=h.parseJSON(p[0]);if(r.post_title){if(r.ID&&r.post_type){l[r.post_title]={ID:r.ID,object_type:r.post_type}}return r.post_title}}},o=function(p,t,q,s){if(p&&p[0]){var r=h.parseJSON(p[0]);if(r.post_title){return r.post_title}}},b=function(v,u){if(!v){return false}u=u||document;var q=["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"],p={},r=u.getElementsByTagName("input"),t=r.length,s,w=document.getElementById("nav-menu-meta-object-id").value;while(t--){s=q.length;while(s--){if(r[t]&&r[t].name&&"menu-item["+v+"]["+q[s]+"]"==r[t].name){p[q[s]]=r[t].value}}}return p},c=function(){var t=this.getElementsByTagName("input"),q=t.length,p,s,r;while(q--){if(-1!=t[q].name.indexOf("menu-item-parent-id["+parseInt(this.id.replace("menu-item-",""),10)+"]")){if(!this.parentNode.className||-1==this.parentNode.className.indexOf("sub-menu")){t[q].value=0}else{if("LI"==this.parentNode.parentNode.nodeName&&-1!=this.parentNode.parentNode.id.indexOf("menu-item-")){s=this.parentNode.parentNode;r=s.getElementsByTagName("input");p=r.length;while(p--){if(r[p].name&&-1!=r[p].name.indexOf("menu-item-object-id["+parseInt(s.id.replace("menu-item-",""),10)+"]")){t[q].value=parseInt(r[p].value,10);break}}}}break}}},e=function(p){var q=this;h(p).droppable({accept:".menu li",tolerance:"pointer",drop:function(s,r){q.eventOnDrop(r.draggable[0],this,r,s)},over:function(s,r){q.eventOnDragOver(r.draggable[0],this,r,s)},out:function(s,r){q.eventOnDragOut(r.draggable[0],this,r,s)}})},k,f=function(s){if(!s){return}var q=document.getElementById(s.id+"-dummy-list-item"),p=s.getElementsByTagName("li"),r=p.length;if(!q){q=document.createElement("li");q.id=s.id+"-dummy-list-item";s.appendChild(q);this.setupListItemDragAndDrop(q)}while(r--){this.setupListItemDragAndDrop(p[r])}};return{init:function(){k=document.getElementById("menu-to-edit");this.attachMenuEditListeners();this.attachMenuMetaListeners(document.getElementById("nav-menu-meta"));this.attachTabsPanelListeners();f.call(this,k);this.initToggles()},initToggles:function(){postboxes.add_postbox_toggles("nav-menus");columns.useCheckboxesForHidden();columns.checked=function(p){h(".field-"+p).removeClass("hidden-field")};columns.unchecked=function(p){h(".field-"+p).addClass("hidden-field")};this.hideAdvancedMenuItemFields()},hideAdvancedMenuItemFields:function(p){p=p||".menu";h(".hide-column-tog").not(":checked").each(function(){h(p).find(".field-"+h(this).val()).addClass("hidden-field")})},attachMenuEditListeners:function(){var p=this;h("#update-nav-menu").bind("click",function(q){if(q.target&&q.target.className){if(-1!=q.target.className.indexOf("item-edit")){return p.eventOnClickEditLink(q.target)}else{if(-1!=q.target.className.indexOf("menu-delete")){return p.eventOnClickMenuDelete(q.target)}else{if(-1!=q.target.className.indexOf("item-delete")){return p.eventOnClickMenuItemDelete(q.target)}else{if(-1!=q.target.className.indexOf("item-close")){return p.eventOnClickCloseLink(q.target)}}}}}})},attachMenuMetaListeners:function(q){if(!q){return}var r=this,p="label-with-default-title";h("."+p).each(function(){var u=h(this),t=u.attr("title"),s=u.val();u.data(p,t);if(""==s){u.val(t)}else{if(t==s){return}else{u.removeClass(p)}}}).focus(function(){var s=h(this);if(s.val()==s.data(p)){s.val("").removeClass(p)}}).blur(function(){var s=h(this);if(""==s.val()){s.val(s.data(p)).addClass(p)}});h("input.quick-search").each(function(s,t){r.setupQuickSearchEventListeners(t)});h(q).bind("submit",function(s){return r.eventSubmitMetaForm.call(r,this,s)})},attachTabsPanelListeners:function(){h("#menu-settings-column").bind("click",function(u){if(u.target&&u.target.className&&-1!=u.target.className.indexOf("nav-tab-link")){var v,q=/#(.*)$/.exec(u.target.href),t,w=getParentWrapper(u.target,"inside"),p=w?w.getElementsByTagName("input"):[],r=p.length;while(r--){p[r].checked=false}h(".tabs-panel",w).each(function(){if(this.className){this.className=this.className.replace("tabs-panel-active","tabs-panel-inactive")}});h(".tabs",w).each(function(){this.className=this.className.replace("tabs","")});u.target.parentNode.className+=" tabs";if(q&&q[1]){v=document.getElementById(q[1]);if(v){v.className=v.className.replace("tabs-panel-inactive","tabs-panel-active")}}return false}else{if(u.target&&u.target.className&&-1!=u.target.className.indexOf("select-all")){var s=/#(.*)$/.exec(u.target.href);if(s&&s[1]){h("#"+s[1]+" .tabs-panel-active input[type=checkbox]").attr("checked","checked");return false}}}})},setupListItemDragAndDrop:function(r){var p=r.getElementsByTagName("dl"),s=this.makeListItemDropzone(r),q=p.length;e.call(this,s);this.makeListItemDraggable(r);while(q--){e.call(this,p[q])}},setupQuickSearchEventListeners:function(p){var q=this;h(p).autocomplete(ajaxurl+"?action=menu-quick-search&type="+p.name,{delay:500,formatItem:n,formatResult:o,minchars:2,multiple:false}).bind("blur",function(t){var r=l[this.value],s=this;if(r){h.post(ajaxurl+"?action=menu-quick-search&type=get-post-item&response-format=markup",r,function(u){q.processQuickSearchQueryResponse.call(q,u,r);l[s.value]=false})}})},eventOnClickEditLink:function(p){var r,q=/#(.*)$/.exec(p.href);if(q&&q[1]){r=h("#"+q[1]);if(0!=r.length){if(r.hasClass("menu-item-edit-inactive")){r.slideDown("fast").siblings("dl").andSelf().removeClass("menu-item-edit-inactive").addClass("menu-item-edit-active")}else{r.slideUp("fast").siblings("dl").andSelf().removeClass("menu-item-edit-active").addClass("menu-item-edit-inactive")}return false}}},eventOnClickCloseLink:function(p){h(p).closest(".menu-item-settings").siblings("dl").find(".item-edit").click();return false},eventOnClickMenuDelete:function(p){if(confirm(navMenuL10n.warnDeleteMenu)){return true}else{return false}},eventOnClickMenuItemDelete:function(p){var s,r,q=this;if(confirm(navMenuL10n.warnDeleteMenuItem)){r=/_wpnonce=([a-zA-Z0-9]*)$/.exec(p.href);if(r&&r[1]){s=parseInt(p.id.replace("delete-",""),10);h.post(ajaxurl,{action:"delete-menu-item","menu-item":s,_wpnonce:r[1]},function(t){if("1"==t){q.removeMenuItem(document.getElementById("menu-item-"+s))}});return false}return true}else{return false}},eventOnDragOver:function(p,q){a=true;j=q;q.className+=" sortable-placeholder"},eventOnDragOut:function(p,q){a=false;(function(r){setTimeout(function(){if(r!=j||(!a&&r.className&&-1!=r.className.indexOf("sortable-placeholder"))){r.className=r.className.replace(/sortable-placeholder/g,"")}},800)})(q)},eventOnDrop:function(s,v){var t=!!(-1==v.className.indexOf("dropzone")),q=v.parentNode.getElementsByTagName("ul"),u=false,r=q.length,p;a=false;v.className=v.className.replace(/sortable-placeholder/g,"");if(t){while(r--){if(q[r]&&1!=q[r].className.indexOf("sub-menu")){u=true;p=q[r]}}if(!u){p=document.createElement("ul");p.className="sub-menu";v.parentNode.appendChild(p)}p.appendChild(s)}else{v.parentNode.parentNode.insertBefore(s,v.parentNode)}this.recalculateSortOrder(k);c.call(s)},eventSubmitMetaForm:function(q,w){var u=q.getElementsByTagName("input"),t=u.length,s,y,p,v,r={},x=function(){},z=new RegExp("menu-item\\[([^\\]]*)");q.className=q.className+" processing",that=this;r.action="";while(t--){if(u[t].name&&-1!=u[t].name.indexOf("menu-item-object-id")&&u[t].checked||("undefined"!=typeof u[t].id&&"custom-menu-item-url"==u[t].id&&""!=u[t].value&&"http://"!=u[t].value)){r.action="add-menu-item";x=that.processAddMenuItemResponse;v=z.exec(u[t].name);p="undefined"==typeof v[1]?0:parseInt(v[1],10);y=b(p);for(s in y){r["menu-item["+p+"]["+s+"]"]=y[s]}u[t].checked=false}else{if(""==r.action&&""!=u[t].value&&u[t].className&&-1!=u[t].className.search(/quick-search\b[^-]/)){r.action="menu-quick-search";r.q=u[t].value;r["response-format"]="markup";r.type=u[t].name;x=that.processQuickSearchQueryResponse}}}r.menu=q.elements.menu.value;r["menu-settings-column-nonce"]=q.elements["menu-settings-column-nonce"].value;h.post(ajaxurl,r,function(A){x.call(that,A,r);q.className=q.className.replace(/processing/g,"")});return false},makeListItemDraggable:function(p){h(p).draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100})},makeListItemDropzone:function(r){if(!r){return false}var q=r.getElementsByTagName("div"),p=q.length,s=document.createElement("div");while(p--){if(q[p].className&&-1!=q[p].className.indexOf("dropzone")&&(r==q[p].parentNode)){return q[p]}}s.className="dropzone";r.insertBefore(s,r.firstChild);return s},processAddMenuItemResponse:function(p,u){if(!u){u={}}var v,q=document.getElementById(k.id+"-dummy-list-item"),s,r,t=document.createElement("ul");t.innerHTML=p;r=t.getElementsByTagName("li");s=r.length;while(s--){this.setupListItemDragAndDrop(r[s]);if(q){k.insertBefore(r[s],q)}else{k.appendChild(r[s])}}this.recalculateSortOrder(k);this.hideAdvancedMenuItemFields(k);h("#custom-menu-item-name").val("").blur();h("#custom-menu-item-url").val("http://")},processQuickSearchQueryResponse:function(t,y){if(!y){y={}}var q=document.createElement("ul"),p=document.getElementById("nav-menu-meta"),u,x,r,z,v,w=new RegExp("menu-item\\[([^\\]]*)"),s;r=w.exec(t);if(r&&r[1]){v=r[1];while(p.elements["menu-item["+v+"][menu-item-type]"]){v--}if(v!=r[1]){t=t.replace(new RegExp("menu-item\\["+r[1]+"\\]","g"),"menu-item["+v+"]")}}q.innerHTML=t;x=q.getElementsByTagName("li");if(x[0]&&y.object_type){s=document.getElementById(y.object_type+"-search-checklist");if(s){s.appendChild(x[0])}}else{if(y.type){r=/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*)/.exec(y.type);if(r&&r[2]){s=document.getElementById(r[2]+"-search-checklist");if(s){u=x.length;if(!u){z=document.createElement("li");z.appendChild(document.createTextNode(navMenuL10n.noResultsFound));s.appendChild(z)}while(u--){s.appendChild(x[u])}}}}}},recalculateSortOrder:function(r){var s=r.getElementsByTagName("input"),q,p=0;for(q=0;q<s.length;q++){if(s[q].name&&-1!=s[q].name.indexOf("menu-item-position")){s[q].value=++p}}},removeMenuItem:function(r){if(!r){return false}var s=r.getElementsByTagName("ul"),q,p;if(s[0]){q=s[0].getElementsByTagName("li");for(p=0;p<q.length;p++){if(q[p].id&&-1!=q[p].id.indexOf("menu-item-")&&q[p].parentNode==s[0]){r.parentNode.insertBefore(q[p],r)}}}r.className+=" deleting";h(r).fadeOut(350,function(){this.parentNode.removeChild(this)});this.recalculateSortOrder(k)}}};var wpNavMenu=new WPNavMenuHandler();jQuery(function(){wpNavMenu.init()});
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>
</body>
</html>