adding basit filtering functionality
authorCharles Holbrow <charlesholbrow@gmail.com>
Sat, 26 Jan 2013 01:10:58 +0000 (20:10 -0500)
committerCharles Holbrow <charlesholbrow@gmail.com>
Sat, 26 Jan 2013 01:10:58 +0000 (20:10 -0500)
karmaworld/assets/css/global.css
karmaworld/assets/css/table_sort.css
karmaworld/assets/js/jquery.tablesorter.min.js [changed mode: 0644->0755]
karmaworld/templates/courses/course_list.html

index 0f9e756728eced5bbb43b0e23f5a82810c0fc0c6..a0797a0079bcdd4b3e28c9d9634acd61af953313 100644 (file)
@@ -595,6 +595,13 @@ table#course_list th
   font-size: 12px;
 }
 
+/* hack - table sorter moves the th into a div */
+table#course_list th div
+{
+  font-family: "MuseoSlab-500";
+  font-size: 12px;
+}
+
 table#course_list td
 {
   font-family: "MuseoSlab-700";
index 41bcae3c5f37cbf34efe939e57fd9d00675089d9..331e456d9ce731cdabb338f5ee8e52d2e6d69568 100644 (file)
@@ -1,14 +1,73 @@
-table.tablesorter thead tr .header {
+table.tablesorter thead tr .tablesorter-header {
        background-image: url(/static/img/bg.gif);
        background-repeat: no-repeat;
        background-position: center right;
        cursor: pointer;
 }
 
-table.tablesorter thead tr .headerSortUp {
+table.tablesorter thead tr .tablesorter-headerAsc {
        background-image: url(/static/img/asc.gif);
 }
 
-table.tablesorter thead tr .headerSortDown {
+table.tablesorter thead tr .tablesorter-headerDesc {
        background-image: url(/static/img/desc.gif);
+}
+
+/* Below stolen from docs:*/
+
+/* filter row */ 
+.tablesorter-filter-row td { 
+  background: #eee; 
+  line-height: normal; 
+  text-align: center; /* center the input */ 
+  -webkit-transition: line-height 0.1s ease; 
+  -moz-transition: line-height 0.1s ease; 
+  -o-transition: line-height 0.1s ease; 
+  transition: line-height 0.1s ease; 
+} 
+/* optional disabled input styling */ 
+.tablesorter-filter-row .disabled { 
+  opacity: 0.5; 
+  filter: alpha(opacity=50); 
+  cursor: not-allowed; 
+} 
+/* hidden filter row */ 
+.tablesorter-filter-row.hideme td { 
+  /*** *********************************************** ***/ 
+  /*** change this padding to modify the thickness     ***/ 
+  /*** of the closed filter row (height = padding x 2) ***/ 
+  padding: 2px; 
+  /*** *********************************************** ***/ 
+  margin: 0; 
+  line-height: 0; 
+  cursor: pointer; 
+} 
+.tablesorter-filter-row.hideme .tablesorter-filter { 
+  height: 1px; 
+  min-height: 0; 
+  border: 0; 
+  padding: 0; 
+  margin: 0; 
+  /* don't use visibility: hidden because it disables tabbing */ 
+  opacity: 0; 
+  filter: alpha(opacity=0); 
+} 
+/* filters */ 
+.tablesorter-filter { 
+  width: 95%; 
+  height: inherit; 
+  margin: 4px; 
+  padding: 4px; 
+  background-color: #fff; 
+  border: 1px solid #bbb; 
+  color: #333; 
+  -webkit-box-sizing: border-box; 
+  -moz-box-sizing: border-box; 
+  box-sizing: border-box; 
+  -webkit-transition: height 0.1s ease; 
+  -moz-transition: height 0.1s ease; 
+  -o-transition: height 0.1s ease; 
+  transition: height 0.1s ease; 
 }
\ No newline at end of file
old mode 100644 (file)
new mode 100755 (executable)
index b8605df..34b2886
@@ -1,4 +1,5 @@
-
-(function($){$.extend({tablesorter:new
-function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,rows,-1,i);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,rows,rowIndex,cellIndex){var l=parsers.length,node=false,nodeValue=false,keepLooking=true;while(nodeValue==''&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node);if(table.config.debug){log('Checking if value was empty on row:'+rowIndex);}}else{keepLooking=false;}}for(var i=1;i<l;i++){if(parsers[i].is(nodeValue,table,node)){return parsers[i];}}return parsers[0];}function getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){return rows[rowIndex].cells[cellIndex];}function trimAndGetNodeText(config,node){return $.trim(getElementText(config,node));}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=$(table.tBodies[0].rows[i]),cols=[];if(c.hasClass(table.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue;}cache.row.push(c);for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j]),table,c[0].cells[j]));}cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};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 appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){var pos=n[i][checkCell];rows.push(r[pos]);if(!table.config.appender){var l=r[pos].length;for(var j=0;j<l;j++){tableBody[0].appendChild(r[pos][j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false;var header_index=computeTableHeaderCellIndexes(table);$tableHeaders=$(table.config.selectorHeaders,table).each(function(index){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(table.config.sortInitialOrder);this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(checkHeaderOptionsSortingLocked(table,index))this.order=this.lockedOrder=checkHeaderOptionsSortingLocked(table,index);if(!this.sortDisabled){var $th=$(this).addClass(table.config.cssHeader);if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function computeTableHeaderCellIndexes(t){var matrix=[];var lookup={};var thead=t.getElementsByTagName('THEAD')[0];var trs=thead.getElementsByTagName('TR');for(var i=0;i<trs.length;i++){var cells=trs[i].cells;for(var j=0;j<cells.length;j++){var c=cells[j];var rowIndex=c.parentNode.rowIndex;var cellId=rowIndex+"-"+c.cellIndex;var rowSpan=c.rowSpan||1;var colSpan=c.colSpan||1
-var firstAvailCol;if(typeof(matrix[rowIndex])=="undefined"){matrix[rowIndex]=[];}for(var k=0;k<matrix[rowIndex].length+1;k++){if(typeof(matrix[rowIndex][k])=="undefined"){firstAvailCol=k;break;}}lookup[cellId]=firstAvailCol;for(var k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(matrix[k])=="undefined"){matrix[k]=[];}var matrixrow=matrix[k];for(var l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x";}}}}return lookup;}function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){return(v.toLowerCase()=="desc")?1:0;}else{return(v==1)?1:0;}}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(table.config.parsers[c].type=="text")?((order==0)?makeSortFunction("text","asc",c):makeSortFunction("text","desc",c)):((order==0)?makeSortFunction("numeric","asc",c):makeSortFunction("numeric","desc",c));var e="e"+i;dynamicExp+="var "+e+" = "+s;dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";if(table.config.debug){benchmark("Evaling expression:"+dynamicExp,new Date());}eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function makeSortFunction(type,direction,index){var a="a["+index+"]",b="b["+index+"]";if(type=='text'&&direction=='asc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+a+" < "+b+") ? -1 : 1 )));";}else if(type=='text'&&direction=='desc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+b+" < "+a+") ? -1 : 1 )));";}else if(type=='numeric'&&direction=='asc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+a+" - "+b+"));";}else if(type=='numeric'&&direction=='desc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+b+" - "+a+"));";}};function makeSortText(i){return"((a["+i+"] < b["+i+"]) ? -1 : ((a["+i+"] > b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){var me=this;setTimeout(function(){me.config.parsers=buildParserCache(me,$headers);cache=buildCache(me);},1);}).bind("updateCell",function(e,cell){var config=this.config;var pos=[(cell.parentNode.rowIndex-1),cell.cellIndex];cache.normalized[pos[0]][pos[1]]=config.parsers[pos[1]].format(getElementText(config,cell),cell);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){return/^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g,'')));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLocaleLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g),""));},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);},format:function(s){var a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0");},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat=="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");}else if(c.dateFormat=="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");}else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime());},type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}var $tr,row=-1,odd;$("tr:visible",table.tBodies[0]).each(function(i){$tr=$(this);if(!$tr.hasClass(table.config.cssChildRow))row++;odd=(row%2==0);$tr.removeClass(table.config.widgetZebra.css[odd?0:1]).addClass(table.config.widgetZebra.css[odd?1:0])});if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);
\ No newline at end of file
+/*!
+* TableSorter 2.7.3 min - Client-side table sorting with ease!
+* Copyright (c) 2007 Christian Bach
+*/
+!function(j){j.extend({tablesorter:new function(){function e(c){"undefined"!==typeof console&&"undefined"!==typeof console.log?console.log(c):alert(c)}function u(c,d){e(c+" ("+((new Date).getTime()-d.getTime())+"ms)")}function p(c,d,a){if(!d)return"";var b=c.config,g=b.textExtraction,f="",f="simple"===g?b.supportsTextContent?d.textContent:j(d).text():"function"===typeof g?g(d,c,a):"object"===typeof g&&g.hasOwnProperty(a)?g[a](d,c,a):b.supportsTextContent?d.textContent:j(d).text();return j.trim(f)} function h(c){var d=c.config,a=d.$tbodies,b,q,f,l,j,n,k="";if(0===a.length)return d.debug?e("*Empty table!* Not building a parser cache"):"";a=a[0].rows;if(a[0]){b=[];q=a[0].cells.length;for(f=0;f<q;f++){l=d.$headers.filter(":not([colspan])");l=l.add(d.$headers.filter('[colspan="1"]')).filter('[data-column="'+f+'"]:last');j=d.headers[f];n=g.getParserById(g.getData(l,j,"sorter"));d.empties[f]=g.getData(l,j,"empty")||d.emptyTo||(d.emptyToBottom?"bottom":"top");d.strings[f]=g.getData(l,j,"string")|| d.stringTo||"max";if(!n)a:{l=c;j=a;n=-1;for(var u=f,x=void 0,t=g.parsers.length,y=!1,m="",x=!0;""===m&&x;)n++,j[n]?(y=j[n].cells[u],m=p(l,y,u),l.config.debug&&e("Checking if value was empty on row "+n+", column: "+u+": "+m)):x=!1;for(x=1;x<t;x++)if(g.parsers[x].is(m,l,y)){n=g.parsers[x];break a}n=g.parsers[0]}d.debug&&(k+="column:"+f+"; parser:"+n.id+"; string:"+d.strings[f]+"; empty: "+d.empties[f]+"\n");b.push(n)}}d.debug&&e(k);return b}function s(c){var d=c.tBodies,a=c.config,b,q,f=a.parsers,l, v,n,k,h,x,t,m=[];a.cache={};if(!f)return a.debug?e("*Empty table!* Not building a cache"):"";a.debug&&(t=new Date);a.showProcessing&&g.isProcessing(c,!0);for(k=0;k<d.length;k++)if(a.cache[k]={row:[],normalized:[]},!j(d[k]).hasClass(a.cssInfoBlock)){b=d[k]&&d[k].rows.length||0;q=d[k].rows[0]&&d[k].rows[0].cells.length||0;for(v=0;v<b;++v)if(h=j(d[k].rows[v]),x=[],h.hasClass(a.cssChildRow))a.cache[k].row[a.cache[k].row.length-1]=a.cache[k].row[a.cache[k].row.length-1].add(h);else{a.cache[k].row.push(h); for(n=0;n<q;++n)if(l=p(c,h[0].cells[n],n),l=f[n].format(l,c,h[0].cells[n],n),x.push(l),"numeric"===(f[n].type||"").toLowerCase())m[n]=Math.max(Math.abs(l),m[n]||0);x.push(a.cache[k].normalized.length);a.cache[k].normalized.push(x)}a.cache[k].colMax=m}a.showProcessing&&g.isProcessing(c);a.debug&&u("Building cache for "+b+" rows",t)}function m(c,d){var a=c.config,b=c.tBodies,q=[],f=a.cache,e,v,n,k,h,p,m,y,s,r,E;if(f[0]){a.debug&&(E=new Date);for(y=0;y<b.length;y++)if(e=j(b[y]),!e.hasClass(a.cssInfoBlock)){h= g.processTbody(c,e,!0);e=f[y].row;v=f[y].normalized;k=(n=v.length)?v[0].length-1:0;for(p=0;p<n;p++)if(r=v[p][k],q.push(e[r]),!a.appender||!a.removeRows){s=e[r].length;for(m=0;m<s;m++)h.append(e[r][m])}g.processTbody(c,h,!1)}a.appender&&a.appender(c,q);a.debug&&u("Rebuilt table",E);d||g.applyWidget(c);j(c).trigger("sortEnd",c)}}function F(c){var d,a,b,g=c.config,f=g.sortList,e=[g.cssAsc,g.cssDesc],h=j(c).find("tfoot tr").children().removeClass(e.join(" "));g.$headers.removeClass(e.join(" "));b=f.length; for(d=0;d<b;d++)if(2!==f[d][1]&&(c=g.$headers.not(".sorter-false").filter('[data-column="'+f[d][0]+'"]'+(1===b?":last":"")),c.length))for(a=0;a<c.length;a++)c[a].sortDisabled||(c.eq(a).addClass(e[f[d][1]]),h.length&&h.filter('[data-column="'+f[d][0]+'"]').eq(a).addClass(e[f[d][1]]))}function G(c){var d=0,a=c.config,b=a.sortList,g=b.length,f=c.tBodies.length,e,h,n,k,p,m,t,r,s;if(!a.serverSideSorting&&a.cache[0]){a.debug&&(e=new Date);for(n=0;n<f;n++)p=a.cache[n].colMax,s=(m=a.cache[n].normalized)&& m[0]?m[0].length-1:0,m.sort(function(f,e){for(h=0;h<g;h++){k=b[h][0];r=b[h][1];t=/n/i.test(a.parsers&&a.parsers[k]?a.parsers[k].type||"":"")?"Numeric":"Text";t+=0===r?"":"Desc";/Numeric/.test(t)&&a.strings[k]&&(d="boolean"===typeof a.string[a.strings[k]]?(0===r?1:-1)*(a.string[a.strings[k]]?-1:1):a.strings[k]?a.string[a.strings[k]]||0:0);var l=j.tablesorter["sort"+t](c,f[k],e[k],k,p[k],d);if(l)return l}return f[s]-e[s]});a.debug&&u("Sorting on "+b.toString()+" and dir "+r+" time",e)}}function C(c, d){c.trigger("updateComplete");"function"===typeof d&&d(c[0])}function H(c,d,a){!1!==d?c.trigger("sorton",[c[0].config.sortList,function(){C(c,a)}]):C(c,a)}var g=this;g.version="2.7.3";g.parsers=[];g.widgets=[];g.defaults={theme:"default",widthFixed:!1,showProcessing:!1,headerTemplate:"{content}",onRenderTemplate:null,onRenderHeader:null,cancelSelection:!0,dateFormat:"mmddyyyy",sortMultiSortKey:"shiftKey",sortResetKey:"ctrlKey",usNumberFormat:!0,delayInit:!1,serverSideSorting:!1,headers:{},ignoreCase:!0, sortForce:null,sortList:[],sortAppend:null,sortInitialOrder:"asc",sortLocaleCompare:!1,sortReset:!1,sortRestart:!1,emptyTo:"bottom",stringTo:"max",textExtraction:"simple",textSorter:null,widgets:[],widgetOptions:{zebra:["even","odd"]},initWidgets:!0,initialized:null,tableClass:"tablesorter",cssAsc:"tablesorter-headerAsc",cssChildRow:"tablesorter-childRow",cssDesc:"tablesorter-headerDesc",cssHeader:"tablesorter-header",cssHeaderRow:"tablesorter-headerRow",cssIcon:"tablesorter-icon",cssInfoBlock:"tablesorter-infoOnly", cssProcessing:"tablesorter-processing",selectorHeaders:"> thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};g.benchmark=u;g.construct=function(c){return this.each(function(){if(!this.tHead||0===this.tBodies.length||!0===this.hasInitialized)return this.config.debug?e("stopping initialization! No thead, tbody or tablesorter has already been initialized"):"";var d=j(this),a=this,b,q,f,l="",v,n,k,C,x=j.metadata;a.hasInitialized= !1;a.config={};b=j.extend(!0,a.config,g.defaults,c);j.data(a,"tablesorter",b);b.debug&&j.data(a,"startoveralltimer",new Date);b.supportsTextContent="x"===j("<span>x</span>")[0].textContent;b.supportsDataObject=1.4<=parseFloat(j.fn.jquery);b.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:!0,bottom:!1};/tablesorter\-/.test(d.attr("class"))||(l=""!==b.theme?" tablesorter-"+b.theme:"");b.$table=d.addClass(b.tableClass+l);b.$tbodies=d.children("tbody:not(."+b.cssInfoBlock+")");var t= [],y={},Q=j(a).find("thead:eq(0), tfoot").children("tr"),K,E,z,A,O,D,L,R,S,I;for(K=0;K<Q.length;K++){O=Q[K].cells;for(E=0;E<O.length;E++){A=O[E];D=A.parentNode.rowIndex;L=D+"-"+A.cellIndex;R=A.rowSpan||1;S=A.colSpan||1;"undefined"===typeof t[D]&&(t[D]=[]);for(z=0;z<t[D].length+1;z++)if("undefined"===typeof t[D][z]){I=z;break}y[L]=I;j(A).attr({"data-column":I});for(z=D;z<D+R;z++){"undefined"===typeof t[z]&&(t[z]=[]);L=t[z];for(A=I;A<I+S;A++)L[A]="x"}}}var M,B,P,T,N,J,U,w=a.config;w.headerList=[];w.headerContent= [];w.debug&&(U=new Date);T=w.cssIcon?'<i class="'+w.cssIcon+'"></i>':"";t=j(a).find(w.selectorHeaders).each(function(a){B=j(this);M=w.headers[a];w.headerContent[a]=this.innerHTML;N=w.headerTemplate.replace(/\{content\}/g,this.innerHTML).replace(/\{icon\}/g,T);w.onRenderTemplate&&(P=w.onRenderTemplate.apply(B,[a,N]))&&"string"===typeof P&&(N=P);this.innerHTML='<div class="tablesorter-header-inner">'+N+"</div>";w.onRenderHeader&&w.onRenderHeader.apply(B,[a]);this.column=y[this.parentNode.rowIndex+"-"+ this.cellIndex];var b=g.getData(B,M,"sortInitialOrder")||w.sortInitialOrder;this.order=/^d/i.test(b)||1===b?[1,0,2]:[0,1,2];this.count=-1;"false"===g.getData(B,M,"sorter")?(this.sortDisabled=!0,B.addClass("sorter-false")):B.removeClass("sorter-false");this.lockedOrder=!1;J=g.getData(B,M,"lockedOrder")||!1;"undefined"!==typeof J&&!1!==J&&(this.order=this.lockedOrder=/^d/i.test(J)||1===J?[1,1,1]:[0,0,0]);B.addClass((this.sortDisabled?"sorter-false ":" ")+w.cssHeader);w.headerList[a]=this;B.parent().addClass(w.cssHeaderRow)}); a.config.debug&&(u("Built headers:",U),e(t));b.$headers=t;b.parsers=h(a);b.delayInit||s(a);b.$headers.find("*").andSelf().filter(b.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter").bind("mousedown.tablesorter mouseup.tablesorter",function(c,e){var h=(this.tagName.match("TH|TD")?j(this):j(this).parents("th, td").filter(":last"))[0];if(1!==(c.which||c.button))return!1;if("mousedown"===c.type)return C=(new Date).getTime(),"INPUT"===c.target.tagName?"":!b.cancelSelection;if(!0!==e&&250< (new Date).getTime()-C)return!1;b.delayInit&&!b.cache&&s(a);if(!h.sortDisabled){d.trigger("sortStart",a);l=!c[b.sortMultiSortKey];h.count=c[b.sortResetKey]?2:(h.count+1)%(b.sortReset?3:2);b.sortRestart&&(q=h,b.$headers.each(function(){if(this!==q&&(l||!j(this).is("."+b.cssDesc+",."+b.cssAsc)))this.count=-1}));q=h.column;if(l){b.sortList=[];if(null!==b.sortForce){v=b.sortForce;for(f=0;f<v.length;f++)v[f][0]!==q&&b.sortList.push(v[f])}k=h.order[h.count];if(2>k&&(b.sortList.push([q,k]),1<h.colSpan))for(f= 1;f<h.colSpan;f++)b.sortList.push([q+f,k])}else if(b.sortAppend&&1<b.sortList.length&&g.isValueInArray(b.sortAppend[0][0],b.sortList)&&b.sortList.pop(),g.isValueInArray(q,b.sortList))for(f=0;f<b.sortList.length;f++)n=b.sortList[f],k=b.headerList[n[0]],n[0]===q&&(n[1]=k.order[k.count],2===n[1]&&(b.sortList.splice(f,1),k.count=-1));else if(k=h.order[h.count],2>k&&(b.sortList.push([q,k]),1<h.colSpan))for(f=1;f<h.colSpan;f++)b.sortList.push([q+f,k]);if(null!==b.sortAppend){v=b.sortAppend;for(f=0;f<v.length;f++)v[f][0]!== q&&b.sortList.push(v[f])}d.trigger("sortBegin",a);setTimeout(function(){F(a);G(a);m(a)},1)}});b.cancelSelection&&b.$headers.each(function(){this.onselectstart=function(){return!1}});d.unbind("sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave").bind("sortReset",function(){b.sortList=[];F(a);G(a);m(a)}).bind("update",function(c,f,g){j(b.selectorRemove,a).remove();b.parsers=h(a);s(a);H(d,f,g)}).bind("updateCell",function(c,f,g, e){var q,h,l;q=d.find("tbody");c=q.index(j(f).parents("tbody").filter(":last"));var k=j(f).parents("tr").filter(":last");f=j(f)[0];q.length&&0<=c&&(h=q.eq(c).find("tr").index(k),l=f.cellIndex,q=a.config.cache[c].normalized[h].length-1,a.config.cache[c].row[a.config.cache[c].normalized[h][q]]=k,a.config.cache[c].normalized[h][l]=b.parsers[l].format(p(a,f,l),a,f,l),H(d,g,e))}).bind("addRows",function(c,g,e,q){var j=g.filter("tr").length,l=[],k=g[0].cells.length,n=d.find("tbody").index(g.closest("tbody")); b.parsers||(b.parsers=h(a));for(c=0;c<j;c++){for(f=0;f<k;f++)l[f]=b.parsers[f].format(p(a,g[c].cells[f],f),a,g[c].cells[f],f);l.push(b.cache[n].row.length);b.cache[n].row.push([g[c]]);b.cache[n].normalized.push(l);l=[]}H(d,e,q)}).bind("sorton",function(b,c,f,g){d.trigger("sortStart",this);var e,q,l,h=a.config;b=c||h.sortList;h.sortList=[];j.each(b,function(a,b){e=[parseInt(b[0],10),parseInt(b[1],10)];if(l=h.headerList[e[0]])h.sortList.push(e),q=j.inArray(e[1],l.order),l.count=0<=q?q:e[1]%(h.sortReset? 3:2)});F(a);G(a);m(a,g);"function"===typeof f&&f(a)}).bind("appendCache",function(b,c,d){m(a,d);"function"===typeof c&&c(a)}).bind("applyWidgetId",function(c,d){g.getWidgetById(d).format(a,b,b.widgetOptions)}).bind("applyWidgets",function(b,c){g.applyWidget(a,c)}).bind("refreshWidgets",function(b,c,d){g.refreshWidgets(a,c,d)}).bind("destroy",function(b,c,d){g.destroy(a,c,d)});b.supportsDataObject&&"undefined"!==typeof d.data().sortlist?b.sortList=d.data().sortlist:x&&(d.metadata()&&d.metadata().sortlist)&& (b.sortList=d.metadata().sortlist);g.applyWidget(a,!0);0<b.sortList.length?d.trigger("sorton",[b.sortList,{},!b.initWidgets]):b.initWidgets&&g.applyWidget(a);if(a.config.widthFixed&&0===j(a).find("colgroup").length){var V=j("<colgroup>"),W=j(a).width();j("tr:first td",a.tBodies[0]).each(function(){V.append(j("<col>").css("width",parseInt(1E3*(j(this).width()/W),10)/10+"%"))});j(a).prepend(V)}b.showProcessing&&d.unbind("sortBegin sortEnd").bind("sortBegin sortEnd",function(b){g.isProcessing(a,"sortBegin"=== b.type)});a.hasInitialized=!0;b.debug&&g.benchmark("Overall initialization time",j.data(a,"startoveralltimer"));d.trigger("tablesorter-initialized",a);"function"===typeof b.initialized&&b.initialized(a)})};g.isProcessing=function(c,d,a){var b=c.config;c=a||j(c).find("."+b.cssHeader);d?(0<b.sortList.length&&(c=c.filter(function(){return this.sortDisabled?!1:g.isValueInArray(parseFloat(j(this).attr("data-column")),b.sortList)})),c.addClass(b.cssProcessing)):c.removeClass(b.cssProcessing)};g.processTbody= function(c,d,a){if(a)return d.before('<span class="tablesorter-savemyplace"/>'),c=j.fn.detach?d.detach():d.remove();c=j(c).find("span.tablesorter-savemyplace");d.insertAfter(c);c.remove()};g.clearTableBody=function(c){c.config.$tbodies.empty()};g.destroy=function(c,d,a){if(c.hasInitialized){g.refreshWidgets(c,!0,!0);var b=j(c),e=c.config,f=b.find("thead:first"),h=f.find("tr."+e.cssHeaderRow).removeClass(e.cssHeaderRow),u=b.find("tfoot:first > tr").children("th, td");f.find("tr").not(h).remove();b.removeData("tablesorter").unbind("sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave"); e.$headers.add(u).removeClass(e.cssHeader+" "+e.cssAsc+" "+e.cssDesc).removeAttr("data-column");h.find(e.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter");h.children().each(function(a){j(this).html(e.headerContent[a])});!1!==d&&b.removeClass(e.tableClass+" tablesorter-"+e.theme);c.hasInitialized=!1;"function"===typeof a&&a(c)}};g.regex=[/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/, /^0x[0-9a-f]+$/i];g.sortText=function(c,d,a,b){if(d===a)return 0;var e=c.config,f=e.string[e.empties[b]||e.emptyTo],h=g.regex;if(""===d&&0!==f)return"boolean"===typeof f?f?-1:1:-f||-1;if(""===a&&0!==f)return"boolean"===typeof f?f?1:-1:f||1;if("function"===typeof e.textSorter)return e.textSorter(d,a,c,b);c=d.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");b=a.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");d=parseInt(d.match(h[2]),16)||1!==c.length&& d.match(h[1])&&Date.parse(d);if(a=parseInt(a.match(h[2]),16)||d&&a.match(h[1])&&Date.parse(a)||null){if(d<a)return-1;if(d>a)return 1}e=Math.max(c.length,b.length);for(d=0;d<e;d++){a=isNaN(c[d])?c[d]||0:parseFloat(c[d])||0;h=isNaN(b[d])?b[d]||0:parseFloat(b[d])||0;if(isNaN(a)!==isNaN(h))return isNaN(a)?1:-1;typeof a!==typeof h&&(a+="",h+="");if(a<h)return-1;if(a>h)return 1}return 0};g.sortTextDesc=function(c,d,a,b){if(d===a)return 0;var e=c.config,f=e.string[e.empties[b]||e.emptyTo];return""===d&& 0!==f?"boolean"===typeof f?f?-1:1:f||1:""===a&&0!==f?"boolean"===typeof f?f?1:-1:-f||-1:"function"===typeof e.textSorter?e.textSorter(a,d,c,b):g.sortText(c,a,d)};g.getTextValue=function(c,d,a){if(d){var b=c.length,e=d+a;for(d=0;d<b;d++)e+=c.charCodeAt(d);return a*e}return 0};g.sortNumeric=function(c,d,a,b,e,f){if(d===a)return 0;c=c.config;b=c.string[c.empties[b]||c.emptyTo];if(""===d&&0!==b)return"boolean"===typeof b?b?-1:1:-b||-1;if(""===a&&0!==b)return"boolean"===typeof b?b?1:-1:b||1;isNaN(d)&& (d=g.getTextValue(d,e,f));isNaN(a)&&(a=g.getTextValue(a,e,f));return d-a};g.sortNumericDesc=function(c,d,a,b,e,f){if(d===a)return 0;c=c.config;b=c.string[c.empties[b]||c.emptyTo];if(""===d&&0!==b)return"boolean"===typeof b?b?-1:1:b||1;if(""===a&&0!==b)return"boolean"===typeof b?b?1:-1:-b||-1;isNaN(d)&&(d=g.getTextValue(d,e,f));isNaN(a)&&(a=g.getTextValue(a,e,f));return a-d};g.characterEquivalents={a:"\u00e1\u00e0\u00e2\u00e3\u00e4\u0105\u00e5",A:"\u00c1\u00c0\u00c2\u00c3\u00c4\u0104\u00c5",c:"\u00e7\u0107\u010d", C:"\u00c7\u0106\u010c",e:"\u00e9\u00e8\u00ea\u00eb\u011b\u0119",E:"\u00c9\u00c8\u00ca\u00cb\u011a\u0118",i:"\u00ed\u00ec\u0130\u00ee\u00ef\u0131",I:"\u00cd\u00cc\u0130\u00ce\u00cf",o:"\u00f3\u00f2\u00f4\u00f5\u00f6",O:"\u00d3\u00d2\u00d4\u00d5\u00d6",ss:"\u00df",SS:"\u1e9e",u:"\u00fa\u00f9\u00fb\u00fc\u016f",U:"\u00da\u00d9\u00db\u00dc\u016e"};g.replaceAccents=function(c){var d,a="[",b=g.characterEquivalents;if(!g.characterRegex){g.characterRegexArray={};for(d in b)"string"===typeof d&&(a+=b[d],g.characterRegexArray[d]= RegExp("["+b[d]+"]","g"));g.characterRegex=RegExp(a+"]")}if(g.characterRegex.test(c))for(d in b)"string"===typeof d&&(c=c.replace(g.characterRegexArray[d],d));return c};g.isValueInArray=function(c,d){var a,b=d.length;for(a=0;a<b;a++)if(d[a][0]===c)return!0;return!1};g.addParser=function(c){var d,a=g.parsers.length,b=!0;for(d=0;d<a;d++)g.parsers[d].id.toLowerCase()===c.id.toLowerCase()&&(b=!1);b&&g.parsers.push(c)};g.getParserById=function(c){var d,a=g.parsers.length;for(d=0;d<a;d++)if(g.parsers[d].id.toLowerCase()=== c.toString().toLowerCase())return g.parsers[d];return!1};g.addWidget=function(c){g.widgets.push(c)};g.getWidgetById=function(c){var d,a,b=g.widgets.length;for(d=0;d<b;d++)if((a=g.widgets[d])&&a.hasOwnProperty("id")&&a.id.toLowerCase()===c.toLowerCase())return a};g.applyWidget=function(c,d){var a=c.config,b=a.widgetOptions,e=a.widgets.sort().reverse(),f,h,m,n=e.length;h=j.inArray("zebra",a.widgets);0<=h&&(a.widgets.splice(h,1),a.widgets.push("zebra"));a.debug&&(f=new Date);for(h=0;h<n;h++)(m=g.getWidgetById(e[h]))&& (!0===d&&m.hasOwnProperty("init")?m.init(c,m,a,b):!d&&m.hasOwnProperty("format")&&m.format(c,a,b));a.debug&&u("Completed "+(!0===d?"initializing":"applying")+" widgets",f)};g.refreshWidgets=function(c,d,a){var b,h=c.config,f=h.widgets,l=g.widgets,m=l.length;for(b=0;b<m;b++)if(l[b]&&l[b].id&&(d||0>j.inArray(l[b].id,f)))h.debug&&e("Refeshing widgets: Removing "+l[b].id),l[b].hasOwnProperty("remove")&&l[b].remove(c,h,h.widgetOptions);!0!==a&&g.applyWidget(c,d)};g.getData=function(c,d,a){var b="";c=j(c); var e,f;if(!c.length)return"";e=j.metadata?c.metadata():!1;f=" "+(c.attr("class")||"");"undefined"!==typeof c.data(a)||"undefined"!==typeof c.data(a.toLowerCase())?b+=c.data(a)||c.data(a.toLowerCase()):e&&"undefined"!==typeof e[a]?b+=e[a]:d&&"undefined"!==typeof d[a]?b+=d[a]:" "!==f&&f.match(" "+a+"-")&&(b=f.match(RegExp(" "+a+"-(\\w+)"))[1]||"");return j.trim(b)};g.formatFloat=function(c,d){if("string"!==typeof c||""===c)return c;var a;c=(d&&d.config?!1!==d.config.usNumberFormat:"undefined"!==typeof d? d:1)?c.replace(/,/g,""):c.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(c)&&(c=c.replace(/^\s*\(/,"-").replace(/\)/,""));a=parseFloat(c);return isNaN(a)?j.trim(c):a};g.isDigit=function(c){return isNaN(c)?/^[\-+(]?\d+[)]?$/.test(c.toString().replace(/[,.'"\s]/g,"")):!0}}});var h=j.tablesorter;j.fn.extend({tablesorter:h.construct});h.addParser({id:"text",is:function(){return!0},format:function(e,u){var p=u.config;e=j.trim(p.ignoreCase?e.toLocaleLowerCase():e);return p.sortLocaleCompare? h.replaceAccents(e):e},type:"text"});h.addParser({id:"currency",is:function(e){return/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/.test(e)},format:function(e,j){return h.formatFloat(e.replace(/[^\w,. \-()]/g,""),j)},type:"numeric"});h.addParser({id:"ipAddress",is:function(e){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(e)},format:function(e,j){var p,r=e.split("."),s="",m=r.length;for(p=0;p<m;p++)s+=("00"+r[p]).slice(-3);return h.formatFloat(s,j)}, type:"numeric"});h.addParser({id:"url",is:function(e){return/^(https?|ftp|file):\/\//.test(e)},format:function(e){return j.trim(e.replace(/(https?|ftp|file):\/\//,""))},type:"text"});h.addParser({id:"isoDate",is:function(e){return/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(e)},format:function(e,j){return h.formatFloat(""!==e?(new Date(e.replace(/-/g,"/"))).getTime()||"":"",j)},type:"numeric"});h.addParser({id:"percent",is:function(e){return/(\d\s?%|%\s?\d)/.test(e)},format:function(e,j){return h.formatFloat(e.replace(/%/g, ""),j)},type:"numeric"});h.addParser({id:"usLongDate",is:function(e){return/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i.test(e)},format:function(e,j){return h.formatFloat((new Date(e.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",j)},type:"numeric"});h.addParser({id:"shortDate",is:function(e){return/^(\d{1,2}|\d{4})[\/\-\,\.\s+]\d{1,2}[\/\-\.\,\s+](\d{1,2}|\d{4})$/.test(e)},format:function(e,j,p,r){p=j.config;var s=p.headerList[r],m=s.shortDateFormat;"undefined"=== typeof m&&(m=s.shortDateFormat=h.getData(s,p.headers[r],"dateFormat")||p.dateFormat);e=e.replace(/\s+/g," ").replace(/[\-|\.|\,]/g,"/");"mmddyyyy"===m?e=e.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$1/$2"):"ddmmyyyy"===m?e=e.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$2/$1"):"yyyymmdd"===m&&(e=e.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,"$1/$2/$3"));return h.formatFloat((new Date(e)).getTime()||"",j)},type:"numeric"});h.addParser({id:"time",is:function(e){return/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i.test(e)}, format:function(e,j){return h.formatFloat((new Date("2000/01/01 "+e.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",j)},type:"numeric"});h.addParser({id:"digit",is:function(e){return h.isDigit(e)},format:function(e,j){return h.formatFloat(e.replace(/[^\w,. \-()]/g,""),j)},type:"numeric"});h.addParser({id:"metadata",is:function(){return!1},format:function(e,h,p){e=h.config;e=!e.parserMetadataName?"sortValue":e.parserMetadataName;return j(p).metadata()[e]},type:"numeric"});h.addWidget({id:"zebra", format:function(e,u,p){var r,s,m,F,G,C,H=RegExp(u.cssChildRow,"i"),g=u.$tbodies;u.debug&&(G=new Date);for(e=0;e<g.length;e++)r=g.eq(e),C=r.children("tr").length,1<C&&(m=0,r=r.children("tr:visible"),r.each(function(){s=j(this);H.test(this.className)||m++;F=0===m%2;s.removeClass(p.zebra[F?1:0]).addClass(p.zebra[F?0:1])}));u.debug&&h.benchmark("Applying Zebra widget",G)},remove:function(e,h){var p,r,s=h.$tbodies,m=(h.widgetOptions.zebra||["even","odd"]).join(" ");for(p=0;p<s.length;p++)r=j.tablesorter.processTbody(e, s.eq(p),!0),r.children().removeClass(m),j.tablesorter.processTbody(e,r,!1)}})}(jQuery);
index 535fd132125db408cf097e2a5f0124a786e2a159..fa71d4260fd81a8fdc1c85a6699644b912151826 100644 (file)
 {% block pagescripts %}
 <script src="stylesheet" href="{{ STATIC_URL }}/js/responsive-tables.js"></script>
 <script src="{{ STATIC_URL }}/js/jquery.tablesorter.min.js"></script>
+<script src="{{ STATIC_URL }}/js/jquery.tablesorter.widgets.min.js"></script>
 <script>
 $(document).ready(function()
-    {
-        $("#course_list").tablesorter();
+{
+  $("#course_list").tablesorter(
+  {
+    widgets: ["filter", "zebra"], 
+    headers: { 3: { filter: false, sorter: true }, 4: { filter: false, sorter: true } },
+    widgetOptions : 
+    { 
+      // This isn't working how I hoped. It appears that tablesorter isn't actually changing the 
+      // even odd in accordance with the filter 
+      zebra : [ "odd", "even" ],
+
+      //Resizable widget: If this option is set to false, resized column widths will not be saved. 
+      //Previous saved values will be restored on page reload. 
+      resizable: false, 
+
+      // If there are child rows in the table (rows with class name from "cssChildRow" option) 
+      // and this option is true and a match is found anywhere in the child row, then it will make that row 
+      // visible; default is false 
+      filter_childRows : false, 
+      // if true, a filter will be added to the top of each table column; 
+      // disabled by using -> headers: { 1: { filter: false } } OR add class="filter-false" 
+      // if you set this to false, make sure you perform a search using the second method below 
+      filter_columnFilters : true, 
+
+      // css class applied to the table row containing the filters & the inputs within that row 
+      //filter_cssFilter : 'tablesorter-filter', 
+      // add custom filter functions using this option 
+      // see the filter widget custom demo for more specifics on how to use this option 
+      filter_functions : null, 
+      // if true, filters are collapsed initially, but can be revealed by hovering over the grey bar immediately 
+      // below the header row. Additionally, tabbing through the document will open the filter row when an input gets focus 
+      filter_hideFilters : false, 
+      // Set this option to false to make the searches case sensitive 
+      filter_ignoreCase : true, 
+      // jQuery selector string of an element used to reset the filters 
+      filter_reset : 'button.reset', 
+      // Delay in milliseconds before the filter widget starts searching; This option prevents searching for 
+      // every character while typing and should make searching large tables faster. 
+      filter_searchDelay : 150, 
+      // Set this option to true to use the filter to find text from the start of the column 
+      // So typing in "a" will find "albert" but not "frank", both have a's; default is false 
+      filter_startsWith : false, 
+      // Filter using parsed content for ALL columns 
+      // be careful on using this on date columns as the date is parsed and stored as time in seconds 
+      filter_useParsedData : false 
     }
-);
-console.log('tablesorter called');
+  });
+});
+
+console.log('tablesorter finished');
 </script>
 {% endblock %}