Ticket #13821: 13821.diff
File 13821.diff, 2.7 KB (added by , 11 years ago) |
---|
-
src/wp-admin/js/post.js
370 370 }(jQuery)); 371 371 372 372 jQuery(document).ready( function($) { 373 var stamp, visibility, $submitButtons, updateVisibility, update Text,373 var stamp, visibility, $submitButtons, updateVisibility, updatePasswordSubmitability, updateText, $postPassword, 374 374 sticky = '', 375 375 last = 0, 376 376 co = $('#content'), … … 653 653 // submitdiv 654 654 if ( $('#submitdiv').length ) { 655 655 stamp = $('#timestamp').html(); 656 visibility = $('#post-visibility-display').html(); 656 visibility = $('#post-visibility-display').html(), 657 $postPassword = $('#post_password'); 657 658 659 updatePasswordSubmitability = function() { 660 var passwordEmpty = $postPassword.val().trim().length < 1; 661 662 $postVisibilitySelect.find('.save-post-visibility').toggleClass( 'button-disabled', passwordEmpty ); 663 $postPassword.toggleClass( 'form-invalid', passwordEmpty ); 664 } 665 658 666 updateVisibility = function() { 659 667 if ( $postVisibilitySelect.find('input:radio:checked').val() != 'public' ) { 660 668 $('#sticky').prop('checked', false); … … 664 672 } 665 673 if ( $postVisibilitySelect.find('input:radio:checked').val() != 'password' ) { 666 674 $('#password-span').hide(); 675 $postVisibilitySelect.find('.save-post-visibility').removeClass('button-disabled'); 667 676 } else { 668 677 $('#password-span').show(); 678 updatePasswordSubmitability(); 669 679 } 670 680 }; 671 681 … … 760 770 $postVisibilitySelect.find('.cancel-post-visibility').click( function( event ) { 761 771 $postVisibilitySelect.slideUp('fast'); 762 772 $('#visibility-radio-' + $('#hidden-post-visibility').val()).prop('checked', true); 763 $ ('#post_password').val($('#hidden-post-password').val());773 $postPassword.val( $('#hidden-post-password').val() ); 764 774 $('#sticky').prop('checked', $('#hidden-post-sticky').prop('checked')); 765 775 $('#post-visibility-display').html(visibility); 766 776 $('#visibility .edit-visibility').show().focus(); … … 769 779 }); 770 780 771 781 $postVisibilitySelect.find('.save-post-visibility').click( function( event ) { // crazyhorse - multiple ok cancels 782 if ( $(this).hasClass('button-disabled') ) { 783 return false; 784 } 785 772 786 $postVisibilitySelect.slideUp('fast'); 773 787 $('#visibility .edit-visibility').show(); 774 788 updateText(); … … 791 805 updateVisibility(); 792 806 }); 793 807 808 // Disable submit button based on password field content 809 $postPassword.on( 'change keyup', updatePasswordSubmitability ); 810 794 811 $timestampdiv.siblings('a.edit-timestamp').click( function( event ) { 795 812 if ( $timestampdiv.is( ':hidden' ) ) { 796 813 $timestampdiv.slideDown('fast');