<!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>[1770] sites/trunk/wordpress.org/public_html/wp-content: WordPress.org Themes: Add the ability to favorite themes.</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" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/1770">1770</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/1770","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>dd32</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-07-22 04:00:32 +0000 (Wed, 22 Jul 2015)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>WordPress.org Themes: Add the ability to favorite themes.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsthemedirectorythemedirectoryphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgthemesfunctionsphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgthemesindexphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/index.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgthemesjsthemejs">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.js</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgthemesjsthememinjs">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.min.js</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgthemesstylertlcss">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/style-rtl.css</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgthemesstylecss">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/style.css</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgthemesthemesinglephp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/theme-single.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgthemesviewtemplatesthemesinglephp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/view-templates/theme-single.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsthemedirectorythemedirectoryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php      2015-07-21 21:14:22 UTC (rev 1769)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php        2015-07-22 04:00:32 UTC (rev 1770)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -147,7 +147,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        // Add the browse/* views
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        add_rewrite_tag( '%browse%', '(featured|popular|new)' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_rewrite_tag( '%browse%', '(featured|popular|new|favorites)' );
</ins><span class="cx" style="display: block; padding: 0 10px">         add_permastruct( 'browse', 'browse/%browse%' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        if ( ! defined( 'WPORG_THEME_DIRECTORY_BLOGID' ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -611,6 +611,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">        if ( get_query_var( 'browse' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $request['browse'] = get_query_var( 'browse' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                if ( 'favorites' === $request['browse'] ) {
+                       $request['user'] = wp_get_current_user()->user_login;
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         } else if ( get_query_var( 'tag' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $request['tag'] = (array) explode( '+', get_query_var( 'tag' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -681,3 +685,90 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        return $api->response;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+
+/**
+ * Returns if the current theme is favourited by the current user.
+ */
+function wporg_themes_is_favourited( $theme_slug ) {
+       return in_array( $theme_slug, wporg_themes_get_user_favorites() );
+}
+
+/**
+ * Returns the current themes favorited by the user.
+ *
+ * @param int $user_id The user to get the favorites of. Default: current user
+ *
+ * @return array
+ */
+function wporg_themes_get_user_favorites( $user_id = 0 ) {
+       if ( ! $user_id ) {
+               $user_id = get_current_user_id();
+       }
+       if ( ! $user_id ) {
+               return array();
+       }
+
+       $favorites = get_user_meta( $user_id, 'theme_favorites', true );
+
+       return $favorites ? array_values( $favorites ) : array();
+}
+
+/**
+ * Sets current themes favorited by the user.
+ *
+ * @param array $favorites An array of theme slugs to mark as favorited.
+ * @param int   $user_id   The user to get the favorites of. Default: current user
+ *
+ * @return bool
+ */
+function wporg_themes_set_user_favorites( $favorites, $user_id = 0 ) {
+       if ( ! $user_id ) {
+               $user_id = get_current_user_id();
+       }
+       if ( ! $user_id ) {
+               return false;
+       }
+
+       return update_user_meta( $user_id, 'theme_favorites', (array) $favorites );
+}
+
+/**
+ * Favorite a theme for the current user
+ *
+ * @param int $theme_slug The theme to favorite.
+ *
+ * @return bool|WP_Error
+ */
+function wporg_themes_add_favorite( $theme_slug ) {
+       if ( ! is_user_logged_in() ) {
+               return new WP_Error( 'not_logged_in' );
+       }
+
+       $favorites = wporg_themes_get_user_favorites();
+       if ( ! in_array( $theme_slug, $favorites ) ) {
+               $favorites[] = $theme_slug;
+               return wporg_themes_set_user_favorites( $favorites );
+       }
+       return true;
+}
+
+/**
+ * Remove a favorited theme for the current user
+ *
+ * @param int $theme_slug The theme to favorite.
+ *
+ * @return bool|WP_Error
+ */
+function wporg_themes_remove_favorite( $theme_slug ) {
+       if ( ! is_user_logged_in() ) {
+               return new WP_Error( 'not_logged_in' );
+       }
+
+       $favorites = wporg_themes_get_user_favorites();
+       if ( in_array( $theme_slug, $favorites ) ) {
+               unset( $favorites[ array_search( $theme_slug, $favorites, true ) ] );
+               return wporg_themes_set_user_favorites( $favorites );
+       }
+       return true;
+}
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgthemesfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php    2015-07-21 21:14:22 UTC (rev 1769)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php      2015-07-22 04:00:32 UTC (rev 1770)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -58,7 +58,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'isMobile'     => wp_is_mobile(),
</span><span class="cx" style="display: block; padding: 0 10px">                                'postsPerPage' => 24,
</span><span class="cx" style="display: block; padding: 0 10px">                                'path'         => trailingslashit( parse_url( home_url(), PHP_URL_PATH ) ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'locale'       => get_locale()
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'locale'       => get_locale(),
+                               'favorites'    => array(
+                                       'themes' => wporg_themes_get_user_favorites(),
+                                       'user'   => wp_get_current_user()->user_login,
+                                       'nonce'  => is_user_logged_in() ? wp_create_nonce( 'modify-theme-favorite' ) : false,
+                               ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'l10n' => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'search'            => __( 'Search Themes', 'wporg-themes' ),
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgthemesindexphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/index.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/index.php        2015-07-21 21:14:22 UTC (rev 1769)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/index.php  2015-07-22 04:00:32 UTC (rev 1770)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,6 +25,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                <li><a href="<?php echo esc_url( home_url( 'browse/featured/' ) ); ?>" data-sort="featured" <?php if ( (is_front_page() && !get_query_var('browse') ) || 'featured' == get_query_var('browse') ) { echo 'class="current"'; } ?>><?php _ex( 'Featured', 'themes', 'wporg-themes' ); ?></a></li>
</span><span class="cx" style="display: block; padding: 0 10px">                                <li><a href="<?php echo esc_url( home_url( 'browse/popular/' ) ); ?>" data-sort="popular" <?php if ( 'popular' == get_query_var('browse') ) { echo 'class="current"'; } ?>><?php _ex( 'Popular', 'themes', 'wporg-themes' ); ?></a></li>
</span><span class="cx" style="display: block; padding: 0 10px">                                <li><a href="<?php echo esc_url( home_url( 'browse/new/' ) ); ?>" data-sort="new" <?php if ( 'new' == get_query_var('browse') ) { echo 'class="current"'; } ?>><?php _ex( 'Latest', 'themes', 'wporg-themes' ); ?></a></li>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                <?php if ( is_user_logged_in() ) { ?>
+                                       <li><a href="<?php echo esc_url( home_url( 'browse/favorites/' ) ); ?>" data-sort="favorites" <?php if ( 'favorites' == get_query_var('browse') ) { echo 'class="current"'; } ?>><?php _ex( 'My Favorites', 'themes', 'wporg-themes' ); ?></a></li>
+                               <?php } ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                         </ul>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        <a class="drawer-toggle" href="#"><?php _e( 'Feature Filter', 'wporg-themes' ); ?></a>
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgthemesjsthemejs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.js      2015-07-21 21:14:22 UTC (rev 1769)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.js        2015-07-22 04:00:32 UTC (rev 1770)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -468,7 +468,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'click .right': 'nextTheme',
</span><span class="cx" style="display: block; padding: 0 10px">                        'click .theme-actions .button-secondary': 'preview',
</span><span class="cx" style="display: block; padding: 0 10px">                        'keydown .theme-actions .button-secondary': 'preview',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'touchend .theme-actions .button-secondary': 'preview'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'touchend .theme-actions .button-secondary': 'preview',
+                       'click .favorite': 'favourite_toggle'
</ins><span class="cx" style="display: block; padding: 0 10px">                 },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // The HTML template for the theme overlay
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -501,6 +502,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        data.downloaded = data.downloaded.toLocaleString();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        data.show_favorites = !! themes.data.settings.favorites.user;
+                       data.is_favorited   = ( themes.data.settings.favorites.themes.indexOf( data.slug ) != -1 );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         this.$el.html( this.html( data ) );
</span><span class="cx" style="display: block; padding: 0 10px">                        // Set up navigation events
</span><span class="cx" style="display: block; padding: 0 10px">                        this.navigation();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -511,6 +515,46 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        this.renderDownloadsGraph();
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                favourite_toggle: function( event ) {
+                       var $heart = this.$el.find( '.favorite' ),
+                               favorited = ! $heart.hasClass( 'favorited' ),
+                               slug = this.model.get("slug"),
+                               pos;
+
+                       $heart.toggleClass( 'favorited' );      
+
+                       // Update it in the current settings
+                       if ( ! favorited ) {
+                               pos = themes.data.settings.favorites.themes.indexOf( slug );
+                               if ( pos > -1 ) {
+                                       delete themes.data.settings.favorites.themes[ pos ];
+                               }
+                       } else {
+                               themes.data.settings.favorites.themes.push( slug );
+                       }
+
+                       // Update the server with the changed data
+                       var options = {
+                               type: 'GET',
+                               url: 'https://api.wordpress.org/themes/theme-directory/1.0/',
+                               jsonp: "callback",
+                               dataType: "jsonp",
+                               data: {
+                                       action: favorited ? 'add-favorite' : 'remove-favorite',
+                                       theme: this.model.get("slug"),
+                                       _wpnonce: themes.data.settings.favorites.nonce
+                               },
+                       };
+
+                       $.ajax( options ).done( function( result ) {
+                               // If the user is no longer logged in, stop showing the favorite heart
+                               if ( 'undefined' != typeof result.error && 'not_logged_in' == result.error ) {
+                                       themes.data.settings.favorites.themes = [];
+                                       themes.data.settings.favorites.user = '';
+                               }
+                       } );
+               },
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 preview: function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        var self = this,
</span><span class="cx" style="display: block; padding: 0 10px">                                current, preview;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1303,7 +1347,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                browse: function( section ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        // Create a new collection with the proper theme data
</span><span class="cx" style="display: block; padding: 0 10px">                        // for each section
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        this.collection.query( { browse: section } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( 'favorites' == section ) {
+                               this.collection.query( {
+                                       browse: section,
+                                       user: themes.data.settings.favorites.user
+                               } );
+                       } else {
+                               this.collection.query( { browse: section } );
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                 },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Sorting navigation
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgthemesjsthememinjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.min.js  2015-07-21 21:14:22 UTC (rev 1769)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.min.js    2015-07-22 04:00:32 UTC (rev 1770)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-window.wp=window.wp||{},function(a){var b,c=wp.themes=wp.themes||{};c.data=_wpThemeSettings,b=c.data.l10n,_.extend(c,{model:{},view:{},routes:{},router:{},template:wp.template}),c.utils={title:function(b){document.title=a("<div/>").html(c.data.settings.title.replace("%s",a("<div/>").text(b).html())).text()}},c.Model=Backbone.Model.extend({initialize:function(){var a;this.set({id:this.get("slug")||this.get("id")}),this.has("sections")&&(a=this.get("sections").description,this.set({description:a}))}}),c.view.Appearance=wp.Backbone.View.extend({el:"#themes .theme-browser",window:a(window),page:0,initialize:function(a){_.bindAll(this,"scroller"),this.SearchView=a.SearchView?a.SearchView:c.view.Search,this.window.bind("scroll",_.throttle(this.scroller,300))},render:function(
 ){this.view=new c.view.Themes({collection:this.collection,parent:this}),this.search(),this.view.render(),this.$el.find(".themes").remove(),this.$el.append(this.view.el).addClass("rendered")},searchContainer:"",search:function(){var c,d=this;c=new this.SearchView({collection:d.collection,parent:this}),c.render(),this.searchContainer.append(a.parseHTML('<label class="screen-reader-text" for="wp-filter-search-input">'+b.search+"</label>")).append(c.el)},scroller:function(){var a,b,c=this;a=this.window.scrollTop()+c.window.height(),b=c.$el.offset().top+c.$el.outerHeight(!1)-c.window.height(),b=Math.round(.9*b),a>b&&this.trigger("theme:scroll")}}),c.Collection=Backbone.Collection.extend({model:c.Model,terms:"",queries:[],currentQuery:{page:1,request:{}},count:!1,loadingThemes:!1,doSearch:function(a){this.terms!==a&&(this.terms=a,this.terms.length>0&&this.search(this.t
 erms),""===this.terms&&this.reset(c.data.themes),this.trigger("update"))},search:function(b){var d,e,f,g,h,i;this.reset(c.data.themes,{silent:!0}),b=b.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),b=b.replace(/ /g,")(?=.*"),d=new RegExp("^(?=.*"+b+").+","i"),e=this.filter(function(a){return g=a.get("name").replace(/(<([^>]+)>)/gi,""),h=a.get("description").replace(/(<([^>]+)>)/gi,""),i=a.get("author").replace(/(<([^>]+)>)/gi,""),f=_.union(g,a.get("id"),h,i,a.get("tags")),d.test(a.get("author"))&&b.length>2&&a.set("displayAuthor",!0),d.test(f)}),0===e.length?this.trigger("query:empty"):a("body").removeClass("no-results"),this.reset(e)},paginate:function(a){var b=this;return a=a||0,b=_(b.rest(c.data.settings.postsPerPage*a)),b=_(b.first
 (c.data.settings.postsPerPage))},query:function(b){var c,d,e,f=this.queries,g=this;if(this.currentQuery.request=b,c=_.find(f,function(a){return _.isEqual(a.request,b)}),d=_.has(b,"page"),d||(this.currentQuery.page=1),c||d){if(d)return this.apiCall(b,d).done(function(a){g.add(a.themes),g.trigger("query:success",a.info.results),g.loadingThemes=!1}).fail(function(){g.trigger("query:fail")});0===c.themes.length?g.trigger("query:empty"):a("body").removeClass("no-results"),_.isNumber(c.total)&&(this.count=c.total),this.reset(c.themes),c.total||(this.count=this.length),this.trigger("update"),this.trigger("query:success",this.count)}else c=this.apiCall(b).done(function(a){a.themes&&(g.reset(a.themes),e=a.info.results,f.push({themes:a.themes,request:b,total:e})),g.trigger("update"),g.trigger("query:success",e),a.themes&&0===a.themes.length&&g.trigger("query
 :empty")}).fail(function(){g.trigger("query:fail")})},apiCall:function(b,d){var e={type:"POST",url:"https://api.wordpress.org/themes/info/1.1/",jsonp:"callback",dataType:"jsonp",data:{action:"query_themes",request:_.extend({per_page:c.data.settings.postsPerPage,locale:c.data.settings.locale,fields:{description:!0,sections:!1,tested:!0,requires:!0,downloaded:!0,downloadlink:!0,last_updated:!0,homepage:!0,theme_url:!0,parent:!0,tags:!0,rating:!0,ratings:!0,num_ratings:!0,extended_author:!0,photon_screenshots:!0}},b)},beforeSend:function(){d||a("body").addClass("loading-content").removeClass("no-results")}};return a.Deferred(function(b){a.ajax(e).done(function(a){b.resolveWith(this,[a])}).fail(function(){b.rejectWith(this,arguments)})}).promise()}}),c.view.Theme=wp.Backbone.View.extend({className:"theme",state:"grid",html:wp.themes.template("theme"),events:{click
 :"expand",keydown:"expand",touchend:"expand",keyup:"addFocus",touchmove:"preventExpand"},touchDrag:!1,render:function(){var a=this.model.toJSON();a.permalink=c.data.settings.path+c.router.baseUrl(a.slug),a.path=c.data.settings.path,this.$el.html(this.html(a)).attr({tabindex:0,"aria-describedby":a.id+"-action "+a.id+"-name"})},addFocus:function(){var b=a(":focus").hasClass("theme")?a(":focus"):a(":focus").parents(".theme");a(".theme.focus").removeClass("focus"),b.addClass("focus")},expand:function(b){var d=this;return b=b||window.event,!0===b.metaKey&&"click"===b.type||"keydown"===b.type&&13!==b.which&&32!==b.which?void 0:this.touchDrag===!0?this.touchDrag=!1:void(a(b.target).is(".theme-actions a")||(c.focusedTheme=this.$el,this.trigger("theme:expand",d.model.cid)
 ,b.preventDefault()))},preventExpand:function(){this.touchDrag=!0}}),c.view.Details=wp.Backbone.View.extend({className:"theme-overlay",events:{click:"collapse","click .left":"previousTheme","click .right":"nextTheme","click .theme-actions .button-secondary":"preview","keydown .theme-actions .button-secondary":"preview","touchend .theme-actions .button-secondary":"preview"},html:c.template("theme-single"),render:function(){var a=this.model.toJSON(),d=new Date;d.setUTCFullYear(a.last_updated.substring(0,4),a.last_updated.substring(5,7)-1,a.last_updated.substring(8,10)),a.last_updated=d.toLocaleDateString(!1,{day:"numeric",month:"long",year:"numeric"}),a.is_outdated=d.setYear(d.getYear()+1902).valueOf()<(new Date).valueOf(),a.tags=_.map(a.tags,function(a,d){return translated_tag=b.tags[d]||a,'<a href="'+c.data.setting
 s.path+c.router.baseUrl("tags/"+d)+'">'+translated_tag+"</a>"}).join(", "),a.path=c.data.settings.path,a.downloaded=a.downloaded.toLocaleString(),this.$el.html(this.html(a)),this.navigation(),this.screenshotCheck(this.$el),this.containFocus(this.$el),this.renderDownloadsGraph()},preview:function(b){var d,e,f=this;return this.touchDrag===!0?this.touchDrag=!1:void(a(b.target).hasClass("button-primary")||("keydown"!==b.type||13===b.which||32===b.which)&&("keydown"===b.type&&13!==b.which&&a(":focus").hasClass("button")||(b=b||window.event,b.preventDefault(),c.focusedTheme=this.$el,e=new c.view.Preview({model:this.model}),e.render(),this.setNavButtonsState(),e.$el.addClass(c.data.settings.isMobile?"wp-full-overlay collapsed":"wp-full-overlay expanded"),a(".theme-install-overlay").append(e.el),this.listenTo(e,"theme:next",function(){
 return this.trigger("theme:next"),d=f.model,_.isUndefined(f.current)||(d=f.current),f.current=f.model.collection.at(f.model.collection.indexOf(d)+1),_.isUndefined(f.current)?(f.options.parent.parent.trigger("theme:end"),f.current=d):(e.model=f.current,e.render(),this.setNavButtonsState(),void a(".next-theme").focus())}).listenTo(e,"theme:previous",function(){this.trigger("theme:previous"),d=f.model,0!==f.model.collection.indexOf(f.current)&&(_.isUndefined(f.current)||(d=f.current),f.current=f.model.collection.at(f.model.collection.indexOf(d)-1),_.isUndefined(f.current)||(e.model=f.current,e.render(),this.setNavButtonsState(),a(".previous-theme").focus()))}),this.listenTo(e,"preview:close",function(){f.current=f.model}))))},setNavButtonsState:function(){var b=a(".theme-install-overlay"),c=_.isUndefined(this.current)?this.model:this.current;0===this.model.collection.indexOf(c)&&b.find(&quot
 ;.previous-theme").addClass("disabled"),_.isUndefined(this.model.collection.at(this.model.collection.indexOf(c)+1))&&b.find(".next-theme").addClass("disabled")},containFocus:function(b){var c,d=window.event;("undefined"==typeof d||1===a(d.target).closest(".theme").length)&&_.delay(function(){a(".theme-wrap a.button-primary:visible").focus()},500),b.on("keydown.wp-themes",function(d){9===d.which&&(c=a(d.target),c.is("button.close")&&d.shiftKey?(b.find(".theme-tags a:last-child").focus(),d.preventDefault()):c.is(".theme-tags a:last-child")&&(b.find("button.close").focus(),d.preventDefault()))})},collapse:function(b){var d,e,f,g,h,i=this,j={};1!==c.data.themes.length&&(b=b||window.event,(a(b.target).is(".close")||27===b.keyCode)&&(a("body").addClass("closing-overlay"),this.$el.fadeOut(1,f
 unction(){a("body").removeClass("closing-overlay"),i.closeOverlay(),d=document.body.scrollTop,(e=c.Collection.prototype.currentQuery.request.author)?(c.router.navigate(c.router.baseUrl("author/"+e)),c.utils.title(e)):(f=c.Collection.prototype.currentQuery.request.search)?(c.router.navigate(c.router.baseUrl(c.router.searchPath+f)),c.utils.title(f)):(g=c.view.Installer.prototype.filtersChecked())?(c.router.navigate(c.router.baseUrl("tags/"+g.join("+"))),c.utils.title(_.each(g,function(b,c){g[c]=a('label[for="filter-id-'+b+'"]').text()}).join(", "))):(h=a(".filter-links .current"))&&(h.length||(h=a('.filter-links [data-sort="featured"]'),j={trigger:!0}),c.router.navigate(c.router.baseUrl(c.router.browsePath+h.data("sort")),j),c.utils.title(h.text())),document.body.scrollTop=d,c.focusedTheme&&c.focusedTheme.focus()})))},renderDownloadsGraph:function(){var b=this;a.getJSON(
 "https://api.wordpress.org/stats/themes/1.0/downloads.php?slug="+b.model.get("id")+"&limit=260&callback=?",function(c){var d=new google.visualization.DataTable,e=0;d.addColumn("string",_wpThemeSettings.l10n.date),d.addColumn("number",_wpThemeSettings.l10n.downloads),a.each(c,function(a,b){d.addRow(),d.setValue(e,0,new Date(a).toLocaleDateString()),d.setValue(e,1,Number(b)),e++}),new google.visualization.ColumnChart(document.getElementById("theme-download-stats-"+b.model.get("id"))).draw(d,{colors:["#253578"],legend:{position:"none"},titlePosition:"in",axisTitlesPosition:"in",chartArea:{height:280,left:35,width:"98%"},hAxis:{textStyle:{color:"black",fontSize:9}},vAxis:{format:"###,###",textPosition:"out",viewWindowMode:"explicit",viewWindow:{min:0}},bar:{groupWidth:d.getNumberOfRows()>100?"100%":null},heig
 ht:350})})},navigation:function(){this.model.cid===this.model.collection.at(0).cid&&this.$el.find(".left").addClass("disabled"),this.model.cid===this.model.collection.at(this.model.collection.length-1).cid&&this.$el.find(".right").addClass("disabled")},closeOverlay:function(){a("body").removeClass("modal-open"),this.remove(),this.unbind(),this.trigger("theme:collapse")},nextTheme:function(){var a=this;return a.trigger("theme:next",a.model.cid),!1},previousTheme:function(){var a=this;return a.trigger("theme:previous",a.model.cid),!1},screenshotCheck:function(a){var b=new Image;b.src=a.find(".screenshot img").attr("src")}}),c.view.Preview=c.view.Details.extend({className:"wp-full-overlay expanded",el:".theme-install-overlay",events:{"click .close-full-overlay":"close","click .collapse-sidebar":"collapse&quo
 t;,"click .previous-theme":"previousTheme","click .next-theme":"nextTheme",keyup:"keyEvent"},html:c.template("theme-preview"),render:function(){var b=this.model.toJSON();this.$el.html(this.html(b)),c.router.navigate(c.router.baseUrl(c.router.themePath+this.model.get("id"))),this.$el.fadeIn(200,function(){a("body").addClass("theme-installer-active full-overlay-active"),a(".close-full-overlay").focus()})},close:function(){return this.$el.fadeOut(200,function(){a("body").removeClass("theme-installer-active full-overlay-active"),c.focusedTheme&&c.focusedTheme.focus()}),this.trigger("preview:close"),this.undelegateEvents(),this.unbind(),c.router.navigate(c.router.baseUrl(c.router.themePath+this.model.get("id"))),!1},collapse:function(){return this.$el.toggleClass("collapsed").toggleClass("expanded"),!1},keyEvent:function()
 {return 27===event.keyCode&&(this.undelegateEvents(),this.close()),39===event.keyCode&&_.once(this.nextTheme()),37===event.keyCode&&this.previousTheme(),!1}}),c.view.Themes=wp.Backbone.View.extend({className:"themes",$overlay:a("div.theme-overlay"),index:0,count:a(".wp-filter .theme-count"),initialize:function(b){var c=this;this.parent=b.parent,this.setView("grid"),this.listenTo(c.collection,"update",function(){c.parent.page=0,c.render(this)}),this.listenTo(c.collection,"query:success",function(a){c.count.text(_.isNumber(a)?a.toLocaleString():c.collection.length.toLocaleString())}),this.listenTo(c.collection,"query:empty",function(){a("body").addClass("no-results")}),this.listenTo(this.parent,"theme:scroll",function(){c.renderThemes(c.parent.page)}),this.listenTo(this.parent,"theme:close",function(){c.overlay&&c.overlay.closeOverlay()}),a(&quo
 t;body").on("keyup",function(a){c.overlay&&(39===a.keyCode&&c.overlay.nextTheme(),37===a.keyCode&&c.overlay.previousTheme(),27===a.keyCode&&c.overlay.collapse(a))})},render:function(){this.$el.empty(),1===c.data.themes.length&&(this.singleTheme=new c.view.Details({model:this.collection.models[0]}),this.singleTheme.render(),this.$el.addClass("single-theme"),this.$el.append(this.singleTheme.el)),this.options.collection.size()>0&&this.renderThemes(this.parent.page),this.count.text(this.collection.count?this.collection.count:this.collection.length)},renderThemes:function(b){var d=this;return d.instance=d.collection.paginate(b),0===d.instance.size()?void this.parent.trigger("theme:end"):(b>=1&&a(".add-new-theme").remove(),d.instance.each(function(a){d.theme=new c.view.Theme({model:a,parent:d}),d.theme.render(),d.$el.append(d.theme.el),d.listenTo(d.theme,"theme:expand",d.ex
 pand,d)}),void this.parent.page++)},setView:function(a){return a},expand:function(b){var d=this;this.model=d.collection.get(b),c.router.navigate(c.router.baseUrl(c.router.themePath+this.model.id)),c.utils.title(this.model.attributes.name),this.setView("detail"),a("body").addClass("modal-open"),this.overlay=new c.view.Details({model:d.model}),this.overlay.render(),this.$overlay.html(this.overlay.el),this.listenTo(this.overlay,"theme:next",function(){d.next([d.model.cid]),a(".theme-header").find(".right").focus()}).listenTo(this.overlay,"theme:previous",function(){d.previous([d.model.cid]),a(".theme-header").find(".left").focus()})},next:function(a){var b,c,d=this;b=d.collection.get(a[0]),c=d.collection.at(d.collection.indexOf(b)+1),void 0!==c&&d.theme.trigger("theme:expand",c.cid)},previous:function(a){var b,c,d=this;b=d.collection.get(a[0]),c=d.collection.at(d.collection.index
 Of(b)-1),void 0!==c&&d.theme.trigger("theme:expand",c.cid)}}),c.view.Search=wp.Backbone.View.extend({tagName:"input",className:"wp-filter-search",id:"wp-filter-search-input",searching:!1,attributes:{placeholder:b.searchPlaceholder,type:"search"},events:{keyup:"search",search:"search"},initialize:function(a){this.parent=a.parent,this.listenTo(this.parent,"theme:close",function(){this.searching=!1})},search:function(a){("keyup"!==a.type||9!==a.which&&16!==a.which)&&(this.collection=this.options.parent.view.collection,"keyup"===a.type&&27===a.which&&(a.target.value=""),_.debounce(_.bind(this.doSearch,this),300)(a.target.value))},doSearch:_.debounce(function(b){var d={};c.view.Installer.prototype.clearFilters(jQuery.Event("click")),d.search=b,"author:"===b.substring(0,7)&&(d.search="",d.author=b.slice(
 7)),"tag:"===b.substring(0,4)&&(d.search="",d.tag=[b.slice(4)]),a(".filter-links li > a.current").removeClass("current"),a("body").removeClass("show-filters filters-applied"),b?(c.utils.title(b),c.router.navigate(c.router.baseUrl(c.router.searchPath+b),{replace:!0})):(delete d.search,d.browse="featured",c.utils.title(a('.filter-links [data-sort="featured"]').text()),c.router.navigate(c.router.baseUrl(c.router.browsePath+"featured"),{replace:!0})),this.collection.query(d)},300)}),c.view.Installer=c.view.Appearance.extend({el:"#themes",events:{"click .filter-links li > a":"onSort","click .theme-filter":"onFilter","click .drawer-toggle":"moreFilters","click .filter-drawer .apply-filters":"applyFilters",'click .filter-group [type="checkbox"]':"addFilter","click .filter-dr
 awer .clear-filters":"clearFilters","click .filtered-by":"backToFilters"},activeClass:"current",searchContainer:a(".wp-filter .search-form"),render:function(){var d=this;this.search(),this.collection=new c.Collection,this.listenTo(this,"theme:end",function(){d.collection.loadingThemes||(d.collection.loadingThemes=!0,d.collection.currentQuery.page++,_.extend(d.collection.currentQuery.request,{page:d.collection.currentQuery.page}),d.collection.query(d.collection.currentQuery.request))}),this.listenTo(this.collection,"query:success",function(){a("body").removeClass("loading-content"),a(".theme-browser").find("div.error").remove()}),this.listenTo(this.collection,"query:fail",function(){a("body").removeClass("loading-content"),a(".theme-browser").find("div.error").remove(),a(".theme-browser").find("div.themes&q
 uot;).before('<div class="error"><p>'+b.error+"</p></div>")}),this.view&&this.view.remove(),this.view=new c.view.Themes({collection:this.collection,parent:this}),this.page=0,this.$el.find(".themes").remove(),this.view.render(),this.$el.find(".theme-browser").append(this.view.el).addClass("rendered")},browse:function(a){this.collection.query({browse:a})},onSort:function(b){var d=a(b.target),e=d.data("sort");b.preventDefault(),a("body").removeClass("filters-applied show-filters"),d.hasClass(this.activeClass)||(this.sort(e),c.router.navigate(c.router.baseUrl(c.router.browsePath+e)))},sort:function(b){var d=a('.filter-links [data-sort="'+b+'"]'),e=this;e.clearSearch(),_.each(a(".filter-group").find(":checkbox").filter(":checked"),function(b){return a(b).prop("checked",!1),e.filtersChecked()}),a(".filter-links li > a, .t
 heme-filter").removeClass(this.activeClass),d.addClass(this.activeClass),c.utils.title(d.text()),this.browse(b)},onFilter:function(b){var c,d=a(b.target),e=d.data("filter");d.hasClass(this.activeClass)||(a(".filter-links li > a, .theme-section").removeClass(this.activeClass),d.addClass(this.activeClass),e&&(e=_.union(e,this.filtersChecked()),c={tag:[e]},this.collection.query(c)))},addFilter:function(){this.filtersChecked()},applyFilters:function(b){var d,e=[],f=this.filtersChecked(),g={tag:f},h=a(".filtered-by .tags");b&&b.preventDefault(),a("body").addClass("filters-applied"),a(".filter-links li > a.current").removeClass("current"),h.empty(),_.each(f,function(b){d=a('label[for="filter-id-'+b+'"]').text(),e.push(d),h.append('<span class="tag">'+d+"</span>")}),c.router.navigate(c.router.baseUrl("tags/"+f.join("+"))),c.utils.tit
 le(e.join(", ")),this.collection.query(g)},filtersChecked:function(){var b=a(".filter-group").find(":checkbox").filter(":checked"),c=a(".filter-drawer"),d=[];return _.each(b,function(b){d.push(a(b).prop("value"))}),0===d.length?(c.find(".apply-filters").prop("disabled",!0).find("span").text(""),c.find(".clear-filters").hide(),a("body").removeClass("filters-applied"),!1):(c.find(".apply-filters").prop("disabled",!1).find("span").text(d.length),c.find(".clear-filters").css("display","inline-block"),d)},moreFilters:function(b){return b.preventDefault(),a("body").hasClass("filters-applied")?this.backToFilters():a("body").hasClass("show-filters")&&this.filtersChecked()?this.addFilter():(setTimeout(function(){var b=0;b=_.reduce(a(".filter-group"
 ),function(b,c){return Math.max(b,a(c).outerHeight())},b),b>710&&a(".filter-group").outerHeight(b)},0),this.clearSearch(),void a("body").toggleClass("show-filters"))},clearFilters:function(b){var c=a(".filter-group").find(":checkbox"),d=this;b.preventDefault(),_.each(c.filter(":checked"),function(b){return a(b).prop("checked",!1),d.filtersChecked()})},backToFilters:function(b){b&&b.preventDefault(),a("body").removeClass("filters-applied")},clearSearch:function(){a("#wp-filter-search-input").val("")}}),c.Router=Backbone.Router.extend({routes:{"browse/:sort(/)":"sort","tags/:tag(/)":"tag","search/:query(/)":"search","author/:author(/)":"author",":slug(/)":"preview","":"sort"},baseUrl:function(a){return 0!==a.length&&(a+="/&quot
 ;),a},themePath:"",browsePath:"browse/",searchPath:"search/",search:function(b){a(".wp-filter-search").val(b)},navigate:function(){Backbone.history._hasPushState&&Backbone.Router.prototype.navigate.apply(this,arguments),"object"==typeof _gaq&&_gaq.push(["_trackPageview",c.data.settings.path+arguments[0]])}}),c.Run={init:function(){this.view=new c.view.Installer({section:"featured",SearchView:c.view.Search}),this.render()},render:function(){this.view.render(),this.routes(),Backbone.history.start({root:c.data.settings.path,pushState:!0,hashChange:!1})},routes:function(){var b=this,d={};c.router=new c.Router,c.router.on("route:preview",function(a){b.view.collection.queries.push(c.data.query),d.theme=a,b.view.collection.query(d),b.view.view.expand(a)}),c.router.on("route:sort",function(a){b.view.collection.queries.push(c.data.query),a||(a="featured"),b.view.sort(a),b.view.
 trigger("theme:close")}),c.router.on("route:search",function(){b.view.collection.queries.push(c.data.query),a(".wp-filter-search").focus().trigger("keyup"),b.view.trigger("theme:close")}),c.router.on("route:tag",function(d){b.view.collection.queries.push(c.data.query),_.each(d.split("+"),function(b){a("#filter-id-"+b).prop("checked",!0)}),a("body").removeClass("show-filters").addClass("show-filters"),b.view.applyFilters(),b.view.trigger("theme:close")}),c.router.on("route:author",function(a){b.view.collection.queries.push(c.data.query),d.author=a,b.view.collection.query(d),c.utils.title(a),b.view.trigger("theme:close")})}},a(function(){c.Run.init()})}(jQuery),function(a){a.load("visualization","1",{packages:["corechart"]})}(google);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+window.wp=window.wp||{},function(a){var b,c=wp.themes=wp.themes||{};c.data=_wpThemeSettings,b=c.data.l10n,_.extend(c,{model:{},view:{},routes:{},router:{},template:wp.template}),c.utils={title:function(b){document.title=a("<div/>").html(c.data.settings.title.replace("%s",a("<div/>").text(b).html())).text()}},c.Model=Backbone.Model.extend({initialize:function(){var a;this.set({id:this.get("slug")||this.get("id")}),this.has("sections")&&(a=this.get("sections").description,this.set({description:a}))}}),c.view.Appearance=wp.Backbone.View.extend({el:"#themes .theme-browser",window:a(window),page:0,initialize:function(a){_.bindAll(this,"scroller"),this.SearchView=a.SearchView?a.SearchView:c.view.Search,this.window.bind("scroll",_.throttle(this.scroller,300))},render:function()
 {this.view=new c.view.Themes({collection:this.collection,parent:this}),this.search(),this.view.render(),this.$el.find(".themes").remove(),this.$el.append(this.view.el).addClass("rendered")},searchContainer:"",search:function(){var c,d=this;c=new this.SearchView({collection:d.collection,parent:this}),c.render(),this.searchContainer.append(a.parseHTML('<label class="screen-reader-text" for="wp-filter-search-input">'+b.search+"</label>")).append(c.el)},scroller:function(){var a,b,c=this;a=this.window.scrollTop()+c.window.height(),b=c.$el.offset().top+c.$el.outerHeight(!1)-c.window.height(),b=Math.round(.9*b),a>b&&this.trigger("theme:scroll")}}),c.Collection=Backbone.Collection.extend({model:c.Model,terms:"",queries:[],currentQuery:{page:1,request:{}},count:!1,loadingThemes:!1,doSearch:function(a){this.terms!==a&&(this.terms=a,this.terms.length>0&&this.search(this.te
 rms),""===this.terms&&this.reset(c.data.themes),this.trigger("update"))},search:function(b){var d,e,f,g,h,i;this.reset(c.data.themes,{silent:!0}),b=b.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),b=b.replace(/ /g,")(?=.*"),d=new RegExp("^(?=.*"+b+").+","i"),e=this.filter(function(a){return g=a.get("name").replace(/(<([^>]+)>)/gi,""),h=a.get("description").replace(/(<([^>]+)>)/gi,""),i=a.get("author").replace(/(<([^>]+)>)/gi,""),f=_.union(g,a.get("id"),h,i,a.get("tags")),d.test(a.get("author"))&&b.length>2&&a.set("displayAuthor",!0),d.test(f)}),0===e.length?this.trigger("query:empty"):a("body").removeClass("no-results"),this.reset(e)},paginate:function(a){var b=this;return a=a||0,b=_(b.rest(c.data.settings.postsPerPage*a)),b=_(b.first(
 c.data.settings.postsPerPage))},query:function(b){var c,d,e,f=this.queries,g=this;if(this.currentQuery.request=b,c=_.find(f,function(a){return _.isEqual(a.request,b)}),d=_.has(b,"page"),d||(this.currentQuery.page=1),c||d){if(d)return this.apiCall(b,d).done(function(a){g.add(a.themes),g.trigger("query:success",a.info.results),g.loadingThemes=!1}).fail(function(){g.trigger("query:fail")});0===c.themes.length?g.trigger("query:empty"):a("body").removeClass("no-results"),_.isNumber(c.total)&&(this.count=c.total),this.reset(c.themes),c.total||(this.count=this.length),this.trigger("update"),this.trigger("query:success",this.count)}else c=this.apiCall(b).done(function(a){a.themes&&(g.reset(a.themes),e=a.info.results,f.push({themes:a.themes,request:b,total:e})),g.trigger("update"),g.trigger("query:success",e),a.themes&&0===a.themes.length&&g.trigger("query:
 empty")}).fail(function(){g.trigger("query:fail")})},apiCall:function(b,d){var e={type:"POST",url:"https://api.wordpress.org/themes/info/1.1/",jsonp:"callback",dataType:"jsonp",data:{action:"query_themes",request:_.extend({per_page:c.data.settings.postsPerPage,locale:c.data.settings.locale,fields:{description:!0,sections:!1,tested:!0,requires:!0,downloaded:!0,downloadlink:!0,last_updated:!0,homepage:!0,theme_url:!0,parent:!0,tags:!0,rating:!0,ratings:!0,num_ratings:!0,extended_author:!0,photon_screenshots:!0}},b)},beforeSend:function(){d||a("body").addClass("loading-content").removeClass("no-results")}};return a.Deferred(function(b){a.ajax(e).done(function(a){b.resolveWith(this,[a])}).fail(function(){b.rejectWith(this,arguments)})}).promise()}}),c.view.Theme=wp.Backbone.View.extend({className:"theme",state:"grid",html:wp.themes.template("theme"),events:{click:
 "expand",keydown:"expand",touchend:"expand",keyup:"addFocus",touchmove:"preventExpand"},touchDrag:!1,render:function(){var a=this.model.toJSON();a.permalink=c.data.settings.path+c.router.baseUrl(a.slug),a.path=c.data.settings.path,this.$el.html(this.html(a)).attr({tabindex:0,"aria-describedby":a.id+"-action "+a.id+"-name"})},addFocus:function(){var b=a(":focus").hasClass("theme")?a(":focus"):a(":focus").parents(".theme");a(".theme.focus").removeClass("focus"),b.addClass("focus")},expand:function(b){var d=this;return b=b||window.event,!0===b.metaKey&&"click"===b.type||"keydown"===b.type&&13!==b.which&&32!==b.which?void 0:this.touchDrag===!0?this.touchDrag=!1:void(a(b.target).is(".theme-actions a")||(c.focusedTheme=this.$el,this.trigger("theme:expand",d.model.cid),
 b.preventDefault()))},preventExpand:function(){this.touchDrag=!0}}),c.view.Details=wp.Backbone.View.extend({className:"theme-overlay",events:{click:"collapse","click .left":"previousTheme","click .right":"nextTheme","click .theme-actions .button-secondary":"preview","keydown .theme-actions .button-secondary":"preview","touchend .theme-actions .button-secondary":"preview","click .favorite":"favourite_toggle"},html:c.template("theme-single"),render:function(){var a=this.model.toJSON(),d=new Date;d.setUTCFullYear(a.last_updated.substring(0,4),a.last_updated.substring(5,7)-1,a.last_updated.substring(8,10)),a.last_updated=d.toLocaleDateString(!1,{day:"numeric",month:"long",year:"numeric"}),a.is_outdated=d.setYear(d.getYear()+1902).valueOf()<(new Date).valueOf(),a.tags=_.map(a.tags,function(a,d){return transl
 ated_tag=b.tags[d]||a,'<a href="'+c.data.settings.path+c.router.baseUrl("tags/"+d)+'">'+translated_tag+"</a>"}).join(", "),a.path=c.data.settings.path,a.downloaded=a.downloaded.toLocaleString(),a.show_favorites=!!c.data.settings.favorites.user,a.is_favorited=-1!=c.data.settings.favorites.themes.indexOf(a.slug),this.$el.html(this.html(a)),this.navigation(),this.screenshotCheck(this.$el),this.containFocus(this.$el),this.renderDownloadsGraph()},favourite_toggle:function(b){var d,e=this.$el.find(".favorite"),f=!e.hasClass("favorited"),g=this.model.get("slug");e.toggleClass("favorited"),f?c.data.settings.favorites.themes.push(g):(d=c.data.settings.favorites.themes.indexOf(g),d>-1&&delete c.data.settings.favorites.themes[d]);var h={type:"GET",url:"https://api.wordpress.org/themes/theme-directory/1.0/",jsonp:"callback",dataType:"jsonp",data:{action:
 f?"add-favorite":"remove-favorite",theme:this.model.get("slug"),_wpnonce:c.data.settings.favorites.nonce}};a.ajax(h).done(function(a){"undefined"!=typeof a.error&&"not_logged_in"==a.error&&(c.data.settings.favorites.themes=[],c.data.settings.favorites.user="")})},preview:function(b){var d,e,f=this;return this.touchDrag===!0?this.touchDrag=!1:void(a(b.target).hasClass("button-primary")||("keydown"!==b.type||13===b.which||32===b.which)&&("keydown"===b.type&&13!==b.which&&a(":focus").hasClass("button")||(b=b||window.event,b.preventDefault(),c.focusedTheme=this.$el,e=new c.view.Preview({model:this.model}),e.render(),this.setNavButtonsState(),c.data.settings.isMobile?e.$el.addClass("wp-full-overlay collapsed"):e.$el.addClass("wp-full-overlay expanded"),a(".theme-install-overlay").append(e.el),this.listenTo(e,&q
 uot;theme:next",function(){return this.trigger("theme:next"),d=f.model,_.isUndefined(f.current)||(d=f.current),f.current=f.model.collection.at(f.model.collection.indexOf(d)+1),_.isUndefined(f.current)?(f.options.parent.parent.trigger("theme:end"),f.current=d):(e.model=f.current,e.render(),this.setNavButtonsState(),void a(".next-theme").focus())}).listenTo(e,"theme:previous",function(){this.trigger("theme:previous"),d=f.model,0!==f.model.collection.indexOf(f.current)&&(_.isUndefined(f.current)||(d=f.current),f.current=f.model.collection.at(f.model.collection.indexOf(d)-1),_.isUndefined(f.current)||(e.model=f.current,e.render(),this.setNavButtonsState(),a(".previous-theme").focus()))}),this.listenTo(e,"preview:close",function(){f.current=f.model}))))},setNavButtonsState:function(){var b=a(".theme-install-overlay"),c=_.isUndefined(this.current)?this.model:this.current;0===this.model.collection.
 indexOf(c)&&b.find(".previous-theme").addClass("disabled"),_.isUndefined(this.model.collection.at(this.model.collection.indexOf(c)+1))&&b.find(".next-theme").addClass("disabled")},containFocus:function(b){var c,d=window.event;("undefined"==typeof d||1===a(d.target).closest(".theme").length)&&_.delay(function(){a(".theme-wrap a.button-primary:visible").focus()},500),b.on("keydown.wp-themes",function(d){9===d.which&&(c=a(d.target),c.is("button.close")&&d.shiftKey?(b.find(".theme-tags a:last-child").focus(),d.preventDefault()):c.is(".theme-tags a:last-child")&&(b.find("button.close").focus(),d.preventDefault()))})},collapse:function(b){var d,e,f,g,h,i=this,j={};1!==c.data.themes.length&&(b=b||window.event,(a(b.target).is(".close")||27===b.keyCode)&&(a("body").addClass("closing-ove
 rlay"),this.$el.fadeOut(1,function(){a("body").removeClass("closing-overlay"),i.closeOverlay(),d=document.body.scrollTop,(e=c.Collection.prototype.currentQuery.request.author)?(c.router.navigate(c.router.baseUrl("author/"+e)),c.utils.title(e)):(f=c.Collection.prototype.currentQuery.request.search)?(c.router.navigate(c.router.baseUrl(c.router.searchPath+f)),c.utils.title(f)):(g=c.view.Installer.prototype.filtersChecked())?(c.router.navigate(c.router.baseUrl("tags/"+g.join("+"))),c.utils.title(_.each(g,function(b,c){g[c]=a('label[for="filter-id-'+b+'"]').text()}).join(", "))):(h=a(".filter-links .current"))&&(h.length||(h=a('.filter-links [data-sort="featured"]'),j={trigger:!0}),c.router.navigate(c.router.baseUrl(c.router.browsePath+h.data("sort")),j),c.utils.title(h.text())),document.body.scrollTop=d,c.focusedTheme&&c.focusedTheme.focus()})))},renderDownloadsGraph:
 function(){var b=this;a.getJSON("https://api.wordpress.org/stats/themes/1.0/downloads.php?slug="+b.model.get("id")+"&limit=260&callback=?",function(c){var d=new google.visualization.DataTable,e=0;d.addColumn("string",_wpThemeSettings.l10n.date),d.addColumn("number",_wpThemeSettings.l10n.downloads),a.each(c,function(a,b){d.addRow(),d.setValue(e,0,new Date(a).toLocaleDateString()),d.setValue(e,1,Number(b)),e++}),new google.visualization.ColumnChart(document.getElementById("theme-download-stats-"+b.model.get("id"))).draw(d,{colors:["#253578"],legend:{position:"none"},titlePosition:"in",axisTitlesPosition:"in",chartArea:{height:280,left:35,width:"98%"},hAxis:{textStyle:{color:"black",fontSize:9}},vAxis:{format:"###,###",textPosition:"out",viewWindowMode:"explicit",viewWindow:{min:0}},bar:{groupWidth:d.getNumberOfRows()&gt
 ;100?"100%":null},height:350})})},navigation:function(){this.model.cid===this.model.collection.at(0).cid&&this.$el.find(".left").addClass("disabled"),this.model.cid===this.model.collection.at(this.model.collection.length-1).cid&&this.$el.find(".right").addClass("disabled")},closeOverlay:function(){a("body").removeClass("modal-open"),this.remove(),this.unbind(),this.trigger("theme:collapse")},nextTheme:function(){var a=this;return a.trigger("theme:next",a.model.cid),!1},previousTheme:function(){var a=this;return a.trigger("theme:previous",a.model.cid),!1},screenshotCheck:function(a){var b=new Image;b.src=a.find(".screenshot img").attr("src")}}),c.view.Preview=c.view.Details.extend({className:"wp-full-overlay expanded",el:".theme-install-overlay",events:{"click .close-full-overlay":"close","click .collapse-
 sidebar":"collapse","click .previous-theme":"previousTheme","click .next-theme":"nextTheme",keyup:"keyEvent"},html:c.template("theme-preview"),render:function(){var b=this.model.toJSON();this.$el.html(this.html(b)),c.router.navigate(c.router.baseUrl(c.router.themePath+this.model.get("id"))),this.$el.fadeIn(200,function(){a("body").addClass("theme-installer-active full-overlay-active"),a(".close-full-overlay").focus()})},close:function(){return this.$el.fadeOut(200,function(){a("body").removeClass("theme-installer-active full-overlay-active"),c.focusedTheme&&c.focusedTheme.focus()}),this.trigger("preview:close"),this.undelegateEvents(),this.unbind(),c.router.navigate(c.router.baseUrl(c.router.themePath+this.model.get("id"))),!1},collapse:function(){return this.$el.toggleClass("collapsed").toggleClass("expande
 d"),!1},keyEvent:function(){return 27===event.keyCode&&(this.undelegateEvents(),this.close()),39===event.keyCode&&_.once(this.nextTheme()),37===event.keyCode&&this.previousTheme(),!1}}),c.view.Themes=wp.Backbone.View.extend({className:"themes",$overlay:a("div.theme-overlay"),index:0,count:a(".wp-filter .theme-count"),initialize:function(b){var c=this;this.parent=b.parent,this.setView("grid"),this.listenTo(c.collection,"update",function(){c.parent.page=0,c.render(this)}),this.listenTo(c.collection,"query:success",function(a){_.isNumber(a)?c.count.text(a.toLocaleString()):c.count.text(c.collection.length.toLocaleString())}),this.listenTo(c.collection,"query:empty",function(){a("body").addClass("no-results")}),this.listenTo(this.parent,"theme:scroll",function(){c.renderThemes(c.parent.page)}),this.listenTo(this.parent,"theme:close",function(){c.over
 lay&&c.overlay.closeOverlay()}),a("body").on("keyup",function(a){c.overlay&&(39===a.keyCode&&c.overlay.nextTheme(),37===a.keyCode&&c.overlay.previousTheme(),27===a.keyCode&&c.overlay.collapse(a))})},render:function(){this.$el.empty(),1===c.data.themes.length&&(this.singleTheme=new c.view.Details({model:this.collection.models[0]}),this.singleTheme.render(),this.$el.addClass("single-theme"),this.$el.append(this.singleTheme.el)),this.options.collection.size()>0&&this.renderThemes(this.parent.page),this.count.text(this.collection.count?this.collection.count:this.collection.length)},renderThemes:function(b){var d=this;return d.instance=d.collection.paginate(b),0===d.instance.size()?void this.parent.trigger("theme:end"):(b>=1&&a(".add-new-theme").remove(),d.instance.each(function(a){d.theme=new c.view.Theme({model:a,parent:d}),d.theme.render(),d.$el.append(d.theme.el),d.
 listenTo(d.theme,"theme:expand",d.expand,d)}),void this.parent.page++)},setView:function(a){return a},expand:function(b){var d=this;this.model=d.collection.get(b),c.router.navigate(c.router.baseUrl(c.router.themePath+this.model.id)),c.utils.title(this.model.attributes.name),this.setView("detail"),a("body").addClass("modal-open"),this.overlay=new c.view.Details({model:d.model}),this.overlay.render(),this.$overlay.html(this.overlay.el),this.listenTo(this.overlay,"theme:next",function(){d.next([d.model.cid]),a(".theme-header").find(".right").focus()}).listenTo(this.overlay,"theme:previous",function(){d.previous([d.model.cid]),a(".theme-header").find(".left").focus()})},next:function(a){var b,c,d=this;b=d.collection.get(a[0]),c=d.collection.at(d.collection.indexOf(b)+1),void 0!==c&&d.theme.trigger("theme:expand",c.cid)},previous:function(a){var b,c,d=this;b=d.collection.
 get(a[0]),c=d.collection.at(d.collection.indexOf(b)-1),void 0!==c&&d.theme.trigger("theme:expand",c.cid)}}),c.view.Search=wp.Backbone.View.extend({tagName:"input",className:"wp-filter-search",id:"wp-filter-search-input",searching:!1,attributes:{placeholder:b.searchPlaceholder,type:"search"},events:{keyup:"search",search:"search"},initialize:function(a){this.parent=a.parent,this.listenTo(this.parent,"theme:close",function(){this.searching=!1})},search:function(a){("keyup"!==a.type||9!==a.which&&16!==a.which)&&(this.collection=this.options.parent.view.collection,"keyup"===a.type&&27===a.which&&(a.target.value=""),_.debounce(_.bind(this.doSearch,this),300)(a.target.value))},doSearch:_.debounce(function(b){var d={};c.view.Installer.prototype.clearFilters(jQuery.Event("click")),d.search=b,"author:"===b.substring(0,7)&amp
 ;&(d.search="",d.author=b.slice(7)),"tag:"===b.substring(0,4)&&(d.search="",d.tag=[b.slice(4)]),a(".filter-links li > a.current").removeClass("current"),a("body").removeClass("show-filters filters-applied"),b?(c.utils.title(b),c.router.navigate(c.router.baseUrl(c.router.searchPath+b),{replace:!0})):(delete d.search,d.browse="featured",c.utils.title(a('.filter-links [data-sort="featured"]').text()),c.router.navigate(c.router.baseUrl(c.router.browsePath+"featured"),{replace:!0})),this.collection.query(d)},300)}),c.view.Installer=c.view.Appearance.extend({el:"#themes",events:{"click .filter-links li > a":"onSort","click .theme-filter":"onFilter","click .drawer-toggle":"moreFilters","click .filter-drawer .apply-filters":"applyFilters",'click .filter-group [type="checkbox"]
 ':"addFilter","click .filter-drawer .clear-filters":"clearFilters","click .filtered-by":"backToFilters"},activeClass:"current",searchContainer:a(".wp-filter .search-form"),render:function(){var d=this;this.search(),this.collection=new c.Collection,this.listenTo(this,"theme:end",function(){d.collection.loadingThemes||(d.collection.loadingThemes=!0,d.collection.currentQuery.page++,_.extend(d.collection.currentQuery.request,{page:d.collection.currentQuery.page}),d.collection.query(d.collection.currentQuery.request))}),this.listenTo(this.collection,"query:success",function(){a("body").removeClass("loading-content"),a(".theme-browser").find("div.error").remove()}),this.listenTo(this.collection,"query:fail",function(){a("body").removeClass("loading-content"),a(".theme-browser").find("div.error").remove(),a(&quot
 ;.theme-browser").find("div.themes").before('<div class="error"><p>'+b.error+"</p></div>")}),this.view&&this.view.remove(),this.view=new c.view.Themes({collection:this.collection,parent:this}),this.page=0,this.$el.find(".themes").remove(),this.view.render(),this.$el.find(".theme-browser").append(this.view.el).addClass("rendered")},browse:function(a){"favorites"==a?this.collection.query({browse:a,user:c.data.settings.favorites.user}):this.collection.query({browse:a})},onSort:function(b){var d=a(b.target),e=d.data("sort");b.preventDefault(),a("body").removeClass("filters-applied show-filters"),d.hasClass(this.activeClass)||(this.sort(e),c.router.navigate(c.router.baseUrl(c.router.browsePath+e)))},sort:function(b){var d=a('.filter-links [data-sort="'+b+'"]'),e=this;e.clearSearch(),_.each(a(".filter-group").find(":checkbox&quot
 ;).filter(":checked"),function(b){return a(b).prop("checked",!1),e.filtersChecked()}),a(".filter-links li > a, .theme-filter").removeClass(this.activeClass),d.addClass(this.activeClass),c.utils.title(d.text()),this.browse(b)},onFilter:function(b){var c,d=a(b.target),e=d.data("filter");d.hasClass(this.activeClass)||(a(".filter-links li > a, .theme-section").removeClass(this.activeClass),d.addClass(this.activeClass),e&&(e=_.union(e,this.filtersChecked()),c={tag:[e]},this.collection.query(c)))},addFilter:function(){this.filtersChecked()},applyFilters:function(b){var d,e=[],f=this.filtersChecked(),g={tag:f},h=a(".filtered-by .tags");b&&b.preventDefault(),a("body").addClass("filters-applied"),a(".filter-links li > a.current").removeClass("current"),h.empty(),_.each(f,function(b){d=a('label[for="filter-id-'+b+'"]').text(),e.push(d),h.append('<span class
 ="tag">'+d+"</span>")}),c.router.navigate(c.router.baseUrl("tags/"+f.join("+"))),c.utils.title(e.join(", ")),this.collection.query(g)},filtersChecked:function(){var b=a(".filter-group").find(":checkbox").filter(":checked"),c=a(".filter-drawer"),d=[];return _.each(b,function(b){d.push(a(b).prop("value"))}),0===d.length?(c.find(".apply-filters").prop("disabled",!0).find("span").text(""),c.find(".clear-filters").hide(),a("body").removeClass("filters-applied"),!1):(c.find(".apply-filters").prop("disabled",!1).find("span").text(d.length),c.find(".clear-filters").css("display","inline-block"),d)},moreFilters:function(b){return b.preventDefault(),a("body").hasClass("filters-applied")?this.backToFilters():a("body").hasClass(&q
 uot;show-filters")&&this.filtersChecked()?this.addFilter():(setTimeout(function(){var b=0;b=_.reduce(a(".filter-group"),function(b,c){return Math.max(b,a(c).outerHeight())},b),b>710&&a(".filter-group").outerHeight(b)},0),this.clearSearch(),void a("body").toggleClass("show-filters"))},clearFilters:function(b){var c=a(".filter-group").find(":checkbox"),d=this;b.preventDefault(),_.each(c.filter(":checked"),function(b){return a(b).prop("checked",!1),d.filtersChecked()})},backToFilters:function(b){b&&b.preventDefault(),a("body").removeClass("filters-applied")},clearSearch:function(){a("#wp-filter-search-input").val("")}}),c.Router=Backbone.Router.extend({routes:{"browse/:sort(/)":"sort","tags/:tag(/)":"tag","search/:query(/)":"search","author/:author(/)":"author&qu
 ot;,":slug(/)":"preview","":"sort"},baseUrl:function(a){return 0!==a.length&&(a+="/"),a},themePath:"",browsePath:"browse/",searchPath:"search/",search:function(b){a(".wp-filter-search").val(b)},navigate:function(){Backbone.history._hasPushState&&Backbone.Router.prototype.navigate.apply(this,arguments),"object"==typeof _gaq&&_gaq.push(["_trackPageview",c.data.settings.path+arguments[0]])}}),c.Run={init:function(){this.view=new c.view.Installer({section:"featured",SearchView:c.view.Search}),this.render()},render:function(){this.view.render(),this.routes(),Backbone.history.start({root:c.data.settings.path,pushState:!0,hashChange:!1})},routes:function(){var b=this,d={};c.router=new c.Router,c.router.on("route:preview",function(a){b.view.collection.queries.push(c.data.query),d.theme=a,b.view.collection.query(d),b.view.view.expand(a)}),c
 .router.on("route:sort",function(a){b.view.collection.queries.push(c.data.query),a||(a="featured"),b.view.sort(a),b.view.trigger("theme:close")}),c.router.on("route:search",function(){b.view.collection.queries.push(c.data.query),a(".wp-filter-search").focus().trigger("keyup"),b.view.trigger("theme:close")}),c.router.on("route:tag",function(d){b.view.collection.queries.push(c.data.query),_.each(d.split("+"),function(b){a("#filter-id-"+b).prop("checked",!0)}),a("body").removeClass("show-filters").addClass("show-filters"),b.view.applyFilters(),b.view.trigger("theme:close")}),c.router.on("route:author",function(a){b.view.collection.queries.push(c.data.query),d.author=a,b.view.collection.query(d),c.utils.title(a),b.view.trigger("theme:close")})}},a(function(){c.Run.init()})}(jQuery),function(a){a.load("visualization
 ","1",{packages:["corechart"]})}(google);
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgthemesstylertlcss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/style-rtl.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/style-rtl.css    2015-07-21 21:14:22 UTC (rev 1769)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/style-rtl.css      2015-07-22 04:00:32 UTC (rev 1770)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,5 +1,5 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-Theme Name: WP.org Themes
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Theme Name: WordPress.org Themes
</ins><span class="cx" style="display: block; padding: 0 10px"> Theme URI: https://wordpress.org/themes
</span><span class="cx" style="display: block; padding: 0 10px"> Author: wordpressdotorg
</span><span class="cx" style="display: block; padding: 0 10px"> Author URI: https://wordpress.org
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -331,7 +331,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        content: '\2190';
</span><span class="cx" style="display: block; padding: 0 10px">        margin-left: 5px;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> .rtl .theme-navigation .close:before {
</span><span class="cx" style="display: block; padding: 0 10px">        content: '\2192';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1607,6 +1606,26 @@
</span><span class="cx" style="display: block; padding: 0 10px">        margin: 5px 0 15px;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/* = Favorites
+----------------*/
+span.favorite {
+       color: #cccccc;
+       float: left;
+}
+
+span.favorite.dashicons,
+span.favorite.dashicons:before {
+       font-size: 40px;
+       width: 40px;
+       line-height: 1.5;
+}
+
+span.favorite:hover,
+span.favorite.favorited {
+       color: #e02020;
+}
+
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /* =Media Queries
</span><span class="cx" style="display: block; padding: 0 10px"> -------------------------------------------------------------- */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1806,5 +1825,3 @@
</span><span class="cx" style="display: block; padding: 0 10px">                margin-top: 40px;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-
</del></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgthemesstylecss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/style.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/style.css        2015-07-21 21:14:22 UTC (rev 1769)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/style.css  2015-07-22 04:00:32 UTC (rev 1770)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,5 +1,5 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-Theme Name: WP.org Themes
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Theme Name: WordPress.org Themes
</ins><span class="cx" style="display: block; padding: 0 10px"> Theme URI: https://wordpress.org/themes
</span><span class="cx" style="display: block; padding: 0 10px"> Author: wordpressdotorg
</span><span class="cx" style="display: block; padding: 0 10px"> Author URI: https://wordpress.org
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1606,6 +1606,26 @@
</span><span class="cx" style="display: block; padding: 0 10px">        margin: 5px 0 15px;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/* = Favorites
+----------------*/
+span.favorite {
+       color: #cccccc;
+       float: right;
+}
+
+span.favorite.dashicons,
+span.favorite.dashicons:before {
+       font-size: 40px;
+       width: 40px;
+       line-height: 1.5;
+}
+
+span.favorite:hover,
+span.favorite.favorited {
+       color: #e02020;
+}
+
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /* =Media Queries
</span><span class="cx" style="display: block; padding: 0 10px"> -------------------------------------------------------------- */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgthemesthemesinglephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/theme-single.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/theme-single.php 2015-07-21 21:14:22 UTC (rev 1769)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/theme-single.php   2015-07-22 04:00:32 UTC (rev 1770)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -17,6 +17,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        <div>
</span><span class="cx" style="display: block; padding: 0 10px">                                <h3 class="theme-name entry-title" itemprop="name"><?php echo esc_html( $theme->name ); ?></h3>
</span><span class="cx" style="display: block; padding: 0 10px">                                <h4 class="theme-author"><?php printf( _x( 'By %s', 'theme author', 'wporg-themes' ), '<a href="https://wordpress.org/themes/author/' . $theme->author->user_nicename . '/"><span class="author" itemprop="author">' . esc_html( $theme->author->display_name ) . '</span></a>' ); ?></h4>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                <?php if ( is_user_logged_in() && wporg_themes_is_favourited( $theme->slug ) ) { ?>
+                                       <span class="dashicons dashicons-heart favorite favorited"></span>
+                               <?php } elseif ( is_user_logged_in() ) { ?>
+                                       <span class="dashicons dashicons-heart favorite"></span>
+                               <?php } ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                         </div>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        <div class="theme-head">
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgthemesviewtemplatesthemesinglephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/view-templates/theme-single.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/view-templates/theme-single.php  2015-07-21 21:14:22 UTC (rev 1769)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/view-templates/theme-single.php    2015-07-22 04:00:32 UTC (rev 1770)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -17,6 +17,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        <div>
</span><span class="cx" style="display: block; padding: 0 10px">                                <h3 class="theme-name entry-title" itemprop="name">{{{ data.name }}}</h3>
</span><span class="cx" style="display: block; padding: 0 10px">                                <h4 class="theme-author"><?php printf( _x( 'By %s', 'theme author', 'wporg-themes' ), '<a href="{{{ data.path }}}author/{{ data.author.user_nicename }}/"><span class="author" itemprop="author">{{{ data.author.display_name }}}</span></a>' ); ?></h4>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                <# if ( data.show_favorites && data.is_favorited ) { #>
+                                       <span class="dashicons dashicons-heart favorite favorited"></span>
+                               <# } else if ( data.show_favorites ) { #>
+                                       <span class="dashicons dashicons-heart favorite"></span>
+                               <# } #>
</ins><span class="cx" style="display: block; padding: 0 10px">                         </div>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        <div class="theme-head">
</span></span></pre>
</div>
</div>

</body>
</html>