[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lon-capa-cvs
Subject:    [LON-CAPA-cvs] cvs: loncom /html/adm/LC_math_editor test.html /html/adm/LC_math_editor/dist LC_math_
From:       damieng <damieng () source ! lon-capa ! org>
Date:       2015-02-25 20:54:06
Message-ID: cvsdamieng1424897646 () cvsserver
[Download RAW message or body]

This is a MIME encoded message


damieng		Wed Feb 25 20:54:06 2015 EDT

  Modified files:              
    /loncom/html/adm/LC_math_editor	test.html 
    /loncom/html/adm/LC_math_editor/dist	LC_math_editor.min.js 
    /loncom/html/adm/LC_math_editor/src	ui.js 
  Log:
  math editor: hardcoded CSS to avoid naming convention conflicts with nextgen \
LON-CAPA, and hiding preview on mouseenter only if there was no error  


["damieng-20150225205406.txt" (text/plain)]

Index: loncom/html/adm/LC_math_editor/test.html
diff -u loncom/html/adm/LC_math_editor/test.html:1.2 \
                loncom/html/adm/LC_math_editor/test.html:1.3
--- loncom/html/adm/LC_math_editor/test.html:1.2	Tue Feb 24 15:20:36 2015
+++ loncom/html/adm/LC_math_editor/test.html	Wed Feb 25 20:53:59 2015
@@ -6,7 +6,6 @@
     <style>
         div.eqnbox { margin: 1em }
         textarea.math { font-family: monospace; height: 3em; width: 100%; }
-        span.math-error { border: solid 1px red; min-width: 1px; }
     </style>
     <script>
       function addField() {
Index: loncom/html/adm/LC_math_editor/dist/LC_math_editor.min.js
diff -u loncom/html/adm/LC_math_editor/dist/LC_math_editor.min.js:1.2 \
                loncom/html/adm/LC_math_editor/dist/LC_math_editor.min.js:1.3
--- loncom/html/adm/LC_math_editor/dist/LC_math_editor.min.js:1.2	Tue Feb 24 15:20:41 \
                2015
+++ loncom/html/adm/LC_math_editor/dist/LC_math_editor.min.js	Wed Feb 25 20:54:03 \
2015 @@ -1,55 +1,55 @@
-'use strict';var LCMATH=function(){function m(){this.operators=[]}function \
e(b,a,c,g,f){this.type=b;this.op=a;this.value=c;this.children=g;this.interval_type="undefined"==typeof \
f?e.NOT_AN_INTERVAL:f}function \
p(b,a,c,g,f,e){this.id=b;this.arity=a;this.lbp=c;this.rbp=g;this.nud=f;this.led=e}function \
n(b,a,c){this.msg=b;this.from=a;this.to=c?c:this.from}function \
r(b,a,c){this.implicit_operators="undefined"==typeof \
b?!1:b;this.unit_mode="undefined"==typeof a?!1:a;this.constants="undefined"==typeof \
                c||
-null==c?[]:c;this.defs=new \
m;this.defs.define();this.operators=this.defs.operators;this.oph={};for(b=0;b<this.operators.length;b++)this.oph[this.operators[b].id]=this.operators[b]}function \
t(b,a){this.defs=b;this.text=a}function \
l(b,a,c,g,f){this.type=b;this.from=a;this.to=c;this.value=g;this.op=f}m.ARG_SEPARATOR= \
",";m.DECIMAL_SIGN_1=".";m.DECIMAL_SIGN_2=".";m.INTERVAL_SEPARATOR=":";m.prototype.operator=function(b,a,c,g,f,e){this.operators.push(new \
                p(b,a,c,g,f,e))};m.prototype.separator=function(b){this.operator(b,
-p.BINARY,0,0,null,null)};m.prototype.infix=function(b,a,c,g){var \
f;f=p.BINARY;g=g||function(a,d){var f=[d,a.expression(c)];return new \
e(e.OPERATOR,this,b,f)};this.operator(b,f,a,c,null,g)};m.prototype.prefix=function(b,a,c){var \
g;g=p.UNARY;c=c||function(c){c=[c.expression(a)];return new \
e(e.OPERATOR,this,b,c)};this.operator(b,g,0,a,c,null)};m.prototype.suffix=function(b,a,c){var \
g;g=p.UNARY;c=c||function(a,c){return new \
                e(e.OPERATOR,this,b,[c])};this.operator(b,g,a,0,null,c)};m.prototype.findOperator=
                
-function(b){for(var \
a=0;a<this.operators.length;a++)if(this.operators[a].id==b)return \
this.operators[a];return \
null};m.prototype.buildInterval=function(b,a,c,g){g.advance(m.INTERVAL_SEPARATOR);var \
f=g.expression(0);if(null==g.current_token||null==g.current_token.op||")"!==g.current_token.op.id&&"]"!==g.current_token.op.id)throw \
new n("Wrong interval \
syntax.",g.tokens[g.token_nr-1].from);")"==g.current_token.op.id?(g.advance(")"),b=b?e.CLOSED_OPEN:e.OPEN_OPEN):(g.advance("]"),b=b?e.CLOSED_CLOSED:e.OPEN_CLOSED);
                
-return new e(e.INTERVAL,c,null,[a,f],b)};m.prototype.define=function(){this.suffix("! \
",160);this.infix("^",140,139);this.infix(".",130,129);this.infix("`",125,125,function(a,b){for(var \
g=a.expression(125);null!=a.current_token&&-1!="*/".indexOf(a.current_token.value);){var \
f=a.tokens[a.token_nr];if(null==f)break;if(f.type!=l.NAME&&"("!=f.value)break;f=a.toke \
ns[a.token_nr+1];if(null!=f&&("("==f.value||f.type==l.NUMBER))break;if(a.unit_mode&&a.tokens[a.token_nr].type==l.NAME){for(var \
                f=a.tokens[a.token_nr].value,
-k=!1,d=0;d<a.constants.length;d++)if(f==a.constants[d]){k=!0;break}if(k)break}f=a.current_token;a.advance();g=f.op.led(a,g)}return \
new e(e.OPERATOR,this,"`",[b,g])});this.infix("*",120,120);this.infix("/",120,120);thi \
s.infix("%",120,120);this.infix("+",100,100);this.operator("-",p.BINARY,100,134,function(a){a=[a.expression(134)];return \
new e(e.OPERATOR,this,"-",a)},function(a,b){var g=[b,a.expression(100)];return new \
e(e.OPERATOR,this,"-",g)});this.infix("=",80,80);this.infix("#",80,80);this.infix("<=",
                
-80,80);this.infix(">=",80,80);this.infix("<",80,80);this.infix(">",80,80);this.separa \
tor(")");this.separator(m.ARG_SEPARATOR);this.separator(m.INTERVAL_SEPARATOR);var \
b=this;this.operator("(",p.BINARY,200,200,function(a){var \
c=a.expression(0);if(null!=a.current_token&&null!=a.current_token.op&&a.current_token.op.id==m.INTERVAL_SEPARATOR)return \
b.buildInterval(!1,c,this,a);a.advance(")");return \
c},function(a,b){if(b.type!=e.NAME&&b.type!=e.SUBSCRIPT)throw new n("Function name \
                expected before a parenthesis.",
-a.tokens[a.token_nr-1].from);var \
g=[b];if(null==a.current_token||null==a.current_token.op||")"!==a.current_token.op.id) \
for(;;){g.push(a.expression(0));if(null==a.current_token||null==a.current_token.op||a. \
current_token.op.id!==m.ARG_SEPARATOR)break;a.advance(m.ARG_SEPARATOR)}a.advance(")");return \
new e(e.FUNCTION,this,"(",g)});this.separator("]");this.operator("[",p.BINARY,200,70,function(a){var \
c=[];if(null==a.current_token||null==a.current_token.op||"]"!==a.current_token.op.id){var \
                g=a.expression(0);
-if(null!=a.current_token&&null!=a.current_token.op&&a.current_token.op.id==m.INTERVAL_SEPARATOR)return \
b.buildInterval(!0,g,this,a);for(;;){c.push(g);if(null==a.current_token||null==a.curre \
nt_token.op||a.current_token.op.id!==m.ARG_SEPARATOR)break;a.advance(m.ARG_SEPARATOR);g=a.expression(0)}}a.advance("]");return \
new e(e.VECTOR,this,null,c)},function(a,b){if(b.type!=e.NAME&&b.type!=e.SUBSCRIPT)throw \
new n("Name expected before a square bracket.",a.tokens[a.token_nr-1].from);var \
                g=[b];if(null==a.current_token||
-null==a.current_token.op||"]"!==a.current_token.op.id)for(;;){g.push(a.expression(0)) \
;if(null==a.current_token||null==a.current_token.op||a.current_token.op.id!==m.ARG_SEPARATOR)break;a.advance(m.ARG_SEPARATOR)}a.advance("]");return \
new e(e.SUBSCRIPT,this,"[",g)});this.separator("}");this.prefix("{",200,function(a){var \
b=[];if(null==a.current_token||null==a.current_token.op||"}"!==a.current_token.op.id)f \
or(;;){b.push(a.expression(0));if(null==a.current_token||null==a.current_token.op||a.current_token.op.id!==
                
-m.ARG_SEPARATOR)break;a.advance(m.ARG_SEPARATOR)}a.advance("}");return new \
e(e.SET,this,null,b)});this.prefix("$",300,function(a){var \
b=a.expression(300);if(b.type!=e.NAME)throw new n("Variable name expected after a \
$.",a.tokens[a.token_nr-1].from);b.value="$"+b.value;return b})};"use \
strict";e.UNKNOWN=0;e.NAME=1;e.NUMBER=2;e.OPERATOR=3;e.FUNCTION=4;e.VECTOR=5;e.INTERVAL=6;e.SET=7;e.SUBSCRIPT=8;e.COLORS="#E01010 \
#0010FF #009000 #FF00FF #00B0B0 #F09000 #800080 #F080A0 #6090F0 #902000 #70A050 \
#A07060 #5000FF #E06050 #008080 #808000".split(" "); +'use strict';var \
LCMATH=function(){function l(){this.operators=[]}function \
e(b,a,c,g,f){this.type=b;this.op=a;this.value=c;this.children=g;this.interval_type="undefined"==typeof \
f?e.NOT_AN_INTERVAL:f}function \
p(b,a,c,g,f,e){this.id=b;this.arity=a;this.lbp=c;this.rbp=g;this.nud=f;this.led=e}function \
n(b,a,c){this.msg=b;this.from=a;this.to=c?c:this.from}function \
r(b,a,c){this.implicit_operators="undefined"==typeof \
b?!1:b;this.unit_mode="undefined"==typeof a?!1:a;this.constants="undefined"==typeof \
c|| +null==c?[]:c;this.defs=new \
l;this.defs.define();this.operators=this.defs.operators;this.oph={};for(b=0;b<this.operators.length;b++)this.oph[this.operators[b].id]=this.operators[b]}function \
t(b,a){this.defs=b;this.text=a}function \
k(b,a,c,g,f){this.type=b;this.from=a;this.to=c;this.value=g;this.op=f}l.ARG_SEPARATOR= \
";";l.DECIMAL_SIGN_1=".";l.DECIMAL_SIGN_2=",";l.INTERVAL_SEPARATOR=":";l.prototype.operator=function(b,a,c,g,f,e){this.operators.push(new \
p(b,a,c,g,f,e))};l.prototype.separator=function(b){this.operator(b, \
+p.BINARY,0,0,null,null)};l.prototype.infix=function(b,a,c,g){var \
f;f=p.BINARY;g=g||function(a,d){var f=[d,a.expression(c)];return new \
e(e.OPERATOR,this,b,f)};this.operator(b,f,a,c,null,g)};l.prototype.prefix=function(b,a,c){var \
g;g=p.UNARY;c=c||function(c){c=[c.expression(a)];return new \
e(e.OPERATOR,this,b,c)};this.operator(b,g,0,a,c,null)};l.prototype.suffix=function(b,a,c){var \
g;g=p.UNARY;c=c||function(a,c){return new \
e(e.OPERATOR,this,b,[c])};this.operator(b,g,a,0,null,c)};l.prototype.findOperator= \
+function(b){for(var \
a=0;a<this.operators.length;a++)if(this.operators[a].id==b)return \
this.operators[a];return \
null};l.prototype.buildInterval=function(b,a,c,g){g.advance(l.INTERVAL_SEPARATOR);var \
f=g.expression(0);if(null==g.current_token||null==g.current_token.op||")"!==g.current_token.op.id&&"]"!==g.current_token.op.id)throw \
new n("Wrong interval \
syntax.",g.tokens[g.token_nr-1].from);")"==g.current_token.op.id?(g.advance(")"),b=b?e.CLOSED_OPEN:e.OPEN_OPEN):(g.advance("]"),b=b?e.CLOSED_CLOSED:e.OPEN_CLOSED);
 +return new e(e.INTERVAL,c,null,[a,f],b)};l.prototype.define=function(){this.suffix(" \
!",160);this.infix("^",140,139);this.infix(".",130,129);this.infix("`",125,125,function(a,b){for(var \
g=a.expression(125);null!=a.current_token&&-1!="*/".indexOf(a.current_token.value);){var \
f=a.tokens[a.token_nr];if(null==f)break;if(f.type!=k.NAME&&"("!=f.value)break;f=a.toke \
ns[a.token_nr+1];if(null!=f&&("("==f.value||f.type==k.NUMBER))break;if(a.unit_mode&&a.tokens[a.token_nr].type==k.NAME){for(var \
f=a.tokens[a.token_nr].value, \
+m=!1,d=0;d<a.constants.length;d++)if(f==a.constants[d]){m=!0;break}if(m)break}f=a.current_token;a.advance();g=f.op.led(a,g)}return \
new e(e.OPERATOR,this,"`",[b,g])});this.infix("*",120,120);this.infix("/",120,120);thi \
s.infix("%",120,120);this.infix("+",100,100);this.operator("-",p.BINARY,100,134,function(a){a=[a.expression(134)];return \
new e(e.OPERATOR,this,"-",a)},function(a,b){var g=[b,a.expression(100)];return new \
e(e.OPERATOR,this,"-",g)});this.infix("=",80,80);this.infix("#",80,80);this.infix("<=",
 +80,80);this.infix(">=",80,80);this.infix("<",80,80);this.infix(">",80,80);this.separ \
ator(")");this.separator(l.ARG_SEPARATOR);this.separator(l.INTERVAL_SEPARATOR);var \
b=this;this.operator("(",p.BINARY,200,200,function(a){var \
c=a.expression(0);if(null!=a.current_token&&null!=a.current_token.op&&a.current_token.op.id==l.INTERVAL_SEPARATOR)return \
b.buildInterval(!1,c,this,a);a.advance(")");return \
c},function(a,b){if(b.type!=e.NAME&&b.type!=e.SUBSCRIPT)throw new n("Function name \
expected before a parenthesis.", +a.tokens[a.token_nr-1].from);var \
g=[b];if(null==a.current_token||null==a.current_token.op||")"!==a.current_token.op.id) \
for(;;){g.push(a.expression(0));if(null==a.current_token||null==a.current_token.op||a. \
current_token.op.id!==l.ARG_SEPARATOR)break;a.advance(l.ARG_SEPARATOR)}a.advance(")");return \
new e(e.FUNCTION,this,"(",g)});this.separator("]");this.operator("[",p.BINARY,200,70,function(a){var \
c=[];if(null==a.current_token||null==a.current_token.op||"]"!==a.current_token.op.id){var \
g=a.expression(0); +if(null!=a.current_token&&null!=a.current_token.op&&a.current_token.op.id==l.INTERVAL_SEPARATOR)return \
b.buildInterval(!0,g,this,a);for(;;){c.push(g);if(null==a.current_token||null==a.curre \
nt_token.op||a.current_token.op.id!==l.ARG_SEPARATOR)break;a.advance(l.ARG_SEPARATOR);g=a.expression(0)}}a.advance("]");return \
new e(e.VECTOR,this,null,c)},function(a,b){if(b.type!=e.NAME&&b.type!=e.SUBSCRIPT)throw \
new n("Name expected before a square bracket.",a.tokens[a.token_nr-1].from);var \
g=[b];if(null==a.current_token|| \
+null==a.current_token.op||"]"!==a.current_token.op.id)for(;;){g.push(a.expression(0)) \
;if(null==a.current_token||null==a.current_token.op||a.current_token.op.id!==l.ARG_SEPARATOR)break;a.advance(l.ARG_SEPARATOR)}a.advance("]");return \
new e(e.SUBSCRIPT,this,"[",g)});this.separator("}");this.prefix("{",200,function(a){var \
b=[];if(null==a.current_token||null==a.current_token.op||"}"!==a.current_token.op.id)f \
or(;;){b.push(a.expression(0));if(null==a.current_token||null==a.current_token.op||a.current_token.op.id!==
 +l.ARG_SEPARATOR)break;a.advance(l.ARG_SEPARATOR)}a.advance("}");return new \
e(e.SET,this,null,b)});this.prefix("$",300,function(a){var \
b=a.expression(300);if(b.type!=e.NAME)throw new n("Variable name expected after a \
$.",a.tokens[a.token_nr-1].from);b.value="$"+b.value;return b})};"use \
strict";e.UNKNOWN=0;e.NAME=1;e.NUMBER=2;e.OPERATOR=3;e.FUNCTION=4;e.VECTOR=5;e.INTERVAL=6;e.SET=7;e.SUBSCRIPT=8;e.COLORS="#E01010 \
#0010FF #009000 #FF00FF #00B0B0 #F09000 #800080 #F080A0 #6090F0 #902000 #70A050 \
#A07060 #5000FF #E06050 #008080 #808000".split(" ");  \
e.NOT_AN_INTERVAL=0;e.OPEN_OPEN=1;e.OPEN_CLOSED=2;e.CLOSED_OPEN=3;e.CLOSED_CLOSED=4;e.prototype.toString=function(){var \
b="(";switch(this.type){case e.UNKNOWN:b+="UNKNOWN";break;case \
e.NAME:b+="NAME";break;case e.NUMBER:b+="NUMBER";break;case \
e.OPERATOR:b+="OPERATOR";break;case e.FUNCTION:b+="FUNCTION";break;case \
e.VECTOR:b+="VECTOR";break;case e.INTERVAL:b+="INTERVAL";break;case \
e.SET:b+="SET";break;case e.SUBSCRIPT:b+="SUBSCRIPT"}this.op&&(b+=" \
'"+this.op.id+"'");this.value&&(b+=" '"+this.value+  "'");if(this.children){for(var \
b=b+" [",a=0;a<this.children.length;a++)b+=this.children[a].toString(),a!=this.children.length-1&&(b+=",");b+="]"}this.interval_type&&(b+=" \
"+this.interval_type);return \
b+")"};e.prototype.getColorForIdentifier=function(b,a){var \
c=a.hcolors[b];c||(c=a.colors?a.colors:e.COLORS,c=c[Object.keys(a.hcolors).length%c.length],a.hcolors[b]=c);return \
c};e.prototype.toMathML=function(b){return \
this._toMathML({hcolors:{},depth:0,colors:b})};e.prototype._toMathML=function(b){var \
                a,
-c,g,f,k,d,h;a=null!=this.children&&0<this.children.length?this.children[0]:null;c=nul \
l!=this.children&&1<this.children.length?this.children[1]:null;g=null!=this.children&& \
2<this.children.length?this.children[2]:null;f=null!=this.children&&3<this.children.le \
ngth?this.children[3]:null;k=null!=this.children&&4<this.children.length?this.children[4]:null;switch(this.type){case \
e.UNKNOWN:return d=document.createElement("mtext"),d.appendChild(document.createTextNode("???")),d;case \
e.NAME:return 0<=this.value.search(/^[a-zA-Z]+[0-9]+$/)? \
+c,g,f,m,d,h;a=null!=this.children&&0<this.children.length?this.children[0]:null;c=nul \
l!=this.children&&1<this.children.length?this.children[1]:null;g=null!=this.children&& \
2<this.children.length?this.children[2]:null;f=null!=this.children&&3<this.children.le \
ngth?this.children[3]:null;m=null!=this.children&&4<this.children.length?this.children[4]:null;switch(this.type){case \
e.UNKNOWN:return d=document.createElement("mtext"),d.appendChild(document.createTextNode("???")),d;case \
e.NAME:return 0<=this.value.search(/^[a-zA-Z]+[0-9]+$/)?  \
(d=this.value.search(/[0-9]/),g=document.createElement("msub"),g.appendChild(this.mi(t \
his.value.substring(0,d))),g.appendChild(this.mn(this.value.substring(d))),d=g):d=this \
.mi(this.value),d.setAttribute("mathcolor",this.getColorForIdentifier(this.value,b)),0===this.value.indexOf("$")&&d.setAttribute("fontfamily","monospace"),d;case \
e.NUMBER:return-1!=this.value.indexOf("e")||-1!=this.value.indexOf("E")?(b=this.value. \
                indexOf("e"),-1==b&&(b=this.value.indexOf("E")),d=document.createElement("mrow"),
                
-d.appendChild(this.mn(this.value.substring(0,b))),d.appendChild(this.mo("\u22c5")),a= \
document.createElement("msup"),a.appendChild(this.mn(10)),a.appendChild(this.mn(this.value.substring(b+1))),d.appendChild(a),d):this.mn(this.value);case \
e.OPERATOR:if("/"==this.value)k=document.createElement("mfrac"),k.appendChild(a._toMathML(b)),k.appendChild(c._toMathML(b)),d=k;else \
if("^"==this.value)g=a.type==e.FUNCTION?"sqrt"==a.value||"abs"==a.value||"matrix"==a.value||"diff"==a.value?!1:!0:a.type==e.OPERATOR?
 +d.appendChild(this.mn(this.value.substring(0,b))),d.appendChild(this.mo("\u22c5")),a \
=document.createElement("msup"),a.appendChild(this.mn(10)),a.appendChild(this.mn(this.value.substring(b+1))),d.appendChild(a),d):this.mn(this.value);case \
e.OPERATOR:if("/"==this.value)m=document.createElement("mfrac"),m.appendChild(a._toMathML(b)),m.appendChild(c._toMathML(b)),d=m;else \
if("^"==this.value)g=a.type==e.FUNCTION?"sqrt"==a.value||"abs"==a.value||"matrix"==a.value||"diff"==a.value?!1:!0:a.type==e.OPERATOR?
                
 !0:!1,d=document.createElement("msup"),g?d.appendChild(this.addP(a,b)):d.appendChild(a._toMathML(b)),d.appendChild(c._toMathML(b));else \
if("*"==this.value){d=document.createElement("mrow");a.type!=e.OPERATOR||"+"!=a.value& \
&"-"!=a.value?d.appendChild(a._toMathML(b)):d.appendChild(this.addP(a,b));for(g=c;g.ty \
pe==e.OPERATOR;)g=g.children[0];a.type==e.VECTOR&&c.type==e.VECTOR?d.appendChild(this. \
mo("*")):g.type==e.NUMBER?d.appendChild(this.mo("\u22c5")):b.units?d.appendChild(this.mo("\u22c5")):d.appendChild(this.mo("\u2062"));
  c.type!=e.OPERATOR||"+"!=c.value&&"-"!=c.value?d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,b))}else \
if("-"==this.value)d=document.createElement("mrow"),1==this.children.length?(d.appendC \
hild(this.mo("-")),d.appendChild(a._toMathML(b))):(d.appendChild(a._toMathML(b)),d.app \
endChild(this.mo("-")),c.type!=e.OPERATOR||"+"!=c.value&&"-"!=c.value?d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,b)));else \
if("!"==this.value)d=document.createElement("mrow"),h=this.mo(this.value),a.type!=  \
e.OPERATOR||"+"!=a.value&&"-"!=a.value?d.appendChild(a._toMathML(b)):d.appendChild(this.addP(a,b)),d.appendChild(h);else \
if("+"==this.value){d=document.createElement("mrow");h=this.mo(this.value);d.appendChi \
ld(a._toMathML(b));d.appendChild(h);g=!1;for(f=c;f.type==e.OPERATOR;)if("-"==f.value&&1==f.children.length){g=!0;break}else \
if("+"==f.value||"-"==f.value||"*"==f.value)f=f.children[0];else \
break;g?d.appendChild(this.addP(c,b)):d.appendChild(c._toMathML(b))}else \
if("."==this.value)d=document.createElement("mrow"),  \
a.type!=e.OPERATOR||"+"!=a.value&&"-"!=a.value?d.appendChild(a._toMathML(b)):d.appendC \
hild(this.addP(a,b)),d.appendChild(this.mo("\u22c5")),c.type!=e.OPERATOR||"+"!=c.value&&"-"!=c.value?d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,b));else \
if("`"==this.value){d=document.createElement("mrow");a.type!=e.OPERATOR||"+"!=a.value& \
&"-"!=a.value?d.appendChild(a._toMathML(b)):d.appendChild(this.addP(a,b));g=document.createElement("mstyle");g.setAttribute("fontstyle","normal");f={};for(h \
in b)b.hasOwnProperty(h)&&  \
(f[h]=b[h]);f.units=!0;c.type!=e.OPERATOR||"+"!=c.value&&"-"!=c.value?g.appendChild(c._toMathML(f)):g.appendChild(this.addP(c,f));d.appendChild(g)}else \
d=document.createElement("mrow"),h=this.mo(this.value),d.appendChild(a._toMathML(b)),d.appendChild(h),d.appendChild(c._toMathML(b));return \
d;case e.FUNCTION:if("sqrt"==a.value&&null!=c)d=document.createElement("msqrt"),d.appendChild(c._toMathML(b));else \
if("abs"==a.value&&null!=c)d=document.createElement("mrow"),d.appendChild(this.mo("|")),d.appendChild(c._toMathML(b)),
                
