mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-11 12:08:51 +01:00
6 lines
27 KiB
JavaScript
6 lines
27 KiB
JavaScript
|
/*!
|
||
|
* TableSorter 2.15.14 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 v(a,b){d(a+" ("+((new Date).getTime()-b.getTime())+"ms)")}function m(a){for(var b in a)return!1;return!0}function n(a,b,c){if(!b)return"";var k=a.config,e=k.textExtraction,f="",f="simple"===e?k.supportsTextContent? b.textContent:g(b).text():"function"===typeof e?e(b,a,c):"object"===typeof e&&e.hasOwnProperty(c)?e[c](b,a,c):k.supportsTextContent?b.textContent:g(b).text();return g.trim(f)}function r(a){var b=a.config,c=b.$tbodies=b.$table.children("tbody:not(."+b.cssInfoBlock+")"),k,e,u,h,p,l,g,m="";if(0===c.length)return b.debug?d("Warning: *Empty table!* Not building a parser cache"):"";b.debug&&(g=new Date,d("Detecting parsers for each column"));c=c[0].rows;if(c[0])for(k=[],e=c[0].cells.length,u=0;u<e;u++){h= b.$headers.filter(":not([colspan])");h=h.add(b.$headers.filter('[colspan="1"]')).filter('[data-column="'+u+'"]:last');p=b.headers[u];l=f.getParserById(f.getData(h,p,"sorter"));b.empties[u]=f.getData(h,p,"empty")||b.emptyTo||(b.emptyToBottom?"bottom":"top");b.strings[u]=f.getData(h,p,"string")||b.stringTo||"max";if(!l)a:{h=a;p=c;l=-1;for(var A=u,y=void 0,x=f.parsers.length,s=!1,r="",y=!0;""===r&&y;)l++,p[l]?(s=p[l].cells[A],r=n(h,s,A),h.config.debug&&d("Checking if value was empty on row "+l+", column: "+ A+': "'+r+'"')):y=!1;for(;0<=--x;)if((y=f.parsers[x])&&"text"!==y.id&&y.is&&y.is(r,h,s)){l=y;break a}l=f.getParserById("text")}b.debug&&(m+="column:"+u+"; parser:"+l.id+"; string:"+b.strings[u]+"; empty: "+b.empties[u]+"\n");k.push(l)}b.debug&&(d(m),v("Completed detecting parsers",g));b.parsers=k}function w(a){var b=a.tBodies,c=a.config,k,e,u=c.parsers,h,p,l,q,m,A,y,x=[];c.cache={};if(!u)return c.debug?d("Warning: *Empty table!* Not building a cache"):"";c.debug&&(y=new Date);c.showProcessing&&f.isProcessing(a, !0);for(q=0;q<b.length;q++)if(c.cache[q]={row:[],normalized:[]},!g(b[q]).hasClass(c.cssInfoBlock)){k=b[q]&&b[q].rows.length||0;e=b[q].rows[0]&&b[q].rows[0].cells.length||0;for(p=0;p<k;++p)if(m=g(b[q].rows[p]),A=[],m.hasClass(c.cssChildRow)&&0!==p)c.cache[q].row[c.cache[q].row.length-1]=c.cache[q].row[c.cache[q].row.length-1].add(m),m.prev().hasClass(c.cssChildRow)||m.prev().addClass(f.css.cssHasChild);else{c.cache[q].row.push(m);for(l=0;l<e;++l)"undefined"===typeof u[l]?c.debug&&d("No parser found for cell:", m[0].cells[l],"does it have a header?"):(h=n(a,m[0].cells[l],l),h=u[l].format(h,a,m[0].cells[l],l),A.push(h),"numeric"===(u[l].type||"").toLowerCase()&&(x[l]=Math.max(Math.abs(h)||0,x[l]||0)));A.push(c.cache[q].normalized.length);c.cache[q].normalized.push(A)}c.cache[q].colMax=x}c.showProcessing&&f.isProcessing(a);c.debug&&v("Building cache for "+k+" rows",y)}function z(a,b){var c=a.config,k=c.widgetOptions,e=a.tBodies,u=[],h=c.cache,d,l,q,n,A,y,x,s,r,t,w;if(m(h))return c.appender?c.appender(a,u): a.isUpdating?c.$table.trigger("updateComplete",a):"";c.debug&&(w=new Date);for(s=0;s<e.length;s++)if(d=g(e[s]),d.length&&!d.hasClass(c.cssInfoBlock)){A=f.processTbody(a,d,!0);d=h[s].row;l=h[s].normalized;n=(q=l.length)?l[0].length-1:0;for(y=0;y<q;y++)if(t=l[y][n],u.push(d[t]),!c.appender||c.pager&&!(c.pager.removeRows&&k.pager_removeRows||c.pager.ajax))for(r=d[t].length,x=0;x<r;x++)A.append(d[t][x]);f.processTbody(a,A,!1)}c.appender&&c.appender(a,u);c.debug&&v("Rebuilt table",w);b||c.appender||f.applyWidget(a); a.isUpdating&&c.$table.trigger("updateComplete",a)}function D(a){var b=[],c=0,k=g(a).children("thead, tfoot").children("tr"),e,f,d,p,l,q,m,v,n,r;for(e=0;e<k.length;e++)for(l=k[e].cells,f=0;f<l.length;f++){p=l[f];q=p.parentNode.rowIndex;g(p).index();m=p.rowSpan||1;v=p.colSpan||1;"undefined"===typeof b[q]&&(b[q]=[]);for(d=0;d<b[q].length+1;d++)if("undefined"===typeof b[q][d]){n=d;break}c=Math.max(n,c);g(p).attr({"data-column":n});for(d=q;d<q+m;d++)for("undefined"===typeof b[d]&&(b[d]=[]),r=b[d],p=n;p< n+v;p++)r[
|