WordPress/wp-admin/js/custom-navigation-dynamic-functions.js

1 line
6.4 KiB
JavaScript
Raw Normal View History

function removeitem(c){var b=document.getElementById("menu-"+c);if(b){var a=document.getElementById("menu-"+c).parentNode;throwaway_node=a.removeChild(b)}updatepostdata()}function edititem(a){itemTitle=jQuery("#title"+a).attr("value");itemURL=jQuery("#linkurl"+a).attr("value");itemAnchorTitle=jQuery("#anchortitle"+a).attr("value");itemNewWindow=jQuery("#newwindow"+a).attr("value");itemDesc=jQuery("#description"+a).attr("value");jQuery("#dialog-confirm").dialog("option","itemID",a);jQuery("#dialog-confirm").dialog("open");jQuery("#edittitle").attr("value",itemTitle);jQuery("#editlink").attr("value",itemURL);jQuery("#editanchortitle").attr("value",itemAnchorTitle);jQuery("#editnewwindow option[value='"+itemNewWindow+"']").attr("selected","selected");jQuery("#editdescription").attr("value",itemDesc)}function updatepostdata(){var a=0;jQuery("#custom-nav").find("li").each(function(c){c=c+1;var b=jQuery(this).attr("value");jQuery(this).find("#position"+b).attr("value",c);jQuery(this).attr("id","menu-"+c);jQuery(this).attr("value",c);jQuery(this).find("#dbid"+b).attr("name","dbid"+c);jQuery(this).find("#dbid"+b).attr("id","dbid"+c);jQuery(this).find("#postmenu"+b).attr("name","postmenu"+c);jQuery(this).find("#postmenu"+b).attr("id","postmenu"+c);var d=jQuery(this).find("#parent"+b).parent().parent().parent().attr("value");jQuery(this).find("#parent"+b).attr("name","parent"+c);jQuery(this).find("#parent"+b).attr("id","parent"+c);if(d){}else{d=0}jQuery(this).find("#parent"+b).attr("value",d);jQuery(this).find("#title"+b).attr("name","title"+c);jQuery(this).find("#title"+b).attr("id","title"+c);jQuery(this).find("#linkurl"+b).attr("name","linkurl"+c);jQuery(this).find("#linkurl"+b).attr("id","linkurl"+c);jQuery(this).find("#description"+b).attr("name","description"+c);jQuery(this).find("#description"+b).attr("id","description"+c);jQuery(this).find("#icon"+b).attr("name","icon"+c);jQuery(this).find("#icon"+b).attr("id","icon"+c);jQuery(this).find("#position"+b).attr("name","position"+c);jQuery(this).find("#position"+b).attr("id","position"+c);jQuery(this).find("#linktype"+b).attr("name","linktype"+c);jQuery(this).find("#linktype"+b).attr("id","linktype"+c);jQuery(this).find("#anchortitle"+b).attr("name","anchortitle"+c);jQuery(this).find("#anchortitle"+b).attr("id","anchortitle"+c);jQuery(this).find("#newwindow"+b).attr("name","newwindow"+c);jQuery(this).find("#newwindow"+b).attr("id","newwindow"+c);jQuery(this).find("dl > dt > span > #remove"+b).attr("value",c);jQuery(this).find("dl > dt > span > #remove"+b).attr("onClick","removeitem("+c+")");jQuery(this).find("dl > dt > span > #remove"+b).attr("id","remove"+c);jQuery("#li-count").attr("value",c)})}function appendToList(b,s,d,n,h,l,e){var k="";var c="";var r="";var o="";var i="";var a="";if(s==navMenuL10n.custom){k=document.getElementById("custom-menu-item-name").value;c=document.getElementById("custom-menu-item-url").value;r="";o="";inputlinktype="custom";i=""}else{if(s==navMenuL10n.page){k=htmlentities(d.toString());c=n.toString();r=h.toString();o="0";inputlinktype="page";i=htmlentities(e.toString())}else{if(s==navMenuL10n.category){k=htmlentities(d.toString());c=n.toString();r=h.toString();o="0";inputlinktype="category";i=htmlentities(e.toString())}else{k="";k="";r="";o="";inputlinktype="custom";i=""}}}var g=document.getElementById("custom-nav").getElementsByTagName("li").length+1;var p=g;var m=0;try{var q=document.getElementById("menu-"+p.toString()).value}catch(f){m=1}while(m==0){p=p+1;try{var j=document.getElementById("menu-"+p.toString()).value}catch(f){m=1}}jQuery(".maintitle").after('<div id="message" class="updated fade below-h2"><p>Menu Item added!</p></div>');jQuery("#message").animate({opacity:1},2000).fadeOut(300,function(){jQuery(this).remove()});jQuery("#custom-nav").append('<li id="menu-'+p+'" value="'+p+'"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="title">'+k+'</span><span class="controls"><span class="type">'+s+'</span><a id="edit'+p+'" onclick="edititem('+p+')" value="'+p+'"><img class="edit" alt="Edit Menu Item" title=