-d.appendChild(this.mo("|"));else \
if("exp"==a.value&&null!=c)d=document.createElement("msup"),d.appendChild(this.mi("e")),d.appendChild(c._toMathML(b));else \
if("factorial"==a.value)d=document.createElement("mrow"),h=this.mo("!"),c.type!=e.OPER \
ATOR||"+"!=c.value&&"-"!=c.value?d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,b)),d.appendChild(h);else \
if("diff"==a.value&&null!=this.children&&3==this.children.length)d=document.createElement("mrow"),k=document.createElement("mfrac"),k.appendChild(this.mi("d")),
                
-h=document.createElement("mrow"),h.appendChild(this.mi("d")),h.appendChild(this.mi(g. \
value)),k.appendChild(h),d.appendChild(k),c.type!=e.OPERATOR||"+"!=c.value&&"-"!=c.value?d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,b));else \
if("diff"==a.value&&null!=this.children&&4==this.children.length)d=document.createElem \
ent("mrow"),k=document.createElement("mfrac"),a=document.createElement("msup"),a.appen \
dChild(this.mi("d")),a.appendChild(f._toMathML(b)),k.appendChild(a),h=document.createElement("mrow"),
                
-h.appendChild(this.mi("d")),a=document.createElement("msup"),a.appendChild(g._toMathM \
L(b)),a.appendChild(f._toMathML(b)),h.appendChild(a),k.appendChild(h),d.appendChild(k) \
,c.type!=e.OPERATOR||"+"!=c.value&&"-"!=c.value?d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,b));else \
if("integrate"==a.value&&null!=this.children&&3==this.children.length)d=document.creat \
eElement("mrow"),h=this.mo("\u222b"),h.setAttribute("stretchy","true"),d.appendChild(h),g.type!=e.OPERATOR||"+"!=g.value&&"-"!=g.value?
                
