Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

minified version works again & lots of other fixes

  • Loading branch information...
commit d24ccca7d0a3df15283b8a5e3cd04819db53fb7b 1 parent 5d0224d
@Mottie authored
View
BIN  README.markdown
Binary file not shown
View
44 docs/index.html
@@ -553,6 +553,14 @@
});
});</pre>
+ Individual columns can be modified by adding the following, set in order of priority <span class="tip"><em>Modified!</em></span> v2.3.1:
+ <ul>
+ <li>jQuery data <code class="hilight">data-dateFormat="mmddyyyy"</code>.</li>
+ <li>metadata <code class="hilight">class="{ dateFormat: 'mmddyyyy'}"</code>. This requires the metadata plugin.</li>
+ <li>headers option <code class="hilight">headers : { 0 : { dateFormat : 'mmddyyyy' } }</code>.</li>
+ <li>header class name <code class="hilight">class="dateFormat-mmddyyyy"</code>.</li>
+ <li>Overall <code class="hilight">dateFormat</code> option.</li>
+ </ul>
</div>
</td>
<td><a href="example-option-date-format.html">Example</a></td>
@@ -632,12 +640,12 @@
0: { sorter: false },
// See example 2: Sort column numerically &amp; treat any text as if its value is:
- 1: { sorter: "digit" }, // zero
- 2: { sorter: "digit", string: "max+" }, // maximum positive value
- 3: { sorter: "digit", string: "max-" }, // maximum negative value
+ 1: { sorter: "digit", empty: "top" }, // zero; sort empty cells to the top
+ 2: { sorter: "digit", string: "max" }, // maximum positive value
+ 3: { sorter: "digit", string: "min" }, // maximum negative value
- // Sort the fifth column by date (e.g. mm/dd/yyyy if the date format is "us")
- 4: { sorter: "shortDate" },
+ // Sort the fifth column by date &amp; set the format
+ 4: { sorter: "shortDate", dateFormat: "yyyymmdd" } // year first format
// See example 3: lock the sort order
// this option will not work if added as metadata
@@ -773,7 +781,13 @@
<td>Use to add an initial sort to the table.
<div class="collapsible">
<br>
- The value contains an array of instructions for per-column sorting and direction in the format: <code class="hilight">[[columnIndex, sortDirection], ... ]</code> where columnIndex is a zero-based index for your columns left-to-right and sortDirection is 0 for Ascending and 1 for Descending. A valid argument that sorts ascending first by column 1 and then column 2 looks like: <code class="hilight">[[0,0],[1,0]]</code>. Please see <a href="#sortforce"><code class="hilight">sortForce</code></a> for more details on other sort order options.
+ The value contains an array of instructions for per-column sorting and direction in the format: <code class="hilight">[[columnIndex, sortDirection], ... ]</code> where columnIndex is a zero-based index for your columns left-to-right and sortDirection is 0 for Ascending and 1 for Descending. A valid argument that sorts ascending first by column 1 and then column 2 looks like: <code class="hilight">[[0,0],[1,0]]</code>. Please see <a href="#sortforce"><code class="hilight">sortForce</code></a> for more details on other sort order options.<br>
+ <br>
+ This option can also be set using jQuery data (<span class="tip"><em>New!</em></span> v2.3.1) or metadata on the table:
+ <table class="info"><tbody>
+ <tr><th>jQuery data</th><td><code>&lt;table data-sortlist="[[0,0],[4,0]]"&gt;</code></td></tr>
+ <tr><th>Meta data</th><td><code>&lt;table class="tablesorter {sortlist: [[0,0],[4,0]]}"&gt;</code></td></tr>
+ </tbody></table>
</div>
</td>
<td><a href="example-option-sort-list.html">Example</a></td>
@@ -795,12 +809,24 @@
</tr>
<tr id="sortinitialorder">
- <td><span class="permalink">sortInitialOrder</span></td>
+ <td><a href="#" class="toggle2">sortInitialOrder</a></td>
<td>String</td>
<td>"asc"</td>
<td>
- When clicking the header for the first time, the direction it sorts. Valid arguments are <code class="hilight">"asc"</code> for Ascending or <code class="hilight">"desc"</code> for Descending.<br>
- This order can also be set by desired column using the <a href="#headers"><code class="hilight">headers</code></a> option (Added in v2.0.8).
+ The direction a column sorts when clicking the header for the first time. Valid arguments are <code class="hilight">"asc"</code> for Ascending or <code class="hilight">"desc"</code> for Descending.<br>
+ <div class="collapsible">
+ <br>
+ This order can also be set by desired column using the <a href="#headers"><code class="hilight">headers</code></a> option (Added in v2.0.8).<br>
+ <br>
+ Individual columns can be modified by adding the following, set in order of priority <span class="tip"><em>Modified!</em></span> v2.3.1:
+ <ul>
+ <li>jQuery data <code class="hilight">data-sortInitialOrder="asc"</code>.</li>
+ <li>metadata <code class="hilight">class="{ sortInitialOrder: 'asc'}"</code>. This requires the metadata plugin.</li>
+ <li>headers option <code class="hilight">headers : { 0 : { sortInitialOrder : 'asc' } }</code>.</li>
+ <li>header class name <code class="hilight">class="sortInitialOrder-asc"</code>.</li>
+ <li>Overall <code class="hilight">sortInitialOrder</code> option.</li>
+ </ul>
+ </div>
</td>
<td>Ex:<a href="example-option-sort-order.html">1</a> <a href="example-options-headers-order.html">2</a></td>
</tr>
View
118 js/jquery.tablesorter.js
@@ -1,5 +1,5 @@
/*!
-* TableSorter 2.3 - Client-side table sorting with ease!
+* TableSorter 2.3.1 - Client-side table sorting with ease!
* @requires jQuery v1.2.6+
*
* Copyright (c) 2007 Christian Bach
@@ -18,9 +18,9 @@
$.extend({
tablesorter: new function() {
- this.version = "2.3";
+ this.version = "2.3.1";
- var parsers = [], widgets = [];
+ var parsers = [], widgets = [];
this.defaults = {
// appearance
@@ -156,29 +156,9 @@
return parsers[0];
}
- // get sorter, string and empty options for each column from
- // metadata, header option or header class name ("sorter-false")
- // priority = jQuery data > meta > headers option > header class name
- function getData(h, ch, key) {
- var val = '',
- m = $.metadata ? h.metadata() : false,
- cl = h.attr('class') || '';
- if (h.data() && typeof h.data(key) !== 'undefined'){
- val += h.data(key);
- } else if (m && m[key]) {
- val = m[key];
- } else if (ch && ch[key]) {
- val = ch[key];
- } else if (cl && cl.match(key + '-')) {
- // include sorter class name "sorter-text", etc
- val = cl.match( new RegExp(key + '-(\\w+)') )[1] || '';
- }
- return $.trim(val);
- }
-
function buildParserCache(table, $headers) {
if (table.tBodies.length === 0) { return; } // In the case of empty tables
- var c = table.config, rows = table.tBodies[0].rows,
+ var c = table.config, rows = table.tBodies[0].rows, ts = $.tablesorter,
list, l, i, h, m, ch, cl, p, parsersDebug = "";
if (rows[0]) {
list = [];
@@ -187,11 +167,11 @@
h = $headers.filter(':not([colspan])[data-column="'+i+'"]:last');
ch = c.headers[i];
// get column parser
- p = getParserById( getData(h, ch, 'sorter') );
+ p = getParserById( ts.getData(h, ch, 'sorter') );
// empty cells behaviour - keeping emptyToBottom for backwards compatibility.
- c.empties[i] = getData(h, ch, 'empty') || c.emptyTo || (c.emptyToBottom ? 'bottom' : 'top' );
+ c.empties[i] = ts.getData(h, ch, 'empty') || c.emptyTo || (c.emptyToBottom ? 'bottom' : 'top' );
// text strings behaviour in numerical sorts
- c.strings[i] = getData(h, ch, 'string') || c.stringTo || 'max';
+ c.strings[i] = ts.getData(h, ch, 'string') || c.stringTo || 'max';
if (!p) {
p = detectParserForColumn(table, rows, -1, i);
}
@@ -382,8 +362,8 @@
function buildHeaders(table) {
var meta = ($.metadata) ? true : false,
- header_index = computeTableHeaderCellIndexes(table),
- $th, lock, time, $tableHeaders, c = table.config;
+ header_index = computeTableHeaderCellIndexes(table), ch, $t,
+ $th, lock, time, $tableHeaders, c = table.config, ts = $.tablesorter;
c.headerList = [];
if (c.debug) {
time = new Date();
@@ -391,22 +371,24 @@
$tableHeaders = $(c.selectorHeaders, table)
.wrapInner("<div class='tablesorter-header-inner' />")
.each(function(index) {
+ $t = $(this);
+ ch = c.headers[index];
this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex];
- this.order = formatSortingOrder( (c.headers[index] && c.headers[index].sortInitialOrder) ? c.headers[index].sortInitialOrder : c.sortInitialOrder ) ? [1,0,2] : [0,1,2];
+ this.order = formatSortingOrder( ts.getData($t, ch, 'sortInitialOrder') || c.sortInitialOrder ) ? [1,0,2] : [0,1,2];
this.count = -1; // set to -1 because clicking on the header automatically adds one
- if (getData($(this), c.headers[index], 'sorter') === 'false') { this.sortDisabled = true; }
+ if (ts.getData($t, ch, 'sorter') === 'false') { this.sortDisabled = true; }
this.lockedOrder = false;
- lock = (c.headers[index] && c.headers[index].lockedOrder !== null) ? c.headers[index].lockedOrder : false;
+ lock = ts.getData($t, ch, 'lockedOrder') || false;
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);
+ $th = $t.addClass(c.cssHeader);
if (c.onRenderHeader) { c.onRenderHeader.apply($th, [index]); }
}
// add cell to headerList
c.headerList[index] = this;
- $(this).parent().addClass(c.cssHeader);
+ $t.parent().addClass(c.cssHeader);
});
if (c.debug) {
benchmark("Built headers", time);
@@ -612,7 +594,8 @@
if (!this.tHead || this.tBodies.length === 0) { return; }
// declare
var $headers, $cell, totalRows, $this,
- config, c, i, j, k, a, s, o;
+ config, c, i, j, k, a, s, o,
+ m = $.metadata;
// new blank config object
this.config = {};
// merge and extend.
@@ -799,9 +782,11 @@
applyWidget(this);
});
- // get sort list from metadata
- if ($.metadata && ($(this).metadata() && $(this).metadata().sortlist)) {
- c.sortList = $(this).metadata().sortlist;
+ // get sort list from jQuery data or metadata
+ if ($this.data() && typeof $this.data().sortlist !== 'undefined') {
+ c.sortList = $this.data().sortlist;
+ } else if (m && ($this.metadata() && $this.metadata().sortlist)) {
+ c.sortList = $this.metadata().sortlist;
}
// apply widget init code
applyWidget(this, true);
@@ -834,8 +819,9 @@
this.addWidget = function(widget) {
widgets.push(widget);
};
+
this.formatFloat = function(s, table) {
- if (typeof(s) !== 'string') { return s; }
+ if (typeof(s) !== 'string' || s === '') { return s; }
if (table.config.usNumberFormat !== false) {
// US Format - 1,234,567.89 -> 1234567.89
s = s.replace(/,/g,'');
@@ -855,6 +841,7 @@
// replace all unwanted chars and match.
return (/^[\-+(]?\d*[)]?$/).test($.trim(s.replace(/[,.'\s]/g, '')));
};
+
// regex used in natural sort
this.regex = [
/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi, // chunk/tokenize numbers & letters
@@ -889,6 +876,27 @@
}
return s;
};
+
+ // get sorter, string, empty, etc options for each column from
+ // metadata, header option or header class name ("sorter-false")
+ // priority = jQuery data > meta > headers option > header class name
+ this.getData = function(h, ch, key) {
+ var val = '',
+ m = $.metadata ? h.metadata() : false,
+ cl = h.attr('class') || '';
+ if (h.data() && typeof h.data(key) !== 'undefined'){
+ val += h.data(key);
+ } else if (m && typeof m[key] !== 'undefined') {
+ val += m[key];
+ } else if (ch && typeof ch[key] !== 'undefined') {
+ val += ch[key];
+ } else if (cl && cl.match(key + '-')) {
+ // include sorter class name "sorter-text", etc
+ val = cl.match( new RegExp(key + '-(\\w+)') )[1] || '';
+ }
+ return $.trim(val);
+ };
+
this.clearTableBody = function(table) {
$(table.tBodies).filter(':not(.' + table.config.cssInfoBlock + ')').empty();
};
@@ -896,14 +904,14 @@
}
})();
+ // make shortcut
+ var ts = $.tablesorter;
+
// extend plugin scope
$.fn.extend({
- tablesorter: $.tablesorter.construct
+ tablesorter: ts.construct
});
- // make shortcut
- var ts = $.tablesorter;
-
// add default parsers
ts.addParser({
id: "text",
@@ -913,7 +921,7 @@
format: function(s, table, cell, cellIndex) {
var c = table.config;
s = $.trim( c.ignoreCase ? s.toLocaleLowerCase() : s );
- return c.sortLocaleCompare ? $.tablesorter.replaceAccents(s) : s;
+ return c.sortLocaleCompare ? ts.replaceAccents(s) : s;
},
type: "text"
});
@@ -924,7 +932,7 @@
return (/^\(?[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]/).test(s); // #$ $%"?.
},
format: function(s, table) {
- return $.tablesorter.formatFloat(s.replace(/[^\w,. \-()]/g, ""), table);
+ return ts.formatFloat(s.replace(/[^\w,. \-()]/g, ""), table);
},
type: "numeric"
});
@@ -946,7 +954,7 @@
r += item;
}
}
- return $.tablesorter.formatFloat(r, table);
+ return ts.formatFloat(r, table);
},
type: "numeric"
});
@@ -968,7 +976,7 @@
return (/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/).test(s);
},
format: function(s, table) {
- return $.tablesorter.formatFloat((s !== "") ? new Date(s.replace(/-/g, "/")).getTime() : "", table);
+ return ts.formatFloat((s !== "") ? (new Date(s.replace(/-/g, "/")).getTime() || "") : "", table);
},
type: "numeric"
});
@@ -979,7 +987,7 @@
return (/\%\)?$/).test($.trim(s));
},
format: function(s, table) {
- return $.tablesorter.formatFloat(s.replace(/%/g, ""), table);
+ return ts.formatFloat(s.replace(/%/g, ""), table);
},
type: "numeric"
});
@@ -990,7 +998,7 @@
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, table) {
- return $.tablesorter.formatFloat(new Date(s).getTime(), table);
+ return ts.formatFloat( (new Date(s).getTime() || ''), table);
},
type: "numeric"
});
@@ -1003,7 +1011,7 @@
},
format: function(s, table, cell, cellIndex) {
var c = table.config,
- format = (c.headers && c.headers[cellIndex]) ? c.headers[cellIndex].dateFormat || c.dateFormat : c.dateFormat; // get dateFormat from header or config
+ format = ts.getData($(cell), c.headers[cellIndex], '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");
@@ -1012,7 +1020,7 @@
} 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(), table);
+ return ts.formatFloat( (new Date(s).getTime() || ''), table);
},
type: "numeric"
});
@@ -1023,7 +1031,7 @@
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, table) {
- return $.tablesorter.formatFloat(new Date("2000/01/01 " + s).getTime(), table);
+ return ts.formatFloat( (new Date("2000/01/01 " + s).getTime() || ''), table);
},
type: "numeric"
});
@@ -1031,10 +1039,10 @@
ts.addParser({
id: "digit",
is: function(s) {
- return $.tablesorter.isDigit(s);
+ return ts.isDigit(s);
},
format: function(s, table) {
- return $.tablesorter.formatFloat(s.replace(/[^\w,. \-()]/g, ""), table);
+ return ts.formatFloat(s.replace(/[^\w,. \-()]/g, ""), table);
},
type: "numeric"
});
@@ -1084,7 +1092,7 @@
}
}
if (c.debug) {
- $.tablesorter.benchmark("Applying Zebra widget", time);
+ ts.benchmark("Applying Zebra widget", time);
}
}
});
View
6 js/jquery.tablesorter.min.js
@@ -1,6 +1,6 @@
/*!
-* TableSorter 2.3 - Client-side table sorting with ease!
-* Minified using http://dean.edwards.name/packer/
+* TableSorter 2.3.1 - Client-side table sorting with ease!
+* Minified using UglifyJS (http://jscompress.com/)
* Copyright (c) 2007 Christian Bach
*/
-!(function($){$.extend({tablesorter:new function(){this.version="2.3";var q=[],widgets=[];this.defaults={widthFixed:false,cancelSelection:true,dateFormat:"mmddyyyy",sortMultiSortKey:"shiftKey",usNumberFormat:true,delayInit:false,headers:{},ignoreCase:true,sortForce:null,sortList:[],sortAppend:null,sortInitialOrder:"asc",sortLocaleCompare:false,sortReset:false,sortRestart:false,emptyTo:"bottom",stringTo:"max",textExtraction:"simple",textSorter:null,widgetOptions:{zebra:["even","odd"]},initialized:null,onRenderHeader:null,tableClass:'tablesorter',cssAsc:"tablesorter-headerSortUp",cssChildRow:"expand-child",cssDesc:"tablesorter-headerSortDown",cssHeader:"tablesorter-header",cssInfoBlock:"tablesorter-infoOnly",selectorHeaders:'> thead th',selectorRemove:"tr.remove-me",debug:false,headerList:[],empties:{},strings:{},parsers:[],widgets:[]};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="",t=a.config.textExtraction;if(!b){return""}if(t==="simple"){d=$(b).text()}else{if(typeof(t)==="function"){d=t(b,a,c)}else if(typeof(t)==="object"&&t.hasOwnProperty(c)){d=t[c](b,a,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 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=$.trim(getElementText(a,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(h,a,b){var c='',m=$.metadata?h.metadata():false,cl=h.attr('class')||'';if(h.data()&&typeof h.data(b)!=='undefined'){c+=h.data(b)}else if(m&&m[b]){c=m[b]}else if(a&&a[b]){c=a[b]}else if(cl&&cl.match(b+'-')){c=cl.match(new RegExp(b+'-(\\w+)'))[1]||''}return $.trim(c)}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.filter(':not([colspan])[data-column="'+i+'"]:last');ch=c.headers[i];p=getParserById(getData(h,ch,'sorter'));c.empties[i]=getData(h,ch,'empty')||c.emptyTo||(c.emptyToBottom?'bottom':'top');c.strings[i]=getData(h,ch,'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 buildRegex(){var a,acc='[',t=$.tablesorter,reg=t.characterEquivalents;t.characterRegexArray={};for(a in reg){if(typeof a==='string'){acc+=reg[a];t.characterRegexArray[a]=new RegExp('['+reg[a]+']','g')}}t.characterRegex=new RegExp(acc+']')}function buildCache(a){var b=a.tBodies,tc=a.config,totalRows,totalCells,q=tc.parsers,t,i,j,k,c,cols,cacheTime;tc.cache={};if(tc.debug){cacheTime=new Date()}for(k=0;k<b.length;k++){tc.cache[k]={row:[],normalized:[]};if(!$(b[k]).hasClass(tc.cssInfoBlock)){totalRows=(b[k]&&b[k].rows.length)||0;totalCells=(b[k].rows[0]&&b[k].rows[0].cells.length)||0;for(i=0;i<totalRows;++i){c=$(b[k].rows[i]);cols=[];if(c.hasClass(tc.cssChildRow)){tc.cache[k].row[tc.cache[k].row.length-1]=tc.cache[k].row[tc.cache[k].row.length-1].add(c);continue}tc.cache[k].row.push(c);for(j=0;j<totalCells;++j){t=$.trim(getElementText(a,c[0].cells[j],j));cols.push(q[j].format(t,a,c[0].cells[j],j))}cols.push(tc.cache[k].normalized.length);tc.cache[k].normalized.push(cols)}}}if(tc.debug){benchmark("Building cache for "+totalRows+" rows",cacheTime)}}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){var c=a.config,b=a.tBodies,rows=[],r,n,totalRows,checkCell,f,i,j,k,l,pos,appendTime;if(c.debug){appendTime=new Date()}for(k=0;k<b.length;k++){if(!$(b[k]).hasClass(c.cssInfoBlock)){f=document.createDocumentFragment();r=c.cache[k].row;n=c.cache[k].normalized;totalRows=n.length;checkCell=totalRows?(n[0].length-1):0;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++){f.appendChild(r[pos][j])}}}a.tBodies[k].appendChild(f)}}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={},trs=$(t).find('thead:eq(0) 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;$(c).attr({'data-column':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 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((c.headers[a]&&c.headers[a].sortInitialOrder)?c.headers[a].sortInitialOrder:c.sortInitialOrder)?[1,0,2]:[0,1,2];this.count=-1;if(getData($(this),c.headers[a],'sorter')==='false'){this.sortDisabled=true}this.lockedOrder=false;lock=(c.headers[a]&&c.headers[a].lockedOrder!==null)?c.headers[a].lockedOrder:false;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 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 f,h=[],i,j,l,css=[a.config.cssDesc,a.config.cssAsc];b.removeClass(css.join(' ')).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]]);f=b.filter('[data-column="'+c[i][0]+'"]');if(l>1&&f.length){for(j=0;j<f.length;j++){if(!f[j].sortDisabled){$(f[j]).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){var d,col,mx=0,dir=0,tc=a.config,l=b.length,bl=a.tBodies.length,sortTime,i,j,k,c,cache,lc,s,e,order,orgOrderCol;if(tc.debug){sortTime=new Date()}for(k=0;k<bl;k++){d="var sortWrapper = function(a,b) {";cache=tc.cache[k];lc=cache.normalized.length;for(i=0;i<l;i++){c=b[i][0];order=b[i][1];s=/n/i.test(getCachedSortType(tc.parsers,c))?"Numeric":"Text";s+=order===0?"":"Desc";e="e"+i;if(/Numeric/.test(s)&&tc.strings[c]){for(j=0;j<lc;j++){col=Math.abs(parseFloat(cache.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}}d+="var "+e+" = sort"+s+"(table, a["+c+"],b["+c+"],"+c+","+mx+","+dir+"); ";d+="if ("+e+") { return "+e+"; } ";d+="else { "}orgOrderCol=(cache.normalized&&cache.normalized[0])?cache.normalized[0].length-1:0;d+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(i=0;i<l;i++){d+="}; "}d+="return 0; ";d+="}; ";eval(d);cache.normalized.sort(sortWrapper)}if(tc.debug){benchmark("Sorting on "+b.toString()+" and dir "+order+" time",sortTime)}}function sortText(d,a,b,f){if(a===b){return 0}var c=d.config,e=c.string[(c.empties[f]||c.emptyTo)],r=$.tablesorter.regex,xN,xD,yN,yD,xF,yF,i,mx;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(typeof c.textSorter==='function'){return c.textSorter(a,b)}xN=a.replace(r[0],'\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0');yN=b.replace(r[0],'\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0');xD=parseInt(a.match(r[2]))||(xN.length!==1&&a.match(r[1])&&Date.parse(a));yD=parseInt(b.match(r[2]))||(xD&&b.match(r[1])&&Date.parse(b))||null;if(yD){if(xD<yD){return-1}if(xD>yD){return 1}}mx=Math.max(xN.length,yN.length);for(i=0;i<mx;i++){xF=(!(xN[i]||'').match(r[3])&&parseFloat(xN[i]))||xN[i]||0;yF=(!(yN[i]||'').match(r[3])&&parseFloat(yN[i]))||yN[i]||0;if(isNaN(xF)!==isNaN(yF)){return(isNaN(xF))?1:-1}if(typeof xF!==typeof yF){xF+='';yF+=''}if(xF<yF){return-1}if(xF>yF){return 1}}return 0}function sortTextDesc(d,a,b,f){if(a===b){return 0}var c=d.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(typeof c.textSorter==='function'){return c.textSorter(b,a)}return sortText(d,b,a)}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(f,a,b,g,h,d){if(a===b){return 0}var c=f.config,e=c.string[(c.empties[g]||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,h,d)}if(isNaN(b)){b=getTextValue(b,h,d)}return a-b}function sortNumericDesc(f,a,b,g,h,d){if(a===b){return 0}var c=f.config,e=c.string[(c.empties[g]||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,h,d)}if(isNaN(b)){b=getTextValue(b,h,d)}return b-a}this.construct=function(f){return this.each(function(){if(!this.tHead||this.tBodies.length===0){return}var d,$cell,totalRows,$this,config,c,i,j,k,a,s,o;this.config={};c=config=$.extend(true,this.config,$.tablesorter.defaults,f);$this=$(this).addClass(c.tableClass);$.data(this,"tablesorter",c);buildRegex();c.string={'max':1,'min':-1,'max+':1,'max-':-1,'zero':0,'none':0,'null':0,'top':true,'bottom':false};d=buildHeaders(this);c.parsers=buildParserCache(this,d);if(!c.delayInit){buildCache(this)}fixColumnWidth(this);d.click(function(e){if(c.delayInit&&!c.cache){buildCache($this[0])}if(!this.sortDisabled){$this.trigger("sortStart",$this[0]);$cell=$(this);k=!e[c.sortMultiSortKey];this.count=(this.count+1)%(c.sortReset?3:2);if(c.sortRestart){i=this;d.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])}}}o=this.order[this.count];if(o<2){c.sortList.push([i,o]);if(this.colSpan>1){for(j=1;j<this.colSpan;j++){c.sortList.push([i+j,o])}}}}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{o=this.order[this.count];if(o<2){c.sortList.push([i,o]);if(this.colSpan>1){for(j=1;j<this.colSpan;j++){c.sortList.push([i+j,o])}}}}}if(c.sortAppend!==null){a=c.sortAppend;for(j=0;j<a.length;j++){if(a[j][0]!==i){c.sortList.push(a[j])}}}$this.trigger("sortBegin",$this[0]);setHeadersCss($this[0],d,c.sortList);appendToTable($this[0],multisort($this[0],c.sortList));return false}}).mousedown(function(){if(c.cancelSelection){this.onselectstart=function(){return false};return false}});$this.bind("update",function(e,a){$(c.selectorRemove,this).remove();c.parsers=buildParserCache(this,d);buildCache(this);if(a!==false){$(this).trigger("sorton",[c.sortList])}}).bind("updateCell",function(e,a,b){var t=this,pos=[(a.parentNode.rowIndex-1),a.cellIndex],tbdy=$(this).find('tbody').index($(a).closest('tbody'));t.config.cache[tbdy].normalized[pos[0]][pos[1]]=c.parsers[pos[1]].format(getElementText(t,a,pos[1]),t,a,pos[1]);if(b!==false){$(this).trigger("sorton",[c.sortList])}}).bind("addRows",function(e,a,b){var i,rows=a.filter('tr').length,dat=[],l=a[0].cells.length,t=this,tbdy=$(this).find('tbody').index(a.closest('tbody'));for(i=0;i<rows;i++){for(j=0;j<l;j++){dat[j]=c.parsers[j].format(getElementText(t,a[i].cells[j],j),t,a[i].cells[j],j)}dat.push(c.cache[tbdy].row.length);c.cache[tbdy].row.push([a[i]]);c.cache[tbdy].normalized.push(dat);dat=[]}if(b!==false){$(this).trigger("sorton",[c.sortList])}}).bind("sorton",function(e,a){$(this).trigger("sortStart",this);c.sortList=a;updateHeaderSortCount(this,c.sortList);setHeadersCss(this,d,c.sortList);appendToTable(this,multisort(this,c.sortList))}).bind("appendCache",function(){appendToTable(this)}).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){$this.trigger("sorton",[c.sortList])}else{applyWidget(this)}this.hasInitialized=true;$this.trigger('tablesorter-initialized',this);if(typeof c.initialized==='function'){c.initialized(this)}})};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,a){if(typeof(s)!=='string'){return s}if(a.config.usNumberFormat!==false){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.regex=[/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/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,/^0/];this.characterEquivalents={"a":"\u00e1\u00e0\u00e2\u00e3\u00e4","A":"\u00c1\u00c0\u00c2\u00c3\u00c4","c":"\u00e7","C":"\u00c7","e":"\u00e9\u00e8\u00ea\u00eb","E":"\u00c9\u00c8\u00ca\u00cb","i":"\u00ed\u00ec\u0130\u00ee\u00ef","I":"\u00cd\u00cc\u0130\u00ce\u00cf","o":"\u00f3\u00f2\u00f4\u00f5\u00f6","O":"\u00d3\u00d2\u00d4\u00d5\u00d6","S":"\u00df","u":"\u00fa\u00f9\u00fb\u00fc","U":"\u00da\u00d9\u00db\u00dc"};this.replaceAccents=function(s){if(this.characterRegex.test(s)){var a,eq=this.characterEquivalents;for(a in eq){if(typeof a==='string'){s=s.replace(this.characterRegexArray[a],a)}}}return s};this.clearTableBody=function(a){$(a.tBodies).filter(':not(.'+a.config.cssInfoBlock+')').empty()}}})();$.fn.extend({tablesorter:$.tablesorter.construct});var u=$.tablesorter;u.addParser({id:"text",is:function(s,a,b){return true},format:function(s,a,b,d){var c=a.config;s=$.trim(c.ignoreCase?s.toLocaleLowerCase():s);return c.sortLocaleCompare?$.tablesorter.replaceAccents(s):s},type:"text"});u.addParser({id:"currency",is:function(s){return(/^\(?[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]/).test(s)},format:function(s,a){return $.tablesorter.formatFloat(s.replace(/[^\w,. \-()]/g,""),a)},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,b){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,b)},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,a){return $.tablesorter.formatFloat((s!=="")?new Date(s.replace(/-/g,"/")).getTime():"",a)},type:"numeric"});u.addParser({id:"percent",is:function(s){return(/\%\)?$/).test($.trim(s))},format:function(s,a){return $.tablesorter.formatFloat(s.replace(/%/g,""),a)},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,a){return $.tablesorter.formatFloat(new Date(s).getTime(),a)},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(),a)},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,a){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime(),a)},type:"numeric"});u.addParser({id:"digit",is:function(s){return $.tablesorter.isDigit(s)},format:function(s,a){return $.tablesorter.formatFloat(s.replace(/[^\w,. \-()]/g,""),a)},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 d,$r,row,even,time,k,c=a.config,child=c.cssChildRow,b=$(a).children('tbody:not('+c.cssInfoBlock+')'),css=["even","odd"];css=c.widgetZebra&&c.hasOwnProperty('css')?c.widgetZebra.css:(c.widgetOptions&&c.widgetOptions.hasOwnProperty('zebra'))?c.widgetOptions.zebra:css;if(c.debug){time=new Date()}for(k=0;k<b.length;k++){row=0;d=$(b[k]).children('tr:visible');if(d.length>1){d.each(function(){$r=$(this);if(!$r.hasClass(child)){row++}even=(row%2===0);$r.removeClass(css[even?1:0]).addClass(css[even?0:1])})}}if(c.debug){$.tablesorter.benchmark("Applying Zebra widget",time)}}})})(jQuery);
+!function($){$.extend({tablesorter:new function(){function log(a){if(typeof console!=="undefined"&&typeof console.log!=="undefined"){console.log(a)}else{alert(a)}}function benchmark(a,b){log(a+" ("+((new Date).getTime()-b.getTime())+"ms)")}function getElementText(a,b,c){var d="",e=a.config.textExtraction;if(!b){return""}if(e==="simple"){d=$(b).text()}else{if(typeof e==="function"){d=e(b,a,c)}else if(typeof e==="object"&&e.hasOwnProperty(c)){d=e[c](b,a,c)}else{d=$(b).text()}}return d}function getParserById(a){var b,c=parsers.length;for(b=0;b<c;b++){if(parsers[b].id.toLowerCase()===a.toString().toLowerCase()){return parsers[b]}}return false}function detectParserForColumn(a,b,c,d){var e,f=parsers.length,g=false,h="",i=true;while(h===""&&i){c++;if(b[c]){g=b[c].cells[d];h=$.trim(getElementText(a,g,d));if(a.config.debug){log("Checking if value was empty on row "+c+", column:"+d+": "+h)}}else{i=false}}for(e=1;e<f;e++){if(parsers[e].is(h,a,g)){return parsers[e]}}return parsers[0]}function buildParserCache(a,b){if(a.tBodies.length===0){return}var c=a.config,d=a.tBodies[0].rows,e=$.tablesorter,f,g,h,i,j,k,l,m,n="";if(d[0]){f=[];g=d[0].cells.length;for(h=0;h<g;h++){i=b.filter(':not([colspan])[data-column="'+h+'"]:last');k=c.headers[h];m=getParserById(e.getData(i,k,"sorter"));c.empties[h]=e.getData(i,k,"empty")||c.emptyTo||(c.emptyToBottom?"bottom":"top");c.strings[h]=e.getData(i,k,"string")||c.stringTo||"max";if(!m){m=detectParserForColumn(a,d,-1,h)}if(c.debug){n+="column:"+h+"; parser:"+m.id+"; string:"+c.strings[h]+"; empty: "+c.empties[h]+"\n"}f.push(m)}}if(c.debug){log(n)}return f}function buildRegex(){var a,b="[",c=$.tablesorter,d=c.characterEquivalents;c.characterRegexArray={};for(a in d){if(typeof a==="string"){b+=d[a];c.characterRegexArray[a]=new RegExp("["+d[a]+"]","g")}}c.characterRegex=new RegExp(b+"]")}function buildCache(a){var b=a.tBodies,c=a.config,d,e,f=c.parsers,g,h,i,j,k,l,m;c.cache={};if(c.debug){m=new Date}for(j=0;j<b.length;j++){c.cache[j]={row:[],normalized:[]};if(!$(b[j]).hasClass(c.cssInfoBlock)){d=b[j]&&b[j].rows.length||0;e=b[j].rows[0]&&b[j].rows[0].cells.length||0;for(h=0;h<d;++h){k=$(b[j].rows[h]);l=[];if(k.hasClass(c.cssChildRow)){c.cache[j].row[c.cache[j].row.length-1]=c.cache[j].row[c.cache[j].row.length-1].add(k);continue}c.cache[j].row.push(k);for(i=0;i<e;++i){g=$.trim(getElementText(a,k[0].cells[i],i));l.push(f[i].format(g,a,k[0].cells[i],i))}l.push(c.cache[j].normalized.length);c.cache[j].normalized.push(l)}}}if(c.debug){benchmark("Building cache for "+d+" rows",m)}}function getWidgetById(a){var b,c,d=widgets.length;for(b=0;b<d;b++){c=widgets[b];if(c&&c.hasOwnProperty("id")&&c.id.toLowerCase()===a.toLowerCase()){return c}}}function applyWidget(a,b){var c=a.config.widgets,d,e,f=c.length;for(d=0;d<f;d++){e=getWidgetById(c[d]);if(e){if(b&&e.hasOwnProperty("init")){e.init(a,widgets,e)}else if(!b&&e.hasOwnProperty("format")){e.format(a)}}}}function appendToTable(a){var b=a.config,c=a.tBodies,d=[],e,f,g,h,i,j,k,l,m,n,o;if(b.debug){o=new Date}for(l=0;l<c.length;l++){if(!$(c[l]).hasClass(b.cssInfoBlock)){i=document.createDocumentFragment();e=b.cache[l].row;f=b.cache[l].normalized;g=f.length;h=g?f[0].length-1:0;for(j=0;j<g;j++){n=f[j][h];d.push(e[n]);if(!b.appender||!b.removeRows){m=e[n].length;for(k=0;k<m;k++){i.appendChild(e[n][k])}}}a.tBodies[l].appendChild(i)}}if(b.appender){b.appender(a,d)}if(b.debug){benchmark("Rebuilt table",o)}applyWidget(a);$(a).trigger("sortEnd",a)}function computeTableHeaderCellIndexes(a){var b=[],c={},d=$(a).find("thead:eq(0) tr"),e,f,g,h,i,j,k,l,m,n,o,p;for(e=0;e<d.length;e++){j=d[e].cells;for(f=0;f<j.length;f++){i=j[f];k=i.parentNode.rowIndex;l=k+"-"+i.cellIndex;m=i.rowSpan||1;n=i.colSpan||1;if(typeof b[k]==="undefined"){b[k]=[]}for(g=0;g<b[k].length+1;g++){if(typeof b[k][g]==="undefined"){o=g;break}}c[l]=o;$(i).attr({"data-column":o});for(g=k;g<k+m;g++){if(typeof b[g]==="undefined"){b[g]=[]}p=b[g];for(h=o;h<o+n;h++){p[h]="x"}}}}return c}function formatSortingOrder(a){return/^d/i.test(a)||a===1}function buildHeaders(a){var b=$.metadata?true:false,c=computeTableHeaderCellIndexes(a),d,e,f,g,h,i,j=a.config,k=$.tablesorter;j.headerList=[];if(j.debug){h=new Date}i=$(j.selectorHeaders,a).wrapInner("<div class='tablesorter-header-inner' />").each(function(a){e=$(this);d=j.headers[a];this.column=c[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(k.getData(e,d,"sortInitialOrder")||j.sortInitialOrder)?[1,0,2]:[0,1,2];this.count=-1;if(k.getData(e,d,"sorter")==="false"){this.sortDisabled=true}this.lockedOrder=false;g=k.getData(e,d,"lockedOrder")||false;if(typeof g!=="undefined"&&g!==false){this.order=this.lockedOrder=formatSortingOrder(g)?[1,1,1]:[0,0,0]}if(!this.sortDisabled){f=e.addClass(j.cssHeader);if(j.onRenderHeader){j.onRenderHeader.apply(f,[a])}}j.headerList[a]=this;e.parent().addClass(j.cssHeader)});if(j.debug){benchmark("Built headers",h);log(i)}return i}function isValueInArray(a,b){var c,d=b.length;for(c=0;c<d;c++){if(b[c][0]===a){return true}}return false}function setHeadersCss(a,b,c){var d,e=[],f,g,h,i=[a.config.cssDesc,a.config.cssAsc];b.removeClass(i.join(" ")).each(function(){if(!this.sortDisabled){e[this.column]=$(this)}});h=c.length;for(f=0;f<h;f++){if(c[f][1]===2){continue}e[c[f][0]].addClass(i[c[f][1]]);d=b.filter('[data-column="'+c[f][0]+'"]');if(h>1&&d.length){for(g=0;g<d.length;g++){if(!d[g].sortDisabled){$(d[g]).addClass(i[c[f][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 c,d,e,f=a.config,g=b.length;for(c=0;c<g;c++){d=b[c];e=f.headerList[d[0]];e.count=d[1]%(f.sortReset?3:2)}}function getCachedSortType(a,b){return a?a[b].type:""}function multisort(table,sortList){var dynamicExp,col,mx=0,dir=0,tc=table.config,l=sortList.length,bl=table.tBodies.length,sortTime,i,j,k,c,cache,lc,s,e,order,orgOrderCol;if(tc.debug){sortTime=new Date}for(k=0;k<bl;k++){dynamicExp="var sortWrapper = function(a,b) {";cache=tc.cache[k];lc=cache.normalized.length;for(i=0;i<l;i++){c=sortList[i][0];order=sortList[i][1];s=/n/i.test(getCachedSortType(tc.parsers,c))?"Numeric":"Text";s+=order===0?"":"Desc";e="e"+i;if(/Numeric/.test(s)&&tc.strings[c]){for(j=0;j<lc;j++){col=Math.abs(parseFloat(cache.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}}dynamicExp+="var "+e+" = sort"+s+"(table, a["+c+"],b["+c+"],"+c+","+mx+","+dir+"); ";dynamicExp+="if ("+e+") { return "+e+"; } ";dynamicExp+="else { "}orgOrderCol=cache.normalized&&cache.normalized[0]?cache.normalized[0].length-1:0;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(i=0;i<l;i++){dynamicExp+="}; "}dynamicExp+="return 0; ";dynamicExp+="}; ";eval(dynamicExp);cache.normalized.sort(sortWrapper)}if(tc.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time",sortTime)}}function sortText(a,b,c,d){if(b===c){return 0}var e=a.config,f=e.string[e.empties[d]||e.emptyTo],g=$.tablesorter.regex,h,i,j,k,l,m,n,o;if(b===""&&f!==0){return typeof f==="boolean"?f?-1:1:-f||-1}if(c===""&&f!==0){return typeof f==="boolean"?f?1:-1:f||1}if(typeof e.textSorter==="function"){return e.textSorter(b,c)}h=b.replace(g[0],"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0");j=c.replace(g[0],"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0");i=parseInt(b.match(g[2]))||h.length!==1&&b.match(g[1])&&Date.parse(b);k=parseInt(c.match(g[2]))||i&&c.match(g[1])&&Date.parse(c)||null;if(k){if(i<k){return-1}if(i>k){return 1}}o=Math.max(h.length,j.length);for(n=0;n<o;n++){l=!(h[n]||"").match(g[3])&&parseFloat(h[n])||h[n]||0;m=!(j[n]||"").match(g[3])&&parseFloat(j[n])||j[n]||0;if(isNaN(l)!==isNaN(m)){return isNaN(l)?1:-1}if(typeof l!==typeof m){l+="";m+=""}if(l<m){return-1}if(l>m){return 1}}return 0}function sortTextDesc(a,b,c,d){if(b===c){return 0}var e=a.config,f=e.string[e.empties[d]||e.emptyTo];if(b===""&&f!==0){return typeof f==="boolean"?f?-1:1:f||1}if(c===""&&f!==0){return typeof f==="boolean"?f?1:-1:-f||-1}if(typeof e.textSorter==="function"){return e.textSorter(c,b)}return sortText(a,c,b)}function getTextValue(a,b,c){if(b){var d,e=a.length,f=b+c;for(d=0;d<e;d++){f+=a.charCodeAt(d)}return c*f}return 0}function sortNumeric(a,b,c,d,e,f){if(b===c){return 0}var g=a.config,h=g.string[g.empties[d]||g.emptyTo];if(b===""&&h!==0){return typeof h==="boolean"?h?-1:1:-h||-1}if(c===""&&h!==0){return typeof h==="boolean"?h?1:-1:h||1}if(isNaN(b)){b=getTextValue(b,e,f)}if(isNaN(c)){c=getTextValue(c,e,f)}return b-c}function sortNumericDesc(a,b,c,d,e,f){if(b===c){return 0}var g=a.config,h=g.string[g.empties[d]||g.emptyTo];if(b===""&&h!==0){return typeof h==="boolean"?h?-1:1:h||1}if(c===""&&h!==0){return typeof h==="boolean"?h?1:-1:-h||-1}if(isNaN(b)){b=getTextValue(b,e,f)}if(isNaN(c)){c=getTextValue(c,e,f)}return c-b}this.version="2.3.1";var parsers=[],widgets=[];this.defaults={widthFixed:false,cancelSelection:true,dateFormat:"mmddyyyy",sortMultiSortKey:"shiftKey",usNumberFormat:true,delayInit:false,headers:{},ignoreCase:true,sortForce:null,sortList:[],sortAppend:null,sortInitialOrder:"asc",sortLocaleCompare:false,sortReset:false,sortRestart:false,emptyTo:"bottom",stringTo:"max",textExtraction:"simple",textSorter:null,widgetOptions:{zebra:["even","odd"]},initialized:null,onRenderHeader:null,tableClass:"tablesorter",cssAsc:"tablesorter-headerSortUp",cssChildRow:"expand-child",cssDesc:"tablesorter-headerSortDown",cssHeader:"tablesorter-header",cssInfoBlock:"tablesorter-infoOnly",selectorHeaders:"> thead th",selectorRemove:"tr.remove-me",debug:false,headerList:[],empties:{},strings:{},parsers:[],widgets:[]};this.benchmark=benchmark;this.hasInitialized=false;this.construct=function(a){return this.each(function(){if(!this.tHead||this.tBodies.length===0){return}var b,c,d,e,f,g,h,i,j,k,l,m,n=$.metadata;this.config={};g=f=$.extend(true,this.config,$.tablesorter.defaults,a);e=$(this).addClass(g.tableClass);$.data(this,"tablesorter",g);buildRegex();g.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:true,bottom:false};b=buildHeaders(this);g.parsers=buildParserCache(this,b);if(!g.delayInit){buildCache(this)}fixColumnWidth(this);b.click(function(a){if(g.delayInit&&!g.cache){buildCache(e[0])}if(!this.sortDisabled){e.trigger("sortStart",e[0]);c=$(this);j=!a[g.sortMultiSortKey];this.count=(this.count+1)%(g.sortReset?3:2);if(g.sortRestart){h=this;b.each(function(){if(this!==h&&(j||!$(this).is("."+g.cssDesc+",."+g.cssAsc))){this.count=-1}})}h=this.column;if(j){g.sortList=[];if(g.sortForce!==null){k=g.sortForce;for(i=0;i<k.length;i++){if(k[i][0]!==h){g.sortList.push(k[i])}}}m=this.order[this.count];if(m<2){g.sortList.push([h,m]);if(this.colSpan>1){for(i=1;i<this.colSpan;i++){g.sortList.push([h+i,m])}}}}else{if(isValueInArray(h,g.sortList)){for(i=0;i<g.sortList.length;i++){l=g.sortList[i];m=g.headerList[l[0]];if(l[0]===h){l[1]=m.order[m.count];if(l[1]===2){g.sortList.splice(i,1);m.count=-1}}}}else{m=this.order[this.count];if(m<2){g.sortList.push([h,m]);if(this.colSpan>1){for(i=1;i<this.colSpan;i++){g.sortList.push([h+i,m])}}}}}if(g.sortAppend!==null){k=g.sortAppend;for(i=0;i<k.length;i++){if(k[i][0]!==h){g.sortList.push(k[i])}}}e.trigger("sortBegin",e[0]);setHeadersCss(e[0],b,g.sortList);appendToTable(e[0],multisort(e[0],g.sortList));return false}}).mousedown(function(){if(g.cancelSelection){this.onselectstart=function(){return false};return false}});e.bind("update",function(a,c){$(g.selectorRemove,this).remove();g.parsers=buildParserCache(this,b);buildCache(this);if(c!==false){$(this).trigger("sorton",[g.sortList])}}).bind("updateCell",function(a,b,c){var d=this,e=[b.parentNode.rowIndex-1,b.cellIndex],f=$(this).find("tbody").index($(b).closest("tbody"));d.config.cache[f].normalized[e[0]][e[1]]=g.parsers[e[1]].format(getElementText(d,b,e[1]),d,b,e[1]);if(c!==false){$(this).trigger("sorton",[g.sortList])}}).bind("addRows",function(a,b,c){var d,e=b.filter("tr").length,f=[],h=b[0].cells.length,j=this,k=$(this).find("tbody").index(b.closest("tbody"));for(d=0;d<e;d++){for(i=0;i<h;i++){f[i]=g.parsers[i].format(getElementText(j,b[d].cells[i],i),j,b[d].cells[i],i)}f.push(g.cache[k].row.length);g.cache[k].row.push([b[d]]);g.cache[k].normalized.push(f);f=[]}if(c!==false){$(this).trigger("sorton",[g.sortList])}}).bind("sorton",function(a,c){$(this).trigger("sortStart",this);g.sortList=c;updateHeaderSortCount(this,g.sortList);setHeadersCss(this,b,g.sortList);appendToTable(this,multisort(this,g.sortList))}).bind("appendCache",function(){appendToTable(this)}).bind("applyWidgetId",function(a,b){getWidgetById(b).format(this)}).bind("applyWidgets",function(){applyWidget(this)});if(e.data()&&typeof e.data().sortlist!=="undefined"){g.sortList=e.data().sortlist}else if(n&&e.metadata()&&e.metadata().sortlist){g.sortList=e.metadata().sortlist}applyWidget(this,true);if(g.sortList.length>0){e.trigger("sorton",[g.sortList])}else{applyWidget(this)}this.hasInitialized=true;e.trigger("tablesorter-initialized",this);if(typeof g.initialized==="function"){g.initialized(this)}})};this.addParser=function(a){var b,c=parsers.length,d=true;for(b=0;b<c;b++){if(parsers[b].id.toLowerCase()===a.id.toLowerCase()){d=false}}if(d){parsers.push(a)}};this.addWidget=function(a){widgets.push(a)};this.formatFloat=function(a,b){if(typeof a!=="string"||a===""){return a}if(b.config.usNumberFormat!==false){a=a.replace(/,/g,"")}else{a=a.replace(/[\s|\.]/g,"").replace(/,/g,".")}if(/^\s*\([.\d]+\)/.test(a)){a=a.replace(/^\s*\(/,"-").replace(/\)/,"")}var c=parseFloat(a);return isNaN(c)?$.trim(a):c};this.isDigit=function(a){return/^[\-+(]?\d*[)]?$/.test($.trim(a.replace(/[,.'\s]/g,"")))};this.regex=[/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/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,/^0/];this.characterEquivalents={a:"áàâãä",A:"ÁÀÂÃÄ",c:"ç",C:"Ç",e:"éèêë",E:"ÉÈÊË",i:"íìIîï",I:"ÍÌIÎÏ",o:"óòôõö",O:"ÓÒÔÕÖ",S:"ß",u:"úùûü",U:"ÚÙÛÜ"};this.replaceAccents=function(a){if(this.characterRegex.test(a)){var b,c=this.characterEquivalents;for(b in c){if(typeof b==="string"){a=a.replace(this.characterRegexArray[b],b)}}}return a};this.getData=function(a,b,c){var d="",e=$.metadata?a.metadata():false,f=a.attr("class")||"";if(a.data()&&typeof a.data(c)!=="undefined"){d+=a.data(c)}else if(e&&typeof e[c]!=="undefined"){d+=e[c]}else if(b&&typeof b[c]!=="undefined"){d+=b[c]}else if(f&&f.match(c+"-")){d=f.match(new RegExp(c+"-(\\w+)"))[1]||""}return $.trim(d)};this.clearTableBody=function(a){$(a.tBodies).filter(":not(."+a.config.cssInfoBlock+")").empty()}}})();var ts=$.tablesorter;$.fn.extend({tablesorter:ts.construct});ts.addParser({id:"text",is:function(a,b,c){return true},format:function(a,b,c,d){var e=b.config;a=$.trim(e.ignoreCase?a.toLocaleLowerCase():a);return e.sortLocaleCompare?ts.replaceAccents(a):a},type:"text"});ts.addParser({id:"currency",is:function(a){return/^\(?[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]/.test(a)},format:function(a,b){return ts.formatFloat(a.replace(/[^\w,. \-()]/g,""),b)},type:"numeric"});ts.addParser({id:"ipAddress",is:function(a){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(a)},format:function(a,b){var c,d,e=a.split("."),f="",g=e.length;for(c=0;c<g;c++){d=e[c];if(d.length===2){f+="0"+d}else{f+=d}}return ts.formatFloat(f,b)},type:"numeric"});ts.addParser({id:"url",is:function(a){return/^(https?|ftp|file):\/\/$/.test(a)},format:function(a){return $.trim(a.replace(/(https?|ftp|file):\/\//,""))},type:"text"});ts.addParser({id:"isoDate",is:function(a){return/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(a)},format:function(a,b){return ts.formatFloat(a!==""?(new Date(a.replace(/-/g,"/"))).getTime()||"":"",b)},type:"numeric"});ts.addParser({id:"percent",is:function(a){return/\%\)?$/.test($.trim(a))},format:function(a,b){return ts.formatFloat(a.replace(/%/g,""),b)},type:"numeric"});ts.addParser({id:"usLongDate",is:function(a){return a.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(a,b){return ts.formatFloat((new Date(a)).getTime()||"",b)},type:"numeric"});ts.addParser({id:"shortDate",is:function(a){return/\d{1,4}[\/\-\,\.\s+]\d{1,4}[\/\-\.\,\s+]\d{1,4}/.test(a)},format:function(a,b,c,d){var e=b.config,f=ts.getData($(c),e.headers[d],"dateFormat")||e.dateFormat;a=a.replace(/\s+/g," ").replace(/[\-|\.|\,]/g,"/");if(f==="mmddyyyy"){a=a.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$1/$2")}else if(f==="ddmmyyyy"){a=a.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$2/$1")}else if(f==="yyyymmdd"){a=a.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,"$1/$2/$3")}return ts.formatFloat((new Date(a)).getTime()||"",b)},type:"numeric"});ts.addParser({id:"time",is:function(a){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(a)},format:function(a,b){return ts.formatFloat((new Date("2000/01/01 "+a)).getTime()||"",b)},type:"numeric"});ts.addParser({id:"digit",is:function(a){return ts.isDigit(a)},format:function(a,b){return ts.formatFloat(a.replace(/[^\w,. \-()]/g,""),b)},type:"numeric"});ts.addParser({id:"metadata",is:function(a){return false},format:function(a,b,c){var d=b.config,e=!d.parserMetadataName?"sortValue":d.parserMetadataName;return $(c).metadata()[e]},type:"numeric"});ts.addWidget({id:"zebra",format:function(a){var b,c,d,e,f,g,h=a.config,i=h.cssChildRow,j=$(a).children("tbody:not("+h.cssInfoBlock+")"),k=["even","odd"];k=h.widgetZebra&&h.hasOwnProperty("css")?h.widgetZebra.css:h.widgetOptions&&h.widgetOptions.hasOwnProperty("zebra")?h.widgetOptions.zebra:k;if(h.debug){f=new Date}for(g=0;g<j.length;g++){d=0;b=$(j[g]).children("tr:visible");if(b.length>1){b.each(function(){c=$(this);if(!c.hasClass(i)){d++}e=d%2===0;c.removeClass(k[e?1:0]).addClass(k[e?0:1])})}}if(h.debug){ts.benchmark("Applying Zebra widget",f)}}})}(jQuery);
View
4 js/jquery.tablesorter.widgets.js
@@ -1,4 +1,4 @@
-/*! tableSorter 2.3 widgets - updated 5/8/2012
+/*! tableSorter 2.3 widgets - updated 5/9/2012
*
* jQuery UI Theme
* Column Styles
@@ -186,7 +186,7 @@ $.tablesorter.addWidget({
for (i=0; i < cols; i++){
fr += '<td><input type="search" data-col="' + i + '" class="' + css;
// use header option - headers: { 1: { filter: false } } OR add class="filter-false"
- fr += ((c.headers[i] && c.headers[i].hasOwnProperty('filter') && c.headers[i].filter === false) || $(c.headerList[i]).is('.filter-false') ) ? ' disabled" disabled' : '"';
+ fr += $.tablesorter.getData(c.headerList[i], c.headers[i], 'filter') === 'false' ? ' disabled" disabled' : '"';
fr += '></td>';
}
$t
View
16 js/jquery.tablesorter.widgets.min.js
@@ -1,10 +1,10 @@
-/*! tableSorter 2.3 widgets - updated 5/8/2012 */
+/*! tableSorter 2.3 widgets - updated 5/9/2012 */
;(function(b){
-b.tablesorter.storage=function(a,e,d){var c,g=!1;c={};var j=a.id||b(".tablesorter").index(b(a)),f=window.location.pathname;try{g=!!localStorage.getItem}catch(h){}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][j])c[f]||(c[f]={});c[f][j]=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(j)?c[f][j]:{}};
-b.tablesorter.addWidget({id:"uitheme",format:function(a){var e,d,c,g,j,f=b(a),h=a.config,i=h.widgetOptions,k=["ui-icon-arrowthick-2-n-s","ui-icon-arrowthick-1-s","ui-icon-arrowthick-1-n"],k=h.widgetUitheme&&h.widgetUitheme.hasOwnProperty("css")?h.widgetUitheme.css||k:i&&i.hasOwnProperty("uitheme")?i.uitheme:k;c=k.join(" ");h.debug&&(e=new Date); f.hasClass("ui-theme")||(f.addClass("ui-widget ui-widget-content ui-corner-all ui-theme"),b.each(h.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(h.headerList,function(a){g=b(this);if(this.sortDisabled)g.find("span.ui-icon").removeClass(c+" ui-icon");else{d=g.hasClass(h.cssAsc)? k[1]:g.hasClass(h.cssDesc)?k[2]:g.hasClass(h.cssHeader)?k[0]:"";j=f.hasClass("hasStickyHeaders")?f.find("tr."+(i.stickyHeaders||"tablesorter-stickyHeader")).find("th").eq(a).add(g):g;j[d===k[0]?"removeClass":"addClass"]("ui-state-active").find("span.ui-icon").removeClass(c).addClass(d)}});h.debug&&b.tablesorter.benchmark("Applying uitheme widget",e)}});
-b.tablesorter.addWidget({id:"columns",format:function(a){var e,d,c,g,j,f=a.config,h=b(a).children("tbody:not("+f.cssInfoBlock+")"),i=f.sortList,k= i.length,l=["primary","secondary","tertiary"],l=f.widgetColumns&&f.widgetColumns.hasOwnProperty("css")?f.widgetColumns.css||l:f.widgetOptions&&f.widgetOptions.hasOwnProperty("columns")?f.widgetOptions.columns||l:l;c=l.length-1;g=l.join(" ");f.debug&&(d=new Date);if(i&&i[0])for(j=0;j<h.length;j++)a=b(h[j]).children("tr:visible"),a.each(function(a){e=b(this).children().removeClass(g);e.eq(i[0][0]).addClass(l[0]);if(1<k)for(a=1;a<k;a++)e.eq(i[a][0]).addClass(l[a]||l[c])});else b(a).find("td").removeClass(g); f.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,j,f,h,i=a.config,k=i.widgetOptions,l=k.filter_cssFilter||"tablesorter-filter",m=b(a).addClass("hasFilters"),n=i.parsers.length,a='<tr class="'+l+'">',o;i.debug&&(o=new Date);for(e=0;e<n;e++)a+='<td><input type="search" data-col="'+e+'" class="'+l,a+=i.headers[e]&&i.headers[e].hasOwnProperty("filter")&&!1===i.headers[e].filter||b(i.headerList[e]).is(".filter-false")? ' disabled" disabled':'"',a+="></td>";m.find("thead").eq(0).append(a+="</tr>").find("input."+l).bind("keyup search",function(){d=m.find("thead").eq(0).children("tr").find("input."+l).map(function(){return(b(this).val()||"").toLowerCase()}).get();""===d.join("")?m.find("tr").show():m.children("tbody:not(."+i.cssInfoBlock+")").children("tr:not(."+i.cssChildRow+")").each(function(){c=!0;f=b(this).nextUntil("tr:not(."+i.cssChildRow+")");g=f.length&&(k&&k.hasOwnProperty("filter_childRows")&&"undefined"!== typeof k.filter_childRows?k.filter_childRows:1)?f.text():"";h=b(this).children("td");for(e=0;e<n;e++)j=b.trim(h.eq(e).text()+g).toLowerCase().indexOf(d[e]),""!==d[e]&&(!k.filter_startsWith&&0<=j||k.filter_startsWith&&0===j)?c=c?!0:!1:""!==d[e]&&(c=!1);b(this)[c?"show":"hide"]();if(f.length)f[c?"show":"hide"]()});m.trigger("applyWidgets")});i.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).children("thead"),j=g.children("tr:not(.sticky-false)").children(),f=d.stickyHeaders||"tablesorter-stickyHeader",h=j.eq(0),i=e.find("tfoot"),k=g.find("tr.tablesorter-header:not(.sticky-false)").clone().removeClass("tablesorter-header").addClass(f).css({width:g.outerWidth(!0),position:"fixed",left:h.offset().left,margin:0,top:0,visibility:"hidden",zIndex:10}),l=k.children(),m="";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()});j.each(function(a){var c=b(this);l.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(k);c.scroll(function(){var a=h.offset(),b=c.scrollTop(),d=e.height()- (h.height()+(i.height()||0)),b=b>a.top&&b<a.top+d?"visible":"hidden";k.css({left:a.left-c.scrollLeft(),visibility:b});b!==m&&(c.resize(),m=b)}).resize(function(){var a=0;k.css({left:h.offset().left-c.scrollLeft(),width:g.outerWidth()}).each(function(c){b(this).css("top",a);a+=g.find("tr").eq(c).outerHeight()});l.find(".tablesorter-header-inner").each(function(a){b(this).width(j.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)"),j=0,f=null,h=null,i=function(){j=0;f=h=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!==j&&f){var b=a.pageX-j;f.width()<-b||h&&h.width()<=b||(h.width(h.width()+b),j=a.pageX)}}).bind("mouseup",function(){d&&(b.tablesorter.storage&&f)&&(d[h.index()]=h.width(),b.tablesorter.storage(a,"tablesorter-resizable",d));i();return!1}).find(".tablesorter-resizer").bind("mousedown",function(a){f=b(a.target).closest("th");h=f.prev();j=a.pageX});b(a).find("thead").bind("mouseup mouseleave",function(){i()})}}});
-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.storage=function(a,f,d){var c,g=!1;c={};var i=a.id||b(".tablesorter").index(b(a)),e=window.location.pathname;try{g=!!localStorage.getItem}catch(h){}b.parseJSON&&(g?c=b.parseJSON(localStorage[f])||{}:(c=document.cookie.split(/[;\s|=]/),a=b.inArray(f,c)+1,c=0!==a?b.parseJSON(c[a])||{}:{}));if(d&&JSON&&JSON.hasOwnProperty("stringify")){if(!c[e]||!c[e][i])c[e]||(c[e]={});c[e][i]=d;g?localStorage[f]=JSON.stringify(c):(a=new Date,a.setTime(a.getTime()+31536E6),document.cookie= f+"="+JSON.stringify(c).replace(/\"/g,'"')+"; expires="+a.toGMTString()+"; path=/")}else return c&&c.hasOwnProperty(e)&&c[e].hasOwnProperty(i)?c[e][i]:{}};
+b.tablesorter.addWidget({id:"uitheme",format:function(a){var f,d,c,g,i,e=b(a),h=a.config,j=h.widgetOptions,k=["ui-icon-arrowthick-2-n-s","ui-icon-arrowthick-1-s","ui-icon-arrowthick-1-n"],k=h.widgetUitheme&&h.widgetUitheme.hasOwnProperty("css")?h.widgetUitheme.css||k:j&&j.hasOwnProperty("uitheme")?j.uitheme:k;c=k.join(" ");h.debug&&(f=new Date); e.hasClass("ui-theme")||(e.addClass("ui-widget ui-widget-content ui-corner-all ui-theme"),b.each(h.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(h.headerList,function(a){g=b(this);if(this.sortDisabled)g.find("span.ui-icon").removeClass(c+" ui-icon");else{d=g.hasClass(h.cssAsc)? k[1]:g.hasClass(h.cssDesc)?k[2]:g.hasClass(h.cssHeader)?k[0]:"";i=e.hasClass("hasStickyHeaders")?e.find("tr."+(j.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)}});h.debug&&b.tablesorter.benchmark("Applying uitheme widget",f)}});
+b.tablesorter.addWidget({id:"columns",format:function(a){var f,d,c,g,i,e=a.config,h=b(a).children("tbody:not("+e.cssInfoBlock+")"),j=e.sortList,k= j.length,l=["primary","secondary","tertiary"],l=e.widgetColumns&&e.widgetColumns.hasOwnProperty("css")?e.widgetColumns.css||l:e.widgetOptions&&e.widgetOptions.hasOwnProperty("columns")?e.widgetOptions.columns||l:l;c=l.length-1;g=l.join(" ");e.debug&&(d=new Date);if(j&&j[0])for(i=0;i<h.length;i++)a=b(h[i]).children("tr:visible"),a.each(function(a){f=b(this).children().removeClass(g);f.eq(j[0][0]).addClass(l[0]);if(1<k)for(a=1;a<k;a++)f.eq(j[a][0]).addClass(l[a]||l[c])});else b(a).find("td").removeClass(g); e.debug&&b.tablesorter.benchmark("Applying Columns widget",d)}});
+b.tablesorter.addWidget({id:"filter",format:function(a){if(!b(a).hasClass("hasFilters")){var f,d,c,g,i,e,h,j=a.config,k=j.widgetOptions,l=k.filter_cssFilter||"tablesorter-filter",m=b(a).addClass("hasFilters"),n=j.parsers.length,a='<tr class="'+l+'">',o;j.debug&&(o=new Date);for(f=0;f<n;f++)a+='<td><input type="search" data-col="'+f+'" class="'+l,a+="false"===b.tablesorter.getData(j.headerList[f],j.headers[f],"filter")?' disabled" disabled': '"',a+="></td>";m.find("thead").eq(0).append(a+="</tr>").find("input."+l).bind("keyup search",function(){d=m.find("thead").eq(0).children("tr").find("input."+l).map(function(){return(b(this).val()||"").toLowerCase()}).get();""===d.join("")?m.find("tr").show():m.children("tbody:not(."+j.cssInfoBlock+")").children("tr:not(."+j.cssChildRow+")").each(function(){c=!0;e=b(this).nextUntil("tr:not(."+j.cssChildRow+")");g=e.length&&(k&&k.hasOwnProperty("filter_childRows")&&"undefined"!==typeof k.filter_childRows? k.filter_childRows:1)?e.text():"";h=b(this).children("td");for(f=0;f<n;f++)i=b.trim(h.eq(f).text()+g).toLowerCase().indexOf(d[f]),""!==d[f]&&(!k.filter_startsWith&&0<=i||k.filter_startsWith&&0===i)?c=c?!0:!1:""!==d[f]&&(c=!1);b(this)[c?"show":"hide"]();if(e.length)e[c?"show":"hide"]()});m.trigger("applyWidgets")});j.debug&&b.tablesorter.benchmark("Applying Filter widget",o)}}});
+b.tablesorter.addWidget({id:"stickyHeaders",format:function(a){if(!b(a).hasClass("hasStickyHeaders")){var f=b(a).addClass("hasStickyHeaders"), d=a.config.widgetOptions,c=b(window),g=b(a).children("thead"),i=g.children("tr:not(.sticky-false)").children(),e=d.stickyHeaders||"tablesorter-stickyHeader",h=i.eq(0),j=f.find("tfoot"),k=g.find("tr.tablesorter-header:not(.sticky-false)").clone().removeClass("tablesorter-header").addClass(e).css({width:g.outerWidth(!0),position:"fixed",left:h.offset().left,margin:0,top:0,visibility:"hidden",zIndex:10}),l=k.children(),m="";f.bind("sortEnd",function(a,c){var d=b(c).find("thead tr"),f=d.filter("."+e).children(); d.filter(":not(."+e+")").children().each(function(a){f.eq(a).attr("class",b(this).attr("class"))})}).bind("pagerComplete",function(){c.resize()});i.each(function(a){var c=b(this);l.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(k);c.scroll(function(){var a=h.offset(),b=c.scrollTop(),d=f.height()-(h.height()+(j.height()||0)), b=b>a.top&&b<a.top+d?"visible":"hidden";k.css({left:a.left-c.scrollLeft(),visibility:b});b!==m&&(c.resize(),m=b)}).resize(function(){var a=0;k.css({left:h.offset().left-c.scrollLeft(),width:g.outerWidth()}).each(function(c){b(this).css("top",a);a+=g.find("tr").eq(c).outerHeight()});l.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 f,d,c=a.config,g=b(c.headerList).filter(":gt(0)"),i=0,e=null,h=null,j=function(){i=0;e=h=null;b(window).trigger("resize")};if(d=b.tablesorter.storage?b.tablesorter.storage(a,"tablesorter-resizable"):"")for(f in d)!isNaN(f)&&f<c.headerList.length&&b(c.headerList[f]).width(d[f]);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&&e){var b=a.pageX-i;e.width()<-b||h&&h.width()<=b||(h.width(h.width()+b),i=a.pageX)}}).bind("mouseup",function(){d&&(b.tablesorter.storage&&e)&&(d[h.index()]=h.width(),b.tablesorter.storage(a,"tablesorter-resizable",d));j();return!1}).find(".tablesorter-resizer").bind("mousedown",function(a){e=b(a.target).closest("th");h=e.prev();i=a.pageX});b(a).find("thead").bind("mouseup mouseleave",function(){j()})}}});
+b.tablesorter.addWidget({id:"saveSort",init:function(a,b,d){d.format(a, !0)},format:function(a,f){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)),f&&d&&0<d.length?g.sortList=d:a.hasInitialized&&(d&&0<d.length)&&b(a).trigger("sorton",[d]))}})
})(jQuery);
View
2  package.json
@@ -1,6 +1,6 @@
{
"name": "tablesorter",
- "version": "2.3",
+ "version": "2.3.1",
"title": "tablesorter",
"author": {
"name": "Christian Bach",
Please sign in to comment.
Something went wrong with that request. Please try again.