equal
deleted
inserted
replaced
1797 |
1797 |
1798 // Escape from the details modal. |
1798 // Escape from the details modal. |
1799 section.closeDetails(); |
1799 section.closeDetails(); |
1800 } else { |
1800 } else { |
1801 |
1801 |
1802 // Escape from the inifinite scroll list. |
1802 // Escape from the infinite scroll list. |
1803 section.headerContainer.find( '.customize-themes-section-title' ).focus(); |
1803 section.headerContainer.find( '.customize-themes-section-title' ).focus(); |
1804 } |
1804 } |
1805 event.stopPropagation(); // Prevent section from being collapsed. |
1805 event.stopPropagation(); // Prevent section from being collapsed. |
1806 } |
1806 } |
1807 }); |
1807 }); |
1915 |
1915 |
1916 // Toggle feature filters. |
1916 // Toggle feature filters. |
1917 section.contentContainer.on( 'click', '.feature-filter-toggle', function( e ) { |
1917 section.contentContainer.on( 'click', '.feature-filter-toggle', function( e ) { |
1918 var $themeContainer = $( '.customize-themes-full-container' ), |
1918 var $themeContainer = $( '.customize-themes-full-container' ), |
1919 $filterToggle = $( e.currentTarget ); |
1919 $filterToggle = $( e.currentTarget ); |
1920 section.filtersHeight = $filterToggle.parent().next( '.filter-drawer' ).height(); |
1920 section.filtersHeight = $filterToggle.parents( '.themes-filter-bar' ).next( '.filter-drawer' ).height(); |
1921 |
1921 |
1922 if ( 0 < $themeContainer.scrollTop() ) { |
1922 if ( 0 < $themeContainer.scrollTop() ) { |
1923 $themeContainer.animate( { scrollTop: 0 }, 400 ); |
1923 $themeContainer.animate( { scrollTop: 0 }, 400 ); |
1924 |
1924 |
1925 if ( $filterToggle.hasClass( 'open' ) ) { |
1925 if ( $filterToggle.hasClass( 'open' ) ) { |
1930 $filterToggle |
1930 $filterToggle |
1931 .toggleClass( 'open' ) |
1931 .toggleClass( 'open' ) |
1932 .attr( 'aria-expanded', function( i, attr ) { |
1932 .attr( 'aria-expanded', function( i, attr ) { |
1933 return 'true' === attr ? 'false' : 'true'; |
1933 return 'true' === attr ? 'false' : 'true'; |
1934 }) |
1934 }) |
1935 .parent().next( '.filter-drawer' ).slideToggle( 180, 'linear' ); |
1935 .parents( '.themes-filter-bar' ).next( '.filter-drawer' ).slideToggle( 180, 'linear' ); |
1936 |
1936 |
1937 if ( $filterToggle.hasClass( 'open' ) ) { |
1937 if ( $filterToggle.hasClass( 'open' ) ) { |
1938 var marginOffset = 1018 < window.innerWidth ? 50 : 76; |
1938 var marginOffset = 1018 < window.innerWidth ? 50 : 76; |
1939 |
1939 |
1940 section.contentContainer.find( '.themes' ).css( 'margin-top', section.filtersHeight + marginOffset ); |
1940 section.contentContainer.find( '.themes' ).css( 'margin-top', section.filtersHeight + marginOffset ); |
3737 * @return {void} |
3737 * @return {void} |
3738 */ |
3738 */ |
3739 ready: function() { |
3739 ready: function() { |
3740 var control = this, newItem; |
3740 var control = this, newItem; |
3741 if ( 'dropdown-pages' === control.params.type && control.params.allow_addition ) { |
3741 if ( 'dropdown-pages' === control.params.type && control.params.allow_addition ) { |
3742 newItem = control.container.find( '.new-content-item' ); |
3742 newItem = control.container.find( '.new-content-item-wrapper' ); |
3743 newItem.hide(); // Hide in JS to preserve flex display when showing. |
3743 newItem.hide(); // Hide in JS to preserve flex display when showing. |
3744 control.container.on( 'click', '.add-new-toggle', function( e ) { |
3744 control.container.on( 'click', '.add-new-toggle', function( e ) { |
3745 $( e.currentTarget ).slideUp( 180 ); |
3745 $( e.currentTarget ).slideUp( 180 ); |
3746 newItem.slideDown( 180 ); |
3746 newItem.slideDown( 180 ); |
3747 newItem.find( '.create-item-input' ).focus(); |
3747 newItem.find( '.create-item-input' ).focus(); |
3864 */ |
3864 */ |
3865 renderNotifications: function() { |
3865 renderNotifications: function() { |
3866 var control = this, container, notifications, hasError = false; |
3866 var control = this, container, notifications, hasError = false; |
3867 |
3867 |
3868 if ( 'undefined' !== typeof console && console.warn ) { |
3868 if ( 'undefined' !== typeof console && console.warn ) { |
3869 console.warn( '[DEPRECATED] wp.customize.Control.prototype.renderNotifications() is deprecated in favor of instantating a wp.customize.Notifications and calling its render() method.' ); |
3869 console.warn( '[DEPRECATED] wp.customize.Control.prototype.renderNotifications() is deprecated in favor of instantiating a wp.customize.Notifications and calling its render() method.' ); |
3870 } |
3870 } |
3871 |
3871 |
3872 container = control.getNotificationsContainerElement(); |
3872 container = control.getNotificationsContainerElement(); |
3873 if ( ! container || ! container.length ) { |
3873 if ( ! container || ! container.length ) { |
3874 return; |
3874 return; |
4083 if ( 'dropdown-pages' !== control.params.type || ! control.params.allow_addition || ! api.Menus ) { |
4083 if ( 'dropdown-pages' !== control.params.type || ! control.params.allow_addition || ! api.Menus ) { |
4084 return; |
4084 return; |
4085 } |
4085 } |
4086 |
4086 |
4087 toggle = control.container.find( '.add-new-toggle' ); |
4087 toggle = control.container.find( '.add-new-toggle' ); |
4088 container = control.container.find( '.new-content-item' ); |
4088 container = control.container.find( '.new-content-item-wrapper' ); |
4089 input = control.container.find( '.create-item-input' ); |
4089 input = control.container.find( '.create-item-input' ); |
4090 title = input.val(); |
4090 title = input.val(); |
4091 select = control.container.find( 'select' ); |
4091 select = control.container.find( 'select' ); |
4092 |
4092 |
4093 if ( ! title ) { |
4093 if ( ! title ) { |
7197 section: section.id, |
7197 section: section.id, |
7198 priority: 100 |
7198 priority: 100 |
7199 } ) ); |
7199 } ) ); |
7200 |
7200 |
7201 /** |
7201 /** |
7202 * Return whether the pubish settings section should be active. |
7202 * Return whether the publish settings section should be active. |
7203 * |
7203 * |
7204 * @return {boolean} Is section active. |
7204 * @return {boolean} Is section active. |
7205 */ |
7205 */ |
7206 isSectionActive = function() { |
7206 isSectionActive = function() { |
7207 if ( ! api.state( 'activated' ).get() ) { |
7207 if ( ! api.state( 'activated' ).get() ) { |
7798 } |
7798 } |
7799 } ); |
7799 } ); |
7800 }, |
7800 }, |
7801 |
7801 |
7802 /** |
7802 /** |
7803 * Builds the front preview url with the current state of customizer. |
7803 * Builds the front preview URL with the current state of customizer. |
7804 * |
7804 * |
7805 * @since 4.9 |
7805 * @since 4.9.0 |
7806 * |
7806 * |
7807 * @return {string} Preview url. |
7807 * @return {string} Preview URL. |
7808 */ |
7808 */ |
7809 getFrontendPreviewUrl: function() { |
7809 getFrontendPreviewUrl: function() { |
7810 var previewer = this, params, urlParser; |
7810 var previewer = this, params, urlParser; |
7811 urlParser = document.createElement( 'a' ); |
7811 urlParser = document.createElement( 'a' ); |
7812 urlParser.href = previewer.previewUrl.get(); |
7812 urlParser.href = previewer.previewUrl.get(); |