minified version works again & lots of other fixes

This commit is contained in:
Rob Garrison 2012-05-09 00:51:53 -05:00
parent 5d0224d895
commit d24ccca7d0
7 changed files with 113 additions and 79 deletions

Binary file not shown.

View File

@ -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 File

@ -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 @@
}
})();
// extend plugin scope
$.fn.extend({
tablesorter: $.tablesorter.construct
});
// make shortcut
var ts = $.tablesorter;
// extend plugin scope
$.fn.extend({
tablesorter: ts.construct
});
// 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);
}
}
});

File diff suppressed because one or more lines are too long

View File

@ -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 File

@ -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 File

@ -1,6 +1,6 @@
{
"name": "tablesorter",
"version": "2.3",
"version": "2.3.1",
"title": "tablesorter",
"author": {
"name": "Christian Bach",