mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-11 13:43:37 +00:00
6 lines
30 KiB
JavaScript
6 lines
30 KiB
JavaScript
|
/*!
|
||
|
* TableSorter 2.17.7 min - Client-side table sorting with ease!
|
||
|
* Copyright (c) 2007 Christian Bach
|
||
|
*/
|
||
|
!function(h){h.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 q(a,b){d(a+" ("+((new Date).getTime()-b.getTime())+"ms)")}function n(a){for(var b in a)return!1;return!0}function r(a,b,c){if(!b)return"";var g,e=a.config,l=e.textExtraction||"",d="",d="basic"===l?h(b).attr(e.textAttribute)|| b.textContent||b.innerText||h(b).text()||"":"function"===typeof l?l(b,a,c):"function"===typeof(g=f.getColumnData(a,l,c))?g(b,a,c):b.textContent||b.innerText||h(b).text()||"";return h.trim(d)}function v(a){var b,c,g=a.config,e=g.$tbodies=g.$table.children("tbody:not(."+g.cssInfoBlock+")"),l,x,k,h,m,B,u,s,t,n=0,v="",w=e.length;if(0===w)return g.debug?d("Warning: *Empty table!* Not building a parser cache"):"";g.debug&&(t=new Date,d("Detecting parsers for each column"));b=[];for(c=[];n<w;){l=e[n].rows; if(l[n])for(x=g.columns,k=0;k<x;k++){h=g.$headers.filter('[data-column="'+k+'"]:last');m=f.getColumnData(a,g.headers,k);s=f.getParserById(f.getData(h,m,"extractor"));u=f.getParserById(f.getData(h,m,"sorter"));B="false"===f.getData(h,m,"parser");g.empties[k]=f.getData(h,m,"empty")||g.emptyTo||(g.emptyToBottom?"bottom":"top");g.strings[k]=f.getData(h,m,"string")||g.stringTo||"max";B&&(u=f.getParserById("no-parser"));s||(s=!1);if(!u)a:{h=a;m=l;B=-1;u=k;for(var A=void 0,K=f.parsers.length,H=!1,z="",A= !0;""===z&&A;)B++,m[B]?(H=m[B].cells[u],z=r(h,H,u),h.config.debug&&d("Checking if value was empty on row "+B+", column: "+u+': "'+z+'"')):A=!1;for(;0<=--K;)if((A=f.parsers[K])&&"text"!==A.id&&A.is&&A.is(z,h,H)){u=A;break a}u=f.getParserById("text")}g.debug&&(v+="column:"+k+"; extractor:"+s.id+"; parser:"+u.id+"; string:"+g.strings[k]+"; empty: "+g.empties[k]+"\n");c[k]=u;b[k]=s}n+=c.length?w:1}g.debug&&(d(v?v:"No parsers detected"),q("Completed detecting parsers",t));g.parsers=c;g.extractors=b}function w(a){var b, c,g,e,l,x,k,p,m,n,u,s=a.config,t=s.$table.children("tbody"),v=s.extractors,w=s.parsers;s.cache={};s.totalRows=0;if(!w)return s.debug?d("Warning: *Empty table!* Not building a cache"):"";s.debug&&(p=new Date);s.showProcessing&&f.isProcessing(a,!0);for(l=0;l<t.length;l++)if(u=[],b=s.cache[l]={normalized:[]},!t.eq(l).hasClass(s.cssInfoBlock)){m=t[l]&&t[l].rows.length||0;for(g=0;g<m;++g)if(n={child:[]},x=h(t[l].rows[g]),k=[],x.hasClass(s.cssChildRow)&&0!==g)c=b.normalized.length-1,b.normalized[c][s.columns].$row= b.normalized[c][s.columns].$row.add(x),x.prev().hasClass(s.cssChildRow)||x.prev().addClass(f.css.cssHasChild),n.child[c]=h.trim(x[0].textContent||x[0].innerText||x.text()||"");else{n.$row=x;n.order=g;for(e=0;e<s.columns;++e)"undefined"===typeof w[e]?s.debug&&d("No parser found for cell:",x[0].cells[e],"does it have a header?"):(c=r(a,x[0].cells[e],e),c="undefined"===typeof v[e].id?c:v[e].format(c,a,x[0].cells[e],e),c="no-parser"===w[e].id?"":w[e].format(c,a,x[0].cells[e],e),k.push(s.ignoreCase&&"string"=== typeof c?c.toLowerCase():c),"numeric"===(w[e].type||"").toLowerCase()&&(u[e]=Math.max(Math.abs(c)||0,u[e]||0)));k[s.columns]=n;b.normalized.push(k)}b.colMax=u;s.totalRows+=b.normalized.length}s.showProcessing&&f.isProcessing(a);s.debug&&q("Building cache for "+m+" rows",p)}function z(a,b){var c=a.config,g=c.widgetOptions,e=a.tBodies,l=[],d=c.cache,k,p,m,r,u,s;if(n(d))return c.appender?c.appender(a,l):a.isUpdating?c.$table.trigger("updateComplete",a):"";c.debug&&(s=new Date);for(u=0;u<e.length;u++)if(k= h(e[u]),k.length&&!k.hasClass(c.cssInfoBlock)){m=f.processTbody(a,k,!0);k=d[u].normalized;p=k.length;for(r=0;r<p;r++)l.push(k[r][c.columns].$row),c.appender&&(!c.pager||c.pager.removeRows&&g.pager_removeRows||c.pager.ajax)||m.append(k[r][c.columns].$row);f.processTbody(a,m,!1)}c.appender&&c.appender(a,l);c.debug&&q("Rebuilt table",s);b||c.appender||f.applyWidget(a);a.isUpdating&&c.$table.trigger("updateComplete",a)}function D(a){return/^d/i.test(a)||1===a}function E(a){var b,c,g,e,l,x,k,p=a.config; p.he
|