<!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>[1296] sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes: WP.org Themes: Update document title according to current view.</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/1296">1296</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/1296","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>obenland</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-02-24 04:48:58 +0000 (Tue, 24 Feb 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'>WP.org Themes: Update document title according to current view.

Also improves UX when closing a modal, URL and title are now agnostic of the
last index view.

See <a href="http://meta.trac.wordpress.org/ticket/745">#745</a>, <a href="http://meta.trac.wordpress.org/ticket/850">#850</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<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_htmlwpcontentthemespubwporgthemesjsthemejs">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<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-02-23 23:42:33 UTC (rev 1295)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php      2015-02-24 04:48:58 UTC (rev 1296)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -72,6 +72,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                wp_localize_script( 'theme', '_wpThemeSettings', array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'themes'   => false,
</span><span class="cx" style="display: block; padding: 0 10px">                        'settings' => array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'title'      => __( 'WordPress &#8250; %s &laquo; Free WordPress Themes', 'wporg-themes' ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 'isMobile'   => wp_is_mobile(),
</span><span class="cx" style="display: block; padding: 0 10px">                                'isInstall'  => true,
</span><span class="cx" style="display: block; padding: 0 10px">                                'canInstall' => false,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -187,7 +188,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $user = get_user_by('login', $theme->author);
</span><span class="cx" style="display: block; padding: 0 10px">                $theme->authorurl       = $user->user_nicename;
</span><span class="cx" style="display: block; padding: 0 10px">                $theme->authordispname = wp_kses( $user->display_name, $themes_allowedtags );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $theme->author         = wp_kses( $theme->author,      $themes_allowedtags );
</span><span class="cx" style="display: block; padding: 0 10px">                $theme->version        = wp_kses( $theme->version,     $themes_allowedtags );
</span><span class="cx" style="display: block; padding: 0 10px">                $theme->description    = wp_kses( $theme->description, $themes_allowedtags );
</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-02-23 23:42:33 UTC (rev 1295)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.js        2015-02-24 04:48:58 UTC (rev 1296)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,6 +1,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ( function ( $, wp ) {
</span><span class="cx" style="display: block; padding: 0 10px">        google.load("visualization", "1", {packages:["corechart"]});
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        wp.themes.utils = {
+               title: function ( item ) {
+                       var title = $( 'title' );
+
+                       title.html( wp.themes.data.settings.title.replace( '%s', item ) );
+               }
+       };
+
</ins><span class="cx" style="display: block; padding: 0 10px">         _.extend( wp.themes.view.Appearance.prototype, {
</span><span class="cx" style="display: block; padding: 0 10px">                el: '#themes .theme-browser',
</span><span class="cx" style="display: block; padding: 0 10px">                searchContainer: ''
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,6 +26,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Trigger a route update for the current model
</span><span class="cx" style="display: block; padding: 0 10px">                        wp.themes.router.navigate( wp.themes.router.baseUrl( wp.themes.router.themePath + this.model.id ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        wp.themes.utils.title( this.model.attributes.name );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Sets this.view to 'detail'
</span><span class="cx" style="display: block; padding: 0 10px">                        this.setView( 'detail' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -53,9 +62,21 @@
</span><span class="cx" style="display: block; padding: 0 10px">        _.extend( wp.themes.view.Installer.prototype, {
</span><span class="cx" style="display: block; padding: 0 10px">                el: '#themes',
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                sort: function( sort ) {
+                       var sorter = $( '.filter-links [data-sort="' + sort + '"]' );
+                       this.clearSearch();
+
+                       $( '.filter-links li > a, .theme-filter' ).removeClass( this.activeClass );
+                       sorter.addClass( this.activeClass );
+                       wp.themes.utils.title( sorter.text() );
+
+                       this.browse( sort );
+               },
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 // Applying filters triggers a tag request.
</span><span class="cx" style="display: block; padding: 0 10px">                applyFilters: function( event ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        var name,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 var names = [],
+                               name,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 tags = this.filtersChecked(),
</span><span class="cx" style="display: block; padding: 0 10px">                                request = { tag: tags },
</span><span class="cx" style="display: block; padding: 0 10px">                                filteringBy = $( '.filtered-by .tags' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -70,10 +91,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        _.each( tags, function( tag ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                name = $( 'label[for="filter-id-' + tag + '"]' ).text();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                names.push( name );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 filteringBy.append( '<span class="tag">' + name + '</span>' );
</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">                        wp.themes.router.navigate( wp.themes.router.baseUrl( 'tag/' + tags.join( '+' ) ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        wp.themes.utils.title( names.join( ', ' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Get the themes by sending Ajax POST request to api.wordpress.org/themes
</span><span class="cx" style="display: block; padding: 0 10px">                        // or searching the local cache
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -438,6 +461,54 @@
</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">                        });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                },
+
+               // Single theme overlay screen
+               // It's shown when clicking a theme
+               collapse: function( event ) {
+                       var self = this,
+                               scroll, sorter;
+
+                       event = event || window.event;
+
+                       // Prevent collapsing detailed view when there is only one theme available
+                       if ( wp.themes.data.themes.length === 1 ) {
+                               return;
+                       }
+
+                       // 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( '.close' ) || 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( 'closing-overlay' );
+                                       // Handle event cleanup
+                                       self.closeOverlay();
+
+                                       // Get scroll position to avoid jumping to the top
+                                       scroll = document.body.scrollTop;
+
+                                       sorter = $( '.filter-links .current' );
+
+                                       // Clean the url structure
+                                       wp.themes.router.navigate( wp.themes.router.baseUrl( wp.themes.router.browsePath + sorter.data( 'sort' ) ) );
+                                       wp.themes.utils.title( sorter.text() );
+
+                                       // Restore scroll position
+                                       document.body.scrollTop = scroll;
+
+                                       // Return focus to the theme div
+                                       if ( wp.themes.focusedTheme ) {
+                                               wp.themes.focusedTheme.focus();
+                                       }
+                               });
+                       }
</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"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -496,7 +567,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        _.extend( wp.themes.view.InstallerSearch.prototype, {
</span><span class="cx" style="display: block; padding: 0 10px">                doSearch: _.debounce( function( value ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        var request = {};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 var request = {},
+                               sort = 'featured';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        request.search = value;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -527,9 +599,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Set route
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( value ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                wp.themes.utils.title( value );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 wp.themes.router.navigate( wp.themes.router.baseUrl( wp.themes.router.searchPath + value ), { replace: true } );
</span><span class="cx" style="display: block; padding: 0 10px">                        } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                wp.themes.router.navigate( wp.themes.router.baseUrl( '' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         wp.themes.router.navigate( wp.themes.router.baseUrl( themes.router.browsePath + sort ) );
+                               this.parent.sort( sort );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }, 300 )
</span><span class="cx" style="display: block; padding: 0 10px">        });
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -581,6 +655,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        wp.themes.router.on( 'route:author', function( author ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                request.author = author;
</span><span class="cx" style="display: block; padding: 0 10px">                                self.view.collection.query( request );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                wp.themes.utils.title( author );
</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">        });
</span></span></pre>
</div>
</div>

</body>
</html>