Make filter_count() a closure. See #14936

git-svn-id: http://svn.automattic.com/wordpress/trunk@16554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu 2010-11-23 20:20:44 +00:00
parent c891b0ebc7
commit b43ad21bc2
2 changed files with 11 additions and 15 deletions

View File

@ -3,19 +3,6 @@ var ThemeViewer;
(function($){
ThemeViewer = function( args ) {
function filter_count() {
var count = $( '#filter-box :checked' ).length;
var text = $( '#filter-click' ).text();
if ( text.indexOf( '(' ) != -1 )
text = text.substr( 0, text.indexOf( '(' ) );
if ( count == 0 )
$( '#filter-click' ).text( text );
else
$( '#filter-click' ).text( text + ' (' + count + ')' );
}
function init() {
$( '#filter-click, #mini-filter-click' ).unbind( 'click' ).click( function() {
$( '#filter-click' ).toggleClass( 'current' );
@ -25,7 +12,16 @@ var ThemeViewer;
});
$( '#filter-box :checkbox' ).unbind( 'click' ).click( function() {
filter_count();
var count = $( '#filter-box :checked' ).length,
text = $( '#filter-click' ).text();
if ( text.indexOf( '(' ) != -1 )
text = text.substr( 0, text.indexOf( '(' ) );
if ( count == 0 )
$( '#filter-click' ).text( text );
else
$( '#filter-click' ).text( text + ' (' + count + ')' );
});
$('#filter-box :submit').unbind( 'click' ).click(function() {

View File

@ -1 +1 @@
var ThemeViewer;(function(a){ThemeViewer=function(b){function d(){var f=a("#filter-box :checked").length;var g=a("#filter-click").text();if(g.indexOf("(")!=-1){g=g.substr(0,g.indexOf("("))}if(f==0){a("#filter-click").text(g)}else{a("#filter-click").text(g+" ("+f+")")}}function e(){a("#filter-click, #mini-filter-click").unbind("click").click(function(){a("#filter-click").toggleClass("current");a("#filter-box").slideToggle();a("#current-theme").slideToggle(300);return false});a("#filter-box :checkbox").unbind("click").click(function(){d()});a("#filter-box :submit").unbind("click").click(function(){var f=[];a("#filter-box :checked").each(function(){f.push(a(this).val())});listTable.update_rows({features:f},true,function(){a("#filter-click").toggleClass("current");a("#filter-box").slideToggle();a("#current-theme").slideToggle(300)});return false})}var c={init:e};return c}})(jQuery);jQuery(document).ready(function(a){theme_viewer=new ThemeViewer();theme_viewer.init()});
var ThemeViewer;(function(a){ThemeViewer=function(b){function d(){a("#filter-click, #mini-filter-click").unbind("click").click(function(){a("#filter-click").toggleClass("current");a("#filter-box").slideToggle();a("#current-theme").slideToggle(300);return false});a("#filter-box :checkbox").unbind("click").click(function(){var e=a("#filter-box :checked").length,f=a("#filter-click").text();if(f.indexOf("(")!=-1){f=f.substr(0,f.indexOf("("))}if(e==0){a("#filter-click").text(f)}else{a("#filter-click").text(f+" ("+e+")")}});a("#filter-box :submit").unbind("click").click(function(){var e=[];a("#filter-box :checked").each(function(){e.push(a(this).val())});listTable.update_rows({features:e},true,function(){a("#filter-click").toggleClass("current");a("#filter-box").slideToggle();a("#current-theme").slideToggle(300)});return false})}var c={init:d};return c}})(jQuery);jQuery(document).ready(function(a){theme_viewer=new ThemeViewer();theme_viewer.init()});