Ticket #17698: 17698.diff
| File 17698.diff, 2.0 KB (added by mitchoyoshitaka, 2 years ago) |
|---|
-
wp-admin/js/nav-menu.dev.js
41 41 this.attachTabsPanelListeners(); 42 42 43 43 this.attachUnsavedChangesListener(); 44 45 this.attachValidators(); 44 46 45 47 if( api.menuList.length ) // If no menu, we're in the + tab. 46 48 this.initSortables(); … … 108 110 }); 109 111 }); 110 112 }, 113 114 validateSelections : function() { 115 return !! this.find('.tabs-panel-active .categorychecklist li input:checked').length; 116 }, 111 117 /** 112 118 * Adds selected menu items to the menu. 113 119 * … … 516 522 }); 517 523 }, 518 524 525 validateCustomLink : function() { 526 var url = $('#custom-menu-item-url').val(); 527 return ! ( '' == url || 'http://' == url ); 528 }, 529 530 attachValidators : function() { 531 var onCustomLinkChange = function() { 532 $('#submit-customlinkdiv').prop('disabled', !api.validateCustomLink()); 533 }, 534 onChecklistChange = function() { 535 var t = $(this).closest('.posttypediv, .taxonomydiv'); 536 t.find('.submit-add-to-menu').prop('disabled', !t.validateSelections()); 537 }; 538 539 $('#custom-menu-item-url').change(onCustomLinkChange); 540 onCustomLinkChange(); 541 542 $('.posttypediv, .taxonomydiv').each(function() { 543 onChecklistChange.apply(this); 544 $(this).delegate( '.tabs-panel .categorychecklist li input', 'change', onChecklistChange ); 545 }); 546 }, 547 519 548 addCustomLink : function( processMethod ) { 520 549 var url = $('#custom-menu-item-url').val(), 521 550 label = $('#custom-menu-item-name').val(); … … 621 650 wrapper = target.parents('.inside').first(); 622 651 623 652 // upon changing tabs, we want to uncheck all checkboxes 624 $('input', wrapper).removeAttr('checked') ;653 $('input', wrapper).removeAttr('checked').change(); 625 654 626 655 $('.tabs-panel-active', wrapper).removeClass('tabs-panel-active').addClass('tabs-panel-inactive'); 627 656 $('#' + panelId, wrapper).removeClass('tabs-panel-inactive').addClass('tabs-panel-active');
