<!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>[13803] trunk/wp-admin/js:
Prevent the nav menu walker from walking in circles.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13803">13803</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-03-22 22:26:27 +0000 (Mon, 22 Mar 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Prevent the nav menu walker from walking in circles. Don't allow an object from being a child of itself; if the functionality is desired, a workaround would be custom links. see <a href="http://trac.wordpress.org/ticket/11817">#11817</a>, see <a href="http://trac.wordpress.org/ticket/12566">#12566</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>
</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 (13802 => 13803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.dev.js        2010-03-22 19:56:16 UTC (rev 13802)
+++ trunk/wp-admin/js/nav-menu.dev.js        2010-03-22 22:26:27 UTC (rev 13803)
</span><span class="lines">@@ -196,6 +196,16 @@
</span><span class="cx">                                         var li = $(this).parent();
</span><span class="cx">                                         var child = !$(this).hasClass('dropzone');
</span><span class="cx">
</span><ins>+                                        var parent_id = li.children('input[name=menu-item-object-id[]]').val();
+                                        var child_id = ui.draggable.children('input[name=menu-item-object-id[]]').val();
+
+                                        // An item cannot be a child of itself. Use a custom link for the effect.
+                                        if ( parent_id == child_id ) {
+                                                ui.draggable.find('dt').animate( { backgroundColor: '#FF3333' }, { duration: 'normal', complete: function() { $(this).css( 'backgroundColor', '' ) } } );
+                                                $(this).parent().find('dt').removeAttr('style');
+                                                return;
+                                        };
+
</ins><span class="cx">                                         // Append UL to first child
</span><span class="cx">                                         if ( child && li.children('ul').length == 0 ) {
</span><span class="cx">                                                 li.append( '<ul class="sub-menu" />' );
</span></span></pre></div>
<a id="trunkwpadminjsnavmenujs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.js (13802 => 13803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.js        2010-03-22 19:56:16 UTC (rev 13802)
+++ trunk/wp-admin/js/nav-menu.js        2010-03-22 22:26:27 UTC (rev 13803)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var wpNavMenu;(function(a){wpNavMenu={init:function(){wpNavMenu.initial_meta_boxes();wpNavMenu.drag_and_drop();a("#update-nav-menu .deletion").click(function(){if(confirm(navMenuL10n.warnDelete)){return true}else{return false}});a("#update-nav-menu").submit(function(){wpNavMenu.update_post_data()});a("#create-menu-name").keypress(function(b){if(13==b.keyCode){a("#create-menu-button").click();return false}});a("#custom-menu-item-url, #custom-menu-item-name").keypress(function(b){if(13==b.keyCode){a("#add-custom-links a.button").click();return false}}).focus(function(){if(a(this).val()==a(this).attr("defaultValue")&&a(this).attr("id")!="custom-menu-item-url"){a(this).val("")}}).blur(function(){if(a(this).val()==""){a(this).val(a(this).attr("defaultValue"))}});a("#create-menu-name").focus(function(){if(a(this).val()==a(this).attr("defaultValue")){a(this).val("")}}).blur(function(){if(a(this).val()==""){a(this).val(a(this).attr("defaultValue"))}});a(".if-js-closed").removeClass("if-js-closed").addClass("closed");postboxes.add_postbox_toggles("nav-menus");a(".quick-search").click(function(){a(this).attr("value","")});a(".quick-search-submit").click(function(){a(this).siblings(".quick-search").search()});a("#menu-container .item-edit").click(function(){wpNavMenu.edit_menu_item(a(this).attr("value"))});a("#menu-container .item-delete").click(function(){wpNavMenu.remove_menu_item(a(this).attr("value"))});a("#update-menu-item").click(function(){wpNavMenu.update_menu_item();tb_remove()});a("#cancel-save").click(function(){tb_remove()});a(".show-all").click(function(b){a(b.currentTarget).parent().parent().siblings(".list-wrap").css("display","block");a(b.currentTarget).parent().parent().siblings(".list-wrap").find("li").css("display","block");a(b.currentTarget).hide();a(b.currentTarget).siblings(".hide-all").show()});a(".hide-all").click(function(b){a(b.currentTarget).parent().parent().siblings(".list-wrap").css("display","none");a(b.currentTarget).parent().parent().siblings(".list-wrap").find("li").css("display","none");a(b.currentTarget).hide();a(b.currentTarget).siblings(".show-all").show()});a(".add-to-menu").click(function(b){wpNavMenu.add_checked_items_to_menu(b.currentTarget)});a("#add-custom-links .add-to-menu a").click(function(b){if(a("#custom-menu-item-url").val()==a("#custom-menu-item-url").attr("defaultValue")){return}wpNavMenu.add_custom_link(a("#custom-menu-item-name").val(),a("#custom-menu-item-url").val());a("#custom-menu-item-name").val(a("#custom-menu-item-name").attr("defaultValue"));a("#custom-menu-item-url").val(a("#custom-menu-item-url").attr("defaultValue")).focus()})},add_custom_link:function(c,b){var d={action:"save-custom-link",link_name:c,link_url:b};a.post(ajaxurl,d,function(e){if("-1"==e){return}wpNavMenu.add_to_menu(e,e,"custom","custom",navMenuL10n.custom,0,c,b,"","","_self","","")},"json")},initial_meta_boxes:function(){var c=a("#hidden-metaboxes").val().split(",");if(""!=c){for(var b=0;b<c.length;b++){a("#"+c[b]).attr("style","display: none;");a("#"+c[b]+"-hide").attr("checked",false)}}},drag_and_drop:function(){a(".menu li").each(function(){if(!a(this).children(".dropzone").attr("class")){a(this).prepend('<div class="dropzone"></div>')}});a(".menu li").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});a(".menu li dl, .menu li .dropzone").droppable({accept:".menu li",tolerance:"pointer",drop:function(g,f){var b=a(this).parent();var h=!a(this).hasClass("dropzone");if(h&&b.children("ul").length==0){b.append('<ul class="sub-menu" />')}if(h){b.children("ul").append(f.draggable)}else{b.before(f.draggable)}b.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var d=f.draggable.attr("value");var c=b.attr("value");b.find("#menu-"+d).find("#parent"+d).val(c);a(this).parent().find("dt").removeAttr("style");a(this).parent().find("div:first").removeAttr("style")},over:function(b){if(a(this).attr("class")=="dropzone ui-droppable"){a(this).parent().find("div:first").css({background:"#f5f5f5",border:"1px dashed #bbb",margin:"10px 0px",height:"40px"})}else{if(a(this).attr("class")=="ui-droppable"){a(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}},out:function(){a(this).parent().find("dt").removeAttr("style");a(this).parent().find("div:first").removeAttr("style");a(this).filter(".dropzone").css({borderColor:""})}})},update_post_data:function(){var b=0;a(".menu li").each(function(){b=b+1;var d=a(this).attr("value");var e=a(this).children("input[name=menu-item-db-id[]]").val();a(this).attr("value",b);a(this).children("input[name=menu-item-position[]]").attr("value",b);var c=a(this).parent(".sub-menu").siblings("input[name=menu-item-object-id[]]").val();if(undefined==c){c=0}a(this).children("input[name=menu-item-parent-id[]]").attr("value",c);a("#li-count").attr("value",b)})},autocomplete:function(b){a("#add-"+b+" .quick-search").autocomplete(a("#add-"+b+" .autocomplete").val().split("|"));a("#add-"+b+" .quick-search").result(function(c,e,d){a("#add-"+b+" .list-wrap").css("display","block");a("#add-"+b+" .list-wrap li:contains('"+e+"')").css("display","block");a("#add-"+b+" .show-all").hide();a("#add-"+b+" .hide-all").show()})},edit_menu_item:function(b){var g=a("#menu-item-"+b).children("input[name=menu-item-type[]]").val();var c=a("#menu-item-"+b).children("input[name=menu-item-title[]]").val();var h=a("#menu-item-"+b).children("input[name=menu-item-url[]]").val();var d=a("#menu-item-"+b).children("input[name=menu-item-attr-title[]]").val();var e=a("#menu-item-"+b).children("input[name=menu-item-target[]]").val();var i=a("#menu-item-"+b).children("input[name=menu-item-description[]]").val();var f=a("#menu-item-"+b).children("input[name=menu-item-classes[]]").val();var j=a("#menu-item-"+b).children("input[name=menu-item-xfn[]]").val();if("custom"!=g){a("#edit-menu-item-url").attr("disabled","disabled")}a("#edit-menu-item-id").val(b);a("#edit-menu-item-title").val(c);a("#edit-menu-item-url").val(h);a("#edit-menu-item-attr-title").val(d);a("#edit-menu-item-target").val(e);a("#edit-menu-item-target option[value='"+e+"']").attr("selected","selected");a("#edit-menu-item-description").val(i);a("#edit-menu-item-classes").val(f);a("#edit-menu-item-xfn").val(j)},update_menu_item:function(){var i=a("#edit-menu-item-id").val();var g=a("#edit-menu-item-title").val();var c=a("#edit-menu-item-url").val();var h=a("#edit-menu-item-attr-title").val();var e=a("#edit-menu-item-target").val();var d=a("#edit-menu-item-description").val();var b=a("#edit-menu-item-classes").val();var f=a("#edit-menu-item-xfn").val();a(".menu #menu-item-"+i).find("span.item-title:first").html(g);a("#menu-item-"+i).children("input[name=menu-item-title[]]").val(g);a("#menu-item-"+i).children("input[name=menu-item-url[]]").val(c);a("#menu-item-"+i).children("input[name=menu-item-attr-title[]]").val(h);a("#menu-item-"+i).children("input[name=menu-item-target[]]").val(e);a("#menu-item-"+i).children("input[name=menu-item-description[]]").val(d);a("#menu-item-"+i).children("input[name=menu-item-classes[]]").val(b);a("#menu-item-"+i).children("input[name=menu-item-xfn[]]").val(f);a(".menu #menu-item-"+i+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){a(this).css("backgroundColor","")}})},remove_menu_item:function(c){var b=a("#menu-item-"+c);if(b){a(b).find("dt").each(function(){a(this).animate({backgroundColor:"#FF3333"},{duration:"normal",complete:function(){a(this).parent().parent().remove()}})})}},add_to_menu:function(b,m,c,h,p,n,d,o,j,g,f,e,k){var l=a(".menu li").length+1;var i=wpNavMenu.get_hidden_inputs(l,b,m,c,h,n,d,o,j,g,f,e,k);a(".menu").append('<li id="menu-item-'+l+'" value="'+l+'"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="item-title">'+d+'</span><span class="item-controls"><span class="item-type">'+p+'</span><a class="item-edit thickbox" id="edit'+l+'" value="'+l+'" onclick="wpNavMenu.edit_menu_item('+l+');" title="'+navMenuL10n.thickbox+'" href="#TB_inline?height=540&width=300&inlineId=menu-item-settings">'+navMenuL10n.edit+'</a> | <a class="item-delete" id="delete'+l+'" value="'+l+'" onclick="wpNavMenu.remove_menu_item('+l+');">Delete</a></span></dt></dl>'+i+"</li>");a(".menu #menu-item-"+l+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){a(this).css("backgroundColor","")}});wpNavMenu.drag_and_drop();tb_init("a.thickbox, area.thickbox, input.thickbox")},add_checked_items_to_menu:function(c){var b=a(c).parent().siblings(".list-wrap").find(":checked");if(0==b.length){return false}a(b).each(function(){var j=a(this).parent().siblings(".menu-item-type").val();if("custom"==j){var g=a(this).parent().siblings(".menu-item-attr-title").val();var h=a(this).parent().siblings(".menu-item-target").val();var i=a(this).parent().siblings(".menu-item-classes").val();var l=a(this).parent().siblings(".menu-item-xfn").val()}else{var g="";var h="_self";var i="";var l=""}var d=a(this).parent().siblings(".menu-item-db-id").val();var m=a(this).parent().siblings(".menu-item-object-id").val();var e=a(this).parent().siblings(".menu-item-object").val();var p=a(this).parent().siblings(".menu-item-append").val();var n=a(this).parent().siblings(".menu-item-parent-id").val();var f=a(this).parent().siblings(".menu-item-title").val();var o=a(this).parent().siblings(".menu-item-url").val();var k=a(this).parent().siblings(".menu-item-description").val();if(undefined==k){k=""}if(undefined==g){g=""}wpNavMenu.add_to_menu(d,m,e,j,p,n,f,o,k,g,h,i,l);a(this).attr("checked",false)})},get_hidden_inputs:function(l,b,m,c,h,n,d,o,j,g,f,e,k){var i="";i+='<input type="hidden" name="menu-item-db-id[]" value="'+b+'" />';i+='<input type="hidden" name="menu-item-object-id[]" value="'+m+'" />';i+='<input type="hidden" name="menu-item-object[]" value="'+c+'" />';i+='<input type="hidden" name="menu-item-type[]" value="'+h+'" />';i+='<input type="hidden" name="menu-item-parent-id[]" value="'+n+'" />';i+='<input type="hidden" name="menu-item-position[]" value="'+l+'" />';i+='<input type="hidden" name="menu-item-title[]" value="'+d+'" />';i+='<input type="hidden" name="menu-item-attr-title[]" value="'+g+'" />';i+='<input type="hidden" name="menu-item-url[]" value="'+o+'" />';i+='<input type="hidden" name="menu-item-target[]" value="'+f+'" />';i+='<input type="hidden" name="menu-item-description[]" value="'+j+'" />';i+='<input type="hidden" name="menu-item-classes[]" value="'+e+'" />';i+='<input type="hidden" name="menu-item-xfn[]" value="'+k+'" />';return i}};a(document).ready(function(b){wpNavMenu.init()})})(jQuery);
</del><span class="cx">\ No newline at end of file
</span><ins>+var wpNavMenu;(function(a){wpNavMenu={init:function(){wpNavMenu.initial_meta_boxes();wpNavMenu.drag_and_drop();a("#update-nav-menu .deletion").click(function(){if(confirm(navMenuL10n.warnDelete)){return true}else{return false}});a("#update-nav-menu").submit(function(){wpNavMenu.update_post_data()});a("#create-menu-name").keypress(function(b){if(13==b.keyCode){a("#create-menu-button").click();return false}});a("#custom-menu-item-url, #custom-menu-item-name").keypress(function(b){if(13==b.keyCode){a("#add-custom-links a.button").click();return false}}).focus(function(){if(a(this).val()==a(this).attr("defaultValue")&&a(this).attr("id")!="custom-menu-item-url"){a(this).val("")}}).blur(function(){if(a(this).val()==""){a(this).val(a(this).attr("defaultValue"))}});a("#create-menu-name").focus(function(){if(a(this).val()==a(this).attr("defaultValue")){a(this).val("")}}).blur(function(){if(a(this).val()==""){a(this).val(a(this).attr("defaultValue"))}});a(".if-js-closed").removeClass("if-js-closed").addClass("closed");postboxes.add_postbox_toggles("nav-menus");a(".quick-search").click(function(){a(this).attr("value","")});a(".quick-search-submit").click(function(){a(this).siblings(".quick-search").search()});a("#menu-container .item-edit").click(function(){wpNavMenu.edit_menu_item(a(this).attr("value"))});a("#menu-container .item-delete").click(function(){wpNavMenu.remove_menu_item(a(this).attr("value"))});a("#update-menu-item").click(function(){wpNavMenu.update_menu_item();tb_remove()});a("#cancel-save").click(function(){tb_remove()});a(".show-all").click(function(b){a(b.currentTarget).parent().parent().siblings(".list-wrap").css("display","block");a(b.currentTarget).parent().parent().siblings(".list-wrap").find("li").css("display","block");a(b.currentTarget).hide();a(b.currentTarget).siblings(".hide-all").show()});a(".hide-all").click(function(b){a(b.currentTarget).parent().parent().siblings(".list-wrap").css("display","none");a(b.currentTarget).parent().parent().siblings(".list-wrap").find("li").css("display","none");a(b.currentTarget).hide();a(b.currentTarget).siblings(".show-all").show()});a(".add-to-menu").click(function(b){wpNavMenu.add_checked_items_to_menu(b.currentTarget)});a("#add-custom-links .add-to-menu a").click(function(b){if(a("#custom-menu-item-url").val()==a("#custom-menu-item-url").attr("defaultValue")){return}wpNavMenu.add_custom_link(a("#custom-menu-item-name").val(),a("#custom-menu-item-url").val());a("#custom-menu-item-name").val(a("#custom-menu-item-name").attr("defaultValue"));a("#custom-menu-item-url").val(a("#custom-menu-item-url").attr("defaultValue")).focus()})},add_custom_link:function(c,b){var d={action:"save-custom-link",link_name:c,link_url:b};a.post(ajaxurl,d,function(e){if("-1"==e){return}wpNavMenu.add_to_menu(e,e,"custom","custom",navMenuL10n.custom,0,c,b,"","","_self","","")},"json")},initial_meta_boxes:function(){var c=a("#hidden-metaboxes").val().split(",");if(""!=c){for(var b=0;b<c.length;b++){a("#"+c[b]).attr("style","display: none;");a("#"+c[b]+"-hide").attr("checked",false)}}},drag_and_drop:function(){a(".menu li").each(function(){if(!a(this).children(".dropzone").attr("class")){a(this).prepend('<div class="dropzone"></div>')}});a(".menu li").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});a(".menu li dl, .menu li .dropzone").droppable({accept:".menu li",tolerance:"pointer",drop:function(h,g){var b=a(this).parent();var j=!a(this).hasClass("dropzone");var f=b.children("input[name=menu-item-object-id[]]").val();var i=g.draggable.children("input[name=menu-item-object-id[]]").val();if(f==i){g.draggable.find("dt").animate({backgroundColor:"#FF3333"},{duration:"normal",complete:function(){a(this).css("backgroundColor","")}});a(this).parent().find("dt").removeAttr("style");return}if(j&&b.children("ul").length==0){b.append('<ul class="sub-menu" />')}if(j){b.children("ul").append(g.draggable)}else{b.before(g.draggable)}b.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var d=g.draggable.attr("value");var c=b.attr("value");b.find("#menu-"+d).find("#parent"+d).val(c);a(this).parent().find("dt").removeAttr("style");a(this).parent().find("div:first").removeAttr("style")},over:function(b){if(a(this).attr("class")=="dropzone ui-droppable"){a(this).parent().find("div:first").css({background:"#f5f5f5",border:"1px dashed #bbb",margin:"10px 0px",height:"40px"})}else{if(a(this).attr("class")=="ui-droppable"){a(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}},out:function(){a(this).parent().find("dt").removeAttr("style");a(this).parent().find("div:first").removeAttr("style");a(this).filter(".dropzone").css({borderColor:""})}})},update_post_data:function(){var b=0;a(".menu li").each(function(){b=b+1;var d=a(this).attr("value");var e=a(this).children("input[name=menu-item-db-id[]]").val();a(this).attr("value",b);a(this).children("input[name=menu-item-position[]]").attr("value",b);var c=a(this).parent(".sub-menu").siblings("input[name=menu-item-object-id[]]").val();if(undefined==c){c=0}a(this).children("input[name=menu-item-parent-id[]]").attr("value",c);a("#li-count").attr("value",b)})},autocomplete:function(b){a("#add-"+b+" .quick-search").autocomplete(a("#add-"+b+" .autocomplete").val().split("|"));a("#add-"+b+" .quick-search").result(function(c,e,d){a("#add-"+b+" .list-wrap").css("display","block");a("#add-"+b+" .list-wrap li:contains('"+e+"')").css("display","block");a("#add-"+b+" .show-all").hide();a("#add-"+b+" .hide-all").show()})},edit_menu_item:function(b){var g=a("#menu-item-"+b).children("input[name=menu-item-type[]]").val();var c=a("#menu-item-"+b).children("input[name=menu-item-title[]]").val();var h=a("#menu-item-"+b).children("input[name=menu-item-url[]]").val();var d=a("#menu-item-"+b).children("input[name=menu-item-attr-title[]]").val();var e=a("#menu-item-"+b).children("input[name=menu-item-target[]]").val();var i=a("#menu-item-"+b).children("input[name=menu-item-description[]]").val();var f=a("#menu-item-"+b).children("input[name=menu-item-classes[]]").val();var j=a("#menu-item-"+b).children("input[name=menu-item-xfn[]]").val();if("custom"!=g){a("#edit-menu-item-url").attr("disabled","disabled")}a("#edit-menu-item-id").val(b);a("#edit-menu-item-title").val(c);a("#edit-menu-item-url").val(h);a("#edit-menu-item-attr-title").val(d);a("#edit-menu-item-target").val(e);a("#edit-menu-item-target option[value='"+e+"']").attr("selected","selected");a("#edit-menu-item-description").val(i);a("#edit-menu-item-classes").val(f);a("#edit-menu-item-xfn").val(j)},update_menu_item:function(){var i=a("#edit-menu-item-id").val();var g=a("#edit-menu-item-title").val();var c=a("#edit-menu-item-url").val();var h=a("#edit-menu-item-attr-title").val();var e=a("#edit-menu-item-target").val();var d=a("#edit-menu-item-description").val();var b=a("#edit-menu-item-classes").val();var f=a("#edit-menu-item-xfn").val();a(".menu #menu-item-"+i).find("span.item-title:first").html(g);a("#menu-item-"+i).children("input[name=menu-item-title[]]").val(g);a("#menu-item-"+i).children("input[name=menu-item-url[]]").val(c);a("#menu-item-"+i).children("input[name=menu-item-attr-title[]]").val(h);a("#menu-item-"+i).children("input[name=menu-item-target[]]").val(e);a("#menu-item-"+i).children("input[name=menu-item-description[]]").val(d);a("#menu-item-"+i).children("input[name=menu-item-classes[]]").val(b);a("#menu-item-"+i).children("input[name=menu-item-xfn[]]").val(f);a(".menu #menu-item-"+i+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){a(this).css("backgroundColor","")}})},remove_menu_item:function(c){var b=a("#menu-item-"+c);if(b){a(b).find("dt").each(function(){a(this).animate({backgroundColor:"#FF3333"},{duration:"normal",complete:function(){a(this).parent().parent().remove()}})})}},add_to_menu:function(b,m,c,h,p,n,d,o,j,g,f,e,k){var l=a(".menu li").length+1;var i=wpNavMenu.get_hidden_inputs(l,b,m,c,h,n,d,o,j,g,f,e,k);a(".menu").append('<li id="menu-item-'+l+'" value="'+l+'"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="item-title">'+d+'</span><span class="item-controls"><span class="item-type">'+p+'</span><a class="item-edit thickbox" id="edit'+l+'" value="'+l+'" onclick="wpNavMenu.edit_menu_item('+l+');" title="'+navMenuL10n.thickbox+'" href="#TB_inline?height=540&width=300&inlineId=menu-item-settings">'+navMenuL10n.edit+'</a> | <a class="item-delete" id="delete'+l+'" value="'+l+'" onclick="wpNavMenu.remove_menu_item('+l+');">Delete</a></span></dt></dl>'+i+"</li>");a(".menu #menu-item-"+l+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){a(this).css("backgroundColor","")}});wpNavMenu.drag_and_drop();tb_init("a.thickbox, area.thickbox, input.thickbox")},add_checked_items_to_menu:function(c){var b=a(c).parent().siblings(".list-wrap").find(":checked");if(0==b.length){return false}a(b).each(function(){var j=a(this).parent().siblings(".menu-item-type").val();if("custom"==j){var g=a(this).parent().siblings(".menu-item-attr-title").val();var h=a(this).parent().siblings(".menu-item-target").val();var i=a(this).parent().siblings(".menu-item-classes").val();var l=a(this).parent().siblings(".menu-item-xfn").val()}else{var g="";var h="_self";var i="";var l=""}var d=a(this).parent().siblings(".menu-item-db-id").val();var m=a(this).parent().siblings(".menu-item-object-id").val();var e=a(this).parent().siblings(".menu-item-object").val();var p=a(this).parent().siblings(".menu-item-append").val();var n=a(this).parent().siblings(".menu-item-parent-id").val();var f=a(this).parent().siblings(".menu-item-title").val();var o=a(this).parent().siblings(".menu-item-url").val();var k=a(this).parent().siblings(".menu-item-description").val();if(undefined==k){k=""}if(undefined==g){g=""}wpNavMenu.add_to_menu(d,m,e,j,p,n,f,o,k,g,h,i,l);a(this).attr("checked",false)})},get_hidden_inputs:function(l,b,m,c,h,n,d,o,j,g,f,e,k){var i="";i+='<input type="hidden" name="menu-item-db-id[]" value="'+b+'" />';i+='<input type="hidden" name="menu-item-object-id[]" value="'+m+'" />';i+='<input type="hidden" name="menu-item-object[]" value="'+c+'" />';i+='<input type="hidden" name="menu-item-type[]" value="'+h+'" />';i+='<input type="hidden" name="menu-item-parent-id[]" value="'+n+'" />';i+='<input type="hidden" name="menu-item-position[]" value="'+l+'" />';i+='<input type="hidden" name="menu-item-title[]" value="'+d+'" />';i+='<input type="hidden" name="menu-item-attr-title[]" value="'+g+'" />';i+='<input type="hidden" name="menu-item-url[]" value="'+o+'" />';i+='<input type="hidden" name="menu-item-target[]" value="'+f+'" />';i+='<input type="hidden" name="menu-item-description[]" value="'+j+'" />';i+='<input type="hidden" name="menu-item-classes[]" value="'+e+'" />';i+='<input type="hidden" name="menu-item-xfn[]" value="'+k+'" />';return i}};a(document).ready(function(b){wpNavMenu.init()})})(jQuery);
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>
</body>
</html>