-d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,b)),d.appendChild(this.mi("d")),d.appendChild(g._toMathML(b));else \
if("integrate"==a.value&&null!=this.children&&5==this.children.length)d=document.creat \
eElement("mrow"),a=document.createElement("msubsup"),h=this.mo("\u222b"),h.setAttribut \
e("stretchy","true"),a.appendChild(h),a.appendChild(f._toMathML(b)),a.appendChild(k._t \
oMathML(b)),d.appendChild(a),g.type!=e.OPERATOR||"+"!=g.value&&"-"!=g.value?d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,
                
-b)),d.appendChild(this.mi("d")),d.appendChild(g._toMathML(b));else \
if("sum"==a.value&&null!=this.children&&5==this.children.length){d=document.createElement("mrow");var \
l=document.createElement("munderover");h=this.mo("\u2211");h.setAttribute("stretchy"," \
true");l.appendChild(h);a=document.createElement("mrow");a.appendChild(g._toMathML(b)) \
;a.appendChild(this.mo("="));a.appendChild(f._toMathML(b));l.appendChild(a);l.appendChild(k._toMathML(b));d.appendChild(l);g.type!=e.OPERATOR||"+"!=g.value&&"-"!=
                
-g.value?d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,b))}else \
if("product"==a.value&&null!=this.children&&5==this.children.length)d=document.createE \
lement("mrow"),l=document.createElement("munderover"),h=this.mo("\u220f"),h.setAttribu \
te("stretchy","true"),l.appendChild(h),a=document.createElement("mrow"),a.appendChild( \
g._toMathML(b)),a.appendChild(this.mo("=")),a.appendChild(f._toMathML(b)),l.appendChil \
d(a),l.appendChild(k._toMathML(b)),d.appendChild(l),g.type!=e.OPERATOR||"+"!=g.value&&
                
