diff --git a/wp-admin/css/customize-controls-rtl.css b/wp-admin/css/customize-controls-rtl.css index de8fd8577b..6470c4cfab 100644 --- a/wp-admin/css/customize-controls-rtl.css +++ b/wp-admin/css/customize-controls-rtl.css @@ -1,11 +1,3 @@ -.control-section .customize-section-title { - font-family: Tahoma, Arial, sans-serif; -} -.customize-section-title:after { - right: auto; - left: 20px; -} - #customize-header-actions .button-primary { float: left; } diff --git a/wp-admin/css/customize-controls.css b/wp-admin/css/customize-controls.css index 7441dea279..05b3ace80d 100644 --- a/wp-admin/css/customize-controls.css +++ b/wp-admin/css/customize-controls.css @@ -6,124 +6,7 @@ body { text-decoration: none; } -.customize-section { - border-top: 1px solid #fff; - border-bottom: 1px solid #dfdfdf; - margin: 0; -} - -.control-section.customize-section:hover, -.control-section.customize-section.open { - border-top-color: #808080; -} - -.control-section.customize-section:hover { - border-bottom-color: #6d6d6d; -} - -.customize-section.open:hover { - border-bottom-color: #dfdfdf; -} - -.customize-section:last-child { - box-shadow: 0 1px 0 0px #fff; -} - -.customize-section-title { - margin: 0; - padding: 15px 20px; - position: relative; - - cursor: pointer; - - -webkit-user-select: none; - -moz-user-select: none; - user-select: none; -} - -.customize-section-title:focus { - outline: none; -} - -.cannot-expand .customize-section-title { - cursor: auto; -} - -.customize-section-content { - display: none; - padding: 10px 20px 15px; - overflow: hidden; -} - -.control-section .customize-section-title { - padding: 10px 20px; - font-size: 15px; - font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; - font-weight: normal; - text-shadow: 0 1px 0 #fff; - background: #f5f5f5; - background-image: -webkit-gradient(linear, left bottom, left top, from(#eee), to(#f5f5f5)); - background-image: -webkit-linear-gradient(bottom, #eee, #f5f5f5); - background-image: -moz-linear-gradient(bottom, #eee, #f5f5f5); - background-image: -o-linear-gradient(bottom, #eee, #f5f5f5); - background-image: linear-gradient(to top, #eee, #f5f5f5); -} - -.control-section:hover .customize-section-title, -.control-section .customize-section-title:hover, -.control-section.open .customize-section-title, -.control-section .customize-section-title:focus { - color: #fff; - text-shadow: 0 -1px 0 #333; - background: #808080; - background-image: -webkit-gradient(linear, left bottom, left top, from(#6d6d6d), to(#808080)); - background-image: -webkit-linear-gradient(bottom, #6d6d6d, #808080); - background-image: -moz-linear-gradient(bottom, #6d6d6d, #808080); - background-image: -o-linear-gradient(bottom, #6d6d6d, #808080); - background-image: linear-gradient(to top, #6d6d6d, #808080); -} - -.control-section.open .customize-section-title { - border-bottom: 1px solid #6d6d6d; -} - -.customize-section.open .customize-section-content { - display: block; - background: #fdfdfd; -} - -.customize-section-title:after { - content: ''; - width: 0; - height: 0; - border-color: #ccc transparent; - border-style: solid; - border-width: 6px 6px 0; - position: absolute; - top: 25px; - right: 20px; - z-index: 1; -} - -.cannot-expand .customize-section-title:after { - display: none; -} - -.customize-section-title:hover:after, -.customize-section-title:focus:after { - border-color: #aaa transparent; -} - -.control-section .customize-section-title:hover:after, -.control-section .customize-section-title:focus:after { - border-color: #eee transparent; -} - -.control-section .customize-section-title:after { - top: 15px; -} - -#customize-info .customize-section-content { +#customize-info .accordion-section-content { background: transparent; } @@ -158,7 +41,7 @@ body { } #customize-theme-controls > ul, -#customize-theme-controls .customize-section-content { +#customize-theme-controls .accordion-section-content { margin: 0; } @@ -245,7 +128,7 @@ body { /* * Dropdowns */ -.customize-section .dropdown { +.accordion-section .dropdown { float: left; display: block; position: relative; @@ -255,7 +138,7 @@ body { border-radius: 3px; } -.customize-section .dropdown-content { +.accordion-section .dropdown-content { overflow: hidden; float: left; min-width: 30px; @@ -301,12 +184,12 @@ body { z-index: 1; } -.customize-section .dropdown:hover .dropdown-content, +.accordion-section .dropdown:hover .dropdown-content, .customize-control .dropdown:hover .dropdown-arrow { border-color: #aaa; } -.customize-section .dropdown:hover .dropdown-arrow:after { +.accordion-section .dropdown:hover .dropdown-arrow:after { border-color: #aaa transparent; } @@ -341,7 +224,7 @@ body { border-color: rgba( 0, 0, 0, 0.25 ); } -.customize-section input[type="text"].color-picker-hex { +.accordion-section input[type="text"].color-picker-hex { width: 65px; font-family: monospace; text-align: center; @@ -349,10 +232,10 @@ body { } /* The centered cursor overlaps the placeholder in webkit. Hide it when selected. */ -.customize-section input[type="text"].color-picker-hex:focus::-webkit-input-placeholder { +.accordion-section input[type="text"].color-picker-hex:focus::-webkit-input-placeholder { color: transparent; } -.customize-section input[type="text"].color-picker-hex:-moz-placeholder { +.accordion-section input[type="text"].color-picker-hex:-moz-placeholder { color: #999; } @@ -371,18 +254,18 @@ body { display: block; } -.customize-section .customize-control-image .dropdown-content { +.accordion-section .customize-control-image .dropdown-content { height: auto; min-height: 24px; min-width: 40px; padding: 0; } -.customize-section .customize-control-image .dropdown-status { +.accordion-section .customize-control-image .dropdown-status { padding: 4px 5px; } -.customize-section .customize-control-image .preview-thumbnail img { +.accordion-section .customize-control-image .preview-thumbnail img { display: block; width: 100%; max-width: 122px; @@ -390,18 +273,18 @@ body { margin: 0 auto; } -.customize-section .customize-control-image .actions { +.accordion-section .customize-control-image .actions { text-align: right; } -.customize-section .customize-control-image .library ul { +.accordion-section .customize-control-image .library ul { border-bottom: 1px solid #dfdfdf; float: left; width: 100%; margin: 10px 0 0; } -.customize-section .customize-control-image .library li { +.accordion-section .customize-control-image .library li { color: #999; float: left; padding: 3px 5px; @@ -411,7 +294,7 @@ body { border-width: 1px 1px 0 1px; } -.customize-section .customize-control-image .library li.library-selected { +.accordion-section .customize-control-image .library li.library-selected { margin-bottom: -1px; padding-bottom: 4px; @@ -422,27 +305,27 @@ body { border-radius: 3px 3px 0 0 ; } -.customize-section .customize-control-image .library-content { +.accordion-section .customize-control-image .library-content { display: none; width: 100%; float: left; padding: 10px 0; } -.customize-section .customize-control-image .library-content.library-selected { +.accordion-section .customize-control-image .library-content.library-selected { display: block; } -.customize-section .customize-control-image .library .thumbnail { +.accordion-section .customize-control-image .library .thumbnail { display: block; width: 100%; } -.customize-section .customize-control-image .library .thumbnail:hover img { +.accordion-section .customize-control-image .library .thumbnail:hover img { border-color: #21759b; } -.customize-section .customize-control-image .library .thumbnail img { +.accordion-section .customize-control-image .library .thumbnail img { display: block; max-width: 90%; max-height: 80px; @@ -453,13 +336,13 @@ body { border: 1px solid #dfdfdf; } -.customize-section .customize-control-upload .upload-fallback, -.customize-section .customize-control-image .upload-fallback { +.accordion-section .customize-control-upload .upload-fallback, +.accordion-section .customize-control-image .upload-fallback { display: none; } -.customize-section .customize-control-upload .upload-dropzone, -.customize-section .customize-control-image .upload-dropzone { +.accordion-section .customize-control-upload .upload-dropzone, +.accordion-section .customize-control-image .upload-dropzone { display: none; padding: 15px 10px; border: 3px dashed #dfdfdf; @@ -470,8 +353,8 @@ body { cursor: default; } -.customize-section .customize-control-upload .upload-dropzone.supports-drag-drop, -.customize-section .customize-control-image .upload-dropzone.supports-drag-drop { +.accordion-section .customize-control-upload .upload-dropzone.supports-drag-drop, +.accordion-section .customize-control-image .upload-dropzone.supports-drag-drop { display: block; -webkit-transition: border-color 0.1s; -moz-transition: border-color 0.1s; @@ -480,13 +363,13 @@ body { transition: border-color 0.1s; } -.customize-section .customize-control-upload .library ul li, -.customize-section .customize-control-image .library ul li { +.accordion-section .customize-control-upload .library ul li, +.accordion-section .customize-control-image .library ul li { cursor: pointer; } -.customize-section .customize-control-upload .upload-dropzone.supports-drag-drop.drag-over, -.customize-section .customize-control-image .upload-dropzone.supports-drag-drop.drag-over { +.accordion-section .customize-control-upload .upload-dropzone.supports-drag-drop.drag-over, +.accordion-section .customize-control-image .upload-dropzone.supports-drag-drop.drag-over { border-color: #83b4d8; } diff --git a/wp-admin/css/wp-admin-rtl.css b/wp-admin/css/wp-admin-rtl.css index f958a2b183..5d120e526f 100644 --- a/wp-admin/css/wp-admin-rtl.css +++ b/wp-admin/css/wp-admin-rtl.css @@ -2534,6 +2534,15 @@ div.sidebar-name h3 { direction: ltr; } +.control-section .accordion-section-title { + font-family: Tahoma, Arial, sans-serif; +} + +.accordion-section-title:after { + right: auto; + left: 20px; +} + /** * HiDPI Displays */ diff --git a/wp-admin/css/wp-admin.css b/wp-admin/css/wp-admin.css index a3577592e4..55aa296fda 100644 --- a/wp-admin/css/wp-admin.css +++ b/wp-admin/css/wp-admin.css @@ -8277,6 +8277,121 @@ a.widget-control-edit { -ms-touch-action: none; } +/* Accordion */ + +.accordion-section { + border-top: 1px solid #fff; + border-bottom: 1px solid #dfdfdf; + margin: 0; +} + +.accordion-section:last-child { + box-shadow: 0 1px 0 0px #fff; +} + +.accordion-section.open .accordion-section-content { + display: block; + background: #fdfdfd; +} + +.accordion-section.open:hover { + border-bottom-color: #dfdfdf; +} + +.accordion-section-content { + display: none; + padding: 10px 20px 15px; + overflow: hidden; +} + +.accordion-section-title { + margin: 0; + padding: 15px 20px; + position: relative; + + cursor: pointer; + + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; +} + +.accordion-section-title:after { + content: ''; + width: 0; + height: 0; + border-color: #ccc transparent; + border-style: solid; + border-width: 6px 6px 0; + position: absolute; + top: 25px; + right: 20px; + z-index: 1; +} + +.accordion-section-title:focus { + outline: none; +} + +.accordion-section-title:hover:after, +.accordion-section-title:focus:after { + border-color: #aaa transparent; +} + +.cannot-expand .accordion-section-title { + cursor: auto; +} + +.cannot-expand .accordion-section-title:after { + display: none; +} + +.control-section .accordion-section-title { + padding: 10px 20px; + font-size: 15px; + font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; + font-weight: normal; + text-shadow: 0 1px 0 #fff; + background: #f5f5f5; + background-image: -webkit-gradient(linear, left bottom, left top, from(#eee), to(#f5f5f5)); + background-image: -webkit-linear-gradient(bottom, #eee, #f5f5f5); + background-image: -moz-linear-gradient(bottom, #eee, #f5f5f5); + background-image: -o-linear-gradient(bottom, #eee, #f5f5f5); + background-image: linear-gradient(to top, #eee, #f5f5f5); +} + +.control-section .accordion-section-title:after { + top: 15px; +} + +.control-section .accordion-section-title:hover:after, +.control-section .accordion-section-title:focus:after { + border-color: #eee transparent; +} + +.control-section:hover .accordion-section-title, +.control-section .accordion-section-title:hover, +.control-section.open .accordion-section-title, +.control-section .accordion-section-title:focus { + color: #fff; + text-shadow: 0 -1px 0 #333; + background: #808080; + background-image: -webkit-gradient(linear, left bottom, left top, from(#6d6d6d), to(#808080)); + background-image: -webkit-linear-gradient(bottom, #6d6d6d, #808080); + background-image: -moz-linear-gradient(bottom, #6d6d6d, #808080); + background-image: -o-linear-gradient(bottom, #6d6d6d, #808080); + background-image: linear-gradient(to top, #6d6d6d, #808080); +} + +.control-section.accordion-section:hover, +.control-section.accordion-section.open { + border-top-color: #808080; +} + +.control-section.open .accordion-section-title { + border-bottom: 1px solid #6d6d6d; +} + /* =Media Queries -------------------------------------------------------------- */ diff --git a/wp-admin/customize.php b/wp-admin/customize.php index 093f9987b3..a02b3e2bf1 100644 --- a/wp-admin/customize.php +++ b/wp-admin/customize.php @@ -36,6 +36,8 @@ do_action( 'customize_controls_init' ); wp_enqueue_script( 'customize-controls' ); wp_enqueue_style( 'customize-controls' ); +wp_enqueue_script( 'accordion' ); + do_action( 'customize_controls_enqueue_scripts' ); // Let's roll. @@ -89,15 +91,15 @@ do_action( 'customize_controls_print_scripts' ); ?>
-
-
+
+
' . $wp_customize->theme()->display('Name') . '' ); ?>
-
+
@@ -109,7 +111,7 @@ do_action( 'customize_controls_print_scripts' );
-
    +
      sections() as $section ) $section->maybe_render(); diff --git a/wp-admin/js/accordion.js b/wp-admin/js/accordion.js new file mode 100644 index 0000000000..cba83e0b7e --- /dev/null +++ b/wp-admin/js/accordion.js @@ -0,0 +1,51 @@ +jQuery(document).ready( function($) { + // Expand/Collapse + $('.accordion-section-title').on('click keydown', function( event ) { + + if ( event.type === 'keydown' && 13 !== event.which ) // enter + return; + + var clicked = $( this ).closest( '.accordion-section' ); + + if ( clicked.hasClass('cannot-expand') ) + return; + + clicked.closest( '.accordion-container' ).find( '.accordion-section' ).not( clicked ).removeClass( 'open' ); + clicked.toggleClass( 'open' ); + event.preventDefault(); + }); +}); +jQuery(document).ready( function($) { + // Expand/Collapse + $('.accordion-section-title').on('click keydown', function( event ) { + + if ( event.type === 'keydown' && 13 !== event.which ) // enter + return; + + var clicked = $( this ).closest( '.accordion-section' ); + + if ( clicked.hasClass('cannot-expand') ) + return; + + clicked.closest( '.accordion-container' ).find( '.accordion-section' ).not( clicked ).removeClass( 'open' ); + clicked.toggleClass( 'open' ); + event.preventDefault(); + }); +}); +jQuery(document).ready( function($) { + // Expand/Collapse + $('.accordion-section-title').on('click keydown', function( event ) { + + if ( event.type === 'keydown' && 13 !== event.which ) // enter + return; + + var clicked = $( this ).closest( '.accordion-section' ); + + if ( clicked.hasClass('cannot-expand') ) + return; + + clicked.closest( '.accordion-container' ).find( '.accordion-section' ).not( clicked ).removeClass( 'open' ); + clicked.toggleClass( 'open' ); + event.preventDefault(); + }); +}); \ No newline at end of file diff --git a/wp-admin/js/accordion.min.js b/wp-admin/js/accordion.min.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/wp-admin/js/customize-controls.js b/wp-admin/js/customize-controls.js index 167f6d8ac1..01fffbac17 100644 --- a/wp-admin/js/customize-controls.js +++ b/wp-admin/js/customize-controls.js @@ -846,26 +846,6 @@ api.state = state; }()); - // Temporary accordion code. - $('.customize-section-title').bind('click keydown', function( event ) { - - if ( event.type === 'keydown' && 13 !== event.which ) // enter - return; - - var clicked = $( this ).parents( '.customize-section' ); - - if ( clicked.hasClass('cannot-expand') ) - return; - - // Scroll up if on #customize-section-title_tagline - if ('customize-section-title_tagline' === clicked.attr('id')) - $('.wp-full-overlay-sidebar-content').scrollTop(0); - - $( '.customize-section' ).not( clicked ).removeClass( 'open' ); - clicked.toggleClass( 'open' ); - event.preventDefault(); - }); - // Button bindings. $('#save').click( function( event ) { previewer.save(); diff --git a/wp-includes/class-wp-customize-section.php b/wp-includes/class-wp-customize-section.php index fb854110fe..63051be619 100644 --- a/wp-includes/class-wp-customize-section.php +++ b/wp-includes/class-wp-customize-section.php @@ -79,9 +79,9 @@ class WP_Customize_Section { */ protected function render() { ?> -
    • -

      title ); ?>

      -
        +
      • +

        title ); ?>

        +
          controls as $control ) $control->maybe_render(); diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index d5bc4db57e..437d50175f 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -107,7 +107,7 @@ function wp_default_scripts( &$scripts ) { ) ); $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), false, 1 ); - + $scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array('jquery'), false, 1 ); did_action( 'init' ) && $scripts->localize( 'heartbeat', 'heartbeatSettings', apply_filters( 'heartbeat_settings', array() ) @@ -331,6 +331,8 @@ function wp_default_scripts( &$scripts ) { 'allowedFiles' => __( 'Allowed Files' ), ) ); + $scripts->add( 'accordion', "/wp-admin/js/accordion$suffix.js", array( 'jquery' ), false, 1 ); + $scripts->add( 'shortcode', "/wp-includes/js/shortcode$suffix.js", array( 'underscore' ), false, 1 ); $scripts->add( 'media-models', "/wp-includes/js/media-models$suffix.js", array( 'backbone', 'jquery' ), false, 1 ); did_action( 'init' ) && $scripts->localize( 'media-models', '_wpMediaModelsL10n', array(