Changeset 31651
- Timestamp:
- 03/06/2015 10:56:17 PM (10 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/press-this.css
r31607 r31651 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 } … … 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; 1805 } 1806 1807 .options-panel-back { 1808 position: absolute; 1809 top: 0; 1810 right: 0; 1811 bottom: 0; 1812 width: 320px; 1813 outline: 0; 1804 1814 } 1805 1815 … … 1832 1842 -webkit-box-shadow: 5001px 5000px 0 5000px #fff; 1833 1843 box-shadow: 5001px 5000px 0 5000px #fff; 1844 } 1845 1846 .options-panel-back { 1847 width: 100%; 1834 1848 } 1835 1849 } -
trunk/src/wp-admin/includes/class-wp-press-this.php
r31637 r31651 792 792 ?> 793 793 </div> 794 <button type="button" class=" buttonadd-cat-submit"><?php _e( 'Add' ); ?></button>794 <button type="button" class="add-cat-submit"><?php _e( 'Add' ); ?></button> 795 795 </div> 796 796 <?php } ?> … … 835 835 <p> 836 836 <input type="text" id="new-tag-post_tag" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="" /> 837 <button type="button" class=" buttontagadd"><?php _e( 'Add' ); ?></button>837 <button type="button" class="tagadd"><?php _e( 'Add' ); ?></button> 838 838 </p> 839 839 </div> … … 1036 1036 </div> 1037 1037 1038 <div class="options-panel is-off-screen is-hidden"> 1038 <div class="options-panel-back is-hidden" tabindex="-1"></div> 1039 <div class="options-panel is-off-screen is-hidden" tabindex="-1"> 1039 1040 <div class="post-options"> 1040 1041 -
trunk/src/wp-admin/js/press-this.js
r31636 r31651 8 8 saveAlert = false, 9 9 textarea = document.createElement( 'textarea' ), 10 sidebarIsOpen = false, 10 11 siteConfig = window.wpPressThisConfig || {}, 11 12 data = window.wpPressThisData || {}, … … 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; … … 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' ), … … 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(); … … 669 667 index = $targetSettingModal.index(); 670 668 671 event.preventDefault(); 672 673 $postOptions 674 .removeClass( isOffScreen + ' ' + isHidden ); 675 676 $targetSettingModal 677 .addClass( isOffScreen ) 678 .one( transitionEndEvent, function() { 669 $postOptions.removeClass( offscreenHidden ); 670 $targetSettingModal.addClass( isOffScreen ); 671 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 ); … … 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; 706 707 $optOpen.on( 'click', function(){ 708 $optOpen.addClass( isHidden ); 709 $optClose.removeClass( isHidden ); 710 $postActions.addClass( isHidden ); 711 $scanbar.addClass( isHidden ); 712 713 $sidebar 714 .removeClass( ifOffHidden ) 715 .one( 'transitionend', function() { 716 $postOption.eq( 0 ).focus(); 717 } ); 718 } ); 719 720 $optClose.on( 'click', function(){ 721 $optClose.addClass( isHidden ); 722 $optOpen.removeClass( isHidden ); 723 $postActions.removeClass( isHidden ); 724 $scanbar.removeClass( isHidden ); 725 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 } ); 689 function openSidebar() { 690 sidebarIsOpen = true; 691 692 $( '.options-open, .press-this-actions, #scanbar' ).addClass( isHidden ); 693 $( '.options-close, .options-panel-back' ).removeClass( isHidden ); 694 695 $( '.options-panel' ).removeClass( offscreenHidden ) 696 .one( 'transitionend', function() { 697 $( '.post-option:first' ).focus(); 698 } ); 699 } 700 701 function closeSidebar() { 702 sidebarIsOpen = false; 703 704 $( '.options-close, .options-panel-back' ).addClass( isHidden ); 705 $( '.options-open, .press-this-actions, #scanbar' ).removeClass( isHidden ); 706 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 … … 788 767 789 768 monitorOptionsModal(); 790 monitorSidebarToggle();791 769 monitorPlaceholder(); 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 }); 792 789 793 790 $( '#post-formats-select input' ).on( 'change', function() { … … 797 794 $( '#post-option-post-format' ).text( $( 'label[for="' + $this.attr( 'id' ) + '"]' ).text() || '' ); 798 795 } 799 } );800 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 796 } ); 806 797
Note: See TracChangeset
for help on using the changeset viewer.