Ticket #31457: 31457.2.patch
File 31457.2.patch, 8.4 KB (added by , 10 years ago) |
---|
-
src/wp-admin/css/press-this.css
1219 1219 } 1220 1220 1221 1221 .options-open.is-hidden, 1222 .options-close.is-hidden { 1222 .options-close.is-hidden, 1223 .options-panel-back.is-hidden { 1223 1224 display: none; 1224 1225 } 1225 1226 … … 1798 1799 width: 320px; 1799 1800 border-left: 1px solid #e5e5e5; 1800 1801 font-size: 14px; 1801 /* Keeps background the full height of the screen */1802 /* Keeps background the full height of the screen, but only visually. Clicks go through. */ 1802 1803 -webkit-box-shadow: 5001px 5000px 0 5000px #fff, 5000px 5000px 0 5000px #e5e5e5; 1803 1804 box-shadow: 5001px 5000px 0 5000px #fff, 5000px 5000px 0 5000px #e5e5e5; 1804 1805 } 1805 1806 1807 .options-panel-back { 1808 position: absolute; 1809 top: 0; 1810 right: 0; 1811 bottom: 0; 1812 width: 320px; 1813 outline: 0; 1814 } 1815 1806 1816 @media (max-width: 900px) { 1807 1817 .options-panel { 1808 1818 background: #fff; -
src/wp-admin/includes/class-wp-press-this.php
779 779 ) ); 780 780 ?> 781 781 </div> 782 <button type="button" class=" buttonadd-cat-submit"><?php _e( 'Add' ); ?></button>782 <button type="button" class="add-cat-submit"><?php _e( 'Add' ); ?></button> 783 783 </div> 784 784 <?php } ?> 785 785 <div class="categories-search-wrapper"> … … 822 822 <label class="screen-reader-text" for="new-tag-post_tag"><?php _e( 'Tags' ); ?></label> 823 823 <p> 824 824 <input type="text" id="new-tag-post_tag" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="" /> 825 <button type="button" class=" buttontagadd"><?php _e( 'Add' ); ?></button>825 <button type="button" class="tagadd"><?php _e( 'Add' ); ?></button> 826 826 </p> 827 827 </div> 828 828 <p class="howto"> … … 1023 1023 </div> 1024 1024 </div> 1025 1025 1026 <div class="options-panel is-off-screen is-hidden"> 1026 <div class="options-panel-back is-hidden" tabindex="-1"></div> 1027 <div class="options-panel is-off-screen is-hidden" tabindex="-1"> 1027 1028 <div class="post-options"> 1028 1029 1029 1030 <?php if ( $supports_formats ) : ?> -
src/wp-admin/js/press-this.js
7 7 var editor, 8 8 saveAlert = false, 9 9 textarea = document.createElement( 'textarea' ), 10 sidebarIsOpen = false, 10 11 siteConfig = window.wpPressThisConfig || {}, 11 12 data = window.wpPressThisData || {}, 12 13 smallestWidth = 128, … … 17 18 suggestedContentStr = getSuggestedContent( data ), 18 19 hasSetFocus = false, 19 20 catsCache = [], 21 isOffScreen = 'is-off-screen', 22 isHidden = 'is-hidden', 23 offscreenHidden = isOffScreen + ' ' + isHidden, 20 24 transitionEndEvent = ( function() { 21 25 var style = document.documentElement.style; 22 26 … … 638 642 * Interactive navigation behavior for the options modal (post format, tags, categories) 639 643 */ 640 644 function monitorOptionsModal() { 641 var isOffScreen = 'is-off-screen', 642 isHidden = 'is-hidden', 643 $postOptions = $( '.post-options' ), 645 var $postOptions = $( '.post-options' ), 644 646 $postOption = $( '.post-option' ), 645 647 $settingModal = $( '.setting-modal' ), 646 648 $modalClose = $( '.modal-close' ); … … 649 651 var index = $( this ).index(), 650 652 $targetSettingModal = $settingModal.eq( index ); 651 653 652 event.preventDefault(); 653 654 $postOptions 655 .addClass( isOffScreen ) 654 $postOptions.addClass( isOffScreen ) 656 655 .one( transitionEndEvent, function() { 657 656 $( this ).addClass( isHidden ); 658 657 } ); 659 658 660 $targetSettingModal 661 .removeClass( isOffScreen + ' ' + isHidden ) 659 $targetSettingModal.removeClass( offscreenHidden ) 662 660 .one( transitionEndEvent, function() { 663 661 $( this ).find( '.modal-close' ).focus(); 664 662 } ); … … 668 666 var $targetSettingModal = $( this ).parent(), 669 667 index = $targetSettingModal.index(); 670 668 671 event.preventDefault(); 669 $postOptions.removeClass( offscreenHidden ); 670 $targetSettingModal.addClass( isOffScreen ); 672 671 673 $postOptions 674 .removeClass( isOffScreen + ' ' + isHidden ); 675 676 $targetSettingModal 677 .addClass( isOffScreen ) 678 .one( transitionEndEvent, function() { 672 if ( transitionEndEvent ) { 673 $targetSettingModal.one( transitionEndEvent, function() { 679 674 $( this ).addClass( isHidden ); 680 675 $postOption.eq( index - 1 ).focus(); 681 676 } ); 682 683 // For browser that don't support transitionend. 684 if ( ! transitionEndEvent ) { 677 } else { 685 678 setTimeout( function() { 686 679 $targetSettingModal.addClass( isHidden ); 687 680 $postOption.eq( index - 1 ).focus(); … … 693 686 /** 694 687 * Interactive behavior for the sidebar toggle, to show the options modals 695 688 */ 696 function monitorSidebarToggle() { 697 var $optOpen = $( '.options-open' ), 698 $optClose = $( '.options-close' ), 699 $postOption = $( '.post-option' ), 700 $sidebar = $( '.options-panel' ), 701 $postActions = $( '.press-this-actions' ), 702 $scanbar = $( '#scanbar' ), 703 isOffScreen = 'is-off-screen', 704 isHidden = 'is-hidden', 705 ifOffHidden = isOffScreen + ' ' + isHidden; 689 function openSidebar() { 690 sidebarIsOpen = true; 706 691 707 $optOpen.on( 'click', function(){ 708 $optOpen.addClass( isHidden ); 709 $optClose.removeClass( isHidden ); 710 $postActions.addClass( isHidden ); 711 $scanbar.addClass( isHidden ); 692 $( '.options-open, .press-this-actions, #scanbar' ).addClass( isHidden ); 693 $( '.options-close, .options-panel-back' ).removeClass( isHidden ); 712 694 713 $sidebar 714 .removeClass( ifOffHidden ) 715 .one( 'transitionend', function() { 716 $postOption.eq( 0 ).focus(); 717 } ); 718 } ); 695 $( '.options-panel' ).removeClass( offscreenHidden ) 696 .one( 'transitionend', function() { 697 $( '.post-option:first' ).focus(); 698 } ); 699 } 700 701 function closeSidebar() { 702 sidebarIsOpen = false; 719 703 720 $optClose.on( 'click', function(){ 721 $optClose.addClass( isHidden ); 722 $optOpen.removeClass( isHidden ); 723 $postActions.removeClass( isHidden ); 724 $scanbar.removeClass( isHidden ); 704 $( '.options-close, .options-panel-back' ).addClass( isHidden ); 705 $( '.options-open, .press-this-actions, #scanbar' ).removeClass( isHidden ); 725 706 726 $sidebar 727 .addClass( isOffScreen ) 728 .one( 'transitionend', function() { 729 $( this ).addClass( isHidden ); 730 // Reset to options list 731 $( '.post-options' ).removeClass( ifOffHidden ); 732 $( '.setting-modal').addClass( ifOffHidden ); 733 } ); 734 } ); 707 $( '.options-panel' ).addClass( isOffScreen ) 708 .one( 'transitionend', function() { 709 $( this ).addClass( isHidden ); 710 // Reset to options list 711 $( '.post-options' ).removeClass( offscreenHidden ); 712 $( '.setting-modal').addClass( offscreenHidden ); 713 } ); 735 714 } 736 715 737 716 /** … … 787 766 } ); 788 767 789 768 monitorOptionsModal(); 790 monitorSidebarToggle();791 769 monitorPlaceholder(); 792 770 771 $( '.options-open' ).on( 'click.press-this', openSidebar ); 772 $( '.options-close' ).on( 'click.press-this', closeSidebar ); 773 774 // Close the sidebar when focus moves outside of it. 775 $( '.options-panel, .options-panel-back' ).on( 'focusout.press-this', function() { 776 setTimeout( function() { 777 var node = document.activeElement, 778 $node = $( node ); 779 780 if ( sidebarIsOpen && node && ! $node.hasClass( 'options-panel-back' ) && 781 ( node.nodeName === 'BODY' || 782 ( ! $node.closest( '.options-panel' ).length && 783 ! $node.closest( '.options-open' ).length ) ) ) { 784 785 closeSidebar(); 786 } 787 }, 50 ); 788 }); 789 793 790 $( '#post-formats-select input' ).on( 'change', function() { 794 791 var $this = $( this ); 795 792 … … 798 795 } 799 796 } ); 800 797 801 // Needs more work, doesn't detect when the other JS changes the value of #tax-input-post_tag802 $( '#tax-input-post_tag' ).on( 'change', function() {803 var val = $( this ).val();804 $( '#post-option-tags' ).text( ( val ) ? val.replace( /,([^\s])/g, ', $1' ) : '' );805 } );806 807 798 $( window ).on( 'beforeunload.press-this', function() { 808 799 if ( saveAlert || ( editor && editor.isDirty() ) ) { 809 800 return __( 'saveAlert' );