/* * TableSorter 2.0 - Client-side table sorting with ease! * Version 2.0.11 * Copyright (c) 2007 Christian Bach */ (function($){$.extend({tablesorter:new function(){var parsers=[],widgets=[],tbl;this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:false,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",onRenderHeader:null,selectorHeaders:"thead th", tableClass:"tablesorter",debug:false};function log(s){if(typeof console!=="undefined"&&typeof console.debug!=="undefined")console.log(s);else alert(s)}function benchmark(s,d){log(s+","+((new Date).getTime()-d.getTime())+"ms")}this.benchmark=benchmark;function getElementText(config,node){var text="";if(!node)return"";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(config.textExtraction==="simple")if(config.supportsTextContent)text=node.textContent;else if(node.childNodes[0]&& node.childNodes[0].hasChildNodes())text=node.childNodes[0].innerHTML;else text=node.innerHTML;else if(typeof config.textExtraction==="function")text=config.textExtraction(node);else text=$(node).text();return text}function getParserById(name){var i,l=parsers.length;for(i=0;i").each(function(index){this.column=header_index[this.parentNode.rowIndex+ "-"+this.cellIndex];this.order=formatSortingOrder(checkHeaderOrder(table,index));this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table,index)||$(this).is(".sorter-false"))this.sortDisabled=true;this.lockedOrder=false;lock=checkHeaderLocked(table,index);if(typeof lock!=="undefined"&&lock!==false)this.order=this.lockedOrder=formatSortingOrder(lock);if(!this.sortDisabled){$th=$(this).addClass(table.config.cssHeader);if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th, [index])}table.config.headerList[index]=this});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders)}return $tableHeaders}function checkCellColSpan(table,rows,row){var i,cell,arr=[],r=table.tHead.rows,c=r[row].cells;for(i=0;i1)arr=arr.concat(checkCellColSpan(table,rows,row++));else if(table.tHead.length===1||cell.rowSpan>1||!r[row+1])arr.push(cell)}return arr}function isValueInArray(v,a){var i,l=a.length;for(i=0;i");$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($("").css("width",$(this).width()))});$(table).prepend(colgroup)}} function updateHeaderSortCount(table,sortList){var i,s,o,c=table.config,l=sortList.length;for(i=0;ib?1:-1}catch(er){return 0}}function sortTextDesc(a,b){if($.data(tbl[0],"tablesorter").sortLocaleCompare)return b.localeCompare(a); return-sortText(a,b)}function getTextValue(a,mx,d){if(a==="")return(d||0)*Number.MAX_VALUE;if(mx){var i,l=a.length,n=mx+d;for(i=0;i0){$this.trigger("sortStart",tbl[0]);$cell=$(this);i=this.column;this.order=this.count++%2;if(typeof this.lockedOrder!=="undefined"&&this.lockedOrder!==false)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!==null){a=config.sortForce;for(j=0;j0)$this.trigger("sorton",[config.sortList]);applyWidget(this)})}; this.addParser=function(parser){var i,l=parsers.length,a=true;for(i=0;i