-"-"!=g.value?d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,b));else \
if("limit"==a.value)d=document.createElement("mrow"),4>this.children.length?d.appendCh \
ild(this.mo("lim")):(a=document.createElement("munder"),a.appendChild(this.mo("lim")), \
h=document.createElement("mrow"),h.appendChild(g._toMathML(b)),h.appendChild(this.mo(" \
\u2192")),h.appendChild(f._toMathML(b)),null!=k&&("plus"==k.value?h.appendChild(this.m \
o("+")):"minus"==k.value&&h.appendChild(this.mo("-"))),a.appendChild(h),d.appendChild(a)),
 +d.appendChild(this.mo("|"));else \
if("exp"==a.value&&null!=c)d=document.createElement("msup"),d.appendChild(this.mi("e")),d.appendChild(c._toMathML(b));else \
if("factorial"==a.value)d=document.createElement("mrow"),h=this.mo("!"),c.type!=e.OPER \
ATOR||"+"!=c.value&&"-"!=c.value?d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,b)),d.appendChild(h);else \
if("diff"==a.value&&null!=this.children&&3==this.children.length)d=document.createElement("mrow"),m=document.createElement("mfrac"),m.appendChild(this.mi("d")),
 +h=document.createElement("mrow"),h.appendChild(this.mi("d")),h.appendChild(this.mi(g \
.value)),m.appendChild(h),d.appendChild(m),c.type!=e.OPERATOR||"+"!=c.value&&"-"!=c.value?d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,b));else \
if("diff"==a.value&&null!=this.children&&4==this.children.length)d=document.createElem \
ent("mrow"),m=document.createElement("mfrac"),a=document.createElement("msup"),a.appen \
dChild(this.mi("d")),a.appendChild(f._toMathML(b)),m.appendChild(a),h=document.createElement("mrow"),
 +h.appendChild(this.mi("d")),a=document.createElement("msup"),a.appendChild(g._toMath \
ML(b)),a.appendChild(f._toMathML(b)),h.appendChild(a),m.appendChild(h),d.appendChild(m \
),c.type!=e.OPERATOR||"+"!=c.value&&"-"!=c.value?d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,b));else \
if("integrate"==a.value&&null!=this.children&&3==this.children.length)d=document.creat \
eElement("mrow"),h=this.mo("\u222b"),h.setAttribute("stretchy","true"),d.appendChild(h),g.type!=e.OPERATOR||"+"!=g.value&&"-"!=g.value?
 +d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,b)),d.appendChild(this.mi("d")),d.appendChild(g._toMathML(b));else \
if("integrate"==a.value&&null!=this.children&&5==this.children.length)d=document.creat \
eElement("mrow"),a=document.createElement("msubsup"),h=this.mo("\u222b"),h.setAttribut \
e("stretchy","true"),a.appendChild(h),a.appendChild(f._toMathML(b)),a.appendChild(m._t \
oMathML(b)),d.appendChild(a),g.type!=e.OPERATOR||"+"!=g.value&&"-"!=g.value?d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,
 +b)),d.appendChild(this.mi("d")),d.appendChild(g._toMathML(b));else \
if("sum"==a.value&&null!=this.children&&5==this.children.length){d=document.createElement("mrow");var \
k=document.createElement("munderover");h=this.mo("\u2211");h.setAttribute("stretchy"," \
true");k.appendChild(h);a=document.createElement("mrow");a.appendChild(g._toMathML(b)) \
;a.appendChild(this.mo("="));a.appendChild(f._toMathML(b));k.appendChild(a);k.appendChild(m._toMathML(b));d.appendChild(k);g.type!=e.OPERATOR||"+"!=g.value&&"-"!=
 +g.value?d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,b))}else \
if("product"==a.value&&null!=this.children&&5==this.children.length)d=document.createE \
lement("mrow"),k=document.createElement("munderover"),h=this.mo("\u220f"),h.setAttribu \
te("stretchy","true"),k.appendChild(h),a=document.createElement("mrow"),a.appendChild( \
g._toMathML(b)),a.appendChild(this.mo("=")),a.appendChild(f._toMathML(b)),k.appendChil \
d(a),k.appendChild(m._toMathML(b)),d.appendChild(k),g.type!=e.OPERATOR||"+"!=g.value&&
 +"-"!=g.value?d.appendChild(c._toMathML(b)):d.appendChild(this.addP(c,b));else \
if("limit"==a.value)d=document.createElement("mrow"),4>this.children.length?d.appendCh \
ild(this.mo("lim")):(a=document.createElement("munder"),a.appendChild(this.mo("lim")), \
h=document.createElement("mrow"),h.appendChild(g._toMathML(b)),h.appendChild(this.mo(" \
\u2192")),h.appendChild(f._toMathML(b)),null!=m&&("plus"==m.value?h.appendChild(this.m \
o("+")):"minus"==m.value&&h.appendChild(this.mo("-"))),a.appendChild(h),d.appendChild(a)),
  d.appendChild(c._toMathML(b));else \
