From 6905b9bb3edd17ab72f4a36400794cd553fe6306 Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Sat, 31 Oct 2015 10:08:21 -0500 Subject: [PATCH] Grunt: update build files --- dist/js/extras/jquery.dragtable.mod.min.js | 164 ++- dist/js/extras/jquery.metadata.min.js | 68 +- .../js/extras/jquery.tablesorter.pager.min.js | 228 +++- dist/js/extras/semver-mod.min.js | 194 ++- dist/js/jquery.tablesorter.combined.js | 64 +- dist/js/jquery.tablesorter.combined.min.js | 1048 ++++++++++++++++- dist/js/jquery.tablesorter.js | 62 +- dist/js/jquery.tablesorter.min.js | 528 ++++++++- dist/js/jquery.tablesorter.widgets.js | 2 +- dist/js/jquery.tablesorter.widgets.min.js | 522 +++++++- dist/js/parsers/parser-date-extract.min.js | 26 +- dist/js/parsers/parser-date-iso8601.min.js | 6 + dist/js/parsers/parser-date-month.min.js | 9 +- dist/js/parsers/parser-date-range.min.js | 19 +- .../parsers/parser-date-two-digit-year.min.js | 19 +- dist/js/parsers/parser-date-weekday.min.js | 9 +- dist/js/parsers/parser-date.min.js | 4 + dist/js/parsers/parser-duration.min.js | 23 +- .../parsers/parser-feet-inch-fraction.min.js | 25 +- dist/js/parsers/parser-file-type.min.js | 13 +- dist/js/parsers/parser-globalize.min.js | 14 +- dist/js/parsers/parser-ignore-articles.min.js | 17 +- dist/js/parsers/parser-image.min.js | 5 +- dist/js/parsers/parser-input-select.min.js | 59 +- dist/js/parsers/parser-metric.min.js | 32 +- dist/js/parsers/parser-named-numbers.min.js | 19 +- dist/js/parsers/parser-network.min.js | 26 +- dist/js/parsers/parser-roman.min.js | 28 +- dist/js/widgets/widget-alignChar.min.js | 19 +- dist/js/widgets/widget-build-table.min.js | 150 ++- dist/js/widgets/widget-chart.min.js | 39 +- dist/js/widgets/widget-columnSelector.min.js | 83 +- dist/js/widgets/widget-columns.min.js | 8 +- .../js/widgets/widget-cssStickyHeaders.min.js | 31 +- dist/js/widgets/widget-editable.min.js | 40 +- .../widget-filter-formatter-html5.min.js | 73 +- .../widget-filter-formatter-jui.min.js | 146 ++- .../widget-filter-formatter-select2.min.js | 34 +- .../widget-filter-type-insideRange.min.js | 13 +- dist/js/widgets/widget-filter.min.js | 301 ++++- dist/js/widgets/widget-formatter.min.js | 14 +- dist/js/widgets/widget-grouping.min.js | 56 +- dist/js/widgets/widget-headerTitles.min.js | 32 +- dist/js/widgets/widget-lazyload.min.js | 61 +- dist/js/widgets/widget-math.min.js | 98 +- dist/js/widgets/widget-output.min.js | 84 +- dist/js/widgets/widget-pager.min.js | 235 +++- dist/js/widgets/widget-print.min.js | 48 +- dist/js/widgets/widget-reflow.min.js | 76 +- dist/js/widgets/widget-repeatheaders.min.js | 23 +- dist/js/widgets/widget-resizable.min.js | 71 +- dist/js/widgets/widget-saveSort.min.js | 14 +- dist/js/widgets/widget-scroller.min.js | 149 ++- dist/js/widgets/widget-sort2Hash.min.js | 36 +- dist/js/widgets/widget-sortTbodies.min.js | 32 +- dist/js/widgets/widget-staticRow.min.js | 31 +- dist/js/widgets/widget-stickyHeaders.min.js | 72 +- dist/js/widgets/widget-storage.min.js | 40 +- dist/js/widgets/widget-uitheme.min.js | 28 +- dist/js/widgets/widget-view.min.js | 11 +- js/jquery.tablesorter.combined.js | 64 +- js/jquery.tablesorter.widgets.js | 2 +- 62 files changed, 5291 insertions(+), 156 deletions(-) diff --git a/dist/js/extras/jquery.dragtable.mod.min.js b/dist/js/extras/jquery.dragtable.mod.min.js index c48d0bea..0525da60 100644 --- a/dist/js/extras/jquery.dragtable.mod.min.js +++ b/dist/js/extras/jquery.dragtable.mod.min.js @@ -1,3 +1,163 @@ /*! Dragtable Mod for TableSorter - 2/7/2015 (v2.19.0) */ -!function(a){"use strict";function b(){var b=a('');a(document.head).append(b),a(document.body).attr("onselectstart","return false;").attr("unselectable","on"),window.getSelection?window.getSelection().removeAllRanges():document.selection.empty()}function c(){a("#__dragtable_disable_text_selection__").remove(),f?a(document.body).attr("onselectstart",f):a(document.body).removeAttr("onselectstart"),g?a(document.body).attr("unselectable",g):a(document.body).removeAttr("unselectable")}var d,e=a.tablesorter;e.dragtable={create:function(b){var c,d=b.originalTable.el,e=b.options.dragHandle.replace(".","");d.children("thead").children().children("th,td").each(function(){var d=a(this);d.find(b.options.dragHandle+",."+e+"-disabled").length||(c=b.options.dragaccept?d.hasClass(b.options.dragaccept.replace(".","")):!0,d.wrapInner('
').prepend('
'))})},start:function(b){b=a(b)[0],b&&b.config&&(b.config.widgetOptions.dragtableLast={search:a(b).data("lastSearch"),order:e.dragtable.getOrder(b)})},update:function(b){var c,d,f,g=b.originalTable,h=g.el[0],i=a(h),j=h.config,k=j&&j.widgetOptions,l=g.startIndex-1,m=g.endIndex-1,n=e.dragtable.getOrder(h)||[],o=e.hasWidget(i,"filter")||!1,p=k&&k.dragtableLast||{},q=[];(p.order||[]).join("")!==n.join("")&&(j.sortList.length&&(d=a.extend(!0,[],j.sortList),a.each(n,function(a,b){f=e.isValueInArray(parseInt(b,10),d),b!==p.order[a]&&f>=0&&(j.sortList[f][0]=a)})),o&&a.each(p.search||[],function(a){q[a]=p.search[n[a]]}),c=e.hasWidget(j.$table,"editable")?k.editable_columnsArray:!1,c&&(j.widgetOptions.editable_columnsArray=e.dragtable.reindexArrayItem(c,l,m)),c=e.hasWidget(j.$table,"math")?k.math_ignore:!1,c&&(j.widgetOptions.math_ignore=e.dragtable.reindexArrayItem(c,l,m)),c=e.hasWidget(j.$table,"resizable")?k.resizable_widths:!1,c&&(k.resizable_widths=e.dragtable.moveArrayItem(c,l,m)),e.updateAll(j,!1,function(){o&&setTimeout(function(){j.lastCombinedFilter=null,j.$table.data("lastSearch",q),e.setFilters(i,q),a.isFunction(b.options.tablesorterComplete)&&b.options.tablesorterComplete(j.table)},10)}))},getOrder:function(b){return a(b).children("thead").children("."+e.css.headerRow).children().map(function(){return a(this).attr("data-column")}).get()||[]},startColumnMove:function(b){var c,d=b.el[0].config,e=b.startIndex-1,f=b.endIndex-1,g=d.columns-1,h=f===g?!1:e>=f,i=d.$table.children().children("tr");d.debug&&console.log("Inserting column "+e+(h?" before":" after")+" column "+f),i.each(function(){c=a(this).children(),c.eq(e)[h?"insertBefore":"insertAfter"](c.eq(f))}),c=d.$table.children("colgroup").children(),c.eq(e)[h?"insertBefore":"insertAfter"](c.eq(f))},swapNodes:function(a,b){var c,d,e,f=a.length;for(c=0;f>c;c++)d=a[c].parentNode,e=a[c].nextSibling===b[c]?a[c]:a[c].nextSibling,b[c].parentNode.insertBefore(a[c],b[c]),d.insertBefore(b[c],e)},moveArrayItem:function(a,b,c){var e,f=a.length;if(c>=f)for(e=c-f;e--+1;)a.push(d);return a.splice(c,0,a.splice(b,1)[0]),a},reindexArrayItem:function(b,c,d){var e=a.inArray(d,b),f=a.inArray(c,b),g=(Math.max.apply(Math,b),[]);return e>=0&&f>=0?b:(a.each(b,function(a,b){c>d?b>=d?g.push(b+(c>b?1:0)):g.push(b):d>c&&(b===c?g.push(d):d>b&&b>=c?g.push(b-1):d>=b?g.push(b):b>c&&g.push(b+(d>b?0:1)))}),g.sort())}},/*! dragtable v2.0.14 Mod */ -a.widget("akottr.dragtable",{options:{revert:!1,dragHandle:".table-handle",maxMovingRows:40,excludeFooter:!1,onlyHeaderThreshold:100,dragaccept:null,persistState:null,restoreState:null,exact:!0,clickDelay:10,containment:null,cursor:"move",cursorAt:!1,distance:0,tolerance:"pointer",axis:"x",beforeStart:a.noop,beforeMoving:a.noop,beforeReorganize:a.noop,beforeStop:a.noop,tablesorterComplete:null,sortClass:".sorter"},originalTable:{el:null,selectedHandle:null,sortOrder:null,startIndex:0,endIndex:0},sortableTable:{el:a(),selectedHandle:a(),movingRow:a()},persistState:function(){var b=this;this.originalTable.el.find("th").each(function(a){""!==this.id&&(b.originalTable.sortOrder[this.id]=a)}),a.ajax({url:this.options.persistState,data:this.originalTable.sortOrder})},_restoreState:function(b){for(var c in b)c in b&&(this.originalTable.startIndex=a("#"+c).closest("th").prevAll().length+1,this.originalTable.endIndex=parseInt(b[c],10)+1,this._bubbleCols())},_bubbleCols:function(){e.dragtable.startColumnMove(this.originalTable)},_rearrangeTableBackroundProcessing:function(){var b=this;return function(){b._bubbleCols(),b.options.beforeStop(b.originalTable),b.sortableTable.el.remove(),c(),e.dragtable.update(b),a.isFunction(b.options.persistState)?b.options.persistState(b.originalTable):b.persistState()}},_rearrangeTable:function(){var a=this;return function(){a.originalTable.selectedHandle.removeClass("dragtable-handle-selected"),a.sortableTable.el.sortable("disable"),a.sortableTable.el.addClass("dragtable-disabled"),a.options.beforeReorganize(a.originalTable,a.sortableTable),a.originalTable.endIndex=a.sortableTable.movingRow.prevAll().length+1,setTimeout(a._rearrangeTableBackroundProcessing(),50)}},_generateSortable:function(c){c.cancelBubble?c.cancelBubble=!0:c.stopPropagation();for(var d=this,e=this.originalTable.el[0].attributes,f="",g=0;g',s=[],t=m.eq(0).children("th, td").length;for(g=0;t>g;g++){var u=m.children(":nth-child("+(g+1)+")");u.is(":visible")&&(q=0,s[g]='
  • "+(p?'':"")+"",m.each(function(a){s[g]+=""+u[a].outerHTML+""}),s[g]+="",u=n.children(":nth-child("+(g+1)+")"),d.options.maxMovingRows>1&&(u=u.add(n.children(":nth-child("+(g+1)+")").slice(0,d.options.maxMovingRows-1))),u.each(function(a){s[g]+=""+this.outerHTML+""}),s[g]+="",d.options.excludeFooter||(s[g]+=""+l.filter("tfoot").children("tr:visible").children()[g].outerHTML+""),s[g]+="
  • ")}r+=s.join("")+"",this.sortableTable.el=this.originalTable.el.before(r).prev(),this.sortableTable.el.find("> li > table").each(function(b){a(this).css("width",j[b]+"px")}),this.sortableTable.selectedHandle=this.sortableTable.el.find("th .dragtable-handle-selected");var v=this.options.dragaccept?"li:has("+this.options.dragaccept+")":"li";this.sortableTable.el.sortable({items:v,stop:this._rearrangeTable(),revert:this.options.revert,tolerance:this.options.tolerance,containment:this.options.containment,cursor:this.options.cursor,cursorAt:this.options.cursorAt,distance:this.options.distance,axis:this.options.axis}),this.originalTable.startIndex=a(c.target).closest("th,td").prevAll().length+1,this.options.beforeMoving(this.originalTable,this.sortableTable),this.sortableTable.movingRow=this.sortableTable.el.children("li:nth-child("+this.originalTable.startIndex+")"),b(),this.sortableTable.movingRow.trigger(a.extend(a.Event(c.type),{which:1,clientX:c.clientX,clientY:c.clientY,pageX:c.pageX,pageY:c.pageY,screenX:c.screenX,screenY:c.screenY}));var w=this.sortableTable.el.find(".ui-sortable-placeholder");w.height()>0&&w.css("height",this.sortableTable.el.find(".ui-sortable-helper").height()),w.html('
    ')},bindTo:{},_create:function(){var b=this;b.originalTable={el:b.element,selectedHandle:a(),sortOrder:{},startIndex:0,endIndex:0},e.dragtable.create(b),b.bindTo="> thead > tr > "+(b.options.dragaccept||"th, td"),b.element.find(b.bindTo).find(b.options.dragHandle).length&&(b.bindTo+=" "+b.options.dragHandle),a.isFunction(b.options.restoreState)?b.options.restoreState(b.originalTable):b._restoreState(b.options.restoreState),b.originalTable.el.on("mousedown.dragtable",b.bindTo,function(c){1===c.which&&(e.dragtable.start(b.originalTable.el),b.options.beforeStart(b.originalTable)!==!1&&(clearTimeout(b.downTimer),b.downTimer=setTimeout(function(){b.originalTable.selectedHandle=a(b),b.originalTable.selectedHandle.addClass("dragtable-handle-selected"),b._generateSortable(c)},b.options.clickDelay)))}).on("mouseup.dragtable",b.options.dragHandle,function(){clearTimeout(b.downTimer)})},redraw:function(){this.destroy(),this._create()},destroy:function(){this.originalTable.el.off("mousedown.dragtable mouseup.dragtable",this.bindTo),a.Widget.prototype.destroy.apply(this,arguments)}});var f=a(document.body).attr("onselectstart"),g=a(document.body).attr("unselectable")}(jQuery); \ No newline at end of file +/* + * Requires + * tablesorter v2.8+ + * jQuery 1.7+ + * jQuery UI (Core, Widget, Mouse & Sortable) + * Dragtable by Akottr (https://github.com/akottr) modified by Rob Garrison + */ +/*jshint browser:true, jquery:true, unused:false */ +/*global jQuery: false */ +!function(a){"use strict"; +// css properties to disable user-select on the body tag by appending a ');a(document.head).append(b),a(document.body).attr("onselectstart","return false;").attr("unselectable","on"),window.getSelection?window.getSelection().removeAllRanges():document.selection.empty()} +// remove the ";a(b).appendTo("body")}),c.resizable={init:function(b,d){if(!b.$table.hasClass("hasResizable")){b.$table.addClass("hasResizable");var e,f,g,h,i,j=b.$table,k=j.parent(),l=parseInt(j.css("margin-top"),10),m=d.resizable_vars={useStorage:c.storage&&d.resizable!==!1,$wrap:k,mouseXPosition:0,$target:null,$next:null,overflow:"auto"===k.css("overflow")||"scroll"===k.css("overflow")||"auto"===k.css("overflow-x")||"scroll"===k.css("overflow-x"),storedSizes:[]};for(c.resizableReset(b.table,!0),m.tableWidth=j.width(),m.fullWidth=Math.abs(k.width()-m.tableWidth)<20,m.useStorage&&m.overflow&&(c.storage(b.table,"tablesorter-table-original-css-width",m.tableWidth),i=c.storage(b.table,"tablesorter-table-resized-width")||"auto",c.resizable.setWidth(j,i,!0)),d.resizable_vars.storedSizes=h=(m.useStorage?c.storage(b.table,c.css.resizableStorage):[])||[],c.resizable.setWidths(b,d,h),c.resizable.updateStoredSizes(b,d),d.$resizable_container=a('
    ').css({top:l}).insertBefore(j),g=0;g').appendTo(d.$resizable_container).attr({"data-column":g,unselectable:"on"}).data("header",f).bind("selectstart",!1);j.one("tablesorter-initialized",function(){c.resizable.setHandlePosition(b,d),c.resizable.bindings(this.config,this.config.widgetOptions)})}},updateStoredSizes:function(a,b){var c,d,e=a.columns,f=b.resizable_vars;for(f.storedSizes=[],c=0;e>c;c++)d=a.$headerIndexed[c],f.storedSizes[c]=d.is(":visible")?d.width():0},setWidth:function(a,b,c){a.css({width:b,"min-width":c?b:"","max-width":c?b:""})},setWidths:function(b,d,e){var f,g,h=d.resizable_vars,i=a(b.namespace+"_extra_headers"),j=b.$table.children("colgroup").children("col");if(e=e||h.storedSizes||[],e.length){for(f=0;ff||f===h&&d.resizable_addLastColumn)&&c.css({display:"inline-block",height:g,left:j.position().left-e+j.outerWidth()-i}):c.hide())})},toggleTextSelection:function(b,d){var e=b.namespace+"tsresize";b.widgetOptions.resizable_vars.disabled=d,a("body").toggleClass(c.css.resizableNoSelect,d),d?a("body").attr("unselectable","on").bind("selectstart"+e,!1):a("body").removeAttr("unselectable").unbind("selectstart"+e)},bindings:function(d,e){var f=d.namespace+"tsresize";e.$resizable_container.children().bind("mousedown",function(b){var f,g=e.resizable_vars,h=a(d.namespace+"_extra_headers"),i=a(b.target).data("header");f=parseInt(i.attr("data-column"),10),g.$target=i=i.add(h.filter('[data-column="'+f+'"]')),g.target=f,g.$next=b.shiftKey||e.resizable_targetLast?i.parent().children().not(".resizable-false").filter(":last"):i.nextAll(":not(.resizable-false)").eq(0),f=parseInt(g.$next.attr("data-column"),10),g.$next=g.$next.add(h.filter('[data-column="'+f+'"]')),g.next=f,g.mouseXPosition=b.pageX,c.resizable.updateStoredSizes(d,e),c.resizable.toggleTextSelection(d,!0)}),a(document).bind("mousemove"+f,function(a){var b=e.resizable_vars;b.disabled&&0!==b.mouseXPosition&&b.$target&&(e.resizable_throttle?(clearTimeout(b.timer),b.timer=setTimeout(function(){c.resizable.mouseMove(d,e,a)},isNaN(e.resizable_throttle)?5:e.resizable_throttle)):c.resizable.mouseMove(d,e,a))}).bind("mouseup"+f,function(){e.resizable_vars.disabled&&(c.resizable.toggleTextSelection(d,!1),c.resizable.stopResize(d,e),c.resizable.setHandlePosition(d,e))}),a(b).bind("resize"+f+" resizeEnd"+f,function(){c.resizable.setHandlePosition(d,e)}),d.$table.bind("columnUpdate"+f,function(){c.resizable.setHandlePosition(d,e)}).find("thead:first").add(a(d.namespace+"_extra_table").find("thead:first")).bind("contextmenu"+f,function(){var a=0===e.resizable_vars.storedSizes.length;return c.resizableReset(d.table),c.resizable.setHandlePosition(d,e),e.resizable_vars.storedSizes=[],a})},mouseMove:function(b,d,e){if(0!==d.resizable_vars.mouseXPosition&&d.resizable_vars.$target){var f,g=0,h=d.resizable_vars,i=h.$next,j=h.storedSizes[h.target],k=e.pageX-h.mouseXPosition;if(h.overflow){if(j+k>0){for(h.storedSizes[h.target]+=k,c.resizable.setWidth(h.$target,h.storedSizes[h.target],!0),f=0;f0?d.sortList=k:c.hasInitialized&&k&&k.length>0&&b.sortOn(d,k))},remove:function(a,c){c.$table.removeClass("hasSaveSort"),b.storage&&b.storage(a,"tablesorter-savesort","")}})}(jQuery),a.tablesorter}); \ No newline at end of file +/*** This file is dynamically generated *** +█████▄ ▄████▄ █████▄ ▄████▄ ██████ ███████▄ ▄████▄ █████▄ ██ ██████ ██ ██ +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▄▄ ██▄▄██ +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀██ +█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀ +*/ +/*! tablesorter (FORK) - updated 10-31-2015 (v2.23.5)*/ +/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */ +!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";var b=a.tablesorter={version:"2.23.5",parsers:[],widgets:[],defaults:{ +// *** appearance +theme:"default",// adds tablesorter-{theme} to the table for styling +widthFixed:!1,// adds colgroup to fix widths of columns +showProcessing:!1,// show an indeterminate timer icon in the header when the table is sorted or filtered. +headerTemplate:"{content}",// header layout template (HTML ok); {content} = innerHTML, {icon} = // class from cssIcon +onRenderTemplate:null,// function( index, template ){ return template; }, // template is a string +onRenderHeader:null,// function( index ){}, // nothing to return +// *** functionality +cancelSelection:!0,// prevent text selection in the header +tabIndex:!0,// add tabindex to header for keyboard accessibility +dateFormat:"mmddyyyy",// other options: 'ddmmyyy' or 'yyyymmdd' +sortMultiSortKey:"shiftKey",// key used to select additional columns +sortResetKey:"ctrlKey",// key used to remove sorting on a column +usNumberFormat:!0,// false for German '1.234.567,89' or French '1 234 567,89' +delayInit:!1,// if false, the parsed table contents will not update until the first sort +serverSideSorting:!1,// if true, server-side sorting should be performed because client-side sorting will be disabled, but the ui and events will still be used. +resort:!0,// default setting to trigger a resort after an 'update', 'addRows', 'updateCell', etc has completed +// *** sort options +headers:{},// set sorter, string, empty, locked order, sortInitialOrder, filter, etc. +ignoreCase:!0,// ignore case while sorting +sortForce:null,// column(s) first sorted; always applied +sortList:[],// Initial sort order; applied initially; updated when manually sorted +sortAppend:null,// column(s) sorted last; always applied +sortStable:!1,// when sorting two rows with exactly the same content, the original sort order is maintained +sortInitialOrder:"asc",// sort direction on first click +sortLocaleCompare:!1,// replace equivalent character (accented characters) +sortReset:!1,// third click on the header will reset column to default - unsorted +sortRestart:!1,// restart sort to 'sortInitialOrder' when clicking on previously unsorted columns +emptyTo:"bottom",// sort empty cell to bottom, top, none, zero, emptyMax, emptyMin +stringTo:"max",// sort strings in numerical column as max, min, top, bottom, zero +textExtraction:"basic",// text extraction method/function - function( node, table, cellIndex ){} +textAttribute:"data-text",// data-attribute that contains alternate cell text (used in default textExtraction function) +textSorter:null,// choose overall or specific column sorter function( a, b, direction, table, columnIndex ) [alt: ts.sortText] +numberSorter:null,// choose overall numeric sorter function( a, b, direction, maxColumnValue ) +// *** widget options +widgets:[],// method to add widgets, e.g. widgets: ['zebra'] +widgetOptions:{zebra:["even","odd"]},initWidgets:!0,// apply widgets on tablesorter initialization +widgetClass:"widget-{name}",// table class name template to match to include a widget +// *** callbacks +initialized:null,// function( table ){}, +// *** extra css class names +tableClass:"",cssAsc:"",cssDesc:"",cssNone:"",cssHeader:"",cssHeaderRow:"",cssProcessing:"",// processing icon applied to header during sort/filter +cssChildRow:"tablesorter-childRow",// class name indiciating that a row is to be attached to the its parent +cssInfoBlock:"tablesorter-infoOnly",// don't sort tbody with this class name (only one class name allowed here!) +cssNoSort:"tablesorter-noSort",// class name added to element inside header; clicking on it won't cause a sort +cssIgnoreRow:"tablesorter-ignoreRow",// header row to ignore; cells within this row will not be added to c.$headers +cssIcon:"tablesorter-icon",// if this class does not exist, the {icon} will not be added from the headerTemplate +cssIconNone:"",// class name added to the icon when there is no column sort +cssIconAsc:"",// class name added to the icon when the column has an ascending sort +cssIconDesc:"",// class name added to the icon when the column has a descending sort +// *** events +pointerClick:"click",pointerDown:"mousedown",pointerUp:"mouseup", +// *** selectors +selectorHeaders:"> thead th, > thead td",selectorSort:"th, td",// jQuery selector of content within selectorHeaders that is clickable to trigger a sort +selectorRemove:".remove-me", +// *** advanced +debug:!1, +// *** Internal variables +headerList:[],empties:{},strings:{},parsers:[]}, +// internal css classes - these will ALWAYS be added to +// the table and MUST only contain one class name - fixes #381 +css:{table:"tablesorter",cssHasChild:"tablesorter-hasChildRow",childRow:"tablesorter-childRow",colgroup:"tablesorter-colgroup",header:"tablesorter-header",headerRow:"tablesorter-headerRow",headerIn:"tablesorter-header-inner",icon:"tablesorter-icon",processing:"tablesorter-processing",sortAsc:"tablesorter-headerAsc",sortDesc:"tablesorter-headerDesc",sortNone:"tablesorter-headerUnSorted"}, +// labels applied to sortable headers for accessibility (aria) support +language:{sortAsc:"Ascending sort applied, ",sortDesc:"Descending sort applied, ",sortNone:"No sort applied, ",nextAsc:"activate to apply an ascending sort",nextDesc:"activate to apply a descending sort",nextNone:"activate to remove the sort"},regex:{templateContent:/\{content\}/g,templateIcon:/\{icon\}/g,templateName:/\{name\}/i,spaces:/\s+/g,nonWord:/\W/g,formElements:/(input|select|button|textarea)/i, +// *** sort functions *** +// regex used in natural sort +// chunk/tokenize numbers & letters +chunk:/(^([+\-]?(?:\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi, +// replace chunks @ ends +chunks:/(^\\0|\\0$)/,hex:/^0x[0-9a-f]+$/i, +// *** formatFloat *** +comma:/,/g,digitNonUS:/[\s|\.]/g,digitNegativeTest:/^\s*\([.\d]+\)/,digitNegativeReplace:/^\s*\(([.\d]+)\)/, +// *** isDigit *** +digitTest:/^[\-+(]?\d+[)]?$/,digitReplace:/[,.'"\s]/g}, +// digit sort text location; keeping max+/- for backwards compatibility +string:{max:1,min:-1,emptymin:1,emptymax:-1,zero:0,none:0,"null":0,top:!0,bottom:!1}, +// These methods can be applied on table.config instance +instanceMethods:{},/* + ▄█████ ██████ ██████ ██ ██ █████▄ + ▀█▄ ██▄▄ ██ ██ ██ ██▄▄██ + ▀█▄ ██▀▀ ██ ██ ██ ██▀▀▀ + █████▀ ██████ ██ ▀████▀ ██ + */ +setup:function(c,d){ +// if no thead or tbody, or tablesorter is already present, quit +if(!c||!c.tHead||0===c.tBodies.length||c.hasInitialized===!0)return void(d.debug&&(c.hasInitialized?console.warn("Stopping initialization. Tablesorter has already been initialized"):console.error("Stopping initialization! No table, thead or tbody")));var e="",f=a(c),g=a.metadata; +// initialization flag +c.hasInitialized=!1, +// table is being processed flag +c.isProcessing=!0, +// make sure to store the config object +c.config=d, +// save the settings where they read +a.data(c,"tablesorter",d),d.debug&&(console[console.group?"group":"log"]("Initializing tablesorter"),a.data(c,"startoveralltimer",new Date)), +// removing this in version 3 (only supports jQuery 1.7+) +d.supportsDataObject=function(a){return a[0]=parseInt(a[0],10),a[0]>1||1===a[0]&&parseInt(a[1],10)>=4}(a.fn.jquery.split(".")), +// ensure case insensitivity +d.emptyTo=d.emptyTo.toLowerCase(),d.stringTo=d.stringTo.toLowerCase(),d.last={sortList:[],clickedIndex:-1}, +// add table theme class only if there isn't already one there +/tablesorter\-/.test(f.attr("class"))||(e=""!==d.theme?" tablesorter-"+d.theme:""),d.table=c,d.$table=f.addClass(b.css.table+" "+d.tableClass+e).attr("role","grid"),d.$headers=f.find(d.selectorHeaders), +// give the table a unique id, which will be used in namespace binding +d.namespace?d.namespace="."+d.namespace.replace(b.regex.nonWord,""):d.namespace=".tablesorter"+Math.random().toString(16).slice(2),d.$table.children().children("tr").attr("role","row"),d.$tbodies=f.children("tbody:not(."+d.cssInfoBlock+")").attr({"aria-live":"polite","aria-relevant":"all"}),d.$table.children("caption").length&&(e=d.$table.children("caption")[0],e.id||(e.id=d.namespace.slice(1)+"caption"),d.$table.attr("aria-labelledby",e.id)),d.widgetInit={},// keep a list of initialized widgets +// change textExtraction via data-attribute +d.textExtraction=d.$table.attr("data-text-extraction")||d.textExtraction||"basic", +// build headers +b.buildHeaders(d), +// fixate columns if the users supplies the fixedWidth option +// do this after theme has been applied +b.fixColumnWidth(c), +// add widgets from class name +b.addWidgetFromClass(c), +// add widget options before parsing (e.g. grouping widget has parser settings) +b.applyWidgetOptions(c), +// try to auto detect column type, and store in tables config +b.setupParsers(d), +// start total row count at zero +d.totalRows=0, +// build the cache for the tbody cells +// delayInit will delay building the cache until the user starts a sort +d.delayInit||b.buildCache(d), +// bind all header events and methods +b.bindEvents(c,d.$headers,!0),b.bindMethods(d), +// get sort list from jQuery data or metadata +// in jQuery < 1.4, an error occurs when calling $table.data() +d.supportsDataObject&&"undefined"!=typeof f.data().sortlist?d.sortList=f.data().sortlist:g&&f.metadata()&&f.metadata().sortlist&&(d.sortList=f.metadata().sortlist), +// apply widget init code +b.applyWidget(c,!0), +// if user has supplied a sort list to constructor +d.sortList.length>0?b.sortOn(d,d.sortList,{},!d.initWidgets):(b.setHeadersCss(d),d.initWidgets&& +// apply widget format +b.applyWidget(c,!1)), +// show processesing icon +d.showProcessing&&f.unbind("sortBegin"+d.namespace+" sortEnd"+d.namespace).bind("sortBegin"+d.namespace+" sortEnd"+d.namespace,function(a){clearTimeout(d.processTimer),b.isProcessing(c),"sortBegin"===a.type&&(d.processTimer=setTimeout(function(){b.isProcessing(c,!0)},500))}), +// initialized +c.hasInitialized=!0,c.isProcessing=!1,d.debug&&(console.log("Overall initialization time: "+b.benchmark(a.data(c,"startoveralltimer"))),d.debug&&console.groupEnd&&console.groupEnd()),f.trigger("tablesorter-initialized",c),"function"==typeof d.initialized&&d.initialized(c)},bindMethods:function(c){var d=c.$table,e=c.namespace,f="sortReset update updateRows updateAll updateHeaders addRows updateCell updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave ".split(" ").join(e+" "); +// apply easy methods that trigger bound events +d.unbind(f.replace(b.regex.spaces," ")).bind("sortReset"+e,function(a,c){a.stopPropagation(), +// using this.config to ensure functions are getting a non-cached version of the config +b.sortReset(this.config,c)}).bind("updateAll"+e,function(a,c,d){a.stopPropagation(),b.updateAll(this.config,c,d)}).bind("update"+e+" updateRows"+e,function(a,c,d){a.stopPropagation(),b.update(this.config,c,d)}).bind("updateHeaders"+e,function(a,c){a.stopPropagation(),b.updateHeaders(this.config,c)}).bind("updateCell"+e,function(a,c,d,e){a.stopPropagation(),b.updateCell(this.config,c,d,e)}).bind("addRows"+e,function(a,c,d,e){a.stopPropagation(),b.addRows(this.config,c,d,e)}).bind("updateComplete"+e,function(){this.isUpdating=!1}).bind("sorton"+e,function(a,c,d,e){a.stopPropagation(),b.sortOn(this.config,c,d,e)}).bind("appendCache"+e,function(c,d,e){c.stopPropagation(),b.appendCache(this.config,e),a.isFunction(d)&&d(this)}).bind("updateCache"+e,function(a,c,d){a.stopPropagation(),b.updateCache(this.config,c,d)}).bind("applyWidgetId"+e,function(a,c){a.stopPropagation(),b.getWidgetById(c).format(this,this.config,this.config.widgetOptions)}).bind("applyWidgets"+e,function(a,c){a.stopPropagation(), +// apply widgets +b.applyWidget(this,c)}).bind("refreshWidgets"+e,function(a,c,d){a.stopPropagation(),b.refreshWidgets(this,c,d)}).bind("destroy"+e,function(a,c,d){a.stopPropagation(),b.destroy(this,c,d)}).bind("resetToLoadState"+e,function(d){d.stopPropagation(), +// remove all widgets +b.removeWidget(this,!0,!1),c=a.extend(!0,b.defaults,c.originalSettings),this.hasInitialized=!1,b.setup(this,c)})},bindEvents:function(c,d,e){c=a(c)[0];var f,g=c.config,h=g.namespace,i=null;e!==!0&&(d.addClass(h.slice(1)+"_extra_headers"),f=a.fn.closest?d.closest("table")[0]:d.parents("table")[0],f&&"TABLE"===f.nodeName&&f!==c&&a(f).addClass(h.slice(1)+"_extra_table")),f=(g.pointerDown+" "+g.pointerUp+" "+g.pointerClick+" sort keyup ").replace(b.regex.spaces," ").split(" ").join(h+" "),d.find(g.selectorSort).add(d.filter(g.selectorSort)).unbind(f).bind(f,function(c,e){var f,h,j,k=a(c.target),l=" "+c.type+" ";if(!(1!==(c.which||c.button)&&!l.match(" "+g.pointerClick+" | sort | keyup ")||" keyup "===l&&13!==c.which||l.match(" "+g.pointerClick+" ")&&"undefined"!=typeof c.which||l.match(" "+g.pointerUp+" ")&&i!==c.target&&e!==!0)){if(l.match(" "+g.pointerDown+" "))return i=c.target,j=k.jquery.split("."),void("1"===j[0]&&j[1]<4&&c.preventDefault());if(i=null,b.regex.formElements.test(c.target.nodeName)||k.hasClass(g.cssNoSort)||k.parents("."+g.cssNoSort).length>0||k.parents("button").length>0)return!g.cancelSelection;g.delayInit&&b.isEmptyObject(g.cache)&&b.buildCache(g),f=a.fn.closest?a(this).closest("th, td"):/TH|TD/.test(this.nodeName)?a(this):a(this).parents("th, td"),j=d.index(f),g.last.clickedIndex=0>j?f.attr("data-column"):j,h=g.$headers[g.last.clickedIndex],h&&!h.sortDisabled&&b.initSort(g,h,c)}}),g.cancelSelection&&d.attr("unselectable","on").bind("selectstart",!1).css({"user-select":"none",MozUserSelect:"none"})},buildHeaders:function(c){var d,e,f,g;for(c.headerList=[],c.headerContent=[],c.sortVars=[],c.debug&&(f=new Date), +// children tr in tfoot - see issue #196 & #547 +c.columns=b.computeColumnIndex(c.$table.children("thead, tfoot").children("tr")),e=c.cssIcon?'':"",c.$headers=a(a.map(c.$table.find(c.selectorHeaders),function(d,f){var g,h,i,j,k,l=a(d);if(!l.parent().hasClass(c.cssIgnoreRow))return g=b.getColumnData(c.table,c.headers,f,!0),c.headerContent[f]=l.html(),""===c.headerTemplate||l.find("."+b.css.headerIn).length||(j=c.headerTemplate.replace(b.regex.templateContent,l.html()).replace(b.regex.templateIcon,l.find("."+b.css.icon).length?"":e),c.onRenderTemplate&&(h=c.onRenderTemplate.apply(l,[f,j]),h&&"string"==typeof h&&(j=h)),l.html('
    '+j+"
    ")),c.onRenderHeader&&c.onRenderHeader.apply(l,[f,c,c.$table]),i=parseInt(l.attr("data-column"),10),d.column=i,k=b.getData(l,g,"sortInitialOrder")||c.sortInitialOrder,c.sortVars[i]={count:-1,order:b.formatSortingOrder(k)?[1,0,2]:[0,1,2],lockedOrder:!1},k=b.getData(l,g,"lockedOrder")||!1,"undefined"!=typeof k&&k!==!1&&(c.sortVars[i].lockedOrder=!0,c.sortVars[i].order=b.formatSortingOrder(k)?[1,1,1]:[0,0,0]),c.headerList[f]=d,l.addClass(b.css.header+" "+c.cssHeader).parent().addClass(b.css.headerRow+" "+c.cssHeaderRow).attr("role","row"),c.tabIndex&&l.attr("tabindex",0),d})),c.$headerIndexed=[],g=0;gs;){if(d=p[s].rows,d.length)for(h=0,g=a.columns,i=0;g>i;i++)j=a.$headerIndexed[h],j&&j.length&&(k=b.getColumnData(r,a.headers,h),n=b.getParserById(b.getData(j,k,"extractor")),m=b.getParserById(b.getData(j,k,"sorter")),l="false"===b.getData(j,k,"parser"),a.empties[h]=(b.getData(j,k,"empty")||a.emptyTo||(a.emptyToBottom?"bottom":"top")).toLowerCase(),a.strings[h]=(b.getData(j,k,"string")||a.stringTo||"max").toLowerCase(),l&&(m=b.getParserById("no-parser")),n||(n=!1),m||(m=b.detectParserForColumn(a,d,-1,h)),a.debug&&(t["("+h+") "+j.text()]={parser:m.id,extractor:n?n.id:"none",string:a.strings[h],empty:a.empties[h]}),e.parsers[h]=m,e.extractors[h]=n,f=j[0].colSpan-1,f>0&&(h+=f,g+=f)),h++;s+=e.parsers.length?q:1}a.debug&&(b.isEmptyObject(t)?console.warn(" No parsers detected!"):console[console.table?"table":"log"](t),console.log("Completed detecting parsers"+b.benchmark(o)),console.groupEnd&&console.groupEnd()),a.parsers=e.parsers,a.extractors=e.extractors},addParser:function(a){var c,d=b.parsers.length,e=!0;for(c=0;d>c;c++)b.parsers[c].id.toLowerCase()===a.id.toLowerCase()&&(e=!1);e&&b.parsers.push(a)},getParserById:function(a){/*jshint eqeqeq:false */ +if("false"==a)return!1;var c,d=b.parsers.length;for(c=0;d>c;c++)if(b.parsers[c].id.toLowerCase()===a.toString().toLowerCase())return b.parsers[c];return!1},detectParserForColumn:function(c,d,e,f){for(var g,h,i=b.parsers.length,j=!1,k="",l=!0;""===k&&l;)e++,d[e]?(j=d[e].cells[f],k=b.getElementText(c,j,f),h=a(j),c.debug&&console.log("Checking if value was empty on row "+e+", column: "+f+': "'+k+'"')):l=!1;for(;--i>=0;) +// ignore the default text parser because it will always be true +if(g=b.parsers[i],g&&"text"!==g.id&&g.is&&g.is(k,c.table,j,h))return g; +// nothing found, return the generic parser (text) +return b.getParserById("text")},getElementText:function(c,d,e){if(!d)return"";var f,g=c.textExtraction||"", +// node could be a jquery object +// http://jsperf.com/jquery-vs-instanceof-jquery/2 +h=d.jquery?d:a(d); +// check data-attribute first when set to 'basic'; don't use node.innerText - it's really slow! +// http://www.kellegous.com/j/2013/02/27/innertext-vs-textcontent/ +return"string"==typeof g?"basic"===g&&"undefined"!=typeof(f=h.attr(c.textAttribute))?a.trim(f):a.trim(d.textContent||h.text()):"function"==typeof g?a.trim(g(h[0],c.table,e)):"function"==typeof(f=b.getColumnData(c.table,g,e))?a.trim(f(h[0],c.table,e)):a.trim(h[0].textContent||h.text())}, +// centralized function to extract/parse cell contents +getParsedText:function(a,c,d,e){"undefined"==typeof e&&(e=b.getElementText(a,c,d)); +// if no parser, make sure to return the txt +var f=""+e,g=a.parsers[d],h=a.extractors[d]; +// do extract before parsing, if there is one +// allow parsing if the string is empty, previously parsing would change it to zero, +// in case the parser needs to extract data from the table cell attributes +// make sure txt is a string (extractor may have converted it) +return g&&(h&&"function"==typeof h.format&&(e=h.format(e,a.table,c,d)),f="no-parser"===g.id?"":g.format(""+e,a.table,c,d),a.ignoreCase&&"string"==typeof f&&(f=f.toLowerCase())),f},/* + ▄████▄ ▄████▄ ▄████▄ ██ ██ ██████ + ██ ▀▀ ██▄▄██ ██ ▀▀ ██▄▄██ ██▄▄ + ██ ▄▄ ██▀▀██ ██ ▄▄ ██▀▀██ ██▀▀ + ▀████▀ ██ ██ ▀████▀ ██ ██ ██████ + */ +buildCache:function(c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z=c.table,A=c.parsers; +// if no parsers found, return - it's an empty table. +if( +// update tbody variable +c.$tbodies=c.$table.children("tbody:not(."+c.cssInfoBlock+")"),l="undefined"==typeof e?c.$tbodies:e,c.cache={},c.totalRows=0,!A)return c.debug?console.warn("Warning: *Empty table!* Not building a cache"):"";for(c.debug&&(q=new Date), +// processing icon +c.showProcessing&&b.isProcessing(z,!0),k=0;ki;++i) +// if this is a child row, add it to the last row's children and continue to the next row +// ignore child row class, if it is the first row +if(s={ +// order: original row order # +// $row : jQuery Object[] +child:[],// child row text (filter widget) +raw:[]},m=a(l[k].rows[i]),n=[],m.hasClass(c.cssChildRow)&&0!==i)for(y=f.normalized.length-1,t=f.normalized[y][c.columns],t.$row=t.$row.add(m),m.prev().hasClass(c.cssChildRow)||m.prev().addClass(b.css.cssHasChild),o=m.children("th, td"),y=t.child.length,t.child[y]=[],w=0,x=c.columns,j=0;x>j;j++)p=o[j],p&&(t.child[y][j]=b.getParsedText(c,p,j),v=o[j].colSpan-1,v>0&&(w+=v,x+=v)),w++;else{for(s.$row=m,s.order=i,w=0,x=c.columns,j=0;x>j;++j)p=m[0].cells[j],"undefined"==typeof A[w]?c.debug&&console.warn("No parser found for column "+j+"; cell:",p,"does it have a header?"):p&&(g=b.getElementText(c,p,w),s.raw[w]=g,h=b.getParsedText(c,p,w,g),n[w]=h,"numeric"===(A[w].type||"").toLowerCase()&&(u[w]=Math.max(Math.abs(h)||0,u[w]||0)),v=p.colSpan-1,v>0&&(w+=v,x+=v)),w++; +// ensure rowData is always in the same location (after the last column) +n[c.columns]=s,f.normalized.push(n)}f.colMax=u, +// total up rows, not including child rows +c.totalRows+=f.normalized.length}c.showProcessing&&b.isProcessing(z),c.debug&&console.log("Building cache for "+r+" rows"+b.benchmark(q)),a.isFunction(d)&&d(z)},getColumnText:function(c,d,e,f){c=a(c)[0];var g,h,i,j,k,l,m,n,o,p,q="function"==typeof e,r="all"===d,s={raw:[],parsed:[],$cell:[]},t=c.config;if(!b.isEmptyObject(t)){for(k=t.$tbodies.length,g=0;k>g;g++)for(i=t.cache[g].normalized,l=i.length,h=0;l>h;h++)j=i[h],(!f||j[t.columns].$row.is(f))&&(p=!0,n=r?j.slice(0,t.columns):j[d],j=j[t.columns],m=r?j.raw:j.raw[d],o=r?j.$row.children():j.$row.children().eq(d),q&&(p=e({tbodyIndex:g,rowIndex:h,parsed:n,raw:m,$row:j.$row,$cell:o})),p!==!1&&(s.parsed.push(n),s.raw.push(m),s.$cell.push(o))); +// return everything +return s}t.debug&&console.warn("No cache found - aborting getColumnText function!")},/* + ██ ██ █████▄ █████▄ ▄████▄ ██████ ██████ + ██ ██ ██▄▄██ ██ ██ ██▄▄██ ██ ██▄▄ + ██ ██ ██▀▀▀ ██ ██ ██▀▀██ ██ ██▀▀ + ▀████▀ ██ █████▀ ██ ██ ██ ██████ + */ +setHeadersCss:function(c){var d,e,f,g,h,i,j,k,l=c.sortList,m=l.length,n=b.css.sortNone+" "+c.cssNone,o=[b.css.sortAsc+" "+c.cssAsc,b.css.sortDesc+" "+c.cssDesc],p=[c.cssIconAsc,c.cssIconDesc,c.cssIconNone],q=["ascending","descending"], +// find the footer +r=c.$table.find("tfoot tr").children().add(a(c.namespace+"_extra_headers")).removeClass(o.join(" "));for( +// remove all header information +c.$headers.removeClass(o.join(" ")).addClass(n).attr("aria-sort","none").find("."+b.css.icon).removeClass(p.join(" ")).addClass(p[2]),f=0;m>f;f++) +// direction = 2 means reset! +if(2!==l[f][1]&&(d=c.$headers.filter(function(d,e){for( +// only include headers that are in the sortList (this includes colspans) +var f=!0,g=a(e),h=parseInt(g.attr("data-column"),10),i=h+e.colSpan;i>h;h++)f=f?b.isValueInArray(h,c.sortList)>-1:!1;return f}),d=d.not(".sorter-false").filter('[data-column="'+l[f][0]+'"]'+(1===m?":last":"")),d.length)){for(g=0;gf;f++)h=r.eq(f),h.length&&(e=r[f],g=parseInt(h.attr("data-column"),10),i=c.sortVars[g].order[(c.sortVars[g].count+1)%(c.sortReset?3:2)],k=h.hasClass(b.css.sortAsc)?"sortAsc":h.hasClass(b.css.sortDesc)?"sortDesc":"sortNone",j=a.trim(h.text())+": "+b.language[k]+b.language[0===i?"nextAsc":1===i?"nextDesc":"nextNone"],h.attr("aria-label",j))},updateHeader:function(a){var c,d,e,f,g=a.table,h=a.$headers.length;for(c=0;h>c;c++)e=a.$headers.eq(c),f=b.getColumnData(g,a.headers,c,!0),d="false"===b.getData(e,f,"sorter")||"false"===b.getData(e,f,"parser"),e[0].sortDisabled=d,e[d?"addClass":"removeClass"]("sorter-false").attr("aria-disabled",""+d),a.tabIndex&&(d?e.removeAttr("tabindex"):e.attr("tabindex","0")),g.id&&(d?e.removeAttr("aria-controls"):e.attr("aria-controls",g.id))},updateHeaderSortCount:function(b,c){var d,e,f,g,h,i,j,k,l=c||b.sortList,m=l.length;for(b.sortList=[],g=0;m>g;g++) +// prevents error if sorton array is wrong +if(j=l[g],d=parseInt(j[0],10),d=0?e:f[1]%(b.sortReset?3:2)}},updateAll:function(a,c,d){var e=a.table;e.isUpdating=!0,b.refreshWidgets(e,!0,!0),b.buildHeaders(a),b.bindEvents(e,a.$headers,!0),b.bindMethods(a),b.commonUpdate(a,c,d)},update:function(a,c,d){var e=a.table;e.isUpdating=!0, +// update sorting (if enabled/disabled) +b.updateHeader(a),b.commonUpdate(a,c,d)}, +// simple header update - see #989 +updateHeaders:function(a,c){a.table.isUpdating=!0,b.buildHeaders(a),b.bindEvents(a.table,a.$headers,!0),b.resortComplete(a,c)},updateCell:function(c,d,e,f){c.table.isUpdating=!0,c.$table.find(c.selectorRemove).remove(); +// get position from the dom +var g,h,i,j,k,l,m=c.$tbodies,n=a(d), +// update cache - format: function( s, table, cell, cellIndex ) +// no closest in jQuery v1.2.6 +o=m.index(a.fn.closest?n.closest("tbody"):n.parents("tbody").filter(":first")),p=c.cache[o],q=a.fn.closest?n.closest("tr"):n.parents("tr").filter(":first");// in case cell is a jQuery object +// tbody may not exist if update is initialized while tbody is removed for processing +if(d=n[0],m.length&&o>=0){if(i=m.eq(o).find("tr").index(q),k=p.normalized[i],l=q[0].cells.length,l!==c.columns)for(j=0,g=!1,h=0;l>h;h++)g||q[0].cells[h]===d?g=!0:j+=q[0].cells[h].colSpan;else j=n.index();g=b.getElementText(c,d,j),// raw +k[c.columns].raw[j]=g,g=b.getParsedText(c,d,j,g),k[j]=g,// parsed +k[c.columns].$row=q,"numeric"===(c.parsers[j].type||"").toLowerCase()&&( +// update column max value (ignore sign) +p.colMax[j]=Math.max(Math.abs(g)||0,p.colMax[j]||0)),g="undefined"!==e?e:c.resort,g!==!1? +// widgets will be reapplied +b.checkResort(c,g,f): +// don't reapply widgets is resort is false, just in case it causes +// problems with element focus +b.resortComplete(c,f)}},addRows:function(c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q,r, +// allow passing a row string if only one non-info tbody exists in the table +s="string"==typeof d&&1===c.$tbodies.length&&/j;j++){ +// add each cell +for(n=0,m=d[j].cells.length,p=[],o={child:[],raw:[],$row:d.eq(j),order:c.cache[i].normalized.length},l=0;m>l;l++)q=d[j].cells[l],g=b.getElementText(c,q,n),o.raw[n]=g,h=b.getParsedText(c,q,n,g),p[n]=h,"numeric"===(c.parsers[n].type||"").toLowerCase()&&(c.cache[i].colMax[n]=Math.max(Math.abs(h)||0,c.cache[i].colMax[n]||0)),r=q.colSpan-1,r>0&&(n+=r),n++; +// add the row data to the end +p[c.columns]=o, +// update cache +c.cache[i].normalized.push(p)} +// resort using current settings +b.checkResort(c,e,f)}},updateCache:function(a,c,d){ +// rebuild parsers +a.parsers&&a.parsers.length||b.setupParsers(a,d), +// rebuild the cache map +b.buildCache(a,c,d)}, +// init flag (true) used by pager plugin to prevent widget application +// renamed from appendToTable +appendCache:function(a,c){var d,e,f,g,h,i,j,k=a.table,l=a.widgetOptions,m=a.$tbodies,n=[],o=a.cache; +// empty table - fixes #206/#346 +if(b.isEmptyObject(o)) +// run pager appender in case the table was just emptied +return a.appender?a.appender(k,n):k.isUpdating?a.$table.trigger("updateComplete",k):"";for(a.debug&&(j=new Date),i=0;ih;h++)n.push(d[h][a.columns].$row), +// removeRows used by the pager plugin; don't render if using ajax - fixes #411 +a.appender&&(!a.pager||a.pager.removeRows&&l.pager_removeRows||a.pager.ajax)||g.append(d[h][a.columns].$row); +// restore tbody +b.processTbody(k,g,!1)}a.appender&&a.appender(k,n),a.debug&&console.log("Rebuilt table"+b.benchmark(j)), +// apply table widgets; but not before ajax completes +c||a.appender||b.applyWidget(k),k.isUpdating&&a.$table.trigger("updateComplete",k)},commonUpdate:function(a,c,d){ +// remove rows/elements before update +a.$table.find(a.selectorRemove).remove(), +// rebuild parsers +b.setupParsers(a), +// rebuild the cache map +b.buildCache(a),b.checkResort(a,c,d)},/* + ▄█████ ▄████▄ █████▄ ██████ ██ █████▄ ▄████▄ + ▀█▄ ██ ██ ██▄▄██ ██ ██ ██ ██ ██ ▄▄▄ + ▀█▄ ██ ██ ██▀██ ██ ██ ██ ██ ██ ▀██ + █████▀ ▀████▀ ██ ██ ██ ██ ██ ██ ▀████▀ + */ +initSort:function(c,d,e){if(c.table.isUpdating) +// let any updates complete before initializing a sort +return setTimeout(function(){b.initSort(c,d,e)},50);var f,g,h,i,j,k,l,m=!e[c.sortMultiSortKey],n=c.table,o=c.$headers.length, +// get current column index +p=parseInt(a(d).attr("data-column"),10),q=c.sortVars[p].order; +// reset all sorts on non-current column - issue #30 +if( +// Only call sortStart if sorting is enabled +c.$table.trigger("sortStart",n), +// get current column sort order +c.sortVars[p].count=e[c.sortResetKey]?2:(c.sortVars[p].count+1)%(c.sortReset?3:2),c.sortRestart)for(k=d,h=0;o>h;h++)l=c.$headers.eq(h),l[0]===k||!m&&l.is("."+b.css.sortDesc+",."+b.css.sortAsc)||(c.sortVars[p].count=-1); +// user only wants to sort on one column +if(m){if( +// flush the sort list +c.sortList=[],c.last.sortList=[],null!==c.sortForce)for(f=c.sortForce,g=0;gi&&(c.sortList.push([p,i]),d.colSpan>1))for(g=1;g=0) +// reverse the sorting direction +for(g=0;gi&&(c.sortList.push([p,i]),d.colSpan>1))for(g=1;gc;c++)e=a.cache[c].colMax,f=a.cache[c].normalized,f.sort(function(c,d){var f,l,m,n,o,p,q;for(f=0;k>f;f++){if(m=j[f][0],n=j[f][1],h=0===n,a.sortStable&&c[m]===d[m]&&1===k)return c[a.columns].order-d[a.columns].order;if(l=/n/i.test(b.getSortType(a.parsers,m)),l&&a.strings[m]?(l="boolean"==typeof b.string[a.strings[m]]?(h?1:-1)*(b.string[a.strings[m]]?-1:1):a.strings[m]?b.string[a.strings[m]]||0:0,o=a.numberSorter?a.numberSorter(c[m],d[m],h,e[m],g):b["sortNumeric"+(h?"Asc":"Desc")](c[m],d[m],l,e[m],m,a)):(p=h?c:d,q=h?d:c,o="function"==typeof i?i(p[m],q[m],h,m,g):"object"==typeof i&&i.hasOwnProperty(m)?i[m](p[m],q[m],h,m,g):b["sortNatural"+(h?"Asc":"Desc")](c[m],d[m],m,a)),o)return o}return c[a.columns].order-d[a.columns].order});a.debug&&console.log("Applying sort "+j.toString()+b.benchmark(d))}},resortComplete:function(b,c){b.table.isUpdating&&b.$table.trigger("updateComplete",b.table),a.isFunction(c)&&c(b.table)},checkResort:function(c,d,e){var f=a.isArray(d)?d:c.sortList, +// if no resort parameter is passed, fallback to config.resort (true by default) +g="undefined"==typeof d?c.resort:d; +// don't try to resort if the table is still processing +// this will catch spamming of the updateCell method +g===!1||c.serverSideSorting||c.table.isProcessing?(b.resortComplete(c,e),b.applyWidget(c.table,!1)):f.length?b.sortOn(c,f,function(){b.resortComplete(c,e)},!0):b.sortReset(c,function(){b.resortComplete(c,e),b.applyWidget(c.table,!1)})},sortOn:function(c,d,e,f){var g=c.table;c.$table.trigger("sortStart",g), +// update header count index +b.updateHeaderSortCount(c,d), +// set css for headers +b.setHeadersCss(c), +// fixes #346 +c.delayInit&&b.isEmptyObject(c.cache)&&b.buildCache(c),c.$table.trigger("sortBegin",g), +// sort the table and append it to the dom +b.multisort(c),b.appendCache(c,f),c.$table.trigger("sortEnd",g),b.applyWidget(g),a.isFunction(e)&&e(g)},sortReset:function(c,d){c.sortList=[],b.setHeadersCss(c),b.multisort(c),b.appendCache(c),a.isFunction(d)&&d(c.table)},getSortType:function(a,b){return a&&a[b]?a[b].type||"":""},formatSortingOrder:function(a){ +// look for 'd' in 'desc' order; return true +return/^d/i.test(a)||1===a}, +// Natural sort - https://github.com/overset/javascript-natural-sort (date sorting removed) +// this function will only accept strings, or you'll see 'TypeError: undefined is not a function' +// I could add a = a.toString(); b = b.toString(); but it'll slow down the sort overall +sortNatural:function(a,c){if(a===c)return 0;var d,e,f,g,h,i,j=b.regex; +// first try and sort Hex codes +if(j.hex.test(c)){if(d=parseInt(a.match(j.hex),16),e=parseInt(c.match(j.hex),16),e>d)return-1;if(d>e)return 1} +// natural sorting through split numeric strings and default strings +for(d=a.replace(j.chunk,"\\0$1\\0").replace(j.chunks,"").split("\\0"),e=c.replace(j.chunk,"\\0$1\\0").replace(j.chunks,"").split("\\0"),i=Math.max(d.length,e.length),h=0;i>h;h++){ +// handle numeric vs string comparison - number < string - (Kyle Adams) +if(f=isNaN(d[h])?d[h]||0:parseFloat(d[h])||0,g=isNaN(e[h])?e[h]||0:parseFloat(e[h])||0,isNaN(f)!==isNaN(g))return isNaN(f)?1:-1;if( +// rely on string comparison if different types - i.e. '02' < 2 != '02' < '2' +typeof f!=typeof g&&(f+="",g+=""),g>f)return-1;if(f>g)return 1}return 0},sortNaturalAsc:function(a,c,d,e){if(a===c)return 0;var f=b.string[e.empties[d]||e.emptyTo];return""===a&&0!==f?"boolean"==typeof f?f?-1:1:-f||-1:""===c&&0!==f?"boolean"==typeof f?f?1:-1:f||1:b.sortNatural(a,c)},sortNaturalDesc:function(a,c,d,e){if(a===c)return 0;var f=b.string[e.empties[d]||e.emptyTo];return""===a&&0!==f?"boolean"==typeof f?f?-1:1:f||1:""===c&&0!==f?"boolean"==typeof f?f?1:-1:-f||-1:b.sortNatural(c,a)}, +// basic alphabetical sort +sortText:function(a,b){return a>b?1:b>a?-1:0}, +// return text string value by adding up ascii value +// so the text is somewhat sorted when using a digital sort +// this is NOT an alphanumeric sort +getTextValue:function(a,b,c){if(c){ +// make sure the text value is greater than the max numerical value (max) +var d,e=a?a.length:0,f=c+b;for(d=0;e>d;d++)f+=a.charCodeAt(d);return b*f}return 0},sortNumericAsc:function(a,c,d,e,f,g){if(a===c)return 0;var h=b.string[g.empties[f]||g.emptyTo];return""===a&&0!==h?"boolean"==typeof h?h?-1:1:-h||-1:""===c&&0!==h?"boolean"==typeof h?h?1:-1:h||1:(isNaN(a)&&(a=b.getTextValue(a,d,e)),isNaN(c)&&(c=b.getTextValue(c,d,e)),a-c)},sortNumericDesc:function(a,c,d,e,f,g){if(a===c)return 0;var h=b.string[g.empties[f]||g.emptyTo];return""===a&&0!==h?"boolean"==typeof h?h?-1:1:h||1:""===c&&0!==h?"boolean"==typeof h?h?1:-1:-h||-1:(isNaN(a)&&(a=b.getTextValue(a,d,e)),isNaN(c)&&(c=b.getTextValue(c,d,e)),c-a)},sortNumeric:function(a,b){return a-b},/* + ██ ██ ██ ██ █████▄ ▄████▄ ██████ ██████ ▄█████ + ██ ██ ██ ██ ██ ██ ██ ▄▄▄ ██▄▄ ██ ▀█▄ + ██ ██ ██ ██ ██ ██ ██ ▀██ ██▀▀ ██ ▀█▄ + ███████▀ ██ █████▀ ▀████▀ ██████ ██ █████▀ + */ +addWidget:function(a){b.widgets.push(a)},hasWidget:function(b,c){return b=a(b),b.length&&b[0].config&&b[0].config.widgetInit[c]||!1},getWidgetById:function(a){var c,d,e=b.widgets.length;for(c=0;e>c;c++)if(d=b.widgets[c],d&&d.id&&d.id.toLowerCase()===a.toLowerCase())return d},applyWidgetOptions:function(c){var d,e,f=c.config,g=f.widgets.length;if(g)for(d=0;g>d;d++)e=b.getWidgetById(f.widgets[d]),e&&e.options&&(f.widgetOptions=a.extend(!0,{},e.options,f.widgetOptions))},addWidgetFromClass:function(a){var c,d,e=a.config, +// look for widgets to apply from table class +// stop using \b otherwise this matches 'ui-widget-content' & adds 'content' widget +f="\\s"+e.widgetClass.replace(b.regex.templateName,"([\\w-]+)")+"\\s",g=new RegExp(f,"g"), +// extract out the widget id from the table class (widget id's can include dashes) +h=(" "+e.table.className+" ").match(g);if(h)for(c=h.length,d=0;c>d;d++)e.widgets.push(h[d].replace(g,"$1"))},applyWidget:function(c,d,e){c=a(c)[0];// in case this is called externally +var f,g,h,i,j,k,l,m,n=c.config,o=[]; +// prevent numerous consecutive widget applications +if(d===!1||!c.hasInitialized||!c.isApplyingWidgets&&!c.isUpdating){if(n.debug&&(l=new Date),b.addWidgetFromClass(c),n.widgets.length){ +// build widget array & add priority as needed +for(c.isApplyingWidgets=!0, +// ensure unique widget ids +n.widgets=a.grep(n.widgets,function(b,c){return a.inArray(b,n.widgets)===c}),h=n.widgets||[],g=h.length,f=0;g>f;f++)i=b.getWidgetById(h[f]),i&&i.id&&(i.priority||(i.priority=10),o[f]=i);for( +// sort widgets by priority +o.sort(function(a,b){return a.priorityf;f++)i=o[f],i&&(j=i.id,k=!1,n.debug&&(m=new Date),(d||!n.widgetInit[j])&&(n.widgetInit[j]=!0,c.hasInitialized&&b.applyWidgetOptions(c),"function"==typeof i.init&&(k=!0,n.debug&&console[console.group?"group":"log"]("Initializing "+j+" widget"),i.init(c,i,c.config,c.config.widgetOptions))),d||"function"!=typeof i.format||(k=!0,n.debug&&console[console.group?"group":"log"]("Updating "+j+" widget"),i.format(c,c.config,c.config.widgetOptions,!1)),n.debug&&k&&(console.log("Completed "+(d?"initializing ":"applying ")+j+" widget"+b.benchmark(m)),console.groupEnd&&console.groupEnd()));n.debug&&console.groupEnd&&console.groupEnd(), +// callback executed on init only +d||"function"!=typeof e||e(c)}setTimeout(function(){c.isApplyingWidgets=!1,a.data(c,"lastWidgetApplication",new Date),n.$table.trigger("tablesorter-ready")},0),n.debug&&(i=n.widgets.length,console.log("Completed "+(d===!0?"initializing ":"applying ")+i+" widget"+(1!==i?"s":"")+b.benchmark(l)))}},removeWidget:function(c,d,e){c=a(c)[0];var f,g,h,i,j=c.config; +// if name === true, add all widgets from $.tablesorter.widgets +if(d===!0)for(d=[],i=b.widgets.length,h=0;i>h;h++)g=b.widgets[h],g&&g.id&&d.push(g.id);else +// name can be either an array of widgets names, +// or a space/comma separated list of widget names +d=(a.isArray(d)?d.join(","):d||"").toLowerCase().split(/[\s,]+/);for(i=d.length,f=0;i>f;f++)g=b.getWidgetById(d[f]),h=a.inArray(d[f],j.widgets),g&&g.remove&&(j.debug&&console.log((e?"Refreshing":"Removing")+' "'+d[f]+'" widget'),g.remove(c,j,j.widgetOptions,e),j.widgetInit[d[f]]=!1),h>=0&&e!==!0&&j.widgets.splice(h,1)},refreshWidgets:function(c,d,e){c=a(c)[0];// see issue #243 +var f,g,h=c.config,i=h.widgets,j=b.widgets,k=j.length,l=[],m=function(b){a(b).trigger("refreshComplete")}; +// remove widgets not defined in config.widgets, unless doAll is true +for(f=0;k>f;f++)g=j[f],g&&g.id&&(d||a.inArray(g.id,i)<0)&&l.push(g.id);b.removeWidget(c,l.join(","),!0),e!==!0?( +// call widget init if +b.applyWidget(c,d||!1,m),d&& +// apply widget format +b.applyWidget(c,!1,m)):m(c)},/* + ██ ██ ██████ ██ ██ ██ ██████ ██ ██████ ▄█████ + ██ ██ ██ ██ ██ ██ ██ ██ ██▄▄ ▀█▄ + ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀█▄ + ▀████▀ ██ ██ ██████ ██ ██ ██ ██████ █████▀ + */ +benchmark:function(a){return" ( "+((new Date).getTime()-a.getTime())+"ms )"}, +// deprecated ts.log +log:function(){console.log(arguments)}, +// $.isEmptyObject from jQuery v1.4 +isEmptyObject:function(a){/*jshint forin: false */ +for(var b in a)return!1;return!0},isValueInArray:function(a,b){var c,d=b&&b.length||0;for(c=0;d>c;c++)if(b[c][0]===a)return c;return-1},formatFloat:function(c,d){if("string"!=typeof c||""===c)return c; +// allow using formatFloat without a table; defaults to US number format +var e,f=d&&d.config?d.config.usNumberFormat!==!1:"undefined"!=typeof d?d:!0; +// return the text instead of zero +// US Format - 1,234,567.89 -> 1234567.89 +// make (#) into a negative number -> (10) = -10 +return c=f?c.replace(b.regex.comma,""):c.replace(b.regex.digitNonUS,"").replace(b.regex.comma,"."),b.regex.digitNegativeTest.test(c)&&(c=c.replace(b.regex.digitNegativeReplace,"-$1")),e=parseFloat(c),isNaN(e)?a.trim(c):e},isDigit:function(a){ +// replace all unwanted chars and match +return isNaN(a)?b.regex.digitTest.test(a.toString().replace(b.regex.digitReplace,"")):""!==a}, +// computeTableHeaderCellIndexes from: +// http://www.javascripttoolbox.com/lib/table/examples.php +// http://www.javascripttoolbox.com/temp/table_cellindex.html +computeColumnIndex:function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o=[],p=[];for(c=0;ce;e++)for("undefined"==typeof o[e]&&(o[e]=[]),p=o[e],f=n;n+m>f;f++)p[f]="x"}return p.length}, +// automatically add a colgroup with col elements set to a percentage width +fixColumnWidth:function(c){c=a(c)[0];var d,e,f,g,h,i=c.config,j=i.$table.children("colgroup");if( +// remove plugin-added colgroup, in case we need to refresh the widths +j.length&&j.hasClass(b.css.colgroup)&&j.remove(),i.widthFixed&&0===i.$table.children("colgroup").length){for(j=a(''),d=i.$table.width(),f=i.$tbodies.find("tr:first").children(":visible"),g=f.length,h=0;g>h;h++)e=parseInt(f.eq(h).width()/d*1e3,10)/10+"%",j.append(a("").css("width",e));i.$table.prepend(j)}}, +// get sorter, string, empty, etc options for each column from +// jQuery data, metadata, header option or header class name ('sorter-false') +// priority = jQuery data > meta > headers option > header class name +getData:function(b,c,d){var e,f,g="",h=a(b); +// 'data-lockedOrder' is assigned to 'lockedorder'; but 'data-locked-order' is assigned to 'lockedOrder' +// 'data-sort-initial-order' is assigned to 'sortInitialOrder' +// include sorter class name 'sorter-text', etc; now works with 'sorter-my-custom-parser' +return h.length?(e=a.metadata?h.metadata():!1,f=" "+(h.attr("class")||""),"undefined"!=typeof h.data(d)||"undefined"!=typeof h.data(d.toLowerCase())?g+=h.data(d)||h.data(d.toLowerCase()):e&&"undefined"!=typeof e[d]?g+=e[d]:c&&"undefined"!=typeof c[d]?g+=c[d]:" "!==f&&f.match(" "+d+"-")&&(g=f.match(new RegExp("\\s"+d+"-([\\w-]+)"))[1]||""),a.trim(g)):""},getColumnData:function(b,c,d,e,f){if("undefined"!=typeof c&&null!==c){b=a(b)[0];var g,h,i=b.config,j=f||i.$headers, +// c.$headerIndexed is not defined initially +k=i.$headerIndexed&&i.$headerIndexed[d]||j.filter('[data-column="'+d+'"]:last');if(c[d])return e?c[d]:c[j.index(k)];for(h in c)if("string"==typeof h&&(g=k.filter(h).add(k.find(h)),g.length))return c[h]}}, +// *** Process table *** +// add processing indicator +isProcessing:function(c,d,e){c=a(c);var f=c[0].config, +// default to all headers +g=e||c.find("."+b.css.header);d?( +// don't use sortList if custom $ths used +"undefined"!=typeof e&&f.sortList.length>0&&( +// get headers from the sortList +g=g.filter(function(){ +// get data-column from attr to keep compatibility with jQuery 1.2.6 +return this.sortDisabled?!1:b.isValueInArray(parseFloat(a(this).attr("data-column")),f.sortList)>=0})),c.add(g).addClass(b.css.processing+" "+f.cssProcessing)):c.add(g).removeClass(b.css.processing+" "+f.cssProcessing)}, +// detach tbody but save the position +// don't use tbody because there are portions that look for a tbody index (updateCell) +processTbody:function(b,c,d){if(b=a(b)[0],d)return b.isProcessing=!0,c.before(''),a.fn.detach?c.detach():c.remove();var e=a(b).find("colgroup.tablesorter-savemyplace");c.insertAfter(e),e.remove(),b.isProcessing=!1},clearTableBody:function(b){a(b)[0].config.$tbodies.children().detach()}, +// used when replacing accented characters during sorting +characterEquivalents:{a:"áàâãäąå",// áàâãäąå +A:"ÁÀÂÃÄĄÅ",// ÁÀÂÃÄĄÅ +c:"çćč",// çćč +C:"ÇĆČ",// ÇĆČ +e:"éèêëěę",// éèêëěę +E:"ÉÈÊËĚĘ",// ÉÈÊËĚĘ +i:"íìİîïı",// íìİîïı +I:"ÍÌİÎÏ",// ÍÌİÎÏ +o:"óòôõöō",// óòôõöō +O:"ÓÒÔÕÖŌ",// ÓÒÔÕÖŌ +ss:"ß",// ß (s sharp) +SS:"ẞ",// ẞ (Capital sharp s) +u:"úùûüů",// úùûüů +U:"ÚÙÛÜŮ"},replaceAccents:function(a){var c,d="[",e=b.characterEquivalents;if(!b.characterRegex){b.characterRegexArray={};for(c in e)"string"==typeof c&&(d+=e[c],b.characterRegexArray[c]=new RegExp("["+e[c]+"]","g"));b.characterRegex=new RegExp(d+"]")}if(b.characterRegex.test(a))for(c in e)"string"==typeof c&&(a=a.replace(b.characterRegexArray[c],c));return a}, +// restore headers +restoreHeaders:function(c){var d,e,f=a(c)[0].config,g=f.$table.find(f.selectorHeaders),h=g.length; +// don't use c.$headers here in case header cells were swapped +for(d=0;h>d;d++)e=g.eq(d),e.find("."+b.css.headerIn).length&&e.html(f.headerContent[d])},destroy:function(c,d,e){if(c=a(c)[0],c.hasInitialized){ +// remove all widgets +b.removeWidget(c,!0,!1);var f,g=a(c),h=c.config,i=h.debug,j=g.find("thead:first"),k=j.find("tr."+b.css.headerRow).removeClass(b.css.headerRow+" "+h.cssHeaderRow),l=g.find("tfoot:first > tr").children("th, td");d===!1&&a.inArray("uitheme",h.widgets)>=0&&( +// reapply uitheme classes, in case we want to maintain appearance +g.trigger("applyWidgetId",["uitheme"]),g.trigger("applyWidgetId",["zebra"])), +// remove widget added rows, just in case +j.find("tr").not(k).remove(), +// disable tablesorter +f="sortReset update updateRows updateAll updateHeaders updateCell addRows updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress "+"sortBegin sortEnd resetToLoadState ".split(" ").join(h.namespace+" "),g.removeData("tablesorter").unbind(f.replace(b.regex.spaces," ")),h.$headers.add(l).removeClass([b.css.header,h.cssHeader,h.cssAsc,h.cssDesc,b.css.sortAsc,b.css.sortDesc,b.css.sortNone].join(" ")).removeAttr("data-column").removeAttr("aria-label").attr("aria-disabled","true"),k.find(h.selectorSort).unbind("mousedown mouseup keypress ".split(" ").join(h.namespace+" ").replace(b.regex.spaces," ")),b.restoreHeaders(c),g.toggleClass(b.css.table+" "+h.tableClass+" tablesorter-"+h.theme,d===!1), +// clear flag in case the plugin is initialized again +c.hasInitialized=!1,delete c.config.cache,"function"==typeof e&&e(c),i&&console.log("tablesorter has been removed")}}};a.fn.tablesorter=function(c){return this.each(function(){var d=this, +// merge & extend config options +e=a.extend(!0,{},b.defaults,c,b.instanceMethods); +// save initial settings +e.originalSettings=c, +// create a table from data (build table widget) +!d.hasInitialized&&b.buildTable&&"TABLE"!==this.nodeName? +// return the table (in case the original target is the table's container) +b.buildTable(d,e):b.setup(d,e)})}, +// set up debug logs +window.console&&window.console.log||( +// access $.tablesorter.logs for browsers that don't have a console... +b.logs=[],/*jshint -W020 */ +console={},console.log=console.warn=console.error=console.table=function(){var a=arguments.length>1?arguments:arguments[0];b.logs.push({date:Date.now(),log:a})}), +// add default parsers +b.addParser({id:"no-parser",is:function(){return!1},format:function(){return""},type:"text"}),b.addParser({id:"text",is:function(){return!0},format:function(c,d){var e=d.config;return c&&(c=a.trim(e.ignoreCase?c.toLocaleLowerCase():c),c=e.sortLocaleCompare?b.replaceAccents(c):c),c},type:"text"}),b.regex.nondigit=/[^\w,. \-()]/g,b.addParser({id:"digit",is:function(a){return b.isDigit(a)},format:function(c,d){var e=b.formatFloat((c||"").replace(b.regex.nondigit,""),d);return c&&"number"==typeof e?e:c?a.trim(c&&d.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"}),b.regex.currencyReplace=/[+\-,. ]/g,b.regex.currencyTest=/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/,b.addParser({id:"currency",is:function(a){ +// test for £$€¤¥¢ +return a=(a||"").replace(b.regex.currencyReplace,""),b.regex.currencyTest.test(a)},format:function(c,d){var e=b.formatFloat((c||"").replace(b.regex.nondigit,""),d);return c&&"number"==typeof e?e:c?a.trim(c&&d.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"}), +// too many protocols to add them all https://en.wikipedia.org/wiki/URI_scheme +// now, this regex can be updated before initialization +b.regex.urlProtocolTest=/^(https?|ftp|file):\/\//,b.regex.urlProtocolReplace=/(https?|ftp|file):\/\//,b.addParser({id:"url",is:function(a){return b.regex.urlProtocolTest.test(a)},format:function(c){return c?a.trim(c.replace(b.regex.urlProtocolReplace,"")):c},parsed:!0,// filter widget flag +type:"text"}),b.regex.dash=/-/g,b.regex.isoDate=/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/,b.addParser({id:"isoDate",is:function(a){return b.regex.isoDate.test(a)},format:function(a,c){var d=a?new Date(a.replace(b.regex.dash,"/")):a;return d instanceof Date&&isFinite(d)?d.getTime():a},type:"numeric"}),b.regex.percent=/%/g,b.regex.percentTest=/(\d\s*?%|%\s*?\d)/,b.addParser({id:"percent",is:function(a){return b.regex.percentTest.test(a)&&a.length<15},format:function(a,c){return a?b.formatFloat(a.replace(b.regex.percent,""),c):a},type:"numeric"}), +// added image parser to core v2.17.9 +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,// filter widget flag +type:"text"}),b.regex.dateReplace=/(\S)([AP]M)$/i,// used by usLongDate & time parser +b.regex.usLongDateTest1=/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i,b.regex.usLongDateTest2=/^\d{1,2}\s+[A-Z]{3,10}\s+\d{4}/i,b.addParser({id:"usLongDate",is:function(a){ +// two digit years are not allowed cross-browser +// Jan 01, 2013 12:34:56 PM or 01 Jan 2013 +return b.regex.usLongDateTest1.test(a)||b.regex.usLongDateTest2.test(a)},format:function(a,c){var d=a?new Date(a.replace(b.regex.dateReplace,"$1 $2")):a;return d instanceof Date&&isFinite(d)?d.getTime():a},type:"numeric"}), +// testing for ##-##-#### or ####-##-##, so it's not perfect; time can be included +b.regex.shortDateTest=/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/, +// escaped "-" because JSHint in Firefox was showing it as an error +b.regex.shortDateReplace=/[\-.,]/g, +// XXY covers MDY & DMY formats +b.regex.shortDateXXY=/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,b.regex.shortDateYMD=/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,b.addParser({id:"shortDate",// 'mmddyyyy', 'ddmmyyyy' or 'yyyymmdd' +is:function(a){return a=(a||"").replace(b.regex.spaces," ").replace(b.regex.shortDateReplace,"/"),b.regex.shortDateTest.test(a)},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(b.regex.spaces," ").replace(b.regex.shortDateReplace,"/"),"mmddyyyy"===j?g=g.replace(b.regex.shortDateXXY,"$3/$1/$2"):"ddmmyyyy"===j?g=g.replace(b.regex.shortDateXXY,"$3/$2/$1"):"yyyymmdd"===j&&(g=g.replace(b.regex.shortDateYMD,"$1/$2/$3")),f=new Date(g),f instanceof Date&&isFinite(f)?f.getTime():a}return a},type:"numeric"}),b.regex.timeTest=/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i,b.addParser({id:"time",is:function(a){return b.regex.timeTest.test(a)},format:function(a,c){var d=a?new Date("2000/01/01 "+a.replace(b.regex.dateReplace,"$1 $2")):a;return d instanceof Date&&isFinite(d)?d.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"}),/* + ██████ ██████ █████▄ █████▄ ▄████▄ + ▄█▀ ██▄▄ ██▄▄██ ██▄▄██ ██▄▄██ + ▄█▀ ██▀▀ ██▀▀██ ██▀▀█ ██▀▀██ + ██████ ██████ █████▀ ██ ██ ██ ██ + */ +// add default widgets +b.addWidget({id:"zebra",priority:90,format:function(b,c,d){var e,f,g,h,i,j,k,l=new RegExp(c.cssChildRow,"i"),m=c.$tbodies.add(a(c.namespace+"_extra_table").children("tbody:not(."+c.cssInfoBlock+")"));for(i=0;ij;j++)f=e.eq(j),l.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 table ID/index on page > data +// *** set value *** +// 365 days +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]:""}}(jQuery,window,document),function(a){"use strict";var b=a.tablesorter||{};b.themes={bootstrap:{table:"table table-bordered table-striped",caption:"caption", +// header class names +header:"bootstrap-header",// give the header a gradient background (theme.bootstrap_2.css) +sortNone:"",sortAsc:"",sortDesc:"",active:"",// applied when column is sorted +hover:"",// custom css required - a defined bootstrap style may not override other classes +// icon class names +icons:"",// add 'icon-white' to make them white; this icon class is added to the in the header +iconSortNone:"bootstrap-icon-unsorted",// class name added to icon when column is not sorted +iconSortAsc:"icon-chevron-up glyphicon glyphicon-chevron-up",// class name added to icon when column has ascending sort +iconSortDesc:"icon-chevron-down glyphicon glyphicon-chevron-down",// class name added to icon when column has descending sort +filterRow:"",// filter row class +footerRow:"",footerCells:"",even:"",// even row zebra striping +odd:""},jui:{table:"ui-widget ui-widget-content ui-corner-all",// table classes +caption:"ui-widget-content", +// header class names +header:"ui-widget-header ui-corner-all ui-state-default",// header classes +sortNone:"",sortAsc:"",sortDesc:"",active:"ui-state-active",// applied when column is sorted +hover:"ui-state-hover",// hover class +// icon class names +icons:"ui-icon",// icon class added to the in the header +iconSortNone:"ui-icon-carat-2-n-s",// class name added to icon when column is not sorted +iconSortAsc:"ui-icon-carat-1-n",// class name added to icon when column has ascending sort +iconSortDesc:"ui-icon-carat-1-s",// class name added to icon when column has descending sort +filterRow:"",footerRow:"",footerCells:"",even:"ui-widget-content",// even row zebra striping +odd:"ui-state-default"}},a.extend(b.css,{wrapper:"tablesorter-wrapper"}),b.addWidget({id:"uitheme",priority:10,format:function(c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r=b.themes,s=d.$table.add(a(d.namespace+"_extra_table")),t=d.$headers.add(a(d.namespace+"_extra_headers")),u=d.theme||"jui",v=r[u]||{},w=a.trim([v.sortNone,v.sortDesc,v.sortAsc,v.active].join(" ")),x=a.trim([v.iconSortNone,v.iconSortDesc,v.iconSortAsc].join(" "));for(d.debug&&(i=new Date), +// initialization code - run once +s.hasClass("tablesorter-"+u)&&d.theme===d.appliedTheme&&e.uitheme_applied||(e.uitheme_applied=!0,n=r[d.appliedTheme]||{},q=!a.isEmptyObject(n),o=q?[n.sortNone,n.sortDesc,n.sortAsc,n.active].join(" "):"",p=q?[n.iconSortNone,n.iconSortDesc,n.iconSortAsc].join(" "):"",q&&(e.zebra[0]=a.trim(" "+e.zebra[0].replace(" "+n.even,"")),e.zebra[1]=a.trim(" "+e.zebra[1].replace(" "+n.odd,"")),d.$tbodies.children().removeClass([n.even,n.odd].join(" "))),v.even&&(e.zebra[0]+=" "+v.even),v.odd&&(e.zebra[1]+=" "+v.odd),s.children("caption").removeClass(n.caption||"").addClass(v.caption),l=s.removeClass((d.appliedTheme?"tablesorter-"+(d.appliedTheme||""):"")+" "+(n.table||"")).addClass("tablesorter-"+u+" "+(v.table||"")).children("tfoot"),d.appliedTheme=d.theme,l.length&&l.children("tr").removeClass(n.footerRow||"").addClass(v.footerRow).children("th, td").removeClass(n.footerCells||"").addClass(v.footerCells),t.removeClass((q?[n.header,n.hover,o].join(" "):"")||"").addClass(v.header).not(".sorter-false").unbind("mouseenter.tsuitheme mouseleave.tsuitheme").bind("mouseenter.tsuitheme mouseleave.tsuitheme",function(b){a(this)["mouseenter"===b.type?"addClass":"removeClass"](v.hover||"")}),t.each(function(){var c=a(this);c.find("."+b.css.wrapper).length||c.wrapInner('
    ')}),d.cssIcon&&t.find("."+b.css.icon).removeClass(q?[n.icons,p].join(" "):"").addClass(v.icons||""),s.hasClass("hasFilters")&&s.children("thead").children("."+b.css.filterRow).removeClass(q?n.filterRow||"":"").addClass(v.filterRow||"")),f=0;f1)))for(m=1;q>m;m++)k.eq(p[m][0]).addClass(r[m]||r[s])}),b.processTbody(c,f,!1);if(i=e.columns_thead!==!1?["thead tr"]:[],e.columns_tfoot!==!1&&i.push("tfoot tr"),i.length&&(h=n.find(i.join(",")).children().removeClass(l),q))for(m=0;q>m;m++) +// add primary. secondary, tertiary, etc sort column classes +h.filter('[data-column="'+p[m][0]+'"]').addClass(r[m]||r[s])},remove:function(c,d,e){var f,g,h=d.$tbodies,i=(e.columns||["primary","secondary","tertiary"]).join(" ");for(d.$headers.removeClass(i),d.$table.children("tfoot").children("tr").children("th, td").removeClass(i),f=0;f=]/g,// replace operators +query:"(q|query)",// replace filter queries +wild01:/\?/g,// wild card match 0 or 1 +wild0More:/\*/g,// wild care match 0 or more +quote:/\"/g,isNeg1:/(>=?\s*-\d)/,isNeg2:/(<=?\s*\d)/}, +// function( c, data ) { } +// c = table.config +// data.$row = jQuery object of the row currently being processed +// data.$cells = jQuery object of all cells within the current row +// data.filters = array of filters for all columns ( some may be undefined ) +// data.filter = filter for the current column +// data.iFilter = same as data.filter, except lowercase ( if wo.filter_ignoreCase is true ) +// data.exact = table cell text ( or parsed data if column parser enabled; may be a number & not a string ) +// data.iExact = same as data.exact, except lowercase ( if wo.filter_ignoreCase is true; may be a number & not a string ) +// data.cache = table cell text from cache, so it has been parsed ( & in all lower case if c.ignoreCase is true ) +// data.cacheArray = An array of parsed content from each table cell in the row being processed +// data.index = column index; table = table element ( DOM ) +// data.parsed = array ( by column ) of boolean values ( from filter_useParsedData or 'filter-parsed' class ) +types:{or:function(c,d,e){if(b.regex.orTest.test(d.iFilter)||b.regex.orSplit.test(d.filter)){var f,g,h,i, +// duplicate data but split filter +j=a.extend({},d),k=d.index,l=d.parsed[k],m=d.filter.split(b.regex.orSplit),n=d.iFilter.split(b.regex.orSplit),o=m.length;for(f=0;o>f;f++){j.nestedFilters=!0,j.filter=""+(b.parseFilter(c,m[f],k,l)||""),j.iFilter=""+(b.parseFilter(c,n[f],k,l)||""),h="("+(b.parseFilter(c,j.filter,k,l)||"")+")";try{if(i=new RegExp(d.isMatch?h:"^"+h+"$",c.widgetOptions.filter_ignoreCase?"i":""),g=i.test(j.exact)||b.processTypes(c,j,e))return g}catch(p){return null}} +// may be null from processing types +return g||!1}return null}, +// Look for an AND or && operator ( logical and ) +and:function(c,d,e){if(b.regex.andTest.test(d.filter)){var f,g,h,i,j, +// duplicate data but split filter +k=a.extend({},d),l=d.index,m=d.parsed[l],n=d.filter.split(b.regex.andSplit),o=d.iFilter.split(b.regex.andSplit),p=n.length;for(f=0;p>f;f++){k.nestedFilters=!0,k.filter=""+(b.parseFilter(c,n[f],l,m)||""),k.iFilter=""+(b.parseFilter(c,o[f],l,m)||""),i=("("+(b.parseFilter(c,k.filter,l,m)||"")+")").replace(b.regex.wild01,"\\S{1}").replace(b.regex.wild0More,"\\S*");try{ +// use try/catch just in case RegExp is invalid +j=new RegExp(d.isMatch?i:"^"+i+"$",c.widgetOptions.filter_ignoreCase?"i":""), +// look for an exact match with the 'and' unless the 'filter-match' class is found +h=j.test(k.exact)||b.processTypes(c,k,e),g=0===f?h:g&&h}catch(q){return null}} +// may be null from processing types +return g||!1}return null}, +// Look for regex +regex:function(a,c){if(b.regex.regex.test(c.filter)){var d, +// cache regex per column for optimal speed +e=c.filter_regexCache[c.index]||b.regex.regex.exec(c.filter),f=e instanceof RegExp;try{f||( +// force case insensitive search if ignoreCase option set? +// if ( c.ignoreCase && !regex[2] ) { regex[2] = 'i'; } +c.filter_regexCache[c.index]=e=new RegExp(e[1],e[2])),d=e.test(c.exact)}catch(g){d=!1}return d}return null}, +// Look for operators >, >=, < or <= +operators:function(d,e){ +// ignore empty strings... because '' < 10 is true +if(b.regex.operTest.test(e.iFilter)&&""!==e.iExact){var f,g,h,i=d.table,j=e.index,k=e.parsed[j],l=c.formatFloat(e.iFilter.replace(b.regex.operators,""),i),m=d.parsers[j],n=l; +// parse filter value in case we're comparing numbers ( dates ) +// iExact may be numeric - see issue #149; +// check if cached is defined, because sometimes j goes out of range? ( numeric columns ) +// keep showing all rows if nothing follows the operator +return(k||"numeric"===m.type)&&(h=a.trim(""+e.iFilter.replace(b.regex.operators,"")),g=b.parseFilter(d,h,j,!0),l="number"!=typeof g||""===g||isNaN(g)?l:g),!k&&"numeric"!==m.type||isNaN(l)||"undefined"==typeof e.cache?(h=isNaN(e.iExact)?e.iExact.replace(c.regex.nondigit,""):e.iExact,f=c.formatFloat(h,i)):f=e.cache,b.regex.gtTest.test(e.iFilter)?g=b.regex.gteTest.test(e.iFilter)?f>=l:f>l:b.regex.ltTest.test(e.iFilter)&&(g=b.regex.lteTest.test(e.iFilter)?l>=f:l>f),g||""!==n||(g=!0),g}return null}, +// Look for a not match +notMatch:function(c,d){if(b.regex.notTest.test(d.iFilter)){var e,f=d.iFilter.replace("!",""),g=b.parseFilter(c,f,d.index,d.parsed[d.index])||""; +// look for exact not matches - see #628 +return b.regex.exact.test(g)?(g=g.replace(b.regex.exact,""),""===g?!0:a.trim(g)!==d.iExact):(e=d.iExact.search(a.trim(g)),""===g?!0:!(c.widgetOptions.filter_startsWith?0===e:e>=0))}return null}, +// Look for quotes or equals to get an exact match; ignore type since iExact could be numeric +exact:function(c,d){/*jshint eqeqeq:false */ +if(b.regex.exact.test(d.iFilter)){var e=d.iFilter.replace(b.regex.exact,""),f=b.parseFilter(c,e,d.index,d.parsed[d.index])||"";return d.anyMatch?a.inArray(f,d.rowArray)>=0:f==d.iExact}return null}, +// Look for a range ( using ' to ' or ' - ' ) - see issue #166; thanks matzhu! +range:function(a,d){if(b.regex.toTest.test(d.iFilter)){var e,f,g,h,i=a.table,j=d.index,k=d.parsed[j], +// make sure the dash is for a range and not indicating a negative number +l=d.iFilter.split(b.regex.toSplit); +// parse filter value in case we're comparing numbers ( dates ) +return f=l[0].replace(c.regex.nondigit,"")||"",g=c.formatFloat(b.parseFilter(a,f,j,k),i),f=l[1].replace(c.regex.nondigit,"")||"",h=c.formatFloat(b.parseFilter(a,f,j,k),i),(k||"numeric"===a.parsers[j].type)&&(e=a.parsers[j].format(""+l[0],i,a.$headers.eq(j),j),g=""===e||isNaN(e)?g:e,e=a.parsers[j].format(""+l[1],i,a.$headers.eq(j),j),h=""===e||isNaN(e)?h:e),!k&&"numeric"!==a.parsers[j].type||isNaN(g)||isNaN(h)?(f=isNaN(d.iExact)?d.iExact.replace(c.regex.nondigit,""):d.iExact,e=c.formatFloat(f,i)):e=d.cache,g>h&&(f=g,g=h,h=f),e>=g&&h>=e||""===g||""===h}return null}, +// Look for wild card: ? = single, * = multiple, or | = logical OR +wild:function(a,c){if(b.regex.wildOrTest.test(c.iFilter)){var d=c.index,e=c.parsed[d],f=""+(b.parseFilter(a,c.iFilter,d,e)||""); +// look for an exact match with the 'or' unless the 'filter-match' class is found +!b.regex.wildTest.test(f)&&c.nestedFilters&&(f=c.isMatch?f:"^("+f+")$"); +// parsing the filter may not work properly when using wildcards =/ +try{return new RegExp(f.replace(b.regex.wild01,"\\S{1}").replace(b.regex.wild0More,"\\S*"),a.widgetOptions.filter_ignoreCase?"i":"").test(c.exact)}catch(g){return null}}return null}, +// fuzzy text search; modified from https://github.com/mattyork/fuzzy ( MIT license ) +fuzzy:function(a,c){if(b.regex.fuzzyTest.test(c.iFilter)){var d,e=0,f=c.iExact.length,g=c.iFilter.slice(1),h=b.parseFilter(a,g,c.index,c.parsed[c.index])||"";for(d=0;f>d;d++)c.iExact[d]===h[e]&&(e+=1);return e===h.length?!0:!1}return null}},init:function(e,f,g){ +// filter language options +c.language=a.extend(!0,{},{to:"to",or:"or",and:"and"},c.language);var h,i,j,k,l,m,n,o,p,q=b.regex;if(f.$table.addClass("hasFilters"), +// define timers so using clearTimeout won't cause an undefined error +g.filter_searchTimer=null,g.filter_initTimer=null,g.filter_formatterCount=0,g.filter_formatterInit=[],g.filter_anyColumnSelector='[data-column="all"],[data-column="any"]',g.filter_multipleColumnSelector='[data-column*="-"],[data-column*=","]',n="\\{"+b.regex.query+"\\}",a.extend(q,{child:new RegExp(f.cssChildRow),filtered:new RegExp(g.filter_filteredRow),alreadyFiltered:new RegExp("(\\s+("+c.language.or+"|-|"+c.language.to+")\\s+)","i"),toTest:new RegExp("\\s+(-|"+c.language.to+")\\s+","i"),toSplit:new RegExp("(?:\\s+(?:-|"+c.language.to+")\\s+)","gi"),andTest:new RegExp("\\s+("+c.language.and+"|&&)\\s+","i"),andSplit:new RegExp("(?:\\s+(?:"+c.language.and+"|&&)\\s+)","gi"),orTest:/\|/,orSplit:new RegExp("(?:\\s+(?:"+c.language.or+")\\s+|\\|)","gi"),iQuery:new RegExp(n,"i"),igQuery:new RegExp(n,"ig"),operTest:/^[<>]=?/,gtTest:/>/,gteTest:/>=/,ltTest:/'+(k.data("placeholder")||k.attr("data-placeholder")||g.filter_placeholder.select||"")+"":"",n=i,j=i,i.indexOf(g.filter_selectSourceSeparator)>=0&&(n=i.split(g.filter_selectSourceSeparator),j=n[1],n=n[0]),h+="");f.$table.find("thead").find("select."+d.filter+'[data-column="'+l+'"]').append(h),j=g.filter_selectSource,o="function"==typeof j?!0:c.getColumnData(e,j,l),o&& +// updating so the extra options are appended +b.buildSelect(f.table,l,"",!0,k.hasClass(g.filter_onlyAvail))} +// not really updating, but if the column has both the 'filter-select' class & +// filter_functions set to true, it would append the same options twice. +b.buildDefault(e,!0),b.bindSearch(e,f.$table.find("."+d.filter),!0),g.filter_external&&b.bindSearch(e,g.filter_external),g.filter_hideFilters&&b.hideFilters(f), +// show processing icon +f.showProcessing&&(j="filterStart filterEnd ".split(" ").join(f.namespace+"filter "),f.$table.unbind(j.replace(c.regex.spaces," ")).bind(j,function(b,g){k=g?f.$table.find("."+d.header).filter("[data-column]").filter(function(){return""!==g[a(this).data("column")]}):"",c.isProcessing(e,"filterStart"===b.type,g?k:"")})), +// set filtered rows count ( intially unfiltered ) +f.filteredRows=f.totalRows,j="tablesorter-initialized pagerBeforeInitialized ".split(" ").join(f.namespace+"filter "),f.$table.unbind(j.replace(c.regex.spaces," ")).bind(j,function(){var a=this.config.widgetOptions;m=b.setDefaults(e,f,a)||[],m.length&&(f.delayInit&&""===m.join("")||c.setFilters(e,m,!0)),f.$table.trigger("filterFomatterUpdate"),setTimeout(function(){a.filter_initialized||b.filterInitComplete(f)},100)}),f.pager&&f.pager.initialized&&!g.filter_initialized&&(f.$table.trigger("filterFomatterUpdate"),setTimeout(function(){b.filterInitComplete(f)},100))}, +// $cell parameter, but not the config, is passed to the filter_formatters, +// so we have to work with it instead +formatterUpdated:function(a,b){ +// prevent error if $cell is undefined - see #1056 +var c=a&&a.closest("table")[0].config.widgetOptions;c&&!c.filter_initialized&&( +// add updates by column since this function +// may be called numerous times before initialization +c.filter_formatterInit[b]=1)},filterInitComplete:function(c){var d,e,f=c.widgetOptions,g=0,h=function(){f.filter_initialized=!0,c.$table.trigger("filterInit",c),b.findRows(c.table,c.$table.data("lastSearch")||[])};if(a.isEmptyObject(f.filter_formatter))h();else{for(e=f.filter_formatterInit.length,d=0;e>d;d++)1===f.filter_formatterInit[d]&&g++;clearTimeout(f.filter_initTimer),f.filter_initialized||g!==f.filter_formatterCount?f.filter_initialized||( +// fall back in case a filter_formatter doesn't call +// $.tablesorter.filter.formatterUpdated( $cell, column ), and the count is off +f.filter_initTimer=setTimeout(function(){h()},500)): +// filter widget initialized +h()}}, +// encode or decode filters for storage; see #1026 +processFilters:function(a,b){var c,d=b?encodeURIComponent:decodeURIComponent,e=a.length;for(c=0;e>c;c++)a[c]=d(a[c]);return a},setDefaults:function(d,e,f){var g,h,i,j,k, +// get current ( default ) filters +l=c.getFilters(d)||[]; +// if no filters saved, then check default settings +if(f.filter_saveFilters&&c.storage&&(h=c.storage(d,"tablesorter-filters")||[],g=a.isArray(h),g&&""===h.join("")||!g||(l=b.processFilters(h))),""===l.join(""))for(k=e.$headers.add(f.filter_$externalFilters).filter("["+f.filter_defaultAttrib+"]"),i=0;i<=e.columns;i++)j=i===e.columns?"all":i,l[i]=k.filter('[data-column="'+j+'"]').attr(f.filter_defaultAttrib)||l[i]||"";return e.$table.data("lastSearch",l),l},parseFilter:function(a,b,c,d){return d?a.parsers[c].format(b,a.table,[],c):b},buildRow:function(b,e,f){var g,h,i,j,k,l,m,n,o, +// c.columns defined in computeThIndexes() +p=f.filter_cellFilter,q=e.columns,r=a.isArray(p),s='';for(i=0;q>i;i++)e.$headerIndexed[i].length&&(s+='1&&(s+=' colspan="'+o+'"'),s+=r?p[i]?' class="'+p[i]+'"':"":""!==p?' class="'+p+'"':"",s+=">"); +// build each filter input +for(e.$filters=a(s+="").appendTo(e.$table.children("thead").eq(0)).children("td"),i=0;q>i;i++)l=!1,j=e.$headerIndexed[i],j&&j.length&&(g=e.$filters.filter('[data-column="'+i+'"]'),n=c.getColumnData(b,f.filter_functions,i),k=f.filter_functions&&n&&"function"!=typeof n||j.hasClass("filter-select"),h=c.getColumnData(b,e.headers,i),l="false"===c.getData(j[0],h,"filter")||"false"===c.getData(j[0],h,"parser"),k?s=a("').appendTo(g),s&&(o=j.data("placeholder")||j.attr("data-placeholder")||f.filter_placeholder.search||"",s.attr("placeholder",o))),s&&(m=(a.isArray(f.filter_cssFilter)?"undefined"!=typeof f.filter_cssFilter[i]?f.filter_cssFilter[i]||"":"":f.filter_cssFilter)||"",s.addClass(d.filter+" "+m).attr("data-column",i),l&&(s.attr("placeholder","").addClass(d.filterDisabled)[0].disabled=!0)))},bindSearch:function(d,e,f){// allow passing a selector string +if(d=a(d)[0],e=a(e),e.length){var g,h=d.config,i=h.widgetOptions,j=h.namespace+"filter",k=i.filter_$externalFilters;f!==!0&&(g=i.filter_anyColumnSelector+","+i.filter_multipleColumnSelector,i.filter_$anyMatch=e.filter(g),k&&k.length?i.filter_$externalFilters=i.filter_$externalFilters.add(e):i.filter_$externalFilters=e,c.setFilters(d,h.$table.data("lastSearch")||[],f===!1)), +// unbind events +g="keypress keyup search change ".split(" ").join(j+" "),e.attr("data-lastSearchTime",(new Date).getTime()).unbind(g.replace(c.regex.spaces," ")).bind("keyup"+j,function(c){ +// emulate what webkit does.... escape clears the filter +if(a(this).attr("data-lastSearchTime",(new Date).getTime()),27===c.which)this.value="";else{if(i.filter_liveSearch===!1)return;if(""!==this.value&&("number"==typeof i.filter_liveSearch&&this.value.length=37&&c.which<=40)))return} +// change event = no delay; last true flag tells getFilters to skip newest timed input +b.searching(d,!0,!0)}).bind("search change keypress ".split(" ").join(j+" "),function(c){ +// don't get cached data, in case data-column changes dynamically +var e=parseInt(a(this).attr("data-column"),10); +// don't allow 'change' event to process if the input value is the same - fixes #685 +i.filter_initialized&&(13===c.which||"search"===c.type||"change"===c.type&&this.value!==h.lastSearch[e])&&(c.preventDefault(), +// init search with no delay +a(this).attr("data-lastSearchTime",(new Date).getTime()),b.searching(d,!1,!0))})}},searching:function(a,c,d){var e=a.config.widgetOptions;clearTimeout(e.filter_searchTimer),"undefined"==typeof c||c===!0? +// delay filtering +e.filter_searchTimer=setTimeout(function(){b.checkFilters(a,c,d)},e.filter_liveSearch?e.filter_searchDelay:10): +// skip delay +b.checkFilters(a,c,d)},checkFilters:function(e,f,g){var h=e.config,i=h.widgetOptions,j=a.isArray(f),k=j?f:c.getFilters(e,!0),l=(k||[]).join("");// combined filter values +// prevent errors if delay init is set +// combined filter values +// prevent errors if delay init is set +// update cache if delayInit set & pager has initialized ( after user initiates a search ) +// add filter array back into inputs +// show/hide filter row as needed +// return if the last search is the same; but filter === false when updating the search +// see example-widget-filter.html filter toggle buttons +// force filter refresh +// give it time for the processing icon to kick in +return a.isEmptyObject(h.cache)?void(h.delayInit&&h.pager&&h.pager.initialized&&c.updateCache(h,function(){b.checkFilters(e,!1,g)})):(j&&(c.setFilters(e,k,!1,g!==!0),i.filter_initialized||(h.lastCombinedFilter="")),i.filter_hideFilters&&h.$table.find("."+d.filterRow).trigger(""===l?"mouseleave":"mouseenter"),h.lastCombinedFilter!==l||f===!1?(f===!1&&(h.lastCombinedFilter=null,h.lastSearch=[]),i.filter_initialized&&h.$table.trigger("filterStart",[k]),h.showProcessing?void setTimeout(function(){return b.findRows(e,k,l),!1},30):(b.findRows(e,k,l),!1)):void 0)},hideFilters:function(b,e){var f,g=(e||b.$table).find("."+d.filterRow).addClass(d.filterRowHide);g.bind("mouseenter mouseleave",function(c){ +// save event object - http://bugs.jquery.com/ticket/12140 +var e=c,g=a(this);clearTimeout(f),f=setTimeout(function(){/enter|over/.test(e.type)?g.removeClass(d.filterRowHide): +// don't hide if input has focus +// $( ':focus' ) needs jQuery 1.6+ +a(document.activeElement).closest("tr")[0]!==g[0]&&""===b.lastCombinedFilter&&g.addClass(d.filterRowHide)},200)}).find("input, select").bind("focus blur",function(e){var g=e,h=a(this).closest("tr");clearTimeout(f),f=setTimeout(function(){clearTimeout(f), +// don't hide row if any filter has a value +""===c.getFilters(b.$table).join("")&&h.toggleClass(d.filterRowHide,"focus"!==g.type)},200)})},defaultFilter:function(c,d){if(""===c)return c;var e=b.regex.iQuery,f=d.match(b.regex.igQuery).length,g=f>1?a.trim(c).split(/\s/):[a.trim(c)],h=g.length-1,i=0,j=d; +// replace all {query} with query words... +// if query = 'Bob', then convert mask from '!{query}' to '!Bob' +// if query = 'Bob Joe Frank', then convert mask '{q} OR {q}' to 'Bob OR Joe OR Frank' +for(1>h&&f>1&&( +// only one 'word' in query but mask has >1 slots +g[1]=g[0]);e.test(j);)j=j.replace(e,g[i++]||""),e.test(j)&&h>i&&""!==(g[i]||"")&&(j=d.replace(e,j));return j},getLatestSearch:function(b){return b?b.sort(function(b,c){return a(c).attr("data-lastSearchTime")-a(b).attr("data-lastSearchTime")}):b||a()},multipleColumns:function(c,d){ +// look for multiple columns '1-3,4-6,8' in data-column +var e,f,g,h,i,j,k,l,m,n=c.widgetOptions, +// only target 'all' column inputs on initialization +// & don't target 'all' column inputs if they don't exist +o=n.filter_initialized||!d.filter(n.filter_anyColumnSelector).length,p=[],q=a.trim(b.getLatestSearch(d).attr("data-column")||"");if(/^[0-9]+$/.test(q))return parseInt(q,10); +// process column range +if(o&&/-/.test(q))for(f=q.match(/(\d+)\s*-\s*(\d+)/g),m=f.length,l=0;m>l;l++){for(g=f[l].split(/\s*-\s*/),h=parseInt(g[0],10)||0,i=parseInt(g[1],10)||c.columns-1,h>i&&(e=h,h=i,i=e),i>=c.columns&&(i=c.columns-1);i>=h;h++)p.push(h); +// remove processed range from val +q=q.replace(f[l],"")} +// process single columns +if(o&&/,/.test(q))for(j=q.split(/\s*,\s*/),m=j.length,k=0;m>k;k++)""!==j[k]&&(l=parseInt(j[k],10),l1){if(e.anyMatch=!0,e.isMatch=!0,e.rowArray=e.$cells.map(function(b){return a.inArray(b,q)>-1?(e.parsed[b]?m=e.cacheArray[b]:(m=e.rawArray[b],m=a.trim(o.filter_ignoreCase?m.toLowerCase():m),d.sortLocaleCompare&&(m=c.replaceAccents(m))),m):void 0}).get(),e.filter=e.anyMatchFilter,e.iFilter=e.iAnyMatchFilter,e.exact=e.rowArray.join(" "),e.iExact=o.filter_ignoreCase?e.exact.toLowerCase():e.exact,e.cache=e.cacheArray.slice(0,-1).join(" "),f.excludeMatch=f.noAnyMatch,j=b.processTypes(d,e,f),null!==j)p=j;else if(o.filter_startsWith)for(p=!1, +// data.rowArray may not contain all columns +q=Math.min(d.columns,e.rowArray.length);!p&&q>0;)q--,p=p||0===e.rowArray[q].indexOf(e.iFilter);else p=(e.iExact+e.childRowText).indexOf(e.iFilter)>=0; +// no other filters to process +if(e.anyMatch=!1,e.filters.join("")===e.filter)return p}for(q=0;q=0:e.filter===e.exact:"function"==typeof k?j=k(e.exact,e.cache,e.filter,q,e.$row,d,e):"function"==typeof k[l||e.filter]&&(m=l||e.filter,j=k[m](e.exact,e.cache,e.filter,q,e.$row,d,e))),null===j?(j=b.processTypes(d,e,f),null!==j?h=j:(m=(e.iExact+e.childRowText).indexOf(b.parseFilter(d,e.iFilter,q,e.parsed[q])),h=!o.filter_startsWith&&m>=0||o.filter_startsWith&&0===m)):h=j,p=h?p:!1);return p},findRows:function(d,e,f){if(d.config.lastCombinedFilter!==f&&d.config.widgetOptions.filter_initialized){var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E=a.extend([],e),F=b.regex,G=d.config,H=G.widgetOptions, +// data object passed to filters; anyMatch is a flag for the filters +I={anyMatch:!1,filters:e, +// regex filter type cache +filter_regexCache:[]},J={ +// anyMatch really screws up with these types of filters +noAnyMatch:["range","notMatch","operators"], +// cache filter variables that use ts.getColumnData in the main loop +functions:[],excludeFilter:[],defaultColFilter:[],defaultAnyFilter:c.getColumnData(d,H.filter_defaultFilter,G.columns,!0)||""};for( +// parse columns after formatter, in case the class is added at that point +I.parsed=G.$headers.map(function(b){ +// force parsing if parser type is numeric +// getData won't return 'parsed' if other 'filter-' class names exist +// ( e.g. ) +return G.parsers&&G.parsers[b]&&G.parsers[b].parsed||c.getData&&"parsed"===c.getData(G.$headerIndexed[b],c.getColumnData(d,G.headers,b),"filter")||a(this).hasClass("filter-parsed")}).get(),o=0;o1&&(C=parseInt(B[0],10)-1,C>=0&&Cw;w++)v=e[w]||"",y||(w=o),y=y&&r.length&&0===v.indexOf(r[w]||"")&&!F.alreadyFiltered.test(v)&&!F.exactTest.test(v)&&!(F.isNeg1.test(v)||F.isNeg2.test(v))&&!(""!==v&&G.$filters&&G.$filters.filter('[data-column="'+w+'"]').find("select").length&&!G.$headerIndexed[w].hasClass("filter-match")); +// loop through the rows +for(x=j.not("."+H.filter_filteredRow).length,y&&0===x&&(y=!1),G.debug&&console.log("Filter: Searching through "+(y&&g>x?x:"all")+" rows"),I.anyMatchFlag&&(G.sortLocaleCompare&&(I.anyMatchFilter=c.replaceAccents(I.anyMatchFilter)),H.filter_defaultFilter&&F.iQuery.test(J.defaultAnyFilter)&&(I.anyMatchFilter=b.defaultFilter(I.anyMatchFilter,J.defaultAnyFilter),y=!1),I.iAnyMatchFilter=H.filter_ignoreCase&&G.ignoreCase?I.anyMatchFilter.toLowerCase():I.anyMatchFilter),l=0;g>l;l++) +// skip child rows & already filtered rows +if(D=j[l].className,p=l&&F.child.test(D),!(p||y&&F.filtered.test(D))){if(I.$row=j.eq(l),I.cacheArray=h[l],i=I.cacheArray[G.columns],I.rawArray=i.raw,I.childRowText="",!H.filter_childByColumn){ +// so, if 'table.config.widgetOptions.filter_childRows' is true and there is +// a match anywhere in the child row, then it will make the row visible +// checked here so the option can be changed dynamically +for(D="",q=i.child,w=0;w")>=0) +// selectSource is a jQuery object or string of options +return l;a.isArray(l)?i=l:"object"===a.type(j)&&l&&( +// custom select source function for a SPECIFIC COLUMN +i=l(d,e,f))} +// fall back to original method +return i===!1&&(i=b.getOptions(d,e,f)),b.processOptions(d,e,i)},processOptions:function(b,d,e){if(!a.isArray(e))return!1;b=a(b)[0];var f,g,h,i,j=b.config,k="undefined"!=typeof d&&null!==d&&d>=0&&dh;h++)g=e[h],l.push({t:g,p:k&&j.parsers&&j.parsers.length&&j.parsers[d].format(g,b,[],d)||g});for(f=j.textSorter||"",l.sort(function(a,e){var g=a.p.toString(),h=e.p.toString();return k&&"function"==typeof f?f(g,h,!0,d,b):k&&"object"==typeof f&&f.hasOwnProperty(d)?f[d](g,h,!0,d,b):c.sortNatural?c.sortNatural(g,h):!0}),e=[],i=l.length,h=0;i>h;h++)e.push(l[h].t);return e},getOptions:function(b,d,e){b=a(b)[0];var f,g,h,i,j,k,l,m,n=b.config,o=n.widgetOptions,p=[];for(g=0;gf;f++) +// check if has class filtered +if(i=j.row?j.row[f]:j.normalized[f][n.columns].$row[0],!e||!i.className.match(o.filter_filteredRow)) +// get non-normalized cell content +if(o.filter_useParsedData||n.parsers[d].parsed||n.$headerIndexed[d].hasClass("filter-parsed")){ +// child row parsed data +if(p.push(""+j.normalized[f][d]),o.filter_childRows&&o.filter_childByColumn)for(m=j.normalized[f][n.columns].$row.length-1,k=0;m>k;k++)p.push(""+j.normalized[f][n.columns].child[k][d])}else +// child row unparsed data +if( +// get raw cached data instead of content directly from the cells +p.push(j.normalized[f][n.columns].raw[d]),o.filter_childRows&&o.filter_childByColumn)for(m=j.normalized[f][n.columns].$row.length,k=1;m>k;k++)l=j.normalized[f][n.columns].$row.eq(k).children().eq(d),p.push(""+c.getElementText(n,l,d));return p},buildSelect:function(c,e,f,g,h){if(c=a(c)[0],e=parseInt(e,10),c.config.cache&&!a.isEmptyObject(c.config.cache)){var i,j,k,l,m,n,o=c.config,p=o.widgetOptions,q=o.$headerIndexed[e], +// t.data( 'placeholder' ) won't work in jQuery older than 1.4.3 +r='", +// Get curent filter value +s=o.$table.find("thead").find("select."+d.filter+'[data-column="'+e+'"]').val();if( +// nothing included in arry ( external source ), so get the options from +// filter_selectSource or column data +("undefined"==typeof f||""===f)&&(f=b.getOptionSource(c,e,h)),a.isArray(f)){ +// build option list +for(i=0;i=0&&(l=k.split(p.filter_selectSourceSeparator),j=l[0],k=l[1]),r+=""!==f[i]?"":""; +// clear arry so it doesn't get appended twice +f=[]} +// update all selects in the same column ( clone thead in sticky headers & +// any external selects ) - fixes 473 +m=(o.$filters?o.$filters:o.$table.children("thead")).find("."+d.filter),p.filter_$externalFilters&&(m=m&&m.length?m.add(p.filter_$externalFilters):p.filter_$externalFilters),n=m.filter('select[data-column="'+e+'"]'), +// make sure there is a select there! +n.length&&(n[g?"html":"append"](r),a.isArray(f)|| +// append options if arry is provided externally as a string or jQuery object +// options ( default value ) was already added +n.append(f).val(s),n.val(s))}},buildDefault:function(a,d){var e,f,g,h=a.config,i=h.widgetOptions,j=h.columns; +// build default select dropdown +for(e=0;j>e;e++)f=h.$headerIndexed[e],g=!(f.hasClass("filter-false")||f.hasClass("parser-false")),(f.hasClass("filter-select")||c.getColumnData(a,i.filter_functions,e)===!0)&&g&&b.buildSelect(a,e,"",d,f.hasClass(i.filter_onlyAvail))}},c.getFilters=function(c,e,f,g){var h,i,j,k,l=!1,m=c?a(c)[0].config:"",n=m?m.widgetOptions:"";if(e!==!0&&n&&!n.filter_columnFilters||a.isArray(f)&&f.join("")===m.lastCombinedFilter)return a(c).data("lastSearch");if(m&&(m.$filters&&(i=m.$filters.find("."+d.filter)),n.filter_$externalFilters&&(i=i&&i.length?i.add(n.filter_$externalFilters):n.filter_$externalFilters),i&&i.length))for(l=f||[],h=0;h1&&(j=j.slice(1)),h===m.columns&&(k=j.filter(n.filter_anyColumnSelector),j=k.length?k:j),j.val(f[h]).trigger("change"+m.namespace)):(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},c.setFilters=function(d,e,f,g){var h=d?a(d)[0].config:"",i=c.getFilters(d,!0,e,g);return h&&f&&(h.lastCombinedFilter=null,h.lastSearch=[],b.searching(h.table,e,g),h.$table.trigger("filterFomatterUpdate")),!!i}}(jQuery),function(a,b){"use strict";var c=a.tablesorter||{};a.extend(c.css,{sticky:"tablesorter-stickyHeader",// stickyHeader +stickyVis:"tablesorter-sticky-visible",stickyHide:"tablesorter-sticky-hidden",stickyWrap:"tablesorter-sticky-wrapper"}), +// Add a resize event to table headers +c.addHeaderResizeEvent=function(b,c,d){// make sure we're using a dom element +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!==e[1])&&(d.data("savedSizes",[f,i]),c.push(d[0]));c.length&&a!==!1&&g.$table.trigger("resize",[c]),h.resize_flag=!1};return i(!1),clearInterval(h.resize_timer),c?(h.resize_flag=!1,!1):void(h.resize_timer=setInterval(function(){h.resize_flag||i()},f.timer))}}, +// Sticky headers based on this awesome article: +// http://css-tricks.com/13465-persistent-headers/ +// and https://github.com/jmosbech/StickyTableHeaders by Jonas Mosbech +// ************************** +c.addWidget({id:"stickyHeaders",priority:60,// sticky widget must be initialized after the filter widget! +options:{stickyHeaders:"",// extra class name added to the sticky header row +stickyHeaders_attachTo:null,// jQuery selector or object to attach sticky header to +stickyHeaders_xScroll:null,// jQuery selector or object to monitor horizontal scroll position (defaults: xScroll > attachTo > window) +stickyHeaders_yScroll:null,// jQuery selector or object to monitor vertical scroll position (defaults: yScroll > attachTo > window) +stickyHeaders_offset:0,// number or jquery selector targeting the position:fixed element +stickyHeaders_filteredToTop:!0,// scroll table top into view after filtering +stickyHeaders_cloneId:"-sticky",// added to table ID, if it exists +stickyHeaders_addResizeEvent:!0,// trigger 'resize' event on headers +stickyHeaders_includeCaption:!0,// if false and a caption exist, it won't be included in the sticky header +stickyHeaders_zIndex:2},format:function(d,e,f){ +// filter widget doesn't initialize on an empty table. Fixes #449 +if(!(e.$table.hasClass("hasStickyHeaders")||a.inArray("filter",e.widgets)>=0&&!e.$table.hasClass("hasFilters"))){var g,h,i,j,k=e.$table, +// add position: relative to attach element, hopefully it won't cause trouble. +l=a(f.stickyHeaders_attachTo),m=e.namespace+"stickyheaders ", +// element to watch for the scroll event +n=a(f.stickyHeaders_yScroll||f.stickyHeaders_attachTo||b),o=a(f.stickyHeaders_xScroll||f.stickyHeaders_attachTo||b),p=k.children("thead:first"),q=p.children("tr").not(".sticky-false").children(),r=k.children("tfoot"),s=isNaN(f.stickyHeaders_offset)?a(f.stickyHeaders_offset):"",t=s.length?s.height()||0:parseInt(f.stickyHeaders_offset,10)||0, +// is this table nested? If so, find parent sticky header wrapper (div, not table) +u=k.parent().closest("."+c.css.table).hasClass("hasStickyHeaders")?k.parent().closest("table.tablesorter")[0].config.widgetOptions.$sticky.parent():[],v=u.length?u.height():0, +// clone table, then wrap to make sticky header +w=f.$sticky=k.clone().addClass("containsStickyHeaders "+c.css.sticky+" "+f.stickyHeaders+" "+e.namespace.slice(1)+"_extra_table").wrap('
    '),x=w.parent().addClass(c.css.stickyHide).css({position:l.length?"absolute":"fixed",padding:parseInt(w.parent().parent().css("padding-left"),10),top:t+v,left:0,visibility:"hidden",zIndex:f.stickyHeaders_zIndex||2}),y=w.children("thead:first"),z="",A=0,B=function(a,c){var d,e,f,g,h,i=a.filter(":visible"),j=i.length;for(d=0;j>d;d++)g=c.filter(":visible").eq(d),h=i.eq(d),"border-box"===h.css("box-sizing")?e=h.outerWidth():"collapse"===g.css("border-collapse")?b.getComputedStyle?e=parseFloat(b.getComputedStyle(h[0],null).width):(f=parseFloat(h.css("border-width")),e=h.outerWidth()-parseFloat(h.css("padding-left"))-parseFloat(h.css("padding-right"))-f):e=h.width(),g.css({width:e,"min-width":e,"max-width":e})},C=function(){t=s.length?s.height()||0:parseInt(f.stickyHeaders_offset,10)||0,A=0,x.css({left:l.length?parseInt(l.css("padding-left"),10)||0:k.offset().left-parseInt(k.css("margin-left"),10)-o.scrollLeft()-A,width:k.outerWidth()}),B(k,w),B(q,j)},D=function(b){if(k.is(":visible")){// fixes #278 +// Detect nested tables - fixes #724 +v=u.length?u.offset().top-n.scrollTop()+u.height():0;var d=k.offset(),e=a.isWindow(n[0]),// $.isWindow needs jQuery 1.4.3 +f=a.isWindow(o[0]), +// scrollTop = ( $attach.length ? $attach.offset().top : $yScroll.scrollTop() ) + stickyOffset + nestedStickyTop, +g=(l.length?e?n.scrollTop():n.offset().top:n.scrollTop())+t+v,h=k.height()-(x.height()+(r.height()||0)),i=g>d.top&&gg;g++) +// send second parameter +e.onRenderHeader.apply(i.eq(g),[g,e,w]); +// make it sticky! +o.add(n).unbind("scroll resize ".split(" ").join(m).replace(/\s+/g," ")).bind("scroll resize ".split(" ").join(m),function(a){D("resize"===a.type)}),e.$table.unbind("stickyHeadersUpdate"+m).bind("stickyHeadersUpdate"+m,function(){D(!0)}),f.stickyHeaders_addResizeEvent&&c.addHeaderResizeEvent(d), +// look for filter widget +k.hasClass("hasFilters")&&f.filter_columnFilters&&( +// scroll table into view after filtering, if sticky header is active - #482 +k.bind("filterEnd"+m,function(){ +// $(':focus') needs jQuery 1.6+ +var d=a(document.activeElement).closest("td"),g=d.parent().children().index(d); +// only scroll if sticky header is active +x.hasClass(c.css.stickyVis)&&f.stickyHeaders_filteredToTop&&( +// scroll to original table (not sticky clone) +b.scrollTo(0,k.position().top), +// give same input/select focus; check if c.$filters exists; fixes #594 +g>=0&&e.$filters&&e.$filters.eq(g).find("a, select, input").filter(":visible").focus())}),c.filter.bindSearch(k,j.find("."+c.css.filter)), +// support hideFilters +f.filter_hideFilters&&c.filter.hideFilters(e,w)),k.trigger("stickyHeadersInit")}},remove:function(d,e,f){var g=e.namespace+"stickyheaders ";e.$table.removeClass("hasStickyHeaders").unbind("pagerComplete filterEnd stickyHeadersUpdate ".split(" ").join(g).replace(/\s+/g," ")).next("."+c.css.stickyWrap).remove(),f.$sticky&&f.$sticky.length&&f.$sticky.remove(),// remove cloned table +a(b).add(f.stickyHeaders_xScroll).add(f.stickyHeaders_yScroll).add(f.stickyHeaders_attachTo).unbind("scroll resize ".split(" ").join(g).replace(/\s+/g," ")),c.addHeaderResizeEvent(d,!1)}})}(jQuery,window),function(a,b){"use strict";var c=a.tablesorter||{};a.extend(c.css,{resizableContainer:"tablesorter-resizable-container",resizableHandle:"tablesorter-resizable-handle",resizableNoSelect:"tablesorter-disableSelection",resizableStorage:"tablesorter-resizable"}), +// Add extra scroller css +a(function(){var b="";a(b).appendTo("body")}),c.resizable={init:function(b,d){if(!b.$table.hasClass("hasResizable")){b.$table.addClass("hasResizable");var e,f,g,h,i,j=b.$table,k=j.parent(),l=parseInt(j.css("margin-top"),10), +// internal variables +m=d.resizable_vars={useStorage:c.storage&&d.resizable!==!1,$wrap:k,mouseXPosition:0,$target:null,$next:null,overflow:"auto"===k.css("overflow")||"scroll"===k.css("overflow")||"auto"===k.css("overflow-x")||"scroll"===k.css("overflow-x"),storedSizes:[]}; +// add container +for( +// set default widths +c.resizableReset(b.table,!0), +// now get measurements! +m.tableWidth=j.width(), +// attempt to autodetect +m.fullWidth=Math.abs(k.width()-m.tableWidth)<20,/* + // Hacky method to determine if table width is set to 'auto' + // http://stackoverflow.com/a/20892048/145346 + if ( !vars.fullWidth ) { + tmp = $table.width(); + $header = $table.wrap('').parent(); // temp variable + storedSizes = parseInt( $table.css( 'margin-left' ), 10 ) || 0; + $table.css( 'margin-left', storedSizes + 50 ); + vars.tableWidth = $header.width() > tmp ? 'auto' : tmp; + $table.css( 'margin-left', storedSizes ? storedSizes : '' ); + $header = null; + $table.unwrap(''); + } + */ +m.useStorage&&m.overflow&&( +// save table width +c.storage(b.table,"tablesorter-table-original-css-width",m.tableWidth),i=c.storage(b.table,"tablesorter-table-resized-width")||"auto",c.resizable.setWidth(j,i,!0)),d.resizable_vars.storedSizes=h=(m.useStorage?c.storage(b.table,c.css.resizableStorage):[])||[],c.resizable.setWidths(b,d,h),c.resizable.updateStoredSizes(b,d),d.$resizable_container=a('
    ').css({top:l}).insertBefore(j),g=0;g').appendTo(d.$resizable_container).attr({"data-column":g,unselectable:"on"}).data("header",f).bind("selectstart",!1);j.one("tablesorter-initialized",function(){c.resizable.setHandlePosition(b,d),c.resizable.bindings(this.config,this.config.widgetOptions)})}},updateStoredSizes:function(a,b){var c,d,e=a.columns,f=b.resizable_vars;for(f.storedSizes=[],c=0;e>c;c++)d=a.$headerIndexed[c],f.storedSizes[c]=d.is(":visible")?d.width():0},setWidth:function(a,b,c){ +// overflow tables need min & max width set as well +a.css({width:b,"min-width":c?b:"","max-width":c?b:""})},setWidths:function(b,d,e){var f,g,h=d.resizable_vars,i=a(b.namespace+"_extra_headers"),j=b.$table.children("colgroup").children("col"); +// process only if table ID or url match +if(e=e||h.storedSizes||[],e.length){for(f=0;ff||f===h&&d.resizable_addLastColumn)&&c.css({display:"inline-block",height:g,left:j.position().left-e+j.outerWidth()-i}):c.hide())})}, +// prevent text selection while dragging resize bar +toggleTextSelection:function(b,d){var e=b.namespace+"tsresize";b.widgetOptions.resizable_vars.disabled=d,a("body").toggleClass(c.css.resizableNoSelect,d),d?a("body").attr("unselectable","on").bind("selectstart"+e,!1):a("body").removeAttr("unselectable").unbind("selectstart"+e)},bindings:function(d,e){var f=d.namespace+"tsresize";e.$resizable_container.children().bind("mousedown",function(b){ +// save header cell and mouse position +var f,g=e.resizable_vars,h=a(d.namespace+"_extra_headers"),i=a(b.target).data("header");f=parseInt(i.attr("data-column"),10),g.$target=i=i.add(h.filter('[data-column="'+f+'"]')),g.target=f,g.$next=b.shiftKey||e.resizable_targetLast?i.parent().children().not(".resizable-false").filter(":last"):i.nextAll(":not(.resizable-false)").eq(0),f=parseInt(g.$next.attr("data-column"),10),g.$next=g.$next.add(h.filter('[data-column="'+f+'"]')),g.next=f,g.mouseXPosition=b.pageX,c.resizable.updateStoredSizes(d,e),c.resizable.toggleTextSelection(d,!0)}),a(document).bind("mousemove"+f,function(a){var b=e.resizable_vars; +// ignore mousemove if no mousedown +b.disabled&&0!==b.mouseXPosition&&b.$target&&(e.resizable_throttle?(clearTimeout(b.timer),b.timer=setTimeout(function(){c.resizable.mouseMove(d,e,a)},isNaN(e.resizable_throttle)?5:e.resizable_throttle)):c.resizable.mouseMove(d,e,a))}).bind("mouseup"+f,function(){e.resizable_vars.disabled&&(c.resizable.toggleTextSelection(d,!1),c.resizable.stopResize(d,e),c.resizable.setHandlePosition(d,e))}), +// resizeEnd event triggered by scroller widget +a(b).bind("resize"+f+" resizeEnd"+f,function(){c.resizable.setHandlePosition(d,e)}), +// right click to reset columns to default widths +d.$table.bind("columnUpdate"+f,function(){c.resizable.setHandlePosition(d,e)}).find("thead:first").add(a(d.namespace+"_extra_table").find("thead:first")).bind("contextmenu"+f,function(){ +// $.isEmptyObject() needs jQuery 1.4+; allow right click if already reset +var a=0===e.resizable_vars.storedSizes.length;return c.resizableReset(d.table),c.resizable.setHandlePosition(d,e),e.resizable_vars.storedSizes=[],a})},mouseMove:function(b,d,e){if(0!==d.resizable_vars.mouseXPosition&&d.resizable_vars.$target){ +// resize columns +var f,g=0,h=d.resizable_vars,i=h.$next,j=h.storedSizes[h.target],k=e.pageX-h.mouseXPosition;if(h.overflow){if(j+k>0){ +// update the entire table width +for(h.storedSizes[h.target]+=k,c.resizable.setWidth(h.$target,h.storedSizes[h.target],!0),f=0;f0?d.sortList=k:c.hasInitialized&&k&&k.length>0&&b.sortOn(d,k))},remove:function(a,c){c.$table.removeClass("hasSaveSort"), +// clear storage +b.storage&&b.storage(a,"tablesorter-savesort","")}})}(jQuery),a.tablesorter}); \ No newline at end of file diff --git a/dist/js/jquery.tablesorter.js b/dist/js/jquery.tablesorter.js index 04a8d2e6..d498dd81 100644 --- a/dist/js/jquery.tablesorter.js +++ b/dist/js/jquery.tablesorter.js @@ -282,8 +282,10 @@ // fixate columns if the users supplies the fixedWidth option // do this after theme has been applied ts.fixColumnWidth( table ); + // add widgets from class name + ts.addWidgetFromClass( table ); // add widget options before parsing (e.g. grouping widget has parser settings) - ts.applyWidgetOptions( table, c ); + ts.applyWidgetOptions( table ); // try to auto detect column type, and store in tables config ts.setupParsers( c ); // start total row count at zero @@ -587,6 +589,10 @@ // cache headers per column c.$headerIndexed = []; for ( indx = 0; indx < c.columns; indx++ ) { + // colspan in header making a column undefined + if ( ts.isEmptyObject( c.sortVars[ indx ] ) ) { + c.sortVars[ indx ] = {}; + } $temp = c.$headers.filter( '[data-column="' + indx + '"]' ); // target sortable column cells, unless there are none, then use non-sortable cells // .last() added in jQuery 1.4; use .filter(':last') to maintain compatibility with jQuery v1.2.6 @@ -671,7 +677,7 @@ extractor = false; } if ( !parser ) { - parser = ts.detectParserForColumn( c, rows, -1, indx ); + parser = ts.detectParserForColumn( c, rows, -1, colIndex ); } if ( c.debug ) { debug[ '(' + colIndex + ') ' + header.text() ] = { @@ -900,13 +906,11 @@ max = c.columns; for ( colIndex = 0; colIndex < max; ++colIndex ) { cell = $row[ 0 ].cells[ colIndex ]; - if ( cell ) { - if ( typeof parsers[ cacheIndex ] === 'undefined' ) { - if ( c.debug ) { - console.warn( 'No parser found for cell:', cell, 'does it have a header?' ); - } - continue; + if ( typeof parsers[ cacheIndex ] === 'undefined' ) { + if ( c.debug ) { + console.warn( 'No parser found for column ' + colIndex + '; cell:', cell, 'does it have a header?' ); } + } else if ( cell ) { val = ts.getElementText( c, cell, cacheIndex ); rowData.raw[ cacheIndex ] = val; // save original row text txt = ts.getParsedText( c, cell, cacheIndex, val ); @@ -1189,7 +1193,6 @@ c.$table.find( c.selectorRemove ).remove(); // get position from the dom var tmp, indx, row, icell, cache, len, - table = c.table, $tbodies = c.$tbodies, $cell = $( cell ), // update cache - format: function( s, table, cell, cellIndex ) @@ -1792,8 +1795,9 @@ } }, - applyWidgetOptions : function( table, c ) { + applyWidgetOptions : function( table ) { var indx, widget, + c = table.config, len = c.widgets.length; if ( len ) { for ( indx = 0; indx < len; indx++ ) { @@ -1805,28 +1809,34 @@ } }, - applyWidget : function( table, init, callback ) { - table = $( table )[ 0 ]; // in case this is called externally - var indx, len, names, widget, name, applied, time, time2, widgetClass, + addWidgetFromClass : function( table ) { + var len, indx, c = table.config, - tableClass = ' ' + c.table.className + ' ', - widgets = []; - // prevent numerous consecutive widget applications - if ( init !== false && table.hasInitialized && ( table.isApplyingWidgets || table.isUpdating ) ) { - return; - } - if ( c.debug ) { time = new Date(); } - // look for widgets to apply from table class - // stop using \b otherwise this matches 'ui-widget-content' & adds 'content' widget - widgetClass = new RegExp( '\\s' + c.widgetClass.replace( ts.regex.templateName, '([\\w-]+)' ) + '\\s', 'g' ); - // extract out the widget id from the table class (widget id's can include dashes) - widget = tableClass.match( widgetClass ); + // look for widgets to apply from table class + // stop using \b otherwise this matches 'ui-widget-content' & adds 'content' widget + regex = '\\s' + c.widgetClass.replace( ts.regex.templateName, '([\\w-]+)' ) + '\\s', + widgetClass = new RegExp( regex, 'g' ), + // extract out the widget id from the table class (widget id's can include dashes) + widget = ( ' ' + c.table.className + ' ' ).match( widgetClass ); if ( widget ) { len = widget.length; for ( indx = 0; indx < len; indx++ ) { c.widgets.push( widget[ indx ].replace( widgetClass, '$1' ) ); } } + }, + + applyWidget : function( table, init, callback ) { + table = $( table )[ 0 ]; // in case this is called externally + var indx, len, names, widget, name, applied, time, time2, + c = table.config, + widgets = []; + // prevent numerous consecutive widget applications + if ( init !== false && table.hasInitialized && ( table.isApplyingWidgets || table.isUpdating ) ) { + return; + } + if ( c.debug ) { time = new Date(); } + ts.addWidgetFromClass( table ); if ( c.widgets.length ) { table.isApplyingWidgets = true; // ensure unique widget ids @@ -1865,7 +1875,7 @@ c.widgetInit[ name ] = true; if ( table.hasInitialized ) { // don't reapply widget options on tablesorter init - ts.applyWidgetOptions( table, table.config ); + ts.applyWidgetOptions( table ); } if ( typeof widget.init === 'function' ) { applied = true; diff --git a/dist/js/jquery.tablesorter.min.js b/dist/js/jquery.tablesorter.min.js index 72bc3a29..72010ee8 100644 --- a/dist/js/jquery.tablesorter.min.js +++ b/dist/js/jquery.tablesorter.min.js @@ -1,2 +1,526 @@ -!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";var b=a.tablesorter={version:"2.23.5",parsers:[],widgets:[],defaults:{theme:"default",widthFixed:!1,showProcessing:!1,headerTemplate:"{content}",onRenderTemplate:null,onRenderHeader:null,cancelSelection:!0,tabIndex:!0,dateFormat:"mmddyyyy",sortMultiSortKey:"shiftKey",sortResetKey:"ctrlKey",usNumberFormat:!0,delayInit:!1,serverSideSorting:!1,resort:!0,headers:{},ignoreCase:!0,sortForce:null,sortList:[],sortAppend:null,sortStable:!1,sortInitialOrder:"asc",sortLocaleCompare:!1,sortReset:!1,sortRestart:!1,emptyTo:"bottom",stringTo:"max",textExtraction:"basic",textAttribute:"data-text",textSorter:null,numberSorter:null,widgets:[],widgetOptions:{zebra:["even","odd"]},initWidgets:!0,widgetClass:"widget-{name}",initialized:null,tableClass:"",cssAsc:"",cssDesc:"",cssNone:"",cssHeader:"",cssHeaderRow:"",cssProcessing:"",cssChildRow:"tablesorter-childRow",cssInfoBlock:"tablesorter-infoOnly",cssNoSort:"tablesorter-noSort",cssIgnoreRow:"tablesorter-ignoreRow",cssIcon:"tablesorter-icon",cssIconNone:"",cssIconAsc:"",cssIconDesc:"",pointerClick:"click",pointerDown:"mousedown",pointerUp:"mouseup",selectorHeaders:"> thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]},css:{table:"tablesorter",cssHasChild:"tablesorter-hasChildRow",childRow:"tablesorter-childRow",colgroup:"tablesorter-colgroup",header:"tablesorter-header",headerRow:"tablesorter-headerRow",headerIn:"tablesorter-header-inner",icon:"tablesorter-icon",processing:"tablesorter-processing",sortAsc:"tablesorter-headerAsc",sortDesc:"tablesorter-headerDesc",sortNone:"tablesorter-headerUnSorted"},language:{sortAsc:"Ascending sort applied, ",sortDesc:"Descending sort applied, ",sortNone:"No sort applied, ",nextAsc:"activate to apply an ascending sort",nextDesc:"activate to apply a descending sort",nextNone:"activate to remove the sort"},regex:{templateContent:/\{content\}/g,templateIcon:/\{icon\}/g,templateName:/\{name\}/i,spaces:/\s+/g,nonWord:/\W/g,formElements:/(input|select|button|textarea)/i,chunk:/(^([+\-]?(?:\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,chunks:/(^\\0|\\0$)/,hex:/^0x[0-9a-f]+$/i,comma:/,/g,digitNonUS:/[\s|\.]/g,digitNegativeTest:/^\s*\([.\d]+\)/,digitNegativeReplace:/^\s*\(([.\d]+)\)/,digitTest:/^[\-+(]?\d+[)]?$/,digitReplace:/[,.'"\s]/g},string:{max:1,min:-1,emptymin:1,emptymax:-1,zero:0,none:0,"null":0,top:!0,bottom:!1},instanceMethods:{},setup:function(c,d){if(!c||!c.tHead||0===c.tBodies.length||c.hasInitialized===!0)return void(d.debug&&(c.hasInitialized?console.warn("Stopping initialization. Tablesorter has already been initialized"):console.error("Stopping initialization! No table, thead or tbody")));var e="",f=a(c),g=a.metadata;c.hasInitialized=!1,c.isProcessing=!0,c.config=d,a.data(c,"tablesorter",d),d.debug&&(console[console.group?"group":"log"]("Initializing tablesorter"),a.data(c,"startoveralltimer",new Date)),d.supportsDataObject=function(a){return a[0]=parseInt(a[0],10),a[0]>1||1===a[0]&&parseInt(a[1],10)>=4}(a.fn.jquery.split(".")),d.emptyTo=d.emptyTo.toLowerCase(),d.stringTo=d.stringTo.toLowerCase(),d.last={sortList:[],clickedIndex:-1},/tablesorter\-/.test(f.attr("class"))||(e=""!==d.theme?" tablesorter-"+d.theme:""),d.table=c,d.$table=f.addClass(b.css.table+" "+d.tableClass+e).attr("role","grid"),d.$headers=f.find(d.selectorHeaders),d.namespace?d.namespace="."+d.namespace.replace(b.regex.nonWord,""):d.namespace=".tablesorter"+Math.random().toString(16).slice(2),d.$table.children().children("tr").attr("role","row"),d.$tbodies=f.children("tbody:not(."+d.cssInfoBlock+")").attr({"aria-live":"polite","aria-relevant":"all"}),d.$table.children("caption").length&&(e=d.$table.children("caption")[0],e.id||(e.id=d.namespace.slice(1)+"caption"),d.$table.attr("aria-labelledby",e.id)),d.widgetInit={},d.textExtraction=d.$table.attr("data-text-extraction")||d.textExtraction||"basic",b.buildHeaders(d),b.fixColumnWidth(c),b.applyWidgetOptions(c,d),b.setupParsers(d),d.totalRows=0,d.delayInit||b.buildCache(d),b.bindEvents(c,d.$headers,!0),b.bindMethods(d),d.supportsDataObject&&"undefined"!=typeof f.data().sortlist?d.sortList=f.data().sortlist:g&&f.metadata()&&f.metadata().sortlist&&(d.sortList=f.metadata().sortlist),b.applyWidget(c,!0),d.sortList.length>0?b.sortOn(d,d.sortList,{},!d.initWidgets):(b.setHeadersCss(d),d.initWidgets&&b.applyWidget(c,!1)),d.showProcessing&&f.unbind("sortBegin"+d.namespace+" sortEnd"+d.namespace).bind("sortBegin"+d.namespace+" sortEnd"+d.namespace,function(a){clearTimeout(d.processTimer),b.isProcessing(c),"sortBegin"===a.type&&(d.processTimer=setTimeout(function(){b.isProcessing(c,!0)},500))}),c.hasInitialized=!0,c.isProcessing=!1,d.debug&&(console.log("Overall initialization time: "+b.benchmark(a.data(c,"startoveralltimer"))),d.debug&&console.groupEnd&&console.groupEnd()),f.trigger("tablesorter-initialized",c),"function"==typeof d.initialized&&d.initialized(c)},bindMethods:function(c){var d=c.$table,e=c.namespace,f="sortReset update updateRows updateAll updateHeaders addRows updateCell updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave ".split(" ").join(e+" ");d.unbind(f.replace(b.regex.spaces," ")).bind("sortReset"+e,function(a,c){a.stopPropagation(),b.sortReset(this.config,c)}).bind("updateAll"+e,function(a,c,d){a.stopPropagation(),b.updateAll(this.config,c,d)}).bind("update"+e+" updateRows"+e,function(a,c,d){a.stopPropagation(),b.update(this.config,c,d)}).bind("updateHeaders"+e,function(a,c){a.stopPropagation(),b.updateHeaders(this.config,c)}).bind("updateCell"+e,function(a,c,d,e){a.stopPropagation(),b.updateCell(this.config,c,d,e)}).bind("addRows"+e,function(a,c,d,e){a.stopPropagation(),b.addRows(this.config,c,d,e)}).bind("updateComplete"+e,function(){this.isUpdating=!1}).bind("sorton"+e,function(a,c,d,e){a.stopPropagation(),b.sortOn(this.config,c,d,e)}).bind("appendCache"+e,function(c,d,e){c.stopPropagation(),b.appendCache(this.config,e),a.isFunction(d)&&d(this)}).bind("updateCache"+e,function(a,c,d){a.stopPropagation(),b.updateCache(this.config,c,d)}).bind("applyWidgetId"+e,function(a,c){a.stopPropagation(),b.getWidgetById(c).format(this,this.config,this.config.widgetOptions)}).bind("applyWidgets"+e,function(a,c){a.stopPropagation(),b.applyWidget(this,c)}).bind("refreshWidgets"+e,function(a,c,d){a.stopPropagation(),b.refreshWidgets(this,c,d)}).bind("destroy"+e,function(a,c,d){a.stopPropagation(),b.destroy(this,c,d)}).bind("resetToLoadState"+e,function(d){d.stopPropagation(),b.removeWidget(this,!0,!1),c=a.extend(!0,b.defaults,c.originalSettings),this.hasInitialized=!1,b.setup(this,c)})},bindEvents:function(c,d,e){c=a(c)[0];var f,g=c.config,h=g.namespace,i=null;e!==!0&&(d.addClass(h.slice(1)+"_extra_headers"),f=a.fn.closest?d.closest("table")[0]:d.parents("table")[0],f&&"TABLE"===f.nodeName&&f!==c&&a(f).addClass(h.slice(1)+"_extra_table")),f=(g.pointerDown+" "+g.pointerUp+" "+g.pointerClick+" sort keyup ").replace(b.regex.spaces," ").split(" ").join(h+" "),d.find(g.selectorSort).add(d.filter(g.selectorSort)).unbind(f).bind(f,function(c,e){var f,h,j,k=a(c.target),l=" "+c.type+" ";if(!(1!==(c.which||c.button)&&!l.match(" "+g.pointerClick+" | sort | keyup ")||" keyup "===l&&13!==c.which||l.match(" "+g.pointerClick+" ")&&"undefined"!=typeof c.which||l.match(" "+g.pointerUp+" ")&&i!==c.target&&e!==!0)){if(l.match(" "+g.pointerDown+" "))return i=c.target,j=k.jquery.split("."),void("1"===j[0]&&j[1]<4&&c.preventDefault());if(i=null,b.regex.formElements.test(c.target.nodeName)||k.hasClass(g.cssNoSort)||k.parents("."+g.cssNoSort).length>0||k.parents("button").length>0)return!g.cancelSelection;g.delayInit&&b.isEmptyObject(g.cache)&&b.buildCache(g),f=a.fn.closest?a(this).closest("th, td"):/TH|TD/.test(this.nodeName)?a(this):a(this).parents("th, td"),j=d.index(f),g.last.clickedIndex=0>j?f.attr("data-column"):j,h=g.$headers[g.last.clickedIndex],h&&!h.sortDisabled&&b.initSort(g,h,c)}}),g.cancelSelection&&d.attr("unselectable","on").bind("selectstart",!1).css({"user-select":"none",MozUserSelect:"none"})},buildHeaders:function(c){var d,e,f,g;for(c.headerList=[],c.headerContent=[],c.sortVars=[],c.debug&&(f=new Date),c.columns=b.computeColumnIndex(c.$table.children("thead, tfoot").children("tr")),e=c.cssIcon?'':"",c.$headers=a(a.map(c.$table.find(c.selectorHeaders),function(d,f){var g,h,i,j,k,l=a(d);if(!l.parent().hasClass(c.cssIgnoreRow))return g=b.getColumnData(c.table,c.headers,f,!0),c.headerContent[f]=l.html(),""===c.headerTemplate||l.find("."+b.css.headerIn).length||(j=c.headerTemplate.replace(b.regex.templateContent,l.html()).replace(b.regex.templateIcon,l.find("."+b.css.icon).length?"":e),c.onRenderTemplate&&(h=c.onRenderTemplate.apply(l,[f,j]),h&&"string"==typeof h&&(j=h)),l.html('
    '+j+"
    ")),c.onRenderHeader&&c.onRenderHeader.apply(l,[f,c,c.$table]),i=parseInt(l.attr("data-column"),10),d.column=i,k=b.getData(l,g,"sortInitialOrder")||c.sortInitialOrder,c.sortVars[i]={count:-1,order:b.formatSortingOrder(k)?[1,0,2]:[0,1,2],lockedOrder:!1},k=b.getData(l,g,"lockedOrder")||!1,"undefined"!=typeof k&&k!==!1&&(c.sortVars[i].lockedOrder=!0,c.sortVars[i].order=b.formatSortingOrder(k)?[1,1,1]:[0,0,0]),c.headerList[f]=d,l.addClass(b.css.header+" "+c.cssHeader).parent().addClass(b.css.headerRow+" "+c.cssHeaderRow).attr("role","row"),c.tabIndex&&l.attr("tabindex",0),d})),c.$headerIndexed=[],g=0;gs;){if(d=p[s].rows,d.length)for(h=0,g=a.columns,i=0;g>i;i++)j=a.$headerIndexed[h],j&&j.length&&(k=b.getColumnData(r,a.headers,h),n=b.getParserById(b.getData(j,k,"extractor")),m=b.getParserById(b.getData(j,k,"sorter")),l="false"===b.getData(j,k,"parser"),a.empties[h]=(b.getData(j,k,"empty")||a.emptyTo||(a.emptyToBottom?"bottom":"top")).toLowerCase(),a.strings[h]=(b.getData(j,k,"string")||a.stringTo||"max").toLowerCase(),l&&(m=b.getParserById("no-parser")),n||(n=!1),m||(m=b.detectParserForColumn(a,d,-1,i)),a.debug&&(t["("+h+") "+j.text()]={parser:m.id,extractor:n?n.id:"none",string:a.strings[h],empty:a.empties[h]}),e.parsers[h]=m,e.extractors[h]=n,f=j[0].colSpan-1,f>0&&(h+=f,g+=f)),h++;s+=e.parsers.length?q:1}a.debug&&(b.isEmptyObject(t)?console.warn(" No parsers detected!"):console[console.table?"table":"log"](t),console.log("Completed detecting parsers"+b.benchmark(o)),console.groupEnd&&console.groupEnd()),a.parsers=e.parsers,a.extractors=e.extractors},addParser:function(a){var c,d=b.parsers.length,e=!0;for(c=0;d>c;c++)b.parsers[c].id.toLowerCase()===a.id.toLowerCase()&&(e=!1);e&&b.parsers.push(a)},getParserById:function(a){if("false"==a)return!1;var c,d=b.parsers.length;for(c=0;d>c;c++)if(b.parsers[c].id.toLowerCase()===a.toString().toLowerCase())return b.parsers[c];return!1},detectParserForColumn:function(c,d,e,f){for(var g,h,i=b.parsers.length,j=!1,k="",l=!0;""===k&&l;)e++,d[e]?(j=d[e].cells[f],k=b.getElementText(c,j,f),h=a(j),c.debug&&console.log("Checking if value was empty on row "+e+", column: "+f+': "'+k+'"')):l=!1;for(;--i>=0;)if(g=b.parsers[i],g&&"text"!==g.id&&g.is&&g.is(k,c.table,j,h))return g;return b.getParserById("text")},getElementText:function(c,d,e){if(!d)return"";var f,g=c.textExtraction||"",h=d.jquery?d:a(d);return"string"==typeof g?"basic"===g&&"undefined"!=typeof(f=h.attr(c.textAttribute))?a.trim(f):a.trim(d.textContent||h.text()):"function"==typeof g?a.trim(g(h[0],c.table,e)):"function"==typeof(f=b.getColumnData(c.table,g,e))?a.trim(f(h[0],c.table,e)):a.trim(h[0].textContent||h.text())},getParsedText:function(a,c,d,e){"undefined"==typeof e&&(e=b.getElementText(a,c,d));var f=""+e,g=a.parsers[d],h=a.extractors[d];return g&&(h&&"function"==typeof h.format&&(e=h.format(e,a.table,c,d)),f="no-parser"===g.id?"":g.format(""+e,a.table,c,d),a.ignoreCase&&"string"==typeof f&&(f=f.toLowerCase())),f},buildCache:function(c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z=c.table,A=c.parsers;if(c.$tbodies=c.$table.children("tbody:not(."+c.cssInfoBlock+")"),l="undefined"==typeof e?c.$tbodies:e,c.cache={},c.totalRows=0,!A)return c.debug?console.warn("Warning: *Empty table!* Not building a cache"):"";for(c.debug&&(q=new Date),c.showProcessing&&b.isProcessing(z,!0),k=0;ki;++i)if(s={child:[],raw:[]},m=a(l[k].rows[i]),n=[],m.hasClass(c.cssChildRow)&&0!==i)for(y=f.normalized.length-1,t=f.normalized[y][c.columns],t.$row=t.$row.add(m),m.prev().hasClass(c.cssChildRow)||m.prev().addClass(b.css.cssHasChild),o=m.children("th, td"),y=t.child.length,t.child[y]=[],w=0,x=c.columns,j=0;x>j;j++)p=o[j],p&&(t.child[y][j]=b.getParsedText(c,p,j),v=o[j].colSpan-1,v>0&&(w+=v,x+=v)),w++;else{for(s.$row=m,s.order=i,w=0,x=c.columns,j=0;x>j;++j){if(p=m[0].cells[j]){if("undefined"==typeof A[w]){c.debug&&console.warn("No parser found for cell:",p,"does it have a header?");continue}g=b.getElementText(c,p,w),s.raw[w]=g,h=b.getParsedText(c,p,w,g),n[w]=h,"numeric"===(A[w].type||"").toLowerCase()&&(u[w]=Math.max(Math.abs(h)||0,u[w]||0)),v=p.colSpan-1,v>0&&(w+=v,x+=v)}w++}n[c.columns]=s,f.normalized.push(n)}f.colMax=u,c.totalRows+=f.normalized.length}c.showProcessing&&b.isProcessing(z),c.debug&&console.log("Building cache for "+r+" rows"+b.benchmark(q)),a.isFunction(d)&&d(z)},getColumnText:function(c,d,e,f){c=a(c)[0];var g,h,i,j,k,l,m,n,o,p,q="function"==typeof e,r="all"===d,s={raw:[],parsed:[],$cell:[]},t=c.config;if(!b.isEmptyObject(t)){for(k=t.$tbodies.length,g=0;k>g;g++)for(i=t.cache[g].normalized,l=i.length,h=0;l>h;h++)j=i[h],(!f||j[t.columns].$row.is(f))&&(p=!0,n=r?j.slice(0,t.columns):j[d],j=j[t.columns],m=r?j.raw:j.raw[d],o=r?j.$row.children():j.$row.children().eq(d),q&&(p=e({tbodyIndex:g,rowIndex:h,parsed:n,raw:m,$row:j.$row,$cell:o})),p!==!1&&(s.parsed.push(n),s.raw.push(m),s.$cell.push(o)));return s}t.debug&&console.warn("No cache found - aborting getColumnText function!")},setHeadersCss:function(c){var d,e,f,g,h,i,j,k,l=c.sortList,m=l.length,n=b.css.sortNone+" "+c.cssNone,o=[b.css.sortAsc+" "+c.cssAsc,b.css.sortDesc+" "+c.cssDesc],p=[c.cssIconAsc,c.cssIconDesc,c.cssIconNone],q=["ascending","descending"],r=c.$table.find("tfoot tr").children().add(a(c.namespace+"_extra_headers")).removeClass(o.join(" "));for(c.$headers.removeClass(o.join(" ")).addClass(n).attr("aria-sort","none").find("."+b.css.icon).removeClass(p.join(" ")).addClass(p[2]),f=0;m>f;f++)if(2!==l[f][1]&&(d=c.$headers.filter(function(d,e){for(var f=!0,g=a(e),h=parseInt(g.attr("data-column"),10),i=h+e.colSpan;i>h;h++)f=f?b.isValueInArray(h,c.sortList)>-1:!1;return f}),d=d.not(".sorter-false").filter('[data-column="'+l[f][0]+'"]'+(1===m?":last":"")),d.length)){for(g=0;gf;f++)h=r.eq(f),h.length&&(e=r[f],g=parseInt(h.attr("data-column"),10),i=c.sortVars[g].order[(c.sortVars[g].count+1)%(c.sortReset?3:2)],k=h.hasClass(b.css.sortAsc)?"sortAsc":h.hasClass(b.css.sortDesc)?"sortDesc":"sortNone",j=a.trim(h.text())+": "+b.language[k]+b.language[0===i?"nextAsc":1===i?"nextDesc":"nextNone"],h.attr("aria-label",j))},updateHeader:function(a){var c,d,e,f,g=a.table,h=a.$headers.length;for(c=0;h>c;c++)e=a.$headers.eq(c),f=b.getColumnData(g,a.headers,c,!0),d="false"===b.getData(e,f,"sorter")||"false"===b.getData(e,f,"parser"),e[0].sortDisabled=d,e[d?"addClass":"removeClass"]("sorter-false").attr("aria-disabled",""+d),a.tabIndex&&(d?e.removeAttr("tabindex"):e.attr("tabindex","0")),g.id&&(d?e.removeAttr("aria-controls"):e.attr("aria-controls",g.id))},updateHeaderSortCount:function(b,c){var d,e,f,g,h,i,j,k,l=c||b.sortList,m=l.length;for(b.sortList=[],g=0;m>g;g++)if(j=l[g],d=parseInt(j[0],10),d=0?e:f[1]%(b.sortReset?3:2)}},updateAll:function(a,c,d){var e=a.table;e.isUpdating=!0,b.refreshWidgets(e,!0,!0),b.buildHeaders(a),b.bindEvents(e,a.$headers,!0),b.bindMethods(a),b.commonUpdate(a,c,d)},update:function(a,c,d){var e=a.table;e.isUpdating=!0,b.updateHeader(a),b.commonUpdate(a,c,d)},updateHeaders:function(a,c){a.table.isUpdating=!0,b.buildHeaders(a),b.bindEvents(a.table,a.$headers,!0),b.resortComplete(a,c)},updateCell:function(c,d,e,f){c.table.isUpdating=!0,c.$table.find(c.selectorRemove).remove();var g,h,i,j,k,l,m=(c.table,c.$tbodies),n=a(d),o=m.index(a.fn.closest?n.closest("tbody"):n.parents("tbody").filter(":first")),p=c.cache[o],q=a.fn.closest?n.closest("tr"):n.parents("tr").filter(":first");if(d=n[0],m.length&&o>=0){if(i=m.eq(o).find("tr").index(q),k=p.normalized[i],l=q[0].cells.length,l!==c.columns)for(j=0,g=!1,h=0;l>h;h++)g||q[0].cells[h]===d?g=!0:j+=q[0].cells[h].colSpan;else j=n.index();g=b.getElementText(c,d,j),k[c.columns].raw[j]=g,g=b.getParsedText(c,d,j,g),k[j]=g,k[c.columns].$row=q,"numeric"===(c.parsers[j].type||"").toLowerCase()&&(p.colMax[j]=Math.max(Math.abs(g)||0,p.colMax[j]||0)),g="undefined"!==e?e:c.resort,g!==!1?b.checkResort(c,g,f):b.resortComplete(c,f)}},addRows:function(c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s="string"==typeof d&&1===c.$tbodies.length&&/j;j++){for(n=0,m=d[j].cells.length,p=[],o={child:[],raw:[],$row:d.eq(j),order:c.cache[i].normalized.length},l=0;m>l;l++)q=d[j].cells[l],g=b.getElementText(c,q,n),o.raw[n]=g,h=b.getParsedText(c,q,n,g),p[n]=h,"numeric"===(c.parsers[n].type||"").toLowerCase()&&(c.cache[i].colMax[n]=Math.max(Math.abs(h)||0,c.cache[i].colMax[n]||0)),r=q.colSpan-1,r>0&&(n+=r),n++;p[c.columns]=o,c.cache[i].normalized.push(p)}b.checkResort(c,e,f)}},updateCache:function(a,c,d){a.parsers&&a.parsers.length||b.setupParsers(a,d),b.buildCache(a,c,d)},appendCache:function(a,c){var d,e,f,g,h,i,j,k=a.table,l=a.widgetOptions,m=a.$tbodies,n=[],o=a.cache;if(b.isEmptyObject(o))return a.appender?a.appender(k,n):k.isUpdating?a.$table.trigger("updateComplete",k):"";for(a.debug&&(j=new Date),i=0;ih;h++)n.push(d[h][a.columns].$row),a.appender&&(!a.pager||a.pager.removeRows&&l.pager_removeRows||a.pager.ajax)||g.append(d[h][a.columns].$row);b.processTbody(k,g,!1)}a.appender&&a.appender(k,n),a.debug&&console.log("Rebuilt table"+b.benchmark(j)),c||a.appender||b.applyWidget(k),k.isUpdating&&a.$table.trigger("updateComplete",k)},commonUpdate:function(a,c,d){a.$table.find(a.selectorRemove).remove(),b.setupParsers(a),b.buildCache(a),b.checkResort(a,c,d)},initSort:function(c,d,e){if(c.table.isUpdating)return setTimeout(function(){b.initSort(c,d,e)},50);var f,g,h,i,j,k,l,m=!e[c.sortMultiSortKey],n=c.table,o=c.$headers.length,p=parseInt(a(d).attr("data-column"),10),q=c.sortVars[p].order;if(c.$table.trigger("sortStart",n),c.sortVars[p].count=e[c.sortResetKey]?2:(c.sortVars[p].count+1)%(c.sortReset?3:2),c.sortRestart)for(k=d,h=0;o>h;h++)l=c.$headers.eq(h),l[0]===k||!m&&l.is("."+b.css.sortDesc+",."+b.css.sortAsc)||(c.sortVars[p].count=-1);if(m){if(c.sortList=[],c.last.sortList=[],null!==c.sortForce)for(f=c.sortForce,g=0;gi&&(c.sortList.push([p,i]),d.colSpan>1))for(g=1;g=0)for(g=0;gi&&(c.sortList.push([p,i]),d.colSpan>1))for(g=1;gc;c++)e=a.cache[c].colMax,f=a.cache[c].normalized,f.sort(function(c,d){var f,l,m,n,o,p,q;for(f=0;k>f;f++){if(m=j[f][0],n=j[f][1],h=0===n,a.sortStable&&c[m]===d[m]&&1===k)return c[a.columns].order-d[a.columns].order;if(l=/n/i.test(b.getSortType(a.parsers,m)),l&&a.strings[m]?(l="boolean"==typeof b.string[a.strings[m]]?(h?1:-1)*(b.string[a.strings[m]]?-1:1):a.strings[m]?b.string[a.strings[m]]||0:0,o=a.numberSorter?a.numberSorter(c[m],d[m],h,e[m],g):b["sortNumeric"+(h?"Asc":"Desc")](c[m],d[m],l,e[m],m,a)):(p=h?c:d,q=h?d:c,o="function"==typeof i?i(p[m],q[m],h,m,g):"object"==typeof i&&i.hasOwnProperty(m)?i[m](p[m],q[m],h,m,g):b["sortNatural"+(h?"Asc":"Desc")](c[m],d[m],m,a)),o)return o}return c[a.columns].order-d[a.columns].order});a.debug&&console.log("Applying sort "+j.toString()+b.benchmark(d))}},resortComplete:function(b,c){b.table.isUpdating&&b.$table.trigger("updateComplete",b.table),a.isFunction(c)&&c(b.table)},checkResort:function(c,d,e){var f=a.isArray(d)?d:c.sortList,g="undefined"==typeof d?c.resort:d;g===!1||c.serverSideSorting||c.table.isProcessing?(b.resortComplete(c,e),b.applyWidget(c.table,!1)):f.length?b.sortOn(c,f,function(){b.resortComplete(c,e)},!0):b.sortReset(c,function(){b.resortComplete(c,e),b.applyWidget(c.table,!1)})},sortOn:function(c,d,e,f){var g=c.table;c.$table.trigger("sortStart",g),b.updateHeaderSortCount(c,d),b.setHeadersCss(c),c.delayInit&&b.isEmptyObject(c.cache)&&b.buildCache(c),c.$table.trigger("sortBegin",g),b.multisort(c),b.appendCache(c,f),c.$table.trigger("sortEnd",g),b.applyWidget(g),a.isFunction(e)&&e(g)},sortReset:function(c,d){c.sortList=[],b.setHeadersCss(c),b.multisort(c),b.appendCache(c),a.isFunction(d)&&d(c.table)},getSortType:function(a,b){return a&&a[b]?a[b].type||"":""},formatSortingOrder:function(a){return/^d/i.test(a)||1===a},sortNatural:function(a,c){if(a===c)return 0;var d,e,f,g,h,i,j=b.regex;if(j.hex.test(c)){if(d=parseInt(a.match(j.hex),16),e=parseInt(c.match(j.hex),16),e>d)return-1;if(d>e)return 1}for(d=a.replace(j.chunk,"\\0$1\\0").replace(j.chunks,"").split("\\0"),e=c.replace(j.chunk,"\\0$1\\0").replace(j.chunks,"").split("\\0"),i=Math.max(d.length,e.length),h=0;i>h;h++){if(f=isNaN(d[h])?d[h]||0:parseFloat(d[h])||0,g=isNaN(e[h])?e[h]||0:parseFloat(e[h])||0,isNaN(f)!==isNaN(g))return isNaN(f)?1:-1;if(typeof f!=typeof g&&(f+="",g+=""),g>f)return-1;if(f>g)return 1}return 0},sortNaturalAsc:function(a,c,d,e){if(a===c)return 0;var f=b.string[e.empties[d]||e.emptyTo];return""===a&&0!==f?"boolean"==typeof f?f?-1:1:-f||-1:""===c&&0!==f?"boolean"==typeof f?f?1:-1:f||1:b.sortNatural(a,c)},sortNaturalDesc:function(a,c,d,e){if(a===c)return 0;var f=b.string[e.empties[d]||e.emptyTo];return""===a&&0!==f?"boolean"==typeof f?f?-1:1:f||1:""===c&&0!==f?"boolean"==typeof f?f?1:-1:-f||-1:b.sortNatural(c,a)},sortText:function(a,b){return a>b?1:b>a?-1:0},getTextValue:function(a,b,c){if(c){var d,e=a?a.length:0,f=c+b;for(d=0;e>d;d++)f+=a.charCodeAt(d);return b*f}return 0},sortNumericAsc:function(a,c,d,e,f,g){if(a===c)return 0;var h=b.string[g.empties[f]||g.emptyTo];return""===a&&0!==h?"boolean"==typeof h?h?-1:1:-h||-1:""===c&&0!==h?"boolean"==typeof h?h?1:-1:h||1:(isNaN(a)&&(a=b.getTextValue(a,d,e)),isNaN(c)&&(c=b.getTextValue(c,d,e)),a-c)},sortNumericDesc:function(a,c,d,e,f,g){if(a===c)return 0;var h=b.string[g.empties[f]||g.emptyTo];return""===a&&0!==h?"boolean"==typeof h?h?-1:1:h||1:""===c&&0!==h?"boolean"==typeof h?h?1:-1:-h||-1:(isNaN(a)&&(a=b.getTextValue(a,d,e)),isNaN(c)&&(c=b.getTextValue(c,d,e)),c-a)},sortNumeric:function(a,b){return a-b},addWidget:function(a){b.widgets.push(a)},hasWidget:function(b,c){return b=a(b),b.length&&b[0].config&&b[0].config.widgetInit[c]||!1},getWidgetById:function(a){var c,d,e=b.widgets.length;for(c=0;e>c;c++)if(d=b.widgets[c],d&&d.id&&d.id.toLowerCase()===a.toLowerCase())return d},applyWidgetOptions:function(c,d){var e,f,g=d.widgets.length;if(g)for(e=0;g>e;e++)f=b.getWidgetById(d.widgets[e]),f&&f.options&&(d.widgetOptions=a.extend(!0,{},f.options,d.widgetOptions))},applyWidget:function(c,d,e){c=a(c)[0];var f,g,h,i,j,k,l,m,n,o=c.config,p=" "+o.table.className+" ",q=[];if(d===!1||!c.hasInitialized||!c.isApplyingWidgets&&!c.isUpdating){if(o.debug&&(l=new Date),n=new RegExp("\\s"+o.widgetClass.replace(b.regex.templateName,"([\\w-]+)")+"\\s","g"),i=p.match(n))for(g=i.length,f=0;g>f;f++)o.widgets.push(i[f].replace(n,"$1"));if(o.widgets.length){for(c.isApplyingWidgets=!0,o.widgets=a.grep(o.widgets,function(b,c){return a.inArray(b,o.widgets)===c}),h=o.widgets||[],g=h.length,f=0;g>f;f++)i=b.getWidgetById(h[f]),i&&i.id&&(i.priority||(i.priority=10),q[f]=i);for(q.sort(function(a,b){return a.priorityf;f++)i=q[f],i&&(j=i.id,k=!1,o.debug&&(m=new Date),(d||!o.widgetInit[j])&&(o.widgetInit[j]=!0,c.hasInitialized&&b.applyWidgetOptions(c,c.config),"function"==typeof i.init&&(k=!0,o.debug&&console[console.group?"group":"log"]("Initializing "+j+" widget"),i.init(c,i,c.config,c.config.widgetOptions))),d||"function"!=typeof i.format||(k=!0,o.debug&&console[console.group?"group":"log"]("Updating "+j+" widget"),i.format(c,c.config,c.config.widgetOptions,!1)),o.debug&&k&&(console.log("Completed "+(d?"initializing ":"applying ")+j+" widget"+b.benchmark(m)),console.groupEnd&&console.groupEnd()));o.debug&&console.groupEnd&&console.groupEnd(),d||"function"!=typeof e||e(c)}setTimeout(function(){c.isApplyingWidgets=!1,a.data(c,"lastWidgetApplication",new Date),o.$table.trigger("tablesorter-ready")},0),o.debug&&(i=o.widgets.length,console.log("Completed "+(d===!0?"initializing ":"applying ")+i+" widget"+(1!==i?"s":"")+b.benchmark(l)))}},removeWidget:function(c,d,e){c=a(c)[0];var f,g,h,i,j=c.config;if(d===!0)for(d=[],i=b.widgets.length,h=0;i>h;h++)g=b.widgets[h],g&&g.id&&d.push(g.id);else d=(a.isArray(d)?d.join(","):d||"").toLowerCase().split(/[\s,]+/);for(i=d.length,f=0;i>f;f++)g=b.getWidgetById(d[f]),h=a.inArray(d[f],j.widgets),g&&g.remove&&(j.debug&&console.log((e?"Refreshing":"Removing")+' "'+d[f]+'" widget'),g.remove(c,j,j.widgetOptions,e),j.widgetInit[d[f]]=!1),h>=0&&e!==!0&&j.widgets.splice(h,1)},refreshWidgets:function(c,d,e){c=a(c)[0];var f,g,h=c.config,i=h.widgets,j=b.widgets,k=j.length,l=[],m=function(b){a(b).trigger("refreshComplete")};for(f=0;k>f;f++)g=j[f],g&&g.id&&(d||a.inArray(g.id,i)<0)&&l.push(g.id);b.removeWidget(c,l.join(","),!0),e!==!0?(b.applyWidget(c,d||!1,m),d&&b.applyWidget(c,!1,m)):m(c)},benchmark:function(a){return" ( "+((new Date).getTime()-a.getTime())+"ms )"},log:function(){console.log(arguments)},isEmptyObject:function(a){for(var b in a)return!1;return!0},isValueInArray:function(a,b){var c,d=b&&b.length||0;for(c=0;d>c;c++)if(b[c][0]===a)return c;return-1},formatFloat:function(c,d){if("string"!=typeof c||""===c)return c;var e,f=d&&d.config?d.config.usNumberFormat!==!1:"undefined"!=typeof d?d:!0;return c=f?c.replace(b.regex.comma,""):c.replace(b.regex.digitNonUS,"").replace(b.regex.comma,"."),b.regex.digitNegativeTest.test(c)&&(c=c.replace(b.regex.digitNegativeReplace,"-$1")),e=parseFloat(c),isNaN(e)?a.trim(c):e},isDigit:function(a){return isNaN(a)?b.regex.digitTest.test(a.toString().replace(b.regex.digitReplace,"")):""!==a},computeColumnIndex:function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o=[],p=[];for(c=0;ce;e++)for("undefined"==typeof o[e]&&(o[e]=[]),p=o[e],f=n;n+m>f;f++)p[f]="x"}return p.length},fixColumnWidth:function(c){c=a(c)[0];var d,e,f,g,h,i=c.config,j=i.$table.children("colgroup");if(j.length&&j.hasClass(b.css.colgroup)&&j.remove(),i.widthFixed&&0===i.$table.children("colgroup").length){for(j=a(''),d=i.$table.width(),f=i.$tbodies.find("tr:first").children(":visible"),g=f.length,h=0;g>h;h++)e=parseInt(f.eq(h).width()/d*1e3,10)/10+"%",j.append(a("").css("width",e));i.$table.prepend(j)}},getData:function(b,c,d){var e,f,g="",h=a(b);return h.length?(e=a.metadata?h.metadata():!1,f=" "+(h.attr("class")||""),"undefined"!=typeof h.data(d)||"undefined"!=typeof h.data(d.toLowerCase())?g+=h.data(d)||h.data(d.toLowerCase()):e&&"undefined"!=typeof e[d]?g+=e[d]:c&&"undefined"!=typeof c[d]?g+=c[d]:" "!==f&&f.match(" "+d+"-")&&(g=f.match(new RegExp("\\s"+d+"-([\\w-]+)"))[1]||""),a.trim(g)):""},getColumnData:function(b,c,d,e,f){if("undefined"!=typeof c&&null!==c){b=a(b)[0];var g,h,i=b.config,j=f||i.$headers,k=i.$headerIndexed&&i.$headerIndexed[d]||j.filter('[data-column="'+d+'"]:last');if(c[d])return e?c[d]:c[j.index(k)];for(h in c)if("string"==typeof h&&(g=k.filter(h).add(k.find(h)),g.length))return c[h]}},isProcessing:function(c,d,e){c=a(c);var f=c[0].config,g=e||c.find("."+b.css.header);d?("undefined"!=typeof e&&f.sortList.length>0&&(g=g.filter(function(){return this.sortDisabled?!1:b.isValueInArray(parseFloat(a(this).attr("data-column")),f.sortList)>=0})),c.add(g).addClass(b.css.processing+" "+f.cssProcessing)):c.add(g).removeClass(b.css.processing+" "+f.cssProcessing)},processTbody:function(b,c,d){if(b=a(b)[0],d)return b.isProcessing=!0,c.before(''), -a.fn.detach?c.detach():c.remove();var e=a(b).find("colgroup.tablesorter-savemyplace");c.insertAfter(e),e.remove(),b.isProcessing=!1},clearTableBody:function(b){a(b)[0].config.$tbodies.children().detach()},characterEquivalents:{a:"áàâãäąå",A:"ÁÀÂÃÄĄÅ",c:"çćč",C:"ÇĆČ",e:"éèêëěę",E:"ÉÈÊËĚĘ",i:"íìİîïı",I:"ÍÌİÎÏ",o:"óòôõöō",O:"ÓÒÔÕÖŌ",ss:"ß",SS:"ẞ",u:"úùûüů",U:"ÚÙÛÜŮ"},replaceAccents:function(a){var c,d="[",e=b.characterEquivalents;if(!b.characterRegex){b.characterRegexArray={};for(c in e)"string"==typeof c&&(d+=e[c],b.characterRegexArray[c]=new RegExp("["+e[c]+"]","g"));b.characterRegex=new RegExp(d+"]")}if(b.characterRegex.test(a))for(c in e)"string"==typeof c&&(a=a.replace(b.characterRegexArray[c],c));return a},restoreHeaders:function(c){var d,e,f=a(c)[0].config,g=f.$table.find(f.selectorHeaders),h=g.length;for(d=0;h>d;d++)e=g.eq(d),e.find("."+b.css.headerIn).length&&e.html(f.headerContent[d])},destroy:function(c,d,e){if(c=a(c)[0],c.hasInitialized){b.removeWidget(c,!0,!1);var f,g=a(c),h=c.config,i=h.debug,j=g.find("thead:first"),k=j.find("tr."+b.css.headerRow).removeClass(b.css.headerRow+" "+h.cssHeaderRow),l=g.find("tfoot:first > tr").children("th, td");d===!1&&a.inArray("uitheme",h.widgets)>=0&&(g.trigger("applyWidgetId",["uitheme"]),g.trigger("applyWidgetId",["zebra"])),j.find("tr").not(k).remove(),f="sortReset update updateRows updateAll updateHeaders updateCell addRows updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress "+"sortBegin sortEnd resetToLoadState ".split(" ").join(h.namespace+" "),g.removeData("tablesorter").unbind(f.replace(b.regex.spaces," ")),h.$headers.add(l).removeClass([b.css.header,h.cssHeader,h.cssAsc,h.cssDesc,b.css.sortAsc,b.css.sortDesc,b.css.sortNone].join(" ")).removeAttr("data-column").removeAttr("aria-label").attr("aria-disabled","true"),k.find(h.selectorSort).unbind("mousedown mouseup keypress ".split(" ").join(h.namespace+" ").replace(b.regex.spaces," ")),b.restoreHeaders(c),g.toggleClass(b.css.table+" "+h.tableClass+" tablesorter-"+h.theme,d===!1),c.hasInitialized=!1,delete c.config.cache,"function"==typeof e&&e(c),i&&console.log("tablesorter has been removed")}}};a.fn.tablesorter=function(c){return this.each(function(){var d=this,e=a.extend(!0,{},b.defaults,c,b.instanceMethods);e.originalSettings=c,!d.hasInitialized&&b.buildTable&&"TABLE"!==this.nodeName?b.buildTable(d,e):b.setup(d,e)})},window.console&&window.console.log||(b.logs=[],console={},console.log=console.warn=console.error=console.table=function(){var a=arguments.length>1?arguments:arguments[0];b.logs.push({date:Date.now(),log:a})}),b.addParser({id:"no-parser",is:function(){return!1},format:function(){return""},type:"text"}),b.addParser({id:"text",is:function(){return!0},format:function(c,d){var e=d.config;return c&&(c=a.trim(e.ignoreCase?c.toLocaleLowerCase():c),c=e.sortLocaleCompare?b.replaceAccents(c):c),c},type:"text"}),b.regex.nondigit=/[^\w,. \-()]/g,b.addParser({id:"digit",is:function(a){return b.isDigit(a)},format:function(c,d){var e=b.formatFloat((c||"").replace(b.regex.nondigit,""),d);return c&&"number"==typeof e?e:c?a.trim(c&&d.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"}),b.regex.currencyReplace=/[+\-,. ]/g,b.regex.currencyTest=/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/,b.addParser({id:"currency",is:function(a){return a=(a||"").replace(b.regex.currencyReplace,""),b.regex.currencyTest.test(a)},format:function(c,d){var e=b.formatFloat((c||"").replace(b.regex.nondigit,""),d);return c&&"number"==typeof e?e:c?a.trim(c&&d.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"}),b.regex.urlProtocolTest=/^(https?|ftp|file):\/\//,b.regex.urlProtocolReplace=/(https?|ftp|file):\/\//,b.addParser({id:"url",is:function(a){return b.regex.urlProtocolTest.test(a)},format:function(c){return c?a.trim(c.replace(b.regex.urlProtocolReplace,"")):c},parsed:!0,type:"text"}),b.regex.dash=/-/g,b.regex.isoDate=/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/,b.addParser({id:"isoDate",is:function(a){return b.regex.isoDate.test(a)},format:function(a,c){var d=a?new Date(a.replace(b.regex.dash,"/")):a;return d instanceof Date&&isFinite(d)?d.getTime():a},type:"numeric"}),b.regex.percent=/%/g,b.regex.percentTest=/(\d\s*?%|%\s*?\d)/,b.addParser({id:"percent",is:function(a){return b.regex.percentTest.test(a)&&a.length<15},format:function(a,c){return a?b.formatFloat(a.replace(b.regex.percent,""),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.regex.dateReplace=/(\S)([AP]M)$/i,b.regex.usLongDateTest1=/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i,b.regex.usLongDateTest2=/^\d{1,2}\s+[A-Z]{3,10}\s+\d{4}/i,b.addParser({id:"usLongDate",is:function(a){return b.regex.usLongDateTest1.test(a)||b.regex.usLongDateTest2.test(a)},format:function(a,c){var d=a?new Date(a.replace(b.regex.dateReplace,"$1 $2")):a;return d instanceof Date&&isFinite(d)?d.getTime():a},type:"numeric"}),b.regex.shortDateTest=/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/,b.regex.shortDateReplace=/[\-.,]/g,b.regex.shortDateXXY=/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,b.regex.shortDateYMD=/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,b.addParser({id:"shortDate",is:function(a){return a=(a||"").replace(b.regex.spaces," ").replace(b.regex.shortDateReplace,"/"),b.regex.shortDateTest.test(a)},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(b.regex.spaces," ").replace(b.regex.shortDateReplace,"/"),"mmddyyyy"===j?g=g.replace(b.regex.shortDateXXY,"$3/$1/$2"):"ddmmyyyy"===j?g=g.replace(b.regex.shortDateXXY,"$3/$2/$1"):"yyyymmdd"===j&&(g=g.replace(b.regex.shortDateYMD,"$1/$2/$3")),f=new Date(g),f instanceof Date&&isFinite(f)?f.getTime():a}return a},type:"numeric"}),b.regex.timeTest=/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i,b.addParser({id:"time",is:function(a){return b.regex.timeTest.test(a)},format:function(a,c){var d=a?new Date("2000/01/01 "+a.replace(b.regex.dateReplace,"$1 $2")):a;return d instanceof Date&&isFinite(d)?d.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=new RegExp(c.cssChildRow,"i"),m=c.$tbodies.add(a(c.namespace+"_extra_table").children("tbody:not(."+c.cssInfoBlock+")"));for(i=0;ij;j++)f=e.eq(j),l.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 // class from cssIcon +onRenderTemplate:null,// function( index, template ){ return template; }, // template is a string +onRenderHeader:null,// function( index ){}, // nothing to return +// *** functionality +cancelSelection:!0,// prevent text selection in the header +tabIndex:!0,// add tabindex to header for keyboard accessibility +dateFormat:"mmddyyyy",// other options: 'ddmmyyy' or 'yyyymmdd' +sortMultiSortKey:"shiftKey",// key used to select additional columns +sortResetKey:"ctrlKey",// key used to remove sorting on a column +usNumberFormat:!0,// false for German '1.234.567,89' or French '1 234 567,89' +delayInit:!1,// if false, the parsed table contents will not update until the first sort +serverSideSorting:!1,// if true, server-side sorting should be performed because client-side sorting will be disabled, but the ui and events will still be used. +resort:!0,// default setting to trigger a resort after an 'update', 'addRows', 'updateCell', etc has completed +// *** sort options +headers:{},// set sorter, string, empty, locked order, sortInitialOrder, filter, etc. +ignoreCase:!0,// ignore case while sorting +sortForce:null,// column(s) first sorted; always applied +sortList:[],// Initial sort order; applied initially; updated when manually sorted +sortAppend:null,// column(s) sorted last; always applied +sortStable:!1,// when sorting two rows with exactly the same content, the original sort order is maintained +sortInitialOrder:"asc",// sort direction on first click +sortLocaleCompare:!1,// replace equivalent character (accented characters) +sortReset:!1,// third click on the header will reset column to default - unsorted +sortRestart:!1,// restart sort to 'sortInitialOrder' when clicking on previously unsorted columns +emptyTo:"bottom",// sort empty cell to bottom, top, none, zero, emptyMax, emptyMin +stringTo:"max",// sort strings in numerical column as max, min, top, bottom, zero +textExtraction:"basic",// text extraction method/function - function( node, table, cellIndex ){} +textAttribute:"data-text",// data-attribute that contains alternate cell text (used in default textExtraction function) +textSorter:null,// choose overall or specific column sorter function( a, b, direction, table, columnIndex ) [alt: ts.sortText] +numberSorter:null,// choose overall numeric sorter function( a, b, direction, maxColumnValue ) +// *** widget options +widgets:[],// method to add widgets, e.g. widgets: ['zebra'] +widgetOptions:{zebra:["even","odd"]},initWidgets:!0,// apply widgets on tablesorter initialization +widgetClass:"widget-{name}",// table class name template to match to include a widget +// *** callbacks +initialized:null,// function( table ){}, +// *** extra css class names +tableClass:"",cssAsc:"",cssDesc:"",cssNone:"",cssHeader:"",cssHeaderRow:"",cssProcessing:"",// processing icon applied to header during sort/filter +cssChildRow:"tablesorter-childRow",// class name indiciating that a row is to be attached to the its parent +cssInfoBlock:"tablesorter-infoOnly",// don't sort tbody with this class name (only one class name allowed here!) +cssNoSort:"tablesorter-noSort",// class name added to element inside header; clicking on it won't cause a sort +cssIgnoreRow:"tablesorter-ignoreRow",// header row to ignore; cells within this row will not be added to c.$headers +cssIcon:"tablesorter-icon",// if this class does not exist, the {icon} will not be added from the headerTemplate +cssIconNone:"",// class name added to the icon when there is no column sort +cssIconAsc:"",// class name added to the icon when the column has an ascending sort +cssIconDesc:"",// class name added to the icon when the column has a descending sort +// *** events +pointerClick:"click",pointerDown:"mousedown",pointerUp:"mouseup", +// *** selectors +selectorHeaders:"> thead th, > thead td",selectorSort:"th, td",// jQuery selector of content within selectorHeaders that is clickable to trigger a sort +selectorRemove:".remove-me", +// *** advanced +debug:!1, +// *** Internal variables +headerList:[],empties:{},strings:{},parsers:[]}, +// internal css classes - these will ALWAYS be added to +// the table and MUST only contain one class name - fixes #381 +css:{table:"tablesorter",cssHasChild:"tablesorter-hasChildRow",childRow:"tablesorter-childRow",colgroup:"tablesorter-colgroup",header:"tablesorter-header",headerRow:"tablesorter-headerRow",headerIn:"tablesorter-header-inner",icon:"tablesorter-icon",processing:"tablesorter-processing",sortAsc:"tablesorter-headerAsc",sortDesc:"tablesorter-headerDesc",sortNone:"tablesorter-headerUnSorted"}, +// labels applied to sortable headers for accessibility (aria) support +language:{sortAsc:"Ascending sort applied, ",sortDesc:"Descending sort applied, ",sortNone:"No sort applied, ",nextAsc:"activate to apply an ascending sort",nextDesc:"activate to apply a descending sort",nextNone:"activate to remove the sort"},regex:{templateContent:/\{content\}/g,templateIcon:/\{icon\}/g,templateName:/\{name\}/i,spaces:/\s+/g,nonWord:/\W/g,formElements:/(input|select|button|textarea)/i, +// *** sort functions *** +// regex used in natural sort +// chunk/tokenize numbers & letters +chunk:/(^([+\-]?(?:\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi, +// replace chunks @ ends +chunks:/(^\\0|\\0$)/,hex:/^0x[0-9a-f]+$/i, +// *** formatFloat *** +comma:/,/g,digitNonUS:/[\s|\.]/g,digitNegativeTest:/^\s*\([.\d]+\)/,digitNegativeReplace:/^\s*\(([.\d]+)\)/, +// *** isDigit *** +digitTest:/^[\-+(]?\d+[)]?$/,digitReplace:/[,.'"\s]/g}, +// digit sort text location; keeping max+/- for backwards compatibility +string:{max:1,min:-1,emptymin:1,emptymax:-1,zero:0,none:0,"null":0,top:!0,bottom:!1}, +// These methods can be applied on table.config instance +instanceMethods:{},/* + ▄█████ ██████ ██████ ██ ██ █████▄ + ▀█▄ ██▄▄ ██ ██ ██ ██▄▄██ + ▀█▄ ██▀▀ ██ ██ ██ ██▀▀▀ + █████▀ ██████ ██ ▀████▀ ██ + */ +setup:function(c,d){ +// if no thead or tbody, or tablesorter is already present, quit +if(!c||!c.tHead||0===c.tBodies.length||c.hasInitialized===!0)return void(d.debug&&(c.hasInitialized?console.warn("Stopping initialization. Tablesorter has already been initialized"):console.error("Stopping initialization! No table, thead or tbody")));var e="",f=a(c),g=a.metadata; +// initialization flag +c.hasInitialized=!1, +// table is being processed flag +c.isProcessing=!0, +// make sure to store the config object +c.config=d, +// save the settings where they read +a.data(c,"tablesorter",d),d.debug&&(console[console.group?"group":"log"]("Initializing tablesorter"),a.data(c,"startoveralltimer",new Date)), +// removing this in version 3 (only supports jQuery 1.7+) +d.supportsDataObject=function(a){return a[0]=parseInt(a[0],10),a[0]>1||1===a[0]&&parseInt(a[1],10)>=4}(a.fn.jquery.split(".")), +// ensure case insensitivity +d.emptyTo=d.emptyTo.toLowerCase(),d.stringTo=d.stringTo.toLowerCase(),d.last={sortList:[],clickedIndex:-1}, +// add table theme class only if there isn't already one there +/tablesorter\-/.test(f.attr("class"))||(e=""!==d.theme?" tablesorter-"+d.theme:""),d.table=c,d.$table=f.addClass(b.css.table+" "+d.tableClass+e).attr("role","grid"),d.$headers=f.find(d.selectorHeaders), +// give the table a unique id, which will be used in namespace binding +d.namespace?d.namespace="."+d.namespace.replace(b.regex.nonWord,""):d.namespace=".tablesorter"+Math.random().toString(16).slice(2),d.$table.children().children("tr").attr("role","row"),d.$tbodies=f.children("tbody:not(."+d.cssInfoBlock+")").attr({"aria-live":"polite","aria-relevant":"all"}),d.$table.children("caption").length&&(e=d.$table.children("caption")[0],e.id||(e.id=d.namespace.slice(1)+"caption"),d.$table.attr("aria-labelledby",e.id)),d.widgetInit={},// keep a list of initialized widgets +// change textExtraction via data-attribute +d.textExtraction=d.$table.attr("data-text-extraction")||d.textExtraction||"basic", +// build headers +b.buildHeaders(d), +// fixate columns if the users supplies the fixedWidth option +// do this after theme has been applied +b.fixColumnWidth(c), +// add widgets from class name +b.addWidgetFromClass(c), +// add widget options before parsing (e.g. grouping widget has parser settings) +b.applyWidgetOptions(c), +// try to auto detect column type, and store in tables config +b.setupParsers(d), +// start total row count at zero +d.totalRows=0, +// build the cache for the tbody cells +// delayInit will delay building the cache until the user starts a sort +d.delayInit||b.buildCache(d), +// bind all header events and methods +b.bindEvents(c,d.$headers,!0),b.bindMethods(d), +// get sort list from jQuery data or metadata +// in jQuery < 1.4, an error occurs when calling $table.data() +d.supportsDataObject&&"undefined"!=typeof f.data().sortlist?d.sortList=f.data().sortlist:g&&f.metadata()&&f.metadata().sortlist&&(d.sortList=f.metadata().sortlist), +// apply widget init code +b.applyWidget(c,!0), +// if user has supplied a sort list to constructor +d.sortList.length>0?b.sortOn(d,d.sortList,{},!d.initWidgets):(b.setHeadersCss(d),d.initWidgets&& +// apply widget format +b.applyWidget(c,!1)), +// show processesing icon +d.showProcessing&&f.unbind("sortBegin"+d.namespace+" sortEnd"+d.namespace).bind("sortBegin"+d.namespace+" sortEnd"+d.namespace,function(a){clearTimeout(d.processTimer),b.isProcessing(c),"sortBegin"===a.type&&(d.processTimer=setTimeout(function(){b.isProcessing(c,!0)},500))}), +// initialized +c.hasInitialized=!0,c.isProcessing=!1,d.debug&&(console.log("Overall initialization time: "+b.benchmark(a.data(c,"startoveralltimer"))),d.debug&&console.groupEnd&&console.groupEnd()),f.trigger("tablesorter-initialized",c),"function"==typeof d.initialized&&d.initialized(c)},bindMethods:function(c){var d=c.$table,e=c.namespace,f="sortReset update updateRows updateAll updateHeaders addRows updateCell updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave ".split(" ").join(e+" "); +// apply easy methods that trigger bound events +d.unbind(f.replace(b.regex.spaces," ")).bind("sortReset"+e,function(a,c){a.stopPropagation(), +// using this.config to ensure functions are getting a non-cached version of the config +b.sortReset(this.config,c)}).bind("updateAll"+e,function(a,c,d){a.stopPropagation(),b.updateAll(this.config,c,d)}).bind("update"+e+" updateRows"+e,function(a,c,d){a.stopPropagation(),b.update(this.config,c,d)}).bind("updateHeaders"+e,function(a,c){a.stopPropagation(),b.updateHeaders(this.config,c)}).bind("updateCell"+e,function(a,c,d,e){a.stopPropagation(),b.updateCell(this.config,c,d,e)}).bind("addRows"+e,function(a,c,d,e){a.stopPropagation(),b.addRows(this.config,c,d,e)}).bind("updateComplete"+e,function(){this.isUpdating=!1}).bind("sorton"+e,function(a,c,d,e){a.stopPropagation(),b.sortOn(this.config,c,d,e)}).bind("appendCache"+e,function(c,d,e){c.stopPropagation(),b.appendCache(this.config,e),a.isFunction(d)&&d(this)}).bind("updateCache"+e,function(a,c,d){a.stopPropagation(),b.updateCache(this.config,c,d)}).bind("applyWidgetId"+e,function(a,c){a.stopPropagation(),b.getWidgetById(c).format(this,this.config,this.config.widgetOptions)}).bind("applyWidgets"+e,function(a,c){a.stopPropagation(), +// apply widgets +b.applyWidget(this,c)}).bind("refreshWidgets"+e,function(a,c,d){a.stopPropagation(),b.refreshWidgets(this,c,d)}).bind("destroy"+e,function(a,c,d){a.stopPropagation(),b.destroy(this,c,d)}).bind("resetToLoadState"+e,function(d){d.stopPropagation(), +// remove all widgets +b.removeWidget(this,!0,!1),c=a.extend(!0,b.defaults,c.originalSettings),this.hasInitialized=!1,b.setup(this,c)})},bindEvents:function(c,d,e){c=a(c)[0];var f,g=c.config,h=g.namespace,i=null;e!==!0&&(d.addClass(h.slice(1)+"_extra_headers"),f=a.fn.closest?d.closest("table")[0]:d.parents("table")[0],f&&"TABLE"===f.nodeName&&f!==c&&a(f).addClass(h.slice(1)+"_extra_table")),f=(g.pointerDown+" "+g.pointerUp+" "+g.pointerClick+" sort keyup ").replace(b.regex.spaces," ").split(" ").join(h+" "),d.find(g.selectorSort).add(d.filter(g.selectorSort)).unbind(f).bind(f,function(c,e){var f,h,j,k=a(c.target),l=" "+c.type+" ";if(!(1!==(c.which||c.button)&&!l.match(" "+g.pointerClick+" | sort | keyup ")||" keyup "===l&&13!==c.which||l.match(" "+g.pointerClick+" ")&&"undefined"!=typeof c.which||l.match(" "+g.pointerUp+" ")&&i!==c.target&&e!==!0)){if(l.match(" "+g.pointerDown+" "))return i=c.target,j=k.jquery.split("."),void("1"===j[0]&&j[1]<4&&c.preventDefault());if(i=null,b.regex.formElements.test(c.target.nodeName)||k.hasClass(g.cssNoSort)||k.parents("."+g.cssNoSort).length>0||k.parents("button").length>0)return!g.cancelSelection;g.delayInit&&b.isEmptyObject(g.cache)&&b.buildCache(g),f=a.fn.closest?a(this).closest("th, td"):/TH|TD/.test(this.nodeName)?a(this):a(this).parents("th, td"),j=d.index(f),g.last.clickedIndex=0>j?f.attr("data-column"):j,h=g.$headers[g.last.clickedIndex],h&&!h.sortDisabled&&b.initSort(g,h,c)}}),g.cancelSelection&&d.attr("unselectable","on").bind("selectstart",!1).css({"user-select":"none",MozUserSelect:"none"})},buildHeaders:function(c){var d,e,f,g;for(c.headerList=[],c.headerContent=[],c.sortVars=[],c.debug&&(f=new Date), +// children tr in tfoot - see issue #196 & #547 +c.columns=b.computeColumnIndex(c.$table.children("thead, tfoot").children("tr")),e=c.cssIcon?'':"",c.$headers=a(a.map(c.$table.find(c.selectorHeaders),function(d,f){var g,h,i,j,k,l=a(d);if(!l.parent().hasClass(c.cssIgnoreRow))return g=b.getColumnData(c.table,c.headers,f,!0),c.headerContent[f]=l.html(),""===c.headerTemplate||l.find("."+b.css.headerIn).length||(j=c.headerTemplate.replace(b.regex.templateContent,l.html()).replace(b.regex.templateIcon,l.find("."+b.css.icon).length?"":e),c.onRenderTemplate&&(h=c.onRenderTemplate.apply(l,[f,j]),h&&"string"==typeof h&&(j=h)),l.html('
    '+j+"
    ")),c.onRenderHeader&&c.onRenderHeader.apply(l,[f,c,c.$table]),i=parseInt(l.attr("data-column"),10),d.column=i,k=b.getData(l,g,"sortInitialOrder")||c.sortInitialOrder,c.sortVars[i]={count:-1,order:b.formatSortingOrder(k)?[1,0,2]:[0,1,2],lockedOrder:!1},k=b.getData(l,g,"lockedOrder")||!1,"undefined"!=typeof k&&k!==!1&&(c.sortVars[i].lockedOrder=!0,c.sortVars[i].order=b.formatSortingOrder(k)?[1,1,1]:[0,0,0]),c.headerList[f]=d,l.addClass(b.css.header+" "+c.cssHeader).parent().addClass(b.css.headerRow+" "+c.cssHeaderRow).attr("role","row"),c.tabIndex&&l.attr("tabindex",0),d})),c.$headerIndexed=[],g=0;gs;){if(d=p[s].rows,d.length)for(h=0,g=a.columns,i=0;g>i;i++)j=a.$headerIndexed[h],j&&j.length&&(k=b.getColumnData(r,a.headers,h),n=b.getParserById(b.getData(j,k,"extractor")),m=b.getParserById(b.getData(j,k,"sorter")),l="false"===b.getData(j,k,"parser"),a.empties[h]=(b.getData(j,k,"empty")||a.emptyTo||(a.emptyToBottom?"bottom":"top")).toLowerCase(),a.strings[h]=(b.getData(j,k,"string")||a.stringTo||"max").toLowerCase(),l&&(m=b.getParserById("no-parser")),n||(n=!1),m||(m=b.detectParserForColumn(a,d,-1,h)),a.debug&&(t["("+h+") "+j.text()]={parser:m.id,extractor:n?n.id:"none",string:a.strings[h],empty:a.empties[h]}),e.parsers[h]=m,e.extractors[h]=n,f=j[0].colSpan-1,f>0&&(h+=f,g+=f)),h++;s+=e.parsers.length?q:1}a.debug&&(b.isEmptyObject(t)?console.warn(" No parsers detected!"):console[console.table?"table":"log"](t),console.log("Completed detecting parsers"+b.benchmark(o)),console.groupEnd&&console.groupEnd()),a.parsers=e.parsers,a.extractors=e.extractors},addParser:function(a){var c,d=b.parsers.length,e=!0;for(c=0;d>c;c++)b.parsers[c].id.toLowerCase()===a.id.toLowerCase()&&(e=!1);e&&b.parsers.push(a)},getParserById:function(a){/*jshint eqeqeq:false */ +if("false"==a)return!1;var c,d=b.parsers.length;for(c=0;d>c;c++)if(b.parsers[c].id.toLowerCase()===a.toString().toLowerCase())return b.parsers[c];return!1},detectParserForColumn:function(c,d,e,f){for(var g,h,i=b.parsers.length,j=!1,k="",l=!0;""===k&&l;)e++,d[e]?(j=d[e].cells[f],k=b.getElementText(c,j,f),h=a(j),c.debug&&console.log("Checking if value was empty on row "+e+", column: "+f+': "'+k+'"')):l=!1;for(;--i>=0;) +// ignore the default text parser because it will always be true +if(g=b.parsers[i],g&&"text"!==g.id&&g.is&&g.is(k,c.table,j,h))return g; +// nothing found, return the generic parser (text) +return b.getParserById("text")},getElementText:function(c,d,e){if(!d)return"";var f,g=c.textExtraction||"", +// node could be a jquery object +// http://jsperf.com/jquery-vs-instanceof-jquery/2 +h=d.jquery?d:a(d); +// check data-attribute first when set to 'basic'; don't use node.innerText - it's really slow! +// http://www.kellegous.com/j/2013/02/27/innertext-vs-textcontent/ +return"string"==typeof g?"basic"===g&&"undefined"!=typeof(f=h.attr(c.textAttribute))?a.trim(f):a.trim(d.textContent||h.text()):"function"==typeof g?a.trim(g(h[0],c.table,e)):"function"==typeof(f=b.getColumnData(c.table,g,e))?a.trim(f(h[0],c.table,e)):a.trim(h[0].textContent||h.text())}, +// centralized function to extract/parse cell contents +getParsedText:function(a,c,d,e){"undefined"==typeof e&&(e=b.getElementText(a,c,d)); +// if no parser, make sure to return the txt +var f=""+e,g=a.parsers[d],h=a.extractors[d]; +// do extract before parsing, if there is one +// allow parsing if the string is empty, previously parsing would change it to zero, +// in case the parser needs to extract data from the table cell attributes +// make sure txt is a string (extractor may have converted it) +return g&&(h&&"function"==typeof h.format&&(e=h.format(e,a.table,c,d)),f="no-parser"===g.id?"":g.format(""+e,a.table,c,d),a.ignoreCase&&"string"==typeof f&&(f=f.toLowerCase())),f},/* + ▄████▄ ▄████▄ ▄████▄ ██ ██ ██████ + ██ ▀▀ ██▄▄██ ██ ▀▀ ██▄▄██ ██▄▄ + ██ ▄▄ ██▀▀██ ██ ▄▄ ██▀▀██ ██▀▀ + ▀████▀ ██ ██ ▀████▀ ██ ██ ██████ + */ +buildCache:function(c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z=c.table,A=c.parsers; +// if no parsers found, return - it's an empty table. +if( +// update tbody variable +c.$tbodies=c.$table.children("tbody:not(."+c.cssInfoBlock+")"),l="undefined"==typeof e?c.$tbodies:e,c.cache={},c.totalRows=0,!A)return c.debug?console.warn("Warning: *Empty table!* Not building a cache"):"";for(c.debug&&(q=new Date), +// processing icon +c.showProcessing&&b.isProcessing(z,!0),k=0;ki;++i) +// if this is a child row, add it to the last row's children and continue to the next row +// ignore child row class, if it is the first row +if(s={ +// order: original row order # +// $row : jQuery Object[] +child:[],// child row text (filter widget) +raw:[]},m=a(l[k].rows[i]),n=[],m.hasClass(c.cssChildRow)&&0!==i)for(y=f.normalized.length-1,t=f.normalized[y][c.columns],t.$row=t.$row.add(m),m.prev().hasClass(c.cssChildRow)||m.prev().addClass(b.css.cssHasChild),o=m.children("th, td"),y=t.child.length,t.child[y]=[],w=0,x=c.columns,j=0;x>j;j++)p=o[j],p&&(t.child[y][j]=b.getParsedText(c,p,j),v=o[j].colSpan-1,v>0&&(w+=v,x+=v)),w++;else{for(s.$row=m,s.order=i,w=0,x=c.columns,j=0;x>j;++j)p=m[0].cells[j],"undefined"==typeof A[w]?c.debug&&console.warn("No parser found for column "+j+"; cell:",p,"does it have a header?"):p&&(g=b.getElementText(c,p,w),s.raw[w]=g,h=b.getParsedText(c,p,w,g),n[w]=h,"numeric"===(A[w].type||"").toLowerCase()&&(u[w]=Math.max(Math.abs(h)||0,u[w]||0)),v=p.colSpan-1,v>0&&(w+=v,x+=v)),w++; +// ensure rowData is always in the same location (after the last column) +n[c.columns]=s,f.normalized.push(n)}f.colMax=u, +// total up rows, not including child rows +c.totalRows+=f.normalized.length}c.showProcessing&&b.isProcessing(z),c.debug&&console.log("Building cache for "+r+" rows"+b.benchmark(q)),a.isFunction(d)&&d(z)},getColumnText:function(c,d,e,f){c=a(c)[0];var g,h,i,j,k,l,m,n,o,p,q="function"==typeof e,r="all"===d,s={raw:[],parsed:[],$cell:[]},t=c.config;if(!b.isEmptyObject(t)){for(k=t.$tbodies.length,g=0;k>g;g++)for(i=t.cache[g].normalized,l=i.length,h=0;l>h;h++)j=i[h],(!f||j[t.columns].$row.is(f))&&(p=!0,n=r?j.slice(0,t.columns):j[d],j=j[t.columns],m=r?j.raw:j.raw[d],o=r?j.$row.children():j.$row.children().eq(d),q&&(p=e({tbodyIndex:g,rowIndex:h,parsed:n,raw:m,$row:j.$row,$cell:o})),p!==!1&&(s.parsed.push(n),s.raw.push(m),s.$cell.push(o))); +// return everything +return s}t.debug&&console.warn("No cache found - aborting getColumnText function!")},/* + ██ ██ █████▄ █████▄ ▄████▄ ██████ ██████ + ██ ██ ██▄▄██ ██ ██ ██▄▄██ ██ ██▄▄ + ██ ██ ██▀▀▀ ██ ██ ██▀▀██ ██ ██▀▀ + ▀████▀ ██ █████▀ ██ ██ ██ ██████ + */ +setHeadersCss:function(c){var d,e,f,g,h,i,j,k,l=c.sortList,m=l.length,n=b.css.sortNone+" "+c.cssNone,o=[b.css.sortAsc+" "+c.cssAsc,b.css.sortDesc+" "+c.cssDesc],p=[c.cssIconAsc,c.cssIconDesc,c.cssIconNone],q=["ascending","descending"], +// find the footer +r=c.$table.find("tfoot tr").children().add(a(c.namespace+"_extra_headers")).removeClass(o.join(" "));for( +// remove all header information +c.$headers.removeClass(o.join(" ")).addClass(n).attr("aria-sort","none").find("."+b.css.icon).removeClass(p.join(" ")).addClass(p[2]),f=0;m>f;f++) +// direction = 2 means reset! +if(2!==l[f][1]&&(d=c.$headers.filter(function(d,e){for( +// only include headers that are in the sortList (this includes colspans) +var f=!0,g=a(e),h=parseInt(g.attr("data-column"),10),i=h+e.colSpan;i>h;h++)f=f?b.isValueInArray(h,c.sortList)>-1:!1;return f}),d=d.not(".sorter-false").filter('[data-column="'+l[f][0]+'"]'+(1===m?":last":"")),d.length)){for(g=0;gf;f++)h=r.eq(f),h.length&&(e=r[f],g=parseInt(h.attr("data-column"),10),i=c.sortVars[g].order[(c.sortVars[g].count+1)%(c.sortReset?3:2)],k=h.hasClass(b.css.sortAsc)?"sortAsc":h.hasClass(b.css.sortDesc)?"sortDesc":"sortNone",j=a.trim(h.text())+": "+b.language[k]+b.language[0===i?"nextAsc":1===i?"nextDesc":"nextNone"],h.attr("aria-label",j))},updateHeader:function(a){var c,d,e,f,g=a.table,h=a.$headers.length;for(c=0;h>c;c++)e=a.$headers.eq(c),f=b.getColumnData(g,a.headers,c,!0),d="false"===b.getData(e,f,"sorter")||"false"===b.getData(e,f,"parser"),e[0].sortDisabled=d,e[d?"addClass":"removeClass"]("sorter-false").attr("aria-disabled",""+d),a.tabIndex&&(d?e.removeAttr("tabindex"):e.attr("tabindex","0")),g.id&&(d?e.removeAttr("aria-controls"):e.attr("aria-controls",g.id))},updateHeaderSortCount:function(b,c){var d,e,f,g,h,i,j,k,l=c||b.sortList,m=l.length;for(b.sortList=[],g=0;m>g;g++) +// prevents error if sorton array is wrong +if(j=l[g],d=parseInt(j[0],10),d=0?e:f[1]%(b.sortReset?3:2)}},updateAll:function(a,c,d){var e=a.table;e.isUpdating=!0,b.refreshWidgets(e,!0,!0),b.buildHeaders(a),b.bindEvents(e,a.$headers,!0),b.bindMethods(a),b.commonUpdate(a,c,d)},update:function(a,c,d){var e=a.table;e.isUpdating=!0, +// update sorting (if enabled/disabled) +b.updateHeader(a),b.commonUpdate(a,c,d)}, +// simple header update - see #989 +updateHeaders:function(a,c){a.table.isUpdating=!0,b.buildHeaders(a),b.bindEvents(a.table,a.$headers,!0),b.resortComplete(a,c)},updateCell:function(c,d,e,f){c.table.isUpdating=!0,c.$table.find(c.selectorRemove).remove(); +// get position from the dom +var g,h,i,j,k,l,m=c.$tbodies,n=a(d), +// update cache - format: function( s, table, cell, cellIndex ) +// no closest in jQuery v1.2.6 +o=m.index(a.fn.closest?n.closest("tbody"):n.parents("tbody").filter(":first")),p=c.cache[o],q=a.fn.closest?n.closest("tr"):n.parents("tr").filter(":first");// in case cell is a jQuery object +// tbody may not exist if update is initialized while tbody is removed for processing +if(d=n[0],m.length&&o>=0){if(i=m.eq(o).find("tr").index(q),k=p.normalized[i],l=q[0].cells.length,l!==c.columns)for(j=0,g=!1,h=0;l>h;h++)g||q[0].cells[h]===d?g=!0:j+=q[0].cells[h].colSpan;else j=n.index();g=b.getElementText(c,d,j),// raw +k[c.columns].raw[j]=g,g=b.getParsedText(c,d,j,g),k[j]=g,// parsed +k[c.columns].$row=q,"numeric"===(c.parsers[j].type||"").toLowerCase()&&( +// update column max value (ignore sign) +p.colMax[j]=Math.max(Math.abs(g)||0,p.colMax[j]||0)),g="undefined"!==e?e:c.resort,g!==!1? +// widgets will be reapplied +b.checkResort(c,g,f): +// don't reapply widgets is resort is false, just in case it causes +// problems with element focus +b.resortComplete(c,f)}},addRows:function(c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q,r, +// allow passing a row string if only one non-info tbody exists in the table +s="string"==typeof d&&1===c.$tbodies.length&&/j;j++){ +// add each cell +for(n=0,m=d[j].cells.length,p=[],o={child:[],raw:[],$row:d.eq(j),order:c.cache[i].normalized.length},l=0;m>l;l++)q=d[j].cells[l],g=b.getElementText(c,q,n),o.raw[n]=g,h=b.getParsedText(c,q,n,g),p[n]=h,"numeric"===(c.parsers[n].type||"").toLowerCase()&&(c.cache[i].colMax[n]=Math.max(Math.abs(h)||0,c.cache[i].colMax[n]||0)),r=q.colSpan-1,r>0&&(n+=r),n++; +// add the row data to the end +p[c.columns]=o, +// update cache +c.cache[i].normalized.push(p)} +// resort using current settings +b.checkResort(c,e,f)}},updateCache:function(a,c,d){ +// rebuild parsers +a.parsers&&a.parsers.length||b.setupParsers(a,d), +// rebuild the cache map +b.buildCache(a,c,d)}, +// init flag (true) used by pager plugin to prevent widget application +// renamed from appendToTable +appendCache:function(a,c){var d,e,f,g,h,i,j,k=a.table,l=a.widgetOptions,m=a.$tbodies,n=[],o=a.cache; +// empty table - fixes #206/#346 +if(b.isEmptyObject(o)) +// run pager appender in case the table was just emptied +return a.appender?a.appender(k,n):k.isUpdating?a.$table.trigger("updateComplete",k):"";for(a.debug&&(j=new Date),i=0;ih;h++)n.push(d[h][a.columns].$row), +// removeRows used by the pager plugin; don't render if using ajax - fixes #411 +a.appender&&(!a.pager||a.pager.removeRows&&l.pager_removeRows||a.pager.ajax)||g.append(d[h][a.columns].$row); +// restore tbody +b.processTbody(k,g,!1)}a.appender&&a.appender(k,n),a.debug&&console.log("Rebuilt table"+b.benchmark(j)), +// apply table widgets; but not before ajax completes +c||a.appender||b.applyWidget(k),k.isUpdating&&a.$table.trigger("updateComplete",k)},commonUpdate:function(a,c,d){ +// remove rows/elements before update +a.$table.find(a.selectorRemove).remove(), +// rebuild parsers +b.setupParsers(a), +// rebuild the cache map +b.buildCache(a),b.checkResort(a,c,d)},/* + ▄█████ ▄████▄ █████▄ ██████ ██ █████▄ ▄████▄ + ▀█▄ ██ ██ ██▄▄██ ██ ██ ██ ██ ██ ▄▄▄ + ▀█▄ ██ ██ ██▀██ ██ ██ ██ ██ ██ ▀██ + █████▀ ▀████▀ ██ ██ ██ ██ ██ ██ ▀████▀ + */ +initSort:function(c,d,e){if(c.table.isUpdating) +// let any updates complete before initializing a sort +return setTimeout(function(){b.initSort(c,d,e)},50);var f,g,h,i,j,k,l,m=!e[c.sortMultiSortKey],n=c.table,o=c.$headers.length, +// get current column index +p=parseInt(a(d).attr("data-column"),10),q=c.sortVars[p].order; +// reset all sorts on non-current column - issue #30 +if( +// Only call sortStart if sorting is enabled +c.$table.trigger("sortStart",n), +// get current column sort order +c.sortVars[p].count=e[c.sortResetKey]?2:(c.sortVars[p].count+1)%(c.sortReset?3:2),c.sortRestart)for(k=d,h=0;o>h;h++)l=c.$headers.eq(h),l[0]===k||!m&&l.is("."+b.css.sortDesc+",."+b.css.sortAsc)||(c.sortVars[p].count=-1); +// user only wants to sort on one column +if(m){if( +// flush the sort list +c.sortList=[],c.last.sortList=[],null!==c.sortForce)for(f=c.sortForce,g=0;gi&&(c.sortList.push([p,i]),d.colSpan>1))for(g=1;g=0) +// reverse the sorting direction +for(g=0;gi&&(c.sortList.push([p,i]),d.colSpan>1))for(g=1;gc;c++)e=a.cache[c].colMax,f=a.cache[c].normalized,f.sort(function(c,d){var f,l,m,n,o,p,q;for(f=0;k>f;f++){if(m=j[f][0],n=j[f][1],h=0===n,a.sortStable&&c[m]===d[m]&&1===k)return c[a.columns].order-d[a.columns].order;if(l=/n/i.test(b.getSortType(a.parsers,m)),l&&a.strings[m]?(l="boolean"==typeof b.string[a.strings[m]]?(h?1:-1)*(b.string[a.strings[m]]?-1:1):a.strings[m]?b.string[a.strings[m]]||0:0,o=a.numberSorter?a.numberSorter(c[m],d[m],h,e[m],g):b["sortNumeric"+(h?"Asc":"Desc")](c[m],d[m],l,e[m],m,a)):(p=h?c:d,q=h?d:c,o="function"==typeof i?i(p[m],q[m],h,m,g):"object"==typeof i&&i.hasOwnProperty(m)?i[m](p[m],q[m],h,m,g):b["sortNatural"+(h?"Asc":"Desc")](c[m],d[m],m,a)),o)return o}return c[a.columns].order-d[a.columns].order});a.debug&&console.log("Applying sort "+j.toString()+b.benchmark(d))}},resortComplete:function(b,c){b.table.isUpdating&&b.$table.trigger("updateComplete",b.table),a.isFunction(c)&&c(b.table)},checkResort:function(c,d,e){var f=a.isArray(d)?d:c.sortList, +// if no resort parameter is passed, fallback to config.resort (true by default) +g="undefined"==typeof d?c.resort:d; +// don't try to resort if the table is still processing +// this will catch spamming of the updateCell method +g===!1||c.serverSideSorting||c.table.isProcessing?(b.resortComplete(c,e),b.applyWidget(c.table,!1)):f.length?b.sortOn(c,f,function(){b.resortComplete(c,e)},!0):b.sortReset(c,function(){b.resortComplete(c,e),b.applyWidget(c.table,!1)})},sortOn:function(c,d,e,f){var g=c.table;c.$table.trigger("sortStart",g), +// update header count index +b.updateHeaderSortCount(c,d), +// set css for headers +b.setHeadersCss(c), +// fixes #346 +c.delayInit&&b.isEmptyObject(c.cache)&&b.buildCache(c),c.$table.trigger("sortBegin",g), +// sort the table and append it to the dom +b.multisort(c),b.appendCache(c,f),c.$table.trigger("sortEnd",g),b.applyWidget(g),a.isFunction(e)&&e(g)},sortReset:function(c,d){c.sortList=[],b.setHeadersCss(c),b.multisort(c),b.appendCache(c),a.isFunction(d)&&d(c.table)},getSortType:function(a,b){return a&&a[b]?a[b].type||"":""},formatSortingOrder:function(a){ +// look for 'd' in 'desc' order; return true +return/^d/i.test(a)||1===a}, +// Natural sort - https://github.com/overset/javascript-natural-sort (date sorting removed) +// this function will only accept strings, or you'll see 'TypeError: undefined is not a function' +// I could add a = a.toString(); b = b.toString(); but it'll slow down the sort overall +sortNatural:function(a,c){if(a===c)return 0;var d,e,f,g,h,i,j=b.regex; +// first try and sort Hex codes +if(j.hex.test(c)){if(d=parseInt(a.match(j.hex),16),e=parseInt(c.match(j.hex),16),e>d)return-1;if(d>e)return 1} +// natural sorting through split numeric strings and default strings +for(d=a.replace(j.chunk,"\\0$1\\0").replace(j.chunks,"").split("\\0"),e=c.replace(j.chunk,"\\0$1\\0").replace(j.chunks,"").split("\\0"),i=Math.max(d.length,e.length),h=0;i>h;h++){ +// handle numeric vs string comparison - number < string - (Kyle Adams) +if(f=isNaN(d[h])?d[h]||0:parseFloat(d[h])||0,g=isNaN(e[h])?e[h]||0:parseFloat(e[h])||0,isNaN(f)!==isNaN(g))return isNaN(f)?1:-1;if( +// rely on string comparison if different types - i.e. '02' < 2 != '02' < '2' +typeof f!=typeof g&&(f+="",g+=""),g>f)return-1;if(f>g)return 1}return 0},sortNaturalAsc:function(a,c,d,e){if(a===c)return 0;var f=b.string[e.empties[d]||e.emptyTo];return""===a&&0!==f?"boolean"==typeof f?f?-1:1:-f||-1:""===c&&0!==f?"boolean"==typeof f?f?1:-1:f||1:b.sortNatural(a,c)},sortNaturalDesc:function(a,c,d,e){if(a===c)return 0;var f=b.string[e.empties[d]||e.emptyTo];return""===a&&0!==f?"boolean"==typeof f?f?-1:1:f||1:""===c&&0!==f?"boolean"==typeof f?f?1:-1:-f||-1:b.sortNatural(c,a)}, +// basic alphabetical sort +sortText:function(a,b){return a>b?1:b>a?-1:0}, +// return text string value by adding up ascii value +// so the text is somewhat sorted when using a digital sort +// this is NOT an alphanumeric sort +getTextValue:function(a,b,c){if(c){ +// make sure the text value is greater than the max numerical value (max) +var d,e=a?a.length:0,f=c+b;for(d=0;e>d;d++)f+=a.charCodeAt(d);return b*f}return 0},sortNumericAsc:function(a,c,d,e,f,g){if(a===c)return 0;var h=b.string[g.empties[f]||g.emptyTo];return""===a&&0!==h?"boolean"==typeof h?h?-1:1:-h||-1:""===c&&0!==h?"boolean"==typeof h?h?1:-1:h||1:(isNaN(a)&&(a=b.getTextValue(a,d,e)),isNaN(c)&&(c=b.getTextValue(c,d,e)),a-c)},sortNumericDesc:function(a,c,d,e,f,g){if(a===c)return 0;var h=b.string[g.empties[f]||g.emptyTo];return""===a&&0!==h?"boolean"==typeof h?h?-1:1:h||1:""===c&&0!==h?"boolean"==typeof h?h?1:-1:-h||-1:(isNaN(a)&&(a=b.getTextValue(a,d,e)),isNaN(c)&&(c=b.getTextValue(c,d,e)),c-a)},sortNumeric:function(a,b){return a-b},/* + ██ ██ ██ ██ █████▄ ▄████▄ ██████ ██████ ▄█████ + ██ ██ ██ ██ ██ ██ ██ ▄▄▄ ██▄▄ ██ ▀█▄ + ██ ██ ██ ██ ██ ██ ██ ▀██ ██▀▀ ██ ▀█▄ + ███████▀ ██ █████▀ ▀████▀ ██████ ██ █████▀ + */ +addWidget:function(a){b.widgets.push(a)},hasWidget:function(b,c){return b=a(b),b.length&&b[0].config&&b[0].config.widgetInit[c]||!1},getWidgetById:function(a){var c,d,e=b.widgets.length;for(c=0;e>c;c++)if(d=b.widgets[c],d&&d.id&&d.id.toLowerCase()===a.toLowerCase())return d},applyWidgetOptions:function(c){var d,e,f=c.config,g=f.widgets.length;if(g)for(d=0;g>d;d++)e=b.getWidgetById(f.widgets[d]),e&&e.options&&(f.widgetOptions=a.extend(!0,{},e.options,f.widgetOptions))},addWidgetFromClass:function(a){var c,d,e=a.config, +// look for widgets to apply from table class +// stop using \b otherwise this matches 'ui-widget-content' & adds 'content' widget +f="\\s"+e.widgetClass.replace(b.regex.templateName,"([\\w-]+)")+"\\s",g=new RegExp(f,"g"), +// extract out the widget id from the table class (widget id's can include dashes) +h=(" "+e.table.className+" ").match(g);if(h)for(c=h.length,d=0;c>d;d++)e.widgets.push(h[d].replace(g,"$1"))},applyWidget:function(c,d,e){c=a(c)[0];// in case this is called externally +var f,g,h,i,j,k,l,m,n=c.config,o=[]; +// prevent numerous consecutive widget applications +if(d===!1||!c.hasInitialized||!c.isApplyingWidgets&&!c.isUpdating){if(n.debug&&(l=new Date),b.addWidgetFromClass(c),n.widgets.length){ +// build widget array & add priority as needed +for(c.isApplyingWidgets=!0, +// ensure unique widget ids +n.widgets=a.grep(n.widgets,function(b,c){return a.inArray(b,n.widgets)===c}),h=n.widgets||[],g=h.length,f=0;g>f;f++)i=b.getWidgetById(h[f]),i&&i.id&&(i.priority||(i.priority=10),o[f]=i);for( +// sort widgets by priority +o.sort(function(a,b){return a.priorityf;f++)i=o[f],i&&(j=i.id,k=!1,n.debug&&(m=new Date),(d||!n.widgetInit[j])&&(n.widgetInit[j]=!0,c.hasInitialized&&b.applyWidgetOptions(c),"function"==typeof i.init&&(k=!0,n.debug&&console[console.group?"group":"log"]("Initializing "+j+" widget"),i.init(c,i,c.config,c.config.widgetOptions))),d||"function"!=typeof i.format||(k=!0,n.debug&&console[console.group?"group":"log"]("Updating "+j+" widget"),i.format(c,c.config,c.config.widgetOptions,!1)),n.debug&&k&&(console.log("Completed "+(d?"initializing ":"applying ")+j+" widget"+b.benchmark(m)),console.groupEnd&&console.groupEnd()));n.debug&&console.groupEnd&&console.groupEnd(), +// callback executed on init only +d||"function"!=typeof e||e(c)}setTimeout(function(){c.isApplyingWidgets=!1,a.data(c,"lastWidgetApplication",new Date),n.$table.trigger("tablesorter-ready")},0),n.debug&&(i=n.widgets.length,console.log("Completed "+(d===!0?"initializing ":"applying ")+i+" widget"+(1!==i?"s":"")+b.benchmark(l)))}},removeWidget:function(c,d,e){c=a(c)[0];var f,g,h,i,j=c.config; +// if name === true, add all widgets from $.tablesorter.widgets +if(d===!0)for(d=[],i=b.widgets.length,h=0;i>h;h++)g=b.widgets[h],g&&g.id&&d.push(g.id);else +// name can be either an array of widgets names, +// or a space/comma separated list of widget names +d=(a.isArray(d)?d.join(","):d||"").toLowerCase().split(/[\s,]+/);for(i=d.length,f=0;i>f;f++)g=b.getWidgetById(d[f]),h=a.inArray(d[f],j.widgets),g&&g.remove&&(j.debug&&console.log((e?"Refreshing":"Removing")+' "'+d[f]+'" widget'),g.remove(c,j,j.widgetOptions,e),j.widgetInit[d[f]]=!1),h>=0&&e!==!0&&j.widgets.splice(h,1)},refreshWidgets:function(c,d,e){c=a(c)[0];// see issue #243 +var f,g,h=c.config,i=h.widgets,j=b.widgets,k=j.length,l=[],m=function(b){a(b).trigger("refreshComplete")}; +// remove widgets not defined in config.widgets, unless doAll is true +for(f=0;k>f;f++)g=j[f],g&&g.id&&(d||a.inArray(g.id,i)<0)&&l.push(g.id);b.removeWidget(c,l.join(","),!0),e!==!0?( +// call widget init if +b.applyWidget(c,d||!1,m),d&& +// apply widget format +b.applyWidget(c,!1,m)):m(c)},/* + ██ ██ ██████ ██ ██ ██ ██████ ██ ██████ ▄█████ + ██ ██ ██ ██ ██ ██ ██ ██ ██▄▄ ▀█▄ + ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀█▄ + ▀████▀ ██ ██ ██████ ██ ██ ██ ██████ █████▀ + */ +benchmark:function(a){return" ( "+((new Date).getTime()-a.getTime())+"ms )"}, +// deprecated ts.log +log:function(){console.log(arguments)}, +// $.isEmptyObject from jQuery v1.4 +isEmptyObject:function(a){/*jshint forin: false */ +for(var b in a)return!1;return!0},isValueInArray:function(a,b){var c,d=b&&b.length||0;for(c=0;d>c;c++)if(b[c][0]===a)return c;return-1},formatFloat:function(c,d){if("string"!=typeof c||""===c)return c; +// allow using formatFloat without a table; defaults to US number format +var e,f=d&&d.config?d.config.usNumberFormat!==!1:"undefined"!=typeof d?d:!0; +// return the text instead of zero +// US Format - 1,234,567.89 -> 1234567.89 +// make (#) into a negative number -> (10) = -10 +return c=f?c.replace(b.regex.comma,""):c.replace(b.regex.digitNonUS,"").replace(b.regex.comma,"."),b.regex.digitNegativeTest.test(c)&&(c=c.replace(b.regex.digitNegativeReplace,"-$1")),e=parseFloat(c),isNaN(e)?a.trim(c):e},isDigit:function(a){ +// replace all unwanted chars and match +return isNaN(a)?b.regex.digitTest.test(a.toString().replace(b.regex.digitReplace,"")):""!==a}, +// computeTableHeaderCellIndexes from: +// http://www.javascripttoolbox.com/lib/table/examples.php +// http://www.javascripttoolbox.com/temp/table_cellindex.html +computeColumnIndex:function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o=[],p=[];for(c=0;ce;e++)for("undefined"==typeof o[e]&&(o[e]=[]),p=o[e],f=n;n+m>f;f++)p[f]="x"}return p.length}, +// automatically add a colgroup with col elements set to a percentage width +fixColumnWidth:function(c){c=a(c)[0];var d,e,f,g,h,i=c.config,j=i.$table.children("colgroup");if( +// remove plugin-added colgroup, in case we need to refresh the widths +j.length&&j.hasClass(b.css.colgroup)&&j.remove(),i.widthFixed&&0===i.$table.children("colgroup").length){for(j=a(''),d=i.$table.width(),f=i.$tbodies.find("tr:first").children(":visible"),g=f.length,h=0;g>h;h++)e=parseInt(f.eq(h).width()/d*1e3,10)/10+"%",j.append(a("").css("width",e));i.$table.prepend(j)}}, +// get sorter, string, empty, etc options for each column from +// jQuery data, metadata, header option or header class name ('sorter-false') +// priority = jQuery data > meta > headers option > header class name +getData:function(b,c,d){var e,f,g="",h=a(b); +// 'data-lockedOrder' is assigned to 'lockedorder'; but 'data-locked-order' is assigned to 'lockedOrder' +// 'data-sort-initial-order' is assigned to 'sortInitialOrder' +// include sorter class name 'sorter-text', etc; now works with 'sorter-my-custom-parser' +return h.length?(e=a.metadata?h.metadata():!1,f=" "+(h.attr("class")||""),"undefined"!=typeof h.data(d)||"undefined"!=typeof h.data(d.toLowerCase())?g+=h.data(d)||h.data(d.toLowerCase()):e&&"undefined"!=typeof e[d]?g+=e[d]:c&&"undefined"!=typeof c[d]?g+=c[d]:" "!==f&&f.match(" "+d+"-")&&(g=f.match(new RegExp("\\s"+d+"-([\\w-]+)"))[1]||""),a.trim(g)):""},getColumnData:function(b,c,d,e,f){if("undefined"!=typeof c&&null!==c){b=a(b)[0];var g,h,i=b.config,j=f||i.$headers, +// c.$headerIndexed is not defined initially +k=i.$headerIndexed&&i.$headerIndexed[d]||j.filter('[data-column="'+d+'"]:last');if(c[d])return e?c[d]:c[j.index(k)];for(h in c)if("string"==typeof h&&(g=k.filter(h).add(k.find(h)),g.length))return c[h]}}, +// *** Process table *** +// add processing indicator +isProcessing:function(c,d,e){c=a(c);var f=c[0].config, +// default to all headers +g=e||c.find("."+b.css.header);d?( +// don't use sortList if custom $ths used +"undefined"!=typeof e&&f.sortList.length>0&&( +// get headers from the sortList +g=g.filter(function(){ +// get data-column from attr to keep compatibility with jQuery 1.2.6 +return this.sortDisabled?!1:b.isValueInArray(parseFloat(a(this).attr("data-column")),f.sortList)>=0})),c.add(g).addClass(b.css.processing+" "+f.cssProcessing)):c.add(g).removeClass(b.css.processing+" "+f.cssProcessing)}, +// detach tbody but save the position +// don't use tbody because there are portions that look for a tbody index (updateCell) +processTbody:function(b,c,d){if(b=a(b)[0],d)return b.isProcessing=!0,c.before(''),a.fn.detach?c.detach():c.remove();var e=a(b).find("colgroup.tablesorter-savemyplace");c.insertAfter(e),e.remove(),b.isProcessing=!1},clearTableBody:function(b){a(b)[0].config.$tbodies.children().detach()}, +// used when replacing accented characters during sorting +characterEquivalents:{a:"áàâãäąå",// áàâãäąå +A:"ÁÀÂÃÄĄÅ",// ÁÀÂÃÄĄÅ +c:"çćč",// çćč +C:"ÇĆČ",// ÇĆČ +e:"éèêëěę",// éèêëěę +E:"ÉÈÊËĚĘ",// ÉÈÊËĚĘ +i:"íìİîïı",// íìİîïı +I:"ÍÌİÎÏ",// ÍÌİÎÏ +o:"óòôõöō",// óòôõöō +O:"ÓÒÔÕÖŌ",// ÓÒÔÕÖŌ +ss:"ß",// ß (s sharp) +SS:"ẞ",// ẞ (Capital sharp s) +u:"úùûüů",// úùûüů +U:"ÚÙÛÜŮ"},replaceAccents:function(a){var c,d="[",e=b.characterEquivalents;if(!b.characterRegex){b.characterRegexArray={};for(c in e)"string"==typeof c&&(d+=e[c],b.characterRegexArray[c]=new RegExp("["+e[c]+"]","g"));b.characterRegex=new RegExp(d+"]")}if(b.characterRegex.test(a))for(c in e)"string"==typeof c&&(a=a.replace(b.characterRegexArray[c],c));return a}, +// restore headers +restoreHeaders:function(c){var d,e,f=a(c)[0].config,g=f.$table.find(f.selectorHeaders),h=g.length; +// don't use c.$headers here in case header cells were swapped +for(d=0;h>d;d++)e=g.eq(d),e.find("."+b.css.headerIn).length&&e.html(f.headerContent[d])},destroy:function(c,d,e){if(c=a(c)[0],c.hasInitialized){ +// remove all widgets +b.removeWidget(c,!0,!1);var f,g=a(c),h=c.config,i=h.debug,j=g.find("thead:first"),k=j.find("tr."+b.css.headerRow).removeClass(b.css.headerRow+" "+h.cssHeaderRow),l=g.find("tfoot:first > tr").children("th, td");d===!1&&a.inArray("uitheme",h.widgets)>=0&&( +// reapply uitheme classes, in case we want to maintain appearance +g.trigger("applyWidgetId",["uitheme"]),g.trigger("applyWidgetId",["zebra"])), +// remove widget added rows, just in case +j.find("tr").not(k).remove(), +// disable tablesorter +f="sortReset update updateRows updateAll updateHeaders updateCell addRows updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress "+"sortBegin sortEnd resetToLoadState ".split(" ").join(h.namespace+" "),g.removeData("tablesorter").unbind(f.replace(b.regex.spaces," ")),h.$headers.add(l).removeClass([b.css.header,h.cssHeader,h.cssAsc,h.cssDesc,b.css.sortAsc,b.css.sortDesc,b.css.sortNone].join(" ")).removeAttr("data-column").removeAttr("aria-label").attr("aria-disabled","true"),k.find(h.selectorSort).unbind("mousedown mouseup keypress ".split(" ").join(h.namespace+" ").replace(b.regex.spaces," ")),b.restoreHeaders(c),g.toggleClass(b.css.table+" "+h.tableClass+" tablesorter-"+h.theme,d===!1), +// clear flag in case the plugin is initialized again +c.hasInitialized=!1,delete c.config.cache,"function"==typeof e&&e(c),i&&console.log("tablesorter has been removed")}}};a.fn.tablesorter=function(c){return this.each(function(){var d=this, +// merge & extend config options +e=a.extend(!0,{},b.defaults,c,b.instanceMethods); +// save initial settings +e.originalSettings=c, +// create a table from data (build table widget) +!d.hasInitialized&&b.buildTable&&"TABLE"!==this.nodeName? +// return the table (in case the original target is the table's container) +b.buildTable(d,e):b.setup(d,e)})}, +// set up debug logs +window.console&&window.console.log||( +// access $.tablesorter.logs for browsers that don't have a console... +b.logs=[],/*jshint -W020 */ +console={},console.log=console.warn=console.error=console.table=function(){var a=arguments.length>1?arguments:arguments[0];b.logs.push({date:Date.now(),log:a})}), +// add default parsers +b.addParser({id:"no-parser",is:function(){return!1},format:function(){return""},type:"text"}),b.addParser({id:"text",is:function(){return!0},format:function(c,d){var e=d.config;return c&&(c=a.trim(e.ignoreCase?c.toLocaleLowerCase():c),c=e.sortLocaleCompare?b.replaceAccents(c):c),c},type:"text"}),b.regex.nondigit=/[^\w,. \-()]/g,b.addParser({id:"digit",is:function(a){return b.isDigit(a)},format:function(c,d){var e=b.formatFloat((c||"").replace(b.regex.nondigit,""),d);return c&&"number"==typeof e?e:c?a.trim(c&&d.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"}),b.regex.currencyReplace=/[+\-,. ]/g,b.regex.currencyTest=/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/,b.addParser({id:"currency",is:function(a){ +// test for £$€¤¥¢ +return a=(a||"").replace(b.regex.currencyReplace,""),b.regex.currencyTest.test(a)},format:function(c,d){var e=b.formatFloat((c||"").replace(b.regex.nondigit,""),d);return c&&"number"==typeof e?e:c?a.trim(c&&d.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"}), +// too many protocols to add them all https://en.wikipedia.org/wiki/URI_scheme +// now, this regex can be updated before initialization +b.regex.urlProtocolTest=/^(https?|ftp|file):\/\//,b.regex.urlProtocolReplace=/(https?|ftp|file):\/\//,b.addParser({id:"url",is:function(a){return b.regex.urlProtocolTest.test(a)},format:function(c){return c?a.trim(c.replace(b.regex.urlProtocolReplace,"")):c},parsed:!0,// filter widget flag +type:"text"}),b.regex.dash=/-/g,b.regex.isoDate=/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/,b.addParser({id:"isoDate",is:function(a){return b.regex.isoDate.test(a)},format:function(a,c){var d=a?new Date(a.replace(b.regex.dash,"/")):a;return d instanceof Date&&isFinite(d)?d.getTime():a},type:"numeric"}),b.regex.percent=/%/g,b.regex.percentTest=/(\d\s*?%|%\s*?\d)/,b.addParser({id:"percent",is:function(a){return b.regex.percentTest.test(a)&&a.length<15},format:function(a,c){return a?b.formatFloat(a.replace(b.regex.percent,""),c):a},type:"numeric"}), +// added image parser to core v2.17.9 +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,// filter widget flag +type:"text"}),b.regex.dateReplace=/(\S)([AP]M)$/i,// used by usLongDate & time parser +b.regex.usLongDateTest1=/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i,b.regex.usLongDateTest2=/^\d{1,2}\s+[A-Z]{3,10}\s+\d{4}/i,b.addParser({id:"usLongDate",is:function(a){ +// two digit years are not allowed cross-browser +// Jan 01, 2013 12:34:56 PM or 01 Jan 2013 +return b.regex.usLongDateTest1.test(a)||b.regex.usLongDateTest2.test(a)},format:function(a,c){var d=a?new Date(a.replace(b.regex.dateReplace,"$1 $2")):a;return d instanceof Date&&isFinite(d)?d.getTime():a},type:"numeric"}), +// testing for ##-##-#### or ####-##-##, so it's not perfect; time can be included +b.regex.shortDateTest=/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/, +// escaped "-" because JSHint in Firefox was showing it as an error +b.regex.shortDateReplace=/[\-.,]/g, +// XXY covers MDY & DMY formats +b.regex.shortDateXXY=/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,b.regex.shortDateYMD=/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,b.addParser({id:"shortDate",// 'mmddyyyy', 'ddmmyyyy' or 'yyyymmdd' +is:function(a){return a=(a||"").replace(b.regex.spaces," ").replace(b.regex.shortDateReplace,"/"),b.regex.shortDateTest.test(a)},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(b.regex.spaces," ").replace(b.regex.shortDateReplace,"/"),"mmddyyyy"===j?g=g.replace(b.regex.shortDateXXY,"$3/$1/$2"):"ddmmyyyy"===j?g=g.replace(b.regex.shortDateXXY,"$3/$2/$1"):"yyyymmdd"===j&&(g=g.replace(b.regex.shortDateYMD,"$1/$2/$3")),f=new Date(g),f instanceof Date&&isFinite(f)?f.getTime():a}return a},type:"numeric"}),b.regex.timeTest=/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i,b.addParser({id:"time",is:function(a){return b.regex.timeTest.test(a)},format:function(a,c){var d=a?new Date("2000/01/01 "+a.replace(b.regex.dateReplace,"$1 $2")):a;return d instanceof Date&&isFinite(d)?d.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"}),/* + ██████ ██████ █████▄ █████▄ ▄████▄ + ▄█▀ ██▄▄ ██▄▄██ ██▄▄██ ██▄▄██ + ▄█▀ ██▀▀ ██▀▀██ ██▀▀█ ██▀▀██ + ██████ ██████ █████▀ ██ ██ ██ ██ + */ +// add default widgets +b.addWidget({id:"zebra",priority:90,format:function(b,c,d){var e,f,g,h,i,j,k,l=new RegExp(c.cssChildRow,"i"),m=c.$tbodies.add(a(c.namespace+"_extra_table").children("tbody:not(."+c.cssInfoBlock+")"));for(i=0;ij;j++)f=e.eq(j),l.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
    ')}),d.cssIcon&&t.find("."+b.css.icon).removeClass(q?[n.icons,p].join(" "):"").addClass(v.icons||""),s.hasClass("hasFilters")&&s.children("thead").children("."+b.css.filterRow).removeClass(q?n.filterRow||"":"").addClass(v.filterRow||"")),f=0;f1)))for(m=1;q>m;m++)k.eq(p[m][0]).addClass(r[m]||r[s])}),b.processTbody(c,f,!1);if(i=e.columns_thead!==!1?["thead tr"]:[],e.columns_tfoot!==!1&&i.push("tfoot tr"),i.length&&(h=n.find(i.join(",")).children().removeClass(l),q))for(m=0;q>m;m++)h.filter('[data-column="'+p[m][0]+'"]').addClass(r[m]||r[s])},remove:function(c,d,e){var f,g,h=d.$tbodies,i=(e.columns||["primary","secondary","tertiary"]).join(" ");for(d.$headers.removeClass(i),d.$table.children("tfoot").children("tr").children("th, td").removeClass(i),f=0;f=]/g,query:"(q|query)",wild01:/\?/g,wild0More:/\*/g,quote:/\"/g,isNeg1:/(>=?\s*-\d)/,isNeg2:/(<=?\s*\d)/},types:{or:function(c,d,e){if(b.regex.orTest.test(d.iFilter)||b.regex.orSplit.test(d.filter)){var f,g,h,i,j=a.extend({},d),k=d.index,l=d.parsed[k],m=d.filter.split(b.regex.orSplit),n=d.iFilter.split(b.regex.orSplit),o=m.length;for(f=0;o>f;f++){j.nestedFilters=!0,j.filter=""+(b.parseFilter(c,m[f],k,l)||""),j.iFilter=""+(b.parseFilter(c,n[f],k,l)||""),h="("+(b.parseFilter(c,j.filter,k,l)||"")+")";try{if(i=new RegExp(d.isMatch?h:"^"+h+"$",c.widgetOptions.filter_ignoreCase?"i":""),g=i.test(j.exact)||b.processTypes(c,j,e))return g}catch(p){return null}}return g||!1}return null},and:function(c,d,e){if(b.regex.andTest.test(d.filter)){var f,g,h,i,j,k=a.extend({},d),l=d.index,m=d.parsed[l],n=d.filter.split(b.regex.andSplit),o=d.iFilter.split(b.regex.andSplit),p=n.length;for(f=0;p>f;f++){k.nestedFilters=!0,k.filter=""+(b.parseFilter(c,n[f],l,m)||""),k.iFilter=""+(b.parseFilter(c,o[f],l,m)||""),i=("("+(b.parseFilter(c,k.filter,l,m)||"")+")").replace(b.regex.wild01,"\\S{1}").replace(b.regex.wild0More,"\\S*");try{j=new RegExp(d.isMatch?i:"^"+i+"$",c.widgetOptions.filter_ignoreCase?"i":""),h=j.test(k.exact)||b.processTypes(c,k,e),g=0===f?h:g&&h}catch(q){return null}}return g||!1}return null},regex:function(a,c){if(b.regex.regex.test(c.filter)){var d,e=c.filter_regexCache[c.index]||b.regex.regex.exec(c.filter),f=e instanceof RegExp;try{f||(c.filter_regexCache[c.index]=e=new RegExp(e[1],e[2])),d=e.test(c.exact)}catch(g){d=!1}return d}return null},operators:function(d,e){if(b.regex.operTest.test(e.iFilter)&&""!==e.iExact){var f,g,h,i=d.table,j=e.index,k=e.parsed[j],l=c.formatFloat(e.iFilter.replace(b.regex.operators,""),i),m=d.parsers[j],n=l;return(k||"numeric"===m.type)&&(h=a.trim(""+e.iFilter.replace(b.regex.operators,"")),g=b.parseFilter(d,h,j,!0),l="number"!=typeof g||""===g||isNaN(g)?l:g),!k&&"numeric"!==m.type||isNaN(l)||"undefined"==typeof e.cache?(h=isNaN(e.iExact)?e.iExact.replace(c.regex.nondigit,""):e.iExact,f=c.formatFloat(h,i)):f=e.cache,b.regex.gtTest.test(e.iFilter)?g=b.regex.gteTest.test(e.iFilter)?f>=l:f>l:b.regex.ltTest.test(e.iFilter)&&(g=b.regex.lteTest.test(e.iFilter)?l>=f:l>f),g||""!==n||(g=!0),g}return null},notMatch:function(c,d){if(b.regex.notTest.test(d.iFilter)){var e,f=d.iFilter.replace("!",""),g=b.parseFilter(c,f,d.index,d.parsed[d.index])||"";return b.regex.exact.test(g)?(g=g.replace(b.regex.exact,""),""===g?!0:a.trim(g)!==d.iExact):(e=d.iExact.search(a.trim(g)),""===g?!0:!(c.widgetOptions.filter_startsWith?0===e:e>=0))}return null},exact:function(c,d){if(b.regex.exact.test(d.iFilter)){var e=d.iFilter.replace(b.regex.exact,""),f=b.parseFilter(c,e,d.index,d.parsed[d.index])||"";return d.anyMatch?a.inArray(f,d.rowArray)>=0:f==d.iExact}return null},range:function(a,d){if(b.regex.toTest.test(d.iFilter)){var e,f,g,h,i=a.table,j=d.index,k=d.parsed[j],l=d.iFilter.split(b.regex.toSplit);return f=l[0].replace(c.regex.nondigit,"")||"",g=c.formatFloat(b.parseFilter(a,f,j,k),i),f=l[1].replace(c.regex.nondigit,"")||"",h=c.formatFloat(b.parseFilter(a,f,j,k),i),(k||"numeric"===a.parsers[j].type)&&(e=a.parsers[j].format(""+l[0],i,a.$headers.eq(j),j),g=""===e||isNaN(e)?g:e,e=a.parsers[j].format(""+l[1],i,a.$headers.eq(j),j),h=""===e||isNaN(e)?h:e),!k&&"numeric"!==a.parsers[j].type||isNaN(g)||isNaN(h)?(f=isNaN(d.iExact)?d.iExact.replace(c.regex.nondigit,""):d.iExact,e=c.formatFloat(f,i)):e=d.cache,g>h&&(f=g,g=h,h=f),e>=g&&h>=e||""===g||""===h}return null},wild:function(a,c){if(b.regex.wildOrTest.test(c.iFilter)){var d=c.index,e=c.parsed[d],f=""+(b.parseFilter(a,c.iFilter,d,e)||"");!b.regex.wildTest.test(f)&&c.nestedFilters&&(f=c.isMatch?f:"^("+f+")$");try{return new RegExp(f.replace(b.regex.wild01,"\\S{1}").replace(b.regex.wild0More,"\\S*"),a.widgetOptions.filter_ignoreCase?"i":"").test(c.exact)}catch(g){return null}}return null},fuzzy:function(a,c){if(b.regex.fuzzyTest.test(c.iFilter)){var d,e=0,f=c.iExact.length,g=c.iFilter.slice(1),h=b.parseFilter(a,g,c.index,c.parsed[c.index])||"";for(d=0;f>d;d++)c.iExact[d]===h[e]&&(e+=1);return e===h.length?!0:!1}return null}},init:function(e,f,g){c.language=a.extend(!0,{},{to:"to",or:"or",and:"and"},c.language);var h,i,j,k,l,m,n,o,p,q=b.regex;if(f.$table.addClass("hasFilters"),g.filter_searchTimer=null,g.filter_initTimer=null,g.filter_formatterCount=0,g.filter_formatterInit=[],g.filter_anyColumnSelector='[data-column="all"],[data-column="any"]',g.filter_multipleColumnSelector='[data-column*="-"],[data-column*=","]',n="\\{"+b.regex.query+"\\}",a.extend(q,{child:new RegExp(f.cssChildRow),filtered:new RegExp(g.filter_filteredRow),alreadyFiltered:new RegExp("(\\s+("+c.language.or+"|-|"+c.language.to+")\\s+)","i"),toTest:new RegExp("\\s+(-|"+c.language.to+")\\s+","i"),toSplit:new RegExp("(?:\\s+(?:-|"+c.language.to+")\\s+)","gi"),andTest:new RegExp("\\s+("+c.language.and+"|&&)\\s+","i"),andSplit:new RegExp("(?:\\s+(?:"+c.language.and+"|&&)\\s+)","gi"),orTest:/\|/,orSplit:new RegExp("(?:\\s+(?:"+c.language.or+")\\s+|\\|)","gi"),iQuery:new RegExp(n,"i"),igQuery:new RegExp(n,"ig"),operTest:/^[<>]=?/,gtTest:/>/,gteTest:/>=/,ltTest:/'+(k.data("placeholder")||k.attr("data-placeholder")||g.filter_placeholder.select||"")+"":"",n=i,j=i,i.indexOf(g.filter_selectSourceSeparator)>=0&&(n=i.split(g.filter_selectSourceSeparator),j=n[1],n=n[0]),h+="");f.$table.find("thead").find("select."+d.filter+'[data-column="'+l+'"]').append(h),j=g.filter_selectSource,o="function"==typeof j?!0:c.getColumnData(e,j,l),o&&b.buildSelect(f.table,l,"",!0,k.hasClass(g.filter_onlyAvail))}b.buildDefault(e,!0),b.bindSearch(e,f.$table.find("."+d.filter),!0),g.filter_external&&b.bindSearch(e,g.filter_external),g.filter_hideFilters&&b.hideFilters(f),f.showProcessing&&(j="filterStart filterEnd ".split(" ").join(f.namespace+"filter "),f.$table.unbind(j.replace(c.regex.spaces," ")).bind(j,function(b,g){k=g?f.$table.find("."+d.header).filter("[data-column]").filter(function(){return""!==g[a(this).data("column")]}):"",c.isProcessing(e,"filterStart"===b.type,g?k:"")})),f.filteredRows=f.totalRows,j="tablesorter-initialized pagerBeforeInitialized ".split(" ").join(f.namespace+"filter "),f.$table.unbind(j.replace(c.regex.spaces," ")).bind(j,function(){var a=this.config.widgetOptions;m=b.setDefaults(e,f,a)||[],m.length&&(f.delayInit&&""===m.join("")||c.setFilters(e,m,!0)),f.$table.trigger("filterFomatterUpdate"),setTimeout(function(){a.filter_initialized||b.filterInitComplete(f)},100)}),f.pager&&f.pager.initialized&&!g.filter_initialized&&(f.$table.trigger("filterFomatterUpdate"),setTimeout(function(){b.filterInitComplete(f)},100))},formatterUpdated:function(a,b){var c=a&&a.closest("table")[0].config.widgetOptions;c&&!c.filter_initialized&&(c.filter_formatterInit[b]=1)},filterInitComplete:function(c){var d,e,f=c.widgetOptions,g=0,h=function(){f.filter_initialized=!0,c.$table.trigger("filterInit",c),b.findRows(c.table,c.$table.data("lastSearch")||[])};if(a.isEmptyObject(f.filter_formatter))h();else{for(e=f.filter_formatterInit.length,d=0;e>d;d++)1===f.filter_formatterInit[d]&&g++;clearTimeout(f.filter_initTimer),f.filter_initialized||g!==f.filter_formatterCount?f.filter_initialized||(f.filter_initTimer=setTimeout(function(){h()},500)):h()}},processFilters:function(a,b){var c,d=b?encodeURIComponent:decodeURIComponent,e=a.length;for(c=0;e>c;c++)a[c]=d(a[c]);return a},setDefaults:function(d,e,f){var g,h,i,j,k,l=c.getFilters(d)||[];if(f.filter_saveFilters&&c.storage&&(h=c.storage(d,"tablesorter-filters")||[],g=a.isArray(h),g&&""===h.join("")||!g||(l=b.processFilters(h))),""===l.join(""))for(k=e.$headers.add(f.filter_$externalFilters).filter("["+f.filter_defaultAttrib+"]"),i=0;i<=e.columns;i++)j=i===e.columns?"all":i,l[i]=k.filter('[data-column="'+j+'"]').attr(f.filter_defaultAttrib)||l[i]||"";return e.$table.data("lastSearch",l),l},parseFilter:function(a,b,c,d){return d?a.parsers[c].format(b,a.table,[],c):b},buildRow:function(b,e,f){var g,h,i,j,k,l,m,n,o,p=f.filter_cellFilter,q=e.columns,r=a.isArray(p),s='';for(i=0;q>i;i++)e.$headerIndexed[i].length&&(s+='1&&(s+=' colspan="'+o+'"'),s+=r?p[i]?' class="'+p[i]+'"':"":""!==p?' class="'+p+'"':"",s+=">");for(e.$filters=a(s+="").appendTo(e.$table.children("thead").eq(0)).children("td"),i=0;q>i;i++)l=!1,j=e.$headerIndexed[i],j&&j.length&&(g=e.$filters.filter('[data-column="'+i+'"]'),n=c.getColumnData(b,f.filter_functions,i),k=f.filter_functions&&n&&"function"!=typeof n||j.hasClass("filter-select"),h=c.getColumnData(b,e.headers,i),l="false"===c.getData(j[0],h,"filter")||"false"===c.getData(j[0],h,"parser"),k?s=a("').appendTo(g),s&&(o=j.data("placeholder")||j.attr("data-placeholder")||f.filter_placeholder.search||"",s.attr("placeholder",o))),s&&(m=(a.isArray(f.filter_cssFilter)?"undefined"!=typeof f.filter_cssFilter[i]?f.filter_cssFilter[i]||"":"":f.filter_cssFilter)||"",s.addClass(d.filter+" "+m).attr("data-column",i),l&&(s.attr("placeholder","").addClass(d.filterDisabled)[0].disabled=!0)))},bindSearch:function(d,e,f){if(d=a(d)[0],e=a(e),e.length){var g,h=d.config,i=h.widgetOptions,j=h.namespace+"filter",k=i.filter_$externalFilters;f!==!0&&(g=i.filter_anyColumnSelector+","+i.filter_multipleColumnSelector,i.filter_$anyMatch=e.filter(g),k&&k.length?i.filter_$externalFilters=i.filter_$externalFilters.add(e):i.filter_$externalFilters=e,c.setFilters(d,h.$table.data("lastSearch")||[],f===!1)),g="keypress keyup search change ".split(" ").join(j+" "),e.attr("data-lastSearchTime",(new Date).getTime()).unbind(g.replace(c.regex.spaces," ")).bind("keyup"+j,function(c){if(a(this).attr("data-lastSearchTime",(new Date).getTime()),27===c.which)this.value="";else{if(i.filter_liveSearch===!1)return;if(""!==this.value&&("number"==typeof i.filter_liveSearch&&this.value.length=37&&c.which<=40)))return}b.searching(d,!0,!0)}).bind("search change keypress ".split(" ").join(j+" "),function(c){var e=parseInt(a(this).attr("data-column"),10);i.filter_initialized&&(13===c.which||"search"===c.type||"change"===c.type&&this.value!==h.lastSearch[e])&&(c.preventDefault(),a(this).attr("data-lastSearchTime",(new Date).getTime()),b.searching(d,!1,!0))})}},searching:function(a,c,d){var e=a.config.widgetOptions;clearTimeout(e.filter_searchTimer),"undefined"==typeof c||c===!0?e.filter_searchTimer=setTimeout(function(){b.checkFilters(a,c,d)},e.filter_liveSearch?e.filter_searchDelay:10):b.checkFilters(a,c,d)},checkFilters:function(e,f,g){var h=e.config,i=h.widgetOptions,j=a.isArray(f),k=j?f:c.getFilters(e,!0),l=(k||[]).join("");return a.isEmptyObject(h.cache)?void(h.delayInit&&h.pager&&h.pager.initialized&&c.updateCache(h,function(){b.checkFilters(e,!1,g)})):(j&&(c.setFilters(e,k,!1,g!==!0),i.filter_initialized||(h.lastCombinedFilter="")),i.filter_hideFilters&&h.$table.find("."+d.filterRow).trigger(""===l?"mouseleave":"mouseenter"),h.lastCombinedFilter!==l||f===!1?(f===!1&&(h.lastCombinedFilter=null,h.lastSearch=[]),i.filter_initialized&&h.$table.trigger("filterStart",[k]),h.showProcessing?void setTimeout(function(){return b.findRows(e,k,l),!1},30):(b.findRows(e,k,l),!1)):void 0)},hideFilters:function(b,e){var f,g=(e||b.$table).find("."+d.filterRow).addClass(d.filterRowHide);g.bind("mouseenter mouseleave",function(c){var e=c,g=a(this);clearTimeout(f),f=setTimeout(function(){/enter|over/.test(e.type)?g.removeClass(d.filterRowHide):a(document.activeElement).closest("tr")[0]!==g[0]&&""===b.lastCombinedFilter&&g.addClass(d.filterRowHide)},200)}).find("input, select").bind("focus blur",function(e){var g=e,h=a(this).closest("tr");clearTimeout(f),f=setTimeout(function(){clearTimeout(f),""===c.getFilters(b.$table).join("")&&h.toggleClass(d.filterRowHide,"focus"!==g.type)},200)})},defaultFilter:function(c,d){if(""===c)return c;var e=b.regex.iQuery,f=d.match(b.regex.igQuery).length,g=f>1?a.trim(c).split(/\s/):[a.trim(c)],h=g.length-1,i=0,j=d;for(1>h&&f>1&&(g[1]=g[0]);e.test(j);)j=j.replace(e,g[i++]||""),e.test(j)&&h>i&&""!==(g[i]||"")&&(j=d.replace(e,j));return j},getLatestSearch:function(b){return b?b.sort(function(b,c){return a(c).attr("data-lastSearchTime")-a(b).attr("data-lastSearchTime")}):b||a()},multipleColumns:function(c,d){var e,f,g,h,i,j,k,l,m,n=c.widgetOptions,o=n.filter_initialized||!d.filter(n.filter_anyColumnSelector).length,p=[],q=a.trim(b.getLatestSearch(d).attr("data-column")||"");if(/^[0-9]+$/.test(q))return parseInt(q,10);if(o&&/-/.test(q))for(f=q.match(/(\d+)\s*-\s*(\d+)/g),m=f.length,l=0;m>l;l++){for(g=f[l].split(/\s*-\s*/),h=parseInt(g[0],10)||0,i=parseInt(g[1],10)||c.columns-1,h>i&&(e=h,h=i,i=e),i>=c.columns&&(i=c.columns-1);i>=h;h++)p.push(h);q=q.replace(f[l],"")}if(o&&/,/.test(q))for(j=q.split(/\s*,\s*/),m=j.length,k=0;m>k;k++)""!==j[k]&&(l=parseInt(j[k],10),l1){if(e.anyMatch=!0,e.isMatch=!0,e.rowArray=e.$cells.map(function(b){return a.inArray(b,q)>-1?(e.parsed[b]?m=e.cacheArray[b]:(m=e.rawArray[b],m=a.trim(o.filter_ignoreCase?m.toLowerCase():m),d.sortLocaleCompare&&(m=c.replaceAccents(m))),m):void 0}).get(),e.filter=e.anyMatchFilter,e.iFilter=e.iAnyMatchFilter,e.exact=e.rowArray.join(" "),e.iExact=o.filter_ignoreCase?e.exact.toLowerCase():e.exact,e.cache=e.cacheArray.slice(0,-1).join(" "),f.excludeMatch=f.noAnyMatch,j=b.processTypes(d,e,f),null!==j)p=j;else if(o.filter_startsWith)for(p=!1,q=Math.min(d.columns,e.rowArray.length);!p&&q>0;)q--,p=p||0===e.rowArray[q].indexOf(e.iFilter);else p=(e.iExact+e.childRowText).indexOf(e.iFilter)>=0;if(e.anyMatch=!1,e.filters.join("")===e.filter)return p}for(q=0;q=0:e.filter===e.exact:"function"==typeof k?j=k(e.exact,e.cache,e.filter,q,e.$row,d,e):"function"==typeof k[l||e.filter]&&(m=l||e.filter,j=k[m](e.exact,e.cache,e.filter,q,e.$row,d,e))),null===j?(j=b.processTypes(d,e,f),null!==j?h=j:(m=(e.iExact+e.childRowText).indexOf(b.parseFilter(d,e.iFilter,q,e.parsed[q])),h=!o.filter_startsWith&&m>=0||o.filter_startsWith&&0===m)):h=j,p=h?p:!1);return p},findRows:function(d,e,f){if(d.config.lastCombinedFilter!==f&&d.config.widgetOptions.filter_initialized){var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E=a.extend([],e),F=b.regex,G=d.config,H=G.widgetOptions,I={anyMatch:!1,filters:e,filter_regexCache:[]},J={noAnyMatch:["range","notMatch","operators"],functions:[],excludeFilter:[],defaultColFilter:[],defaultAnyFilter:c.getColumnData(d,H.filter_defaultFilter,G.columns,!0)||""};for(I.parsed=G.$headers.map(function(b){return G.parsers&&G.parsers[b]&&G.parsers[b].parsed||c.getData&&"parsed"===c.getData(G.$headerIndexed[b],c.getColumnData(d,G.headers,b),"filter")||a(this).hasClass("filter-parsed")}).get(),o=0;o1&&(C=parseInt(B[0],10)-1,C>=0&&Cw;w++)v=e[w]||"",y||(w=o),y=y&&r.length&&0===v.indexOf(r[w]||"")&&!F.alreadyFiltered.test(v)&&!F.exactTest.test(v)&&!(F.isNeg1.test(v)||F.isNeg2.test(v))&&!(""!==v&&G.$filters&&G.$filters.filter('[data-column="'+w+'"]').find("select").length&&!G.$headerIndexed[w].hasClass("filter-match"));for(x=j.not("."+H.filter_filteredRow).length,y&&0===x&&(y=!1),G.debug&&console.log("Filter: Searching through "+(y&&g>x?x:"all")+" rows"),I.anyMatchFlag&&(G.sortLocaleCompare&&(I.anyMatchFilter=c.replaceAccents(I.anyMatchFilter)),H.filter_defaultFilter&&F.iQuery.test(J.defaultAnyFilter)&&(I.anyMatchFilter=b.defaultFilter(I.anyMatchFilter,J.defaultAnyFilter),y=!1),I.iAnyMatchFilter=H.filter_ignoreCase&&G.ignoreCase?I.anyMatchFilter.toLowerCase():I.anyMatchFilter),l=0;g>l;l++)if(D=j[l].className,p=l&&F.child.test(D),!(p||y&&F.filtered.test(D))){if(I.$row=j.eq(l),I.cacheArray=h[l],i=I.cacheArray[G.columns],I.rawArray=i.raw,I.childRowText="",!H.filter_childByColumn){for(D="",q=i.child,w=0;w")>=0)return l;a.isArray(l)?i=l:"object"===a.type(j)&&l&&(i=l(d,e,f))}return i===!1&&(i=b.getOptions(d,e,f)),b.processOptions(d,e,i)},processOptions:function(b,d,e){if(!a.isArray(e))return!1;b=a(b)[0];var f,g,h,i,j=b.config,k="undefined"!=typeof d&&null!==d&&d>=0&&dh;h++)g=e[h],l.push({t:g,p:k&&j.parsers&&j.parsers.length&&j.parsers[d].format(g,b,[],d)||g});for(f=j.textSorter||"",l.sort(function(a,e){var g=a.p.toString(),h=e.p.toString();return k&&"function"==typeof f?f(g,h,!0,d,b):k&&"object"==typeof f&&f.hasOwnProperty(d)?f[d](g,h,!0,d,b):c.sortNatural?c.sortNatural(g,h):!0}),e=[],i=l.length,h=0;i>h;h++)e.push(l[h].t);return e},getOptions:function(b,d,e){b=a(b)[0];var f,g,h,i,j,k,l,m,n=b.config,o=n.widgetOptions,p=[];for(g=0;gf;f++)if(i=j.row?j.row[f]:j.normalized[f][n.columns].$row[0],!e||!i.className.match(o.filter_filteredRow))if(o.filter_useParsedData||n.parsers[d].parsed||n.$headerIndexed[d].hasClass("filter-parsed")){if(p.push(""+j.normalized[f][d]),o.filter_childRows&&o.filter_childByColumn)for(m=j.normalized[f][n.columns].$row.length-1,k=0;m>k;k++)p.push(""+j.normalized[f][n.columns].child[k][d])}else if(p.push(j.normalized[f][n.columns].raw[d]),o.filter_childRows&&o.filter_childByColumn)for(m=j.normalized[f][n.columns].$row.length,k=1;m>k;k++)l=j.normalized[f][n.columns].$row.eq(k).children().eq(d),p.push(""+c.getElementText(n,l,d));return p},buildSelect:function(c,e,f,g,h){if(c=a(c)[0],e=parseInt(e,10),c.config.cache&&!a.isEmptyObject(c.config.cache)){var i,j,k,l,m,n,o=c.config,p=o.widgetOptions,q=o.$headerIndexed[e],r='",s=o.$table.find("thead").find("select."+d.filter+'[data-column="'+e+'"]').val();if(("undefined"==typeof f||""===f)&&(f=b.getOptionSource(c,e,h)),a.isArray(f)){for(i=0;i=0&&(l=k.split(p.filter_selectSourceSeparator), -j=l[0],k=l[1]),r+=""!==f[i]?"":"";f=[]}m=(o.$filters?o.$filters:o.$table.children("thead")).find("."+d.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,d){var e,f,g,h=a.config,i=h.widgetOptions,j=h.columns;for(e=0;j>e;e++)f=h.$headerIndexed[e],g=!(f.hasClass("filter-false")||f.hasClass("parser-false")),(f.hasClass("filter-select")||c.getColumnData(a,i.filter_functions,e)===!0)&&g&&b.buildSelect(a,e,"",d,f.hasClass(i.filter_onlyAvail))}},c.getFilters=function(c,e,f,g){var h,i,j,k,l=!1,m=c?a(c)[0].config:"",n=m?m.widgetOptions:"";if(e!==!0&&n&&!n.filter_columnFilters||a.isArray(f)&&f.join("")===m.lastCombinedFilter)return a(c).data("lastSearch");if(m&&(m.$filters&&(i=m.$filters.find("."+d.filter)),n.filter_$externalFilters&&(i=i&&i.length?i.add(n.filter_$externalFilters):n.filter_$externalFilters),i&&i.length))for(l=f||[],h=0;h1&&(j=j.slice(1)),h===m.columns&&(k=j.filter(n.filter_anyColumnSelector),j=k.length?k:j),j.val(f[h]).trigger("change"+m.namespace)):(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},c.setFilters=function(d,e,f,g){var h=d?a(d)[0].config:"",i=c.getFilters(d,!0,e,g);return h&&f&&(h.lastCombinedFilter=null,h.lastSearch=[],b.searching(h.table,e,g),h.$table.trigger("filterFomatterUpdate")),!!i}}(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!==e[1])&&(d.data("savedSizes",[f,i]),c.push(d[0]));c.length&&a!==!1&&g.$table.trigger("resize",[c]),h.resize_flag=!1};return i(!1),clearInterval(h.resize_timer),c?(h.resize_flag=!1,!1):void(h.resize_timer=setInterval(function(){h.resize_flag||i()},f.timer))}},c.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,e,f){if(!(e.$table.hasClass("hasStickyHeaders")||a.inArray("filter",e.widgets)>=0&&!e.$table.hasClass("hasFilters"))){var g,h,i,j,k=e.$table,l=a(f.stickyHeaders_attachTo),m=e.namespace+"stickyheaders ",n=a(f.stickyHeaders_yScroll||f.stickyHeaders_attachTo||b),o=a(f.stickyHeaders_xScroll||f.stickyHeaders_attachTo||b),p=k.children("thead:first"),q=p.children("tr").not(".sticky-false").children(),r=k.children("tfoot"),s=isNaN(f.stickyHeaders_offset)?a(f.stickyHeaders_offset):"",t=s.length?s.height()||0:parseInt(f.stickyHeaders_offset,10)||0,u=k.parent().closest("."+c.css.table).hasClass("hasStickyHeaders")?k.parent().closest("table.tablesorter")[0].config.widgetOptions.$sticky.parent():[],v=u.length?u.height():0,w=f.$sticky=k.clone().addClass("containsStickyHeaders "+c.css.sticky+" "+f.stickyHeaders+" "+e.namespace.slice(1)+"_extra_table").wrap('
    '),x=w.parent().addClass(c.css.stickyHide).css({position:l.length?"absolute":"fixed",padding:parseInt(w.parent().parent().css("padding-left"),10),top:t+v,left:0,visibility:"hidden",zIndex:f.stickyHeaders_zIndex||2}),y=w.children("thead:first"),z="",A=0,B=function(a,c){var d,e,f,g,h,i=a.filter(":visible"),j=i.length;for(d=0;j>d;d++)g=c.filter(":visible").eq(d),h=i.eq(d),"border-box"===h.css("box-sizing")?e=h.outerWidth():"collapse"===g.css("border-collapse")?b.getComputedStyle?e=parseFloat(b.getComputedStyle(h[0],null).width):(f=parseFloat(h.css("border-width")),e=h.outerWidth()-parseFloat(h.css("padding-left"))-parseFloat(h.css("padding-right"))-f):e=h.width(),g.css({width:e,"min-width":e,"max-width":e})},C=function(){t=s.length?s.height()||0:parseInt(f.stickyHeaders_offset,10)||0,A=0,x.css({left:l.length?parseInt(l.css("padding-left"),10)||0:k.offset().left-parseInt(k.css("margin-left"),10)-o.scrollLeft()-A,width:k.outerWidth()}),B(k,w),B(q,j)},D=function(b){if(k.is(":visible")){v=u.length?u.offset().top-n.scrollTop()+u.height():0;var d=k.offset(),e=a.isWindow(n[0]),f=a.isWindow(o[0]),g=(l.length?e?n.scrollTop():n.offset().top:n.scrollTop())+t+v,h=k.height()-(x.height()+(r.height()||0)),i=g>d.top&&gg;g++)e.onRenderHeader.apply(i.eq(g),[g,e,w]);o.add(n).unbind("scroll resize ".split(" ").join(m).replace(/\s+/g," ")).bind("scroll resize ".split(" ").join(m),function(a){D("resize"===a.type)}),e.$table.unbind("stickyHeadersUpdate"+m).bind("stickyHeadersUpdate"+m,function(){D(!0)}),f.stickyHeaders_addResizeEvent&&c.addHeaderResizeEvent(d),k.hasClass("hasFilters")&&f.filter_columnFilters&&(k.bind("filterEnd"+m,function(){var d=a(document.activeElement).closest("td"),g=d.parent().children().index(d);x.hasClass(c.css.stickyVis)&&f.stickyHeaders_filteredToTop&&(b.scrollTo(0,k.position().top),g>=0&&e.$filters&&e.$filters.eq(g).find("a, select, input").filter(":visible").focus())}),c.filter.bindSearch(k,j.find("."+c.css.filter)),f.filter_hideFilters&&c.filter.hideFilters(e,w)),k.trigger("stickyHeadersInit")}},remove:function(d,e,f){var g=e.namespace+"stickyheaders ";e.$table.removeClass("hasStickyHeaders").unbind("pagerComplete filterEnd stickyHeadersUpdate ".split(" ").join(g).replace(/\s+/g," ")).next("."+c.css.stickyWrap).remove(),f.$sticky&&f.$sticky.length&&f.$sticky.remove(),a(b).add(f.stickyHeaders_xScroll).add(f.stickyHeaders_yScroll).add(f.stickyHeaders_attachTo).unbind("scroll resize ".split(" ").join(g).replace(/\s+/g," ")),c.addHeaderResizeEvent(d,!1)}})}(jQuery,window),function(a,b){"use strict";var c=a.tablesorter||{};a.extend(c.css,{resizableContainer:"tablesorter-resizable-container",resizableHandle:"tablesorter-resizable-handle",resizableNoSelect:"tablesorter-disableSelection",resizableStorage:"tablesorter-resizable"}),a(function(){var b="";a(b).appendTo("body")}),c.resizable={init:function(b,d){if(!b.$table.hasClass("hasResizable")){b.$table.addClass("hasResizable");var e,f,g,h,i,j=b.$table,k=j.parent(),l=parseInt(j.css("margin-top"),10),m=d.resizable_vars={useStorage:c.storage&&d.resizable!==!1,$wrap:k,mouseXPosition:0,$target:null,$next:null,overflow:"auto"===k.css("overflow")||"scroll"===k.css("overflow")||"auto"===k.css("overflow-x")||"scroll"===k.css("overflow-x"),storedSizes:[]};for(c.resizableReset(b.table,!0),m.tableWidth=j.width(),m.fullWidth=Math.abs(k.width()-m.tableWidth)<20,m.useStorage&&m.overflow&&(c.storage(b.table,"tablesorter-table-original-css-width",m.tableWidth),i=c.storage(b.table,"tablesorter-table-resized-width")||"auto",c.resizable.setWidth(j,i,!0)),d.resizable_vars.storedSizes=h=(m.useStorage?c.storage(b.table,c.css.resizableStorage):[])||[],c.resizable.setWidths(b,d,h),c.resizable.updateStoredSizes(b,d),d.$resizable_container=a('
    ').css({top:l}).insertBefore(j),g=0;g').appendTo(d.$resizable_container).attr({"data-column":g,unselectable:"on"}).data("header",f).bind("selectstart",!1);j.one("tablesorter-initialized",function(){c.resizable.setHandlePosition(b,d),c.resizable.bindings(this.config,this.config.widgetOptions)})}},updateStoredSizes:function(a,b){var c,d,e=a.columns,f=b.resizable_vars;for(f.storedSizes=[],c=0;e>c;c++)d=a.$headerIndexed[c],f.storedSizes[c]=d.is(":visible")?d.width():0},setWidth:function(a,b,c){a.css({width:b,"min-width":c?b:"","max-width":c?b:""})},setWidths:function(b,d,e){var f,g,h=d.resizable_vars,i=a(b.namespace+"_extra_headers"),j=b.$table.children("colgroup").children("col");if(e=e||h.storedSizes||[],e.length){for(f=0;ff||f===h&&d.resizable_addLastColumn)&&c.css({display:"inline-block",height:g,left:j.position().left-e+j.outerWidth()-i}):c.hide())})},toggleTextSelection:function(b,d){var e=b.namespace+"tsresize";b.widgetOptions.resizable_vars.disabled=d,a("body").toggleClass(c.css.resizableNoSelect,d),d?a("body").attr("unselectable","on").bind("selectstart"+e,!1):a("body").removeAttr("unselectable").unbind("selectstart"+e)},bindings:function(d,e){var f=d.namespace+"tsresize";e.$resizable_container.children().bind("mousedown",function(b){var f,g=e.resizable_vars,h=a(d.namespace+"_extra_headers"),i=a(b.target).data("header");f=parseInt(i.attr("data-column"),10),g.$target=i=i.add(h.filter('[data-column="'+f+'"]')),g.target=f,g.$next=b.shiftKey||e.resizable_targetLast?i.parent().children().not(".resizable-false").filter(":last"):i.nextAll(":not(.resizable-false)").eq(0),f=parseInt(g.$next.attr("data-column"),10),g.$next=g.$next.add(h.filter('[data-column="'+f+'"]')),g.next=f,g.mouseXPosition=b.pageX,c.resizable.updateStoredSizes(d,e),c.resizable.toggleTextSelection(d,!0)}),a(document).bind("mousemove"+f,function(a){var b=e.resizable_vars;b.disabled&&0!==b.mouseXPosition&&b.$target&&(e.resizable_throttle?(clearTimeout(b.timer),b.timer=setTimeout(function(){c.resizable.mouseMove(d,e,a)},isNaN(e.resizable_throttle)?5:e.resizable_throttle)):c.resizable.mouseMove(d,e,a))}).bind("mouseup"+f,function(){e.resizable_vars.disabled&&(c.resizable.toggleTextSelection(d,!1),c.resizable.stopResize(d,e),c.resizable.setHandlePosition(d,e))}),a(b).bind("resize"+f+" resizeEnd"+f,function(){c.resizable.setHandlePosition(d,e)}),d.$table.bind("columnUpdate"+f,function(){c.resizable.setHandlePosition(d,e)}).find("thead:first").add(a(d.namespace+"_extra_table").find("thead:first")).bind("contextmenu"+f,function(){var a=0===e.resizable_vars.storedSizes.length;return c.resizableReset(d.table),c.resizable.setHandlePosition(d,e),e.resizable_vars.storedSizes=[],a})},mouseMove:function(b,d,e){if(0!==d.resizable_vars.mouseXPosition&&d.resizable_vars.$target){var f,g=0,h=d.resizable_vars,i=h.$next,j=h.storedSizes[h.target],k=e.pageX-h.mouseXPosition;if(h.overflow){if(j+k>0){for(h.storedSizes[h.target]+=k,c.resizable.setWidth(h.$target,h.storedSizes[h.target],!0),f=0;f0?d.sortList=k:c.hasInitialized&&k&&k.length>0&&b.sortOn(d,k))},remove:function(a,c){c.$table.removeClass("hasSaveSort"),b.storage&&b.storage(a,"tablesorter-savesort","")}})}(jQuery),a.tablesorter}); \ No newline at end of file +/*** This file is dynamically generated *** +█████▄ ▄████▄ █████▄ ▄████▄ ██████ ███████▄ ▄████▄ █████▄ ██ ██████ ██ ██ +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▄▄ ██▄▄██ +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀██ +█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀ +*/ +/*! tablesorter (FORK) - updated 10-31-2015 (v2.23.5)*/ +/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */ +!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,b,c){"use strict";var d=a.tablesorter||{}; +// *** Store data in local storage, with a cookie fallback *** +/* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json) + if you need it, then include https://github.com/douglascrockford/JSON-js + + $.parseJSON is not available is jQuery versions older than 1.4.1, using older + versions will only allow storing information for one page at a time + + // *** Save data (JSON format only) *** + // val must be valid JSON... use http://jsonlint.com/ to ensure it is valid + var val = { "mywidget" : "data1" }; // valid JSON uses double quotes + // $.tablesorter.storage(table, key, val); + $.tablesorter.storage(table, 'tablesorter-mywidget', val); + + // *** Get data: $.tablesorter.storage(table, key); *** + v = $.tablesorter.storage(table, 'tablesorter-mywidget'); + // val may be empty, so also check for your data + val = (v && v.hasOwnProperty('mywidget')) ? v.mywidget : ''; + alert(val); // 'data1' if saved, or '' if not + */ +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), +// id from (1) options ID, (2) table 'data-table-group' attribute, (3) widgetOptions.storage_tableId, +// (4) table ID, then (5) table index +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), +// url from (1) options url, (2) table 'data-table-page' attribute, (3) widgetOptions.storage_fixedUrl, +// (4) table.config.fixedUrl (deprecated), then (5) window location path +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; +// https://gist.github.com/paulirish/5558557 +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")} +// allow value to be an empty string too +// *** get value *** +// old browser, using cookies +// add one to get from the key to the value +// allow value to be an empty string too +// add unique identifiers = url pathname > table ID/index on page > data +// *** set value *** +// 365 days +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]:""}}(jQuery,window,document),function(a){"use strict";var b=a.tablesorter||{};b.themes={bootstrap:{table:"table table-bordered table-striped",caption:"caption", +// header class names +header:"bootstrap-header",// give the header a gradient background (theme.bootstrap_2.css) +sortNone:"",sortAsc:"",sortDesc:"",active:"",// applied when column is sorted +hover:"",// custom css required - a defined bootstrap style may not override other classes +// icon class names +icons:"",// add 'icon-white' to make them white; this icon class is added to the in the header +iconSortNone:"bootstrap-icon-unsorted",// class name added to icon when column is not sorted +iconSortAsc:"icon-chevron-up glyphicon glyphicon-chevron-up",// class name added to icon when column has ascending sort +iconSortDesc:"icon-chevron-down glyphicon glyphicon-chevron-down",// class name added to icon when column has descending sort +filterRow:"",// filter row class +footerRow:"",footerCells:"",even:"",// even row zebra striping +odd:""},jui:{table:"ui-widget ui-widget-content ui-corner-all",// table classes +caption:"ui-widget-content", +// header class names +header:"ui-widget-header ui-corner-all ui-state-default",// header classes +sortNone:"",sortAsc:"",sortDesc:"",active:"ui-state-active",// applied when column is sorted +hover:"ui-state-hover",// hover class +// icon class names +icons:"ui-icon",// icon class added to the in the header +iconSortNone:"ui-icon-carat-2-n-s",// class name added to icon when column is not sorted +iconSortAsc:"ui-icon-carat-1-n",// class name added to icon when column has ascending sort +iconSortDesc:"ui-icon-carat-1-s",// class name added to icon when column has descending sort +filterRow:"",footerRow:"",footerCells:"",even:"ui-widget-content",// even row zebra striping +odd:"ui-state-default"}},a.extend(b.css,{wrapper:"tablesorter-wrapper"}),b.addWidget({id:"uitheme",priority:10,format:function(c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r=b.themes,s=d.$table.add(a(d.namespace+"_extra_table")),t=d.$headers.add(a(d.namespace+"_extra_headers")),u=d.theme||"jui",v=r[u]||{},w=a.trim([v.sortNone,v.sortDesc,v.sortAsc,v.active].join(" ")),x=a.trim([v.iconSortNone,v.iconSortDesc,v.iconSortAsc].join(" "));for(d.debug&&(i=new Date), +// initialization code - run once +s.hasClass("tablesorter-"+u)&&d.theme===d.appliedTheme&&e.uitheme_applied||(e.uitheme_applied=!0,n=r[d.appliedTheme]||{},q=!a.isEmptyObject(n),o=q?[n.sortNone,n.sortDesc,n.sortAsc,n.active].join(" "):"",p=q?[n.iconSortNone,n.iconSortDesc,n.iconSortAsc].join(" "):"",q&&(e.zebra[0]=a.trim(" "+e.zebra[0].replace(" "+n.even,"")),e.zebra[1]=a.trim(" "+e.zebra[1].replace(" "+n.odd,"")),d.$tbodies.children().removeClass([n.even,n.odd].join(" "))),v.even&&(e.zebra[0]+=" "+v.even),v.odd&&(e.zebra[1]+=" "+v.odd),s.children("caption").removeClass(n.caption||"").addClass(v.caption),l=s.removeClass((d.appliedTheme?"tablesorter-"+(d.appliedTheme||""):"")+" "+(n.table||"")).addClass("tablesorter-"+u+" "+(v.table||"")).children("tfoot"),d.appliedTheme=d.theme,l.length&&l.children("tr").removeClass(n.footerRow||"").addClass(v.footerRow).children("th, td").removeClass(n.footerCells||"").addClass(v.footerCells),t.removeClass((q?[n.header,n.hover,o].join(" "):"")||"").addClass(v.header).not(".sorter-false").unbind("mouseenter.tsuitheme mouseleave.tsuitheme").bind("mouseenter.tsuitheme mouseleave.tsuitheme",function(b){a(this)["mouseenter"===b.type?"addClass":"removeClass"](v.hover||"")}),t.each(function(){var c=a(this);c.find("."+b.css.wrapper).length||c.wrapInner('
    ')}),d.cssIcon&&t.find("."+b.css.icon).removeClass(q?[n.icons,p].join(" "):"").addClass(v.icons||""),s.hasClass("hasFilters")&&s.children("thead").children("."+b.css.filterRow).removeClass(q?n.filterRow||"":"").addClass(v.filterRow||"")),f=0;f1)))for(m=1;q>m;m++)k.eq(p[m][0]).addClass(r[m]||r[s])}),b.processTbody(c,f,!1);if(i=e.columns_thead!==!1?["thead tr"]:[],e.columns_tfoot!==!1&&i.push("tfoot tr"),i.length&&(h=n.find(i.join(",")).children().removeClass(l),q))for(m=0;q>m;m++) +// add primary. secondary, tertiary, etc sort column classes +h.filter('[data-column="'+p[m][0]+'"]').addClass(r[m]||r[s])},remove:function(c,d,e){var f,g,h=d.$tbodies,i=(e.columns||["primary","secondary","tertiary"]).join(" ");for(d.$headers.removeClass(i),d.$table.children("tfoot").children("tr").children("th, td").removeClass(i),f=0;f=]/g,// replace operators +query:"(q|query)",// replace filter queries +wild01:/\?/g,// wild card match 0 or 1 +wild0More:/\*/g,// wild care match 0 or more +quote:/\"/g,isNeg1:/(>=?\s*-\d)/,isNeg2:/(<=?\s*\d)/}, +// function( c, data ) { } +// c = table.config +// data.$row = jQuery object of the row currently being processed +// data.$cells = jQuery object of all cells within the current row +// data.filters = array of filters for all columns ( some may be undefined ) +// data.filter = filter for the current column +// data.iFilter = same as data.filter, except lowercase ( if wo.filter_ignoreCase is true ) +// data.exact = table cell text ( or parsed data if column parser enabled; may be a number & not a string ) +// data.iExact = same as data.exact, except lowercase ( if wo.filter_ignoreCase is true; may be a number & not a string ) +// data.cache = table cell text from cache, so it has been parsed ( & in all lower case if c.ignoreCase is true ) +// data.cacheArray = An array of parsed content from each table cell in the row being processed +// data.index = column index; table = table element ( DOM ) +// data.parsed = array ( by column ) of boolean values ( from filter_useParsedData or 'filter-parsed' class ) +types:{or:function(c,d,e){if(b.regex.orTest.test(d.iFilter)||b.regex.orSplit.test(d.filter)){var f,g,h,i, +// duplicate data but split filter +j=a.extend({},d),k=d.index,l=d.parsed[k],m=d.filter.split(b.regex.orSplit),n=d.iFilter.split(b.regex.orSplit),o=m.length;for(f=0;o>f;f++){j.nestedFilters=!0,j.filter=""+(b.parseFilter(c,m[f],k,l)||""),j.iFilter=""+(b.parseFilter(c,n[f],k,l)||""),h="("+(b.parseFilter(c,j.filter,k,l)||"")+")";try{if(i=new RegExp(d.isMatch?h:"^"+h+"$",c.widgetOptions.filter_ignoreCase?"i":""),g=i.test(j.exact)||b.processTypes(c,j,e))return g}catch(p){return null}} +// may be null from processing types +return g||!1}return null}, +// Look for an AND or && operator ( logical and ) +and:function(c,d,e){if(b.regex.andTest.test(d.filter)){var f,g,h,i,j, +// duplicate data but split filter +k=a.extend({},d),l=d.index,m=d.parsed[l],n=d.filter.split(b.regex.andSplit),o=d.iFilter.split(b.regex.andSplit),p=n.length;for(f=0;p>f;f++){k.nestedFilters=!0,k.filter=""+(b.parseFilter(c,n[f],l,m)||""),k.iFilter=""+(b.parseFilter(c,o[f],l,m)||""),i=("("+(b.parseFilter(c,k.filter,l,m)||"")+")").replace(b.regex.wild01,"\\S{1}").replace(b.regex.wild0More,"\\S*");try{ +// use try/catch just in case RegExp is invalid +j=new RegExp(d.isMatch?i:"^"+i+"$",c.widgetOptions.filter_ignoreCase?"i":""), +// look for an exact match with the 'and' unless the 'filter-match' class is found +h=j.test(k.exact)||b.processTypes(c,k,e),g=0===f?h:g&&h}catch(q){return null}} +// may be null from processing types +return g||!1}return null}, +// Look for regex +regex:function(a,c){if(b.regex.regex.test(c.filter)){var d, +// cache regex per column for optimal speed +e=c.filter_regexCache[c.index]||b.regex.regex.exec(c.filter),f=e instanceof RegExp;try{f||( +// force case insensitive search if ignoreCase option set? +// if ( c.ignoreCase && !regex[2] ) { regex[2] = 'i'; } +c.filter_regexCache[c.index]=e=new RegExp(e[1],e[2])),d=e.test(c.exact)}catch(g){d=!1}return d}return null}, +// Look for operators >, >=, < or <= +operators:function(d,e){ +// ignore empty strings... because '' < 10 is true +if(b.regex.operTest.test(e.iFilter)&&""!==e.iExact){var f,g,h,i=d.table,j=e.index,k=e.parsed[j],l=c.formatFloat(e.iFilter.replace(b.regex.operators,""),i),m=d.parsers[j],n=l; +// parse filter value in case we're comparing numbers ( dates ) +// iExact may be numeric - see issue #149; +// check if cached is defined, because sometimes j goes out of range? ( numeric columns ) +// keep showing all rows if nothing follows the operator +return(k||"numeric"===m.type)&&(h=a.trim(""+e.iFilter.replace(b.regex.operators,"")),g=b.parseFilter(d,h,j,!0),l="number"!=typeof g||""===g||isNaN(g)?l:g),!k&&"numeric"!==m.type||isNaN(l)||"undefined"==typeof e.cache?(h=isNaN(e.iExact)?e.iExact.replace(c.regex.nondigit,""):e.iExact,f=c.formatFloat(h,i)):f=e.cache,b.regex.gtTest.test(e.iFilter)?g=b.regex.gteTest.test(e.iFilter)?f>=l:f>l:b.regex.ltTest.test(e.iFilter)&&(g=b.regex.lteTest.test(e.iFilter)?l>=f:l>f),g||""!==n||(g=!0),g}return null}, +// Look for a not match +notMatch:function(c,d){if(b.regex.notTest.test(d.iFilter)){var e,f=d.iFilter.replace("!",""),g=b.parseFilter(c,f,d.index,d.parsed[d.index])||""; +// look for exact not matches - see #628 +return b.regex.exact.test(g)?(g=g.replace(b.regex.exact,""),""===g?!0:a.trim(g)!==d.iExact):(e=d.iExact.search(a.trim(g)),""===g?!0:!(c.widgetOptions.filter_startsWith?0===e:e>=0))}return null}, +// Look for quotes or equals to get an exact match; ignore type since iExact could be numeric +exact:function(c,d){/*jshint eqeqeq:false */ +if(b.regex.exact.test(d.iFilter)){var e=d.iFilter.replace(b.regex.exact,""),f=b.parseFilter(c,e,d.index,d.parsed[d.index])||"";return d.anyMatch?a.inArray(f,d.rowArray)>=0:f==d.iExact}return null}, +// Look for a range ( using ' to ' or ' - ' ) - see issue #166; thanks matzhu! +range:function(a,d){if(b.regex.toTest.test(d.iFilter)){var e,f,g,h,i=a.table,j=d.index,k=d.parsed[j], +// make sure the dash is for a range and not indicating a negative number +l=d.iFilter.split(b.regex.toSplit); +// parse filter value in case we're comparing numbers ( dates ) +return f=l[0].replace(c.regex.nondigit,"")||"",g=c.formatFloat(b.parseFilter(a,f,j,k),i),f=l[1].replace(c.regex.nondigit,"")||"",h=c.formatFloat(b.parseFilter(a,f,j,k),i),(k||"numeric"===a.parsers[j].type)&&(e=a.parsers[j].format(""+l[0],i,a.$headers.eq(j),j),g=""===e||isNaN(e)?g:e,e=a.parsers[j].format(""+l[1],i,a.$headers.eq(j),j),h=""===e||isNaN(e)?h:e),!k&&"numeric"!==a.parsers[j].type||isNaN(g)||isNaN(h)?(f=isNaN(d.iExact)?d.iExact.replace(c.regex.nondigit,""):d.iExact,e=c.formatFloat(f,i)):e=d.cache,g>h&&(f=g,g=h,h=f),e>=g&&h>=e||""===g||""===h}return null}, +// Look for wild card: ? = single, * = multiple, or | = logical OR +wild:function(a,c){if(b.regex.wildOrTest.test(c.iFilter)){var d=c.index,e=c.parsed[d],f=""+(b.parseFilter(a,c.iFilter,d,e)||""); +// look for an exact match with the 'or' unless the 'filter-match' class is found +!b.regex.wildTest.test(f)&&c.nestedFilters&&(f=c.isMatch?f:"^("+f+")$"); +// parsing the filter may not work properly when using wildcards =/ +try{return new RegExp(f.replace(b.regex.wild01,"\\S{1}").replace(b.regex.wild0More,"\\S*"),a.widgetOptions.filter_ignoreCase?"i":"").test(c.exact)}catch(g){return null}}return null}, +// fuzzy text search; modified from https://github.com/mattyork/fuzzy ( MIT license ) +fuzzy:function(a,c){if(b.regex.fuzzyTest.test(c.iFilter)){var d,e=0,f=c.iExact.length,g=c.iFilter.slice(1),h=b.parseFilter(a,g,c.index,c.parsed[c.index])||"";for(d=0;f>d;d++)c.iExact[d]===h[e]&&(e+=1);return e===h.length?!0:!1}return null}},init:function(e,f,g){ +// filter language options +c.language=a.extend(!0,{},{to:"to",or:"or",and:"and"},c.language);var h,i,j,k,l,m,n,o,p,q=b.regex;if(f.$table.addClass("hasFilters"), +// define timers so using clearTimeout won't cause an undefined error +g.filter_searchTimer=null,g.filter_initTimer=null,g.filter_formatterCount=0,g.filter_formatterInit=[],g.filter_anyColumnSelector='[data-column="all"],[data-column="any"]',g.filter_multipleColumnSelector='[data-column*="-"],[data-column*=","]',n="\\{"+b.regex.query+"\\}",a.extend(q,{child:new RegExp(f.cssChildRow),filtered:new RegExp(g.filter_filteredRow),alreadyFiltered:new RegExp("(\\s+("+c.language.or+"|-|"+c.language.to+")\\s+)","i"),toTest:new RegExp("\\s+(-|"+c.language.to+")\\s+","i"),toSplit:new RegExp("(?:\\s+(?:-|"+c.language.to+")\\s+)","gi"),andTest:new RegExp("\\s+("+c.language.and+"|&&)\\s+","i"),andSplit:new RegExp("(?:\\s+(?:"+c.language.and+"|&&)\\s+)","gi"),orTest:/\|/,orSplit:new RegExp("(?:\\s+(?:"+c.language.or+")\\s+|\\|)","gi"),iQuery:new RegExp(n,"i"),igQuery:new RegExp(n,"ig"),operTest:/^[<>]=?/,gtTest:/>/,gteTest:/>=/,ltTest:/'+(k.data("placeholder")||k.attr("data-placeholder")||g.filter_placeholder.select||"")+"":"",n=i,j=i,i.indexOf(g.filter_selectSourceSeparator)>=0&&(n=i.split(g.filter_selectSourceSeparator),j=n[1],n=n[0]),h+="");f.$table.find("thead").find("select."+d.filter+'[data-column="'+l+'"]').append(h),j=g.filter_selectSource,o="function"==typeof j?!0:c.getColumnData(e,j,l),o&& +// updating so the extra options are appended +b.buildSelect(f.table,l,"",!0,k.hasClass(g.filter_onlyAvail))} +// not really updating, but if the column has both the 'filter-select' class & +// filter_functions set to true, it would append the same options twice. +b.buildDefault(e,!0),b.bindSearch(e,f.$table.find("."+d.filter),!0),g.filter_external&&b.bindSearch(e,g.filter_external),g.filter_hideFilters&&b.hideFilters(f), +// show processing icon +f.showProcessing&&(j="filterStart filterEnd ".split(" ").join(f.namespace+"filter "),f.$table.unbind(j.replace(c.regex.spaces," ")).bind(j,function(b,g){k=g?f.$table.find("."+d.header).filter("[data-column]").filter(function(){return""!==g[a(this).data("column")]}):"",c.isProcessing(e,"filterStart"===b.type,g?k:"")})), +// set filtered rows count ( intially unfiltered ) +f.filteredRows=f.totalRows,j="tablesorter-initialized pagerBeforeInitialized ".split(" ").join(f.namespace+"filter "),f.$table.unbind(j.replace(c.regex.spaces," ")).bind(j,function(){var a=this.config.widgetOptions;m=b.setDefaults(e,f,a)||[],m.length&&(f.delayInit&&""===m.join("")||c.setFilters(e,m,!0)),f.$table.trigger("filterFomatterUpdate"),setTimeout(function(){a.filter_initialized||b.filterInitComplete(f)},100)}),f.pager&&f.pager.initialized&&!g.filter_initialized&&(f.$table.trigger("filterFomatterUpdate"),setTimeout(function(){b.filterInitComplete(f)},100))}, +// $cell parameter, but not the config, is passed to the filter_formatters, +// so we have to work with it instead +formatterUpdated:function(a,b){ +// prevent error if $cell is undefined - see #1056 +var c=a&&a.closest("table")[0].config.widgetOptions;c&&!c.filter_initialized&&( +// add updates by column since this function +// may be called numerous times before initialization +c.filter_formatterInit[b]=1)},filterInitComplete:function(c){var d,e,f=c.widgetOptions,g=0,h=function(){f.filter_initialized=!0,c.$table.trigger("filterInit",c),b.findRows(c.table,c.$table.data("lastSearch")||[])};if(a.isEmptyObject(f.filter_formatter))h();else{for(e=f.filter_formatterInit.length,d=0;e>d;d++)1===f.filter_formatterInit[d]&&g++;clearTimeout(f.filter_initTimer),f.filter_initialized||g!==f.filter_formatterCount?f.filter_initialized||( +// fall back in case a filter_formatter doesn't call +// $.tablesorter.filter.formatterUpdated( $cell, column ), and the count is off +f.filter_initTimer=setTimeout(function(){h()},500)): +// filter widget initialized +h()}}, +// encode or decode filters for storage; see #1026 +processFilters:function(a,b){var c,d=b?encodeURIComponent:decodeURIComponent,e=a.length;for(c=0;e>c;c++)a[c]=d(a[c]);return a},setDefaults:function(d,e,f){var g,h,i,j,k, +// get current ( default ) filters +l=c.getFilters(d)||[]; +// if no filters saved, then check default settings +if(f.filter_saveFilters&&c.storage&&(h=c.storage(d,"tablesorter-filters")||[],g=a.isArray(h),g&&""===h.join("")||!g||(l=b.processFilters(h))),""===l.join(""))for(k=e.$headers.add(f.filter_$externalFilters).filter("["+f.filter_defaultAttrib+"]"),i=0;i<=e.columns;i++)j=i===e.columns?"all":i,l[i]=k.filter('[data-column="'+j+'"]').attr(f.filter_defaultAttrib)||l[i]||"";return e.$table.data("lastSearch",l),l},parseFilter:function(a,b,c,d){return d?a.parsers[c].format(b,a.table,[],c):b},buildRow:function(b,e,f){var g,h,i,j,k,l,m,n,o, +// c.columns defined in computeThIndexes() +p=f.filter_cellFilter,q=e.columns,r=a.isArray(p),s='';for(i=0;q>i;i++)e.$headerIndexed[i].length&&(s+='1&&(s+=' colspan="'+o+'"'),s+=r?p[i]?' class="'+p[i]+'"':"":""!==p?' class="'+p+'"':"",s+=">"); +// build each filter input +for(e.$filters=a(s+="").appendTo(e.$table.children("thead").eq(0)).children("td"),i=0;q>i;i++)l=!1,j=e.$headerIndexed[i],j&&j.length&&(g=e.$filters.filter('[data-column="'+i+'"]'),n=c.getColumnData(b,f.filter_functions,i),k=f.filter_functions&&n&&"function"!=typeof n||j.hasClass("filter-select"),h=c.getColumnData(b,e.headers,i),l="false"===c.getData(j[0],h,"filter")||"false"===c.getData(j[0],h,"parser"),k?s=a("').appendTo(g),s&&(o=j.data("placeholder")||j.attr("data-placeholder")||f.filter_placeholder.search||"",s.attr("placeholder",o))),s&&(m=(a.isArray(f.filter_cssFilter)?"undefined"!=typeof f.filter_cssFilter[i]?f.filter_cssFilter[i]||"":"":f.filter_cssFilter)||"",s.addClass(d.filter+" "+m).attr("data-column",i),l&&(s.attr("placeholder","").addClass(d.filterDisabled)[0].disabled=!0)))},bindSearch:function(d,e,f){// allow passing a selector string +if(d=a(d)[0],e=a(e),e.length){var g,h=d.config,i=h.widgetOptions,j=h.namespace+"filter",k=i.filter_$externalFilters;f!==!0&&(g=i.filter_anyColumnSelector+","+i.filter_multipleColumnSelector,i.filter_$anyMatch=e.filter(g),k&&k.length?i.filter_$externalFilters=i.filter_$externalFilters.add(e):i.filter_$externalFilters=e,c.setFilters(d,h.$table.data("lastSearch")||[],f===!1)), +// unbind events +g="keypress keyup search change ".split(" ").join(j+" "),e.attr("data-lastSearchTime",(new Date).getTime()).unbind(g.replace(c.regex.spaces," ")).bind("keyup"+j,function(c){ +// emulate what webkit does.... escape clears the filter +if(a(this).attr("data-lastSearchTime",(new Date).getTime()),27===c.which)this.value="";else{if(i.filter_liveSearch===!1)return;if(""!==this.value&&("number"==typeof i.filter_liveSearch&&this.value.length=37&&c.which<=40)))return} +// change event = no delay; last true flag tells getFilters to skip newest timed input +b.searching(d,!0,!0)}).bind("search change keypress ".split(" ").join(j+" "),function(c){ +// don't get cached data, in case data-column changes dynamically +var e=parseInt(a(this).attr("data-column"),10); +// don't allow 'change' event to process if the input value is the same - fixes #685 +i.filter_initialized&&(13===c.which||"search"===c.type||"change"===c.type&&this.value!==h.lastSearch[e])&&(c.preventDefault(), +// init search with no delay +a(this).attr("data-lastSearchTime",(new Date).getTime()),b.searching(d,!1,!0))})}},searching:function(a,c,d){var e=a.config.widgetOptions;clearTimeout(e.filter_searchTimer),"undefined"==typeof c||c===!0? +// delay filtering +e.filter_searchTimer=setTimeout(function(){b.checkFilters(a,c,d)},e.filter_liveSearch?e.filter_searchDelay:10): +// skip delay +b.checkFilters(a,c,d)},checkFilters:function(e,f,g){var h=e.config,i=h.widgetOptions,j=a.isArray(f),k=j?f:c.getFilters(e,!0),l=(k||[]).join("");// combined filter values +// prevent errors if delay init is set +// combined filter values +// prevent errors if delay init is set +// update cache if delayInit set & pager has initialized ( after user initiates a search ) +// add filter array back into inputs +// show/hide filter row as needed +// return if the last search is the same; but filter === false when updating the search +// see example-widget-filter.html filter toggle buttons +// force filter refresh +// give it time for the processing icon to kick in +return a.isEmptyObject(h.cache)?void(h.delayInit&&h.pager&&h.pager.initialized&&c.updateCache(h,function(){b.checkFilters(e,!1,g)})):(j&&(c.setFilters(e,k,!1,g!==!0),i.filter_initialized||(h.lastCombinedFilter="")),i.filter_hideFilters&&h.$table.find("."+d.filterRow).trigger(""===l?"mouseleave":"mouseenter"),h.lastCombinedFilter!==l||f===!1?(f===!1&&(h.lastCombinedFilter=null,h.lastSearch=[]),i.filter_initialized&&h.$table.trigger("filterStart",[k]),h.showProcessing?void setTimeout(function(){return b.findRows(e,k,l),!1},30):(b.findRows(e,k,l),!1)):void 0)},hideFilters:function(b,e){var f,g=(e||b.$table).find("."+d.filterRow).addClass(d.filterRowHide);g.bind("mouseenter mouseleave",function(c){ +// save event object - http://bugs.jquery.com/ticket/12140 +var e=c,g=a(this);clearTimeout(f),f=setTimeout(function(){/enter|over/.test(e.type)?g.removeClass(d.filterRowHide): +// don't hide if input has focus +// $( ':focus' ) needs jQuery 1.6+ +a(document.activeElement).closest("tr")[0]!==g[0]&&""===b.lastCombinedFilter&&g.addClass(d.filterRowHide)},200)}).find("input, select").bind("focus blur",function(e){var g=e,h=a(this).closest("tr");clearTimeout(f),f=setTimeout(function(){clearTimeout(f), +// don't hide row if any filter has a value +""===c.getFilters(b.$table).join("")&&h.toggleClass(d.filterRowHide,"focus"!==g.type)},200)})},defaultFilter:function(c,d){if(""===c)return c;var e=b.regex.iQuery,f=d.match(b.regex.igQuery).length,g=f>1?a.trim(c).split(/\s/):[a.trim(c)],h=g.length-1,i=0,j=d; +// replace all {query} with query words... +// if query = 'Bob', then convert mask from '!{query}' to '!Bob' +// if query = 'Bob Joe Frank', then convert mask '{q} OR {q}' to 'Bob OR Joe OR Frank' +for(1>h&&f>1&&( +// only one 'word' in query but mask has >1 slots +g[1]=g[0]);e.test(j);)j=j.replace(e,g[i++]||""),e.test(j)&&h>i&&""!==(g[i]||"")&&(j=d.replace(e,j));return j},getLatestSearch:function(b){return b?b.sort(function(b,c){return a(c).attr("data-lastSearchTime")-a(b).attr("data-lastSearchTime")}):b||a()},multipleColumns:function(c,d){ +// look for multiple columns '1-3,4-6,8' in data-column +var e,f,g,h,i,j,k,l,m,n=c.widgetOptions, +// only target 'all' column inputs on initialization +// & don't target 'all' column inputs if they don't exist +o=n.filter_initialized||!d.filter(n.filter_anyColumnSelector).length,p=[],q=a.trim(b.getLatestSearch(d).attr("data-column")||"");if(/^[0-9]+$/.test(q))return parseInt(q,10); +// process column range +if(o&&/-/.test(q))for(f=q.match(/(\d+)\s*-\s*(\d+)/g),m=f.length,l=0;m>l;l++){for(g=f[l].split(/\s*-\s*/),h=parseInt(g[0],10)||0,i=parseInt(g[1],10)||c.columns-1,h>i&&(e=h,h=i,i=e),i>=c.columns&&(i=c.columns-1);i>=h;h++)p.push(h); +// remove processed range from val +q=q.replace(f[l],"")} +// process single columns +if(o&&/,/.test(q))for(j=q.split(/\s*,\s*/),m=j.length,k=0;m>k;k++)""!==j[k]&&(l=parseInt(j[k],10),l1){if(e.anyMatch=!0,e.isMatch=!0,e.rowArray=e.$cells.map(function(b){return a.inArray(b,q)>-1?(e.parsed[b]?m=e.cacheArray[b]:(m=e.rawArray[b],m=a.trim(o.filter_ignoreCase?m.toLowerCase():m),d.sortLocaleCompare&&(m=c.replaceAccents(m))),m):void 0}).get(),e.filter=e.anyMatchFilter,e.iFilter=e.iAnyMatchFilter,e.exact=e.rowArray.join(" "),e.iExact=o.filter_ignoreCase?e.exact.toLowerCase():e.exact,e.cache=e.cacheArray.slice(0,-1).join(" "),f.excludeMatch=f.noAnyMatch,j=b.processTypes(d,e,f),null!==j)p=j;else if(o.filter_startsWith)for(p=!1, +// data.rowArray may not contain all columns +q=Math.min(d.columns,e.rowArray.length);!p&&q>0;)q--,p=p||0===e.rowArray[q].indexOf(e.iFilter);else p=(e.iExact+e.childRowText).indexOf(e.iFilter)>=0; +// no other filters to process +if(e.anyMatch=!1,e.filters.join("")===e.filter)return p}for(q=0;q=0:e.filter===e.exact:"function"==typeof k?j=k(e.exact,e.cache,e.filter,q,e.$row,d,e):"function"==typeof k[l||e.filter]&&(m=l||e.filter,j=k[m](e.exact,e.cache,e.filter,q,e.$row,d,e))),null===j?(j=b.processTypes(d,e,f),null!==j?h=j:(m=(e.iExact+e.childRowText).indexOf(b.parseFilter(d,e.iFilter,q,e.parsed[q])),h=!o.filter_startsWith&&m>=0||o.filter_startsWith&&0===m)):h=j,p=h?p:!1);return p},findRows:function(d,e,f){if(d.config.lastCombinedFilter!==f&&d.config.widgetOptions.filter_initialized){var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E=a.extend([],e),F=b.regex,G=d.config,H=G.widgetOptions, +// data object passed to filters; anyMatch is a flag for the filters +I={anyMatch:!1,filters:e, +// regex filter type cache +filter_regexCache:[]},J={ +// anyMatch really screws up with these types of filters +noAnyMatch:["range","notMatch","operators"], +// cache filter variables that use ts.getColumnData in the main loop +functions:[],excludeFilter:[],defaultColFilter:[],defaultAnyFilter:c.getColumnData(d,H.filter_defaultFilter,G.columns,!0)||""};for( +// parse columns after formatter, in case the class is added at that point +I.parsed=G.$headers.map(function(b){ +// force parsing if parser type is numeric +// getData won't return 'parsed' if other 'filter-' class names exist +// ( e.g. ) +return G.parsers&&G.parsers[b]&&G.parsers[b].parsed||c.getData&&"parsed"===c.getData(G.$headerIndexed[b],c.getColumnData(d,G.headers,b),"filter")||a(this).hasClass("filter-parsed")}).get(),o=0;o1&&(C=parseInt(B[0],10)-1,C>=0&&Cw;w++)v=e[w]||"",y||(w=o),y=y&&r.length&&0===v.indexOf(r[w]||"")&&!F.alreadyFiltered.test(v)&&!F.exactTest.test(v)&&!(F.isNeg1.test(v)||F.isNeg2.test(v))&&!(""!==v&&G.$filters&&G.$filters.filter('[data-column="'+w+'"]').find("select").length&&!G.$headerIndexed[w].hasClass("filter-match")); +// loop through the rows +for(x=j.not("."+H.filter_filteredRow).length,y&&0===x&&(y=!1),G.debug&&console.log("Filter: Searching through "+(y&&g>x?x:"all")+" rows"),I.anyMatchFlag&&(G.sortLocaleCompare&&(I.anyMatchFilter=c.replaceAccents(I.anyMatchFilter)),H.filter_defaultFilter&&F.iQuery.test(J.defaultAnyFilter)&&(I.anyMatchFilter=b.defaultFilter(I.anyMatchFilter,J.defaultAnyFilter),y=!1),I.iAnyMatchFilter=H.filter_ignoreCase&&G.ignoreCase?I.anyMatchFilter.toLowerCase():I.anyMatchFilter),l=0;g>l;l++) +// skip child rows & already filtered rows +if(D=j[l].className,p=l&&F.child.test(D),!(p||y&&F.filtered.test(D))){if(I.$row=j.eq(l),I.cacheArray=h[l],i=I.cacheArray[G.columns],I.rawArray=i.raw,I.childRowText="",!H.filter_childByColumn){ +// so, if 'table.config.widgetOptions.filter_childRows' is true and there is +// a match anywhere in the child row, then it will make the row visible +// checked here so the option can be changed dynamically +for(D="",q=i.child,w=0;w")>=0) +// selectSource is a jQuery object or string of options +return l;a.isArray(l)?i=l:"object"===a.type(j)&&l&&( +// custom select source function for a SPECIFIC COLUMN +i=l(d,e,f))} +// fall back to original method +return i===!1&&(i=b.getOptions(d,e,f)),b.processOptions(d,e,i)},processOptions:function(b,d,e){if(!a.isArray(e))return!1;b=a(b)[0];var f,g,h,i,j=b.config,k="undefined"!=typeof d&&null!==d&&d>=0&&dh;h++)g=e[h],l.push({t:g,p:k&&j.parsers&&j.parsers.length&&j.parsers[d].format(g,b,[],d)||g});for(f=j.textSorter||"",l.sort(function(a,e){var g=a.p.toString(),h=e.p.toString();return k&&"function"==typeof f?f(g,h,!0,d,b):k&&"object"==typeof f&&f.hasOwnProperty(d)?f[d](g,h,!0,d,b):c.sortNatural?c.sortNatural(g,h):!0}),e=[],i=l.length,h=0;i>h;h++)e.push(l[h].t);return e},getOptions:function(b,d,e){b=a(b)[0];var f,g,h,i,j,k,l,m,n=b.config,o=n.widgetOptions,p=[];for(g=0;gf;f++) +// check if has class filtered +if(i=j.row?j.row[f]:j.normalized[f][n.columns].$row[0],!e||!i.className.match(o.filter_filteredRow)) +// get non-normalized cell content +if(o.filter_useParsedData||n.parsers[d].parsed||n.$headerIndexed[d].hasClass("filter-parsed")){ +// child row parsed data +if(p.push(""+j.normalized[f][d]),o.filter_childRows&&o.filter_childByColumn)for(m=j.normalized[f][n.columns].$row.length-1,k=0;m>k;k++)p.push(""+j.normalized[f][n.columns].child[k][d])}else +// child row unparsed data +if( +// get raw cached data instead of content directly from the cells +p.push(j.normalized[f][n.columns].raw[d]),o.filter_childRows&&o.filter_childByColumn)for(m=j.normalized[f][n.columns].$row.length,k=1;m>k;k++)l=j.normalized[f][n.columns].$row.eq(k).children().eq(d),p.push(""+c.getElementText(n,l,d));return p},buildSelect:function(c,e,f,g,h){if(c=a(c)[0],e=parseInt(e,10),c.config.cache&&!a.isEmptyObject(c.config.cache)){var i,j,k,l,m,n,o=c.config,p=o.widgetOptions,q=o.$headerIndexed[e], +// t.data( 'placeholder' ) won't work in jQuery older than 1.4.3 +r='", +// Get curent filter value +s=o.$table.find("thead").find("select."+d.filter+'[data-column="'+e+'"]').val();if( +// nothing included in arry ( external source ), so get the options from +// filter_selectSource or column data +("undefined"==typeof f||""===f)&&(f=b.getOptionSource(c,e,h)),a.isArray(f)){ +// build option list +for(i=0;i=0&&(l=k.split(p.filter_selectSourceSeparator),j=l[0],k=l[1]),r+=""!==f[i]?"":""; +// clear arry so it doesn't get appended twice +f=[]} +// update all selects in the same column ( clone thead in sticky headers & +// any external selects ) - fixes 473 +m=(o.$filters?o.$filters:o.$table.children("thead")).find("."+d.filter),p.filter_$externalFilters&&(m=m&&m.length?m.add(p.filter_$externalFilters):p.filter_$externalFilters),n=m.filter('select[data-column="'+e+'"]'), +// make sure there is a select there! +n.length&&(n[g?"html":"append"](r),a.isArray(f)|| +// append options if arry is provided externally as a string or jQuery object +// options ( default value ) was already added +n.append(f).val(s),n.val(s))}},buildDefault:function(a,d){var e,f,g,h=a.config,i=h.widgetOptions,j=h.columns; +// build default select dropdown +for(e=0;j>e;e++)f=h.$headerIndexed[e],g=!(f.hasClass("filter-false")||f.hasClass("parser-false")),(f.hasClass("filter-select")||c.getColumnData(a,i.filter_functions,e)===!0)&&g&&b.buildSelect(a,e,"",d,f.hasClass(i.filter_onlyAvail))}},c.getFilters=function(c,e,f,g){var h,i,j,k,l=!1,m=c?a(c)[0].config:"",n=m?m.widgetOptions:"";if(e!==!0&&n&&!n.filter_columnFilters||a.isArray(f)&&f.join("")===m.lastCombinedFilter)return a(c).data("lastSearch");if(m&&(m.$filters&&(i=m.$filters.find("."+d.filter)),n.filter_$externalFilters&&(i=i&&i.length?i.add(n.filter_$externalFilters):n.filter_$externalFilters),i&&i.length))for(l=f||[],h=0;h1&&(j=j.slice(1)),h===m.columns&&(k=j.filter(n.filter_anyColumnSelector),j=k.length?k:j),j.val(f[h]).trigger("change"+m.namespace)):(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},c.setFilters=function(d,e,f,g){var h=d?a(d)[0].config:"",i=c.getFilters(d,!0,e,g);return h&&f&&(h.lastCombinedFilter=null,h.lastSearch=[],b.searching(h.table,e,g),h.$table.trigger("filterFomatterUpdate")),!!i}}(jQuery),function(a,b){"use strict";var c=a.tablesorter||{};a.extend(c.css,{sticky:"tablesorter-stickyHeader",// stickyHeader +stickyVis:"tablesorter-sticky-visible",stickyHide:"tablesorter-sticky-hidden",stickyWrap:"tablesorter-sticky-wrapper"}), +// Add a resize event to table headers +c.addHeaderResizeEvent=function(b,c,d){// make sure we're using a dom element +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!==e[1])&&(d.data("savedSizes",[f,i]),c.push(d[0]));c.length&&a!==!1&&g.$table.trigger("resize",[c]),h.resize_flag=!1};return i(!1),clearInterval(h.resize_timer),c?(h.resize_flag=!1,!1):void(h.resize_timer=setInterval(function(){h.resize_flag||i()},f.timer))}}, +// Sticky headers based on this awesome article: +// http://css-tricks.com/13465-persistent-headers/ +// and https://github.com/jmosbech/StickyTableHeaders by Jonas Mosbech +// ************************** +c.addWidget({id:"stickyHeaders",priority:60,// sticky widget must be initialized after the filter widget! +options:{stickyHeaders:"",// extra class name added to the sticky header row +stickyHeaders_attachTo:null,// jQuery selector or object to attach sticky header to +stickyHeaders_xScroll:null,// jQuery selector or object to monitor horizontal scroll position (defaults: xScroll > attachTo > window) +stickyHeaders_yScroll:null,// jQuery selector or object to monitor vertical scroll position (defaults: yScroll > attachTo > window) +stickyHeaders_offset:0,// number or jquery selector targeting the position:fixed element +stickyHeaders_filteredToTop:!0,// scroll table top into view after filtering +stickyHeaders_cloneId:"-sticky",// added to table ID, if it exists +stickyHeaders_addResizeEvent:!0,// trigger 'resize' event on headers +stickyHeaders_includeCaption:!0,// if false and a caption exist, it won't be included in the sticky header +stickyHeaders_zIndex:2},format:function(d,e,f){ +// filter widget doesn't initialize on an empty table. Fixes #449 +if(!(e.$table.hasClass("hasStickyHeaders")||a.inArray("filter",e.widgets)>=0&&!e.$table.hasClass("hasFilters"))){var g,h,i,j,k=e.$table, +// add position: relative to attach element, hopefully it won't cause trouble. +l=a(f.stickyHeaders_attachTo),m=e.namespace+"stickyheaders ", +// element to watch for the scroll event +n=a(f.stickyHeaders_yScroll||f.stickyHeaders_attachTo||b),o=a(f.stickyHeaders_xScroll||f.stickyHeaders_attachTo||b),p=k.children("thead:first"),q=p.children("tr").not(".sticky-false").children(),r=k.children("tfoot"),s=isNaN(f.stickyHeaders_offset)?a(f.stickyHeaders_offset):"",t=s.length?s.height()||0:parseInt(f.stickyHeaders_offset,10)||0, +// is this table nested? If so, find parent sticky header wrapper (div, not table) +u=k.parent().closest("."+c.css.table).hasClass("hasStickyHeaders")?k.parent().closest("table.tablesorter")[0].config.widgetOptions.$sticky.parent():[],v=u.length?u.height():0, +// clone table, then wrap to make sticky header +w=f.$sticky=k.clone().addClass("containsStickyHeaders "+c.css.sticky+" "+f.stickyHeaders+" "+e.namespace.slice(1)+"_extra_table").wrap('
    '),x=w.parent().addClass(c.css.stickyHide).css({position:l.length?"absolute":"fixed",padding:parseInt(w.parent().parent().css("padding-left"),10),top:t+v,left:0,visibility:"hidden",zIndex:f.stickyHeaders_zIndex||2}),y=w.children("thead:first"),z="",A=0,B=function(a,c){var d,e,f,g,h,i=a.filter(":visible"),j=i.length;for(d=0;j>d;d++)g=c.filter(":visible").eq(d),h=i.eq(d),"border-box"===h.css("box-sizing")?e=h.outerWidth():"collapse"===g.css("border-collapse")?b.getComputedStyle?e=parseFloat(b.getComputedStyle(h[0],null).width):(f=parseFloat(h.css("border-width")),e=h.outerWidth()-parseFloat(h.css("padding-left"))-parseFloat(h.css("padding-right"))-f):e=h.width(),g.css({width:e,"min-width":e,"max-width":e})},C=function(){t=s.length?s.height()||0:parseInt(f.stickyHeaders_offset,10)||0,A=0,x.css({left:l.length?parseInt(l.css("padding-left"),10)||0:k.offset().left-parseInt(k.css("margin-left"),10)-o.scrollLeft()-A,width:k.outerWidth()}),B(k,w),B(q,j)},D=function(b){if(k.is(":visible")){// fixes #278 +// Detect nested tables - fixes #724 +v=u.length?u.offset().top-n.scrollTop()+u.height():0;var d=k.offset(),e=a.isWindow(n[0]),// $.isWindow needs jQuery 1.4.3 +f=a.isWindow(o[0]), +// scrollTop = ( $attach.length ? $attach.offset().top : $yScroll.scrollTop() ) + stickyOffset + nestedStickyTop, +g=(l.length?e?n.scrollTop():n.offset().top:n.scrollTop())+t+v,h=k.height()-(x.height()+(r.height()||0)),i=g>d.top&&gg;g++) +// send second parameter +e.onRenderHeader.apply(i.eq(g),[g,e,w]); +// make it sticky! +o.add(n).unbind("scroll resize ".split(" ").join(m).replace(/\s+/g," ")).bind("scroll resize ".split(" ").join(m),function(a){D("resize"===a.type)}),e.$table.unbind("stickyHeadersUpdate"+m).bind("stickyHeadersUpdate"+m,function(){D(!0)}),f.stickyHeaders_addResizeEvent&&c.addHeaderResizeEvent(d), +// look for filter widget +k.hasClass("hasFilters")&&f.filter_columnFilters&&( +// scroll table into view after filtering, if sticky header is active - #482 +k.bind("filterEnd"+m,function(){ +// $(':focus') needs jQuery 1.6+ +var d=a(document.activeElement).closest("td"),g=d.parent().children().index(d); +// only scroll if sticky header is active +x.hasClass(c.css.stickyVis)&&f.stickyHeaders_filteredToTop&&( +// scroll to original table (not sticky clone) +b.scrollTo(0,k.position().top), +// give same input/select focus; check if c.$filters exists; fixes #594 +g>=0&&e.$filters&&e.$filters.eq(g).find("a, select, input").filter(":visible").focus())}),c.filter.bindSearch(k,j.find("."+c.css.filter)), +// support hideFilters +f.filter_hideFilters&&c.filter.hideFilters(e,w)),k.trigger("stickyHeadersInit")}},remove:function(d,e,f){var g=e.namespace+"stickyheaders ";e.$table.removeClass("hasStickyHeaders").unbind("pagerComplete filterEnd stickyHeadersUpdate ".split(" ").join(g).replace(/\s+/g," ")).next("."+c.css.stickyWrap).remove(),f.$sticky&&f.$sticky.length&&f.$sticky.remove(),// remove cloned table +a(b).add(f.stickyHeaders_xScroll).add(f.stickyHeaders_yScroll).add(f.stickyHeaders_attachTo).unbind("scroll resize ".split(" ").join(g).replace(/\s+/g," ")),c.addHeaderResizeEvent(d,!1)}})}(jQuery,window),function(a,b){"use strict";var c=a.tablesorter||{};a.extend(c.css,{resizableContainer:"tablesorter-resizable-container",resizableHandle:"tablesorter-resizable-handle",resizableNoSelect:"tablesorter-disableSelection",resizableStorage:"tablesorter-resizable"}), +// Add extra scroller css +a(function(){var b="";a(b).appendTo("body")}),c.resizable={init:function(b,d){if(!b.$table.hasClass("hasResizable")){b.$table.addClass("hasResizable");var e,f,g,h,i,j=b.$table,k=j.parent(),l=parseInt(j.css("margin-top"),10), +// internal variables +m=d.resizable_vars={useStorage:c.storage&&d.resizable!==!1,$wrap:k,mouseXPosition:0,$target:null,$next:null,overflow:"auto"===k.css("overflow")||"scroll"===k.css("overflow")||"auto"===k.css("overflow-x")||"scroll"===k.css("overflow-x"),storedSizes:[]}; +// add container +for( +// set default widths +c.resizableReset(b.table,!0), +// now get measurements! +m.tableWidth=j.width(), +// attempt to autodetect +m.fullWidth=Math.abs(k.width()-m.tableWidth)<20,/* + // Hacky method to determine if table width is set to 'auto' + // http://stackoverflow.com/a/20892048/145346 + if ( !vars.fullWidth ) { + tmp = $table.width(); + $header = $table.wrap('').parent(); // temp variable + storedSizes = parseInt( $table.css( 'margin-left' ), 10 ) || 0; + $table.css( 'margin-left', storedSizes + 50 ); + vars.tableWidth = $header.width() > tmp ? 'auto' : tmp; + $table.css( 'margin-left', storedSizes ? storedSizes : '' ); + $header = null; + $table.unwrap(''); + } + */ +m.useStorage&&m.overflow&&( +// save table width +c.storage(b.table,"tablesorter-table-original-css-width",m.tableWidth),i=c.storage(b.table,"tablesorter-table-resized-width")||"auto",c.resizable.setWidth(j,i,!0)),d.resizable_vars.storedSizes=h=(m.useStorage?c.storage(b.table,c.css.resizableStorage):[])||[],c.resizable.setWidths(b,d,h),c.resizable.updateStoredSizes(b,d),d.$resizable_container=a('
    ').css({top:l}).insertBefore(j),g=0;g').appendTo(d.$resizable_container).attr({"data-column":g,unselectable:"on"}).data("header",f).bind("selectstart",!1);j.one("tablesorter-initialized",function(){c.resizable.setHandlePosition(b,d),c.resizable.bindings(this.config,this.config.widgetOptions)})}},updateStoredSizes:function(a,b){var c,d,e=a.columns,f=b.resizable_vars;for(f.storedSizes=[],c=0;e>c;c++)d=a.$headerIndexed[c],f.storedSizes[c]=d.is(":visible")?d.width():0},setWidth:function(a,b,c){ +// overflow tables need min & max width set as well +a.css({width:b,"min-width":c?b:"","max-width":c?b:""})},setWidths:function(b,d,e){var f,g,h=d.resizable_vars,i=a(b.namespace+"_extra_headers"),j=b.$table.children("colgroup").children("col"); +// process only if table ID or url match +if(e=e||h.storedSizes||[],e.length){for(f=0;ff||f===h&&d.resizable_addLastColumn)&&c.css({display:"inline-block",height:g,left:j.position().left-e+j.outerWidth()-i}):c.hide())})}, +// prevent text selection while dragging resize bar +toggleTextSelection:function(b,d){var e=b.namespace+"tsresize";b.widgetOptions.resizable_vars.disabled=d,a("body").toggleClass(c.css.resizableNoSelect,d),d?a("body").attr("unselectable","on").bind("selectstart"+e,!1):a("body").removeAttr("unselectable").unbind("selectstart"+e)},bindings:function(d,e){var f=d.namespace+"tsresize";e.$resizable_container.children().bind("mousedown",function(b){ +// save header cell and mouse position +var f,g=e.resizable_vars,h=a(d.namespace+"_extra_headers"),i=a(b.target).data("header");f=parseInt(i.attr("data-column"),10),g.$target=i=i.add(h.filter('[data-column="'+f+'"]')),g.target=f,g.$next=b.shiftKey||e.resizable_targetLast?i.parent().children().not(".resizable-false").filter(":last"):i.nextAll(":not(.resizable-false)").eq(0),f=parseInt(g.$next.attr("data-column"),10),g.$next=g.$next.add(h.filter('[data-column="'+f+'"]')),g.next=f,g.mouseXPosition=b.pageX,c.resizable.updateStoredSizes(d,e),c.resizable.toggleTextSelection(d,!0)}),a(document).bind("mousemove"+f,function(a){var b=e.resizable_vars; +// ignore mousemove if no mousedown +b.disabled&&0!==b.mouseXPosition&&b.$target&&(e.resizable_throttle?(clearTimeout(b.timer),b.timer=setTimeout(function(){c.resizable.mouseMove(d,e,a)},isNaN(e.resizable_throttle)?5:e.resizable_throttle)):c.resizable.mouseMove(d,e,a))}).bind("mouseup"+f,function(){e.resizable_vars.disabled&&(c.resizable.toggleTextSelection(d,!1),c.resizable.stopResize(d,e),c.resizable.setHandlePosition(d,e))}), +// resizeEnd event triggered by scroller widget +a(b).bind("resize"+f+" resizeEnd"+f,function(){c.resizable.setHandlePosition(d,e)}), +// right click to reset columns to default widths +d.$table.bind("columnUpdate"+f,function(){c.resizable.setHandlePosition(d,e)}).find("thead:first").add(a(d.namespace+"_extra_table").find("thead:first")).bind("contextmenu"+f,function(){ +// $.isEmptyObject() needs jQuery 1.4+; allow right click if already reset +var a=0===e.resizable_vars.storedSizes.length;return c.resizableReset(d.table),c.resizable.setHandlePosition(d,e),e.resizable_vars.storedSizes=[],a})},mouseMove:function(b,d,e){if(0!==d.resizable_vars.mouseXPosition&&d.resizable_vars.$target){ +// resize columns +var f,g=0,h=d.resizable_vars,i=h.$next,j=h.storedSizes[h.target],k=e.pageX-h.mouseXPosition;if(h.overflow){if(j+k>0){ +// update the entire table width +for(h.storedSizes[h.target]+=k,c.resizable.setWidth(h.$target,h.storedSizes[h.target],!0),f=0;f0?d.sortList=k:c.hasInitialized&&k&&k.length>0&&b.sortOn(d,k))},remove:function(a,c){c.$table.removeClass("hasSaveSort"), +// clear storage +b.storage&&b.storage(a,"tablesorter-savesort","")}})}(jQuery),a.tablesorter}); \ No newline at end of file diff --git a/dist/js/parsers/parser-date-extract.min.js b/dist/js/parsers/parser-date-extract.min.js index 240dc3e5..2e7b7bdf 100644 --- a/dist/js/parsers/parser-date-extract.min.js +++ b/dist/js/parsers/parser-date-extract.min.js @@ -1,6 +1,24 @@ /*! Parser: Extract out date - updated 10/26/2014 (v2.18.0) */ +/*jshint jquery:true */ !function(a){"use strict";var b={usLong:/[A-Z]{3,10}\.?\s+\d{1,2},?\s+(?:\d{4})(?:\s+\d{1,2}:\d{2}(?::\d{2})?(?:\s+[AP]M)?)?/i,mdy:/(\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/i,dmy:/(\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/i,dmyreplace:/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,ymd:/(\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/i,ymdreplace:/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/};/*! extract US Long Date */ -a.tablesorter.addParser({id:"extractUSLongDate",is:function(){return!1},format:function(a){var c,d=a?a.match(b.usLong):a;return d?(c=new Date(d[0]),c instanceof Date&&isFinite(c)?c.getTime():a):a},type:"numeric"}),/*! extract MMDDYYYY */ -a.tablesorter.addParser({id:"extractMMDDYYYY",is:function(){return!1},format:function(a){var c,d=a?a.replace(/\s+/g," ").replace(/[\-.,]/g,"/").match(b.mdy):a;return d?(c=new Date(d[0]),c instanceof Date&&isFinite(c)?c.getTime():a):a},type:"numeric"}),/*! extract DDMMYYYY */ -a.tablesorter.addParser({id:"extractDDMMYYYY",is:function(){return!1},format:function(a){var c,d=a?a.replace(/\s+/g," ").replace(/[\-.,]/g,"/").match(b.dmy):a;return d?(c=new Date(d[0].replace(b.dmyreplace,"$2/$1/$3")),c instanceof Date&&isFinite(c)?c.getTime():a):a},type:"numeric"}),/*! extract YYYYMMDD */ -a.tablesorter.addParser({id:"extractYYYYMMDD",is:function(){return!1},format:function(a){var c,d=a?a.replace(/\s+/g," ").replace(/[\-.,]/g,"/").match(b.ymd):a;return d?(c=new Date(d[0].replace(b.ymdreplace,"$2/$3/$1")),c instanceof Date&&isFinite(c)?c.getTime():a):a},type:"numeric"})}(jQuery); \ No newline at end of file +/* (ignore any other text) + * e.g. 'Sue's Birthday! Jun 26, 2004 7:22 AM (8# 2oz)' + * demo: http://jsfiddle.net/Mottie/abkNM/4165/ */ +a.tablesorter.addParser({id:"extractUSLongDate",is:function(){ +// don't auto detect this parser +return!1},format:function(a){var c,d=a?a.match(b.usLong):a;return d?(c=new Date(d[0]),c instanceof Date&&isFinite(c)?c.getTime():a):a},type:"numeric"}),/*! extract MMDDYYYY */ +/* (ignore any other text) + * demo: http://jsfiddle.net/Mottie/abkNM/4166/ */ +a.tablesorter.addParser({id:"extractMMDDYYYY",is:function(){ +// don't auto detect this parser +return!1},format:function(a){var c,d=a?a.replace(/\s+/g," ").replace(/[\-.,]/g,"/").match(b.mdy):a;return d?(c=new Date(d[0]),c instanceof Date&&isFinite(c)?c.getTime():a):a},type:"numeric"}),/*! extract DDMMYYYY */ +/* (ignore any other text) + * demo: http://jsfiddle.net/Mottie/abkNM/4167/ */ +a.tablesorter.addParser({id:"extractDDMMYYYY",is:function(){ +// don't auto detect this parser +return!1},format:function(a){var c,d=a?a.replace(/\s+/g," ").replace(/[\-.,]/g,"/").match(b.dmy):a;return d?(c=new Date(d[0].replace(b.dmyreplace,"$2/$1/$3")),c instanceof Date&&isFinite(c)?c.getTime():a):a},type:"numeric"}),/*! extract YYYYMMDD */ +/* (ignore any other text) + * demo: http://jsfiddle.net/Mottie/abkNM/4168/ */ +a.tablesorter.addParser({id:"extractYYYYMMDD",is:function(){ +// don't auto detect this parser +return!1},format:function(a){var c,d=a?a.replace(/\s+/g," ").replace(/[\-.,]/g,"/").match(b.ymd):a;return d?(c=new Date(d[0].replace(b.ymdreplace,"$2/$3/$1")),c instanceof Date&&isFinite(c)?c.getTime():a):a},type:"numeric"})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-date-iso8601.min.js b/dist/js/parsers/parser-date-iso8601.min.js index 35e93614..db6c9574 100644 --- a/dist/js/parsers/parser-date-iso8601.min.js +++ b/dist/js/parsers/parser-date-iso8601.min.js @@ -1,2 +1,8 @@ /*! Parser: ISO-8601 date - updated 10/26/2014 (v2.18.0) */ +/* This parser works with dates in ISO8601 format + * 2013-02-18T18:18:44+00:00 + * Written by Sean Ellingham :https://github.com/seanellingham + * See https://github.com/Mottie/tablesorter/issues/247 + */ +/*global jQuery: false */ !function(a){"use strict";var b=/^([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?$/;a.tablesorter.addParser({id:"iso8601date",is:function(a){return a?a.match(b):!1},format:function(a){var c=a?a.match(b):a;if(c){var d=new Date(c[1],0,1);return c[3]&&d.setMonth(c[3]-1),c[5]&&d.setDate(c[5]),c[7]&&d.setHours(c[7]),c[8]&&d.setMinutes(c[8]),c[10]&&d.setSeconds(c[10]),c[12]&&d.setMilliseconds(1e3*Number("0."+c[12])),d.getTime()}return a},type:"numeric"})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-date-month.min.js b/dist/js/parsers/parser-date-month.min.js index 45c1ec54..168cdd69 100644 --- a/dist/js/parsers/parser-date-month.min.js +++ b/dist/js/parsers/parser-date-month.min.js @@ -1,2 +1,9 @@ /*! Parser: Month - updated 10/26/2014 (v2.18.0) */ -!function(a){"use strict";var b=a.tablesorter;b.dates=a.extend({},b.dates,{monthCased:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),b.dates.monthLower=b.dates.monthCased.join(",").toLocaleLowerCase().split(","),b.addParser({id:"month",is:function(){return!1},format:function(c,d){if(c){var e=-1,f=d.config,g=f.ignoreCase?c.toLocaleLowerCase():c;return a.each(b.dates["month"+(f.ignoreCase?"Lower":"Cased")],function(a,b){return 0>e&&g.match(b)?(e=a,!1):void 0}),0>e?c:e}return c},type:"numeric"})}(jQuery); \ No newline at end of file +/* Demo: http://jsfiddle.net/Mottie/abkNM/4169/ */ +/*jshint jquery:true */ +!function(a){"use strict";var b=a.tablesorter;b.dates=a.extend({},b.dates,{ +// *** modify this array to match the desired language *** +monthCased:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),b.dates.monthLower=b.dates.monthCased.join(",").toLocaleLowerCase().split(","),b.addParser({id:"month",is:function(){return!1},format:function(c,d){if(c){var e=-1,f=d.config,g=f.ignoreCase?c.toLocaleLowerCase():c; +// return s (original string) if there isn't a match +// (non-weekdays will sort separately and empty cells will sort as expected) +return a.each(b.dates["month"+(f.ignoreCase?"Lower":"Cased")],function(a,b){return 0>e&&g.match(b)?(e=a,!1):void 0}),0>e?c:e}return c},type:"numeric"})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-date-range.min.js b/dist/js/parsers/parser-date-range.min.js index 5eebe07e..64b11dec 100644 --- a/dist/js/parsers/parser-date-range.min.js +++ b/dist/js/parsers/parser-date-range.min.js @@ -1,5 +1,18 @@ /*! Parser: date ranges - updated 2/23/2015 (v2.21.0) */ +/* Include the 'widget-filter-type-insideRange.js' to filter ranges */ +/*jshint jquery:true */ !function(a){"use strict";var b={mdy:/(\d{1,2}[-\s]\d{1,2}[-\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/gi,dmy:/(\d{1,2}[-\s]\d{1,2}[-\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/gi,dmyreplace:/(\d{1,2})[-\s](\d{1,2})[-\s](\d{4})/,ymd:/(\d{4}[-\s]\d{1,2}[-\s]\d{1,2}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/gi,ymdreplace:/(\d{4})[-\s](\d{1,2})[-\s](\d{1,2})/};/*! date-range MMDDYYYY */ -a.tablesorter.addParser({id:"date-range-mdy",is:function(){return!1},format:function(a){var c,d,e,f,g=[];if(d=a.replace(/\s+/g," ").replace(/[\/\-.,]/g,"-").match(b.mdy),f=d&&d.length){for(e=0;f>e;e++)c=new Date(d[e]),g.push(c instanceof Date&&isFinite(c)?c.getTime():d[e]);return g.sort().join(" - ")}return a},type:"text"}),/*! date-range DDMMYYYY */ -a.tablesorter.addParser({id:"date-range-dmy",is:function(){return!1},format:function(a){var c,d,e,f,g=[];if(d=a.replace(/\s+/g," ").replace(/[\/\-.,]/g,"-").match(b.dmy),f=d&&d.length){for(e=0;f>e;e++)c=new Date((""+d[e]).replace(b.dmyreplace,"$2/$1/$3")),g.push(c instanceof Date&&isFinite(c)?c.getTime():d[e]);return g.sort().join(" - ")}return a},type:"text"}),/*! date-range DDMMYYYY */ -a.tablesorter.addParser({id:"date-range-ymd",is:function(){return!1},format:function(a){var c,d,e,f,g=[];if(d=a.replace(/\s+/g," ").replace(/[\/\-.,]/g,"-").match(b.ymd),f=d&&d.length){for(e=0;f>e;e++)c=new Date((""+d[e]).replace(b.ymdreplace,"$2/$3/$1")),g.push(c instanceof Date&&isFinite(c)?c.getTime():d[e]);return g.sort().join(" - ")}return a},type:"text"})}(jQuery); \ No newline at end of file +/* (2/15/2000 - 5/18/2000) */ +a.tablesorter.addParser({id:"date-range-mdy",is:function(){return!1},format:function(a){var c,d,e,f,g=[]; +// work on dates, even if there is no range +if(d=a.replace(/\s+/g," ").replace(/[\/\-.,]/g,"-").match(b.mdy),f=d&&d.length){for(e=0;f>e;e++)c=new Date(d[e]),g.push(c instanceof Date&&isFinite(c)?c.getTime():d[e]); +// sort from min to max +return g.sort().join(" - ")}return a},type:"text"}),/*! date-range DDMMYYYY */ +/* (15/2/2000 - 18/5/2000) */ +a.tablesorter.addParser({id:"date-range-dmy",is:function(){return!1},format:function(a){var c,d,e,f,g=[];if(d=a.replace(/\s+/g," ").replace(/[\/\-.,]/g,"-").match(b.dmy),f=d&&d.length){for(e=0;f>e;e++)c=new Date((""+d[e]).replace(b.dmyreplace,"$2/$1/$3")),g.push(c instanceof Date&&isFinite(c)?c.getTime():d[e]); +// sort from min to max +return g.sort().join(" - ")}return a},type:"text"}),/*! date-range DDMMYYYY */ +/* (2000/2/15 - 2000/5/18) */ +a.tablesorter.addParser({id:"date-range-ymd",is:function(){return!1},format:function(a){var c,d,e,f,g=[];if(d=a.replace(/\s+/g," ").replace(/[\/\-.,]/g,"-").match(b.ymd),f=d&&d.length){for(e=0;f>e;e++)c=new Date((""+d[e]).replace(b.ymdreplace,"$2/$3/$1")),g.push(c instanceof Date&&isFinite(c)?c.getTime():d[e]); +// sort from min to max +return g.sort().join(" - ")}return a},type:"text"})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-date-two-digit-year.min.js b/dist/js/parsers/parser-date-two-digit-year.min.js index 27f547f7..3af02c0d 100644 --- a/dist/js/parsers/parser-date-two-digit-year.min.js +++ b/dist/js/parsers/parser-date-two-digit-year.min.js @@ -1,2 +1,19 @@ /*! Parser: two digit year - updated 10/26/2014 (v2.18.0) */ -!function(a){"use strict";var b=50,c=a.tablesorter,d=(new Date).getFullYear();c.dates=a.extend({},c.dates,{regxxxxyy:/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{2})/,regyyxxxx:/(\d{2})[\/\s](\d{1,2})[\/\s](\d{1,2})/}),c.formatDate=function(a,c,e,f){if(a){var g,h,i=a.replace(/\s+/g," ").replace(/[-.,]/g,"/").replace(c,e),j=new Date(i);if(j instanceof Date&&isFinite(j)){for(g=j.getFullYear(),h=f&&f.config.dateRange||b;d-g>h;)g+=100;return j.setFullYear(g)}}return a},a.tablesorter.addParser({id:"ddmmyy",is:function(){return!1},format:function(a,b){return c.formatDate(a,c.dates.regxxxxyy,"$2/$1/19$3",b)},type:"numeric"}),a.tablesorter.addParser({id:"mmddyy",is:function(){return!1},format:function(a,b){return c.formatDate(a,c.dates.regxxxxyy,"$1/$2/19$3",b)},type:"numeric"}),a.tablesorter.addParser({id:"yymmdd",is:function(){return!1},format:function(a,b){return c.formatDate(a,c.dates.regyyxxxx,"$2/$3/19$1",b)},type:"numeric"})}(jQuery); \ No newline at end of file +/* Demo: http://mottie.github.io/tablesorter/docs/example-parsers-dates.html */ +/*jshint jquery:true */ +!function(a){"use strict"; +// Make the date be within +/- range of the 2 digit year +// so if the current year is 2020, and the 2 digit year is 80 (2080 - 2020 > 50), it becomes 1980 +// if the 2 digit year is 50 (2050 - 2020 < 50), then it becomes 2050. +var b=50, +// no need to change any of the code below +c=a.tablesorter,d=(new Date).getFullYear();c.dates=a.extend({},c.dates,{regxxxxyy:/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{2})/,regyyxxxx:/(\d{2})[\/\s](\d{1,2})[\/\s](\d{1,2})/}),c.formatDate=function(a,c,e,f){if(a){var g,h,i=a.replace(/\s+/g," ").replace(/[-.,]/g,"/").replace(c,e),j=new Date(i);if(j instanceof Date&&isFinite(j)){ +// if date > 50 years old (set range), add 100 years +// this will work when people start using '50' and mean '2050' +for(g=j.getFullYear(),h=f&&f.config.dateRange||b;d-g>h;)g+=100;return j.setFullYear(g)}}return a},a.tablesorter.addParser({id:"ddmmyy",is:function(){return!1},format:function(a,b){ +// reformat dd/mm/yy to mm/dd/19yy; +return c.formatDate(a,c.dates.regxxxxyy,"$2/$1/19$3",b)},type:"numeric"}),a.tablesorter.addParser({id:"mmddyy",is:function(){return!1},format:function(a,b){ +// reformat mm/dd/yy to mm/dd/19yy +return c.formatDate(a,c.dates.regxxxxyy,"$1/$2/19$3",b)},type:"numeric"}),a.tablesorter.addParser({id:"yymmdd",is:function(){return!1},format:function(a,b){ +// reformat yy/mm/dd to mm/dd/19yy +return c.formatDate(a,c.dates.regyyxxxx,"$2/$3/19$1",b)},type:"numeric"})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-date-weekday.min.js b/dist/js/parsers/parser-date-weekday.min.js index 7bfb15f5..89f2a278 100644 --- a/dist/js/parsers/parser-date-weekday.min.js +++ b/dist/js/parsers/parser-date-weekday.min.js @@ -1,2 +1,9 @@ /*! Parser: weekday - updated 10/26/2014 (v2.18.0) */ -!function(a){"use strict";var b=a.tablesorter;b.dates=a.extend({},b.dates,{weekdayCased:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}),b.dates.weekdayLower=b.dates.weekdayCased.join(",").toLocaleLowerCase().split(","),b.addParser({id:"weekday",is:function(){return!1},format:function(c,d){if(c){var e=-1,f=d.config;return c=f.ignoreCase?c.toLocaleLowerCase():c,a.each(b.dates["weekday"+(f.ignoreCase?"Lower":"Cased")],function(a,b){return 0>e&&c.match(b)?(e=a,!1):void 0}),0>e?c:e}return c},type:"numeric"})}(jQuery); \ No newline at end of file +/* Demo: http://jsfiddle.net/Mottie/abkNM/4169/ */ +/*jshint jquery:true */ +!function(a){"use strict";var b=a.tablesorter;b.dates=a.extend({},b.dates,{ +// *** modify this array to change match the language *** +weekdayCased:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}),b.dates.weekdayLower=b.dates.weekdayCased.join(",").toLocaleLowerCase().split(","),b.addParser({id:"weekday",is:function(){return!1},format:function(c,d){if(c){var e=-1,f=d.config; +// return s (original string) if there isn't a match +// (non-weekdays will sort separately and empty cells will sort as expected) +return c=f.ignoreCase?c.toLocaleLowerCase():c,a.each(b.dates["weekday"+(f.ignoreCase?"Lower":"Cased")],function(a,b){return 0>e&&c.match(b)?(e=a,!1):void 0}),0>e?c:e}return c},type:"numeric"})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-date.min.js b/dist/js/parsers/parser-date.min.js index 9f345a98..11edd303 100644 --- a/dist/js/parsers/parser-date.min.js +++ b/dist/js/parsers/parser-date.min.js @@ -1,4 +1,8 @@ /*! Parser: dates - updated 10/26/2014 (v2.18.0) */ +/* Extract dates using popular natural language date parsers */ +/*jshint jquery:true */ !function(a){"use strict";/*! Sugar (http://sugarjs.com/dates#comparing_dates) */ +/* demo: http://jsfiddle.net/Mottie/abkNM/4163/ */ a.tablesorter.addParser({id:"sugar",is:function(){return!1},format:function(a){var b=Date.create?Date.create(a):a?new Date(a):a;return b instanceof Date&&isFinite(b)?b.getTime():a},type:"numeric"}),/*! Datejs (http://www.datejs.com/) */ +/* demo: http://jsfiddle.net/Mottie/abkNM/4164/ */ a.tablesorter.addParser({id:"datejs",is:function(){return!1},format:function(a){var b=Date.parse?Date.parse(a):a?new Date(a):a;return b instanceof Date&&isFinite(b)?b.getTime():a},type:"numeric"})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-duration.min.js b/dist/js/parsers/parser-duration.min.js index 29efa5c5..e8361e1d 100644 --- a/dist/js/parsers/parser-duration.min.js +++ b/dist/js/parsers/parser-duration.min.js @@ -1,3 +1,22 @@ /*! Parser: duration & countdown - updated 2/7/2015 (v2.19.0) */ -!function(a){"use strict";a.tablesorter.addParser({id:"duration",is:function(){return!1},format:function(a,b){var c,d,e=b.config,f="",g="",h=e.durationLength||4,i=new Array(h+1).join("0"),j=(e.durationLabels||"(?:years|year|y),(?:days|day|d),(?:hours|hour|h),(?:minutes|minute|min|m),(?:seconds|second|sec|s)").split(/\s*,\s*/),k=j.length;if(!e.durationRegex){for(c=0;k>c;c++)f+="(?:(\\d+)\\s*"+j[c]+"\\s*)?";e.durationRegex=new RegExp(f,"i")}for(d=(e.usNumberFormat?a.replace(/,/g,""):a.replace(/(\d)(?:\.|\s*)(\d)/g,"$1$2")).match(e.durationRegex),c=1;k+1>c;c++)g+=(i+(d[c]||0)).slice(-h);return g},type:"text"}),/*! Countdown parser ( hh:mm:ss ) */ -a.tablesorter.addParser({id:"countdown",is:function(){return!1},format:function(a,b){for(var c=b.config.durationLength||4,d=new Array(c+1).join("0"),e=a.split(/\s*:\s*/),f=e.length,g=[];f;)g.push((d+(e[--f]||0)).slice(-c));return g.length?g.reverse().join(""):a},type:"text"})}(jQuery); \ No newline at end of file +/*jshint jquery:true, unused:false */ +!function(a){"use strict"; +// If any number > 9999, then set table.config.durationLength = 5 +// The below regex matches this duration example: 1y 23d 12h 44m 9s +a.tablesorter.addParser({id:"duration",is:function(){return!1},format:function(a,b){var c,d,e=b.config,f="",g="",h=e.durationLength||4,i=new Array(h+1).join("0"),j=(e.durationLabels||"(?:years|year|y),(?:days|day|d),(?:hours|hour|h),(?:minutes|minute|min|m),(?:seconds|second|sec|s)").split(/\s*,\s*/),k=j.length; +// build regex +if(!e.durationRegex){for(c=0;k>c;c++)f+="(?:(\\d+)\\s*"+j[c]+"\\s*)?";e.durationRegex=new RegExp(f,"i")}for(d=(e.usNumberFormat?a.replace(/,/g,""):a.replace(/(\d)(?:\.|\s*)(\d)/g,"$1$2")).match(e.durationRegex),c=1;k+1>c;c++)g+=(i+(d[c]||0)).slice(-h);return g},type:"text"}),/*! Countdown parser ( hh:mm:ss ) */ +/* Added 2/7/2015 (v2.19.0) - see http://stackoverflow.com/a/27023733/145346 */ +a.tablesorter.addParser({id:"countdown",is:function(){return!1},format:function(a,b){ +// add values in reverse, so if there is only one block +// ( e.g. '10' ), then it would be the time in seconds +for( +// change maxDigits to 4, if values go > 999 +// or to 5 for values > 9999, etc. +var c=b.config.durationLength||4, +// prefix contains leading zeros that are tacked +d=new Array(c+1).join("0"), +// split time into blocks +e=a.split(/\s*:\s*/),f=e.length,g=[];f;)g.push((d+(e[--f]||0)).slice(-c)); +// reverse the results and join them +return g.length?g.reverse().join(""):a},type:"text"})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-feet-inch-fraction.min.js b/dist/js/parsers/parser-feet-inch-fraction.min.js index a1f72aba..454ef605 100644 --- a/dist/js/parsers/parser-feet-inch-fraction.min.js +++ b/dist/js/parsers/parser-feet-inch-fraction.min.js @@ -1,2 +1,25 @@ /*! Parser: distance */ -!function(a){"use strict";var b=a.tablesorter;b.symbolRegex=/[\u215b\u215c\u215d\u215e\u00bc\u00bd\u00be]/g,b.processFractions=function(c,d){if(c){var e,f=0;c=a.trim(c.replace(/\"/,"")),/\s/.test(c)&&(f=b.formatFloat(c.split(" ")[0],d),c=a.trim(c.substring(c.indexOf(" "),c.length))),/\//g.test(c)?(e=c.split("/"),c=f+parseInt(e[0],10)/parseInt(e[1]||1,10)):b.symbolRegex.test(c)&&(c=f+c.replace(b.symbolRegex,function(a){return{"⅛":".125","⅜":".375","⅝":".625","⅞":".875","¼":".25","½":".5","¾":".75"}[a]}))}return c||0},a.tablesorter.addParser({id:"distance",is:function(){return!1},format:function(a,c){if(""===a)return"";var d=/^\s*\S*(\s+\S+)?\s*\'/.test(a)?a.split(/\'/):[0,a],e=b.processFractions(d[0],c),f=b.processFractions(d[1],c);return/[\'\"]/.test(a)?parseFloat(e)+(parseFloat(f)/12||0):parseFloat(e)+parseFloat(f)},type:"numeric"})}(jQuery); \ No newline at end of file +/* +* This parser will parser numbers like 5'10" (5 foot 10 inches) +* and 31½ into sortable values. +* Demo: http://jsfiddle.net/Mottie/abkNM/154/ +*/ +/*global jQuery: false */ +!function(a){"use strict";var b=a.tablesorter;b.symbolRegex=/[\u215b\u215c\u215d\u215e\u00bc\u00bd\u00be]/g,b.processFractions=function(c,d){if(c){var e,f=0;c=a.trim(c.replace(/\"/,"")), +// look for a space in the first part of the number: '10 3/4' and save the '10' +/\s/.test(c)&&(f=b.formatFloat(c.split(" ")[0],d),c=a.trim(c.substring(c.indexOf(" "),c.length))), +// look for a '/' to calculate fractions +/\//g.test(c)?(e=c.split("/"),c=f+parseInt(e[0],10)/parseInt(e[1]||1,10)):b.symbolRegex.test(c)&&(c=f+c.replace(b.symbolRegex,function(a){return{"⅛":".125",// 1/8 +"⅜":".375",// 3/8 +"⅝":".625",// 5/8 +"⅞":".875",// 7/8 +"¼":".25",// 1/4 +"½":".5",// 1/2 +"¾":".75"}[a]}))}return c||0},a.tablesorter.addParser({id:"distance",is:function(){ +// return false so this parser is not auto detected +return!1},format:function(a,c){if(""===a)return""; +// look for feet symbol = ' +// very generic test to catch 1.1', 1 1/2' and 1½' +var d=/^\s*\S*(\s+\S+)?\s*\'/.test(a)?a.split(/\'/):[0,a],e=b.processFractions(d[0],c),// feet +f=b.processFractions(d[1],c);// inches +return/[\'\"]/.test(a)?parseFloat(e)+(parseFloat(f)/12||0):parseFloat(e)+parseFloat(f)},type:"numeric"})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-file-type.min.js b/dist/js/parsers/parser-file-type.min.js index 66ef0908..62863866 100644 --- a/dist/js/parsers/parser-file-type.min.js +++ b/dist/js/parsers/parser-file-type.min.js @@ -1,2 +1,13 @@ /*! Parser: filetype */ -!function(a){"use strict";a.tablesorter.fileTypes={separator:"|",equivalents:{"3D Image":"3dm|3ds|dwg|max|obj",Audio:"aif|aac|ape|flac|la|m4a|mid|midi|mp2|mp3|ogg|ra|raw|rm|wav|wma",Compressed:"7z|bin|cab|cbr|gz|gzip|iso|lha|lz|rar|tar|tgz|zip|zipx|zoo",Database:"csv|dat|db|dbf|json|ldb|mdb|myd|pdb|sql|tsv|wdb|wmdb|xlr|xls|xlsx|xml",Development:"asm|c|class|cls|cpp|cc|cs|cxx|cbp|cs|dba|fla|h|java|lua|pl|py|pyc|pyo|sh|sln|r|rb|vb",Document:"doc|docx|odt|ott|pages|pdf|rtf|tex|wpd|wps|wrd|wri",Executable:"apk|app|com|exe|gadget|lnk|msi",Fonts:"eot|fnt|fon|otf|ttf|woff",Icons:"ani|cur|icns|ico",Images:"bmp|gif|jpg|jpeg|jpe|jp2|pic|png|psd|tga|tif|tiff|wmf|webp",Presentation:"pps|ppt",Published:"chp|epub|lit|pub|ppp|fm|mobi",Script:"as|bat|cgi|cmd|jar|js|lua|scpt|scptd|sh|vbs|vb|wsf",Styles:"css|less|sass",Text:"info|log|md|markdown|nfo|tex|text|txt",Vectors:"awg|ai|eps|cdr|ps|svg",Video:"asf|avi|flv|m4v|mkv|mov|mp4|mpe|mpeg|mpg|ogg|rm|rv|swf|vob|wmv",Web:"asp|aspx|cer|cfm|htm|html|php|url|xhtml"}},a.tablesorter.addParser({id:"filetype",is:function(){return!1},format:function(b,c){var d,e=c.config,f=e.widgetOptions,g=b.lastIndexOf("."),h=a.tablesorter.fileTypes.separator,i=a.tablesorter.fileTypes.matching,j=a.tablesorter.fileTypes.equivalents;if(i||(d=[],a.each(j,function(a,b){d.push(b)}),i=a.tablesorter.fileTypes.matching=h+d.join(h)+h),g>=0&&(d=h+b.substring(g+1,b.length)+h,i.indexOf(d)>=0))for(g in j)if((h+j[g]+h).indexOf(d)>=0)return g+(f.group_separator?f.group_separator:"-")+b;return b},type:"text"})}(jQuery); \ No newline at end of file +/* + * When a file type extension is found, the equivalent name is + * prefixed into the parsed data, so sorting occurs in groups + */ +/*global jQuery: false */ +!function(a){"use strict"; +// basic list from http://en.wikipedia.org/wiki/List_of_file_formats +// To add a custom equivalent, define: +// $.tablesorter.fileTypes.equivalents['xx'] = 'A|B|C'; +a.tablesorter.fileTypes={ +// divides filetype extensions in the equivalent list below +separator:"|",equivalents:{"3D Image":"3dm|3ds|dwg|max|obj",Audio:"aif|aac|ape|flac|la|m4a|mid|midi|mp2|mp3|ogg|ra|raw|rm|wav|wma",Compressed:"7z|bin|cab|cbr|gz|gzip|iso|lha|lz|rar|tar|tgz|zip|zipx|zoo",Database:"csv|dat|db|dbf|json|ldb|mdb|myd|pdb|sql|tsv|wdb|wmdb|xlr|xls|xlsx|xml",Development:"asm|c|class|cls|cpp|cc|cs|cxx|cbp|cs|dba|fla|h|java|lua|pl|py|pyc|pyo|sh|sln|r|rb|vb",Document:"doc|docx|odt|ott|pages|pdf|rtf|tex|wpd|wps|wrd|wri",Executable:"apk|app|com|exe|gadget|lnk|msi",Fonts:"eot|fnt|fon|otf|ttf|woff",Icons:"ani|cur|icns|ico",Images:"bmp|gif|jpg|jpeg|jpe|jp2|pic|png|psd|tga|tif|tiff|wmf|webp",Presentation:"pps|ppt",Published:"chp|epub|lit|pub|ppp|fm|mobi",Script:"as|bat|cgi|cmd|jar|js|lua|scpt|scptd|sh|vbs|vb|wsf",Styles:"css|less|sass",Text:"info|log|md|markdown|nfo|tex|text|txt",Vectors:"awg|ai|eps|cdr|ps|svg",Video:"asf|avi|flv|m4v|mkv|mov|mp4|mpe|mpeg|mpg|ogg|rm|rv|swf|vob|wmv",Web:"asp|aspx|cer|cfm|htm|html|php|url|xhtml"}},a.tablesorter.addParser({id:"filetype",is:function(){return!1},format:function(b,c){var d,e=c.config,f=e.widgetOptions,g=b.lastIndexOf("."),h=a.tablesorter.fileTypes.separator,i=a.tablesorter.fileTypes.matching,j=a.tablesorter.fileTypes.equivalents;if(i||(d=[],a.each(j,function(a,b){d.push(b)}),i=a.tablesorter.fileTypes.matching=h+d.join(h)+h),g>=0&&(d=h+b.substring(g+1,b.length)+h,i.indexOf(d)>=0))for(g in j)if((h+j[g]+h).indexOf(d)>=0)return g+(f.group_separator?f.group_separator:"-")+b;return b},type:"text"})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-globalize.min.js b/dist/js/parsers/parser-globalize.min.js index f67127dc..2b22c331 100644 --- a/dist/js/parsers/parser-globalize.min.js +++ b/dist/js/parsers/parser-globalize.min.js @@ -1,4 +1,14 @@ /*! Parser: jQuery Globalize - updated 10/26/2015 (v2.23.6) */ +/* Extract localized data using jQuery's Globalize parsers; set + Globalize.locale( 'xx' ) in the globalize settings */ +/*jshint jquery:true, newcap: false */ +/*global Globalize:false */ !function(a){"use strict";/*! jQuery Globalize date parser (https://github.com/jquery/globalize#date-module) */ -a.tablesorter.addParser({id:"globalize-date",is:function(){return!1},format:function(a,b,c,d){var e,f,g=b.config,h=g.globalize&&(g.globalize[d]||g.globalize)||{};return Globalize&&(e="object"==typeof h.lang?h.lang:Globalize(h.lang||"en")),f=e&&e.dateParser?e.dateParser(h)(a):a?new Date(a):a,f instanceof Date&&isFinite(f)?f.getTime():a},type:"numeric"}),/*! jQuery Globalize number parser (https://github.com/jquery/globalize#number-module) */ -a.tablesorter.addParser({id:"globalize-number",is:function(){return!1},format:function(b,c,d,e){var f,g,h=c.config,i=h.globalize&&(h.globalize[e]||h.globalize)||{};return Globalize&&(f="object"==typeof i.lang?i.lang:Globalize(i.lang||"en")),g=f&&f.numberParser?f.numberParser(i)(b):b?a.tablesorter.formatFloat((b||"").replace(/[^\w,. \-()]/g,""),c):b,b&&"number"==typeof g?g:b},type:"numeric"})}(jQuery); \ No newline at end of file +a.tablesorter.addParser({id:"globalize-date",is:function(){return!1},format:function(a,b,c,d){var e,f,g=b.config, +// add options to 'config.globalize' for all columns --> globalize : { skeleton: 'GyMMMd' } +// or per column by using the column index --> globalize : { 0 : { datetime: 'medium' } } +h=g.globalize&&(g.globalize[d]||g.globalize)||{};return Globalize&&(e="object"==typeof h.lang?h.lang:Globalize(h.lang||"en")),f=e&&e.dateParser?e.dateParser(h)(a):a?new Date(a):a,f instanceof Date&&isFinite(f)?f.getTime():a},type:"numeric"}),/*! jQuery Globalize number parser (https://github.com/jquery/globalize#number-module) */ +a.tablesorter.addParser({id:"globalize-number",is:function(){return!1},format:function(b,c,d,e){var f,g,h=c.config, +// add options to 'config.globalize' for all columns --> globalize : { skeleton: 'GyMMMd' } +// or per column by using the column index --> globalize : { 0 : { datetime: 'medium' } } +i=h.globalize&&(h.globalize[e]||h.globalize)||{};return Globalize&&(f="object"==typeof i.lang?i.lang:Globalize(i.lang||"en")),g=f&&f.numberParser?f.numberParser(i)(b):b?a.tablesorter.formatFloat((b||"").replace(/[^\w,. \-()]/g,""),c):b,b&&"number"==typeof g?g:b},type:"numeric"})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-ignore-articles.min.js b/dist/js/parsers/parser-ignore-articles.min.js index 41771a1c..55781396 100644 --- a/dist/js/parsers/parser-ignore-articles.min.js +++ b/dist/js/parsers/parser-ignore-articles.min.js @@ -1,2 +1,17 @@ /*! Parser: ignoreArticles - updated 9/15/2014 (v2.17.8) */ -!function(a){"use strict";var b=a.tablesorter;b.ignoreArticles={en:"the, a, an",de:"der, die, das, des, dem, den, ein, eine, einer, eines, einem, einen",nl:"de, het, de, een",es:"el, la, lo, los, las, un, una, unos, unas",pt:"o, a, os, as, um, uma, uns, umas",fr:"le, la, l'_, les, un, une, des",it:"il, lo, la, l'_, i, gli, le, un', uno, una, un",hu:"a, az, egy"},b.addParser({id:"ignoreArticles",is:function(){return!1},format:function(c,d,e,f){var g,h,i,j=d.config,k=c||"";return j.headers&&j.headers[f]&&j.headers[f].ignoreArticlesRegex||(j.headers||(j.headers={}),j.headers[f]||(j.headers[f]={}),i=b.getData(j.$headers.eq(f),b.getColumnData(d,j.headers,f),"ignoreArticles"),g=(b.ignoreArticles[i]||"the, a, an")+"",j.headers[f].ignoreArticlesRegex=new RegExp("^("+a.trim(g.split(/\s*\,\s*/).join("\\s|")+"\\s").replace("_\\s","")+")","i"),h=b.getData(j.$headers.eq(f),b.getColumnData(d,j.headers,f),"ignoreArticlesExcept"),j.headers[f].ignoreArticlesRegex2=""!==h?new RegExp("^("+h.replace(/\s/g,"\\s")+")","i"):""),g=j.headers[f].ignoreArticlesRegex,!g.test(k)||(h=j.headers[f].ignoreArticlesRegex2,h&&h.test(k))?k:k.replace(g,"")},type:"text"})}(jQuery); \ No newline at end of file +/* + * This parser will remove 'The', 'A' and 'An' from the beginning of a book + * or movie title, so it sorts by the second word or number + * Demo: http://jsfiddle.net/Mottie/abkNM/5/ + */ +/*jshint browser: true, jquery:true, unused:false */ +!function(a){"use strict";var b=a.tablesorter; +// basic list from http://en.wikipedia.org/wiki/Article_%28grammar%29 +b.ignoreArticles={en:"the, a, an",de:"der, die, das, des, dem, den, ein, eine, einer, eines, einem, einen",nl:"de, het, de, een",es:"el, la, lo, los, las, un, una, unos, unas",pt:"o, a, os, as, um, uma, uns, umas",fr:"le, la, l'_, les, un, une, des",it:"il, lo, la, l'_, i, gli, le, un', uno, una, un",hu:"a, az, egy"}, +// To add a custom parser, define: +// $.tablesorter.ignoreArticles['xx'] = 'A, B, C'; +// and then set the language id 'xx' in the headers option +// ignoreArticles : 'xx' +b.addParser({id:"ignoreArticles",is:function(){return!1},format:function(c,d,e,f){var g,h,i,j=d.config,k=c||"";return j.headers&&j.headers[f]&&j.headers[f].ignoreArticlesRegex||( +// initialize - save regex in c.headers[cellIndex].ignoreArticlesRegex +j.headers||(j.headers={}),j.headers[f]||(j.headers[f]={}),i=b.getData(j.$headers.eq(f),b.getColumnData(d,j.headers,f),"ignoreArticles"),g=(b.ignoreArticles[i]||"the, a, an")+"",j.headers[f].ignoreArticlesRegex=new RegExp("^("+a.trim(g.split(/\s*\,\s*/).join("\\s|")+"\\s").replace("_\\s","")+")","i"),h=b.getData(j.$headers.eq(f),b.getColumnData(d,j.headers,f),"ignoreArticlesExcept"),j.headers[f].ignoreArticlesRegex2=""!==h?new RegExp("^("+h.replace(/\s/g,"\\s")+")","i"):""),g=j.headers[f].ignoreArticlesRegex,!g.test(k)||(h=j.headers[f].ignoreArticlesRegex2,h&&h.test(k))?k:k.replace(g,"")},type:"text"})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-image.min.js b/dist/js/parsers/parser-image.min.js index 624029b3..a31ada1c 100644 --- a/dist/js/parsers/parser-image.min.js +++ b/dist/js/parsers/parser-image.min.js @@ -1,2 +1,5 @@ /*! Parser: image - new 7/17/2014 (v2.17.5) */ -!function(a){"use strict";a.tablesorter.addParser({id:"image",is:function(){return!1},format:function(b,c,d){return a(d).find("img").attr(c.config.imgAttr||"alt")||b},parsed:!0,type:"text"})}(jQuery); \ No newline at end of file +/* alt attribute parser for jQuery 1.7+ & tablesorter 2.7.11+ */ +/*jshint jquery:true, unused:false */ +!function(a){"use strict";a.tablesorter.addParser({id:"image",is:function(){return!1},format:function(b,c,d){return a(d).find("img").attr(c.config.imgAttr||"alt")||b},parsed:!0,// filter widget flag +type:"text"})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-input-select.min.js b/dist/js/parsers/parser-input-select.min.js index 6040672f..ddf76e23 100644 --- a/dist/js/parsers/parser-input-select.min.js +++ b/dist/js/parsers/parser-input-select.min.js @@ -1,2 +1,59 @@ /*! Parser: input & select - updated 8/17/2015 (v2.23.0) */ -!function(a){"use strict";var b=function(a,b,c){};a.tablesorter.addParser({id:"inputs",is:function(){return!1},format:function(b,c,d){var e=a(d).find("input");return e.length?e.val():b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"inputs-numeric",is:function(){return!1},format:function(b,c,d){var e=a(d).find("input"),f=e.length?e.val():b,g=a.tablesorter.formatFloat((f||"").replace(/[^\w,. \-()]/g,""),c);return b&&"number"==typeof g?g:b?a.trim(b&&c.config.ignoreCase?b.toLocaleLowerCase():b):b},parsed:!0,type:"numeric"}),a.tablesorter.addParser({id:"checkbox",is:function(){return!1},format:function(b,c,d,e){var f=a(d),g=f.closest("tr"),h=c.config.widgetOptions,i=c.config.checkboxClass||"checked",j=h.group_checkbox?h.group_checkbox:["checked","unchecked"],k=f.find('input[type="checkbox"]'),l=k.length?k[0].checked:"";return g.toggleClass(i+"-"+e,l),l?g.addClass(i):g.length&&!(g[0].className||"").match(i+"-")&&g.removeClass(i),k.length?j[l?0:1]:b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"select",is:function(){return!1},format:function(b,c,d){var e=a(d).find("select");return e.length?e.val():b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"select-text",is:function(){return!1},format:function(b,c,d){var e=a(d).find("select");return e.length?e.find("option:selected").text()||"":b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"textarea",is:function(){return!1},format:function(b,c,d){var e=a(d).find("textarea");return e.length?e.val():b},parsed:!0,type:"text"}),a(function(){a("table").on("tablesorter-initialized updateComplete",function(){var c=".parser-forms",d=function(b){b&&a(":focus").blur()};a(this).children("tbody").off(c).on("mouseleave"+c,function(a){d("TBODY"===a.target.nodeName)}).on("focus"+c,"select, input, textarea",function(){a(this).data("ts-original-value",this.value)}).on("blur"+c,"input, textarea",function(){this.value=a(this).data("ts-original-value")}).on("change keyup ".split(" ").join(c+" "),"select, input, textarea",function(c){if(27===c.which)return void(this.value=a(this).data("ts-original-value"));if("change"===c.type||"keyup"===c.type&&13===c.which&&("INPUT"===c.target.nodeName||"TEXTAREA"===c.target.nodeName&&c.altKey)){var d,e=a(c.target),f=e.closest("td"),g=f.closest("table"),h=f[0].cellIndex,i=g[0].config||!1,j=i&&i.$headerIndexed&&i.$headerIndexed[h]||[],k=e.val();if(j.length&&(j.hasClass("parser-false")||j.hasClass("sorter-false")&&j.hasClass("filter-false")))return;(i&&k!==e.data("ts-original-value")||"checkbox"===c.target.type)&&(e.data("ts-original-value",k),a.tablesorter.updateCell(i,f,d,function(){b(c,g,e)}))}})})})}(jQuery); \ No newline at end of file +/* + * for jQuery 1.7+ & tablesorter 2.7.11+ + * Demo: http://mottie.github.com/tablesorter/docs/example-widget-grouping.html + */ +/*jshint browser: true, jquery:true, unused:false */ +!function(a){"use strict";var b=function(a,b,c){}; +// Custom parser for parsing input values +// updated dynamically using the 'change' function below +a.tablesorter.addParser({id:"inputs",is:function(){return!1},format:function(b,c,d){var e=a(d).find("input");return e.length?e.val():b},parsed:!0,// filter widget flag +type:"text"}),a.tablesorter.addParser({id:"inputs-numeric",is:function(){return!1},format:function(b,c,d){var e=a(d).find("input"),f=e.length?e.val():b,g=a.tablesorter.formatFloat((f||"").replace(/[^\w,. \-()]/g,""),c);return b&&"number"==typeof g?g:b?a.trim(b&&c.config.ignoreCase?b.toLocaleLowerCase():b):b},parsed:!0,// filter widget flag +type:"numeric"}), +// Custom parser for including checkbox status if using the grouping widget +// updated dynamically using the 'change' function below +a.tablesorter.addParser({id:"checkbox",is:function(){return!1},format:function(b,c,d,e){var f=a(d),g=f.closest("tr"),h=c.config.widgetOptions,i=c.config.checkboxClass||"checked", +// returning plain language here because this is what is shown in the +// group headers - change it as desired +j=h.group_checkbox?h.group_checkbox:["checked","unchecked"],k=f.find('input[type="checkbox"]'),l=k.length?k[0].checked:""; +// adding class to row, indicating that a checkbox is checked; includes +// a column index in case more than one checkbox happens to be in a row +// don't remove checked class if other columns have a check +return g.toggleClass(i+"-"+e,l),l?g.addClass(i):g.length&&!(g[0].className||"").match(i+"-")&&g.removeClass(i),k.length?j[l?0:1]:b},parsed:!0,// filter widget flag +type:"text"}), +// Custom parser which returns the currently selected options +// updated dynamically using the 'change' function below +a.tablesorter.addParser({id:"select",is:function(){return!1},format:function(b,c,d){var e=a(d).find("select");return e.length?e.val():b},parsed:!0,// filter widget flag +type:"text"}), +// Select parser to get the selected text +a.tablesorter.addParser({id:"select-text",is:function(){return!1},format:function(b,c,d){var e=a(d).find("select");return e.length?e.find("option:selected").text()||"":b},parsed:!0,// filter widget flag +type:"text"}), +// Custom parser for parsing textarea values +// updated dynamically using the 'change' function below +a.tablesorter.addParser({id:"textarea",is:function(){return!1},format:function(b,c,d){var e=a(d).find("textarea");return e.length?e.val():b},parsed:!0,// filter widget flag +type:"text"}), +// update select and all input types in the tablesorter cache when the change event fires. +// This method only works with jQuery 1.7+ +// you can change it to use delegate (v1.4.3+) or live (v1.3+) as desired +// if this code interferes somehow, target the specific table $('#mytable'), instead of $('table') +a(function(){a("table").on("tablesorter-initialized updateComplete",function(){var c=".parser-forms",d=function(b){ +// make sure we restore original values (trigger blur) +// isTbody is needed to prevent the select from closing in IE +// see https://connect.microsoft.com/IE/feedbackdetail/view/962618/ +b&&a(":focus").blur()}; +// bind to .tablesorter (default class name) +a(this).children("tbody").off(c).on("mouseleave"+c,function(a){d("TBODY"===a.target.nodeName)}).on("focus"+c,"select, input, textarea",function(){a(this).data("ts-original-value",this.value)}).on("blur"+c,"input, textarea",function(){ +// restore input value; +// 'change' is triggered before 'blur' so this doesn't replace the new update with the original +this.value=a(this).data("ts-original-value")}).on("change keyup ".split(" ").join(c+" "),"select, input, textarea",function(c){if(27===c.which) +// escape: restore original value +return void(this.value=a(this).data("ts-original-value")); +// Update cell cache using... select: change, input: enter or textarea: alt + enter +if("change"===c.type||"keyup"===c.type&&13===c.which&&("INPUT"===c.target.nodeName||"TEXTAREA"===c.target.nodeName&&c.altKey)){var d,e=a(c.target),f=e.closest("td"),g=f.closest("table"),h=f[0].cellIndex,i=g[0].config||!1,j=i&&i.$headerIndexed&&i.$headerIndexed[h]||[],k=e.val(); +// abort if not a tablesorter table, or don't use updateCell if column is set +// to 'sorter-false' and 'filter-false', or column is set to 'parser-false' +if(j.length&&(j.hasClass("parser-false")||j.hasClass("sorter-false")&&j.hasClass("filter-false")))return; +// ignore change event if nothing changed +(i&&k!==e.data("ts-original-value")||"checkbox"===c.target.type)&&(e.data("ts-original-value",k), +// pass undefined resort value so it falls back to config.resort setting +a.tablesorter.updateCell(i,f,d,function(){b(c,g,e)}))}})})})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-metric.min.js b/dist/js/parsers/parser-metric.min.js index b24f5020..b2598485 100644 --- a/dist/js/parsers/parser-metric.min.js +++ b/dist/js/parsers/parser-metric.min.js @@ -1,2 +1,32 @@ /*! Parser: metric */ -!function(a){"use strict";var b={"Y|Yotta|yotta":[1e24,Math.pow(1024,8)],"Z|Zetta|zetta":[1e21,Math.pow(1024,7)],"E|Exa|exa":[1e18,Math.pow(1024,6)],"P|Peta|peta":[1e15,Math.pow(1024,5)],"T|Tera|tera":[1e12,Math.pow(1024,4)],"G|Giga|giga":[1e9,Math.pow(1024,3)],"M|Mega|mega":[1e6,Math.pow(1024,2)],"k|Kilo|kilo":[1e3,1024],"h|hecto":[100,100],"da|deka":[10,10],"d|deci":[.1,.1],"c|centi":[.01,.01],"m|milli":[.001,.001],"µ|micro":[1e-6,1e-6],"n|nano":[1e-9,1e-9],"p|pico":[1e-12,1e-12],"f|femto":[1e-15,1e-15],"a|atto":[1e-18,1e-18],"z|zepto":[1e-21,1e-21],"y|yocto":[1e-24,1e-24]},c="(\\d+)(\\s+)?([Zz]etta|[Ee]xa|[Pp]eta|[Tt]era|[Gg]iga|[Mm]ega|kilo|hecto|deka|deci|centi|milli|micro|nano|pico|femto|atto|zepto|yocto)(",d="(\\d+)(\\s+)?(Z|E|P|T|G|M|k|h|da|d|c|m|µ|n|p|f|a|z|y)(",e=/^[b|bit|byte|o|octet]/i;a.tablesorter.addParser({id:"metric",is:function(){return!1},format:function(f,g,h,i){var j,k,l,m,n="m|meter",o=a.tablesorter.formatFloat(f.replace(/[^\w,. \-()]/g,""),g),p=g.config.$headerIndexed[i],q=p.data("metric");if(q||(j=(p.attr("data-metric-name")||n).split("|"),l=p.attr("data-metric-name-full")||"",m=p.attr("data-metric-name-abbr")||"",q=[l||j[1]||j[0].substring(1),m||j[0]],k=e.test(q.join("")),q[2]=new RegExp(c+((""===l?"":l+"|"+m)||(k?q[0].toLowerCase()+"|"+q[0].toUpperCase():q[0])+"|"+(k?q[1].toLowerCase()+"|"+q[1].toUpperCase():q[1]))+")"),q[3]=new RegExp(d+(m||(k?q[1].toLowerCase()+"|"+q[1].toUpperCase():q[1]))+")"),p.data("metric",q)),j=f.match(q[2])||f.match(q[3]))for(n in b)if(j[3].match(n))return k=e.test(j[4])?1:0,o*b[n][k];return o},type:"numeric"})}(jQuery); \ No newline at end of file +/* + * Demo: http://jsfiddle.net/Mottie/abkNM/382/ + * Set the metric name in the header (defaults to 'm|meter'), e.g. + * HDD Size + * Distance + */ +/*jshint jquery:true */ +!function(a){"use strict";var b={ +// 'prefix' : [ base 10, base 2 ] +// skipping IEEE 1541 defined prefixes: kibibyte, mebibyte, etc, for now. +"Y|Yotta|yotta":[1e24,Math.pow(1024,8)],// 1024^8 +"Z|Zetta|zetta":[1e21,Math.pow(1024,7)],// 1024^7 +"E|Exa|exa":[1e18,Math.pow(1024,6)],// 1024^6 +"P|Peta|peta":[1e15,Math.pow(1024,5)],// 1024^5 +"T|Tera|tera":[1e12,Math.pow(1024,4)],// 1024^4 +"G|Giga|giga":[1e9,Math.pow(1024,3)],// 1024^3 +"M|Mega|mega":[1e6,Math.pow(1024,2)],// 1024^2 +"k|Kilo|kilo":[1e3,1024],// 1024 +// prefixes below here are rarely, if ever, used in binary +"h|hecto":[100,100],"da|deka":[10,10],"d|deci":[.1,.1],"c|centi":[.01,.01],"m|milli":[.001,.001],"µ|micro":[1e-6,1e-6],"n|nano":[1e-9,1e-9],"p|pico":[1e-12,1e-12],"f|femto":[1e-15,1e-15],"a|atto":[1e-18,1e-18],"z|zepto":[1e-21,1e-21],"y|yocto":[1e-24,1e-24]}, +// the \\d+ will not catch digits with spaces, commas or decimals; so use the value from n instead +c="(\\d+)(\\s+)?([Zz]etta|[Ee]xa|[Pp]eta|[Tt]era|[Gg]iga|[Mm]ega|kilo|hecto|deka|deci|centi|milli|micro|nano|pico|femto|atto|zepto|yocto)(",d="(\\d+)(\\s+)?(Z|E|P|T|G|M|k|h|da|d|c|m|µ|n|p|f|a|z|y)(", +// make these case-insensitive because we all forget the case for these binary values +e=/^[b|bit|byte|o|octet]/i;a.tablesorter.addParser({id:"metric",is:function(){return!1},format:function(f,g,h,i){var j,k,l,m, +// default base unit name +n="m|meter", +// process number here to get a numerical format (us or eu) +o=a.tablesorter.formatFloat(f.replace(/[^\w,. \-()]/g,""),g),p=g.config.$headerIndexed[i],q=p.data("metric");if(q||(j=(p.attr("data-metric-name")||n).split("|"),l=p.attr("data-metric-name-full")||"",m=p.attr("data-metric-name-abbr")||"",q=[l||j[1]||j[0].substring(1),m||j[0]],k=e.test(q.join("")),q[2]=new RegExp(c+((""===l?"":l+"|"+m)||(k?q[0].toLowerCase()+"|"+q[0].toUpperCase():q[0])+"|"+(k?q[1].toLowerCase()+"|"+q[1].toUpperCase():q[1]))+")"),q[3]=new RegExp(d+(m||(k?q[1].toLowerCase()+"|"+q[1].toUpperCase():q[1]))+")"),p.data("metric",q)),j=f.match(q[2])||f.match(q[3]))for(n in b)if(j[3].match(n)) +// exception when using binary prefix +// change base for binary use +return k=e.test(j[4])?1:0,o*b[n][k];return o},type:"numeric"})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-named-numbers.min.js b/dist/js/parsers/parser-named-numbers.min.js index 096a7726..59e9d919 100644 --- a/dist/js/parsers/parser-named-numbers.min.js +++ b/dist/js/parsers/parser-named-numbers.min.js @@ -1,2 +1,19 @@ /*! Parser: namedNumbers - updated 10/26/2014 (v2.18.0) */ -!function(a){"use strict";var b,c,d={negative:["negative","minus"],numbers:{zero:0,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30,forty:40,fourty:40,fifty:50,sixty:60,seventy:70,eighty:80,ninety:90},hundred:"hundred",powers:{thousand:1e3,million:1e6,billion:1e9,trillion:1e12,quadrillion:1e15,quintillion:1e18,sextillion:1e21,septillion:1e24,octillion:1e27,nonillion:1e30,decillion:1e33,undecillion:1e36,duodecillion:1e39,tredecillion:1e42,quattuordecillion:1e45,quindecillion:1e48,sexdecillion:1e51,septendecillion:1e54,octodecillion:1e57,novemdecillion:1e60,vigintillion:1e63,unvigintillion:1e66,duovigintillion:1e69,trevigintillion:1e72,quattuorvigintillion:1e75,quinvigintillion:1e78,sexvigintillion:1e81,septenvigintillion:1e84,octovigintillion:1e87,novemvigintillion:1e90,trigintillion:1e93,untrigintillion:1e96,duotrigintillion:1e99,googl:1e100}},e=new RegExp("("+d.negative.join("|")+")"),f=function(e,f){var g=e.replace(/[,."']/g,""),h=a.tablesorter.formatFloat(e||"",f),i=d.powers.hasOwnProperty(g)?d.powers[g]:null;h="number"==typeof h?h:d.numbers.hasOwnProperty(g)?d.numbers[g]:null,null!==h?c+=h:g===d.hundred?c*=100:null!==i&&(b+=c*i,c=0)};a.tablesorter.addParser({id:"namedNumbers",is:function(){return!1},format:function(g,h){b=0,c=0;var i,j=(g||"").split(/[\s-]+/),k=j.length;for(i=0;k>i;i++)f(j[i].toLowerCase(),h);return b=(b+c)*(g.match(e)?-1:1),b||d.numbers.hasOwnProperty(g)?b:a.tablesorter.formatFloat(g||"",h)},type:"numeric"})}(jQuery); \ No newline at end of file +/* + * code modified from http://stackoverflow.com/a/12014376/145346 + */ +/*jshint jquery:true */ +!function(a){"use strict"; +// Change language of the named numbers as needed +var b,c,d={negative:["negative","minus"],numbers:{zero:0,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30,forty:40,fourty:40,// common misspelling +fifty:50,sixty:60,seventy:70,eighty:80,ninety:90}, +// special case +hundred:"hundred", +// multiples +powers:{thousand:1e3,million:1e6,billion:1e9,trillion:1e12,quadrillion:1e15,quintillion:1e18,sextillion:1e21,septillion:1e24,octillion:1e27,nonillion:1e30,decillion:1e33,undecillion:1e36,duodecillion:1e39,tredecillion:1e42,quattuordecillion:1e45,quindecillion:1e48,sexdecillion:1e51,septendecillion:1e54,octodecillion:1e57,novemdecillion:1e60,vigintillion:1e63,unvigintillion:1e66,duovigintillion:1e69,trevigintillion:1e72,quattuorvigintillion:1e75,quinvigintillion:1e78,sexvigintillion:1e81,septenvigintillion:1e84,octovigintillion:1e87,novemvigintillion:1e90,trigintillion:1e93,untrigintillion:1e96,duotrigintillion:1e99,googl:1e100}},e=new RegExp("("+d.negative.join("|")+")"),f=function(e,f){ +// remove extra characters that might be next to the word +var g=e.replace(/[,."']/g,""), +// formatFloat will deal with the commas & decimals in the number format +h=a.tablesorter.formatFloat(e||"",f),i=d.powers.hasOwnProperty(g)?d.powers[g]:null;h="number"==typeof h?h:d.numbers.hasOwnProperty(g)?d.numbers[g]:null,null!==h?c+=h:g===d.hundred?c*=100:null!==i&&(b+=c*i,c=0)};a.tablesorter.addParser({id:"namedNumbers",is:function(){return!1},format:function(g,h){b=0,c=0;var i,j=(g||"").split(/[\s-]+/),k=j.length;for(i=0;k>i;i++)f(j[i].toLowerCase(),h); +// make sure to let zero get parsed, so check hasOwnProperty +return b=(b+c)*(g.match(e)?-1:1),b||d.numbers.hasOwnProperty(g)?b:a.tablesorter.formatFloat(g||"",h)},type:"numeric"})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-network.min.js b/dist/js/parsers/parser-network.min.js index 2d3ce51c..e7618e6f 100644 --- a/dist/js/parsers/parser-network.min.js +++ b/dist/js/parsers/parser-network.min.js @@ -1,5 +1,25 @@ /*! Parser: network - updated 5/17/2015 (v2.22.0) */ +/* IPv4, IPv6 and MAC Addresses */ +/*global jQuery: false */ !function(a){"use strict";var b,c,d=a.tablesorter;/*! IPv6 Address parser (WIP) */ -a.extend(d.regex,{},{ipv4Validate:/((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})/,ipv4Extract:/([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/,ipv6Validate:/^\s*((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/i}),d.addParser({id:"ipv6Address",is:function(a){return d.regex.ipv6Validate.test(a)},format:function(a,b){var c,e,f,g,h,i=b?"boolean"==typeof b?b:b&&b.config.ipv6HexFormat||!1:!1,j="",k="",l=8;if(a=a.replace(/\s*/g,""),d.regex.ipv4Validate.test(a)){for(g=a.match(d.regex.ipv4Extract),e="",c=1;cc;c++)j+="0000:";j+=f[1]}for(g=j.split(":"),c=0;l>c;c++)g[c]=i?("0000"+g[c]).slice(-4):("00000"+(parseInt(g[c],16)||0)).slice(-5),k+=c!=l-1?g[c]+":":g[c];return i?k:k.replace(/:/g,"")},type:"numeric"}),c=function(a){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(a)},b=function(a,b){var c,e=a?a.split("."):"",f="",g=e.length;for(c=0;g>c;c++)f+=("000"+e[c]).slice(-3);return a?d.formatFloat(f,b):a},/*! Parser: ipv4Address (a.k.a. ipAddress) */ -d.addParser({id:"ipAddress",is:c,format:b,type:"numeric"}),d.addParser({id:"ipv4Address",is:c,format:b,type:"numeric"}),/*! Parser: MAC address */ -d.addParser({id:"MAC",is:function(){return!1},format:function(a){var b,c,d="",e=(a||"").replace(/[:.-]/g,"").match(/\w{2}/g);if(e){for(c=e.length,b=0;c>b;b++)d+=("000"+parseInt(e[b],16)).slice(-3);return d}return a},type:"numeric"})}(jQuery); \ No newline at end of file +/* + * IPv6 Address (ffff:0000:0000:0000:0000:0000:0000:0000) + * needs to support short versions like '::8' or '1:2::7:8' + * and '::00:192.168.10.184' (embedded IPv4 address) + * see http://www.intermapper.com/support/tools/IPV6-Validator.aspx + */ +a.extend(d.regex,{},{ipv4Validate:/((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})/,ipv4Extract:/([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/, +// simplified regex from http://www.intermapper.com/support/tools/IPV6-Validator.aspx +// (specifically from http://download.dartware.com/thirdparty/ipv6validator.js) +ipv6Validate:/^\s*((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/i}),d.addParser({id:"ipv6Address",is:function(a){return d.regex.ipv6Validate.test(a)},format:function(a,b){ +// code modified from http://zurb.com/forrst/posts/JS_Expand_Abbreviated_IPv6_Addresses-1OR +// Saved to https://gist.github.com/Mottie/7018157 +var c,e,f,g,h,i=b?"boolean"==typeof b?b:b&&b.config.ipv6HexFormat||!1:!1,j="",k="",l=8; +// look for embedded ipv4 +if(a=a.replace(/\s*/g,""),d.regex.ipv4Validate.test(a)){for(g=a.match(d.regex.ipv4Extract),e="",c=1;cc;c++)j+="0000:";j+=f[1]}for(g=j.split(":"),c=0;l>c;c++) +// it's fastest & easiest for tablesorter to sort decimal values (vs hex) +g[c]=i?("0000"+g[c]).slice(-4):("00000"+(parseInt(g[c],16)||0)).slice(-5),k+=c!=l-1?g[c]+":":g[c];return i?k:k.replace(/:/g,"")}, +// uses natural sort hex compare +type:"numeric"}),c=function(a){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(a)},b=function(a,b){var c,e=a?a.split("."):"",f="",g=e.length;for(c=0;g>c;c++)f+=("000"+e[c]).slice(-3);return a?d.formatFloat(f,b):a},d.addParser({id:"ipAddress",is:c,format:b,type:"numeric"}),d.addParser({id:"ipv4Address",is:c,format:b,type:"numeric"}),d.addParser({id:"MAC",is:function(){return!1},format:function(a){var b,c,d="",e=(a||"").replace(/[:.-]/g,"").match(/\w{2}/g);if(e){for(c=e.length,b=0;c>b;b++)d+=("000"+parseInt(e[b],16)).slice(-3);return d}return a},type:"numeric"})}(jQuery); \ No newline at end of file diff --git a/dist/js/parsers/parser-roman.min.js b/dist/js/parsers/parser-roman.min.js index ee1fc7e9..f76c0134 100644 --- a/dist/js/parsers/parser-roman.min.js +++ b/dist/js/parsers/parser-roman.min.js @@ -1,2 +1,28 @@ /*! Parser: roman - updated 6/28/MMXIV (v2.17.3) */ -!function(a){"use strict";var b=/^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/i,c=/\b([MCDLXVI]+\b)/gi,d={I:1,V:5,X:10,L:50,C:100,D:500,M:1e3};a.tablesorter.addParser({id:"roman",is:function(){return!1},format:function(a){var c,e=a.toUpperCase().split(""),f=0;if(!a||!b.test(a))return a;for(;e.length;)c=d[e.shift()],f+=c*(cg;g++){if(s=l.row?l.row[g]:l.normalized[g][c.columns].$row,m=s.find("td").eq(e.column).text().replace(/[ ]/g," "),n=(m.match(e.regex)||[]).length,n>0&&e.alignIndex>0)for(i=Math.min(e.alignIndex,n),h=0,k=0,j=0;h++j?k:j;else k=m.indexOf(e.align);k>=0?(t.push(m.substring(0,k)||""),u.push(m.substring(k,m.length)||"")):(t.push(n>=1&&e.alignIndex>=n?"":m||""),u.push(n>=1&&e.alignIndex>=n?m||"":""))}for(p=a.extend([],t).sort(function(a,b){return b.length-a.length})[0],q=a.extend([],u).sort(function(a,b){return b.length-a.length})[0],e.width=e.width||Math.floor(p.length/(p.length+q.length)*100)+e.adjust,p="min-width:"+e.width+"%",q="min-width:"+(100-e.width)+"%",f=0;fg;g++)r=a(d.alignChar_wrap).length?a(d.alignChar_wrap).html(e.align)[0].outerHTML:e.align,s=l.row?l.row[g]:l.normalized[g][c.columns].$row,j=u[g].slice(e.align.length),s.find("td").eq(e.column).html(''+t[g]+''+(j.length?r+j:"")+"");d.alignChar_initialized=!0}},remove:function(b,c,d){if(!a.isEmptyObject(c.cache)){var e,f,g,h,i,j;for(e=0;ef;f++)i=h.row?h.row[f]:h.normalized[f][c.columns].$row,j=i.find("td").eq(d),j.html(j.text().replace(/\s/g," "))}}},b.addWidget({id:"alignChar",priority:100,options:{alignChar_wrap:"",alignChar_charAttrib:"data-align-char",alignChar_indexAttrib:"data-align-index",alignChar_adjustAttrib:"data-align-adjust"},init:function(a,c,d,e){e.alignChar_initialized=!1,e.alignChar_savedVars=[],b.alignChar.init(a,d,e),d.$table.on("pagerEnd refreshAlign",function(){d.$headers.filter("["+e.alignChar_charAttrib+"]").each(function(){b.alignChar.remove(a,d,this.column)}),b.alignChar.init(a,d,e)})},format:function(a,b,c){c.alignChar_initialized||b.$table.trigger("refreshAlign")},remove:function(a,c,d,e){e||(c.$headers.filter("["+d.alignChar_charAttrib+"]").each(function(){b.alignChar.remove(a,c,this.column)}),d.alignChar_initialized=!1)}})}(jQuery); \ No newline at end of file +/* + * Align Characters, Requires tablesorter v2.8+ and jQuery 1.7+ + * by Rob Garrison + */ +/*jshint browser:true, jquery:true, unused:false */ +/*global jQuery: false */ +!function(a){"use strict";var b=a.tablesorter;b.alignChar={init:function(c,d,e){d.$headers.filter("["+e.alignChar_charAttrib+"]").each(function(){var f=a(this),g={column:this.column,align:f.attr(e.alignChar_charAttrib),alignIndex:parseInt(f.attr(e.alignChar_indexAttrib)||0,10),adjust:parseFloat(f.attr(e.alignChar_adjustAttrib))||0};g.regex=new RegExp("\\"+g.align,"g"),"undefined"!=typeof g.align&&(e.alignChar_savedVars[this.column]=g,b.alignChar.setup(c,d,e,g))})},setup:function(b,c,d,e){ +// do nothing for empty tables +if(!a.isEmptyObject(c.cache)){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t=[],u=[];for(f=0;fg;g++){ +// set alignment @ alignIndex (one-based index) +if(s=l.row?l.row[g]:l.normalized[g][c.columns].$row,m=s.find("td").eq(e.column).text().replace(/[ ]/g," "),n=(m.match(e.regex)||[]).length,n>0&&e.alignIndex>0) +// find index of nth align character based on alignIndex (data-align-index) +for(i=Math.min(e.alignIndex,n),h=0,k=0,j=0;h++j?k:j;else k=m.indexOf(e.align);k>=0?(t.push(m.substring(0,k)||""),u.push(m.substring(k,m.length)||"")):( +// no align character found! +// put val in right or left based on the align index +t.push(n>=1&&e.alignIndex>=n?"":m||""),u.push(n>=1&&e.alignIndex>=n?m||"":""))}for(p=a.extend([],t).sort(function(a,b){return b.length-a.length})[0],q=a.extend([],u).sort(function(a,b){return b.length-a.length})[0],e.width=e.width||Math.floor(p.length/(p.length+q.length)*100)+e.adjust,p="min-width:"+e.width+"%",q="min-width:"+(100-e.width)+"%",f=0;fg;g++)r=a(d.alignChar_wrap).length?a(d.alignChar_wrap).html(e.align)[0].outerHTML:e.align,s=l.row?l.row[g]:l.normalized[g][c.columns].$row,j=u[g].slice(e.align.length),s.find("td").eq(e.column).html(''+t[g]+''+(j.length?r+j:"")+"");d.alignChar_initialized=!0}},remove:function(b,c,d){if(!a.isEmptyObject(c.cache)){var e,f,g,h,i,j;for(e=0;ef;f++)i=h.row?h.row[f]:h.normalized[f][c.columns].$row,j=i.find("td").eq(d),j.html(j.text().replace(/\s/g," "))}}},b.addWidget({id:"alignChar",priority:100,options:{alignChar_wrap:"",alignChar_charAttrib:"data-align-char",alignChar_indexAttrib:"data-align-index",alignChar_adjustAttrib:"data-align-adjust"},init:function(a,c,d,e){e.alignChar_initialized=!1,e.alignChar_savedVars=[],b.alignChar.init(a,d,e),d.$table.on("pagerEnd refreshAlign",function(){d.$headers.filter("["+e.alignChar_charAttrib+"]").each(function(){b.alignChar.remove(a,d,this.column)}),b.alignChar.init(a,d,e)})},format:function(a,b,c){ +// reinitialize in case table is empty when first initialized +c.alignChar_initialized||b.$table.trigger("refreshAlign")},remove:function(a,c,d,e){e||(c.$headers.filter("["+d.alignChar_charAttrib+"]").each(function(){b.alignChar.remove(a,c,this.column)}),d.alignChar_initialized=!1)}})}(jQuery); \ No newline at end of file diff --git a/dist/js/widgets/widget-build-table.min.js b/dist/js/widgets/widget-build-table.min.js index 2a5ed23a..dc3516bf 100644 --- a/dist/js/widgets/widget-build-table.min.js +++ b/dist/js/widgets/widget-build-table.min.js @@ -1,2 +1,150 @@ /*! Widget: Build Table - updated 3/26/2015 (v2.21.3) */ -!function(a){"use strict";var b=a.tablesorter=a.tablesorter||{},c=b.buildTable=function(d,e){var f="TABLE"===d.nodeName?a(d):a("").appendTo(d),g=f[0],h=e.widgetOptions=a.extend(!0,{},c.defaults,e.widgetOptions),i=h.build_processing,j=h.build_type,k=h.build_source||e.data,l=function(b){var d=a.type(b),f=b instanceof jQuery;if("function"==typeof i&&(b=i(b,h)),e.data=b,f||"string"===d){if(f||/<\s*\/tr\s*>/.test(b))return c.html(g,b,h);try{if(b=a.parseJSON(b||"null"))return c.object(g,b,h)}catch(k){}}return"array"===d||"string"===d||"array"===j||"csv"===j?c.csv(g,b,h):c.object(g,b,h)};return g.config=e,b.buildTable.hasOwnProperty(j)||""===j?void(k instanceof jQuery?l(a.trim(k.html())):k&&(k.hasOwnProperty("url")||"json"===j)?a.ajax(h.build_source).done(function(a){l(a)}).fail(function(a,b,c){e.debug&&console.error("aborting build table widget, failed ajax load"),f.html('")}):l(k)):(e.debug&&console.error("aborting build table widget, incorrect build type"),!1)};c.defaults={build_type:"",build_source:"",build_processing:null,build_complete:"tablesorter-build-complete",build_headers:{rows:1,classes:[],text:[],widths:[]},build_footers:{rows:1,classes:[],text:[]},build_numbers:{addColumn:!1,sortable:!1},build_csvStartLine:0,build_csvSeparator:",",build_objectRowKey:"rows",build_objectCellKey:"cells",build_objectHeaderKey:"headers",build_objectFooterKey:"footers"},c.build={colgroup:function(b){var c="";return b&&b.length&&(c+="",a.each(b,function(a,b){c+=""}),c+=""),c},cell:function(b,c,d,e,f){var g,h,i=f?a(""):"",j=c.build_headers.classes,k=c.build_headers.widths;if(/string|number/.test(typeof b))h=a("<"+d+(j&&j[e]?' class="'+j[e]+'"':"")+">"+b+""),f&&k&&k[e]&&i.width(k[e]||"");else{h=a("<"+d+">");for(g in b)b.hasOwnProperty(g)&&("text"===g||"html"===g?h[g](b[g]):f&&"width"===g?i.width(b[g]||""):h.attr(g,b[g]))}return[h,i]},header:function(b,c){var d=c.build_headers.text,e=c.build_headers.classes,f=""+(c.build_numbers.addColumn?""+c.build_numbers.addColumn+"":"");return a.each(b,function(a,b){f+=/<\s*\/t(d|h)\s*>/.test(b)?b:""+(d&&d[a]?d[a]:b)+""}),f+""},rows:function(b,c,d,e,f,g){var h=g?"th":"td",i=""+(e.build_numbers.addColumn?"<"+h+">"+(g?"":f)+"":"");return a.each(b,function(a,b){i+=/<\s*\/t(d|h)\s*>/.test(b)?b:"<"+(g?h+(d&&d[a]?' class="'+d[a]+'"':""):h)+">"+(g&&c&&c.length&&c[a]?c[a]:b)+""}),i+""}},c.buildComplete=function(c,d){a(c).trigger(d.build_complete),b.setup(c,c.config)},c.array=function(a,b,d){return c.csv(a,b,d)},c.csv=function(b,d,e){var f,g,h,i="csv"===e.build_type||"string"==typeof d,j=a(b),k=i?d.replace("\r","").split("\n"):d,l=k.length,m=0,n=!1,o=e.build_headers.rows+(i?e.build_csvStartLine:0),p=e.build_footers.rows,q=0,r="",s=c.build.colgroup(e.build_headers.widths)+"";a.each(k,function(a,b){a>=l-p&&(n=!0),(i?a>=e.build_csvStartLine:!0)&&o>a?(g=i?c.splitCSV(b,e.build_csvSeparator):b,q=g.length,s+=c.build.header(g,e)):a>=o&&(a===o&&(s+=""),h=i?c.splitCSV(b,e.build_csvSeparator):b,n&&p>0&&(s+=(a===l-p?"":"")+(a===l?"":"")),h.length>1&&(m++,h.length!==q&&(r+="error on line "+a+": Item count ("+h.length+") does not match header count ("+q+") \n"),f=n?e.build_footers.classes:"",s+=c.build.rows(h,e.build_footers.text,f,e,m,n)))}),s+=p>0?"":"",r?j.html(r):(j.html(s),c.buildComplete(b,e))},c.splitCSV=function(b,c){var d,e,f=a.trim(b).split(c=c||",");for(d=f.length-1;d>=0;d--)'"'===f[d].replace(/\"\s+$/,'"').charAt(f[d].length-1)?(e=f[d].replace(/^\s+\"/,'"')).length>1&&'"'===e.charAt(0)?f[d]=f[d].replace(/^\s*"|"\s*$/g,"").replace(/""/g,'"'):d?f.splice(d-1,2,[f[d-1],f[d]].join(c)):f=f.shift().split(c).concat(f):f[d].replace(/""/g,'"');return f},c.html=function(b,d,e){var f=a(b);d instanceof jQuery?f.empty().append(d):f.html(d),c.buildComplete(b,e)},c.object=function(b,d,e){var f,g,h,i,j,k,l,m=b.config,n=e.build_objectHeaderKey,o=e.build_objectRowKey,p=d.hasOwnProperty(n)&&!a.isEmptyObject(d.kh)?d.kh:d.hasOwnProperty("headers")?d.headers:!1,q=d.hasOwnProperty(o)&&!a.isEmptyObject(d.kr)?d.kr:d.hasOwnProperty("rows")?d.rows:!1;return p&&q&&0!==p.length&&0!==q.length?(i=a(""),j=a("
    '+a.status+" "+b+"
    "),a.each(p,function(b,d){for(l=a("").appendTo(j.find("thead")),g=d.length,f=0;g>f;f++)h=c.build.cell(d[f],e,"th",f,0===b),h[0]&&h[0].length&&h[0].appendTo(l),0===b&&h[1]&&h[1].appendTo(i)}),i.find("col[style]").length&&j.prepend(i),k=a(""),a.each(q,function(b,d){var f;if(h="object"===a.type(d),h&&d.newTbody){k=a("").appendTo(j);for(f in d)d.hasOwnProperty(f)&&"newTbody"!==f&&k.attr(f,d[f])}else{if(0===b&&k.appendTo(j),l=a("").appendTo(k),h){for(f in d)d.hasOwnProperty(f)&&f!==e.build_objectCellKey&&l.attr(f,d[f]);d.hasOwnProperty(e.build_objectCellKey)&&(d=d.cells)}for(g=d.length,f=0;g>f;f++)i=c.build.cell(d[f],e,"td",f),i[0]&&i[0].length&&i[0].appendTo(l)}}),d.hasOwnProperty(e.build_objectFooterKey)&&(h=d[e.build_objectFooterKey],"clone"===h?(i=j.find("thead").html(),j.append(""+i+"")):(i=a("").appendTo(j),a.each(h,function(b,d){for(l=a("").appendTo(i),g=d.length,f=0;g>f;f++)k=c.build.cell(d[f],e,"th",f),k[0]&&k[0].length&&k[0].appendTo(l)}))),a(b).html(j.html()),void c.buildComplete(b,e)):(m.debug&&console.error("aborting build table widget, missing data for object build"),!1)},c.ajax=c.json=function(a,b,d){return c.object(a,b,d)}}(jQuery); \ No newline at end of file +/* + * for tableSorter v2.16.0+ + * by Rob Garrison + */ +/*jshint browser:true, jquery:true, unused:false */ +/*global jQuery: false */ +!function(a){"use strict";var b=a.tablesorter=a.tablesorter||{}, +// build a table from data (requires existing tag) +// data.header contains an array of header titles +// data.rows contains an array of rows which contains an array of cells +c=b.buildTable=function(d,e){ +// add table if one doesn't exist +var f="TABLE"===d.nodeName?a(d):a("
    ").appendTo(d),g=f[0],h=e.widgetOptions=a.extend(!0,{},c.defaults,e.widgetOptions),i=h.build_processing,j=h.build_type,k=h.build_source||e.data, +// determine type: html, json, array, csv, object +l=function(b){var d=a.type(b),f=b instanceof jQuery; +// String (html or unprocessed json) or jQuery object +if( +// run any processing if set +"function"==typeof i&&(b=i(b,h)), +// store processed data in table.config.data +e.data=b,f||"string"===d){ +// look for closing tag, then we have an HTML string +if(f||/<\s*\/tr\s*>/.test(b))return c.html(g,b,h);try{if(b=a.parseJSON(b||"null")) +// valid JSON! +return c.object(g,b,h)}catch(k){}} +// Array +// Array +return"array"===d||"string"===d||"array"===j||"csv"===j?c.csv(g,b,h):c.object(g,b,h)}; +// even if wo.build_type is undefined, we can try to figure out the type +// store config +// even if wo.build_type is undefined, we can try to figure out the type +// get data from within a jQuery object (csv) +// load data via ajax +return g.config=e,b.buildTable.hasOwnProperty(j)||""===j?void(k instanceof jQuery?l(a.trim(k.html())):k&&(k.hasOwnProperty("url")||"json"===j)?a.ajax(h.build_source).done(function(a){l(a)}).fail(function(a,b,c){e.debug&&console.error("aborting build table widget, failed ajax load"),f.html('")}):l(k)):(e.debug&&console.error("aborting build table widget, incorrect build type"),!1)};c.defaults={ +// *** build widget core *** +build_type:"",// array, csv, object, json, html +build_source:"",// array, object, jQuery Object or ajaxObject { url: '', dataType: 'json' }, +build_processing:null,// function that returns a useable build_type (e.g. string to array) +build_complete:"tablesorter-build-complete",// triggered event when build completes +// *** CSV & Array *** +build_headers:{rows:1,// Number of header rows from the csv +classes:[],// Header classes to apply to cells +text:[],// Header cell text +widths:[]},build_footers:{rows:1,// Number of header rows from the csv +classes:[],// Footer classes to apply to cells +text:[]},build_numbers:{addColumn:!1,// include row numbering column? +sortable:!1}, +// *** CSV only options *** +build_csvStartLine:0,// line within the csv to start adding to table +build_csvSeparator:",",// csv separator +// *** build object options *** +build_objectRowKey:"rows",// object key containing table rows +build_objectCellKey:"cells",// object key containing table cells (within the rows object) +build_objectHeaderKey:"headers",// object key containing table headers +build_objectFooterKey:"footers"},c.build={colgroup:function(b){var c=""; +// add colgroup if widths set +return b&&b.length&&(c+="",a.each(b,function(a,b){c+=""}),c+=""),c}, +// d = cell data; typ = 'th' or 'td'; first = save widths from first header row only +cell:function(b,c,d,e,f){var g,h,i=f?a(""):"",j=c.build_headers.classes,k=c.build_headers.widths; +// d is just an array +if(/string|number/.test(typeof b))h=a("<"+d+(j&&j[e]?' class="'+j[e]+'"':"")+">"+b+""),f&&k&&k[e]&&i.width(k[e]||"");else{ +// assume we have an object +h=a("<"+d+">");for(g in b)b.hasOwnProperty(g)&&("text"===g||"html"===g?h[g](b[g]):f&&"width"===g? +// set column width, but only from first row +i.width(b[g]||""):h.attr(g,b[g]))}return[h,i]}, +// h1 = header text from data +header:function(b,c){var d=c.build_headers.text,e=c.build_headers.classes,f=""+(c.build_numbers.addColumn?""+c.build_numbers.addColumn+"":"");return a.each(b,function(a,b){f+=/<\s*\/t(d|h)\s*>/.test(b)?b:""+(d&&d[a]?d[a]:b)+""}),f+""},rows:function(b,c,d,e,f,g){var h=g?"th":"td",i=""+(e.build_numbers.addColumn?"<"+h+">"+(g?"":f)+"":"");return a.each(b,function(a,b){ +// test if HTML is already included; look for closing +i+=/<\s*\/t(d|h)\s*>/.test(b)?b:"<"+(g?h+(d&&d[a]?' class="'+d[a]+'"':""):h)+">"+(g&&c&&c.length&&c[a]?c[a]:b)+""}),i+""}},c.buildComplete=function(c,d){a(c).trigger(d.build_complete),b.setup(c,c.config)},/* ==== Array example ==== + [ + [ "header1", "header2", ... "headerN" ], + [ "row1cell1", "row1cell2", ... "row1cellN" ], + [ "row2cell1", "row2cell2", ... "row2cellN" ], + ... + [ "rowNcell1", "rowNcell2", ... "rowNcellN" ] + ] + */ +c.array=function(a,b,d){return c.csv(a,b,d)},/* ==== CSV example ==== + ID, Name, Age, Date + A42b, Parker, 28, "Jul 6, 2006 8:14 AM" + A255, Hood, 33, "Dec 10, 2002 5:14 AM" + A33, Kent, 18, "Jan 12, 2003 11:14 AM" + A1, Franklin, 45, "Jan 18, 2001 9:12 AM" + A102, Evans, 22, "Jan 18, 2007 9:12 AM" + A42a, Everet, 22, "Jan 18, 2007 9:12 AM" + ID, Name, Age, Date + */ +// Adapted & modified from csvToTable.js by Steve Sobel +// MIT license: https://code.google.com/p/jquerycsvtotable/ +c.csv=function(b,d,e){var f,g,h,i="csv"===e.build_type||"string"==typeof d,j=a(b),k=i?d.replace("\r","").split("\n"):d,l=k.length,m=0,n=!1,o=e.build_headers.rows+(i?e.build_csvStartLine:0),p=e.build_footers.rows,q=0,r="",s=c.build.colgroup(e.build_headers.widths)+"";a.each(k,function(a,b){a>=l-p&&(n=!0), +// build header +(i?a>=e.build_csvStartLine:!0)&&o>a?(g=i?c.splitCSV(b,e.build_csvSeparator):b,q=g.length,s+=c.build.header(g,e)):a>=o&&( +// build tbody & tfoot rows +a===o&&(s+=""),h=i?c.splitCSV(b,e.build_csvSeparator):b,n&&p>0&&(s+=(a===l-p?"":"")+(a===l?"":"")),h.length>1&&(m++,h.length!==q&&(r+="error on line "+a+": Item count ("+h.length+") does not match header count ("+q+") \n"),f=n?e.build_footers.classes:"",s+=c.build.rows(h,e.build_footers.text,f,e,m,n)))}),s+=p>0?"":"",r?j.html(r):(j.html(s),c.buildComplete(b,e))}, +// CSV Parser by Brian Huisman (http://www.greywyvern.com/?post=258) +c.splitCSV=function(b,c){var d,e,f=a.trim(b).split(c=c||",");for(d=f.length-1;d>=0;d--)'"'===f[d].replace(/\"\s+$/,'"').charAt(f[d].length-1)?(e=f[d].replace(/^\s+\"/,'"')).length>1&&'"'===e.charAt(0)?f[d]=f[d].replace(/^\s*"|"\s*$/g,"").replace(/""/g,'"'):d?f.splice(d-1,2,[f[d-1],f[d]].join(c)):f=f.shift().split(c).concat(f):f[d].replace(/""/g,'"');return f}, +// data may be a jQuery object after processing +c.html=function(b,d,e){var f=a(b);d instanceof jQuery?f.empty().append(d):f.html(d),c.buildComplete(b,e)},/* ==== Object example ==== + data : { + headers : [ + [ + { text: 'First Name', class: 'fname', width: '20%' }, // row 1 cell 1 + 'Last Name', + { text: 'Age', class: 'age', 'data-sorter' : false }, + 'Total', + { text: 'Discount', class : 'sorter-false' }, + { text: 'Date', class : 'date' } // row 1 cell 6 + ] + ], + footers : 'clone', // clone headers or assign array like headers + rows : [ + // TBODY 1 + [ 'Peter', 'Parker', 28, '$9.99', '20%', 'Jul 6, 2006 8:14 AM' ], // row 1 + [ 'John', 'Hood', 33, '$19.99', '25%', 'Dec 10, 2002 5:14 AM' ], // row 2 + [ 'Clark', 'Kent', 18, '$15.89', '44%', 'Jan 12, 2003 11:14 AM' ], // row 3 + + // TBODY 2 + { newTbody: true, class: 'tablesorter-infoOnly' }, + { cells : [ { text: 'Info Row', colSpan: 6 } ] }, // row 4 + + // TBODY 3 + { newTbody: true }, + [ 'Bruce', 'Evans', 22, '$13.19', '11%', 'Jan 18, 2007 9:12 AM' ], // row 5 + [ 'Brice', 'Almighty', 45, '$153.19', '44%', 'Jan 18, 2001 9:12 AM' ], // row 6 + + { class: 'specialRow', // row 7 + cells: [ + { text: 'Fred', class: 'fname' }, + { text: 'Smith', class: 'lname' }, + { text: 18, class: 'age', 'data-info': 'fake ID!, he is really 16' }, + { text: '$22.44', class: 'total' }, + { text: '8%', class: 'discount' }, + { text: 'Aug 20, 2012 10:15 AM', class: 'date' } + ], + 'data-info' : 'This row likes turtles' + } + ] + } + */ +c.object=function(b,d,e){ +// 'rows' +var f,g,h,i,j,k,l,m=b.config,n=e.build_objectHeaderKey,o=e.build_objectRowKey,p=d.hasOwnProperty(n)&&!a.isEmptyObject(d.kh)?d.kh:d.hasOwnProperty("headers")?d.headers:!1,q=d.hasOwnProperty(o)&&!a.isEmptyObject(d.kr)?d.kr:d.hasOwnProperty("rows")?d.rows:!1; +// Build thead +// h = [ ['headerRow1Cell1', 'headerRow1Cell2', ... 'headerRow1CellN' ], ['headerRow2Cell1', ... ] ] +// or h = [ [ { text: 'firstCell', class: 'fc', width: '20%' }, ..., { text: 'last Cell' } ], [ /* second row */ ] ] +// add colgroup if it contains col elements +// Build tbody +// add footer +return p&&q&&0!==p.length&&0!==q.length?(i=a(""),j=a("
    '+a.status+" "+b+"
    "),a.each(p,function(b,d){for(l=a("").appendTo(j.find("thead")),g=d.length,f=0;g>f;f++)h=c.build.cell(d[f],e,"th",f,0===b),h[0]&&h[0].length&&h[0].appendTo(l),0===b&&h[1]&&h[1].appendTo(i)}),i.find("col[style]").length&&j.prepend(i),k=a(""),a.each(q,function(b,d){var f;if(h="object"===a.type(d),h&&d.newTbody){k=a("").appendTo(j);for(f in d)d.hasOwnProperty(f)&&"newTbody"!==f&&k.attr(f,d[f])}else{if(0===b&&k.appendTo(j),l=a("").appendTo(k),h){for(f in d)d.hasOwnProperty(f)&&f!==e.build_objectCellKey&&l.attr(f,d[f]);d.hasOwnProperty(e.build_objectCellKey)&&(d=d.cells)}for(g=d.length,f=0;g>f;f++)i=c.build.cell(d[f],e,"td",f),i[0]&&i[0].length&&i[0].appendTo(l)}}),d.hasOwnProperty(e.build_objectFooterKey)&&(h=d[e.build_objectFooterKey],"clone"===h?(i=j.find("thead").html(),j.append(""+i+"")):(i=a("").appendTo(j),a.each(h,function(b,d){for(l=a("").appendTo(i),g=d.length,f=0;g>f;f++)k=c.build.cell(d[f],e,"th",f),k[0]&&k[0].length&&k[0].appendTo(l)}))),a(b).html(j.html()),void c.buildComplete(b,e)):(m.debug&&console.error("aborting build table widget, missing data for object build"),!1)},c.ajax=c.json=function(a,b,d){return c.object(a,b,d)}}(jQuery); \ No newline at end of file diff --git a/dist/js/widgets/widget-chart.min.js b/dist/js/widgets/widget-chart.min.js index 425837bf..23e48eea 100644 --- a/dist/js/widgets/widget-chart.min.js +++ b/dist/js/widgets/widget-chart.min.js @@ -1 +1,38 @@ -!function(a){"use strict";var b=a.tablesorter,c=[],d=[],e=[],f=[],g=[],h=[],i=[],j=[],k=b.chart={nonDigit:/[^\d,.\-()]/g,init:function(a,b){a.$table.off(b.chart_event).on(b.chart_event,function(){if(this.hasInitialized){var a=this.config;k.getCols(a,a.widgetOptions),k.getData(a,a.widgetOptions)}})},getCols:function(d,e){var f;for(c=[],h=[],j=[],f=0;f=0?j.push(e[f]):(g=i[f].getAttribute(c.textAttribute)||i[f].textContent||i.eq(f).text(),j.push(a.trim(g)));l.push(j)}}),l.sort(function(a,c){return 1===d.chart_sort[0][1]?b.sortNatural(c[d.chart_sort[0][0]],a[d.chart_sort[0][0]]):b.sortNatural(a[d.chart_sort[0][0]],c[d.chart_sort[0][0]])}),a.each(l,function(f,l){var m,n=0,o=[],p=l[d.chart_labelCol];o.push(""+p),a.each(l,function(e,f){var l;return e===d.chart_labelCol?(g.push(f),i.push({label:f}),!0):(m=!1,d.chart_useSelector&&b.hasWidget(c.table,"columnSelector")&&!c.selector.auto?c.selector.states[e]&&a.inArray(e,d.chart_ignoreColumns)<0&&(m=""+f):a.inArray(e,d.chart_ignoreColumns)<0&&(m=""+f),void(m!==!1&&(/s/i.test(""+d.chart_layout[e])?(o.push(m),h[n].data.push(m),j[n].data.push(m)):(l=b.formatFloat(m.replace(k.nonDigit,""),c.table),l=isNaN(l)?m:l,o.push(l),h[n].data.push(l),j[n].data.push({value:l})),n++)))}),e.push(o)})},remove:function(a,b){a.$table.off(b.chart_event)}};b.addWidget({id:"chart",options:{chart_incRows:"filtered",chart_useSelector:!1,chart_ignoreColumns:[],chart_parsed:[],chart_layout:{0:"string"},chart_labelCol:0,chart_sort:[[0,0]],chart_event:"chartData"},init:function(a,b,c,d){k.init(c,d)},remove:function(a,b,c){k.remove(b,c)}})}(jQuery); \ No newline at end of file +/* Widget: chart (beta) - updated 2/7/2015 (v2.19.0) */ +/* + * Requires tablesorter v2.8+ and jQuery 1.7+ + */ +/*jshint browser:true, jquery:true, unused:false */ +/*global jQuery: false */ +!function(a){"use strict";var b=a.tablesorter, +// temp variables +c=[],d=[], +// google charts +e=[],f=[], +// highcharts +g=[],h=[], +// fusioncharts +i=[],j=[],k=b.chart={ +// regex used to strip out non-digit values before sending +// the string to the $.tablesorter.formatFloat function +nonDigit:/[^\d,.\-()]/g,init:function(a,b){a.$table.off(b.chart_event).on(b.chart_event,function(){if(this.hasInitialized){ +// refresh 'c' variable in case options are updated dynamically +var a=this.config;k.getCols(a,a.widgetOptions),k.getData(a,a.widgetOptions)}})},getCols:function(d,e){var f;for(c=[],h=[],j=[],f=0;f=0?j.push(e[f]):(g=i[f].getAttribute(c.textAttribute)||i[f].textContent||i.eq(f).text(),j.push(a.trim(g)));l.push(j)}}),l.sort(function(a,c){return 1===d.chart_sort[0][1]?b.sortNatural(c[d.chart_sort[0][0]],a[d.chart_sort[0][0]]):b.sortNatural(a[d.chart_sort[0][0]],c[d.chart_sort[0][0]])}),a.each(l,function(f,l){var m,n=0,o=[],p=l[d.chart_labelCol];o.push(""+p),a.each(l,function(e,f){var l;return e===d.chart_labelCol?(g.push(f),i.push({label:f}),!0):(m=!1,d.chart_useSelector&&b.hasWidget(c.table,"columnSelector")&&!c.selector.auto?c.selector.states[e]&&a.inArray(e,d.chart_ignoreColumns)<0&&(m=""+f):a.inArray(e,d.chart_ignoreColumns)<0&&(m=""+f),void(m!==!1&&(/s/i.test(""+d.chart_layout[e])?(o.push(m),h[n].data.push(m),j[n].data.push(m)):(l=b.formatFloat(m.replace(k.nonDigit,""),c.table),l=isNaN(l)?m:l,o.push(l),h[n].data.push(l),j[n].data.push({value:l})),n++)))}),e.push(o)})},remove:function(a,b){a.$table.off(b.chart_event)}};b.addWidget({id:"chart",options:{ +// (a)ll, (v)isible or (f)iltered - only the first letter is needed +chart_incRows:"filtered", +// prefer columnSelector for ignoreColumns +chart_useSelector:!1, +// columns to ignore [0, 1,... ] (zero-based index) +chart_ignoreColumns:[], +// Use parsed data instead of cell.text() +chart_parsed:[], +// data output layout, float is default +chart_layout:{ +// first element is a string, all others will be float +0:"string"}, +// Set the label column +chart_labelCol:0, +// data sort, should always be first row, might want [[0,1]] +chart_sort:[[0,0]], +// event to trigger get updated data +chart_event:"chartData"},init:function(a,b,c,d){k.init(c,d)},remove:function(a,b,c){k.remove(b,c)}})}(jQuery); \ No newline at end of file diff --git a/dist/js/widgets/widget-columnSelector.min.js b/dist/js/widgets/widget-columnSelector.min.js index e6e833af..88da6693 100644 --- a/dist/js/widgets/widget-columnSelector.min.js +++ b/dist/js/widgets/widget-columnSelector.min.js @@ -1 +1,82 @@ -!function(a){"use strict";var b=a.tablesorter,c=".tscolsel",d=b.columnSelector={queryAll:"@media only all { [columns] { display: none; } } ",queryBreak:"@media all and (min-width: [size]) { [columns] { display: table-cell; } } ",init:function(b,e,f){var g,h;return g=a(f.columnSelector_layout),g.find("input").add(g.filter("input")).length?(e.$table.addClass(e.namespace.slice(1)+"columnselector"),h=e.selector={$container:a(f.columnSelector_container||"
    ")},h.$style=a("").prop("disabled",!0).appendTo("head"),h.$breakpoints=a("").prop("disabled",!0).appendTo("head"),h.isInitializing=!0,d.setUpColspan(e,f),d.setupSelector(e,f),f.columnSelector_mediaquery&&d.setupBreakpoints(e,f),h.isInitializing=!1,h.$container.length?d.updateCols(e,f):e.debug&&console.warn("ColumnSelector: >> container not found"),void e.$table.off("refreshColumnSelector"+c).on("refreshColumnSelector"+c,function(a,b,c){d.refreshColumns(this.config,b,c)})):void(e.debug&&console.error("ColumnSelector: >> ERROR: Column Selector aborting, no input found in the layout! ***"))},refreshColumns:function(b,c,e){var f,g,h=a.isArray(e||c),i=b.widgetOptions;if("undefined"!=typeof c&&b.selector.$container.length){if("selectors"===c&&(b.selector.$container.empty(),d.setupSelector(b,i),d.setupBreakpoints(b,i),"undefined"==typeof e&&(e=b.selector.auto)),h)for(g=e||c,a.each(g,function(a,b){g[a]=parseInt(b,10)}),f=0;f=0);d.updateAuto(b,i,b.selector.$container.find('input[data-column="auto"]').prop("checked",e===!0||c===!0||"auto"===c&&e!==!1))}else d.updateBreakpoints(b,i),d.updateCols(b,i);d.adjustColspans(b,i)},setupSelector:function(c,e){var f,g,h,i,j,k,l=c.selector,m=l.$container,n=e.columnSelector_saveColumns&&b.storage,o=n?b.storage(c.table,"tablesorter-columnSelector"):[],p=n?b.storage(c.table,"tablesorter-columnSelector-auto"):{};for(l.auto=a.isEmptyObject(p)||"boolean"!==a.type(p.auto)?e.columnSelector_mediaqueryState:p.auto,l.states=[],l.$column=[],l.$wrapper=[],l.$checkbox=[],f=0;f0||"disable"===p||e.columnSelector_columns[k]&&"disable"===e.columnSelector_columns[k]||(l.states[k]=o&&"undefined"!=typeof o[k]?o[k]:"undefined"!=typeof e.columnSelector_columns[k]?e.columnSelector_columns[k]:"true"===p||"false"!==p,l.$column[k]=a(this),g=h.attr(e.columnSelector_name)||h.text(),m.length&&(l.$wrapper[k]=a(e.columnSelector_layout.replace(/\{name\}/g,g)).appendTo(m),l.$checkbox[k]=l.$wrapper[k].find("input").add(l.$wrapper[k].filter("input")).attr("data-column",k).toggleClass(e.columnSelector_cssChecked,l.states[k]).prop("checked",l.states[k]).on("change",function(){var b=a(this).attr("data-column");c.selector.states[b]=this.checked,d.updateCols(c,e)}).change()))},setupBreakpoints:function(b,e){var f=b.selector;e.columnSelector_mediaquery&&(f.lastIndex=-1,d.updateBreakpoints(b,e),b.$table.off("updateAll"+c).on("updateAll"+c,function(){d.updateBreakpoints(b,e),d.updateCols(b,e)})),f.$container.length&&(e.columnSelector_mediaquery&&(f.$auto=a(e.columnSelector_layout.replace(/\{name\}/g,e.columnSelector_mediaqueryName)).prependTo(f.$container),f.$auto.find("input").add(f.$auto.filter("input")).attr("data-column","auto").prop("checked",f.auto).toggleClass(e.columnSelector_cssChecked,f.auto).on("change",function(){d.updateAuto(b,e,a(this))}).change()),b.$table.off("update"+c).on("update"+c,function(){d.updateCols(b,e)}))},updateAuto:function(c,e,f){var g=c.selector;g.auto=f.prop("checked")||!1,a.each(g.$checkbox,function(a,b){b&&(b[0].disabled=g.auto,g.$wrapper[a].toggleClass("disabled",g.auto))}),e.columnSelector_mediaquery&&d.updateBreakpoints(c,e),d.updateCols(c,e),c.selector.$popup&&c.selector.$popup.find(".tablesorter-column-selector").html(g.$container.html()).find("input").each(function(){var b=a(this).attr("data-column");a(this).prop("checked","auto"===b?g.auto:g.states[b])}),e.columnSelector_saveColumns&&b.storage&&b.storage(c.$table[0],"tablesorter-columnSelector-auto",{auto:g.auto}),d.adjustColspans(c,e),g.auto&&c.$table.trigger(e.columnSelector_updated)},addSelectors:function(a,b){var c=[],d=" col:nth-child("+b+")";return c.push(a+d+","+a+"_extra_table"+d),d=" tr th:nth-child("+b+")",c.push(a+d+","+a+"_extra_table"+d),d=" tr td:nth-child("+b+")",c.push(a+d+","+a+"_extra_table"+d),c},updateBreakpoints:function(c,e){var f,g,h,i,j=[],k=c.selector,l=c.namespace+"columnselector",m=[],n="";if(e.columnSelector_mediaquery&&!k.auto)return k.$breakpoints.prop("disabled",!0),void k.$style.prop("disabled",!1);if(e.columnSelector_mediaqueryHidden)for(h=0;hf;f++)i=[],c.$headers.filter("["+e.columnSelector_priority+"="+(f+1)+"]").each(function(){h=parseInt(a(this).attr("data-column"),10)+1,j[h]||(i=i.concat(d.addSelectors(l,h)))}),i.length&&(m=m.concat(i),n+=d.queryBreak.replace(/\[size\]/g,e.columnSelector_breakpoints[f]).replace(/\[columns\]/g,i.join(",")));k.$style&&k.$style.prop("disabled",!0),m.length&&k.$breakpoints.prop("disabled",!1).html(d.queryAll.replace(/\[columns\]/g,m.join(","))+n)},updateCols:function(c,e){if(!(e.columnSelector_mediaquery&&c.selector.auto||c.selector.isInitializing)){var f,g=c.selector,h=[],i=c.namespace+"columnselector";g.$container.find("input[data-column]").filter('[data-column!="auto"]').each(function(){this.checked||(f=parseInt(a(this).attr("data-column"),10)+1,h=h.concat(d.addSelectors(i,f))),a(this).toggleClass(e.columnSelector_cssChecked,this.checked)}),e.columnSelector_mediaquery&&g.$breakpoints.prop("disabled",!0),g.$style&&g.$style.prop("disabled",!1).html(h.length?h.join(",")+" { display: none; }":""),e.columnSelector_saveColumns&&b.storage&&b.storage(c.$table[0],"tablesorter-columnSelector",g.states),d.adjustColspans(c,e),c.$table.trigger(e.columnSelector_updated)}},setUpColspan:function(c,e){var f,g,h,i=a(window),j=!1,k=c.$table.add(a(c.namespace+"_extra_table")).children("thead, tfoot").children("tr").children("th, td"),l=k.length;for(f=0;l>f;f++)g=k[f].colSpan,g>1&&(j=!0,k.eq(f).addClass(c.namespace.slice(1)+"columnselectorHasSpan").attr("data-col-span",g));j&&e.columnSelector_mediaquery&&(h=c.namespace.slice(1)+"columnselector",i.off(h).on("resize"+h,b.window_resize).on("resizeEnd"+h,function(){i.off("resize"+h,b.window_resize),d.adjustColspans(c,e),i.on("resize"+h,b.window_resize)}))},adjustColspans:function(b,c){var d,e,f,g,h,i=b.selector,j=i.auto,k=a(b.namespace+"columnselectorHasSpan"),l=k.length;if(l)for(d=0;l>d;d++){for(f=parseInt(k.eq(d).attr("data-column"),10),g=parseInt(k.eq(d).attr("data-col-span"),10),h=f+g,e=f;h>e;e++)(!j&&i.states[e]===!1||j&&b.$headerIndexed[e]&&!b.$headerIndexed[e].is(":visible"))&&g--;g?k.eq(d).show()[0].colSpan=g:k.eq(d).hide()}},attachTo:function(b,c){b=a(b)[0];var d,e,f,g=b.config,h=a(c);h.length&&g&&(h.find(".tablesorter-column-selector").length||h.append(''),d=g.selector,e=g.widgetOptions,h.find(".tablesorter-column-selector").html(d.$container.html()).find("input").each(function(){var b=a(this).attr("data-column"),c="auto"===b?d.auto:d.states[b];a(this).toggleClass(e.columnSelector_cssChecked,c).prop("checked",c)}),d.$popup=h.on("change","input",function(){f=a(this).toggleClass(e.columnSelector_cssChecked,this.checked).attr("data-column"),d.$container.find('input[data-column="'+f+'"]').prop("checked",this.checked).trigger("change")}))}};b.window_resize=function(){b.timer_resize&&clearTimeout(b.timer_resize),b.timer_resize=setTimeout(function(){a(window).trigger("resizeEnd")},250)},b.addWidget({id:"columnSelector",priority:10,options:{columnSelector_container:null,columnSelector_columns:{},columnSelector_saveColumns:!0,columnSelector_layout:'',columnSelector_name:"data-selector-name",columnSelector_mediaquery:!0,columnSelector_mediaqueryName:"Auto: ",columnSelector_mediaqueryState:!0,columnSelector_mediaqueryHidden:!1,columnSelector_breakpoints:["20em","30em","40em","50em","60em","70em"],columnSelector_priority:"data-priority",columnSelector_cssChecked:"checked",columnSelector_updated:"columnUpdate"},init:function(a,b,c,e){d.init(a,c,e)},remove:function(a,b,d,e){if(!e){var f=b.selector;f.$container.empty(),f.$popup&&f.$popup.empty(),f.$style.remove(),f.$breakpoints.remove(),b.$table.off("updateAll"+c+" update"+c)}}})}(jQuery); \ No newline at end of file +/* Widget: columnSelector (responsive table widget) - updated 8/23/2015 (v2.23.2) */ +/* + * Requires tablesorter v2.8+ and jQuery 1.7+ + * by Justin Hallett & Rob Garrison + */ +/*jshint browser:true, jquery:true, unused:false */ +/*global jQuery: false */ +!function(a){"use strict";var b=a.tablesorter,c=".tscolsel",d=b.columnSelector={queryAll:"@media only all { [columns] { display: none; } } ",queryBreak:"@media all and (min-width: [size]) { [columns] { display: table-cell; } } ",init:function(b,e,f){var g,h; +// abort if no input is contained within the layout +// unique table class name +// build column selector/state array +return g=a(f.columnSelector_layout),g.find("input").add(g.filter("input")).length?(e.$table.addClass(e.namespace.slice(1)+"columnselector"),h=e.selector={$container:a(f.columnSelector_container||"
    ")},h.$style=a("").prop("disabled",!0).appendTo("head"),h.$breakpoints=a("").prop("disabled",!0).appendTo("head"),h.isInitializing=!0,d.setUpColspan(e,f),d.setupSelector(e,f),f.columnSelector_mediaquery&&d.setupBreakpoints(e,f),h.isInitializing=!1,h.$container.length?d.updateCols(e,f):e.debug&&console.warn("ColumnSelector: >> container not found"),void e.$table.off("refreshColumnSelector"+c).on("refreshColumnSelector"+c,function(a,b,c){d.refreshColumns(this.config,b,c)})):void(e.debug&&console.error("ColumnSelector: >> ERROR: Column Selector aborting, no input found in the layout! ***"))},refreshColumns:function(b,c,e){var f,g,h=a.isArray(e||c),i=b.widgetOptions; +// see #798 +if("undefined"!=typeof c&&b.selector.$container.length){ +// pass an array of column zero-based indexes to turn off auto mode & toggle selected columns +if( +// pass "selectors" to update the all of the container contents +"selectors"===c&&(b.selector.$container.empty(),d.setupSelector(b,i),d.setupBreakpoints(b,i), +// if optState is undefined, maintain the current "auto" state +"undefined"==typeof e&&(e=b.selector.auto)),h)for(g=e||c,a.each(g,function(a,b){g[a]=parseInt(b,10)}),f=0;f=0); +// if passing an array, set auto to false to allow manual column selection & update columns +// refreshColumns( c, 'auto', true ) === refreshColumns( c, true ); +d.updateAuto(b,i,b.selector.$container.find('input[data-column="auto"]').prop("checked",e===!0||c===!0||"auto"===c&&e!==!1))}else d.updateBreakpoints(b,i),d.updateCols(b,i);d.adjustColspans(b,i)},setupSelector:function(c,e){var f,g,h,i,j,k,l=c.selector,m=l.$container,n=e.columnSelector_saveColumns&&b.storage, +// get stored column states +o=n?b.storage(c.table,"tablesorter-columnSelector"):[],p=n?b.storage(c.table,"tablesorter-columnSelector-auto"):{}; +// populate the selector container +for( +// initial states +l.auto=a.isEmptyObject(p)||"boolean"!==a.type(p.auto)?e.columnSelector_mediaqueryState:p.auto,l.states=[],l.$column=[],l.$wrapper=[],l.$checkbox=[],f=0;f0||"disable"===p||e.columnSelector_columns[k]&&"disable"===e.columnSelector_columns[k]||(l.states[k]=o&&"undefined"!=typeof o[k]?o[k]:"undefined"!=typeof e.columnSelector_columns[k]?e.columnSelector_columns[k]:"true"===p||"false"!==p,l.$column[k]=a(this),g=h.attr(e.columnSelector_name)||h.text(),m.length&&(l.$wrapper[k]=a(e.columnSelector_layout.replace(/\{name\}/g,g)).appendTo(m),l.$checkbox[k]=l.$wrapper[k].find("input").add(l.$wrapper[k].filter("input")).attr("data-column",k).toggleClass(e.columnSelector_cssChecked,l.states[k]).prop("checked",l.states[k]).on("change",function(){var b=a(this).attr("data-column");c.selector.states[b]=this.checked,d.updateCols(c,e)}).change()))},setupBreakpoints:function(b,e){var f=b.selector; +// add responsive breakpoints +e.columnSelector_mediaquery&&( +// used by window resize function +f.lastIndex=-1,d.updateBreakpoints(b,e),b.$table.off("updateAll"+c).on("updateAll"+c,function(){d.updateBreakpoints(b,e),d.updateCols(b,e)})),f.$container.length&&( +// Add media queries toggle +e.columnSelector_mediaquery&&(f.$auto=a(e.columnSelector_layout.replace(/\{name\}/g,e.columnSelector_mediaqueryName)).prependTo(f.$container),f.$auto.find("input").add(f.$auto.filter("input")).attr("data-column","auto").prop("checked",f.auto).toggleClass(e.columnSelector_cssChecked,f.auto).on("change",function(){d.updateAuto(b,e,a(this))}).change()), +// Add a bind on update to re-run col setup +b.$table.off("update"+c).on("update"+c,function(){d.updateCols(b,e)}))},updateAuto:function(c,e,f){var g=c.selector;g.auto=f.prop("checked")||!1,a.each(g.$checkbox,function(a,b){b&&(b[0].disabled=g.auto,g.$wrapper[a].toggleClass("disabled",g.auto))}),e.columnSelector_mediaquery&&d.updateBreakpoints(c,e),d.updateCols(c,e), +// copy the column selector to a popup/tooltip +c.selector.$popup&&c.selector.$popup.find(".tablesorter-column-selector").html(g.$container.html()).find("input").each(function(){var b=a(this).attr("data-column");a(this).prop("checked","auto"===b?g.auto:g.states[b])}),e.columnSelector_saveColumns&&b.storage&&b.storage(c.$table[0],"tablesorter-columnSelector-auto",{auto:g.auto}),d.adjustColspans(c,e), +// trigger columnUpdate if auto is true (it gets skipped in updateCols() +g.auto&&c.$table.trigger(e.columnSelector_updated)},addSelectors:function(a,b){var c=[],d=" col:nth-child("+b+")";return c.push(a+d+","+a+"_extra_table"+d),d=" tr th:nth-child("+b+")",c.push(a+d+","+a+"_extra_table"+d),d=" tr td:nth-child("+b+")",c.push(a+d+","+a+"_extra_table"+d),c},updateBreakpoints:function(c,e){var f,g,h,i,j=[],k=c.selector,l=c.namespace+"columnselector",m=[],n="";if(e.columnSelector_mediaquery&&!k.auto)return k.$breakpoints.prop("disabled",!0),void k.$style.prop("disabled",!1);if(e.columnSelector_mediaqueryHidden) +// add columns to be hidden; even when "auto" is set - see #964 +for(h=0;hf;f++)i=[],c.$headers.filter("["+e.columnSelector_priority+"="+(f+1)+"]").each(function(){h=parseInt(a(this).attr("data-column"),10)+1,j[h]||(i=i.concat(d.addSelectors(l,h)))}),i.length&&(m=m.concat(i),n+=d.queryBreak.replace(/\[size\]/g,e.columnSelector_breakpoints[f]).replace(/\[columns\]/g,i.join(",")));k.$style&&k.$style.prop("disabled",!0),m.length&&k.$breakpoints.prop("disabled",!1).html(d.queryAll.replace(/\[columns\]/g,m.join(","))+n)},updateCols:function(c,e){if(!(e.columnSelector_mediaquery&&c.selector.auto||c.selector.isInitializing)){var f,g=c.selector,h=[],i=c.namespace+"columnselector";g.$container.find("input[data-column]").filter('[data-column!="auto"]').each(function(){this.checked||(f=parseInt(a(this).attr("data-column"),10)+1,h=h.concat(d.addSelectors(i,f))),a(this).toggleClass(e.columnSelector_cssChecked,this.checked)}),e.columnSelector_mediaquery&&g.$breakpoints.prop("disabled",!0),g.$style&&g.$style.prop("disabled",!1).html(h.length?h.join(",")+" { display: none; }":""),e.columnSelector_saveColumns&&b.storage&&b.storage(c.$table[0],"tablesorter-columnSelector",g.states),d.adjustColspans(c,e),c.$table.trigger(e.columnSelector_updated)}},setUpColspan:function(c,e){var f,g,h,i=a(window),j=!1,k=c.$table.add(a(c.namespace+"_extra_table")).children("thead, tfoot").children("tr").children("th, td"),l=k.length;for(f=0;l>f;f++)g=k[f].colSpan,g>1&&(j=!0,k.eq(f).addClass(c.namespace.slice(1)+"columnselectorHasSpan").attr("data-col-span",g)); +// only add resize end if using media queries +j&&e.columnSelector_mediaquery&&(h=c.namespace.slice(1)+"columnselector",i.off(h).on("resize"+h,b.window_resize).on("resizeEnd"+h,function(){i.off("resize"+h,b.window_resize),d.adjustColspans(c,e),i.on("resize"+h,b.window_resize)}))},adjustColspans:function(b,c){var d,e,f,g,h,i=b.selector,j=i.auto,k=a(b.namespace+"columnselectorHasSpan"),l=k.length;if(l)for(d=0;l>d;d++){for(f=parseInt(k.eq(d).attr("data-column"),10),g=parseInt(k.eq(d).attr("data-col-span"),10),h=f+g,e=f;h>e;e++)(!j&&i.states[e]===!1||j&&b.$headerIndexed[e]&&!b.$headerIndexed[e].is(":visible"))&&g--;g?k.eq(d).show()[0].colSpan=g:k.eq(d).hide()}},attachTo:function(b,c){b=a(b)[0];var d,e,f,g=b.config,h=a(c);h.length&&g&&(h.find(".tablesorter-column-selector").length|| +// add a wrapper to add the selector into, in case the popup has other content +h.append(''),d=g.selector,e=g.widgetOptions,h.find(".tablesorter-column-selector").html(d.$container.html()).find("input").each(function(){var b=a(this).attr("data-column"),c="auto"===b?d.auto:d.states[b];a(this).toggleClass(e.columnSelector_cssChecked,c).prop("checked",c)}),d.$popup=h.on("change","input",function(){f=a(this).toggleClass(e.columnSelector_cssChecked,this.checked).attr("data-column"),d.$container.find('input[data-column="'+f+'"]').prop("checked",this.checked).trigger("change")}))}};/* Add window resizeEnd event (also used by scroller widget) */ +b.window_resize=function(){b.timer_resize&&clearTimeout(b.timer_resize),b.timer_resize=setTimeout(function(){a(window).trigger("resizeEnd")},250)},b.addWidget({id:"columnSelector",priority:10,options:{ +// target the column selector markup +columnSelector_container:null, +// column status, true = display, false = hide +// disable = do not display on list +columnSelector_columns:{}, +// remember selected columns +columnSelector_saveColumns:!0, +// container layout +columnSelector_layout:'', +// data attribute containing column name to use in the selector container +columnSelector_name:"data-selector-name",/* Responsive Media Query settings */ +// enable/disable mediaquery breakpoints +columnSelector_mediaquery:!0, +// toggle checkbox name +columnSelector_mediaqueryName:"Auto: ", +// breakpoints checkbox initial setting +columnSelector_mediaqueryState:!0, +// hide columnSelector false columns while in auto mode +columnSelector_mediaqueryHidden:!1, +// responsive table hides columns with priority 1-6 at these breakpoints +// see http://view.jquerymobile.com/1.3.2/dist/demos/widgets/table-column-toggle/#Applyingapresetbreakpoint +// *** set to false to disable *** +columnSelector_breakpoints:["20em","30em","40em","50em","60em","70em"], +// data attribute containing column priority +// duplicates how jQuery mobile uses priorities: +// http://view.jquerymobile.com/1.3.2/dist/demos/widgets/table-column-toggle/ +columnSelector_priority:"data-priority", +// class name added to checked checkboxes - this fixes an issue with Chrome not updating FontAwesome +// applied icons; use this class name (input.checked) instead of input:checked +columnSelector_cssChecked:"checked", +// event triggered when columnSelector completes +columnSelector_updated:"columnUpdate"},init:function(a,b,c,e){d.init(a,c,e)},remove:function(a,b,d,e){if(!e){var f=b.selector;f.$container.empty(),f.$popup&&f.$popup.empty(),f.$style.remove(),f.$breakpoints.remove(),b.$table.off("updateAll"+c+" update"+c)}}})}(jQuery); \ No newline at end of file diff --git a/dist/js/widgets/widget-columns.min.js b/dist/js/widgets/widget-columns.min.js index f69e1657..8bc2c60e 100644 --- a/dist/js/widgets/widget-columns.min.js +++ b/dist/js/widgets/widget-columns.min.js @@ -1,2 +1,8 @@ /*! Widget: columns */ -!function(a){"use strict";var b=a.tablesorter||{};b.addWidget({id:"columns",priority:30,options:{columns:["primary","secondary","tertiary"]},format:function(c,d,e){var f,g,h,i,j,k,l,m,n=d.$table,o=d.$tbodies,p=d.sortList,q=p.length,r=e&&e.columns||["primary","secondary","tertiary"],s=r.length-1;for(l=r.join(" "),g=0;g1)))for(m=1;q>m;m++)k.eq(p[m][0]).addClass(r[m]||r[s])}),b.processTbody(c,f,!1);if(i=e.columns_thead!==!1?["thead tr"]:[],e.columns_tfoot!==!1&&i.push("tfoot tr"),i.length&&(h=n.find(i.join(",")).children().removeClass(l),q))for(m=0;q>m;m++)h.filter('[data-column="'+p[m][0]+'"]').addClass(r[m]||r[s])},remove:function(c,d,e){var f,g,h=d.$tbodies,i=(e.columns||["primary","secondary","tertiary"]).join(" ");for(d.$headers.removeClass(i),d.$table.children("tfoot").children("tr").children("th, td").removeClass(i),f=0;f1)))for(m=1;q>m;m++)k.eq(p[m][0]).addClass(r[m]||r[s])}),b.processTbody(c,f,!1);if(i=e.columns_thead!==!1?["thead tr"]:[],e.columns_tfoot!==!1&&i.push("tfoot tr"),i.length&&(h=n.find(i.join(",")).children().removeClass(l),q))for(m=0;q>m;m++) +// add primary. secondary, tertiary, etc sort column classes +h.filter('[data-column="'+p[m][0]+'"]').addClass(r[m]||r[s])},remove:function(c,d,e){var f,g,h=d.$tbodies,i=(e.columns||["primary","secondary","tertiary"]).join(" ");for(d.$headers.removeClass(i),d.$table.children("tfoot").children("tr").children("th, td").removeClass(i),f=0;f0&&c>=n?n:0,z=m?o.children().children():o;m&&f.$table.data("cssStickyHeaderBottom",(s.length?d:0)-(g.cssStickyHeaders_addCaption?b:0)),g.cssStickyHeaders_addCaption&&(z=z.add(p)),u!==g.cssStickyHeaders_addCaption&&(u=g.cssStickyHeaders_addCaption,u||x(p,0)),x(z,y)}),k.unbind(("filterEnd"+n).replace(/\s+/g," ")).bind("filterEnd"+n,function(){g.cssStickyHeaders_filteredToTop&&b.scrollTo(0,k.position().top)})},remove:function(c,d,e,f){if(!f){var g=d.namespace+"cssstickyheader ";a(b).unbind("scroll resize ".split(" ").join(g).replace(/\s+/g," ")),d.$table.unbind("filterEnd scroll resize ".split(" ").join(g).replace(/\s+/g," ")).add(d.$table.children("thead").children().children()).children("thead, caption").css({transform:"","-ms-transform":"","-webkit-transform":""})}}})}(jQuery,window); \ No newline at end of file +/* +* Requires a modern browser, tablesorter v2.8+ +*/ +/*jshint jquery:true, unused:false */ +!function(a,b){"use strict";var c=a.tablesorter;c.addWidget({id:"cssStickyHeaders",priority:10,options:{cssStickyHeaders_offset:0,cssStickyHeaders_addCaption:!1, +// jQuery selector or object to attach sticky header to +cssStickyHeaders_attachTo:null,cssStickyHeaders_filteredToTop:!0},init:function(d,e,f,g){var h,i,j,k=f.$table,l=a(g.cssStickyHeaders_attachTo),m="ActiveXObject"in b,// target all versions of IE +n=f.namespace+"cssstickyheader ",o=k.children("thead"),p=k.children("caption"),q=l.length?l:a(b),r=k.parent().closest("table."+c.css.table),s=r.length&&c.hasWidget(r[0],"cssStickyHeaders")?r.children("thead"):[],t=parseInt(k.css("border-top-width"),10)||0,u=g.cssStickyHeaders_addCaption, +// table offset top changes while scrolling in FF +v=!1,w=!1,x=function(a,b){var c=0===b?"":"translate(0px,"+b+"px)";a.css({transform:c,"-ms-transform":c,"-webkit-transform":c})}; +// Firefox fixes +p.length&&(h=k.height(),p.hide(),w=k.height()===h,p.show(),i=k.offset().top,x(p,20),v=k.offset().top!==i,x(p,0)),q.unbind("scroll resize ".split(" ").join(n).replace(/\s+/g," ")).bind("scroll resize ".split(" ").join(n),function(){g=f.widgetOptions,v&&(x(p,0),j=k.offset().top);var a=l.length?l.offset().top:q.scrollTop(), +// add caption height; include table padding top & border-spacing or text may be above the fold (jQuery UI themes) +// border-spacing needed in Firefox, but not webkit... not sure if I should account for that +b=(p.outerHeight(!0)||0)+(parseInt(k.css("padding-top"),10)||0)+(parseInt(k.css("border-spacing"),10)||0),c=k.height()+(w&&g.cssStickyHeaders_addCaption?b:0)-o.height()-(k.children("tfoot").height()||0)-(g.cssStickyHeaders_addCaption?b:w?0:b),d=s.length?s.height():0, +// get bottom of nested sticky headers +e=s.length?m?r.data("cssStickyHeaderBottom")+d:s.offset().top+d-q.scrollTop():0, +// in this case FF's offsetTop changes while scrolling, so we get a saved offsetTop before scrolling occurs +// but when the table is inside a wrapper ($attach) we need to continually update the offset top +h=v?j:k.offset().top,i=w?h-(g.cssStickyHeaders_addCaption?b:0):h, +// Detect nested tables - fixes #724 +n=a-i+e+t+(g.cssStickyHeaders_offset||0)-(g.cssStickyHeaders_addCaption?w?b:0:b),y=n>0&&c>=n?n:0, +// All IE (even IE11) can only transform header cells - fixes #447 thanks to @gakreol! +z=m?o.children().children():o; +// more crazy IE stuff... +m&& +// I didn't bother testing 3 nested tables deep in IE, because I hate it +f.$table.data("cssStickyHeaderBottom",(s.length?d:0)-(g.cssStickyHeaders_addCaption?b:0)),g.cssStickyHeaders_addCaption&&(z=z.add(p)),u!==g.cssStickyHeaders_addCaption&&(u=g.cssStickyHeaders_addCaption,u||x(p,0)),x(z,y)}),k.unbind(("filterEnd"+n).replace(/\s+/g," ")).bind("filterEnd"+n,function(){g.cssStickyHeaders_filteredToTop&& +// scroll top of table into view +b.scrollTo(0,k.position().top)})},remove:function(c,d,e,f){if(!f){var g=d.namespace+"cssstickyheader ";a(b).unbind("scroll resize ".split(" ").join(g).replace(/\s+/g," ")),d.$table.unbind("filterEnd scroll resize ".split(" ").join(g).replace(/\s+/g," ")).add(d.$table.children("thead").children().children()).children("thead, caption").css({transform:"","-ms-transform":"","-webkit-transform":""})}}})}(jQuery,window); \ No newline at end of file diff --git a/dist/js/widgets/widget-editable.min.js b/dist/js/widgets/widget-editable.min.js index a2391af6..de2c2cbb 100644 --- a/dist/js/widgets/widget-editable.min.js +++ b/dist/js/widgets/widget-editable.min.js @@ -1,2 +1,40 @@ /*! Widget: editable - updated 8/17/2015 (v2.23.0) */ -!function(a){"use strict";var b=a.tablesorter.editable={namespace:".tseditable",lastEdited:"tseditable-last-edited-cell",editComplete:function(a,c,d,e){a.$table.find("."+b.lastEdited).removeClass(b.lastEdited).trigger(c.editable_editComplete,[a]),e&&setTimeout(function(){d.focus()},50)},selectAll:function(a){setTimeout(function(){var b,c;document.body.createTextRange?(b=document.body.createTextRange(),b.moveToElementText(a),b.select()):window.getSelection&&(c=window.getSelection(),b=document.createRange(),b.selectNodeContents(a),c.removeAllRanges(),c.addRange(b))},100)},getColumns:function(b,c){var d,e,f,g,h,i=c.editable_columns,j=[];if("string"==typeof i)for(d=i.replace(/\s+/,"").split(/,/),g=d.length-1;g>=0;){if(d[g].indexOf("-")>=0)for(f=d[g].split("-"),e=parseInt(f[0],10)||0,f=parseInt(f[1],10)||b.columns-1,e>f&&(h=e,e=f,f=h);f>=e;e++)j.push("td:nth-child("+(e+1)+")");else j.push("td:nth-child("+((parseInt(d[g],10)||0)+1)+")");g--}else if(a.isArray(i))for(g=i.length,e=0;g>e;e++)i[e]").wrapInner(d.editable_wrapContent).children().length||a.isFunction(d.editable_wrapContent),m=b.getColumns(c,d).join(",");for(c.$tbodies.find(m).find("[contenteditable]").prop("contenteditable",!1),f=c.$tbodies.find(m).not("."+d.editable_noEdit),h=f.length,g=0;h>g;g++)if(e=f.eq(g),l&&0===e.children("div, span").length&&e.wrapInner(d.editable_wrapContent),i=e.children("div, span").not("."+d.editable_noEdit),k=i.length)for(j=0;k>j;j++){var n=i.eq(j);d.editable_trimContent&&n.html(function(b,c){return a.trim(c)}),n.prop("contenteditable",!0)}else d.editable_trimContent&&e.html(function(b,c){return a.trim(c)}),e.prop("contenteditable",!0)},bindEvents:function(c,d){var e=b.namespace;c.$table.off("updateComplete pagerComplete ".split(" ").join(e+" ").replace(/\s+/g," ")).on("updateComplete pagerComplete ".split(" ").join(e+" "),function(){b.update(c,c.widgetOptions)}).children("thead").add(a(c.namespace+"_extra_table").children("thead")).off("mouseenter"+e).on("mouseenter"+e,function(){c.$table.data("contentFocused")&&(c.$table.data("contentFocused",!0),a(":focus").trigger("focusout"))}),c.$tbodies.off("focus blur focusout keydown ".split(" ").join(e+" ").replace(/\s+/g," ")).on("focus"+e,"[contenteditable]",function(f){clearTimeout(a(this).data("timer")),c.$table.data("contentFocused",f.target),c.table.isUpdating=!0;var g=a(this),h=d.editable_selectAll,i=g.closest("td").index(),j=g.html();d.editable_trimContent&&(j=a.trim(j)),g.off("keydown"+e).on("keydown"+e,function(a){d.editable_enterToAccept&&13===a.which&&!a.shiftKey&&a.preventDefault()}),g.data({before:j,original:j}),"function"==typeof d.editable_focused&&d.editable_focused(j,i,g),h&&("function"==typeof h?h(j,i,g)&&b.selectAll(g[0]):b.selectAll(g[0]))}).on("blur focusout keydown ".split(" ").join(e+" "),"[contenteditable]",function(f){if(c.$table.data("contentFocused")){var g,h,i=!1,j=a(f.target),k=j.html(),l=j.closest("td").index();if(d.editable_trimContent&&(k=a.trim(k)),27===f.which)return j.html(j.data("original")).trigger("blur"+e),c.$table.data("contentFocused",!1),c.table.isUpdating=!1,!1;if(g=13===f.which&&!f.shiftKey&&(d.editable_enterToAccept||f.altKey)||d.editable_autoAccept&&"keydown"!==f.type,g&&j.data("before")!==k){if(h=d.editable_validate,i=k,"function"==typeof h?i=h(k,j.data("original"),l,j):"function"==typeof(h=a.tablesorter.getColumnData(c.table,h,l))&&(i=h(k,j.data("original"),l,j)),g&&i!==!1)return c.$table.find("."+b.lastEdited).removeClass(b.lastEdited),j.addClass(b.lastEdited).html(i).data("before",i).data("original",i).trigger("change"),a.tablesorter.updateCell(c,j.closest("td"),!1,function(){d.editable_autoResort?setTimeout(function(){a.tablesorter.sortOn(c,c.sortList,function(){b.editComplete(c,d,c.$table.data("contentFocused"),!0)},!0)},10):b.editComplete(c,d,c.$table.data("contentFocused"))}),!1}else i||"keydown"===f.type||(clearTimeout(j.data("timer")),j.data("timer",setTimeout(function(){c.table.isUpdating=!1,a.isFunction(d.editable_blur)&&(k=j.html(),d.editable_blur(d.editable_trimContent?a.trim(k):k,l,j))},100)),j.html(j.data("original")))}})},destroy:function(a,c){var d=b.namespace,e=b.getColumns(a,c),f="updateComplete pagerComplete ".split(" ").join(d+" ").replace(/\s+/g," ");a.$table.off(f),f="focus blur focusout keydown ".split(" ").join(d+" ").replace(/\s+/g," "),a.$tbodies.off(f).find(e.join(",")).find("[contenteditable]").prop("contenteditable",!1)}};a.tablesorter.addWidget({id:"editable",options:{editable_columns:[],editable_enterToAccept:!0,editable_autoAccept:!0,editable_autoResort:!1,editable_wrapContent:"
    ",editable_trimContent:!0,editable_validate:null,editable_focused:null,editable_blur:null,editable_selectAll:!1,editable_noEdit:"no-edit",editable_editComplete:"editComplete"},init:function(a,c,d,e){e.editable_columns.length&&(b.update(d,e),b.bindEvents(d,e))},remove:function(a,c,d,e){e||b.destroy(c,d)}})}(jQuery); \ No newline at end of file +/* + * Requires tablesorter v2.8+ and jQuery 1.7+ + * by Rob Garrison + */ +/*jshint browser:true, jquery:true, unused:false */ +/*global jQuery: false */ +!function(a){"use strict";var b=a.tablesorter.editable={namespace:".tseditable", +// last edited class name +lastEdited:"tseditable-last-edited-cell",editComplete:function(a,c,d,e){a.$table.find("."+b.lastEdited).removeClass(b.lastEdited).trigger(c.editable_editComplete,[a]), +// restore focus last cell after updating +e&&setTimeout(function(){d.focus()},50)},selectAll:function(a){setTimeout(function(){ +// select all text in contenteditable +// see http://stackoverflow.com/a/6150060/145346 +var b,c;document.body.createTextRange?(b=document.body.createTextRange(),b.moveToElementText(a),b.select()):window.getSelection&&(c=window.getSelection(),b=document.createRange(),b.selectNodeContents(a),c.removeAllRanges(),c.addRange(b))},100)},getColumns:function(b,c){var d,e,f,g,h,i=c.editable_columns,j=[];if("string"==typeof i)for( +// editable_columns can contain a range string, or comma separated values (e.g. '1,2-4,7') +d=i.replace(/\s+/,"").split(/,/),g=d.length-1;g>=0;){if(d[g].indexOf("-")>=0)for(f=d[g].split("-"),e=parseInt(f[0],10)||0,f=parseInt(f[1],10)||b.columns-1,e>f&&(h=e,e=f,f=h);f>=e;e++)j.push("td:nth-child("+(e+1)+")");else j.push("td:nth-child("+((parseInt(d[g],10)||0)+1)+")");g--}else if(a.isArray(i))for(g=i.length,e=0;g>e;e++)i[e]").wrapInner(d.editable_wrapContent).children().length||a.isFunction(d.editable_wrapContent),m=b.getColumns(c,d).join(",");for( +// turn off contenteditable to allow dynamically setting the wo.editable_noEdit +// class on table cells - see issue #900 +c.$tbodies.find(m).find("[contenteditable]").prop("contenteditable",!1),f=c.$tbodies.find(m).not("."+d.editable_noEdit),h=f.length,g=0;h>g;g++)if(e=f.eq(g),l&&0===e.children("div, span").length&&e.wrapInner(d.editable_wrapContent),i=e.children("div, span").not("."+d.editable_noEdit),k=i.length) +// make div/span children content editable +for(j=0;k>j;j++){var n=i.eq(j);d.editable_trimContent&&n.html(function(b,c){return a.trim(c)}),n.prop("contenteditable",!0)}else d.editable_trimContent&&e.html(function(b,c){return a.trim(c)}),e.prop("contenteditable",!0)},bindEvents:function(c,d){var e=b.namespace;c.$table.off("updateComplete pagerComplete ".split(" ").join(e+" ").replace(/\s+/g," ")).on("updateComplete pagerComplete ".split(" ").join(e+" "),function(){b.update(c,c.widgetOptions)}).children("thead").add(a(c.namespace+"_extra_table").children("thead")).off("mouseenter"+e).on("mouseenter"+e,function(){c.$table.data("contentFocused")&&( +// change to 'true' instead of element to allow focusout to process +c.$table.data("contentFocused",!0),a(":focus").trigger("focusout"))}),c.$tbodies.off("focus blur focusout keydown ".split(" ").join(e+" ").replace(/\s+/g," ")).on("focus"+e,"[contenteditable]",function(f){clearTimeout(a(this).data("timer")),c.$table.data("contentFocused",f.target),c.table.isUpdating=!0;// prevent sorting while editing +var g=a(this),h=d.editable_selectAll,i=g.closest("td").index(),j=g.html();d.editable_trimContent&&(j=a.trim(j)), +// prevent enter from adding into the content +g.off("keydown"+e).on("keydown"+e,function(a){d.editable_enterToAccept&&13===a.which&&!a.shiftKey&&a.preventDefault()}),g.data({before:j,original:j}),"function"==typeof d.editable_focused&&d.editable_focused(j,i,g),h&&("function"==typeof h?h(j,i,g)&&b.selectAll(g[0]):b.selectAll(g[0]))}).on("blur focusout keydown ".split(" ").join(e+" "),"[contenteditable]",function(f){if(c.$table.data("contentFocused")){var g,h,i=!1,j=a(f.target),k=j.html(),l=j.closest("td").index();if(d.editable_trimContent&&(k=a.trim(k)),27===f.which) +// user cancelled +return j.html(j.data("original")).trigger("blur"+e),c.$table.data("contentFocused",!1),c.table.isUpdating=!1,!1; +// change if new or user hits enter ( if option set ) +if(g=13===f.which&&!f.shiftKey&&(d.editable_enterToAccept||f.altKey)||d.editable_autoAccept&&"keydown"!==f.type,g&&j.data("before")!==k){if(h=d.editable_validate,i=k,"function"==typeof h?i=h(k,j.data("original"),l,j):"function"==typeof(h=a.tablesorter.getColumnData(c.table,h,l))&&(i=h(k,j.data("original"),l,j)),g&&i!==!1)return c.$table.find("."+b.lastEdited).removeClass(b.lastEdited),j.addClass(b.lastEdited).html(i).data("before",i).data("original",i).trigger("change"),a.tablesorter.updateCell(c,j.closest("td"),!1,function(){d.editable_autoResort?setTimeout(function(){a.tablesorter.sortOn(c,c.sortList,function(){b.editComplete(c,d,c.$table.data("contentFocused"),!0)},!0)},10):b.editComplete(c,d,c.$table.data("contentFocused"))}),!1}else i||"keydown"===f.type||(clearTimeout(j.data("timer")),j.data("timer",setTimeout(function(){c.table.isUpdating=!1,// clear flag or sorting will be disabled +a.isFunction(d.editable_blur)&&(k=j.html(),d.editable_blur(d.editable_trimContent?a.trim(k):k,l,j))},100)), +// restore original content on blur +j.html(j.data("original")))}})},destroy:function(a,c){var d=b.namespace,e=b.getColumns(a,c),f="updateComplete pagerComplete ".split(" ").join(d+" ").replace(/\s+/g," ");a.$table.off(f),f="focus blur focusout keydown ".split(" ").join(d+" ").replace(/\s+/g," "),a.$tbodies.off(f).find(e.join(",")).find("[contenteditable]").prop("contenteditable",!1)}};a.tablesorter.addWidget({id:"editable",options:{editable_columns:[],editable_enterToAccept:!0,editable_autoAccept:!0,editable_autoResort:!1,editable_wrapContent:"
    ",// wrap the cell content... makes this widget work in IE, and with autocomplete +editable_trimContent:!0,// trim content inside of contenteditable ( remove tabs & carriage returns ) +editable_validate:null,// function( text, originalText ){ return text; } +editable_focused:null,// function( text, columnIndex, $element ) {} +editable_blur:null,// function( text, columnIndex, $element ) { } +editable_selectAll:!1,// true/false or function( text, columnIndex, $element ) { return true; } +editable_noEdit:"no-edit",editable_editComplete:"editComplete"},init:function(a,c,d,e){e.editable_columns.length&&(b.update(d,e),b.bindEvents(d,e))},remove:function(a,c,d,e){e||b.destroy(c,d)}})}(jQuery); \ No newline at end of file diff --git a/dist/js/widgets/widget-filter-formatter-html5.min.js b/dist/js/widgets/widget-filter-formatter-html5.min.js index f67c90d0..ffdf0eef 100644 --- a/dist/js/widgets/widget-filter-formatter-html5.min.js +++ b/dist/js/widgets/widget-filter-formatter-html5.min.js @@ -1,2 +1,73 @@ /*! Widget: filter, html5 formatter functions - updated 7/17/2014 (v2.17.5) */ -!function(a){"use strict";var b=a.tablesorter||{},c=".compare-select",d=b.filterFormatter=a.extend({},b.filterFormatter,{addCompare:function(b,d,e){if(e.compare&&a.isArray(e.compare)&&e.compare.length>1){var f="",g=[c.slice(1)," "+c.slice(1),""],h=e.cellText?'":"";a.each(e.compare,function(a,b){f+=""}),b.wrapInner('
    ').prepend(h+'').appendTo(e),l=j.skipTest||"number"===k.attr("type")&&"test"!==k.val(),m=[],n=e.closest("table")[0].config,o=function(b,d){var f=j.addToggle?e.find(".toggle").is(":checked"):!0,g=e.find(".number").val(),h=(a.isArray(j.compare)?e.find(c).val()||j.compare[j.selected||0]:j.compare)||"",k=n.$table[0].hasInitialized?(b?b:j.delayed)||"":!0;i.val(!j.addToggle||f?(h?h:j.exactMatch?"=":"")+g:"").trigger(d?"":"search",k).end().find(".number").val(g),e.find(".number").length&&(e.find(".number")[0].disabled=j.disabled||!f),m.length&&(m.find(".number").val(g)[0].disabled=j.disabled||!f,m.find(c).val(h),j.addToggle&&(m.find(".toggle")[0].checked=f))};return k.remove(),l&&(h=j.addToggle?'
    ':"",h+='',e.append(h+'').find(".toggle, .number").bind("change",function(){o()}).closest("thead").find("th[data-column="+f+"]").addClass("filter-parsed").closest("table").bind("filterReset",function(){a.isArray(j.compare)&&e.add(m).find(c).val(j.compare[j.selected||0]),j.addToggle&&(e.find(".toggle")[0].checked=!1,m.length&&(m.find(".toggle")[0].checked=!1)),e.find(".number").val(j.value),setTimeout(function(){o()},0)}),i=e.find("input[type=hidden]").bind("change",function(){e.find(".number").val(this.value),o()}),n.$table.bind("filterFomatterUpdate",function(){var a=d.updateCompare(e,i,j)[0]||j.value;e.find(".number").val(((a||"")+"").replace(/[><=]/g,"")),o(!1,!0),b.filter.formatterUpdated(e,f)}),j.compare&&(d.addCompare(e,f,j),e.find(c).bind("change",function(){o()})),n.$table.bind("stickyHeadersInit",function(){m=n.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty(),m.append(h).find(".toggle, .number").bind("change",function(){e.find(".number").val(a(this).val()),o()}),j.compare&&(d.addCompare(m,f,j),m.find(c).bind("change",function(){e.find(c).val(a(this).val()),o()})),o()}),o()),l?e.find('input[type="hidden"]'):a('')},html5Range:function(e,f,g){var h,i=a.extend({value:0,min:0,max:100,step:1,delayed:!0,valueToHeader:!0,exactMatch:!0,cellText:"",compare:"",allText:"all",skipTest:!1},g),j=a('').appendTo(e),k=i.skipTest||"range"===j.attr("type")&&"test"!==j.val(),l=[],m=e.closest("table")[0].config,n=function(b,d,g){b=("undefined"==typeof b?h.val():b).toString().replace(/[<>=]/g,"")||i.value;var j=(a.isArray(i.compare)?e.find(c).val()||i.compare[i.selected||0]:i.compare)||"",k=" ("+(j?j+b:b==i.min?i.allText:b)+")",n=m.$table[0].hasInitialized?(d?d:i.delayed)||"":!0;e.find("input[type=hidden]").val(j?j+b:b==i.min?"":(i.exactMatch?"=":"")+b).trigger(g?"":"search",n).end().find(".range").val(b),e.closest("thead").find("th[data-column="+f+"]").find(".curvalue").html(k),l.length&&(l.find(".range").val(b).end().find(c).val(j),l.closest("thead").find("th[data-column="+f+"]").find(".curvalue").html(k))};return j.remove(),k&&(e.html('').closest("thead").find("th[data-column="+f+"]").addClass("filter-parsed").find(".tablesorter-header-inner").append(''),h=e.find("input[type=hidden]").bind("change"+m.namespace+"filter",function(){var b=this.value,d=(a.isArray(i.compare)?e.find(c).val()||i.compare[i.selected||0]:i.compare)||"";b!==this.lastValue&&(this.lastValue=d?d+b:b==i.min?"":(i.exactMatch?"=":"")+b,this.value=this.lastValue,n(b))}),e.find(".range").bind("change",function(){n(this.value)}),m.$table.bind("filterFomatterUpdate",function(){var a=d.updateCompare(e,h,i)[0];e.find(".range").val(a),n(a,!1,!0),b.filter.formatterUpdated(e,f)}),i.compare&&(d.addCompare(e,f,i),e.find(c).bind("change",function(){n()})),m.$table.bind("stickyHeadersInit",function(){l=m.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty(),l.html('').find(".range").bind("change",function(){n(l.find(".range").val())}),n(),i.compare&&(d.addCompare(l,f,i),l.find(c).bind("change",function(){e.find(c).val(a(this).val()),n()}))}),e.closest("table").bind("filterReset",function(){a.isArray(i.compare)&&e.add(l).find(c).val(i.compare[i.selected||0]),setTimeout(function(){n(i.value,!1,!0)},0)}),n()),k?e.find('input[type="hidden"]'):a('')},html5Color:function(c,d,e){var f,g,h=a.extend({value:"#000000",disabled:!1,addToggle:!0,exactMatch:!0,valueToHeader:!1,skipTest:!1},e),i=a('').appendTo(c),j=h.skipTest||"color"===i.attr("type")&&"test"!==i.val(),k=[],l=c.closest("table")[0].config,m=function(a,b){a=("undefined"==typeof a?g.val():a).toString().replace("=","")||h.value;var e=!0,f=" ("+a+")";h.addToggle&&(e=c.find(".toggle").is(":checked")),c.find(".colorpicker").length&&(c.find(".colorpicker").val(a)[0].disabled=h.disabled||!e),g.val(e?a+(h.exactMatch?"=":""):"").trigger(!l.$table[0].hasInitialized||b?"":"search"),h.valueToHeader?c.closest("thead").find("th[data-column="+d+"]").find(".curcolor").html(f):c.find(".currentColor").html(f),k.length&&(k.find(".colorpicker").val(a)[0].disabled=h.disabled||!e,h.addToggle&&(k.find(".toggle")[0].checked=e),h.valueToHeader?k.closest("thead").find("th[data-column="+d+"]").find(".curcolor").html(f):k.find(".currentColor").html(f))};return i.remove(),j&&(f=""+d+Math.round(100*Math.random()),f='
    '+(h.addToggle?'
    ':"")+''+(h.valueToHeader?"":'(#000000)')+"
    ",c.html(f),h.valueToHeader&&c.closest("thead").find("th[data-column="+d+"]").find(".tablesorter-header-inner").append(''),c.find(".toggle, .colorpicker").bind("change",function(){m(c.find(".colorpicker").val())}),g=c.find("input[type=hidden]").bind("change"+l.namespace+"filter",function(){m(this.value)}),l.$table.bind("filterFomatterUpdate",function(){m(g.val(),!0),b.filter.formatterUpdated(c,d)}),c.closest("table").bind("filterReset",function(){h.addToggle&&(c.find(".toggle")[0].checked=!1),setTimeout(function(){m()},0)}),l.$table.bind("stickyHeadersInit",function(){k=l.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(d),k.html(f).find(".toggle, .colorpicker").bind("change",function(){m(k.find(".colorpicker").val())}),m(k.find(".colorpicker").val())}),m(h.value)),j?c.find('input[type="hidden"]'):a('')}})}(jQuery); \ No newline at end of file +/* + * requires: tableSorter (FORK) 2.15+ and jQuery 1.4.3+ + * + * html5Number (spinner) + * html5Range (slider) + * html5Color (color) + */ +/*jshint browser:true, jquery:true, unused:false */ +/*global jQuery: false */ +!function(a){"use strict";var b=a.tablesorter||{}, +// compare option selector class name (jQuery selector) +c=".compare-select",d=b.filterFormatter=a.extend({},b.filterFormatter,{addCompare:function(b,d,e){if(e.compare&&a.isArray(e.compare)&&e.compare.length>1){var f="",g=[c.slice(1)," "+c.slice(1),""],h=e.cellText?'":"";a.each(e.compare,function(a,b){f+=""}),b.wrapInner('
    ').prepend(h+'').appendTo(e), +// test if HTML5 number is supported - from Modernizr +l=j.skipTest||"number"===k.attr("type")&&"test"!==k.val(),m=[],n=e.closest("table")[0].config,o=function(b,d){var f=j.addToggle?e.find(".toggle").is(":checked"):!0,g=e.find(".number").val(),h=(a.isArray(j.compare)?e.find(c).val()||j.compare[j.selected||0]:j.compare)||"",k=n.$table[0].hasInitialized?(b?b:j.delayed)||"":!0;i.val(!j.addToggle||f?(h?h:j.exactMatch?"=":"")+g:"").trigger(d?"":"search",k).end().find(".number").val(g),e.find(".number").length&&(e.find(".number")[0].disabled=j.disabled||!f), +// update sticky header cell +m.length&&(m.find(".number").val(g)[0].disabled=j.disabled||!f,m.find(c).val(h),j.addToggle&&(m.find(".toggle")[0].checked=f))}; +// add HTML5 number (spinner) +// update slider from hidden input, in case of saved filters +// add compare select +// has sticky headers? +return k.remove(),l&&(h=j.addToggle?'
    ':"",h+='',e.append(h+'').find(".toggle, .number").bind("change",function(){o()}).closest("thead").find("th[data-column="+f+"]").addClass("filter-parsed").closest("table").bind("filterReset",function(){a.isArray(j.compare)&&e.add(m).find(c).val(j.compare[j.selected||0]),j.addToggle&&(e.find(".toggle")[0].checked=!1,m.length&&(m.find(".toggle")[0].checked=!1)),e.find(".number").val(j.value),setTimeout(function(){o()},0)}),i=e.find("input[type=hidden]").bind("change",function(){e.find(".number").val(this.value),o()}),n.$table.bind("filterFomatterUpdate",function(){var a=d.updateCompare(e,i,j)[0]||j.value;e.find(".number").val(((a||"")+"").replace(/[><=]/g,"")),o(!1,!0),b.filter.formatterUpdated(e,f)}),j.compare&&(d.addCompare(e,f,j),e.find(c).bind("change",function(){o()})),n.$table.bind("stickyHeadersInit",function(){m=n.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty(),m.append(h).find(".toggle, .number").bind("change",function(){e.find(".number").val(a(this).val()),o()}),j.compare&&(d.addCompare(m,f,j),m.find(c).bind("change",function(){e.find(c).val(a(this).val()),o()})),o()}),o()),l?e.find('input[type="hidden"]'):a('')},/**********************\ + HTML5 range slider + \**********************/ +html5Range:function(e,f,g){var h,i=a.extend({value:0,min:0,max:100,step:1,delayed:!0,valueToHeader:!0,exactMatch:!0,cellText:"",compare:"",allText:"all",skipTest:!1},g), +// test browser for HTML5 range support +j=a('').appendTo(e), +// test if HTML5 range is supported - from Modernizr (but I left out the method to detect in Safari 2-4) +// see https://github.com/Modernizr/Modernizr/blob/master/feature-detects/inputtypes.js +k=i.skipTest||"range"===j.attr("type")&&"test"!==j.val(),l=[],m=e.closest("table")[0].config,n=function(b,d,g){/*jshint eqeqeq:false */ +// hidden input changes may include compare symbols +b=("undefined"==typeof b?h.val():b).toString().replace(/[<>=]/g,"")||i.value;var j=(a.isArray(i.compare)?e.find(c).val()||i.compare[i.selected||0]:i.compare)||"",k=" ("+(j?j+b:b==i.min?i.allText:b)+")",n=m.$table[0].hasInitialized?(d?d:i.delayed)||"":!0;e.find("input[type=hidden]").val(j?j+b:b==i.min?"":(i.exactMatch?"=":"")+b).trigger(g?"":"search",n).end().find(".range").val(b), +// or add current value to the header cell, if desired +e.closest("thead").find("th[data-column="+f+"]").find(".curvalue").html(k), +// update sticky header cell +l.length&&(l.find(".range").val(b).end().find(c).val(j),l.closest("thead").find("th[data-column="+f+"]").find(".curvalue").html(k))}; +// add HTML5 range +// hidden filter update namespace trigger by filter widget +// update spinner from hidden input, in case of saved filters +// add compare select +// has sticky headers? +// on reset +return j.remove(),k&&(e.html('').closest("thead").find("th[data-column="+f+"]").addClass("filter-parsed").find(".tablesorter-header-inner").append(''),h=e.find("input[type=hidden]").bind("change"+m.namespace+"filter",function(){/*jshint eqeqeq:false */ +var b=this.value,d=(a.isArray(i.compare)?e.find(c).val()||i.compare[i.selected||0]:i.compare)||"";b!==this.lastValue&&(this.lastValue=d?d+b:b==i.min?"":(i.exactMatch?"=":"")+b,this.value=this.lastValue,n(b))}),e.find(".range").bind("change",function(){n(this.value)}),m.$table.bind("filterFomatterUpdate",function(){var a=d.updateCompare(e,h,i)[0];e.find(".range").val(a),n(a,!1,!0),b.filter.formatterUpdated(e,f)}),i.compare&&(d.addCompare(e,f,i),e.find(c).bind("change",function(){n()})),m.$table.bind("stickyHeadersInit",function(){l=m.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty(),l.html('').find(".range").bind("change",function(){n(l.find(".range").val())}),n(),i.compare&&(d.addCompare(l,f,i),l.find(c).bind("change",function(){e.find(c).val(a(this).val()),n()}))}),e.closest("table").bind("filterReset",function(){a.isArray(i.compare)&&e.add(l).find(c).val(i.compare[i.selected||0]),setTimeout(function(){n(i.value,!1,!0)},0)}),n()),k?e.find('input[type="hidden"]'):a('')},/**********************\ + HTML5 Color picker + \**********************/ +html5Color:function(c,d,e){var f,g,h=a.extend({value:"#000000",disabled:!1,addToggle:!0,exactMatch:!0,valueToHeader:!1,skipTest:!1},e), +// Add a hidden input to hold the range values +i=a('').appendTo(c), +// test if HTML5 color is supported - from Modernizr +j=h.skipTest||"color"===i.attr("type")&&"test"!==i.val(),k=[],l=c.closest("table")[0].config,m=function(a,b){a=("undefined"==typeof a?g.val():a).toString().replace("=","")||h.value;var e=!0,f=" ("+a+")";h.addToggle&&(e=c.find(".toggle").is(":checked")),c.find(".colorpicker").length&&(c.find(".colorpicker").val(a)[0].disabled=h.disabled||!e),g.val(e?a+(h.exactMatch?"=":""):"").trigger(!l.$table[0].hasInitialized||b?"":"search"),h.valueToHeader? +// add current color to the header cell +c.closest("thead").find("th[data-column="+d+"]").find(".curcolor").html(f): +// current color to span in cell +c.find(".currentColor").html(f), +// update sticky header cell +k.length&&(k.find(".colorpicker").val(a)[0].disabled=h.disabled||!e,h.addToggle&&(k.find(".toggle")[0].checked=e),h.valueToHeader? +// add current color to the header cell +k.closest("thead").find("th[data-column="+d+"]").find(".curcolor").html(f): +// current color to span in cell +k.find(".currentColor").html(f))}; +// add HTML5 color picker +// add span to header for the current color value - only works if the line in the updateColor() function is also un-commented out +// hidden filter update namespace trigger by filter widget +// update slider from hidden input, in case of saved filters +// on reset +// has sticky headers? +return i.remove(),j&&(f=""+d+Math.round(100*Math.random()),f='
    '+(h.addToggle?'
    ':"")+''+(h.valueToHeader?"":'(#000000)')+"
    ",c.html(f),h.valueToHeader&&c.closest("thead").find("th[data-column="+d+"]").find(".tablesorter-header-inner").append(''),c.find(".toggle, .colorpicker").bind("change",function(){m(c.find(".colorpicker").val())}),g=c.find("input[type=hidden]").bind("change"+l.namespace+"filter",function(){m(this.value)}),l.$table.bind("filterFomatterUpdate",function(){m(g.val(),!0),b.filter.formatterUpdated(c,d)}),c.closest("table").bind("filterReset",function(){h.addToggle&&(c.find(".toggle")[0].checked=!1),setTimeout(function(){m()},0)}),l.$table.bind("stickyHeadersInit",function(){k=l.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(d),k.html(f).find(".toggle, .colorpicker").bind("change",function(){m(k.find(".colorpicker").val())}),m(k.find(".colorpicker").val())}),m(h.value)),j?c.find('input[type="hidden"]'):a('')}})}(jQuery); \ No newline at end of file diff --git a/dist/js/widgets/widget-filter-formatter-jui.min.js b/dist/js/widgets/widget-filter-formatter-jui.min.js index 00892e4f..fca34466 100644 --- a/dist/js/widgets/widget-filter-formatter-jui.min.js +++ b/dist/js/widgets/widget-filter-formatter-jui.min.js @@ -1,2 +1,146 @@ /*! Widget: filter jQuery UI formatter functions - updated 7/17/2014 (v2.17.5) */ -!function(a){"use strict";var b=a.tablesorter||{},c=".compare-select",d=b.filterFormatter=a.extend({},b.filterFormatter,{addCompare:function(b,d,e){if(e.compare&&a.isArray(e.compare)&&e.compare.length>1){var f="",g=[c.slice(1)," "+c.slice(1),""],h=e.cellText?'":"";a.each(e.compare,function(a,b){f+=""}),b.wrapInner('
    ').prepend(h+'').appendTo(e).bind("change"+i.namespace+"filter",function(){l({value:this.value,delayed:!1})}),k=[],l=function(d,f){var g,j=!0,l=d&&d.value&&b.formatFloat((d.value+"").replace(/[><=]/g,""))||e.find(".spinner").val()||h.value,m=(a.isArray(h.compare)?e.find(c).val()||h.compare[h.selected||0]:h.compare)||"",n=d&&"boolean"==typeof d.delayed?d.delayed:i.$table[0].hasInitialized?h.delayed||"":!0;h.addToggle&&(j=e.find(".toggle").is(":checked")),g=h.disabled||!j?"disable":"enable",e.find(".filter").val(j?(m?m:h.exactMatch?"=":"")+l:"").trigger(f?"":"search",n).end().find(".spinner").spinner(g).val(l),k.length&&(k.find(".spinner").spinner(g).val(l).end().find(c).val(m),h.addToggle&&(k.find(".toggle")[0].checked=j))};return h.oldcreate=h.create,h.oldspin=h.spin,h.create=function(a,b){l(),"function"==typeof h.oldcreate&&h.oldcreate(a,b)},h.spin=function(a,b){l(b),"function"==typeof h.oldspin&&h.oldspin(a,b)},h.addToggle&&a('
    ').appendTo(e).find(".toggle").bind("change",function(){l()}),e.closest("thead").find("th[data-column="+f+"]").addClass("filter-parsed"),a('').val(h.value).appendTo(e).spinner(h).bind("change keyup",function(){l()}),i.$table.bind("filterFomatterUpdate",function(){var a=d.updateCompare(e,j,h)[0];e.find(".spinner").val(a),l({value:a},!0),b.filter.formatterUpdated(e,f)}),h.compare&&(d.addCompare(e,f,h),e.find(c).bind("change",function(){l()})),i.$table.bind("stickyHeadersInit",function(){k=i.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty(),h.addToggle&&a('
    ').appendTo(k).find(".toggle").bind("change",function(){e.find(".toggle")[0].checked=this.checked,l()}),a('').val(h.value).appendTo(k).spinner(h).bind("change keyup",function(){e.find(".spinner").val(this.value),l()}),h.compare&&(d.addCompare(k,f,h),k.find(c).bind("change",function(){e.find(c).val(a(this).val()),l()}))}),i.$table.bind("filterReset",function(){a.isArray(h.compare)&&e.add(k).find(c).val(h.compare[h.selected||0]),h.addToggle&&(e.find(".toggle")[0].checked=!1),e.find(".spinner").spinner("value",h.value),setTimeout(function(){l()},0)}),l(),j},uiSlider:function(e,f,g){var h=a.extend({delayed:!0,valueToHeader:!1,exactMatch:!0,cellText:"",compare:"",allText:"all",value:0,min:0,max:100,step:1,range:"min"},g),i=e.closest("table")[0].config,j=a('').appendTo(e).bind("change"+i.namespace+"filter",function(){l({value:this.value})}),k=[],l=function(d,g){var j="undefined"!=typeof d?b.formatFloat((d.value+"").replace(/[><=]/g,""))||h.value:h.value,l=h.compare?j:j===h.min?h.allText:j,m=(a.isArray(h.compare)?e.find(c).val()||h.compare[h.selected||0]:h.compare)||"",n=m+l,o=d&&"boolean"==typeof d.delayed?d.delayed:i.$table[0].hasInitialized?h.delayed||"":!0;h.valueToHeader?e.closest("thead").find("th[data-column="+f+"]").find(".curvalue").html(" ("+n+")"):e.find(".ui-slider-handle").addClass("value-popup").attr("data-value",n),e.find(".filter").val(m?m+j:j===h.min?"":(h.exactMatch?"=":"")+j).trigger(g?"":"search",o).end().find(".slider").slider("value",j),k.length&&(k.find(c).val(m).end().find(".slider").slider("value",j),h.valueToHeader?k.closest("thead").find("th[data-column="+f+"]").find(".curvalue").html(" ("+n+")"):k.find(".ui-slider-handle").addClass("value-popup").attr("data-value",n))};return e.closest("thead").find("th[data-column="+f+"]").addClass("filter-parsed"),h.valueToHeader&&e.closest("thead").find("th[data-column="+f+"]").find(".tablesorter-header-inner").append(''),h.oldcreate=h.create,h.oldslide=h.slide,h.create=function(a,b){l(),"function"==typeof h.oldcreate&&h.oldcreate(a,b)},h.slide=function(a,b){l(b),"function"==typeof h.oldslide&&h.oldslide(a,b)},a('
    ').appendTo(e).slider(h),i.$table.bind("filterFomatterUpdate",function(){var a=d.updateCompare(e,j,h)[0];e.find(".slider").slider("value",a),l({value:a},!1),b.filter.formatterUpdated(e,f)}),h.compare&&(d.addCompare(e,f,h),e.find(c).bind("change",function(){l({value:e.find(".slider").slider("value")})})),i.$table.bind("filterReset",function(){a.isArray(h.compare)&&e.add(k).find(c).val(h.compare[h.selected||0]),setTimeout(function(){l({value:h.value})},0)}),i.$table.bind("stickyHeadersInit",function(){k=i.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty(),a('
    ').val(h.value).appendTo(k).slider(h).bind("change keyup",function(){e.find(".slider").slider("value",this.value),l()}),h.compare&&(d.addCompare(k,f,h),k.find(c).bind("change",function(){e.find(c).val(a(this).val()),l()}))}),j},uiRange:function(c,d,e){var f=a.extend({delayed:!0,valueToHeader:!1,values:[0,100],min:0,max:100,range:!0},e),g=c.closest("table")[0].config,h=a('').appendTo(c).bind("change"+g.namespace+"filter",function(){j()}),i=[],j=function(){var a=h.val(),b=a.split(" - ");""===a&&(b=[f.min,f.max]),b&&b[1]&&k({values:b,delay:!1},!0)},k=function(a,b){var e=a&&a.values||f.values,h=e[0]+" - "+e[1],j=e[0]===f.min&&e[1]===f.max?"":h,k=a&&"boolean"==typeof a.delayed?a.delayed:g.$table[0].hasInitialized?f.delayed||"":!0;f.valueToHeader?c.closest("thead").find("th[data-column="+d+"]").find(".currange").html(" ("+h+")"):c.find(".ui-slider-handle").addClass("value-popup").eq(0).attr("data-value",e[0]).end().eq(1).attr("data-value",e[1]),c.find(".filter").val(j).trigger(b?"":"search",k).end().find(".range").slider("values",e),i.length&&(i.find(".range").slider("values",e),f.valueToHeader?i.closest("thead").find("th[data-column="+d+"]").find(".currange").html(" ("+h+")"):i.find(".ui-slider-handle").addClass("value-popup").eq(0).attr("data-value",e[0]).end().eq(1).attr("data-value",e[1]))};return c.closest("thead").find("th[data-column="+d+"]").addClass("filter-parsed"),f.valueToHeader&&c.closest("thead").find("th[data-column="+d+"]").find(".tablesorter-header-inner").append(''),f.oldcreate=f.create,f.oldslide=f.slide,f.create=function(a,b){k(),"function"==typeof f.oldcreate&&f.oldcreate(a,b)},f.slide=function(a,b){k(b),"function"==typeof f.oldslide&&f.oldslide(a,b)},a('
    ').appendTo(c).slider(f),g.$table.bind("filterFomatterUpdate",function(){j(),b.filter.formatterUpdated(c,d)}),g.$table.bind("filterReset",function(){c.find(".range").slider("values",f.values),setTimeout(function(){k()},0)}),g.$table.bind("stickyHeadersInit",function(){i=g.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(d).empty(),a('
    ').val(f.value).appendTo(i).slider(f).bind("change keyup",function(){c.find(".range").val(this.value),k()})}),h},uiDateCompare:function(e,f,g){var h,i,j=a.extend({cellText:"",compare:"",endOfDay:!0,defaultDate:"",changeMonth:!0,changeYear:!0,numberOfMonths:1},g),k=e.closest("table")[0].config,l=e.closest("thead").find("th[data-column="+f+"]").addClass("filter-parsed"),m=a('').appendTo(e).bind("change"+k.namespace+"filter",function(){var a=this.value;a&&j.onClose(a)}),n=[],o=function(b){var d,f,g=h.datepicker("getDate")||"",i=(a.isArray(j.compare)?e.find(c).val()||j.compare[j.selected||0]:j.compare)||"",l=k.$table[0].hasInitialized?j.delayed||"":!0;h.datepicker("setDate",(""===g?"":g)||null),""===g&&(b=!1),d=h.datepicker("getDate"),f=d?(j.endOfDay&&/<=/.test(i)?d.setHours(23,59,59):d.getTime())||"":"",d&&j.endOfDay&&"="===i&&(i="",f+=" - "+d.setHours(23,59,59),b=!1),e.find(".dateCompare").val(i+f).trigger(b?"":"search",l).end(),n.length&&n.find(".dateCompare").val(i+f).end().find(c).val(i)};return i='',h=a(i).appendTo(e),j.oldonClose=j.onClose,j.onClose=function(a,b){o(),"function"==typeof j.oldonClose&&j.oldonClose(a,b)},h.datepicker(j),k.$table.bind("filterReset",function(){a.isArray(j.compare)&&e.add(n).find(c).val(j.compare[j.selected||0]),e.add(n).find(".date").val(j.defaultDate).datepicker("setDate",j.defaultDate||null),setTimeout(function(){o()},0)}),k.$table.bind("filterFomatterUpdate",function(){var a,g=m.val();/\s+-\s+/.test(g)?(e.find(c).val("="),a=g.split(/\s+-\s+/)[0],h.datepicker("setDate",a||null)):(a=d.updateCompare(e,m,j)[1].toString()||"",a=""!==a?/\d{5}/g.test(a)?new Date(Number(a)):a||"":""),e.add(n).find(".date").datepicker("setDate",a||null),setTimeout(function(){o(!0),b.filter.formatterUpdated(e,f)},0)}),j.compare&&(d.addCompare(e,f,j),e.find(c).bind("change",function(){o()})),k.$table.bind("stickyHeadersInit",function(){n=k.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty(),n.append(i).find(".date").datepicker(j),j.compare&&(d.addCompare(n,f,j),n.find(c).bind("change",function(){e.find(c).val(a(this).val()),o()}))}),m.val(j.defaultDate?j.defaultDate:"")},uiDatepicker:function(c,d,e){var f,g,h=a.extend({endOfDay:!0,textFrom:"from",textTo:"to",from:"",to:"",changeMonth:!0,changeYear:!0,numberOfMonths:1},e),i=[],j=c.closest("table")[0].config,k=function(a){return a instanceof Date&&isFinite(a)},l=a('').appendTo(c).bind("change"+j.namespace+"filter",function(){var a=this.value;a.match(" - ")?(a=a.split(" - "),c.find(".dateTo").val(a[1]),g(a[0])):a.match(">=")?g(a.replace(">=","")):a.match("<=")&&g(a.replace("<=",""))}),m=c.closest("thead").find("th[data-column="+d+"]").addClass("filter-parsed");return f="',a(f).appendTo(c),h.oldonClose=h.onClose,g=h.onClose=function(a,b){var d,e=c.find(".dateFrom").datepicker("getDate"),f=c.find(".dateTo").datepicker("getDate");e=k(e)?e.getTime():"",f=k(f)?(h.endOfDay?f.setHours(23,59,59):f.getTime())||"":"",d=e?f?e+" - "+f:">="+e:f?"<="+f:"",c.add(i).find(".dateRange").val(d).trigger("search"),e=e?new Date(e):"",f=f?new Date(f):"",/<=/.test(d)?c.add(i).find(".dateFrom").datepicker("option","maxDate",f||null).end().find(".dateTo").datepicker("option","minDate",null).datepicker("setDate",f||null):/>=/.test(d)?c.add(i).find(".dateFrom").datepicker("option","maxDate",null).datepicker("setDate",e||null).end().find(".dateTo").datepicker("option","minDate",e||null):c.add(i).find(".dateFrom").datepicker("option","maxDate",null).datepicker("setDate",e||null).end().find(".dateTo").datepicker("option","minDate",null).datepicker("setDate",f||null),"function"==typeof h.oldonClose&&h.oldonClose(a,b)},h.defaultDate=h.from||"",c.find(".dateFrom").datepicker(h),h.defaultDate=h.to||"+7d",c.find(".dateTo").datepicker(h),j.$table.bind("filterFomatterUpdate",function(){var a=l.val()||"",e="",f="";/\s+-\s+/.test(a)?(a=a.split(/\s+-\s+/)||[],e=a[0]||"",f=a[1]||""):/>=/.test(a)?e=a.replace(/>=/,"")||"":/<=/.test(a)&&(f=a.replace(/<=/,"")||""),e=""!==e?/\d{5}/g.test(e)?new Date(Number(e)):e||"":"",f=""!==f?/\d{5}/g.test(f)?new Date(Number(f)):f||"":"",c.add(i).find(".dateFrom").datepicker("setDate",e||null),c.add(i).find(".dateTo").datepicker("setDate",f||null),setTimeout(function(){g(),b.filter.formatterUpdated(c,d)},0)}),j.$table.bind("stickyHeadersInit",function(){i=j.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(d).empty(),i.append(f),h.defaultDate=h.from||"",i.find(".dateFrom").datepicker(h),h.defaultDate=h.to||"+7d",i.find(".dateTo").datepicker(h)}),c.closest("table").bind("filterReset",function(){c.add(i).find(".dateFrom").val("").datepicker("setDate",h.from||null),c.add(i).find(".dateTo").val("").datepicker("setDate",h.to||null),setTimeout(function(){g()},0)}),l.val(h.from?h.to?h.from+" - "+h.to:">="+h.from:h.to?"<="+h.to:"")}})}(jQuery); \ No newline at end of file +/* + * requires: tableSorter (FORK) 2.15+ and jQuery 1.4.3+ + * + * uiSpinner (jQuery UI spinner) + * uiSlider (jQuery UI slider) + * uiRange (jQuery UI range slider) + * uiDateCompare (jQuery UI datepicker; 1 input) + * uiDatepicker (jQuery UI datepicker; 2 inputs, filter range) + */ +/*jshint browser:true, jquery:true, unused:false */ +/*global jQuery: false */ +!function(a){"use strict";var b=a.tablesorter||{}, +// compare option selector class name (jQuery selector) +c=".compare-select",d=b.filterFormatter=a.extend({},b.filterFormatter,{addCompare:function(b,d,e){if(e.compare&&a.isArray(e.compare)&&e.compare.length>1){var f="",g=[c.slice(1)," "+c.slice(1),""],h=e.cellText?'":"";a.each(e.compare,function(a,b){f+=""}),b.wrapInner('
    ').prepend(h+'').appendTo(e).bind("change"+i.namespace+"filter",function(){l({value:this.value,delayed:!1})}),k=[], +// this function updates the hidden input and adds the current values to the header cell text +l=function(d,f){var g,j=!0, +// ui is not undefined on create +l=d&&d.value&&b.formatFloat((d.value+"").replace(/[><=]/g,""))||e.find(".spinner").val()||h.value,m=(a.isArray(h.compare)?e.find(c).val()||h.compare[h.selected||0]:h.compare)||"",n=d&&"boolean"==typeof d.delayed?d.delayed:i.$table[0].hasInitialized?h.delayed||"":!0;h.addToggle&&(j=e.find(".toggle").is(":checked")),g=h.disabled||!j?"disable":"enable",e.find(".filter").val(j?(m?m:h.exactMatch?"=":"")+l:"").trigger(f?"":"search",n).end().find(".spinner").spinner(g).val(l),k.length&&(k.find(".spinner").spinner(g).val(l).end().find(c).val(m),h.addToggle&&(k.find(".toggle")[0].checked=j))}; +// add callbacks; preserve added callbacks +// make sure we use parsed data +// add a jQuery UI spinner! +// update spinner from hidden input, in case of saved filters +// add compare select +// has sticky headers? +// on reset +return h.oldcreate=h.create,h.oldspin=h.spin,h.create=function(a,b){l(),// ui is an empty object on create +"function"==typeof h.oldcreate&&h.oldcreate(a,b)},h.spin=function(a,b){l(b),"function"==typeof h.oldspin&&h.oldspin(a,b)},h.addToggle&&a('
    ').appendTo(e).find(".toggle").bind("change",function(){l()}),e.closest("thead").find("th[data-column="+f+"]").addClass("filter-parsed"),a('').val(h.value).appendTo(e).spinner(h).bind("change keyup",function(){l()}),i.$table.bind("filterFomatterUpdate",function(){var a=d.updateCompare(e,j,h)[0];e.find(".spinner").val(a),l({value:a},!0),b.filter.formatterUpdated(e,f)}),h.compare&&(d.addCompare(e,f,h),e.find(c).bind("change",function(){l()})),i.$table.bind("stickyHeadersInit",function(){k=i.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty(),h.addToggle&&a('
    ').appendTo(k).find(".toggle").bind("change",function(){e.find(".toggle")[0].checked=this.checked,l()}),a('').val(h.value).appendTo(k).spinner(h).bind("change keyup",function(){e.find(".spinner").val(this.value),l()}),h.compare&&(d.addCompare(k,f,h),k.find(c).bind("change",function(){e.find(c).val(a(this).val()),l()}))}),i.$table.bind("filterReset",function(){a.isArray(h.compare)&&e.add(k).find(c).val(h.compare[h.selected||0]), +// turn off the toggle checkbox +h.addToggle&&(e.find(".toggle")[0].checked=!1),e.find(".spinner").spinner("value",h.value),setTimeout(function(){l()},0)}),l(),j},/**********************\ + jQuery UI Slider + \**********************/ +uiSlider:function(e,f,g){var h=a.extend({ +// filter formatter options +delayed:!0,valueToHeader:!1,exactMatch:!0,cellText:"",compare:"",allText:"all", +// include ANY jQuery UI spinner options below +// except values, since this is a non-range setup +value:0,min:0,max:100,step:1,range:"min"},g),i=e.closest("table")[0].config, +// Add a hidden input to hold the range values +j=a('').appendTo(e).bind("change"+i.namespace+"filter",function(){l({value:this.value})}),k=[], +// this function updates the hidden input and adds the current values to the header cell text +l=function(d,g){ +// ui is not undefined on create +var j="undefined"!=typeof d?b.formatFloat((d.value+"").replace(/[><=]/g,""))||h.value:h.value,l=h.compare?j:j===h.min?h.allText:j,m=(a.isArray(h.compare)?e.find(c).val()||h.compare[h.selected||0]:h.compare)||"",n=m+l,o=d&&"boolean"==typeof d.delayed?d.delayed:i.$table[0].hasInitialized?h.delayed||"":!0;h.valueToHeader? +// add range indication to the header cell above! +e.closest("thead").find("th[data-column="+f+"]").find(".curvalue").html(" ("+n+")"): +// add values to the handle data-value attribute so the css tooltip will work properly +e.find(".ui-slider-handle").addClass("value-popup").attr("data-value",n), +// update the hidden input; +// ****** ADD AN EQUAL SIGN TO THE BEGINNING! <- this makes the slide exactly match the number ****** +// when the value is at the minimum, clear the hidden input so all rows will be seen +e.find(".filter").val(m?m+j:j===h.min?"":(h.exactMatch?"=":"")+j).trigger(g?"":"search",o).end().find(".slider").slider("value",j), +// update sticky header cell +k.length&&(k.find(c).val(m).end().find(".slider").slider("value",j),h.valueToHeader?k.closest("thead").find("th[data-column="+f+"]").find(".curvalue").html(" ("+n+")"):k.find(".ui-slider-handle").addClass("value-popup").attr("data-value",n))}; +// add span to header for value - only works if the line in the updateSlider() function is also un-commented out +// add callbacks; preserve added callbacks +// add a jQuery UI slider! +// update slider from hidden input, in case of saved filters +// add compare select +// on reset +// has sticky headers? +return e.closest("thead").find("th[data-column="+f+"]").addClass("filter-parsed"),h.valueToHeader&&e.closest("thead").find("th[data-column="+f+"]").find(".tablesorter-header-inner").append(''),h.oldcreate=h.create,h.oldslide=h.slide,h.create=function(a,b){l(),// ui is an empty object on create +"function"==typeof h.oldcreate&&h.oldcreate(a,b)},h.slide=function(a,b){l(b),"function"==typeof h.oldslide&&h.oldslide(a,b)},a('
    ').appendTo(e).slider(h),i.$table.bind("filterFomatterUpdate",function(){var a=d.updateCompare(e,j,h)[0];e.find(".slider").slider("value",a),l({value:a},!1),b.filter.formatterUpdated(e,f)}),h.compare&&(d.addCompare(e,f,h),e.find(c).bind("change",function(){l({value:e.find(".slider").slider("value")})})),i.$table.bind("filterReset",function(){a.isArray(h.compare)&&e.add(k).find(c).val(h.compare[h.selected||0]),setTimeout(function(){l({value:h.value})},0)}),i.$table.bind("stickyHeadersInit",function(){k=i.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty(),a('
    ').val(h.value).appendTo(k).slider(h).bind("change keyup",function(){e.find(".slider").slider("value",this.value),l()}),h.compare&&(d.addCompare(k,f,h),k.find(c).bind("change",function(){e.find(c).val(a(this).val()),l()}))}),j},/*************************\ + jQuery UI Range Slider (2 handles) + \*************************/ +uiRange:function(c,d,e){var f=a.extend({ +// filter formatter options +delayed:!0,valueToHeader:!1, +// include ANY jQuery UI spinner options below +// except value, since this one is range specific) +values:[0,100],min:0,max:100,range:!0},e),g=c.closest("table")[0].config, +// Add a hidden input to hold the range values +h=a('').appendTo(c).bind("change"+g.namespace+"filter",function(){j()}),i=[],j=function(){var a=h.val(),b=a.split(" - ");""===a&&(b=[f.min,f.max]),b&&b[1]&&k({values:b,delay:!1},!0)}, +// this function updates the hidden input and adds the current values to the header cell text +k=function(a,b){ +// ui.values are undefined for some reason on create +var e=a&&a.values||f.values,h=e[0]+" - "+e[1], +// make range an empty string if entire range is covered so the filter row will hide (if set) +j=e[0]===f.min&&e[1]===f.max?"":h,k=a&&"boolean"==typeof a.delayed?a.delayed:g.$table[0].hasInitialized?f.delayed||"":!0;f.valueToHeader? +// add range indication to the header cell above (if not using the css method)! +c.closest("thead").find("th[data-column="+d+"]").find(".currange").html(" ("+h+")"): +// add values to the handle data-value attribute so the css tooltip will work properly +c.find(".ui-slider-handle").addClass("value-popup").eq(0).attr("data-value",e[0]).end().eq(1).attr("data-value",e[1]), +// update the hidden input +c.find(".filter").val(j).trigger(b?"":"search",k).end().find(".range").slider("values",e), +// update sticky header cell +i.length&&(i.find(".range").slider("values",e),f.valueToHeader?i.closest("thead").find("th[data-column="+d+"]").find(".currange").html(" ("+h+")"):i.find(".ui-slider-handle").addClass("value-popup").eq(0).attr("data-value",e[0]).end().eq(1).attr("data-value",e[1]))}; +// return the hidden input so the filter widget has a reference to it +// add span to header for value - only works if the line in the updateUiRange() function is also un-commented out +// add callbacks; preserve added callbacks +// add a jQuery UI range slider! +// update slider from hidden input, in case of saved filters +// on reset +// has sticky headers? +return c.closest("thead").find("th[data-column="+d+"]").addClass("filter-parsed"),f.valueToHeader&&c.closest("thead").find("th[data-column="+d+"]").find(".tablesorter-header-inner").append(''),f.oldcreate=f.create,f.oldslide=f.slide,f.create=function(a,b){k(),// ui is an empty object on create +"function"==typeof f.oldcreate&&f.oldcreate(a,b)},f.slide=function(a,b){k(b),"function"==typeof f.oldslide&&f.oldslide(a,b)},a('
    ').appendTo(c).slider(f),g.$table.bind("filterFomatterUpdate",function(){j(),b.filter.formatterUpdated(c,d)}),g.$table.bind("filterReset",function(){c.find(".range").slider("values",f.values),setTimeout(function(){k()},0)}),g.$table.bind("stickyHeadersInit",function(){i=g.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(d).empty(),a('
    ').val(f.value).appendTo(i).slider(f).bind("change keyup",function(){c.find(".range").val(this.value),k()})}),h},/*************************\ + jQuery UI Datepicker compare (1 input) + \*************************/ +uiDateCompare:function(e,f,g){var h,i,j=a.extend({ +// filter formatter options +cellText:"",compare:"",endOfDay:!0, +// include ANY jQuery UI spinner options below +defaultDate:"",changeMonth:!0,changeYear:!0,numberOfMonths:1},g),k=e.closest("table")[0].config, +// make sure we're using parsed dates in the search +l=e.closest("thead").find("th[data-column="+f+"]").addClass("filter-parsed"), +// Add a hidden input to hold the range values +m=a('').appendTo(e).bind("change"+k.namespace+"filter",function(){var a=this.value;a&&j.onClose(a)}),n=[], +// this function updates the hidden input +o=function(b){var d,f,g=h.datepicker("getDate")||"",i=(a.isArray(j.compare)?e.find(c).val()||j.compare[j.selected||0]:j.compare)||"",l=k.$table[0].hasInitialized?j.delayed||"":!0;h.datepicker("setDate",(""===g?"":g)||null),""===g&&(b=!1),d=h.datepicker("getDate"),f=d?(j.endOfDay&&/<=/.test(i)?d.setHours(23,59,59):d.getTime())||"":"",d&&j.endOfDay&&"="===i&&(i="",f+=" - "+d.setHours(23,59,59),b=!1),e.find(".dateCompare").val(i+f).trigger(b?"":"search",l).end(),n.length&&n.find(".dateCompare").val(i+f).end().find(c).val(i)}; +// return the hidden input so the filter widget has a reference to it +// Add date range picker +// add callbacks; preserve added callbacks +// on reset +// update date compare from hidden input, in case of saved filters +// add compare select +// has sticky headers? +return i='',h=a(i).appendTo(e),j.oldonClose=j.onClose,j.onClose=function(a,b){o(),"function"==typeof j.oldonClose&&j.oldonClose(a,b)},h.datepicker(j),k.$table.bind("filterReset",function(){a.isArray(j.compare)&&e.add(n).find(c).val(j.compare[j.selected||0]),e.add(n).find(".date").val(j.defaultDate).datepicker("setDate",j.defaultDate||null),setTimeout(function(){o()},0)}),k.$table.bind("filterFomatterUpdate",function(){var a,g=m.val();/\s+-\s+/.test(g)?(e.find(c).val("="),a=g.split(/\s+-\s+/)[0],h.datepicker("setDate",a||null)):(a=d.updateCompare(e,m,j)[1].toString()||"",a=""!==a?/\d{5}/g.test(a)?new Date(Number(a)):a||"":""),e.add(n).find(".date").datepicker("setDate",a||null),setTimeout(function(){o(!0),b.filter.formatterUpdated(e,f)},0)}),j.compare&&(d.addCompare(e,f,j),e.find(c).bind("change",function(){o()})),k.$table.bind("stickyHeadersInit",function(){n=k.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty(),n.append(i).find(".date").datepicker(j),j.compare&&(d.addCompare(n,f,j),n.find(c).bind("change",function(){e.find(c).val(a(this).val()),o()}))}),m.val(j.defaultDate?j.defaultDate:"")},/*************************\ + jQuery UI Datepicker (2 inputs) + \*************************/ +uiDatepicker:function(c,d,e){var f,g,h=a.extend({ +// filter formatter options +endOfDay:!0,textFrom:"from",textTo:"to",from:"",// defaultDate 'from' input +to:"",// defaultDate 'to' input +// include ANY jQuery UI spinner options below +changeMonth:!0,changeYear:!0,numberOfMonths:1},e),i=[],j=c.closest("table")[0].config,k=function(a){return a instanceof Date&&isFinite(a)}, +// Add a hidden input to hold the range values +l=a('').appendTo(c).bind("change"+j.namespace+"filter",function(){var a=this.value;a.match(" - ")?(a=a.split(" - "),c.find(".dateTo").val(a[1]),g(a[0])):a.match(">=")?g(a.replace(">=","")):a.match("<=")&&g(a.replace("<=",""))}), +// make sure we're using parsed dates in the search +m=c.closest("thead").find("th[data-column="+d+"]").addClass("filter-parsed"); +// return the hidden input so the filter widget has a reference to it +// Add date range picker +// add callbacks; preserve added callbacks +// set to date +7 days from today (if not defined) +// update date compare from hidden input, in case of saved filters +// has sticky headers? +// on reset +return f="',a(f).appendTo(c),h.oldonClose=h.onClose,g=h.onClose=function(a,b){var d,e=c.find(".dateFrom").datepicker("getDate"),f=c.find(".dateTo").datepicker("getDate");e=k(e)?e.getTime():"",f=k(f)?(h.endOfDay?f.setHours(23,59,59):f.getTime())||"":"",d=e?f?e+" - "+f:">="+e:f?"<="+f:"",c.add(i).find(".dateRange").val(d).trigger("search"),e=e?new Date(e):"",f=f?new Date(f):"",/<=/.test(d)?c.add(i).find(".dateFrom").datepicker("option","maxDate",f||null).end().find(".dateTo").datepicker("option","minDate",null).datepicker("setDate",f||null):/>=/.test(d)?c.add(i).find(".dateFrom").datepicker("option","maxDate",null).datepicker("setDate",e||null).end().find(".dateTo").datepicker("option","minDate",e||null):c.add(i).find(".dateFrom").datepicker("option","maxDate",null).datepicker("setDate",e||null).end().find(".dateTo").datepicker("option","minDate",null).datepicker("setDate",f||null),"function"==typeof h.oldonClose&&h.oldonClose(a,b)},h.defaultDate=h.from||"",c.find(".dateFrom").datepicker(h),h.defaultDate=h.to||"+7d",c.find(".dateTo").datepicker(h),j.$table.bind("filterFomatterUpdate",function(){var a=l.val()||"",e="",f="";/\s+-\s+/.test(a)?(a=a.split(/\s+-\s+/)||[],e=a[0]||"",f=a[1]||""):/>=/.test(a)?e=a.replace(/>=/,"")||"":/<=/.test(a)&&(f=a.replace(/<=/,"")||""),e=""!==e?/\d{5}/g.test(e)?new Date(Number(e)):e||"":"",f=""!==f?/\d{5}/g.test(f)?new Date(Number(f)):f||"":"",c.add(i).find(".dateFrom").datepicker("setDate",e||null),c.add(i).find(".dateTo").datepicker("setDate",f||null),setTimeout(function(){g(),b.filter.formatterUpdated(c,d)},0)}),j.$table.bind("stickyHeadersInit",function(){i=j.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(d).empty(),i.append(f),h.defaultDate=h.from||"",i.find(".dateFrom").datepicker(h),h.defaultDate=h.to||"+7d",i.find(".dateTo").datepicker(h)}),c.closest("table").bind("filterReset",function(){c.add(i).find(".dateFrom").val("").datepicker("setDate",h.from||null),c.add(i).find(".dateTo").val("").datepicker("setDate",h.to||null),setTimeout(function(){g()},0)}),l.val(h.from?h.to?h.from+" - "+h.to:">="+h.from:h.to?"<="+h.to:"")}})}(jQuery); \ No newline at end of file diff --git a/dist/js/widgets/widget-filter-formatter-select2.min.js b/dist/js/widgets/widget-filter-formatter-select2.min.js index e65aea47..20f57eaa 100644 --- a/dist/js/widgets/widget-filter-formatter-select2.min.js +++ b/dist/js/widgets/widget-filter-formatter-select2.min.js @@ -1,2 +1,34 @@ /*! Widget: filter, select2 formatter function - updated 3/26/2015 (v2.21.3) */ -!function(a){"use strict";var b=a.tablesorter||{};b.filterFormatter=b.filterFormatter||{},b.filterFormatter.select2=function(c,d,e){var f,g,h=a.extend({cellText:"",match:!0,value:"",multiple:!0,width:"100%"},e),i=c.closest("table")[0].config,j=i.widgetOptions,k=a('').appendTo(c).bind("change"+i.namespace+"filter",function(){var a=this.value;a=a.replace(/[\/()$^]/g,"").split("|"),c.find(".select2").select2("val",a),q()}),l=i.$headerIndexed[d],m=l.hasClass(j.filter_onlyAvail),n=[],o=h.match?"":"^",p=h.match?"":"$",q=function(){var b=!1,d=c.find(".select2").select2("val")||h.value||"";a.isArray(d)&&(b=!0,d=d.join("\x00")),d=d.replace(/[-[\]{}()*+?.,\/\\^$|#\s]/g,"\\$&"),b&&(d=d.split("\x00")),k.val(a.isArray(d)&&d.length&&""!==d.join("")?"/("+o+(d||[]).join(p+"|"+o)+p+")/":"").trigger("search").end().find(".select2").select2("val",d),n.length&&n.find(".select2").select2("val",d)},r=function(){g=[],f=b.filter.getOptionSource(i.$table[0],d,m)||[],a.each(f,function(a,b){g.push({id:b,text:b})}),h.data=g};return l.toggleClass("filter-match",h.match),h.cellText&&c.prepend(""),h.ajax&&!a.isEmptyObject(h.ajax)||h.data||(r(),m&&i.$table.bind("filterEnd",function(){r(),c.add(n).find(".select2").select2(h)})),a('').val(h.value).appendTo(c).select2(h).bind("change",function(){q()}),i.$table.bind("filterFomatterUpdate",function(){var a=i.$table.data("lastSearch")[d]||"";a=a.replace(/^\/\(\^?/,"").replace(/\$\|\^/g,"|").replace(/\$?\)\/$/g,"").split("|"),c.find(".select2").select2("val",a),q(),b.filter.formatterUpdated(c,d)}),i.$table.bind("stickyHeadersInit",function(){n=i.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(d).empty(),a('').val(h.value).appendTo(n).select2(h).bind("change",function(){c.find(".select2").select2("val",n.find(".select2").select2("val")),q()}),h.cellText&&n.prepend("")}),i.$table.bind("filterReset",function(){c.find(".select2").select2("val",h.value||""),setTimeout(function(){q()},0)}),q(),k}}(jQuery); \ No newline at end of file +/* + * requires: jQuery 1.7.2+, tableSorter (FORK) 2.16+, filter widget 2.16+ and select2 v3.4.6+ plugin + */ +/*jshint browser:true, jquery:true, unused:false */ +/*global jQuery: false */ +!function(a){"use strict";var b=a.tablesorter||{};b.filterFormatter=b.filterFormatter||{},/************************\ + Select2 Filter Formatter + \************************/ +b.filterFormatter.select2=function(c,d,e){var f,g,h=a.extend({ +// select2 filter formatter options +cellText:"",// Text (wrapped in a label element) +match:!0,// adds 'filter-match' to header +value:"", +// include ANY select2 options below +multiple:!0,width:"100%"},e),i=c.closest("table")[0].config,j=i.widgetOptions, +// Add a hidden input to hold the range values +k=a('').appendTo(c).bind("change"+i.namespace+"filter",function(){var a=this.value;a=a.replace(/[\/()$^]/g,"").split("|"),c.find(".select2").select2("val",a),q()}),l=i.$headerIndexed[d],m=l.hasClass(j.filter_onlyAvail),n=[],o=h.match?"":"^",p=h.match?"":"$", +// this function updates the hidden input and adds the current values to the header cell text +q=function(){var b=!1,d=c.find(".select2").select2("val")||h.value||""; +// convert array to string +a.isArray(d)&&(b=!0,d=d.join("\x00")),d=d.replace(/[-[\]{}()*+?.,\/\\^$|#\s]/g,"\\$&"),b&&(d=d.split("\x00")),k.val(a.isArray(d)&&d.length&&""!==d.join("")?"/("+o+(d||[]).join(p+"|"+o)+p+")/":"").trigger("search").end().find(".select2").select2("val",d),n.length&&n.find(".select2").select2("val",d)}, +// get options from table cell content or filter_selectSource (v2.16) +r=function(){g=[],f=b.filter.getOptionSource(i.$table[0],d,m)||[],a.each(f,function(a,b){g.push({id:b,text:b})}),h.data=g}; +// get filter-match class from option +// don't add default in table options if either ajax or +// data options are already defined +// add a select2 hidden input! +// update select2 from filter hidden input, in case of saved filters +// has sticky headers? +// on reset +return l.toggleClass("filter-match",h.match),h.cellText&&c.prepend(""),h.ajax&&!a.isEmptyObject(h.ajax)||h.data||(r(),m&&i.$table.bind("filterEnd",function(){r(),c.add(n).find(".select2").select2(h)})),a('').val(h.value).appendTo(c).select2(h).bind("change",function(){q()}),i.$table.bind("filterFomatterUpdate",function(){ +// value = '/(^x$|^y$)/' => 'x,y' +var a=i.$table.data("lastSearch")[d]||"";a=a.replace(/^\/\(\^?/,"").replace(/\$\|\^/g,"|").replace(/\$?\)\/$/g,"").split("|"),c.find(".select2").select2("val",a),q(),b.filter.formatterUpdated(c,d)}),i.$table.bind("stickyHeadersInit",function(){n=i.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(d).empty(),a('').val(h.value).appendTo(n).select2(h).bind("change",function(){c.find(".select2").select2("val",n.find(".select2").select2("val")),q()}),h.cellText&&n.prepend("")}),i.$table.bind("filterReset",function(){c.find(".select2").select2("val",h.value||""),setTimeout(function(){q()},0)}),q(),k}}(jQuery); \ No newline at end of file diff --git a/dist/js/widgets/widget-filter-type-insideRange.min.js b/dist/js/widgets/widget-filter-type-insideRange.min.js index 05fbbc80..d76d7f79 100644 --- a/dist/js/widgets/widget-filter-type-insideRange.min.js +++ b/dist/js/widgets/widget-filter-type-insideRange.min.js @@ -1,2 +1,13 @@ /*! Widget: filter, insideRange filter type - updated 2/23/2015 (v2.21.0) */ -!function(a){"use strict";var b=a.tablesorter,c=/\d+/,d=/\s+-\s+/,e=function(a){return isNaN(a)?a:parseFloat(a)};b.filter.types.insideRange=function(a,b){if(c.test(b.iFilter)&&d.test(b.iExact)){var f,g,h,i,j=b.iExact.split(d),k=a.parsers[b.index].format;return j&&j.length<2?null:(h=e(k(j[0],a.table)),i=e(k(j[1],a.table)),g=e(k(b.iFilter,a.table)),h>i&&(f=i,i=h,h=f),g>=h&&i>=g)}return null}}(jQuery); \ No newline at end of file +!function(a){"use strict"; +// Add insideRange filter type +// ============================ +// This allows you to enter a number (e.g. 8) and show the +// resulting rows that will have that query within it's range +// demo at http://mottie.github.io/tablesorter/docs/example-widget-filter-custom-search2.html +var b=a.tablesorter,c=/\d+/,d=/\s+-\s+/,e=function(a){return isNaN(a)?a:parseFloat(a)};b.filter.types.insideRange=function(a,b){if(c.test(b.iFilter)&&d.test(b.iExact)){var f,g,h,i,j=b.iExact.split(d),k=a.parsers[b.index].format; +// the cell does not contain a range +// the cell does not contain a range +// format each side part of the range using the assigned parser +// swap high & low +return j&&j.length<2?null:(h=e(k(j[0],a.table)),i=e(k(j[1],a.table)),g=e(k(b.iFilter,a.table)),h>i&&(f=i,i=h,h=f),g>=h&&i>=g)}return null}}(jQuery); \ No newline at end of file diff --git a/dist/js/widgets/widget-filter.min.js b/dist/js/widgets/widget-filter.min.js index f0d9c7a3..cb330356 100644 --- a/dist/js/widgets/widget-filter.min.js +++ b/dist/js/widgets/widget-filter.min.js @@ -1,2 +1,301 @@ /*! Widget: filter - updated 10/4/2015 (v2.23.5) */ -!function(a){"use strict";var b,c=a.tablesorter||{},d=c.css;a.extend(d,{filterRow:"tablesorter-filter-row",filter:"tablesorter-filter",filterDisabled:"disabled",filterRowHide:"hideme"}),c.addWidget({id:"filter",priority:50,options:{filter_childRows:!1,filter_childByColumn:!1,filter_childWithSibs:!0,filter_columnFilters:!0,filter_columnAnyMatch:!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(a,c,d){c.$table.hasClass("hasFilters")||b.init(a,c,d)},remove:function(b,e,f,g){var h,i,j=e.$table,k=e.$tbodies,l="addRows updateCell update updateRows updateComplete appendCache filterReset filterEnd search ".split(" ").join(e.namespace+"filter ");if(j.removeClass("hasFilters").unbind(l.replace(c.regex.spaces," ")).find("."+d.filterRow).remove(),!g){for(h=0;h=]/g,query:"(q|query)",wild01:/\?/g,wild0More:/\*/g,quote:/\"/g,isNeg1:/(>=?\s*-\d)/,isNeg2:/(<=?\s*\d)/},types:{or:function(c,d,e){if(b.regex.orTest.test(d.iFilter)||b.regex.orSplit.test(d.filter)){var f,g,h,i,j=a.extend({},d),k=d.index,l=d.parsed[k],m=d.filter.split(b.regex.orSplit),n=d.iFilter.split(b.regex.orSplit),o=m.length;for(f=0;o>f;f++){j.nestedFilters=!0,j.filter=""+(b.parseFilter(c,m[f],k,l)||""),j.iFilter=""+(b.parseFilter(c,n[f],k,l)||""),h="("+(b.parseFilter(c,j.filter,k,l)||"")+")";try{if(i=new RegExp(d.isMatch?h:"^"+h+"$",c.widgetOptions.filter_ignoreCase?"i":""),g=i.test(j.exact)||b.processTypes(c,j,e))return g}catch(p){return null}}return g||!1}return null},and:function(c,d,e){if(b.regex.andTest.test(d.filter)){var f,g,h,i,j,k=a.extend({},d),l=d.index,m=d.parsed[l],n=d.filter.split(b.regex.andSplit),o=d.iFilter.split(b.regex.andSplit),p=n.length;for(f=0;p>f;f++){k.nestedFilters=!0,k.filter=""+(b.parseFilter(c,n[f],l,m)||""),k.iFilter=""+(b.parseFilter(c,o[f],l,m)||""),i=("("+(b.parseFilter(c,k.filter,l,m)||"")+")").replace(b.regex.wild01,"\\S{1}").replace(b.regex.wild0More,"\\S*");try{j=new RegExp(d.isMatch?i:"^"+i+"$",c.widgetOptions.filter_ignoreCase?"i":""),h=j.test(k.exact)||b.processTypes(c,k,e),g=0===f?h:g&&h}catch(q){return null}}return g||!1}return null},regex:function(a,c){if(b.regex.regex.test(c.filter)){var d,e=c.filter_regexCache[c.index]||b.regex.regex.exec(c.filter),f=e instanceof RegExp;try{f||(c.filter_regexCache[c.index]=e=new RegExp(e[1],e[2])),d=e.test(c.exact)}catch(g){d=!1}return d}return null},operators:function(d,e){if(b.regex.operTest.test(e.iFilter)&&""!==e.iExact){var f,g,h,i=d.table,j=e.index,k=e.parsed[j],l=c.formatFloat(e.iFilter.replace(b.regex.operators,""),i),m=d.parsers[j],n=l;return(k||"numeric"===m.type)&&(h=a.trim(""+e.iFilter.replace(b.regex.operators,"")),g=b.parseFilter(d,h,j,!0),l="number"!=typeof g||""===g||isNaN(g)?l:g),!k&&"numeric"!==m.type||isNaN(l)||"undefined"==typeof e.cache?(h=isNaN(e.iExact)?e.iExact.replace(c.regex.nondigit,""):e.iExact,f=c.formatFloat(h,i)):f=e.cache,b.regex.gtTest.test(e.iFilter)?g=b.regex.gteTest.test(e.iFilter)?f>=l:f>l:b.regex.ltTest.test(e.iFilter)&&(g=b.regex.lteTest.test(e.iFilter)?l>=f:l>f),g||""!==n||(g=!0),g}return null},notMatch:function(c,d){if(b.regex.notTest.test(d.iFilter)){var e,f=d.iFilter.replace("!",""),g=b.parseFilter(c,f,d.index,d.parsed[d.index])||"";return b.regex.exact.test(g)?(g=g.replace(b.regex.exact,""),""===g?!0:a.trim(g)!==d.iExact):(e=d.iExact.search(a.trim(g)),""===g?!0:!(c.widgetOptions.filter_startsWith?0===e:e>=0))}return null},exact:function(c,d){if(b.regex.exact.test(d.iFilter)){var e=d.iFilter.replace(b.regex.exact,""),f=b.parseFilter(c,e,d.index,d.parsed[d.index])||"";return d.anyMatch?a.inArray(f,d.rowArray)>=0:f==d.iExact}return null},range:function(a,d){if(b.regex.toTest.test(d.iFilter)){var e,f,g,h,i=a.table,j=d.index,k=d.parsed[j],l=d.iFilter.split(b.regex.toSplit);return f=l[0].replace(c.regex.nondigit,"")||"",g=c.formatFloat(b.parseFilter(a,f,j,k),i),f=l[1].replace(c.regex.nondigit,"")||"",h=c.formatFloat(b.parseFilter(a,f,j,k),i),(k||"numeric"===a.parsers[j].type)&&(e=a.parsers[j].format(""+l[0],i,a.$headers.eq(j),j),g=""===e||isNaN(e)?g:e,e=a.parsers[j].format(""+l[1],i,a.$headers.eq(j),j),h=""===e||isNaN(e)?h:e),!k&&"numeric"!==a.parsers[j].type||isNaN(g)||isNaN(h)?(f=isNaN(d.iExact)?d.iExact.replace(c.regex.nondigit,""):d.iExact,e=c.formatFloat(f,i)):e=d.cache,g>h&&(f=g,g=h,h=f),e>=g&&h>=e||""===g||""===h}return null},wild:function(a,c){if(b.regex.wildOrTest.test(c.iFilter)){var d=c.index,e=c.parsed[d],f=""+(b.parseFilter(a,c.iFilter,d,e)||"");!b.regex.wildTest.test(f)&&c.nestedFilters&&(f=c.isMatch?f:"^("+f+")$");try{return new RegExp(f.replace(b.regex.wild01,"\\S{1}").replace(b.regex.wild0More,"\\S*"),a.widgetOptions.filter_ignoreCase?"i":"").test(c.exact)}catch(g){return null}}return null},fuzzy:function(a,c){if(b.regex.fuzzyTest.test(c.iFilter)){var d,e=0,f=c.iExact.length,g=c.iFilter.slice(1),h=b.parseFilter(a,g,c.index,c.parsed[c.index])||"";for(d=0;f>d;d++)c.iExact[d]===h[e]&&(e+=1);return e===h.length?!0:!1}return null}},init:function(e,f,g){c.language=a.extend(!0,{},{to:"to",or:"or",and:"and"},c.language);var h,i,j,k,l,m,n,o,p,q=b.regex;if(f.$table.addClass("hasFilters"),g.filter_searchTimer=null,g.filter_initTimer=null,g.filter_formatterCount=0,g.filter_formatterInit=[],g.filter_anyColumnSelector='[data-column="all"],[data-column="any"]',g.filter_multipleColumnSelector='[data-column*="-"],[data-column*=","]',n="\\{"+b.regex.query+"\\}",a.extend(q,{child:new RegExp(f.cssChildRow),filtered:new RegExp(g.filter_filteredRow),alreadyFiltered:new RegExp("(\\s+("+c.language.or+"|-|"+c.language.to+")\\s+)","i"),toTest:new RegExp("\\s+(-|"+c.language.to+")\\s+","i"),toSplit:new RegExp("(?:\\s+(?:-|"+c.language.to+")\\s+)","gi"),andTest:new RegExp("\\s+("+c.language.and+"|&&)\\s+","i"),andSplit:new RegExp("(?:\\s+(?:"+c.language.and+"|&&)\\s+)","gi"),orTest:/\|/,orSplit:new RegExp("(?:\\s+(?:"+c.language.or+")\\s+|\\|)","gi"),iQuery:new RegExp(n,"i"),igQuery:new RegExp(n,"ig"),operTest:/^[<>]=?/,gtTest:/>/,gteTest:/>=/,ltTest:/'+(k.data("placeholder")||k.attr("data-placeholder")||g.filter_placeholder.select||"")+"":"",n=i,j=i,i.indexOf(g.filter_selectSourceSeparator)>=0&&(n=i.split(g.filter_selectSourceSeparator),j=n[1],n=n[0]),h+="");f.$table.find("thead").find("select."+d.filter+'[data-column="'+l+'"]').append(h),j=g.filter_selectSource,o="function"==typeof j?!0:c.getColumnData(e,j,l),o&&b.buildSelect(f.table,l,"",!0,k.hasClass(g.filter_onlyAvail))}b.buildDefault(e,!0),b.bindSearch(e,f.$table.find("."+d.filter),!0),g.filter_external&&b.bindSearch(e,g.filter_external),g.filter_hideFilters&&b.hideFilters(f),f.showProcessing&&(j="filterStart filterEnd ".split(" ").join(f.namespace+"filter "),f.$table.unbind(j.replace(c.regex.spaces," ")).bind(j,function(b,g){k=g?f.$table.find("."+d.header).filter("[data-column]").filter(function(){return""!==g[a(this).data("column")]}):"",c.isProcessing(e,"filterStart"===b.type,g?k:"")})),f.filteredRows=f.totalRows,j="tablesorter-initialized pagerBeforeInitialized ".split(" ").join(f.namespace+"filter "),f.$table.unbind(j.replace(c.regex.spaces," ")).bind(j,function(){var a=this.config.widgetOptions;m=b.setDefaults(e,f,a)||[],m.length&&(f.delayInit&&""===m.join("")||c.setFilters(e,m,!0)),f.$table.trigger("filterFomatterUpdate"),setTimeout(function(){a.filter_initialized||b.filterInitComplete(f)},100)}),f.pager&&f.pager.initialized&&!g.filter_initialized&&(f.$table.trigger("filterFomatterUpdate"),setTimeout(function(){b.filterInitComplete(f)},100))},formatterUpdated:function(a,b){var c=a&&a.closest("table")[0].config.widgetOptions;c&&!c.filter_initialized&&(c.filter_formatterInit[b]=1)},filterInitComplete:function(c){var d,e,f=c.widgetOptions,g=0,h=function(){f.filter_initialized=!0,c.$table.trigger("filterInit",c),b.findRows(c.table,c.$table.data("lastSearch")||[])};if(a.isEmptyObject(f.filter_formatter))h();else{for(e=f.filter_formatterInit.length,d=0;e>d;d++)1===f.filter_formatterInit[d]&&g++;clearTimeout(f.filter_initTimer),f.filter_initialized||g!==f.filter_formatterCount?f.filter_initialized||(f.filter_initTimer=setTimeout(function(){h()},500)):h()}},processFilters:function(a,b){var c,d=b?encodeURIComponent:decodeURIComponent,e=a.length;for(c=0;e>c;c++)a[c]=d(a[c]);return a},setDefaults:function(d,e,f){var g,h,i,j,k,l=c.getFilters(d)||[];if(f.filter_saveFilters&&c.storage&&(h=c.storage(d,"tablesorter-filters")||[],g=a.isArray(h),g&&""===h.join("")||!g||(l=b.processFilters(h))),""===l.join(""))for(k=e.$headers.add(f.filter_$externalFilters).filter("["+f.filter_defaultAttrib+"]"),i=0;i<=e.columns;i++)j=i===e.columns?"all":i,l[i]=k.filter('[data-column="'+j+'"]').attr(f.filter_defaultAttrib)||l[i]||"";return e.$table.data("lastSearch",l),l},parseFilter:function(a,b,c,d){return d?a.parsers[c].format(b,a.table,[],c):b},buildRow:function(b,e,f){var g,h,i,j,k,l,m,n,o,p=f.filter_cellFilter,q=e.columns,r=a.isArray(p),s='';for(i=0;q>i;i++)e.$headerIndexed[i].length&&(s+='1&&(s+=' colspan="'+o+'"'),s+=r?p[i]?' class="'+p[i]+'"':"":""!==p?' class="'+p+'"':"",s+=">");for(e.$filters=a(s+="").appendTo(e.$table.children("thead").eq(0)).children("td"),i=0;q>i;i++)l=!1,j=e.$headerIndexed[i],j&&j.length&&(g=e.$filters.filter('[data-column="'+i+'"]'),n=c.getColumnData(b,f.filter_functions,i),k=f.filter_functions&&n&&"function"!=typeof n||j.hasClass("filter-select"),h=c.getColumnData(b,e.headers,i),l="false"===c.getData(j[0],h,"filter")||"false"===c.getData(j[0],h,"parser"),k?s=a("').appendTo(g),s&&(o=j.data("placeholder")||j.attr("data-placeholder")||f.filter_placeholder.search||"",s.attr("placeholder",o))),s&&(m=(a.isArray(f.filter_cssFilter)?"undefined"!=typeof f.filter_cssFilter[i]?f.filter_cssFilter[i]||"":"":f.filter_cssFilter)||"",s.addClass(d.filter+" "+m).attr("data-column",i),l&&(s.attr("placeholder","").addClass(d.filterDisabled)[0].disabled=!0)))},bindSearch:function(d,e,f){if(d=a(d)[0],e=a(e),e.length){var g,h=d.config,i=h.widgetOptions,j=h.namespace+"filter",k=i.filter_$externalFilters;f!==!0&&(g=i.filter_anyColumnSelector+","+i.filter_multipleColumnSelector,i.filter_$anyMatch=e.filter(g),k&&k.length?i.filter_$externalFilters=i.filter_$externalFilters.add(e):i.filter_$externalFilters=e,c.setFilters(d,h.$table.data("lastSearch")||[],f===!1)),g="keypress keyup search change ".split(" ").join(j+" "),e.attr("data-lastSearchTime",(new Date).getTime()).unbind(g.replace(c.regex.spaces," ")).bind("keyup"+j,function(c){if(a(this).attr("data-lastSearchTime",(new Date).getTime()),27===c.which)this.value="";else{if(i.filter_liveSearch===!1)return;if(""!==this.value&&("number"==typeof i.filter_liveSearch&&this.value.length=37&&c.which<=40)))return}b.searching(d,!0,!0)}).bind("search change keypress ".split(" ").join(j+" "),function(c){var e=parseInt(a(this).attr("data-column"),10);i.filter_initialized&&(13===c.which||"search"===c.type||"change"===c.type&&this.value!==h.lastSearch[e])&&(c.preventDefault(),a(this).attr("data-lastSearchTime",(new Date).getTime()),b.searching(d,!1,!0))})}},searching:function(a,c,d){var e=a.config.widgetOptions;clearTimeout(e.filter_searchTimer),"undefined"==typeof c||c===!0?e.filter_searchTimer=setTimeout(function(){b.checkFilters(a,c,d)},e.filter_liveSearch?e.filter_searchDelay:10):b.checkFilters(a,c,d)},checkFilters:function(e,f,g){var h=e.config,i=h.widgetOptions,j=a.isArray(f),k=j?f:c.getFilters(e,!0),l=(k||[]).join("");return a.isEmptyObject(h.cache)?void(h.delayInit&&h.pager&&h.pager.initialized&&c.updateCache(h,function(){b.checkFilters(e,!1,g)})):(j&&(c.setFilters(e,k,!1,g!==!0),i.filter_initialized||(h.lastCombinedFilter="")),i.filter_hideFilters&&h.$table.find("."+d.filterRow).trigger(""===l?"mouseleave":"mouseenter"),h.lastCombinedFilter!==l||f===!1?(f===!1&&(h.lastCombinedFilter=null,h.lastSearch=[]),i.filter_initialized&&h.$table.trigger("filterStart",[k]),h.showProcessing?void setTimeout(function(){return b.findRows(e,k,l),!1},30):(b.findRows(e,k,l),!1)):void 0)},hideFilters:function(b,e){var f,g=(e||b.$table).find("."+d.filterRow).addClass(d.filterRowHide);g.bind("mouseenter mouseleave",function(c){var e=c,g=a(this);clearTimeout(f),f=setTimeout(function(){/enter|over/.test(e.type)?g.removeClass(d.filterRowHide):a(document.activeElement).closest("tr")[0]!==g[0]&&""===b.lastCombinedFilter&&g.addClass(d.filterRowHide)},200)}).find("input, select").bind("focus blur",function(e){var g=e,h=a(this).closest("tr");clearTimeout(f),f=setTimeout(function(){clearTimeout(f),""===c.getFilters(b.$table).join("")&&h.toggleClass(d.filterRowHide,"focus"!==g.type)},200)})},defaultFilter:function(c,d){if(""===c)return c;var e=b.regex.iQuery,f=d.match(b.regex.igQuery).length,g=f>1?a.trim(c).split(/\s/):[a.trim(c)],h=g.length-1,i=0,j=d;for(1>h&&f>1&&(g[1]=g[0]);e.test(j);)j=j.replace(e,g[i++]||""),e.test(j)&&h>i&&""!==(g[i]||"")&&(j=d.replace(e,j));return j},getLatestSearch:function(b){return b?b.sort(function(b,c){return a(c).attr("data-lastSearchTime")-a(b).attr("data-lastSearchTime")}):b||a()},multipleColumns:function(c,d){var e,f,g,h,i,j,k,l,m,n=c.widgetOptions,o=n.filter_initialized||!d.filter(n.filter_anyColumnSelector).length,p=[],q=a.trim(b.getLatestSearch(d).attr("data-column")||"");if(/^[0-9]+$/.test(q))return parseInt(q,10);if(o&&/-/.test(q))for(f=q.match(/(\d+)\s*-\s*(\d+)/g),m=f.length,l=0;m>l;l++){for(g=f[l].split(/\s*-\s*/),h=parseInt(g[0],10)||0,i=parseInt(g[1],10)||c.columns-1,h>i&&(e=h,h=i,i=e),i>=c.columns&&(i=c.columns-1);i>=h;h++)p.push(h);q=q.replace(f[l],"")}if(o&&/,/.test(q))for(j=q.split(/\s*,\s*/),m=j.length,k=0;m>k;k++)""!==j[k]&&(l=parseInt(j[k],10),l1){if(e.anyMatch=!0,e.isMatch=!0,e.rowArray=e.$cells.map(function(b){return a.inArray(b,q)>-1?(e.parsed[b]?m=e.cacheArray[b]:(m=e.rawArray[b],m=a.trim(o.filter_ignoreCase?m.toLowerCase():m),d.sortLocaleCompare&&(m=c.replaceAccents(m))),m):void 0}).get(),e.filter=e.anyMatchFilter,e.iFilter=e.iAnyMatchFilter,e.exact=e.rowArray.join(" "),e.iExact=o.filter_ignoreCase?e.exact.toLowerCase():e.exact,e.cache=e.cacheArray.slice(0,-1).join(" "),f.excludeMatch=f.noAnyMatch,j=b.processTypes(d,e,f),null!==j)p=j;else if(o.filter_startsWith)for(p=!1,q=Math.min(d.columns,e.rowArray.length);!p&&q>0;)q--,p=p||0===e.rowArray[q].indexOf(e.iFilter);else p=(e.iExact+e.childRowText).indexOf(e.iFilter)>=0;if(e.anyMatch=!1,e.filters.join("")===e.filter)return p}for(q=0;q=0:e.filter===e.exact:"function"==typeof k?j=k(e.exact,e.cache,e.filter,q,e.$row,d,e):"function"==typeof k[l||e.filter]&&(m=l||e.filter,j=k[m](e.exact,e.cache,e.filter,q,e.$row,d,e))),null===j?(j=b.processTypes(d,e,f),null!==j?h=j:(m=(e.iExact+e.childRowText).indexOf(b.parseFilter(d,e.iFilter,q,e.parsed[q])),h=!o.filter_startsWith&&m>=0||o.filter_startsWith&&0===m)):h=j,p=h?p:!1);return p},findRows:function(d,e,f){if(d.config.lastCombinedFilter!==f&&d.config.widgetOptions.filter_initialized){var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E=a.extend([],e),F=b.regex,G=d.config,H=G.widgetOptions,I={anyMatch:!1,filters:e,filter_regexCache:[]},J={noAnyMatch:["range","notMatch","operators"],functions:[],excludeFilter:[],defaultColFilter:[],defaultAnyFilter:c.getColumnData(d,H.filter_defaultFilter,G.columns,!0)||""};for(I.parsed=G.$headers.map(function(b){return G.parsers&&G.parsers[b]&&G.parsers[b].parsed||c.getData&&"parsed"===c.getData(G.$headerIndexed[b],c.getColumnData(d,G.headers,b),"filter")||a(this).hasClass("filter-parsed")}).get(),o=0;o1&&(C=parseInt(B[0],10)-1,C>=0&&Cw;w++)v=e[w]||"",y||(w=o),y=y&&r.length&&0===v.indexOf(r[w]||"")&&!F.alreadyFiltered.test(v)&&!F.exactTest.test(v)&&!(F.isNeg1.test(v)||F.isNeg2.test(v))&&!(""!==v&&G.$filters&&G.$filters.filter('[data-column="'+w+'"]').find("select").length&&!G.$headerIndexed[w].hasClass("filter-match"));for(x=j.not("."+H.filter_filteredRow).length,y&&0===x&&(y=!1),G.debug&&console.log("Filter: Searching through "+(y&&g>x?x:"all")+" rows"),I.anyMatchFlag&&(G.sortLocaleCompare&&(I.anyMatchFilter=c.replaceAccents(I.anyMatchFilter)),H.filter_defaultFilter&&F.iQuery.test(J.defaultAnyFilter)&&(I.anyMatchFilter=b.defaultFilter(I.anyMatchFilter,J.defaultAnyFilter),y=!1),I.iAnyMatchFilter=H.filter_ignoreCase&&G.ignoreCase?I.anyMatchFilter.toLowerCase():I.anyMatchFilter),l=0;g>l;l++)if(D=j[l].className,p=l&&F.child.test(D),!(p||y&&F.filtered.test(D))){if(I.$row=j.eq(l),I.cacheArray=h[l],i=I.cacheArray[G.columns],I.rawArray=i.raw,I.childRowText="",!H.filter_childByColumn){for(D="",q=i.child,w=0;w")>=0)return l;a.isArray(l)?i=l:"object"===a.type(j)&&l&&(i=l(d,e,f))}return i===!1&&(i=b.getOptions(d,e,f)),b.processOptions(d,e,i)},processOptions:function(b,d,e){if(!a.isArray(e))return!1;b=a(b)[0];var f,g,h,i,j=b.config,k="undefined"!=typeof d&&null!==d&&d>=0&&dh;h++)g=e[h],l.push({t:g,p:k&&j.parsers&&j.parsers.length&&j.parsers[d].format(g,b,[],d)||g});for(f=j.textSorter||"",l.sort(function(a,e){var g=a.p.toString(),h=e.p.toString();return k&&"function"==typeof f?f(g,h,!0,d,b):k&&"object"==typeof f&&f.hasOwnProperty(d)?f[d](g,h,!0,d,b):c.sortNatural?c.sortNatural(g,h):!0}),e=[],i=l.length,h=0;i>h;h++)e.push(l[h].t);return e},getOptions:function(b,d,e){b=a(b)[0];var f,g,h,i,j,k,l,m,n=b.config,o=n.widgetOptions,p=[];for(g=0;gf;f++)if(i=j.row?j.row[f]:j.normalized[f][n.columns].$row[0],!e||!i.className.match(o.filter_filteredRow))if(o.filter_useParsedData||n.parsers[d].parsed||n.$headerIndexed[d].hasClass("filter-parsed")){if(p.push(""+j.normalized[f][d]),o.filter_childRows&&o.filter_childByColumn)for(m=j.normalized[f][n.columns].$row.length-1,k=0;m>k;k++)p.push(""+j.normalized[f][n.columns].child[k][d])}else if(p.push(j.normalized[f][n.columns].raw[d]),o.filter_childRows&&o.filter_childByColumn)for(m=j.normalized[f][n.columns].$row.length,k=1;m>k;k++)l=j.normalized[f][n.columns].$row.eq(k).children().eq(d),p.push(""+c.getElementText(n,l,d));return p},buildSelect:function(c,e,f,g,h){if(c=a(c)[0],e=parseInt(e,10),c.config.cache&&!a.isEmptyObject(c.config.cache)){var i,j,k,l,m,n,o=c.config,p=o.widgetOptions,q=o.$headerIndexed[e],r='",s=o.$table.find("thead").find("select."+d.filter+'[data-column="'+e+'"]').val();if(("undefined"==typeof f||""===f)&&(f=b.getOptionSource(c,e,h)),a.isArray(f)){for(i=0;i=0&&(l=k.split(p.filter_selectSourceSeparator),j=l[0],k=l[1]),r+=""!==f[i]?"":"";f=[]}m=(o.$filters?o.$filters:o.$table.children("thead")).find("."+d.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,d){var e,f,g,h=a.config,i=h.widgetOptions,j=h.columns;for(e=0;j>e;e++)f=h.$headerIndexed[e],g=!(f.hasClass("filter-false")||f.hasClass("parser-false")),(f.hasClass("filter-select")||c.getColumnData(a,i.filter_functions,e)===!0)&&g&&b.buildSelect(a,e,"",d,f.hasClass(i.filter_onlyAvail))}},c.getFilters=function(c,e,f,g){var h,i,j,k,l=!1,m=c?a(c)[0].config:"",n=m?m.widgetOptions:"";if(e!==!0&&n&&!n.filter_columnFilters||a.isArray(f)&&f.join("")===m.lastCombinedFilter)return a(c).data("lastSearch");if(m&&(m.$filters&&(i=m.$filters.find("."+d.filter)),n.filter_$externalFilters&&(i=i&&i.length?i.add(n.filter_$externalFilters):n.filter_$externalFilters),i&&i.length))for(l=f||[],h=0;h1&&(j=j.slice(1)),h===m.columns&&(k=j.filter(n.filter_anyColumnSelector),j=k.length?k:j),j.val(f[h]).trigger("change"+m.namespace)):(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},c.setFilters=function(d,e,f,g){var h=d?a(d)[0].config:"",i=c.getFilters(d,!0,e,g);return h&&f&&(h.lastCombinedFilter=null,h.lastSearch=[],b.searching(h.table,e,g),h.$table.trigger("filterFomatterUpdate")),!!i}}(jQuery); \ No newline at end of file +/* + * Requires tablesorter v2.8+ and jQuery 1.7+ + * by Rob Garrison + */ +!function(a){"use strict";var b,c=a.tablesorter||{},d=c.css;a.extend(d,{filterRow:"tablesorter-filter-row",filter:"tablesorter-filter",filterDisabled:"disabled",filterRowHide:"hideme"}),c.addWidget({id:"filter",priority:50,options:{filter_childRows:!1,// if true, filter includes child row content in the search +filter_childByColumn:!1,// ( filter_childRows must be true ) if true = search child rows by column; false = search all child row text grouped +filter_childWithSibs:!0,// if true, include matching child row siblings +filter_columnFilters:!0,// if true, a filter will be added to the top of each table column +filter_columnAnyMatch:!0,// if true, allows using '#:{query}' in AnyMatch searches ( column:query ) +filter_cellFilter:"",// css class name added to the filter cell ( string or array ) +filter_cssFilter:"",// css class name added to the filter row & each input in the row ( tablesorter-filter is ALWAYS added ) +filter_defaultFilter:{},// add a default column filter type '~{query}' to make fuzzy searches default; '{q1} AND {q2}' to make all searches use a logical AND. +filter_excludeFilter:{},// filters to exclude, per column +filter_external:"",// jQuery selector string ( or jQuery object ) of external filters +filter_filteredRow:"filtered",// class added to filtered rows; needed by pager plugin +filter_formatter:null,// add custom filter elements to the filter row +filter_functions:null,// add custom filter functions using this option +filter_hideEmpty:!0,// hide filter row when table is empty +filter_hideFilters:!1,// collapse filter row when mouse leaves the area +filter_ignoreCase:!0,// if true, make all searches case-insensitive +filter_liveSearch:!0,// if true, search column content while the user types ( with a delay ) +filter_onlyAvail:"filter-onlyAvail",// a header with a select dropdown & this class name will only show available ( visible ) options within the drop down +filter_placeholder:{search:"",select:""},// default placeholder text ( overridden by any header 'data-placeholder' setting ) +filter_reset:null,// jQuery selector string of an element used to reset the filters +filter_saveFilters:!1,// Use the $.tablesorter.storage utility to save the most recent filters +filter_searchDelay:300,// typing delay in milliseconds before starting a search +filter_searchFiltered:!0,// allow searching through already filtered rows in special circumstances; will speed up searching in large tables if true +filter_selectSource:null,// include a function to return an array of values to be added to the column filter select +filter_startsWith:!1,// if true, filter start from the beginning of the cell contents +filter_useParsedData:!1,// filter all data using parsed content +filter_serversideFiltering:!1,// if true, must perform server-side filtering b/c client-side filtering is disabled, but the ui and events will still be used. +filter_defaultAttrib:"data-value",// data attribute in the header cell that contains the default filter value +filter_selectSourceSeparator:"|"},format:function(a,c,d){c.$table.hasClass("hasFilters")||b.init(a,c,d)},remove:function(b,e,f,g){var h,i,j=e.$table,k=e.$tbodies,l="addRows updateCell update updateRows updateComplete appendCache filterReset filterEnd search ".split(" ").join(e.namespace+"filter ");if(j.removeClass("hasFilters").unbind(l.replace(c.regex.spaces," ")).find("."+d.filterRow).remove(),!g){for(h=0;h=]/g,// replace operators +query:"(q|query)",// replace filter queries +wild01:/\?/g,// wild card match 0 or 1 +wild0More:/\*/g,// wild care match 0 or more +quote:/\"/g,isNeg1:/(>=?\s*-\d)/,isNeg2:/(<=?\s*\d)/}, +// function( c, data ) { } +// c = table.config +// data.$row = jQuery object of the row currently being processed +// data.$cells = jQuery object of all cells within the current row +// data.filters = array of filters for all columns ( some may be undefined ) +// data.filter = filter for the current column +// data.iFilter = same as data.filter, except lowercase ( if wo.filter_ignoreCase is true ) +// data.exact = table cell text ( or parsed data if column parser enabled; may be a number & not a string ) +// data.iExact = same as data.exact, except lowercase ( if wo.filter_ignoreCase is true; may be a number & not a string ) +// data.cache = table cell text from cache, so it has been parsed ( & in all lower case if c.ignoreCase is true ) +// data.cacheArray = An array of parsed content from each table cell in the row being processed +// data.index = column index; table = table element ( DOM ) +// data.parsed = array ( by column ) of boolean values ( from filter_useParsedData or 'filter-parsed' class ) +types:{or:function(c,d,e){if(b.regex.orTest.test(d.iFilter)||b.regex.orSplit.test(d.filter)){var f,g,h,i, +// duplicate data but split filter +j=a.extend({},d),k=d.index,l=d.parsed[k],m=d.filter.split(b.regex.orSplit),n=d.iFilter.split(b.regex.orSplit),o=m.length;for(f=0;o>f;f++){j.nestedFilters=!0,j.filter=""+(b.parseFilter(c,m[f],k,l)||""),j.iFilter=""+(b.parseFilter(c,n[f],k,l)||""),h="("+(b.parseFilter(c,j.filter,k,l)||"")+")";try{if(i=new RegExp(d.isMatch?h:"^"+h+"$",c.widgetOptions.filter_ignoreCase?"i":""),g=i.test(j.exact)||b.processTypes(c,j,e))return g}catch(p){return null}} +// may be null from processing types +return g||!1}return null}, +// Look for an AND or && operator ( logical and ) +and:function(c,d,e){if(b.regex.andTest.test(d.filter)){var f,g,h,i,j, +// duplicate data but split filter +k=a.extend({},d),l=d.index,m=d.parsed[l],n=d.filter.split(b.regex.andSplit),o=d.iFilter.split(b.regex.andSplit),p=n.length;for(f=0;p>f;f++){k.nestedFilters=!0,k.filter=""+(b.parseFilter(c,n[f],l,m)||""),k.iFilter=""+(b.parseFilter(c,o[f],l,m)||""),i=("("+(b.parseFilter(c,k.filter,l,m)||"")+")").replace(b.regex.wild01,"\\S{1}").replace(b.regex.wild0More,"\\S*");try{ +// use try/catch just in case RegExp is invalid +j=new RegExp(d.isMatch?i:"^"+i+"$",c.widgetOptions.filter_ignoreCase?"i":""), +// look for an exact match with the 'and' unless the 'filter-match' class is found +h=j.test(k.exact)||b.processTypes(c,k,e),g=0===f?h:g&&h}catch(q){return null}} +// may be null from processing types +return g||!1}return null}, +// Look for regex +regex:function(a,c){if(b.regex.regex.test(c.filter)){var d, +// cache regex per column for optimal speed +e=c.filter_regexCache[c.index]||b.regex.regex.exec(c.filter),f=e instanceof RegExp;try{f||( +// force case insensitive search if ignoreCase option set? +// if ( c.ignoreCase && !regex[2] ) { regex[2] = 'i'; } +c.filter_regexCache[c.index]=e=new RegExp(e[1],e[2])),d=e.test(c.exact)}catch(g){d=!1}return d}return null}, +// Look for operators >, >=, < or <= +operators:function(d,e){ +// ignore empty strings... because '' < 10 is true +if(b.regex.operTest.test(e.iFilter)&&""!==e.iExact){var f,g,h,i=d.table,j=e.index,k=e.parsed[j],l=c.formatFloat(e.iFilter.replace(b.regex.operators,""),i),m=d.parsers[j],n=l; +// parse filter value in case we're comparing numbers ( dates ) +// iExact may be numeric - see issue #149; +// check if cached is defined, because sometimes j goes out of range? ( numeric columns ) +// keep showing all rows if nothing follows the operator +return(k||"numeric"===m.type)&&(h=a.trim(""+e.iFilter.replace(b.regex.operators,"")),g=b.parseFilter(d,h,j,!0),l="number"!=typeof g||""===g||isNaN(g)?l:g),!k&&"numeric"!==m.type||isNaN(l)||"undefined"==typeof e.cache?(h=isNaN(e.iExact)?e.iExact.replace(c.regex.nondigit,""):e.iExact,f=c.formatFloat(h,i)):f=e.cache,b.regex.gtTest.test(e.iFilter)?g=b.regex.gteTest.test(e.iFilter)?f>=l:f>l:b.regex.ltTest.test(e.iFilter)&&(g=b.regex.lteTest.test(e.iFilter)?l>=f:l>f),g||""!==n||(g=!0),g}return null}, +// Look for a not match +notMatch:function(c,d){if(b.regex.notTest.test(d.iFilter)){var e,f=d.iFilter.replace("!",""),g=b.parseFilter(c,f,d.index,d.parsed[d.index])||""; +// look for exact not matches - see #628 +return b.regex.exact.test(g)?(g=g.replace(b.regex.exact,""),""===g?!0:a.trim(g)!==d.iExact):(e=d.iExact.search(a.trim(g)),""===g?!0:!(c.widgetOptions.filter_startsWith?0===e:e>=0))}return null}, +// Look for quotes or equals to get an exact match; ignore type since iExact could be numeric +exact:function(c,d){/*jshint eqeqeq:false */ +if(b.regex.exact.test(d.iFilter)){var e=d.iFilter.replace(b.regex.exact,""),f=b.parseFilter(c,e,d.index,d.parsed[d.index])||"";return d.anyMatch?a.inArray(f,d.rowArray)>=0:f==d.iExact}return null}, +// Look for a range ( using ' to ' or ' - ' ) - see issue #166; thanks matzhu! +range:function(a,d){if(b.regex.toTest.test(d.iFilter)){var e,f,g,h,i=a.table,j=d.index,k=d.parsed[j], +// make sure the dash is for a range and not indicating a negative number +l=d.iFilter.split(b.regex.toSplit); +// parse filter value in case we're comparing numbers ( dates ) +return f=l[0].replace(c.regex.nondigit,"")||"",g=c.formatFloat(b.parseFilter(a,f,j,k),i),f=l[1].replace(c.regex.nondigit,"")||"",h=c.formatFloat(b.parseFilter(a,f,j,k),i),(k||"numeric"===a.parsers[j].type)&&(e=a.parsers[j].format(""+l[0],i,a.$headers.eq(j),j),g=""===e||isNaN(e)?g:e,e=a.parsers[j].format(""+l[1],i,a.$headers.eq(j),j),h=""===e||isNaN(e)?h:e),!k&&"numeric"!==a.parsers[j].type||isNaN(g)||isNaN(h)?(f=isNaN(d.iExact)?d.iExact.replace(c.regex.nondigit,""):d.iExact,e=c.formatFloat(f,i)):e=d.cache,g>h&&(f=g,g=h,h=f),e>=g&&h>=e||""===g||""===h}return null}, +// Look for wild card: ? = single, * = multiple, or | = logical OR +wild:function(a,c){if(b.regex.wildOrTest.test(c.iFilter)){var d=c.index,e=c.parsed[d],f=""+(b.parseFilter(a,c.iFilter,d,e)||""); +// look for an exact match with the 'or' unless the 'filter-match' class is found +!b.regex.wildTest.test(f)&&c.nestedFilters&&(f=c.isMatch?f:"^("+f+")$"); +// parsing the filter may not work properly when using wildcards =/ +try{return new RegExp(f.replace(b.regex.wild01,"\\S{1}").replace(b.regex.wild0More,"\\S*"),a.widgetOptions.filter_ignoreCase?"i":"").test(c.exact)}catch(g){return null}}return null}, +// fuzzy text search; modified from https://github.com/mattyork/fuzzy ( MIT license ) +fuzzy:function(a,c){if(b.regex.fuzzyTest.test(c.iFilter)){var d,e=0,f=c.iExact.length,g=c.iFilter.slice(1),h=b.parseFilter(a,g,c.index,c.parsed[c.index])||"";for(d=0;f>d;d++)c.iExact[d]===h[e]&&(e+=1);return e===h.length?!0:!1}return null}},init:function(e,f,g){ +// filter language options +c.language=a.extend(!0,{},{to:"to",or:"or",and:"and"},c.language);var h,i,j,k,l,m,n,o,p,q=b.regex;if(f.$table.addClass("hasFilters"), +// define timers so using clearTimeout won't cause an undefined error +g.filter_searchTimer=null,g.filter_initTimer=null,g.filter_formatterCount=0,g.filter_formatterInit=[],g.filter_anyColumnSelector='[data-column="all"],[data-column="any"]',g.filter_multipleColumnSelector='[data-column*="-"],[data-column*=","]',n="\\{"+b.regex.query+"\\}",a.extend(q,{child:new RegExp(f.cssChildRow),filtered:new RegExp(g.filter_filteredRow),alreadyFiltered:new RegExp("(\\s+("+c.language.or+"|-|"+c.language.to+")\\s+)","i"),toTest:new RegExp("\\s+(-|"+c.language.to+")\\s+","i"),toSplit:new RegExp("(?:\\s+(?:-|"+c.language.to+")\\s+)","gi"),andTest:new RegExp("\\s+("+c.language.and+"|&&)\\s+","i"),andSplit:new RegExp("(?:\\s+(?:"+c.language.and+"|&&)\\s+)","gi"),orTest:/\|/,orSplit:new RegExp("(?:\\s+(?:"+c.language.or+")\\s+|\\|)","gi"),iQuery:new RegExp(n,"i"),igQuery:new RegExp(n,"ig"),operTest:/^[<>]=?/,gtTest:/>/,gteTest:/>=/,ltTest:/'+(k.data("placeholder")||k.attr("data-placeholder")||g.filter_placeholder.select||"")+"":"",n=i,j=i,i.indexOf(g.filter_selectSourceSeparator)>=0&&(n=i.split(g.filter_selectSourceSeparator),j=n[1],n=n[0]),h+="");f.$table.find("thead").find("select."+d.filter+'[data-column="'+l+'"]').append(h),j=g.filter_selectSource,o="function"==typeof j?!0:c.getColumnData(e,j,l),o&& +// updating so the extra options are appended +b.buildSelect(f.table,l,"",!0,k.hasClass(g.filter_onlyAvail))} +// not really updating, but if the column has both the 'filter-select' class & +// filter_functions set to true, it would append the same options twice. +b.buildDefault(e,!0),b.bindSearch(e,f.$table.find("."+d.filter),!0),g.filter_external&&b.bindSearch(e,g.filter_external),g.filter_hideFilters&&b.hideFilters(f), +// show processing icon +f.showProcessing&&(j="filterStart filterEnd ".split(" ").join(f.namespace+"filter "),f.$table.unbind(j.replace(c.regex.spaces," ")).bind(j,function(b,g){k=g?f.$table.find("."+d.header).filter("[data-column]").filter(function(){return""!==g[a(this).data("column")]}):"",c.isProcessing(e,"filterStart"===b.type,g?k:"")})), +// set filtered rows count ( intially unfiltered ) +f.filteredRows=f.totalRows,j="tablesorter-initialized pagerBeforeInitialized ".split(" ").join(f.namespace+"filter "),f.$table.unbind(j.replace(c.regex.spaces," ")).bind(j,function(){var a=this.config.widgetOptions;m=b.setDefaults(e,f,a)||[],m.length&&(f.delayInit&&""===m.join("")||c.setFilters(e,m,!0)),f.$table.trigger("filterFomatterUpdate"),setTimeout(function(){a.filter_initialized||b.filterInitComplete(f)},100)}),f.pager&&f.pager.initialized&&!g.filter_initialized&&(f.$table.trigger("filterFomatterUpdate"),setTimeout(function(){b.filterInitComplete(f)},100))}, +// $cell parameter, but not the config, is passed to the filter_formatters, +// so we have to work with it instead +formatterUpdated:function(a,b){ +// prevent error if $cell is undefined - see #1056 +var c=a&&a.closest("table")[0].config.widgetOptions;c&&!c.filter_initialized&&( +// add updates by column since this function +// may be called numerous times before initialization +c.filter_formatterInit[b]=1)},filterInitComplete:function(c){var d,e,f=c.widgetOptions,g=0,h=function(){f.filter_initialized=!0,c.$table.trigger("filterInit",c),b.findRows(c.table,c.$table.data("lastSearch")||[])};if(a.isEmptyObject(f.filter_formatter))h();else{for(e=f.filter_formatterInit.length,d=0;e>d;d++)1===f.filter_formatterInit[d]&&g++;clearTimeout(f.filter_initTimer),f.filter_initialized||g!==f.filter_formatterCount?f.filter_initialized||( +// fall back in case a filter_formatter doesn't call +// $.tablesorter.filter.formatterUpdated( $cell, column ), and the count is off +f.filter_initTimer=setTimeout(function(){h()},500)): +// filter widget initialized +h()}}, +// encode or decode filters for storage; see #1026 +processFilters:function(a,b){var c,d=b?encodeURIComponent:decodeURIComponent,e=a.length;for(c=0;e>c;c++)a[c]=d(a[c]);return a},setDefaults:function(d,e,f){var g,h,i,j,k, +// get current ( default ) filters +l=c.getFilters(d)||[]; +// if no filters saved, then check default settings +if(f.filter_saveFilters&&c.storage&&(h=c.storage(d,"tablesorter-filters")||[],g=a.isArray(h),g&&""===h.join("")||!g||(l=b.processFilters(h))),""===l.join(""))for(k=e.$headers.add(f.filter_$externalFilters).filter("["+f.filter_defaultAttrib+"]"),i=0;i<=e.columns;i++)j=i===e.columns?"all":i,l[i]=k.filter('[data-column="'+j+'"]').attr(f.filter_defaultAttrib)||l[i]||"";return e.$table.data("lastSearch",l),l},parseFilter:function(a,b,c,d){return d?a.parsers[c].format(b,a.table,[],c):b},buildRow:function(b,e,f){var g,h,i,j,k,l,m,n,o, +// c.columns defined in computeThIndexes() +p=f.filter_cellFilter,q=e.columns,r=a.isArray(p),s='';for(i=0;q>i;i++)e.$headerIndexed[i].length&&(s+='1&&(s+=' colspan="'+o+'"'),s+=r?p[i]?' class="'+p[i]+'"':"":""!==p?' class="'+p+'"':"",s+=">"); +// build each filter input +for(e.$filters=a(s+="").appendTo(e.$table.children("thead").eq(0)).children("td"),i=0;q>i;i++)l=!1,j=e.$headerIndexed[i],j&&j.length&&(g=e.$filters.filter('[data-column="'+i+'"]'),n=c.getColumnData(b,f.filter_functions,i),k=f.filter_functions&&n&&"function"!=typeof n||j.hasClass("filter-select"),h=c.getColumnData(b,e.headers,i),l="false"===c.getData(j[0],h,"filter")||"false"===c.getData(j[0],h,"parser"),k?s=a("').appendTo(g),s&&(o=j.data("placeholder")||j.attr("data-placeholder")||f.filter_placeholder.search||"",s.attr("placeholder",o))),s&&(m=(a.isArray(f.filter_cssFilter)?"undefined"!=typeof f.filter_cssFilter[i]?f.filter_cssFilter[i]||"":"":f.filter_cssFilter)||"",s.addClass(d.filter+" "+m).attr("data-column",i),l&&(s.attr("placeholder","").addClass(d.filterDisabled)[0].disabled=!0)))},bindSearch:function(d,e,f){// allow passing a selector string +if(d=a(d)[0],e=a(e),e.length){var g,h=d.config,i=h.widgetOptions,j=h.namespace+"filter",k=i.filter_$externalFilters;f!==!0&&(g=i.filter_anyColumnSelector+","+i.filter_multipleColumnSelector,i.filter_$anyMatch=e.filter(g),k&&k.length?i.filter_$externalFilters=i.filter_$externalFilters.add(e):i.filter_$externalFilters=e,c.setFilters(d,h.$table.data("lastSearch")||[],f===!1)), +// unbind events +g="keypress keyup search change ".split(" ").join(j+" "),e.attr("data-lastSearchTime",(new Date).getTime()).unbind(g.replace(c.regex.spaces," ")).bind("keyup"+j,function(c){ +// emulate what webkit does.... escape clears the filter +if(a(this).attr("data-lastSearchTime",(new Date).getTime()),27===c.which)this.value="";else{if(i.filter_liveSearch===!1)return;if(""!==this.value&&("number"==typeof i.filter_liveSearch&&this.value.length=37&&c.which<=40)))return} +// change event = no delay; last true flag tells getFilters to skip newest timed input +b.searching(d,!0,!0)}).bind("search change keypress ".split(" ").join(j+" "),function(c){ +// don't get cached data, in case data-column changes dynamically +var e=parseInt(a(this).attr("data-column"),10); +// don't allow 'change' event to process if the input value is the same - fixes #685 +i.filter_initialized&&(13===c.which||"search"===c.type||"change"===c.type&&this.value!==h.lastSearch[e])&&(c.preventDefault(), +// init search with no delay +a(this).attr("data-lastSearchTime",(new Date).getTime()),b.searching(d,!1,!0))})}},searching:function(a,c,d){var e=a.config.widgetOptions;clearTimeout(e.filter_searchTimer),"undefined"==typeof c||c===!0? +// delay filtering +e.filter_searchTimer=setTimeout(function(){b.checkFilters(a,c,d)},e.filter_liveSearch?e.filter_searchDelay:10): +// skip delay +b.checkFilters(a,c,d)},checkFilters:function(e,f,g){var h=e.config,i=h.widgetOptions,j=a.isArray(f),k=j?f:c.getFilters(e,!0),l=(k||[]).join("");// combined filter values +// prevent errors if delay init is set +// combined filter values +// prevent errors if delay init is set +// update cache if delayInit set & pager has initialized ( after user initiates a search ) +// add filter array back into inputs +// show/hide filter row as needed +// return if the last search is the same; but filter === false when updating the search +// see example-widget-filter.html filter toggle buttons +// force filter refresh +// give it time for the processing icon to kick in +return a.isEmptyObject(h.cache)?void(h.delayInit&&h.pager&&h.pager.initialized&&c.updateCache(h,function(){b.checkFilters(e,!1,g)})):(j&&(c.setFilters(e,k,!1,g!==!0),i.filter_initialized||(h.lastCombinedFilter="")),i.filter_hideFilters&&h.$table.find("."+d.filterRow).trigger(""===l?"mouseleave":"mouseenter"),h.lastCombinedFilter!==l||f===!1?(f===!1&&(h.lastCombinedFilter=null,h.lastSearch=[]),i.filter_initialized&&h.$table.trigger("filterStart",[k]),h.showProcessing?void setTimeout(function(){return b.findRows(e,k,l),!1},30):(b.findRows(e,k,l),!1)):void 0)},hideFilters:function(b,e){var f,g=(e||b.$table).find("."+d.filterRow).addClass(d.filterRowHide);g.bind("mouseenter mouseleave",function(c){ +// save event object - http://bugs.jquery.com/ticket/12140 +var e=c,g=a(this);clearTimeout(f),f=setTimeout(function(){/enter|over/.test(e.type)?g.removeClass(d.filterRowHide): +// don't hide if input has focus +// $( ':focus' ) needs jQuery 1.6+ +a(document.activeElement).closest("tr")[0]!==g[0]&&""===b.lastCombinedFilter&&g.addClass(d.filterRowHide)},200)}).find("input, select").bind("focus blur",function(e){var g=e,h=a(this).closest("tr");clearTimeout(f),f=setTimeout(function(){clearTimeout(f), +// don't hide row if any filter has a value +""===c.getFilters(b.$table).join("")&&h.toggleClass(d.filterRowHide,"focus"!==g.type)},200)})},defaultFilter:function(c,d){if(""===c)return c;var e=b.regex.iQuery,f=d.match(b.regex.igQuery).length,g=f>1?a.trim(c).split(/\s/):[a.trim(c)],h=g.length-1,i=0,j=d; +// replace all {query} with query words... +// if query = 'Bob', then convert mask from '!{query}' to '!Bob' +// if query = 'Bob Joe Frank', then convert mask '{q} OR {q}' to 'Bob OR Joe OR Frank' +for(1>h&&f>1&&( +// only one 'word' in query but mask has >1 slots +g[1]=g[0]);e.test(j);)j=j.replace(e,g[i++]||""),e.test(j)&&h>i&&""!==(g[i]||"")&&(j=d.replace(e,j));return j},getLatestSearch:function(b){return b?b.sort(function(b,c){return a(c).attr("data-lastSearchTime")-a(b).attr("data-lastSearchTime")}):b||a()},multipleColumns:function(c,d){ +// look for multiple columns '1-3,4-6,8' in data-column +var e,f,g,h,i,j,k,l,m,n=c.widgetOptions, +// only target 'all' column inputs on initialization +// & don't target 'all' column inputs if they don't exist +o=n.filter_initialized||!d.filter(n.filter_anyColumnSelector).length,p=[],q=a.trim(b.getLatestSearch(d).attr("data-column")||"");if(/^[0-9]+$/.test(q))return parseInt(q,10); +// process column range +if(o&&/-/.test(q))for(f=q.match(/(\d+)\s*-\s*(\d+)/g),m=f.length,l=0;m>l;l++){for(g=f[l].split(/\s*-\s*/),h=parseInt(g[0],10)||0,i=parseInt(g[1],10)||c.columns-1,h>i&&(e=h,h=i,i=e),i>=c.columns&&(i=c.columns-1);i>=h;h++)p.push(h); +// remove processed range from val +q=q.replace(f[l],"")} +// process single columns +if(o&&/,/.test(q))for(j=q.split(/\s*,\s*/),m=j.length,k=0;m>k;k++)""!==j[k]&&(l=parseInt(j[k],10),l1){if(e.anyMatch=!0,e.isMatch=!0,e.rowArray=e.$cells.map(function(b){return a.inArray(b,q)>-1?(e.parsed[b]?m=e.cacheArray[b]:(m=e.rawArray[b],m=a.trim(o.filter_ignoreCase?m.toLowerCase():m),d.sortLocaleCompare&&(m=c.replaceAccents(m))),m):void 0}).get(),e.filter=e.anyMatchFilter,e.iFilter=e.iAnyMatchFilter,e.exact=e.rowArray.join(" "),e.iExact=o.filter_ignoreCase?e.exact.toLowerCase():e.exact,e.cache=e.cacheArray.slice(0,-1).join(" "),f.excludeMatch=f.noAnyMatch,j=b.processTypes(d,e,f),null!==j)p=j;else if(o.filter_startsWith)for(p=!1, +// data.rowArray may not contain all columns +q=Math.min(d.columns,e.rowArray.length);!p&&q>0;)q--,p=p||0===e.rowArray[q].indexOf(e.iFilter);else p=(e.iExact+e.childRowText).indexOf(e.iFilter)>=0; +// no other filters to process +if(e.anyMatch=!1,e.filters.join("")===e.filter)return p}for(q=0;q=0:e.filter===e.exact:"function"==typeof k?j=k(e.exact,e.cache,e.filter,q,e.$row,d,e):"function"==typeof k[l||e.filter]&&(m=l||e.filter,j=k[m](e.exact,e.cache,e.filter,q,e.$row,d,e))),null===j?(j=b.processTypes(d,e,f),null!==j?h=j:(m=(e.iExact+e.childRowText).indexOf(b.parseFilter(d,e.iFilter,q,e.parsed[q])),h=!o.filter_startsWith&&m>=0||o.filter_startsWith&&0===m)):h=j,p=h?p:!1);return p},findRows:function(d,e,f){if(d.config.lastCombinedFilter!==f&&d.config.widgetOptions.filter_initialized){var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E=a.extend([],e),F=b.regex,G=d.config,H=G.widgetOptions, +// data object passed to filters; anyMatch is a flag for the filters +I={anyMatch:!1,filters:e, +// regex filter type cache +filter_regexCache:[]},J={ +// anyMatch really screws up with these types of filters +noAnyMatch:["range","notMatch","operators"], +// cache filter variables that use ts.getColumnData in the main loop +functions:[],excludeFilter:[],defaultColFilter:[],defaultAnyFilter:c.getColumnData(d,H.filter_defaultFilter,G.columns,!0)||""};for( +// parse columns after formatter, in case the class is added at that point +I.parsed=G.$headers.map(function(b){ +// force parsing if parser type is numeric +// getData won't return 'parsed' if other 'filter-' class names exist +// ( e.g. ) +return G.parsers&&G.parsers[b]&&G.parsers[b].parsed||c.getData&&"parsed"===c.getData(G.$headerIndexed[b],c.getColumnData(d,G.headers,b),"filter")||a(this).hasClass("filter-parsed")}).get(),o=0;o1&&(C=parseInt(B[0],10)-1,C>=0&&Cw;w++)v=e[w]||"",y||(w=o),y=y&&r.length&&0===v.indexOf(r[w]||"")&&!F.alreadyFiltered.test(v)&&!F.exactTest.test(v)&&!(F.isNeg1.test(v)||F.isNeg2.test(v))&&!(""!==v&&G.$filters&&G.$filters.filter('[data-column="'+w+'"]').find("select").length&&!G.$headerIndexed[w].hasClass("filter-match")); +// loop through the rows +for(x=j.not("."+H.filter_filteredRow).length,y&&0===x&&(y=!1),G.debug&&console.log("Filter: Searching through "+(y&&g>x?x:"all")+" rows"),I.anyMatchFlag&&(G.sortLocaleCompare&&(I.anyMatchFilter=c.replaceAccents(I.anyMatchFilter)),H.filter_defaultFilter&&F.iQuery.test(J.defaultAnyFilter)&&(I.anyMatchFilter=b.defaultFilter(I.anyMatchFilter,J.defaultAnyFilter),y=!1),I.iAnyMatchFilter=H.filter_ignoreCase&&G.ignoreCase?I.anyMatchFilter.toLowerCase():I.anyMatchFilter),l=0;g>l;l++) +// skip child rows & already filtered rows +if(D=j[l].className,p=l&&F.child.test(D),!(p||y&&F.filtered.test(D))){if(I.$row=j.eq(l),I.cacheArray=h[l],i=I.cacheArray[G.columns],I.rawArray=i.raw,I.childRowText="",!H.filter_childByColumn){ +// so, if 'table.config.widgetOptions.filter_childRows' is true and there is +// a match anywhere in the child row, then it will make the row visible +// checked here so the option can be changed dynamically +for(D="",q=i.child,w=0;w")>=0) +// selectSource is a jQuery object or string of options +return l;a.isArray(l)?i=l:"object"===a.type(j)&&l&&( +// custom select source function for a SPECIFIC COLUMN +i=l(d,e,f))} +// fall back to original method +return i===!1&&(i=b.getOptions(d,e,f)),b.processOptions(d,e,i)},processOptions:function(b,d,e){if(!a.isArray(e))return!1;b=a(b)[0];var f,g,h,i,j=b.config,k="undefined"!=typeof d&&null!==d&&d>=0&&dh;h++)g=e[h],l.push({t:g,p:k&&j.parsers&&j.parsers.length&&j.parsers[d].format(g,b,[],d)||g});for(f=j.textSorter||"",l.sort(function(a,e){var g=a.p.toString(),h=e.p.toString();return k&&"function"==typeof f?f(g,h,!0,d,b):k&&"object"==typeof f&&f.hasOwnProperty(d)?f[d](g,h,!0,d,b):c.sortNatural?c.sortNatural(g,h):!0}),e=[],i=l.length,h=0;i>h;h++)e.push(l[h].t);return e},getOptions:function(b,d,e){b=a(b)[0];var f,g,h,i,j,k,l,m,n=b.config,o=n.widgetOptions,p=[];for(g=0;gf;f++) +// check if has class filtered +if(i=j.row?j.row[f]:j.normalized[f][n.columns].$row[0],!e||!i.className.match(o.filter_filteredRow)) +// get non-normalized cell content +if(o.filter_useParsedData||n.parsers[d].parsed||n.$headerIndexed[d].hasClass("filter-parsed")){ +// child row parsed data +if(p.push(""+j.normalized[f][d]),o.filter_childRows&&o.filter_childByColumn)for(m=j.normalized[f][n.columns].$row.length-1,k=0;m>k;k++)p.push(""+j.normalized[f][n.columns].child[k][d])}else +// child row unparsed data +if( +// get raw cached data instead of content directly from the cells +p.push(j.normalized[f][n.columns].raw[d]),o.filter_childRows&&o.filter_childByColumn)for(m=j.normalized[f][n.columns].$row.length,k=1;m>k;k++)l=j.normalized[f][n.columns].$row.eq(k).children().eq(d),p.push(""+c.getElementText(n,l,d));return p},buildSelect:function(c,e,f,g,h){if(c=a(c)[0],e=parseInt(e,10),c.config.cache&&!a.isEmptyObject(c.config.cache)){var i,j,k,l,m,n,o=c.config,p=o.widgetOptions,q=o.$headerIndexed[e], +// t.data( 'placeholder' ) won't work in jQuery older than 1.4.3 +r='", +// Get curent filter value +s=o.$table.find("thead").find("select."+d.filter+'[data-column="'+e+'"]').val();if( +// nothing included in arry ( external source ), so get the options from +// filter_selectSource or column data +("undefined"==typeof f||""===f)&&(f=b.getOptionSource(c,e,h)),a.isArray(f)){ +// build option list +for(i=0;i=0&&(l=k.split(p.filter_selectSourceSeparator),j=l[0],k=l[1]),r+=""!==f[i]?"":""; +// clear arry so it doesn't get appended twice +f=[]} +// update all selects in the same column ( clone thead in sticky headers & +// any external selects ) - fixes 473 +m=(o.$filters?o.$filters:o.$table.children("thead")).find("."+d.filter),p.filter_$externalFilters&&(m=m&&m.length?m.add(p.filter_$externalFilters):p.filter_$externalFilters),n=m.filter('select[data-column="'+e+'"]'), +// make sure there is a select there! +n.length&&(n[g?"html":"append"](r),a.isArray(f)|| +// append options if arry is provided externally as a string or jQuery object +// options ( default value ) was already added +n.append(f).val(s),n.val(s))}},buildDefault:function(a,d){var e,f,g,h=a.config,i=h.widgetOptions,j=h.columns; +// build default select dropdown +for(e=0;j>e;e++)f=h.$headerIndexed[e],g=!(f.hasClass("filter-false")||f.hasClass("parser-false")),(f.hasClass("filter-select")||c.getColumnData(a,i.filter_functions,e)===!0)&&g&&b.buildSelect(a,e,"",d,f.hasClass(i.filter_onlyAvail))}},c.getFilters=function(c,e,f,g){var h,i,j,k,l=!1,m=c?a(c)[0].config:"",n=m?m.widgetOptions:"";if(e!==!0&&n&&!n.filter_columnFilters||a.isArray(f)&&f.join("")===m.lastCombinedFilter)return a(c).data("lastSearch");if(m&&(m.$filters&&(i=m.$filters.find("."+d.filter)),n.filter_$externalFilters&&(i=i&&i.length?i.add(n.filter_$externalFilters):n.filter_$externalFilters),i&&i.length))for(l=f||[],h=0;h1&&(j=j.slice(1)),h===m.columns&&(k=j.filter(n.filter_anyColumnSelector),j=k.length?k:j),j.val(f[h]).trigger("change"+m.namespace)):(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},c.setFilters=function(d,e,f,g){var h=d?a(d)[0].config:"",i=c.getFilters(d,!0,e,g);return h&&f&&(h.lastCombinedFilter=null,h.lastSearch=[],b.searching(h.table,e,g),h.$table.trigger("filterFomatterUpdate")),!!i}}(jQuery); \ No newline at end of file diff --git a/dist/js/widgets/widget-formatter.min.js b/dist/js/widgets/widget-formatter.min.js index 7ad69d62..7c8dc9ec 100644 --- a/dist/js/widgets/widget-formatter.min.js +++ b/dist/js/widgets/widget-formatter.min.js @@ -1,2 +1,14 @@ /*! Widget: formatter - 2/9/2015 (v2.19.1) */ -!function(a){"use strict";var b=a.tablesorter;b.formatter={init:function(a){var c=a.widgetOptions.formatter_event+" pagerComplete updateComplete ".split(" ").join(".tsformatter ");a.$table.off(c.replace(/\s+/g," ")).on(c,function(){b.formatter.setup(a)}),b.formatter.setup(a)},setup:function(c){if(!a.isEmptyObject(c.cache)){var d,e,f,g,h,i,j,k=c.widgetOptions,l={config:c,wo:k},m=[],n=[];for(j=0;jf;f++)for(l.$row=g.normalized[f][c.columns].$row,l.$cells=l.$row.children("th, td"),j=0;jf;f++)for(l.$row=g.normalized[f][c.columns].$row,l.$cells=l.$row.children("th, td"),j=0;j1&&""!==d?c.hasClass(b.css.sortAsc)?(g=Math.floor(parseFloat(d)/e)*e,g>parseFloat(f||0)?g:parseFloat(f||0)):(g=Math.ceil(parseFloat(d)/e)*e,g=e?h[e-1]:d||"")},separator:function(b,c,d,e){var f=(d+"").split(b.widgetOptions.group_separator);return a.trim(f&&e>0&&f.length>=e?f[(e||1)-1]:"")},word:function(a,b,c,d){var e=(c+" ").match(/\w+/g);return e&&e.length>=d?e[d-1]:c||""},letter:function(a,b,c,d){return c?(c+" ").substring(0,d):""},date:function(a,c,d,e,f){var g,h,i=a.widgetOptions,j=new Date(d||"");return j instanceof Date&&isFinite(j)?(g=j.getFullYear(),h=b.grouping.findMonth(i,j.getMonth()),"year"===e?g:"month"===e?h:"monthyear"===e?h+" "+g:"day"===e?h+" "+j.getDate():"week"===e?b.grouping.findWeek(i,j.getDay()):"time"===e?b.grouping.findTime(i,j):i.group_dateString(j,a,c)):i.group_dateInvalid}},findMonth:function(a,b){return a.group_months[b+(""===(a.group_months[0]||"")?1:0)]},findWeek:function(b,c){if(a.isArray(b.group_week))return b.group_week[c];if(!a.isEmptyObject(b.group_week)){var d=["sun","mon","tue","wed","thu","fri","sat"];return b.group_week[d[c]]}},findTime:function(a,b){var c,d=b.getHours(),e=d>=12?1:0,f=a.group_time.am&&a.group_time.pm,g=("00"+(a.group_time24Hour&&d>12?d-12:a.group_time24Hour&&0===d?d+12:d)).slice(-2),h=("00"+b.getMinutes()).slice(-2);return c=a.group_time[f?["am","pm"][e]:e],g+":"+h+(a.group_time24Hour?"":" "+(c||""))},update:function(c,d,e){if(!a.isEmptyObject(d.cache)){var f,g,h,i,j,k,l,m,n,o,p=b.hasWidget(c,"pager"),q="undefined"!=typeof d.sortList[0],r="",s=0,t=!1,u=a.isArray(e.group_forceColumn)&&"undefined"!=typeof e.group_forceColumn[0]?e.group_enforceSort&&!q?-1:e.group_forceColumn[0]:q?d.sortList[0][0]:-1;if(d.$table.find("tr.group-hidden").removeClass("group-hidden").end().find("tr.group-header").remove(),e.group_collapsible&&d.$table.data("pagerSavedHeight",0),u>=0&&uf;f++)i=l[f][d.columns].$row,i.is(":visible")&&b.grouping.types[k[1]]&&(h=l[f]?b.grouping.types[k[1]](d,d.$headerIndexed[u],l[f][u],/date/.test(j)?k[2]:parseInt(k[2]||1,10)||1,r):h,r!==h&&(r=h,"number"===k[1]&&k[2]>1&&""!==h&&(h+=" - "+(parseInt(h,10)+(parseInt(k[2],10)-1)*(d.$headerIndexed[u].hasClass(b.css.sortAsc)?1:-1))),a.isFunction(e.group_formatter)&&(h=e.group_formatter((h||"").toString(),u,c,d,e)||h),i.before(''+(e.group_collapsible?"":"")+''+h+''),e.group_saveGroups&&!t&&e.group_collapsed&&e.group_collapsible&&e.group_currentGroups[e.group_currentGroup].push(h)));d.$table.find("tr.group-header").bind("selectstart",!1).each(function(){var b,d,f,g=a(this),h=g.nextUntil("tr.group-header").filter(":visible");(e.group_count||a.isFunction(e.group_callback))&&(d=g.find(".group-count"),d.length&&(e.group_count&&d.html(e.group_count.replace(/\{num\}/g,h.length)),a.isFunction(e.group_callback)&&e.group_callback(g.find("td"),h,u,c))),e.group_saveGroups&&!a.isEmptyObject(e.group_currentGroups)&&e.group_currentGroups[e.group_currentGroup].length?(f=g.find(".group-name").text().toLowerCase()+g.attr("data-group-index"),b=a.inArray(f,e.group_currentGroups[e.group_currentGroup])>-1,g.toggleClass("collapsed",b),h.toggleClass("group-hidden",b)):e.group_collapsed&&e.group_collapsible&&(g.addClass("collapsed"),h.addClass("group-hidden"))}),d.$table.trigger(e.group_complete)}}},bindEvents:function(c,d,e){e.group_collapsible&&(e.group_currentGroups=[],d.$table.on("click toggleGroup keyup","tr.group-header",function(f){if(f.stopPropagation(),"keyup"!==f.type||13===f.which){var g,h,i,j=a(this),k=j.find(".group-name").text().toLowerCase()+j.attr("data-group-index");!f.shiftKey||"click"!==f.type&&"keyup"!==f.type||j.siblings(".group-header").trigger("toggleGroup"),j.toggleClass("collapsed"),j.nextUntil("tr.group-header").toggleClass("group-hidden",j.hasClass("collapsed")),e.group_saveGroups&&b.storage&&(h=d.$table.find(".group-header"),g=j.hasClass("collapsed"),e.group_currentGroups[e.group_currentGroup]||(e.group_currentGroups[e.group_currentGroup]=[]),g&&e.group_currentGroup?e.group_currentGroups[e.group_currentGroup].push(k):e.group_currentGroup&&(i=a.inArray(k,e.group_currentGroups[e.group_currentGroup]),i>-1&&e.group_currentGroups[e.group_currentGroup].splice(i,1)),b.storage(c,"tablesorter-groups",e.group_currentGroups))}})),a(e.group_saveReset).on("click",function(){b.grouping.clearSavedGroups(c)}),d.$table.on("pagerChange.tsgrouping",function(){b.grouping.update(c,d,e)})},clearSavedGroups:function(a){a&&b.storage&&(b.storage(a,"tablesorter-groups",""),b.grouping.update(a,a.config,a.config.widgetOptions))}},b.addWidget({id:"group",priority:100,options:{group_collapsible:!0,group_collapsed:!1,group_saveGroups:!0,group_saveReset:null,group_count:" ({num})",group_separator:"-",group_formatter:null,group_callback:null,group_complete:"groupingComplete",group_forceColumn:[],group_enforceSort:!0,group_checkbox:["checked","unchecked"],group_months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],group_week:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],group_time:["AM","PM"],group_time24Hour:!1,group_dateInvalid:"Invalid Date",group_dateString:function(a){return a.toLocaleString()}},init:function(a,c,d,e){b.grouping.bindEvents(a,d,e)},format:function(a,c,d){b.grouping.update(a,c,d)},remove:function(a,b,c){b.$table.off("click","tr.group-header").off("pagerChange.tsgrouping").find(".group-hidden").removeClass("group-hidden").end().find("tr.group-header").remove()}})}(jQuery); \ No newline at end of file +/* + * Requires tablesorter v2.8+ and jQuery 1.7+ + * by Rob Garrison + */ +/*jshint browser:true, jquery:true, unused:false */ +/*global jQuery: false */ +!function(a){"use strict";var b=a.tablesorter;b.grouping={types:{number:function(a,c,d,e,f){var g,h;return e>1&&""!==d?c.hasClass(b.css.sortAsc)?(g=Math.floor(parseFloat(d)/e)*e,g>parseFloat(f||0)?g:parseFloat(f||0)):(g=Math.ceil(parseFloat(d)/e)*e,g=e?h[e-1]:d||"")},separator:function(b,c,d,e){var f=(d+"").split(b.widgetOptions.group_separator);return a.trim(f&&e>0&&f.length>=e?f[(e||1)-1]:"")},word:function(a,b,c,d){var e=(c+" ").match(/\w+/g);return e&&e.length>=d?e[d-1]:c||""},letter:function(a,b,c,d){return c?(c+" ").substring(0,d):""},date:function(a,c,d,e,f){var g,h,i=a.widgetOptions,j=new Date(d||""); +// check for valid date +// check for valid date +return j instanceof Date&&isFinite(j)?(g=j.getFullYear(),h=b.grouping.findMonth(i,j.getMonth()),"year"===e?g:"month"===e?h:"monthyear"===e?h+" "+g:"day"===e?h+" "+j.getDate():"week"===e?b.grouping.findWeek(i,j.getDay()):"time"===e?b.grouping.findTime(i,j):i.group_dateString(j,a,c)):i.group_dateInvalid}}, +// group date type functions to allow using this widget with Globalize +findMonth:function(a,b){ +// CLDR returns an object { 1: "Jan", 2: "Feb", 3: "Mar", ..., 12: "Dec" } +return a.group_months[b+(""===(a.group_months[0]||"")?1:0)]},findWeek:function(b,c){if(a.isArray(b.group_week))return b.group_week[c];if(!a.isEmptyObject(b.group_week)){ +// CLDR returns { sun: "Sun", mon: "Mon", tue: "Tue", wed: "Wed", thu: "Thu", ... } +var d=["sun","mon","tue","wed","thu","fri","sat"];return b.group_week[d[c]]}},findTime:function(a,b){var c,d=b.getHours(),e=d>=12?1:0, +// CLDR returns { am: "AM", pm: "PM", ... } +f=a.group_time.am&&a.group_time.pm,g=("00"+(a.group_time24Hour&&d>12?d-12:a.group_time24Hour&&0===d?d+12:d)).slice(-2),h=("00"+b.getMinutes()).slice(-2);return c=a.group_time[f?["am","pm"][e]:e],g+":"+h+(a.group_time24Hour?"":" "+(c||""))},update:function(c,d,e){if(!a.isEmptyObject(d.cache)){var f,g,h,i,j,k,l,m,n,o,p=b.hasWidget(c,"pager"),q="undefined"!=typeof d.sortList[0],r="",s=0,t=!1,u=a.isArray(e.group_forceColumn)&&"undefined"!=typeof e.group_forceColumn[0]?e.group_enforceSort&&!q?-1:e.group_forceColumn[0]:q?d.sortList[0][0]:-1;if(d.$table.find("tr.group-hidden").removeClass("group-hidden").end().find("tr.group-header").remove(),e.group_collapsible&& +// clear pager saved spacer height (in case the rows are collapsed) +d.$table.data("pagerSavedHeight",0),u>=0&&uf;f++)i=l[f][d.columns].$row,i.is(":visible")&&b.grouping.types[k[1]]&&(h=l[f]?b.grouping.types[k[1]](d,d.$headerIndexed[u],l[f][u],/date/.test(j)?k[2]:parseInt(k[2]||1,10)||1,r):h,r!==h&&(r=h,"number"===k[1]&&k[2]>1&&""!==h&&(h+=" - "+(parseInt(h,10)+(parseInt(k[2],10)-1)*(d.$headerIndexed[u].hasClass(b.css.sortAsc)?1:-1))),a.isFunction(e.group_formatter)&&(h=e.group_formatter((h||"").toString(),u,c,d,e)||h),i.before(''+(e.group_collapsible?"":"")+''+h+''),e.group_saveGroups&&!t&&e.group_collapsed&&e.group_collapsible&&e.group_currentGroups[e.group_currentGroup].push(h)));d.$table.find("tr.group-header").bind("selectstart",!1).each(function(){var b,d,f,g=a(this),h=g.nextUntil("tr.group-header").filter(":visible");(e.group_count||a.isFunction(e.group_callback))&&(d=g.find(".group-count"),d.length&&(e.group_count&&d.html(e.group_count.replace(/\{num\}/g,h.length)),a.isFunction(e.group_callback)&&e.group_callback(g.find("td"),h,u,c))),e.group_saveGroups&&!a.isEmptyObject(e.group_currentGroups)&&e.group_currentGroups[e.group_currentGroup].length?(f=g.find(".group-name").text().toLowerCase()+g.attr("data-group-index"),b=a.inArray(f,e.group_currentGroups[e.group_currentGroup])>-1,g.toggleClass("collapsed",b),h.toggleClass("group-hidden",b)):e.group_collapsed&&e.group_collapsible&&(g.addClass("collapsed"),h.addClass("group-hidden"))}),d.$table.trigger(e.group_complete)}}},bindEvents:function(c,d,e){e.group_collapsible&&(e.group_currentGroups=[], +// .on() requires jQuery 1.7+ +d.$table.on("click toggleGroup keyup","tr.group-header",function(f){ +// pressing enter will toggle the group +if(f.stopPropagation(),"keyup"!==f.type||13===f.which){var g,h,i,j=a(this),k=j.find(".group-name").text().toLowerCase()+j.attr("data-group-index"); +// use shift-click to toggle ALL groups +!f.shiftKey||"click"!==f.type&&"keyup"!==f.type||j.siblings(".group-header").trigger("toggleGroup"),j.toggleClass("collapsed"), +// nextUntil requires jQuery 1.4+ +j.nextUntil("tr.group-header").toggleClass("group-hidden",j.hasClass("collapsed")), +// save collapsed groups +e.group_saveGroups&&b.storage&&(h=d.$table.find(".group-header"),g=j.hasClass("collapsed"),e.group_currentGroups[e.group_currentGroup]||(e.group_currentGroups[e.group_currentGroup]=[]),g&&e.group_currentGroup?e.group_currentGroups[e.group_currentGroup].push(k):e.group_currentGroup&&(i=a.inArray(k,e.group_currentGroups[e.group_currentGroup]),i>-1&&e.group_currentGroups[e.group_currentGroup].splice(i,1)),b.storage(c,"tablesorter-groups",e.group_currentGroups))}})),a(e.group_saveReset).on("click",function(){b.grouping.clearSavedGroups(c)}),d.$table.on("pagerChange.tsgrouping",function(){b.grouping.update(c,d,e)})},clearSavedGroups:function(a){a&&b.storage&&(b.storage(a,"tablesorter-groups",""),b.grouping.update(a,a.config,a.config.widgetOptions))}},b.addWidget({id:"group",priority:100,options:{group_collapsible:!0,// make the group header clickable and collapse the rows below it. +group_collapsed:!1,// start with all groups collapsed +group_saveGroups:!0,// remember collapsed groups +group_saveReset:null,// element to clear saved collapsed groups +group_count:" ({num})",// if not false, the '{num}' string is replaced with the number of rows in the group +group_separator:"-",// group name separator; used when group-separator-# class is used. +group_formatter:null,// function(txt, column, table, c, wo) { return txt; } +group_callback:null,// function($cell, $rows, column, table){}, callback allowing modification of the group header labels +group_complete:"groupingComplete",// event triggered on the table when the grouping widget has finished work +// apply the grouping widget only to selected column +group_forceColumn:[],// only the first value is used; set as an array for future expansion +group_enforceSort:!0,// only apply group_forceColumn when a sort is applied to the table +// checkbox parser text used for checked/unchecked values +group_checkbox:["checked","unchecked"], +// change these default date names based on your language preferences +group_months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],group_week:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],group_time:["AM","PM"], +// use 12 vs 24 hour time +group_time24Hour:!1, +// group header text added for invalid dates +group_dateInvalid:"Invalid Date", +// this function is used when 'group-date' is set to create the date string +// you can just return date, date.toLocaleString(), date.toLocaleDateString() or d.toLocaleTimeString() +// reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#Conversion_getter +group_dateString:function(a){return a.toLocaleString()}},init:function(a,c,d,e){b.grouping.bindEvents(a,d,e)},format:function(a,c,d){b.grouping.update(a,c,d)},remove:function(a,b,c){b.$table.off("click","tr.group-header").off("pagerChange.tsgrouping").find(".group-hidden").removeClass("group-hidden").end().find("tr.group-header").remove()}})}(jQuery); \ No newline at end of file diff --git a/dist/js/widgets/widget-headerTitles.min.js b/dist/js/widgets/widget-headerTitles.min.js index 9288140f..9a56559e 100644 --- a/dist/js/widgets/widget-headerTitles.min.js +++ b/dist/js/widgets/widget-headerTitles.min.js @@ -1,2 +1,32 @@ /*! Widget: headerTitles - updated 3/5/2014 (v2.15.6) */ -!function(a){"use strict";var b=a.tablesorter;b.addWidget({id:"headerTitles",options:{headerTitle_useAria:!1,headerTitle_tooltip:"",headerTitle_cur_text:[" sort: A - Z"," sort: Z - A","ly unsorted"],headerTitle_cur_numeric:[" sort: 0 - 9"," sort: 9 - 0","ly unsorted"],headerTitle_nxt_text:[" sort: A - Z"," sort: Z - A","remove sort"],headerTitle_nxt_numeric:[" sort: 0 - 9"," sort: 9 - 0","remove sort"],headerTitle_output_sorted:"current{current}; activate to {next}",headerTitle_output_unsorted:"current{current}; activate to {next} ",headerTitle_output_nosort:"No sort available",headerTitle_type:[],headerTitle_callback:null},init:function(b,c,d,e){d.$table.on("refreshHeaderTitle",function(){c.format(b,d,e)}),a.isArray(e.headerTitle_tooltip)?d.$headers.each(function(){a(this).addClass(e.headerTitle_tooltip[this.column]||"")}):""!==e.headerTitle_tooltip&&d.$headers.addClass(e.headerTitle_tooltip)},format:function(c,d,e){var f;d.$headers.each(function(){var c=a(this),g=parseInt(c.attr("data-column"),10),h=e.headerTitle_type[g]||d.parsers[g].type||"text",i=c.hasClass(b.css.sortAsc)?0:c.hasClass(b.css.sortDesc)?1:2,j=d.sortVars[g].order[(d.sortVars[g].count+1)%(d.sortReset?3:2)];e.headerTitle_useAria?f=c.hasClass("sorter-false")?e.headerTitle_output_nosort:c.attr("aria-label")||"":(f=(e.headerTitle_prefix||"")+(c.hasClass("sorter-false")?e.headerTitle_output_nosort:b.isValueInArray(g,d.sortList)>=0?e.headerTitle_output_sorted:e.headerTitle_output_unsorted),f=f.replace(/\{(current|next|name)\}/gi,function(a){return{"{name}":c.text(),"{current}":e["headerTitle_cur_"+h][i]||"","{next}":e["headerTitle_nxt_"+h][j]||""}[a.toLowerCase()]})),c.attr("title",a.isFunction(e.headerTitle_callback)?e.headerTitle_callback(c,f):f)})},remove:function(b,c,d){c.$headers.attr("title",""),c.$table.off("refreshHeaderTitle"),a.isArray(d.headerTitle_tooltip)?c.$headers.each(function(){a(this).removeClass(d.headerTitle_tooltip[this.column]||"")}):""!==d.headerTitle_tooltip&&c.$headers.removeClass(d.headerTitle_tooltip)}})}(jQuery); \ No newline at end of file +/* + * Requires tablesorter v2.8+ and jQuery 1.7+ + * by Rob Garrison + */ +/*jshint browser:true, jquery:true, unused:false */ +/*global jQuery: false */ +!function(a){"use strict";var b=a.tablesorter;b.addWidget({id:"headerTitles",options:{ +// use aria-label text +// e.g. 'First Name: Ascending sort applied, activate to apply a descending sort' +headerTitle_useAria:!1, +// add tooltip class +headerTitle_tooltip:"", +// custom titles [ ascending, descending, unsorted ] +headerTitle_cur_text:[" sort: A - Z"," sort: Z - A","ly unsorted"],headerTitle_cur_numeric:[" sort: 0 - 9"," sort: 9 - 0","ly unsorted"],headerTitle_nxt_text:[" sort: A - Z"," sort: Z - A","remove sort"],headerTitle_nxt_numeric:[" sort: 0 - 9"," sort: 9 - 0","remove sort"], +// title display; {prefix} adds above prefix +// {type} adds the current sort order from above (text or numeric) +// {next} adds the next sort direction using the sort order above +headerTitle_output_sorted:"current{current}; activate to {next}",headerTitle_output_unsorted:"current{current}; activate to {next} ",headerTitle_output_nosort:"No sort available", +// use this type to override the parser detection result +// e.g. use for numerically parsed columns (e.g. dates), but you +// want the user to see a text sort, e.g. [ 'text', 'numeric' ] +headerTitle_type:[], +// manipulate the title as desired +headerTitle_callback:null},init:function(b,c,d,e){ +// force refresh +d.$table.on("refreshHeaderTitle",function(){c.format(b,d,e)}), +// add tooltip class +a.isArray(e.headerTitle_tooltip)?d.$headers.each(function(){a(this).addClass(e.headerTitle_tooltip[this.column]||"")}):""!==e.headerTitle_tooltip&&d.$headers.addClass(e.headerTitle_tooltip)},format:function(c,d,e){var f;d.$headers.each(function(){var c=a(this),g=parseInt(c.attr("data-column"),10),h=e.headerTitle_type[g]||d.parsers[g].type||"text",i=c.hasClass(b.css.sortAsc)?0:c.hasClass(b.css.sortDesc)?1:2,j=d.sortVars[g].order[(d.sortVars[g].count+1)%(d.sortReset?3:2)];e.headerTitle_useAria?f=c.hasClass("sorter-false")?e.headerTitle_output_nosort:c.attr("aria-label")||"":(f=(e.headerTitle_prefix||"")+(// now deprecated +c.hasClass("sorter-false")?e.headerTitle_output_nosort:b.isValueInArray(g,d.sortList)>=0?e.headerTitle_output_sorted:e.headerTitle_output_unsorted),f=f.replace(/\{(current|next|name)\}/gi,function(a){return{"{name}":c.text(),"{current}":e["headerTitle_cur_"+h][i]||"","{next}":e["headerTitle_nxt_"+h][j]||""}[a.toLowerCase()]})),c.attr("title",a.isFunction(e.headerTitle_callback)?e.headerTitle_callback(c,f):f)})},remove:function(b,c,d){c.$headers.attr("title",""),c.$table.off("refreshHeaderTitle"), +// remove tooltip class +a.isArray(d.headerTitle_tooltip)?c.$headers.each(function(){a(this).removeClass(d.headerTitle_tooltip[this.column]||"")}):""!==d.headerTitle_tooltip&&c.$headers.removeClass(d.headerTitle_tooltip)}})}(jQuery); \ No newline at end of file diff --git a/dist/js/widgets/widget-lazyload.min.js b/dist/js/widgets/widget-lazyload.min.js index 42f5f06f..5cd097d9 100644 --- a/dist/js/widgets/widget-lazyload.min.js +++ b/dist/js/widgets/widget-lazyload.min.js @@ -1,5 +1,48 @@ /*! Widget: lazyload - 10/25/2015 (v2.23.6) */ -!function(a,b){"use strict";var c=a.tablesorter;c.lazyload={init:function(b,d){"scrollstop"!==d.lazyload_event||c.addScrollStopDone||(c.addScrollStop(),c.addScrollStopDone=!0,a.event.special.scrollstop.latency=d.lazyload_latency||250),c.lazyload.update(b,d);var e=[d.lazyload_update,"pagerUpdate",d.columnSelector_updated||"columnUpdate",""].join(b.namespace+"lazyload ");b.$table.on(e,function(){c.lazyload.update(b,b.widgetOptions)})},update:function(a,b){var c=(/(\.|#)/.test(b.lazyload_imageClass)?"":".")+b.lazyload_imageClass;a.$table.find(c).lazyload({threshold:b.lazyload_threshold,failure_limit:b.lazyload_failure_limit,event:b.lazyload_event,effect:b.lazyload_effect,container:b.lazyload_container,data_attribute:b.lazyload_data_attribute,skip_invisible:b.lazyload_skip_invisible,appear:b.lazyload_appear,load:b.lazyload_load,placeholder:b.lazyload_placeholder})},remove:function(a,b){a.$table.off(a.namespace+"lazyload")}},c.addWidget({id:"lazyload",options:{lazyload_imageClass:"lazy",lazyload_update:"lazyloadUpdate",lazyload_latency:250,lazyload_threshold:0,lazyload_failure_limit:0,lazyload_event:"scrollstop",lazyload_effect:"show",lazyload_container:b,lazyload_data_attribute:"original",lazyload_skip_invisible:!1,lazyload_appear:null,lazyload_load:null,lazyload_placeholder:"data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="},init:function(a,b,d,e){c.lazyload.init(d,e)},remove:function(a,b,d){c.lazyload.remove(b,d)}}),c.addScrollStop=function(){var b=a.event.dispatch||a.event.handle,c=a.event.special,d="D"+ +new Date,e="D"+(+new Date+1);c.scrollstart={setup:function(e){var f,g=a.extend({latency:c.scrollstop.latency},e),h=function(a){var c=this,d=arguments;f?clearTimeout(f):(a.type="scrollstart",b.apply(c,d)),f=setTimeout(function(){f=null},g.latency)};a(this).bind("scroll",h).data(d,h)},teardown:function(){a(this).unbind("scroll",a(this).data(d))}},c.scrollstop={latency:250,setup:function(d){var f,g=a.extend({latency:c.scrollstop.latency},d),h=function(a){var c=this,d=arguments;f&&clearTimeout(f),f=setTimeout(function(){f=null,a.type="scrollstop",b.apply(c,d)},g.latency)};a(this).bind("scroll",h).data(e,h)},teardown:function(){a(this).unbind("scroll",a(this).data(e))}}}}(jQuery,window),/*! +/* + * Requires tablesorter v2.8+ and jQuery 1.7+ + * by Rob Garrison + */ +/*jshint browser:true, jquery:true, unused:false */ +!function(a,b){"use strict";var c=a.tablesorter;c.lazyload={init:function(b,d){"scrollstop"!==d.lazyload_event||c.addScrollStopDone||(c.addScrollStop(),c.addScrollStopDone=!0,a.event.special.scrollstop.latency=d.lazyload_latency||250),c.lazyload.update(b,d);var e=[d.lazyload_update,"pagerUpdate",d.columnSelector_updated||"columnUpdate",""].join(b.namespace+"lazyload ");b.$table.on(e,function(){c.lazyload.update(b,b.widgetOptions)})},update:function(a,b){ +// add '.' if not already included +var c=(/(\.|#)/.test(b.lazyload_imageClass)?"":".")+b.lazyload_imageClass;a.$table.find(c).lazyload({threshold:b.lazyload_threshold,failure_limit:b.lazyload_failure_limit,event:b.lazyload_event,effect:b.lazyload_effect,container:b.lazyload_container,data_attribute:b.lazyload_data_attribute,skip_invisible:b.lazyload_skip_invisible,appear:b.lazyload_appear,load:b.lazyload_load,placeholder:b.lazyload_placeholder})},remove:function(a,b){a.$table.off(a.namespace+"lazyload")}},c.addWidget({id:"lazyload",options:{ +// widget options +lazyload_imageClass:"lazy",lazyload_update:"lazyloadUpdate", +// scrollStop option (https://github.com/ssorallen/jquery-scrollstop) +lazyload_latency:250, +// lazyload options (see http://www.appelsiini.net/projects/lazyload) +lazyload_threshold:0,lazyload_failure_limit:0,lazyload_event:"scrollstop",lazyload_effect:"show",lazyload_container:b,lazyload_data_attribute:"original",lazyload_skip_invisible:!1,lazyload_appear:null,lazyload_load:null,lazyload_placeholder:"data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="},init:function(a,b,d,e){c.lazyload.init(d,e)},remove:function(a,b,d){c.lazyload.remove(b,d)}}), +// jscs:disable +c.addScrollStop=function(){ +// jQuery Scrollstop Plugin v1.2.0 +// https://github.com/ssorallen/jquery-scrollstop +/* + (function (factory) { + // UMD[2] wrapper for jQuery plugins to work in AMD or in CommonJS. + // + // [2] https://github.com/umdjs/umd + + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS + module.exports = factory(require('jquery')); + } else { + // Browser globals + factory(jQuery); + } + }(function ($) { */ +// $.event.dispatch was undocumented and was deprecated in jQuery 1.7[1]. It +// was replaced by $.event.handle in jQuery 1.9. +// +// Use the first of the available functions to support jQuery <1.8. +// +// [1] https://github.com/jquery/jquery-migrate/blob/master/src/event.js#L25 +var b=a.event.dispatch||a.event.handle,c=a.event.special,d="D"+ +new Date,e="D"+(+new Date+1);c.scrollstart={setup:function(e){var f,g=a.extend({latency:c.scrollstop.latency},e),h=function(a){var c=this,d=arguments;f?clearTimeout(f):(a.type="scrollstart",b.apply(c,d)),f=setTimeout(function(){f=null},g.latency)};a(this).bind("scroll",h).data(d,h)},teardown:function(){a(this).unbind("scroll",a(this).data(d))}},c.scrollstop={latency:250,setup:function(d){var f,g=a.extend({latency:c.scrollstop.latency},d),h=function(a){var c=this,d=arguments;f&&clearTimeout(f),f=setTimeout(function(){f=null,a.type="scrollstop",b.apply(c,d)},g.latency)};a(this).bind("scroll",h).data(e,h)},teardown:function(){a(this).unbind("scroll",a(this).data(e))}}}}(jQuery,window), +// jscs:disable +/*! * Lazy Load - jQuery plugin for lazy loading images * * Copyright (c) 2007-2015 Mika Tuupola @@ -13,4 +56,18 @@ * Version: 1.9.7 * */ -function(a,b,c,d){var e=a(b);a.fn.lazyload=function(f){function g(){var b=0;i.each(function(){var c=a(this);if(!j.skip_invisible||c.is(":visible"))if(a.abovethetop(this,j)||a.leftofbegin(this,j));else if(a.belowthefold(this,j)||a.rightoffold(this,j)){if(++b>j.failure_limit)return!1}else c.trigger("appear"),b=0})}var h,i=this,j={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!1,appear:null,load:null,placeholder:"data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="};return f&&(d!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),d!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),a.extend(j,f)),h=j.container===d||j.container===b?e:a(j.container),0===j.event.indexOf("scroll")&&h.bind(j.event,function(){return g()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,(c.attr("src")===d||c.attr("src")===!1)&&c.is("img")&&c.attr("src",j.placeholder),c.one("appear",function(){if(!this.loaded){if(j.appear){var d=i.length;j.appear.call(b,d,j)}a("").bind("load",function(){var d=c.attr("data-"+j.data_attribute);c.hide(),c.is("img")?c.attr("src",d):c.css("background-image","url('"+d+"')"),c[j.effect](j.effect_speed),b.loaded=!0;var e=a.grep(i,function(a){return!a.loaded});if(i=a(e),j.load){var f=i.length;j.load.call(b,f,j)}}).attr("src",c.attr("data-"+j.data_attribute))}}),0!==j.event.indexOf("scroll")&&c.bind(j.event,function(){b.loaded||c.trigger("appear")})}),e.bind("resize",function(){g()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent&&b.originalEvent.persisted&&i.each(function(){a(this).trigger("appear")})}),a(c).ready(function(){g()}),this},a.belowthefold=function(c,f){var g;return g=f.container===d||f.container===b?(b.innerHeight?b.innerHeight:e.height())+e.scrollTop():a(f.container).offset().top+a(f.container).height(),g<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){var g;return g=f.container===d||f.container===b?e.width()+e.scrollLeft():a(f.container).offset().left+a(f.container).width(),g<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollTop():a(f.container).offset().top,g>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollLeft():a(f.container).offset().left,g>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!(a.rightoffold(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.abovethetop(b,c))},a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})},"in-viewport":function(b){return a.inviewport(b,{threshold:0})},"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})}(jQuery,window,document); \ No newline at end of file +function(a,b,c,d){var e=a(b);a.fn.lazyload=function(f){function g(){var b=0;i.each(function(){var c=a(this);if(!j.skip_invisible||c.is(":visible"))if(a.abovethetop(this,j)||a.leftofbegin(this,j));else if(a.belowthefold(this,j)||a.rightoffold(this,j)){if(++b>j.failure_limit)return!1}else c.trigger("appear"),/* if we found an image we'll load, reset the counter */ +b=0})}var h,i=this,j={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!1,appear:null,load:null,placeholder:"data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="};/* Maintain BC for a couple of versions. */ +/* Cache container as jQuery as object. */ +/* Fire one scroll event per scroll. Not one scroll event per image. */ +/* Check if something appears when window is resized. */ +/* With IOS5 force loading images when navigating with back button. */ +/* Non optimal workaround. */ +/* Force initial check if images should appear. */ +return f&&(d!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),d!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),a.extend(j,f)),h=j.container===d||j.container===b?e:a(j.container),0===j.event.indexOf("scroll")&&h.bind(j.event,function(){return g()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,(c.attr("src")===d||c.attr("src")===!1)&&c.is("img")&&c.attr("src",j.placeholder),c.one("appear",function(){if(!this.loaded){if(j.appear){var d=i.length;j.appear.call(b,d,j)}a("").bind("load",function(){var d=c.attr("data-"+j.data_attribute);c.hide(),c.is("img")?c.attr("src",d):c.css("background-image","url('"+d+"')"),c[j.effect](j.effect_speed),b.loaded=!0;var e=a.grep(i,function(a){return!a.loaded});if(i=a(e),j.load){var f=i.length;j.load.call(b,f,j)}}).attr("src",c.attr("data-"+j.data_attribute))}}),0!==j.event.indexOf("scroll")&&c.bind(j.event,function(){b.loaded||c.trigger("appear")})}),e.bind("resize",function(){g()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent&&b.originalEvent.persisted&&i.each(function(){a(this).trigger("appear")})}),a(c).ready(function(){g()}),this},/* Convenience methods in jQuery namespace. */ +/* Use as $.belowthefold(element, {threshold : 100, container : window}) */ +a.belowthefold=function(c,f){var g;return g=f.container===d||f.container===b?(b.innerHeight?b.innerHeight:e.height())+e.scrollTop():a(f.container).offset().top+a(f.container).height(),g<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){var g;return g=f.container===d||f.container===b?e.width()+e.scrollLeft():a(f.container).offset().left+a(f.container).width(),g<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollTop():a(f.container).offset().top,g>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollLeft():a(f.container).offset().left,g>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!(a.rightoffold(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.abovethetop(b,c))},/* Custom selectors for your convenience. */ +/* Use as $("img:below-the-fold").something() or */ +/* $("img").filter(":below-the-fold").something() which is faster */ +a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})},"in-viewport":function(b){return a.inviewport(b,{threshold:0})},/* Maintain BC for couple of versions. */ +"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})}(jQuery,window,document); \ No newline at end of file diff --git a/dist/js/widgets/widget-math.min.js b/dist/js/widgets/widget-math.min.js index 07e25976..f98a2a6e 100644 --- a/dist/js/widgets/widget-math.min.js +++ b/dist/js/widgets/widget-math.min.js @@ -1,9 +1,103 @@ /*! Widget: math - updated 7/28/2015 (v2.22.4) */ -!function(a){"use strict";var b=a.tablesorter,c={error:{0:"Infinity result: Divide by zero",1:"Need more than one element to make this calculation",undef:"No elements found"},invalid:function(a,b,d){return console.log(b,c.error[d]),a&&a.widgetOptions.math_none||"none"},events:"tablesorter-initialized update updateAll updateRows addRows updateCell filterReset filterEnd ".split(" ").join(".tsmath "),processText:function(a,c){var d=c.attr(a.textAttribute);return"undefined"==typeof d&&(d=c[0].textContent||c.text()),d=b.formatFloat(d.replace(/[^\w,. \-()]/g,""),a.table)||0,isNaN(d)?0:d},getRow:function(b,d){var e=b.widgetOptions,f=[],g=d.closest("tr"),h=g.children().not("["+e.math_dataAttrib+"=ignore]");return g.hasClass(e.filter_filteredRow||"filtered")||(e.math_ignore.length&&(h=h.not("[data-column="+e.math_ignore.join("],[data-column=")+"]")),f=h.not(d).map(function(){return c.processText(b,a(this))}).get()),f},getColumn:function(a,b,d){var e,f,g,h,i,j=[],k=a.widgetOptions,l=k.math_dataAttrib,m=k.filter_filteredRow||"filtered",n=parseInt(b.attr("data-column"),10),o=a.$table.children("tbody").children(),p=b.closest("tr");if("above"===d)for(g=o.index(p),e=g;e>=0;)f=o.eq(e).children().filter("[data-column="+n+"]"),i=f.filter("["+l+"^=above]").length,(!o.eq(e).hasClass(m)&&o.eq(e).not("["+l+"=ignore]").length&&e!==g||i&&e!==g)&&(i?e=0:f.length&&j.push(c.processText(a,f))),e--;else if("below"===d)for(g=o.length,e=o.index(p)+1;g>e&&(f=o.eq(e).children().filter("[data-column="+n+"]"),!f.filter("["+l+"^=below]").length);e++)!o.eq(e).hasClass(m)&&o.eq(e).not("["+l+"=ignore]").length&&f.length&&j.push(c.processText(a,f));else for(h=o.not("["+l+"=ignore]"),g=h.length,e=0;g>e;e++)f=h.eq(e).children().filter("[data-column="+n+"]"),h.eq(e).hasClass(m)||!f.not("["+l+"^=above],["+l+"^=below],["+l+"^=col]").length||f.is(b)||j.push(c.processText(a,f));return j},getAll:function(b){var d,e,f,g,h,i,j,k,l=[],m=b.widgetOptions,n=m.math_dataAttrib,o=m.filter_filteredRow||"filtered",p=b.$table.children("tbody").children().not("["+n+"=ignore]");for(h=p.length,g=0;h>g;g++)if(f=p.eq(g),!f.hasClass(o))for(i=f.children().not("["+n+"=ignore]"),k=i.length,j=0;k>j;j++)d=i.eq(j),e=parseInt(d.attr("data-column"),10),!d.filter("["+n+"]").length&&a.inArray(e,m.math_ignore)<0&&l.push(c.processText(b,d));return l},setColumnIndexes:function(c){c.$table.after('
    ');var d=c.$table.detach();b.computeColumnIndex(d.children("tbody").children()),a("#_tablesorter_table_placeholder").after(d).remove()},recalculate:function(a,d,e){if(a&&(!d.math_isUpdating||e)){var f,g,h;a.debug&&(f=new Date),e&&c.setColumnIndexes(a),d.math_dataAttrib="data-"+(d.math_data||"math"),g=d.math_dataAttrib,h=a.$tbodies.find("["+g+"]"),c.mathType(a,h,d.math_priority),h=a.$table.children("."+a.cssInfoBlock+", tfoot").find("["+g+"]"),c.mathType(a,h,d.math_priority),h=a.$table.find("["+g+"^=all]"),c.mathType(a,h,["all"]),d.math_isUpdating=!0,a.debug&&console[console.group?"group":"log"]("Math widget triggering an update after recalculation"),b.update(a),a.debug&&console.log("Math widget update completed"+b.benchmark(f))}},mathType:function(d,e,f){if(e.length){var g,h,i,j,k,l,m,n,o=d.widgetOptions,p=o.math_dataAttrib,q=b.equations;"all"===f[0]&&(k=c.getAll(d)),d.debug&&console[console.group?"group":"log"]("Tablesorter Math widget recalculation"),a.each(f,function(a,b){if(l=e.filter("["+p+"^="+b+"]"),n=l.length){for(d.debug&&console[console.group?"group":"log"](b),m=0;n>m;m++)i=l.eq(m),i.parent().hasClass(o.filter_filteredRow||"filtered")||(g=(i.attr(p)||"").replace(b+"-",""),j="row"===b?c.getRow(d,i):"all"===b?k:c.getColumn(d,i,b),q[g]&&(j.length?(h=q[g](j,d),d.debug&&console.log(i.attr(p),j,"=",h)):h=c.invalid(d,g,"mean"===g?0:"undef"),c.output(i,o,h,j)));d.debug&&console.groupEnd&&console.groupEnd()}}),d.debug&&console.groupEnd&&console.groupEnd()}},output:function(a,c,d,e){var f=a.attr("data-"+c.math_data+"-mask")||c.math_mask,g=b.formatMask(f,d,c.math_wrapPrefix,c.math_wrapSuffix);"function"==typeof c.math_complete&&(g=c.math_complete(a,c,g,d,e)),g!==!1&&a.html(g)}};/** +/* +* Requires tablesorter v2.16+ and jQuery 1.7+ +* by Rob Garrison +*/ +/*jshint browser:true, jquery:true, unused:false */ +/*global jQuery: false */ +!function(a){"use strict";var b=a.tablesorter,c={error:{0:"Infinity result: Divide by zero",1:"Need more than one element to make this calculation",undef:"No elements found"}, +// value returned when calculation is not possible, e.g. no values, dividing by zero, etc. +invalid:function(a,b,d){ +// name = function returning invalid results +// errorIndex = math.error index with an explanation of the error +return console.log(b,c.error[d]),a&&a.widgetOptions.math_none||"none"},events:"tablesorter-initialized update updateAll updateRows addRows updateCell filterReset filterEnd ".split(" ").join(".tsmath "),processText:function(a,c){var d=c.attr(a.textAttribute); +// isNaN('') => false +return"undefined"==typeof d&&(d=c[0].textContent||c.text()),d=b.formatFloat(d.replace(/[^\w,. \-()]/g,""),a.table)||0,isNaN(d)?0:d}, +// get all of the row numerical values in an arry +getRow:function(b,d){var e=b.widgetOptions,f=[],g=d.closest("tr"),h=g.children().not("["+e.math_dataAttrib+"=ignore]");return g.hasClass(e.filter_filteredRow||"filtered")||(e.math_ignore.length&&(h=h.not("[data-column="+e.math_ignore.join("],[data-column=")+"]")),f=h.not(d).map(function(){return c.processText(b,a(this))}).get()),f}, +// get all of the column numerical values in an arry +getColumn:function(a,b,d){var e,f,g,h,i,j=[],k=a.widgetOptions,l=k.math_dataAttrib,m=k.filter_filteredRow||"filtered",n=parseInt(b.attr("data-column"),10),o=a.$table.children("tbody").children(),p=b.closest("tr"); +// make sure tfoot rows are AFTER the tbody rows +// $rows.add( c.$table.children( 'tfoot' ).children() ); +if("above"===d)for(g=o.index(p),e=g;e>=0;)f=o.eq(e).children().filter("[data-column="+n+"]"),i=f.filter("["+l+"^=above]").length,(!o.eq(e).hasClass(m)&&o.eq(e).not("["+l+"=ignore]").length&&e!==g||i&&e!==g)&&(i?e=0:f.length&&j.push(c.processText(a,f))),e--;else if("below"===d) +// index + 1 to ignore starting node +for(g=o.length,e=o.index(p)+1;g>e&&(f=o.eq(e).children().filter("[data-column="+n+"]"),!f.filter("["+l+"^=below]").length);e++)!o.eq(e).hasClass(m)&&o.eq(e).not("["+l+"=ignore]").length&&f.length&&j.push(c.processText(a,f));else for(h=o.not("["+l+"=ignore]"),g=h.length,e=0;g>e;e++)f=h.eq(e).children().filter("[data-column="+n+"]"),h.eq(e).hasClass(m)||!f.not("["+l+"^=above],["+l+"^=below],["+l+"^=col]").length||f.is(b)||j.push(c.processText(a,f));return j}, +// get all of the column numerical values in an arry +getAll:function(b){var d,e,f,g,h,i,j,k,l=[],m=b.widgetOptions,n=m.math_dataAttrib,o=m.filter_filteredRow||"filtered",p=b.$table.children("tbody").children().not("["+n+"=ignore]");for(h=p.length,g=0;h>g;g++)if(f=p.eq(g),!f.hasClass(o)) +// $row.children().each(function(){ +for(i=f.children().not("["+n+"=ignore]"),k=i.length,j=0;k>j;j++)d=i.eq(j),e=parseInt(d.attr("data-column"),10),!d.filter("["+n+"]").length&&a.inArray(e,m.math_ignore)<0&&l.push(c.processText(b,d));return l},setColumnIndexes:function(c){c.$table.after('
    '); +// detach table from DOM to speed up column indexing +var d=c.$table.detach();b.computeColumnIndex(d.children("tbody").children()),a("#_tablesorter_table_placeholder").after(d).remove()},recalculate:function(a,d,e){if(a&&(!d.math_isUpdating||e)){var f,g,h;a.debug&&(f=new Date), +// add data-column attributes to all table cells +e&&c.setColumnIndexes(a), +// data-attribute name (defaults to data-math) +d.math_dataAttrib="data-"+(d.math_data||"math"), +// all non-info tbody cells +g=d.math_dataAttrib,h=a.$tbodies.find("["+g+"]"),c.mathType(a,h,d.math_priority), +// only info tbody cells +h=a.$table.children("."+a.cssInfoBlock+", tfoot").find("["+g+"]"),c.mathType(a,h,d.math_priority), +// find the 'all' total +h=a.$table.find("["+g+"^=all]"),c.mathType(a,h,["all"]),d.math_isUpdating=!0,a.debug&&console[console.group?"group":"log"]("Math widget triggering an update after recalculation"), +// update internal cache +b.update(a),a.debug&&console.log("Math widget update completed"+b.benchmark(f))}},mathType:function(d,e,f){if(e.length){var g,h,i,j,k,l,m,n,o=d.widgetOptions,p=o.math_dataAttrib,q=b.equations;"all"===f[0]&&( +// no need to get all cells more than once +k=c.getAll(d)),d.debug&&console[console.group?"group":"log"]("Tablesorter Math widget recalculation"), +// $.each is okay here... only 4 priorities +a.each(f,function(a,b){if(l=e.filter("["+p+"^="+b+"]"),n=l.length){for(d.debug&&console[console.group?"group":"log"](b),m=0;n>m;m++)i=l.eq(m),i.parent().hasClass(o.filter_filteredRow||"filtered")||(g=(i.attr(p)||"").replace(b+"-",""),j="row"===b?c.getRow(d,i):"all"===b?k:c.getColumn(d,i,b),q[g]&&(j.length?(h=q[g](j,d),d.debug&&console.log(i.attr(p),j,"=",h)):h=c.invalid(d,g,"mean"===g?0:"undef"),c.output(i,o,h,j)));d.debug&&console.groupEnd&&console.groupEnd()}}),d.debug&&console.groupEnd&&console.groupEnd()}},output:function(a,c,d,e){ +// get mask from cell data-attribute: data-math-mask="#,##0.00" +var f=a.attr("data-"+c.math_data+"-mask")||c.math_mask,g=b.formatMask(f,d,c.math_wrapPrefix,c.math_wrapSuffix);"function"==typeof c.math_complete&&(g=c.math_complete(a,c,g,d,e)),g!==!1&&a.html(g)}}; +// Modified from https://code.google.com/p/javascript-number-formatter/ +/** * @preserve IntegraXor Web SCADA - JavaScript Number Formatter * http:// www.integraxor.com/ * author: KPL, KHL * (c)2011 ecava * Dual licensed under the MIT or GPL Version 2 licenses. */ -b.formatMask=function(a,b,c,d){if(!a||isNaN(+b))return b;var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t="",u=a.length,v=a.search(/[0-9\-\+#]/),w=v>0?a.substring(0,v):"",x=w;if(v>0&&c&&(x=/\{content\}/.test(c||"")?(c||"").replace(/\{content\}/g,w||""):(c||"")+w),s=a.split("").reverse().join(""),r=s.search(/[0-9\-\+#]/),q=u-r,q+="."===a.substring(q,q+1)?1:0,w=r>0?a.substring(q,u):"",t=w,""!==w&&d&&(t=/\{content\}/.test(d||"")?(d||"").replace(/\{content\}/g,w||""):w+(d||"")),a=a.substring(v,q),b="-"==a.charAt(0)?-b:+b,e=0>b?b=-b:0,f=a.match(/[^\d\-\+#]/g),g=f&&f[f.length-1]||".",h=f&&f[1]&&f[0]||",",a=a.split(g),b=b.toFixed(a[1]&&a[1].length),b=+b+"",j=a[1]&&a[1].lastIndexOf("0"),l=b.split("."),(!l[1]||l[1]&&l[1].length<=j)&&(b=(+b).toFixed(j+1)),m=a[0].split(h),a[0]=m.join(""),i=a[0]&&a[0].indexOf("0"),i>-1)for(;l[0].lengthq;q++)o+=n.charAt(q),!((q-p+1)%k)&&u-k>q&&(o+=h);b[0]=o}return b[1]=a[1]&&b[1]?g+b[1]:"",x+((e?"-":"")+b[0]+b[1])+t},b.equations={count:function(a){return a.length},sum:function(a){var b,c=a.length,d=0;for(b=0;c>b;b++)d+=a[b];return d},mean:function(a){var c=b.equations.sum(a);return c/a.length},median:function(a,b){var d,e=a.length;return e>1?(a.sort(function(a,b){return a-b}),d=Math.floor(e/2),e%2?a[d]:(a[d-1]+a[d])/2):c.invalid(b,"median",1)},mode:function(a){var b,c,d,e={},f=1,g=[a[0]];for(b=0;bf?(g=[c],f=d):d===f&&(g.push(c),f=d);return g.sort(function(a,b){return a-b})},max:function(a){return Math.max.apply(Math,a)},min:function(a){return Math.min.apply(Math,a)},range:function(a){var b=a.sort(function(a,b){return a-b});return b[a.length-1]-b[0]},variance:function(a,d,e){for(var f,g=b.equations.mean(a),h=0,i=a.length;i--;)h+=Math.pow(a[i]-g,2);return f=a.length-(d?0:1),0===f?c.invalid(e,"variance",0):h/=f},varp:function(a,c){return b.equations.variance(a,!0,c)},vars:function(a,c){return b.equations.variance(a,!1,c)},stdevs:function(a,c){var d=b.equations.variance(a,!1,c);return Math.sqrt(d)},stdevp:function(a,c){var d=b.equations.variance(a,!0,c);return Math.sqrt(d)}},b.addWidget({id:"math",priority:100,options:{math_data:"math",math_ignore:[],math_mask:"#,##0.00",math_complete:null,math_priority:["row","above","below","col"],math_prefix:"",math_suffix:"",math_none:"N/A",math_event:"recalculate"},init:function(a,d,e,f){var g=b.hasWidget(a,"filter")?"filterEnd":"updateComplete";e.$table.off((c.events+" updateComplete.tsmath "+f.math_event).replace(/\s+/g," ")).on(c.events+" "+f.math_event,function(a){var b="tablesorter-initialized"===a.type;(!f.math_isUpdating||b)&&(/filter/.test(a.type)||c.setColumnIndexes(e),c.recalculate(e,f,b))}).on(g+".tsmath",function(){setTimeout(function(){f.math_isUpdating&&e.debug&&console.groupEnd&&console.groupEnd(),f.math_isUpdating=!1},40)}),f.math_isUpdating=!1,a.hasInitialized&&c.recalculate(e,f,!0)},remove:function(a,b,d,e){e||b.$table.off((c.events+" updateComplete.tsmath "+d.math_event).replace(/\s+/g," ")).find("[data-"+d.math_data+"]").empty()}})}(jQuery); \ No newline at end of file +b.formatMask=function(a,b,c,d){if(!a||isNaN(+b))return b;var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t="", +// find prefix/suffix +u=a.length,v=a.search(/[0-9\-\+#]/),w=v>0?a.substring(0,v):"",x=w;if(v>0&&c&&(x=/\{content\}/.test(c||"")?(c||"").replace(/\{content\}/g,w||""):(c||"")+w),s=a.split("").reverse().join(""),r=s.search(/[0-9\-\+#]/),q=u-r,q+="."===a.substring(q,q+1)?1:0,w=r>0?a.substring(q,u):"",t=w,""!==w&&d&&(t=/\{content\}/.test(d||"")?(d||"").replace(/\{content\}/g,w||""):w+(d||"")),a=a.substring(v,q),b="-"==a.charAt(0)?-b:+b,e=0>b?b=-b:0,f=a.match(/[^\d\-\+#]/g),g=f&&f[f.length-1]||".",h=f&&f[1]&&f[0]||",",a=a.split(g),b=b.toFixed(a[1]&&a[1].length),b=+b+"",j=a[1]&&a[1].lastIndexOf("0"),l=b.split("."),(!l[1]||l[1]&&l[1].length<=j)&&(b=(+b).toFixed(j+1)),m=a[0].split(h),a[0]=m.join(""),i=a[0]&&a[0].indexOf("0"),i>-1)for(;l[0].lengthq;q++)o+=n.charAt(q),!((q-p+1)%k)&&u-k>q&&(o+=h);b[0]=o} +// put back any negation, combine integer and fraction, and add back prefix & suffix +return b[1]=a[1]&&b[1]?g+b[1]:"",x+((e?"-":"")+b[0]+b[1])+t},b.equations={count:function(a){return a.length},sum:function(a){var b,c=a.length,d=0;for(b=0;c>b;b++)d+=a[b];return d},mean:function(a){var c=b.equations.sum(a);return c/a.length},median:function(a,b){var d,e=a.length; +// https://gist.github.com/caseyjustus/1166258 +return e>1?(a.sort(function(a,b){return a-b}),d=Math.floor(e/2),e%2?a[d]:(a[d-1]+a[d])/2):c.invalid(b,"median",1)},mode:function(a){ +// http://stackoverflow.com/a/3451640/145346 +var b,c,d,e={},f=1,g=[a[0]];for(b=0;bf?(g=[c],f=d):d===f&&(g.push(c),f=d); +// returns arry of modes if there is a tie +return g.sort(function(a,b){return a-b})},max:function(a){return Math.max.apply(Math,a)},min:function(a){return Math.min.apply(Math,a)},range:function(a){var b=a.sort(function(a,b){return a-b});return b[a.length-1]-b[0]}, +// common variance equation +// (not accessible via data-attribute setting) +variance:function(a,d,e){for(var f,g=b.equations.mean(a),h=0,i=a.length;i--;)h+=Math.pow(a[i]-g,2);return f=a.length-(d?0:1),0===f?c.invalid(e,"variance",0):h/=f}, +// variance (population) +varp:function(a,c){return b.equations.variance(a,!0,c)}, +// variance (sample) +vars:function(a,c){return b.equations.variance(a,!1,c)}, +// standard deviation (sample) +stdevs:function(a,c){var d=b.equations.variance(a,!1,c);return Math.sqrt(d)}, +// standard deviation (population) +stdevp:function(a,c){var d=b.equations.variance(a,!0,c);return Math.sqrt(d)}}, +// add new widget called repeatHeaders +// ************************************ +b.addWidget({id:"math",priority:100,options:{math_data:"math", +// column index to ignore +math_ignore:[], +// mask info: https://code.google.com/p/javascript-number-formatter/ +math_mask:"#,##0.00", +// complete executed after each fucntion +math_complete:null,// function($cell, wo, result, value, arry){ return result; }, +// order of calculation; 'all' is last +math_priority:["row","above","below","col"], +// template for or just prepend the mask prefix & suffix with this HTML +// e.g. '{content}' +math_prefix:"",math_suffix:"", +// no matching math elements found (text added to cell) +math_none:"N/A",math_event:"recalculate"},init:function(a,d,e,f){ +// filterEnd fires after updateComplete +var g=b.hasWidget(a,"filter")?"filterEnd":"updateComplete";e.$table.off((c.events+" updateComplete.tsmath "+f.math_event).replace(/\s+/g," ")).on(c.events+" "+f.math_event,function(a){var b="tablesorter-initialized"===a.type;(!f.math_isUpdating||b)&&(/filter/.test(a.type)|| +// redo data-column indexes on update +c.setColumnIndexes(e),c.recalculate(e,f,b))}).on(g+".tsmath",function(){setTimeout(function(){f.math_isUpdating&&e.debug&&console.groupEnd&&console.groupEnd(),f.math_isUpdating=!1},40)}),f.math_isUpdating=!1, +// math widget initialized after table - see #946 +a.hasInitialized&&c.recalculate(e,f,!0)}, +// this remove function is called when using the refreshWidgets method or when destroying the tablesorter plugin +// this function only applies to tablesorter v2.4+ +remove:function(a,b,d,e){e||b.$table.off((c.events+" updateComplete.tsmath "+d.math_event).replace(/\s+/g," ")).find("[data-"+d.math_data+"]").empty()}})}(jQuery); \ No newline at end of file diff --git a/dist/js/widgets/widget-output.min.js b/dist/js/widgets/widget-output.min.js index 3c558532..093dfd33 100644 --- a/dist/js/widgets/widget-output.min.js +++ b/dist/js/widgets/widget-output.min.js @@ -1,2 +1,84 @@ /*! Widget: output - updated 7/28/2015 (v2.22.4) */ -!function(a){"use strict";var b=a.tablesorter,c=b.output={event:"outputTable",regexQuote:/([\n\t\x09\x0d\x0a]|<[^<]+>)/,regexBR:/(|\n)/g,regexIMG:/]+alt\s*=\s*['"]([^'"]+)['"][^>]*>/i,regexHTML:/<[^<]+>/g,replaceCR:"\r\n",replaceTab:" ",popupTitle:"Output",popupStyle:"width:100%;height:100%;",message:"Your device does not support downloading. Please try again in desktop browser.",init:function(a){a.$table.off(c.event).on(c.event,function(b){b.stopPropagation(),c.process(a,a.widgetOptions)})},processRow:function(d,e,f,g){var h,i,j,k,l,m,n,o,p,q,r=d.widgetOptions,s=[],t=r.output_duplicateSpans,u=f&&g&&r.output_headerRows&&a.isFunction(r.output_callbackJSON),v=0,w=e.length;for(k=0;w>k;k++)for(s[k]||(s[k]=[]),v=0,i=e.eq(k).children(),j=i.length,n=0;j>n;n++){if(h=i.eq(n),h.filter("[rowspan]").length)for(o=parseInt(h.attr("rowspan"),10)-1,q=c.formatData(d,r,h,f),l=1;o>=l;l++)s[k+l]||(s[k+l]=[]),s[k+l][v]=f?q:t?q:"";if(h.filter("[colspan]").length)for(p=parseInt(h.attr("colspan"),10)-1,q=c.formatData(d,r,h,f),m=1;p>=m;m++)if(h.filter("[rowspan]").length)for(o=parseInt(h.attr("rowspan"),10),l=0;o>l;l++)s[k+l]||(s[k+l]=[]),s[k+l][v+m]=u?r.output_callbackJSON(h,q,v+m)||q+"("+(v+m)+")":f?q:t?q:"";else s[k][v+m]=u?r.output_callbackJSON(h,q,v+m)||q+"("+(v+m)+")":f?q:t?q:"";for(;"undefined"!=typeof s[k][v];)v++;s[k][v]=s[k][v]||c.formatData(d,r,h,f),v++}return b.output.removeColumns(d,r,s)},removeColumns:function(a,b,c){var d,e,f,g=[],h=c.length;for(d=0;h>d;d++)for(e=c[d],g[d]=[],f=0;f-1||!e.output_hiddenColumns&&"none"===d.$headerIndexed[o].css("display")&&!d.$headerIndexed[o].hasClass("tablesorter-scroller-hidden-column");if(g=u.children("thead").children("tr").not("."+(b.css.filterRow||"tablesorter-filter-row")).filter(function(){return e.output_hiddenColumns||"none"!==a(this).css("display")}),i=c.processRow(d,g,!0,q),h=u.children("tbody").children("tr"),h=/^f/.test(t)?h.not("."+(e.filter_filteredRow||"filtered")):/^v/.test(t)?h.filter(":visible"):/^[.#:\[]/.test(t)?h.filter(t):h,j=c.processRow(d,h),e.output_includeFooter&&(j=j.concat(c.processRow(d,u.children("tfoot").children("tr:visible")))),k=i.length,q){for(p=[],l=j.length,o=0;l>o;o++)m=i[k>1&&e.output_headerRows?o%k:k-1],p.push(c.row2Hash(m,j[o]));f=n?JSON.stringify(p):p}else m=[i[k>1&&e.output_headerRows?o%k:k-1]],p=c.row2CSV(e,e.output_headerRows?i:m,r).concat(c.row2CSV(e,j,r)),f=r&&n?JSON.stringify(p):p.join("\n");(!a.isFunction(e.output_callback)||e.output_callback(d,f))&&(/p/i.test(e.output_delivery||"")?c.popup(f,e.output_popupStyle,q||r):c.download(e,f))},row2CSV:function(a,b,c){var d,e,f=[],g=b.length;for(e=0;g>e;e++)d=(b[e]||[]).join("").replace(/\"/g,""),(b[e]||[]).length>0&&""!==d&&(f[f.length]=c?b[e]:b[e].join(a.output_separator));return f},row2Hash:function(a,b){var c,d={},e=b.length;for(c=0;e>c;c++)c"+c.popupTitle+'"),e.document.close(),e.focus(),!0},download:function(a,b){var d,e,f,g=window.navigator,h=document.createElement("a");if(/(iP)/g.test(g.userAgent))return alert(c.message),!1;try{f=!!new Blob}catch(i){f=!1}return f?(window.URL=window.URL||window.webkitURL,e=new Blob(["\ufeff",b],{type:a.output_encoding}),g.msSaveBlob?g.msSaveBlob(e,a.output_saveFileName):(h.href=window.URL.createObjectURL(e),h.download=a.output_saveFileName,document.createEvent&&(d=document.createEvent("MouseEvents"),d.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),h.dispatchEvent(d))),!1):(window.open(a.output_encoding+encodeURIComponent(b)+"?download","_self"),!0)},remove:function(a){a.$table.off(c.event)}};b.addWidget({id:"output",options:{output_separator:",",output_ignoreColumns:[],output_hiddenColumns:!1,output_includeFooter:!1,output_dataAttrib:"data-name",output_headerRows:!1,output_delivery:"popup",output_saveRows:"filtered",output_duplicateSpans:!0,output_replaceQuote:"“;",output_includeHTML:!1,output_trimSpaces:!0,output_wrapQuotes:!1,output_popupStyle:"width=500,height=300",output_saveFileName:"mytable.csv",output_formatContent:null,output_callback:function(a,b){return!0},output_callbackJSON:function(a,b,c){return b+"("+c+")"},output_encoding:"data:application/octet-stream;charset=utf8,"},init:function(a,b,d){c.init(d)},remove:function(a,b){c.remove(b)}})}(jQuery); \ No newline at end of file +/* + * Requires tablesorter v2.8+ and jQuery 1.7+ + * Modified from: + * HTML Table to CSV: http://www.kunalbabre.com/projects/table2CSV.php (License unknown?) + * Download-File-JS: https://github.com/PixelsCommander/Download-File-JS (http://www.apache.org/licenses/LICENSE-2.0) + */ +/*jshint browser:true, jquery:true, unused:false */ +/*global jQuery:false, alert:false */ +!function(a){"use strict";var b=a.tablesorter,c=b.output={event:"outputTable", +// wrap line breaks & tabs in quotes +regexQuote:/([\n\t\x09\x0d\x0a]|<[^<]+>)/,// test if cell needs wrapping quotes +regexBR:/(|\n)/g,// replace +regexIMG:/]+alt\s*=\s*['"]([^'"]+)['"][^>]*>/i,// match +regexHTML:/<[^<]+>/g,// replace +replaceCR:"\r\n",replaceTab:" ",popupTitle:"Output",popupStyle:"width:100%;height:100%;",// for textarea +message:"Your device does not support downloading. Please try again in desktop browser.",init:function(a){a.$table.off(c.event).on(c.event,function(b){b.stopPropagation(), +// explicitly use table.config.widgetOptions because we want +// the most up-to-date values; not the 'wo' from initialization +c.process(a,a.widgetOptions)})},processRow:function(d,e,f,g){var h,i,j,k,l,m,n,o,p,q,r=d.widgetOptions,s=[],t=r.output_duplicateSpans,u=f&&g&&r.output_headerRows&&a.isFunction(r.output_callbackJSON),v=0,w=e.length;for(k=0;w>k;k++)for(s[k]||(s[k]=[]),v=0,i=e.eq(k).children(),j=i.length,n=0;j>n;n++){ +// process rowspans +if(h=i.eq(n),h.filter("[rowspan]").length)for(o=parseInt(h.attr("rowspan"),10)-1,q=c.formatData(d,r,h,f),l=1;o>=l;l++)s[k+l]||(s[k+l]=[]),s[k+l][v]=f?q:t?q:""; +// process colspans +if(h.filter("[colspan]").length)for(p=parseInt(h.attr("colspan"),10)-1,q=c.formatData(d,r,h,f),m=1;p>=m;m++) +// if we're processing the header & making JSON, the header names need to be unique +if(h.filter("[rowspan]").length)for(o=parseInt(h.attr("rowspan"),10),l=0;o>l;l++)s[k+l]||(s[k+l]=[]),s[k+l][v+m]=u?r.output_callbackJSON(h,q,v+m)||q+"("+(v+m)+")":f?q:t?q:"";else s[k][v+m]=u?r.output_callbackJSON(h,q,v+m)||q+"("+(v+m)+")":f?q:t?q:""; +// skip column if already defined +for(;"undefined"!=typeof s[k][v];)v++;s[k][v]=s[k][v]||c.formatData(d,r,h,f),v++}return b.output.removeColumns(d,r,s)}, +// remove hidden/ignored columns +removeColumns:function(a,b,c){var d,e,f,g=[],h=c.length;for(d=0;h>d;d++)for(e=c[d],g[d]=[],f=0;f