Index: /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.js
===================================================================
--- /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.js	(revision 6550)
+++ /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.js	(revision 6551)
@@ -934,5 +934,5 @@
 		collapse: function() {
 
-			this.$el.toggleClass( 'collapsed' ).toggleClass( 'expanded' );
+			this.$el.removeClass( 'collapsed expanded' );
 			return false;
 		},
Index: /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.min.js
===================================================================
--- /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.min.js	(revision 6550)
+++ /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.min.js	(revision 6551)
@@ -1,1 +1,1 @@
-window.wp=window.wp||{},function(e){var t,i=wp.themes=wp.themes||{};i.data=_wpThemeSettings,t=i.data.l10n,_.extend(i,{model:{},view:{},routes:{},router:{},template:wp.template}),i.utils={title:function(t){document.title=e("<div/>").html(i.data.settings.title.replace("%s",e("<div/>").text(t).html())).text()}},i.Model=Backbone.Model.extend({initialize:function(){var e;this.set({id:this.get("slug")||this.get("id")}),this.has("sections")&&(e=this.get("sections").description,this.set({description:e}))}}),i.view.Appearance=wp.Backbone.View.extend({el:"#themes .theme-browser",window:e(window),page:0,initialize:function(e){_.bindAll(this,"scroller"),this.SearchView=e.SearchView?e.SearchView:i.view.Search,this.window.bind("scroll",_.throttle(this.scroller,300))},render:function(){this.view=new i.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 i,s=this;(i=new this.SearchView({collection:s.collection,parent:this})).render(),this.searchContainer.append(e.parseHTML('<label class="screen-reader-text" for="wp-filter-search-input">'+t.search+"</label>")).append(i.el)},scroller:function(){var e,t,i=this;e=this.window.scrollTop()+i.window.height(),t=i.$el.offset().top+i.$el.outerHeight(!1)-i.window.height(),e>(t=Math.round(.9*t))&&this.trigger("theme:scroll")}}),i.Collection=Backbone.Collection.extend({model:i.Model,terms:"",queries:[],currentQuery:{page:1,request:{}},count:!1,loadingThemes:!1,doSearch:function(e){this.terms!==e&&(this.terms=e,this.terms.length>0&&this.search(this.terms),""===this.terms&&this.reset(i.data.themes),this.trigger("themes:update"))},search:function(t){var s,r,o,n,a,l;this.reset(i.data.themes,{silent:!0}),t=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),t=t.replace(/ /g,")(?=.*"),s=new RegExp("^(?=.*"+t+").+","i"),0===(r=this.filter(function(e){return n=e.get("name").replace(/(<([^>]+)>)/gi,""),a=e.get("description").replace(/(<([^>]+)>)/gi,""),l=e.get("author").replace(/(<([^>]+)>)/gi,""),o=_.union([n,e.get("id"),a,l,e.get("tags")]),s.test(e.get("author"))&&t.length>2&&e.set("displayAuthor",!0),s.test(o)})).length?this.trigger("query:empty"):e("body").removeClass("no-results"),this.reset(r)},paginate:function(e){var t=this;return e=e||0,t=_(t.rest(i.data.settings.postsPerPage*e)),t=_(t.first(i.data.settings.postsPerPage))},query:function(t){var i,s,r,o=this.queries,n=this;if(this.currentQuery.request=t,i=_.find(o,function(e){return _.isEqual(e.request,t)}),(s=_.has(t,"page"))||(this.currentQuery.page=1),i||s){if(s)return this.apiCall(t,s).done(function(e){n.add(e.themes),n.trigger("query:success",e.info.results),n.loadingThemes=!1}).fail(function(){n.trigger("query:fail")});0===i.themes.length?n.trigger("query:empty"):e("body").removeClass("no-results"),_.isNumber(i.total)&&(this.count=i.total),this.reset(i.themes),i.total||(this.count=this.length),this.trigger("themes:update"),this.trigger("query:success",this.count)}else i=this.apiCall(t).done(function(e){e.themes&&(n.reset(e.themes),r=e.info.results,o.push({themes:e.themes,request:t,total:r})),n.trigger("themes:update"),n.trigger("query:success",r),e.themes&&0===e.themes.length&&n.trigger("query:empty")}).fail(function(){n.trigger("query:fail")})},apiCall:function(t,s){var r={type:"POST",url:"https://api.wordpress.org/themes/info/1.1/",jsonp:"callback",dataType:"jsonp",data:{action:"query_themes",request:_.extend({per_page:i.data.settings.postsPerPage,locale:i.data.settings.locale,fields:{description:!0,sections:!1,tested:!0,requires:!0,downloaded:!1,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,active_installs:!0}},t)},beforeSend:function(){s||e("body").addClass("loading-content").removeClass("no-results")}};return e.Deferred(function(t){e.ajax(r).done(function(e){t.resolveWith(this,[e])}).fail(function(){t.rejectWith(this,arguments)})}).promise()}}),i.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 e=this.model.toJSON();e.permalink=i.data.settings.path+i.router.baseUrl(e.slug),e.path=i.data.settings.path,this.$el.html(this.html(e)).attr({tabindex:0,"aria-describedby":e.id+"-action "+e.id+"-name"})},addFocus:function(){var t=e(":focus").hasClass("theme")?e(":focus"):e(":focus").parents(".theme");e(".theme.focus").removeClass("focus"),t.addClass("focus")},expand:function(t){var s=this;if(!(!0===(t=t||window.event).metaKey|t.ctrlKey&&"click"===t.type||"keydown"===t.type&&13!==t.which&&32!==t.which))return!0===this.touchDrag?this.touchDrag=!1:void(e(t.target).is(".theme-actions a")||(i.focusedTheme=this.$el,this.trigger("theme:expand",s.model.cid),t.preventDefault()))},preventExpand:function(){this.touchDrag=!0}}),i.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:i.template("theme-single"),render:function(){var e=this.model.toJSON(),s=new Date;s.setUTCFullYear(e.last_updated.substring(0,4),e.last_updated.substring(5,7)-1,e.last_updated.substring(8,10)),e.last_updated=s.toLocaleDateString(t.locale,{day:"numeric",month:"long",year:"numeric"}),e.is_outdated=s.setYear(s.getYear()+1902).valueOf()<(new Date).valueOf(),e.tags=_.map(e.tags,function(e,s){return translated_tag=t.tags[s]||e,'<a href="'+i.data.settings.path+i.router.baseUrl("tags/"+s)+'">'+translated_tag+"</a>"}).join(", "),e.path=i.data.settings.path,e.active_installs<10?e.active_installs=t.active_installs_less_than_10:e.active_installs>=1e6?e.active_installs=t.active_installs_1_million:e.active_installs=e.active_installs.toLocaleString()+"+",e.show_favorites=!!i.data.settings.favorites.user,e.is_favorited=-1!=i.data.settings.favorites.themes.indexOf(e.slug),this.$el.html(this.html(e)),this.navigation(),this.screenshotCheck(this.$el),this.containFocus(this.$el),this.renderDownloadsGraph()},favourite_toggle:function(t){var s,r=this.$el.find(".favorite"),o=!r.hasClass("favorited"),n=this.model.get("slug");r.toggleClass("favorited"),o?i.data.settings.favorites.themes.push(n):(s=i.data.settings.favorites.themes.indexOf(n))>-1&&delete i.data.settings.favorites.themes[s];var a={type:"GET",url:"https://api.wordpress.org/themes/theme-directory/1.0/",jsonp:"callback",dataType:"jsonp",data:{action:o?"add-favorite":"remove-favorite",theme:this.model.get("slug"),_wpnonce:i.data.settings.favorites.nonce}};e.ajax(a).done(function(e){void 0!==e.error&&"not_logged_in"==e.error&&(i.data.settings.favorites.themes=[],i.data.settings.favorites.user="")})},preview:function(t){var s,r,o=this;if(!0===this.touchDrag)return this.touchDrag=!1;e(t.target).hasClass("button-primary")||"keydown"===t.type&&13!==t.which&&32!==t.which||"keydown"===t.type&&13!==t.which&&e(":focus").hasClass("button")||((t=t||window.event).preventDefault(),i.focusedTheme=this.$el,(r=new i.view.Preview({model:this.model})).render(),this.setNavButtonsState(),i.data.settings.isMobile?r.$el.addClass("wp-full-overlay collapsed"):r.$el.addClass("wp-full-overlay expanded"),e(".theme-install-overlay").append(r.el),this.listenTo(r,"theme:next",function(){if(this.trigger("theme:next"),s=o.model,_.isUndefined(o.current)||(s=o.current),o.current=o.model.collection.at(o.model.collection.indexOf(s)+1),_.isUndefined(o.current))return o.options.parent.parent.trigger("theme:end"),o.current=s;r.model=o.current,r.render(),this.setNavButtonsState(),e(".next-theme").focus()}).listenTo(r,"theme:previous",function(){this.trigger("theme:previous"),s=o.model,0!==o.model.collection.indexOf(o.current)&&(_.isUndefined(o.current)||(s=o.current),o.current=o.model.collection.at(o.model.collection.indexOf(s)-1),_.isUndefined(o.current)||(r.model=o.current,r.render(),this.setNavButtonsState(),e(".previous-theme").focus()))}),this.listenTo(r,"preview:close",function(){o.current=o.model}))},setNavButtonsState:function(){var t=e(".theme-install-overlay"),i=_.isUndefined(this.current)?this.model:this.current;0===this.model.collection.indexOf(i)&&t.find(".previous-theme").addClass("disabled"),_.isUndefined(this.model.collection.at(this.model.collection.indexOf(i)+1))&&t.find(".next-theme").addClass("disabled")},containFocus:function(t){var i,s=window.event;void 0!==s&&1!==e(s.target).closest(".theme").length||_.delay(function(){e(".theme-wrap a.button-primary:visible").focus()},500),t.on("keydown.wp-themes",function(s){9===s.which&&((i=e(s.target)).is("button.close")&&s.shiftKey?(t.find(".theme-tags a:last-child").focus(),s.preventDefault()):i.is(".theme-tags a:last-child")&&(t.find("button.close").focus(),s.preventDefault()))})},collapse:function(t){var s,r,o,n,a,l=this,c={};1!==i.data.themes.length&&(t=t||window.event,(e(t.target).is(".close")||27===t.keyCode)&&(e("body").addClass("closing-overlay"),this.$el.fadeOut(1,function(){e("body").removeClass("closing-overlay"),l.closeOverlay(),s=document.body.scrollTop,(r=i.Collection.prototype.currentQuery.request.author)?(i.router.navigate(i.router.baseUrl("author/"+r)),i.utils.title(r)):(o=i.Collection.prototype.currentQuery.request.search)?(i.router.navigate(i.router.baseUrl(i.router.searchPath+o)),i.utils.title(o)):(n=i.view.Installer.prototype.filtersChecked())?(i.router.navigate(i.router.baseUrl("tags/"+n.join("+"))),i.utils.title(_.each(n,function(t,i){n[i]=e('label[for="filter-id-'+t+'"]').text()}).join(", "))):(a=e(".filter-links .current"))&&(a.length||(a=e('.filter-links [data-sort="featured"]'),c={trigger:!0}),i.router.navigate(i.router.baseUrl(i.router.browsePath+a.data("sort")),c),i.utils.title(a.text())),document.body.scrollTop=s,i.focusedTheme&&i.focusedTheme.focus()})))},renderDownloadsGraph:function(){var t=this;e.getJSON("https://api.wordpress.org/stats/themes/1.0/downloads.php?slug="+t.model.get("id")+"&limit=260&callback=?",function(i){google.charts.setOnLoadCallback(function(){var s=new google.visualization.DataTable,r=0;s.addColumn("string",_wpThemeSettings.l10n.date),s.addColumn("number",_wpThemeSettings.l10n.downloads),e.each(i,function(e,t){s.addRow(),s.setValue(r,0,new Date(e).toLocaleDateString()),s.setValue(r,1,Number(t)),r++}),new google.visualization.ColumnChart(document.getElementById("theme-download-stats-"+t.model.get("id"))).draw(s,{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:s.getNumberOfRows()>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(){e("body").removeClass("modal-open"),this.remove(),this.unbind(),this.trigger("theme:collapse")},nextTheme:function(){var e=this;return e.trigger("theme:next",e.model.cid),!1},previousTheme:function(){var e=this;return e.trigger("theme:previous",e.model.cid),!1},screenshotCheck:function(e){(new Image).src=e.find(".screenshot img").attr("src")}}),i.view.Preview=i.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:i.template("theme-preview"),render:function(){var t=this.model.toJSON();this.$el.html(this.html(t)),i.router.navigate(i.router.baseUrl(i.router.themePath+this.model.get("id"))),this.$el.fadeIn(200,function(){e("body").addClass("theme-installer-active full-overlay-active"),e(".close-full-overlay").focus()})},close:function(){return this.$el.fadeOut(200,function(){e("body").removeClass("theme-installer-active full-overlay-active"),i.focusedTheme&&i.focusedTheme.focus()}),this.trigger("preview:close"),this.undelegateEvents(),this.unbind(),i.router.navigate(i.router.baseUrl(i.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}}),i.view.Themes=wp.Backbone.View.extend({className:"themes",$overlay:e("div.theme-overlay"),index:0,count:e(".wp-filter .theme-count"),initialize:function(t){var i=this;this.parent=t.parent,this.setView("grid"),this.listenTo(i.collection,"themes:update",function(){i.parent.page=0,i.render(this)}),this.listenTo(i.collection,"query:success",function(e){_.isNumber(e)?i.count.text(e.toLocaleString()):i.count.text(i.collection.length.toLocaleString())}),this.listenTo(i.collection,"query:empty",function(){e("body").addClass("no-results")}),this.listenTo(this.parent,"theme:scroll",function(){i.renderThemes(i.parent.page)}),this.listenTo(this.parent,"theme:close",function(){i.overlay&&i.overlay.closeOverlay()}),e("body").on("keyup",function(e){i.overlay&&(39===e.keyCode&&i.overlay.nextTheme(),37===e.keyCode&&i.overlay.previousTheme(),27===e.keyCode&&i.overlay.collapse(e))})},render:function(){this.$el.empty(),1===i.data.themes.length&&(this.singleTheme=new i.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(t){var s=this;s.instance=s.collection.paginate(t),0!==s.instance.size()?(t>=1&&e(".add-new-theme").remove(),s.instance.each(function(e){s.theme=new i.view.Theme({model:e,parent:s}),s.theme.render(),s.$el.append(s.theme.el),s.listenTo(s.theme,"theme:expand",s.expand,s)}),this.parent.page++):this.parent.trigger("theme:end")},setView:function(e){return e},expand:function(t){var s=this;this.model=s.collection.get(t),_.isUndefined(this.model)||(i.router.navigate(i.router.baseUrl(i.router.themePath+this.model.id)),i.utils.title(this.model.attributes.name),this.setView("detail"),e("body").addClass("modal-open"),this.overlay=new i.view.Details({model:s.model}),this.overlay.render(),this.$overlay.html(this.overlay.el),this.listenTo(this.overlay,"theme:next",function(){s.next([s.model.cid]),e(".theme-header").find(".right").focus()}).listenTo(this.overlay,"theme:previous",function(){s.previous([s.model.cid]),e(".theme-header").find(".left").focus()}))},next:function(e){var t,i,s=this;t=s.collection.get(e[0]),void 0!==(i=s.collection.at(s.collection.indexOf(t)+1))&&s.theme.trigger("theme:expand",i.cid)},previous:function(e){var t,i,s=this;t=s.collection.get(e[0]),void 0!==(i=s.collection.at(s.collection.indexOf(t)-1))&&s.theme.trigger("theme:expand",i.cid)}}),i.view.Search=wp.Backbone.View.extend({tagName:"input",className:"wp-filter-search",id:"wp-filter-search-input",searching:!1,attributes:{placeholder:t.searchPlaceholder,type:"search"},events:{keyup:"search",search:"search"},initialize:function(e){this.parent=e.parent,this.listenTo(this.parent,"theme:close",function(){this.searching=!1})},search:function(e){("keyup"!==e.type||9!==e.which&&16!==e.which)&&(this.collection=this.options.parent.view.collection,"keyup"===e.type&&27===e.which&&(e.target.value=""),_.debounce(_.bind(this.doSearch,this),300)(e.target.value))},doSearch:_.debounce(function(t){var s={};i.view.Installer.prototype.clearFilters(jQuery.Event("click")),s.search=t,"author:"===t.substring(0,7)&&(s.search="",s.author=t.slice(7)),"tag:"===t.substring(0,4)&&(s.search="",s.tag=[t.slice(4)]),e(".filter-links li > a.current").removeClass("current"),e("body").removeClass("show-filters filters-applied"),t?(i.utils.title(t),i.router.navigate(i.router.baseUrl(i.router.searchPath+t),{replace:!0})):(delete s.search,s.browse="featured",i.utils.title(e('.filter-links [data-sort="featured"]').text()),i.router.navigate(i.router.baseUrl(i.router.browsePath+"featured"),{replace:!0})),this.collection.query(s)},300)}),i.view.Installer=i.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:e(".wp-filter .search-form"),initialize:function(){i.view.Appearance.prototype.initialize.apply(this,arguments),this.sortValues=e(".filter-links li > a").map(function(){return e(this).data("sort")}).get()},render:function(){var s=this;this.search(),this.collection=new i.Collection,this.listenTo(this,"theme:end",function(){s.collection.loadingThemes||e("body").hasClass("modal-open")||s.collection.length<i.data.settings.postsPerPage||(s.collection.loadingThemes=!0,s.collection.currentQuery.page++,_.extend(s.collection.currentQuery.request,{page:s.collection.currentQuery.page}),s.collection.query(s.collection.currentQuery.request))}),this.listenTo(this.collection,"query:success",function(){e("body").removeClass("loading-content"),e(".theme-browser").find("div.error").remove()}),this.listenTo(this.collection,"query:fail",function(){e("body").removeClass("loading-content"),e(".theme-browser").find("div.error").remove(),e(".theme-browser").find("div.themes").before('<div class="error"><p>'+t.error+"</p></div>")}),this.view&&this.view.remove(),this.view=new i.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(e){"favorites"==e?this.collection.query({browse:e,user:i.data.settings.favorites.user}):this.collection.query({browse:e})},onSort:function(t){var s=e(t.target),r=s.data("sort");t.preventDefault(),e("body").removeClass("filters-applied show-filters"),s.hasClass(this.activeClass)||(this.sort(r),i.router.navigate(i.router.baseUrl(i.router.browsePath+r)))},sort:function(t){var s,r=this;-1===_.indexOf(this.sortValues,t)&&(t="featured"),s=e('.filter-links [data-sort="'+t+'"]'),r.clearSearch(),_.each(e(".filter-group").find(":checkbox").filter(":checked"),function(t){return e(t).prop("checked",!1),r.filtersChecked()}),e(".filter-links li > a, .theme-filter").removeClass(this.activeClass),s.addClass(this.activeClass),i.utils.title(s.text()),this.browse(t)},onFilter:function(t){var i,s=e(t.target),r=s.data("filter");s.hasClass(this.activeClass)||(e(".filter-links li > a, .theme-section").removeClass(this.activeClass),s.addClass(this.activeClass),r&&(i={tag:[r=_.union([r,this.filtersChecked()])]},this.collection.query(i)))},addFilter:function(){this.filtersChecked()},applyFilters:function(t){var s,r=[],o=this.filtersChecked(),n={tag:o},a=e(".filtered-by .tags");t&&t.preventDefault(),o&&(e("body").addClass("filters-applied"),e(".filter-links li > a.current").removeClass("current"),a.empty(),_.each(o,function(t){s=e('label[for="filter-id-'+t+'"]').text(),r.push(s),a.append('<span class="tag">'+s+"</span>")}),i.router.navigate(i.router.baseUrl("tags/"+o.join("+"))),i.utils.title(r.join(", ")),this.collection.query(n))},filtersChecked:function(){var t=e(".filter-group").find(":checkbox").filter(":checked"),i=e(".filter-drawer"),s=[];return _.each(t,function(t){s.push(e(t).prop("value"))}),0===s.length?(i.find(".apply-filters").prop("disabled",!0).find("span").text(""),i.find(".clear-filters").hide(),e("body").removeClass("filters-applied"),!1):(i.find(".apply-filters").prop("disabled",!1).find("span").text(s.length),i.find(".clear-filters").css("display","inline-block"),s)},moreFilters:function(t){return t.preventDefault(),e("body").hasClass("filters-applied")?this.backToFilters():e("body").hasClass("show-filters")&&this.filtersChecked()?this.addFilter():(this.clearSearch(),void e("body").toggleClass("show-filters"))},clearFilters:function(t){var i=e(".filter-group").find(":checkbox"),s=this;t.preventDefault(),_.each(i.filter(":checked"),function(t){return e(t).prop("checked",!1),s.filtersChecked()})},backToFilters:function(t){t&&t.preventDefault(),e("body").removeClass("filters-applied")},clearSearch:function(){e("#wp-filter-search-input").val("")}}),i.Router=Backbone.Router.extend({routes:{"browse/:sort(/)":"sort","tags/:tag(/)":"tag","search/:query(/)":"search","author/:author(/)":"author",":slug(/)":"preview","":"sort"},baseUrl:function(e){return 0!==e.length&&(e+="/"),e},themePath:"",browsePath:"browse/",searchPath:"search/",search:function(t){e(".wp-filter-search").val(t)},navigate:function(){Backbone.history._hasPushState&&Backbone.Router.prototype.navigate.apply(this,arguments),"object"==typeof _gaq&&_gaq.push(["_trackPageview",i.data.settings.path+arguments[0]])}}),i.Run={init:function(){this.view=new i.view.Installer({section:"featured",SearchView:i.view.Search}),this.render()},render:function(){this.view.render(),this.routes(),Backbone.history.start({root:i.data.settings.path,pushState:!0,hashChange:!1})},routes:function(){var t=this,s={};i.router=new i.Router,i.router.on("route:preview",function(e){t.view.collection.queries.push(i.data.query),s.theme=e,t.view.collection.query(s),t.view.view.expand(e)}),i.router.on("route:sort",function(e){t.view.collection.queries.push(i.data.query),e||(e="featured"),t.view.sort(e),t.view.trigger("theme:close")}),i.router.on("route:search",function(){t.view.collection.queries.push(i.data.query),e(".wp-filter-search").focus().trigger("keyup"),t.view.trigger("theme:close")}),i.router.on("route:tag",function(s){t.view.collection.queries.push(i.data.query),_.each(s.split("+"),function(t){t=t.toLowerCase().replace(/[^a-z-]/g,""),e("#filter-id-"+t).prop("checked",!0)}),e("body").removeClass("show-filters").addClass("show-filters"),t.view.applyFilters(),t.view.trigger("theme:close")}),i.router.on("route:author",function(e){t.view.collection.queries.push(i.data.query),s.author=e,t.view.collection.query(s),i.utils.title(e),t.view.trigger("theme:close")})}},e(function(){i.Run.init()})}(jQuery),google.charts.load("current",{packages:["corechart"]});
+window.wp=window.wp||{},function(e){var t,i=wp.themes=wp.themes||{};i.data=_wpThemeSettings,t=i.data.l10n,_.extend(i,{model:{},view:{},routes:{},router:{},template:wp.template}),i.utils={title:function(t){document.title=e("<div/>").html(i.data.settings.title.replace("%s",e("<div/>").text(t).html())).text()}},i.Model=Backbone.Model.extend({initialize:function(){var e;this.set({id:this.get("slug")||this.get("id")}),this.has("sections")&&(e=this.get("sections").description,this.set({description:e}))}}),i.view.Appearance=wp.Backbone.View.extend({el:"#themes .theme-browser",window:e(window),page:0,initialize:function(e){_.bindAll(this,"scroller"),this.SearchView=e.SearchView?e.SearchView:i.view.Search,this.window.bind("scroll",_.throttle(this.scroller,300))},render:function(){this.view=new i.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 i;(i=new this.SearchView({collection:this.collection,parent:this})).render(),this.searchContainer.append(e.parseHTML('<label class="screen-reader-text" for="wp-filter-search-input">'+t.search+"</label>")).append(i.el)},scroller:function(){var e,t,i=this;e=this.window.scrollTop()+i.window.height(),t=i.$el.offset().top+i.$el.outerHeight(!1)-i.window.height(),e>(t=Math.round(.9*t))&&this.trigger("theme:scroll")}}),i.Collection=Backbone.Collection.extend({model:i.Model,terms:"",queries:[],currentQuery:{page:1,request:{}},count:!1,loadingThemes:!1,doSearch:function(e){this.terms!==e&&(this.terms=e,this.terms.length>0&&this.search(this.terms),""===this.terms&&this.reset(i.data.themes),this.trigger("themes:update"))},search:function(t){var s,r,o,n,a,l;this.reset(i.data.themes,{silent:!0}),t=(t=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")).replace(/ /g,")(?=.*"),s=new RegExp("^(?=.*"+t+").+","i"),0===(r=this.filter(function(e){return n=e.get("name").replace(/(<([^>]+)>)/gi,""),a=e.get("description").replace(/(<([^>]+)>)/gi,""),l=e.get("author").replace(/(<([^>]+)>)/gi,""),o=_.union([n,e.get("id"),a,l,e.get("tags")]),s.test(e.get("author"))&&t.length>2&&e.set("displayAuthor",!0),s.test(o)})).length?this.trigger("query:empty"):e("body").removeClass("no-results"),this.reset(r)},paginate:function(e){var t=this;return e=e||0,t=_(t.rest(i.data.settings.postsPerPage*e)),t=_(t.first(i.data.settings.postsPerPage))},query:function(t){var i,s,r,o=this.queries,n=this;if(this.currentQuery.request=t,i=_.find(o,function(e){return _.isEqual(e.request,t)}),(s=_.has(t,"page"))||(this.currentQuery.page=1),i||s){if(s)return this.apiCall(t,s).done(function(e){n.add(e.themes),n.trigger("query:success",e.info.results),n.loadingThemes=!1}).fail(function(){n.trigger("query:fail")});0===i.themes.length?n.trigger("query:empty"):e("body").removeClass("no-results"),_.isNumber(i.total)&&(this.count=i.total),this.reset(i.themes),i.total||(this.count=this.length),this.trigger("themes:update"),this.trigger("query:success",this.count)}else i=this.apiCall(t).done(function(e){e.themes&&(n.reset(e.themes),r=e.info.results,o.push({themes:e.themes,request:t,total:r})),n.trigger("themes:update"),n.trigger("query:success",r),e.themes&&0===e.themes.length&&n.trigger("query:empty")}).fail(function(){n.trigger("query:fail")})},apiCall:function(t,s){var r={type:"POST",url:"https://api.wordpress.org/themes/info/1.1/",jsonp:"callback",dataType:"jsonp",data:{action:"query_themes",request:_.extend({per_page:i.data.settings.postsPerPage,locale:i.data.settings.locale,fields:{description:!0,sections:!1,tested:!0,requires:!0,downloaded:!1,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,active_installs:!0}},t)},beforeSend:function(){s||e("body").addClass("loading-content").removeClass("no-results")}};return e.Deferred(function(t){e.ajax(r).done(function(e){t.resolveWith(this,[e])}).fail(function(){t.rejectWith(this,arguments)})}).promise()}}),i.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 e=this.model.toJSON();e.permalink=i.data.settings.path+i.router.baseUrl(e.slug),e.path=i.data.settings.path,this.$el.html(this.html(e)).attr({tabindex:0,"aria-describedby":e.id+"-action "+e.id+"-name"})},addFocus:function(){var t=e(":focus").hasClass("theme")?e(":focus"):e(":focus").parents(".theme");e(".theme.focus").removeClass("focus"),t.addClass("focus")},expand:function(t){if(!(!0===(t=t||window.event).metaKey|t.ctrlKey&&"click"===t.type||"keydown"===t.type&&13!==t.which&&32!==t.which))return!0===this.touchDrag?this.touchDrag=!1:void(e(t.target).is(".theme-actions a")||(i.focusedTheme=this.$el,this.trigger("theme:expand",this.model.cid),t.preventDefault()))},preventExpand:function(){this.touchDrag=!0}}),i.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:i.template("theme-single"),render:function(){var e=this.model.toJSON(),s=new Date;s.setUTCFullYear(e.last_updated.substring(0,4),e.last_updated.substring(5,7)-1,e.last_updated.substring(8,10)),e.last_updated=s.toLocaleDateString(t.locale,{day:"numeric",month:"long",year:"numeric"}),e.is_outdated=s.setYear(s.getYear()+1902).valueOf()<(new Date).valueOf(),e.tags=_.map(e.tags,function(e,s){return translated_tag=t.tags[s]||e,'<a href="'+i.data.settings.path+i.router.baseUrl("tags/"+s)+'">'+translated_tag+"</a>"}).join(", "),e.path=i.data.settings.path,e.active_installs<10?e.active_installs=t.active_installs_less_than_10:e.active_installs>=1e6?e.active_installs=t.active_installs_1_million:e.active_installs=e.active_installs.toLocaleString()+"+",e.show_favorites=!!i.data.settings.favorites.user,e.is_favorited=-1!=i.data.settings.favorites.themes.indexOf(e.slug),this.$el.html(this.html(e)),this.navigation(),this.screenshotCheck(this.$el),this.containFocus(this.$el),this.renderDownloadsGraph()},favourite_toggle:function(t){var s,r=this.$el.find(".favorite"),o=!r.hasClass("favorited"),n=this.model.get("slug");r.toggleClass("favorited"),o?i.data.settings.favorites.themes.push(n):(s=i.data.settings.favorites.themes.indexOf(n))>-1&&delete i.data.settings.favorites.themes[s];var a={type:"GET",url:"https://api.wordpress.org/themes/theme-directory/1.0/",jsonp:"callback",dataType:"jsonp",data:{action:o?"add-favorite":"remove-favorite",theme:this.model.get("slug"),_wpnonce:i.data.settings.favorites.nonce}};e.ajax(a).done(function(e){void 0!==e.error&&"not_logged_in"==e.error&&(i.data.settings.favorites.themes=[],i.data.settings.favorites.user="")})},preview:function(t){var s,r,o=this;if(!0===this.touchDrag)return this.touchDrag=!1;e(t.target).hasClass("button-primary")||"keydown"===t.type&&13!==t.which&&32!==t.which||"keydown"===t.type&&13!==t.which&&e(":focus").hasClass("button")||((t=t||window.event).preventDefault(),i.focusedTheme=this.$el,(r=new i.view.Preview({model:this.model})).render(),this.setNavButtonsState(),i.data.settings.isMobile?r.$el.addClass("wp-full-overlay collapsed"):r.$el.addClass("wp-full-overlay expanded"),e(".theme-install-overlay").append(r.el),this.listenTo(r,"theme:next",function(){if(this.trigger("theme:next"),s=o.model,_.isUndefined(o.current)||(s=o.current),o.current=o.model.collection.at(o.model.collection.indexOf(s)+1),_.isUndefined(o.current))return o.options.parent.parent.trigger("theme:end"),o.current=s;r.model=o.current,r.render(),this.setNavButtonsState(),e(".next-theme").focus()}).listenTo(r,"theme:previous",function(){this.trigger("theme:previous"),s=o.model,0!==o.model.collection.indexOf(o.current)&&(_.isUndefined(o.current)||(s=o.current),o.current=o.model.collection.at(o.model.collection.indexOf(s)-1),_.isUndefined(o.current)||(r.model=o.current,r.render(),this.setNavButtonsState(),e(".previous-theme").focus()))}),this.listenTo(r,"preview:close",function(){o.current=o.model}))},setNavButtonsState:function(){var t=e(".theme-install-overlay"),i=_.isUndefined(this.current)?this.model:this.current;0===this.model.collection.indexOf(i)&&t.find(".previous-theme").addClass("disabled"),_.isUndefined(this.model.collection.at(this.model.collection.indexOf(i)+1))&&t.find(".next-theme").addClass("disabled")},containFocus:function(t){var i,s=window.event;void 0!==s&&1!==e(s.target).closest(".theme").length||_.delay(function(){e(".theme-wrap a.button-primary:visible").focus()},500),t.on("keydown.wp-themes",function(s){9===s.which&&((i=e(s.target)).is("button.close")&&s.shiftKey?(t.find(".theme-tags a:last-child").focus(),s.preventDefault()):i.is(".theme-tags a:last-child")&&(t.find("button.close").focus(),s.preventDefault()))})},collapse:function(t){var s,r,o,n,a,l=this,c={};1!==i.data.themes.length&&(t=t||window.event,(e(t.target).is(".close")||27===t.keyCode)&&(e("body").addClass("closing-overlay"),this.$el.fadeOut(1,function(){e("body").removeClass("closing-overlay"),l.closeOverlay(),s=document.body.scrollTop,(r=i.Collection.prototype.currentQuery.request.author)?(i.router.navigate(i.router.baseUrl("author/"+r)),i.utils.title(r)):(o=i.Collection.prototype.currentQuery.request.search)?(i.router.navigate(i.router.baseUrl(i.router.searchPath+o)),i.utils.title(o)):(n=i.view.Installer.prototype.filtersChecked())?(i.router.navigate(i.router.baseUrl("tags/"+n.join("+"))),i.utils.title(_.each(n,function(t,i){n[i]=e('label[for="filter-id-'+t+'"]').text()}).join(", "))):(a=e(".filter-links .current"))&&(a.length||(a=e('.filter-links [data-sort="featured"]'),c={trigger:!0}),i.router.navigate(i.router.baseUrl(i.router.browsePath+a.data("sort")),c),i.utils.title(a.text())),document.body.scrollTop=s,i.focusedTheme&&i.focusedTheme.focus()})))},renderDownloadsGraph:function(){var t=this;e.getJSON("https://api.wordpress.org/stats/themes/1.0/downloads.php?slug="+t.model.get("id")+"&limit=260&callback=?",function(i){google.charts.setOnLoadCallback(function(){var s=new google.visualization.DataTable,r=0;s.addColumn("string",_wpThemeSettings.l10n.date),s.addColumn("number",_wpThemeSettings.l10n.downloads),e.each(i,function(e,t){s.addRow(),s.setValue(r,0,new Date(e).toLocaleDateString()),s.setValue(r,1,Number(t)),r++}),new google.visualization.ColumnChart(document.getElementById("theme-download-stats-"+t.model.get("id"))).draw(s,{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:s.getNumberOfRows()>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(){e("body").removeClass("modal-open"),this.remove(),this.unbind(),this.trigger("theme:collapse")},nextTheme:function(){return this.trigger("theme:next",this.model.cid),!1},previousTheme:function(){return this.trigger("theme:previous",this.model.cid),!1},screenshotCheck:function(e){(new Image).src=e.find(".screenshot img").attr("src")}}),i.view.Preview=i.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:i.template("theme-preview"),render:function(){var t=this.model.toJSON();this.$el.html(this.html(t)),i.router.navigate(i.router.baseUrl(i.router.themePath+this.model.get("id"))),this.$el.fadeIn(200,function(){e("body").addClass("theme-installer-active full-overlay-active"),e(".close-full-overlay").focus()})},close:function(){return this.$el.fadeOut(200,function(){e("body").removeClass("theme-installer-active full-overlay-active"),i.focusedTheme&&i.focusedTheme.focus()}),this.trigger("preview:close"),this.undelegateEvents(),this.unbind(),i.router.navigate(i.router.baseUrl(i.router.themePath+this.model.get("id"))),!1},collapse:function(){return this.$el.removeClass("collapsed expanded"),!1},keyEvent:function(){return 27===event.keyCode&&(this.undelegateEvents(),this.close()),39===event.keyCode&&_.once(this.nextTheme()),37===event.keyCode&&this.previousTheme(),!1}}),i.view.Themes=wp.Backbone.View.extend({className:"themes",$overlay:e("div.theme-overlay"),index:0,count:e(".wp-filter .theme-count"),initialize:function(t){var i=this;this.parent=t.parent,this.setView("grid"),this.listenTo(i.collection,"themes:update",function(){i.parent.page=0,i.render(this)}),this.listenTo(i.collection,"query:success",function(e){_.isNumber(e)?i.count.text(e.toLocaleString()):i.count.text(i.collection.length.toLocaleString())}),this.listenTo(i.collection,"query:empty",function(){e("body").addClass("no-results")}),this.listenTo(this.parent,"theme:scroll",function(){i.renderThemes(i.parent.page)}),this.listenTo(this.parent,"theme:close",function(){i.overlay&&i.overlay.closeOverlay()}),e("body").on("keyup",function(e){i.overlay&&(39===e.keyCode&&i.overlay.nextTheme(),37===e.keyCode&&i.overlay.previousTheme(),27===e.keyCode&&i.overlay.collapse(e))})},render:function(){this.$el.empty(),1===i.data.themes.length&&(this.singleTheme=new i.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(t){var s=this;s.instance=s.collection.paginate(t),0!==s.instance.size()?(t>=1&&e(".add-new-theme").remove(),s.instance.each(function(e){s.theme=new i.view.Theme({model:e,parent:s}),s.theme.render(),s.$el.append(s.theme.el),s.listenTo(s.theme,"theme:expand",s.expand,s)}),this.parent.page++):this.parent.trigger("theme:end")},setView:function(e){return e},expand:function(t){var s=this;this.model=s.collection.get(t),_.isUndefined(this.model)||(i.router.navigate(i.router.baseUrl(i.router.themePath+this.model.id)),i.utils.title(this.model.attributes.name),this.setView("detail"),e("body").addClass("modal-open"),this.overlay=new i.view.Details({model:s.model}),this.overlay.render(),this.$overlay.html(this.overlay.el),this.listenTo(this.overlay,"theme:next",function(){s.next([s.model.cid]),e(".theme-header").find(".right").focus()}).listenTo(this.overlay,"theme:previous",function(){s.previous([s.model.cid]),e(".theme-header").find(".left").focus()}))},next:function(e){var t,i;t=this.collection.get(e[0]),void 0!==(i=this.collection.at(this.collection.indexOf(t)+1))&&this.theme.trigger("theme:expand",i.cid)},previous:function(e){var t,i;t=this.collection.get(e[0]),void 0!==(i=this.collection.at(this.collection.indexOf(t)-1))&&this.theme.trigger("theme:expand",i.cid)}}),i.view.Search=wp.Backbone.View.extend({tagName:"input",className:"wp-filter-search",id:"wp-filter-search-input",searching:!1,attributes:{placeholder:t.searchPlaceholder,type:"search"},events:{keyup:"search",search:"search"},initialize:function(e){this.parent=e.parent,this.listenTo(this.parent,"theme:close",function(){this.searching=!1})},search:function(e){("keyup"!==e.type||9!==e.which&&16!==e.which)&&(this.collection=this.options.parent.view.collection,"keyup"===e.type&&27===e.which&&(e.target.value=""),_.debounce(_.bind(this.doSearch,this),300)(e.target.value))},doSearch:_.debounce(function(t){var s={};i.view.Installer.prototype.clearFilters(jQuery.Event("click")),s.search=t,"author:"===t.substring(0,7)&&(s.search="",s.author=t.slice(7)),"tag:"===t.substring(0,4)&&(s.search="",s.tag=[t.slice(4)]),e(".filter-links li > a.current").removeClass("current"),e("body").removeClass("show-filters filters-applied"),t?(i.utils.title(t),i.router.navigate(i.router.baseUrl(i.router.searchPath+t),{replace:!0})):(delete s.search,s.browse="featured",i.utils.title(e('.filter-links [data-sort="featured"]').text()),i.router.navigate(i.router.baseUrl(i.router.browsePath+"featured"),{replace:!0})),this.collection.query(s)},300)}),i.view.Installer=i.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:e(".wp-filter .search-form"),initialize:function(){i.view.Appearance.prototype.initialize.apply(this,arguments),this.sortValues=e(".filter-links li > a").map(function(){return e(this).data("sort")}).get()},render:function(){var s=this;this.search(),this.collection=new i.Collection,this.listenTo(this,"theme:end",function(){s.collection.loadingThemes||e("body").hasClass("modal-open")||s.collection.length<i.data.settings.postsPerPage||(s.collection.loadingThemes=!0,s.collection.currentQuery.page++,_.extend(s.collection.currentQuery.request,{page:s.collection.currentQuery.page}),s.collection.query(s.collection.currentQuery.request))}),this.listenTo(this.collection,"query:success",function(){e("body").removeClass("loading-content"),e(".theme-browser").find("div.error").remove()}),this.listenTo(this.collection,"query:fail",function(){e("body").removeClass("loading-content"),e(".theme-browser").find("div.error").remove(),e(".theme-browser").find("div.themes").before('<div class="error"><p>'+t.error+"</p></div>")}),this.view&&this.view.remove(),this.view=new i.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(e){"favorites"==e?this.collection.query({browse:e,user:i.data.settings.favorites.user}):this.collection.query({browse:e})},onSort:function(t){var s=e(t.target),r=s.data("sort");t.preventDefault(),e("body").removeClass("filters-applied show-filters"),s.hasClass(this.activeClass)||(this.sort(r),i.router.navigate(i.router.baseUrl(i.router.browsePath+r)))},sort:function(t){var s,r=this;-1===_.indexOf(this.sortValues,t)&&(t="featured"),s=e('.filter-links [data-sort="'+t+'"]'),r.clearSearch(),_.each(e(".filter-group").find(":checkbox").filter(":checked"),function(t){return e(t).prop("checked",!1),r.filtersChecked()}),e(".filter-links li > a, .theme-filter").removeClass(this.activeClass),s.addClass(this.activeClass),i.utils.title(s.text()),this.browse(t)},onFilter:function(t){var i,s=e(t.target),r=s.data("filter");s.hasClass(this.activeClass)||(e(".filter-links li > a, .theme-section").removeClass(this.activeClass),s.addClass(this.activeClass),r&&(i={tag:[r=_.union([r,this.filtersChecked()])]},this.collection.query(i)))},addFilter:function(){this.filtersChecked()},applyFilters:function(t){var s,r=[],o=this.filtersChecked(),n={tag:o},a=e(".filtered-by .tags");t&&t.preventDefault(),o&&(e("body").addClass("filters-applied"),e(".filter-links li > a.current").removeClass("current"),a.empty(),_.each(o,function(t){s=e('label[for="filter-id-'+t+'"]').text(),r.push(s),a.append('<span class="tag">'+s+"</span>")}),i.router.navigate(i.router.baseUrl("tags/"+o.join("+"))),i.utils.title(r.join(", ")),this.collection.query(n))},filtersChecked:function(){var t=e(".filter-group").find(":checkbox").filter(":checked"),i=e(".filter-drawer"),s=[];return _.each(t,function(t){s.push(e(t).prop("value"))}),0===s.length?(i.find(".apply-filters").prop("disabled",!0).find("span").text(""),i.find(".clear-filters").hide(),e("body").removeClass("filters-applied"),!1):(i.find(".apply-filters").prop("disabled",!1).find("span").text(s.length),i.find(".clear-filters").css("display","inline-block"),s)},moreFilters:function(t){return t.preventDefault(),e("body").hasClass("filters-applied")?this.backToFilters():e("body").hasClass("show-filters")&&this.filtersChecked()?this.addFilter():(this.clearSearch(),void e("body").toggleClass("show-filters"))},clearFilters:function(t){var i=e(".filter-group").find(":checkbox"),s=this;t.preventDefault(),_.each(i.filter(":checked"),function(t){return e(t).prop("checked",!1),s.filtersChecked()})},backToFilters:function(t){t&&t.preventDefault(),e("body").removeClass("filters-applied")},clearSearch:function(){e("#wp-filter-search-input").val("")}}),i.Router=Backbone.Router.extend({routes:{"browse/:sort(/)":"sort","tags/:tag(/)":"tag","search/:query(/)":"search","author/:author(/)":"author",":slug(/)":"preview","":"sort"},baseUrl:function(e){return 0!==e.length&&(e+="/"),e},themePath:"",browsePath:"browse/",searchPath:"search/",search:function(t){e(".wp-filter-search").val(t)},navigate:function(){Backbone.history._hasPushState&&Backbone.Router.prototype.navigate.apply(this,arguments),"object"==typeof _gaq&&_gaq.push(["_trackPageview",i.data.settings.path+arguments[0]])}}),i.Run={init:function(){this.view=new i.view.Installer({section:"featured",SearchView:i.view.Search}),this.render()},render:function(){this.view.render(),this.routes(),Backbone.history.start({root:i.data.settings.path,pushState:!0,hashChange:!1})},routes:function(){var t=this,s={};i.router=new i.Router,i.router.on("route:preview",function(e){t.view.collection.queries.push(i.data.query),s.theme=e,t.view.collection.query(s),t.view.view.expand(e)}),i.router.on("route:sort",function(e){t.view.collection.queries.push(i.data.query),e||(e="featured"),t.view.sort(e),t.view.trigger("theme:close")}),i.router.on("route:search",function(){t.view.collection.queries.push(i.data.query),e(".wp-filter-search").focus().trigger("keyup"),t.view.trigger("theme:close")}),i.router.on("route:tag",function(s){t.view.collection.queries.push(i.data.query),_.each(s.split("+"),function(t){t=t.toLowerCase().replace(/[^a-z-]/g,""),e("#filter-id-"+t).prop("checked",!0)}),e("body").removeClass("show-filters").addClass("show-filters"),t.view.applyFilters(),t.view.trigger("theme:close")}),i.router.on("route:author",function(e){t.view.collection.queries.push(i.data.query),s.author=e,t.view.collection.query(s),i.utils.title(e),t.view.trigger("theme:close")})}},e(function(){i.Run.init()})}(jQuery),google.charts.load("current",{packages:["corechart"]});