if("binomial"==a.value){d=document.createElement("mrow");d.appendChild(this.mo("("));g \
=document.createElement("mtable");for(f=1;f<this.children.length;f++)a=document.create \
Element("mtr"),a.appendChild(this.children[f]._toMathML(b)),g.appendChild(a);d.appendChild(g);d.appendChild(this.mo(")"))}else \
if("matrix"==a.value){for(f=1;f<this.children.length;f++)if(this.children[f].type!==e.VECTOR)return \
d=document.createElement("mtext"),d.appendChild(document.createTextNode("???")),  \
d;d=document.createElement("mrow");d.appendChild(this.mo("("));g=document.createElemen \
t("mtable");for(f=1;f<this.children.length;f++){a=document.createElement("mtr");for(c= \
0;c<this.children[f].children.length;c++)a.appendChild(this.children[f].children[c]._toMathML(b));g.appendChild(a)}d.appendChild(g);d.appendChild(this.mo(")"))}else \
if("union"==a.value&&3==this.children.length){for(f=1;f<this.children.length;f++)if(this.children[f].type!==e.INTERVAL&&this.children[f].type!==e.SET)return \
d=document.createElement("mtext"),  \
d.appendChild(document.createTextNode("???")),d;d=document.createElement("mrow");d.app \
endChild(c._toMathML(b));d.appendChild(this.mo("\u222a"));d.appendChild(g._toMathML(b))}else \
if("intersection"==a.value&&3==this.children.length){for(f=1;f<this.children.length;f++)if(this.children[f].type!==e.INTERVAL&&this.children[f].type!==e.SET)return \
d=document.createElement("mtext"),d.appendChild(document.createTextNode("???")),d;d=do \
cument.createElement("mrow");d.appendChild(c._toMathML(b));d.appendChild(this.mo("\u2229"));
                
-d.appendChild(g._toMathML(b))}else{d=document.createElement("mrow");d.appendChild(a._ \
toMathML(b));d.appendChild(this.mo("("));for(f=1;f<this.children.length;f++)d.appendCh \
ild(this.children[f]._toMathML(b)),f<this.children.length-1&&d.appendChild(this.mo(m.ARG_SEPARATOR));d.appendChild(this.mo(")"))}return \
d;case e.VECTOR:k=!0;for(f=0;f<this.children.length;f++)this.children[f].type!==e.VECT \
OR&&(k=!1);d=document.createElement("mrow");d.appendChild(this.mo("("));g=document.createElement("mtable");for(f=
                
-0;f<this.children.length;f++){a=document.createElement("mtr");if(k)for(c=0;c<this.chi \
ldren[f].children.length;c++)a.appendChild(this.children[f].children[c]._toMathML(b));else \
a.appendChild(this.children[f]._toMathML(b));g.appendChild(a)}d.appendChild(g);d.appendChild(this.mo(")"));return \
d;case e.INTERVAL:return \
d=document.createElement("mrow"),h=this.interval_type==e.OPEN_OPEN||this.interval_type \
==e.OPEN_CLOSED?this.mo("("):this.mo("["),d.appendChild(h),a=document.createElement("mrow"),a.appendChild(this.children[0]._toMathML(b)),
 +d.appendChild(g._toMathML(b))}else{d=document.createElement("mrow");d.appendChild(a. \
_toMathML(b));d.appendChild(this.mo("("));for(f=1;f<this.children.length;f++)d.appendC \
hild(this.children[f]._toMathML(b)),f<this.children.length-1&&d.appendChild(this.mo(l.ARG_SEPARATOR));d.appendChild(this.mo(")"))}return \
d;case e.VECTOR:m=!0;for(f=0;f<this.children.length;f++)this.children[f].type!==e.VECT \
OR&&(m=!1);d=document.createElement("mrow");d.appendChild(this.mo("("));g=document.createElement("mtable");for(f=
 +0;f<this.children.length;f++){a=document.createElement("mtr");if(m)for(c=0;c<this.ch \
ildren[f].children.length;c++)a.appendChild(this.children[f].children[c]._toMathML(b));else \
a.appendChild(this.children[f]._toMathML(b));g.appendChild(a)}d.appendChild(g);d.appendChild(this.mo(")"));return \
d;case e.INTERVAL:return \
d=document.createElement("mrow"),h=this.interval_type==e.OPEN_OPEN||this.interval_type \
==e.OPEN_CLOSED?this.mo("("):this.mo("["),d.appendChild(h),a=document.createElement("mrow"),a.appendChild(this.children[0]._toMathML(b)),
  a.appendChild(this.mo(":")),a.appendChild(this.children[1]._toMathML(b)),d.appendChi \
ld(a),h=this.interval_type==e.OPEN_OPEN||this.interval_type==e.CLOSED_OPEN?this.mo(")"):this.mo("]"),d.appendChild(h),d;case \
e.SET:d=document.createElement("mrow");d.appendChild(this.mo("{"));a=document.createEl \
ement("mrow");for(f=0;f<this.children.length;f++)0<f&&a.appendChild(this.mo(";")),a.ap \
pendChild(this.children[f]._toMathML(b));d.appendChild(a);d.appendChild(this.mo("}"));return \
                d;case e.SUBSCRIPT:g=document.createElement("msub");
