Ticket #23449: 23449.7.diff
File 23449.7.diff, 4.8 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 1 (function($){ 2 3 $(document).ready( function () { 4 5 // Expand/Collapse 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 var section = $( this ).closest( '.accordion-section' ), 12 siblings = section.siblings( '.open' ), 13 content = section.find( '.accordion-section-content' ); 14 15 if ( section.hasClass('cannot-expand') ) 5 16 return; 6 e.preventDefault(); // Keep this AFTER the key filter above 7 8 var section = $( this ).closest( '.accordion-section' ), 9 siblings = section.siblings( '.open' ), 10 content = section.find( '.accordion-section-content' ); 11 12 if ( section.hasClass('cannot-expand') ) 13 return; 14 15 siblings.removeClass( 'open' ); 16 siblings.find( '.accordion-section-content' ).show().slideUp( 150 ); 17 content.toggle( section.hasClass( 'open' ) ).slideToggle( 150 ); 18 section.toggleClass( 'open' ); 17 18 siblings.removeClass( 'open' ); 19 siblings.find( '.accordion-section-content' ).show().slideUp( 150 ); 20 content.toggle( section.hasClass( 'open' ) ).slideToggle( 150 ); 21 section.toggleClass( 'open' ); 22 }); 23 24 // Refresh selected accordion option when screen options are toggled 25 $('.hide-postbox-tog').click(function () { 26 accordionInit(); 27 }); 28 19 29 }); 20 }); 30 31 function accordionInit () { 32 var accordionOptions = $( '.accordion-container li.accordion-section' ); 33 accordionOptions.removeClass( 'open' ); 34 console.log(accordionOptions.filter( ':visible' )); 35 accordionOptions.filter( ':visible' ).first().addClass( 'open' ); 36 }; 37 38 // Show the first accordion option by default 39 accordionInit(); 40 41 })(jQuery); 42 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 .accordion-section:first-child { 7442 7442 -webkit-border-top-right-radius: 3px; 7443 7443 -webkit-border-top-left-radius: 3px; 7444 7444 border-top-right-radius: 3px; 7445 7445 border-top-left-radius: 3px; 7446 7446 } 7447 7447 7448 .accordion-container .accordion-section:last-child { 7448 #nav-menu-meta .accordion-container .accordion-section:last-child { 7449 7449 -webkit-border-bottom-right-radius: 3px; 7450 7450 -webkit-border-bottom-left-radius: 3px; 7451 7451 border-bottom-right-radius: 3px;