<!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>[13365] trunk/wp-admin/js: Increment the menu ID so the first menu works.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13365">13365</a></dd>
<dt>Author</dt> <dd>markjaquith</dd>
<dt>Date</dt> <dd>2010-02-24 07:58:14 +0000 (Wed, 24 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Increment the menu ID so the first menu works. props junsuijin. fixes <a href="http://trac.wordpress.org/ticket/12339">#12339</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminjscustomnavigationdynamicfunctionsdevjs">trunk/wp-admin/js/custom-navigation-dynamic-functions.dev.js</a></li>
<li><a href="#trunkwpadminjscustomnavigationdynamicfunctionsjs">trunk/wp-admin/js/custom-navigation-dynamic-functions.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminjscustomnavigationdynamicfunctionsdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/custom-navigation-dynamic-functions.dev.js (13364 => 13365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/custom-navigation-dynamic-functions.dev.js        2010-02-24 07:52:48 UTC (rev 13364)
+++ trunk/wp-admin/js/custom-navigation-dynamic-functions.dev.js        2010-02-24 07:58:14 UTC (rev 13365)
</span><span class="lines">@@ -180,7 +180,7 @@
</span><span class="cx">                 inputdescription = '';
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        var count=document.getElementById('custom-nav').getElementsByTagName('li').length;
</del><ins>+        var count=document.getElementById('custom-nav').getElementsByTagName('li').length + 1;
</ins><span class="cx"> 
</span><span class="cx">         var randomnumber = count;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminjscustomnavigationdynamicfunctionsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/custom-navigation-dynamic-functions.js (13364 => 13365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/custom-navigation-dynamic-functions.js        2010-02-24 07:52:48 UTC (rev 13364)
+++ trunk/wp-admin/js/custom-navigation-dynamic-functions.js        2010-02-24 07:58:14 UTC (rev 13365)
</span><span class="lines">@@ -1 +1 @@
</span><del>-function removeitem(c){var b=document.getElementById(&quot;menu-&quot;+c);if(b){var a=document.getElementById(&quot;menu-&quot;+c).parentNode;throwaway_node=a.removeChild(b)}updatepostdata()}function edititem(a){itemTitle=jQuery(&quot;#title&quot;+a).attr(&quot;value&quot;);itemURL=jQuery(&quot;#linkurl&quot;+a).attr(&quot;value&quot;);itemAnchorTitle=jQuery(&quot;#anchortitle&quot;+a).attr(&quot;value&quot;);itemNewWindow=jQuery(&quot;#newwindow&quot;+a).attr(&quot;value&quot;);itemDesc=jQuery(&quot;#description&quot;+a).attr(&quot;value&quot;);jQuery(&quot;#dialog-confirm&quot;).dialog(&quot;option&quot;,&quot;itemID&quot;,a);jQuery(&quot;#dialog-confirm&quot;).dialog(&quot;open&quot;);jQuery(&quot;#edittitle&quot;).attr(&quot;value&quot;,itemTitle);jQuery(&quot;#editlink&quot;).attr(&quot;value&quot;,itemURL);jQuery(&quot;#editanchortitle&quot;).attr(&quot;value&quot;,itemAnchorTitle);jQuery(&quot;#editnewwindow option[value='&quot;+itemNewWindow+&quot;']&quot;).attr(&quot;selected&quot;,&quot;selected&quot;);jQuery(&quot;#editdescription&quot;).attr(&quot;value&quot;,itemDesc)}function updatepostdata(){var a=0;jQuery(&quot;#custom-nav&quot;).find(&quot;li&quot;).each(function(c){c=c+1;var b=jQuery(this).attr(&quot;value&quot;);jQuery(this).find(&quot;#position&quot;+b).attr(&quot;value&quot;,c);jQuery(this).attr(&quot;id&quot;,&quot;menu-&quot;+c);jQuery(this).attr(&quot;value&quot;,c);jQuery(this).find(&quot;#dbid&quot;+b).attr(&quot;name&quot;,&quot;dbid&quot;+c);jQuery(this).find(&quot;#dbid&quot;+b).attr(&quot;id&quot;,&quot;dbid&quot;+c);jQuery(this).find(&quot;#postmenu&quot;+b).attr(&quot;name&quot;,&quot;postmenu&quot;+c);jQuery(this).find(&quot;#postmenu&quot;+b).attr(&quot;id&quot;,&quot;postmenu&quot;+c);var d=jQuery(this).find(&quot;#parent&quot;+b).parent().parent().parent().attr(&quot;value&quot;);jQuery(this).find(&quot;#parent&quot;+b).attr(&quot;name&quot;,&quot;parent&quot;+c);jQuery(this).find(&quot;#parent&quot;+b).attr(&quot;id&quot;,&quot;parent&quot;+c);if(d){}else{d=0}jQuery(this).find(&quot;#parent&quot;+b).attr(&quot;value&quot;,d);jQuery(this).find(&quot;#title&quot;+b).attr(&quot;name&quot;,&quot;title&quot;+c);jQuery(this).find(&quot;#title&quot;+b).attr(&quot;id&quot;,&quot;title&quot;+c);jQuery(this).find(&quot;#linkurl&quot;+b).attr(&quot;name&quot;,&quot;linkurl&quot;+c);jQuery(this).find(&quot;#linkurl&quot;+b).attr(&quot;id&quot;,&quot;linkurl&quot;+c);jQuery(this).find(&quot;#description&quot;+b).attr(&quot;name&quot;,&quot;description&quot;+c);jQuery(this).find(&quot;#description&quot;+b).attr(&quot;id&quot;,&quot;description&quot;+c);jQuery(this).find(&quot;#icon&quot;+b).attr(&quot;name&quot;,&quot;icon&quot;+c);jQuery(this).find(&quot;#icon&quot;+b).attr(&quot;id&quot;,&quot;icon&quot;+c);jQuery(this).find(&quot;#position&quot;+b).attr(&quot;name&quot;,&quot;position&quot;+c);jQuery(this).find(&quot;#position&quot;+b).attr(&quot;id&quot;,&quot;position&quot;+c);jQuery(this).find(&quot;#linktype&quot;+b).attr(&quot;name&quot;,&quot;linktype&quot;+c);jQuery(this).find(&quot;#linktype&quot;+b).attr(&quot;id&quot;,&quot;linktype&quot;+c);jQuery(this).find(&quot;#anchortitle&quot;+b).attr(&quot;name&quot;,&quot;anchortitle&quot;+c);jQuery(this).find(&quot;#anchortitle&quot;+b).attr(&quot;id&quot;,&quot;anchortitle&quot;+c);jQuery(this).find(&quot;#newwindow&quot;+b).attr(&quot;name&quot;,&quot;newwindow&quot;+c);jQuery(this).find(&quot;#newwindow&quot;+b).attr(&quot;id&quot;,&quot;newwindow&quot;+c);jQuery(this).find(&quot;dl &gt; dt &gt; span &gt; #remove&quot;+b).attr(&quot;value&quot;,c);jQuery(this).find(&quot;dl &gt; dt &gt; span &gt; #remove&quot;+b).attr(&quot;onClick&quot;,&quot;removeitem(&quot;+c+&quot;)&quot;);jQuery(this).find(&quot;dl &gt; dt &gt; span &gt; #remove&quot;+b).attr(&quot;id&quot;,&quot;remove&quot;+c);jQuery(&quot;#licount&quot;).attr(&quot;value&quot;,c)})}function appendToList(b,s,d,n,h,l,e){var k=&quot;&quot;;var c=&quot;&quot;;var r=&quot;&quot;;var o=&quot;&quot;;var i=&quot;&quot;;var a=&quot;&quot;;if(s==&quot;Custom&quot;){k=document.getElementById(&quot;custom_menu_item_name&quot;).value;c=document.getElementById(&quot;custom_menu_item_url&quot;).value;r=&quot;&quot;;o=&quot;&quot;;inputlinktype=&quot;custom&quot;;i=document.getElementById(&quot;custom_menu_item_description&quot;).value}else{if(s==&quot;Page&quot;){k=htmlentities(d.toString());c=n.toString();r=h.toString();o=&quot;0&quot;;inputlinktype=&quot;page&quot;;i=htmlentities(e.toString())}else{if(s==&quot;Category&quot;){k=htmlentities(d.toString());c=n.toString();r=h.toString();o=&quot;0&quot;;inputlinktype=&quot;category&quot;;i=htmlentities(e.toString())}else{k=&quot;&quot;;k=&quot;&quot;;r=&quot;&quot;;o=&quot;&quot;;inputlinktype=&quot;custom&quot;;i=&quot;&quot;}}}var g=document.getElementById(&quot;custom-nav&quot;).getElementsByTagName(&quot;li&quot;).length;var p=g;var m=0;try{var q=document.getElementById(&quot;menu-&quot;+p.toString()).value}catch(f){m=1}while(m==0){p=p+1;try{var j=document.getElementById(&quot;menu-&quot;+p.toString()).value}catch(f){m=1}}jQuery(&quot;.maintitle&quot;).after('&lt;div id=&quot;message&quot; class=&quot;updated fade below-h2&quot;&gt;&lt;p&gt;Menu Item added!&lt;/p&gt;&lt;/div&gt;');jQuery(&quot;#message&quot;).animate({opacity:1},2000).fadeOut(300,function(){jQuery(this).remove()});jQuery(&quot;#custom-nav&quot;).append('&lt;li id=&quot;menu-'+p+'&quot; value=&quot;'+p+'&quot;&gt;&lt;div class=&quot;dropzone ui-droppable&quot;&gt;&lt;/div&gt;&lt;dl class=&quot;ui-droppable&quot;&gt;&lt;dt&gt;&lt;span class=&quot;title&quot;&gt;'+k+'&lt;/span&gt;&lt;span class=&quot;controls&quot;&gt;&lt;span class=&quot;type&quot;&gt;'+s+'&lt;/span&gt;&lt;a id=&quot;edit'+p+'&quot; onclick=&quot;edititem('+p+')&quot; value=&quot;'+p+'&quot;&gt;&lt;img class=&quot;edit&quot; alt=&quot;Edit Menu Item&quot; title=&quot;Edit Menu Item&quot; src=&quot;'+b+'/wp-admin/images/ico-edit.png&quot; /&gt;&lt;/a&gt; &lt;a id=&quot;remove'+p+'&quot; onclick=&quot;removeitem('+p+')&quot; value=&quot;'+p+'&quot;&gt;&lt;img class=&quot;remove&quot; alt=&quot;Remove from Custom Menu&quot; title=&quot;Remove from Custom Menu&quot; src=&quot;'+b+'/wp-admin/images/ico-close.png&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;'+c+'&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;View Custom Link&quot; title=&quot;View Custom Link&quot; src=&quot;'+b+'/wp-admin/images/ico-viewpage.png&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/dt&gt;&lt;/dl&gt;&lt;a class=&quot;hide&quot; href=&quot;'+c+'&quot;&gt;'+k+'&lt;/a&gt;&lt;input type=&quot;hidden&quot; name=&quot;postmenu'+p+'&quot; id=&quot;postmenu'+p+'&quot; value=&quot;'+r+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;parent'+p+'&quot; id=&quot;parent'+p+'&quot; value=&quot;'+o+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;title'+p+'&quot; id=&quot;title'+p+'&quot; value=&quot;'+k+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;linkurl'+p+'&quot; id=&quot;linkurl'+p+'&quot; value=&quot;'+c+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;description'+p+'&quot; id=&quot;description'+p+'&quot; value=&quot;'+i+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;icon'+p+'&quot; id=&quot;icon'+p+'&quot; value=&quot;'+a+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;position'+p+'&quot; id=&quot;position'+p+'&quot; value=&quot;'+p+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;linktype'+p+'&quot; id=&quot;linktype'+p+'&quot; value=&quot;'+inputlinktype+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;anchortitle'+p+'&quot; id=&quot;anchortitle'+p+'&quot; value=&quot;'+k+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;newwindow'+p+'&quot; id=&quot;newwindow'+p+'&quot; value=&quot;0&quot; /&gt;&lt;/li&gt;');jQuery(&quot;#menu-&quot;+p+&quot;&quot;).draggable({handle:&quot; &gt; dl&quot;,opacity:0.8,addClasses:false,helper:&quot;clone&quot;,zIndex:100});jQuery(&quot;#menu-&quot;+p+&quot; dl, #menu-&quot;+p+&quot; .dropzone&quot;).droppable({accept:&quot;#&quot;+p+&quot;, #custom-nav li&quot;,tolerance:&quot;pointer&quot;,drop:function(x,w){var t=jQuery(this).parent();var y=!jQuery(this).hasClass(&quot;dropzone&quot;);if(y&amp;&amp;t.children(&quot;ul&quot;).length==0){t.append(&quot;&lt;ul/&gt;&quot;)}if(y){t.children(&quot;ul&quot;).append(w.draggable)}else{t.before(w.draggable)}t.find(&quot;dl,.dropzone&quot;).css({backgroundColor:&quot;&quot;,borderColor:&quot;&quot;});var v=w.draggable.attr(&quot;value&quot;);var u=t.attr(&quot;value&quot;);t.find(&quot;#menu-&quot;+v).find(&quot;#parent&quot;+v).val(u);jQuery(this).parent().find(&quot;dt&quot;).removeAttr(&quot;style&quot;);jQuery(this).parent().find(&quot;div:first&quot;).removeAttr(&quot;style&quot;)},over:function(){if(jQuery(this).attr(&quot;class&quot;)==&quot;dropzone ui-droppable&quot;){jQuery(this).parent().find(&quot;div:first&quot;).css(&quot;background&quot;,&quot;none&quot;).css(&quot;height&quot;,&quot;50px&quot;)}else{if(jQuery(this).attr(&quot;class&quot;)==&quot;ui-droppable&quot;){jQuery(this).parent().find(&quot;dt:first&quot;).css(&quot;background&quot;,&quot;#d8d8d8&quot;)}else{}}var t=jQuery(this).parent().attr(&quot;id&quot;)},out:function(){jQuery(this).parent().find(&quot;dt&quot;).removeAttr(&quot;style&quot;);jQuery(this).parent().find(&quot;div:first&quot;).removeAttr(&quot;style&quot;);jQuery(this).filter(&quot;.dropzone&quot;).css({borderColor:&quot;&quot;})}});updatepostdata()};
</del><span class="cx">\ No newline at end of file
</span><ins>+function removeitem(o){var todelete=document.getElementById(&quot;menu-&quot;+o);if(todelete){var parenttodelete=document.getElementById(&quot;menu-&quot;+o).parentNode;throwaway_node=parenttodelete.removeChild(todelete)}updatepostdata()}function edititem(o){itemTitle=jQuery(&quot;#title&quot;+o).attr(&quot;value&quot;);itemURL=jQuery(&quot;#linkurl&quot;+o).attr(&quot;value&quot;);itemAnchorTitle=jQuery(&quot;#anchortitle&quot;+o).attr(&quot;value&quot;);itemNewWindow=jQuery(&quot;#newwindow&quot;+o).attr(&quot;value&quot;);itemDesc=jQuery(&quot;#description&quot;+o).attr(&quot;value&quot;);jQuery(&quot;#dialog-confirm&quot;).dialog(&quot;option&quot;,&quot;itemID&quot;,o);jQuery(&quot;#dialog-confirm&quot;).dialog(&quot;open&quot;);jQuery(&quot;#edittitle&quot;).attr(&quot;value&quot;,itemTitle);jQuery(&quot;#editlink&quot;).attr(&quot;value&quot;,itemURL);jQuery(&quot;#editanchortitle&quot;).attr(&quot;value&quot;,itemAnchorTitle);jQuery(&quot;#editnewwindow option[value='&quot;+itemNewWindow+&quot;']&quot;).attr(&quot;selected&quot;,&quot;selected&quot;);jQuery(&quot;#editdescription&quot;).attr(&quot;value&quot;,itemDesc)}function updatepostdata(){var i=0;jQuery(&quot;#custom-nav&quot;).find(&quot;li&quot;).each(function(i){i=i+1;var j=jQuery(this).attr(&quot;value&quot;);jQuery(this).find(&quot;#position&quot;+j).attr(&quot;value&quot;,i);jQuery(this).attr(&quot;id&quot;,&quot;menu-&quot;+i);jQuery(this).attr(&quot;value&quot;,i);jQuery(this).find(&quot;#dbid&quot;+j).attr(&quot;name&quot;,&quot;dbid&quot;+i);jQuery(this).find(&quot;#dbid&quot;+j).attr(&quot;id&quot;,&quot;dbid&quot;+i);jQuery(this).find(&quot;#postmenu&quot;+j).attr(&quot;name&quot;,&quot;postmenu&quot;+i);jQuery(this).find(&quot;#postmenu&quot;+j).attr(&quot;id&quot;,&quot;postmenu&quot;+i);var p=jQuery(this).find(&quot;#parent&quot;+j).parent().parent().parent().attr(&quot;value&quot;);jQuery(this).find(&quot;#parent&quot;+j).attr(&quot;name&quot;,&quot;parent&quot;+i);jQuery(this).find(&quot;#parent&quot;+j).attr(&quot;id&quot;,&quot;parent&quot;+i);if(p){}else{p=0}jQuery(this).find(&quot;#parent&quot;+j).attr(&quot;value&quot;,p);jQuery(this).find(&quot;#title&quot;+j).attr(&quot;name&quot;,&quot;title&quot;+i);jQuery(this).find(&quot;#title&quot;+j).attr(&quot;id&quot;,&quot;title&quot;+i);jQuery(this).find(&quot;#linkurl&quot;+j).attr(&quot;name&quot;,&quot;linkurl&quot;+i);jQuery(this).find(&quot;#linkurl&quot;+j).attr(&quot;id&quot;,&quot;linkurl&quot;+i);jQuery(this).find(&quot;#description&quot;+j).attr(&quot;name&quot;,&quot;description&quot;+i);jQuery(this).find(&quot;#description&quot;+j).attr(&quot;id&quot;,&quot;description&quot;+i);jQuery(this).find(&quot;#icon&quot;+j).attr(&quot;name&quot;,&quot;icon&quot;+i);jQuery(this).find(&quot;#icon&quot;+j).attr(&quot;id&quot;,&quot;icon&quot;+i);jQuery(this).find(&quot;#position&quot;+j).attr(&quot;name&quot;,&quot;position&quot;+i);jQuery(this).find(&quot;#position&quot;+j).attr(&quot;id&quot;,&quot;position&quot;+i);jQuery(this).find(&quot;#linktype&quot;+j).attr(&quot;name&quot;,&quot;linktype&quot;+i);jQuery(this).find(&quot;#linktype&quot;+j).attr(&quot;id&quot;,&quot;linktype&quot;+i);jQuery(this).find(&quot;#anchortitle&quot;+j).attr(&quot;name&quot;,&quot;anchortitle&quot;+i);jQuery(this).find(&quot;#anchortitle&quot;+j).attr(&quot;id&quot;,&quot;anchortitle&quot;+i);jQuery(this).find(&quot;#newwindow&quot;+j).attr(&quot;name&quot;,&quot;newwindow&quot;+i);jQuery(this).find(&quot;#newwindow&quot;+j).attr(&quot;id&quot;,&quot;newwindow&quot;+i);jQuery(this).find(&quot;dl &gt; dt &gt; span &gt; #remove&quot;+j).attr(&quot;value&quot;,i);jQuery(this).find(&quot;dl &gt; dt &gt; span &gt; #remove&quot;+j).attr(&quot;onClick&quot;,&quot;removeitem(&quot;+i+&quot;)&quot;);jQuery(this).find(&quot;dl &gt; dt &gt; span &gt; #remove&quot;+j).attr(&quot;id&quot;,&quot;remove&quot;+i);jQuery(&quot;#licount&quot;).attr(&quot;value&quot;,i)})}function appendToList(templatedir,additemtype,itemtext,itemurl,itemid,itemparentid,itemdescription){var inputvaluevarname=&quot;&quot;;var inputvaluevarurl=&quot;&quot;;var inputitemid=&quot;&quot;;var inputparentid=&quot;&quot;;var inputdescription=&quot;&quot;;var inputicon=&quot;&quot;;if(additemtype==&quot;Custom&quot;){inputvaluevarname=document.getElementById(&quot;custom_menu_item_name&quot;).value;inputvaluevarurl=document.getElementById(&quot;custom_menu_item_url&quot;).value;inputitemid=&quot;&quot;;inputparentid=&quot;&quot;;inputlinktype=&quot;custom&quot;;inputdescription=document.getElementById(&quot;custom_menu_item_description&quot;).value}else{if(additemtype==&quot;Page&quot;){inputvaluevarname=htmlentities(itemtext.toString());inputvaluevarurl=itemurl.toString();inputitemid=itemid.toString();inputparentid=&quot;0&quot;;inputlinktype=&quot;page&quot;;inputdescription=htmlentities(itemdescription.toString())}else{if(additemtype==&quot;Category&quot;){inputvaluevarname=htmlentities(itemtext.toString());inputvaluevarurl=itemurl.toString();inputitemid=itemid.toString();inputparentid=&quot;0&quot;;inputlinktype=&quot;category&quot;;inputdescription=htmlentities(itemdescription.toString())}else{inputvaluevarname=&quot;&quot;;inputvaluevarname=&quot;&quot;;inputitemid=&quot;&quot;;inputparentid=&quot;&quot;;inputlinktype=&quot;custom&quot;;inputdescription=&quot;&quot;}}}var count=document.getElementById(&quot;custom-nav&quot;).getElementsByTagName(&quot;li&quot;).length+1;var randomnumber=count;var validatetest=0;try{var test=document.getElementById(&quot;menu-&quot;+randomnumber.toString()).value}catch(err){validatetest=1}while(validatetest==0){randomnumber=randomnumber+1;try{var test2=document.getElementById(&quot;menu-&quot;+randomnumber.toString()).value}catch(err){validatetest=1}}jQuery(&quot;.maintitle&quot;).after('&lt;div id=&quot;message&quot; class=&quot;updated fade below-h2&quot;&gt;&lt;p&gt;Menu Item added!&lt;/p&gt;&lt;/div&gt;');jQuery(&quot;#message&quot;).animate({opacity:1},2000).fadeOut(300,function(){jQuery(this).remove()});jQuery(&quot;#custom-nav&quot;).append('&lt;li id=&quot;menu-'+randomnumber+'&quot; value=&quot;'+randomnumber+'&quot;&gt;&lt;div class=&quot;dropzone ui-droppable&quot;&gt;&lt;/div&gt;&lt;dl class=&quot;ui-droppable&quot;&gt;&lt;dt&gt;&lt;span class=&quot;title&quot;&gt;'+inputvaluevarname+'&lt;/span&gt;&lt;span class=&quot;controls&quot;&gt;&lt;span class=&quot;type&quot;&gt;'+additemtype+'&lt;/span&gt;&lt;a id=&quot;edit'+randomnumber+'&quot; onclick=&quot;edititem('+randomnumber+')&quot; value=&quot;'+randomnumber+'&quot;&gt;&lt;img class=&quot;edit&quot; alt=&quot;Edit Menu Item&quot; title=&quot;Edit Menu Item&quot; src=&quot;'+templatedir+'/wp-admin/images/ico-edit.png&quot; /&gt;&lt;/a&gt; &lt;a id=&quot;remove'+randomnumber+'&quot; onclick=&quot;removeitem('+randomnumber+')&quot; value=&quot;'+randomnumber+'&quot;&gt;&lt;img class=&quot;remove&quot; alt=&quot;Remove from Custom Menu&quot; title=&quot;Remove from Custom Menu&quot; src=&quot;'+templatedir+'/wp-admin/images/ico-close.png&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;'+inputvaluevarurl+'&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;View Custom Link&quot; title=&quot;View Custom Link&quot; src=&quot;'+templatedir+'/wp-admin/images/ico-viewpage.png&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/dt&gt;&lt;/dl&gt;&lt;a class=&quot;hide&quot; href=&quot;'+inputvaluevarurl+'&quot;&gt;'+inputvaluevarname+'&lt;/a&gt;&lt;input type=&quot;hidden&quot; name=&quot;postmenu'+randomnumber+'&quot; id=&quot;postmenu'+randomnumber+'&quot; value=&quot;'+inputitemid+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;parent'+randomnumber+'&quot; id=&quot;parent'+randomnumber+'&quot; value=&quot;'+inputparentid+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;title'+randomnumber+'&quot; id=&quot;title'+randomnumber+'&quot; value=&quot;'+inputvaluevarname+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;linkurl'+randomnumber+'&quot; id=&quot;linkurl'+randomnumber+'&quot; value=&quot;'+inputvaluevarurl+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;description'+randomnumber+'&quot; id=&quot;description'+randomnumber+'&quot; value=&quot;'+inputdescription+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;icon'+randomnumber+'&quot; id=&quot;icon'+randomnumber+'&quot; value=&quot;'+inputicon+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;position'+randomnumber+'&quot; id=&quot;position'+randomnumber+'&quot; value=&quot;'+randomnumber+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;linktype'+randomnumber+'&quot; id=&quot;linktype'+randomnumber+'&quot; value=&quot;'+inputlinktype+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;anchortitle'+randomnumber+'&quot; id=&quot;anchortitle'+randomnumber+'&quot; value=&quot;'+inputvaluevarname+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;newwindow'+randomnumber+'&quot; id=&quot;newwindow'+randomnumber+'&quot; value=&quot;0&quot; /&gt;&lt;/li&gt;');jQuery(&quot;#menu-&quot;+randomnumber+&quot;&quot;).draggable({handle:&quot; &gt; dl&quot;,opacity:0.8,addClasses:false,helper:&quot;clone&quot;,zIndex:100});jQuery(&quot;#menu-&quot;+randomnumber+&quot; dl, #menu-&quot;+randomnumber+&quot; .dropzone&quot;).droppable({accept:&quot;#&quot;+randomnumber+&quot;, #custom-nav li&quot;,tolerance:&quot;pointer&quot;,drop:function(e,ui){var li=jQuery(this).parent();var child=!jQuery(this).hasClass(&quot;dropzone&quot;);if(child&amp;&amp;li.children(&quot;ul&quot;).length==0){li.append(&quot;&lt;ul/&gt;&quot;)}if(child){li.children(&quot;ul&quot;).append(ui.draggable)}else{li.before(ui.draggable)}li.find(&quot;dl,.dropzone&quot;).css({backgroundColor:&quot;&quot;,borderColor:&quot;&quot;});var draggablevalue=ui.draggable.attr(&quot;value&quot;);var droppablevalue=li.attr(&quot;value&quot;);li.find(&quot;#menu-&quot;+draggablevalue).find(&quot;#parent&quot;+draggablevalue).val(droppablevalue);jQuery(this).parent().find(&quot;dt&quot;).removeAttr(&quot;style&quot;);jQuery(this).parent().find(&quot;div:first&quot;).removeAttr(&quot;style&quot;)},over:function(){if(jQuery(this).attr(&quot;class&quot;)==&quot;dropzone ui-droppable&quot;){jQuery(this).parent().find(&quot;div:first&quot;).css(&quot;background&quot;,&quot;none&quot;).css(&quot;height&quot;,&quot;50px&quot;)}else{if(jQuery(this).attr(&quot;class&quot;)==&quot;ui-droppable&quot;){jQuery(this).parent().find(&quot;dt:first&quot;).css(&quot;background&quot;,&quot;#d8d8d8&quot;)}else{}}var parentid=jQuery(this).parent().attr(&quot;id&quot;)},out:function(){jQuery(this).parent().find(&quot;dt&quot;).removeAttr(&quot;style&quot;);jQuery(this).parent().find(&quot;div:first&quot;).removeAttr(&quot;style&quot;);jQuery(this).filter(&quot;.dropzone&quot;).css({borderColor:&quot;&quot;})}});updatepostdata()};
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>