tablesorter/js/jquery.tablesorter.widgets.min.js
2013-10-18 13:38:46 -05:00

16 lines
23 KiB
JavaScript

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