Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix issue #55 & updated docs

  • Loading branch information...
commit b9830622f38610c4c356bc8841c6a5b85fbaf524 1 parent 0176a41
@Mottie authored
View
9 README.markdown
@@ -35,6 +35,15 @@ tablesorter can successfully parse and sort many types of data including linked
View the [complete listing here](https://github.com/Mottie/tablesorter/wiki/Change).
+#### Version 2.1.19 (4/23/2012)
+
+* The filter widget will now ignore leading spaces so when the `filter_startsWith` is `true` it will match the text. Fix from [issue #55](https://github.com/Mottie/tablesorter/issues/55). Thanks to [aarkay18](https://github.com/aarkay18) for the code!
+* Fixed a problem with empty table cells returning an empty string instead of parsing the cell - needed when there is HTML like an input tag to process. Reverted the change accidently added back in version 2.1.15.
+* Added a resort flag that when set to false, it will prevent the resorting of the table when "update", "updateCell" or "addRows" is called. Use the appropriate format below:
+ * *update*: `$('table').trigger('update', [false]);
+ * *updateCell*: `$('table').trigger('updateCell', [ this, false ]);` - see the [updating a table cell](http://mottie.github.com/tablesorter/docs/example-update-cell.html) demo.
+ * *addRows*: `$('table').trigger('addRows', [$row, false]);` - see the [adding table rows](http://mottie.github.com/tablesorter/docs/example-add-rows.html) demo.
+
#### Version 2.1.18 (4/23/2012)
* When the sticky headers widget is applied to a table with multiple header rows, adding the class name `sticky-false` to any header row will prevent it from becoming sticky. Thanks to [megatom](https://github.com/megatom) for the suggestion in [issue #52](https://github.com/Mottie/tablesorter/issues/52#issuecomment-5261303)!
View
7 docs/example-add-rows.html
@@ -32,10 +32,13 @@
// add two rows
var row = '<tr><td>Frank</td><td>Smith</td><td>53</td><td>$39.95</td><td>22%</td><td>Mar 22, 2011 9:33 AM</td></tr>' +
'<tr><td>Inigo</td><td>Montoya</td><td>34</td><td>$19.99</td><td>15%</td><td>Sep 25, 1987 12:00PM</td></tr>',
- $row = $(row);
+ $row = $(row),
+ // resort table using the current sort; set to false to prevent resort, otherwise
+ // any other value in resort will automatically trigger the table resort.
+ resort = true;
$('table')
.find('tbody').append($row)
- .trigger('addRows', [$row]);
+ .trigger('addRows', [$row, resort]);
});
});</script>
View
5 docs/example-ajax.html
@@ -29,7 +29,10 @@
$("table tbody").append(html);
// let the plugin know that we made a update
- $("table").trigger("update");
+ // the resort flag set to anything BUT false (no quotes) will trigger an automatic
+ // table resort using the current sort
+ var resort = true;
+ $("table").trigger("update", [resort]);
// triggering the "update" function will resort the table using the current sort; since version 2.0.14
// use the following code to change the sort; set sorting column and direction, this will sort on the first and third column
View
7 docs/example-update-cell.html
@@ -28,10 +28,13 @@
$("table tbody td.discount").click(function() {
// randomize a number
- var discount = '$' + Math.round(Math.random() * Math.random() * 100) + '.' + ('0' + Math.round(Math.random() * Math.random() * 100)).slice(-2);
+ var resort = "", // resort variable set to anything BUT false (without quotes) will trigger the automatic resort
+ discount = '$' + Math.round(Math.random() * Math.random() * 100) + '.' + ('0' + Math.round(Math.random() * Math.random() * 100)).slice(-2);
$(this).text(discount);
- $("table").trigger("updateCell",[this]);
+ // set resort flag to false to prevent automatic resort
+ // leave the resort flag as undefined, or with any other value, to automatically resort the table
+ $("table").trigger("updateCell",[this, resort]);
return false;
});
View
22 docs/index.html
@@ -1286,10 +1286,13 @@
<pre class="js">// Add multiple rows to the table
var row = '&lt;tr&gt;&lt;td&gt;Inigo&lt;/td&gt;&lt;td&gt;Montoya&lt;/td&gt;&lt;td&gt;34&lt;/td&gt;' +
'&lt;td&gt;$19.99&lt;/td&gt;&lt;td&gt;15%&lt;/td&gt;&lt;td&gt;Sep 25, 1987 12:00PM&lt;/td&gt;&lt;/tr&gt;',
- $row = $(row);
+ $row = $(row),
+ // resort table using the current sort; set to false to prevent resort, otherwise
+ // any other value in resort will automatically trigger the table resort.
+ resort = true;
$('table')
.find('tbody').append($row)
- .trigger('addRows', [$row]);</pre></div>
+ .trigger('addRows', [$row, resort]);</pre></div>
</td>
<td><a href="example-add-rows.html">Example</a></td>
</tr>
@@ -1314,7 +1317,10 @@
$("table tbody").append(html);
// let the plugin know that we made a update
-$("table").trigger("update");
+// the resort flag set to anything BUT false (no quotes) will trigger an automatic
+// table resort using the current sort
+var resort = true;
+$("table").trigger("update", [resort]);
// As of version 2.0.14, the table will automatically resort (using the current sort selection)
// after the update, so include the following if you want to specify a different sort
@@ -1351,19 +1357,23 @@
$("td.discount").click(function(){
// randomize a number
- var discount = '$' + Math.round(Math.random() * Math.random() * 100) + '.' +
+ var resort = false,
+ discount = '$' + Math.round(Math.random() * Math.random() * 100) + '.' +
('0' + Math.round(Math.random() * Math.random() * 100)).slice(-2);
$(this).text(discount);
// update the table, so the tablesorter plugin knows its value
- $("table").trigger("updateCell",[this]);
+ // set resort flag to false to prevent automatic resort (since we're using a different sort below)
+ // leave the resort flag as undefined, or with any other value, to automatically resort the table
+ // $("table").trigger("updateCell", [this]); < - resort is undefined so the table WILL resort
+ $("table").trigger("updateCell", [this, resort]);
// As of version 2.0.14, the table will automatically resort (using the current sort selection)
// after the update, so include the following if you want to specify a different sort
// set sorting column and direction, this will sort on the first and third column
var sorting = [[3,1]];
- $("table").trigger("sorton",[sorting]);
+ $("table").trigger("sorton", [sorting]);
return false;
});
View
4 js/jquery.tablesorter.min.js
@@ -1,6 +1,6 @@
/*!
-* TableSorter 2.1.18 - Client-side table sorting with ease!
+* TableSorter 2.1.19 - Client-side table sorting with ease!
* Minified using http://dean.edwards.name/packer/
* Copyright (c) 2007 Christian Bach
*/
-!(function($){$.extend({tablesorter:new function(){this.version="2.1.18";var q=[],widgets=[],tbl;this.defaults={cssHeader:"tablesorter-header",cssAsc:"tablesorter-headerSortUp",cssDesc:"tablesorter-headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:false,sortReset:false,sortRestart:false,emptyTo:"bottom",stringTo:"max",textExtraction:"simple",parsers:{},widgets:[],headers:{},empties:{},strings:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"mmddyyyy",usNumberFormat:true,onRenderHeader:null,selectorHeaders:'thead th',selectorRemove:"tr.remove-me",tableClass:'tablesorter',debug:false,widgetOptions:{zebra:["even","odd"]}};function log(s){if(typeof console!=="undefined"&&typeof console.log!=="undefined"){console.log(s)}else{alert(s)}}function benchmark(s,d){log(s+" ("+(new Date().getTime()-d.getTime())+"ms)")}this.benchmark=benchmark;this.hasInitialized=false;function getElementText(a,b,c){var d="",te=a.textExtraction;if(!b){return""}if(!a.supportsTextContent){a.supportsTextContent=b.textContent||false}if(te==="simple"){if(a.supportsTextContent){d=b.textContent}else{if(b.childNodes[0]&&b.childNodes[0].hasChildNodes()){d=b.childNodes[0].innerHTML}else{d=b.innerHTML}}}else{if(typeof(te)==="function"){d=te(b,tbl,c)}else if(typeof(te)==="object"&&te.hasOwnProperty(c)){d=te[c](b,tbl,c)}else{d=$(b).text()}}return d}function getParserById(a){var i,l=q.length;for(i=0;i<l;i++){if(q[i].id.toLowerCase()===(a.toString()).toLowerCase()){return q[i]}}return false}function trimAndGetNodeText(a,b,c){return $.trim(getElementText(a,b,c))}function detectParserForColumn(a,b,c,d){var i,l=q.length,node=false,nodeValue='',keepLooking=true;while(nodeValue===''&&keepLooking){c++;if(b[c]){node=b[c].cells[d];nodeValue=trimAndGetNodeText(a.config,node,d);if(a.config.debug){log('Checking if value was empty on row '+c+', column:'+d+": "+nodeValue)}}else{keepLooking=false}}for(i=1;i<l;i++){if(q[i].is(nodeValue,a,node)){return q[i]}}return q[0]}function getData(m,a,b,c){var d='';if(m&&m[c]){d=m[c]}else if(a&&a[c]){d=a[c]}else if(b&&b.match(c+'-')){d=b.match(new RegExp(c+'-(\\w+)'))[1]||''}return $.trim(d)}function buildParserCache(a,b){if(a.tBodies.length===0){return}var c=a.config,rows=a.tBodies[0].rows,list,l,i,h,m,ch,cl,p,parsersDebug="";if(rows[0]){list=[];l=rows[0].cells.length;for(i=0;i<l;i++){h=$(b[i]);m=$.metadata?h.metadata():false;ch=c.headers[i];cl=h.attr('class')||'';p=getParserById(getData(m,ch,cl,'sorter'));c.empties[i]=getData(m,ch,cl,'empty')||c.emptyTo||(c.emptyToBottom?'bottom':'top');c.strings[i]=getData(m,ch,cl,'string')||c.stringTo||'max';if(!p){p=detectParserForColumn(a,rows,-1,i)}if(c.debug){parsersDebug+="column:"+i+"; parser:"+p.id+"; string:"+c.strings[i]+'; empty: '+c.empties[i]+"\n"}list.push(p)}}if(c.debug){log(parsersDebug)}return list}function buildCache(a){var b=a.tBodies[0],totalRows=(b&&b.rows.length)||0,totalCells=(b.rows[0]&&b.rows[0].cells.length)||0,q=a.config.parsers,cache={row:[],normalized:[]},t,i,j,c,cols,cacheTime;if(a.config.debug){cacheTime=new Date()}for(i=0;i<totalRows;++i){c=$(b.rows[i]);cols=[];if(c.hasClass(a.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue}cache.row.push(c);for(j=0;j<totalCells;++j){t=trimAndGetNodeText(a.config,c[0].cells[j],j);cols.push(t===''?'':q[j].format(t,a,c[0].cells[j],j))}cols.push(cache.normalized.length);cache.normalized.push(cols)}if(a.config.debug){benchmark("Building cache for "+totalRows+" rows",cacheTime)}a.config.cache=cache;return cache}function getWidgetById(a){var i,w,l=widgets.length;for(i=0;i<l;i++){w=widgets[i];if(w&&w.hasOwnProperty('id')&&w.id.toLowerCase()===a.toLowerCase()){return w}}}function applyWidget(a,b){var c=a.config.widgets,i,w,l=c.length;for(i=0;i<l;i++){w=getWidgetById(c[i]);if(w){if(b&&w.hasOwnProperty('init')){w.init(a,widgets,w)}else if(!b&&w.hasOwnProperty('format')){w.format(a)}}}}function appendToTable(a,b){var c=a.config,r=b.row,n=b.normalized,totalRows=n.length,checkCell=totalRows?(n[0].length-1):0,rows=[],i,j,l,pos,appendTime;if(c.debug){appendTime=new Date()}for(i=0;i<totalRows;i++){pos=n[i][checkCell];rows.push(r[pos]);if(!c.appender||!c.removeRows){l=r[pos].length;for(j=0;j<l;j++){a.tBodies[0].appendChild(r[pos][j])}}}if(c.appender){c.appender(a,rows)}if(c.debug){benchmark("Rebuilt table",appendTime)}applyWidget(a);$(a).trigger("sortEnd",a)}function computeTableHeaderCellIndexes(t){var a=[],lookup={},thead=t.getElementsByTagName('THEAD')[0],trs=thead.getElementsByTagName('TR'),i,j,k,l,c,cells,rowIndex,cellId,rowSpan,colSpan,firstAvailCol,matrixrow;for(i=0;i<trs.length;i++){cells=trs[i].cells;for(j=0;j<cells.length;j++){c=cells[j];rowIndex=c.parentNode.rowIndex;cellId=rowIndex+"-"+c.cellIndex;rowSpan=c.rowSpan||1;colSpan=c.colSpan||1;if(typeof(a[rowIndex])==="undefined"){a[rowIndex]=[]}for(k=0;k<a[rowIndex].length+1;k++){if(typeof(a[rowIndex][k])==="undefined"){firstAvailCol=k;break}}lookup[cellId]=firstAvailCol;for(k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(a[k])==="undefined"){a[k]=[]}matrixrow=a[k];for(l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x"}}}}return lookup}function formatSortingOrder(v){return(/^d/i.test(v)||v===1)}function checkHeaderMetadata(a){return(($.metadata)&&($(a).metadata().sorter===false))}function checkHeaderOptions(a,i){return((a.config.headers[i])&&(a.config.headers[i].sorter===false))}function checkHeaderLocked(a,i){if((a.config.headers[i])&&(a.config.headers[i].lockedOrder!==null)){return a.config.headers[i].lockedOrder}return false}function checkHeaderOrder(a,i){if((a.config.headers[i])&&(a.config.headers[i].sortInitialOrder)){return a.config.headers[i].sortInitialOrder}return a.config.sortInitialOrder}function buildHeaders(b){var d=($.metadata)?true:false,header_index=computeTableHeaderCellIndexes(b),$th,lock,time,$tableHeaders,c=b.config;c.headerList=[];if(c.debug){time=new Date()}$tableHeaders=$(c.selectorHeaders,b).wrapInner("<div class='tablesorter-header-inner' />").each(function(a){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(checkHeaderOrder(b,a))?[1,0,2]:[0,1,2];this.count=-1;if(checkHeaderMetadata(this)||checkHeaderOptions(b,a)||$(this).hasClass('sorter-false')){this.sortDisabled=true}this.lockedOrder=false;lock=checkHeaderLocked(b,a);if(typeof(lock)!=='undefined'&&lock!==false){this.order=this.lockedOrder=formatSortingOrder(lock)?[1,1,1]:[0,0,0]}if(!this.sortDisabled){$th=$(this).addClass(c.cssHeader);if(c.onRenderHeader){c.onRenderHeader.apply($th,[a])}}c.headerList[a]=this;$(this).parent().addClass(c.cssHeader)});if(c.debug){benchmark("Built headers",time);log($tableHeaders)}return $tableHeaders}function checkCellColSpan(a,b,d){var i,cell,arr=[],r=a.tHead.rows,c=r[d].cells;for(i=0;i<c.length;i++){cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(a,b,d++))}else{if(a.tHead.length===1||(cell.rowSpan>1||!r[d+1])){arr.push(cell)}}}return arr}function isValueInArray(v,a){var i,l=a.length;for(i=0;i<l;i++){if(a[i][0]===v){return true}}return false}function setHeadersCss(a,b,c){var h=[],i,l,css=[a.config.cssDesc,a.config.cssAsc];b.removeClass(css[0]).removeClass(css[1]);b.each(function(){if(!this.sortDisabled){h[this.column]=$(this)}});l=c.length;for(i=0;i<l;i++){if(c[i][1]===2){continue}h[c[i][0]].addClass(css[c[i][1]])}}function fixColumnWidth(a){if(a.config.widthFixed){var b=$('<colgroup>');$("tr:first td",a.tBodies[0]).each(function(){b.append($('<col>').css('width',$(this).width()))});$(a).prepend(b)}}function updateHeaderSortCount(a,b){var i,s,o,c=a.config,l=b.length;for(i=0;i<l;i++){s=b[i];o=c.headerList[s[0]];o.count=s[1]%(c.sortReset?3:2)}}function getCachedSortType(a,i){return(a)?a[i].type:''}function multisort(a,b,d){var f="var sortWrapper = function(a,b) {",col,mx=0,dir=0,tc=a.config,lc=d.normalized.length,l=b.length,sortTime,i,j,c,s,e,order,orgOrderCol;if(tc.debug){sortTime=new Date()}for(i=0;i<l;i++){c=b[i][0];order=b[i][1];s=getCachedSortType(tc.parsers,c)==="text"?"Text":"Numeric";s+=order===0?"":"Desc";e="e"+i;if(/Numeric/.test(s)&&tc.strings[c]){for(j=0;j<lc;j++){col=Math.abs(parseFloat(d.normalized[j][c]));mx=Math.max(mx,isNaN(col)?0:col)}if(typeof(tc.string[tc.strings[c]])==='boolean'){dir=(order===0?1:-1)*(tc.string[tc.strings[c]]?-1:1)}else{dir=(tc.strings[c])?tc.string[tc.strings[c]]||0:0}}f+="var "+e+" = sort"+s+"(a["+c+"],b["+c+"],"+c+","+mx+","+dir+"); ";f+="if ("+e+") { return "+e+"; } ";f+="else { "}orgOrderCol=(d.normalized&&d.normalized[0])?d.normalized[0].length-1:0;f+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(i=0;i<l;i++){f+="}; "}f+="return 0; ";f+="}; ";eval(f);d.normalized.sort(sortWrapper);if(tc.debug){benchmark("Sorting on "+b.toString()+" and dir "+order+" time",sortTime)}return d}function sortText(a,b,d){if(a===b){return 0}var c=tbl[0].config,cnt=0,L,t,x,e=c.string[(c.empties[d]||c.emptyTo)];if(a===''&&e!==0){return(typeof(e)==='boolean')?(e?-1:1):-e||-1}if(b===''&&e!==0){return(typeof(e)==='boolean')?(e?1:-1):e||1}if(c.sortLocaleCompare){return a.localeCompare(b)}try{x=/^(\.)?\d/;L=Math.min(a.length,b.length)+1;while(cnt<L&&a.charAt(cnt)===b.charAt(cnt)&&x.test(b.substring(cnt))===false&&x.test(a.substring(cnt))===false){cnt++}a=a.substring(cnt);b=b.substring(cnt);if(x.test(a)||x.test(b)){if(x.test(a)===false){return(a)?1:-1}else if(x.test(b)===false){return(b)?-1:1}else{t=parseFloat(a)-parseFloat(b);if(t!==0){return t}else{t=a.search(/[^\.\d]/)}if(t===-1){t=b.search(/[^\.\d]/)}a=a.substring(t);b=b.substring(t)}}return(a>b)?1:-1}catch(er){return 0}}function sortTextDesc(a,b,d){if(a===b){return 0}var c=tbl[0].config,e=c.string[(c.empties[d]||c.emptyTo)];if(a===''&&e!==0){return(typeof(e)==='boolean')?(e?-1:1):e||1}if(b===''&&e!==0){return(typeof(e)==='boolean')?(e?1:-1):-e||-1}if(c.sortLocaleCompare){return b.localeCompare(a)}return-sortText(a,b)}function getTextValue(a,b,d){if(b){var i,l=a.length,n=b+d;for(i=0;i<l;i++){n+=a.charCodeAt(i)}return d*n}return 0}function sortNumeric(a,b,f,g,d){if(a===b){return 0}var c=tbl[0].config,e=c.string[(c.empties[f]||c.emptyTo)];if(a===''&&e!==0){return(typeof(e)==='boolean')?(e?-1:1):-e||-1}if(b===''&&e!==0){return(typeof(e)==='boolean')?(e?1:-1):e||1}if(isNaN(a)){a=getTextValue(a,g,d)}if(isNaN(b)){b=getTextValue(b,g,d)}return a-b}function sortNumericDesc(a,b,f,g,d){if(a===b){return 0}var c=tbl[0].config,e=c.string[(c.empties[f]||c.emptyTo)];if(a===''&&e!==0){return(typeof(e)==='boolean')?(e?-1:1):e||1}if(b===''&&e!==0){return(typeof(e)==='boolean')?(e?1:-1):-e||-1}if(isNaN(a)){a=getTextValue(a,g,d)}if(isNaN(b)){b=getTextValue(b,g,d)}return b-a}this.construct=function(f){return this.each(function(){if(!this.tHead||this.tBodies.length===0){return}var d,$headers,cache,config,totalRows,$cell,c,i,j,k,a,s,o;this.config={};c=config=$.extend(true,this.config,$.tablesorter.defaults,f);tbl=d=$(this).addClass(this.config.tableClass);$.data(this,"tablesorter",c);c.string={'max':1,'min':-1,'max+':1,'max-':-1,'zero':0,'none':0,'null':0,'top':true,'bottom':false};$headers=buildHeaders(this);c.parsers=buildParserCache(this,$headers);cache=buildCache(this);fixColumnWidth(this);$headers.click(function(e){totalRows=(d[0].tBodies[0]&&d[0].tBodies[0].rows.length)||0;if(!this.sortDisabled){d.trigger("sortStart",tbl[0]);$cell=$(this);k=!e[c.sortMultiSortKey];this.count=(this.count+1)%(c.sortReset?3:2);if(c.sortRestart){i=this;$headers.each(function(){if(this!==i&&(k||!$(this).is('.'+c.cssDesc+',.'+c.cssAsc))){this.count=-1}})}i=this.column;if(k){c.sortList=[];if(c.sortForce!==null){a=c.sortForce;for(j=0;j<a.length;j++){if(a[j][0]!==i){c.sortList.push(a[j])}}}if(this.order[this.count]<2){c.sortList.push([i,this.order[this.count]])}}else{if(isValueInArray(i,c.sortList)){for(j=0;j<c.sortList.length;j++){s=c.sortList[j];o=c.headerList[s[0]];if(s[0]===i){s[1]=o.order[o.count];if(s[1]===2){c.sortList.splice(j,1);o.count=-1}}}}else{if(this.order[this.count]<2){c.sortList.push([i,this.order[this.count]])}}}if(c.sortAppend!==null){a=c.sortAppend;for(j=0;j<a.length;j++){if(a[j][0]!==i){c.sortList.push(a[j])}}}d.trigger("sortBegin",tbl[0]);setHeadersCss(d[0],$headers,c.sortList);appendToTable(d[0],multisort(d[0],c.sortList,cache));return false}}).mousedown(function(){if(c.cancelSelection){this.onselectstart=function(){return false};return false}});d.bind("update",function(){var t=this,c=t.config;$(c.selectorRemove,t.tBodies[0]).remove();t.config.parsers=buildParserCache(t,$headers);cache=buildCache(t);d.trigger("sorton",[t.config.sortList])}).bind("updateCell",function(e,a){var b=[(a.parentNode.rowIndex-1),a.cellIndex];cache.normalized[b[0]][b[1]]=c.parsers[b[1]].format(getElementText(c,a,b[1]),d,a,b[1]);c.cache=cache;d.trigger("sorton",[c.sortList])}).bind("addRows",function(e,a){var i,rows=a.filter('tr').length,dat=[],l=a[0].cells.length;for(i=0;i<rows;i++){for(j=0;j<l;j++){dat[j]=c.parsers[j].format(getElementText(c,a[i].cells[j],j),d,a[i].cells[j],j)}dat.push(cache.row.length);cache.row.push([a[i]]);cache.normalized.push(dat);dat=[]}c.cache=cache;d.trigger("sorton",[c.sortList])}).bind("sorton",function(e,a){$(this).trigger("sortStart",tbl[0]);c.sortList=a;var b=c.sortList;updateHeaderSortCount(this,b);setHeadersCss(this,$headers,b);appendToTable(this,multisort(this,b,cache))}).bind("appendCache",function(){appendToTable(this,cache)}).bind("applyWidgetId",function(e,a){getWidgetById(a).format(this)}).bind("applyWidgets",function(){applyWidget(this)});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){c.sortList=$(this).metadata().sortlist}applyWidget(this,true);if(c.sortList.length>0){d.trigger("sorton",[c.sortList])}else{applyWidget(this)}this.hasInitialized=true})};this.addParser=function(b){var i,l=q.length,a=true;for(i=0;i<l;i++){if(q[i].id.toLowerCase()===b.id.toLowerCase()){a=false}}if(a){q.push(b)}};this.addWidget=function(a){widgets.push(a)};this.formatFloat=function(s){if(typeof(s)!=='string'){return s}if(tbl[0].config.usNumberFormat){s=s.replace(/,/g,'')}else{s=s.replace(/[\s|\.]/g,'').replace(/,/g,'.')}if(/^\s*\([.\d]+\)/.test(s)){s=s.replace(/^\s*\(/,'-').replace(/\)/,'')}var i=parseFloat(s);return isNaN(i)?$.trim(s):i};this.isDigit=function(s){return(/^[\-+(]?\d*[)]?$/).test($.trim(s.replace(/[,.'\s]/g,'')))};this.clearTableBody=function(a){$(a.tBodies[0]).empty()}}})();$.fn.extend({tablesorter:$.tablesorter.construct});var u=$.tablesorter;u.addParser({id:"text",is:function(s){return true},format:function(s){return $.trim(s.toLocaleLowerCase())},type:"text"});u.addParser({id:"digit",is:function(s){return $.tablesorter.isDigit(s)},format:function(s){return $.tablesorter.formatFloat(s.replace(/[^\w,. \-()]/g,""))},type:"numeric"});u.addParser({id:"currency",is:function(s){return(/^\(?[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]/).test(s)},format:function(s){return $.tablesorter.formatFloat(s.replace(/[^0-9,. \-()]/g,""))},type:"numeric"});u.addParser({id:"ipAddress",is:function(s){return(/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/).test(s)},format:function(s){var i,item,a=s.split("."),r="",l=a.length;for(i=0;i<l;i++){item=a[i];if(item.length===2){r+="0"+item}else{r+=item}}return $.tablesorter.formatFloat(r)},type:"numeric"});u.addParser({id:"url",is:function(s){return(/^(https?|ftp|file):\/\/$/).test(s)},format:function(s){return $.trim(s.replace(/(https?|ftp|file):\/\//,''))},type:"text"});u.addParser({id:"isoDate",is:function(s){return(/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/).test(s)},format:function(s){return $.tablesorter.formatFloat((s!=="")?new Date(s.replace(/-/g,"/")).getTime():"")},type:"numeric"});u.addParser({id:"percent",is:function(s){return(/\%\)?$/).test($.trim(s))},format:function(s){return $.tablesorter.formatFloat(s.replace(/%/g,""))},type:"numeric"});u.addParser({id:"usLongDate",is:function(s){return s.match(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/)},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime())},type:"numeric"});u.addParser({id:"shortDate",is:function(s){return(/\d{1,4}[\/\-\,\.\s+]\d{1,4}[\/\-\.\,\s+]\d{1,4}/).test(s)},format:function(s,a,b,d){var c=a.config,format=(c.headers&&c.headers[d])?c.headers[d].dateFormat||c.dateFormat:c.dateFormat;s=s.replace(/\s+/g," ").replace(/[\-|\.|\,]/g,"/");if(format==="mmddyyyy"){s=s.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$1/$2")}else if(format==="ddmmyyyy"){s=s.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$2/$1")}else if(format==="yyyymmdd"){s=s.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,"$1/$2/$3")}return $.tablesorter.formatFloat(new Date(s).getTime())},type:"numeric"});u.addParser({id:"time",is:function(s){return(/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/).test(s)},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime())},type:"numeric"});u.addParser({id:"metadata",is:function(s){return false},format:function(s,a,b){var c=a.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(b).metadata()[p]},type:"numeric"});u.addWidget({id:"zebra",format:function(a){var b,row=0,even,time,c=a.config,child=c.cssChildRow,css=["even","odd"];css=c.widgetZebra&&c.hasOwnProperty('css')?c.widgetZebra.css:(c.widgetOptions&&c.widgetOptions.hasOwnProperty('zebra'))?c.widgetOptions.zebra:css;if(a.config.debug){time=new Date()}$("tr:visible",a.tBodies[0]).each(function(){b=$(this);if(!b.hasClass(child)){row++}even=(row%2===0);b.removeClass(css[even?1:0]).addClass(css[even?0:1])});if(a.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time)}}})})(jQuery);
+!(function($){$.extend({tablesorter:new function(){this.version="2.1.19";var q=[],widgets=[],tbl;this.defaults={cssHeader:"tablesorter-header",cssAsc:"tablesorter-headerSortUp",cssDesc:"tablesorter-headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:false,sortReset:false,sortRestart:false,emptyTo:"bottom",stringTo:"max",textExtraction:"simple",parsers:{},widgets:[],headers:{},empties:{},strings:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"mmddyyyy",usNumberFormat:true,onRenderHeader:null,selectorHeaders:'thead th',selectorRemove:"tr.remove-me",tableClass:'tablesorter',debug:false,widgetOptions:{zebra:["even","odd"]}};function log(s){if(typeof console!=="undefined"&&typeof console.log!=="undefined"){console.log(s)}else{alert(s)}}function benchmark(s,d){log(s+" ("+(new Date().getTime()-d.getTime())+"ms)")}this.benchmark=benchmark;this.hasInitialized=false;function getElementText(a,b,c){var d="",te=a.textExtraction;if(!b){return""}if(!a.supportsTextContent){a.supportsTextContent=b.textContent||false}if(te==="simple"){if(a.supportsTextContent){d=b.textContent}else{if(b.childNodes[0]&&b.childNodes[0].hasChildNodes()){d=b.childNodes[0].innerHTML}else{d=b.innerHTML}}}else{if(typeof(te)==="function"){d=te(b,tbl,c)}else if(typeof(te)==="object"&&te.hasOwnProperty(c)){d=te[c](b,tbl,c)}else{d=$(b).text()}}return d}function getParserById(a){var i,l=q.length;for(i=0;i<l;i++){if(q[i].id.toLowerCase()===(a.toString()).toLowerCase()){return q[i]}}return false}function trimAndGetNodeText(a,b,c){return $.trim(getElementText(a,b,c))}function detectParserForColumn(a,b,c,d){var i,l=q.length,node=false,nodeValue='',keepLooking=true;while(nodeValue===''&&keepLooking){c++;if(b[c]){node=b[c].cells[d];nodeValue=trimAndGetNodeText(a.config,node,d);if(a.config.debug){log('Checking if value was empty on row '+c+', column:'+d+": "+nodeValue)}}else{keepLooking=false}}for(i=1;i<l;i++){if(q[i].is(nodeValue,a,node)){return q[i]}}return q[0]}function getData(m,a,b,c){var d='';if(m&&m[c]){d=m[c]}else if(a&&a[c]){d=a[c]}else if(b&&b.match(c+'-')){d=b.match(new RegExp(c+'-(\\w+)'))[1]||''}return $.trim(d)}function buildParserCache(a,b){if(a.tBodies.length===0){return}var c=a.config,rows=a.tBodies[0].rows,list,l,i,h,m,ch,cl,p,parsersDebug="";if(rows[0]){list=[];l=rows[0].cells.length;for(i=0;i<l;i++){h=$(b[i]);m=$.metadata?h.metadata():false;ch=c.headers[i];cl=h.attr('class')||'';p=getParserById(getData(m,ch,cl,'sorter'));c.empties[i]=getData(m,ch,cl,'empty')||c.emptyTo||(c.emptyToBottom?'bottom':'top');c.strings[i]=getData(m,ch,cl,'string')||c.stringTo||'max';if(!p){p=detectParserForColumn(a,rows,-1,i)}if(c.debug){parsersDebug+="column:"+i+"; parser:"+p.id+"; string:"+c.strings[i]+'; empty: '+c.empties[i]+"\n"}list.push(p)}}if(c.debug){log(parsersDebug)}return list}function buildCache(a){var b=a.tBodies[0],totalRows=(b&&b.rows.length)||0,totalCells=(b.rows[0]&&b.rows[0].cells.length)||0,q=a.config.parsers,cache={row:[],normalized:[]},t,i,j,c,cols,cacheTime;if(a.config.debug){cacheTime=new Date()}for(i=0;i<totalRows;++i){c=$(b.rows[i]);cols=[];if(c.hasClass(a.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue}cache.row.push(c);for(j=0;j<totalCells;++j){t=trimAndGetNodeText(a.config,c[0].cells[j],j);cols.push(q[j].format(t,a,c[0].cells[j],j))}cols.push(cache.normalized.length);cache.normalized.push(cols)}if(a.config.debug){benchmark("Building cache for "+totalRows+" rows",cacheTime)}a.config.cache=cache;return cache}function getWidgetById(a){var i,w,l=widgets.length;for(i=0;i<l;i++){w=widgets[i];if(w&&w.hasOwnProperty('id')&&w.id.toLowerCase()===a.toLowerCase()){return w}}}function applyWidget(a,b){var c=a.config.widgets,i,w,l=c.length;for(i=0;i<l;i++){w=getWidgetById(c[i]);if(w){if(b&&w.hasOwnProperty('init')){w.init(a,widgets,w)}else if(!b&&w.hasOwnProperty('format')){w.format(a)}}}}function appendToTable(a,b){var c=a.config,r=b.row,n=b.normalized,totalRows=n.length,checkCell=totalRows?(n[0].length-1):0,rows=[],i,j,l,pos,appendTime;if(c.debug){appendTime=new Date()}for(i=0;i<totalRows;i++){pos=n[i][checkCell];rows.push(r[pos]);if(!c.appender||!c.removeRows){l=r[pos].length;for(j=0;j<l;j++){a.tBodies[0].appendChild(r[pos][j])}}}if(c.appender){c.appender(a,rows)}if(c.debug){benchmark("Rebuilt table",appendTime)}applyWidget(a);$(a).trigger("sortEnd",a)}function computeTableHeaderCellIndexes(t){var a=[],lookup={},thead=t.getElementsByTagName('THEAD')[0],trs=thead.getElementsByTagName('TR'),i,j,k,l,c,cells,rowIndex,cellId,rowSpan,colSpan,firstAvailCol,matrixrow;for(i=0;i<trs.length;i++){cells=trs[i].cells;for(j=0;j<cells.length;j++){c=cells[j];rowIndex=c.parentNode.rowIndex;cellId=rowIndex+"-"+c.cellIndex;rowSpan=c.rowSpan||1;colSpan=c.colSpan||1;if(typeof(a[rowIndex])==="undefined"){a[rowIndex]=[]}for(k=0;k<a[rowIndex].length+1;k++){if(typeof(a[rowIndex][k])==="undefined"){firstAvailCol=k;break}}lookup[cellId]=firstAvailCol;for(k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(a[k])==="undefined"){a[k]=[]}matrixrow=a[k];for(l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x"}}}}return lookup}function formatSortingOrder(v){return(/^d/i.test(v)||v===1)}function checkHeaderMetadata(a){return(($.metadata)&&($(a).metadata().sorter===false))}function checkHeaderOptions(a,i){return((a.config.headers[i])&&(a.config.headers[i].sorter===false))}function checkHeaderLocked(a,i){if((a.config.headers[i])&&(a.config.headers[i].lockedOrder!==null)){return a.config.headers[i].lockedOrder}return false}function checkHeaderOrder(a,i){if((a.config.headers[i])&&(a.config.headers[i].sortInitialOrder)){return a.config.headers[i].sortInitialOrder}return a.config.sortInitialOrder}function buildHeaders(b){var d=($.metadata)?true:false,header_index=computeTableHeaderCellIndexes(b),$th,lock,time,$tableHeaders,c=b.config;c.headerList=[];if(c.debug){time=new Date()}$tableHeaders=$(c.selectorHeaders,b).wrapInner("<div class='tablesorter-header-inner' />").each(function(a){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(checkHeaderOrder(b,a))?[1,0,2]:[0,1,2];this.count=-1;if(checkHeaderMetadata(this)||checkHeaderOptions(b,a)||$(this).hasClass('sorter-false')){this.sortDisabled=true}this.lockedOrder=false;lock=checkHeaderLocked(b,a);if(typeof(lock)!=='undefined'&&lock!==false){this.order=this.lockedOrder=formatSortingOrder(lock)?[1,1,1]:[0,0,0]}if(!this.sortDisabled){$th=$(this).addClass(c.cssHeader);if(c.onRenderHeader){c.onRenderHeader.apply($th,[a])}}c.headerList[a]=this;$(this).parent().addClass(c.cssHeader)});if(c.debug){benchmark("Built headers",time);log($tableHeaders)}return $tableHeaders}function checkCellColSpan(a,b,d){var i,cell,arr=[],r=a.tHead.rows,c=r[d].cells;for(i=0;i<c.length;i++){cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(a,b,d++))}else{if(a.tHead.length===1||(cell.rowSpan>1||!r[d+1])){arr.push(cell)}}}return arr}function isValueInArray(v,a){var i,l=a.length;for(i=0;i<l;i++){if(a[i][0]===v){return true}}return false}function setHeadersCss(a,b,c){var h=[],i,l,css=[a.config.cssDesc,a.config.cssAsc];b.removeClass(css[0]).removeClass(css[1]);b.each(function(){if(!this.sortDisabled){h[this.column]=$(this)}});l=c.length;for(i=0;i<l;i++){if(c[i][1]===2){continue}h[c[i][0]].addClass(css[c[i][1]])}}function fixColumnWidth(a){if(a.config.widthFixed){var b=$('<colgroup>');$("tr:first td",a.tBodies[0]).each(function(){b.append($('<col>').css('width',$(this).width()))});$(a).prepend(b)}}function updateHeaderSortCount(a,b){var i,s,o,c=a.config,l=b.length;for(i=0;i<l;i++){s=b[i];o=c.headerList[s[0]];o.count=s[1]%(c.sortReset?3:2)}}function getCachedSortType(a,i){return(a)?a[i].type:''}function multisort(a,b,d){var f="var sortWrapper = function(a,b) {",col,mx=0,dir=0,tc=a.config,lc=d.normalized.length,l=b.length,sortTime,i,j,c,s,e,order,orgOrderCol;if(tc.debug){sortTime=new Date()}for(i=0;i<l;i++){c=b[i][0];order=b[i][1];s=getCachedSortType(tc.parsers,c)==="text"?"Text":"Numeric";s+=order===0?"":"Desc";e="e"+i;if(/Numeric/.test(s)&&tc.strings[c]){for(j=0;j<lc;j++){col=Math.abs(parseFloat(d.normalized[j][c]));mx=Math.max(mx,isNaN(col)?0:col)}if(typeof(tc.string[tc.strings[c]])==='boolean'){dir=(order===0?1:-1)*(tc.string[tc.strings[c]]?-1:1)}else{dir=(tc.strings[c])?tc.string[tc.strings[c]]||0:0}}f+="var "+e+" = sort"+s+"(a["+c+"],b["+c+"],"+c+","+mx+","+dir+"); ";f+="if ("+e+") { return "+e+"; } ";f+="else { "}orgOrderCol=(d.normalized&&d.normalized[0])?d.normalized[0].length-1:0;f+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(i=0;i<l;i++){f+="}; "}f+="return 0; ";f+="}; ";eval(f);d.normalized.sort(sortWrapper);if(tc.debug){benchmark("Sorting on "+b.toString()+" and dir "+order+" time",sortTime)}return d}function sortText(a,b,d){if(a===b){return 0}var c=tbl[0].config,cnt=0,L,t,x,e=c.string[(c.empties[d]||c.emptyTo)];if(a===''&&e!==0){return(typeof(e)==='boolean')?(e?-1:1):-e||-1}if(b===''&&e!==0){return(typeof(e)==='boolean')?(e?1:-1):e||1}if(c.sortLocaleCompare){return a.localeCompare(b)}try{x=/^(\.)?\d/;L=Math.min(a.length,b.length)+1;while(cnt<L&&a.charAt(cnt)===b.charAt(cnt)&&x.test(b.substring(cnt))===false&&x.test(a.substring(cnt))===false){cnt++}a=a.substring(cnt);b=b.substring(cnt);if(x.test(a)||x.test(b)){if(x.test(a)===false){return(a)?1:-1}else if(x.test(b)===false){return(b)?-1:1}else{t=parseFloat(a)-parseFloat(b);if(t!==0){return t}else{t=a.search(/[^\.\d]/)}if(t===-1){t=b.search(/[^\.\d]/)}a=a.substring(t);b=b.substring(t)}}return(a>b)?1:-1}catch(er){return 0}}function sortTextDesc(a,b,d){if(a===b){return 0}var c=tbl[0].config,e=c.string[(c.empties[d]||c.emptyTo)];if(a===''&&e!==0){return(typeof(e)==='boolean')?(e?-1:1):e||1}if(b===''&&e!==0){return(typeof(e)==='boolean')?(e?1:-1):-e||-1}if(c.sortLocaleCompare){return b.localeCompare(a)}return-sortText(a,b)}function getTextValue(a,b,d){if(b){var i,l=a.length,n=b+d;for(i=0;i<l;i++){n+=a.charCodeAt(i)}return d*n}return 0}function sortNumeric(a,b,f,g,d){if(a===b){return 0}var c=tbl[0].config,e=c.string[(c.empties[f]||c.emptyTo)];if(a===''&&e!==0){return(typeof(e)==='boolean')?(e?-1:1):-e||-1}if(b===''&&e!==0){return(typeof(e)==='boolean')?(e?1:-1):e||1}if(isNaN(a)){a=getTextValue(a,g,d)}if(isNaN(b)){b=getTextValue(b,g,d)}return a-b}function sortNumericDesc(a,b,f,g,d){if(a===b){return 0}var c=tbl[0].config,e=c.string[(c.empties[f]||c.emptyTo)];if(a===''&&e!==0){return(typeof(e)==='boolean')?(e?-1:1):e||1}if(b===''&&e!==0){return(typeof(e)==='boolean')?(e?1:-1):-e||-1}if(isNaN(a)){a=getTextValue(a,g,d)}if(isNaN(b)){b=getTextValue(b,g,d)}return b-a}this.construct=function(g){return this.each(function(){if(!this.tHead||this.tBodies.length===0){return}var f,$headers,cache,config,totalRows,$cell,c,i,j,k,a,s,o;this.config={};c=config=$.extend(true,this.config,$.tablesorter.defaults,g);tbl=f=$(this).addClass(this.config.tableClass);$.data(this,"tablesorter",c);c.string={'max':1,'min':-1,'max+':1,'max-':-1,'zero':0,'none':0,'null':0,'top':true,'bottom':false};$headers=buildHeaders(this);c.parsers=buildParserCache(this,$headers);cache=buildCache(this);fixColumnWidth(this);$headers.click(function(e){totalRows=(f[0].tBodies[0]&&f[0].tBodies[0].rows.length)||0;if(!this.sortDisabled){f.trigger("sortStart",tbl[0]);$cell=$(this);k=!e[c.sortMultiSortKey];this.count=(this.count+1)%(c.sortReset?3:2);if(c.sortRestart){i=this;$headers.each(function(){if(this!==i&&(k||!$(this).is('.'+c.cssDesc+',.'+c.cssAsc))){this.count=-1}})}i=this.column;if(k){c.sortList=[];if(c.sortForce!==null){a=c.sortForce;for(j=0;j<a.length;j++){if(a[j][0]!==i){c.sortList.push(a[j])}}}if(this.order[this.count]<2){c.sortList.push([i,this.order[this.count]])}}else{if(isValueInArray(i,c.sortList)){for(j=0;j<c.sortList.length;j++){s=c.sortList[j];o=c.headerList[s[0]];if(s[0]===i){s[1]=o.order[o.count];if(s[1]===2){c.sortList.splice(j,1);o.count=-1}}}}else{if(this.order[this.count]<2){c.sortList.push([i,this.order[this.count]])}}}if(c.sortAppend!==null){a=c.sortAppend;for(j=0;j<a.length;j++){if(a[j][0]!==i){c.sortList.push(a[j])}}}f.trigger("sortBegin",tbl[0]);setHeadersCss(f[0],$headers,c.sortList);appendToTable(f[0],multisort(f[0],c.sortList,cache));return false}}).mousedown(function(){if(c.cancelSelection){this.onselectstart=function(){return false};return false}});f.bind("update",function(e,a){var t=this,c=t.config;$(c.selectorRemove,t.tBodies[0]).remove();c.parsers=buildParserCache(t,$headers);cache=buildCache(t);if(a!==false){f.trigger("sorton",[c.sortList])}}).bind("updateCell",function(e,a,b){var d=[(a.parentNode.rowIndex-1),a.cellIndex];cache.normalized[d[0]][d[1]]=c.parsers[d[1]].format(getElementText(c,a,d[1]),f,a,d[1]);c.cache=cache;if(b!==false){f.trigger("sorton",[c.sortList])}}).bind("addRows",function(e,a,b){var i,rows=a.filter('tr').length,dat=[],l=a[0].cells.length;for(i=0;i<rows;i++){for(j=0;j<l;j++){dat[j]=c.parsers[j].format(getElementText(c,a[i].cells[j],j),f,a[i].cells[j],j)}dat.push(cache.row.length);cache.row.push([a[i]]);cache.normalized.push(dat);dat=[]}c.cache=cache;if(b!==false){f.trigger("sorton",[c.sortList])}}).bind("sorton",function(e,a){$(this).trigger("sortStart",tbl[0]);c.sortList=a;var b=c.sortList;updateHeaderSortCount(this,b);setHeadersCss(this,$headers,b);appendToTable(this,multisort(this,b,cache))}).bind("appendCache",function(){appendToTable(this,cache)}).bind("applyWidgetId",function(e,a){getWidgetById(a).format(this)}).bind("applyWidgets",function(){applyWidget(this)});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){c.sortList=$(this).metadata().sortlist}applyWidget(this,true);if(c.sortList.length>0){f.trigger("sorton",[c.sortList])}else{applyWidget(this)}this.hasInitialized=true})};this.addParser=function(b){var i,l=q.length,a=true;for(i=0;i<l;i++){if(q[i].id.toLowerCase()===b.id.toLowerCase()){a=false}}if(a){q.push(b)}};this.addWidget=function(a){widgets.push(a)};this.formatFloat=function(s){if(typeof(s)!=='string'){return s}if(tbl[0].config.usNumberFormat){s=s.replace(/,/g,'')}else{s=s.replace(/[\s|\.]/g,'').replace(/,/g,'.')}if(/^\s*\([.\d]+\)/.test(s)){s=s.replace(/^\s*\(/,'-').replace(/\)/,'')}var i=parseFloat(s);return isNaN(i)?$.trim(s):i};this.isDigit=function(s){return(/^[\-+(]?\d*[)]?$/).test($.trim(s.replace(/[,.'\s]/g,'')))};this.clearTableBody=function(a){$(a.tBodies[0]).empty()}}})();$.fn.extend({tablesorter:$.tablesorter.construct});var u=$.tablesorter;u.addParser({id:"text",is:function(s){return true},format:function(s){return $.trim(s.toLocaleLowerCase())},type:"text"});u.addParser({id:"digit",is:function(s){return $.tablesorter.isDigit(s)},format:function(s){return $.tablesorter.formatFloat(s.replace(/[^\w,. \-()]/g,""))},type:"numeric"});u.addParser({id:"currency",is:function(s){return(/^\(?[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]/).test(s)},format:function(s){return $.tablesorter.formatFloat(s.replace(/[^0-9,. \-()]/g,""))},type:"numeric"});u.addParser({id:"ipAddress",is:function(s){return(/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/).test(s)},format:function(s){var i,item,a=s.split("."),r="",l=a.length;for(i=0;i<l;i++){item=a[i];if(item.length===2){r+="0"+item}else{r+=item}}return $.tablesorter.formatFloat(r)},type:"numeric"});u.addParser({id:"url",is:function(s){return(/^(https?|ftp|file):\/\/$/).test(s)},format:function(s){return $.trim(s.replace(/(https?|ftp|file):\/\//,''))},type:"text"});u.addParser({id:"isoDate",is:function(s){return(/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/).test(s)},format:function(s){return $.tablesorter.formatFloat((s!=="")?new Date(s.replace(/-/g,"/")).getTime():"")},type:"numeric"});u.addParser({id:"percent",is:function(s){return(/\%\)?$/).test($.trim(s))},format:function(s){return $.tablesorter.formatFloat(s.replace(/%/g,""))},type:"numeric"});u.addParser({id:"usLongDate",is:function(s){return s.match(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/)},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime())},type:"numeric"});u.addParser({id:"shortDate",is:function(s){return(/\d{1,4}[\/\-\,\.\s+]\d{1,4}[\/\-\.\,\s+]\d{1,4}/).test(s)},format:function(s,a,b,d){var c=a.config,format=(c.headers&&c.headers[d])?c.headers[d].dateFormat||c.dateFormat:c.dateFormat;s=s.replace(/\s+/g," ").replace(/[\-|\.|\,]/g,"/");if(format==="mmddyyyy"){s=s.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$1/$2")}else if(format==="ddmmyyyy"){s=s.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$2/$1")}else if(format==="yyyymmdd"){s=s.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,"$1/$2/$3")}return $.tablesorter.formatFloat(new Date(s).getTime())},type:"numeric"});u.addParser({id:"time",is:function(s){return(/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/).test(s)},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime())},type:"numeric"});u.addParser({id:"metadata",is:function(s){return false},format:function(s,a,b){var c=a.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(b).metadata()[p]},type:"numeric"});u.addWidget({id:"zebra",format:function(a){var b,row=0,even,time,c=a.config,child=c.cssChildRow,css=["even","odd"];css=c.widgetZebra&&c.hasOwnProperty('css')?c.widgetZebra.css:(c.widgetOptions&&c.widgetOptions.hasOwnProperty('zebra'))?c.widgetOptions.zebra:css;if(a.config.debug){time=new Date()}$("tr:visible",a.tBodies[0]).each(function(){b=$(this);if(!b.hasClass(child)){row++}even=(row%2===0);b.removeClass(css[even?1:0]).addClass(css[even?0:1])});if(a.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time)}}})})(jQuery);
View
2  js/jquery.tablesorter.widgets.js
@@ -202,7 +202,7 @@ $.tablesorter.addWidget({
typeof wo.filter_childRows !== 'undefined' ? wo.filter_childRows : true)) ? cr.text() : '';
$td = $(this).find('td');
for (i=0; i < cols; i++){
- x = ($td.eq(i).text() + t).toLowerCase().indexOf(v[i]);
+ x = $.trim(($td.eq(i).text() + t)).toLowerCase().indexOf(v[i]);
if (v[i] !== '' && ( (!wo.filter_startsWith && x >= 0) || (wo.filter_startsWith && x === 0) ) ) {
r = (r) ? true : false;
} else if (v[i] !== '') {
View
8 js/jquery.tablesorter.widgets.min.js
@@ -3,8 +3,8 @@
b.tablesorter.storage=function(a,e,d){var c,g=!1;c={};var i=a.id||b(".tablesorter").index(b(a)),f=window.location.pathname;try{g=!!localStorage.getItem}catch(j){}b.parseJSON&&(g?c=b.parseJSON(localStorage[e])||{}:(c=document.cookie.split(/[;\s|=]/),a=b.inArray(e,c)+1,c=0!==a?b.parseJSON(c[a])||{}:{}));if(d&&JSON&&JSON.hasOwnProperty("stringify")){if(!c[f]||!c[f][i])c[f]||(c[f]={});c[f][i]=d;g?localStorage[e]=JSON.stringify(c):(a=new Date,a.setTime(a.getTime()+31536E6),document.cookie= e+"="+JSON.stringify(c).replace(/\"/g,'"')+"; expires="+a.toGMTString()+"; path=/")}else return c&&c.hasOwnProperty(f)&&c[f].hasOwnProperty(i)?c[f][i]:{}};
b.tablesorter.addWidget({id:"uitheme",format:function(a){var e,d,c,g,i,f=b(a),j=a.config,h=j.widgetOptions,k=["ui-icon-arrowthick-2-n-s","ui-icon-arrowthick-1-s","ui-icon-arrowthick-1-n"],k=j.widgetUitheme&&j.widgetUitheme.hasOwnProperty("css")?j.widgetUitheme.css||k:h&&h.hasOwnProperty("uitheme")?h.uitheme:k;c=k.join(" ");j.debug&&(e=new Date); f.hasClass("ui-theme")||(f.addClass("ui-widget ui-widget-content ui-corner-all ui-theme"),b.each(j.headerList,function(){b(this).addClass("ui-widget-header ui-corner-all ui-state-default").append('<span class="ui-icon"/>').wrapInner('<div class="tablesorter-inner"/>').hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")})}));b.each(j.headerList,function(a){g=b(this);if(this.sortDisabled)g.find("span.ui-icon").removeClass(c+" ui-icon");else{d=g.hasClass(j.cssAsc)? k[1]:g.hasClass(j.cssDesc)?k[2]:g.hasClass(j.cssHeader)?k[0]:"";i=f.hasClass("hasStickyHeaders")?f.find("tr."+(h.stickyHeaders||"tablesorter-stickyHeader")).find("th").eq(a).add(g):g;i[d===k[0]?"removeClass":"addClass"]("ui-state-active").find("span.ui-icon").removeClass(c).addClass(d)}});j.debug&&b.tablesorter.benchmark("Applying uitheme widget",e)}});
b.tablesorter.addWidget({id:"columns",format:function(a){var e,d,c,g,i=a.config,f=i.sortList,j=f.length,h=["primary","secondary","tertiary"],h=i.widgetColumns&& i.widgetColumns.hasOwnProperty("css")?i.widgetColumns.css||h:i.widgetOptions&&i.widgetOptions.hasOwnProperty("columns")?i.widgetOptions.columns||h:h;c=h.length-1;g=h.join(" ");i.debug&&(d=new Date);f&&f[0]?b("tr:visible",a.tBodies[0]).each(function(a){e=b(this).children().removeClass(g);e.eq(f[0][0]).addClass(h[0]);if(1<j)for(a=1;a<j;a++)e.eq(f[a][0]).addClass(h[a]||h[c])}):b("td",a.tBodies[0]).removeClass(g);i.debug&&b.tablesorter.benchmark("Applying Columns widget",d)}});
-b.tablesorter.addWidget({id:"filter", format:function(a){if(!b(a).hasClass("hasFilters")){var e,d,c,g,i,f,j,h=a.config,k=h.widgetOptions,l=k.filter_cssFilter||"tablesorter-filter",m=b(a).addClass("hasFilters"),n=m.find("tbody tr:first td").length,a='<tr class="'+l+'">',o;h.debug&&(o=new Date);for(e=0;e<n;e++)a+='<td><input type="search" data-col="'+e+'" class="'+l,a+=h.headers[e]&&h.headers[e].hasOwnProperty("filter")&&!1===h.headers[e].filter||b(h.headerList[e]).is(".filter-false")?' disabled" disabled':'"',a+="></td>";m.find("thead").append(a+= "</tr>").find("input."+l).bind("keyup search",function(){d=m.find("thead").find("input."+l).map(function(){return(b(this).val()||"").toLowerCase()}).get();""===d.join("")?m.find("tr").show():m.find("tbody").find("tr:not(."+h.cssChildRow+")").each(function(){c=!0;f=b(this).nextUntil("tr:not(."+h.cssChildRow+")");g=f.length&&(k&&k.hasOwnProperty("filter_childRows")&&"undefined"!==typeof k.filter_childRows?k.filter_childRows:1)?f.text():"";j=b(this).find("td");for(e=0;e<n;e++)i=(j.eq(e).text()+g).toLowerCase().indexOf(d[e]), ""!==d[e]&&(!k.filter_startsWith&&0<=i||k.filter_startsWith&&0===i)?c=c?!0:!1:""!==d[e]&&(c=!1);b(this)[c?"show":"hide"]();if(f.length)f[c?"show":"hide"]()});m.trigger("applyWidgets")});h.debug&&b.tablesorter.benchmark("Applying Filter widget",o)}}});
-b.tablesorter.addWidget({id:"stickyHeaders",format:function(a){if(!b(a).hasClass("hasStickyHeaders")){var e=b(a).addClass("hasStickyHeaders"),d=a.config.widgetOptions,c=b(window),g=b(a).find("thead"),i=g.find("tr:not(.sticky-false)").children(),f=d.stickyHeaders|| "tablesorter-stickyHeader",j=i.eq(0),h=g.find("tr.tablesorter-header:not(.sticky-false)").clone().removeClass("tablesorter-header").addClass(f).css({width:g.outerWidth(!0),position:"fixed",left:j.offset().left,margin:0,top:0,visibility:"hidden",zIndex:10}),k=h.children(),l="";e.bind("sortEnd",function(a,c){var d=b(c).find("thead tr"),e=d.filter("."+f).children();d.filter(":not(."+f+")").children().each(function(a){e.eq(a).attr("class",b(this).attr("class"))})}).bind("pagerComplete",function(){c.resize()}); i.each(function(a){var c=b(this);k.eq(a).bind("click",function(a){c.trigger(a)}).bind("mousedown",function(){this.onselectstart=function(){return!1};return!1}).find(".tablesorter-header-inner").width(c.find(".tablesorter-header-inner").width())});g.prepend(h);c.scroll(function(){var a=j.offset(),b=c.scrollTop(),b=b>a.top&&b<a.top+e.find("tbody").height()?"visible":"hidden";h.css({left:a.left-c.scrollLeft(),visibility:b});b!==l&&(c.resize(),l=b)}).resize(function(){var a=0;h.css({left:j.offset().left- c.scrollLeft(),width:g.outerWidth()}).each(function(c){b(this).css("top",a);a+=g.find("tr").eq(c).outerHeight()});k.find(".tablesorter-header-inner").each(function(a){b(this).width(i.eq(a).find(".tablesorter-header-inner").width())})})}}});
-b.tablesorter.addWidget({id:"resizable",format:function(a){if(!b(a).hasClass("hasResizable")){b(a).addClass("hasResizable");var e,d,c=a.config,g=b(c.headerList).filter(":gt(0)"),i=0,f=null,j=null,h=function(){i=0;f=j=null;b(window).trigger("resize")};if(d=b.tablesorter.storage? b.tablesorter.storage(a,"tablesorter-resizable"):"")for(e in d)!isNaN(e)&&e<c.headerList.length&&b(c.headerList[e]).width(d[e]);g.each(function(){b(this).append('<div class="tablesorter-resizer" style="cursor:w-resize;position:absolute;height:100%;width:20px;left:-20px;top:0;z-index:1;"></div>').wrapInner('<div style="position:relative;height:100%;width:100%"></div>')}).bind("mousemove",function(a){if(0!==i&&f){var b=a.pageX-i;f.width()<-b||j&&j.width()<=b||(j.width(j.width()+b),i=a.pageX)}}).bind("mouseup", function(){d&&b.tablesorter.storage&&f&&(d[j.index()]=j.width(),b.tablesorter.storage(a,"tablesorter-resizable",d));h();return!1}).find(".tablesorter-resizer").bind("mousedown",function(a){f=b(a.target).closest("th");j=f.prev();i=a.pageX});b(a).find("thead").bind("mouseup mouseleave",function(){h()})}}});
-b.tablesorter.addWidget({id:"saveSort",init:function(a,b,d){d.format(a,!0)},format:function(a,e){var d,c,g=a.config;d={sortList:g.sortList};g.debug&&(c=new Date);b(a).hasClass("hasSaveSort")?a.hasInitialized&& b.tablesorter.storage&&(b.tablesorter.storage(a,"tablesorter-savesort",d),g.debug&&b.tablesorter.benchmark("saveSort widget: Saving last sort: "+g.sortList,c)):(b(a).addClass("hasSaveSort"),d="",b.tablesorter.storage&&(d=(d=b.tablesorter.storage(a,"tablesorter-savesort"))&&d.hasOwnProperty("sortList")&&b.isArray(d.sortList)?d.sortList:"",g.debug&&b.tablesorter.benchmark("saveSort: Last sort loaded: "+d,c)),e&&d&&0<d.length?g.sortList=d:a.hasInitialized&&d&&0<d.length&&b(a).trigger("sorton",[d]))}})
+b.tablesorter.addWidget({id:"filter", format:function(a){if(!b(a).hasClass("hasFilters")){var e,d,c,g,i,f,j,h=a.config,k=h.widgetOptions,l=k.filter_cssFilter||"tablesorter-filter",m=b(a).addClass("hasFilters"),n=m.find("tbody tr:first td").length,a='<tr class="'+l+'">',o;h.debug&&(o=new Date);for(e=0;e<n;e++)a+='<td><input type="search" data-col="'+e+'" class="'+l,a+=h.headers[e]&&h.headers[e].hasOwnProperty("filter")&&!1===h.headers[e].filter||b(h.headerList[e]).is(".filter-false")?' disabled" disabled':'"',a+="></td>";m.find("thead").append(a+= "</tr>").find("input."+l).bind("keyup search",function(){d=m.find("thead").find("input."+l).map(function(){return(b(this).val()||"").toLowerCase()}).get();""===d.join("")?m.find("tr").show():m.find("tbody").find("tr:not(."+h.cssChildRow+")").each(function(){c=!0;f=b(this).nextUntil("tr:not(."+h.cssChildRow+")");g=f.length&&(k&&k.hasOwnProperty("filter_childRows")&&"undefined"!==typeof k.filter_childRows?k.filter_childRows:1)?f.text():"";j=b(this).find("td");for(e=0;e<n;e++)i=b.trim(j.eq(e).text()+ g).toLowerCase().indexOf(d[e]),""!==d[e]&&(!k.filter_startsWith&&0<=i||k.filter_startsWith&&0===i)?c=c?!0:!1:""!==d[e]&&(c=!1);b(this)[c?"show":"hide"]();if(f.length)f[c?"show":"hide"]()});m.trigger("applyWidgets")});h.debug&&b.tablesorter.benchmark("Applying Filter widget",o)}}});
+b.tablesorter.addWidget({id:"stickyHeaders",format:function(a){if(!b(a).hasClass("hasStickyHeaders")){var e=b(a).addClass("hasStickyHeaders"),d=a.config.widgetOptions,c=b(window),g=b(a).find("thead"),i=g.find("tr:not(.sticky-false)").children(), f=d.stickyHeaders||"tablesorter-stickyHeader",j=i.eq(0),h=g.find("tr.tablesorter-header:not(.sticky-false)").clone().removeClass("tablesorter-header").addClass(f).css({width:g.outerWidth(!0),position:"fixed",left:j.offset().left,margin:0,top:0,visibility:"hidden",zIndex:10}),k=h.children(),l="";e.bind("sortEnd",function(a,c){var d=b(c).find("thead tr"),e=d.filter("."+f).children();d.filter(":not(."+f+")").children().each(function(a){e.eq(a).attr("class",b(this).attr("class"))})}).bind("pagerComplete", function(){c.resize()});i.each(function(a){var c=b(this);k.eq(a).bind("click",function(b){c.trigger(b)}).bind("mousedown",function(){this.onselectstart=function(){return!1};return!1}).find(".tablesorter-header-inner").width(c.find(".tablesorter-header-inner").width())});g.prepend(h);c.scroll(function(){var b=j.offset(),a=c.scrollTop(),a=a>b.top&&a<b.top+e.find("tbody").height()?"visible":"hidden";h.css({left:b.left-c.scrollLeft(),visibility:a});a!==l&&(c.resize(),l=a)}).resize(function(){var a=0; h.css({left:j.offset().left-c.scrollLeft(),width:g.outerWidth()}).each(function(c){b(this).css("top",a);a+=g.find("tr").eq(c).outerHeight()});k.find(".tablesorter-header-inner").each(function(a){b(this).width(i.eq(a).find(".tablesorter-header-inner").width())})})}}});
+b.tablesorter.addWidget({id:"resizable",format:function(a){if(!b(a).hasClass("hasResizable")){b(a).addClass("hasResizable");var e,d,c=a.config,g=b(c.headerList).filter(":gt(0)"),i=0,f=null,j=null,h=function(){i=0;f=j=null;b(window).trigger("resize")}; if(d=b.tablesorter.storage?b.tablesorter.storage(a,"tablesorter-resizable"):"")for(e in d)!isNaN(e)&&e<c.headerList.length&&b(c.headerList[e]).width(d[e]);g.each(function(){b(this).append('<div class="tablesorter-resizer" style="cursor:w-resize;position:absolute;height:100%;width:20px;left:-20px;top:0;z-index:1;"></div>').wrapInner('<div style="position:relative;height:100%;width:100%"></div>')}).bind("mousemove",function(a){if(0!==i&&f){var b=a.pageX-i;f.width()<-b||j&&j.width()<=b||(j.width(j.width()+ b),i=a.pageX)}}).bind("mouseup",function(){d&&b.tablesorter.storage&&f&&(d[j.index()]=j.width(),b.tablesorter.storage(a,"tablesorter-resizable",d));h();return!1}).find(".tablesorter-resizer").bind("mousedown",function(a){f=b(a.target).closest("th");j=f.prev();i=a.pageX});b(a).find("thead").bind("mouseup mouseleave",function(){h()})}}});
+b.tablesorter.addWidget({id:"saveSort",init:function(a,b,d){d.format(a,!0)},format:function(a,e){var d,c,g=a.config;d={sortList:g.sortList};g.debug&&(c=new Date);b(a).hasClass("hasSaveSort")? a.hasInitialized&&b.tablesorter.storage&&(b.tablesorter.storage(a,"tablesorter-savesort",d),g.debug&&b.tablesorter.benchmark("saveSort widget: Saving last sort: "+g.sortList,c)):(b(a).addClass("hasSaveSort"),d="",b.tablesorter.storage&&(d=(d=b.tablesorter.storage(a,"tablesorter-savesort"))&&d.hasOwnProperty("sortList")&&b.isArray(d.sortList)?d.sortList:"",g.debug&&b.tablesorter.benchmark("saveSort: Last sort loaded: "+d,c)),e&&d&&0<d.length?g.sortList=d:a.hasInitialized&&d&&0<d.length&&b(a).trigger("sorton",[d]))}})
})(jQuery);
View
4 package.json
@@ -1,6 +1,6 @@
-{
+{
"name": "tablesorter",
- "version": "2.1.18",
+ "version": "2.1.19",
"title": "tablesorter",
"author": {
"name": "Christian Bach",
Please sign in to comment.
Something went wrong with that request. Please try again.