wp/wp-admin/js/theme.js
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
     1 /* global _wpThemeSettings, confirm */
     1 /**
       
     2  * @output wp-admin/js/theme.js
       
     3  */
       
     4 
       
     5 /* global _wpThemeSettings, confirm, tb_position */
     2 window.wp = window.wp || {};
     6 window.wp = window.wp || {};
     3 
     7 
     4 ( function($) {
     8 ( function($) {
     5 
     9 
     6 // Set up our namespace...
    10 // Set up our namespace...
   332 	apiCall: function( request, paginated ) {
   336 	apiCall: function( request, paginated ) {
   333 		return wp.ajax.send( 'query-themes', {
   337 		return wp.ajax.send( 'query-themes', {
   334 			data: {
   338 			data: {
   335 			// Request data
   339 			// Request data
   336 				request: _.extend({
   340 				request: _.extend({
   337 					per_page: 100,
   341 					per_page: 100
   338 					fields: {
       
   339 						description: true,
       
   340 						tested: true,
       
   341 						requires: true,
       
   342 						rating: true,
       
   343 						downloaded: true,
       
   344 						downloadLink: true,
       
   345 						last_updated: true,
       
   346 						homepage: true,
       
   347 						num_ratings: true
       
   348 					}
       
   349 				}, request)
   342 				}, request)
   350 			},
   343 			},
   351 
   344 
   352 			beforeSend: function() {
   345 			beforeSend: function() {
   353 				if ( ! paginated ) {
   346 				if ( ! paginated ) {
   582 	},
   575 	},
   583 
   576 
   584 	// Handles .disabled classes for previous/next buttons in theme installer preview
   577 	// Handles .disabled classes for previous/next buttons in theme installer preview
   585 	setNavButtonsState: function() {
   578 	setNavButtonsState: function() {
   586 		var $themeInstaller = $( '.theme-install-overlay' ),
   579 		var $themeInstaller = $( '.theme-install-overlay' ),
   587 			current = _.isUndefined( this.current ) ? this.model : this.current;
   580 			current = _.isUndefined( this.current ) ? this.model : this.current,
       
   581 			previousThemeButton = $themeInstaller.find( '.previous-theme' ),
       
   582 			nextThemeButton = $themeInstaller.find( '.next-theme' );
   588 
   583 
   589 		// Disable previous at the zero position
   584 		// Disable previous at the zero position
   590 		if ( 0 === this.model.collection.indexOf( current ) ) {
   585 		if ( 0 === this.model.collection.indexOf( current ) ) {
   591 			$themeInstaller.find( '.previous-theme' ).addClass( 'disabled' );
   586 			previousThemeButton
       
   587 				.addClass( 'disabled' )
       
   588 				.prop( 'disabled', true );
       
   589 
       
   590 			nextThemeButton.focus();
   592 		}
   591 		}
   593 
   592 
   594 		// Disable next if the next model is undefined
   593 		// Disable next if the next model is undefined
   595 		if ( _.isUndefined( this.model.collection.at( this.model.collection.indexOf( current ) + 1 ) ) ) {
   594 		if ( _.isUndefined( this.model.collection.at( this.model.collection.indexOf( current ) + 1 ) ) ) {
   596 			$themeInstaller.find( '.next-theme' ).addClass( 'disabled' );
   595 			nextThemeButton
       
   596 				.addClass( 'disabled' )
       
   597 				.prop( 'disabled', true );
       
   598 
       
   599 			previousThemeButton.focus();
   597 		}
   600 		}
   598 	},
   601 	},
   599 
   602 
   600 	installTheme: function( event ) {
   603 	installTheme: function( event ) {
   601 		var _this = this;
   604 		var _this = this;
  2036 });
  2039 });
  2037 
  2040 
  2038 })( jQuery );
  2041 })( jQuery );
  2039 
  2042 
  2040 // Align theme browser thickbox
  2043 // Align theme browser thickbox
  2041 var tb_position;
       
  2042 jQuery(document).ready( function($) {
  2044 jQuery(document).ready( function($) {
  2043 	tb_position = function() {
  2045 	window.tb_position = function() {
  2044 		var tbWindow = $('#TB_window'),
  2046 		var tbWindow = $('#TB_window'),
  2045 			width = $(window).width(),
  2047 			width = $(window).width(),
  2046 			H = $(window).height(),
  2048 			H = $(window).height(),
  2047 			W = ( 1040 < width ) ? 1040 : width,
  2049 			W = ( 1040 < width ) ? 1040 : width,
  2048 			adminbar_height = 0;
  2050 			adminbar_height = 0;