tablesorter/js/jquery.tablesorter.widgets.min.js

18 lines
38 KiB
JavaScript
Raw Normal View History

2015-02-07 06:46:44 +00:00
/*! tableSorter (FORK) 2.16+ widgets - updated 2/7/2015 (v2.19.0) */
2014-12-23 03:12:59 +00:00
;(function(k,A){
2014-10-27 00:11:12 +00:00
var e=k.tablesorter=k.tablesorter||{};
2015-02-07 06:46:44 +00:00
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:
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.cs
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","")}})
2014-12-23 03:12:59 +00:00
})(jQuery,window);