-g.appendChild(a._toMathML(b));if(2<this.children.length){d=document.createElement("mr \
ow");for(f=1;f<this.children.length;f++)d.appendChild(this.children[f]._toMathML(b)),f \
<this.children.length-1&&d.appendChild(this.mo(m.ARG_SEPARATOR));g.appendChild(d)}else \
g.appendChild(c._toMathML(b));return g}};e.prototype.mi=function(b){var \
a=document.createElement("mi");e.symbols[b]&&(b=e.symbols[b]);a.appendChild(document.createTextNode(b));return \
a};e.prototype.mn=function(b){var a=document.createElement("mn"); \
+g.appendChild(a._toMathML(b));if(2<this.children.length){d=document.createElement("mr \
ow");for(f=1;f<this.children.length;f++)d.appendChild(this.children[f]._toMathML(b)),f \
<this.children.length-1&&d.appendChild(this.mo(l.ARG_SEPARATOR));g.appendChild(d)}else \
g.appendChild(c._toMathML(b));return g}};e.prototype.mi=function(b){var \
a=document.createElement("mi");e.symbols[b]&&(b=e.symbols[b]);a.appendChild(document.createTextNode(b));return \
a};e.prototype.mn=function(b){var a=document.createElement("mn");  \
a.appendChild(document.createTextNode(b));return a};e.prototype.mo=function(b){var \
a=document.createElement("mo");e.symbols[b]&&(b=e.symbols[b]);a.appendChild(document.createTextNode(b));return \
a};e.prototype.addP=function(b,a){var \
c,g;c=document.createElement("mrow");g=this.mo("(");var \
f;f=a.colors?a.colors:e.COLORS;g.setAttribute("mathcolor",f[a.depth%f.length]);c.appen \
dChild(g);a.depth++;c.appendChild(b._toMathML(a));a.depth--;g=this.mo(")");g.setAttribute("mathcolor",f[a.depth%f.length]);c.appendChild(g);
  return c};e.symbols={alpha:"\u03b1",beta:"\u03b2",gamma:"\u03b3",delta:"\u03b4",epsi \
lon:"\u03b5",zeta:"\u03b6",eta:"\u03b7",theta:"\u03b8",iota:"\u03b9",kappa:"\u03ba",la \
mbda:"\u03bb",mu:"\u03bc",nu:"\u03bd",xi:"\u03be",omicron:"\u03bf",pi:"\u03c0",rho:"\u \
03c1",sigma:"\u03c3",tau:"\u03c4",upsilon:"\u03c5",phi:"\u03c6",chi:"\u03c7",psi:"\u03 \
c8",omega:"\u03c9",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039a",
  Lambda:"\u039b",Mu:"\u039c",Nu:"\u039d",Xi:"\u039e",Omicron:"\u039f",Pi:"\u03a0",Rho \
:"\u03a1",Sigma:"\u03a3",Tau:"\u03a4",Upsilon:"\u03a5",Phi:"\u03a6",Chi:"\u03a7",Psi:" \
\u03a8",Omega:"\u03a9","#":"\u2260",">=":"\u2265","<=":"\u2264",inf:"\u221e",minf:"-\u221e",hbar:"\u210f",G:"\ud835\udca2"};"use \
strict";p.UNKNOWN=0;p.UNARY=1;p.BINARY=2;p.TERNARY=3;"use \
strict";n.prototype.toString=function(){return this.msg+" at "+this.from+" - \
"+this.to};"use strict";r.prototype.expression=function(b){var a,c=  \
this.current_token;if(null==c)throw new n("Expected something at the \
end",this.tokens[this.tokens.length-1].to+1);this.advance();if(null==c.op)a=new \
e(c.type,null,c.value,null);else{if(null==c.op.nud)throw new n("Unexpected operator \
'"+c.op.id+"'",c.from);a=c.op.nud(this)}for(;null!=this.current_token&&null!=this.curr \
ent_token.op&&b<this.current_token.op.lbp;)c=this.current_token,this.advance(),a=c.op.led(this,a);return \
a};r.prototype.advance=function(b){if(b&&(null==this.current_token||null==this.current_token.op||
  this.current_token.op.id!==b)){if(null==this.current_token)throw new n("Expected \
'"+b+"' at the end",this.tokens[this.tokens.length-1].to+1);throw new n("Expected \
'"+b+"'",this.current_token.from);}this.token_nr>=this.tokens.length?this.current_toke \
n=null:(this.current_token=this.tokens[this.token_nr],this.token_nr+=1)};r.prototype.addHiddenOperators=function(){for(var \
b=this.defs.findOperator("*"),a=this.defs.findOperator("`"),c=!1,g=!1,f=0;f<this.tokens.length-1;f++){var \
                e=this.tokens[f],d=this.tokens[f+
-1];this.unit_mode&&("`"==e.value?c=!0:c&&("^"==e.value?g=!0:g&&e.type==l.NUMBER?g=!1: \
g||e.type!=l.NUMBER?g||e.type!=l.OPERATOR||-1!="*/^()".indexOf(e.value)?e.type==l.NAME \
&&"("==d.value&&(c=!1):c=!1:c=!1));if(e.type==l.NAME&&d.type==l.NAME||e.type==l.NUMBER \
&&d.type==l.NAME||e.type==l.NUMBER&&d.type==l.NUMBER||e.type==l.NUMBER&&("("==d.value| \
|"["==d.value||"{"==d.value)||(")"==e.value||"]"==e.value||"}"==e.value)&&d.type==l.NAME||(")"==e.value||"]"==e.value||"}"==e.value)&&d.type==l.NUMBER||(")"==
                
-e.value||"]"==e.value||"}"==e.value)&&"("==d.value){if(e=this.unit_mode&&!c&&(e.type= \
=l.NUMBER||")"==e.value||"]"==e.value||"}"==e.value)&&(d.type==l.NAME||("("==d.value|| \
"["==d.value||"{"==d.value)&&this.tokens.length>f+2&&this.tokens[f+2].type==l.NAME)){var \
h,m;d.type==l.NAME?(h=d,m=f+1):(m=f+2,h=this.tokens[m]);for(var \
s=0;s<this.constants.length;s++)if(h.value==this.constants[s]){e=!1;break}if(this.tokens.length>m+1&&"("==this.tokens[m+1].value)for(m="pow \
sqrt abs exp factorial diff integrate sum product limit binomial matrix ln log log10 \
mod signum ceiling floor sin cos tan asin acos atan atan2 sinh cosh tanh asinh acosh \
                atanh".split(" "),
-s=0;s<m.length;s++)if(h.value==m[s]){e=!1;break}}e?(d=new \
l(l.OPERATOR,d.from,d.from,a.id,a),c=!0):d=new \
l(l.OPERATOR,d.from,d.from,b.id,b);this.tokens.splice(f+1,0,d)}}};r.prototype.parse=function(b){this.tokens=(new \
t(this.defs,b)).tokenize();if(0==this.tokens.length)return \
null;this.implicit_operators&&this.addHiddenOperators();this.token_nr=0;this.current_t \
oken=this.tokens[this.token_nr];this.advance();b=this.expression(0);if(null!=this.current_token)throw \
                new n("Expected the end",this.current_token.from);
-return b};"use strict";t.prototype.tokenize=function(){var \
b,a,c,g,f;a=0;b=this.text.charAt(a);f=[];a:for(;b;)if(g=a," \
">=b)a++,b=this.text.charAt(a);else{if("0"<=b&&"9">=b||(b===m.DECIMAL_SIGN_1||b===m.DE \
CIMAL_SIGN_2)&&"0"<=this.text.charAt(a+1)&&"9">=this.text.charAt(a+1)){c="";if(b!==m.D \
ECIMAL_SIGN_1&&b!==m.DECIMAL_SIGN_2)for(a++,c+=b;;){b=this.text.charAt(a);if("0">b||"9 \
"<b)break;a++;c+=b}if(b===m.DECIMAL_SIGN_1||b===m.DECIMAL_SIGN_2)for(a++,c+=b;;){b=this.text.charAt(a);if("0">b||"9"<b)break;
                
-a+=1;c+=b}if("e"===b||"E"===b){a++;c+=b;b=this.text.charAt(a);if("-"===b||"+"===b)a++,c+=b,b=this.text.charAt(a);if("0">b||"9"<b)throw \
new n("syntax error in number exponent",g,a);do \
a++,c+=b,b=this.text.charAt(a);while("0"<=b&&"9">=b)}var \
e=+c.replace(m.DECIMAL_SIGN_1,".").replace(m.DECIMAL_SIGN_2,".");if(isFinite(e)){f.push(new \
l(l.NUMBER,g,a-1,c,null));continue}else throw new n("syntax error in \
number",g,a);}for(c=0;c<this.defs.operators.length;c++)if(e=this.defs.operators[c],this.text.substring(a,
                
-a+e.id.length)===e.id){a+=e.id.length;b=this.text.charAt(a);f.push(new \
l(l.OPERATOR,g,a-1,e.id,e));continue \
a}if("a"<=b&&"z">=b||"A"<=b&&"Z">=b||"\u03b1"<=b&&"\u03c9">=b||"\u0391"<=b&&"\u03a9">= \
b||"\u00b5"==b){c=b;for(a++;;)if(b=this.text.charAt(a),"a"<=b&&"z">=b||"A"<=b&&"Z">=b| \
|"\u03b1"<=b&&"\u03c9">=b||"\u0391"<=b&&"\u03a9">=b||"\u00b5"==b||"0"<=b&&"9">=b||"_"===b)c+=b,a++;else \
break;f.push(new l(l.NAME,g,a-1,c,null))}else throw new n("unrecognized \
                operator",g,a);}return f};"use strict";l.UNKNOWN=
