template/html/jquery-tablesorter.js
function( c, cell, event ) {
         if ( c.table.isUpdating ) {
            // let any updates complete before initializing a sort
            return setTimeout( function(){
               ts.initSort( c, cell, event );
            }, 50 );
         }

         var arry, indx, headerIndx, dir, temp, tmp, $header,
          notMultiSort = !event[ c.sortMultiSortKey ],
          table = c.table,
          len = c.$headers.length,
         // get current column index
          col = parseInt( $( cell ).attr( 'data-column' ), 10 ),
          order = c.sortVars[ col ].order;

         // Only call sortStart if sorting is enabled
         c.$table.triggerHandler( 'sortStart', table );
         // get current column sort order
         c.sortVars[ col ].count =
          event[ c.sortResetKey ] ? 2 : ( c.sortVars[ col ].count + 1 ) % ( c.sortReset ? 3 : 2 );
         // reset all sorts on non-current column - issue #30
         if ( c.sortRestart ) {
            for ( headerIndx = 0; headerIndx < len; headerIndx++ ) {
               $header = c.$headers.eq( headerIndx );
               tmp = parseInt( $header.attr( 'data-column' ), 10 );
               // only reset counts on columns that weren't just clicked on and if not included in a multisort
               if ( col !== tmp && ( notMultiSort || $header.hasClass( ts.css.sortNone ) ) ) {
                  c.sortVars[ tmp ].count = -1;
               }
            }
         }
         // user only wants to sort on one column
         if ( notMultiSort ) {
            // flush the sort list
            c.sortList = [];
            c.last.sortList = [];
            if ( c.sortForce !== null ) {
               arry = c.sortForce;
               for ( indx = 0; indx < arry.length; indx++ ) {
                  if ( arry[ indx ][ 0 ] !== col ) {
                     c.sortList[ c.sortList.length ] = arry[ indx ];
                  }
               }
            }
            // add column to sort list
            dir = order[ c.sortVars[ col ].count ];
            if ( dir < 2 ) {
               c.sortList[ c.sortList.length ] = [ col, dir ];
               // add other columns if header spans across multiple
               if ( cell.colSpan > 1 ) {
                  for ( indx = 1; indx < cell.colSpan; indx++ ) {
                     c.sortList[ c.sortList.length ] = [ col + indx, dir ];
                     // update count on columns in colSpan
                     c.sortVars[ col + indx ].count = $.inArray( dir, order );
                  }
               }
            }
            // multi column sorting
         } else {
            // get rid of the sortAppend before adding more - fixes issue #115 & #523
            c.sortList = $.extend( [], c.last.sortList );

            // the user has clicked on an already sorted column
            if ( ts.isValueInArray( col, c.sortList ) >= 0 ) {
               // reverse the sorting direction
               for ( indx = 0; indx < c.sortList.length; indx++ ) {
                  tmp = c.sortList[ indx ];
                  if ( tmp[ 0 ] === col ) {
                     // order.count seems to be incorrect when compared to cell.count
                     tmp[ 1 ] = order[ c.sortVars[ col ].count ];
                     if ( tmp[1] === 2 ) {
                        c.sortList.splice( indx, 1 );
                        c.sortVars[ col ].count = -1;
                     }
                  }
               }
            } else {
               // add column to sort list array
               dir = order[ c.sortVars[ col ].count ];
               if ( dir < 2 ) {
                  c.sortList[ c.sortList.length ] = [ col, dir ];
                  // add other columns if header spans across multiple
                  if ( cell.colSpan > 1 ) {
                     for ( indx = 1; indx < cell.colSpan; indx++ ) {
                        c.sortList[ c.sortList.length ] = [ col + indx, dir ];
                        // update count on columns in colSpan
                        c.sortVars[ col + indx ].count = $.inArray( dir, order );
                     }
                  }
               }
            }
         }
         // save sort before applying sortAppend
         c.last.sortList = $.extend( [], c.sortList );
         if ( c.sortList.length && c.sortAppend ) {
            arry = $.isArray( c.sortAppend ) ? c.sortAppend : c.sortAppend[ c.sortList[ 0 ][ 0 ] ];
            if ( !ts.isEmptyObject( arry ) ) {
               for ( indx = 0; indx < arry.length; indx++ ) {
                  if ( arry[ indx ][ 0 ] !== col && ts.isValueInArray( arry[ indx ][ 0 ], c.sortList ) < 0 ) {
                     dir = arry[ indx ][ 1 ];
                     temp = ( '' + dir ).match( /^(a|d|s|o|n)/ );
                     if ( temp ) {
                        tmp = c.sortList[ 0 ][ 1 ];
                        switch ( temp[ 0 ] ) {
                           case 'd' :
                              dir = 1;
                              break;
                           case 's' :
                              dir = tmp;
                              break;
                           case 'o' :
                              dir = tmp === 0 ? 1 : 0;
                              break;
                           case 'n' :
                              dir = ( tmp + 1 ) % ( c.sortReset ? 3 : 2 );
                              break;
                           default:
                              dir = 0;
                              break;
                        }
                     }
                     c.sortList[ c.sortList.length ] = [ arry[ indx ][ 0 ], dir ];
                  }
               }
            }
         }
         // sortBegin event triggered immediately before the sort
         c.$table.triggerHandler( 'sortBegin', table );
         // setTimeout needed so the processing icon shows up
         setTimeout( function() {
            // set css for headers
            ts.setHeadersCss( c );
            ts.multisort( c );
            ts.appendCache( c );
            c.$table.triggerHandler( 'sortBeforeEnd', table );
            c.$table.triggerHandler( 'sortEnd', table );
         }, 1 );
      }
