From e5483f3d49fadbbcd73c7cb65b97a9a8fcc1309d Mon Sep 17 00:00:00 2001 From: Mottie Date: Fri, 22 Feb 2013 09:02:29 -0600 Subject: [PATCH] cleanup & version bump --- README.md | 50 ++++++++++------------------ component.json | 2 +- js/jquery.tablesorter.js | 4 +-- js/jquery.tablesorter.min.js | 4 +-- js/jquery.tablesorter.widgets.js | 22 ++++++------ js/jquery.tablesorter.widgets.min.js | 10 +++--- package.json | 2 +- tablesorter.jquery.json | 2 +- 8 files changed, 40 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 8299a0ee..49d89208 100644 --- a/README.md +++ b/README.md @@ -35,13 +35,28 @@ tablesorter can successfully parse and sort many types of data including linked ### Special Thanks * Big shout-out to [Nick Craver](https://github.com/NickCraver) for getting rid of the `eval()` function that was previously needed for multi-column sorting. -* Also big thanks to [thezoggy](https://github.com/thezoggy) for helping with code, themes and valuable feedback. -* And, thanks to everyone that has contributed, and continue to contribute to this forked project! +* Also big thanks to [thezoggy](https://github.com/thezoggy) for helping with code, themes and providing valuable feedback. +* And, thanks to everyone else that has contributed, and continue to contribute to this forked project! ### Change Log View the [complete listing here](https://github.com/Mottie/tablesorter/wiki/Change). +#### Version 2.7.10 (2/22/2013) + +* Updated widget storage function to ensure no invalid strings are passed to the `$.parseJSON` function. + * Thanks to [andriijas](https://github.com/andriijas) for the code suggestion :) + * Fixes [issue #240](https://github.com/Mottie/tablesorter/issues/240) & [issue #244](https://github.com/Mottie/tablesorter/issues/244). +* Updated filter widget: + * When cell content contains quotes and the filter select is added, the quotes are now properly processed to be included within the options. Fixes [issue #242](https://github.com/Mottie/tablesorter/issues/242). + * Empty cells are no longer added to the options. If you want to include empty cells, add the following (see [this StackOverflow question](http://stackoverflow.com/q/14990971/145346)): + + ```html + {empty} + ``` + + Then you'll get a select dropdown showing `{empty}` allowing you to select empty content. + #### Version 2.7.9 (2/20/2013) * Fixed an issue with the pager targetting an incorrect page when the table starts out empty. @@ -107,34 +122,3 @@ View the [complete listing here](https://github.com/Mottie/tablesorter/wiki/Chan #### Version 2.7.6 (2/6/2013) * Merged in an update from [Somebi](https://github.com/Somebi) to fix a javascript error which occurs when the table doesn't have a thead or tbody, or it is already initialized. - -#### Version 2.7.5 (1/31/2013) - -* Added pager `pageSize` method to the docs. -* Added chili syntax highlighting script files back to the repo as some other external demos were still linking to it. - -#### Version 2.7.4 (1/29/2013) - -* Fixed an problem with the pager not pointing to a tbody, and breaking on an empty tbody. See [issue #223](https://github.com/Mottie/tablesorter/issues/223). -* Modified core to always add a `` to the table. Only when the `widthFixed` option is `true` will it add percentage based widths. -* Modified the parsers code to no longer require an `is` function; or if the function is missing, no error will be thrown. -* Modified the isoDate and usLongDate parsers: - * isoDate parser will now auto-detect dates with times - * usLongDate parser will now auto-detect dates in this format: "DD MMMMMMMMM YYYY" (25 Jan 2013) -* Added manifest files: - * `component.json` for bower package manager. Thanks to [appleboy](https://github.com/appleboy); also see [issue #190](https://github.com/Mottie/tablesorter/issues/190). - * `tablesorter.jquery.json` for the jquery plugin registry. -* Added `"updateRows"` method which is the exact same as `"update"`, but needed due to issues with Prototype. See [issue #217](https://github.com/Mottie/tablesorter/issues/217). -* Added `pageSize` method to change the pager page size more easily. See [issue #218](https://github.com/Mottie/tablesorter/issues/218). -* Added [filter widget change log](https://github.com/Mottie/tablesorter/wiki/Change3) to the wiki pages. -* Added a config variable `config.columns`: - * This variable indicates the number of columns in the table. - * Previously, `config.parsers.length` or `config.$headers.length` were used. Neither of which were accurate if the table was empty or multiple rows in the header existed. - * This value may still be inaccurate if a rowspan is used in the header. -* Updated index page to use jQuery 1.9. - * jQuery 2.0 is has a [bug adding rows to the table](http://jsfiddle.net/Mottie/abkNM/324/), so I didn't upgrade the demos to use it. - * Changed syntax highlighting script from chilli to google's prettify. - -#### Version 2.7.3 (1/10/2013) - -* Fixed a serious bug in the filter widget that was breaking the widget completely if `filter_functions` was not defined (introduced in v2.7.2). Fixes [issue #213](https://github.com/Mottie/tablesorter/issues/213). diff --git a/component.json b/component.json index a8d463e3..d3bdf159 100644 --- a/component.json +++ b/component.json @@ -1,6 +1,6 @@ { "name": "tablesorter", - "version": "2.7.9", + "version": "2.7.10", "dependencies": { "jqueryjs": ">=1.2.6" } diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js index eda7b94a..c5288b20 100644 --- a/js/jquery.tablesorter.js +++ b/js/jquery.tablesorter.js @@ -1,5 +1,5 @@ /*! -* TableSorter 2.7.9 - Client-side table sorting with ease! +* TableSorter 2.7.10 - Client-side table sorting with ease! * @requires jQuery v1.2.6+ * * Copyright (c) 2007 Christian Bach @@ -24,7 +24,7 @@ var ts = this; - ts.version = "2.7.9"; + ts.version = "2.7.10"; ts.parsers = []; ts.widgets = []; diff --git a/js/jquery.tablesorter.min.js b/js/jquery.tablesorter.min.js index 5fa2c5ea..f28c9337 100644 --- a/js/jquery.tablesorter.min.js +++ b/js/jquery.tablesorter.min.js @@ -1,5 +1,5 @@ /*! -* TableSorter 2.7.9 min - Client-side table sorting with ease! +* TableSorter 2.7.10 min - Client-side table sorting with ease! * Copyright (c) 2007 Christian Bach */ -!function(j){j.extend({tablesorter:new function(){function e(d){"undefined"!==typeof console&&"undefined"!==typeof console.log?console.log(d):alert(d)}function u(d,c){e(d+" ("+((new Date).getTime()-c.getTime())+"ms)")}function p(d,c,a){if(!c)return"";var b=d.config,g=b.textExtraction,f="",f="simple"===g?b.supportsTextContent?c.textContent:j(c).text():"function"===typeof g?g(c,d,a):"object"===typeof g&&g.hasOwnProperty(a)?g[a](c,d,a):b.supportsTextContent?c.textContent:j(c).text();return j.trim(f)} function h(d){var c=d.config,a=c.$tbodies=c.$table.children("tbody:not(."+c.cssInfoBlock+")"),b,q,f,l,j,n,k="";if(0===a.length)return c.debug?e("*Empty table!* Not building a parser cache"):"";a=a[0].rows;if(a[0]){b=[];q=a[0].cells.length;for(f=0;f thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};g.benchmark=u;g.construct=function(d){return this.each(function(){if(!this.tHead||0===this.tBodies.length||!0===this.hasInitialized)return this.config&&this.config.debug?e("stopping initialization! No thead, tbody or tablesorter has already been initialized"):"";var c=j(this),a=this,b,q,f,l="",v,n,k,C,x=j.metadata; a.hasInitialized=!1;a.config={};b=j.extend(!0,a.config,g.defaults,d);j.data(a,"tablesorter",b);b.debug&&j.data(a,"startoveralltimer",new Date);b.supportsTextContent="x"===j("x")[0].textContent;b.supportsDataObject=1.4<=parseFloat(j.fn.jquery);b.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:!0,bottom:!1};/tablesorter\-/.test(c.attr("class"))||(l=""!==b.theme?" tablesorter-"+b.theme:"");b.$table=c.addClass(b.tableClass+l);b.$tbodies=c.children("tbody:not(."+b.cssInfoBlock+ ")");var t=[],y={},O=0,R=j(a).find("thead:eq(0), tfoot").children("tr"),E,K,z,A,P,D,L,S,T,H;for(E=0;E':"";t=j(a).find(w.selectorHeaders).each(function(a){B=j(this);M=w.headers[a];w.headerContent[a]=this.innerHTML;N=w.headerTemplate.replace(/\{content\}/g,this.innerHTML).replace(/\{icon\}/g,U);w.onRenderTemplate&&(Q=w.onRenderTemplate.apply(B,[a,N]))&&"string"===typeof Q&&(N=Q);this.innerHTML='
'+N+"
";w.onRenderHeader&&w.onRenderHeader.apply(B, [a]);this.column=y[this.parentNode.rowIndex+"-"+this.cellIndex];var b=g.getData(B,M,"sortInitialOrder")||w.sortInitialOrder;this.order=/^d/i.test(b)||1===b?[1,0,2]:[0,1,2];this.count=-1;"false"===g.getData(B,M,"sorter")?(this.sortDisabled=!0,B.addClass("sorter-false")):B.removeClass("sorter-false");this.lockedOrder=!1;J=g.getData(B,M,"lockedOrder")||!1;"undefined"!==typeof J&&!1!==J&&(this.order=this.lockedOrder=/^d/i.test(J)||1===J?[1,1,1]:[0,0,0]);B.addClass((this.sortDisabled?"sorter-false ":" ")+ w.cssHeader);w.headerList[a]=this;B.parent().addClass(w.cssHeaderRow)});a.config.debug&&(u("Built headers:",V),e(t));b.$headers=t;if(a.config.widthFixed&&0===j(a).find("colgroup").length){var W=j(""),X=j(a).width();j(a.tBodies[0]).find("tr:first").children("td").each(function(){W.append(j("").css("width",parseInt(1E3*(j(this).width()/X),10)/10+"%"))});j(a).prepend(W)}b.parsers=h(a);b.delayInit||s(a);b.$headers.find("*")[j.fn.addBack?"addBack":"andSelf"]().filter(b.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter").bind("mousedown.tablesorter mouseup.tablesorter", function(d,e){var h=(this.tagName.match("TH|TD")?j(this):j(this).parents("th, td").filter(":last"))[0];if(1!==(d.which||d.button))return!1;if("mousedown"===d.type)return C=(new Date).getTime(),"INPUT"===d.target.tagName?"":!b.cancelSelection;if(!0!==e&&250<(new Date).getTime()-C)return!1;b.delayInit&&!b.cache&&s(a);if(!h.sortDisabled){c.trigger("sortStart",a);l=!d[b.sortMultiSortKey];h.count=d[b.sortResetKey]?2:(h.count+1)%(b.sortReset?3:2);b.sortRestart&&(q=h,b.$headers.each(function(){if(this!== q&&(l||!j(this).is("."+b.cssDesc+",."+b.cssAsc)))this.count=-1}));q=h.column;if(l){b.sortList=[];if(null!==b.sortForce){v=b.sortForce;for(f=0;fk&&(b.sortList.push([q,k]),1k&&(b.sortList.push([q,k]),1'),d=j.fn.detach?c.detach():c.remove();d=j(d).find("span.tablesorter-savemyplace");c.insertAfter(d);d.remove()};g.clearTableBody=function(d){d.config.$tbodies.empty()};g.destroy=function(d,c,a){if(d.hasInitialized){g.refreshWidgets(d,!0,!0);var b=j(d),e=d.config,f=b.find("thead:first"),h=f.find("tr."+e.cssHeaderRow).removeClass(e.cssHeaderRow),u=b.find("tfoot:first > tr").children("th, td"); f.find("tr").not(h).remove();b.removeData("tablesorter").unbind("sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave sortBegin sortEnd ".split(" ").join(".tablesorter "));e.$headers.add(u).removeClass(e.cssHeader+" "+e.cssAsc+" "+e.cssDesc).removeAttr("data-column");h.find(e.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter");h.children().each(function(a){j(this).html(e.headerContent[a])});!1!==c&&b.removeClass(e.tableClass+ " tablesorter-"+e.theme);d.hasInitialized=!1;"function"===typeof a&&a(d)}};g.regex=[/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,/^0x[0-9a-f]+$/i];g.sortText=function(d,c,a,b){if(c===a)return 0;var e=d.config,f=e.string[e.empties[b]||e.emptyTo],h=g.regex;if(""===c&&0!==f)return"boolean"===typeof f?f?-1:1:-f||-1;if(""===a&&0!==f)return"boolean"===typeof f? f?1:-1:f||1;if("function"===typeof e.textSorter)return e.textSorter(c,a,d,b);d=c.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");b=a.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");c=parseInt(c.match(h[2]),16)||1!==d.length&&c.match(h[1])&&Date.parse(c);if(a=parseInt(a.match(h[2]),16)||c&&a.match(h[1])&&Date.parse(a)||null){if(ca)return 1}e=Math.max(d.length,b.length);for(c=0;ch)return 1}return 0};g.sortTextDesc=function(d,c,a,b){if(c===a)return 0;var e=d.config,f=e.string[e.empties[b]||e.emptyTo];return""===c&&0!==f?"boolean"===typeof f?f?-1:1:f||1:""===a&&0!==f?"boolean"===typeof f?f?1:-1:-f||-1:"function"===typeof e.textSorter?e.textSorter(a,c,d,b):g.sortText(d,a,c)};g.getTextValue=function(d,c,a){if(c){var b=d.length,e=c+a; for(c=0;cj.inArray(l[b].id,f)))h.debug&&e("Refeshing widgets: Removing "+l[b].id),l[b].hasOwnProperty("remove")&&l[b].remove(d,h,h.widgetOptions);!0!==a&&g.applyWidget(d,c)};g.getData=function(d,c,a){var b="";d=j(d);var e,f;if(!d.length)return"";e=j.metadata?d.metadata():!1;f=" "+(d.attr("class")||"");"undefined"!==typeof d.data(a)||"undefined"!==typeof d.data(a.toLowerCase())? b+=d.data(a)||d.data(a.toLowerCase()):e&&"undefined"!==typeof e[a]?b+=e[a]:c&&"undefined"!==typeof c[a]?b+=c[a]:" "!==f&&f.match(" "+a+"-")&&(b=f.match(RegExp(" "+a+"-(\\w+)"))[1]||"");return j.trim(b)};g.formatFloat=function(d,c){if("string"!==typeof d||""===d)return d;var a;d=(c&&c.config?!1!==c.config.usNumberFormat:"undefined"!==typeof c?c:1)?d.replace(/,/g,""):d.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(d)&&(d=d.replace(/^\s*\(/,"-").replace(/\)/,""));a=parseFloat(d);return isNaN(a)? j.trim(d):a};g.isDigit=function(d){return isNaN(d)?/^[\-+(]?\d+[)]?$/.test(d.toString().replace(/[,.'"\s]/g,"")):!0}}});var h=j.tablesorter;j.fn.extend({tablesorter:h.construct});h.addParser({id:"text",is:function(){return!0},format:function(e,u){var p=u.config;e=j.trim(p.ignoreCase?e.toLocaleLowerCase():e);return p.sortLocaleCompare?h.replaceAccents(e):e},type:"text"});h.addParser({id:"currency",is:function(e){return/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/.test((e|| "").replace(/[,. ]/g,""))},format:function(e,j){return h.formatFloat(e.replace(/[^\w,. \-()]/g,""),j)},type:"numeric"});h.addParser({id:"ipAddress",is:function(e){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(e)},format:function(e,j){var p,r=e.split("."),s="",m=r.length;for(p=0;p thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};g.benchmark=u;g.construct=function(d){return this.each(function(){if(!this.tHead||0===this.tBodies.length||!0===this.hasInitialized)return this.config&&this.config.debug?e("stopping initialization! No thead, tbody or tablesorter has already been initialized"):"";var c=j(this),a=this,b,q,f,l="",v,n,k,C,x=j.metadata; a.hasInitialized=!1;a.config={};b=j.extend(!0,a.config,g.defaults,d);j.data(a,"tablesorter",b);b.debug&&j.data(a,"startoveralltimer",new Date);b.supportsTextContent="x"===j("x")[0].textContent;b.supportsDataObject=1.4<=parseFloat(j.fn.jquery);b.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:!0,bottom:!1};/tablesorter\-/.test(c.attr("class"))||(l=""!==b.theme?" tablesorter-"+b.theme:"");b.$table=c.addClass(b.tableClass+l);b.$tbodies=c.children("tbody:not(."+b.cssInfoBlock+ ")");var t=[],y={},O=0,R=j(a).find("thead:eq(0), tfoot").children("tr"),E,K,z,A,P,D,L,S,T,H;for(E=0;E':"";t=j(a).find(w.selectorHeaders).each(function(a){B=j(this);M=w.headers[a];w.headerContent[a]=this.innerHTML;N=w.headerTemplate.replace(/\{content\}/g,this.innerHTML).replace(/\{icon\}/g,U);w.onRenderTemplate&&(Q=w.onRenderTemplate.apply(B,[a,N]))&&"string"===typeof Q&&(N=Q);this.innerHTML='
'+N+"
";w.onRenderHeader&&w.onRenderHeader.apply(B, [a]);this.column=y[this.parentNode.rowIndex+"-"+this.cellIndex];var b=g.getData(B,M,"sortInitialOrder")||w.sortInitialOrder;this.order=/^d/i.test(b)||1===b?[1,0,2]:[0,1,2];this.count=-1;"false"===g.getData(B,M,"sorter")?(this.sortDisabled=!0,B.addClass("sorter-false")):B.removeClass("sorter-false");this.lockedOrder=!1;J=g.getData(B,M,"lockedOrder")||!1;"undefined"!==typeof J&&!1!==J&&(this.order=this.lockedOrder=/^d/i.test(J)||1===J?[1,1,1]:[0,0,0]);B.addClass((this.sortDisabled?"sorter-false ":" ")+ w.cssHeader);w.headerList[a]=this;B.parent().addClass(w.cssHeaderRow)});a.config.debug&&(u("Built headers:",V),e(t));b.$headers=t;if(a.config.widthFixed&&0===j(a).find("colgroup").length){var W=j(""),X=j(a).width();j(a.tBodies[0]).find("tr:first").children("td").each(function(){W.append(j("").css("width",parseInt(1E3*(j(this).width()/X),10)/10+"%"))});j(a).prepend(W)}b.parsers=h(a);b.delayInit||s(a);b.$headers.find("*")[j.fn.addBack?"addBack":"andSelf"]().filter(b.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter").bind("mousedown.tablesorter mouseup.tablesorter", function(d,e){var h=(this.tagName.match("TH|TD")?j(this):j(this).parents("th, td").filter(":last"))[0];if(1!==(d.which||d.button))return!1;if("mousedown"===d.type)return C=(new Date).getTime(),"INPUT"===d.target.tagName?"":!b.cancelSelection;if(!0!==e&&250<(new Date).getTime()-C)return!1;b.delayInit&&!b.cache&&s(a);if(!h.sortDisabled){c.trigger("sortStart",a);l=!d[b.sortMultiSortKey];h.count=d[b.sortResetKey]?2:(h.count+1)%(b.sortReset?3:2);b.sortRestart&&(q=h,b.$headers.each(function(){if(this!== q&&(l||!j(this).is("."+b.cssDesc+",."+b.cssAsc)))this.count=-1}));q=h.column;if(l){b.sortList=[];if(null!==b.sortForce){v=b.sortForce;for(f=0;fk&&(b.sortList.push([q,k]),1k&&(b.sortList.push([q,k]),1'),d=j.fn.detach?c.detach():c.remove();d=j(d).find("span.tablesorter-savemyplace");c.insertAfter(d);d.remove()};g.clearTableBody=function(d){d.config.$tbodies.empty()};g.destroy=function(d,c,a){if(d.hasInitialized){g.refreshWidgets(d,!0,!0);var b=j(d),e=d.config,f=b.find("thead:first"),h=f.find("tr."+e.cssHeaderRow).removeClass(e.cssHeaderRow),u=b.find("tfoot:first > tr").children("th, td"); f.find("tr").not(h).remove();b.removeData("tablesorter").unbind("sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave sortBegin sortEnd ".split(" ").join(".tablesorter "));e.$headers.add(u).removeClass(e.cssHeader+" "+e.cssAsc+" "+e.cssDesc).removeAttr("data-column");h.find(e.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter");h.children().each(function(a){j(this).html(e.headerContent[a])});!1!==c&&b.removeClass(e.tableClass+ " tablesorter-"+e.theme);d.hasInitialized=!1;"function"===typeof a&&a(d)}};g.regex=[/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,/^0x[0-9a-f]+$/i];g.sortText=function(d,c,a,b){if(c===a)return 0;var e=d.config,f=e.string[e.empties[b]||e.emptyTo],h=g.regex;if(""===c&&0!==f)return"boolean"===typeof f?f?-1:1:-f||-1;if(""===a&&0!==f)return"boolean"===typeof f? f?1:-1:f||1;if("function"===typeof e.textSorter)return e.textSorter(c,a,d,b);d=c.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");b=a.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");c=parseInt(c.match(h[2]),16)||1!==d.length&&c.match(h[1])&&Date.parse(c);if(a=parseInt(a.match(h[2]),16)||c&&a.match(h[1])&&Date.parse(a)||null){if(ca)return 1}e=Math.max(d.length,b.length);for(c=0;ch)return 1}return 0};g.sortTextDesc=function(d,c,a,b){if(c===a)return 0;var e=d.config,f=e.string[e.empties[b]||e.emptyTo];return""===c&&0!==f?"boolean"===typeof f?f?-1:1:f||1:""===a&&0!==f?"boolean"===typeof f?f?1:-1:-f||-1:"function"===typeof e.textSorter?e.textSorter(a,c,d,b):g.sortText(d,a,c)};g.getTextValue=function(d,c,a){if(c){var b=d.length,e=c+a; for(c=0;cj.inArray(l[b].id,f)))h.debug&&e("Refeshing widgets: Removing "+l[b].id),l[b].hasOwnProperty("remove")&&l[b].remove(d,h,h.widgetOptions);!0!==a&&g.applyWidget(d,c)};g.getData=function(d,c,a){var b="";d=j(d);var e,f;if(!d.length)return"";e=j.metadata?d.metadata():!1;f=" "+(d.attr("class")||"");"undefined"!==typeof d.data(a)||"undefined"!==typeof d.data(a.toLowerCase())? b+=d.data(a)||d.data(a.toLowerCase()):e&&"undefined"!==typeof e[a]?b+=e[a]:c&&"undefined"!==typeof c[a]?b+=c[a]:" "!==f&&f.match(" "+a+"-")&&(b=f.match(RegExp(" "+a+"-(\\w+)"))[1]||"");return j.trim(b)};g.formatFloat=function(d,c){if("string"!==typeof d||""===d)return d;var a;d=(c&&c.config?!1!==c.config.usNumberFormat:"undefined"!==typeof c?c:1)?d.replace(/,/g,""):d.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(d)&&(d=d.replace(/^\s*\(/,"-").replace(/\)/,""));a=parseFloat(d);return isNaN(a)? j.trim(d):a};g.isDigit=function(d){return isNaN(d)?/^[\-+(]?\d+[)]?$/.test(d.toString().replace(/[,.'"\s]/g,"")):!0}}});var h=j.tablesorter;j.fn.extend({tablesorter:h.construct});h.addParser({id:"text",is:function(){return!0},format:function(e,u){var p=u.config;e=j.trim(p.ignoreCase?e.toLocaleLowerCase():e);return p.sortLocaleCompare?h.replaceAccents(e):e},type:"text"});h.addParser({id:"currency",is:function(e){return/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/.test((e|| "").replace(/[,. ]/g,""))},format:function(e,j){return h.formatFloat(e.replace(/[^\w,. \-()]/g,""),j)},type:"numeric"});h.addParser({id:"ipAddress",is:function(e){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(e)},format:function(e,j){var p,r=e.split("."),s="",m=r.length;for(p=0;p, >=, < or <= } else if (/^[<>]=?/.test(val)){ // xi may be numeric - see issue #149 - rg = isNaN(xi) ? fmt(xi.replace(reg["nondigit"], ''), table) : fmt(xi, table); - s = fmt(val.replace(reg["nondigit"], '').replace(reg["operators"],''), table); + rg = isNaN(xi) ? fmt(xi.replace(reg.nondigit, ''), table) : fmt(xi, table); + s = fmt(val.replace(reg.nondigit, '').replace(reg.operators,''), table); if (/>/.test(val)) { ff = />=/.test(val) ? rg >= s : rg > s; } if (/ r2) { ff = r1; r1 = r2; r2 = ff; } // swap ff = (rg >= r1 && rg <= r2) || (r1 === '' || r2 === '') ? true : false; // Look for wild card: ? = single, * = multiple, or | = logical OR diff --git a/js/jquery.tablesorter.widgets.min.js b/js/jquery.tablesorter.widgets.min.js index e5e24dde..bdb2ebe4 100644 --- a/js/jquery.tablesorter.widgets.min.js +++ b/js/jquery.tablesorter.widgets.min.js @@ -1,11 +1,11 @@ -/*! tableSorter 2.4+ widgets - updated 2/17/2013 */ +/*! tableSorter 2.4+ widgets - updated 2/22/2013 */ ;(function(b){ b.tablesorter=b.tablesorter||{}; b.tablesorter.themes={bootstrap:{table:"table table-bordered table-striped",header:"bootstrap-header",footerRow:"",footerCells:"",icons:"",sortNone:"bootstrap-icon-unsorted",sortAsc:"icon-chevron-up",sortDesc:"icon-chevron-down",active:"",hover:"",filterRow:"",even:"",odd:""},jui:{table:"ui-widget ui-widget-content ui-corner-all",header:"ui-widget-header ui-corner-all ui-state-default",footerRow:"",footerCells:"",icons:"ui-icon",sortNone:"ui-icon-carat-2-n-s", sortAsc:"ui-icon-carat-1-n",sortDesc:"ui-icon-carat-1-s",active:"ui-state-active",hover:"ui-state-hover",filterRow:"",even:"ui-widget-content",odd:"ui-state-default"}}; -b.tablesorter.storage=function(c,a,d){var e,g=!1;e={};var f=c.id||b(".tablesorter").index(b(c)),l=window.location.pathname;try{g=!!localStorage.getItem}catch(n){}b.parseJSON&&(g?e=b.parseJSON(localStorage[a])||{}:(e=document.cookie.split(/[;\s|=]/),c=b.inArray(a,e)+1,e=0!==c?b.parseJSON(e[c])||{}:{}));if((d||""===d)&&window.JSON&&JSON.hasOwnProperty("stringify"))e[l]|| (e[l]={}),e[l][f]=d,g?localStorage[a]=JSON.stringify(e):(c=new Date,c.setTime(c.getTime()+31536E6),document.cookie=a+"="+JSON.stringify(e).replace(/\"/g,'"')+"; expires="+c.toGMTString()+"; path=/");else return e&&e[l]?e[l][f]:{}}; -b.tablesorter.addWidget({id:"uitheme",format:function(c){var a,d,e,g,f=b.tablesorter.themes,l=b(c),n=c.config,m=n.widgetOptions,q="default"!==n.theme?n.theme:m.uitheme||"jui",h=f[f[q]?q:f[m.uitheme]?m.uitheme:"jui"],r=b(n.headerList),w="tr."+(m.stickyHeaders||"tablesorter-stickyHeader"), t=h.sortNone+" "+h.sortDesc+" "+h.sortAsc;n.debug&&(a=new Date);if(!l.hasClass("tablesorter-"+q)||n.theme===q||!c.hasInitialized)""!==h.even&&(m.zebra[0]+=" "+h.even),""!==h.odd&&(m.zebra[1]+=" "+h.odd),f=l.removeClass(""===n.theme?"":"tablesorter-"+n.theme).addClass("tablesorter-"+q+" "+h.table).find("tfoot"),f.length&&f.find("tr").addClass(h.footerRow).children("th, td").addClass(h.footerCells),r.addClass(h.header).filter(":not(.sorter-false)").bind("mouseenter.tsuitheme mouseleave.tsuitheme",function(a){b(this)["mouseenter"=== a.type?"addClass":"removeClass"](h.hover)}),r.find(".tablesorter-wrapper").length||r.wrapInner('
'),n.cssIcon&&r.find("."+n.cssIcon).addClass(h.icons),l.hasClass("hasFilters")&&r.find(".tablesorter-filter-row").addClass(h.filterRow);b.each(r,function(a){e=b(this);g=n.cssIcon?e.find("."+n.cssIcon):e;this.sortDisabled?(e.removeClass(t),g.removeClass(t+" tablesorter-icon "+h.icons)):(f=l.hasClass("hasStickyHeaders")? l.find(w).find("th").eq(a).add(e):e,d=e.hasClass(n.cssAsc)?h.sortAsc:e.hasClass(n.cssDesc)?h.sortDesc:e.hasClass(n.cssHeader)?h.sortNone:"",e[d===h.sortNone?"removeClass":"addClass"](h.active),g.removeClass(t).addClass(d))});n.debug&&b.tablesorter.benchmark("Applying "+q+" theme",a)},remove:function(c,a,d){c=b(c);var e="object"===typeof d.uitheme?"jui":d.uitheme||"jui";d="object"===typeof d.uitheme?d.uitheme:b.tablesorter.themes[b.tablesorter.themes.hasOwnProperty(e)?e:"jui"];var g=c.children("thead").children(), f=d.sortNone+" "+d.sortDesc+" "+d.sortAsc;c.removeClass("tablesorter-"+e+" "+d.table).find(a.cssHeader).removeClass(d.header);g.unbind("mouseenter.tsuitheme mouseleave.tsuitheme").removeClass(d.hover+" "+f+" "+d.active).find(".tablesorter-filter-row").removeClass(d.filterRow);g.find(".tablesorter-icon").removeClass(d.icons)}}); -b.tablesorter.addWidget({id:"columns",format:function(c){var a,d,e,g,f,l,n,m,q,h=b(c),r=c.config,w=r.widgetOptions,t=r.$tbodies,k=r.sortList,u=k.length,s=["primary","secondary", "tertiary"],s=r.widgetColumns&&r.widgetColumns.hasOwnProperty("css")?r.widgetColumns.css||s:w&&w.hasOwnProperty("columns")?w.columns||s:s;l=s.length-1;n=s.join(" ");r.debug&&(f=new Date);for(q=0;q=]/g],L,M,N,H=function(a){var c=b.isArray(a),d=y.find("thead").eq(0).find(".tablesorter-filter-row").children(),e=c?a:d.map(function(a){a=b(this).find("select."+E+", input."+E);return a.length?a.val()||"":""}).get(),f=(e||[]).join("");c&&d.each(function(c,d){b(d).val(a[c]||"")});!0===j.filter_hideFilters&&y.find(".tablesorter-filter-row").trigger(""=== f?"mouseleave":"mouseenter");if(!(K===f&&!1!==a))if(y.trigger("filterStart",[e]),v.showProcessing)setTimeout(function(){O(a,e,f);return!1},30);else return O(a,e,f),!1},O=function(k,g,l){var h,r,q,t,w,x,G,B,z;v.debug&&(G=new Date);for(e=0;e]=?/.test(f))u=isNaN(m)?F(m.replace(A[5],""),c):F(m,c),s=F(f.replace(A[5],"").replace(A[6],""),c),/>/.test(f)&&(x=/>=/.test(f)?u>=s:u>s),/z&&(x=B,B=z,z=x),x=u>=B&&u<=z||""===B||""===z?!0:!1):/[\?|\*]/.test(f)||/\s+OR\s+/.test(g[a])?x=RegExp(f.replace(/\s+or\s+/gi,"|").replace(/\?/g,"\\S{1}").replace(/\*/g,"\\S*")).test(m):(n=(m+p).indexOf(f),x=!j.filter_startsWith&&0<=n||j.filter_startsWith&&0===n);t=x?t?!0:!1:!1}h[d].style.display=t?"":"none";h.eq(d)[t?"removeClass":"addClass"]("filtered");if(q.length)q[t?"show":"hide"]()}b.tablesorter.processTbody(c,k,!1)}K=l;v.debug&&C.benchmark("Completed filter widget search", G);y.trigger("applyWidgets");y.trigger("filterEnd")},P=function(a,f){var k,h=[];a=parseInt(a,10);k='";for(e=0;e'+h[e]+"";y.find("thead").find("select."+E+'[data-column="'+a+'"]')[f?"html":"append"](k)},Q=function(b){for(a=0;a';for(a=0;a";k=y.find("thead").eq(0).append(p+="").find("td");for(a=0;a").appendTo(k.eq(a)):(j.filter_formatter&&b.isFunction(j.filter_formatter[a])?((p=j.filter_formatter[a](k.eq(a),a))&&0===p.length&&(p=k.eq(a).children("input")),p&&(0===p.parent().length||p.parent().length&&p.parent()[0]!==k[a])&&k.eq(a).append(p)):p=b('').appendTo(k.eq(a)),p&&p.attr("placeholder",t.attr("data-placeholder")||"")),p&&(p.addClass(E).attr("data-column",a),G&& (p.addClass("disabled")[0].disabled=!0))}y.bind("addRows updateCell update updateRows appendCache filterReset search ".split(" ").join(".tsfilter "),function(a,b){/(search|filterReset)/.test(a.type)||Q(!0);"filterReset"===a.type&&y.find("."+E).val("");H("search"===a.type?b:"");return!1}).find("input."+E).bind("keyup search",function(a,b){if(!(32>a.which&&8!==a.which||37<=a.which&&40>=a.which)){if("undefined"!==typeof b)return H(b),!1;clearTimeout(N);N=setTimeout(function(){H()},j.filter_searchDelay|| 300)}});L=D.map(function(a){return C.getData?"parsed"===C.getData(D.filter('[data-column="'+a+'"]:last'),v.headers[a],"filter"):b(this).hasClass("filter-parsed")}).get();j.filter_reset&&b(j.filter_reset).length&&b(j.filter_reset).bind("click.tsfilter",function(){y.trigger("filterReset")});if(j.filter_functions)for(z in j.filter_functions)if(j.filter_functions.hasOwnProperty(z)&&"string"===typeof z)if(p=D.filter('[data-column="'+z+'"]:last'),l="",!0===j.filter_functions[z]&&!p.hasClass("filter-false"))P(z); else if("string"===typeof z&&!p.hasClass("filter-false")){for(h in j.filter_functions[z])"string"===typeof h&&(l+=""===l?'":"",l+='");y.find("thead").find("select."+E+'[data-column="'+z+'"]').append(l)}Q(!0);y.find("select."+E).bind("change search",function(){H()});!0===j.filter_hideFilters&&y.find(".tablesorter-filter-row").addClass("hideme").bind("mouseenter mouseleave",function(a){var c;r=b(this); clearTimeout(q);q=setTimeout(function(){/enter|over/.test(a.type)?r.removeClass("hideme"):b(document.activeElement).closest("tr")[0]!==r[0]&&(c=y.find("."+(j.filter_cssFilter||"tablesorter-filter")).map(function(){return b(this).val()||""}).get().join(""),""===c&&r.addClass("hideme"))},200)}).find("input, select").bind("focus blur",function(a){w=b(this).closest("tr");clearTimeout(q);q=setTimeout(function(){if(""===y.find("."+(j.filter_cssFilter||"tablesorter-filter")).map(function(){return b(this).val()|| ""}).get().join(""))w["focus"===a.type?"removeClass":"addClass"]("hideme")},200)});v.showProcessing&&y.bind("filterStart.tsfilter filterEnd.tsfilter",function(a,c){var d=c?y.find("."+v.cssHeader).filter("[data-column]").filter(function(){return""!==c[b(this).data("column")]}):"";C.isProcessing(y[0],"filterStart"===a.type,c?d:"")});v.debug&&C.benchmark("Applying Filter widget",M);y.trigger("filterInit");H()}},remove:function(c,a,d){var e,g;e=b(c);a=a.$tbodies;e.removeClass("hasFilters").unbind("addRows updateCell update appendCache search filterStart filterEnd ".split(" ").join(".tsfilter ")).find(".tablesorter-filter-row").remove(); for(e=0;e'),n.cssIcon&&r.find("."+n.cssIcon).addClass(h.icons),l.hasClass("hasFilters")&&r.find(".tablesorter-filter-row").addClass(h.filterRow);b.each(r,function(a){e=b(this);g=n.cssIcon?e.find("."+n.cssIcon):e;this.sortDisabled?(e.removeClass(t),g.removeClass(t+" tablesorter-icon "+h.icons)): (f=l.hasClass("hasStickyHeaders")?l.find(w).find("th").eq(a).add(e):e,d=e.hasClass(n.cssAsc)?h.sortAsc:e.hasClass(n.cssDesc)?h.sortDesc:e.hasClass(n.cssHeader)?h.sortNone:"",e[d===h.sortNone?"removeClass":"addClass"](h.active),g.removeClass(t).addClass(d))});n.debug&&b.tablesorter.benchmark("Applying "+q+" theme",a)},remove:function(c,a,d){c=b(c);var e="object"===typeof d.uitheme?"jui":d.uitheme||"jui";d="object"===typeof d.uitheme?d.uitheme:b.tablesorter.themes[b.tablesorter.themes.hasOwnProperty(e)? e:"jui"];var g=c.children("thead").children(),f=d.sortNone+" "+d.sortDesc+" "+d.sortAsc;c.removeClass("tablesorter-"+e+" "+d.table).find(a.cssHeader).removeClass(d.header);g.unbind("mouseenter.tsuitheme mouseleave.tsuitheme").removeClass(d.hover+" "+f+" "+d.active).find(".tablesorter-filter-row").removeClass(d.filterRow);g.find(".tablesorter-icon").removeClass(d.icons)}}); +b.tablesorter.addWidget({id:"columns",format:function(c){var a,d,e,g,f,l,n,m,q,h=b(c),r=c.config,w=r.widgetOptions,t=r.$tbodies, k=r.sortList,u=k.length,s=["primary","secondary","tertiary"],s=r.widgetColumns&&r.widgetColumns.hasOwnProperty("css")?r.widgetColumns.css||s:w&&w.hasOwnProperty("columns")?w.columns||s:s;l=s.length-1;n=s.join(" ");r.debug&&(f=new Date);for(q=0;q=]/g,N,O,P,H=function(a){var c=b.isArray(a),d=y.find("thead").eq(0).find(".tablesorter-filter-row").children(),e=c?a:d.map(function(a){a=b(this).find("select."+D+", input."+D);return a.length?a.val()||"":""}).get(),f=(e||[]).join("");c&&d.each(function(c, d){b(d).val(a[c]||"")});!0===j.filter_hideFilters&&y.find(".tablesorter-filter-row").trigger(""===f?"mouseleave":"mouseenter");if(!(K===f&&!1!==a))if(y.trigger("filterStart",[e]),v.showProcessing)setTimeout(function(){Q(a,e,f);return!1},30);else return Q(a,e,f),!1},Q=function(k,g,l){var h,r,q,t,w,x,F,A,z;v.debug&&(F=new Date);for(e=0;e]=?/.test(f))u=isNaN(m)?E(m.replace(G,""),c):E(m,c),s=E(f.replace(G,"").replace(V,""),c),/>/.test(f)&&(x=/>=/.test(f)?u>=s:u>s),/z&&(x=A,A=z,z=x),x=u>=A&&u<=z||""===A||""===z?!0:!1):/[\?|\*]/.test(f)||/\s+OR\s+/.test(g[a])?x=RegExp(f.replace(/\s+or\s+/gi,"|").replace(/\?/g,"\\S{1}").replace(/\*/g,"\\S*")).test(m):(n=(m+p).indexOf(f),x=!j.filter_startsWith&&0<=n||j.filter_startsWith&&0===n);t=x?t?!0:!1:!1}h[d].style.display=t?"":"none";h.eq(d)[t?"removeClass":"addClass"]("filtered");if(q.length)q[t?"show":"hide"]()}b.tablesorter.processTbody(c, k,!1)}K=l;v.debug&&B.benchmark("Completed filter widget search",F);y.trigger("applyWidgets");y.trigger("filterEnd")},R=function(a,f){var k,h=[];a=parseInt(a,10);k='";for(e=0;e'+h[e]+"":"";y.find("thead").find("select."+D+'[data-column="'+a+'"]')[f?"html":"append"](k)},S=function(b){for(a=0;a';for(a=0;a";k=y.find("thead").eq(0).append(p+="").find("td");for(a=0;a").appendTo(k.eq(a)):(j.filter_formatter&&b.isFunction(j.filter_formatter[a])?((p=j.filter_formatter[a](k.eq(a),a))&&0===p.length&&(p=k.eq(a).children("input")),p&&(0===p.parent().length||p.parent().length&&p.parent()[0]!==k[a])&&k.eq(a).append(p)):p=b('').appendTo(k.eq(a)), p&&p.attr("placeholder",t.attr("data-placeholder")||"")),p&&(p.addClass(D).attr("data-column",a),F&&(p.addClass("disabled")[0].disabled=!0))}y.bind("addRows updateCell update updateRows appendCache filterReset search ".split(" ").join(".tsfilter "),function(a,b){/(search|filterReset)/.test(a.type)||S(!0);"filterReset"===a.type&&y.find("."+D).val("");H("search"===a.type?b:"");return!1}).find("input."+D).bind("keyup search",function(a,b){if(!(32>a.which&&8!==a.which||37<=a.which&&40>=a.which)){if("undefined"!== typeof b)return H(b),!1;clearTimeout(P);P=setTimeout(function(){H()},j.filter_searchDelay||300)}});N=C.map(function(a){return B.getData?"parsed"===B.getData(C.filter('[data-column="'+a+'"]:last'),v.headers[a],"filter"):b(this).hasClass("filter-parsed")}).get();j.filter_reset&&b(j.filter_reset).length&&b(j.filter_reset).bind("click.tsfilter",function(){y.trigger("filterReset")});if(j.filter_functions)for(z in j.filter_functions)if(j.filter_functions.hasOwnProperty(z)&&"string"===typeof z)if(p=C.filter('[data-column="'+ z+'"]:last'),l="",!0===j.filter_functions[z]&&!p.hasClass("filter-false"))R(z);else if("string"===typeof z&&!p.hasClass("filter-false")){for(h in j.filter_functions[z])"string"===typeof h&&(l+=""===l?'":"",l+='");y.find("thead").find("select."+D+'[data-column="'+z+'"]').append(l)}S(!0);y.find("select."+D).bind("change search",function(){H()});!0===j.filter_hideFilters&&y.find(".tablesorter-filter-row").addClass("hideme").bind("mouseenter mouseleave", function(a){var c;r=b(this);clearTimeout(q);q=setTimeout(function(){/enter|over/.test(a.type)?r.removeClass("hideme"):b(document.activeElement).closest("tr")[0]!==r[0]&&(c=y.find("."+(j.filter_cssFilter||"tablesorter-filter")).map(function(){return b(this).val()||""}).get().join(""),""===c&&r.addClass("hideme"))},200)}).find("input, select").bind("focus blur",function(a){w=b(this).closest("tr");clearTimeout(q);q=setTimeout(function(){if(""===y.find("."+(j.filter_cssFilter||"tablesorter-filter")).map(function(){return b(this).val()|| ""}).get().join(""))w["focus"===a.type?"removeClass":"addClass"]("hideme")},200)});v.showProcessing&&y.bind("filterStart.tsfilter filterEnd.tsfilter",function(a,c){var d=c?y.find("."+v.cssHeader).filter("[data-column]").filter(function(){return""!==c[b(this).data("column")]}):"";B.isProcessing(y[0],"filterStart"===a.type,c?d:"")});v.debug&&B.benchmark("Applying Filter widget",O);y.trigger("filterInit");H()}},remove:function(c,a,d){var e,g;e=b(c);a=a.$tbodies;e.removeClass("hasFilters").unbind("addRows updateCell update appendCache search filterStart filterEnd ".split(" ").join(".tsfilter ")).find(".tablesorter-filter-row").remove(); for(e=0;eb.top&&cMath.abs(h.parent().width()-h.width()),p=function(){b.tablesorter.storage&&k&&(f[k.index()]=k.width(),f[u.index()]=u.width(),k.width(f[k.index()]),u.width(f[u.index()]),!1!==w.resizable&&b.tablesorter.storage(c,"tablesorter-resizable",f));t=0;k=u=null;b(window).trigger("resize")};if(f=b.tablesorter.storage&&!1!==w.resizable?b.tablesorter.storage(c,"tablesorter-resizable"):{})for(g in f)!isNaN(g)&&g');l=l.slice(0, -1);n=n?n.add(l):l});n.each(function(){a=b(this);g=parseInt(a.css("padding-right"),10)+10;d='
';a.find(".tablesorter-wrapper").append(d)}).bind("mousemove.tsresize",function(a){0!==t&&k&&(m=a.pageX-t,q=k.width(),k.width(q+m),k.width()!==q&&s&&u.width(u.width()-m),t=a.pageX)}).bind("mouseup.tsresize",function(){p()}).find(".tablesorter-resizer,.tablesorter-resizer-grip").bind("mousedown", function(a){k=b(a.target).closest("th");d=r.$headers.filter('[data-column="'+k.attr("data-column")+'"]');1