1
lorchess.ru/assets/js/jquery.tablesorter.min.js

6 lines
27 KiB
JavaScript
Raw Normal View History

/*!
* TableSorter 2.15.10 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 t(a,b){d(a+" ("+((new Date).getTime()-b.getTime())+"ms)")}function l(a){for(var b in a)return!1;return!0}function n(a,b,c){if(!b)return"";var h=a.config,e=h.textExtraction,f="",f="simple"===e?h.supportsTextContent? b.textContent:g(b).text():"function"===typeof e?e(b,a,c):"object"===typeof e&&e.hasOwnProperty(c)?e[c](b,a,c):h.supportsTextContent?b.textContent:g(b).text();return g.trim(f)}function v(a){var b=a.config,c=b.$tbodies=b.$table.children("tbody:not(."+b.cssInfoBlock+")"),h,e,u,k,m,g,p,x="";if(0===c.length)return b.debug?d("Warning: *Empty table!* Not building a parser cache"):"";b.debug&&(p=new Date,d("Detecting parsers for each column"));c=c[0].rows;if(c[0])for(h=[],e=c[0].cells.length,u=0;u<e;u++){k= b.$headers.filter(":not([colspan])");k=k.add(b.$headers.filter('[colspan="1"]')).filter('[data-column="'+u+'"]:last');m=b.headers[u];g=f.getParserById(f.getData(k,m,"sorter"));b.empties[u]=f.getData(k,m,"empty")||b.emptyTo||(b.emptyToBottom?"bottom":"top");b.strings[u]=f.getData(k,m,"string")||b.stringTo||"max";if(!g)a:{k=a;m=c;g=-1;for(var l=u,r=void 0,s=f.parsers.length,F=!1,v="",r=!0;""===v&&r;)g++,m[g]?(F=m[g].cells[l],v=n(k,F,l),k.config.debug&&d("Checking if value was empty on row "+g+", column: "+ l+': "'+v+'"')):r=!1;for(;0<=--s;)if((r=f.parsers[s])&&"text"!==r.id&&r.is&&r.is(v,k,F)){g=r;break a}g=f.getParserById("text")}b.debug&&(x+="column:"+u+"; parser:"+g.id+"; string:"+b.strings[u]+"; empty: "+b.empties[u]+"\n");h.push(g)}b.debug&&(d(x),t("Completed detecting parsers",p));b.parsers=h}function y(a){var b,c,h,e,u,k,m,q,p,x,l,r=a.config,s=r.$table.children("tbody"),v=r.parsers;r.cache={};if(!v)return r.debug?d("Warning: *Empty table!* Not building a cache"):"";r.debug&&(q=new Date);r.showProcessing&& f.isProcessing(a,!0);for(u=0;u<s.length;u++)if(l=[],b=r.cache[u]={normalized:[]},!s.eq(u).hasClass(r.cssInfoBlock)){p=s[u]&&s[u].rows.length||0;for(h=0;h<p;++h)if(x={child:[]},k=g(s[u].rows[h]),m=[],k.hasClass(r.cssChildRow))c=b.normalized.length-1,b.normalized[c][r.columns].$row=b.normalized[c][r.columns].$row.add(k),x.child[c]=g.trim(k[0].textContent||k[0].innerText||k.text()||"");else{x.$row=k;x.order=h;for(e=0;e<r.columns;++e)c=n(a,k[0].cells[e],e),c=v[e].format(c,a,k[0].cells[e],e),m.push(c), "numeric"===(v[e].type||"").toLowerCase()&&(l[e]=Math.max(Math.abs(c)||0,l[e]||0));m.push(x);b.normalized.push(m)}b.colMax=l}r.showProcessing&&f.isProcessing(a);r.debug&&t("Building cache for "+p+" rows",q)}function z(a,b){var c=a.config,h=c.widgetOptions,e=a.tBodies,u=[],k=c.cache,d,q,p,x,n,r;if(l(k))return c.appender?c.appender(a,u):a.isUpdating?c.$table.trigger("updateComplete",a):"";c.debug&&(r=new Date);for(n=0;n<e.length;n++)if(d=g(e[n]),d.length&&!d.hasClass(c.cssInfoBlock)){p=f.processTbody(a, d,!0);d=k[n].normalized;q=d.length;for(x=0;x<q;x++)u.push(d[x][c.columns].$row),c.appender&&(!c.pager||c.pager.removeRows&&h.pager_removeRows||c.pager.ajax)||p.append(d[x][c.columns].$row);f.processTbody(a,p,!1)}c.appender&&c.appender(a,u);c.debug&&t("Rebuilt table",r);b||c.appender||f.applyWidget(a);a.isUpdating&&c.$table.trigger("updateComplete",a)}function C(a){var b=[],c={},h=0,e=g(a).find("thead:eq(0), tfoot").children("tr"),f,d,m,q,p,x,l,r,t,n;for(f=0;f<e.length;f++)for(p=e[f].cells,d=0;d<p.length;d++){q= p[d];x=q.parentNode.rowIndex;l=x+"-"+q.cellIndex;r=q.rowSpan||1;t=q.colSpan||1;"undefined"===typeof b[x]&&(b[x]=[]);for(m=0;m<b[x].length+1;m++)if("undefined"===typeof b[x][m]){n=m;break}c[l]=n;h=Math.max(n,h);g(q).attr({"data-column":n});for(m=x;m<x+r;m++)for("undefined"===typeof b[m]&&(b[m]=[]),l=b[m],q=n;q<n+t;q++)l[q]="x"}a.config.columns=h+1;return c}function B(a){return/^d/i.test(a)||1===a}function D(a){var b=C(a),c,h,e,u,k,m,q,p=a.config;p.headerList=[];p.headerContent=[];p.debug&&(q=new Date); u=p.cssIcon?'<i c