1
lorchess.ru/assets/js/jquery.tablesorter.widgets.min.js
Vladimir Hodakov 15b8f3a13e
Revive site from the unmaintainable state
Now we can again deploy it with moden Jekyll and restore lorchess.ru
archive.
2018-10-28 17:59:15 +04:00

18 lines
28 KiB
JavaScript

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