WordPress/wp-admin/js/custom-navigation-default-items.js
2010-02-20 23:58:00 +00:00

1 line
2.4 KiB
JavaScript

jQuery(function(a){a("#dialog-confirm").dialog({autoOpen:false,resizable:false,height:210,width:400,modal:true,buttons:{Save:function(){titletosave=a("#edittitle").attr("value");linktosave=a("#editlink").attr("value");anchortitletosave=a("#editanchortitle").attr("value");newwindowtosave=a("#editnewwindow").attr("value");desctosave=a("#editdescription").attr("value");a("#title"+a(this).dialog("option","itemID")).attr("value",titletosave);a("#linkurl"+a(this).dialog("option","itemID")).attr("value",linktosave);a("#anchortitle"+a(this).dialog("option","itemID")).attr("value",anchortitletosave);a("#newwindow"+a(this).dialog("option","itemID")).attr("value",newwindowtosave);a("#description"+a(this).dialog("option","itemID")).attr("value",desctosave);a("#menu-"+a(this).dialog("option","itemID")+" > dl > dt > span.title").text(titletosave);a("#view"+ +a(this).dialog("option","itemID")).attr("href",linktosave);a(this).dialog("close")},Cancel:function(){a(this).dialog("close")}}});a("#message").animate({opacity:1},2000).fadeOut(300,function(){a(this).remove()});a("#custom-nav li").prepend('<div class="dropzone"></div>');a("#custom-nav li").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});a("#custom-nav dl, #custom-nav .dropzone").droppable({accept:"#custom-nav 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 id="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(){if(a(this).attr("class")=="dropzone ui-droppable"){a(this).parent().find("div:first").css("background","none").css("height","50px")}else{if(a(this).attr("class")=="ui-droppable"){a(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}var b=a(this).parent().attr("id")},out:function(){a(this).parent().find("dt").removeAttr("style");a(this).parent().find("div:first").removeAttr("style");a(this).filter(".dropzone").css({borderColor:""})},deactivate:function(){}});a("#save_top").click(function(){updatepostdata()});a("#save_bottom").click(function(){updatepostdata()})});