Merge branch 'master' into anachronic_merged
diff --git a/extension/jsx/utils/expressionHelper.jsx b/extension/jsx/utils/expressionHelper.jsx
index 749af9b..bb31d42 100644
--- a/extension/jsx/utils/expressionHelper.jsx
+++ b/extension/jsx/utils/expressionHelper.jsx
@@ -514,7 +514,6 @@
expressionStr = escodegen.generate(parsed);
expressionStr = 'var $bm_rt;\n' + expressionStr;
- //console.log(expressionStr);
returnOb.x = expressionStr;
}
}
diff --git a/player/js/utils/expressions/ExpressionManager.js b/player/js/utils/expressions/ExpressionManager.js
index cc1e2d1..220cd3e 100644
--- a/player/js/utils/expressions/ExpressionManager.js
+++ b/player/js/utils/expressions/ExpressionManager.js
@@ -2,18 +2,20 @@
var ob = {};
function sum(a,b) {
- if(typeof a === 'number' && typeof b === 'number') {
+ var tOfA = typeof a;
+ var tOfB = typeof b;
+ if((tOfA === 'number' || tOfA === 'boolean') && (tOfB === 'number' || tOfB === 'boolean')) {
return a + b;
}
- if(typeof a === 'object' && typeof b === 'number'){
+ if(tOfA === 'object' && (tOfB === 'number' || tOfB === 'boolean')){
a[0] = a[0] + b;
return a;
}
- if(typeof a === 'number' && typeof b === 'object'){
+ if((tOfA === 'number' || tOfA === 'boolean') && tOfB === 'object'){
b[0] = a + b[0];
return b;
}
- if(typeof a === 'object' && typeof b === 'object'){
+ if(tOfA === 'object' && tOfB === 'object'){
var i = 0, lenA = a.length, lenB = b.length;
var retArr = [];
while(i<lenA || i < lenB){
@@ -30,18 +32,20 @@
}
function sub(a,b) {
- if(typeof a === 'number' && typeof b === 'number') {
+ var tOfA = typeof a;
+ var tOfB = typeof b;
+ if((tOfA === 'number' || tOfA === 'boolean') && (tOfB === 'number' || tOfB === 'boolean')) {
return a - b;
}
- if(typeof a === 'object' && typeof b === 'number'){
+ if(tOfA === 'object' && (tOfB === 'number' || tOfB === 'boolean')){
a[0] = a[0] - b;
return a;
}
- if(typeof a === 'number' && typeof b === 'object'){
+ if((tOfA === 'number' || tOfA === 'boolean') && tOfB === 'object'){
b[0] = a - b[0];
return b;
}
- if(typeof a === 'object' && typeof b === 'object'){
+ if(tOfA === 'object' && tOfB === 'object'){
var i = 0, lenA = a.length, lenB = b.length;
var retArr = [];
while(i<lenA || i < lenB){
@@ -58,18 +62,20 @@
}
function mul(a,b) {
- if(typeof a === 'number' && typeof b === 'number') {
+ var tOfA = typeof a;
+ var tOfB = typeof b;
+ if((tOfA === 'number' || tOfA === 'boolean') && (tOfB === 'number' || tOfB === 'boolean')) {
return a * b;
}
var i, len;
- if(typeof a === 'object' && typeof b === 'number'){
+ if(tOfA === 'object' && (tOfB === 'number' || tOfB === 'boolean')){
len = a.length;
for(i=0;i<len;i+=1){
a[i] = a[i] * b;
}
return a;
}
- if(typeof a === 'number' && typeof b === 'object'){
+ if((tOfA === 'number' || tOfA === 'boolean') && tOfB === 'object'){
len = b.length;
for(i=0;i<len;i+=1){
b[i] = a * b[i];
@@ -80,18 +86,20 @@
}
function div(a,b) {
- if(typeof a === 'number' && typeof b === 'number') {
+ var tOfA = typeof a;
+ var tOfB = typeof b;
+ if((tOfA === 'number' || tOfA === 'boolean') && (tOfB === 'number' || tOfB === 'boolean')) {
return a / b;
}
var i, len;
- if(typeof a === 'object' && typeof b === 'number'){
+ if(tOfA === 'object' && (tOfB === 'number' || tOfB === 'boolean')){
len = a.length;
for(i=0;i<len;i+=1){
a[i] = a[i] / b;
}
return a;
}
- if(typeof a === 'number' && typeof b === 'object'){
+ if((tOfA === 'number' || tOfA === 'boolean') && tOfB === 'object'){
len = b.length;
for(i=0;i<len;i+=1){
b[i] = a / b[i];