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