Make js noConflict compat. see #11817
git-svn-id: http://svn.automattic.com/wordpress/trunk@13266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d49599feb9
commit
28891708e3
|
@ -45,22 +45,22 @@ function wp_custom_navigation() {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<div id="no-js"><h3>You do not have JavaScript enabled in your browser. Please enabled it to access the Custom Menu functionality.</h3></div>
|
<div id="no-js"><h3>You do not have JavaScript enabled in your browser. Please enable it to access the Custom Menu functionality.</h3></div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$messagesdiv = '';
|
$messagesdiv = '';
|
||||||
$menu_id_in_edit = 0;
|
$menu_id_in_edit = 0;
|
||||||
|
|
||||||
//Get the theme name
|
// Get the theme name
|
||||||
$themename = get_current_theme();
|
$themename = get_current_theme();
|
||||||
|
|
||||||
//CHECK which menu is selected and if menu is in edit already
|
// Check which menu is selected and if menu is in edit already
|
||||||
if ( isset( $_POST['switch_menu'] ) )
|
if ( isset( $_POST['switch_menu'] ) )
|
||||||
$menu_selected_id = $_POST['menu_select'];
|
$menu_selected_id = $_POST['menu_select'];
|
||||||
elseif ( isset( $_POST['menu_id_in_edit'] ) )
|
elseif ( isset( $_POST['menu_id_in_edit'] ) )
|
||||||
$menu_selected_id = $_POST['menu_id_in_edit'];
|
$menu_selected_id = $_POST['menu_id_in_edit'];
|
||||||
|
|
||||||
//Default Menu to show
|
// Default Menu to show
|
||||||
$custom_menus = get_terms( 'menu', array( 'hide_empty' => false ) );
|
$custom_menus = get_terms( 'menu', array( 'hide_empty' => false ) );
|
||||||
if ( !empty( $custom_menus ) )
|
if ( !empty( $custom_menus ) )
|
||||||
$menu_selected_id = $custom_menus[0]->term_id;
|
$menu_selected_id = $custom_menus[0]->term_id;
|
||||||
|
@ -85,6 +85,7 @@ function wp_custom_navigation() {
|
||||||
else
|
else
|
||||||
$postCounter = 0;
|
$postCounter = 0;
|
||||||
|
|
||||||
|
// Create a new menu. Menus are stored as terms in the 'menu' taxonomy.
|
||||||
if ( isset( $_POST['add_menu'] ) ) {
|
if ( isset( $_POST['add_menu'] ) ) {
|
||||||
$insert_menu_name = $_POST['add_menu_name'];
|
$insert_menu_name = $_POST['add_menu_name'];
|
||||||
|
|
||||||
|
@ -106,21 +107,19 @@ function wp_custom_navigation() {
|
||||||
} else {
|
} else {
|
||||||
$messagesdiv = '<div id="message" class="error fade below-h2"><p>Please enter a valid Menu name</p></div>';
|
$messagesdiv = '<div id="message" class="error fade below-h2"><p>Please enter a valid Menu name</p></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['reset_wp_menu'])) {
|
if ( isset($_POST['reset_wp_menu']) ) {
|
||||||
$success = wp_custom_nav_reset();
|
$success = wp_custom_nav_reset();
|
||||||
if ($success) {
|
if ($success) {
|
||||||
//DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly
|
// DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly
|
||||||
$messagesdiv = '<div id="message" class="updated fade below-h2"><p>'.$themename.'s Custom Menu has been RESET!</p></div>';
|
$messagesdiv = '<div id="message" class="updated fade below-h2"><p>'.$themename.'s Custom Menu has been RESET!</p></div>';
|
||||||
//GET reset menu id
|
// GET reset menu id
|
||||||
$custom_menus = array();
|
$custom_menus = array();
|
||||||
$menu_selected_id = 0;
|
$menu_selected_id = 0;
|
||||||
} else {
|
} else {
|
||||||
//DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly
|
// DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly
|
||||||
$messagesdiv = '<div id="message" class="error fade below-h2"><p>'.$themename.'s Custom Menu could not be RESET. Please try again.</p></div>';
|
$messagesdiv = '<div id="message" class="error fade below-h2"><p>'.$themename.'s Custom Menu could not be RESET. Please try again.</p></div>';
|
||||||
}
|
}
|
||||||
} elseif ( $postCounter > 0 && $menu_selected_id > 0 ) {
|
} elseif ( $postCounter > 0 && $menu_selected_id > 0 ) {
|
||||||
$menu_objects = get_objects_in_term( $menu_selected_id, 'menu' );
|
$menu_objects = get_objects_in_term( $menu_selected_id, 'menu' );
|
||||||
|
@ -285,7 +284,7 @@ function wp_custom_navigation() {
|
||||||
//DISPLAY SELECT OPTIONS
|
//DISPLAY SELECT OPTIONS
|
||||||
foreach( $custom_menus as $menu ) {
|
foreach( $custom_menus as $menu ) {
|
||||||
$menu_term = get_term( $menu, 'menu' );
|
$menu_term = get_term( $menu, 'menu' );
|
||||||
if ( ( $menu_id_in_edit == $menu ) || ( $menu_selected_id == $menu ) )
|
if ( ( $menu_id_in_edit == $menu->term_id ) || ( $menu_selected_id == $menu->term_id ) )
|
||||||
$selected_option = 'selected="selected"';
|
$selected_option = 'selected="selected"';
|
||||||
else
|
else
|
||||||
$selected_option = '';
|
$selected_option = '';
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
/*
|
/*
|
||||||
* Init Functions
|
* Init Functions
|
||||||
*/
|
*/
|
||||||
$(function()
|
jQuery(function($)
|
||||||
{
|
{
|
||||||
//Makes dialog box
|
//Makes dialog box
|
||||||
$("#dialog-confirm").dialog({
|
$("#dialog-confirm").dialog({
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
$(function(){$("#dialog-confirm").dialog({autoOpen:false,resizable:false,height:210,width:400,modal:true,buttons:{Save:function(){titletosave=$("#edittitle").attr("value");linktosave=$("#editlink").attr("value");anchortitletosave=$("#editanchortitle").attr("value");newwindowtosave=$("#editnewwindow").attr("value");desctosave=$("#editdescription").attr("value");$("#title"+$(this).dialog("option","itemID")).attr("value",titletosave);$("#linkurl"+$(this).dialog("option","itemID")).attr("value",linktosave);$("#anchortitle"+$(this).dialog("option","itemID")).attr("value",anchortitletosave);$("#newwindow"+$(this).dialog("option","itemID")).attr("value",newwindowtosave);$("#description"+$(this).dialog("option","itemID")).attr("value",desctosave);$("#menu-"+$(this).dialog("option","itemID")+" > dl > dt > span.title").text(titletosave);$("#view"+ +$(this).dialog("option","itemID")).attr("href",linktosave);$(this).dialog("close")},Cancel:function(){$(this).dialog("close")}}});$("#message").animate({opacity:1},2000).fadeOut(300,function(){$(this).remove()});$("#custom-nav li").prepend('<div class="dropzone"></div>');$("#custom-nav li").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});$("#custom-nav dl, #custom-nav .dropzone").droppable({accept:"#custom-nav li",tolerance:"pointer",drop:function(f,d){var a=$(this).parent();var g=!$(this).hasClass("dropzone");if(g&&a.children("ul").length==0){a.append('<ul id="sub-menu" />')}if(g){a.children("ul").append(d.draggable)}else{a.before(d.draggable)}a.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var c=d.draggable.attr("value");var b=a.attr("value");a.find("#menu-"+c).find("#parent"+c).val(b);$(this).parent().find("dt").removeAttr("style");$(this).parent().find("div:first").removeAttr("style")},over:function(){if($(this).attr("class")=="dropzone ui-droppable"){$(this).parent().find("div:first").css("background","none").css("height","50px")}else{if($(this).attr("class")=="ui-droppable"){$(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}var a=$(this).parent().attr("id")},out:function(){$(this).parent().find("dt").removeAttr("style");$(this).parent().find("div:first").removeAttr("style");$(this).filter(".dropzone").css({borderColor:""})},deactivate:function(){}});$("#save_top").click(function(){updatepostdata()});$("#save_bottom").click(function(){updatepostdata()})});
|
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()})});
|
|
@ -34,21 +34,21 @@ function removeitem(o)
|
||||||
function edititem(o)
|
function edititem(o)
|
||||||
{
|
{
|
||||||
|
|
||||||
itemTitle = $('#title' + o).attr('value');
|
itemTitle = jQuery('#title' + o).attr('value');
|
||||||
itemURL = $('#linkurl' + o).attr('value');
|
itemURL = jQuery('#linkurl' + o).attr('value');
|
||||||
itemAnchorTitle = $('#anchortitle' + o).attr('value');
|
itemAnchorTitle = jQuery('#anchortitle' + o).attr('value');
|
||||||
itemNewWindow = $('#newwindow' + o).attr('value');
|
itemNewWindow = jQuery('#newwindow' + o).attr('value');
|
||||||
itemDesc = $('#description' + o).attr('value');
|
itemDesc = jQuery('#description' + o).attr('value');
|
||||||
|
|
||||||
$('#dialog-confirm').dialog( 'option' , 'itemID' , o )
|
jQuery('#dialog-confirm').dialog( 'option' , 'itemID' , o )
|
||||||
|
|
||||||
$('#dialog-confirm').dialog('open');
|
jQuery('#dialog-confirm').dialog('open');
|
||||||
|
|
||||||
$('#edittitle').attr('value', itemTitle);
|
jQuery('#edittitle').attr('value', itemTitle);
|
||||||
$('#editlink').attr('value', itemURL);
|
jQuery('#editlink').attr('value', itemURL);
|
||||||
$('#editanchortitle').attr('value', itemAnchorTitle);
|
jQuery('#editanchortitle').attr('value', itemAnchorTitle);
|
||||||
$("#editnewwindow option[value='" + itemNewWindow + "']").attr('selected', 'selected');
|
jQuery("#editnewwindow option[value='" + itemNewWindow + "']").attr('selected', 'selected');
|
||||||
$('#editdescription').attr('value', itemDesc);
|
jQuery('#editdescription').attr('value', itemDesc);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -59,24 +59,24 @@ function updatepostdata()
|
||||||
{
|
{
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
$("#custom-nav").find("li").each(function(i) {
|
jQuery("#custom-nav").find("li").each(function(i) {
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
var j = $(this).attr('value');
|
var j = jQuery(this).attr('value');
|
||||||
|
|
||||||
$(this).find('#position' + j).attr('value', i);
|
jQuery(this).find('#position' + j).attr('value', i);
|
||||||
$(this).attr('id','menu-' + i);
|
jQuery(this).attr('id','menu-' + i);
|
||||||
$(this).attr('value', i);
|
jQuery(this).attr('value', i);
|
||||||
|
|
||||||
$(this).find('#dbid' + j).attr('name','dbid' + i);
|
jQuery(this).find('#dbid' + j).attr('name','dbid' + i);
|
||||||
$(this).find('#dbid' + j).attr('id','dbid' + i);
|
jQuery(this).find('#dbid' + j).attr('id','dbid' + i);
|
||||||
|
|
||||||
$(this).find('#postmenu' + j).attr('name','postmenu' + i);
|
jQuery(this).find('#postmenu' + j).attr('name','postmenu' + i);
|
||||||
$(this).find('#postmenu' + j).attr('id','postmenu' + i);
|
jQuery(this).find('#postmenu' + j).attr('id','postmenu' + i);
|
||||||
|
|
||||||
var p = $(this).find('#parent' + j).parent().parent().parent().attr('value');
|
var p = jQuery(this).find('#parent' + j).parent().parent().parent().attr('value');
|
||||||
|
|
||||||
$(this).find('#parent' + j).attr('name','parent' + i);
|
jQuery(this).find('#parent' + j).attr('name','parent' + i);
|
||||||
$(this).find('#parent' + j).attr('id','parent' + i);
|
jQuery(this).find('#parent' + j).attr('id','parent' + i);
|
||||||
if (p) {
|
if (p) {
|
||||||
//Do nothing
|
//Do nothing
|
||||||
}
|
}
|
||||||
|
@ -85,37 +85,37 @@ function updatepostdata()
|
||||||
p = 0;
|
p = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this).find('#parent' + j).attr('value', p);
|
jQuery(this).find('#parent' + j).attr('value', p);
|
||||||
|
|
||||||
$(this).find('#title' + j).attr('name','title' + i);
|
jQuery(this).find('#title' + j).attr('name','title' + i);
|
||||||
$(this).find('#title' + j).attr('id','title' + i);
|
jQuery(this).find('#title' + j).attr('id','title' + i);
|
||||||
|
|
||||||
$(this).find('#linkurl' + j).attr('name','linkurl' + i);
|
jQuery(this).find('#linkurl' + j).attr('name','linkurl' + i);
|
||||||
$(this).find('#linkurl' + j).attr('id','linkurl' + i);
|
jQuery(this).find('#linkurl' + j).attr('id','linkurl' + i);
|
||||||
|
|
||||||
$(this).find('#description' + j).attr('name','description' + i);
|
jQuery(this).find('#description' + j).attr('name','description' + i);
|
||||||
$(this).find('#description' + j).attr('id','description' + i);
|
jQuery(this).find('#description' + j).attr('id','description' + i);
|
||||||
|
|
||||||
$(this).find('#icon' + j).attr('name','icon' + i);
|
jQuery(this).find('#icon' + j).attr('name','icon' + i);
|
||||||
$(this).find('#icon' + j).attr('id','icon' + i);
|
jQuery(this).find('#icon' + j).attr('id','icon' + i);
|
||||||
|
|
||||||
$(this).find('#position' + j).attr('name','position' + i);
|
jQuery(this).find('#position' + j).attr('name','position' + i);
|
||||||
$(this).find('#position' + j).attr('id','position' + i);
|
jQuery(this).find('#position' + j).attr('id','position' + i);
|
||||||
|
|
||||||
$(this).find('#linktype' + j).attr('name','linktype' + i);
|
jQuery(this).find('#linktype' + j).attr('name','linktype' + i);
|
||||||
$(this).find('#linktype' + j).attr('id','linktype' + i);
|
jQuery(this).find('#linktype' + j).attr('id','linktype' + i);
|
||||||
|
|
||||||
$(this).find('#anchortitle' + j).attr('name','anchortitle' + i);
|
jQuery(this).find('#anchortitle' + j).attr('name','anchortitle' + i);
|
||||||
$(this).find('#anchortitle' + j).attr('id','anchortitle' + i);
|
jQuery(this).find('#anchortitle' + j).attr('id','anchortitle' + i);
|
||||||
|
|
||||||
$(this).find('#newwindow' + j).attr('name','newwindow' + i);
|
jQuery(this).find('#newwindow' + j).attr('name','newwindow' + i);
|
||||||
$(this).find('#newwindow' + j).attr('id','newwindow' + i);
|
jQuery(this).find('#newwindow' + j).attr('id','newwindow' + i);
|
||||||
|
|
||||||
$(this).find('dl > dt > span > #remove' + j).attr('value', i);
|
jQuery(this).find('dl > dt > span > #remove' + j).attr('value', i);
|
||||||
$(this).find('dl > dt > span > #remove' + j).attr('onClick', 'removeitem(' + i + ')');
|
jQuery(this).find('dl > dt > span > #remove' + j).attr('onClick', 'removeitem(' + i + ')');
|
||||||
$(this).find('dl > dt > span > #remove' + j).attr('id','remove' + i);
|
jQuery(this).find('dl > dt > span > #remove' + j).attr('id','remove' + i);
|
||||||
|
|
||||||
$('#licount').attr('value',i);
|
jQuery('#licount').attr('value',i);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -210,14 +210,14 @@ function appendToList(templatedir,additemtype,itemtext,itemurl,itemid,itemparent
|
||||||
}
|
}
|
||||||
|
|
||||||
//Notification Message
|
//Notification Message
|
||||||
$('.maintitle').after('<div id="message" class="updated fade below-h2"><p>Menu Item added!</p></div>');
|
jQuery('.maintitle').after('<div id="message" class="updated fade below-h2"><p>Menu Item added!</p></div>');
|
||||||
$('#message').animate({ opacity: 1.0 },2000).fadeOut(300, function(){ $(this).remove();});
|
jQuery('#message').animate({ opacity: 1.0 },2000).fadeOut(300, function(){ jQuery(this).remove();});
|
||||||
|
|
||||||
//Appends HTML to the menu
|
//Appends HTML to the menu
|
||||||
$('#custom-nav').append('<li id="menu-' + randomnumber + '" value="' + randomnumber + '"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="title">' + inputvaluevarname + '</span><span class="controls"><span class="type">' + additemtype + '</span><a id="edit' + randomnumber + '" onclick="edititem(' + randomnumber + ')" value="' + randomnumber +'"><img class="edit" alt="Edit Menu Item" title="Edit Menu Item" src="' + templatedir + '/wp-admin/images/ico-edit.png" /></a> <a id="remove' + randomnumber + '" onclick="removeitem(' + randomnumber + ')" value="' + randomnumber +'"><img class="remove" alt="Remove from Custom Menu" title="Remove from Custom Menu" src="' + templatedir + '/wp-admin/images/ico-close.png" /></a> <a href="' + inputvaluevarurl + '" target="_blank"><img alt="View Custom Link" title="View Custom Link" src="' + templatedir + '/wp-admin/images/ico-viewpage.png" /></a></span></dt></dl><a class="hide" href="' + inputvaluevarurl + '">' + inputvaluevarname + '</a><input type="hidden" name="postmenu' + randomnumber + '" id="postmenu' + randomnumber + '" value="' + inputitemid + '" /><input type="hidden" name="parent' + randomnumber + '" id="parent' + randomnumber + '" value="' + inputparentid + '" /><input type="hidden" name="title' + randomnumber + '" id="title' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="linkurl' + randomnumber + '" id="linkurl' + randomnumber + '" value="' + inputvaluevarurl + '" /><input type="hidden" name="description' + randomnumber + '" id="description' + randomnumber + '" value="' + inputdescription + '" /><input type="hidden" name="icon' + randomnumber + '" id="icon' + randomnumber + '" value="' + inputicon + '" /><input type="hidden" name="position' + randomnumber + '" id="position' + randomnumber + '" value="' + randomnumber + '" /><input type="hidden" name="linktype' + randomnumber + '" id="linktype' + randomnumber + '" value="' + inputlinktype + '" /><input type="hidden" name="anchortitle' + randomnumber + '" id="anchortitle' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="newwindow' + randomnumber + '" id="newwindow' + randomnumber + '" value="0" /></li>');
|
jQuery('#custom-nav').append('<li id="menu-' + randomnumber + '" value="' + randomnumber + '"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="title">' + inputvaluevarname + '</span><span class="controls"><span class="type">' + additemtype + '</span><a id="edit' + randomnumber + '" onclick="edititem(' + randomnumber + ')" value="' + randomnumber +'"><img class="edit" alt="Edit Menu Item" title="Edit Menu Item" src="' + templatedir + '/wp-admin/images/ico-edit.png" /></a> <a id="remove' + randomnumber + '" onclick="removeitem(' + randomnumber + ')" value="' + randomnumber +'"><img class="remove" alt="Remove from Custom Menu" title="Remove from Custom Menu" src="' + templatedir + '/wp-admin/images/ico-close.png" /></a> <a href="' + inputvaluevarurl + '" target="_blank"><img alt="View Custom Link" title="View Custom Link" src="' + templatedir + '/wp-admin/images/ico-viewpage.png" /></a></span></dt></dl><a class="hide" href="' + inputvaluevarurl + '">' + inputvaluevarname + '</a><input type="hidden" name="postmenu' + randomnumber + '" id="postmenu' + randomnumber + '" value="' + inputitemid + '" /><input type="hidden" name="parent' + randomnumber + '" id="parent' + randomnumber + '" value="' + inputparentid + '" /><input type="hidden" name="title' + randomnumber + '" id="title' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="linkurl' + randomnumber + '" id="linkurl' + randomnumber + '" value="' + inputvaluevarurl + '" /><input type="hidden" name="description' + randomnumber + '" id="description' + randomnumber + '" value="' + inputdescription + '" /><input type="hidden" name="icon' + randomnumber + '" id="icon' + randomnumber + '" value="' + inputicon + '" /><input type="hidden" name="position' + randomnumber + '" id="position' + randomnumber + '" value="' + randomnumber + '" /><input type="hidden" name="linktype' + randomnumber + '" id="linktype' + randomnumber + '" value="' + inputlinktype + '" /><input type="hidden" name="anchortitle' + randomnumber + '" id="anchortitle' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="newwindow' + randomnumber + '" id="newwindow' + randomnumber + '" value="0" /></li>');
|
||||||
|
|
||||||
//make menu item draggable
|
//make menu item draggable
|
||||||
$('#menu-' + randomnumber + '').draggable(
|
jQuery('#menu-' + randomnumber + '').draggable(
|
||||||
{
|
{
|
||||||
handle: ' > dl',
|
handle: ' > dl',
|
||||||
opacity: .8,
|
opacity: .8,
|
||||||
|
@ -227,13 +227,13 @@ function appendToList(templatedir,additemtype,itemtext,itemurl,itemid,itemparent
|
||||||
});
|
});
|
||||||
|
|
||||||
//make menu item droppable
|
//make menu item droppable
|
||||||
$('#menu-' + randomnumber + ' dl, #menu-' + randomnumber + ' .dropzone').droppable({
|
jQuery('#menu-' + randomnumber + ' dl, #menu-' + randomnumber + ' .dropzone').droppable({
|
||||||
accept: '#' + randomnumber + ', #custom-nav li',
|
accept: '#' + randomnumber + ', #custom-nav li',
|
||||||
tolerance: 'pointer',
|
tolerance: 'pointer',
|
||||||
drop: function(e, ui)
|
drop: function(e, ui)
|
||||||
{
|
{
|
||||||
var li = $(this).parent();
|
var li = jQuery(this).parent();
|
||||||
var child = !$(this).hasClass('dropzone');
|
var child = !jQuery(this).hasClass('dropzone');
|
||||||
//Append UL to first child
|
//Append UL to first child
|
||||||
if (child && li.children('ul').length == 0)
|
if (child && li.children('ul').length == 0)
|
||||||
{
|
{
|
||||||
|
@ -254,34 +254,34 @@ function appendToList(templatedir,additemtype,itemtext,itemurl,itemid,itemparent
|
||||||
var draggablevalue = ui.draggable.attr('value');
|
var draggablevalue = ui.draggable.attr('value');
|
||||||
var droppablevalue = li.attr('value');
|
var droppablevalue = li.attr('value');
|
||||||
li.find('#menu-' + draggablevalue).find('#parent' + draggablevalue).val(droppablevalue);
|
li.find('#menu-' + draggablevalue).find('#parent' + draggablevalue).val(droppablevalue);
|
||||||
$(this).parent().find("dt").removeAttr('style');
|
jQuery(this).parent().find("dt").removeAttr('style');
|
||||||
$(this).parent().find("div:first").removeAttr('style');
|
jQuery(this).parent().find("div:first").removeAttr('style');
|
||||||
|
|
||||||
},
|
},
|
||||||
over: function()
|
over: function()
|
||||||
{
|
{
|
||||||
//Add child
|
//Add child
|
||||||
if ($(this).attr('class') == 'dropzone ui-droppable')
|
if (jQuery(this).attr('class') == 'dropzone ui-droppable')
|
||||||
{
|
{
|
||||||
$(this).parent().find("div:first").css('background', 'none').css('height', '50px');
|
jQuery(this).parent().find("div:first").css('background', 'none').css('height', '50px');
|
||||||
}
|
}
|
||||||
//Add above
|
//Add above
|
||||||
else if ($(this).attr('class') == 'ui-droppable')
|
else if (jQuery(this).attr('class') == 'ui-droppable')
|
||||||
{
|
{
|
||||||
$(this).parent().find("dt:first").css('background', '#d8d8d8');
|
jQuery(this).parent().find("dt:first").css('background', '#d8d8d8');
|
||||||
}
|
}
|
||||||
//do nothing
|
//do nothing
|
||||||
else {
|
else {
|
||||||
|
|
||||||
}
|
}
|
||||||
var parentid = $(this).parent().attr('id');
|
var parentid = jQuery(this).parent().attr('id');
|
||||||
|
|
||||||
},
|
},
|
||||||
out: function()
|
out: function()
|
||||||
{
|
{
|
||||||
$(this).parent().find("dt").removeAttr('style');
|
jQuery(this).parent().find("dt").removeAttr('style');
|
||||||
$(this).parent().find("div:first").removeAttr('style');
|
jQuery(this).parent().find("div:first").removeAttr('style');
|
||||||
$(this).filter('.dropzone').css({ borderColor: '' });
|
jQuery(this).filter('.dropzone').css({ borderColor: '' });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -13,14 +13,14 @@
|
||||||
function wp_custom_navigation_get_menu_items( $menu_objects, $key = 'ID' ) {
|
function wp_custom_navigation_get_menu_items( $menu_objects, $key = 'ID' ) {
|
||||||
$menu_items = array();
|
$menu_items = array();
|
||||||
if ( !empty( $menu_objects ) && !empty( $key ) ) {
|
if ( !empty( $menu_objects ) && !empty( $key ) ) {
|
||||||
$args = array( 'orderby' => 'menu_order', 'post_type' => 'menu_item', 'post_status' => 'menu-category,menu-page,menu-custom' );
|
$args = array( 'orderby' => 'menu_order', 'post_type' => 'menu_item', 'post_status' => 'publish' );
|
||||||
if ( count( $menu_objects ) > 1 )
|
if ( count( $menu_objects ) > 1 )
|
||||||
$args['include'] = implode( ',', $menu_objects );
|
$args['include'] = implode( ',', $menu_objects );
|
||||||
else
|
else
|
||||||
$args['include'] = $menu_objects[0];
|
$args['include'] = $menu_objects[0];
|
||||||
$posts = new WP_Query( $args );
|
$posts = get_posts( $args );
|
||||||
if ( ! empty( $posts->posts ) ) {
|
if ( ! empty( $posts ) ) {
|
||||||
foreach( $posts->posts as $post ) {
|
foreach ( $posts as $post ) {
|
||||||
$menu_items[ $post->$key ] = $post;
|
$menu_items[ $post->$key ] = $post;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ function wp_custom_navigation_get_menu_items( $menu_objects, $key = 'ID' ) {
|
||||||
}
|
}
|
||||||
return $menu_items;
|
return $menu_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
function wp_custom_navigation_setup($override = false) {
|
function wp_custom_navigation_setup($override = false) {
|
||||||
|
|
||||||
$nav_version = '1.1.0';
|
$nav_version = '1.1.0';
|
||||||
|
|
|
@ -403,9 +403,9 @@ function wp_default_scripts( &$scripts ) {
|
||||||
$scripts->add( 'custom-navigation-ui-custom', '/wp-admin/js/custom-navigation-custom-jquery-ui-1.7.2.js', array('jquery'), '1.7.2' );
|
$scripts->add( 'custom-navigation-ui-custom', '/wp-admin/js/custom-navigation-custom-jquery-ui-1.7.2.js', array('jquery'), '1.7.2' );
|
||||||
$scripts->add_data( 'custom-navigation-ui-custom', 'group', 1 );
|
$scripts->add_data( 'custom-navigation-ui-custom', 'group', 1 );
|
||||||
|
|
||||||
$scripts->add( 'custom-navigation-default-items', '/wp-admin/js/custom-navigation-default-items.js', false, '1.0.0' );
|
$scripts->add( 'custom-navigation-default-items', "/wp-admin/js/custom-navigation-default-items$suffix.js", false, '20100220' );
|
||||||
$scripts->add( 'custom-navigation-dynamic-functions', '/wp-admin/js/custom-navigation-dynamic-functions.js', false, '1.0.0' );
|
$scripts->add( 'custom-navigation-dynamic-functions', "/wp-admin/js/custom-navigation-dynamic-functions$suffix.js", false, '20100220' );
|
||||||
$scripts->add( 'custom-navigation-php-functions', '/wp-admin/js/custom-navigation-php-functions.js', false, '1.0.0' );
|
$scripts->add( 'custom-navigation-php-functions', "/wp-admin/js/custom-navigation-php-functions$suffix.js", false, '20100220' );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue