6 lines
28 KiB
JavaScript
6 lines
28 KiB
JavaScript
|
/*!
|
||
|
* TableSorter 2.16.2 min - Client-side table sorting with ease!
|
||
|
* Copyright (c) 2007 Christian Bach
|
||
|
*/
|
||
|
!function(g){g.extend({tablesorter:new function(){function d(){var a=arguments[0],b=1<arguments.length?Array.prototype.slice.call(arguments):a;if("undefined"!==typeof console&&"undefined"!==typeof console.log)console[/error/i.test(a)?"error":/warn/i.test(a)?"warn":"log"](b);else alert(b)}function u(a,b){d(a+" ("+((new Date).getTime()-b.getTime())+"ms)")}function n(a){for(var b in a)return!1;return!0}function p(a,b,c){if(!b)return"";var h=a.config,e=h.textExtraction||"",f="",f="basic"===e?g(b).attr(h.textAttribute)|| b.textContent||b.innerText||g(b).text()||"":"function"===typeof e?e(b,a,c):"object"===typeof e&&e.hasOwnProperty(c)?e[c](b,a,c):b.textContent||b.innerText||g(b).text()||"";return g.trim(f)}function s(a){var b=a.config,c=b.$tbodies=b.$table.children("tbody:not(."+b.cssInfoBlock+")"),h,e,t,k,l,m,g,n,w=0,q="",r=c.length;if(0===r)return b.debug?d("Warning: *Empty table!* Not building a parser cache"):"";b.debug&&(n=new Date,d("Detecting parsers for each column"));for(e=[];w<r;){h=c[w].rows;if(h[w])for(t= h[w].cells.length,k=0;k<t;k++){l=b.$headers.filter(":not([colspan])");l=l.add(b.$headers.filter('[colspan="1"]')).filter('[data-column="'+k+'"]:last');m=b.headers[k];g=f.getParserById(f.getData(l,m,"sorter"));b.empties[k]=f.getData(l,m,"empty")||b.emptyTo||(b.emptyToBottom?"bottom":"top");b.strings[k]=f.getData(l,m,"string")||b.stringTo||"max";if(!g)a:{l=a;m=h;g=-1;for(var s=k,A=void 0,x=f.parsers.length,y=!1,F="",A=!0;""===F&&A;)g++,m[g]?(y=m[g].cells[s],F=p(l,y,s),l.config.debug&&d("Checking if value was empty on row "+ g+", column: "+s+': "'+F+'"')):A=!1;for(;0<=--x;)if((A=f.parsers[x])&&"text"!==A.id&&A.is&&A.is(F,l,y)){g=A;break a}g=f.getParserById("text")}b.debug&&(q+="column:"+k+"; parser:"+g.id+"; string:"+b.strings[k]+"; empty: "+b.empties[k]+"\n");e.push(g)}w+=e.length?r:1}b.debug&&(d(q?q:"No parsers detected"),u("Completed detecting parsers",n));b.parsers=e}function x(a){var b,c,h,e,t,k,l,m,z,n,w,q=a.config,r=q.$table.children("tbody"),s=q.parsers;q.cache={};if(!s)return q.debug?d("Warning: *Empty table!* Not building a cache"): "";q.debug&&(m=new Date);q.showProcessing&&f.isProcessing(a,!0);for(t=0;t<r.length;t++)if(w=[],b=q.cache[t]={normalized:[]},!r.eq(t).hasClass(q.cssInfoBlock)){z=r[t]&&r[t].rows.length||0;for(h=0;h<z;++h)if(n={child:[]},k=g(r[t].rows[h]),l=[],k.hasClass(q.cssChildRow)&&0!==h)c=b.normalized.length-1,b.normalized[c][q.columns].$row=b.normalized[c][q.columns].$row.add(k),k.prev().hasClass(q.cssChildRow)||k.prev().addClass(f.css.cssHasChild),n.child[c]=g.trim(k[0].textContent||k[0].innerText||k.text()|| "");else{n.$row=k;n.order=h;for(e=0;e<q.columns;++e)"undefined"===typeof s[e]?q.debug&&d("No parser found for cell:",k[0].cells[e],"does it have a header?"):(c=p(a,k[0].cells[e],e),c=s[e].format(c,a,k[0].cells[e],e),l.push(c),"numeric"===(s[e].type||"").toLowerCase()&&(w[e]=Math.max(Math.abs(c)||0,w[e]||0)));l[q.columns]=n;b.normalized.push(l)}b.colMax=w}q.showProcessing&&f.isProcessing(a);q.debug&&u("Building cache for "+z+" rows",m)}function y(a,b){var c=a.config,h=c.widgetOptions,e=a.tBodies,t= [],k=c.cache,d,m,z,p,w,q;if(n(k))return c.appender?c.appender(a,t):a.isUpdating?c.$table.trigger("updateComplete",a):"";c.debug&&(q=new Date);for(w=0;w<e.length;w++)if(d=g(e[w]),d.length&&!d.hasClass(c.cssInfoBlock)){z=f.processTbody(a,d,!0);d=k[w].normalized;m=d.length;for(p=0;p<m;p++)t.push(d[p][c.columns].$row),c.appender&&(!c.pager||c.pager.removeRows&&h.pager_removeRows||c.pager.ajax)||z.append(d[p][c.columns].$row);f.processTbody(a,z,!1)}c.appender&&c.appender(a,t);c.debug&&u("Rebuilt table", q);b||c.appender||f.applyWidget(a);a.isUpdating&&c.$table.trigger("updateComplete",a)}function C(a){return/^d/i.test(a)||1===a}function D(a){var b,c,h,e,t,k,l,m=a.config;m.headerList=[];m.headerContent=[];m.debug&&(l=new Date);m.columns=f.computeColumnIndex(m.$table.children("thead, tfoot").children("tr"));e=m.cssIcon?'<i class="'+(m.cssIcon===f.css.icon?f.css.icon:m.cssIcon+" "+f.css.icon)+'"></i>':"";m.$headers=g(a).find(m.selectorHeaders).each(function(a){c=g(this);b=m.headers[a];m.headerCont
|