resources/src/jquery.tablesorter/jquery.tablesorter.js
File jquery.tablesorter.js
has 879 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* TableSorter for MediaWiki
*
* Written 2011 Leo Koppelkamm
* Based on tablesorter.com plugin, written (c) 2007 Christian Bach.
Function construct
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
construct: function ( $tables, settings ) {
return $tables.each( function ( i, table ) {
// Declare and cache.
var cache,
$table = $( table ),
Function explodeRowspans
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function explodeRowspans( $table ) {
var spanningRealCellIndex, colSpan,
rowspanCells = $table.find( '> tbody > tr > [rowspan]' ).get();
// Short circuit
Function buildHeaders
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function buildHeaders( table, msg ) {
var config = $( table ).data( 'tablesorter' ).config,
maxSeen = 0,
colspanOffset = 0,
$tableHeaders = $( [] ),
Function detectParserForColumn
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function detectParserForColumn( table, rows, column ) {
var l = parsers.length,
config = $( table ).data( 'tablesorter' ).config,
nextRow = false,
// Start with 1 because 0 is the fallback parser
Function format
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
format: function ( s ) {
s = s.toLowerCase();
var match;
if ( ( match = s.match( ts.dateRegex[ 0 ] ) ) !== null ) {
Function getElementSortKey
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getElementSortKey( node ) {
// Browse the node to build the raw sort key, which will then be normalized.
function buildRawSortKey( currentNode ) {
// Get data-sort-value attribute. Uses jQuery to allow live value
// changes from other code paths via data(), which reside only in jQuery.
Function emulateTHeadAndFoot
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function emulateTHeadAndFoot( $table ) {
var $rows = $table.find( '> tbody > tr' );
if ( !$table.get( 0 ).tHead ) {
var $thead = $( '<thead>' );
Function buildCache
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function buildCache( table ) {
var totalRows = ( table.tBodies[ 0 ] && table.tBodies[ 0 ].rows.length ) || 0,
config = $( table ).data( 'tablesorter' ).config,
cachedParsers = config.parsers,
cellIndex,
Function multisort
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function multisort( table, sortList, cache ) {
var sortFn = [],
cachedParsers = $( table ).data( 'tablesorter' ).config.parsers;
for ( var i = 0; i < sortList.length; i++ ) {
Function buildDateTable
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function buildDateTable() {
var regex = [];
ts.monthNames = {};
Function buildRawSortKey
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function buildRawSortKey( currentNode ) {
// Get data-sort-value attribute. Uses jQuery to allow live value
// changes from other code paths via data(), which reside only in jQuery.
// Must use $().data() instead of $.data(), as the latter *only*
// accesses the live values, without reading HTML5 attribs first (T40152).
Avoid deeply nested control flow statements. Open
Open
if ( isValueInArray( s[ 0 ], newSortList ) ) {
$( o ).data( 'count', s[ 1 ] + 1 );
s[ 1 ] = $( o ).data( 'count' ) % numSortOrders;
}
Function setHeadersCss
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function setHeadersCss( table, $headers, list, css, msg, columnToHeader ) {
Avoid too many return
statements within this function. Open
Open
return buildRawSortKey( elem );
Avoid too many return
statements within this function. Open
Open
return null;
Avoid too many return
statements within this function. Open
Open
return elem.textContent;