This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
lnapp/media/vendor/mottie-tablesorter/js/jquery.tablesorter.min.js
2013-05-16 11:24:07 +10:00

6 lines
23 KiB
JavaScript

/*!
* TableSorter 2.10.0 min - Client-side table sorting with ease!
* Copyright (c) 2007 Christian Bach
*/
!function(f){f.extend({tablesorter:new function(){function c(d){"undefined"!==typeof console&&"undefined"!==typeof console.log?console.log(d):alert(d)}function t(d,a){c(d+" ("+((new Date).getTime()-a.getTime())+"ms)")}function r(d,a,b){if(!a)return"";var e=d.config,c=e.textExtraction,l="",l="simple"===c?e.supportsTextContent?a.textContent:f(a).text():"function"===typeof c?c(a,d,b):"object"===typeof c&&c.hasOwnProperty(b)?c[b](a,d,b):e.supportsTextContent?a.textContent:f(a).text();return f.trim(l)} function j(d){var a=d.config,b=a.$tbodies=a.$table.children("tbody:not(."+a.cssInfoBlock+")"),e,u,l,p,k,n,h="";if(0===b.length)return a.debug?c("*Empty table!* Not building a parser cache"):"";b=b[0].rows;if(b[0]){e=[];u=b[0].cells.length;for(l=0;l<u;l++){p=a.$headers.filter(":not([colspan])");p=p.add(a.$headers.filter('[colspan="1"]')).filter('[data-column="'+l+'"]:last');k=a.headers[l];n=g.getParserById(g.getData(p,k,"sorter"));a.empties[l]=g.getData(p,k,"empty")||a.emptyTo||(a.emptyToBottom?"bottom": "top");a.strings[l]=g.getData(p,k,"string")||a.stringTo||"max";if(!n)a:{p=d;k=b;n=-1;for(var f=l,m=void 0,t=g.parsers.length,F=!1,C="",m=!0;""===C&&m;)n++,k[n]?(F=k[n].cells[f],C=r(p,F,f),p.config.debug&&c("Checking if value was empty on row "+n+", column: "+f+': "'+C+'"')):m=!1;for(;0<=--t;)if((m=g.parsers[t])&&"text"!==m.id&&m.is&&m.is(C,p,F)){n=m;break a}n=g.getParserById("text")}a.debug&&(h+="column:"+l+"; parser:"+n.id+"; string:"+a.strings[l]+"; empty: "+a.empties[l]+"\n");e.push(n)}}a.debug&& c(h);a.parsers=e}function s(d){var a=d.tBodies,b=d.config,e,u,l=b.parsers,p,k,n,h,q,m,G,j=[];b.cache={};if(!l)return b.debug?c("*Empty table!* Not building a cache"):"";b.debug&&(G=new Date);b.showProcessing&&g.isProcessing(d,!0);for(h=0;h<a.length;h++)if(b.cache[h]={row:[],normalized:[]},!f(a[h]).hasClass(b.cssInfoBlock)){e=a[h]&&a[h].rows.length||0;u=a[h].rows[0]&&a[h].rows[0].cells.length||0;for(k=0;k<e;++k)if(q=f(a[h].rows[k]),m=[],q.hasClass(b.cssChildRow))b.cache[h].row[b.cache[h].row.length- 1]=b.cache[h].row[b.cache[h].row.length-1].add(q);else{b.cache[h].row.push(q);for(n=0;n<u;++n)if(p=r(d,q[0].cells[n],n),p=l[n].format(p,d,q[0].cells[n],n),m.push(p),"numeric"===(l[n].type||"").toLowerCase())j[n]=Math.max(Math.abs(p)||0,j[n]||0);m.push(b.cache[h].normalized.length);b.cache[h].normalized.push(m)}b.cache[h].colMax=j}b.showProcessing&&g.isProcessing(d);b.debug&&t("Building cache for "+e+" rows",G)}function w(d,a){var b=d.config,e=d.tBodies,c=[],l=b.cache,p,k,n,h,q,m,r,j,C,s,w;if(l[0]){b.debug&& (w=new Date);for(j=0;j<e.length;j++)if(p=f(e[j]),p.length&&!p.hasClass(b.cssInfoBlock)){q=g.processTbody(d,p,!0);p=l[j].row;k=l[j].normalized;h=(n=k.length)?k[0].length-1:0;for(m=0;m<n;m++)if(s=k[m][h],c.push(p[s]),!b.appender||!b.removeRows){C=p[s].length;for(r=0;r<C;r++)q.append(p[s][r])}g.processTbody(d,q,!1)}b.appender&&b.appender(d,c);b.debug&&t("Rebuilt table",w);a||g.applyWidget(d);f(d).trigger("sortEnd",d)}}function z(d){var a=[],b={},e=0,u=f(d).find("thead:eq(0), tfoot").children("tr"),l, p,k,n,h,q,m,j,r,s;for(l=0;l<u.length;l++){h=u[l].cells;for(p=0;p<h.length;p++){n=h[p];q=n.parentNode.rowIndex;m=q+"-"+n.cellIndex;j=n.rowSpan||1;r=n.colSpan||1;"undefined"===typeof a[q]&&(a[q]=[]);for(k=0;k<a[q].length+1;k++)if("undefined"===typeof a[q][k]){s=k;break}b[m]=s;e=Math.max(s,e);f(n).attr({"data-column":s});for(k=q;k<q+j;k++){"undefined"===typeof a[k]&&(a[k]=[]);m=a[k];for(n=s;n<s+r;n++)m[n]="x"}}}d.config.columns=e;var w,v,z,B,A,y,D,x=d.config;x.headerList=[];x.headerContent=[];x.debug&& (D=new Date);B=x.cssIcon?'<i class="'+x.cssIcon+'"></i>':"";x.$headers=f(d).find(x.selectorHeaders).each(function(d){v=f(this);w=x.headers[d];x.headerContent[d]=this.innerHTML;A=x.headerTemplate.replace(/\{content\}/g,this.innerHTML).replace(/\{icon\}/g,B);x.onRenderTemplate&&(z=x.onRenderTemplate.apply(v,[d,A]))&&"string"===typeof z&&(A=z);this.innerHTML='<div class="tablesorter-header-inner">'+A+"</div>";x.onRenderHeader&&x.onRenderHeader.apply(v,[d]);this.column=b[this.parentNode.rowIndex+"-"+ this.cellIndex];var a=g.getData(v,w,"sortInitialOrder")||x.sortInitialOrder;this.order=/^d/i.test(a)||1===a?[1,0,2]:[0,1,2];this.count=-1;this.lockedOrder=!1;y=g.getData(v,w,"lockedOrder")||!1;"undefined"!==typeof y&&!1!==y&&(this.order=this.lockedOrder=/^d/i.test(y)||1===y?[1,1,1]:[0,0,0]);v.addClass(x.cssHeader);x.headerList[d]=this;v.parent().addClass(x.cssHeaderRow)});E(d);x.debug&&(t("Built headers:",D),c(x.$headers))}function A(d,a,b){var e=f(d);e.find(d.config.selectorRemove).remove();j(d); s(d);D(e,a,b)}function E(d){var a,b=d.config;b.$headers.each(function(d,c){a="false"===g.getData(c,b.headers[d],"sorter");c.sortDisabled=a;f(c)[a?"addClass":"removeClass"]("sorter-false")})}function y(d){var a,b,e,c=d.config,l=c.sortList,p=[c.cssAsc,c.cssDesc],k=f(d).find("tfoot tr").children().removeClass(p.join(" "));c.$headers.removeClass(p.join(" "));e=l.length;for(a=0;a<e;a++)if(2!==l[a][1]&&(d=c.$headers.not(".sorter-false").filter('[data-column="'+l[a][0]+'"]'+(1===e?":last":"")),d.length))for(b= 0;b<d.length;b++)d[b].sortDisabled||(d.eq(b).addClass(p[l[a][1]]),k.length&&k.filter('[data-column="'+l[a][0]+'"]').eq(b).addClass(p[l[a][1]]))}function B(d){var a=0,b=d.config,e=b.sortList,c=e.length,l=d.tBodies.length,p,k,g,h,q,m,j,r,s;if(!b.serverSideSorting&&b.cache[0]){b.debug&&(p=new Date);for(g=0;g<l;g++)q=b.cache[g].colMax,s=(m=b.cache[g].normalized)&&m[0]?m[0].length-1:0,m.sort(function(l,p){for(k=0;k<c;k++){h=e[k][0];r=e[k][1];j=/n/i.test(b.parsers&&b.parsers[h]?b.parsers[h].type||"":"")? "Numeric":"Text";j+=0===r?"":"Desc";/Numeric/.test(j)&&b.strings[h]&&(a="boolean"===typeof b.string[b.strings[h]]?(0===r?1:-1)*(b.string[b.strings[h]]?-1:1):b.strings[h]?b.string[b.strings[h]]||0:0);var g=f.tablesorter["sort"+j](d,l[h],p[h],h,q[h],a);if(g)return g}return l[s]-p[s]});b.debug&&t("Sorting on "+e.toString()+" and dir "+r+" time",p)}}function H(d,a){d.trigger("updateComplete");"function"===typeof a&&a(d[0])}function D(d,a,b){!1!==a&&!d[0].isProcessing?d.trigger("sorton",[d[0].config.sortList, function(){H(d,b)}]):H(d,b)}function I(d){var a=d.config,b=a.$table,e,c;a.$headers.find(a.selectorSort).add(a.$headers.filter(a.selectorSort)).unbind("mousedown.tablesorter mouseup.tablesorter sort.tablesorter").bind("mousedown.tablesorter mouseup.tablesorter sort.tablesorter",function(b,e){var k=(/TH|TD/.test(this.tagName)?f(this):f(this).parents("th, td").filter(":last"))[0];if(1!==(b.which||b.button)&&"sort"!==b.type)return!1;if("mousedown"===b.type)return c=(new Date).getTime(),"INPUT"===b.target.tagName? "":!a.cancelSelection;if(!0!==e&&250<(new Date).getTime()-c)return!1;a.delayInit&&!a.cache&&s(d);if(!k.sortDisabled){var n,h,q,m=d.config,j=!b[m.sortMultiSortKey],r=f(d);r.trigger("sortStart",d);k.count=b[m.sortResetKey]?2:(k.count+1)%(m.sortReset?3:2);m.sortRestart&&(h=k,m.$headers.each(function(){if(this!==h&&(j||!f(this).is("."+m.cssDesc+",."+m.cssAsc)))this.count=-1}));h=k.column;if(j){m.sortList=[];if(null!==m.sortForce){n=m.sortForce;for(q=0;q<n.length;q++)n[q][0]!==h&&m.sortList.push(n[q])}n= k.order[k.count];if(2>n&&(m.sortList.push([h,n]),1<k.colSpan))for(q=1;q<k.colSpan;q++)m.sortList.push([h+q,n])}else if(m.sortAppend&&1<m.sortList.length&&g.isValueInArray(m.sortAppend[0][0],m.sortList)&&m.sortList.pop(),g.isValueInArray(h,m.sortList))for(q=0;q<m.sortList.length;q++)k=m.sortList[q],n=m.headerList[k[0]],k[0]===h&&(k[1]=n.order[n.count],2===k[1]&&(m.sortList.splice(q,1),n.count=-1));else if(n=k.order[k.count],2>n&&(m.sortList.push([h,n]),1<k.colSpan))for(q=1;q<k.colSpan;q++)m.sortList.push([h+ q,n]);if(null!==m.sortAppend){n=m.sortAppend;for(q=0;q<n.length;q++)n[q][0]!==h&&m.sortList.push(n[q])}r.trigger("sortBegin",d);setTimeout(function(){y(d);B(d);w(d)},1)}});a.cancelSelection&&a.$headers.attr("unselectable","on").bind("selectstart",!1).css({"user-select":"none",MozUserSelect:"none"});b.unbind("sortReset update updateRows updateCell updateAll addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave ".split(" ").join(".tablesorter ")).bind("sortReset.tablesorter", function(b){b.stopPropagation();a.sortList=[];y(d);B(d);w(d)}).bind("updateAll.tablesorter",function(b,a,e){b.stopPropagation();g.restoreHeaders(d);z(d);I(d);A(d,a,e)}).bind("update.tablesorter updateRows.tablesorter",function(b,a,e){b.stopPropagation();E(d);A(d,a,e)}).bind("updateCell.tablesorter",function(e,c,g,n){e.stopPropagation();b.find(a.selectorRemove).remove();var h,q,m;h=b.find("tbody");e=h.index(f(c).parents("tbody").filter(":last"));var u=f(c).parents("tr").filter(":last");c=f(c)[0];h.length&& 0<=e&&(q=h.eq(e).find("tr").index(u),m=c.cellIndex,h=a.cache[e].normalized[q].length-1,a.cache[e].row[d.config.cache[e].normalized[q][h]]=u,a.cache[e].normalized[q][m]=a.parsers[m].format(r(d,c,m),d,c,m),D(b,g,n))}).bind("addRows.tablesorter",function(c,g,k,f){c.stopPropagation();var h=g.filter("tr").length,u=[],m=g[0].cells.length,t=b.find("tbody").index(g.closest("tbody"));a.parsers||j(d);for(c=0;c<h;c++){for(e=0;e<m;e++)u[e]=a.parsers[e].format(r(d,g[c].cells[e],e),d,g[c].cells[e],e);u.push(a.cache[t].row.length); a.cache[t].row.push([g[c]]);a.cache[t].normalized.push(u);u=[]}D(b,k,f)}).bind("sorton.tablesorter",function(a,e,c,g){a.stopPropagation();b.trigger("sortStart",this);var h,u,m,j=d.config;a=e||j.sortList;j.sortList=[];f.each(a,function(b,a){h=[parseInt(a[0],10),parseInt(a[1],10)];if(m=j.headerList[h[0]])j.sortList.push(h),u=f.inArray(h[1],m.order),m.count=0<=u?u:h[1]%(j.sortReset?3:2)});y(d);b.trigger("sortBegin",this);B(d);w(d,g);"function"===typeof c&&c(d)}).bind("appendCache.tablesorter",function(b, a,e){b.stopPropagation();w(d,e);"function"===typeof a&&a(d)}).bind("applyWidgetId.tablesorter",function(b,e){b.stopPropagation();g.getWidgetById(e).format(d,a,a.widgetOptions)}).bind("applyWidgets.tablesorter",function(b,a){b.stopPropagation();g.applyWidget(d,a)}).bind("refreshWidgets.tablesorter",function(b,a,e){b.stopPropagation();g.refreshWidgets(d,a,e)}).bind("destroy.tablesorter",function(b,a,e){b.stopPropagation();g.destroy(d,a,e)})}var g=this;g.version="2.10.0";g.parsers=[];g.widgets=[];g.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:"tablesorter",cssAsc:"tablesorter-headerAsc",cssChildRow:"tablesorter-childRow",cssDesc:"tablesorter-headerDesc",cssHeader:"tablesorter-header",cssHeaderRow:"tablesorter-headerRow",cssIcon:"tablesorter-icon",cssInfoBlock:"tablesorter-infoOnly",cssProcessing:"tablesorter-processing",selectorHeaders:"> thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};g.benchmark=t;g.construct= function(d){return this.each(function(){if(!this.tHead||0===this.tBodies.length||!0===this.hasInitialized)return this.config&&this.config.debug?c("stopping initialization! No thead, tbody or tablesorter has already been initialized"):"";var a=f(this),b=this,e,u="",l=f.metadata;b.hasInitialized=!1;b.isProcessing=!0;b.config={};e=f.extend(!0,b.config,g.defaults,d);f.data(b,"tablesorter",e);e.debug&&f.data(b,"startoveralltimer",new Date);e.supportsTextContent="x"===f("<span>x</span>")[0].textContent; e.supportsDataObject=1.4<=parseFloat(f.fn.jquery);e.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:!0,bottom:!1};/tablesorter\-/.test(a.attr("class"))||(u=""!==e.theme?" tablesorter-"+e.theme:"");e.$table=a.addClass(e.tableClass+u);e.$tbodies=a.children("tbody:not(."+e.cssInfoBlock+")");z(b);if(b.config.widthFixed&&0===f(b).find("colgroup").length){var p=f("<colgroup>"),k=f(b).width();f(b.tBodies[0]).find("tr:first").children("td").each(function(){p.append(f("<col>").css("width", parseInt(1E3*(f(this).width()/k),10)/10+"%"))});f(b).prepend(p)}j(b);e.delayInit||s(b);I(b);e.supportsDataObject&&"undefined"!==typeof a.data().sortlist?e.sortList=a.data().sortlist:l&&(a.metadata()&&a.metadata().sortlist)&&(e.sortList=a.metadata().sortlist);g.applyWidget(b,!0);0<e.sortList.length?a.trigger("sorton",[e.sortList,{},!e.initWidgets]):e.initWidgets&&g.applyWidget(b);e.showProcessing&&a.unbind("sortBegin.tablesorter sortEnd.tablesorter").bind("sortBegin.tablesorter sortEnd.tablesorter", function(a){g.isProcessing(b,"sortBegin"===a.type)});b.hasInitialized=!0;b.isProcessing=!1;e.debug&&g.benchmark("Overall initialization time",f.data(b,"startoveralltimer"));a.trigger("tablesorter-initialized",b);"function"===typeof e.initialized&&e.initialized(b)})};g.isProcessing=function(d,a,b){d=f(d);var e=d[0].config;d=b||d.find("."+e.cssHeader);a?(0<e.sortList.length&&(d=d.filter(function(){return this.sortDisabled?!1:g.isValueInArray(parseFloat(f(this).attr("data-column")),e.sortList)})),d.addClass(e.cssProcessing)): d.removeClass(e.cssProcessing)};g.processTbody=function(d,a,b){if(b)return d.isProcessing=!0,a.before('<span class="tablesorter-savemyplace"/>'),b=f.fn.detach?a.detach():a.remove();b=f(d).find("span.tablesorter-savemyplace");a.insertAfter(b);b.remove();d.isProcessing=!1};g.clearTableBody=function(d){f(d)[0].config.$tbodies.empty()};g.restoreHeaders=function(d){var a=d.config;a.$headers.each(function(b){f(this).find(".tablesorter-header-inner").length&&f(this).html(a.headerContent[b])})};g.destroy= function(d,a,b){d=f(d)[0];if(d.hasInitialized){g.refreshWidgets(d,!0,!0);var e=f(d),c=d.config,l=e.find("thead:first"),p=l.find("tr."+c.cssHeaderRow).removeClass(c.cssHeaderRow),k=e.find("tfoot:first > tr").children("th, td");l.find("tr").not(p).remove();e.removeData("tablesorter").unbind("sortReset update updateAll updateRows updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave sortBegin sortEnd ".split(" ").join(".tablesorter "));c.$headers.add(k).removeClass(c.cssHeader+ " "+c.cssAsc+" "+c.cssDesc).removeAttr("data-column");p.find(c.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter");g.restoreHeaders(d);!1!==a&&e.removeClass(c.tableClass+" tablesorter-"+c.theme);d.hasInitialized=!1;"function"===typeof b&&b(d)}};g.regex=[/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,/^0x[0-9a-f]+$/i];g.sortText=function(d,a, b,e){if(a===b)return 0;var c=d.config,l=c.string[c.empties[e]||c.emptyTo],f=g.regex;if(""===a&&0!==l)return"boolean"===typeof l?l?-1:1:-l||-1;if(""===b&&0!==l)return"boolean"===typeof l?l?1:-1:l||1;if("function"===typeof c.textSorter)return c.textSorter(a,b,d,e);d=a.replace(f[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");e=b.replace(f[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");a=parseInt(a.match(f[2]),16)||1!==d.length&&a.match(f[1])&&Date.parse(a);if(b= parseInt(b.match(f[2]),16)||a&&b.match(f[1])&&Date.parse(b)||null){if(a<b)return-1;if(a>b)return 1}c=Math.max(d.length,e.length);for(a=0;a<c;a++){b=isNaN(d[a])?d[a]||0:parseFloat(d[a])||0;f=isNaN(e[a])?e[a]||0:parseFloat(e[a])||0;if(isNaN(b)!==isNaN(f))return isNaN(b)?1:-1;typeof b!==typeof f&&(b+="",f+="");if(b<f)return-1;if(b>f)return 1}return 0};g.sortTextDesc=function(d,a,b,e){if(a===b)return 0;var c=d.config,f=c.string[c.empties[e]||c.emptyTo];return""===a&&0!==f?"boolean"===typeof f?f?-1:1: f||1:""===b&&0!==f?"boolean"===typeof f?f?1:-1:-f||-1:"function"===typeof c.textSorter?c.textSorter(b,a,d,e):g.sortText(d,b,a)};g.getTextValue=function(d,a,b){if(a){var c=d?d.length:0,g=a+b;for(a=0;a<c;a++)g+=d.charCodeAt(a);return b*g}return 0};g.sortNumeric=function(d,a,b,c,f,l){if(a===b)return 0;d=d.config;c=d.string[d.empties[c]||d.emptyTo];if(""===a&&0!==c)return"boolean"===typeof c?c?-1:1:-c||-1;if(""===b&&0!==c)return"boolean"===typeof c?c?1:-1:c||1;isNaN(a)&&(a=g.getTextValue(a,f,l));isNaN(b)&& (b=g.getTextValue(b,f,l));return a-b};g.sortNumericDesc=function(d,a,b,c,f,l){if(a===b)return 0;d=d.config;c=d.string[d.empties[c]||d.emptyTo];if(""===a&&0!==c)return"boolean"===typeof c?c?-1:1:c||1;if(""===b&&0!==c)return"boolean"===typeof c?c?1:-1:-c||-1;isNaN(a)&&(a=g.getTextValue(a,f,l));isNaN(b)&&(b=g.getTextValue(b,f,l));return b-a};g.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"};g.replaceAccents=function(d){var a,b="[",c=g.characterEquivalents;if(!g.characterRegex){g.characterRegexArray={};for(a in c)"string"===typeof a&&(b+=c[a],g.characterRegexArray[a]= RegExp("["+c[a]+"]","g"));g.characterRegex=RegExp(b+"]")}if(g.characterRegex.test(d))for(a in c)"string"===typeof a&&(d=d.replace(g.characterRegexArray[a],a));return d};g.isValueInArray=function(d,a){var b,c=a.length;for(b=0;b<c;b++)if(a[b][0]===d)return!0;return!1};g.addParser=function(d){var a,b=g.parsers.length,c=!0;for(a=0;a<b;a++)g.parsers[a].id.toLowerCase()===d.id.toLowerCase()&&(c=!1);c&&g.parsers.push(d)};g.getParserById=function(d){var a,b=g.parsers.length;for(a=0;a<b;a++)if(g.parsers[a].id.toLowerCase()=== d.toString().toLowerCase())return g.parsers[a];return!1};g.addWidget=function(d){g.widgets.push(d)};g.getWidgetById=function(d){var a,b,c=g.widgets.length;for(a=0;a<c;a++)if((b=g.widgets[a])&&b.hasOwnProperty("id")&&b.id.toLowerCase()===d.toLowerCase())return b};g.applyWidget=function(d,a){d=f(d)[0];var b=d.config,c=b.widgetOptions,j=[],l,p,k;b.debug&&(l=new Date);b.widgets.length&&(b.widgets=f.grep(b.widgets,function(a,d){return f.inArray(a,b.widgets)===d}),f.each(b.widgets||[],function(a,b){if((k= g.getWidgetById(b))&&k.id)k.priority||(k.priority=10),j[a]=k}),j.sort(function(a,b){return a.priority<b.priority?-1:a.priority===b.priority?0:1}),f.each(j,function(g,h){h&&(a?(h.hasOwnProperty("options")&&(c=d.config.widgetOptions=f.extend(!0,{},h.options,c)),h.hasOwnProperty("init")&&h.init(d,h,b,c)):!a&&h.hasOwnProperty("format")&&h.format(d,b,c,!1))}));b.debug&&(p=b.widgets.length,t("Completed "+(!0===a?"initializing ":"applying ")+p+" widget"+(1!==p?"s":""),l))};g.refreshWidgets=function(d,a, b){d=f(d)[0];var e,j=d.config,l=j.widgets,p=g.widgets,k=p.length;for(e=0;e<k;e++)if(p[e]&&p[e].id&&(a||0>f.inArray(p[e].id,l)))j.debug&&c("Refeshing widgets: Removing "+p[e].id),p[e].hasOwnProperty("remove")&&p[e].remove(d,j,j.widgetOptions);!0!==b&&g.applyWidget(d,a)};g.getData=function(d,a,b){var c="";d=f(d);var g,l;if(!d.length)return"";g=f.metadata?d.metadata():!1;l=" "+(d.attr("class")||"");"undefined"!==typeof d.data(b)||"undefined"!==typeof d.data(b.toLowerCase())?c+=d.data(b)||d.data(b.toLowerCase()): g&&"undefined"!==typeof g[b]?c+=g[b]:a&&"undefined"!==typeof a[b]?c+=a[b]:" "!==l&&l.match(" "+b+"-")&&(c=l.match(RegExp("\\s"+b+"-([\\w-]+)"))[1]||"");return f.trim(c)};g.formatFloat=function(c,a){if("string"!==typeof c||""===c)return c;var b;c=(a&&a.config?!1!==a.config.usNumberFormat:"undefined"!==typeof a?a:1)?c.replace(/,/g,""):c.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(c)&&(c=c.replace(/^\s*\(/,"-").replace(/\)/,""));b=parseFloat(c);return isNaN(b)?f.trim(c):b};g.isDigit= function(c){return isNaN(c)?/^[\-+(]?\d+[)]?$/.test(c.toString().replace(/[,.'"\s]/g,"")):!0}}});var j=f.tablesorter;f.fn.extend({tablesorter:j.construct});j.addParser({id:"text",is:function(){return!0},format:function(c,t){var r=t.config;c&&(c=f.trim(r.ignoreCase?c.toLocaleLowerCase():c),c=r.sortLocaleCompare?j.replaceAccents(c):c);return c},type:"text"});j.addParser({id:"digit",is:function(c){return j.isDigit(c)},format:function(c,t){var r=j.formatFloat((c||"").replace(/[^\w,. \-()]/g,""),t);return c&& "number"===typeof r?r:c?f.trim(c&&t.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"});j.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,t){var r=j.formatFloat((c||"").replace(/[^\w,. \-()]/g,""),t);return c&&"number"===typeof r?r:c?f.trim(c&&t.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"});j.addParser({id:"ipAddress",is:function(c){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(c)}, format:function(c,f){var r,v=c?c.split("."):"",s="",w=v.length;for(r=0;r<w;r++)s+=("00"+v[r]).slice(-3);return c?j.formatFloat(s,f):c},type:"numeric"});j.addParser({id:"url",is:function(c){return/^(https?|ftp|file):\/\//.test(c)},format:function(c){return c?f.trim(c.replace(/(https?|ftp|file):\/\//,"")):c},type:"text"});j.addParser({id:"isoDate",is:function(c){return/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/.test(c)},format:function(c,f){return c?j.formatFloat(""!==c?(new Date(c.replace(/-/g,"/"))).getTime()|| "":"",f):c},type:"numeric"});j.addParser({id:"percent",is:function(c){return/(\d\s?%|%\s?\d)/.test(c)},format:function(c,f){return c?j.formatFloat(c.replace(/%/g,""),f):c},type:"numeric"});j.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,f){return c?j.formatFloat((new Date(c.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",f):c},type:"numeric"});j.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,f,r,v){if(c){r=f.config;var s=r.headerList[v],w=s.shortDateFormat;"undefined"===typeof w&&(w=s.shortDateFormat=j.getData(s,r.headers[v],"dateFormat")||r.dateFormat);c=c.replace(/\s+/g," ").replace(/[\-.,]/g,"/");"mmddyyyy"===w?c=c.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$1/$2"):"ddmmyyyy"===w?c=c.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/, "$3/$2/$1"):"yyyymmdd"===w&&(c=c.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,"$1/$2/$3"))}return c?j.formatFloat((new Date(c)).getTime()||"",f):c},type:"numeric"});j.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,f){return c?j.formatFloat((new Date("2000/01/01 "+c.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",f):c},type:"numeric"});j.addParser({id:"metadata",is:function(){return!1},format:function(c,j,r){c=j.config; c=!c.parserMetadataName?"sortValue":c.parserMetadataName;return f(r).metadata()[c]},type:"numeric"});j.addWidget({id:"zebra",priority:90,format:function(c,t,r){var v,s,w,z,A,E,y=RegExp(t.cssChildRow,"i"),B=t.$tbodies;t.debug&&(A=new Date);for(c=0;c<B.length;c++)v=B.eq(c),E=v.children("tr").length,1<E&&(w=0,v=v.children("tr:visible"),v.each(function(){s=f(this);y.test(this.className)||w++;z=0===w%2;s.removeClass(r.zebra[z?1:0]).addClass(r.zebra[z?0:1])}));t.debug&&j.benchmark("Applying Zebra widget", A)},remove:function(c,j,r){var v;j=j.$tbodies;var s=(r.zebra||["even","odd"]).join(" ");for(r=0;r<j.length;r++)v=f.tablesorter.processTbody(c,j.eq(r),!0),v.children().removeClass(s),f.tablesorter.processTbody(c,v,!1)}})}(jQuery);