tablesorter/js/jquery.tablesorter.widgets.min.js
2013-11-09 14:30:58 -06:00

18 lines
25 KiB
JavaScript

/*! tableSorter 2.8+ widgets - updated 11/9/2013 */
;(function(l){
var e=l.tablesorter=l.tablesorter||{};
e.themes={bootstrap:{table:"table table-bordered table-striped",caption:"caption",header:"bootstrap-header",footerRow:"",footerCells:"",icons:"",sortNone:"bootstrap-icon-unsorted",sortAsc:"icon-chevron-up glyphicon glyphicon-chevron-up",sortDesc:"icon-chevron-down glyphicon glyphicon-chevron-down",active:"",hover:"",filterRow:"",even:"",odd:""},jui:{table:"ui-widget ui-widget-content ui-corner-all",caption:"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"}};
e.storage=function(b,a,c,d){var f,e=!1;f={};var h=b.config,n=d&&d.id||l(b).attr(d&&d.group||"data-table-group")||b.id||l(".tablesorter").index(l(b));d=d&&d.url||l(b).attr(d&&d.page||"data-table-page")||h&&h.fixedUrl||window.location.pathname;if("localStorage"in window)try{window.localStorage.setItem("_tmptest","temp"),e=!0,window.localStorage.removeItem("_tmptest")}catch(q){}l.parseJSON&&(e?f=l.parseJSON(localStorage[a]||"{}"):(f=document.cookie.split(/[;\s|=]/),b=l.inArray(a,f)+1,f=0!==b?l.parseJSON(f[b]||"{}"):{}));if((c||""===c)&&window.JSON&&JSON.hasOwnProperty("stringify"))f[d]||(f[d]={}),f[d][n]=c,e?localStorage[a]=JSON.stringify(f):(b=new Date,b.setTime(b.getTime()+31536E6),document.cookie=a+"="+JSON.stringify(f).replace(/\"/g,'"')+"; expires="+b.toGMTString()+ "; path=/");else return f&&f[d]?f[d][n]:{}};
e.addHeaderResizeEvent=function(b,a,c){c=l.extend({},{timer:250},c);var d=b.config,f=d.widgetOptions,e,h=function(){f.resize_flag=!0;e=[];d.$headers.each(function(){var a=l.data(this,"savedSizes")||[0,0],b=this.offsetWidth,c=this.offsetHeight;if(b!==a[0]||c!==a[1])l.data(this,"savedSizes",[b,c]),e.push(this)});e.length&&d.$table.trigger("resize",[e]);f.resize_flag=!1};d.$headers.each(function(){l.data(this,"savedSizes",[this.offsetWidth,this.offsetHeight])}); clearInterval(f.resize_timer);if(a)return f.resize_flag=!1;f.resize_timer=setInterval(function(){f.resize_flag||h()},c.timer)};
e.addWidget({id:"uitheme",priority:10,options:{uitheme:"jui"},format:function(b,a,c){var d,f,g,h,n=e.themes,q=a.$table,m="default"!==a.theme?a.theme:c.uitheme||"jui",k=n[n[m]?m:n[c.uitheme]?c.uitheme:"jui"],p=a.$headers,x="tr."+(c.stickyHeaders||"tablesorter-stickyHeader"),r=k.sortNone+" "+k.sortDesc+" "+k.sortAsc;a.debug&&(d=new Date);q.hasClass("tablesorter-"+m)&&a.theme!== m&&b.hasInitialized||(""!==k.even&&(c.zebra[0]+=" "+k.even),""!==k.odd&&(c.zebra[1]+=" "+k.odd),q.find("caption").addClass(k.caption),n=q.removeClass(""===a.theme?"":"tablesorter-"+a.theme).addClass("tablesorter-"+m+" "+k.table).find("tfoot"),n.length&&n.find("tr").addClass(k.footerRow).children("th, td").addClass(k.footerCells),p.addClass(k.header).filter(":not(.sorter-false)").bind("mouseenter.tsuitheme mouseleave.tsuitheme",function(a){l(this)["mouseenter"===a.type?"addClass":"removeClass"](k.hover)}), p.find(".tablesorter-wrapper").length||p.wrapInner('<div class="tablesorter-wrapper" style="position:relative;height:100%;width:100%"></div>'),a.cssIcon&&p.find("."+e.css.icon).addClass(k.icons),q.hasClass("hasFilters")&&p.find(".tablesorter-filter-row").addClass(k.filterRow));l.each(p,function(a){g=l(this);h=e.css.icon?g.find("."+e.css.icon):g;this.sortDisabled?(g.removeClass(r),h.removeClass(r+" tablesorter-icon "+k.icons)):(n=q.hasClass("hasStickyHeaders")?q.find(x).find("th").eq(a).add(g):g,f= g.hasClass(e.css.sortAsc)?k.sortAsc:g.hasClass(e.css.sortDesc)?k.sortDesc:g.hasClass(e.css.header)?k.sortNone:"",g[f===k.sortNone?"removeClass":"addClass"](k.active),h.removeClass(r).addClass(f))});a.debug&&e.benchmark("Applying "+m+" theme",d)},remove:function(b,a,c){b=a.$table;a="object"===typeof c.uitheme?"jui":c.uitheme||"jui";c="object"===typeof c.uitheme?c.uitheme:e.themes[e.themes.hasOwnProperty(a)?a:"jui"];var d=b.children("thead").children(),f=c.sortNone+" "+c.sortDesc+" "+c.sortAsc;b.removeClass("tablesorter-"+ a+" "+c.table).find(e.css.header).removeClass(c.header);d.unbind("mouseenter.tsuitheme mouseleave.tsuitheme").removeClass(c.hover+" "+f+" "+c.active).find(".tablesorter-filter-row").removeClass(c.filterRow);d.find(".tablesorter-icon").removeClass(c.icons)}});
e.addWidget({id:"columns",priority:30,options:{columns:["primary","secondary","tertiary"]},format:function(b,a,c){var d,f,g,h,n,q,m,k,p,x=a.$table,r=a.$tbodies,s=a.sortList,u=s.length,w=a.widgetColumns&&a.widgetColumns.hasOwnProperty("css")?a.widgetColumns.css|| w:c&&c.hasOwnProperty("columns")?c.columns||w:w;q=w.length-1;m=w.join(" ");a.debug&&(n=new Date);for(p=0;p<r.length;p++)d=e.processTbody(b,r.eq(p),!0),f=d.children("tr"),f.each(function(){h=l(this);if("none"!==this.style.display&&(g=h.children().removeClass(m),s&&s[0]&&(g.eq(s[0][0]).addClass(w[0]),1<u)))for(k=1;k<u;k++)g.eq(s[k][0]).addClass(w[k]||w[q])}),e.processTbody(b,d,!1);f=!1!==c.columns_thead?["thead tr"]:[];!1!==c.columns_tfoot&&f.push("tfoot tr");if(f.length&&(h=x.find(f.join(",")).children().removeClass(m), u))for(k=0;k<u;k++)h.filter('[data-column="'+s[k][0]+'"]').addClass(w[k]||w[q]);a.debug&&e.benchmark("Applying Columns widget",n)},remove:function(b,a,c){var d=a.$tbodies,f=(c.columns||["primary","secondary","tertiary"]).join(" ");a.$headers.removeClass(f);a.$table.children("tfoot").children("tr").children("th, td").removeClass(f);for(a=0;a<d.length;a++)c=e.processTbody(b,d.eq(a),!0),c.children("tr").each(function(){l(this).children().removeClass(f)}),e.processTbody(b,c,!1)}});
e.addWidget({id:"filter", priority:50,options:{filter_anyMatch:!1,filter_childRows:!1,filter_columnFilters:!0,filter_cssFilter:"",filter_filteredRow:"filtered",filter_formatter:null,filter_functions:null,filter_hideFilters:!1,filter_ignoreCase:!0,filter_liveSearch:!0,filter_onlyAvail:"filter-onlyAvail",filter_reset:null,filter_searchDelay:300,filter_startsWith:!1,filter_useParsedData:!1,filter_serversideFiltering:!1,filter_defaultAttrib:"data-value"},format:function(b,a,c){a.$table.hasClass("hasFilters")||(a.parsers||!a.parsers&& c.filter_serversideFiltering)&&e.filter.init(b,a,c)},remove:function(b,a,c){var d,f=a.$tbodies;a.$table.removeClass("hasFilters").unbind("addRows updateCell update updateComplete appendCache search filterStart filterEnd ".split(" ").join(".tsfilter ")).find(".tablesorter-filter-row").remove();for(a=0;a<f.length;a++)d=e.processTbody(b,f.eq(a),!0),d.children().removeClass(c.filter_filteredRow).show(),e.processTbody(b,d,!1);c.filter_reset&&l(document).undelegate(c.filter_reset,"click.tsfilter")}});
e.filter= {regex:{regex:/^\/((?:\\\/|[^\/])+)\/([mig]{0,3})?$/,child:/tablesorter-childRow/,filtered:/filtered/,type:/undefined|number/,exact:/(^[\"|\'|=]+)|([\"|\'|=]+$)/g,nondigit:/[^\w,. \-()]/g,operators:/[<>=]/g},types:{regex:function(b,a,c,d){if(e.filter.regex.regex.test(a)){var f;b=e.filter.regex.regex.exec(a);try{f=RegExp(b[1],b[2]).test(d)}catch(g){f=!1}return f}return null},exact:function(b,a,c,d){return a.replace(e.filter.regex.exact,"")==d?!0:null},notMatch:function(b,a,c,d,f,e,h,n){return/^\!/.test(a)? (a=a.replace("!",""),b=d.search(l.trim(a)),""===a?!0:!(n.filter_startsWith?0===b:0<=b)):null},operators:function(b,a,c,d,f,g,h,l,q){if(/^[<>]=?/.test(a)){var m,k;m=h.config;b=e.formatFloat(a.replace(e.filter.regex.operators,""),h);c=m.parsers[g];l=b;if(q[g]||"numeric"===c.type)m=c.format(""+a.replace(e.filter.regex.operators,""),h,m.$headers.eq(g),g),b="number"!==typeof b||""===m||isNaN(m)?b:m;m=!q[g]&&"numeric"!==c.type||isNaN(b)||!f?isNaN(d)?e.formatFloat(d.replace(e.filter.regex.nondigit,""),h): e.formatFloat(d,h):f;/>/.test(a)&&(k=/>=/.test(a)?m>=b:m>b);/</.test(a)&&(k=/<=/.test(a)?m<=b:m<b);k||""!==l||(k=!0);return k}return null},and:function(b,a,c,d){if(/\s+(AND|&&)\s+/g.test(b)){b=a.split(/(?:\s+(?:and|&&)\s+)/g);a=0<=d.search(l.trim(b[0]));for(c=b.length-1;a&&c;)a=a&&0<=d.search(l.trim(b[c])),c--;return a}return null},range:function(b,a,c,d,f,g,h,l,q){if(/\s+(-|to)\s+/.test(a)){b=h.config;c=a.split(/(?: - | to )/);l=e.formatFloat(c[0].replace(e.filter.regex.nondigit,""),h);var m=e.formatFloat(c[1].replace(e.filter.regex.nondigit, ""),h);if(q[g]||"numeric"===b.parsers[g].type)a=b.parsers[g].format(""+c[0],h,b.$headers.eq(g),g),l=""===a||isNaN(a)?l:a,a=b.parsers[g].format(""+c[1],h,b.$headers.eq(g),g),m=""===a||isNaN(a)?m:a;a=!q[g]&&"numeric"!==b.parsers[g].type||isNaN(l)||isNaN(m)?isNaN(d)?e.formatFloat(d.replace(e.filter.regex.nondigit,""),h):e.formatFloat(d,h):f;l>m&&(a=l,l=m,m=a);return a>=l&&a<=m||""===l||""===m}return null},wild:function(b,a,c,d,f,e,h){return/[\?|\*]/.test(a)||/\s+OR\s+/.test(b)?(b=h.config,a=a.replace(/\s+OR\s+/gi, "|"),!b.$headers.filter('[data-column="'+e+'"]:last').hasClass("filter-match")&&/\|/.test(a)&&(a="^("+a+")$"),RegExp(a.replace(/\?/g,"\\S{1}").replace(/\*/g,"\\S*")).test(d)):null},fuzzy:function(b,a,c,d){if(/^~/.test(a)){b=0;c=d.length;var f=a.slice(1);for(a=0;a<c;a++)d[a]===f[b]&&(b+=1);return b===f.length?!0:!1}return null}},init:function(b,a,c){var d,f,g,h,n,q;a.debug&&(q=new Date);a.$table.addClass("hasFilters");e.filter.regex.child=RegExp(a.cssChildRow);e.filter.regex.filtered=RegExp(c.filter_filteredRow); !1!==c.filter_columnFilters&&a.$headers.filter(".filter-false").length!==a.$headers.length&&e.filter.buildRow(b,a,c);a.$table.bind("addRows updateCell update updateRows updateComplete appendCache filterReset filterEnd search ".split(" ").join(".tsfilter "),function(c,d){/(search|filterReset|filterEnd)/.test(c.type)||(c.stopPropagation(),e.filter.buildDefault(b,!0));"filterReset"===c.type&&e.filter.searching(b,[]);"filterEnd"===c.type?e.filter.buildDefault(b,!0):(d="search"===c.type?d:"updateComplete"=== c.type?a.$table.data("lastSearch"):"",e.filter.searching(b,d));return!1});e.filter.bindSearch(b,a.$table.find("input.tablesorter-filter"));c.filter_reset&&l(document).delegate(c.filter_reset,"click.tsfilter",function(){e.filter.searching(b,[])});if(c.filter_functions)for(h in c.filter_functions)if(c.filter_functions.hasOwnProperty(h)&&"string"===typeof h)if(g=a.$headers.filter('[data-column="'+h+'"]:last'),d="",!0===c.filter_functions[h]&&!g.hasClass("filter-false"))e.filter.buildSelect(h);else if("string"=== typeof h&&!g.hasClass("filter-false")){for(f in c.filter_functions[h])"string"===typeof f&&(d+=""===d?'<option value="">'+(g.data("placeholder")||g.attr("data-placeholder")||"")+"</option>":"",d+='<option value="'+f+'">'+f+"</option>");a.$table.find("thead").find('select.tablesorter-filter[data-column="'+h+'"]').append(d)}e.filter.buildDefault(b,!0);a.$table.find("select.tablesorter-filter").bind("change search",function(a,c){e.filter.checkFilters(b,c)});c.filter_hideFilters&&e.filter.hideFilters(b, a,c);a.showProcessing&&a.$table.bind("filterStart.tsfilter filterEnd.tsfilter",function(c,d){g=d?a.$table.find("."+e.css.header).filter("[data-column]").filter(function(){return""!==d[l(this).data("column")]}):"";e.isProcessing(b,"filterStart"===c.type,d?g:"")});a.debug&&e.benchmark("Applying Filter widget",q);a.$table.bind("tablesorter-initialized pagerInitialized",function(){n=e.filter.setDefaults(b,a,c)||[];n.length&&e.setFilters(b,n,!0)});c.filter_Initialized=!0;a.$table.trigger("filterInit"); e.filter.checkFilters(b)},setDefaults:function(b,a,c){var d,f=[],e=a.columns;for(d=0;d<e;d++)f[d]=a.$headers.filter('[data-column="'+d+'"]:last').attr(c.filter_defaultAttrib)||f[d];l(b).data("lastSearch",f);return f},buildRow:function(b,a,c){var d,f,g,h=a.columns;f='<tr class="tablesorter-filter-row">';for(b=0;b<h;b++)f+="<td></td>";a.$filters=l(f+"</tr>").appendTo(a.$table.find("thead").eq(0)).find("td");for(b=0;b<h;b++)d=a.$headers.filter('[data-column="'+b+'"]:last'),f=c.filter_functions&&c.filter_functions[b]&& "function"!==typeof c.filter_functions[b]||d.hasClass("filter-select"),g=e.getData?"false"===e.getData(d[0],a.headers[b],"filter"):a.headers[b]&&a.headers[b].hasOwnProperty("filter")&&!1===a.headers[b].filter||d.hasClass("filter-false"),f?f=l("<select>").appendTo(a.$filters.eq(b)):(c.filter_formatter&&l.isFunction(c.filter_formatter[b])?((f=c.filter_formatter[b](a.$filters.eq(b),b))&&0===f.length&&(f=a.$filters.eq(b).children("input")),f&&(0===f.parent().length||f.parent().length&&f.parent()[0]!== a.$filters[b])&&a.$filters.eq(b).append(f)):f=l('<input type="search">').appendTo(a.$filters.eq(b)),f&&f.attr("placeholder",d.data("placeholder")||d.attr("data-placeholder")||"")),f&&(f.addClass("tablesorter-filter "+c.filter_cssFilter).attr("data-column",b),g&&(f.addClass("disabled")[0].disabled=!0))},bindSearch:function(b,a){b=l(b)[0];var c,d=b.config.widgetOptions;a.bind("keyup search",function(a,g){if(27===a.which)this.value="";else if("number"===typeof d.filter_liveSearch&&this.value.length< d.filter_liveSearch&&""!==this.value||"keyup"===a.type&&(32>a.which&&8!==a.which&&!0===d.filter_liveSearch&&13!==a.which||37<=a.which&&40>=a.which||13!==a.which&&!1===d.filter_liveSearch))return;c=l(this).hasClass("tablesorter-filter")?g:[l(this).val()];e.filter.searching(b,g,c)})},checkFilters:function(b,a){var c=b.config,d=c.widgetOptions,f=l.isArray(a),g=f?a:e.getFilters(b),h=(g||[]).join("");f&&e.setFilters(b,g);d.filter_hideFilters&&c.$table.find(".tablesorter-filter-row").trigger(""===h?"mouseleave": "mouseenter");if(c.lastCombinedFilter!==h||!1===a)if(c.$table.trigger("filterStart",[g]),c.showProcessing)setTimeout(function(){e.filter.findRows(b,g,h);return!1},30);else return e.filter.findRows(b,g,h),!1},hideFilters:function(b,a,c){var d,f,g;a.$table.find(".tablesorter-filter-row").addClass("hideme").bind("mouseenter mouseleave",function(a){d=l(this);clearTimeout(g);g=setTimeout(function(){/enter|over/.test(a.type)?d.removeClass("hideme"):l(document.activeElement).closest("tr")[0]!==d[0]&&""=== e.getFilters(b).join("")&&d.addClass("hideme")},200)}).find("input, select").bind("focus blur",function(a){f=l(this).closest("tr");clearTimeout(g);g=setTimeout(function(){if(""===e.getFilters(b).join(""))f["focus"===a.type?"removeClass":"addClass"]("hideme")},200)})},findRows:function(b,a,c){var d,f,g,h,n,q,m,k,p,x,r,s,u,w,y,A,B,C,z,E,v=b.config,t=v.widgetOptions,G=v.columns,D=v.$tbodies,H=["range","operators"],F=v.$headers.map(function(a){return e.getData?"parsed"===e.getData(v.$headers.filter('[data-column="'+ a+'"]:last'),v.headers[a],"filter"):l(this).hasClass("filter-parsed")}).get();v.debug&&(E=new Date);for(n=0;n<D.length;n++)if(!D.eq(n).hasClass(e.css.info)){q=e.processTbody(b,D.eq(n),!0);g=q.children("tr").not("."+v.cssChildRow);f=g.length;if(""===c||t.filter_serversideFiltering)q.children().show().removeClass(t.filter_filteredRow);else for(B=!0,w=v.lastSearch||v.$table.data("lastSearch")||[],l.each(a,function(a,b){B=0===(b||"").indexOf(w[a]||"")&&B&&!/(\s+or\s+|\|)/g.test(b||"")}),B&&0===g.filter(":visible").length&& (B=!1),h=0;h<f;h++)if(p=g[h].className,!(e.filter.regex.child.test(p)||B&&e.filter.regex.filtered.test(p))){z=!0;p=g.eq(h).nextUntil("tr:not(."+v.cssChildRow+")");x=p.length&&t.filter_childRows?p.text():"";x=t.filter_ignoreCase?x.toLocaleLowerCase():x;m=g.eq(h).children("td");for(k=0;k<G;k++)if(a[k]||t.filter_anyMatch){d=v.cache[n].normalized[h][k];t.filter_useParsedData||F[k]?r=d:(r=l.trim(m.eq(k).text()),r=v.sortLocaleCompare?e.replaceAccents(r):r);s=!e.filter.regex.type.test(typeof r)&&t.filter_ignoreCase? r.toLocaleLowerCase():r;A=z;if("undefined"===typeof a[k]||null===a[k])a[k]=t.filter_anyMatch?c:a[k];a[k]=v.sortLocaleCompare?e.replaceAccents(a[k]):a[k];u=t.filter_ignoreCase?a[k].toLocaleLowerCase():a[k];t.filter_functions&&t.filter_functions[k]?!0===t.filter_functions[k]?A=v.$headers.filter('[data-column="'+k+'"]:last').hasClass("filter-match")?0<=s.search(u):a[k]===r:"function"===typeof t.filter_functions[k]?A=t.filter_functions[k](r,d,a[k],k,g.eq(h)):"function"===typeof t.filter_functions[k][a[k]]&& (A=t.filter_functions[k][a[k]](r,d,a[k],k,g.eq(h))):(C=null,l.each(e.filter.types,function(c,e){if(!t.filter_anyMatch||t.filter_anyMatch&&0>H.indexOf(c))if(y=e(a[k],u,r,s,d,k,b,t,F),null!==y)return C=y,!1}),null!==C?A=C:(r=(s+x).indexOf(u),A=!t.filter_startsWith&&0<=r||t.filter_startsWith&&0===r));if(t.filter_anyMatch){if(z=A)break}else z=A?z:!1}g[h].style.display=z?"":"none";g.eq(h)[z?"removeClass":"addClass"](t.filter_filteredRow);if(p.length){if(v.pager&&v.pager.countChildRows||t.pager_countChildRows)p[z? "removeClass":"addClass"](t.filter_filteredRow);p.toggle(z)}}e.processTbody(b,q,!1)}v.lastCombinedFilter=c;v.lastSearch=a;v.$table.data("lastSearch",a);v.debug&&e.benchmark("Completed filter widget search",E);v.$table.trigger("applyWidgets");v.$table.trigger("filterEnd")},buildSelect:function(b,a,c,d){a=parseInt(a,10);var f,g,h;b=b.config;var n=b.widgetOptions,q=b.$tbodies,m=[],k=b.$headers.filter('[data-column="'+a+'"]:last'),p='<option value="">'+(k.data("placeholder")||k.attr("data-placeholder")|| "")+"</option>";for(g=0;g<q.length;g++)for(h=b.cache[g].row.length,f=0;f<h;f++)d&&b.cache[g].row[f][0].className.match(n.filter_filteredRow)||(n.filter_useParsedData?m.push(""+b.cache[g].normalized[f][a]):(k=b.cache[g].row[f][0].cells[a])&&m.push(l.trim(k.textContent||k.innerText||l(k).text())));m=l.grep(m,function(a,b){return l.inArray(a,m)===b});m=e.sortNatural?m.sort(function(a,b){return e.sortNatural(a,b)}):m.sort(!0);f=b.$table.find("thead").find('select.tablesorter-filter[data-column="'+a+'"]').val(); for(d=0;d<m.length;d++)g=m[d].replace(/\"/g,"&quot;"),p+=""!==m[d]?'<option value="'+g+'"'+(f===g?' selected="selected"':"")+">"+m[d]+"</option>":"";b.$table.find("thead").find('select.tablesorter-filter[data-column="'+a+'"]')[c?"html":"append"](p)},buildDefault:function(b,a){var c,d,f=b.config,g=f.widgetOptions,h=f.columns;for(c=0;c<h;c++)d=f.$headers.filter('[data-column="'+c+'"]:last'),(d.hasClass("filter-select")||g.filter_functions&&!0===g.filter_functions[c])&&!d.hasClass("filter-false")&&(g.filter_functions|| (g.filter_functions={}),g.filter_functions[c]=!0,e.filter.buildSelect(b,c,a,d.hasClass(g.filter_onlyAvail)))},searching:function(b,a,c){if("undefined"===typeof a||!0===a||c){var d=b.config.widgetOptions;clearTimeout(d.searchTimer);d.searchTimer=setTimeout(function(){e.filter.checkFilters(b,c||a)},d.filter_liveSearch?d.filter_searchDelay:10)}else e.filter.checkFilters(b,a)}};
e.getFilters=function(b){var a=b?l(b)[0].config:{};return a&&a.widgetOptions&&!a.widgetOptions.filter_columnFilters?l(b).data("lastSearch"): a&&a.$filters?a.$filters.map(function(a,b){return l(b).find(".tablesorter-filter").val()||""}).get()||[]:!1};
e.setFilters=function(b,a,c){b=l(b);var d=b.length?b[0].config:{},d=d&&d.$filters?d.$filters.each(function(b,c){l(c).find(".tablesorter-filter").val(a[b]||"")}).trigger("change.tsfilter")||!1:!1;c&&b.trigger("search",[a,!1]);return!!d};
e.addWidget({id:"stickyHeaders",priority:60,options:{stickyHeaders:"",stickyHeaders_offset:0,stickyHeaders_cloneId:"-sticky",stickyHeaders_addResizeEvent:!0, stickyHeaders_includeCaption:!0,stickyHeaders_zIndex:2},format:function(b,a,c){if(!a.$table.hasClass("hasStickyHeaders")){var d=a.$table,f=l(window),g=d.children("thead:first"),h=g.children("tr:not(.sticky-false)").children(),n=d.find("tfoot"),q=isNaN(c.stickyHeaders_offset)?l(c.stickyHeaders_offset):"",m=q.length?q.height()||0:parseInt(c.stickyHeaders_offset,10)||0,k=c.stickyHeaders_zIndex?c.stickyHeaders_zIndex:2,p=c.$sticky=d.clone().addClass("containsStickyHeaders").css({position:"fixed",margin:0, top:m,visibility:"hidden",zIndex:k}),x=p.children("thead:first").addClass("tablesorter-stickyHeader "+c.stickyHeaders),r,s="",u=0,w=!1,y=function(){m=q.length?q.height()||0:parseInt(c.stickyHeaders_offset,10)||0;var a=navigator.userAgent;u=0;"collapse"===d.css("border-collapse")||/(webkit|msie)/i.test(a)||(u=2*parseInt(h.eq(0).css("border-left-width"),10));p.css({left:g.offset().left-f.scrollLeft()-u,width:d.width()});r.filter(":visible").each(function(a){a=h.filter(":visible").eq(a);l(this).css({width:a.width()- u,height:a.height()}).find(".tablesorter-header-inner").width(a.find(".tablesorter-header-inner").width())})};p.attr("id")&&(p[0].id+=c.stickyHeaders_cloneId);p.find("thead:gt(0), tr.sticky-false, tbody, tfoot").remove();c.stickyHeaders_includeCaption||p.find("caption").remove();r=x.children().children();p.css({height:0,width:0,padding:0,margin:0,border:0});r.find(".tablesorter-resizer").remove();d.addClass("hasStickyHeaders").bind("sortEnd.tsSticky",function(){h.filter(":visible").each(function(b){b= r.filter(":visible").eq(b);b.attr("class",l(this).attr("class")).removeClass(e.css.processing+" "+a.cssProcessing);a.cssIcon&&b.find("."+e.css.icon).attr("class",l(this).find("."+e.css.icon).attr("class"))})}).bind("pagerComplete.tsSticky",function(){y()});h.find(a.selectorSort).add(a.$headers.filter(a.selectorSort)).each(function(b){var c=l(this);b=x.children("tr.tablesorter-headerRow").children().eq(b).bind("mouseup",function(a){c.trigger(a,!0)});a.cancelSelection&&b.attr("unselectable","on").bind("selectstart", !1).css({"user-select":"none",MozUserSelect:"none"})});d.after(p);f.bind("scroll.tsSticky resize.tsSticky",function(a){if(d.is(":visible")){var b=d.offset(),e=c.stickyHeaders_includeCaption?0:d.find("caption").outerHeight(!0),e=f.scrollTop()+m-e,h=d.height()-(p.height()+(n.height()||0)),b=e>b.top&&e<b.top+h?"visible":"hidden";p.removeClass("tablesorter-sticky-visible tablesorter-sticky-hidden").addClass("tablesorter-sticky-"+b).css({left:g.offset().left-f.scrollLeft()-u,visibility:b});if(b!==s||"resize"=== a.type)y(),s=b}});c.stickyHeaders_addResizeEvent&&e.addHeaderResizeEvent(b);d.bind("filterEnd",function(){w||x.find(".tablesorter-filter-row").children().each(function(b){l(this).find(".tablesorter-filter").val(a.$filters.find(".tablesorter-filter").eq(b).val())})});r.find(".tablesorter-filter").bind("keyup search change",function(b){if(!(32>b.which&&8!==b.which||37<=b.which&&40>=b.which)){w=!0;b=l(this);var d=b.attr("data-column");a.$filters.find(".tablesorter-filter").eq(d).val(b.val()).trigger("search"); setTimeout(function(){w=!1},c.filter_searchDelay)}});d.trigger("stickyHeadersInit")}},remove:function(b,a,c){a.$table.removeClass("hasStickyHeaders").unbind("sortEnd.tsSticky pagerComplete.tsSticky").find(".tablesorter-stickyHeader").remove();c.$sticky&&c.$sticky.length&&c.$sticky.remove();l(".hasStickyHeaders").length||l(window).unbind("scroll.tsSticky resize.tsSticky");e.addHeaderResizeEvent(b,!1)}});
e.addWidget({id:"resizable",priority:40,options:{resizable:!0,resizable_addLastColumn:!1},format:function(b, a,c){if(!a.$table.hasClass("hasResizable")){a.$table.addClass("hasResizable");var d,f,g,h,n={},q,m,k,p,x=a.$table,r=0,s=null,u=null,w=20>Math.abs(x.parent().width()-x.width()),y=function(){e.storage&&s&&(n[s.index()]=s.width(),n[u.index()]=u.width(),s.width(n[s.index()]),u.width(n[u.index()]),!1!==c.resizable&&e.storage(b,"tablesorter-resizable",n));r=0;s=u=null;l(window).trigger("resize")};if(n=e.storage&&!1!==c.resizable?e.storage(b,"tablesorter-resizable"):{})for(h in n)!isNaN(h)&&h<a.$headers.length&& a.$headers.eq(h).width(n[h]);d=x.children("thead:first").children("tr");d.children().each(function(){f=l(this);g=f.attr("data-column");h="false"===e.getData(f,a.headers[g],"resizable");d.children().filter('[data-column="'+g+'"]').toggleClass("resizable-false",h)});d.each(function(){q=l(this).children(":not(.resizable-false)");l(this).find(".tablesorter-wrapper").length||q.wrapInner('<div class="tablesorter-wrapper" style="position:relative;height:100%;width:100%"></div>');c.resizable_addLastColumn|| (q=q.slice(0,-1));m=m?m.add(q):q});m.each(function(){d=l(this);h=parseInt(d.css("padding-right"),10)+10;f='<div class="tablesorter-resizer" style="cursor:w-resize;position:absolute;z-index:1;right:-'+h+'px;top:0;height:100%;width:20px;"></div>';d.find(".tablesorter-wrapper").append(f)}).bind("mousemove.tsresize",function(a){0!==r&&s&&(k=a.pageX-r,p=s.width(),s.width(p+k),s.width()!==p&&w&&u.width(u.width()-k),r=a.pageX)}).bind("mouseup.tsresize",function(){y()}).find(".tablesorter-resizer,.tablesorter-resizer-grip").bind("mousedown", function(b){s=l(b.target).closest("th");f=a.$headers.filter('[data-column="'+s.attr("data-column")+'"]');1<f.length&&(s=s.add(f));u=b.shiftKey?s.parent().find("th:not(.resizable-false)").filter(":last"):s.nextAll(":not(.resizable-false)").eq(0);r=b.pageX});x.find("thead:first").bind("mouseup.tsresize mouseleave.tsresize",function(){y()}).bind("contextmenu.tsresize",function(){e.resizableReset(b);var a=l.isEmptyObject?l.isEmptyObject(n):n==={};n={};return a})}},remove:function(b,a,c){a.$table.removeClass("hasResizable").find("thead").unbind("mouseup.tsresize mouseleave.tsresize contextmenu.tsresize").find("tr").children().unbind("mousemove.tsresize mouseup.tsresize").find(".tablesorter-resizer,.tablesorter-resizer-grip").remove(); e.resizableReset(b)}});
e.resizableReset=function(b){b.config.$headers.filter(":not(.resizable-false)").css("width","");e.storage&&e.storage(b,"tablesorter-resizable",{})};
e.addWidget({id:"saveSort",priority:20,options:{saveSort:!0},init:function(b,a,c,d){a.format(b,c,d,!0)},format:function(b,a,c,d){var f,g=a.$table;c=!1!==c.saveSort;var h={sortList:a.sortList};a.debug&&(f=new Date);g.hasClass("hasSaveSort")?c&&b.hasInitialized&&e.storage&&(e.storage(b,"tablesorter-savesort",h),a.debug&&e.benchmark("saveSort widget: Saving last sort: "+ a.sortList,f)):(g.addClass("hasSaveSort"),h="",e.storage&&(h=(c=e.storage(b,"tablesorter-savesort"))&&c.hasOwnProperty("sortList")&&l.isArray(c.sortList)?c.sortList:"",a.debug&&e.benchmark('saveSort: Last sort loaded: "'+h+'"',f),g.bind("saveSortReset",function(a){a.stopPropagation();e.storage(b,"tablesorter-savesort","")})),d&&h&&0<h.length?a.sortList=h:b.hasInitialized&&h&&0<h.length&&g.trigger("sorton",[h]))},remove:function(b){e.storage&&e.storage(b,"tablesorter-savesort","")}})
})(jQuery);