tablesorter/js/jquery.tablesorter.widgets.min.js
2014-05-05 20:52:17 -05:00

18 lines
30 KiB
JavaScript

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