<!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>[26141] trunk: Update the Themes screen, merging THX into core.</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 { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { 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/26141">26141</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2013-11-13 20:57:29 +0000 (Wed, 13 Nov 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Update the Themes screen, merging THX into core.

 * Name: THX38
 * Description: Update the Themes screen with a new design and experience.
 * Tags: visually-focused, bigger-screenshots, fast, mobile-friendly, backbone-driven
 * Author: matveb, shaunandrews, melchoyce, designsimply, shelob9
 * URI: http://wordpress.org/plugins/thx38/

fixes <a href="http://core.trac.wordpress.org/ticket/25948">#25948</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkGruntfilejs">trunk/Gruntfile.js</a></li>
<li><a href="#trunksrcwpadminincludesthemephp">trunk/src/wp-admin/includes/theme.php</a></li>
<li><a href="#trunksrcwpadminthemesphp">trunk/src/wp-admin/themes.php</a></li>
<li><a href="#trunksrcwpincludesscriptloaderphp">trunk/src/wp-includes/script-loader.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjsthemeinstalljs">trunk/src/wp-admin/js/theme-install.js</a></li>
<li><a href="#trunksrcwpadminjsthemejs">trunk/src/wp-admin/js/theme.js</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjsthemejs">trunk/src/wp-admin/js/theme.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkGruntfilejs"></a>
<div class="modfile"><h4>Modified: trunk/Gruntfile.js (26140 => 26141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Gruntfile.js       2013-11-13 20:05:51 UTC (rev 26140)
+++ trunk/Gruntfile.js  2013-11-13 20:57:29 UTC (rev 26141)
</span><span class="lines">@@ -102,6 +102,7 @@
</span><span class="cx">                                  'wp-admin/css/*.css',
</span><span class="cx">                                  'wp-includes/css/*.css',
</span><span class="cx">                                  // Exceptions
</span><ins>+                                       '!wp-admin/css/theme.css', // Temporary file
</ins><span class="cx">                                   '!wp-admin/css/farbtastic.css'
</span><span class="cx">                          ]
</span><span class="cx">                  },
</span></span></pre></div>
<a id="trunksrcwpadminincludesthemephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/theme.php (26140 => 26141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/theme.php    2013-11-13 20:05:51 UTC (rev 26140)
+++ trunk/src/wp-admin/includes/theme.php       2013-11-13 20:57:29 UTC (rev 26141)
</span><span class="lines">@@ -345,3 +345,60 @@
</span><span class="cx">   */
</span><span class="cx">  return apply_filters( 'themes_api_result', $res, $action, $args );
</span><span class="cx"> }
</span><ins>+
+/**
+ * Prepare themes for JavaScript.
+ *
+ * @since 3.8.0
+ *
+ * @param array $themes Optional. Array of WP_Theme objects to prepare.
+ *                      Defaults to all allowed themes.
+ *
+ * @return array An associative array of theme data.
+ */
+function wp_prepare_themes_for_js( $themes = null ) {
+       if ( null === $themes ) {
+               $themes = wp_get_themes( array( 'allowed' => true ) );
+       }
+
+       $prepared_themes = array();
+       $current_theme = get_stylesheet();
+
+       $updates = array();
+       if ( current_user_can( 'update_themes' ) ) {
+               $updates = get_site_transient( 'update_themes' );
+               $updates = $updates->response;
+       }
+
+       foreach( $themes as $slug => $theme ) {
+               $parent = false;
+               if ( $theme->parent() ) {
+                       $parent = $theme->parent()->display( 'Name' );
+               }
+
+               $encoded_slug = urlencode( $slug );
+
+               $prepared_themes[] = array(
+                       'id'           => $slug,
+                       'name'         => $theme->display( 'Name' ),
+                       'screenshot'   => array( $theme->get_screenshot() ), // @todo multiple
+                       'description'  => $theme->display( 'Description' ),
+                       'author'       => $theme->get( 'Author' ),
+                       'authorURI'    => $theme->get( 'AuthorURI' ),
+                       'version'      => $theme->get( 'Version' ),
+                       'tags'         => $theme->get( 'Tags' ),
+                       'parent'       => $parent,
+                       'active'       => $slug === $current_theme,
+                       'hasUpdate'    => isset( $updates[ $slug ] ),
+                       'update'       => 'New version available', // @todo complete this
+                       'actions'      => array(
+                               'activate' => wp_nonce_url( 'themes.php?action=activate&amp;stylesheet=' . $encoded_slug, 'switch-theme_' . $slug ),
+                               'customize'=> admin_url( 'customize.php?theme=' . $encoded_slug ),
+                               'delete'   => wp_nonce_url( 'themes.php?action=delete&amp;stylesheet=' . $encoded_slug, 'delete-theme_' . $slug ),
+                       ),
+               );
+       }
+       // var_dump( $prepared_themes );
+
+       return $prepared_themes;
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpadminjsthemeinstalljsfromrev26140trunksrcwpadminjsthemejs"></a>
<div class="copfile"><h4>Copied: trunk/src/wp-admin/js/theme-install.js (from rev 26140, trunk/src/wp-admin/js/theme.js) (0 => 26141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/theme-install.js                           (rev 0)
+++ trunk/src/wp-admin/js/theme-install.js      2013-11-13 20:57:29 UTC (rev 26141)
</span><span class="lines">@@ -0,0 +1,279 @@
</span><ins>+/**
+ * Theme Browsing
+ *
+ * Controls visibility of theme details on manage and install themes pages.
+ */
+jQuery( function($) {
+       $('#availablethemes').on( 'click', '.theme-detail', function (event) {
+               var theme   = $(this).closest('.available-theme'),
+                       details = theme.find('.themedetaildiv');
+
+               if ( ! details.length ) {
+                       details = theme.find('.install-theme-info .theme-details');
+                       details = details.clone().addClass('themedetaildiv').appendTo( theme ).hide();
+               }
+
+               details.toggle();
+               event.preventDefault();
+       });
+});
+
+/**
+ * Theme Browser Thickbox
+ *
+ * Aligns theme browser thickbox.
+ */
+var tb_position;
+jQuery(document).ready( function($) {
+       tb_position = function() {
+               var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 1040 < width ) ? 1040 : width, adminbar_height = 0;
+
+               if ( $('body.admin-bar').length )
+                       adminbar_height = 28;
+
+               if ( tbWindow.size() ) {
+                       tbWindow.width( W - 50 ).height( H - 45 - adminbar_height );
+                       $('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height );
+                       tbWindow.css({'margin-left': '-' + parseInt( ( ( W - 50 ) / 2 ), 10 ) + 'px'});
+                       if ( typeof document.body.style.maxWidth != 'undefined' )
+                               tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'});
+               };
+       };
+
+       $(window).resize(function(){ tb_position(); });
+});
+
+/**
+ * Theme Install
+ *
+ * Displays theme previews on theme install pages.
+ */
+jQuery( function($) {
+       if( ! window.postMessage )
+               return;
+
+       var preview = $('#theme-installer'),
+               info    = preview.find('.install-theme-info'),
+               panel   = preview.find('.wp-full-overlay-main'),
+               body    = $( document.body );
+
+       preview.on( 'click', '.close-full-overlay', function( event ) {
+               preview.fadeOut( 200, function() {
+                       panel.empty();
+                       body.removeClass('theme-installer-active full-overlay-active');
+               });
+               event.preventDefault();
+       });
+
+       preview.on( 'click', '.collapse-sidebar', function( event ) {
+               preview.toggleClass( 'collapsed' ).toggleClass( 'expanded' );
+               event.preventDefault();
+       });
+
+       $('#availablethemes').on( 'click', '.install-theme-preview', function( event ) {
+               var src;
+
+               info.html( $(this).closest('.installable-theme').find('.install-theme-info').html() );
+               src = info.find( '.theme-preview-url' ).val();
+               panel.html( '<iframe src="' + src + '" />');
+               preview.fadeIn( 200, function() {
+                       body.addClass('theme-installer-active full-overlay-active');
+               });
+               event.preventDefault();
+       });
+});
+
+var ThemeViewer;
+
+(function($){
+       ThemeViewer = function( args ) {
+
+               function init() {
+                       $( '#filter-click, #mini-filter-click' ).unbind( 'click' ).click( function() {
+                               $( '#filter-click' ).toggleClass( 'current' );
+                               $( '#filter-box' ).slideToggle();
+                               $( '#current-theme' ).slideToggle( 300 );
+                               return false;
+                       });
+
+                       $( '#filter-box :checkbox' ).unbind( 'click' ).click( function() {
+                               var count = $( '#filter-box :checked' ).length,
+                                       text  = $( '#filter-click' ).text();
+
+                               if ( text.indexOf( '(' ) != -1 )
+                                       text = text.substr( 0, text.indexOf( '(' ) );
+
+                               if ( count == 0 )
+                                       $( '#filter-click' ).text( text );
+                               else
+                                       $( '#filter-click' ).text( text + ' (' + count + ')' );
+                       });
+
+                       /* $('#filter-box :submit').unbind( 'click' ).click(function() {
+                               var features = [];
+                               $('#filter-box :checked').each(function() {
+                                       features.push($(this).val());
+                               });
+
+                               listTable.update_rows({'features': features}, true, function() {
+                                       $( '#filter-click' ).toggleClass( 'current' );
+                                       $( '#filter-box' ).slideToggle();
+                                       $( '#current-theme' ).slideToggle( 300 );
+                               });
+
+                               return false;
+                       }); */
+               }
+
+               // These are the functions we expose
+               var api = {
+                       init: init
+               };
+
+       return api;
+       }
+})(jQuery);
+
+jQuery( document ).ready( function($) {
+       theme_viewer = new ThemeViewer();
+       theme_viewer.init();
+});
+
+
+/**
+ * Class that provides infinite scroll for Themes admin screens
+ *
+ * @since 3.4
+ *
+ * @uses ajaxurl
+ * @uses list_args
+ * @uses theme_list_args
+ * @uses $('#_ajax_fetch_list_nonce').val()
+* */
+var ThemeScroller;
+(function($){
+       ThemeScroller = {
+               querying: false,
+               scrollPollingDelay: 500,
+               failedRetryDelay: 4000,
+               outListBottomThreshold: 300,
+
+               /**
+                * Initializer
+                *
+                * @since 3.4
+                * @access private
+                */
+               init: function() {
+                       var self = this;
+
+                       // Get out early if we don't have the required arguments.
+                       if ( typeof ajaxurl === 'undefined' ||
+                                typeof list_args === 'undefined' ||
+                                typeof theme_list_args === 'undefined' ) {
+                                       $('.pagination-links').show();
+                                       return;
+                       }
+
+                       // Handle inputs
+                       this.nonce = $('#_ajax_fetch_list_nonce').val();
+                       this.nextPage = ( theme_list_args.paged + 1 );
+
+                       // Cache jQuery selectors
+                       this.$outList = $('#availablethemes');
+                       this.$spinner = $('div.tablenav.bottom').children( '.spinner' );
+                       this.$window = $(window);
+                       this.$document = $(document);
+
+                       /**
+                        * If there are more pages to query, then start polling to track
+                        * when user hits the bottom of the current page
+                        */
+                       if ( theme_list_args.total_pages >= this.nextPage )
+                               this.pollInterval =
+                                       setInterval( function() {
+                                               return self.poll();
+                                       }, this.scrollPollingDelay );
+               },
+
+               /**
+                * Checks to see if user has scrolled to bottom of page.
+                * If so, requests another page of content from self.ajax().
+                *
+                * @since 3.4
+                * @access private
+                */
+               poll: function() {
+                       var bottom = this.$document.scrollTop() + this.$window.innerHeight();
+
+                       if ( this.querying ||
+                               ( bottom < this.$outList.height() - this.outListBottomThreshold ) )
+                               return;
+
+                       this.ajax();
+               },
+
+               /**
+                * Applies results passed from this.ajax() to $outList
+                *
+                * @since 3.4
+                * @access private
+                *
+                * @param results Array with results from this.ajax() query.
+                */
+               process: function( results ) {
+                       if ( results === undefined ) {
+                               clearInterval( this.pollInterval );
+                               return;
+                       }
+
+                       if ( this.nextPage > theme_list_args.total_pages )
+                               clearInterval( this.pollInterval );
+
+                       if ( this.nextPage <= ( theme_list_args.total_pages + 1 ) )
+                               this.$outList.append( results.rows );
+               },
+
+               /**
+                * Queries next page of themes
+                *
+                * @since 3.4
+                * @access private
+                */
+               ajax: function() {
+                       var self = this;
+
+                       this.querying = true;
+
+                       var query = {
+                               action: 'fetch-list',
+                               paged: this.nextPage,
+                               s: theme_list_args.search,
+                               tab: theme_list_args.tab,
+                               type: theme_list_args.type,
+                               _ajax_fetch_list_nonce: this.nonce,
+                               'features[]': theme_list_args.features,
+                               'list_args': list_args
+                       };
+
+                       this.$spinner.show();
+                       $.getJSON( ajaxurl, query )
+                               .done( function( response ) {
+                                       self.nextPage++;
+                                       self.process( response );
+                                       self.$spinner.hide();
+                                       self.querying = false;
+                               })
+                               .fail( function() {
+                                       self.$spinner.hide();
+                                       self.querying = false;
+                                       setTimeout( function() { self.ajax(); }, self.failedRetryDelay );
+                               });
+               }
+       }
+
+       $(document).ready( function($) {
+               ThemeScroller.init();
+       });
+
+})(jQuery);
</ins></span></pre></div>
<a id="trunksrcwpadminjsthemejs"></a>
<div class="delfile"><h4>Deleted: trunk/src/wp-admin/js/theme.js (26140 => 26141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/theme.js   2013-11-13 20:05:51 UTC (rev 26140)
+++ trunk/src/wp-admin/js/theme.js      2013-11-13 20:57:29 UTC (rev 26141)
</span><span class="lines">@@ -1,279 +0,0 @@
</span><del>-/**
- * Theme Browsing
- *
- * Controls visibility of theme details on manage and install themes pages.
- */
-jQuery( function($) {
-       $('#availablethemes').on( 'click', '.theme-detail', function (event) {
-               var theme   = $(this).closest('.available-theme'),
-                       details = theme.find('.themedetaildiv');
-
-               if ( ! details.length ) {
-                       details = theme.find('.install-theme-info .theme-details');
-                       details = details.clone().addClass('themedetaildiv').appendTo( theme ).hide();
-               }
-
-               details.toggle();
-               event.preventDefault();
-       });
-});
-
-/**
- * Theme Browser Thickbox
- *
- * Aligns theme browser thickbox.
- */
-var tb_position;
-jQuery(document).ready( function($) {
-       tb_position = function() {
-               var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 1040 < width ) ? 1040 : width, adminbar_height = 0;
-
-               if ( $('body.admin-bar').length )
-                       adminbar_height = 28;
-
-               if ( tbWindow.size() ) {
-                       tbWindow.width( W - 50 ).height( H - 45 - adminbar_height );
-                       $('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height );
-                       tbWindow.css({'margin-left': '-' + parseInt( ( ( W - 50 ) / 2 ), 10 ) + 'px'});
-                       if ( typeof document.body.style.maxWidth != 'undefined' )
-                               tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'});
-               };
-       };
-
-       $(window).resize(function(){ tb_position(); });
-});
-
-/**
- * Theme Install
- *
- * Displays theme previews on theme install pages.
- */
-jQuery( function($) {
-       if( ! window.postMessage )
-               return;
-
-       var preview = $('#theme-installer'),
-               info    = preview.find('.install-theme-info'),
-               panel   = preview.find('.wp-full-overlay-main'),
-               body    = $( document.body );
-
-       preview.on( 'click', '.close-full-overlay', function( event ) {
-               preview.fadeOut( 200, function() {
-                       panel.empty();
-                       body.removeClass('theme-installer-active full-overlay-active');
-               });
-               event.preventDefault();
-       });
-
-       preview.on( 'click', '.collapse-sidebar', function( event ) {
-               preview.toggleClass( 'collapsed' ).toggleClass( 'expanded' );
-               event.preventDefault();
-       });
-
-       $('#availablethemes').on( 'click', '.install-theme-preview', function( event ) {
-               var src;
-
-               info.html( $(this).closest('.installable-theme').find('.install-theme-info').html() );
-               src = info.find( '.theme-preview-url' ).val();
-               panel.html( '<iframe src="' + src + '" />');
-               preview.fadeIn( 200, function() {
-                       body.addClass('theme-installer-active full-overlay-active');
-               });
-               event.preventDefault();
-       });
-});
-
-var ThemeViewer;
-
-(function($){
-       ThemeViewer = function( args ) {
-
-               function init() {
-                       $( '#filter-click, #mini-filter-click' ).unbind( 'click' ).click( function() {
-                               $( '#filter-click' ).toggleClass( 'current' );
-                               $( '#filter-box' ).slideToggle();
-                               $( '#current-theme' ).slideToggle( 300 );
-                               return false;
-                       });
-
-                       $( '#filter-box :checkbox' ).unbind( 'click' ).click( function() {
-                               var count = $( '#filter-box :checked' ).length,
-                                       text  = $( '#filter-click' ).text();
-
-                               if ( text.indexOf( '(' ) != -1 )
-                                       text = text.substr( 0, text.indexOf( '(' ) );
-
-                               if ( count == 0 )
-                                       $( '#filter-click' ).text( text );
-                               else
-                                       $( '#filter-click' ).text( text + ' (' + count + ')' );
-                       });
-
-                       /* $('#filter-box :submit').unbind( 'click' ).click(function() {
-                               var features = [];
-                               $('#filter-box :checked').each(function() {
-                                       features.push($(this).val());
-                               });
-
-                               listTable.update_rows({'features': features}, true, function() {
-                                       $( '#filter-click' ).toggleClass( 'current' );
-                                       $( '#filter-box' ).slideToggle();
-                                       $( '#current-theme' ).slideToggle( 300 );
-                               });
-
-                               return false;
-                       }); */
-               }
-
-               // These are the functions we expose
-               var api = {
-                       init: init
-               };
-
-       return api;
-       }
-})(jQuery);
-
-jQuery( document ).ready( function($) {
-       theme_viewer = new ThemeViewer();
-       theme_viewer.init();
-});
-
-
-/**
- * Class that provides infinite scroll for Themes admin screens
- *
- * @since 3.4
- *
- * @uses ajaxurl
- * @uses list_args
- * @uses theme_list_args
- * @uses $('#_ajax_fetch_list_nonce').val()
-* */
-var ThemeScroller;
-(function($){
-       ThemeScroller = {
-               querying: false,
-               scrollPollingDelay: 500,
-               failedRetryDelay: 4000,
-               outListBottomThreshold: 300,
-
-               /**
-                * Initializer
-                *
-                * @since 3.4
-                * @access private
-                */
-               init: function() {
-                       var self = this;
-
-                       // Get out early if we don't have the required arguments.
-                       if ( typeof ajaxurl === 'undefined' ||
-                                typeof list_args === 'undefined' ||
-                                typeof theme_list_args === 'undefined' ) {
-                                       $('.pagination-links').show();
-                                       return;
-                       }
-
-                       // Handle inputs
-                       this.nonce = $('#_ajax_fetch_list_nonce').val();
-                       this.nextPage = ( theme_list_args.paged + 1 );
-
-                       // Cache jQuery selectors
-                       this.$outList = $('#availablethemes');
-                       this.$spinner = $('div.tablenav.bottom').children( '.spinner' );
-                       this.$window = $(window);
-                       this.$document = $(document);
-
-                       /**
-                        * If there are more pages to query, then start polling to track
-                        * when user hits the bottom of the current page
-                        */
-                       if ( theme_list_args.total_pages >= this.nextPage )
-                               this.pollInterval =
-                                       setInterval( function() {
-                                               return self.poll();
-                                       }, this.scrollPollingDelay );
-               },
-
-               /**
-                * Checks to see if user has scrolled to bottom of page.
-                * If so, requests another page of content from self.ajax().
-                *
-                * @since 3.4
-                * @access private
-                */
-               poll: function() {
-                       var bottom = this.$document.scrollTop() + this.$window.innerHeight();
-
-                       if ( this.querying ||
-                               ( bottom < this.$outList.height() - this.outListBottomThreshold ) )
-                               return;
-
-                       this.ajax();
-               },
-
-               /**
-                * Applies results passed from this.ajax() to $outList
-                *
-                * @since 3.4
-                * @access private
-                *
-                * @param results Array with results from this.ajax() query.
-                */
-               process: function( results ) {
-                       if ( results === undefined ) {
-                               clearInterval( this.pollInterval );
-                               return;
-                       }
-
-                       if ( this.nextPage > theme_list_args.total_pages )
-                               clearInterval( this.pollInterval );
-
-                       if ( this.nextPage <= ( theme_list_args.total_pages + 1 ) )
-                               this.$outList.append( results.rows );
-               },
-
-               /**
-                * Queries next page of themes
-                *
-                * @since 3.4
-                * @access private
-                */
-               ajax: function() {
-                       var self = this;
-
-                       this.querying = true;
-
-                       var query = {
-                               action: 'fetch-list',
-                               paged: this.nextPage,
-                               s: theme_list_args.search,
-                               tab: theme_list_args.tab,
-                               type: theme_list_args.type,
-                               _ajax_fetch_list_nonce: this.nonce,
-                               'features[]': theme_list_args.features,
-                               'list_args': list_args
-                       };
-
-                       this.$spinner.show();
-                       $.getJSON( ajaxurl, query )
-                               .done( function( response ) {
-                                       self.nextPage++;
-                                       self.process( response );
-                                       self.$spinner.hide();
-                                       self.querying = false;
-                               })
-                               .fail( function() {
-                                       self.$spinner.hide();
-                                       self.querying = false;
-                                       setTimeout( function() { self.ajax(); }, self.failedRetryDelay );
-                               });
-               }
-       }
-
-       $(document).ready( function($) {
-               ThemeScroller.init();
-       });
-
-})(jQuery);
</del></span></pre></div>
<a id="trunksrcwpadminjsthemejs"></a>
<div class="addfile"><h4>Added: trunk/src/wp-admin/js/theme.js (0 => 26141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/theme.js                           (rev 0)
+++ trunk/src/wp-admin/js/theme.js      2013-11-13 20:57:29 UTC (rev 26141)
</span><span class="lines">@@ -0,0 +1,718 @@
</span><ins>+/* global _wpThemeSettings, confirm */
+window.wp = window.wp || {};
+
+( function($) {
+
+// Set up our namespace...
+var themes = wp.themes = wp.themes || {};
+
+// Store the theme data and settings for organized and quick access
+// themes.data.settings, themes.data.themes, themes.data.i18n
+themes.data = _wpThemeSettings;
+
+// Setup app structure
+_.extend( themes, { model: {}, view: {}, routes: {}, router: {}, template: wp.template });
+
+themes.model = Backbone.Model.extend({});
+
+// Main view controller for themes.php
+// Unifies and renders all available views
+//
+// Hooks to #appearance and organizes the views to be rendered
+themes.view.Appearance = wp.Backbone.View.extend({
+
+       // Set DOM container
+       // {#appearance} by default
+       el: themes.data.settings.container,
+
+       window: $( window ),
+       // Pagination instance
+       page: 0,
+
+       events: {
+               'click .themes-bulk-edit': 'editMode',
+               'click .theme .delete-theme': 'deleteTheme'
+       },
+
+       // Sets up a throttler for binding to 'scroll'
+       initialize: function() {
+               var self = this;
+
+               // Keep a boolean check so that we don't run
+               // too much code on every event trigger
+               this.window.bind( 'scroll.themes', function() {
+                       this.throttle = true;
+               });
+
+               setInterval( function() {
+                       if ( this.throttle ) {
+                               // Once the case is the case, the action occurs and the fact is no more
+                               this.throttle = false;
+                               self.scroller();
+                       }
+               }, 300 );
+       },
+
+       // Main render control
+       render: function() {
+               // Setup the main theme view
+               // with the current theme collection
+               this.view = new themes.view.Themes({
+                       collection: this.collection,
+                       parent: this
+               });
+               // Render and append
+               this.view.render();
+               this.$el.append( this.view.el );
+
+               // Search form
+               this.search();
+       },
+
+       // Search input and view
+       // for current theme collection
+       search: function() {
+               var view,
+                       self = this;
+
+               view = new themes.view.Search({ collection: self.collection });
+
+               // Render and append after screen title
+               view.render();
+               self.$el.find( '> h2' ).after( view.el );
+       },
+
+       // Checks when the user gets close to the bottom
+       // of the mage and triggers a theme:scroll event
+       scroller: function() {
+               var self = this,
+                       bottom, threshold;
+
+               bottom = this.window.scrollTop() + self.window.height();
+               threshold = self.$el.offset().top + self.$el.outerHeight( false ) - self.window.height();
+               threshold = Math.round( threshold * 0.9 );
+
+               if ( bottom > threshold ) {
+                       this.trigger( 'theme:scroll' );
+               }
+       },
+
+       // Enters edit mode that allows easy access to deleting themes
+       editMode: function() {
+               $( 'body' ).toggleClass( 'edit-mode' );
+               this.$el.find( '.themes-bulk-edit' ).toggleClass( 'mp6-text-highlight' );
+       },
+
+       deleteTheme: function() {
+               return confirm( themes.data.settings.confirmDelete );
+       }
+});
+
+// Set up the Collection for our theme data
+// @has 'id' 'name' 'screenshot' 'author' 'authorURI' 'version' 'active' ...
+themes.Collection = Backbone.Collection.extend({
+
+       model: themes.model,
+
+       // Search terms
+       terms: '',
+
+       // Controls searching on the current theme collection
+       // and triggers an update event
+       doSearch: function( value ) {
+
+               // Updates terms with the value passed
+               this.terms = value;
+
+               // If we have terms, run a search...
+               if ( this.terms.length > 0 ) {
+                       this.search( this.terms );
+               }
+
+               // If search is blank, show all themes
+               // Useful for resetting the views when you clean the input
+               if ( this.terms === '' ) {
+                       this.reset( themes.data.themes );
+               }
+
+               // Trigger an 'update' event
+               this.trigger( 'update' );
+       },
+       // Performs a search within the collection
+       // @uses RegExp
+       search: function( term ) {
+               var self = this,
+                       match, results, haystack;
+
+               // Start with a full collection
+               self.reset( themes.data.themes );
+
+               // The RegExp object to match
+               //
+               // Consider spaces as word delimiters and match the whole string
+               // so matching terms can be combined
+               term = term.replace( ' ', ')(?=.*' );
+               match = new RegExp( '^(?=.*' + term + ').+', 'i' );
+
+               // Find results
+               // _.filter and .test
+               results = self.filter( function( data ) {
+                       haystack = _.union( data.get( 'name' ), data.get( 'author' ), data.get( 'tags' ) );
+
+                       if ( match.test( data.get( 'author' ) ) ) {
+                               data.set( 'displayAuthor', true );
+                       }
+
+                       return match.test( haystack );
+               });
+
+               self.reset( results );
+       },
+
+       // Paginates the collection with a helper method
+       // that slices the collection
+       paginate: function( instance ) {
+               var collection = this;
+               instance = instance || 0;
+
+               // Themes per instance are set at 15
+               collection = _( collection.rest( 15 * instance ) );
+               collection = _( collection.first( 15 ) );
+
+               return collection;
+       }
+});
+
+// This is the view that controls each theme item
+// that will be displayed on the screen
+themes.view.Theme = wp.Backbone.View.extend({
+
+       // Wrap theme data on a div.theme element
+       className: 'theme',
+
+       // Reflects which theme view we have
+       // 'grid' (default) or 'detail'
+       state: 'grid',
+
+       // The HTML template for each element to be rendered
+       html: themes.template( 'theme' ),
+
+       events: {
+               'click': 'expand'
+       },
+
+       render: function() {
+               var data = this.model.toJSON();
+               // Render themes using the html template
+               this.$el.html( this.html( data ) );
+               // Renders active theme styles
+               this.activeTheme();
+
+               if ( this.model.get( 'displayAuthor' ) ) {
+                       this.$el.addClass( 'display-author' );
+               }
+       },
+
+       // Adds a class to the currently active theme
+       // and to the overlay in detailed view mode
+       activeTheme: function() {
+               if ( this.model.get( 'active' ) ) {
+                       this.$el.addClass( 'active' );
+                       this.$el.find( '.theme-name' ).addClass( 'mp6-primary' );
+                       $( '#theme-overlay' ).addClass( 'active' );
+               }
+       },
+
+       // Single theme overlay screen
+       // It's shown when clicking a theme
+       expand: function( event ) {
+               var self = this;
+
+               event = event || window.event;
+
+               // Prevent the modal from showing when the user clicks
+               // one of the direct action buttons
+               if ( $( event.target ).is( '.theme-actions a, .delete-theme' ) ) {
+                       return;
+               }
+
+               this.trigger( 'theme:expand', self.model.cid );
+       }
+});
+
+// Theme Details view
+// Set ups a modal overlay with the expanded theme data
+themes.view.Details = wp.Backbone.View.extend({
+
+       // Wrap theme data on a div.theme element
+       id: 'theme-overlay',
+
+       events: {
+               'click': 'collapse',
+               'click .delete-theme': 'deleteTheme',
+               'click .left': 'previousTheme',
+               'click .right': 'nextTheme'
+       },
+
+       // The HTML template for the theme overlay
+       html: themes.template( 'theme-single' ),
+
+       render: function() {
+               var data = this.model.toJSON();
+
+               this.$el.html( this.html( data ) );
+               // Renders active theme styles
+               this.activeTheme();
+               // Set up navigation events
+               this.navigation();
+       },
+
+       // Adds a class to the currently active theme
+       // and to the overlay in detailed view mode
+       activeTheme: function() {
+               // Check the model has the active property
+               if ( this.model.get( 'active' ) ) {
+                       this.$el.addClass( 'active' );
+               } else {
+                       $( '#theme-overlay' ).removeClass( 'active' );
+               }
+       },
+
+       // Single theme overlay screen
+       // It's shown when clicking a theme
+       collapse: function( event ) {
+               var self = this,
+                       scroll;
+
+               event = event || window.event;
+
+               // Detect if the click is inside the overlay
+               // and don't close it unless the target was
+               // the div.back button
+               if ( $( event.target ).is( '.theme-backdrop' ) || $( event.target ).is( 'div.back' ) || event.keyCode === 27 ) {
+
+                       // Add a temporary closing class while overlay fades out
+                       $( 'body' ).addClass( 'closing-overlay' );
+
+                       // With a quick fade out animation
+                       this.$el.fadeOut( 130, function() {
+                               // Clicking outside the modal box closes the overlay
+                               $( 'body' ).removeClass( 'theme-overlay closing-overlay' );
+                               // Handle event cleanup
+                               self.closeOverlay();
+
+                               // Get scroll position to avoid jumping to the top
+                               scroll = document.body.scrollTop;
+
+                               // Clean the url structure
+                               themes.router.navigate( '' );
+
+                               // Restore scroll position
+                               document.body.scrollTop = scroll;
+                       });
+               }
+       },
+
+       // Handles arrow keys navigation for the overlay
+       // Triggers theme:next and theme:previous events
+       navigation: function() {
+               var self = this;
+
+               $( 'body' ).on( 'keyup', function( event ) {
+
+                       // Pressing the right arrow key fires a theme:next event
+                       if ( event.keyCode === 39 ) {
+                               self.trigger( 'theme:next', self.model.cid );
+                       }
+
+                       // Pressing the left arrow key fires a theme:previous event
+                       if ( event.keyCode === 37 ) {
+                               self.trigger( 'theme:previous', self.model.cid );
+                       }
+
+                       // Pressing the escape key closes the theme details panel
+                       if ( event.keyCode === 27 ) {
+                               self.collapse();
+                       }
+               });
+       },
+
+       // Performs the actions to effectively close
+       // the theme details overlay
+       closeOverlay: function() {
+               this.remove();
+               this.unbind();
+               this.trigger( 'theme:collapse' );
+       },
+
+       // Setups an image gallery using the theme screenshots supplied by a theme
+       screenshotGallery: function() {
+               var screenshots = $( '#theme-screenshots' ),
+                       current, img;
+
+               screenshots.find( 'div.first' ).next().addClass( 'selected' );
+
+               // Clicking on a screenshot thumbnail drops it
+               // at the top of the stack in a larger size
+               screenshots.on( 'click', 'div.thumb', function() {
+                       current = $( this );
+                       img = $( this ).find( 'img' ).clone();
+
+                       current.siblings( '.first' ).html( img );
+                       current.siblings( '.selected' ).removeClass( 'selected' );
+                       current.addClass( 'selected' );
+               });
+       },
+
+       // Confirmation dialoge for deleting a theme
+       deleteTheme: function() {
+               return confirm( themes.data.settings.confirmDelete );
+       },
+
+       nextTheme: function() {
+               var self = this;
+               self.trigger( 'theme:next', self.model.cid );
+       },
+
+       previousTheme: function() {
+               var self = this;
+               self.trigger( 'theme:previous', self.model.cid );
+       }
+});
+
+// Controls the rendering of div#themes,
+// a wrapper that will hold all the theme elements
+themes.view.Themes = wp.Backbone.View.extend({
+
+       id: 'themes',
+
+       // Number to keep track of scroll position
+       // while in theme-overlay mode
+       index: 0,
+
+       // The theme count element
+       count: $( '#theme-count' ),
+
+       initialize: function( options ) {
+               var self = this;
+
+               // Set up parent
+               this.parent = options.parent;
+
+               // Set current view to [grid]
+               this.setView( 'grid' );
+
+               // Move the active theme to the beginning of the collection
+               self.currentTheme();
+
+               // When the collection is updated by user input...
+               this.listenTo( self.collection, 'update', function() {
+                       self.parent.page = 0;
+                       self.currentTheme();
+                       self.render( this );
+               });
+
+               this.listenTo( this.parent, 'theme:scroll', function() {
+                       self.renderThemes( self.parent.page );
+               });
+       },
+
+       // Manages rendering of theme pages
+       // and keeping theme count in sync
+       render: function() {
+               // Clear the DOM, please
+               this.$el.html( '' );
+
+               // Generate the themes
+               // Using page instance
+               this.renderThemes( this.parent.page );
+
+               // Display a live theme count for the collection
+               this.count.text( this.collection.length );
+       },
+
+       // Iterates through each instance of the collection
+       // and renders each theme module
+       renderThemes: function( page ) {
+               var self = this;
+
+               self.instance = self.collection.paginate( page );
+
+               // If we have no more themes bail
+               if ( self.instance.length === 0 ) {
+                       return;
+               }
+
+               // Make sure the add-new stays at the end
+               if ( page >= 1 ) {
+                       $( '#add-new' ).remove();
+               }
+
+               // Loop through the themes and setup each theme view
+               self.instance.each( function( theme ) {
+                       self.theme = new themes.view.Theme({
+                               model: theme
+                       });
+
+                       // Render the views...
+                       self.theme.render();
+                       // and append them to div#themes
+                       self.$el.append( self.theme.el );
+
+                       // Binds to theme:expand to show the modal box
+                       // with the theme details
+                       self.listenTo( self.theme, 'theme:expand', self.expand, self );
+               });
+
+               // 'Add new theme' element shown at the end of the grid
+               this.$el.append( '<div id="add-new" class="theme add-new"><a href="' + themes.data.settings.install_uri + '"><div class="theme-screenshot"><span></span></div><h3 class="theme-name">' + themes.data.i18n.add_new + '</h3></a></div>' );
+
+               this.parent.page++;
+       },
+
+       // Grabs current theme and puts it at the beginning of the collection
+       currentTheme: function() {
+               var self = this,
+                       current;
+
+               current = self.collection.findWhere({ active: true });
+
+               // Move the active theme to the beginning of the collection
+               if ( current ) {
+                       self.collection.remove( current );
+                       self.collection.add( current, { at:0 } );
+               }
+       },
+
+       // Sets current view
+       setView: function( view ) {
+               return view;
+       },
+
+       // Renders the overlay with the ThemeDetails view
+       // Uses the current model data
+       expand: function( id ) {
+               var self = this;
+
+               // Set the current theme model
+               this.model = self.collection.get( id );
+
+               // Trigger a route update for the current model
+               themes.router.navigate( 'theme/' + this.model.id );
+
+               // Sets this.view to 'detail'
+               this.setView( 'detail' );
+               $( 'body' ).addClass( 'theme-overlay' );
+
+               // Set up the theme details view
+               this.overlay = new themes.view.Details({
+                       model: self.model,
+                       className: 'theme-' + self.model.id
+               });
+
+               this.overlay.render();
+               this.$el.append( this.overlay.el );
+
+               this.overlay.screenshotGallery();
+
+               // Resets counter whenever the overlay is opened
+               this.index = 0;
+
+               // Bind to theme:next and theme:previous
+               // triggered by the arrow keys
+               //
+               // The index keep track of where we are at
+               // any given time
+               this.listenTo( this.overlay, 'theme:next', function() {
+                       // Bump the index number to keep track of how far
+                       // we should go for the next theme
+                       self.index++;
+                       // Renders the next theme on the overlay
+                       self.next( [ self.model.cid, self.index ] );
+                       self.overlay.screenshotGallery();
+
+               })
+               .listenTo( this.overlay, 'theme:previous', function() {
+                       // Decrease the index number to keep track of how far
+                       // we should go for the previous theme
+                       self.index--;
+                       // Renders the previous theme on the overlay
+                       self.previous( [ self.model.cid, self.index ] );
+                       self.overlay.screenshotGallery();
+               });
+
+       },
+
+       // This method renders the next theme on the overlay modal
+       // based on the current position in the collection
+       // @params [model cid] and [index]
+       next: function( args ) {
+               var self = this,
+                       model, nextModel;
+
+               // Get the current theme
+               model = self.collection.get( args[0] );
+               // Get the next one
+               nextModel = self.collection.at( self.collection.indexOf( model ) + args[1] );
+
+               // Sanity check which also serves as a boundary test
+               if ( nextModel !== undefined ) {
+
+                       // We have a new theme...
+                       // Clean the overlay
+                       this.overlay.$el.html('');
+
+                       // Create the view
+                       this.nextTheme = new themes.view.Details({
+                               model: nextModel,
+                               className: 'theme-' + nextModel.id
+                       });
+
+                       // Trigger a route update for the current model
+                       themes.router.navigate( 'theme/' + nextModel.id );
+
+                       // Render and fill this.overlay with the new html
+                       this.nextTheme.render();
+                       return this.overlay.$el.html( this.nextTheme.el );
+               }
+
+               // If we got this far it means we have no other themes
+               // so move back the counter to keep it sane
+               self.index--;
+       },
+
+       // This method renders the previous theme on the overlay modal
+       // based on the current position in the collection
+       // @params [model cid] and [index]
+       previous: function( args ) {
+               var self = this,
+                       model, previousModel;
+
+               // Get the current theme
+               model = self.collection.get( args[0] );
+               previousModel = self.collection.at( self.collection.indexOf( model ) + args[1] );
+
+               if ( previousModel !== undefined ) {
+
+                       // We have a new theme...
+                       // Clean the overlay
+                       this.overlay.$el.html( '' );
+
+                       // Create the view
+                       this.previousTheme = new themes.view.Details({
+                               model: previousModel,
+                               className: 'theme-' + previousModel.id
+                       });
+
+                       // Trigger a route update for the current model
+                       themes.router.navigate( 'theme/' + previousModel.id );
+
+                       // Render and fill this.overlay with the new html
+                       this.previousTheme.render();
+                       return this.overlay.$el.html( this.previousTheme.el );
+               }
+
+               // If we got this far it means we have no other themes
+               // so move back the counter to keep it sane
+               self.index++;
+       }
+});
+
+// Search input view controller
+// renders #search-form
+themes.view.Search = wp.Backbone.View.extend({
+
+       className: 'search-form',
+
+       // 'keyup' triggers search
+       events: {
+               'keyup #theme-search': 'search'
+       },
+
+       // Grabs template file
+       html: themes.template( 'theme-search' ),
+
+       // Render the search form
+       render: function() {
+               var self = this;
+               self.$el.html( self.html );
+       },
+
+       // Runs a search on the theme collection
+       // bind on 'keyup' event
+       search: function() {
+               this.collection.doSearch( $( '#theme-search' ).val() );
+       }
+});
+
+// Sets up the routes events for relevant url queries
+// Listens to [theme] and [search] params
+themes.routes = Backbone.Router.extend({
+
+       routes: {
+               'search/:query': 'search',
+               'theme/:slug': 'theme'
+       },
+
+       // Set the search input value based on url
+       search: function( query ) {
+               $( '#theme-search' ).val( query );
+       }
+});
+
+// Make routes easily extendable
+_.extend( themes.routes, themes.data.settings.extraRoutes );
+
+// Execute and setup the application
+themes.Run = {
+       init: function() {
+               // Initializes the blog's theme library view
+               // Create a new collection with data
+               this.themes = new themes.Collection( themes.data.themes );
+
+               // Set up the view
+               this.view = new themes.view.Appearance({
+                       collection: this.themes
+               });
+
+               this.render();
+       },
+
+       render: function() {
+               // Render results
+               this.view.render();
+
+               // Calls the routes functionality
+               this.routes();
+
+               // Set ups history with pushState and our root
+               Backbone.history.start({ root: themes.data.settings.root });
+       },
+
+       routes: function() {
+               var self = this;
+               // Bind to our global thx object
+               // so that the object is available to sub-views
+               themes.router = new themes.routes();
+
+               // Handles theme details route event
+               themes.router.on( 'route:theme', function( slug ) {
+                       self.view.view.expand( slug );
+               });
+
+               // Handles search route event
+               themes.router.on( 'route:search', function( query ) {
+                       self.themes.doSearch( query );
+               });
+       }
+};
+
+// Ready...
+jQuery( document ).ready(
+
+       // Bring on the themes
+       _.bind( themes.Run.init, themes.Run )
+
+);
+
+})( jQuery );
</ins></span></pre></div>
<a id="trunksrcwpadminthemesphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/themes.php (26140 => 26141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/themes.php    2013-11-13 20:05:51 UTC (rev 26140)
+++ trunk/src/wp-admin/themes.php       2013-11-13 20:57:29 UTC (rev 26141)
</span><span class="lines">@@ -12,10 +12,6 @@
</span><span class="cx"> if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') )
</span><span class="cx">  wp_die( __( 'Cheatin&#8217; uh?' ) );
</span><span class="cx"> 
</span><del>-$wp_list_table = _get_list_table('WP_Themes_List_Table');
-
-$_SERVER['REQUEST_URI'] = remove_query_arg( array( 's', 'features', '_ajax_fetch_list_nonce', '_wp_http_referer', 'paged' ), $_SERVER['REQUEST_URI'] );
-
</del><span class="cx"> if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) {
</span><span class="cx">  if ( 'activate' == $_GET['action'] ) {
</span><span class="cx">          check_admin_referer('switch-theme_' . $_GET['stylesheet']);
</span><span class="lines">@@ -36,8 +32,6 @@
</span><span class="cx">  }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-$wp_list_table->prepare_items();
-
</del><span class="cx"> $title = __('Manage Themes');
</span><span class="cx"> $parent_file = 'themes.php';
</span><span class="cx"> 
</span><span class="lines">@@ -66,8 +60,6 @@
</span><span class="cx">  ) );
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-add_thickbox();
-
</del><span class="cx"> endif; // switch_themes
</span><span class="cx"> 
</span><span class="cx"> if ( current_user_can( 'edit_theme_options' ) ) {
</span><span class="lines">@@ -90,21 +82,42 @@
</span><span class="cx">  '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
</span><span class="cx"> );
</span><span class="cx"> 
</span><ins>+if ( current_user_can( 'switch_themes' ) ) {
+       $themes = wp_prepare_themes_for_js();
+} else {
+       $themes = wp_prepare_themes_for_js( array( wp_get_theme() ) );
+}
+
+wp_localize_script( 'theme', '_wpThemeSettings', array(
+       'themes'   => $themes,
+       'settings' => array(
+               'install_uri'   => admin_url( 'theme-install.php' ),
+               'customizeURI'  => ( current_user_can( 'edit_theme_options' ) ) ? wp_customize_url() : null,
+               'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete." ),
+               'root'          => '/wp-admin/themes.php',
+               'container'     => '#appearance',
+               'extraRoutes'   => '',
+       ),
+       'i18n' => array(
+               'add_new'         => __( 'Add New Theme' ),
+       ),
+) );
+
+wp_enqueue_style( 'theme' );
</ins><span class="cx"> wp_enqueue_script( 'theme' );
</span><span class="cx"> wp_enqueue_script( 'customize-loader' );
</span><span class="cx"> 
</span><span class="cx"> require_once( ABSPATH . 'wp-admin/admin-header.php' );
</span><span class="cx"> ?>
</span><span class="cx"> 
</span><del>-<div class="wrap"><?php
-screen_icon();
-if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?>
-<h2 class="nav-tab-wrapper">
-<a href="themes.php" class="nav-tab nav-tab-active"><?php echo esc_html( $title ); ?></a><a href="<?php echo admin_url( 'theme-install.php'); ?>" class="nav-tab"><?php echo esc_html_x('Install Themes', 'theme'); ?></a>
-<?php else : ?>
-<h2><?php echo esc_html( $title ); ?>
-<?php endif; ?>
-</h2>
</del><ins>+<div id="appearance" class="wrap">
+       <h2><?php esc_html_e( 'Themes' ); ?>
+               <span id="theme-count" class="theme-count"></span>
+       <?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?>
+               <a href="<?php echo admin_url( 'theme-install.php' ); ?>" class="add-new-h2"><?php echo esc_html( _x( 'Add New', 'Add new theme' ) ); ?></a>
+       <?php endif; ?>
+       </h2>
+
</ins><span class="cx"> <?php
</span><span class="cx"> if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) : ?>
</span><span class="cx"> <div id="message1" class="updated"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div>
</span><span class="lines">@@ -120,50 +133,16 @@
</span><span class="cx"> endif;
</span><span class="cx"> 
</span><span class="cx"> $ct = wp_get_theme();
</span><del>-$screenshot = $ct->get_screenshot();
-$class = $screenshot ? 'has-screenshot' : '';
</del><span class="cx"> 
</span><del>-$customize_title = sprintf( __( 'Customize &#8220;%s&#8221;' ), $ct->display('Name') );
-
-?>
-<div id="current-theme" class="<?php echo esc_attr( $class ); ?>">
-       <?php if ( $screenshot ) : ?>
-               <?php if ( current_user_can( 'edit_theme_options' ) ) : ?>
-               <a href="<?php echo wp_customize_url(); ?>" class="load-customize hide-if-no-customize" title="<?php echo esc_attr( $customize_title ); ?>">
-                       <img src="<?php echo esc_url( $screenshot ); ?>" alt="<?php esc_attr_e( 'Current theme preview' ); ?>" />
-               </a>
-               <?php endif; ?>
-               <img class="hide-if-customize" src="<?php echo esc_url( $screenshot ); ?>" alt="<?php esc_attr_e( 'Current theme preview' ); ?>" />
-       <?php endif; ?>
-
-       <h3><?php _e('Current Theme'); ?></h3>
-       <h4>
-               <?php echo $ct->display('Name'); ?>
-       </h4>
-
-<?php
</del><span class="cx"> if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) {
</span><span class="cx">  echo '<p class="error-message">' . sprintf( __( 'ERROR: %s' ), $ct->errors()->get_error_message() ) . '</p>';
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/*
</ins><span class="cx"> // Certain error codes are less fatal than others. We can still display theme information in most cases.
</span><span class="cx"> if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() )
</span><span class="cx">  && in_array( $ct->errors()->get_error_code(), array( 'theme_no_parent', 'theme_parent_invalid', 'theme_no_index' ) ) ) ) : ?>
</span><span class="cx"> 
</span><del>-       <div>
-               <ul class="theme-info">
-                       <li><?php printf( __('By %s'), $ct->display('Author') ); ?></li>
-                       <li><?php printf( __('Version %s'), $ct->display('Version') ); ?></li>
-               </ul>
-               <p class="theme-description"><?php echo $ct->display('Description'); ?></p>
-               <?php if ( $ct->parent() ) {
-                       printf( ' <p class="howto">' . __( 'This <a href="%1$s">child theme</a> requires its parent theme, %2$s.' ) . '</p>',
-                               __( 'http://codex.wordpress.org/Child_Themes' ),
-                               $ct->parent()->display( 'Name' ) );
-               } ?>
-               <?php theme_update_available( $ct ); ?>
-       </div>
-
</del><span class="cx">   <?php
</span><span class="cx">  // Pretend you didn't see this.
</span><span class="cx">  $options = array();
</span><span class="lines">@@ -194,103 +173,9 @@
</span><span class="cx">                  }
</span><span class="cx">          }
</span><span class="cx">  }
</span><del>-
-       if ( $options || current_user_can( 'edit_theme_options' ) ) :
-       ?>
-       <div class="theme-options">
-               <?php if ( current_user_can( 'edit_theme_options' ) ) : ?>
-               <a id="customize-current-theme-link" href="<?php echo wp_customize_url(); ?>" class="load-customize hide-if-no-customize" title="<?php echo esc_attr( $customize_title ); ?>"><?php _e( 'Customize' ); ?></a>
-               <?php
-               endif; // edit_theme_options
-               if ( $options ) :
-               ?>
-               <span><?php _e( 'Options:' )?></span>
-               <ul>
-                       <?php foreach ( $options as $option ) : ?>
-                               <li><?php echo $option; ?></li>
-                       <?php endforeach; ?>
-               </ul>
-               <?php
-               endif; // options
-               ?>
-       </div>
-       <?php
-       endif; // options || edit_theme_options
-       ?>
-
-<?php endif; // theme errors ?>
-
-</div>
-
-<br class="clear" />
-<?php
-if ( ! current_user_can( 'switch_themes' ) ) {
-       echo '</div>';
-       require( ABSPATH . 'wp-admin/admin-footer.php' );
-       exit;
-}
</del><ins>+*/
</ins><span class="cx"> ?>
</span><span class="cx"> 
</span><del>-<form class="search-form filter-form" action="" method="get">
-
-<h3 class="available-themes"><?php _e('Available Themes'); ?></h3>
-
-<?php if ( !empty( $_REQUEST['s'] ) || !empty( $_REQUEST['features'] ) || $wp_list_table->has_items() ) : ?>
-
-<p class="search-box">
-       <label class="screen-reader-text" for="theme-search-input"><?php _e('Search Installed Themes'); ?>:</label>
-       <input type="search" id="theme-search-input" name="s" value="<?php _admin_search_query(); ?>" />
-       <?php submit_button( __( 'Search Installed Themes' ), 'button', false, false, array( 'id' => 'search-submit' ) ); ?>
-       <a id="filter-click" href="?filter=1"><?php _e( 'Feature Filter' ); ?></a>
-</p>
-
-<div id="filter-box" style="<?php if ( empty($_REQUEST['filter']) ) echo 'display: none;'; ?>">
-<?php $feature_list = get_theme_feature_list(); ?>
-       <div class="feature-filter">
-               <p class="install-help"><?php _e('Theme filters') ?></p>
-       <?php if ( !empty( $_REQUEST['filter'] ) ) : ?>
-               <input type="hidden" name="filter" value="1" />
-       <?php endif; ?>
-       <?php foreach ( $feature_list as $feature_name => $features ) :
-                       $feature_name = esc_html( $feature_name ); ?>
-
-               <div class="feature-container">
-                       <div class="feature-name"><?php echo $feature_name ?></div>
-
-                       <ol class="feature-group">
-                               <?php foreach ( $features as $key => $feature ) :
-                                               $feature_name = $feature;
-                                               $feature_name = esc_html( $feature_name );
-                                               $feature = esc_attr( $feature );
-                                               ?>
-                               <li>
-                                       <input type="checkbox" name="features[]" id="feature-id-<?php echo $key; ?>" value="<?php echo $key; ?>" <?php checked( in_array( $key, $wp_list_table->features ) ); ?>/>
-                                       <label for="feature-id-<?php echo $key; ?>"><?php echo $feature_name; ?></label>
-                               </li>
-                               <?php endforeach; ?>
-                       </ol>
-               </div>
-       <?php endforeach; ?>
-
-       <div class="feature-container">
-               <?php submit_button( __( 'Apply Filters' ), 'button-secondary submitter', false, false, array( 'id' => 'filter-submit' ) ); ?>
-               &nbsp;
-               <a id="mini-filter-click" href="<?php echo esc_url( remove_query_arg( array('filter', 'features', 'submit') ) ); ?>"><?php _e( 'Close filters' )?></a>
-       </div>
-       <br/>
-       </div>
-       <br class="clear"/>
-</div>
-
-<?php endif; ?>
-
-<br class="clear" />
-
-<?php $wp_list_table->display(); ?>
-
-</form>
-<br class="clear" />
-
</del><span class="cx"> <?php
</span><span class="cx"> // List broken themes, if any.
</span><span class="cx"> if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) {
</span><span class="lines">@@ -317,6 +202,106 @@
</span><span class="cx"> <?php
</span><span class="cx"> }
</span><span class="cx"> ?>
</span><del>-</div>
</del><ins>+</div><!-- .wrap -->
</ins><span class="cx"> 
</span><ins>+<script id="tmpl-theme" type="text/template">
+       <div class="theme-screenshot">
+               <img src="{{ data.screenshot[0] }}" alt="" />
+       </div>
+       <div class="theme-author"><?php printf( __( 'By %s' ), '{{ data.author }}' ); ?></div>
+       <h3 class="theme-name">{{ data.name }}</h3>
+       <div class="theme-actions">
+
+       <# if ( data.active ) { #>
+               <span class="current-label"><?php _e( 'Current Theme' ); ?></span>
+               <# if ( wp.themes.data.settings['customizeURI'] ) { #>
+                       <a class="button button-primary hide-if-no-customize" href="{{ wp.themes.data.settings['customizeURI'] }}"><?php _e( 'Customize' ); ?></a>
+               <# } #>
+       <# } else { #>
+               <a class="button button-primary activate" href="{{{ data.actions['activate'] }}}"><?php _e( 'Activate' ); ?></a>
+               <a class="button button-secondary preview" href="{{{ data.actions['customize'] }}}"><?php _e( 'Live Preview' ); ?></a>
+       <# } #>
+
+       </div>
+
+       <# if ( data.hasUpdate ) { #>
+               <a class="theme-update"><?php _e( 'Update Available' ); ?></a>
+       <# } #>
+
+       <# if ( ! data.active ) { #>
+               <a href="{{{ data.actions.delete }}}" class="delete-theme"><?php _e( 'Delete' ); ?></a>
+       <# } #>
+</script>
+
+<script id="tmpl-theme-search" type="text/template">
+       <input type="text" name="theme-search" id="theme-search" placeholder="<?php esc_attr_e( 'Search...' ); ?>" />
+</script>
+
+<script id="tmpl-theme-single" type="text/template">
+       <div class="theme-backdrop"></div>
+       <div class="theme-wrap">
+               <div class="theme-utility">
+                       <div alt="<?php _e( 'Close overlay' ); ?>" class="back dashicons dashicons-no"></div>
+                       <div alt="<?php _e( 'Show previous theme' ); ?>" class="left dashicons dashicons-no"></div>
+                       <div alt="<?php _e( 'Show next theme' ); ?>" class="right dashicons dashicons-no"></div>
+               </div>
+
+               <div class="theme-screenshots" id="theme-screenshots">
+                       <div class="screenshot first"><img src="{{ data.screenshot[0] }}" alt="" /></div>
+               <#
+                       if ( _.size( data.screenshot ) > 1 ) {
+                               _.each ( data.screenshot, function( image ) {
+               #>
+                               <div class="screenshot thumb"><img src="{{ image }}" alt="" /></div>
+               <#
+                               });
+                       }
+               #>
+               </div>
+
+               <div class="theme-info">
+                       <# if ( data.active ) { #>
+                               <span class="current-label"><?php _e( 'Current Theme' ); ?></span>
+                       <# } #>
+                       <h3 class="theme-name">{{ data.name }}<span class="theme-version"><?php _e('Version: '); ?> {{ data.version }}</span></h3>
+                       <h4 class="theme-author"><?php printf( __( 'By %s' ), '<a href="{{ data.authorURI }}">{{ data.author }}</a>' ); ?></h4>
+
+                       <# if ( data.hasUpdate ) { #>
+                       <div class="theme-update-message">
+                               <a class="theme-update"><?php _e( 'Update Available' ); ?></a>
+                               <p>{{{ data.update }}}</p>
+                       </div>
+                       <# } #>
+                       <p class="theme-description">{{{ data.description }}}</p>
+
+                       <# if ( data.parent ) { #>
+                               <p class="parent-theme"><?php printf( __( 'This is a child theme of <strong>%s</strong>.' ), '{{ data.parent }}' ); ?></p>
+                       <# } #>
+
+                       <# if ( data.tags.length !== 0 ) { #>
+                               <p class="theme-tags">
+                                       <span><?php _e( 'Tags:' ); ?></span>
+                                       {{{ data.tags.join( ', ' ).replace( /-/g, ' ' ) }}}
+                               </p>
+                       <# } #>
+               </div>
+       </div>
+
+       <div class="theme-actions">
+               <div class="active-theme">
+                       <a href="{{{ wp.themes.data.settings.customizeURI }}}" class="button button-primary hide-if-no-customize"><?php _e( 'Customize' ); ?></a>
+                       <a class="button button-secondary" href="<?php echo admin_url( 'nav-menus.php' ); ?>"><?php _e( 'Menus' ); ?></a>
+                       <a class="button button-secondary" href="<?php echo admin_url( 'widgets.php' ); ?>"><?php _e( 'Widgets' ); ?></a>
+               </div>
+               <div class="inactive-theme">
+                       <a href="{{{ data.actions.activate }}}" class="button button-primary"><?php _e( 'Activate' ); ?></a>
+                       <a href="{{{ data.actions.customize }}}" class="button button-secondary"><?php _e( 'Live Preview' ); ?></a>
+               </div>
+
+               <# if ( ! data.active ) { #>
+                       <a href="{{{ data.actions.delete }}}" class="delete-theme"><?php _e( 'Delete' ); ?></a>
+               <# } #>
+       </div>
+</script>
+
</ins><span class="cx"> <?php require( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
</span></span></pre></div>
<a id="trunksrcwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/script-loader.php (26140 => 26141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/script-loader.php  2013-11-13 20:05:51 UTC (rev 26140)
+++ trunk/src/wp-includes/script-loader.php     2013-11-13 20:57:29 UTC (rev 26141)
</span><span class="lines">@@ -451,7 +451,8 @@
</span><span class="cx"> 
</span><span class="cx">          $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 );
</span><span class="cx"> 
</span><del>-               $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'jquery' ), false, 1 );
</del><ins>+                $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone' ), false, 1 );
+               $scripts->add( 'theme-install', "/wp-admin/js/theme-install$suffix.js", array( 'jquery' ), false, 1 );
</ins><span class="cx"> 
</span><span class="cx">          // @todo: Core no longer uses theme-preview.js. Remove?
</span><span class="cx">          $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), false, 1 );
</span><span class="lines">@@ -570,6 +571,7 @@
</span><span class="cx">  // do not refer to these directly, the right one is queued by the above "meta" colors handle
</span><span class="cx">  $styles->add( 'colors-fresh', "/wp-admin/css/colors-fresh$suffix.css", array( 'wp-admin', 'buttons' ) );
</span><span class="cx"> 
</span><ins>+       $styles->add( 'theme', "/wp-admin/css/theme.css" );
</ins><span class="cx">   $styles->add( 'media', "/wp-admin/css/media$suffix.css" );
</span><span class="cx">  $styles->add( 'install', "/wp-admin/css/install$suffix.css", array('buttons') );
</span><span class="cx">  $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20121105' );
</span></span></pre>
</div>
</div>

</body>
</html>