<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[20476] trunk: Theme Customizer: Allow the customize iframe to be accessed directly (with full feature support).</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/20476">20476</a></dd>
<dt>Author</dt> <dd>koopersmith</dd>
<dt>Date</dt> <dd>2012-04-16 14:02:28 +0000 (Mon, 16 Apr 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Theme Customizer: Allow the customize iframe to be accessed directly (with full feature support). see <a href="http://core.trac.wordpress.org/ticket/19910">#19910</a>.

* Move the 'Return to Manage Themes' and 'Collapse Sidebar' actions from themes.php to customize-controls.php.
* Create a postMessage connection between themes.php and customize-controls.php.
* Allow the theme customizer to be accessed directly (independent of themes.php and the customize loader).
* Add wp_customize_href() and wp_customize_url().
* Remove wp_customize_loader(). To include the loader, use wp_enqueue_script( 'customize-loader' ).
* The theme customizer now requires postMessage browser support.
* Add .hide-if-customize and .hide-if-no-customize CSS classes.
* Clean up customize-preview.js.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincsswpadmindevcss">trunk/wp-admin/css/wp-admin.dev.css</a></li>
<li><a href="#trunkwpadminincludesclasswpthemeslisttablephp">trunk/wp-admin/includes/class-wp-themes-list-table.php</a></li>
<li><a href="#trunkwpadminincludesclasswpupgraderphp">trunk/wp-admin/includes/class-wp-upgrader.php</a></li>
<li><a href="#trunkwpadminthemesphp">trunk/wp-admin/themes.php</a></li>
<li><a href="#trunkwpadminupdatephp">trunk/wp-admin/update.php</a></li>
<li><a href="#trunkwpincludescsscustomizecontrolsdevcss">trunk/wp-includes/css/customize-controls.dev.css</a></li>
<li><a href="#trunkwpincludescustomizecontrolsphp">trunk/wp-includes/customize-controls.php</a></li>
<li><a href="#trunkwpincludesjscustomizebasedevjs">trunk/wp-includes/js/customize-base.dev.js</a></li>
<li><a href="#trunkwpincludesjscustomizecontrolsdevjs">trunk/wp-includes/js/customize-controls.dev.js</a></li>
<li><a href="#trunkwpincludesjscustomizeloaderdevjs">trunk/wp-includes/js/customize-loader.dev.js</a></li>
<li><a href="#trunkwpincludesjscustomizepreviewdevjs">trunk/wp-includes/js/customize-preview.dev.js</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
<li><a href="#trunkwpincludesthemephp">trunk/wp-includes/theme.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincsswpadmindevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin.dev.css (20475 => 20476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin.dev.css        2012-04-15 21:17:55 UTC (rev 20475)
+++ trunk/wp-admin/css/wp-admin.dev.css        2012-04-16 14:02:28 UTC (rev 20476)
</span><span class="lines">@@ -5313,6 +5313,16 @@
</span><span class="cx">   24.0 - Customize Loader
</span><span class="cx"> ------------------------------------------------------------------------------*/
</span><span class="cx"> 
</span><ins>+.hide-if-no-customize,
+.customize-support .hide-if-customize {
+        display: none !important;
+}
+
+.hide-if-customize,
+.customize-support .hide-if-no-customize {
+        display: block !important;
+}
+
</ins><span class="cx"> #customize-container {
</span><span class="cx">         display: none;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpadminincludesclasswpthemeslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-themes-list-table.php (20475 => 20476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-themes-list-table.php        2012-04-15 21:17:55 UTC (rev 20475)
+++ trunk/wp-admin/includes/class-wp-themes-list-table.php        2012-04-16 14:02:28 UTC (rev 20476)
</span><span class="lines">@@ -131,15 +131,13 @@
</span><span class="cx">                                 array( 'preview' =&gt; 1, 'template' =&gt; $template, 'stylesheet' =&gt; $stylesheet, 'preview_iframe' =&gt; true, 'TB_iframe' =&gt; 'true' ),
</span><span class="cx">                                 home_url( '/' ) ) );
</span><span class="cx"> 
</span><del>-                        $customize_attributes = 'title=&quot;' . esc_attr( sprintf( __( 'Customize &amp;#8220;%s&amp;#8221;' ), $title ) ) . '&quot;
-                                . data-customize-template=&quot;' . esc_attr( $template ) . '&quot; data-customize-stylesheet=&quot;' . esc_attr( $stylesheet ) . '&quot;';
-
</del><span class="cx">                         $actions = array();
</span><span class="cx">                         $actions[] = '&lt;a href=&quot;' . $activate_link . '&quot; class=&quot;activatelink&quot; title=&quot;'
</span><span class="cx">                                 . esc_attr( sprintf( __( 'Activate &amp;#8220;%s&amp;#8221;' ), $title ) ) . '&quot;&gt;' . __( 'Activate' ) . '&lt;/a&gt;';
</span><del>-                        $actions[] = '&lt;a href=&quot;' . $preview_link . '&quot; class=&quot;hide-if-js&quot; title=&quot;'
</del><ins>+                        $actions[] = '&lt;a href=&quot;' . $preview_link . '&quot; class=&quot;hide-if-customize&quot; title=&quot;'
</ins><span class="cx">                                 . esc_attr( sprintf( __( 'Preview &amp;#8220;%s&amp;#8221;' ), $title ) ) . '&quot;&gt;' . __( 'Preview' ) . '&lt;/a&gt;'
</span><del>-                                . '&lt;a href=&quot;#&quot; class=&quot;load-customize hide-if-no-js&quot; ' . $customize_attributes . '&gt;' . __( 'Customize' ) . '&lt;/a&gt;';
</del><ins>+                                . '&lt;a ' . wp_customize_href( $template, $stylesheet ) . ' class=&quot;load-customize hide-if-no-customize&quot;&gt;'
+                                . __( 'Customize' ) . '&lt;/a&gt;';
</ins><span class="cx">                         if ( ! is_multisite() &amp;&amp; current_user_can( 'delete_themes' ) )
</span><span class="cx">                                 $actions['delete'] = '&lt;a class=&quot;submitdelete deletion&quot; href=&quot;' . wp_nonce_url( &quot;themes.php?action=delete&amp;amp;template=$stylesheet&quot;, 'delete-theme_' . $stylesheet )
</span><span class="cx">                                         . '&quot; onclick=&quot;' . &quot;return confirm( '&quot; . esc_js( sprintf( __( &quot;You are about to delete this theme '%s'\n  'Cancel' to stop, 'OK' to delete.&quot; ), $title ) )
</span><span class="lines">@@ -150,11 +148,18 @@
</span><span class="cx">                         unset( $actions['delete'] );
</span><span class="cx"> 
</span><span class="cx">                         ?&gt;
</span><del>-                        &lt;a href=&quot;&lt;?php echo $preview_link; ?&gt;&quot; class=&quot;load-customize screenshot&quot; &lt;?php echo $customize_attributes; ?&gt;&gt;
-                        &lt;?php if ( $screenshot = $theme-&gt;get_screenshot() ) : ?&gt;
-                                &lt;img src=&quot;&lt;?php echo esc_url( $screenshot ); ?&gt;&quot; alt=&quot;&quot; /&gt;
-                        &lt;?php endif; ?&gt;
</del><ins>+
+                        &lt;a href=&quot;&lt;?php echo $preview_link; ?&gt;&quot; class=&quot;screenshot hide-if-customize&quot;&gt;
+                                &lt;?php if ( $screenshot = $theme-&gt;get_screenshot() ) : ?&gt;
+                                        &lt;img src=&quot;&lt;?php echo esc_url( $screenshot ); ?&gt;&quot; alt=&quot;&quot; /&gt;
+                                &lt;?php endif; ?&gt;
</ins><span class="cx">                         &lt;/a&gt;
</span><ins>+                        &lt;a &lt;?php echo wp_customize_href( $template, $stylesheet ); ?&gt; class=&quot;screenshot load-customize hide-if-no-customize&quot;&gt;
+                                &lt;?php if ( $screenshot = $theme-&gt;get_screenshot() ) : ?&gt;
+                                        &lt;img src=&quot;&lt;?php echo esc_url( $screenshot ); ?&gt;&quot; alt=&quot;&quot; /&gt;
+                                &lt;?php endif; ?&gt;
+                        &lt;/a&gt;
+
</ins><span class="cx">                         &lt;h3&gt;&lt;?php echo $title; ?&gt;&lt;/h3&gt;
</span><span class="cx">                         &lt;div class=&quot;theme-author&quot;&gt;&lt;?php printf( __( 'By %s' ), $author ); ?&gt;&lt;/div&gt;
</span><span class="cx">                         &lt;div class=&quot;action-links&quot;&gt;
</span></span></pre></div>
<a id="trunkwpadminincludesclasswpupgraderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-upgrader.php (20475 => 20476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-upgrader.php        2012-04-15 21:17:55 UTC (rev 20475)
+++ trunk/wp-admin/includes/class-wp-upgrader.php        2012-04-16 14:02:28 UTC (rev 20476)
</span><span class="lines">@@ -1507,9 +1507,6 @@
</span><span class="cx">                         'stylesheet' =&gt; $stylesheet,
</span><span class="cx">                 ), trailingslashit( get_home_url() ) );
</span><span class="cx"> 
</span><del>-                $customize_attributes = 'title=&quot;' . esc_attr( sprintf( __( 'Customize &amp;#8220;%s&amp;#8221;' ), $name ) ) . '&quot;
-                        . data-customize-template=&quot;' . esc_attr( $template ) . '&quot; data-customize-stylesheet=&quot;' . esc_attr( $stylesheet ) . '&quot;';
-
</del><span class="cx">                 $activate_link = add_query_arg( array(
</span><span class="cx">                         'action'     =&gt; 'activate',
</span><span class="cx">                         'template'   =&gt; $template,
</span><span class="lines">@@ -1518,8 +1515,8 @@
</span><span class="cx">                 $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $template );
</span><span class="cx"> 
</span><span class="cx">                 $install_actions = array();
</span><del>-                $install_actions['preview']  = '&lt;a href=&quot;' . esc_url( $preview_link ) . '&quot; class=&quot;hide-if-js&quot; title=&quot;' . esc_attr(sprintf(__('Preview &amp;#8220;%s&amp;#8221;'), $name ) ) . '&quot;&gt;' . __('Preview') . '&lt;/a&gt;';
-                $install_actions['preview'] .= '&lt;a href=&quot;#&quot; class=&quot;hide-if-no-js load-customize&quot; ' . $customize_attributes . '&gt;' . __('Customize') . '&lt;/a&gt;';
</del><ins>+                $install_actions['preview']  = '&lt;a href=&quot;' . esc_url( $preview_link ) . '&quot; class=&quot;hide-if-customize&quot; title=&quot;' . esc_attr(sprintf(__('Preview &amp;#8220;%s&amp;#8221;'), $name ) ) . '&quot;&gt;' . __('Preview') . '&lt;/a&gt;';
+                $install_actions['preview'] .= '&lt;a ' . wp_customize_href( $template, $stylesheet ) . ' class=&quot;hide-if-no-customize load-customize&gt;' . __('Customize') . '&lt;/a&gt;';
</ins><span class="cx">                 $install_actions['activate'] = '&lt;a href=&quot;' . esc_url( $activate_link ) . '&quot; class=&quot;activatelink&quot; title=&quot;' . esc_attr( sprintf( __('Activate &amp;#8220;%s&amp;#8221;'), $name ) ) . '&quot;&gt;' . __('Activate') . '&lt;/a&gt;';
</span><span class="cx"> 
</span><span class="cx">                 if ( is_network_admin() &amp;&amp; current_user_can( 'manage_network_themes' ) )
</span><span class="lines">@@ -1574,9 +1571,6 @@
</span><span class="cx">                                 'stylesheet' =&gt; $stylesheet,
</span><span class="cx">                         ), trailingslashit( get_home_url() ) );
</span><span class="cx"> 
</span><del>-                        $customize_attributes = 'title=&quot;' . esc_attr( sprintf( __( 'Customize &amp;#8220;%s&amp;#8221;' ), $name ) ) . '&quot;
-                                . data-customize-template=&quot;' . esc_attr( $template ) . '&quot; data-customize-stylesheet=&quot;' . esc_attr( $stylesheet ) . '&quot;';
-
</del><span class="cx">                         $activate_link = add_query_arg( array(
</span><span class="cx">                                 'action'     =&gt; 'activate',
</span><span class="cx">                                 'template'   =&gt; $template,
</span><span class="lines">@@ -1584,8 +1578,8 @@
</span><span class="cx">                         ), admin_url('themes.php') );
</span><span class="cx">                         $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $template );
</span><span class="cx"> 
</span><del>-                        $update_actions['preview']  = '&lt;a href=&quot;' . esc_url( $preview_link ) . '&quot; class=&quot;hide-if-js&quot; title=&quot;' . esc_attr(sprintf(__('Preview &amp;#8220;%s&amp;#8221;'), $name ) ) . '&quot;&gt;' . __('Preview') . '&lt;/a&gt;';
-                        $update_actions['preview'] .= '&lt;a href=&quot;#&quot; class=&quot;hide-if-no-js load-customize&quot; ' . $customize_attributes . '&gt;' . __('Customize') . '&lt;/a&gt;';
</del><ins>+                        $update_actions['preview']  = '&lt;a href=&quot;' . esc_url( $preview_link ) . '&quot; class=&quot;hide-if-customize&quot; title=&quot;' . esc_attr(sprintf(__('Preview &amp;#8220;%s&amp;#8221;'), $name ) ) . '&quot;&gt;' . __('Preview') . '&lt;/a&gt;';
+                        $update_actions['preview'] .= '&lt;a ' . wp_customize_href( $template, $stylesheet ) . ' class=&quot;hide-if-no-customize load-customize&quot;&gt;' . __('Customize') . '&lt;/a&gt;';
</ins><span class="cx">                         $update_actions['activate'] = '&lt;a href=&quot;' . esc_url( $activate_link ) . '&quot; class=&quot;activatelink&quot; title=&quot;' . esc_attr( sprintf( __('Activate &amp;#8220;%s&amp;#8221;'), $name ) ) . '&quot;&gt;' . __('Activate') . '&lt;/a&gt;';
</span><span class="cx"> 
</span><span class="cx">                         if ( ( ! $this-&gt;result || is_wp_error( $this-&gt;result ) ) || $stylesheet == get_stylesheet() )
</span></span></pre></div>
<a id="trunkwpadminthemesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/themes.php (20475 => 20476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/themes.php        2012-04-15 21:17:55 UTC (rev 20475)
+++ trunk/wp-admin/themes.php        2012-04-16 14:02:28 UTC (rev 20476)
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx"> );
</span><span class="cx"> 
</span><span class="cx"> wp_enqueue_script( 'theme' );
</span><del>-wp_customize_loader();
</del><ins>+wp_enqueue_script( 'customize-loader' );
</ins><span class="cx"> 
</span><span class="cx"> endif;
</span><span class="cx"> 
</span><span class="lines">@@ -122,7 +122,7 @@
</span><span class="cx">         &lt;/div&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;div class=&quot;theme-options&quot;&gt;
</span><del>-        &lt;a href=&quot;#&quot; class=&quot;load-customize hide-if-no-js&quot; data-customize-template=&quot;&lt;?php echo esc_attr( $ct-&gt;get_template() ); ?&gt;&quot; data-customize-stylesheet=&quot;&lt;?php echo esc_attr( $ct-&gt;get_stylesheet() ); ?&gt;&quot; title=&quot;&lt;?php echo esc_attr( sprintf( __( 'Customize &amp;#8220;%s&amp;#8221;' ), $ct-&gt;get('Name') ) ); ?&gt;&quot;&gt;&lt;?php _e( 'Customize' )?&gt;&lt;/a&gt;
</del><ins>+        &lt;a &lt;?php echo wp_customize_href( $ct-&gt;get_template(), $ct-&gt;get_stylesheet() ); ?&gt; class=&quot;load-customize hide-if-no-customize&quot; title=&quot;&lt;?php echo esc_attr( sprintf( __( 'Customize &amp;#8220;%s&amp;#8221;' ), $ct-&gt;get('Name') ) ); ?&gt;&quot;&gt;&lt;?php _e( 'Customize' )?&gt;&lt;/a&gt;
</ins><span class="cx">         &lt;span&gt;&lt;?php _e( 'Options:' )?&gt;&lt;/span&gt;
</span><span class="cx">         &lt;?php
</span><span class="cx">         // Pretend you didn't see this.
</span></span></pre></div>
<a id="trunkwpadminupdatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/update.php (20475 => 20476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/update.php        2012-04-15 21:17:55 UTC (rev 20475)
+++ trunk/wp-admin/update.php        2012-04-16 14:02:28 UTC (rev 20476)
</span><span class="lines">@@ -152,7 +152,7 @@
</span><span class="cx"> 
</span><span class="cx">                 check_admin_referer('upgrade-theme_' . $theme);
</span><span class="cx"> 
</span><del>-                wp_customize_loader();
</del><ins>+                wp_enqueue_script( 'customize-loader' );
</ins><span class="cx"> 
</span><span class="cx">                 $title = __('Update Theme');
</span><span class="cx">                 $parent_file = 'themes.php';
</span><span class="lines">@@ -204,7 +204,7 @@
</span><span class="cx">                 if ( is_wp_error($api) )
</span><span class="cx">                          wp_die($api);
</span><span class="cx"> 
</span><del>-                 wp_customize_loader();
</del><ins>+                wp_enqueue_script( 'customize-loader' );
</ins><span class="cx"> 
</span><span class="cx">                 $title = __('Install Themes');
</span><span class="cx">                 $parent_file = 'themes.php';
</span><span class="lines">@@ -230,7 +230,7 @@
</span><span class="cx"> 
</span><span class="cx">                 $file_upload = new File_Upload_Upgrader('themezip', 'package');
</span><span class="cx"> 
</span><del>-                wp_customize_loader();
</del><ins>+                wp_enqueue_script( 'customize-loader' );
</ins><span class="cx"> 
</span><span class="cx">                 $title = __('Upload Theme');
</span><span class="cx">                 $parent_file = 'themes.php';
</span></span></pre></div>
<a id="trunkwpincludescsscustomizecontrolsdevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/css/customize-controls.dev.css (20475 => 20476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/css/customize-controls.dev.css        2012-04-15 21:17:55 UTC (rev 20475)
+++ trunk/wp-includes/css/customize-controls.dev.css        2012-04-16 14:02:28 UTC (rev 20476)
</span><span class="lines">@@ -182,14 +182,6 @@
</span><span class="cx">         margin-right: 5px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#customize-preview {
-        position: fixed;
-        left: 300px;
-        right: 0;
-        top: 0;
-        bottom: 0;
-}
-
</del><span class="cx"> #customize-preview iframe {
</span><span class="cx">         width: 100%;
</span><span class="cx">         height: 100%;
</span></span></pre></div>
<a id="trunkwpincludescustomizecontrolsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/customize-controls.php (20475 => 20476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/customize-controls.php        2012-04-15 21:17:55 UTC (rev 20475)
+++ trunk/wp-includes/customize-controls.php        2012-04-16 14:02:28 UTC (rev 20476)
</span><span class="lines">@@ -50,7 +50,11 @@
</span><span class="cx">                 &lt;input type=&quot;hidden&quot; id=&quot;customize-template&quot; name=&quot;template&quot; value=&quot;&lt;?php echo esc_attr( $theme['Template'] ); ?&gt;&quot; /&gt;
</span><span class="cx">                 &lt;input type=&quot;hidden&quot; id=&quot;customize-stylesheet&quot; name=&quot;stylesheet&quot; value=&quot;&lt;?php echo esc_attr( $theme['Stylesheet'] ); ?&gt;&quot; /&gt;
</span><span class="cx"> 
</span><del>-                &lt;div id=&quot;customize-header-actions&quot; class=&quot;customize-section wp-full-overlay-header&quot;&gt;&amp;nbsp;&lt;/div&gt;
</del><ins>+                &lt;div id=&quot;customize-header-actions&quot; class=&quot;customize-section wp-full-overlay-header&quot;&gt;
+                        &lt;a class=&quot;back&quot; href=&quot;&lt;?php echo esc_url( admin_url( 'themes.php' ) ); ?&gt;&quot;&gt;
+                                &lt;?php printf( __( '&amp;larr; Return to %s' ), __('Manage Themes') ); ?&gt;
+                        &lt;/a&gt;
+                &lt;/div&gt;
</ins><span class="cx"> 
</span><span class="cx">                 &lt;div id=&quot;customize-info&quot; class=&quot;customize-section&quot;&gt;
</span><span class="cx">                         &lt;div class=&quot;customize-section-title&quot;&gt;
</span><span class="lines">@@ -79,6 +83,10 @@
</span><span class="cx">                         &lt;?php
</span><span class="cx">                         submit_button( __( 'Save' ), 'primary', 'save', false );
</span><span class="cx">                         ?&gt;
</span><ins>+                        &lt;a href=&quot;#&quot; class=&quot;collapse-sidebar button-secondary&quot; title=&quot;&lt;?php esc_attr_e('Collapse Sidebar'); ?&gt;&quot;&gt;
+                                &lt;span class=&quot;collapse-sidebar-label&quot;&gt;&lt;?php _e('Collapse'); ?&gt;&lt;/span&gt;
+                                &lt;span class=&quot;collapse-sidebar-arrow&quot;&gt;&lt;/span&gt;
+                        &lt;/a&gt;
</ins><span class="cx">                 &lt;/div&gt;
</span><span class="cx">         &lt;/form&gt;
</span><span class="cx">         &lt;div id=&quot;customize-preview&quot; class=&quot;wp-full-overlay-main&quot;&gt;
</span><span class="lines">@@ -95,6 +103,7 @@
</span><span class="cx">                 'settings' =&gt; array(),
</span><span class="cx">                 'controls' =&gt; array(),
</span><span class="cx">                 'prefix'   =&gt; WP_Customize_Setting::name_prefix,
</span><ins>+                'parent'   =&gt; esc_url( admin_url() ),
</ins><span class="cx">         );
</span><span class="cx"> 
</span><span class="cx">         foreach ( $this-&gt;settings as $id =&gt; $setting ) {
</span></span></pre></div>
<a id="trunkwpincludesjscustomizebasedevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/customize-base.dev.js (20475 => 20476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/customize-base.dev.js        2012-04-15 21:17:55 UTC (rev 20475)
+++ trunk/wp-includes/js/customize-base.dev.js        2012-04-16 14:02:28 UTC (rev 20476)
</span><span class="lines">@@ -457,6 +457,8 @@
</span><span class="cx">                 send: function( id, data ) {
</span><span class="cx">                         var message;
</span><span class="cx"> 
</span><ins>+                        data = data || {};
+
</ins><span class="cx">                         if ( ! this.url() )
</span><span class="cx">                                 return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesjscustomizecontrolsdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/customize-controls.dev.js (20475 => 20476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/customize-controls.dev.js        2012-04-15 21:17:55 UTC (rev 20475)
+++ trunk/wp-includes/js/customize-controls.dev.js        2012-04-16 14:02:28 UTC (rev 20476)
</span><span class="lines">@@ -216,6 +216,8 @@
</span><span class="cx">                  *  - url    - the URL of preview frame
</span><span class="cx">                  */
</span><span class="cx">                 initialize: function( params, options ) {
</span><ins>+                        var self = this;
+
</ins><span class="cx">                         $.extend( this, options || {} );
</span><span class="cx"> 
</span><span class="cx">                         this.loaded = $.proxy( this.loaded, this );
</span><span class="lines">@@ -287,6 +289,21 @@
</span><span class="cx">                                 if ( 13 === e.which ) // Enter
</span><span class="cx">                                         e.preventDefault();
</span><span class="cx">                         });
</span><ins>+
+                        // Create a potential postMessage connection with the parent frame.
+                        this.parent = new api.Messenger( api.settings.parent );
+
+                        // If we receive a 'back' event, we're inside an iframe.
+                        // Send any clicks to the 'Return' link to the parent page.
+                        this.parent.bind( 'back', function( text ) {
+                                self.form.find('.back').text( text ).click( function( event ) {
+                                        event.preventDefault();
+                                        self.parent.send( 'close' );
+                                });
+                        });
+
+                        // Initialize the connection with the parent frame.
+                        this.parent.send( 'ready' );
</ins><span class="cx">                 },
</span><span class="cx">                 loader: function() {
</span><span class="cx">                         if ( this.loading )
</span><span class="lines">@@ -337,11 +354,12 @@
</span><span class="cx">                         return;
</span><span class="cx"> 
</span><span class="cx">                 // Initialize Previewer
</span><del>-                var previewer = new api.Previewer({
-                        iframe: '#customize-preview iframe',
-                        form:   '#customize-controls',
-                        url:    api.settings.preview
-                });
</del><ins>+                var body = $( document.body ),
+                        previewer = new api.Previewer({
+                                iframe: '#customize-preview iframe',
+                                form:   '#customize-controls',
+                                url:    api.settings.preview
+                        });
</ins><span class="cx"> 
</span><span class="cx">                 $.each( api.settings.settings, function( id, data ) {
</span><span class="cx">                         api.set( id, id, data.value, {
</span><span class="lines">@@ -380,11 +398,16 @@
</span><span class="cx">                 });
</span><span class="cx"> 
</span><span class="cx">                 // Button bindings.
</span><del>-                $('#save').click( function() {
</del><ins>+                $('#save').click( function( event ) {
</ins><span class="cx">                         previewer.submit();
</span><del>-                        return false;
</del><ins>+                        event.preventDefault();
</ins><span class="cx">                 });
</span><span class="cx"> 
</span><ins>+                $('.collapse-sidebar').click( function( event ) {
+                        body.toggleClass( 'collapsed' );
+                        event.preventDefault();
+                });
+
</ins><span class="cx">                 // Background color uses postMessage by default
</span><span class="cx">                 api( 'background_color', function( setting ) {
</span><span class="cx">                         setting.method = 'postMessage';
</span></span></pre></div>
<a id="trunkwpincludesjscustomizeloaderdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/customize-loader.dev.js (20475 => 20476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/customize-loader.dev.js        2012-04-15 21:17:55 UTC (rev 20475)
+++ trunk/wp-includes/js/customize-loader.dev.js        2012-04-16 14:02:28 UTC (rev 20476)
</span><span class="lines">@@ -2,29 +2,36 @@
</span><span class="cx">         var wp = {};
</span><span class="cx"> 
</span><span class="cx"> (function( exports, $ ){
</span><del>-        var Loader = {
</del><ins>+        var api = wp.customize,
+                Loader;
+
+        Loader = {
</ins><span class="cx">                 initialize: function() {
</span><del>-                        this.body      = $( document.body );
-                        this.element   = $( '#customize-container' );
-                        this.base      = $( '.admin-url', this.element ).val();
</del><ins>+                        this.body      = $( document.body ).addClass('customize-support');
+                        this.element   = $( '&lt;div id=&quot;customize-container&quot; class=&quot;wp-full-overlay&quot; /&gt;' ).appendTo( this.body );
</ins><span class="cx"> 
</span><del>-                        this.element.on( 'click', '.close-full-overlay', function() {
-                                Loader.close();
-                                return false;
-                        });
</del><ins>+                        $('#wpbody').on( 'click', '.load-customize', function( event ) {
+                                event.preventDefault();
</ins><span class="cx"> 
</span><del>-                        this.element.on( 'click', '.collapse-sidebar', function() {
-                                Loader.element.toggleClass('collapsed');
-                                return false;
</del><ins>+                                // Load the theme.
+                                Loader.open( $(this).attr('href') );
</ins><span class="cx">                         });
</span><span class="cx">                 },
</span><del>-                open: function( params ) {
-                        params.customize = 'on';
</del><ins>+                open: function( src ) {
+                        this.iframe = $( '&lt;iframe /&gt;', { src: src }).appendTo( this.element );
</ins><span class="cx"> 
</span><del>-                        this.iframe = $( '&lt;iframe /&gt;', {
-                                src: this.base + '?' + jQuery.param( params )
-                        }).appendTo( this.element );
</del><ins>+                        // Create a postMessage connection with the iframe.
+                        this.messenger = new api.Messenger( src, this.iframe[0].contentWindow );
</ins><span class="cx"> 
</span><ins>+                        // Wait for the connection from the iframe before sending any postMessage events.
+                        this.messenger.bind( 'ready', function() {
+                                Loader.messenger.send( 'back', wpCustomizeLoaderL10n.back );
+                        });
+
+                        this.messenger.bind( 'close', function() {
+                                Loader.close();
+                        });
+
</ins><span class="cx">                         this.element.fadeIn( 200, function() {
</span><span class="cx">                                 Loader.body.addClass( 'customize-active full-overlay-active' );
</span><span class="cx">                         });
</span><span class="lines">@@ -32,28 +39,18 @@
</span><span class="cx">                 close: function() {
</span><span class="cx">                         this.element.fadeOut( 200, function() {
</span><span class="cx">                                 Loader.iframe.remove();
</span><del>-                                Loader.iframe = null;
</del><ins>+                                Loader.iframe    = null;
+                                Loader.messenger = null;
</ins><span class="cx">                                 Loader.body.removeClass( 'customize-active full-overlay-active' );
</span><span class="cx">                         });
</span><span class="cx">                 }
</span><span class="cx">         };
</span><span class="cx"> 
</span><span class="cx">         $( function() {
</span><del>-                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')
-                        });
-                });
</del><ins>+                if ( !! window.postMessage )
+                        Loader.initialize();
</ins><span class="cx">         });
</span><span class="cx"> 
</span><span class="cx">         // Expose the API to the world.
</span><del>-        exports.CustomizeLoader = Loader;
</del><ins>+        api.Loader = Loader;
</ins><span class="cx"> })( wp, jQuery );
</span></span></pre></div>
<a id="trunkwpincludesjscustomizepreviewdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/customize-preview.dev.js (20475 => 20476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/customize-preview.dev.js        2012-04-15 21:17:55 UTC (rev 20475)
+++ trunk/wp-includes/js/customize-preview.dev.js        2012-04-16 14:02:28 UTC (rev 20476)
</span><span class="lines">@@ -13,10 +13,8 @@
</span><span class="cx">                 initialize: function( url, options ) {
</span><span class="cx">                         var self = this;
</span><span class="cx"> 
</span><del>-                        $.extend( this, options || {} );
</del><ins>+                        api.Messenger.prototype.initialize.call( this, url, null, options );
</ins><span class="cx"> 
</span><del>-                        api.Messenger.prototype.initialize.call( this, url );
-
</del><span class="cx">                         this.body = $( document.body );
</span><span class="cx">                         this.body.on( 'click.preview', 'a', function( event ) {
</span><span class="cx">                                 event.preventDefault();
</span><span class="lines">@@ -29,24 +27,6 @@
</span><span class="cx">                         this.body.on( 'submit.preview', 'form', function( event ) {
</span><span class="cx">                                 event.preventDefault();
</span><span class="cx">                         });
</span><del>-
-                        this.bind( 'url', function( url ) {
-                                this.url( url );
-                                this.refresh();
-                        });
-                },
-                refresh: function() {
-                        this.submit({
-                                target: this.iframe.prop('name'),
-                                action: this.url()
-                        });
-                },
-                submit: function( props ) {
-                        if ( props )
-                                this.form.prop( props );
-                        this.form.submit();
-                        if ( props )
-                                this.form.prop( this._formOriginalProps );
</del><span class="cx">                 }
</span><span class="cx">         });
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (20475 => 20476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2012-04-15 21:17:55 UTC (rev 20475)
+++ trunk/wp-includes/script-loader.php        2012-04-16 14:02:28 UTC (rev 20476)
</span><span class="lines">@@ -298,10 +298,10 @@
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'hoverIntent', &quot;/wp-includes/js/hoverIntent$suffix.js&quot;, array('jquery'), 'r6', 1 );
</span><span class="cx"> 
</span><del>-        $scripts-&gt;add( 'customize-loader', &quot;/wp-includes/js/customize-loader$suffix.js&quot;,   array( 'jquery' ), false, 1 );
-        $scripts-&gt;add( 'customize-base', &quot;/wp-includes/js/customize-base$suffix.js&quot;,       array( 'jquery-postmessage', 'json2' ), false, 1 );
</del><ins>+        $scripts-&gt;add( 'customize-base',     &quot;/wp-includes/js/customize-base$suffix.js&quot;,     array( 'jquery-postmessage', 'json2' ), false, 1 );
+        $scripts-&gt;add( 'customize-loader',   &quot;/wp-includes/js/customize-loader$suffix.js&quot;,   array( 'customize-base' ), false, 1 );
</ins><span class="cx">         $scripts-&gt;add( 'customize-controls', &quot;/wp-includes/js/customize-controls$suffix.js&quot;, array( 'customize-base' ), false, 1 );
</span><del>-        $scripts-&gt;add( 'customize-preview', &quot;/wp-includes/js/customize-preview$suffix.js&quot;,  array( 'customize-base' ), false, 1 );
</del><ins>+        $scripts-&gt;add( 'customize-preview',  &quot;/wp-includes/js/customize-preview$suffix.js&quot;,  array( 'customize-base' ), false, 1 );
</ins><span class="cx"> 
</span><span class="cx">         if ( is_admin() ) {
</span><span class="cx">                 $scripts-&gt;add( 'ajaxcat', &quot;/wp-admin/js/cat$suffix.js&quot;, array( 'wp-lists' ) );
</span></span></pre></div>
<a id="trunkwpincludesthemephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/theme.php (20475 => 20476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/theme.php        2012-04-15 21:17:55 UTC (rev 20475)
+++ trunk/wp-includes/theme.php        2012-04-16 14:02:28 UTC (rev 20476)
</span><span class="lines">@@ -1583,30 +1583,33 @@
</span><span class="cx"> add_action( 'plugins_loaded', '_wp_customize_include' );
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Includes the loading scripts for the theme customizer and
- * adds the action to print the customize container template.
</del><ins>+ * Localizes the customize-loader script.
</ins><span class="cx">  *
</span><span class="cx">  * @since 3.4.0
</span><span class="cx">  */
</span><del>-function wp_customize_loader() {
-        wp_enqueue_script( 'customize-loader' );
-        add_action( 'admin_footer', '_wp_customize_loader_template' );
</del><ins>+function _wp_customize_loader_localize() {
+        wp_localize_script( 'customize-loader', 'wpCustomizeLoaderL10n', array(
+                'back' =&gt; sprintf( __( '&amp;larr; Return to %s' ), get_admin_page_title() ),
+        ) );
</ins><span class="cx"> }
</span><ins>+add_action( 'admin_enqueue_scripts', '_wp_customize_loader_localize' );
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Print the customize container template.
</del><ins>+ * Returns a URL to load the theme customizer.
</ins><span class="cx">  *
</span><span class="cx">  * @since 3.4.0
</span><span class="cx">  */
</span><del>-function _wp_customize_loader_template() {
-        ?&gt;
-        &lt;div id=&quot;customize-container&quot; class=&quot;wp-full-overlay&quot;&gt;
-                &lt;input type=&quot;hidden&quot; class=&quot;admin-url&quot; value=&quot;&lt;?php echo esc_url( admin_url( 'admin.php' ) ); ?&gt;&quot; /&gt;
-                &lt;a href=&quot;#&quot; class=&quot;close-full-overlay&quot;&gt;&lt;?php printf( __( '&amp;larr; Return to %s' ), get_admin_page_title() ); ?&gt;&lt;/a&gt;
-                &lt;a href=&quot;#&quot; class=&quot;collapse-sidebar button-secondary&quot; title=&quot;&lt;?php esc_attr_e('Collapse Sidebar'); ?&gt;&quot;&gt;
-                        &lt;span class=&quot;collapse-sidebar-label&quot;&gt;&lt;?php _e('Collapse'); ?&gt;&lt;/span&gt;
-                        &lt;span class=&quot;collapse-sidebar-arrow&quot;&gt;&lt;/span&gt;
-                &lt;/a&gt;
-        &lt;/div&gt;
-        &lt;?php
</del><ins>+function wp_customize_url( $template, $stylesheet = null ) {
+        $stylesheet = isset( $stylesheet ) ? $stylesheet : $template;
+        return admin_url( 'admin.php' ) . '?customize=on&amp;template=' . $template . '&amp;stylesheet=' . $stylesheet;
+}
+
+/**
+ * Prints an href attribute to load the theme customizer.
+ *
+ * @since 3.4.0
+ */
+function wp_customize_href( $template, $stylesheet = null ) {
+        $link = wp_customize_url( $template, $stylesheet );
+        return 'href=&quot;' . esc_url( $link ) . '&quot;';
</ins><span class="cx"> }
</span><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>