-0;l.NAME=1;l.NUMBER=2;l.OPERATOR=3;"use strict";var u=function(b){var \
a,c,e,f,k;a=b.ta;c=b.output_node;a=a.value;f="";for(k=a;k!=f;)f=k,k=f.replace(/\[[^\[\ \
]]*\]/g,"");if(k.split("[").length==k.split("]").length){for(f="";k!=f;)f=k,k=f.replac \
e(/\([^\(\)]*\)/g,"");if(k.split("(").length==k.split(")").length){for(f="";k!=f;)f=k, \
k=f.replace(/\{[^\{\}]*\}/g,"");k.split("{").length==k.split("}").length&&-1!=k.indexO \
f(m.ARG_SEPARATOR)&&(a="["+a+"]")}}if(a!=b.oldtxt){for(b.oldtxt=a;null!=c.firstChild;)c.removeChild(c.firstChild);
                
-c.removeAttribute("title");if(""!=a){b=b.parser;try{if(e=b.parse(a),null!=e){var \
d=document.createElement("math");d.setAttribute("display","block");d.appendChild(e.toM \
athML());c.appendChild(d);MathJax.Hub.Queue(["Typeset",MathJax.Hub,c])}}catch(h){e="error: \
"+h,c.setAttribute("title",e),h instanceof \
n?(c.appendChild(document.createTextNode(a.substring(0,h.from))),e=document.createElem \
ent("span"),e.appendChild(document.createTextNode(a.substring(h.from,h.to+1))),e.className="math-error",c.appendChild(e),
                
-h.to<a.length-1&&c.appendChild(document.createTextNode(a.substring(h.to+1)))):(a=docu \
ment.createTextNode(e),c.appendChild(a))}}}},q=[];return{Definitions:m,ENode:e,Operato \
r:p,ParseException:n,Parser:r,initEditors:function(){MathJax.Hub.Config({messageStyle:"none"});for(var \
b=document.getElementsByClassName("math"),a=0;a<q.length;a++){for(var \
c=q[a].ta,e=!1,f=0;f<b.length;f++)if(b[f]==c){e=!0;break}e||(f=q[a].output_node,f.pare \
                ntNode&&f.parentNode.removeChild(f),q.splice(a,1),a--)}for(a=0;a<b.length;a++)if(c=
                
-b[a],"TEXTAREA"==c.nodeName||"INPUT"==c.nodeName){for(var \
k=-1,f=0;f<q.length;f++)if(q[f].ta==c){k=f;break}var \
e="true"===c.getAttribute("data-implicit_operators"),d="true"===c.getAttribute("data-u \
nit_mode"),h=c.getAttribute("data-constants");h&&(h=h.split(/[\s,]+/));if(-1==k){f=doc \
ument.createElement("span");f.style.display="none";f.style.position="absolute";f.style \
.backgroundColor="rgba(255,255,224,0.9)";f.style.color="black";f.style.border="1px \
                solid #A0A0A0";f.style.padding="5px";f.style.zIndex=
-"1";var m=function(a,b){var c,d=a.getBoundingClientRect();c=a;for(var \
e=0,f=0;c&&!isNaN(c.offsetLeft)&&!isNaN(c.offsetTop);)if(e+=c.offsetLeft-c.scrollLeft,f+=c.offsetTop-c.scrollTop,c=c.offsetParent){var \
g=window.getComputedStyle(c);if("absolute"==g.position||"relative"==g.position)break}c \
=f;b.style.left=e+"px";b.style.top=window.innerHeight>d.bottom+b.offsetHeight?c+a.offs \
etHeight+"px":c-b.offsetHeight+"px"};c.nextSibling?c.parentNode.insertBefore(f,c.nextSibling):c.parentNode.appendChild(f);k=
                
-function(a){return function(b){a.style.display="none"}};c.addEventListener("blur",k(f),!1);c.addEventListener("focus",function(a,b){return \
function(c){""!=a.value&&(b.style.display="block",m(a,b))}}(c,f),!1);f.addEventListener("mouseenter",k(f),!1);k=q.length;q[k]={ta:c,output_node:f,oldtxt:"",parser:new \
r(e,d,h)};e=function(a){return function(b){var \
c=q[a];u(c);document.activeElement==c.ta&&(""!=c.ta.value?(c.output_node.style.display="block",MathJax.Hub.Queue(function(){m(c.ta,c.output_node)})):
                
-c.output_node.style.display="none")}}(k);""!=c.value&&e();c.addEventListener("change",e,!1);c.addEventListener("keyup",e,!1)}else{var \
l,n=q[k].parser;if(h||0!=n.constants.length)if(h){if(l=n.constants.length==h.length)for(f=0;f<h.length;f++)if(n.constants[f]!=h[f]){l=!1;break}}else \
l=!1;else l=!0;n.implicit_operators==e&&n.unit_mode==d&&l||(q[k].parser=new \
r(e,d,h),""!=c.value&&(q[k].oldtxt="",u(q[k])))}}},updateMathSpanAndDiv:function(){for(var \
                b=document.getElementsByClassName("math"),a=[],c=0,
-e=a.length=b.length;c<e;c++)a[c]=b[c];for(c=0;c<a.length;c++)if(b=a[c],("SPAN"==b.nodeName||"DIV"==b.nodeName)&&null!=b.firstChild&&3==b.firstChild.nodeType){var \
e="SPAN"==b.nodeName,f=b.firstChild.nodeValue,k="true"===b.getAttribute("data-implicit \
_operators"),d="true"===b.getAttribute("data-unit_mode"),h=b.getAttribute("data-constants");h&&(h=h.split(/[\s,]+/));k=new \
r(k,d,h);try{var m=k.parse(f);if(null!=m){var \
l=document.createElement("math");l.setAttribute("display",e?"inline":"block");l.appendChild(m.toMathML(["#000000"]));
                
-b.classList.remove("math");b.removeChild(b.firstChild);b.appendChild(l);MathJax.Hub.Queue(["Typeset",MathJax.Hub,b])}}catch(n){b.firstChild.nodeValue="[syntax \
error in math:"+n+"]",b.classList.remove("math")}}}}}(); \
+1];this.unit_mode&&("`"==e.value?c=!0:c&&("^"==e.value?g=!0:g&&e.type==k.NUMBER?g=!1: \
g||e.type!=k.NUMBER?g||e.type!=k.OPERATOR||-1!="*/^()".indexOf(e.value)?e.type==k.NAME \
&&"("==d.value&&(c=!1):c=!1:c=!1));if(e.type==k.NAME&&d.type==k.NAME||e.type==k.NUMBER \
&&d.type==k.NAME||e.type==k.NUMBER&&d.type==k.NUMBER||e.type==k.NUMBER&&("("==d.value| \
|"["==d.value||"{"==d.value)||(")"==e.value||"]"==e.value||"}"==e.value)&&d.type==k.NAME||(")"==e.value||"]"==e.value||"}"==e.value)&&d.type==k.NUMBER||(")"==
 +e.value||"]"==e.value||"}"==e.value)&&"("==d.value){if(e=this.unit_mode&&!c&&(e.type \
==k.NUMBER||")"==e.value||"]"==e.value||"}"==e.value)&&(d.type==k.NAME||("("==d.value| \
|"["==d.value||"{"==d.value)&&this.tokens.length>f+2&&this.tokens[f+2].type==k.NAME)){var \
h,l;d.type==k.NAME?(h=d,l=f+1):(l=f+2,h=this.tokens[l]);for(var \
s=0;s<this.constants.length;s++)if(h.value==this.constants[s]){e=!1;break}if(this.tokens.length>l+1&&"("==this.tokens[l+1].value)for(l="pow \
sqrt abs exp factorial diff integrate sum product limit binomial matrix ln log log10 \
mod signum ceiling floor sin cos tan asin acos atan atan2 sinh cosh tanh asinh acosh \
atanh".split(" "), +s=0;s<l.length;s++)if(h.value==l[s]){e=!1;break}}e?(d=new \
k(k.OPERATOR,d.from,d.from,a.id,a),c=!0):d=new \
k(k.OPERATOR,d.from,d.from,b.id,b);this.tokens.splice(f+1,0,d)}}};r.prototype.parse=function(b){this.tokens=(new \
t(this.defs,b)).tokenize();if(0==this.tokens.length)return \
null;this.implicit_operators&&this.addHiddenOperators();this.token_nr=0;this.current_t \
oken=this.tokens[this.token_nr];this.advance();b=this.expression(0);if(null!=this.current_token)throw \
new n("Expected the end",this.current_token.from); +return b};"use \
strict";t.prototype.tokenize=function(){var \
b,a,c,g,f;a=0;b=this.text.charAt(a);f=[];a:for(;b;)if(g=a," \
">=b)a++,b=this.text.charAt(a);else{if("0"<=b&&"9">=b||(b===l.DECIMAL_SIGN_1||b===l.DE \
CIMAL_SIGN_2)&&"0"<=this.text.charAt(a+1)&&"9">=this.text.charAt(a+1)){c="";if(b!==l.D \
ECIMAL_SIGN_1&&b!==l.DECIMAL_SIGN_2)for(a++,c+=b;;){b=this.text.charAt(a);if("0">b||"9 \
"<b)break;a++;c+=b}if(b===l.DECIMAL_SIGN_1||b===l.DECIMAL_SIGN_2)for(a++,c+=b;;){b=this.text.charAt(a);if("0">b||"9"<b)break;
 +a+=1;c+=b}if("e"===b||"E"===b){a++;c+=b;b=this.text.charAt(a);if("-"===b||"+"===b)a++,c+=b,b=this.text.charAt(a);if("0">b||"9"<b)throw \
new n("syntax error in number exponent",g,a);do \
a++,c+=b,b=this.text.charAt(a);while("0"<=b&&"9">=b)}var \
e=+c.replace(l.DECIMAL_SIGN_1,".").replace(l.DECIMAL_SIGN_2,".");if(isFinite(e)){f.push(new \
k(k.NUMBER,g,a-1,c,null));continue}else throw new n("syntax error in \
number",g,a);}for(c=0;c<this.defs.operators.length;c++)if(e=this.defs.operators[c],this.text.substring(a,
 +a+e.id.length)===e.id){a+=e.id.length;b=this.text.charAt(a);f.push(new \
k(k.OPERATOR,g,a-1,e.id,e));continue \
a}if("a"<=b&&"z">=b||"A"<=b&&"Z">=b||"\u03b1"<=b&&"\u03c9">=b||"\u0391"<=b&&"\u03a9">= \
b||"\u00b5"==b){c=b;for(a++;;)if(b=this.text.charAt(a),"a"<=b&&"z">=b||"A"<=b&&"Z">=b| \
|"\u03b1"<=b&&"\u03c9">=b||"\u0391"<=b&&"\u03a9">=b||"\u00b5"==b||"0"<=b&&"9">=b||"_"===b)c+=b,a++;else \
break;f.push(new k(k.NAME,g,a-1,c,null))}else throw new n("unrecognized \
operator",g,a);}return f};"use strict";k.UNKNOWN= \
+0;k.NAME=1;k.NUMBER=2;k.OPERATOR=3;"use strict";var u=function(b){var \
a,c,e,f,m;a=b.ta;c=b.output_node;a=a.value;f="";for(m=a;m!=f;)f=m,m=f.replace(/\[[^\[\ \
]]*\]/g,"");if(m.split("[").length==m.split("]").length){for(f="";m!=f;)f=m,m=f.replac \
e(/\([^\(\)]*\)/g,"");if(m.split("(").length==m.split(")").length){for(f="";m!=f;)f=m, \
m=f.replace(/\{[^\{\}]*\}/g,"");m.split("{").length==m.split("}").length&&-1!=m.indexO \
f(l.ARG_SEPARATOR)&&(a="["+a+"]")}}if(a!=b.oldtxt){for(b.oldtxt=a;null!=c.firstChild;)c.removeChild(c.firstChild);
 +c.removeAttribute("title");if(""!=a){b=b.parser;try{if(e=b.parse(a),null!=e){var \
d=document.createElement("math");d.setAttribute("display","block");d.appendChild(e.toM \
athML());c.appendChild(d);MathJax.Hub.Queue(["Typeset",MathJax.Hub,c])}}catch(h){e="error: \
"+h,c.setAttribute("title",e),h instanceof \
n?(c.appendChild(document.createTextNode(a.substring(0,h.from))),e=document.createElem \
ent("span"),e.appendChild(document.createTextNode(a.substring(h.from,h.to+1))),e.style.border="solid \
1px red",e.style.minWidth= \
+"1px",c.appendChild(e),h.to<a.length-1&&c.appendChild(document.createTextNode(a.subst \
ring(h.to+1)))):(a=document.createTextNode(e),c.appendChild(a))}}}},q=[];return{Defini \
tions:l,ENode:e,Operator:p,ParseException:n,Parser:r,initEditors:function(){MathJax.Hub.Config({messageStyle:"none"});for(var \
b=document.getElementsByClassName("math"),a=0;a<q.length;a++){for(var \
c=q[a].ta,e=!1,f=0;f<b.length;f++)if(b[f]==c){e=!0;break}e||(f=q[a].output_node,f.parentNode&&f.parentNode.removeChild(f),q.splice(a,1),
 +a--)}for(a=0;a<b.length;a++)if(c=b[a],"TEXTAREA"==c.nodeName||"INPUT"==c.nodeName){e=-1;for(f=0;f<q.length;f++)if(q[f].ta==c){e=f;break}var \
m="true"===c.getAttribute("data-implicit_operators"),d="true"===c.getAttribute("data-u \
nit_mode"),h=c.getAttribute("data-constants");h&&(h=h.split(/[\s,]+/));if(-1==e){f=doc \
ument.createElement("span");f.style.display="none";f.style.position="absolute";f.style \
.backgroundColor="rgba(255,255,224,0.9)";f.style.color="black";f.style.border="1px \
solid #A0A0A0";f.style.padding= +"5px";f.style.zIndex="1";var l=function(a,b){var \
c,d=a.getBoundingClientRect();c=a;for(var \
e=0,f=0;c&&!isNaN(c.offsetLeft)&&!isNaN(c.offsetTop);)if(e+=c.offsetLeft-c.scrollLeft,f+=c.offsetTop-c.scrollTop,c=c.offsetParent){var \
g=window.getComputedStyle(c);if("absolute"==g.position||"relative"==g.position)break}c \
=f;b.style.left=e+"px";b.style.top=window.innerHeight>d.bottom+b.offsetHeight?c+a.offs \
etHeight+"px":c-b.offsetHeight+"px"};c.nextSibling?c.parentNode.insertBefore(f,c.nextSibling):c.parentNode.appendChild(f);
 +c.addEventListener("blur",function(a){return \
function(b){a.style.display="none"}}(f),!1);c.addEventListener("focus",function(a,b){return \
function(c){""!=a.value&&(b.style.display="block",l(a,b))}}(c,f),!1);f.addEventListener("mouseenter",function(a){return \
function(b){a.hasAttribute("title")||(a.style.display="none")}}(f),!1);e=q.length;q[e]={ta:c,output_node:f,oldtxt:"",parser:new \
r(m,d,h)};f=function(a){return function(b){var \
c=q[a];u(c);document.activeElement==c.ta&&(""!=c.ta.value?(c.output_node.style.display=
 +"block",MathJax.Hub.Queue(function(){l(c.ta,c.output_node)})):c.output_node.style.di \
splay="none")}}(e);""!=c.value&&f();c.addEventListener("change",f,!1);c.addEventListener("keyup",f,!1)}else{var \
k,n=q[e].parser;if(h||0!=n.constants.length)if(h){if(k=n.constants.length==h.length)for(f=0;f<h.length;f++)if(n.constants[f]!=h[f]){k=!1;break}}else \
k=!1;else k=!0;n.implicit_operators==m&&n.unit_mode==d&&k||(q[e].parser=new \
r(m,d,h),""!=c.value&&(q[e].oldtxt="",u(q[e])))}}},updateMathSpanAndDiv:function(){for(var \
b= +document.getElementsByClassName("math"),a=[],c=0,e=a.length=b.length;c<e;c++)a[c]= \
b[c];for(c=0;c<a.length;c++)if(b=a[c],("SPAN"==b.nodeName||"DIV"==b.nodeName)&&null!=b.firstChild&&3==b.firstChild.nodeType){var \
e="SPAN"==b.nodeName,f=b.firstChild.nodeValue,m="true"===b.getAttribute("data-implicit \
_operators"),d="true"===b.getAttribute("data-unit_mode"),h=b.getAttribute("data-constants");h&&(h=h.split(/[\s,]+/));m=new \
r(m,d,h);try{var l=m.parse(f);if(null!=l){var \
k=document.createElement("math");k.setAttribute("display", \
+e?"inline":"block");k.appendChild(l.toMathML(["#000000"]));b.classList.remove("math") \
;b.removeChild(b.firstChild);b.appendChild(k);MathJax.Hub.Queue(["Typeset",MathJax.Hub,b])}}catch(n){b.firstChild.nodeValue="[syntax \
                error in math:"+n+"]",b.classList.remove("math")}}}}}();
