WordPress/wp-includes/js/customize-loader.dev.js
koopersmith c2fb0c425b Replace all instances of thickbox theme preview with the theme customizer. fixes #20404.
* Use theme customizer in theme install/update screens.
* Separate the customize loader from the customizer. Use wp_customize_loader() to include the loader script and markup.
* Deprecated: wp-admin/js/theme-preview.js is now no longer used by core.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-10 02:25:03 +00:00

60 lines
1.4 KiB
JavaScript

if ( typeof wp === 'undefined' )
var wp = {};
(function( exports, $ ){
var Loader = {
initialize: function() {
this.body = $( document.body );
this.element = $( '#customize-container' );
this.base = $( '.admin-url', this.element ).val();
this.element.on( 'click', '.close-full-overlay', function() {
Loader.close();
return false;
});
this.element.on( 'click', '.collapse-sidebar', function() {
Loader.element.toggleClass('collapsed');
return false;
});
},
open: function( params ) {
params.customize = 'on';
this.iframe = $( '<iframe />', {
src: this.base + '?' + jQuery.param( params )
}).appendTo( this.element );
this.element.fadeIn( 200, function() {
Loader.body.addClass( 'customize-active full-overlay-active' );
});
},
close: function() {
this.element.fadeOut( 200, function() {
Loader.iframe.remove();
Loader.iframe = null;
Loader.body.removeClass( 'customize-active full-overlay-active' );
});
}
};
$( function() {
Loader.initialize();
$('#wpbody').on( 'click', '.load-customize', function( event ) {
var load = $(this);
event.preventDefault();
// Load the theme.
Loader.open({
template: load.data('customizeTemplate'),
stylesheet: load.data('customizeStylesheet')
});
});
});
// Expose the API to the world.
exports.CustomizeLoader = Loader;
})( wp, jQuery );