if ( typeof wp === 'undefined' ) var wp = {}; (function( exports, $ ){ var api = wp.customize, Loader; Loader = { supports: { history: !! ( window.history && history.pushState ), hashchange: ('onhashchange' in window) && (document.documentMode === undefined || document.documentMode > 7) }, initialize: function() { this.body = $( document.body ).addClass('customize-support'); this.window = $( window ); this.element = $( '
' ).appendTo( this.body ); $('#wpbody').on( 'click', '.load-customize', function( event ) { event.preventDefault(); // Load the theme. Loader.open( $(this).attr('href') ); }); // Add navigation listeners. if ( this.supports.history ) this.window.on( 'popstate', Loader.popstate ); if ( this.supports.hashchange ) this.window.on( 'hashchange', Loader.hashchange ); }, popstate: function( e ) { var state = e.originalEvent.state; if ( state && state.customize ) Loader.open( state.customize ); else if ( Loader.active ) Loader.close(); }, hashchange: function( e ) { var hash = window.location.toString().split('#')[1]; if ( hash && 0 === hash.indexOf( 'customize=on' ) ) Loader.open( wpCustomizeLoaderL10n.url + '?' + hash ); if ( ! hash && ! Loader.supports.history ) Loader.close(); }, open: function( src ) { if ( this.active ) return; this.active = true; this.iframe = $( '