Index: loncom/html/adm/LC_math_editor/src/ui.js
diff -u loncom/html/adm/LC_math_editor/src/ui.js:1.2 \
                loncom/html/adm/LC_math_editor/src/ui.js:1.3
--- loncom/html/adm/LC_math_editor/src/ui.js:1.2	Tue Feb 24 15:20:44 2015
+++ loncom/html/adm/LC_math_editor/src/ui.js	Wed Feb 25 20:54:06 2015
@@ -79,7 +79,8 @@
                     output_node.appendChild(document.createTextNode(txt.substring(0, \
e.from)));  var span = document.createElement('span');
                     span.appendChild(document.createTextNode(txt.substring(e.from, \
                e.to + 1)));
-                    span.className = 'math-error';
+                    span.style.border = 'solid 1px red';// this used to be CSS \
"math-error", but using CSS caused too many problems +                    \
span.style.minWidth = '1px';  output_node.appendChild(span);
                     if (e.to < txt.length - 1) {
                         \
output_node.appendChild(document.createTextNode(txt.substring(e.to + 1))); @@ -190,6 \
+191,12 @@  an_output_node.style.display = "none";
                     };
                 }
+                var hide_node_if_no_error = function(an_output_node) {
+                    return function(e) {
+                      if (!an_output_node.hasAttribute('title'))
+                        an_output_node.style.display = "none";
+                    };
+                }
                 var focus = function(a_ta, an_output_node) {
                     return function(e) {
                         if (a_ta.value != '') {
@@ -200,7 +207,7 @@
                 };
                 ta.addEventListener("blur", hide_node(output_node), false);
                 ta.addEventListener("focus", focus(ta, output_node), false);
-                output_node.addEventListener("mouseenter", hide_node(output_node), \
false); +                output_node.addEventListener("mouseenter", \
hide_node_if_no_error(output_node), false);  ind_math = math_objects.length;
                 var oldtxt = "";
                 math_objects[ind_math] = {



_______________________________________________
LON-CAPA-cvs mailing list
LON-CAPA-cvs@mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic