mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
18 lines
38 KiB
JavaScript
18 lines
38 KiB
JavaScript
/*! tableSorter (FORK) 2.16+ widgets - updated 2/7/2015 (v2.19.0) */
|
|
;(function(k,A){
|
|
var e=k.tablesorter=k.tablesorter||{};
|
|
e.themes={bootstrap:{table:"table table-bordered table-striped",caption:"caption",header:"bootstrap-header",sortNone:"",sortAsc:"",sortDesc:"",active:"",hover:"",icons:"",iconSortNone:"bootstrap-icon-unsorted",iconSortAsc:"icon-chevron-up glyphicon glyphicon-chevron-up",iconSortDesc:"icon-chevron-down glyphicon glyphicon-chevron-down",filterRow:"",footerRow:"",footerCells:"",even:"",odd:""},jui:{table:"ui-widget ui-widget-content ui-corner-all", caption:"ui-widget-content",header:"ui-widget-header ui-corner-all ui-state-default",sortNone:"",sortAsc:"",sortDesc:"",active:"ui-state-active",hover:"ui-state-hover",icons:"ui-icon",iconSortNone:"ui-icon-carat-2-n-s",iconSortAsc:"ui-icon-carat-1-n",iconSortDesc:"ui-icon-carat-1-s",filterRow:"",footerRow:"",footerCells:"",even:"ui-widget-content",odd:"ui-state-default"}};k.extend(e.css,{filterRow:"tablesorter-filter-row",filter:"tablesorter-filter",wrapper:"tablesorter-wrapper",resizer:"tablesorter-resizer", sticky:"tablesorter-stickyHeader",stickyVis:"tablesorter-sticky-visible",stickyWrap:"tablesorter-sticky-wrapper"});
|
|
e.storage=function(d,a,b,c){d=k(d)[0];var f,e,g=!1;f={};e=d.config;var n=k(d);d=c&&c.id||n.attr(c&&c.group||"data-table-group")||d.id||k(".tablesorter").index(n);c=c&&c.url||n.attr(c&&c.page||"data-table-page")||e&&e.fixedUrl||A.location.pathname;if("localStorage"in A)try{A.localStorage.setItem("_tmptest","temp"),g=!0,A.localStorage.removeItem("_tmptest")}catch(m){}k.parseJSON&&(g?f= k.parseJSON(localStorage[a]||"null")||{}:(e=document.cookie.split(/[;\s|=]/),f=k.inArray(a,e)+1,f=0!==f?k.parseJSON(e[f]||"null")||{}:{}));if((b||""===b)&&A.JSON&&JSON.hasOwnProperty("stringify"))f[c]||(f[c]={}),f[c][d]=b,g?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[c]?f[c][d]:""};
|
|
e.addHeaderResizeEvent=function(d,a,b){d=k(d)[0];var c;b=k.extend({}, {timer:250},b);var e=d.config,h=e.widgetOptions,g=function(a){h.resize_flag=!0;c=[];e.$headers.each(function(){var a=k(this),b=a.data("savedSizes")||[0,0],d=this.offsetWidth,e=this.offsetHeight;if(d!==b[0]||e!==b[1])a.data("savedSizes",[d,e]),c.push(this)});c.length&&!1!==a&&e.$table.trigger("resize",[c]);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()},b.timer)};
|
|
e.addWidget({id:"uitheme",priority:10,format:function(d, a,b){var c,f,h,g,n,m;c=e.themes;g=a.$table.add(a.$extraTables);d=a.$headers.add(a.$extraHeaders);var r=a.theme||"jui",p=c[r]||{},w=k.trim([p.sortNone,p.sortDesc,p.sortAsc,p.active].join(" ")),x=k.trim([p.iconSortNone,p.iconSortDesc,p.iconSortAsc].join(" "));a.debug&&(h=new Date);g.hasClass("tablesorter-"+r)&&a.theme===a.appliedTheme&&b.uitheme_applied||(b.uitheme_applied=!0,c=c[a.appliedTheme]||{},f=(m=!k.isEmptyObject(c))?[c.sortNone,c.sortDesc,c.sortAsc,c.active].join(" "):"",n=m?[c.iconSortNone, c.iconSortDesc,c.iconSortAsc].join(" "):"",m&&(b.zebra[0]=k.trim(" "+b.zebra[0].replace(" "+c.even,"")),b.zebra[1]=k.trim(" "+b.zebra[1].replace(" "+c.odd,"")),a.$tbodies.children().removeClass([c.even,c.odd].join(" "))),p.even&&(b.zebra[0]+=" "+p.even),p.odd&&(b.zebra[1]+=" "+p.odd),g.children("caption").removeClass(c.caption||"").addClass(p.caption),b=g.removeClass((a.appliedTheme?"tablesorter-"+(a.appliedTheme||""):"")+" "+(c.table||"")).addClass("tablesorter-"+r+" "+(p.table||"")).children("tfoot"), a.appliedTheme=a.theme,b.length&&b.children("tr").removeClass(c.footerRow||"").addClass(p.footerRow).children("th, td").removeClass(c.footerCells||"").addClass(p.footerCells),d.removeClass((m?[c.header,c.hover,f].join(" "):"")||"").addClass(p.header).not(".sorter-false").unbind("mouseenter.tsuitheme mouseleave.tsuitheme").bind("mouseenter.tsuitheme mouseleave.tsuitheme",function(a){k(this)["mouseenter"===a.type?"addClass":"removeClass"](p.hover||"")}),d.each(function(){var a=k(this);a.find("."+e.css.wrapper).length|| a.wrapInner('<div class="'+e.css.wrapper+'" style="position:relative;height:100%;width:100%"></div>')}),a.cssIcon&&d.find("."+e.css.icon).removeClass(m?[c.icons,n].join(" "):"").addClass(p.icons||""),g.hasClass("hasFilters")&&g.children("thead").children("."+e.css.filterRow).removeClass(m?c.filterRow||"":"").addClass(p.filterRow||""));for(b=0;b<a.columns;b++)c=a.$headers.add(a.$extraHeaders).not(".sorter-false").filter('[data-column="'+b+'"]'),f=e.css.icon?c.find("."+e.css.icon):k(),g=d.not(".sorter-false").filter('[data-column="'+ b+'"]:last'),g.length&&(c.removeClass(w),f.removeClass(x),g[0].sortDisabled?f.removeClass(p.icons||""):(c=p.sortNone,f=p.iconSortNone,g.hasClass(e.css.sortAsc)?(c=[p.sortAsc,p.active].join(" "),f=p.iconSortAsc):g.hasClass(e.css.sortDesc)&&(c=[p.sortDesc,p.active].join(" "),f=p.iconSortDesc),g.addClass(c).find("."+e.css.icon).addClass(f||"")));a.debug&&e.benchmark("Applying "+r+" theme",h)},remove:function(d,a,b,c){if(b.uitheme_applied){d=a.$table;a=a.appliedTheme||"jui";var f=e.themes[a]||e.themes.jui, h=d.children("thead").children(),g=f.sortNone+" "+f.sortDesc+" "+f.sortAsc,k=f.iconSortNone+" "+f.iconSortDesc+" "+f.iconSortAsc;d.removeClass("tablesorter-"+a+" "+f.table);b.uitheme_applied=!1;c||(d.find(e.css.header).removeClass(f.header),h.unbind("mouseenter.tsuitheme mouseleave.tsuitheme").removeClass(f.hover+" "+g+" "+f.active).filter("."+e.css.filterRow).removeClass(f.filterRow),h.find("."+e.css.icon).removeClass(f.icons+" "+k))}}});
|
|
e.addWidget({id:"columns",priority:30,options:{columns:["primary", "secondary","tertiary"]},format:function(d,a,b){var c,f,h,g,n,m,r=a.$table,p=a.$tbodies,w=a.sortList,x=w.length,u=b&&b.columns||["primary","secondary","tertiary"],t=u.length-1;n=u.join(" ");for(c=0;c<p.length;c++)a=e.processTbody(d,p.eq(c),!0),f=a.children("tr"),f.each(function(){h=k(this);if("none"!==this.style.display&&(g=h.children().removeClass(n),w&&w[0]&&(g.eq(w[0][0]).addClass(u[0]),1<x)))for(m=1;m<x;m++)g.eq(w[m][0]).addClass(u[m]||u[t])}),e.processTbody(d,a,!1);d=!1!==b.columns_thead?["thead tr"]: [];!1!==b.columns_tfoot&&d.push("tfoot tr");if(d.length&&(f=r.find(d.join(",")).children().removeClass(n),x))for(m=0;m<x;m++)f.filter('[data-column="'+w[m][0]+'"]').addClass(u[m]||u[t])},remove:function(d,a,b){var c=a.$tbodies,f=(b.columns||["primary","secondary","tertiary"]).join(" ");a.$headers.removeClass(f);a.$table.children("tfoot").children("tr").children("th, td").removeClass(f);for(a=0;a<c.length;a++)b=e.processTbody(d,c.eq(a),!0),b.children("tr").each(function(){k(this).children().removeClass(f)}), e.processTbody(d,b,!1)}});
|
|
e.addWidget({id:"filter",priority:50,options:{filter_childRows:!1,filter_columnFilters:!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(d,a,b){a.$table.hasClass("hasFilters")||e.filter.init(d,a,b)},remove:function(d,a,b,c){var f=a.$tbodies;a.$table.removeClass("hasFilters").unbind("addRows updateCell update updateRows updateComplete appendCache filterReset filterEnd search ".split(" ").join(a.namespace+"filter ")).find("."+e.css.filterRow).remove(); if(!c){for(a=0;a<f.length;a++)c=e.processTbody(d,f.eq(a),!0),c.children().removeClass(b.filter_filteredRow).show(),e.processTbody(d,c,!1);b.filter_reset&&k(document).undelegate(b.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,query:"(q|query)"},types:{regex:function(d,a){if(e.filter.regex.regex.test(a.iFilter)){var b, c=e.filter.regex.regex.exec(a.iFilter);try{b=(new RegExp(c[1],c[2])).test(a.iExact)}catch(f){b=!1}return b}return null},operators:function(d,a){if(/^[<>]=?/.test(a.iFilter)){var b,c;b=d.table;var f=a.index,h=a.parsed[f],g=e.formatFloat(a.iFilter.replace(e.filter.regex.operators,""),b),n=d.parsers[f],m=g;if(h||"numeric"===n.type)c=e.filter.parseFilter(d,k.trim(""+a.iFilter.replace(e.filter.regex.operators,"")),f,h,!0),g="number"!==typeof c||""===c||isNaN(c)?g:c;b=!h&&"numeric"!==n.type||isNaN(g)|| "undefined"===typeof a.cache?isNaN(a.iExact)?e.formatFloat(a.iExact.replace(e.filter.regex.nondigit,""),b):e.formatFloat(a.iExact,b):a.cache;/>/.test(a.iFilter)&&(c=/>=/.test(a.iFilter)?b>=g:b>g);/</.test(a.iFilter)&&(c=/<=/.test(a.iFilter)?b<=g:b<g);c||""!==m||(c=!0);return c}return null},notMatch:function(d,a){if(/^\!/.test(a.iFilter)){var b,c=e.filter.parseFilter(d,a.iFilter.replace("!",""),a.index,a.parsed[a.index]);if(e.filter.regex.exact.test(c))return c=c.replace(e.filter.regex.exact,""),""=== c?!0:k.trim(c)!==a.iExact;b=a.iExact.search(k.trim(c));return""===c?!0:!(d.widgetOptions.filter_startsWith?0===b:0<=b)}return null},exact:function(d,a){if(e.filter.regex.exact.test(a.iFilter)){var b=e.filter.parseFilter(d,a.iFilter.replace(e.filter.regex.exact,""),a.index,a.parsed[a.index]);return a.anyMatch?0<=k.inArray(b,a.rowArray):b==a.iExact}return null},and:function(d,a){if(e.filter.regex.andTest.test(a.filter)){for(var b=a.index,c=a.parsed[b],f=a.iFilter.split(e.filter.regex.andSplit),h=0<= a.iExact.search(k.trim(e.filter.parseFilter(d,f[0],b,c))),g=f.length-1;h&&g;)h=h&&0<=a.iExact.search(k.trim(e.filter.parseFilter(d,f[g],b,c))),g--;return h}return null},range:function(d,a){if(e.filter.regex.toTest.test(a.iFilter)){var b,c;c=d.table;var f=a.index,h=a.parsed[f],g=a.iFilter.split(e.filter.regex.toSplit),k=e.formatFloat(e.filter.parseFilter(d,g[0].replace(e.filter.regex.nondigit,""),f,h),c),m=e.formatFloat(e.filter.parseFilter(d,g[1].replace(e.filter.regex.nondigit,""),f,h),c);if(h|| "numeric"===d.parsers[f].type)b=d.parsers[f].format(""+g[0],c,d.$headers.eq(f),f),k=""===b||isNaN(b)?k:b,b=d.parsers[f].format(""+g[1],c,d.$headers.eq(f),f),m=""===b||isNaN(b)?m:b;b=!h&&"numeric"!==d.parsers[f].type||isNaN(k)||isNaN(m)?isNaN(a.iExact)?e.formatFloat(a.iExact.replace(e.filter.regex.nondigit,""),c):e.formatFloat(a.iExact,c):a.cache;k>m&&(c=k,k=m,m=c);return b>=k&&b<=m||""===k||""===m}return null},wild:function(d,a){if(/[\?\*\|]/.test(a.iFilter)||e.filter.regex.orReplace.test(a.filter)){var b= a.index,c=a.parsed[b],c=e.filter.parseFilter(d,a.iFilter.replace(e.filter.regex.orReplace,"|"),b,c);!d.$headers.filter('[data-column="'+b+'"]:last').hasClass("filter-match")&&/\|/.test(c)&&("|"===c[c.length-1]&&(c+="*"),c=a.anyMatch&&k.isArray(a.rowArray)?"("+c+")":"^("+c+")$");return(new RegExp(c.replace(/\?/g,"\\S{1}").replace(/\*/g,"\\S*"))).test(a.iExact)}return null},fuzzy:function(d,a){if(/^~/.test(a.iFilter)){var b,c=0,f=a.iExact.length,h=e.filter.parseFilter(d,a.iFilter.slice(1),a.index,a.parsed[a.index]); for(b=0;b<f;b++)a.iExact[b]===h[c]&&(c+=1);return c===h.length?!0:!1}return null}},init:function(d,a,b){e.language=k.extend(!0,{},{to:"to",or:"or",and:"and"},e.language);var c,f,h,g,n,m,r,p;c=e.filter.regex;a.$table.addClass("hasFilters");b.searchTimer=null;b.filter_initTimer=null;b.filter_formatterCount=0;b.filter_formatterInit=[];b.filter_anyColumnSelector='[data-column="all"],[data-column="any"]';b.filter_multipleColumnSelector='[data-column*="-"],[data-column*=","]';h="\\{"+e.filter.regex.query+ "\\}";k.extend(c,{child:new RegExp(a.cssChildRow),filtered:new RegExp(b.filter_filteredRow),alreadyFiltered:new RegExp("(\\s+("+e.language.or+"|-|"+e.language.to+")\\s+)","i"),toTest:new RegExp("\\s+(-|"+e.language.to+")\\s+","i"),toSplit:new RegExp("(?:\\s+(?:-|"+e.language.to+")\\s+)","gi"),andTest:new RegExp("\\s+("+e.language.and+"|&&)\\s+","i"),andSplit:new RegExp("(?:\\s+(?:"+e.language.and+"|&&)\\s+)","gi"),orReplace:new RegExp("\\s+("+e.language.or+")\\s+","gi"),iQuery:new RegExp(h,"i"),igQuery:new RegExp(h, "ig")});!1!==b.filter_columnFilters&&a.$headers.filter(".filter-false, .parser-false").length!==a.$headers.length&&e.filter.buildRow(d,a,b);h="addRows updateCell update updateRows updateComplete appendCache filterReset filterEnd search ".split(" ").join(a.namespace+"filter ");a.$table.bind(h,function(c,f){r=b.filter_hideEmpty&&k.isEmptyObject(a.cache)&&!(a.delayInit&&"appendCache"===c.type);a.$table.find("."+e.css.filterRow).toggleClass(b.filter_filteredRow,r);/(search|filter)/.test(c.type)||(c.stopPropagation(), e.filter.buildDefault(d,!0));"filterReset"===c.type?(a.$table.find("."+e.css.filter).add(b.filter_$externalFilters).val(""),e.filter.searching(d,[])):"filterEnd"===c.type?e.filter.buildDefault(d,!0):(f="search"===c.type?f:"updateComplete"===c.type?a.$table.data("lastSearch"):"",/(update|add)/.test(c.type)&&"updateComplete"!==c.type&&(a.lastCombinedFilter=null,a.lastSearch=[]),e.filter.searching(d,f,!0));return!1});b.filter_reset&&(b.filter_reset instanceof k?b.filter_reset.click(function(){a.$table.trigger("filterReset")}): k(b.filter_reset).length&&k(document).undelegate(b.filter_reset,"click.tsfilter").delegate(b.filter_reset,"click.tsfilter",function(){a.$table.trigger("filterReset")}));if(b.filter_functions)for(n=0;n<a.columns;n++)if(h=e.getColumnData(d,b.filter_functions,n))if(g=a.$headers.filter('[data-column="'+n+'"]:last').removeClass("filter-select"),p=!(g.hasClass("filter-false")||g.hasClass("parser-false")),c="",!0===h&&p)e.filter.buildSelect(d,n);else if("object"===typeof h&&p){for(f in h)"string"===typeof f&& (c+=""===c?'<option value="">'+(g.data("placeholder")||g.attr("data-placeholder")||b.filter_placeholder.select||"")+"</option>":"",h=r=f,0<=f.indexOf(b.filter_selectSourceSeparator)&&(r=f.split(b.filter_selectSourceSeparator),h=r[1],r=r[0]),c+="<option "+(h===r?"":'data-function-name="'+f+'" ')+'value="'+r+'">'+h+"</option>");a.$table.find("thead").find("select."+e.css.filter+'[data-column="'+n+'"]').append(c)}e.filter.buildDefault(d,!0);e.filter.bindSearch(d,a.$table.find("."+e.css.filter),!0);b.filter_external&& e.filter.bindSearch(d,b.filter_external);b.filter_hideFilters&&e.filter.hideFilters(d,a);a.showProcessing&&a.$table.bind("filterStart"+a.namespace+"filter filterEnd"+a.namespace+"filter",function(b,c){g=c?a.$table.find("."+e.css.header).filter("[data-column]").filter(function(){return""!==c[k(this).data("column")]}):"";e.isProcessing(d,"filterStart"===b.type,c?g:"")});a.filteredRows=a.totalRows;a.$table.bind("tablesorter-initialized pagerBeforeInitialized",function(){var b=this.config.widgetOptions; m=e.filter.setDefaults(d,a,b)||[];m.length&&(a.delayInit&&""===m.join("")||e.setFilters(d,m,!0));a.$table.trigger("filterFomatterUpdate");setTimeout(function(){b.filter_initialized||e.filter.filterInitComplete(a)},100)});a.pager&&a.pager.initialized&&!b.filter_initialized&&(a.$table.trigger("filterFomatterUpdate"),setTimeout(function(){e.filter.filterInitComplete(a)},100))},formatterUpdated:function(d,a){var b=d.closest("table")[0].config.widgetOptions;b.filter_initialized||(b.filter_formatterInit[a]= 1)},filterInitComplete:function(d){var a=d.widgetOptions,b=0,c=function(){a.filter_initialized=!0;d.$table.trigger("filterInit",d);e.filter.findRows(d.table,d.$table.data("lastSearch")||[])};k.isEmptyObject(a.filter_formatter)?c():(k.each(a.filter_formatterInit,function(a,c){1===c&&b++}),clearTimeout(a.filter_initTimer),a.filter_initialized||b!==a.filter_formatterCount)?a.filter_initialized||(a.filter_initTimer=setTimeout(function(){c()},500)):c()},setDefaults:function(d,a,b){var c,f=e.getFilters(d)|| [];b.filter_saveFilters&&e.storage&&(c=e.storage(d,"tablesorter-filters")||[],(d=k.isArray(c))&&""===c.join("")||!d||(f=c));if(""===f.join(""))for(d=0;d<a.columns;d++)f[d]=a.$headers.filter('[data-column="'+d+'"]:last').attr(b.filter_defaultAttrib)||f[d];a.$table.data("lastSearch",f);return f},parseFilter:function(d,a,b,c,e){return e||c?d.parsers[b].format(a,d.table,[],b):a},buildRow:function(d,a,b){var c,f,h,g,n=a.columns;h=k.isArray(b.filter_cellFilter);g='<tr role="row" class="'+e.css.filterRow+ '">';for(f=0;f<n;f++)g=h?g+("<td"+(b.filter_cellFilter[f]?' class="'+b.filter_cellFilter[f]+'"':"")+"></td>"):g+("<td"+(""!==b.filter_cellFilter?' class="'+b.filter_cellFilter+'"':"")+"></td>");a.$filters=k(g+"</tr>").appendTo(a.$table.children("thead").eq(0)).find("td");for(f=0;f<n;f++)h=a.$headers.filter('[data-column="'+f+'"]:last'),g=e.getColumnData(d,b.filter_functions,f),g=b.filter_functions&&g&&"function"!==typeof g||h.hasClass("filter-select"),c=e.getColumnData(d,a.headers,f),c="false"=== e.getData(h[0],c,"filter")||"false"===e.getData(h[0],c,"parser"),g?g=k("<select>").appendTo(a.$filters.eq(f)):((g=e.getColumnData(d,b.filter_formatter,f))?(b.filter_formatterCount++,(g=g(a.$filters.eq(f),f))&&0===g.length&&(g=a.$filters.eq(f).children("input")),g&&(0===g.parent().length||g.parent().length&&g.parent()[0]!==a.$filters[f])&&a.$filters.eq(f).append(g)):g=k('<input type="search">').appendTo(a.$filters.eq(f)),g&&g.attr("placeholder",h.data("placeholder")||h.attr("data-placeholder")||b.filter_placeholder.search|| "")),g&&(h=(k.isArray(b.filter_cssFilter)?"undefined"!==typeof b.filter_cssFilter[f]?b.filter_cssFilter[f]||"":"":b.filter_cssFilter)||"",g.addClass(e.css.filter+" "+h).attr("data-column",f),c&&(g.attr("placeholder","").addClass("disabled")[0].disabled=!0))},bindSearch:function(d,a,b){d=k(d)[0];a=k(a);if(a.length){var c=d.config,f=c.widgetOptions,h=f.filter_$externalFilters;!0!==b&&(f.filter_$anyMatch=a.filter(f.filter_anyColumnSelector+","+f.filter_multipleColumnSelector),f.filter_$externalFilters= h&&h.length?f.filter_$externalFilters.add(a):a,e.setFilters(d,c.$table.data("lastSearch")||[],!1===b));a.attr("data-lastSearchTime",(new Date).getTime()).unbind(["keypress","keyup","search","change",""].join(c.namespace+"filter ")).bind("keyup"+c.namespace+"filter",function(a){k(this).attr("data-lastSearchTime",(new Date).getTime());if(27===a.which)this.value="";else if(!1===f.filter_liveSearch||""!==this.value&&("number"===typeof f.filter_liveSearch&&this.value.length<f.filter_liveSearch||13!==a.which&& 8!==a.which&&(32>a.which||37<=a.which&&40>=a.which)))return;e.filter.searching(d,!0,!0)}).bind(["search","change","keypress",""].join(c.namespace+"filter "),function(a){var b=k(this).data("column");if(13===a.which||"search"===a.type||"change"===a.type&&this.value!==c.lastSearch[b])a.preventDefault(),k(this).attr("data-lastSearchTime",(new Date).getTime()),e.filter.searching(d,!1,!0)})}},searching:function(d,a,b){var c=d.config.widgetOptions;clearTimeout(c.searchTimer);"undefined"===typeof a||!0=== a?c.searchTimer=setTimeout(function(){e.filter.checkFilters(d,a,b)},c.filter_liveSearch?c.filter_searchDelay:10):e.filter.checkFilters(d,a,b)},checkFilters:function(d,a,b){var c=d.config,f=c.widgetOptions,h=k.isArray(a),g=h?a:e.getFilters(d,!0),n=(g||[]).join("");if(k.isEmptyObject(c.cache))c.delayInit&&c.pager&&c.pager.initialized&&c.$table.trigger("updateCache",[function(){e.filter.checkFilters(d,!1,b)}]);else if(h&&(e.setFilters(d,g,!1,!0!==b),f.filter_initialized||(c.lastCombinedFilter="")),f.filter_hideFilters&& c.$table.find("."+e.css.filterRow).trigger(""===n?"mouseleave":"mouseenter"),c.lastCombinedFilter!==n||!1===a)if(!1===a&&(c.lastCombinedFilter=null,c.lastSearch=[]),f.filter_initialized&&c.$table.trigger("filterStart",[g]),c.showProcessing)setTimeout(function(){e.filter.findRows(d,g,n);return!1},30);else return e.filter.findRows(d,g,n),!1},hideFilters:function(d,a){var b,c,f;k(d).find("."+e.css.filterRow).addClass("hideme").bind("mouseenter mouseleave",function(c){b=k(this);clearTimeout(f);f=setTimeout(function(){/enter|over/.test(c.type)? b.removeClass("hideme"):k(document.activeElement).closest("tr")[0]!==b[0]&&""===a.lastCombinedFilter&&b.addClass("hideme")},200)}).find("input, select").bind("focus blur",function(b){c=k(this).closest("tr");clearTimeout(f);f=setTimeout(function(){if(""===e.getFilters(a.$table).join(""))c["focus"===b.type?"removeClass":"addClass"]("hideme")},200)})},defaultFilter:function(d,a){if(""===d)return d;var b=e.filter.regex.iQuery,c=a.match(e.filter.regex.igQuery).length,f=1<c?k.trim(d).split(/\s/):[k.trim(d)], h=f.length-1,g=0,n=a;for(1>h&&1<c&&(f[1]=f[0]);b.test(n);)n=n.replace(b,f[g++]||""),b.test(n)&&g<h&&""!==(f[g]||"")&&(n=a.replace(b,n));return n},getLatestSearch:function(d){return d.sort(function(a,b){return k(b).attr("data-lastSearchTime")-k(a).attr("data-lastSearchTime")})},multipleColumns:function(d,a){var b,c;b=d.widgetOptions;var f=b.filter_initialized||!a.filter(b.filter_anyColumnSelector).length,h=[],g=k.trim(e.filter.getLatestSearch(a).attr("data-column"));f&&/-/.test(g)&&(b=g.match(/(\d+)\s*-\s*(\d+)/g), k.each(b,function(a,b){var c;c=b.split(/\s*-\s*/);var e=parseInt(c[0],10)||0,f=parseInt(c[1],10)||d.columns-1;e>f&&(c=e,e=f,f=c);for(f>=d.columns&&(f=d.columns-1);e<=f;e++)h.push(e);g=g.replace(b,"")}));f&&/,/.test(g)&&(b=g.split(/\s*,\s*/),k.each(b,function(a,b){""!==b&&(c=parseInt(b,10),c<d.columns&&h.push(c))}));if(!h.length)for(c=0;c<d.columns;c++)h.push(c);return h},findRows:function(d,a,b){if(d.config.lastCombinedFilter!==b&&d.config.widgetOptions.filter_initialized){var c,f,h,g,n,m,r,p,w,x, u,t,z,A,y,B,C,G,D,H,F=e.filter.regex,q=d.config,v=q.widgetOptions,I=q.$table.children("tbody"),l={anyMatch:!1},J=["range","notMatch","operators"];l.parsed=q.$headers.map(function(a){return q.parsers&&q.parsers[a]&&q.parsers[a].parsed||e.getData&&"parsed"===e.getData(q.$headers.filter('[data-column="'+a+'"]:last'),e.getColumnData(d,q.headers,a),"filter")||k(this).hasClass("filter-parsed")}).get();q.debug&&(e.log("Starting filter widget search",a),A=new Date);q.filteredRows=0;q.totalRows=0;b=(a||[]).join(""); for(g=0;g<I.length;g++)if(!I.eq(g).hasClass(q.cssInfoBlock||e.css.info)){n=e.processTbody(d,I.eq(g),!0);p=q.columns;f=k(k.map(q.cache[g].normalized,function(a){return a[p].$row.get()}));if(""===b||v.filter_serversideFiltering)f.removeClass(v.filter_filteredRow).not("."+q.cssChildRow).show();else{f=f.not("."+q.cssChildRow);c=f.length;B=v.filter_searchFiltered;h=q.lastSearch||q.$table.data("lastSearch")||[];if(B)for(m=0;m<p+1;m++)y=a[m]||"",B||(m=p),B=B&&h.length&&0===y.indexOf(h[m]||"")&&!F.alreadyFiltered.test(y)&& !/[=\"\|!]/.test(y)&&!(/(>=?\s*-\d)/.test(y)||/(<=?\s*\d)/.test(y))&&!(""!==y&&q.$filters&&q.$filters.eq(m).find("select").length&&!q.$headers.filter('[data-column="'+m+'"]:last').hasClass("filter-match"));y=f.not("."+v.filter_filteredRow).length;B&&0===y&&(B=!1);q.debug&&e.log("Searching through "+(B&&y<c?y:"all")+" rows");if(v.filter_$anyMatch&&v.filter_$anyMatch.length||a[q.columns])l.anyMatchFlag=!0,l.anyMatchFilter=v.filter_$anyMatch&&e.filter.getLatestSearch(v.filter_$anyMatch).val()||a[q.columns]|| "",q.sortLocaleCompare&&(l.anyMatchFilter=e.replaceAccents(l.anyMatchFilter)),v.filter_defaultFilter&&F.iQuery.test(e.getColumnData(d,v.filter_defaultFilter,q.columns,!0)||"")&&(l.anyMatchFilter=e.filter.defaultFilter(l.anyMatchFilter,e.getColumnData(d,v.filter_defaultFilter,q.columns,!0)),B=!1),l.iAnyMatchFilter=v.filter_ignoreCase&&q.ignoreCase?l.anyMatchFilter.toLocaleLowerCase():l.anyMatchFilter;for(h=0;h<c;h++)if(l.cacheArray=q.cache[g].normalized[h],w=f[h].className,!(F.child.test(w)||B&&F.filtered.test(w))){z= !0;w=f.eq(h).nextUntil("tr:not(."+q.cssChildRow+")");l.childRowText=w.length&&v.filter_childRows?w.text():"";l.childRowText=v.filter_ignoreCase?l.childRowText.toLocaleLowerCase():l.childRowText;m=f.eq(h).children();if(l.anyMatchFlag){p=e.filter.multipleColumns(q,v.filter_$anyMatch);l.anyMatch=!0;l.rowArray=m.map(function(a){if(-1<k.inArray(a,p))return l.parsed[a]?a=l.cacheArray[a]:(a=this.getAttribute(q.textAttribute)||this.textContent||k(this).text(),a=k.trim(v.filter_ignoreCase?a.toLowerCase(): a),q.sortLocaleCompare&&(a=e.replaceAccents(a))),a}).get();l.filter=l.anyMatchFilter;l.iFilter=l.iAnyMatchFilter;l.exact=l.rowArray.join(" ");l.iExact=v.filter_ignoreCase?l.exact.toLowerCase():l.exact;l.cache=l.cacheArray.slice(0,-1).join(" ");C=null;k.each(e.filter.types,function(a,b){if(0>k.inArray(a,J)&&(u=b(q,l),null!==u))return C=u,!1});if(null!==C)z=C;else if(v.filter_startsWith)for(z=!1,p=q.columns;!z&&0<p;)p--,z=z||0===l.rowArray[p].indexOf(l.iFilter);else z=0<=(l.iExact+l.childRowText).indexOf(l.iFilter); l.anyMatch=!1}for(p=0;p<q.columns;p++)l.filter=a[p],l.index=p,G=(e.getColumnData(d,v.filter_excludeFilter,p,!0)||"").split(/\s+/),l.filter&&(l.cache=l.cacheArray[p],v.filter_useParsedData||l.parsed[p]?l.exact=l.cache:(y=m[p],t=k.trim(y.getAttribute(q.textAttribute)||y.textContent||m.eq(p).text()),l.exact=q.sortLocaleCompare?e.replaceAccents(t):t),l.iExact=!F.type.test(typeof l.exact)&&v.filter_ignoreCase?l.exact.toLocaleLowerCase():l.exact,t=z,H=v.filter_columnFilters?q.$filters.add(q.$externalFilters).filter('[data-column="'+ p+'"]').find("select option:selected").attr("data-function-name")||"":"",q.sortLocaleCompare&&(l.filter=e.replaceAccents(l.filter)),y=!0,v.filter_defaultFilter&&F.iQuery.test(e.getColumnData(d,v.filter_defaultFilter,p)||"")&&(l.filter=e.filter.defaultFilter(l.filter,e.getColumnData(d,v.filter_defaultFilter,p)),y=!1),l.iFilter=v.filter_ignoreCase?(l.filter||"").toLocaleLowerCase():l.filter,D=e.getColumnData(d,v.filter_functions,p),r=q.$headers.filter('[data-column="'+p+'"]:last'),x=r.hasClass("filter-select"), D||x&&y?!0===D||x?t=r.hasClass("filter-match")?0<=l.iExact.search(l.iFilter):l.filter===l.exact:"function"===typeof D?t=D(l.exact,l.cache,l.filter,p,f.eq(h)):"function"===typeof D[H||l.filter]&&(t=D[H||l.filter](l.exact,l.cache,l.filter,p,f.eq(h))):(C=null,k.each(e.filter.types,function(a,b){if(0>k.inArray(a,G)&&(u=b(q,l),null!==u))return C=u,!1}),null!==C?t=C:(l.exact=(l.iExact+l.childRowText).indexOf(e.filter.parseFilter(q,l.iFilter,p,l.parsed[p])),t=!v.filter_startsWith&&0<=l.exact||v.filter_startsWith&& 0===l.exact)),z=t?z:!1);f.eq(h).toggle(z).toggleClass(v.filter_filteredRow,!z);w.length&&w.toggleClass(v.filter_filteredRow,!z)}}q.filteredRows+=f.not("."+v.filter_filteredRow).length;q.totalRows+=f.length;e.processTbody(d,n,!1)}q.lastCombinedFilter=b;q.lastSearch=a;q.$table.data("lastSearch",a);v.filter_saveFilters&&e.storage&&e.storage(d,"tablesorter-filters",a);q.debug&&e.benchmark("Completed filter widget search",A);v.filter_initialized&&q.$table.trigger("filterEnd",q);setTimeout(function(){q.$table.trigger("applyWidgets")}, 0)}},getOptionSource:function(d,a,b){d=k(d)[0];var c,f=d.config,h=[],g=!1,n=f.widgetOptions.filter_selectSource,m=f.$table.data("lastSearch")||[],r=k.isFunction(n)?!0:e.getColumnData(d,n,a);b&&""!==m[a]&&(b=!1);if(!0===r)g=n(d,a,b);else{if(r instanceof k||"string"===k.type(r)&&0<=r.indexOf("</option>"))return r;k.isArray(r)?g=r:"object"===k.type(n)&&r&&(g=r(d,a,b))}!1===g&&(g=e.filter.getOptions(d,a,b));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(b,c){h.push({t:c,p:f.parsers&&f.parsers[a].format(c,d,[],a)})}),c=f.textSorter||"",h.sort(function(b,f){var g=b.p.toString(),h=f.p.toString();return k.isFunction(c)?c(g,h,!0,a,d):"object"===typeof c&&c.hasOwnProperty(a)?c[a](g,h,!0,a,d):e.sortNatural?e.sortNatural(g,h):!0}),g=[],k.each(h,function(a,b){g.push(b.t)}));return g},getOptions:function(d,a,b){d=k(d)[0];var c,e,h,g,n=d.config,m=n.widgetOptions,r=n.$table.children("tbody"),p=[];for(c=0;c<r.length;c++)if(!r.eq(c).hasClass(n.cssInfoBlock))for(g= n.cache[c],e=n.cache[c].normalized.length,d=0;d<e;d++)h=g.row?g.row[d]:g.normalized[d][n.columns].$row[0],b&&h.className.match(m.filter_filteredRow)||(m.filter_useParsedData||n.parsers[a].parsed||n.$headers.filter('[data-column="'+a+'"]:last').hasClass("filter-parsed")?p.push(""+g.normalized[d][a]):(h=h.cells[a])&&p.push(k.trim(h.getAttribute(n.textAttribute)||h.textContent||k(h).text())));return p},buildSelect:function(d,a,b,c,f){d=k(d)[0];a=parseInt(a,10);if(d.config.cache&&!k.isEmptyObject(d.config.cache)){var h, g;g=d.config;var n=g.widgetOptions,m=g.$headers.filter('[data-column="'+a+'"]:last'),m='<option value="">'+(m.data("placeholder")||m.attr("data-placeholder")||n.filter_placeholder.select||"")+"</option>",r=g.$table.find("thead").find("select."+e.css.filter+'[data-column="'+a+'"]').val();if("undefined"===typeof b||""===b)b=e.filter.getOptionSource(d,a,f);if(k.isArray(b)){for(d=0;d<b.length;d++)f=h=b[d]=(""+b[d]).replace(/\"/g,"""),0<=h.indexOf(n.filter_selectSourceSeparator)&&(h=h.split(n.filter_selectSourceSeparator), f=h[0],h=h[1]),m+=""!==b[d]?"<option "+(f===h?"":'data-function-name="'+b[d]+'" ')+'value="'+f+'">'+h+"</option>":"";b=[]}g=(g.$filters?g.$filters:g.$table.children("thead")).find("."+e.css.filter);n.filter_$externalFilters&&(g=g&&g.length?g.add(n.filter_$externalFilters):n.filter_$externalFilters);a=g.filter('select[data-column="'+a+'"]');a.length&&(a[c?"html":"append"](m),k.isArray(b)||a.append(b).val(r),a.val(r))}},buildDefault:function(d,a){var b,c,f,h=d.config,g=h.widgetOptions,k=h.columns;for(b= 0;b<k;b++)c=h.$headers.filter('[data-column="'+b+'"]:last'),f=!(c.hasClass("filter-false")||c.hasClass("parser-false")),(c.hasClass("filter-select")||!0===e.getColumnData(d,g.filter_functions,b))&&f&&e.filter.buildSelect(d,b,"",a,c.hasClass(g.filter_onlyAvail))}};
|
|
e.getFilters=function(d,a,b,c){var f,h,g=!1,n=d?k(d)[0].config:"",m=n?n.widgetOptions:"";if(!0!==a&&m&&!m.filter_columnFilters)return k(d).data("lastSearch");if(n&&(n.$filters&&(f=n.$filters.find("."+e.css.filter)),m.filter_$externalFilters&& (f=f&&f.length?f.add(m.filter_$externalFilters):m.filter_$externalFilters),f&&f.length))for(g=b||[],d=0;d<n.columns+1;d++)h=d===n.columns?m.filter_anyColumnSelector+","+m.filter_multipleColumnSelector:'[data-column="'+d+'"]',a=f.filter(h),a.length&&(a=e.filter.getLatestSearch(a),k.isArray(b)?(c&&a.slice(1),d===n.columns&&(h=a.filter(m.filter_anyColumnSelector),a=h.length?h:a),a.val(b[d]).trigger("change.tsfilter")):(g[d]=a.val()||"",d===n.columns?a.slice(1).filter('[data-column*="'+a.attr("data-column")+ '"]').val(g[d]):a.slice(1).val(g[d])),d===n.columns&&a.length&&(m.filter_$anyMatch=a));0===g.length&&(g=!1);return g};
|
|
e.setFilters=function(d,a,b,c){var f=d?k(d)[0].config:"";d=e.getFilters(d,!0,a,c);f&&b&&(f.lastCombinedFilter=null,f.lastSearch=[],e.filter.searching(f.table,a,c),f.$table.trigger("filterFomatterUpdate"));return!!d};
|
|
e.addWidget({id:"stickyHeaders",priority:60,options:{stickyHeaders:"",stickyHeaders_attachTo:null,stickyHeaders_xScroll:null,stickyHeaders_yScroll:null,stickyHeaders_offset:0, stickyHeaders_filteredToTop:!0,stickyHeaders_cloneId:"-sticky",stickyHeaders_addResizeEvent:!0,stickyHeaders_includeCaption:!0,stickyHeaders_zIndex:2},format:function(d,a,b){if(!(a.$table.hasClass("hasStickyHeaders")||0<=k.inArray("filter",a.widgets)&&!a.$table.hasClass("hasFilters"))){var c=a.$table,f=k(b.stickyHeaders_attachTo),h=a.namespace+"stickyheaders ",g=k(b.stickyHeaders_yScroll||b.stickyHeaders_attachTo||A),n=k(b.stickyHeaders_xScroll||b.stickyHeaders_attachTo||A),m=c.children("thead:first").children("tr").not(".sticky-false").children(), r=c.children("tfoot"),p=isNaN(b.stickyHeaders_offset)?k(b.stickyHeaders_offset):"",w=f.length?0:p.length?p.height()||0:parseInt(b.stickyHeaders_offset,10)||0,x=c.parent().closest("."+e.css.table).hasClass("hasStickyHeaders")?c.parent().closest("table.tablesorter")[0].config.widgetOptions.$sticky.parent():[],u=x.length?x.height():0,t=b.$sticky=c.clone().addClass("containsStickyHeaders "+e.css.sticky+" "+b.stickyHeaders).wrap('<div class="'+e.css.stickyWrap+'">'),z=t.parent().css({position:f.length? "absolute":"fixed",padding:parseInt(t.parent().parent().css("padding-left"),10),top:w+u,left:0,visibility:"hidden",zIndex:b.stickyHeaders_zIndex||2}),E=t.children("thead:first"),y,B="",C=0,G=function(a,b){a.filter(":visible").each(function(a){var c;a=b.filter(":visible").eq(a);var d=k(this);"border-box"===d.css("box-sizing")?c=d.outerWidth():"collapse"===a.css("border-collapse")?A.getComputedStyle?c=parseFloat(A.getComputedStyle(this,null).width):(c=parseFloat(d.css("border-width")),c=d.outerWidth()- parseFloat(d.css("padding-left"))-parseFloat(d.css("padding-right"))-c):c=d.width();a.css({"min-width":c,"max-width":c})})},D=function(){w=p.length?p.height()||0:parseInt(b.stickyHeaders_offset,10)||0;C=0;z.css({left:f.length?parseInt(f.css("padding-left"),10)||0:c.offset().left-parseInt(c.css("margin-left"),10)-n.scrollLeft()-C,width:c.outerWidth()});G(c,t);G(m,y)};a.$extraTables&&a.$extraTables.length?a.$extraTables.add(t):a.$extraTables=t;t.attr("id")&&(t[0].id+=b.stickyHeaders_cloneId);t.find("thead:gt(0), tr.sticky-false").hide(); t.find("tbody, tfoot").remove();t.find("caption").toggle(b.stickyHeaders_includeCaption);y=E.children().children();t.css({height:0,width:0,margin:0});y.find("."+e.css.resizer).remove();c.addClass("hasStickyHeaders").bind("pagerComplete"+h,function(){D()});e.bindEvents(d,E.children().children(".tablesorter-header"));c.after(z);a.onRenderHeader&&E.children("tr").children().each(function(b){a.onRenderHeader.apply(k(this),[b,a,t])});n.add(g).unbind(["scroll","resize",""].join(h)).bind(["scroll","resize", ""].join(h),function(a){if(c.is(":visible")){u=x.length?x.offset().top-g.scrollTop()+x.height():0;var b=c.offset(),d=k.isWindow(g[0]),e=k.isWindow(n[0]),h=(f.length?d?g.scrollTop():g.offset().top:g.scrollTop())+w+u,l=c.height()-(z.height()+(r.height()||0)),b=h>b.top&&h<b.top+l?"visible":"hidden",l={visibility:b};f.length&&(l.top=d?h:f.scrollTop());e&&(l.left=c.offset().left-parseInt(c.css("margin-left"),10)-n.scrollLeft()-C);x.length&&(l.top=(l.top||0)+w+u);z.removeClass("tablesorter-sticky-visible tablesorter-sticky-hidden").addClass("tablesorter-sticky-"+ b).css(l);if(b!==B||"resize"===a.type)D(),B=b}});b.stickyHeaders_addResizeEvent&&e.addHeaderResizeEvent(d);c.hasClass("hasFilters")&&b.filter_columnFilters&&(c.bind("filterEnd"+h,function(){var d=k(document.activeElement).closest("td"),d=d.parent().children().index(d);z.hasClass(e.css.stickyVis)&&b.stickyHeaders_filteredToTop&&(A.scrollTo(0,c.position().top),0<=d&&a.$filters&&a.$filters.eq(d).find("a, select, input").filter(":visible").focus())}),e.filter.bindSearch(c,y.find("."+e.css.filter)),b.filter_hideFilters&& e.filter.hideFilters(t,a));c.trigger("stickyHeadersInit")}},remove:function(d,a,b){var c=a.namespace+"stickyheaders ";a.$table.removeClass("hasStickyHeaders").unbind(["pagerComplete","filterEnd",""].join(c)).next("."+e.css.stickyWrap).remove();b.$sticky&&b.$sticky.length&&b.$sticky.remove();k(A).add(b.stickyHeaders_xScroll).add(b.stickyHeaders_yScroll).add(b.stickyHeaders_attachTo).unbind(["scroll","resize",""].join(c));e.addHeaderResizeEvent(d,!1)}});
|
|
e.addWidget({id:"resizable",priority:40,options:{resizable:!0, resizable_addLastColumn:!1,resizable_widths:[],resizable_throttle:!1},format:function(d,a,b){if(!a.$table.hasClass("hasResizable")){a.$table.addClass("hasResizable");e.resizableReset(d,!0);var c,f,h,g,n,m={},r=a.$table,p=r.parent(),w="auto"===r.parent().css("overflow"),x=0,u=null,t=null,z=20>Math.abs(r.parent().width()-r.width()),E=function(a){if(0!==x&&u){var b=a.pageX-x,c=u.width();u.width(c+b);u.width()!==c&&z?t.width(t.width()-b):w&&(r.width(function(a,c){return c+b}),t.length||(p[0].scrollLeft= r.width()));x=a.pageX}},y=function(){e.storage&&u&&t&&(m={},m[u.index()]=u.width(),m[t.index()]=t.width(),u.width(m[u.index()]),t.width(m[t.index()]),!1!==b.resizable&&e.storage(d,"tablesorter-resizable",a.$headers.map(function(){return k(this).width()}).get()));x=0;u=t=null;k(A).trigger("resize")};if(m=e.storage&&!1!==b.resizable?e.storage(d,"tablesorter-resizable"):{})for(g in m)!isNaN(g)&&g<a.$headers.length&&a.$headers.eq(g).width(m[g]);c=r.children("thead:first").children("tr");c.children().each(function(){var b; b=k(this);g=b.attr("data-column");b="false"===e.getData(b,e.getColumnData(d,a.headers,g),"resizable");c.children().filter('[data-column="'+g+'"]')[b?"addClass":"removeClass"]("resizable-false")});c.each(function(){h=k(this).children().not(".resizable-false");k(this).find("."+e.css.wrapper).length||h.wrapInner('<div class="'+e.css.wrapper+'" style="position:relative;height:100%;width:100%"></div>');b.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("."+e.css.wrapper).append('<div class="'+e.css.resizer+'" style="cursor:w-resize;position:absolute;z-index:1;right:-'+b+'px;top:0;height:100%;width:20px;"></div>')}).find("."+e.css.resizer).bind("mousedown",function(b){u=k(b.target).closest("th");var c=a.$headers.filter('[data-column="'+u.attr("data-column")+'"]');1<c.length&&(u=u.add(c));t=b.shiftKey?u.parent().find("th").not(".resizable-false").filter(":last"):u.nextAll(":not(.resizable-false)").eq(0);x=b.pageX});k(document).bind("mousemove.tsresize", function(a){0!==x&&u&&(b.resizable_throttle?(clearTimeout(n),n=setTimeout(function(){E(a)},isNaN(b.resizable_throttle)?5:b.resizable_throttle)):E(a))}).bind("mouseup.tsresize",function(){y()});r.find("thead:first").bind("contextmenu.tsresize",function(){e.resizableReset(d);var a=k.isEmptyObject?k.isEmptyObject(m):!0;m={};return a})}},remove:function(d,a){a.$table.removeClass("hasResizable").children("thead").unbind("mouseup.tsresize mouseleave.tsresize contextmenu.tsresize").children("tr").children().unbind("mousemove.tsresize mouseup.tsresize").find("."+ e.css.resizer).remove();e.resizableReset(d)}});
|
|
e.resizableReset=function(d,a){k(d).each(function(){var b,c=this.config,f=c&&c.widgetOptions;d&&c&&(c.$headers.each(function(a){b=k(this);f.resizable_widths&&f.resizable_widths[a]?b.css("width",f.resizable_widths[a]):b.hasClass("resizable-false")||b.css("width","")}),e.storage&&!a&&e.storage(this,"tablesorter-resizable",{}))})};
|
|
e.addWidget({id:"saveSort",priority:20,options:{saveSort:!0},init:function(d,a,b,c){a.format(d,b,c,!0)},format:function(d,a, b,c){var f,h=a.$table;b=!1!==b.saveSort;var g={sortList:a.sortList};a.debug&&(f=new Date);h.hasClass("hasSaveSort")?b&&d.hasInitialized&&e.storage&&(e.storage(d,"tablesorter-savesort",g),a.debug&&e.benchmark("saveSort widget: Saving last sort: "+a.sortList,f)):(h.addClass("hasSaveSort"),g="",e.storage&&(g=(b=e.storage(d,"tablesorter-savesort"))&&b.hasOwnProperty("sortList")&&k.isArray(b.sortList)?b.sortList:"",a.debug&&e.benchmark('saveSort: Last sort loaded: "'+g+'"',f),h.bind("saveSortReset",function(a){a.stopPropagation(); e.storage(d,"tablesorter-savesort","")})),c&&g&&0<g.length?a.sortList=g:d.hasInitialized&&g&&0<g.length&&h.trigger("sorton",[g]))},remove:function(d,a){a.$table.removeClass("hasSaveSort");e.storage&&e.storage(d,"tablesorter-savesort","")}})
|
|
})(jQuery,window);
|