Changeset 42033
- Timestamp:
- 10/28/2017 05:21:42 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-controls.js
r42031 r42033 1888 1888 }); 1889 1889 1890 function updateSelectedState() { 1891 var el = section.headerContainer.find( '.customize-themes-section-title' ); 1892 el.toggleClass( 'selected', section.expanded() ); 1893 el.attr( 'aria-expanded', section.expanded() ? 'true' : 'false' ); 1894 if ( ! section.expanded() ) { 1895 el.removeClass( 'details-open' ); 1896 } 1897 } 1898 section.expanded.bind( updateSelectedState ); 1899 updateSelectedState(); 1900 1890 1901 // Move section controls to the themes area. 1891 1902 api.bind( 'ready', function () { … … 1921 1932 } 1922 1933 1923 if ( expanded) {1934 function expand() { 1924 1935 1925 1936 // Try to load controls if none are loaded yet. … … 1950 1961 } 1951 1962 } 1963 otherSection.collapse( { duration: args.duration } ); 1952 1964 } 1953 otherSection.collapse( { duration: args.duration } );1954 1965 } 1955 1966 }); … … 1957 1968 section.contentContainer.addClass( 'current-section' ); 1958 1969 container.scrollTop(); 1959 section.headerContainer.find( '.customize-themes-section-title' ).addClass( 'selected' ).attr( 'aria-expanded', 'true' );1960 1970 1961 1971 container.on( 'scroll', _.throttle( section.renderScreenshots, 300 ) ); … … 1966 1976 } 1967 1977 section.updateCount(); // Show this section's count. 1978 } 1979 1980 if ( expanded ) { 1981 if ( section.panel() && api.panel.has( section.panel() ) ) { 1982 api.panel( section.panel() ).expand({ 1983 duration: args.duration, 1984 completeCallback: expand 1985 }); 1986 } else { 1987 expand(); 1988 } 1968 1989 } else { 1969 1990 section.contentContainer.removeClass( 'current-section' ); 1970 1991 1971 1992 // Always hide, even if they don't exist or are already hidden. 1972 section.headerContainer.find( '.customize-themes-section-title' ).removeClass( 'selected details-open' ).attr( 'aria-expanded', 'false' );1973 1993 section.headerContainer.find( '.filter-details' ).slideUp( 180 ); 1974 1994 … … 3059 3079 */ 3060 3080 onChangeExpanded: function( expanded, args ) { 3061 var panel = this, overlay ;3081 var panel = this, overlay, sections, hasExpandedSection = false; 3062 3082 3063 3083 // Expand/collapse the panel normally. … … 3083 3103 }, 200 ); 3084 3104 3085 // Automatically open the installed themes section (except on small screens).3105 // Automatically open the first section (except on small screens), if one isn't already expanded. 3086 3106 if ( 600 < window.innerWidth ) { 3087 api.section( 'installed_themes' ).expand(); 3107 sections = panel.sections(); 3108 _.each( sections, function( section ) { 3109 if ( section.expanded() ) { 3110 hasExpandedSection = true; 3111 } 3112 } ); 3113 if ( ! hasExpandedSection && sections.length > 0 ) { 3114 sections[0].expand(); 3115 } 3088 3116 } 3089 3117 } else {
Note: See TracChangeset
for help on using the changeset viewer.