Changeset 41739
- Timestamp:
- 10/04/2017 04:48:50 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-controls.js
r41726 r41739 2209 2209 * @since 4.2.0 2210 2210 * 2211 * @returns { object|boolean} Next theme.2211 * @returns {wp.customize.ThemeControl|boolean} Next theme. 2212 2212 */ 2213 2213 getNextTheme: function () { 2214 var section = this, control, next; 2215 control = api.control( section.params.action + '_theme_' + this.currentTheme ); 2216 next = control.container.next( 'li.customize-control-theme' ); 2217 if ( ! next.length ) { 2214 var section = this, control, nextControl, sectionControls, i; 2215 control = api.control( section.params.action + '_theme_' + section.currentTheme ); 2216 sectionControls = section.controls(); 2217 i = _.indexOf( sectionControls, control ); 2218 if ( -1 === i ) { 2218 2219 return false; 2219 2220 } 2220 next = next[0].id.replace( 'customize-control-theme-' + section.params.action, section.params.action + '_theme' ); 2221 control = api.control( next ); 2222 2223 return control.params.theme; 2221 2222 nextControl = sectionControls[ i + 1 ]; 2223 if ( ! nextControl ) { 2224 return false; 2225 } 2226 return nextControl.params.theme; 2224 2227 }, 2225 2228 … … 2243 2246 * 2244 2247 * @since 4.2.0 2245 * @returns { object|boolean} Previous theme.2248 * @returns {wp.customize.ThemeControl|boolean} Previous theme. 2246 2249 */ 2247 2250 getPreviousTheme: function () { 2248 var section = this, control, previous; 2249 control = api.control( section.params.action + '_theme_' + this.currentTheme ); 2250 previous = control.container.prev( 'li.customize-control-theme' ); 2251 if ( ! previous.length ) { 2251 var section = this, control, nextControl, sectionControls, i; 2252 control = api.control( section.params.action + '_theme_' + section.currentTheme ); 2253 sectionControls = section.controls(); 2254 i = _.indexOf( sectionControls, control ); 2255 if ( -1 === i ) { 2252 2256 return false; 2253 2257 } 2254 previous = previous[0].id.replace( 'customize-control-theme-' + section.params.action, section.params.action + '_theme' ); 2255 control = api.control( previous ); 2256 2257 return control.params.theme; 2258 2259 nextControl = sectionControls[ i - 1 ]; 2260 if ( ! nextControl ) { 2261 return false; 2262 } 2263 return nextControl.params.theme; 2258 2264 }, 2259 2265
Note: See TracChangeset
for help on using the changeset viewer.