2012-02-25 05:12:43 +01:00
|
|
|
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();
|
|
|
|
|
2012-03-07 04:19:35 +01:00
|
|
|
this.element.on( 'click', '.close-full-overlay', function() {
|
2012-02-25 05:12:43 +01:00
|
|
|
Loader.close();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
this.element.on( 'click', '.collapse-sidebar', function() {
|
|
|
|
Loader.element.toggleClass('collapsed');
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
open: function( params ) {
|
|
|
|
params.customize = 'on';
|
|
|
|
|
2012-03-22 03:39:03 +01:00
|
|
|
this.iframe = $( '<iframe />', {
|
|
|
|
src: this.base + '?' + jQuery.param( params )
|
|
|
|
}).appendTo( this.element );
|
2012-02-25 05:12:43 +01:00
|
|
|
|
|
|
|
this.element.fadeIn( 200, function() {
|
2012-03-07 04:19:35 +01:00
|
|
|
Loader.body.addClass( 'customize-active full-overlay-active' );
|
2012-02-25 05:12:43 +01:00
|
|
|
});
|
|
|
|
},
|
|
|
|
close: function() {
|
|
|
|
this.element.fadeOut( 200, function() {
|
|
|
|
Loader.iframe.remove();
|
|
|
|
Loader.iframe = null;
|
2012-03-07 04:19:35 +01:00
|
|
|
Loader.body.removeClass( 'customize-active full-overlay-active' );
|
2012-02-25 05:12:43 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
$( function() {
|
|
|
|
Loader.initialize();
|
|
|
|
|
2012-04-04 23:02:29 +02:00
|
|
|
$('#current-theme, #availablethemes').on( 'click', '.load-customize', function( event ) {
|
|
|
|
var load = $(this);
|
2012-02-25 05:12:43 +01:00
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
// Load the theme.
|
|
|
|
Loader.open({
|
2012-04-04 23:02:29 +02:00
|
|
|
template: load.data('customizeTemplate'),
|
|
|
|
stylesheet: load.data('customizeStylesheet')
|
2012-02-25 05:12:43 +01:00
|
|
|
});
|
2012-04-04 23:02:29 +02:00
|
|
|
});
|
2012-02-25 05:12:43 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
// Expose the API to the world.
|
|
|
|
exports.CustomizeLoader = Loader;
|
|
|
|
})( wp, jQuery );
|