//>>built require({cache:{"url:dojox/calc/templates/Standard.html":"
\n\t\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n
\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t(-)\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t
\n\n
\n"}}); define("dojox/calc/Standard",["dojo/_base/declare","dojo/_base/lang","dojo/_base/sniff","dojo/_base/window","dojo/_base/event","dojo/dom-style","dojo/ready","dojo/keys","dijit/registry","dijit/typematic","dijit/_WidgetBase","dijit/_WidgetsInTemplateMixin","dijit/_TemplatedMixin","dijit/form/_TextBoxMixin","dojox/math/_base","dijit/TooltipDialog","dojo/text!./templates/Standard.html","dojox/calc/_Executor","dijit/Menu","dijit/MenuItem","dijit/form/ComboButton","dijit/form/Button","dijit/form/TextBox"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f,_10,_11,_12){ return _1("dojox.calc.Standard",[_b,_d,_c],{templateString:_11,readStore:null,writeStore:null,functions:[],executorLoaded:function(){ _7(_2.hitch(this,function(){ this.loadStore(this.readStore,true); this.loadStore(this.writeStore); })); },saveFunction:function(_13,_14,_15){ this.functions[_13]=this.executor.normalizedFunction(_13,_14,_15); this.functions[_13].args=_14; this.functions[_13].body=_15; },loadStore:function(_16,_17){ if(!_16){ return; } _16.query({}).forEach(_2.hitch(this,function(_18){ _2.hitch(this,_17?this.executor.normalizedFunction:this.saveFunction)(_18.name,_18.args,_18.body); })); },parseTextbox:function(){ var _19=this.textboxWidget.textbox.value; if(_19==""&&this.commandList.length>0){ this.setTextboxValue(this.textboxWidget,this.commandList[this.commandList.length-1]); _19=this.textboxWidget.textbox.value; } if(_19!=""){ var ans=this.executor.eval(_19); if((typeof ans=="number"&&isNaN(ans))){ if(this.commandList.length==0||this.commandList[this.commandList.length-1]!=_19){ this.commandList.push(_19); } this.print(_19,false); this.print("Not a Number",true); }else{ if(((typeof ans=="object"&&"length" in ans)||typeof ans!="object")&&typeof ans!="function"&&ans!=null){ this.executor.eval("Ans="+ans); if(this.commandList.length==0||this.commandList[this.commandList.length-1]!=_19){ this.commandList.push(_19); } this.print(_19,false); this.print(ans,true); } } this.commandIndex=this.commandList.length-1; if(this.hasDisplay){ this.displayBox.scrollTop=this.displayBox.scrollHeight; } _e.selectInputText(this.textboxWidget.textbox); }else{ this.textboxWidget.focus(); } },cycleCommands:function(_1a,_1b,_1c){ if(_1a==-1||this.commandList.length==0){ return; } var _1d=_1c.charOrCode; if(_1d==_8.UP_ARROW){ this.cycleCommandUp(); }else{ if(_1d==_8.DOWN_ARROW){ this.cycleCommandDown(); } } },cycleCommandUp:function(){ if(this.commandIndex-1<0){ this.commandIndex=0; }else{ this.commandIndex--; } this.setTextboxValue(this.textboxWidget,this.commandList[this.commandIndex]); },cycleCommandDown:function(){ if(this.commandIndex+1>=this.commandList.length){ this.commandIndex=this.commandList.length; this.setTextboxValue(this.textboxWidget,""); }else{ this.commandIndex++; this.setTextboxValue(this.textboxWidget,this.commandList[this.commandIndex]); } },onBlur:function(){ if(_3("ie")){ var tr=_4.doc.selection.createRange().duplicate(); var _1e=tr.text||""; var ntr=this.textboxWidget.textbox.createTextRange(); tr.move("character",0); ntr.move("character",0); try{ ntr.setEndPoint("EndToEnd",tr); this.textboxWidget.textbox.selectionEnd=(this.textboxWidget.textbox.selectionStart=String(ntr.text).replace(/\r/g,"").length)+_1e.length; } catch(e){ } } },onKeyPress:function(e){ if(e.charOrCode==_8.ENTER){ this.parseTextbox(); _5.stop(e); }else{ if(e.charOrCode=="!"||e.charOrCode=="^"||e.charOrCode=="*"||e.charOrCode=="/"||e.charOrCode=="-"||e.charOrCode=="+"){ if(_3("ie")){ var tr=_4.doc.selection.createRange().duplicate(); var _1f=tr.text||""; var ntr=this.textboxWidget.textbox.createTextRange(); tr.move("character",0); ntr.move("character",0); try{ ntr.setEndPoint("EndToEnd",tr); this.textboxWidget.textbox.selectionEnd=(this.textboxWidget.textbox.selectionStart=String(ntr.text).replace(/\r/g,"").length)+_1f.length; } catch(e){ } } if(this.textboxWidget.get("value")==""){ this.setTextboxValue(this.textboxWidget,"Ans"); }else{ if(this.putInAnsIfTextboxIsHighlighted(this.textboxWidget.textbox,_5.charOrCode)){ this.setTextboxValue(this.textboxWidget,"Ans"); _e.selectInputText(this.textboxWidget.textbox,this.textboxWidget.textbox.value.length,this.textboxWidget.textbox.value.length); } } } } },insertMinus:function(){ this.insertText("-"); },print:function(_20,_21){ var t=""; }else{ t+="text-align:left;'>"; } t+=_20+"
"; if(this.hasDisplay){ this.displayBox.innerHTML+=t; }else{ this.setTextboxValue(this.textboxWidget,_20); } },setTextboxValue:function(_22,val){ _22.set("value",val); },putInAnsIfTextboxIsHighlighted:function(_23){ if(typeof _23.selectionStart=="number"){ if(_23.selectionStart==0&&_23.selectionEnd==_23.value.length){ return true; } }else{ if(document.selection){ var _24=document.selection.createRange(); if(_23.value==_24.text){ return true; } } } return false; },clearText:function(){ if(this.hasDisplay&&this.textboxWidget.get("value")==""){ this.displayBox.innerHTML=""; }else{ this.setTextboxValue(this.textboxWidget,""); } this.textboxWidget.focus(); },insertOperator:function(_25){ if(typeof _25=="object"){ _25=_25=_9.getEnclosingWidget(_25["target"]).value; } if(this.textboxWidget.get("value")==""||this.putInAnsIfTextboxIsHighlighted(this.textboxWidget.textbox)){ _25="Ans"+_25; } this.insertText(_25); },insertText:function(_26){ setTimeout(_2.hitch(this,function(){ var _27=this.textboxWidget.textbox; if(_27.value==""){ _27.selectionStart=0; _27.selectionEnd=0; } if(typeof _26=="object"){ _26=_26=_9.getEnclosingWidget(_26["target"]).value; } var _28=_27.value.replace(/\r/g,""); if(typeof _27.selectionStart=="number"){ var pos=_27.selectionStart; var cr=0; if(_3("opera")){ cr=(_27.value.substring(0,pos).match(/\r/g)||[]).length; } _27.value=_28.substring(0,_27.selectionStart-cr)+_26+_28.substring(_27.selectionEnd-cr); _27.focus(); pos+=_26.length; _e.selectInputText(this.textboxWidget.textbox,pos,pos); }else{ if(document.selection){ if(this.handle){ clearTimeout(this.handle); this.handle=null; } _27.focus(); this.handle=setTimeout(function(){ var _29=document.selection.createRange(); _29.text=_26; _29.select(); this.handle=null; },0); } } }),0); },hasDisplay:false,postCreate:function(){ this.handle=null; this.commandList=[]; this.commandIndex=0; if(this.displayBox){ this.hasDisplay=true; } if(this.toFracButton&&!_12.toFrac){ _6.set(this.toFracButton.domNode,{visibility:"hidden"}); } if(this.functionMakerButton&&!_12.FuncGen){ _6.set(this.functionMakerButton.domNode,{visibility:"hidden"}); } if(this.grapherMakerButton&&!_12.Grapher){ _6.set(this.grapherMakerButton.domNode,{visibility:"hidden"}); } this._connects.push(_a.addKeyListener(this.textboxWidget.textbox,{charOrCode:_8.UP_ARROW,shiftKey:false,metaKey:false,ctrlKey:false},this,this.cycleCommands,200,200)); this._connects.push(_a.addKeyListener(this.textboxWidget.textbox,{charOrCode:_8.DOWN_ARROW,shiftKey:false,metaKey:false,ctrlKey:false},this,this.cycleCommands,200,200)); this.startup(); }}); });