Permalink
Browse files

fixed filtering bug

  • Loading branch information...
1 parent f123dbb commit cf02e698a4a2d0b6b13d673b1da5beb073ebefff @acconrad committed May 4, 2012
Showing with 5 additions and 5 deletions.
  1. +2 −2 dist/jquery.expander.js
  2. +2 −2 dist/jquery.expander.min.js
  3. +1 −1 src/jquery.expander.js
@@ -1,4 +1,4 @@
-/*! jQuery Expander - v0.2.5 - 2012-04-28
+/*! jQuery Expander - v0.2.5 - 2012-05-04
* https://github.com/acconrad/jquery-expander
* Copyright (c) 2012 Adam Conrad; Licensed MIT, GPL */
@@ -55,7 +55,7 @@
var $target = $(event.target)
, $list = $target.prev()
- , targetFilter = typeof $target.attr('name') === 'undefined' ? '' : '.' + $target.attr('name')
+ , targetFilter = $target.attr('name') === '' ? '' : '.' + $target.attr('name')
, listIsTable = $list.is('table')
, listRows = listIsTable ? $list.children('tbody').children(targetFilter).length : $list.children(targetFilter).length
, listVisibleRows = listIsTable ? (listRows - $list.children('tbody').children('.hidden').length) : (listRows - $list.children('.hidden').length)
@@ -1,4 +1,4 @@
-/*! jQuery Expander - v0.2.5 - 2012-04-28
+/*! jQuery Expander - v0.2.5 - 2012-05-04
* https://github.com/acconrad/jquery-expander
* Copyright (c) 2012 Adam Conrad; Licensed MIT, GPL */
-(function(a){"use strict",a.fn.expander=function(b){var c=a.extend({},a.fn.expander.options,b),d=c.filter===""?c.filter:"."+c.filter,e=10;return this.each(function(b){var f=a(this),g=f.next(),h=f.is("table"),i=h?f.children("tbody").children(d).length:f.children(d).length,j,k;e<i?(h?f.children("tbody").children(d+":gt("+(e-1)+")").addClass("hidden"):f.children(d+":gt("+(e-1)+")").addClass("hidden"),k=i-e,j=k<e?k:e,g.hasClass("expander-more")?g.html("Show "+j+" More").removeClass("hidden").attr("name",c.filter):f.after('<a href="#" name="'+c.filter+'" class="expander-more">Show '+j+" More</a>")):e>=i&&g.hasClass("expander-more")&&g.addClass("hidden")})},a.fn.expander.options={filter:""},a(document).on("click",".expander-more",function(b){b.preventDefault();var c=a(b.target),d=c.prev(),e=typeof c.attr("name")=="undefined"?"":"."+c.attr("name"),f=d.is("table"),g=f?d.children("tbody").children(e).length:d.children(e).length,h=f?g-d.children("tbody").children(".hidden").length:g-d.children(".hidden").length,i,j,k,l,m;h<g&&(j=10,m=g-h,l=m<j?m:j,i=f?d.children("tbody").children(e+":lt("+(h+l)+")").removeClass("hidden"):d.children(e+":lt("+(h+l)+")").removeClass("hidden"),k=i.length,k===g?c.remove():(m=g-k,l=m<j?m:j,c.html("Show "+l+" More")))})})(jQuery);
+(function(a){"use strict",a.fn.expander=function(b){var c=a.extend({},a.fn.expander.options,b),d=c.filter===""?c.filter:"."+c.filter,e=10;return this.each(function(b){var f=a(this),g=f.next(),h=f.is("table"),i=h?f.children("tbody").children(d).length:f.children(d).length,j,k;e<i?(h?f.children("tbody").children(d+":gt("+(e-1)+")").addClass("hidden"):f.children(d+":gt("+(e-1)+")").addClass("hidden"),k=i-e,j=k<e?k:e,g.hasClass("expander-more")?g.html("Show "+j+" More").removeClass("hidden").attr("name",c.filter):f.after('<a href="#" name="'+c.filter+'" class="expander-more">Show '+j+" More</a>")):e>=i&&g.hasClass("expander-more")&&g.addClass("hidden")})},a.fn.expander.options={filter:""},a(document).on("click",".expander-more",function(b){b.preventDefault();var c=a(b.target),d=c.prev(),e=c.attr("name")===""?"":"."+c.attr("name"),f=d.is("table"),g=f?d.children("tbody").children(e).length:d.children(e).length,h=f?g-d.children("tbody").children(".hidden").length:g-d.children(".hidden").length,i,j,k,l,m;h<g&&(j=10,m=g-h,l=m<j?m:j,i=f?d.children("tbody").children(e+":lt("+(h+l)+")").removeClass("hidden"):d.children(e+":lt("+(h+l)+")").removeClass("hidden"),k=i.length,k===g?c.remove():(m=g-k,l=m<j?m:j,c.html("Show "+l+" More")))})})(jQuery);
@@ -64,7 +64,7 @@
var $target = $(event.target)
, $list = $target.prev()
- , targetFilter = typeof $target.attr('name') === 'undefined' ? '' : '.' + $target.attr('name')
+ , targetFilter = $target.attr('name') === '' ? '' : '.' + $target.attr('name')
, listIsTable = $list.is('table')
, listRows = listIsTable ? $list.children('tbody').children(targetFilter).length : $list.children(targetFilter).length
, listVisibleRows = listIsTable ? (listRows - $list.children('tbody').children('.hidden').length) : (listRows - $list.children('.hidden').length)

0 comments on commit cf02e69

Please sign in to comment.