Core: make getParsedText a public function

This commit is contained in:
Mottie 2015-06-07 19:36:13 -05:00
parent ca163ec639
commit e16a44c0b5
6 changed files with 22 additions and 22 deletions

View File

@ -249,7 +249,7 @@
} }
// centralized function to extract/parse cell contents // centralized function to extract/parse cell contents
function getParsedText( c, cell, colIndex, txt ) { ts.getParsedText = function( c, cell, colIndex, txt ) {
if ( typeof txt === 'undefined' ) { if ( typeof txt === 'undefined' ) {
txt = ts.getElementText( c, cell, colIndex ); txt = ts.getElementText( c, cell, colIndex );
} }
@ -392,7 +392,7 @@
prevRowData.child[ t ] = []; prevRowData.child[ t ] = [];
// child row content does not account for colspans/rowspans; so indexing may be off // child row content does not account for colspans/rowspans; so indexing may be off
for ( j = 0; j < c.columns; j++ ) { for ( j = 0; j < c.columns; j++ ) {
prevRowData.child[ t ][ j ] = getParsedText( c, v[ j ], j ); prevRowData.child[ t ][ j ] = ts.getParsedText( c, v[ j ], j );
} }
// go to the next for loop // go to the next for loop
continue; continue;
@ -408,7 +408,7 @@
} }
t = ts.getElementText( c, $row[ 0 ].cells[j], j ); t = ts.getElementText( c, $row[ 0 ].cells[j], j );
rowData.raw.push( t ); // save original row text rowData.raw.push( t ); // save original row text
v = getParsedText( c, $row[ 0 ].cells[ j ], j, t ); v = ts.getParsedText( c, $row[ 0 ].cells[ j ], j, t );
cols.push( v ); cols.push( v );
if ( ( parsers[ j ].type || '' ).toLowerCase() === 'numeric' ) { if ( ( parsers[ j ].type || '' ).toLowerCase() === 'numeric' ) {
// determine column max value (ignore sign) // determine column max value (ignore sign)
@ -964,7 +964,7 @@
row = $tb.eq( tbdy ).find( 'tr' ).index( $row ); row = $tb.eq( tbdy ).find( 'tr' ).index( $row );
cache = tbcache.normalized[ row ]; cache = tbcache.normalized[ row ];
icell = $cell.index(); icell = $cell.index();
t = getParsedText( c, cell, icell ); t = ts.getParsedText( c, cell, icell );
cache[ icell ] = t; cache[ icell ] = t;
cache[ c.columns ].$row = $row; cache[ c.columns ].$row = $row;
if ( (c.parsers[icell].type || '').toLowerCase() === 'numeric' ) { if ( (c.parsers[icell].type || '').toLowerCase() === 'numeric' ) {
@ -1012,7 +1012,7 @@
}; };
// add each cell // add each cell
for (j = 0; j < l; j++) { for (j = 0; j < l; j++) {
cells[j] = getParsedText( c, $row[i].cells[j], j ); cells[j] = ts.getParsedText( c, $row[i].cells[j], j );
if ((c.parsers[j].type || '').toLowerCase() === 'numeric') { if ((c.parsers[j].type || '').toLowerCase() === 'numeric') {
// update column max value (ignore sign) // update column max value (ignore sign)
c.cache[tbdy].colMax[j] = Math.max(Math.abs(cells[j]) || 0, c.cache[tbdy].colMax[j] || 0); c.cache[tbdy].colMax[j] = Math.max(Math.abs(cells[j]) || 0, c.cache[tbdy].colMax[j] || 0);

File diff suppressed because one or more lines are too long

View File

@ -247,7 +247,7 @@
} }
// centralized function to extract/parse cell contents // centralized function to extract/parse cell contents
function getParsedText( c, cell, colIndex, txt ) { ts.getParsedText = function( c, cell, colIndex, txt ) {
if ( typeof txt === 'undefined' ) { if ( typeof txt === 'undefined' ) {
txt = ts.getElementText( c, cell, colIndex ); txt = ts.getElementText( c, cell, colIndex );
} }
@ -390,7 +390,7 @@
prevRowData.child[ t ] = []; prevRowData.child[ t ] = [];
// child row content does not account for colspans/rowspans; so indexing may be off // child row content does not account for colspans/rowspans; so indexing may be off
for ( j = 0; j < c.columns; j++ ) { for ( j = 0; j < c.columns; j++ ) {
prevRowData.child[ t ][ j ] = getParsedText( c, v[ j ], j ); prevRowData.child[ t ][ j ] = ts.getParsedText( c, v[ j ], j );
} }
// go to the next for loop // go to the next for loop
continue; continue;
@ -406,7 +406,7 @@
} }
t = ts.getElementText( c, $row[ 0 ].cells[j], j ); t = ts.getElementText( c, $row[ 0 ].cells[j], j );
rowData.raw.push( t ); // save original row text rowData.raw.push( t ); // save original row text
v = getParsedText( c, $row[ 0 ].cells[ j ], j, t ); v = ts.getParsedText( c, $row[ 0 ].cells[ j ], j, t );
cols.push( v ); cols.push( v );
if ( ( parsers[ j ].type || '' ).toLowerCase() === 'numeric' ) { if ( ( parsers[ j ].type || '' ).toLowerCase() === 'numeric' ) {
// determine column max value (ignore sign) // determine column max value (ignore sign)
@ -962,7 +962,7 @@
row = $tb.eq( tbdy ).find( 'tr' ).index( $row ); row = $tb.eq( tbdy ).find( 'tr' ).index( $row );
cache = tbcache.normalized[ row ]; cache = tbcache.normalized[ row ];
icell = $cell.index(); icell = $cell.index();
t = getParsedText( c, cell, icell ); t = ts.getParsedText( c, cell, icell );
cache[ icell ] = t; cache[ icell ] = t;
cache[ c.columns ].$row = $row; cache[ c.columns ].$row = $row;
if ( (c.parsers[icell].type || '').toLowerCase() === 'numeric' ) { if ( (c.parsers[icell].type || '').toLowerCase() === 'numeric' ) {
@ -1010,7 +1010,7 @@
}; };
// add each cell // add each cell
for (j = 0; j < l; j++) { for (j = 0; j < l; j++) {
cells[j] = getParsedText( c, $row[i].cells[j], j ); cells[j] = ts.getParsedText( c, $row[i].cells[j], j );
if ((c.parsers[j].type || '').toLowerCase() === 'numeric') { if ((c.parsers[j].type || '').toLowerCase() === 'numeric') {
// update column max value (ignore sign) // update column max value (ignore sign)
c.cache[tbdy].colMax[j] = Math.max(Math.abs(cells[j]) || 0, c.cache[tbdy].colMax[j] || 0); c.cache[tbdy].colMax[j] = Math.max(Math.abs(cells[j]) || 0, c.cache[tbdy].colMax[j] || 0);

File diff suppressed because one or more lines are too long

View File

@ -255,7 +255,7 @@
} }
// centralized function to extract/parse cell contents // centralized function to extract/parse cell contents
function getParsedText( c, cell, colIndex, txt ) { ts.getParsedText = function( c, cell, colIndex, txt ) {
if ( typeof txt === 'undefined' ) { if ( typeof txt === 'undefined' ) {
txt = ts.getElementText( c, cell, colIndex ); txt = ts.getElementText( c, cell, colIndex );
} }
@ -398,7 +398,7 @@
prevRowData.child[ t ] = []; prevRowData.child[ t ] = [];
// child row content does not account for colspans/rowspans; so indexing may be off // child row content does not account for colspans/rowspans; so indexing may be off
for ( j = 0; j < c.columns; j++ ) { for ( j = 0; j < c.columns; j++ ) {
prevRowData.child[ t ][ j ] = getParsedText( c, v[ j ], j ); prevRowData.child[ t ][ j ] = ts.getParsedText( c, v[ j ], j );
} }
// go to the next for loop // go to the next for loop
continue; continue;
@ -414,7 +414,7 @@
} }
t = ts.getElementText( c, $row[ 0 ].cells[j], j ); t = ts.getElementText( c, $row[ 0 ].cells[j], j );
rowData.raw.push( t ); // save original row text rowData.raw.push( t ); // save original row text
v = getParsedText( c, $row[ 0 ].cells[ j ], j, t ); v = ts.getParsedText( c, $row[ 0 ].cells[ j ], j, t );
cols.push( v ); cols.push( v );
if ( ( parsers[ j ].type || '' ).toLowerCase() === 'numeric' ) { if ( ( parsers[ j ].type || '' ).toLowerCase() === 'numeric' ) {
// determine column max value (ignore sign) // determine column max value (ignore sign)
@ -970,7 +970,7 @@
row = $tb.eq( tbdy ).find( 'tr' ).index( $row ); row = $tb.eq( tbdy ).find( 'tr' ).index( $row );
cache = tbcache.normalized[ row ]; cache = tbcache.normalized[ row ];
icell = $cell.index(); icell = $cell.index();
t = getParsedText( c, cell, icell ); t = ts.getParsedText( c, cell, icell );
cache[ icell ] = t; cache[ icell ] = t;
cache[ c.columns ].$row = $row; cache[ c.columns ].$row = $row;
if ( (c.parsers[icell].type || '').toLowerCase() === 'numeric' ) { if ( (c.parsers[icell].type || '').toLowerCase() === 'numeric' ) {
@ -1018,7 +1018,7 @@
}; };
// add each cell // add each cell
for (j = 0; j < l; j++) { for (j = 0; j < l; j++) {
cells[j] = getParsedText( c, $row[i].cells[j], j ); cells[j] = ts.getParsedText( c, $row[i].cells[j], j );
if ((c.parsers[j].type || '').toLowerCase() === 'numeric') { if ((c.parsers[j].type || '').toLowerCase() === 'numeric') {
// update column max value (ignore sign) // update column max value (ignore sign)
c.cache[tbdy].colMax[j] = Math.max(Math.abs(cells[j]) || 0, c.cache[tbdy].colMax[j] || 0); c.cache[tbdy].colMax[j] = Math.max(Math.abs(cells[j]) || 0, c.cache[tbdy].colMax[j] || 0);

View File

@ -237,7 +237,7 @@
} }
// centralized function to extract/parse cell contents // centralized function to extract/parse cell contents
function getParsedText( c, cell, colIndex, txt ) { ts.getParsedText = function( c, cell, colIndex, txt ) {
if ( typeof txt === 'undefined' ) { if ( typeof txt === 'undefined' ) {
txt = ts.getElementText( c, cell, colIndex ); txt = ts.getElementText( c, cell, colIndex );
} }
@ -380,7 +380,7 @@
prevRowData.child[ t ] = []; prevRowData.child[ t ] = [];
// child row content does not account for colspans/rowspans; so indexing may be off // child row content does not account for colspans/rowspans; so indexing may be off
for ( j = 0; j < c.columns; j++ ) { for ( j = 0; j < c.columns; j++ ) {
prevRowData.child[ t ][ j ] = getParsedText( c, v[ j ], j ); prevRowData.child[ t ][ j ] = ts.getParsedText( c, v[ j ], j );
} }
// go to the next for loop // go to the next for loop
continue; continue;
@ -396,7 +396,7 @@
} }
t = ts.getElementText( c, $row[ 0 ].cells[j], j ); t = ts.getElementText( c, $row[ 0 ].cells[j], j );
rowData.raw.push( t ); // save original row text rowData.raw.push( t ); // save original row text
v = getParsedText( c, $row[ 0 ].cells[ j ], j, t ); v = ts.getParsedText( c, $row[ 0 ].cells[ j ], j, t );
cols.push( v ); cols.push( v );
if ( ( parsers[ j ].type || '' ).toLowerCase() === 'numeric' ) { if ( ( parsers[ j ].type || '' ).toLowerCase() === 'numeric' ) {
// determine column max value (ignore sign) // determine column max value (ignore sign)
@ -952,7 +952,7 @@
row = $tb.eq( tbdy ).find( 'tr' ).index( $row ); row = $tb.eq( tbdy ).find( 'tr' ).index( $row );
cache = tbcache.normalized[ row ]; cache = tbcache.normalized[ row ];
icell = $cell.index(); icell = $cell.index();
t = getParsedText( c, cell, icell ); t = ts.getParsedText( c, cell, icell );
cache[ icell ] = t; cache[ icell ] = t;
cache[ c.columns ].$row = $row; cache[ c.columns ].$row = $row;
if ( (c.parsers[icell].type || '').toLowerCase() === 'numeric' ) { if ( (c.parsers[icell].type || '').toLowerCase() === 'numeric' ) {
@ -1000,7 +1000,7 @@
}; };
// add each cell // add each cell
for (j = 0; j < l; j++) { for (j = 0; j < l; j++) {
cells[j] = getParsedText( c, $row[i].cells[j], j ); cells[j] = ts.getParsedText( c, $row[i].cells[j], j );
if ((c.parsers[j].type || '').toLowerCase() === 'numeric') { if ((c.parsers[j].type || '').toLowerCase() === 'numeric') {
// update column max value (ignore sign) // update column max value (ignore sign)
c.cache[tbdy].colMax[j] = Math.max(Math.abs(cells[j]) || 0, c.cache[tbdy].colMax[j] || 0); c.cache[tbdy].colMax[j] = Math.max(Math.abs(cells[j]) || 0, c.cache[tbdy].colMax[j] || 0);