diff --git a/dist/js/widgets/widget-filter.min.js b/dist/js/widgets/widget-filter.min.js index e68fdd1b..fe9ba30d 100644 --- a/dist/js/widgets/widget-filter.min.js +++ b/dist/js/widgets/widget-filter.min.js @@ -1,2 +1,2 @@ -/*! Widget: filter - updated 1/10/2016 (v2.25.1) */ -!function(a){"use strict";var b,c,d=a.tablesorter||{},e=d.css;a.extend(e,{filterRow:"tablesorter-filter-row",filter:"tablesorter-filter",filterDisabled:"disabled",filterRowHide:"hideme"}),d.addWidget({id:"filter",priority:50,options:{filter_childRows:!1,filter_childByColumn:!1,filter_childWithSibs:!0,filter_columnFilters:!0,filter_columnAnyMatch:!0,filter_cellFilter:"",filter_cssFilter:"",filter_defaultFilter:{},filter_excludeFilter:{},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_searchFiltered:!0,filter_selectSource:null,filter_startsWith:!1,filter_useParsedData:!1,filter_serversideFiltering:!1,filter_defaultAttrib:"data-value",filter_selectSourceSeparator:"|"},format:function(a,c,d){c.$table.hasClass("hasFilters")||b.init(a,c,d)},remove:function(b,c,f,g){var h,i,j=c.$table,k=c.$tbodies,l="addRows updateCell update updateRows updateComplete appendCache filterReset filterEnd search ".split(" ").join(c.namespace+"filter ");if(j.removeClass("hasFilters").unbind(l.replace(d.regex.spaces," ")).find("."+e.filterRow).remove(),!g){for(h=0;h=]/g,query:"(q|query)",wild01:/\?/g,wild0More:/\*/g,quote:/\"/g,isNeg1:/(>=?\s*-\d)/,isNeg2:/(<=?\s*\d)/},types:{or:function(d,e,f){if((c.orTest.test(e.iFilter)||c.orSplit.test(e.filter))&&!c.regex.test(e.filter)){var g,h,i,j,k=a.extend({},e),l=e.filter.split(c.orSplit),m=e.iFilter.split(c.orSplit),n=l.length;for(g=0;n>g;g++){k.nestedFilters=!0,k.filter=""+(b.parseFilter(d,l[g],e)||""),k.iFilter=""+(b.parseFilter(d,m[g],e)||""),i="("+(b.parseFilter(d,k.filter,e)||"")+")";try{if(j=new RegExp(e.isMatch?i:"^"+i+"$",d.widgetOptions.filter_ignoreCase?"i":""),h=j.test(k.exact)||b.processTypes(d,k,f))return h}catch(o){return null}}return h||!1}return null},and:function(d,e,f){if(c.andTest.test(e.filter)){var g,h,i,j,k,l=a.extend({},e),m=e.filter.split(c.andSplit),n=e.iFilter.split(c.andSplit),o=m.length;for(g=0;o>g;g++){l.nestedFilters=!0,l.filter=""+(b.parseFilter(d,m[g],e)||""),l.iFilter=""+(b.parseFilter(d,n[g],e)||""),j=("("+(b.parseFilter(d,l.filter,e)||"")+")").replace(c.wild01,"\\S{1}").replace(c.wild0More,"\\S*");try{k=new RegExp(e.isMatch?j:"^"+j+"$",d.widgetOptions.filter_ignoreCase?"i":""),i=k.test(l.exact)||b.processTypes(d,l,f),h=0===g?i:h&&i}catch(p){return null}}return h||!1}return null},regex:function(a,b){if(c.regex.test(b.filter)){var d,e=b.filter_regexCache[b.index]||c.regex.exec(b.filter),f=e instanceof RegExp;try{f||(b.filter_regexCache[b.index]=e=new RegExp(e[1],e[2])),d=e.test(b.exact)}catch(g){d=!1}return d}return null},operators:function(e,f){if(c.operTest.test(f.iFilter)&&""!==f.iExact){var g,h,i,j=e.table,k=f.parsed[f.index],l=d.formatFloat(f.iFilter.replace(c.operators,""),j),m=e.parsers[f.index]||{},n=l;return(k||"numeric"===m.type)&&(i=a.trim(""+f.iFilter.replace(c.operators,"")),h=b.parseFilter(e,i,f,!0),l="number"!=typeof h||""===h||isNaN(h)?l:h),!k&&"numeric"!==m.type||isNaN(l)||"undefined"==typeof f.cache?(i=isNaN(f.iExact)?f.iExact.replace(d.regex.nondigit,""):f.iExact,g=d.formatFloat(i,j)):g=f.cache,c.gtTest.test(f.iFilter)?h=c.gteTest.test(f.iFilter)?g>=l:g>l:c.ltTest.test(f.iFilter)&&(h=c.lteTest.test(f.iFilter)?l>=g:l>g),h||""!==n||(h=!0),h}return null},notMatch:function(d,e){if(c.notTest.test(e.iFilter)){var f,g=e.iFilter.replace("!",""),h=b.parseFilter(d,g,e)||"";return c.exact.test(h)?(h=h.replace(c.exact,""),""===h?!0:a.trim(h)!==e.iExact):(f=e.iExact.search(a.trim(h)),""===h?!0:!(d.widgetOptions.filter_startsWith?0===f:f>=0))}return null},exact:function(d,e){if(c.exact.test(e.iFilter)){var f=e.iFilter.replace(c.exact,""),g=b.parseFilter(d,f,e)||"";return e.anyMatch?a.inArray(g,e.rowArray)>=0:g==e.iExact}return null},range:function(a,e){if(c.toTest.test(e.iFilter)){var f,g,h,i,j=a.table,k=e.index,l=e.parsed[k],m=e.iFilter.split(c.toSplit);return g=m[0].replace(d.regex.nondigit,"")||"",h=d.formatFloat(b.parseFilter(a,g,e),j),g=m[1].replace(d.regex.nondigit,"")||"",i=d.formatFloat(b.parseFilter(a,g,e),j),(l||"numeric"===a.parsers[k].type)&&(f=a.parsers[k].format(""+m[0],j,a.$headers.eq(k),k),h=""===f||isNaN(f)?h:f,f=a.parsers[k].format(""+m[1],j,a.$headers.eq(k),k),i=""===f||isNaN(f)?i:f),!l&&"numeric"!==a.parsers[k].type||isNaN(h)||isNaN(i)?(g=isNaN(e.iExact)?e.iExact.replace(d.regex.nondigit,""):e.iExact,f=d.formatFloat(g,j)):f=e.cache,h>i&&(g=h,h=i,i=g),f>=h&&i>=f||""===h||""===i}return null},wild:function(a,d){if(c.wildOrTest.test(d.iFilter)){var e=""+(b.parseFilter(a,d.iFilter,d)||"");!c.wildTest.test(e)&&d.nestedFilters&&(e=d.isMatch?e:"^("+e+")$");try{return new RegExp(e.replace(c.wild01,"\\S{1}").replace(c.wild0More,"\\S*"),a.widgetOptions.filter_ignoreCase?"i":"").test(d.exact)}catch(f){return null}}return null},fuzzy:function(a,d){if(c.fuzzyTest.test(d.iFilter)){var e,f=0,g=d.iExact.length,h=d.iFilter.slice(1),i=b.parseFilter(a,h,d)||"";for(e=0;g>e;e++)d.iExact[e]===i[f]&&(f+=1);return f===i.length}return null}},init:function(f,g,h){d.language=a.extend(!0,{},{to:"to",or:"or",and:"and"},d.language);var i,j,k,l,m,n,o,p,q;if(g.$table.addClass("hasFilters"),g.lastSearch=[],h.filter_searchTimer=null,h.filter_initTimer=null,h.filter_formatterCount=0,h.filter_formatterInit=[],h.filter_anyColumnSelector='[data-column="all"],[data-column="any"]',h.filter_multipleColumnSelector='[data-column*="-"],[data-column*=","]',o="\\{"+c.query+"\\}",a.extend(c,{child:new RegExp(g.cssChildRow),filtered:new RegExp(h.filter_filteredRow),alreadyFiltered:new RegExp("(\\s+("+d.language.or+"|-|"+d.language.to+")\\s+)","i"),toTest:new RegExp("\\s+(-|"+d.language.to+")\\s+","i"),toSplit:new RegExp("(?:\\s+(?:-|"+d.language.to+")\\s+)","gi"),andTest:new RegExp("\\s+("+d.language.and+"|&&)\\s+","i"),andSplit:new RegExp("(?:\\s+(?:"+d.language.and+"|&&)\\s+)","gi"),orTest:new RegExp("(\\||\\s+"+d.language.or+"\\s+)","i"),orSplit:new RegExp("(?:\\s+(?:"+d.language.or+")\\s+|\\|)","gi"),iQuery:new RegExp(o,"i"),igQuery:new RegExp(o,"ig"),operTest:/^[<>]=?/,gtTest:/>/,gteTest:/>=/,ltTest:/'+(l.data("placeholder")||l.attr("data-placeholder")||h.filter_placeholder.select||"")+"":"",o=j,k=j,j.indexOf(h.filter_selectSourceSeparator)>=0&&(o=j.split(h.filter_selectSourceSeparator),k=o[1],o=o[0]),i+="");g.$table.find("thead").find("select."+e.filter+'[data-column="'+m+'"]').append(i),k=h.filter_selectSource,p="function"==typeof k?!0:d.getColumnData(f,k,m),p&&b.buildSelect(g.table,m,"",!0,l.hasClass(h.filter_onlyAvail))}b.buildDefault(f,!0),b.bindSearch(f,g.$table.find("."+e.filter),!0),h.filter_external&&b.bindSearch(f,h.filter_external),h.filter_hideFilters&&b.hideFilters(g),g.showProcessing&&(k="filterStart filterEnd ".split(" ").join(g.namespace+"filter "),g.$table.unbind(k.replace(d.regex.spaces," ")).bind(k,function(b,c){l=c?g.$table.find("."+e.header).filter("[data-column]").filter(function(){return""!==c[a(this).data("column")]}):"",d.isProcessing(f,"filterStart"===b.type,c?l:"")})),g.filteredRows=g.totalRows,k="tablesorter-initialized pagerBeforeInitialized ".split(" ").join(g.namespace+"filter "),g.$table.unbind(k.replace(d.regex.spaces," ")).bind(k,function(){var a=this.config.widgetOptions;n=b.setDefaults(f,g,a)||[],n.length&&(g.delayInit&&""===n.join("")||d.setFilters(f,n,!0)),g.$table.triggerHandler("filterFomatterUpdate"),setTimeout(function(){a.filter_initialized||b.filterInitComplete(g)},100)}),g.pager&&g.pager.initialized&&!h.filter_initialized&&(g.$table.triggerHandler("filterFomatterUpdate"),setTimeout(function(){b.filterInitComplete(g)},100))},formatterUpdated:function(a,b){var c=a&&a.closest("table")[0].config.widgetOptions;c&&!c.filter_initialized&&(c.filter_formatterInit[b]=1)},filterInitComplete:function(c){var d,e,f=c.widgetOptions,g=0,h=function(){f.filter_initialized=!0,c.$table.triggerHandler("filterInit",c),b.findRows(c.table,c.$table.data("lastSearch")||[])};if(a.isEmptyObject(f.filter_formatter))h();else{for(e=f.filter_formatterInit.length,d=0;e>d;d++)1===f.filter_formatterInit[d]&&g++;clearTimeout(f.filter_initTimer),f.filter_initialized||g!==f.filter_formatterCount?f.filter_initialized||(f.filter_initTimer=setTimeout(function(){h()},500)):h()}},processFilters:function(a,b){var c,d=b?encodeURIComponent:decodeURIComponent,e=a.length;for(c=0;e>c;c++)a[c]=d(a[c]);return a},setDefaults:function(c,e,f){var g,h,i,j,k,l=d.getFilters(c)||[];if(f.filter_saveFilters&&d.storage&&(h=d.storage(c,"tablesorter-filters")||[],g=a.isArray(h),g&&""===h.join("")||!g||(l=b.processFilters(h))),""===l.join(""))for(k=e.$headers.add(f.filter_$externalFilters).filter("["+f.filter_defaultAttrib+"]"),i=0;i<=e.columns;i++)j=i===e.columns?"all":i,l[i]=k.filter('[data-column="'+j+'"]').attr(f.filter_defaultAttrib)||l[i]||"";return e.$table.data("lastSearch",l),l},parseFilter:function(a,b,c,d){return d||c.parsed[c.index]?a.parsers[c.index].format(b,a.table,[],c.index):b},buildRow:function(c,f,g){var h,i,j,k,l,m,n,o,p,q=g.filter_cellFilter,r=f.columns,s=a.isArray(q),t='';for(j=0;r>j;j++)f.$headerIndexed[j].length&&(p=f.$headerIndexed[j]&&f.$headerIndexed[j][0].colSpan||0,t+=p>1?'").appendTo(f.$table.children("thead").eq(0)).children("td"),j=0;r>j;j++)m=!1,k=f.$headerIndexed[j],k&&k.length&&(h=b.getColumnElm(f,f.$filters,j),o=d.getColumnData(c,g.filter_functions,j),l=g.filter_functions&&o&&"function"!=typeof o||k.hasClass("filter-select"),i=d.getColumnData(c,f.headers,j),m="false"===d.getData(k[0],i,"filter")||"false"===d.getData(k[0],i,"parser"),l?t=a("').appendTo(h),t&&(p=k.data("placeholder")||k.attr("data-placeholder")||g.filter_placeholder.search||"",t.attr("placeholder",p))),t&&(n=(a.isArray(g.filter_cssFilter)?"undefined"!=typeof g.filter_cssFilter[j]?g.filter_cssFilter[j]||"":"":g.filter_cssFilter)||"",t.addClass(e.filter+" "+n).attr("data-column",h.attr("data-column")),m&&(t.attr("placeholder","").addClass(e.filterDisabled)[0].disabled=!0)))},bindSearch:function(c,e,f){if(c=a(c)[0],e=a(e),e.length){var g,h=c.config,i=h.widgetOptions,j=h.namespace+"filter",k=i.filter_$externalFilters;f!==!0&&(g=i.filter_anyColumnSelector+","+i.filter_multipleColumnSelector,i.filter_$anyMatch=e.filter(g),k&&k.length?i.filter_$externalFilters=i.filter_$externalFilters.add(e):i.filter_$externalFilters=e,d.setFilters(c,h.$table.data("lastSearch")||[],f===!1)),g="keypress keyup search change ".split(" ").join(j+" "),e.attr("data-lastSearchTime",(new Date).getTime()).unbind(g.replace(d.regex.spaces," ")).bind("keyup"+j,function(d){if(a(this).attr("data-lastSearchTime",(new Date).getTime()),27===d.which)this.value="";else{if(i.filter_liveSearch===!1)return;if(""!==this.value&&("number"==typeof i.filter_liveSearch&&this.value.length=37&&d.which<=40)))return}b.searching(c,!0,!0)}).bind("search change keypress ".split(" ").join(j+" "),function(d){var e=parseInt(a(this).attr("data-column"),10);i.filter_initialized&&(13===d.which||"search"===d.type||"change"===d.type&&this.value!==h.lastSearch[e])&&(d.preventDefault(),a(this).attr("data-lastSearchTime",(new Date).getTime()),b.searching(c,!1,!0))})}},searching:function(a,c,d){var e=a.config.widgetOptions;clearTimeout(e.filter_searchTimer),"undefined"==typeof c||c===!0?e.filter_searchTimer=setTimeout(function(){b.checkFilters(a,c,d)},e.filter_liveSearch?e.filter_searchDelay:10):b.checkFilters(a,c,d)},checkFilters:function(c,f,g){var h=c.config,i=h.widgetOptions,j=a.isArray(f),k=j?f:d.getFilters(c,!0),l=(k||[]).join("");return a.isEmptyObject(h.cache)?void(h.delayInit&&h.pager&&h.pager.initialized&&d.updateCache(h,function(){b.checkFilters(c,!1,g)})):(j&&(d.setFilters(c,k,!1,g!==!0),i.filter_initialized||(h.lastCombinedFilter="")),i.filter_hideFilters&&h.$table.find("."+e.filterRow).triggerHandler(""===l?"mouseleave":"mouseenter"),h.lastCombinedFilter!==l||f===!1?(f===!1&&(h.lastCombinedFilter=null,h.lastSearch=[]),k=k||[],k=Array.prototype.map?k.map(String):k.join("�").split("�"),i.filter_initialized&&h.$table.triggerHandler("filterStart",[k]),h.showProcessing?void setTimeout(function(){return b.findRows(c,k,l),!1},30):(b.findRows(c,k,l),!1)):void 0)},hideFilters:function(b,c){var f,g=(c||b.$table).find("."+e.filterRow).addClass(e.filterRowHide);g.bind("mouseenter mouseleave",function(c){var d=c,g=a(this);clearTimeout(f),f=setTimeout(function(){/enter|over/.test(d.type)?g.removeClass(e.filterRowHide):a(document.activeElement).closest("tr")[0]!==g[0]&&""===b.lastCombinedFilter&&g.addClass(e.filterRowHide)},200)}).find("input, select").bind("focus blur",function(c){var g=c,h=a(this).closest("tr");clearTimeout(f),f=setTimeout(function(){clearTimeout(f),""===d.getFilters(b.$table).join("")&&h.toggleClass(e.filterRowHide,"focus"!==g.type)},200)})},defaultFilter:function(b,d){if(""===b)return b;var e=c.iQuery,f=d.match(c.igQuery).length,g=f>1?a.trim(b).split(/\s/):[a.trim(b)],h=g.length-1,i=0,j=d;for(1>h&&f>1&&(g[1]=g[0]);e.test(j);)j=j.replace(e,g[i++]||""),e.test(j)&&h>i&&""!==(g[i]||"")&&(j=d.replace(e,j));return j},getLatestSearch:function(b){return b?b.sort(function(b,c){return a(c).attr("data-lastSearchTime")-a(b).attr("data-lastSearchTime")}):b||a()},findRange:function(a,b,c){var d,e,f,g,h,i,j,k,l,m=[];if(/^[0-9]+$/.test(b))return[parseInt(b,10)];if(!c&&/-/.test(b))for(e=b.match(/(\d+)\s*-\s*(\d+)/g),l=e?e.length:0,k=0;l>k;k++){for(f=e[k].split(/\s*-\s*/),g=parseInt(f[0],10)||0,h=parseInt(f[1],10)||a.columns-1,g>h&&(d=g,g=h,h=d),h>=a.columns&&(h=a.columns-1);h>=g;g++)m.push(g);b=b.replace(e[k],"")}if(!c&&/,/.test(b))for(i=b.split(/\s*,\s*/),l=i.length,j=0;l>j;j++)""!==i[j]&&(k=parseInt(i[j],10),k-1})},multipleColumns:function(c,d){var e=c.widgetOptions,f=e.filter_initialized||!d.filter(e.filter_anyColumnSelector).length,g=a.trim(b.getLatestSearch(d).attr("data-column")||"");return b.findRange(c,g,!f)},processTypes:function(c,d,e){var f,g=null,h=null;for(f in b.types)a.inArray(f,e.excludeMatch)<0&&null===h&&(h=b.types[f](c,d,e),null!==h&&(g=h));return g},processRow:function(e,f,g){var h,i,j,k,l,m=e.widgetOptions,n=!0,o=m.filter_$anyMatch&&m.filter_$anyMatch.length?b.multipleColumns(e,m.filter_$anyMatch):[];if(f.$cells=f.$row.children(),f.anyMatchFlag&&o.length>1){if(f.anyMatch=!0,f.isMatch=!0,f.rowArray=f.$cells.map(function(b){return a.inArray(b,o)>-1?(f.parsed[b]?l=f.cacheArray[b]:(l=f.rawArray[b],l=a.trim(m.filter_ignoreCase?l.toLowerCase():l),e.sortLocaleCompare&&(l=d.replaceAccents(l))),l):void 0}).get(),f.filter=f.anyMatchFilter,f.iFilter=f.iAnyMatchFilter,f.exact=f.rowArray.join(" "),f.iExact=m.filter_ignoreCase?f.exact.toLowerCase():f.exact,f.cache=f.cacheArray.slice(0,-1).join(" "),g.excludeMatch=g.noAnyMatch,i=b.processTypes(e,f,g),null!==i)n=i;else if(m.filter_startsWith)for(n=!1,o=Math.min(e.columns,f.rowArray.length);!n&&o>0;)o--,n=n||0===f.rowArray[o].indexOf(f.iFilter);else n=(f.iExact+f.childRowText).indexOf(f.iFilter)>=0;if(f.anyMatch=!1,f.filters.join("")===f.filter)return n}for(o=0;o=0:f.filter===f.exact:"function"==typeof j?i=j(f.exact,f.cache,f.filter,o,f.$row,e,f):"function"==typeof j[k||f.filter]&&(l=k||f.filter,i=j[l](f.exact,f.cache,f.filter,o,f.$row,e,f))),null===i?(i=b.processTypes(e,f,g),null!==i?h=i:(l=(f.iExact+f.childRowText).indexOf(b.parseFilter(e,f.iFilter,f)),h=!m.filter_startsWith&&l>=0||m.filter_startsWith&&0===l)):h=i,n=h?n:!1);return n},findRows:function(e,f,g){if(e.config.lastCombinedFilter!==g&&e.config.widgetOptions.filter_initialized){var h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F=a.extend([],f),G=e.config,H=G.widgetOptions,I={anyMatch:!1,filters:f,filter_regexCache:[]},J={noAnyMatch:["range","notMatch","operators"],functions:[],excludeFilter:[],defaultColFilter:[],defaultAnyFilter:d.getColumnData(e,H.filter_defaultFilter,G.columns,!0)||""};for(I.parsed=[],p=0;p1&&(D=parseInt(C[0],10)-1,D>=0&&Dx;x++)w=f[x]||"",z||(x=p),z=z&&s.length&&0===w.indexOf(s[x]||"")&&!c.alreadyFiltered.test(w)&&!c.exactTest.test(w)&&!(c.isNeg1.test(w)||c.isNeg2.test(w))&&!(""!==w&&G.$filters&&G.$filters.filter('[data-column="'+x+'"]').find("select").length&&!G.$headerIndexed[x].hasClass("filter-match"));for(y=k.not("."+H.filter_filteredRow).length,z&&0===y&&(z=!1),G.debug&&console.log("Filter: Searching through "+(z&&h>y?y:"all")+" rows"),I.anyMatchFlag&&(G.sortLocaleCompare&&(I.anyMatchFilter=d.replaceAccents(I.anyMatchFilter)),H.filter_defaultFilter&&c.iQuery.test(J.defaultAnyFilter)&&(I.anyMatchFilter=b.defaultFilter(I.anyMatchFilter,J.defaultAnyFilter),z=!1),I.iAnyMatchFilter=H.filter_ignoreCase&&G.ignoreCase?I.anyMatchFilter.toLowerCase():I.anyMatchFilter),m=0;h>m;m++)if(E=k[m].className,q=m&&c.child.test(E),!(q||z&&c.filtered.test(E))){if(I.$row=k.eq(m),I.cacheArray=i[m],j=I.cacheArray[G.columns],I.rawArray=j.raw,I.childRowText="",!H.filter_childByColumn){for(E="",r=j.child,x=0;x")>=0)return l;a.isArray(l)?i=l:"object"===a.type(j)&&l&&(i=l(c,e,f))}return i===!1&&(i=b.getOptions(c,e,f)),b.processOptions(c,e,i)},processOptions:function(b,c,e){if(!a.isArray(e))return!1;b=a(b)[0];var f,g,h,i,j,k,l=b.config,m="undefined"!=typeof c&&null!==c&&c>=0&&ch;h++)g=e[h],k=g.text?g.text:g,j=(m&&l.parsers&&l.parsers.length&&l.parsers[c].format(k,b,[],c)||k).toString(),j=l.widgetOptions.filter_ignoreCase?j.toLowerCase():j,g.text?(g.parsed=j,n.push(g)):n.push({text:g,parsed:j});for(f=l.textSorter||"",n.sort(function(a,e){var g=a.parsed,h=e.parsed;return m&&"function"==typeof f?f(g,h,!0,c,b):m&&"object"==typeof f&&f.hasOwnProperty(c)?f[c](g,h,!0,c,b):d.sortNatural?d.sortNatural(g,h):!0}),e=[],i=n.length,h=0;i>h;h++)e.push(n[h]);return e},getOptions:function(b,c,e){b=a(b)[0];var f,g,h,i,j,k,l,m,n=b.config,o=n.widgetOptions,p=[];for(g=0;gf;f++)if(i=j.row?j.row[f]:j.normalized[f][n.columns].$row[0],!e||!i.className.match(o.filter_filteredRow))if(o.filter_useParsedData||n.parsers[c].parsed||n.$headerIndexed[c].hasClass("filter-parsed")){if(p.push(""+j.normalized[f][c]),o.filter_childRows&&o.filter_childByColumn)for(m=j.normalized[f][n.columns].$row.length-1,k=0;m>k;k++)p.push(""+j.normalized[f][n.columns].child[k][c])}else if(p.push(j.normalized[f][n.columns].raw[c]),o.filter_childRows&&o.filter_childByColumn)for(m=j.normalized[f][n.columns].$row.length,k=1;m>k;k++)l=j.normalized[f][n.columns].$row.eq(k).children().eq(c),p.push(""+d.getElementText(n,l,c));return p},buildSelect:function(d,f,g,h,i){if(d=a(d)[0],f=parseInt(f,10),d.config.cache&&!a.isEmptyObject(d.config.cache)){var j,k,l,m,n,o,p,q=d.config,r=q.widgetOptions,s=q.$headerIndexed[f],t='",u=q.$table.find("thead").find("select."+e.filter+'[data-column="'+f+'"]').val();if(("undefined"==typeof g||""===g)&&(g=b.getOptionSource(d,f,i)),a.isArray(g)){for(j=0;j"}else""+p!="[object Object]"&&(l=p=(""+p).replace(c.quote,"""),k=l,l.indexOf(r.filter_selectSourceSeparator)>=0&&(m=l.split(r.filter_selectSourceSeparator),k=m[0],l=m[1]),t+=""!==p?"":"");g=[]}n=(q.$filters?q.$filters:q.$table.children("thead")).find("."+e.filter),r.filter_$externalFilters&&(n=n&&n.length?n.add(r.filter_$externalFilters):r.filter_$externalFilters),o=n.filter('select[data-column="'+f+'"]'),o.length&&(o[h?"html":"append"](t),a.isArray(g)||o.append(g).val(u),o.val(u))}},buildDefault:function(a,c){var e,f,g,h=a.config,i=h.widgetOptions,j=h.columns;for(e=0;j>e;e++)f=h.$headerIndexed[e],g=!(f.hasClass("filter-false")||f.hasClass("parser-false")),(f.hasClass("filter-select")||d.getColumnData(a,i.filter_functions,e)===!0)&&g&&b.buildSelect(a,e,"",c,f.hasClass(i.filter_onlyAvail))}},c=b.regex,d.getFilters=function(c,d,f,g){var h,i,j,k,l=!1,m=c?a(c)[0].config:"",n=m?m.widgetOptions:"";if(d!==!0&&n&&!n.filter_columnFilters||a.isArray(f)&&f.join("")===m.lastCombinedFilter)return a(c).data("lastSearch");if(m&&(m.$filters&&(i=m.$filters.find("."+e.filter)),n.filter_$externalFilters&&(i=i&&i.length?i.add(n.filter_$externalFilters):n.filter_$externalFilters),i&&i.length))for(l=f||[],h=0;h1&&(j=j.slice(1)),h===m.columns&&(k=j.filter(n.filter_anyColumnSelector),j=k.length?k:j),j.val(f[h]).trigger("change"+m.namespace)):(l[h]=j.val()||"",h===m.columns?j.slice(1).filter('[data-column*="'+j.attr("data-column")+'"]').val(l[h]):j.slice(1).val(l[h])),h===m.columns&&j.length&&(n.filter_$anyMatch=j));return 0===l.length&&(l=!1),l},d.setFilters=function(c,e,f,g){var h=c?a(c)[0].config:"",i=d.getFilters(c,!0,e,g);return"undefined"==typeof f&&(f=!0),h&&f&&(h.lastCombinedFilter=null,h.lastSearch=[],b.searching(h.table,e,g),h.$table.triggerHandler("filterFomatterUpdate")),!!i}}(jQuery); \ No newline at end of file +/*! Widget: filter - updated 1/14/2016 (v2.25.2) */ +!function(a){"use strict";var b,c,d=a.tablesorter||{},e=d.css,f=d.keyCodes;a.extend(e,{filterRow:"tablesorter-filter-row",filter:"tablesorter-filter",filterDisabled:"disabled",filterRowHide:"hideme"}),a.extend(f,{backSpace:8,escape:27,space:32,left:37,down:40}),d.addWidget({id:"filter",priority:50,options:{filter_childRows:!1,filter_childByColumn:!1,filter_childWithSibs:!0,filter_columnFilters:!0,filter_columnAnyMatch:!0,filter_cellFilter:"",filter_cssFilter:"",filter_defaultFilter:{},filter_excludeFilter:{},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_resetOnEsc:!0,filter_saveFilters:!1,filter_searchDelay:300,filter_searchFiltered:!0,filter_selectSource:null,filter_startsWith:!1,filter_useParsedData:!1,filter_serversideFiltering:!1,filter_defaultAttrib:"data-value",filter_selectSourceSeparator:"|"},format:function(a,c,d){c.$table.hasClass("hasFilters")||b.init(a,c,d)},remove:function(b,c,f,g){var h,i,j=c.$table,k=c.$tbodies,l="addRows updateCell update updateRows updateComplete appendCache filterReset filterEnd search ".split(" ").join(c.namespace+"filter ");if(j.removeClass("hasFilters").unbind(l.replace(d.regex.spaces," ")).find("."+e.filterRow).remove(),!g){for(h=0;h=]/g,query:"(q|query)",wild01:/\?/g,wild0More:/\*/g,quote:/\"/g,isNeg1:/(>=?\s*-\d)/,isNeg2:/(<=?\s*\d)/},types:{or:function(d,e,f){if((c.orTest.test(e.iFilter)||c.orSplit.test(e.filter))&&!c.regex.test(e.filter)){var g,h,i,j,k=a.extend({},e),l=e.filter.split(c.orSplit),m=e.iFilter.split(c.orSplit),n=l.length;for(g=0;n>g;g++){k.nestedFilters=!0,k.filter=""+(b.parseFilter(d,l[g],e)||""),k.iFilter=""+(b.parseFilter(d,m[g],e)||""),i="("+(b.parseFilter(d,k.filter,e)||"")+")";try{if(j=new RegExp(e.isMatch?i:"^"+i+"$",d.widgetOptions.filter_ignoreCase?"i":""),h=j.test(k.exact)||b.processTypes(d,k,f))return h}catch(o){return null}}return h||!1}return null},and:function(d,e,f){if(c.andTest.test(e.filter)){var g,h,i,j,k,l=a.extend({},e),m=e.filter.split(c.andSplit),n=e.iFilter.split(c.andSplit),o=m.length;for(g=0;o>g;g++){l.nestedFilters=!0,l.filter=""+(b.parseFilter(d,m[g],e)||""),l.iFilter=""+(b.parseFilter(d,n[g],e)||""),j=("("+(b.parseFilter(d,l.filter,e)||"")+")").replace(c.wild01,"\\S{1}").replace(c.wild0More,"\\S*");try{k=new RegExp(e.isMatch?j:"^"+j+"$",d.widgetOptions.filter_ignoreCase?"i":""),i=k.test(l.exact)||b.processTypes(d,l,f),h=0===g?i:h&&i}catch(p){return null}}return h||!1}return null},regex:function(a,b){if(c.regex.test(b.filter)){var d,e=b.filter_regexCache[b.index]||c.regex.exec(b.filter),f=e instanceof RegExp;try{f||(b.filter_regexCache[b.index]=e=new RegExp(e[1],e[2])),d=e.test(b.exact)}catch(g){d=!1}return d}return null},operators:function(e,f){if(c.operTest.test(f.iFilter)&&""!==f.iExact){var g,h,i,j=e.table,k=f.parsed[f.index],l=d.formatFloat(f.iFilter.replace(c.operators,""),j),m=e.parsers[f.index]||{},n=l;return(k||"numeric"===m.type)&&(i=a.trim(""+f.iFilter.replace(c.operators,"")),h=b.parseFilter(e,i,f,!0),l="number"!=typeof h||""===h||isNaN(h)?l:h),!k&&"numeric"!==m.type||isNaN(l)||"undefined"==typeof f.cache?(i=isNaN(f.iExact)?f.iExact.replace(d.regex.nondigit,""):f.iExact,g=d.formatFloat(i,j)):g=f.cache,c.gtTest.test(f.iFilter)?h=c.gteTest.test(f.iFilter)?g>=l:g>l:c.ltTest.test(f.iFilter)&&(h=c.lteTest.test(f.iFilter)?l>=g:l>g),h||""!==n||(h=!0),h}return null},notMatch:function(d,e){if(c.notTest.test(e.iFilter)){var f,g=e.iFilter.replace("!",""),h=b.parseFilter(d,g,e)||"";return c.exact.test(h)?(h=h.replace(c.exact,""),""===h?!0:a.trim(h)!==e.iExact):(f=e.iExact.search(a.trim(h)),""===h?!0:!(d.widgetOptions.filter_startsWith?0===f:f>=0))}return null},exact:function(d,e){if(c.exact.test(e.iFilter)){var f=e.iFilter.replace(c.exact,""),g=b.parseFilter(d,f,e)||"";return e.anyMatch?a.inArray(g,e.rowArray)>=0:g==e.iExact}return null},range:function(a,e){if(c.toTest.test(e.iFilter)){var f,g,h,i,j=a.table,k=e.index,l=e.parsed[k],m=e.iFilter.split(c.toSplit);return g=m[0].replace(d.regex.nondigit,"")||"",h=d.formatFloat(b.parseFilter(a,g,e),j),g=m[1].replace(d.regex.nondigit,"")||"",i=d.formatFloat(b.parseFilter(a,g,e),j),(l||"numeric"===a.parsers[k].type)&&(f=a.parsers[k].format(""+m[0],j,a.$headers.eq(k),k),h=""===f||isNaN(f)?h:f,f=a.parsers[k].format(""+m[1],j,a.$headers.eq(k),k),i=""===f||isNaN(f)?i:f),!l&&"numeric"!==a.parsers[k].type||isNaN(h)||isNaN(i)?(g=isNaN(e.iExact)?e.iExact.replace(d.regex.nondigit,""):e.iExact,f=d.formatFloat(g,j)):f=e.cache,h>i&&(g=h,h=i,i=g),f>=h&&i>=f||""===h||""===i}return null},wild:function(a,d){if(c.wildOrTest.test(d.iFilter)){var e=""+(b.parseFilter(a,d.iFilter,d)||"");!c.wildTest.test(e)&&d.nestedFilters&&(e=d.isMatch?e:"^("+e+")$");try{return new RegExp(e.replace(c.wild01,"\\S{1}").replace(c.wild0More,"\\S*"),a.widgetOptions.filter_ignoreCase?"i":"").test(d.exact)}catch(f){return null}}return null},fuzzy:function(a,d){if(c.fuzzyTest.test(d.iFilter)){var e,f=0,g=d.iExact.length,h=d.iFilter.slice(1),i=b.parseFilter(a,h,d)||"";for(e=0;g>e;e++)d.iExact[e]===i[f]&&(f+=1);return f===i.length}return null}},init:function(f,g,h){d.language=a.extend(!0,{},{to:"to",or:"or",and:"and"},d.language);var i,j,k,l,m,n,o,p,q;if(g.$table.addClass("hasFilters"),g.lastSearch=[],h.filter_searchTimer=null,h.filter_initTimer=null,h.filter_formatterCount=0,h.filter_formatterInit=[],h.filter_anyColumnSelector='[data-column="all"],[data-column="any"]',h.filter_multipleColumnSelector='[data-column*="-"],[data-column*=","]',o="\\{"+c.query+"\\}",a.extend(c,{child:new RegExp(g.cssChildRow),filtered:new RegExp(h.filter_filteredRow),alreadyFiltered:new RegExp("(\\s+("+d.language.or+"|-|"+d.language.to+")\\s+)","i"),toTest:new RegExp("\\s+(-|"+d.language.to+")\\s+","i"),toSplit:new RegExp("(?:\\s+(?:-|"+d.language.to+")\\s+)","gi"),andTest:new RegExp("\\s+("+d.language.and+"|&&)\\s+","i"),andSplit:new RegExp("(?:\\s+(?:"+d.language.and+"|&&)\\s+)","gi"),orTest:new RegExp("(\\||\\s+"+d.language.or+"\\s+)","i"),orSplit:new RegExp("(?:\\s+(?:"+d.language.or+")\\s+|\\|)","gi"),iQuery:new RegExp(o,"i"),igQuery:new RegExp(o,"ig"),operTest:/^[<>]=?/,gtTest:/>/,gteTest:/>=/,ltTest:/'+(l.data("placeholder")||l.attr("data-placeholder")||h.filter_placeholder.select||"")+"":"",o=j,k=j,j.indexOf(h.filter_selectSourceSeparator)>=0&&(o=j.split(h.filter_selectSourceSeparator),k=o[1],o=o[0]),i+="");g.$table.find("thead").find("select."+e.filter+'[data-column="'+m+'"]').append(i),k=h.filter_selectSource,p="function"==typeof k?!0:d.getColumnData(f,k,m),p&&b.buildSelect(g.table,m,"",!0,l.hasClass(h.filter_onlyAvail))}b.buildDefault(f,!0),b.bindSearch(f,g.$table.find("."+e.filter),!0),h.filter_external&&b.bindSearch(f,h.filter_external),h.filter_hideFilters&&b.hideFilters(g),g.showProcessing&&(k="filterStart filterEnd ".split(" ").join(g.namespace+"filter "),g.$table.unbind(k.replace(d.regex.spaces," ")).bind(k,function(b,c){l=c?g.$table.find("."+e.header).filter("[data-column]").filter(function(){return""!==c[a(this).data("column")]}):"",d.isProcessing(f,"filterStart"===b.type,c?l:"")})),g.filteredRows=g.totalRows,k="tablesorter-initialized pagerBeforeInitialized ".split(" ").join(g.namespace+"filter "),g.$table.unbind(k.replace(d.regex.spaces," ")).bind(k,function(){var a=this.config.widgetOptions;n=b.setDefaults(f,g,a)||[],n.length&&(g.delayInit&&""===n.join("")||d.setFilters(f,n,!0)),g.$table.triggerHandler("filterFomatterUpdate"),setTimeout(function(){a.filter_initialized||b.filterInitComplete(g)},100)}),g.pager&&g.pager.initialized&&!h.filter_initialized&&(g.$table.triggerHandler("filterFomatterUpdate"),setTimeout(function(){b.filterInitComplete(g)},100))},formatterUpdated:function(a,b){var c=a&&a.closest("table")[0].config.widgetOptions;c&&!c.filter_initialized&&(c.filter_formatterInit[b]=1)},filterInitComplete:function(c){var d,e,f=c.widgetOptions,g=0,h=function(){f.filter_initialized=!0,c.$table.triggerHandler("filterInit",c),b.findRows(c.table,c.$table.data("lastSearch")||[])};if(a.isEmptyObject(f.filter_formatter))h();else{for(e=f.filter_formatterInit.length,d=0;e>d;d++)1===f.filter_formatterInit[d]&&g++;clearTimeout(f.filter_initTimer),f.filter_initialized||g!==f.filter_formatterCount?f.filter_initialized||(f.filter_initTimer=setTimeout(function(){h()},500)):h()}},processFilters:function(a,b){var c,d=b?encodeURIComponent:decodeURIComponent,e=a.length;for(c=0;e>c;c++)a[c]=d(a[c]);return a},setDefaults:function(c,e,f){var g,h,i,j,k,l=d.getFilters(c)||[];if(f.filter_saveFilters&&d.storage&&(h=d.storage(c,"tablesorter-filters")||[],g=a.isArray(h),g&&""===h.join("")||!g||(l=b.processFilters(h))),""===l.join(""))for(k=e.$headers.add(f.filter_$externalFilters).filter("["+f.filter_defaultAttrib+"]"),i=0;i<=e.columns;i++)j=i===e.columns?"all":i,l[i]=k.filter('[data-column="'+j+'"]').attr(f.filter_defaultAttrib)||l[i]||"";return e.$table.data("lastSearch",l),l},parseFilter:function(a,b,c,d){return d||c.parsed[c.index]?a.parsers[c.index].format(b,a.table,[],c.index):b},buildRow:function(c,f,g){var h,i,j,k,l,m,n,o,p,q=g.filter_cellFilter,r=f.columns,s=a.isArray(q),t='';for(j=0;r>j;j++)f.$headerIndexed[j].length&&(p=f.$headerIndexed[j]&&f.$headerIndexed[j][0].colSpan||0,t+=p>1?'").appendTo(f.$table.children("thead").eq(0)).children("td"),j=0;r>j;j++)m=!1,k=f.$headerIndexed[j],k&&k.length&&(h=b.getColumnElm(f,f.$filters,j),o=d.getColumnData(c,g.filter_functions,j),l=g.filter_functions&&o&&"function"!=typeof o||k.hasClass("filter-select"),i=d.getColumnData(c,f.headers,j),m="false"===d.getData(k[0],i,"filter")||"false"===d.getData(k[0],i,"parser"),l?t=a("').appendTo(h),t&&(p=k.data("placeholder")||k.attr("data-placeholder")||g.filter_placeholder.search||"",t.attr("placeholder",p))),t&&(n=(a.isArray(g.filter_cssFilter)?"undefined"!=typeof g.filter_cssFilter[j]?g.filter_cssFilter[j]||"":"":g.filter_cssFilter)||"",t.addClass(e.filter+" "+n).attr("data-column",h.attr("data-column")),m&&(t.attr("placeholder","").addClass(e.filterDisabled)[0].disabled=!0)))},bindSearch:function(c,e,g){if(c=a(c)[0],e=a(e),e.length){var h,i=c.config,j=i.widgetOptions,k=i.namespace+"filter",l=j.filter_$externalFilters;g!==!0&&(h=j.filter_anyColumnSelector+","+j.filter_multipleColumnSelector,j.filter_$anyMatch=e.filter(h),l&&l.length?j.filter_$externalFilters=j.filter_$externalFilters.add(e):j.filter_$externalFilters=e,d.setFilters(c,i.$table.data("lastSearch")||[],g===!1)),h="keypress keyup keydown search change input ".split(" ").join(k+" "),e.attr("data-lastSearchTime",(new Date).getTime()).unbind(h.replace(d.regex.spaces," ")).bind("keydown"+k,function(a){return a.which!==f.escape||j.filter_resetOnEsc?void 0:!1}).bind("keyup"+k,function(d){var e=parseInt(a(this).attr("data-column"),10);if(a(this).attr("data-lastSearchTime",(new Date).getTime()),d.which===f.escape)this.value=j.filter_resetOnEsc?"":i.lastSearch[e];else{if(j.filter_liveSearch===!1)return;if(""!==this.value&&("number"==typeof j.filter_liveSearch&&this.value.length=f.left&&d.which<=f.down)))return}b.searching(c,!0,!0)}).bind("search change keypress input ".split(" ").join(k+" "),function(d){var e=parseInt(a(this).attr("data-column"),10);!j.filter_initialized||d.which!==f.enter&&"search"!==d.type&&("change"!==d.type&&"input"!==d.type||this.value===i.lastSearch[e])||(d.preventDefault(),a(this).attr("data-lastSearchTime",(new Date).getTime()),b.searching(c,!1,!0))})}},searching:function(a,c,d){var e=a.config.widgetOptions;clearTimeout(e.filter_searchTimer),"undefined"==typeof c||c===!0?e.filter_searchTimer=setTimeout(function(){b.checkFilters(a,c,d)},e.filter_liveSearch?e.filter_searchDelay:10):b.checkFilters(a,c,d)},checkFilters:function(c,f,g){var h=c.config,i=h.widgetOptions,j=a.isArray(f),k=j?f:d.getFilters(c,!0),l=(k||[]).join("");return a.isEmptyObject(h.cache)?void(h.delayInit&&h.pager&&h.pager.initialized&&d.updateCache(h,function(){b.checkFilters(c,!1,g)})):(j&&(d.setFilters(c,k,!1,g!==!0),i.filter_initialized||(h.lastCombinedFilter="")),i.filter_hideFilters&&h.$table.find("."+e.filterRow).triggerHandler(""===l?"mouseleave":"mouseenter"),h.lastCombinedFilter!==l||f===!1?(f===!1&&(h.lastCombinedFilter=null,h.lastSearch=[]),k=k||[],k=Array.prototype.map?k.map(String):k.join("�").split("�"),i.filter_initialized&&h.$table.triggerHandler("filterStart",[k]),h.showProcessing?void setTimeout(function(){return b.findRows(c,k,l),!1},30):(b.findRows(c,k,l),!1)):void 0)},hideFilters:function(b,c){var f,g=(c||b.$table).find("."+e.filterRow).addClass(e.filterRowHide);g.bind("mouseenter mouseleave",function(c){var d=c,g=a(this);clearTimeout(f),f=setTimeout(function(){/enter|over/.test(d.type)?g.removeClass(e.filterRowHide):a(document.activeElement).closest("tr")[0]!==g[0]&&""===b.lastCombinedFilter&&g.addClass(e.filterRowHide)},200)}).find("input, select").bind("focus blur",function(c){var g=c,h=a(this).closest("tr");clearTimeout(f),f=setTimeout(function(){clearTimeout(f),""===d.getFilters(b.$table).join("")&&h.toggleClass(e.filterRowHide,"focus"!==g.type)},200)})},defaultFilter:function(b,d){if(""===b)return b;var e=c.iQuery,f=d.match(c.igQuery).length,g=f>1?a.trim(b).split(/\s/):[a.trim(b)],h=g.length-1,i=0,j=d;for(1>h&&f>1&&(g[1]=g[0]);e.test(j);)j=j.replace(e,g[i++]||""),e.test(j)&&h>i&&""!==(g[i]||"")&&(j=d.replace(e,j));return j},getLatestSearch:function(b){return b?b.sort(function(b,c){return a(c).attr("data-lastSearchTime")-a(b).attr("data-lastSearchTime")}):b||a()},findRange:function(a,b,c){var d,e,f,g,h,i,j,k,l,m=[];if(/^[0-9]+$/.test(b))return[parseInt(b,10)];if(!c&&/-/.test(b))for(e=b.match(/(\d+)\s*-\s*(\d+)/g),l=e?e.length:0,k=0;l>k;k++){for(f=e[k].split(/\s*-\s*/),g=parseInt(f[0],10)||0,h=parseInt(f[1],10)||a.columns-1,g>h&&(d=g,g=h,h=d),h>=a.columns&&(h=a.columns-1);h>=g;g++)m.push(g);b=b.replace(e[k],"")}if(!c&&/,/.test(b))for(i=b.split(/\s*,\s*/),l=i.length,j=0;l>j;j++)""!==i[j]&&(k=parseInt(i[j],10),k-1})},multipleColumns:function(c,d){var e=c.widgetOptions,f=e.filter_initialized||!d.filter(e.filter_anyColumnSelector).length,g=a.trim(b.getLatestSearch(d).attr("data-column")||"");return b.findRange(c,g,!f)},processTypes:function(c,d,e){var f,g=null,h=null;for(f in b.types)a.inArray(f,e.excludeMatch)<0&&null===h&&(h=b.types[f](c,d,e),null!==h&&(g=h));return g},processRow:function(e,f,g){var h,i,j,k,l,m=e.widgetOptions,n=!0,o=m.filter_$anyMatch&&m.filter_$anyMatch.length?b.multipleColumns(e,m.filter_$anyMatch):[];if(f.$cells=f.$row.children(),f.anyMatchFlag&&o.length>1){if(f.anyMatch=!0,f.isMatch=!0,f.rowArray=f.$cells.map(function(b){return a.inArray(b,o)>-1?(f.parsed[b]?l=f.cacheArray[b]:(l=f.rawArray[b],l=a.trim(m.filter_ignoreCase?l.toLowerCase():l),e.sortLocaleCompare&&(l=d.replaceAccents(l))),l):void 0}).get(),f.filter=f.anyMatchFilter,f.iFilter=f.iAnyMatchFilter,f.exact=f.rowArray.join(" "),f.iExact=m.filter_ignoreCase?f.exact.toLowerCase():f.exact,f.cache=f.cacheArray.slice(0,-1).join(" "),g.excludeMatch=g.noAnyMatch,i=b.processTypes(e,f,g),null!==i)n=i;else if(m.filter_startsWith)for(n=!1,o=Math.min(e.columns,f.rowArray.length);!n&&o>0;)o--,n=n||0===f.rowArray[o].indexOf(f.iFilter);else n=(f.iExact+f.childRowText).indexOf(f.iFilter)>=0;if(f.anyMatch=!1,f.filters.join("")===f.filter)return n}for(o=0;o=0:f.filter===f.exact:"function"==typeof j?i=j(f.exact,f.cache,f.filter,o,f.$row,e,f):"function"==typeof j[k||f.filter]&&(l=k||f.filter,i=j[l](f.exact,f.cache,f.filter,o,f.$row,e,f))),null===i?(i=b.processTypes(e,f,g),null!==i?h=i:(l=(f.iExact+f.childRowText).indexOf(b.parseFilter(e,f.iFilter,f)),h=!m.filter_startsWith&&l>=0||m.filter_startsWith&&0===l)):h=i,n=h?n:!1);return n},findRows:function(e,f,g){if(e.config.lastCombinedFilter!==g&&e.config.widgetOptions.filter_initialized){var h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F=a.extend([],f),G=e.config,H=G.widgetOptions,I={anyMatch:!1,filters:f,filter_regexCache:[]},J={noAnyMatch:["range","notMatch","operators"],functions:[],excludeFilter:[],defaultColFilter:[],defaultAnyFilter:d.getColumnData(e,H.filter_defaultFilter,G.columns,!0)||""};for(I.parsed=[],p=0;p1&&(D=parseInt(C[0],10)-1,D>=0&&Dx;x++)w=f[x]||"",z||(x=p),z=z&&s.length&&0===w.indexOf(s[x]||"")&&!c.alreadyFiltered.test(w)&&!c.exactTest.test(w)&&!(c.isNeg1.test(w)||c.isNeg2.test(w))&&!(""!==w&&G.$filters&&G.$filters.filter('[data-column="'+x+'"]').find("select").length&&!G.$headerIndexed[x].hasClass("filter-match"));for(y=k.not("."+H.filter_filteredRow).length,z&&0===y&&(z=!1),G.debug&&console.log("Filter: Searching through "+(z&&h>y?y:"all")+" rows"),I.anyMatchFlag&&(G.sortLocaleCompare&&(I.anyMatchFilter=d.replaceAccents(I.anyMatchFilter)),H.filter_defaultFilter&&c.iQuery.test(J.defaultAnyFilter)&&(I.anyMatchFilter=b.defaultFilter(I.anyMatchFilter,J.defaultAnyFilter),z=!1),I.iAnyMatchFilter=H.filter_ignoreCase&&G.ignoreCase?I.anyMatchFilter.toLowerCase():I.anyMatchFilter),m=0;h>m;m++)if(E=k[m].className,q=m&&c.child.test(E),!(q||z&&c.filtered.test(E))){if(I.$row=k.eq(m),I.cacheArray=i[m],j=I.cacheArray[G.columns],I.rawArray=j.raw,I.childRowText="",!H.filter_childByColumn){for(E="",r=j.child,x=0;x")>=0)return l;a.isArray(l)?i=l:"object"===a.type(j)&&l&&(i=l(c,e,f))}return i===!1&&(i=b.getOptions(c,e,f)),b.processOptions(c,e,i)},processOptions:function(b,c,e){if(!a.isArray(e))return!1;b=a(b)[0];var f,g,h,i,j,k,l=b.config,m="undefined"!=typeof c&&null!==c&&c>=0&&ch;h++)g=e[h],k=g.text?g.text:g,j=(m&&l.parsers&&l.parsers.length&&l.parsers[c].format(k,b,[],c)||k).toString(),j=l.widgetOptions.filter_ignoreCase?j.toLowerCase():j,g.text?(g.parsed=j,n.push(g)):n.push({text:g,parsed:j});for(f=l.textSorter||"",n.sort(function(a,e){var g=a.parsed,h=e.parsed;return m&&"function"==typeof f?f(g,h,!0,c,b):m&&"object"==typeof f&&f.hasOwnProperty(c)?f[c](g,h,!0,c,b):d.sortNatural?d.sortNatural(g,h):!0}),e=[],i=n.length,h=0;i>h;h++)e.push(n[h]);return e},getOptions:function(b,c,e){b=a(b)[0];var f,g,h,i,j,k,l,m,n=b.config,o=n.widgetOptions,p=[];for(g=0;gf;f++)if(i=j.row?j.row[f]:j.normalized[f][n.columns].$row[0],!e||!i.className.match(o.filter_filteredRow))if(o.filter_useParsedData||n.parsers[c].parsed||n.$headerIndexed[c].hasClass("filter-parsed")){if(p.push(""+j.normalized[f][c]),o.filter_childRows&&o.filter_childByColumn)for(m=j.normalized[f][n.columns].$row.length-1,k=0;m>k;k++)p.push(""+j.normalized[f][n.columns].child[k][c])}else if(p.push(j.normalized[f][n.columns].raw[c]),o.filter_childRows&&o.filter_childByColumn)for(m=j.normalized[f][n.columns].$row.length,k=1;m>k;k++)l=j.normalized[f][n.columns].$row.eq(k).children().eq(c),p.push(""+d.getElementText(n,l,c));return p},buildSelect:function(d,f,g,h,i){if(d=a(d)[0],f=parseInt(f,10),d.config.cache&&!a.isEmptyObject(d.config.cache)){var j,k,l,m,n,o,p,q=d.config,r=q.widgetOptions,s=q.$headerIndexed[f],t='",u=q.$table.find("thead").find("select."+e.filter+'[data-column="'+f+'"]').val();if(("undefined"==typeof g||""===g)&&(g=b.getOptionSource(d,f,i)),a.isArray(g)){for(j=0;j"}else""+p!="[object Object]"&&(l=p=(""+p).replace(c.quote,"""),k=l,l.indexOf(r.filter_selectSourceSeparator)>=0&&(m=l.split(r.filter_selectSourceSeparator),k=m[0],l=m[1]),t+=""!==p?"":"");g=[]}n=(q.$filters?q.$filters:q.$table.children("thead")).find("."+e.filter),r.filter_$externalFilters&&(n=n&&n.length?n.add(r.filter_$externalFilters):r.filter_$externalFilters),o=n.filter('select[data-column="'+f+'"]'),o.length&&(o[h?"html":"append"](t),a.isArray(g)||o.append(g).val(u),o.val(u))}},buildDefault:function(a,c){var e,f,g,h=a.config,i=h.widgetOptions,j=h.columns;for(e=0;j>e;e++)f=h.$headerIndexed[e],g=!(f.hasClass("filter-false")||f.hasClass("parser-false")),(f.hasClass("filter-select")||d.getColumnData(a,i.filter_functions,e)===!0)&&g&&b.buildSelect(a,e,"",c,f.hasClass(i.filter_onlyAvail))}},c=b.regex,d.getFilters=function(c,d,f,g){var h,i,j,k,l=!1,m=c?a(c)[0].config:"",n=m?m.widgetOptions:"";if(d!==!0&&n&&!n.filter_columnFilters||a.isArray(f)&&f.join("")===m.lastCombinedFilter)return a(c).data("lastSearch");if(m&&(m.$filters&&(i=m.$filters.find("."+e.filter)),n.filter_$externalFilters&&(i=i&&i.length?i.add(n.filter_$externalFilters):n.filter_$externalFilters),i&&i.length))for(l=f||[],h=0;h1&&(j=j.slice(1)),h===m.columns&&(k=j.filter(n.filter_anyColumnSelector),j=k.length?k:j),j.val(f[h]).trigger("change"+m.namespace)):(l[h]=j.val()||"",h===m.columns?j.slice(1).filter('[data-column*="'+j.attr("data-column")+'"]').val(l[h]):j.slice(1).val(l[h])),h===m.columns&&j.length&&(n.filter_$anyMatch=j));return 0===l.length&&(l=!1),l},d.setFilters=function(c,e,f,g){var h=c?a(c)[0].config:"",i=d.getFilters(c,!0,e,g);return"undefined"==typeof f&&(f=!0),h&&f&&(h.lastCombinedFilter=null,h.lastSearch=[],b.searching(h.table,e,g),h.$table.triggerHandler("filterFomatterUpdate")),!!i}}(jQuery); \ No newline at end of file diff --git a/docs/example-widget-filter.html b/docs/example-widget-filter.html index d1d6f3ba..01a8faba 100644 --- a/docs/example-widget-filter.html +++ b/docs/example-widget-filter.html @@ -112,6 +112,9 @@ // jQuery selector string of an element used to reset the filters filter_reset : 'button.reset', + // Reset filter input when the user presses escape - normalized across browsers + filter_resetOnEsc : true, + // Use the $.tablesorter.storage utility to save the most recent filters (default setting is false) filter_saveFilters : true, @@ -228,6 +231,7 @@ $(function(){

Notes

    +
  • In v2.25.2, added filter_resetOnEsc option.
  • In v2.22.2,
    • The getFilters function will now target the last used filter properly.
    • @@ -513,6 +517,12 @@ $(function(){ jQuery selector string of an element used to reset the filters (v2.4; v2.16.0). + + filter_resetOnEsc + true + Press escape to clear filter input - normalized across browsers (v2.25.2). + + filter_saveFilters false diff --git a/docs/index.html b/docs/index.html index 8d4f7981..32b995d5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -458,7 +458,7 @@
    • Column selector widget (v2.15; v2.25.1).
    • Content editable widget (v2.9; v2.25.0).
    • Beta Dragtable mod - (jQuery UI widget for column reordering [ref]; v2.24.0).
    • -
    • Filter widget (v2.25.1): +
    • Filter widget (v2.25.2):
      • basic (v2.0.18; v2.23.5).
      • external option (match any column) (v2.13.3; v2.22.0).
      • @@ -1901,6 +1901,8 @@ $(function(){ filter_placeholder : { search : '', select : '' }, // jQuery selector string of an element used to reset the filters. filter_reset : null, + // Reset filter input when the user presses escape - normalized across browsers + filter_resetOnEsc : true, // Use the $.tablesorter.storage utility to save the most recent filters filter_saveFilters : false, // typing delay in milliseconds before starting a search. @@ -2963,6 +2965,20 @@ filter_cssFilter : [ '', 'hidden', '', 'hidden' ] Example + + + Boolean + true + + Filter widget: when true, normalize pressing escape to clear filter input across browsers (v2.25.2). +
        +

        Webkit browsers automatically clear the filter search input when pressing escape, but IE and Firefox do not. Setting this option to true, clears the filter input when the user presses escape.

        + When this option is set to false, pressing escape inside the search field is ignored. +
        + + + + Boolean diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js index c5acc46d..5ddc369c 100644 --- a/js/jquery.tablesorter.js +++ b/js/jquery.tablesorter.js @@ -190,6 +190,10 @@ bottom : false }, + keyCodes : { + enter : 13 + }, + // placeholder date parser data (globalize) dates : {}, @@ -458,7 +462,7 @@ // only recognize left clicks if ( ( ( e.which || e.button ) !== 1 && !type.match( ' ' + c.pointerClick + ' | sort | keyup ' ) ) || // allow pressing enter - ( type === ' keyup ' && e.which !== 13 ) || + ( type === ' keyup ' && e.which !== ts.keyCodes.enter ) || // allow triggering a click event (e.which is undefined) & ignore physical clicks ( type.match( ' ' + c.pointerClick + ' ' ) && typeof e.which !== 'undefined' ) ) { return; diff --git a/js/widgets/widget-filter.js b/js/widgets/widget-filter.js index 6977e64b..19ac3bcd 100644 --- a/js/widgets/widget-filter.js +++ b/js/widgets/widget-filter.js @@ -1,4 +1,4 @@ -/*! Widget: filter - updated 1/10/2016 (v2.25.1) *//* +/*! Widget: filter - updated 1/14/2016 (v2.25.2) *//* * Requires tablesorter v2.8+ and jQuery 1.7+ * by Rob Garrison */ @@ -6,7 +6,8 @@ 'use strict'; var tsf, tsfRegex, ts = $.tablesorter || {}, - tscss = ts.css; + tscss = ts.css, + tskeyCodes = ts.keyCodes; $.extend( tscss, { filterRow : 'tablesorter-filter-row', @@ -15,6 +16,14 @@ filterRowHide : 'hideme' }); + $.extend( tskeyCodes, { + backSpace : 8, + escape : 27, + space : 32, + left : 37, + down : 40 + }); + ts.addWidget({ id: 'filter', priority: 50, @@ -39,6 +48,7 @@ filter_onlyAvail : 'filter-onlyAvail', // a header with a select dropdown & this class name will only show available ( visible ) options within the drop down filter_placeholder : { search : '', select : '' }, // default placeholder text ( overridden by any header 'data-placeholder' setting ) filter_reset : null, // jQuery selector string of an element used to reset the filters + filter_resetOnEsc : true, // Reset filter input when the user presses escape - normalized across browsers filter_saveFilters : false, // Use the $.tablesorter.storage utility to save the most recent filters filter_searchDelay : 300, // typing delay in milliseconds before starting a search filter_searchFiltered: true, // allow searching through already filtered rows in special circumstances; will speed up searching in large tables if true @@ -747,18 +757,25 @@ ts.setFilters( table, c.$table.data( 'lastSearch' ) || [], internal === false ); } // unbind events - tmp = ( 'keypress keyup search change '.split( ' ' ).join( namespace + ' ' ) ); + tmp = ( 'keypress keyup keydown search change input '.split( ' ' ).join( namespace + ' ' ) ); $el // use data attribute instead of jQuery data since the head is cloned without including // the data/binding .attr( 'data-lastSearchTime', new Date().getTime() ) .unbind( tmp.replace( ts.regex.spaces, ' ' ) ) - // include change for select - fixes #473 + .bind( 'keydown' + namespace, function( event ) { + if ( event.which === tskeyCodes.escape && !wo.filter_resetOnEsc ) { + // prevent keypress event + return false; + } + }) .bind( 'keyup' + namespace, function( event ) { + var column = parseInt( $( this ).attr( 'data-column' ), 10 ); $( this ).attr( 'data-lastSearchTime', new Date().getTime() ); // emulate what webkit does.... escape clears the filter - if ( event.which === 27 ) { - this.value = ''; + if ( event.which === tskeyCodes.escape ) { + // make sure to restore the last value on escape + this.value = wo.filter_resetOnEsc ? '' : c.lastSearch[column]; // live search } else if ( wo.filter_liveSearch === false ) { return; @@ -767,19 +784,21 @@ // liveSearch can contain a min value length; ignore arrow and meta keys, but allow backspace ( typeof wo.filter_liveSearch === 'number' && this.value.length < wo.filter_liveSearch ) || // let return & backspace continue on, but ignore arrows & non-valid characters - ( event.which !== 13 && event.which !== 8 && - ( event.which < 32 || ( event.which >= 37 && event.which <= 40 ) ) ) ) ) { + ( event.which !== tskeyCodes.enter && event.which !== tskeyCodes.backSpace && + ( event.which < tskeyCodes.space || ( event.which >= tskeyCodes.left && event.which <= tskeyCodes.down ) ) ) ) ) { return; } // change event = no delay; last true flag tells getFilters to skip newest timed input tsf.searching( table, true, true ); }) - .bind( 'search change keypress '.split( ' ' ).join( namespace + ' ' ), function( event ) { + // include change for select - fixes #473 + .bind( 'search change keypress input '.split( ' ' ).join( namespace + ' ' ), function( event ) { // don't get cached data, in case data-column changes dynamically var column = parseInt( $( this ).attr( 'data-column' ), 10 ); // don't allow 'change' event to process if the input value is the same - fixes #685 - if ( wo.filter_initialized && ( event.which === 13 || event.type === 'search' || - event.type === 'change' && this.value !== c.lastSearch[column] ) ) { + if ( wo.filter_initialized && ( event.which === tskeyCodes.enter || event.type === 'search' || + // only "input" event fires in MS Edge when clicking the "x" to clear the search + ( event.type === 'change' || event.type === 'input' ) && this.value !== c.lastSearch[column] ) ) { event.preventDefault(); // init search with no delay $( this ).attr( 'data-lastSearchTime', new Date().getTime() );