Update widget-math.js

Created new calculation type "below". It works just like "above" except in other direction starting from top to bottom.
This commit is contained in:
Ansis Kļaviņš 2015-10-04 18:06:07 +03:00
parent 40dcaace25
commit 0c7658893c

View File

@ -86,6 +86,27 @@
} }
index--; index--;
} }
} else if (type === 'below') {
len = $rows.length;
// index + 1 to ignore starting node
for (index = $rows.index( $row ) + 1; index < len; index++ ) {
$t = $rows.eq( index ).children().filter( '[data-column=' + cIndex + ']' );
if ($t.filter( '[' + wo.math_dataAttrib + '^=below]' ).length)
break;
if ( ( !$rows.eq( index ).hasClass( filtered ) &&
$rows.eq( index ).not( '[' + wo.math_dataAttrib + '=ignore]' ).length)) {
if ( $t.length ) {
arry.push( math.processText( c, $t ) );
}
}
}
} else { } else {
$mathRows = $rows.not( '[' + wo.math_dataAttrib + '=ignore]' ); // .each(function(){ $mathRows = $rows.not( '[' + wo.math_dataAttrib + '=ignore]' ); // .each(function(){
len = $mathRows.length; len = $mathRows.length;
@ -436,7 +457,7 @@
// complete executed after each fucntion // complete executed after each fucntion
math_complete : null, // function($cell, wo, result, value, arry){ return result; }, math_complete : null, // function($cell, wo, result, value, arry){ return result; },
// order of calculation; 'all' is last // order of calculation; 'all' is last
math_priority : [ 'row', 'above', 'col' ], math_priority : [ 'row', 'above', 'below', 'col' ],
// template for or just prepend the mask prefix & suffix with this HTML // template for or just prepend the mask prefix & suffix with this HTML
// e.g. '<span class="red">{content}</span>' // e.g. '<span class="red">{content}</span>'
math_prefix : '', math_prefix : '',