SortTbodies: remove already defined variables

This commit is contained in:
Mottie 2015-06-12 20:20:40 -05:00
parent 5608727c80
commit a79f3417ce
2 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1,5 @@
/*! tablesorter tbody sorting widget (BETA) - 6/10/2015 (core v2.22.2)
* Requires tablesorter v2.22.2+ and jQuery 1.4+
* by Rob Garrison
*/
!function(a){"use strict";var b=a.tablesorter;b.sortTbodies={init:function(c,d){var e,f,g,h,i,j=c.namespace+"sortTbody",k=c.$table.children("tbody"),l=k.length;for(d.sortTbody_original_serverSideSorting=c.serverSideSorting,d.sortTbody_original_cssInfoBlock=c.cssInfoBlock,c.cssInfoBlock=d.sortTbody_noSort,b.sortTbodies.setTbodies(c,d),e=0;l>e;e++)k.eq(e).attr("data-ts-original-order",e);for(c.$table.unbind("sortBegin updateComplete ".split(" ").join(j+" ")).bind("sortBegin"+j,function(){b.sortTbodies.sorter(c)}).bind("updateComplete"+j,function(){b.sortTbodies.setTbodies(c,d),c.$table.trigger("updateCache",[null,c.$tbodies])}),(a.isEmptyObject(c.parsers)||c.$tbodies.length!==k.length)&&(b.sortTbodies.setTbodies(c,d),c.$table.trigger("updateCache",[null,c.$tbodies])),i=k.children("tr"),l=i.length,e=0;e<c.columns;e++){if(h=0,"numeric"===c.parsers[e].type)for(f=0;l>f;f++)g=b.getParsedText(c,i.eq(f).children()[e],e),h=Math.max(Math.abs(g)||0,h);c.$headerIndexed[e].attr("data-ts-col-max-value",h)}},setTbodies:function(a,b){a.$tbodies=a.$table.children("tbody").not("."+b.sortTbody_noSort)},sorter:function(c){var d=c.$table,e=c.widgetOptions;if(e.sortTbody_busy!==!0){e.sortTbody_busy=!0;var f=d.children("tbody").not("."+e.sortTbody_noSort),g=e.sortTbody_primaryRow||"tr:eq(0)",h=c.sortList||[],i=h.length;i&&(c.serverSideSorting=!e.sortTbody_sortRows,f.sort(function(d,e){var f,j,k,l,m,n,o,p,q,r,s,t,u=c.table,v=c.parsers,w=c.textSorter||"",x=a(d),y=a(e),z=x.find(g).children("td, th"),A=y.find(g).children("td, th");for(f=0;i>f;f++){if(o=h[f][0],p=h[f][1],k=0===p,j=b.getElementText(c,z.eq(o),o),q=v[o].format(j,u,z[o],o),j=b.getElementText(c,A.eq(o),o),r=v[o].format(j,u,A[o],o),c.sortStable&&q===r&&1===i)return x.attr("data-ts-original-order")-y.attr("data-ts-original-order");if(l=/n/i.test(v&&v[o]?v[o].type||"":""),l&&c.strings[o]?(m=c.$headerIndexed[o].attr("data-ts-col-max-value")||1.79e308,l="boolean"==typeof c.string[c.strings[o]]?(k?1:-1)*(c.string[c.strings[o]]?-1:1):c.strings[o]?c.string[c.strings[o]]||0:0,n=c.numberSorter?c.numberSorter(q,r,k,m,u):b["sortNumeric"+(k?"Asc":"Desc")](q,r,l,m,o,u)):(s=k?q:r,t=k?r:q,n="function"==typeof w?w(s,t,k,o,u):"object"==typeof w&&w.hasOwnProperty(o)?w[o](s,t,k,o,u):b["sortNatural"+(k?"Asc":"Desc")](q,r,o,u,c)),n)return n}return x.attr("data-ts-original-order")-y.attr("data-ts-original-order")}),b.sortTbodies.restoreTbodies(c,e,f),e.sortTbody_busy=!1)}},restoreTbodies:function(a,b,c){var d,e,f,g,h,i,j,k,l,m=a.$table,i=!0,k=0;if(m.hide(),c.appendTo(m),e=m.children("tbody"),g=e.length,d=e.filter("."+b.sortTbody_noSort).appendTo(m),h=d.length)for(;i&&h>k;){for(i=!1,j=0;h>j;j++)l=parseInt(d.eq(j).attr("data-ts-original-order"),10),l=l>=g?g:0>l?0:l,l!==d.eq(j).index()&&(i=!0,f=d.eq(j).detach(),l>=g?f.appendTo(m):0===l?f.prependTo(m):f.insertBefore(m.children("tbody:eq("+l+")")));k++}m.show()}},b.addWidget({id:"sortTbody",priority:40,options:{sortTbody_primaryRow:null,sortTbody_sortRows:!1,sortTbody_noSort:"tablesorter-no-sort-tbody"},init:function(a,c,d,e){b.sortTbodies.init(d,e)},remove:function(a,b,c,d){b.$table.unbind("sortBegin updateComplete ".split(" ").join(b.namespace+"sortTbody ")),b.serverSideSorting=c.sortTbody_original_serverSideSorting,b.cssInfoBlock=c.sortTbody_original_cssInfoBlock}})}(jQuery);

View File

@ -153,7 +153,7 @@ ts.sortTbodies = {
},
restoreTbodies : function ( c, wo, $sortedTbodies ) {
var $nosort, $tbodies, $thisTbody, tbLen, nsLen, hasShuffled, index, indx, targetIndex,
var $nosort, $tbodies, $thisTbody, tbLen, nsLen, index, targetIndex,
$table = c.$table,
hasShuffled = true,
indx = 0;