Wordpress/wp-admin/js/nav-menu-default-items.js
2010-02-28 20:00:49 +00:00

1 line
2.6 KiB
JavaScript

jQuery(document).ready(function($){wp_drag_and_drop();wp_update_post_data();$("#save_menu").click(function(){return wp_update_post_data()});$(".quick-search").click(function(){$(this).attr("value","")});$(".quick-search-submit").click(function(){$(this).siblings(".quick-search").search()});$("#menu-container .item-edit").click(function(){return wp_edit_menu_item($(this).attr("value"))});$("#menu-container .item-delete").live("click",function(){return wp_remove_menu_item($(this).attr("value"))});$("#update-menu-item").click(function(){wp_update_menu_item();tb_remove();var id=$("#edit-item-id").val();$("#menu-"+id+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}})});$("#cancel-save").click(function(){return tb_remove()});$(".show-all").click(function(){$(this).offsetParent().find("#add-buttons-actions").attr("style","margin-bottom: 10px;");$(this).offsetParent().find(".list-wrap").css("display","block");$(this).siblings(".quick-search").attr("value","");$(this).offsetParent().find(".list-wrap li").css("display","block");$(this).hide();$(this).siblings(".hide-all").show()});$(".hide-all").click(function(){$(this).offsetParent().find("#add-buttons-actions").attr("style","margin-bottom: 0px;");$(this).offsetParent().find(".list-wrap").css("display","none");$(this).siblings(".quick-search").attr("value","Search");$(this).offsetParent().find(".list-wrap li").css("display","none");$(this).hide();$(this).siblings(".show-all").show()});$(".list input").click(function(){var item_type=jQuery(this).parent().siblings(".item-type").val();var item_title=jQuery(this).parent().siblings(".item-title").val();var item_url=jQuery(this).parent().siblings(".item-url").val();var item_id=jQuery(this).parent().siblings(".item-id").val();var item_parent_id=jQuery(this).parent().siblings(".item-parent-id").val();var item_description=jQuery(this).parent().siblings(".item-description").val();return wp_update_queue($(this),item_type,item_title,item_url,item_id,item_parent_id,item_description)});$(".enqueue a").click(function(){return wp_add_queued_items_to_menu(this)});$("#add-custom-link .add-to-menu a").click(function(){var link_url=$(this).offsetParent().find("#menu-item-url").val();var link_name=$(this).offsetParent().find("#menu-item-name").val();wp_add_queued_items_to_menu(this);if("http://"==link_url||"Menu Item"==link_name){return}params={action:"add-menu-link",link_url:link_url,link_name:link_name,};$.post(ajaxurl,params,function(response){if(null==response||"-1"==response){return false}params.link_id=response;wp_add_item_to_menu("Custom",params.link_name,params.link_url,params.link_id,0,"")},"json")})});