Ticket #23449: 23449.8.diff
File 23449.8.diff, 5.0 KB (added by , 11 years ago) |
---|
-
wp-admin/includes/template.php
984 984 */ 985 985 function do_accordion_sections( $screen, $context, $object ) { 986 986 global $wp_meta_boxes; 987 988 wp_enqueue_script( 'accordion' ); 987 989 988 990 if ( empty( $screen ) ) 989 991 $screen = get_current_screen(); -
wp-admin/js/accordion.js
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 7 8 var section = $( this ).closest( '.accordion-section' ), 9 siblings = section.siblings( '.open' ), 1 ( function( $ ){ 2 3 $( document ).ready( function () { 4 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 // Rounded corners 23 function accordionCorners () { 24 var accordionOptions = $( '.accordion-container li.accordion-section' ); 25 26 accordionOptions.removeClass( 'top bottom' ); 27 accordionOptions.filter( ':visible' ).first().addClass( 'top' ); 28 accordionOptions.filter( ':visible' ).last().addClass( 'bottom' ).find('.accordion-section-content ').addClass('bottom'); 29 }; 30 31 function accordionInit () { 32 accordionSwitch( $( '.accordion-container li.accordion-section' ).filter( ':visible' ).first() ); 33 accordionCorners(); 34 } 35 36 function accordionSwitch ( el ) { 37 var section = el.closest( '.accordion-section' ), 38 siblings = section.parent().find( '.open' ), 10 39 content = section.find( '.accordion-section-content' ); 11 40 12 if ( section.hasClass( 'cannot-expand') )41 if ( section.hasClass( 'cannot-expand' ) ) 13 42 return; 14 43 15 44 siblings.removeClass( 'open' ); 16 45 siblings.find( '.accordion-section-content' ).show().slideUp( 150 ); 17 46 content.toggle( section.hasClass( 'open' ) ).slideToggle( 150 ); 18 47 section.toggleClass( 'open' ); 19 }); 20 }); 48 } 49 50 // Show the first accordion option by default 51 accordionInit(); 52 53 })(jQuery); 54 No newline at end of file -
wp-admin/js/nav-menu.js
53 53 this.initAccessibility(); 54 54 55 55 this.initToggles(); 56 57 // Open first accordion option58 this.initAccordion();59 56 }, 60 57 61 58 jQueryExtensions : function() { … … 267 264 }); 268 265 }, 269 266 270 initAccordion : function() {271 var accordionOptions = $( '.accordion-container li.accordion-section' );272 accordionOptions.removeClass('open');273 accordionOptions.filter(':visible').first().addClass( 'open' );274 },275 276 267 countMenuItems : function( depth ) { 277 268 return $( '.menu-item-depth-' + depth ).length; 278 269 }, … … 544 535 api.menuList.hideAdvancedMenuItemFields(); 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, { 551 540 action: 'closed-postboxes', -
wp-admin/nav-menus.php
23 23 wp_die( __( 'Cheatin’ uh?' ) ); 24 24 25 25 wp_enqueue_script( 'nav-menu' ); 26 wp_enqueue_script( 'accordion' );27 26 28 27 if ( wp_is_mobile() ) 29 28 wp_enqueue_script( 'jquery-touch-punch' ); -
wp-admin/css/wp-admin.css
7438 7438 margin: 0; 7439 7439 } 7440 7440 7441 .accordion-container .accordion-section:first-child { 7441 #nav-menu-meta .accordion-container .top { 7442 border-top: 1px solid #dfdfdf; 7443 } 7444 7445 #nav-menu-meta .accordion-container .top, 7446 #nav-menu-meta .accordion-container .top h3 { 7442 7447 -webkit-border-top-right-radius: 3px; 7443 7448 -webkit-border-top-left-radius: 3px; 7444 7449 border-top-right-radius: 3px; 7445 7450 border-top-left-radius: 3px; 7446 7451 } 7447 7452 7448 .accordion-container .accordion-section:last-child { 7453 #nav-menu-meta .accordion-container .bottom { 7449 7454 -webkit-border-bottom-right-radius: 3px; 7450 7455 -webkit-border-bottom-left-radius: 3px; 7451 7456 border-bottom-right-radius: 3px;