tablesorter/dist/js/jquery.tablesorter.combined.min.js

4 lines
80 KiB
JavaScript
Raw Normal View History

2015-07-26 17:17:22 +00:00
/*! tablesorter (FORK) - updated 07-26-2015 (v2.22.2)*/
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return function(a){"use strict";a.extend({tablesorter:new function(){function b(a){for(var b in a)return!1;return!0}function c(b,c,d,e){for(var f,g,h=s.parsers.length,i=!1,j="",k=!0;""===j&&k;)d++,c[d]?(i=c[d].cells[e],j=s.getElementText(b,i,e),g=a(i),b.debug&&console.log("Checking if value was empty on row "+d+", column: "+e+': "'+j+'"')):k=!1;for(;--h>=0;)if(f=s.parsers[h],f&&"text"!==f.id&&f.is&&f.is(j,b.table,i,g))return f;return s.getParserById("text")}function d(a,d){var e,f,g,h,i,j,k,l,m,n,o,p,q=a.table,r=0,t={};if(a.$tbodies=a.$table.children("tbody:not(."+a.cssInfoBlock+")"),o="undefined"==typeof d?a.$tbodies:d,p=o.length,0===p)return a.debug?console.warn("Warning: *Empty table!* Not building a parser cache"):"";for(a.debug&&(n=new Date,console[console.group?"group":"log"]("Detecting parsers for each column")),f={extractors:[],parsers:[]};p>r;){if(e=o[r].rows,e.length)for(g=a.columns,h=0;g>h;h++)i=a.$headerIndexed[h],j=s.getColumnData(q,a.headers,h),m=s.getParserById(s.getData(i,j,"extractor")),l=s.getParserById(s.getData(i,j,"sorter")),k="false"===s.getData(i,j,"parser"),a.empties[h]=(s.getData(i,j,"empty")||a.emptyTo||(a.emptyToBottom?"bottom":"top")).toLowerCase(),a.strings[h]=(s.getData(i,j,"string")||a.stringTo||"max").toLowerCase(),k&&(l=s.getParserById("no-parser")),m||(m=!1),l||(l=c(a,e,-1,h)),a.debug&&(t["("+h+") "+i.text()]={parser:l.id,extractor:m?m.id:"none",string:a.strings[h],empty:a.empties[h]}),f.parsers[h]=l,f.extractors[h]=m;r+=f.parsers.length?p:1}a.debug&&(b(t)?console.warn(" No parsers detected!"):console[console.table?"table":"log"](t),console.log("Completed detecting parsers"+s.benchmark(n)),console.groupEnd&&console.groupEnd()),a.parsers=f.parsers,a.extractors=f.extractors}function e(b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r=b.config,t=r.parsers;if(r.$tbodies=r.$table.children("tbody:not(."+r.cssInfoBlock+")"),j="undefined"==typeof c?r.$tbodies:c,r.cache={},r.totalRows=0,!t)return r.debug?console.warn("Warning: *Empty table!* Not building a cache"):"";for(r.debug&&(m=new Date),r.showProcessing&&s.isProcessing(b,!0),i=0;i<j.length;i++){for(q=[],d=r.cache[i]={normalized:[]},n=j[i]&&j[i].rows.length||0,g=0;n>g;++g)if(o={child:[],raw:[]},k=a(j[i].rows[g]),l=[],k.hasClass(r.cssChildRow)&&0!==g)for(e=d.normalized.length-1,p=d.normalized[e][r.columns],p.$row=p.$row.add(k),k.prev().hasClass(r.cssChildRow)||k.prev().addClass(s.css.cssHasChild),f=k.children("th, td"),e=p.child.length,p.child[e]=[],h=0;h<r.columns;h++)p.child[e][h]=s.getParsedText(r,f[h],h);else{for(o.$row=k,o.order=g,h=0;h<r.columns;++h)"undefined"!=typeof t[h]?(e=s.getElementText(r,k[0].cells[h],h),o.raw.push(e),f=s.getParsedText(r,k[0].cells[h],h,e),l.push(f),"numeric"===(t[h].type||"").toLowerCase()&&(q[h]=Math.max(Math.abs(f)||0,q[h]||0))):r.debug&&console.warn("No parser found for cell:",k[0].cells[h],"does it have a header?");l[r.columns]=o,d.normalized.push(l)}d.colMax=q,r.totalRows+=d.normalized.length}r.showProcessing&&s.isProcessing(b),r.debug&&console.log("Building cache for "+n+" rows"+s.benchmark(m))}function f(a,c){var d,e,f,g,h,i,j,k=a.config,l=k.widgetOptions,m=k.$tbodies,n=[],o=k.cache;if(b(o))return k.appender?k.appender(a,n):a.isUpdating?k.$table.trigger("updateComplete",a):"";for(k.debug&&(j=new Date),i=0;i<m.length;i++)if(f=m.eq(i),f.length){for(g=s.processTbody(a,f,!0),d=o[i].normalized,e=d.length,h=0;e>h;h++)n.push(d[h][k.columns].$row),k.appender&&(!k.pager||k.pager.removeRows&&l.pager_removeRows||k.pager.ajax)||g.append(d[h][k.columns].$row);s.processTbody(a,g,!1)}k.appender&&k.appender(a,n),k.debug&&console.log("Rebuilt table"+s.benchmark(j)),c||k.appender||s.applyWidget(a),a.isUpdating&&k.$table.trigger("updateComplete",a)}function g(a){return/^d/i.test(a)||1===a}function h(b){var c,d,e,f,h,i,k,l,m=b.config;for(m.headerList=[],m.headerContent=[],m.debug&&(k=new Date),m.columns=s.computeColumnIndex(m.$table.children("thead
return c&&"number"==typeof e?e:c?a.trim(c&&d.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"}),b.addParser({id:"url",is:function(a){return/^(https?|ftp|file):\/\//.test(a)},format:function(b){return b?a.trim(b.replace(/(https?|ftp|file):\/\//,"")):b},parsed:!0,type:"text"}),b.addParser({id:"isoDate",is:function(a){return/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/.test(a)},format:function(a,b){var c=a?new Date(a.replace(/-/g,"/")):a;return c instanceof Date&&isFinite(c)?c.getTime():a},type:"numeric"}),b.addParser({id:"percent",is:function(a){return/(\d\s*?%|%\s*?\d)/.test(a)&&a.length<15},format:function(a,c){return a?b.formatFloat(a.replace(/%/g,""),c):a},type:"numeric"}),b.addParser({id:"image",is:function(a,b,c,d){return d.find("img").length>0},format:function(b,c,d){return a(d).find("img").attr(c.config.imgAttr||"alt")||b},parsed:!0,type:"text"}),b.addParser({id:"usLongDate",is:function(a){return/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i.test(a)||/^\d{1,2}\s+[A-Z]{3,10}\s+\d{4}/i.test(a)},format:function(a,b){var c=a?new Date(a.replace(/(\S)([AP]M)$/i,"$1 $2")):a;return c instanceof Date&&isFinite(c)?c.getTime():a},type:"numeric"}),b.addParser({id:"shortDate",is:function(a){return/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/.test((a||"").replace(/\s+/g," ").replace(/[\-.,]/g,"/"))},format:function(a,c,d,e){if(a){var f,g,h=c.config,i=h.$headerIndexed[e],j=i.length&&i[0].dateFormat||b.getData(i,b.getColumnData(c,h.headers,e),"dateFormat")||h.dateFormat;return g=a.replace(/\s+/g," ").replace(/[\-.,]/g,"/"),"mmddyyyy"===j?g=g.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$1/$2"):"ddmmyyyy"===j?g=g.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$2/$1"):"yyyymmdd"===j&&(g=g.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,"$1/$2/$3")),f=new Date(g),f instanceof Date&&isFinite(f)?f.getTime():a}return a},type:"numeric"}),b.addParser({id:"time",is:function(a){return/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i.test(a)},format:function(a,b){var c=a?new Date("2000/01/01 "+a.replace(/(\S)([AP]M)$/i,"$1 $2")):a;return c instanceof Date&&isFinite(c)?c.getTime():a},type:"numeric"}),b.addParser({id:"metadata",is:function(){return!1},format:function(b,c,d){var e=c.config,f=e.parserMetadataName?e.parserMetadataName:"sortValue";return a(d).metadata()[f]},type:"numeric"}),b.addWidget({id:"zebra",priority:90,format:function(b,c,d){var e,f,g,h,i,j,k,l,m=new RegExp(c.cssChildRow,"i"),n=c.$tbodies.add(a(c.namespace+"_extra_table").children("tbody:not(."+c.cssInfoBlock+")"));for(c.debug&&(i=new Date),j=0;j<n.length;j++)for(g=0,e=n.eq(j).children("tr:visible").not(c.selectorRemove),l=e.length,k=0;l>k;k++)f=e.eq(k),m.test(f[0].className)||g++,h=g%2===0,f.removeClass(d.zebra[h?1:0]).addClass(d.zebra[h?0:1])},remove:function(a,c,d,e){if(!e){var f,g,h=c.$tbodies,i=(d.zebra||["even","odd"]).join(" ");for(f=0;f<h.length;f++)g=b.processTbody(a,h.eq(f),!0),g.children().removeClass(i),b.processTbody(a,g,!1)}}})}(jQuery),function(a,b,c){"use strict";var d=a.tablesorter||{};d.storage=function(d,e,f,g){d=a(d)[0];var h,i,j,k=!1,l={},m=d.config,n=m&&m.widgetOptions,o=g&&g.useSessionStorage||n&&n.storage_useSessionStorage?"sessionStorage":"localStorage",p=a(d),q=g&&g.id||p.attr(g&&g.group||n&&n.storage_group||"data-table-group")||n&&n.storage_tableId||d.id||a(".tablesorter").index(p),r=g&&g.url||p.attr(g&&g.page||n&&n.storage_page||"data-table-page")||n&&n.storage_fixedUrl||m&&m.fixedUrl||b.location.pathname;if(o in b)try{b[o].setItem("_tmptest","temp"),k=!0,b[o].removeItem("_tmptest")}catch(s){m&&m.debug&&console.warn(o+" is not supported in this browser")}return a.parseJSON&&(k?l=a.parseJSON(b[o][e]||"null")||{}:(i=c.cookie.split(/[;\s|=]/),h=a.inArray(e,i)+1,l=0!==h?a.parseJSON(i[h]||"null")||{}:{})),(f||""===f)&&b.JSON&&JSON.hasOwnProperty("stringify")?(l[r]||(l[r]={}),l[r][q]=f,k?b[o][e]=JSON.stringify(l):(j=new Date,j.setTime(j.getTime()+31536e6),c.cookie=e+"="+JSON.stringify(l).replace(/\"/g,'"')+"; expires="+j.toGMTString()+"; path=/"),void 0):l&&l[r]?l[r][q]:""}}
a.isArray(p)?m=p:"object"===a.type(n)&&p&&(m=p(c,d,e))}if(m===!1&&(m=b.filter.getOptions(c,d,e)),m=a.grep(m,function(b,c){return a.inArray(b,m)===c}),j.$headerIndexed[d].hasClass("filter-select-nosort"))return m;for(i=m.length,h=0;i>h;h++)g=m[h],l.push({t:g,p:j.parsers&&j.parsers.length&&j.parsers[d].format(g,c,[],d)||g});for(f=j.textSorter||"",l.sort(function(e,g){var h=e.p.toString(),i=g.p.toString();return a.isFunction(f)?f(h,i,!0,d,c):"object"==typeof f&&f.hasOwnProperty(d)?f[d](h,i,!0,d,c):b.sortNatural?b.sortNatural(h,i):!0}),m=[],i=l.length,h=0;i>h;h++)m.push(l[h].t);return m},getOptions:function(b,c,d){b=a(b)[0];var e,f,g,h,i,j=b.config,k=j.widgetOptions,l=[];for(f=0;f<j.$tbodies.length;f++)for(i=j.cache[f],g=j.cache[f].normalized.length,e=0;g>e;e++)h=i.row?i.row[e]:i.normalized[e][j.columns].$row[0],d&&h.className.match(k.filter_filteredRow)||(k.filter_useParsedData||j.parsers[c].parsed||j.$headerIndexed[c].hasClass("filter-parsed")?l.push(""+i.normalized[e][c]):l.push(i.normalized[e][j.columns].raw[c]));return l},buildSelect:function(d,e,f,g,h){if(d=a(d)[0],e=parseInt(e,10),d.config.cache&&!a.isEmptyObject(d.config.cache)){var i,j,k,l,m,n,o=d.config,p=o.widgetOptions,q=o.$headerIndexed[e],r='<option value="">'+(q.data("placeholder")||q.attr("data-placeholder")||p.filter_placeholder.select||"")+"</option>",s=o.$table.find("thead").find("select."+c.filter+'[data-column="'+e+'"]').val();if(("undefined"==typeof f||""===f)&&(f=b.filter.getOptionSource(d,e,h)),a.isArray(f)){for(i=0;i<f.length;i++)k=f[i]=(""+f[i]).replace(/\"/g,"&quot;"),j=k,k.indexOf(p.filter_selectSourceSeparator)>=0&&(l=k.split(p.filter_selectSourceSeparator),j=l[0],k=l[1]),r+=""!==f[i]?"<option "+(j===k?"":'data-function-name="'+f[i]+'" ')+'value="'+j+'">'+k+"</option>":"";f=[]}m=(o.$filters?o.$filters:o.$table.children("thead")).find("."+c.filter),p.filter_$externalFilters&&(m=m&&m.length?m.add(p.filter_$externalFilters):p.filter_$externalFilters),n=m.filter('select[data-column="'+e+'"]'),n.length&&(n[g?"html":"append"](r),a.isArray(f)||n.append(f).val(s),n.val(s))}},buildDefault:function(a,c){var d,e,f,g=a.config,h=g.widgetOptions,i=g.columns;for(d=0;i>d;d++)e=g.$headerIndexed[d],f=!(e.hasClass("filter-false")||e.hasClass("parser-false")),(e.hasClass("filter-select")||b.getColumnData(a,h.filter_functions,d)===!0)&&f&&b.filter.buildSelect(a,d,"",c,e.hasClass(h.filter_onlyAvail))}},b.getFilters=function(d,e,f,g){var h,i,j,k,l=!1,m=d?a(d)[0].config:"",n=m?m.widgetOptions:"";if(e!==!0&&n&&!n.filter_columnFilters||a.isArray(f)&&f.join("")===m.lastCombinedFilter)return a(d).data("lastSearch");if(m&&(m.$filters&&(i=m.$filters.find("."+c.filter)),n.filter_$externalFilters&&(i=i&&i.length?i.add(n.filter_$externalFilters):n.filter_$externalFilters),i&&i.length))for(l=f||[],h=0;h<m.columns+1;h++)k=h===m.columns?n.filter_anyColumnSelector+","+n.filter_multipleColumnSelector:'[data-column="'+h+'"]',j=i.filter(k),j.length&&(j=b.filter.getLatestSearch(j),a.isArray(f)?(g&&j.length>1&&(j=j.slice(1)),h===m.columns&&(k=j.filter(n.filter_anyColumnSelector),j=k.length?k:j),j.val(f[h]).trigger("change.tsfilter")):(l[h]=j.val()||"",h===m.columns?j.slice(1).filter('[data-column*="'+j.attr("data-column")+'"]').val(l[h]):j.slice(1).val(l[h])),h===m.columns&&j.length&&(n.filter_$anyMatch=j));return 0===l.length&&(l=!1),l},b.setFilters=function(c,d,e,f){var g=c?a(c)[0].config:"",h=b.getFilters(c,!0,d,f);return g&&e&&(g.lastCombinedFilter=null,g.lastSearch=[],b.filter.searching(g.table,d,f),g.$table.trigger("filterFomatterUpdate")),!!h}}(jQuery),function(a,b){"use strict";var c=a.tablesorter||{};a.extend(c.css,{sticky:"tablesorter-stickyHeader",stickyVis:"tablesorter-sticky-visible",stickyHide:"tablesorter-sticky-hidden",stickyWrap:"tablesorter-sticky-wrapper"}),c.addHeaderResizeEvent=function(b,c,d){if(b=a(b)[0],b.config){var e={timer:250},f=a.extend({},e,d),g=b.config,h=g.widgetOptions,i=function(a){var b,c,d,e,f,i,j=g.$headers.length;for(h.resize_flag=!0,c=[],b=0;j>b;b++)d=g.$headers.eq(b),e=d.data("savedSizes")||[0,0],f=d[0].offsetWidth,i=d[0].offsetHeight,(f!==e[0]||i