tablesorter/js/jquery.tablesorter.min.js
2013-10-11 14:33:31 -05:00

6 lines
24 KiB
JavaScript

/*!
* TableSorter 2.11.0 min - Client-side table sorting with ease!
* Copyright (c) 2007 Christian Bach
*/
!(function(h){h.extend({tablesorter:new function(){function c(a){"undefined"!==typeof console&&"undefined"!==typeof console.log?console.log(a):alert(a)}function n(a,b){c(a+" ("+((new Date).getTime()-b.getTime())+"ms)")}function m(a){for(var b in a)return!1;return!0}function p(a,b,d){if(!b)return"";var e=a.config,f=e.textExtraction,g="",g="simple"===f?e.supportsTextContent?b.textContent:h(b).text():"function"===typeof f?f(b,a,d):"object"===typeof f&&f.hasOwnProperty(d)?f[d](b,a,d):e.supportsTextContent? b.textContent:h(b).text();return h.trim(g)}function r(a){var b=a.config,d=b.$tbodies=b.$table.children("tbody:not(."+b.cssInfoBlock+")"),e,w,g,l,q,h,k="";if(0===d.length)return b.debug?c("*Empty table!* Not building a parser cache"):"";d=d[0].rows;if(d[0])for(e=[],w=d[0].cells.length,g=0;g<w;g++){l=b.$headers.filter(":not([colspan])");l=l.add(b.$headers.filter('[colspan="1"]')).filter('[data-column="'+g+'"]:last');q=b.headers[g];h=f.getParserById(f.getData(l,q,"sorter"));b.empties[g]=f.getData(l, q,"empty")||b.emptyTo||(b.emptyToBottom?"bottom":"top");b.strings[g]=f.getData(l,q,"string")||b.stringTo||"max";if(!h)a:{l=a;q=d;h=-1;for(var x=g,n=void 0,m=f.parsers.length,v=!1,C="",n=!0;""===C&&n;)h++,q[h]?(v=q[h].cells[x],C=p(l,v,x),l.config.debug&&c("Checking if value was empty on row "+h+", column: "+x+': "'+C+'"')):n=!1;for(;0<=--m;)if((n=f.parsers[m])&&"text"!==n.id&&n.is&&n.is(C,l,v)){h=n;break a}h=f.getParserById("text")}b.debug&&(k+="column:"+g+"; parser:"+h.id+"; string:"+b.strings[g]+ "; empty: "+b.empties[g]+"\n");e.push(h)}b.debug&&c(k);b.parsers=e}function u(a){var b=a.tBodies,d=a.config,e,w,g=d.parsers,l,q,s,k,x,m,z,v=[];d.cache={};if(!g)return d.debug?c("*Empty table!* Not building a cache"):"";d.debug&&(z=new Date);d.showProcessing&&f.isProcessing(a,!0);for(k=0;k<b.length;k++)if(d.cache[k]={row:[],normalized:[]},!h(b[k]).hasClass(d.cssInfoBlock)){e=b[k]&&b[k].rows.length||0;w=b[k].rows[0]&&b[k].rows[0].cells.length||0;for(q=0;q<e;++q)if(x=h(b[k].rows[q]),m=[],x.hasClass(d.cssChildRow))d.cache[k].row[d.cache[k].row.length- 1]=d.cache[k].row[d.cache[k].row.length-1].add(x);else{d.cache[k].row.push(x);for(s=0;s<w;++s)l=p(a,x[0].cells[s],s),l=g[s].format(l,a,x[0].cells[s],s),m.push(l),"numeric"===(g[s].type||"").toLowerCase()&&(v[s]=Math.max(Math.abs(l)||0,v[s]||0));m.push(d.cache[k].normalized.length);d.cache[k].normalized.push(m)}d.cache[k].colMax=v}d.showProcessing&&f.isProcessing(a);d.debug&&n("Building cache for "+e+" rows",z)}function y(a,b){var d=a.config,e=a.tBodies,c=[],g=d.cache,l,q,s,k,x,p,z,v,t,r,u;if(!m(g)){d.debug&& (u=new Date);for(v=0;v<e.length;v++)if(l=h(e[v]),l.length&&!l.hasClass(d.cssInfoBlock)){x=f.processTbody(a,l,!0);l=g[v].row;q=g[v].normalized;k=(s=q.length)?q[0].length-1:0;for(p=0;p<s;p++)if(r=q[p][k],c.push(l[r]),!d.appender||!d.removeRows)for(t=l[r].length,z=0;z<t;z++)x.append(l[r][z]);f.processTbody(a,x,!1)}d.appender&&d.appender(a,c);d.debug&&n("Rebuilt table",u);b||f.applyWidget(a);h(a).trigger("sortEnd",a);h(a).trigger("updateComplete",a)}}function D(a){var b=[],d={},e=0,f=h(a).find("thead:eq(0), tfoot").children("tr"), g,l,c,s,k,n,m,p,t,r;for(g=0;g<f.length;g++)for(k=f[g].cells,l=0;l<k.length;l++){s=k[l];n=s.parentNode.rowIndex;m=n+"-"+s.cellIndex;p=s.rowSpan||1;t=s.colSpan||1;"undefined"===typeof b[n]&&(b[n]=[]);for(c=0;c<b[n].length+1;c++)if("undefined"===typeof b[n][c]){r=c;break}d[m]=r;e=Math.max(r,e);h(s).attr({"data-column":r});for(c=n;c<n+p;c++)for("undefined"===typeof b[c]&&(b[c]=[]),m=b[c],s=r;s<r+t;s++)m[s]="x"}a.config.columns=e;return d}function A(a){var b=D(a),d,e,w,g,l,q,s,k=a.config;k.headerList= [];k.headerContent=[];k.debug&&(s=new Date);g=k.cssIcon?'<i class="'+k.cssIcon+" "+f.css.icon+'"></i>':"";k.$headers=h(a).find(k.selectorHeaders).each(function(a){e=h(this);d=k.headers[a];k.headerContent[a]=this.innerHTML;l=k.headerTemplate.replace(/\{content\}/g,this.innerHTML).replace(/\{icon\}/g,g);k.onRenderTemplate&&(w=k.onRenderTemplate.apply(e,[a,l]))&&"string"===typeof w&&(l=w);this.innerHTML='<div class="tablesorter-header-inner">'+l+"</div>";k.onRenderHeader&&k.onRenderHeader.apply(e,[a]); this.column=b[this.parentNode.rowIndex+"-"+this.cellIndex];var c=f.getData(e,d,"sortInitialOrder")||k.sortInitialOrder;this.order=/^d/i.test(c)||1===c?[1,0,2]:[0,1,2];this.count=-1;this.lockedOrder=!1;q=f.getData(e,d,"lockedOrder")||!1;"undefined"!==typeof q&&!1!==q&&(this.order=this.lockedOrder=/^d/i.test(q)||1===q?[1,1,1]:[0,0,0]);e.addClass(f.css.header+" "+k.cssHeader);k.headerList[a]=this;e.parent().addClass(f.css.headerRow+" "+k.cssHeaderRow);e.attr("tabindex",0)});B(a);k.debug&&(n("Built headers:", s),c(k.$headers))}function E(a,b,d){var e=a.config;e.$table.find(e.selectorRemove).remove();r(a);u(a);F(e.$table,b,d)}function B(a){var b,d=a.config;d.$headers.each(function(a,c){b="false"===f.getData(c,d.headers[a],"sorter");c.sortDisabled=b;h(c)[b?"addClass":"removeClass"]("sorter-false")})}function G(a){var b,d,e,c=a.config,g=c.sortList,l=[f.css.sortAsc+" "+c.cssAsc,f.css.sortDesc+" "+c.cssDesc],q=h(a).find("tfoot tr").children().removeClass(l.join(" "));c.$headers.removeClass(l.join(" "));e=g.length; for(b=0;b<e;b++)if(2!==g[b][1]&&(a=c.$headers.not(".sorter-false").filter('[data-column="'+g[b][0]+'"]'+(1===e?":last":"")),a.length))for(d=0;d<a.length;d++)a[d].sortDisabled||(a.eq(d).addClass(l[g[b][1]]),q.length&&q.filter('[data-column="'+g[b][0]+'"]').eq(d).addClass(l[g[b][1]]))}function K(a){if(a.config.widthFixed&&0===h(a).find("colgroup").length){var b=h("<colgroup>"),d=h(a).width();h(a.tBodies[0]).find("tr:first").children("td:visible").each(function(){b.append(h("<col>").css("width",parseInt(1E3* (h(this).width()/d),10)/10+"%"))});h(a).prepend(b)}}function L(a,b){var d,e,c,g=a.config,f=b||g.sortList;g.sortList=[];h.each(f,function(a,b){d=[parseInt(b[0],10),parseInt(b[1],10)];if(c=g.headerList[d[0]])g.sortList.push(d),e=h.inArray(d[1],c.order),c.count=0<=e?e:d[1]%(g.sortReset?3:2)})}function M(a,b,d){var e,c,g=a.config,l=!d[g.sortMultiSortKey],q=h(a);q.trigger("sortStart",a);b.count=d[g.sortResetKey]?2:(b.count+1)%(g.sortReset?3:2);g.sortRestart&&(c=b,g.$headers.each(function(){this===c||!l&& h(this).is("."+f.css.sortDesc+",."+f.css.sortAsc)||(this.count=-1)}));c=b.column;if(l){g.sortList=[];if(null!==g.sortForce)for(e=g.sortForce,d=0;d<e.length;d++)e[d][0]!==c&&g.sortList.push(e[d]);e=b.order[b.count];if(2>e&&(g.sortList.push([c,e]),1<b.colSpan))for(d=1;d<b.colSpan;d++)g.sortList.push([c+d,e])}else if(g.sortAppend&&1<g.sortList.length&&f.isValueInArray(g.sortAppend[0][0],g.sortList)&&g.sortList.pop(),f.isValueInArray(c,g.sortList))for(d=0;d<g.sortList.length;d++)b=g.sortList[d],e=g.headerList[b[0]], b[0]===c&&(b[1]=e.order[e.count],2===b[1]&&(g.sortList.splice(d,1),e.count=-1));else if(e=b.order[b.count],2>e&&(g.sortList.push([c,e]),1<b.colSpan))for(d=1;d<b.colSpan;d++)g.sortList.push([c+d,e]);if(null!==g.sortAppend)for(e=g.sortAppend,d=0;d<e.length;d++)e[d][0]!==c&&g.sortList.push(e[d]);q.trigger("sortBegin",a);setTimeout(function(){G(a);H(a);y(a)},1)}function H(a){var b=0,d=a.config,e=d.sortList,c=e.length,g=a.tBodies.length,f,q,s,k,p,r,t,v,u;if(!d.serverSideSorting&&!m(d.cache)){d.debug&& (f=new Date);for(s=0;s<g;s++)p=d.cache[s].colMax,u=(r=d.cache[s].normalized)&&r[0]?r[0].length-1:0,r.sort(function(g,f){for(q=0;q<c;q++){k=e[q][0];v=e[q][1];t=/n/i.test(d.parsers&&d.parsers[k]?d.parsers[k].type||"":"")?"Numeric":"Text";t+=0===v?"":"Desc";/Numeric/.test(t)&&d.strings[k]&&(b="boolean"===typeof d.string[d.strings[k]]?(0===v?1:-1)*(d.string[d.strings[k]]?-1:1):d.strings[k]?d.string[d.strings[k]]||0:0);var l=h.tablesorter["sort"+t](a,g[k],f[k],k,p[k],b);if(l)return l}return g[u]-f[u]}); d.debug&&n("Sorting on "+e.toString()+" and dir "+v+" time",f)}}function I(a,b){var d=a[0].config;d.pager&&!d.pager.ajax&&a.trigger("updateComplete");"function"===typeof b&&b(a[0])}function F(a,b,d){!1===b||a[0].isProcessing?I(a,d):a.trigger("sorton",[a[0].config.sortList,function(){I(a,d)}])}function J(a){var b=a.config,d=b.$table,e,c;b.$headers.find(b.selectorSort).add(b.$headers.filter(b.selectorSort)).unbind("mousedown.tablesorter mouseup.tablesorter sort.tablesorter keypress.tablesorter").bind("mousedown.tablesorter mouseup.tablesorter sort.tablesorter keypress.tablesorter", function(d,e){if(!(1!==(d.which||d.button)&&!/sort|keypress/.test(d.type)||"keypress"===d.type&&13!==d.which||"mouseup"===d.type&&!0!==e&&250<(new Date).getTime()-c)){if("mousedown"===d.type)return c=(new Date).getTime(),"INPUT"===d.target.tagName?"":!b.cancelSelection;b.delayInit&&m(b.cache)&&u(a);var f=(/TH|TD/.test(this.tagName)?h(this):h(this).parents("th, td").filter(":first"))[0];f.sortDisabled||M(a,f,d)}});b.cancelSelection&&b.$headers.attr("unselectable","on").bind("selectstart",!1).css({"user-select":"none", MozUserSelect:"none"});d.unbind("sortReset update updateRows updateCell updateAll addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave ".split(" ").join(".tablesorter ")).bind("sortReset.tablesorter",function(d){d.stopPropagation();b.sortList=[];G(a);H(a);y(a)}).bind("updateAll.tablesorter",function(b,d,e){b.stopPropagation();f.refreshWidgets(a,!0,!0);f.restoreHeaders(a);A(a);J(a);E(a,d,e)}).bind("update.tablesorter updateRows.tablesorter",function(b,d,e){b.stopPropagation(); B(a);E(a,d,e)}).bind("updateCell.tablesorter",function(e,c,f,w){e.stopPropagation();d.find(b.selectorRemove).remove();var k,n,m;k=d.find("tbody");e=k.index(h(c).parents("tbody").filter(":first"));var r=h(c).parents("tr").filter(":first");c=h(c)[0];k.length&&0<=e&&(n=k.eq(e).find("tr").index(r),m=c.cellIndex,k=b.cache[e].normalized[n].length-1,b.cache[e].row[a.config.cache[e].normalized[n][k]]=r,b.cache[e].normalized[n][m]=b.parsers[m].format(p(a,c,m),a,c,m),F(d,f,w))}).bind("addRows.tablesorter", function(c,f,h,n){c.stopPropagation();var k=f.filter("tr").length,w=[],m=f[0].cells.length,u=d.find("tbody").index(f.parents("tbody").filter(":first"));b.parsers||r(a);for(c=0;c<k;c++){for(e=0;e<m;e++)w[e]=b.parsers[e].format(p(a,f[c].cells[e],e),a,f[c].cells[e],e);w.push(b.cache[u].row.length);b.cache[u].row.push([f[c]]);b.cache[u].normalized.push(w);w=[]}F(d,h,n)}).bind("sorton.tablesorter",function(b,e,c,f){var k=a.config;b.stopPropagation();d.trigger("sortStart",this);L(a,e);G(a);k.delayInit&& m(k.cache)&&u(a);d.trigger("sortBegin",this);H(a);y(a,f);"function"===typeof c&&c(a)}).bind("appendCache.tablesorter",function(b,d,e){b.stopPropagation();y(a,e);"function"===typeof d&&d(a)}).bind("applyWidgetId.tablesorter",function(d,e){d.stopPropagation();f.getWidgetById(e).format(a,b,b.widgetOptions)}).bind("applyWidgets.tablesorter",function(b,d){b.stopPropagation();f.applyWidget(a,d)}).bind("refreshWidgets.tablesorter",function(b,d,e){b.stopPropagation();f.refreshWidgets(a,d,e)}).bind("destroy.tablesorter", function(b,d,e){b.stopPropagation();f.destroy(a,d,e)})}var f=this;f.version="2.11.1";f.parsers=[];f.widgets=[];f.defaults={theme:"default",widthFixed:!1,showProcessing:!1,headerTemplate:"{content}",onRenderTemplate:null,onRenderHeader:null,cancelSelection:!0,dateFormat:"mmddyyyy",sortMultiSortKey:"shiftKey",sortResetKey:"ctrlKey",usNumberFormat:!0,delayInit:!1,serverSideSorting:!1,headers:{},ignoreCase:!0,sortForce:null,sortList:[],sortAppend:null,sortInitialOrder:"asc",sortLocaleCompare:!1,sortReset:!1, sortRestart:!1,emptyTo:"bottom",stringTo:"max",textExtraction:"simple",textSorter:null,widgets:[],widgetOptions:{zebra:["even","odd"]},initWidgets:!0,initialized:null,tableClass:"",cssAsc:"",cssDesc:"",cssHeader:"",cssHeaderRow:"",cssProcessing:"",cssChildRow:"tablesorter-childRow",cssIcon:"tablesorter-icon",cssInfoBlock:"tablesorter-infoOnly",selectorHeaders:"> thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};f.css={table:"tablesorter", childRow:"tablesorter-childRow",header:"tablesorter-header",headerRow:"tablesorter-headerRow",icon:"tablesorter-icon",info:"tablesorter-infoOnly",processing:"tablesorter-processing",sortAsc:"tablesorter-headerAsc",sortDesc:"tablesorter-headerDesc"};f.log=c;f.benchmark=n;f.construct=function(a){return this.each(function(){var b=h.extend(!0,{},f.defaults,a);!this.hasInitialized&&f.buildTable&&"TABLE"!==this.tagName&&f.buildTable(this,b);f.setup(this,b)})};f.setup=function(a,b){if(!a||!a.tHead||0=== a.tBodies.length||!0===a.hasInitialized)return b.debug?c("stopping initialization! No table, thead, tbody or tablesorter has already been initialized"):"";var d="",e=h(a),w=h.metadata;a.hasInitialized=!1;a.isProcessing=!0;a.config=b;h.data(a,"tablesorter",b);b.debug&&h.data(a,"startoveralltimer",new Date);b.supportsTextContent="x"===h("<span>x</span>")[0].textContent;b.supportsDataObject=function(a){a[0]=parseInt(a[0],10);return 1<a[0]||1===a[0]&&4<=parseInt(a[1],10)}(h.fn.jquery.split("."));b.string= {max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:!0,bottom:!1};/tablesorter\-/.test(e.attr("class"))||(d=""!==b.theme?" tablesorter-"+b.theme:"");b.$table=e.addClass(f.css.table+" "+b.tableClass+d);b.$tbodies=e.children("tbody:not(."+b.cssInfoBlock+")");b.widgetInit={};A(a);K(a);r(a);b.delayInit||u(a);J(a);b.supportsDataObject&&"undefined"!==typeof e.data().sortlist?b.sortList=e.data().sortlist:w&&e.metadata()&&e.metadata().sortlist&&(b.sortList=e.metadata().sortlist);f.applyWidget(a,!0); 0<b.sortList.length?e.trigger("sorton",[b.sortList,{},!b.initWidgets]):b.initWidgets&&f.applyWidget(a);b.showProcessing&&e.unbind("sortBegin.tablesorter sortEnd.tablesorter").bind("sortBegin.tablesorter sortEnd.tablesorter",function(b){f.isProcessing(a,"sortBegin"===b.type)});a.hasInitialized=!0;a.isProcessing=!1;b.debug&&f.benchmark("Overall initialization time",h.data(a,"startoveralltimer"));e.trigger("tablesorter-initialized",a);"function"===typeof b.initialized&&b.initialized(a)};f.isProcessing= function(a,b,d){a=h(a);var e=a[0].config;a=d||a.find("."+f.css.header);b?(0<e.sortList.length&&(a=a.filter(function(){return this.sortDisabled?!1:f.isValueInArray(parseFloat(h(this).attr("data-column")),e.sortList)})),a.addClass(f.css.processing+" "+e.cssProcessing)):a.removeClass(f.css.processing+" "+e.cssProcessing)};f.processTbody=function(a,b,d){if(d)return a.isProcessing=!0,b.before('<span class="tablesorter-savemyplace"/>'),d=h.fn.detach?b.detach():b.remove();d=h(a).find("span.tablesorter-savemyplace"); b.insertAfter(d);d.remove();a.isProcessing=!1};f.clearTableBody=function(a){h(a)[0].config.$tbodies.empty()};f.restoreHeaders=function(a){var b=a.config;b.$table.find(b.selectorHeaders).each(function(a){h(this).find(".tablesorter-header-inner").length&&h(this).html(b.headerContent[a])})};f.destroy=function(a,b,d){a=h(a)[0];if(a.hasInitialized){f.refreshWidgets(a,!0,!0);var e=h(a),c=a.config,g=e.find("thead:first"),l=g.find("tr."+f.css.headerRow).removeClass(f.css.headerRow+" "+c.cssHeaderRow),n=e.find("tfoot:first > tr").children("th, td"); g.find("tr").not(l).remove();e.removeData("tablesorter").unbind("sortReset update updateAll updateRows updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress sortBegin sortEnd ".split(" ").join(".tablesorter "));c.$headers.add(n).removeClass([f.css.header,c.cssHeader,c.cssAsc,c.cssDesc,f.css.sortAsc,f.css.sortDesc].join(" ")).removeAttr("data-column");l.find(c.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter keypress.tablesorter"); f.restoreHeaders(a);!1!==b&&e.removeClass(f.css.table+" "+c.tableClass+" tablesorter-"+c.theme);a.hasInitialized=!1;"function"===typeof d&&d(a)}};f.regex={chunk:/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,hex:/^0x[0-9a-f]+$/i};f.sortText=function(a,b,d,e){if(b===d)return 0;var c=a.config,g=c.string[c.empties[e]||c.emptyTo],h=f.regex;if(""===b&&0!==g)return"boolean"===typeof g?g?-1:1:-g||-1;if(""===d&&0!==g)return"boolean"===typeof g?g?1:-1:g||1;if("function"===typeof c.textSorter)return c.textSorter(b, d,a,e);if(e=parseInt(d.match(h.hex),16)){a=parseInt(b.match(h.hex),16);if(a<e)return-1;if(a>e)return 1}b=b.replace(h.chunk,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");d=d.replace(h.chunk,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");c=Math.max(b.length,d.length);for(e=0;e<c;e++){h=isNaN(b[e])?b[e]||0:parseFloat(b[e])||0;a=isNaN(d[e])?d[e]||0:parseFloat(d[e])||0;if(isNaN(h)!==isNaN(a))return isNaN(h)?1:-1;typeof h!==typeof a&&(h+="",a+="");if(h<a)return-1;if(h>a)return 1}return 0}; f.sortTextDesc=function(a,b,d,e){if(b===d)return 0;var c=a.config,g=c.string[c.empties[e]||c.emptyTo];return""===b&&0!==g?"boolean"===typeof g?g?-1:1:g||1:""===d&&0!==g?"boolean"===typeof g?g?1:-1:-g||-1:"function"===typeof c.textSorter?c.textSorter(d,b,a,e):f.sortText(a,d,b)};f.getTextValue=function(a,b,d){if(b){var e=a?a.length:0,c=b+d;for(b=0;b<e;b++)c+=a.charCodeAt(b);return d*c}return 0};f.sortNumeric=function(a,b,d,c,h,g){if(b===d)return 0;a=a.config;c=a.string[a.empties[c]||a.emptyTo];if(""=== b&&0!==c)return"boolean"===typeof c?c?-1:1:-c||-1;if(""===d&&0!==c)return"boolean"===typeof c?c?1:-1:c||1;isNaN(b)&&(b=f.getTextValue(b,h,g));isNaN(d)&&(d=f.getTextValue(d,h,g));return b-d};f.sortNumericDesc=function(a,b,d,c,h,g){if(b===d)return 0;a=a.config;c=a.string[a.empties[c]||a.emptyTo];if(""===b&&0!==c)return"boolean"===typeof c?c?-1:1:c||1;if(""===d&&0!==c)return"boolean"===typeof c?c?1:-1:-c||-1;isNaN(b)&&(b=f.getTextValue(b,h,g));isNaN(d)&&(d=f.getTextValue(d,h,g));return d-b};f.characterEquivalents= {a:"\u00e1\u00e0\u00e2\u00e3\u00e4\u0105\u00e5",A:"\u00c1\u00c0\u00c2\u00c3\u00c4\u0104\u00c5",c:"\u00e7\u0107\u010d",C:"\u00c7\u0106\u010c",e:"\u00e9\u00e8\u00ea\u00eb\u011b\u0119",E:"\u00c9\u00c8\u00ca\u00cb\u011a\u0118",i:"\u00ed\u00ec\u0130\u00ee\u00ef\u0131",I:"\u00cd\u00cc\u0130\u00ce\u00cf",o:"\u00f3\u00f2\u00f4\u00f5\u00f6",O:"\u00d3\u00d2\u00d4\u00d5\u00d6",ss:"\u00df",SS:"\u1e9e",u:"\u00fa\u00f9\u00fb\u00fc\u016f",U:"\u00da\u00d9\u00db\u00dc\u016e"};f.replaceAccents=function(a){var b,d= "[",c=f.characterEquivalents;if(!f.characterRegex){f.characterRegexArray={};for(b in c)"string"===typeof b&&(d+=c[b],f.characterRegexArray[b]=RegExp("["+c[b]+"]","g"));f.characterRegex=RegExp(d+"]")}if(f.characterRegex.test(a))for(b in c)"string"===typeof b&&(a=a.replace(f.characterRegexArray[b],b));return a};f.isValueInArray=function(a,b){var d,c=b.length;for(d=0;d<c;d++)if(b[d][0]===a)return!0;return!1};f.addParser=function(a){var b,d=f.parsers.length,c=!0;for(b=0;b<d;b++)f.parsers[b].id.toLowerCase()=== a.id.toLowerCase()&&(c=!1);c&&f.parsers.push(a)};f.getParserById=function(a){var b,d=f.parsers.length;for(b=0;b<d;b++)if(f.parsers[b].id.toLowerCase()===a.toString().toLowerCase())return f.parsers[b];return!1};f.addWidget=function(a){f.widgets.push(a)};f.getWidgetById=function(a){var b,d,c=f.widgets.length;for(b=0;b<c;b++)if((d=f.widgets[b])&&d.hasOwnProperty("id")&&d.id.toLowerCase()===a.toLowerCase())return d};f.applyWidget=function(a,b){a=h(a)[0];var d=a.config,c=d.widgetOptions,m=[],g,l,q;d.debug&& (g=new Date);d.widgets.length&&(d.widgets=h.grep(d.widgets,function(a,b){return h.inArray(a,d.widgets)===b}),h.each(d.widgets||[],function(a,b){(q=f.getWidgetById(b))&&q.id&&(q.priority||(q.priority=10),m[a]=q)}),m.sort(function(a,b){return a.priority<b.priority?-1:a.priority===b.priority?0:1}),h.each(m,function(f,g){if(g){if(b||!d.widgetInit[g.id])g.hasOwnProperty("options")&&(c=a.config.widgetOptions=h.extend(!0,{},g.options,c),d.widgetInit[g.id]=!0),g.hasOwnProperty("init")&&g.init(a,g,d,c);!b&& g.hasOwnProperty("format")&&g.format(a,d,c,!1)}}));d.debug&&(l=d.widgets.length,n("Completed "+(!0===b?"initializing ":"applying ")+l+" widget"+(1!==l?"s":""),g))};f.refreshWidgets=function(a,b,d){a=h(a)[0];var e,n=a.config,g=n.widgets,l=f.widgets,m=l.length;for(e=0;e<m;e++)l[e]&&l[e].id&&(b||0>h.inArray(l[e].id,g))&&(n.debug&&c("Refeshing widgets: Removing "+l[e].id),l[e].hasOwnProperty("remove")&&(l[e].remove(a,n,n.widgetOptions),n.widgetInit[l[e].id]=!1));!0!==d&&f.applyWidget(a,b)};f.getData= function(a,b,d){var c="";a=h(a);var f,g;if(!a.length)return"";f=h.metadata?a.metadata():!1;g=" "+(a.attr("class")||"");"undefined"!==typeof a.data(d)||"undefined"!==typeof a.data(d.toLowerCase())?c+=a.data(d)||a.data(d.toLowerCase()):f&&"undefined"!==typeof f[d]?c+=f[d]:b&&"undefined"!==typeof b[d]?c+=b[d]:" "!==g&&g.match(" "+d+"-")&&(c=g.match(RegExp("\\s"+d+"-([\\w-]+)"))[1]||"");return h.trim(c)};f.formatFloat=function(a,b){if("string"!==typeof a||""===a)return a;var c;a=(b&&b.config?!1!==b.config.usNumberFormat: "undefined"!==typeof b?b:1)?a.replace(/,/g,""):a.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(a)&&(a=a.replace(/^\s*\(/,"-").replace(/\)/,""));c=parseFloat(a);return isNaN(c)?h.trim(a):c};f.isDigit=function(a){return isNaN(a)?/^[\-+(]?\d+[)]?$/.test(a.toString().replace(/[,.'"\s]/g,"")):!0}}});var p=h.tablesorter;h.fn.extend({tablesorter:p.construct});p.addParser({id:"text",is:function(){return!0},format:function(c,n){var m=n.config;c&&(c=h.trim(m.ignoreCase?c.toLocaleLowerCase(): c),c=m.sortLocaleCompare?p.replaceAccents(c):c);return c},type:"text"});p.addParser({id:"digit",is:function(c){return p.isDigit(c)},format:function(c,n){var m=p.formatFloat((c||"").replace(/[^\w,. \-()]/g,""),n);return c&&"number"===typeof m?m:c?h.trim(c&&n.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"});p.addParser({id:"currency",is:function(c){return/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/.test((c||"").replace(/[,. ]/g,""))},format:function(c, n){var m=p.formatFloat((c||"").replace(/[^\w,. \-()]/g,""),n);return c&&"number"===typeof m?m:c?h.trim(c&&n.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"});p.addParser({id:"ipAddress",is:function(c){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(c)},format:function(c,h){var m,t=c?c.split("."):"",r="",u=t.length;for(m=0;m<u;m++)r+=("00"+t[m]).slice(-3);return c?p.formatFloat(r,h):c},type:"numeric"});p.addParser({id:"url",is:function(c){return/^(https?|ftp|file):\/\//.test(c)}, format:function(c){return c?h.trim(c.replace(/(https?|ftp|file):\/\//,"")):c},type:"text"});p.addParser({id:"isoDate",is:function(c){return/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/.test(c)},format:function(c,h){return c?p.formatFloat(""!==c?(new Date(c.replace(/-/g,"/"))).getTime()||"":"",h):c},type:"numeric"});p.addParser({id:"percent",is:function(c){return/(\d\s*?%|%\s*?\d)/.test(c)&&15>c.length},format:function(c,h){return c?p.formatFloat(c.replace(/%/g,""),h):c},type:"numeric"});p.addParser({id:"usLongDate", is:function(c){return/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i.test(c)||/^\d{1,2}\s+[A-Z]{3,10}\s+\d{4}/i.test(c)},format:function(c,h){return c?p.formatFloat((new Date(c.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",h):c},type:"numeric"});p.addParser({id:"shortDate",is:function(c){return/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/.test((c||"").replace(/\s+/g," ").replace(/[\-.,]/g,"/"))},format:function(c,h,m,t){if(c){m=h.config; var r=m.headerList[t];t=r.dateFormat||p.getData(r,m.headers[t],"dateFormat")||m.dateFormat;c=c.replace(/\s+/g," ").replace(/[\-.,]/g,"/");"mmddyyyy"===t?c=c.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$1/$2"):"ddmmyyyy"===t?c=c.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$2/$1"):"yyyymmdd"===t&&(c=c.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,"$1/$2/$3"))}return c?p.formatFloat((new Date(c)).getTime()||"",h):c},type:"numeric"});p.addParser({id:"time",is:function(c){return/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i.test(c)}, format:function(c,h){return c?p.formatFloat((new Date("2000/01/01 "+c.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",h):c},type:"numeric"});p.addParser({id:"metadata",is:function(){return!1},format:function(c,n,m){c=n.config;c=c.parserMetadataName?c.parserMetadataName:"sortValue";return h(m).metadata()[c]},type:"numeric"});p.addWidget({id:"zebra",priority:90,format:function(c,n,m){var t,r,u,y,D,A,E=RegExp(n.cssChildRow,"i"),B=n.$tbodies;n.debug&&(D=new Date);for(c=0;c<B.length;c++)t=B.eq(c),A=t.children("tr").length, 1<A&&(u=0,t=t.children("tr:visible"),t.each(function(){r=h(this);E.test(this.className)||u++;y=0===u%2;r.removeClass(m.zebra[y?1:0]).addClass(m.zebra[y?0:1])}));n.debug&&p.benchmark("Applying Zebra widget",D)},remove:function(c,n,m){var p;n=n.$tbodies;var r=(m.zebra||["even","odd"]).join(" ");for(m=0;m<n.length;m++)p=h.tablesorter.processTbody(c,n.eq(m),!0),p.children().removeClass(r),h.tablesorter.processTbody(c,p,!1)}})})(jQuery);