Changeset 24680
- Timestamp:
- 07/12/2013 06:16:29 PM (11 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/css/wp-admin-rtl.css
r24633 r24680 2709 2709 } 2710 2710 2711 . accordion-section-title:after {2711 .js .accordion-section-title:after { 2712 2712 right: auto; 2713 2713 left: 20px; -
trunk/wp-admin/css/wp-admin.css
r24677 r24680 7501 7501 } 7502 7502 7503 .accordion-container .accordion-section:first-child { 7503 #nav-menu-meta .accordion-container .top { 7504 border-top: 1px solid #dfdfdf; 7505 } 7506 7507 #nav-menu-meta .accordion-container .accordion-section:first-child, 7508 #nav-menu-meta .accordion-container .accordion-section:first-child h3, 7509 #nav-menu-meta .accordion-container .top, 7510 #nav-menu-meta .accordion-container .top h3 { 7504 7511 -webkit-border-top-right-radius: 3px; 7505 7512 -webkit-border-top-left-radius: 3px; … … 7508 7515 } 7509 7516 7510 .accordion-container .accordion-section:last-child { 7517 #nav-menu-meta .accordion-container .accordion-section:last-child, 7518 #nav-menu-meta .accordion-container .accordion-section:last-child .accordion-section-content, 7519 #nav-menu-meta .accordion-container .bottom, 7520 #nav-menu-meta .accordion-container .bottom:not(.open) h3 { 7511 7521 -webkit-border-bottom-right-radius: 3px; 7512 7522 -webkit-border-bottom-left-radius: 3px; … … 8969 8979 border-right: 1px solid #dfdfdf; 8970 8980 8971 cursor: pointer;8972 8973 8981 -webkit-user-select: none; 8974 8982 -moz-user-select: none; … … 8976 8984 } 8977 8985 8978 .accordion-section-title:after { 8986 .js .accordion-section-title { 8987 cursor: pointer; 8988 } 8989 8990 .js .accordion-section-title:after { 8979 8991 content: ''; 8980 8992 width: 0; … … 9029 9041 } 9030 9042 9031 . control-section:hover .accordion-section-title,9032 . control-section .accordion-section-title:hover,9033 . control-section.open .accordion-section-title,9034 . control-section .accordion-section-title:focus {9043 .js .control-section:hover .accordion-section-title, 9044 .js .control-section .accordion-section-title:hover, 9045 .js .control-section.open .accordion-section-title, 9046 .js .control-section .accordion-section-title:focus { 9035 9047 color: #fff; 9036 9048 text-shadow: 0 -1px 0 #333; … … 9045 9057 } 9046 9058 9047 . control-section.accordion-section:hover,9059 .js .control-section.accordion-section:hover, 9048 9060 .control-section.accordion-section.open { 9049 9061 border-top-color: #808080; -
trunk/wp-admin/includes/template.php
r24674 r24680 986 986 global $wp_meta_boxes; 987 987 988 wp_enqueue_script( 'accordion' ); 989 988 990 if ( empty( $screen ) ) 989 991 $screen = get_current_screen(); -
trunk/wp-admin/js/accordion.js
r24644 r24680 1 jQuery(document).ready( function($) { 2 // Expand/Collapse 3 $('.accordion-container').on( 'click keydown', '.accordion-section-title', function(e) { 4 if ( e.type === 'keydown' && 13 !== e.which ) // "return" key 5 return; 6 e.preventDefault(); // Keep this AFTER the key filter above 1 ( function( $ ){ 7 2 8 var section = $( this ).closest( '.accordion-section' ), 9 siblings = section.siblings( '.open' ), 10 content = section.find( '.accordion-section-content' ); 3 $( document ).ready( function () { 11 4 12 if ( section.hasClass('cannot-expand') ) 5 // Expand/Collapse on click 6 $( '.accordion-container' ).on( 'click keydown', '.accordion-section-title', function( e ) { 7 if ( e.type === 'keydown' && 13 !== e.which ) // "return" key 8 return; 9 e.preventDefault(); // Keep this AFTER the key filter above 10 11 accordionSwitch( $( this ) ); 12 accordionCorners(); 13 }); 14 15 // Refresh selected accordion option when screen options are toggled 16 $( '.hide-postbox-tog' ).click( function () { 17 accordionInit(); 18 }); 19 20 }); 21 22 var accordionOptions = $( '.accordion-container li.accordion-section' ), 23 sectionContent = $( '.accordion-section-content' ); 24 25 // Rounded corners 26 function accordionCorners () { 27 accordionOptions.removeClass( 'top bottom' ); 28 accordionOptions.filter( ':visible' ).first().addClass( 'top' ); 29 accordionOptions.filter( ':visible' ).last().addClass( 'bottom' ).find( sectionContent ).addClass('bottom'); 30 }; 31 32 function accordionInit () { 33 accordionSwitch( accordionOptions.filter( ':visible' ).first() ); 34 accordionCorners(); 35 } 36 37 function accordionSwitch ( el ) { 38 var section = el.closest( '.accordion-section' ), 39 siblings = section.parent().find( '.open' ), 40 content = section.find( sectionContent ); 41 42 if ( section.hasClass( 'cannot-expand' ) ) 13 43 return; 14 44 15 45 siblings.removeClass( 'open' ); 16 siblings.find( '.accordion-section-content').show().slideUp( 150 );46 siblings.find( sectionContent ).show().slideUp( 150 ); 17 47 content.toggle( section.hasClass( 'open' ) ).slideToggle( 150 ); 18 48 section.toggleClass( 'open' ); 19 }); 20 }); 49 } 50 51 // Show the first accordion option by default 52 accordionInit(); 53 54 })(jQuery); -
trunk/wp-admin/js/nav-menu.js
r23810 r24680 54 54 55 55 this.initToggles(); 56 57 // Open first accordion option58 this.initAccordion();59 56 }, 60 57 … … 266 263 } 267 264 }); 268 },269 270 initAccordion : function() {271 var accordionOptions = $( '.accordion-container li.accordion-section' );272 accordionOptions.removeClass('open');273 accordionOptions.filter(':visible').first().addClass( 'open' );274 265 }, 275 266 … … 545 536 546 537 $('.hide-postbox-tog').click(function () { 547 api.initAccordion();548 549 538 var hidden = $( '.accordion-container li.accordion-section' ).filter(':hidden').map(function() { return this.id; }).get().join(','); 550 539 $.post(ajaxurl, { -
trunk/wp-admin/nav-menus.php
r24567 r24680 24 24 25 25 wp_enqueue_script( 'nav-menu' ); 26 wp_enqueue_script( 'accordion' );27 26 28 27 if ( wp_is_mobile() )
Note: See TracChangeset
for help on using the changeset viewer.