function( c, cell, event ) {
         if ( c.table.isUpdating ) {
            // let any updates complete before initializing a sort
            return setTimeout( function(){
               ts.initSort( c, cell, event );
            }, 50 );
         }

         var arry, indx, headerIndx, dir, temp, tmp, $header,
          notMultiSort = !event[ c.sortMultiSortKey ],
          table = c.table,
          len = c.$headers.length,
         // get current column index
          col = parseInt( $( cell ).attr( 'data-column' ), 10 ),
          order = c.sortVars[ col ].order;

         // Only call sortStart if sorting is enabled
         c.$table.triggerHandler( 'sortStart', table );
         // get current column sort order
         c.sortVars[ col ].count =
          event[ c.sortResetKey ] ? 2 : ( c.sortVars[ col ].count + 1 ) % ( c.sortReset ? 3 : 2 );
         // reset all sorts on non-current column - issue #30
         if ( c.sortRestart ) {
            for ( headerIndx = 0; headerIndx < len; headerIndx++ ) {
               $header = c.$headers.eq( headerIndx );
               tmp = parseInt( $header.attr( 'data-column' ), 10 );
               // only reset counts on columns that weren't just clicked on and if not included in a multisort
               if ( col !== tmp && ( notMultiSort || $header.hasClass( ts.css.sortNone ) ) ) {
                  c.sortVars[ tmp ].count = -1;
               }
            }
         }
         // user only wants to sort on one column
         if ( notMultiSort ) {
            // flush the sort list
            c.sortList = [];
            c.last.sortList = [];
            if ( c.sortForce !== null ) {
               arry = c.sortForce;
               for ( indx = 0; indx < arry.length; indx++ ) {
                  if ( arry[ indx ][ 0 ] !== col ) {
                     c.sortList[ c.sortList.length ] = arry[ indx ];
                  }
               }
            }
            // add column to sort list
            dir = order[ c.sortVars[ col ].count ];
            if ( dir < 2 ) {
               c.sortList[ c.sortList.length ] = [ col, dir ];
               // add other columns if header spans across multiple
               if ( cell.colSpan > 1 ) {
                  for ( indx = 1; indx < cell.colSpan; indx++ ) {
                     c.sortList[ c.sortList.length ] = [ col + indx, dir ];
                     // update count on columns in colSpan
                     c.sortVars[ col + indx ].count = $.inArray( dir, order );
                  }
               }
            }
            // multi column sorting
         } else {
            // get rid of the sortAppend before adding more - fixes issue #115 & #523
            c.sortList = $.extend( [], c.last.sortList );

            // the user has clicked on an already sorted column
            if ( ts.isValueInArray( col, c.sortList ) >= 0 ) {
               // reverse the sorting direction
               for ( indx = 0; indx < c.sortList.length; indx++ ) {
                  tmp = c.sortList[ indx ];
                  if ( tmp[ 0 ] === col ) {
                     // order.count seems to be incorrect when compared to cell.count
                     tmp[ 1 ] = order[ c.sortVars[ col ].count ];
                     if ( tmp[1] === 2 ) {
                        c.sortList.splice( indx, 1 );
                        c.sortVars[ col ].count = -1;
                     }
                  }
               }
            } else {
               // add column to sort list array
               dir = order[ c.sortVars[ col ].count ];
               if ( dir < 2 ) {
                  c.sortList[ c.sortList.length ] = [ col, dir ];
                  // add other columns if header spans across multiple
                  if ( cell.colSpan > 1 ) {
                     for ( indx = 1; indx < cell.colSpan; indx++ ) {
                        c.sortList[ c.sortList.length ] = [ col + indx, dir ];
                        // update count on columns in colSpan
                        c.sortVars[ col + indx ].count = $.inArray( dir, order );
                     }
                  }
               }
            }
         }
         // save sort before applying sortAppend
         c.last.sortList = $.extend( [], c.sortList );
         if ( c.sortList.length && c.sortAppend ) {
            arry = $.isArray( c.sortAppend ) ? c.sortAppend : c.sortAppend[ c.sortList[ 0 ][ 0 ] ];
            if ( !ts.isEmptyObject( arry ) ) {
               for ( indx = 0; indx < arry.length; indx++ ) {
                  if ( arry[ indx ][ 0 ] !== col && ts.isValueInArray( arry[ indx ][ 0 ], c.sortList ) < 0 ) {
                     dir = arry[ indx ][ 1 ];
                     temp = ( '' + dir ).match( /^(a|d|s|o|n)/ );
                     if ( temp ) {
                        tmp = c.sortList[ 0 ][ 1 ];
                        switch ( temp[ 0 ] ) {
                           case 'd' :
                              dir = 1;
                              break;
                           case 's' :
                              dir = tmp;
                              break;
                           case 'o' :
                              dir = tmp === 0 ? 1 : 0;
                              break;
                           case 'n' :
                              dir = ( tmp + 1 ) % ( c.sortReset ? 3 : 2 );
                              break;
                           default:
                              dir = 0;
                              break;
                        }
                     }
                     c.sortList[ c.sortList.length ] = [ arry[ indx ][ 0 ], dir ];
                  }
               }
            }
         }
         // sortBegin event triggered immediately before the sort
         c.$table.triggerHandler( 'sortBegin', table );
         // setTimeout needed so the processing icon shows up
         setTimeout( function() {
            // set css for headers
            ts.setHeadersCss( c );
            ts.multisort( c );
            ts.appendCache( c );
            c.$table.triggerHandler( 'sortBeforeEnd', table );
            c.$table.triggerHandler( 'sortEnd', table );
         }, 1 );
      }
/*
▄█████ ▄████▄ █████▄ ██████ ██ █████▄ ▄████▄
▀█▄    ██  ██ ██▄▄██   ██   ██ ██  ██ ██ ▄▄▄
▀█▄ ██  ██ ██▀██    ██   ██ ██  ██ ██ ▀██
█████▀ ▀████▀ ██  ██   ██   ██ ██  ██ ▀████▀