var CookieManager={set:function(_1,_2){
var _3=new Date();
_3.setTime(_3.getTime()+(30*24*60*60*1000));
var _4="; expires="+_3.toGMTString();
document.cookie=_1+"="+escape(_2)+_4;
},get:function(_5){
var dc=document.cookie;
var _7=_5+"=";
var _8=dc.indexOf("; "+_7);
if(_8==-1){
_8=dc.indexOf(_7);
if(_8!==0){
return null;
}
}else{
_8+=2;
}
var _9=document.cookie.indexOf(";",_8);
if(_9==-1){
_9=dc.length;
}
return unescape(dc.substring(_8+_7.length,_9));
},erase:function(_a){
var _b=new Date(2000,1,1,19,30,30);
document.cookie=_a+"=; expires="+_b.toGMTString();
}};
CookieManager.setCookiePair=function(_c,_d,_e){
var _f,end;
var _11=CookieManager.get(_c);
var _12=[_d,"@",_e,"#"].join("");
function trimEntry(s){
var a=s.split(",");
return a.slice(3).join(",");
}
if(!_11){
CookieManager.set(_c,_12);
}else{
_f=_11.search(eval("/(^|#)"+_d+"@/"));
if(_f===-1){
_11+=_12;
}else{
if(_11.charAt(_f)==="#"){
_f+=1;
}
end=_11.indexOf("#",_f);
_11=_11.replace(_11.substring(_f,end+1),_12);
}
while(_11.length>600){
_11=trimEntry(_11);
}
CookieManager.set(_c,_11);
}
};
CookieManager.getCookiePair=function(_15,key){
var _17=CookieManager.get(_15);
if(!_17){
return null;
}
var _18=_17.search(eval("/(^|#)"+key+"@/"));
if(_18===-1){
return null;
}
var end=_17.indexOf("#",_18+1);
var s=_17.substring(_18,end);
return s.split("@")[1];
};
var QuillUtil={lang:"hindi",getLangLegacy:function(){
if(window.defaultLang){
return window.defaultLang;
}
var arr;
try{
arr=window.location.pathname.match(/\/[a-z]+/g);
if(window.location.pathname.slice(-1)==="/"){
return arr[arr.length-1].substring(1);
}
return arr[arr.length-2].substring(1);
}
catch(e){
return "hindi";
}
},getLang_:function(){
return QuillUtil.lang;
},setLang_:function(_1c){
QuillUtil.lang=_1c;
},isValidEmailID:function(_1d){
var _1e=_1d.match(/^[0-9a-zA-Z_\.-]+@([0-9a-zA-Z_-]+\.)+[a-zA-Z0-9_-]+$/);
return (_1e!==null);
},isValidEmailIDGroup:function(_1f){
var _20=_1f.split(/[\s\+,]+/);
var _21;
if(_20.length<1){
return false;
}
for(var i=0;i<_20.length;++i){
_21=_20[i].match(/^[0-9a-zA-Z_\.-]+@([0-9a-zA-Z_-]+\.)+[a-zA-Z0-9_-]+$/);
if(_21===null){
return false;
}
}
return true;
},getRandom:function(_23){
var _24=Math.random()-0.5;
_24=_24*Math.pow(2,32);
return Math.floor(_24);
},getBrowser:function(){
var ua=window.navigator.userAgent.toLowerCase();
var _26;
var _27;
var _28;
if(ua.indexOf("opera")!=-1){
return "opera";
}else{
if(ua.indexOf("safari")!=-1){
return "safari";
}else{
if(ua.indexOf("msie 6.0")!=-1||ua.indexOf("msie 7.0")!=-1){
return "ie";
}else{
if(ua.indexOf("mozilla")!=-1){
_27=ua.indexOf("gecko/");
if(_27==-1){
return "oldmoz";
}
_28=ua.indexOf(" ",_27);
if(_28==-1){
_28=ua.length;
}
_26=parseInt(ua.substring(_27+6,_28),10);
if(_26<20051107){
return "oldmoz";
}
return "moz";
}
}
}
}
return "unknown";
},isBlank:function(_29){
if(_29.match(/^\s*$/)){
return true;
}
return false;
},isValidURL:function(_2a){
if(_2a.match(/^http:\/\/.*$/)){
return true;
}
return false;
},isAlpha:function(_2b){
if(_2b.match(/^[a-zA-Z]$/)){
return true;
}
return false;
},getServerAddr:function(){
if(Quill.Config.client.scriptReq){
return Quill.Config.server.location;
}
if(document.domain){
return ("http://"+window.location.host);
}else{
return Quill.Config.server.location;
}
},getServerPath:function(){
var _2c=window.location.pathname.match(/.*\//g);
return ["http://",window.location.host,_2c].join("");
},isValidAlpha:function(_2d){
if(_2d.match(/[a-zA-Z]+/)){
return true;
}
return false;
},getMeta:function(){
var d=document.getElementsByTagName("meta");
var ret={};
var i;
if(!d||!d.length){
logger.error("Could not read meta tags.");
}else{
for(i=0;i<d.length;i++){
if(d[i].name){
ret[d[i].name]=d[i].content;
}
}
}
return ret;
},makeURL:function(_31,req){
var _33="";
for(var i in req){
_33+=[i,"=",encodeURIComponent(req[i])].join("");
}
if(_33){
return [_31,"?",_33].join("");
}else{
return _31;
}
},setupLogging:function(){
try{
try{
if(console.log){
logger={log:console.log,debug:console.debug,info:console.info,warn:console.warn,error:console.error};
}
}
catch(e){
if(logDebug){
logger={log:log,debug:logDebug,info:logDebug,warn:logWarning,error:logError};
}
}
}
catch(e){
logger={log:function(){
},debug:function(){
},info:function(){
},warn:function(){
},error:function(){
}};
}
},setCharEncoding:function(_35){
if(document.defaultCharset){
document.defaultCharset=_35;
}else{
if(document.charset){
document.charset=_35;
}
}
},getNodeText:function(){
var n=MochiKit.DOM.SPAN();
if(typeof (n.textContent)!=="undefined"){
return function(_37){
return _37.textContent;
};
}else{
if(typeof (n.innerText)!=="undefined"){
return function(_38){
return _38.innerText;
};
}else{
return function(_39){
return _39.text;
};
}
}
}(),setNodeText:function(){
var n=MochiKit.DOM.SPAN();
if(typeof (n.textContent)!=="undefined"){
return function(_3b,_3c){
_3b.textContent=_3c;
};
}else{
if(typeof (n.innerText)!=="undefined"){
return function(_3d,_3e){
_3d.innerText=_3e;
};
}else{
return function(_3f,_40){
_3f.text=_40;
};
}
}
}(),getFontSize_:function(){
if(Quill.Config.fontSizes&&Quill.Config.fontSizes.hasOwnProperty(QuillUtil.getLang())){
return Quill.Config.fontSizes[QuillUtil.getLang()];
}else{
return ["12px","20px"];
}
},addStyleSheet:function(doc,url){
var _43=doc.createElement("LINK");
_43.rel="stylesheet";
_43.type="text/css";
_43.href=url;
var _44=doc.getElementsByTagName("head")[0];
if(_44){
_44.appendChild(_43);
}else{
logger.error("addStyleSheet: document.head not found for",doc);
}
},enableLogPane:function(){
var _45=MochiKit.DOM.getElement("logpane");
logger.info=function(){
var s="";
for(var i=0;i<arguments.length;i++){
s+=arguments[i]+" ";
}
_45.appendChild(DIV(s));
if(_45.scrollHeight>_45.clientHeight){
_45.scrollTop=_45.scrollHeight-_45.clientHeight;
}
};
},getCursorPosition:function(_48){
var _49;
if(typeof (_48.selectionStart)!=="undefined"){
_49=_48.selectionEnd;
}else{
if(document.selection){
_48.focus();
var sel=document.selection.createRange();
var _4b=sel.duplicate();
_4b.collapse(true);
var _4c=_4b.moveStart("character",-1000);
return -_4c;
}
}
return _49;
},setCursorPosition:function(_4d,pos){
if(typeof (_4d.selectionStart)!=="undefined"){
_4d.selectionStart=pos;
_4d.selectionEnd=pos;
}else{
if(document.selection){
_4d.focus();
var _4f=_4d.createTextRange();
_4f.collapse(true);
_4f.moveStart("character",pos);
_4f.moveEnd("character",pos);
_4f.select();
}
}
}};
if(typeof (Quill)==="undefined"){
Quill={};
}
Quill.doScriptRequest=function(url,req){
var d=new MochiKit.Async.Deferred();
var id=Quill.doScriptRequest.id;
var dom=MochiKit.DOM;
req.callback="Quill.cbk";
req.scid=id;
var qs=MochiKit.Base.queryString(req);
if(qs){
url+="?"+qs;
}
if(!Quill.doScriptRequest.head){
Quill.doScriptRequest.head=document.getElementsByTagName("head")[0];
}
var _56=dom.createDOM("SCRIPT",{"type":"text/javascript","src":url,"id":"scr"+id});
Quill.doScriptRequest.id+=1;
dom.appendChildNodes(Quill.doScriptRequest.head,_56);
Quill.doScriptRequest.reqmap[id]=d;
return d;
};
Quill.doScriptRequest.id=0;
Quill.doScriptRequest.reqmap={};
Quill.cbk=function(obj,id){
var _59=Quill.doScriptRequest.reqmap;
if(_59.hasOwnProperty(id)){
try{
_59[id].callback(obj);
MochiKit.DOM.removeElement("scr"+id);
}
catch(e){
logger.warn(e);
}
}else{
logger.warn("id",id,"not found");
}
};
Quill.doAsyncRequest=function(){
if(Quill.Config.client.scriptReq){
return Quill.doScriptRequest;
}else{
return MochiKit.Async.doSimpleXMLHttpRequest;
}
}();
WordMapping=function(_5a,_5b,_5c,_5d,_5e){
this.engWord=_5a;
this.tWordList=_5b;
this.preferred=_5c;
this.itrans=_5d;
this.optmap=_5e;
};
var WordMap=function WordMap(_5f){
this.localCache=_5f;
this.wordMap={};
for(var i in Quill.Config.supportedLanguages){
this.wordMap[i]={};
}
};
WordMap.prototype.responseFunc=function(_61,_62,o,_64,r){
var a=[];
var val;
var i;
var itr=true;
var _6a=false;
var _6b;
var _6c;
try{
if(typeof (r.responseText)!=="undefined"){
val=eval("("+r.responseText+")");
}else{
val=r;
}
_6b=CookieManager.getCookiePair(_61+"_prefs",_62);
_6c=Quill.Config.client.maxWordOptions;
if(val.twords[0].options.length<_6c){
_6c=val.twords[0].options.length;
}
for(i=0;i<_6c;i++){
if(val.twords[0].options[i]===val.itrans){
itr=false;
}
a.push(val.twords[0].options[i]);
}
var _6d=val.twords[0].optmap;
if(!itr){
val.itrans=null;
}else{
a=a.splice(0,Quill.Config.client.maxWordOptions-1);
if(val.inString.slice(1).match(/[A-Z]+/)){
a.unshift(val.itrans);
}else{
a.push(val.itrans);
}
}
if(a.length<1){
logger.error("goofup in responseFunc, len(a) < 1");
return;
}
if(_6b!=null){
for(i=0;i<a.length;i++){
if(a[i]===_6b){
_6a=true;
break;
}
}
}
if(!_6a){
if(_62.match(/[\.\/~\^]/)){
o.wordMap[_61][_62]=new WordMapping(_62,[val.itrans],val.itrans,val.itrans,_6d);
}else{
o.wordMap[_61][_62]=new WordMapping(_62,a,a[0],val.itrans,_6d);
}
}else{
o.wordMap[_61][_62]=new WordMapping(_62,a,_6b,val.itrans,_6d);
}
var _6e=CookieManager.getCookiePair(_61+"_userMaps",_62);
if(_6e){
_6e=_6e.split(",");
for(i=0;i<_6e.length;i++){
if(_6e[i]===_6b){
o.wordMap[_61][_62].preferred=_6b;
break;
}
}
o.wordMap[_61][_62].userMapping=_6e;
}
_64(o.getMapping(_61,_62));
}
catch(e){
logger.error(e);
return;
}
};
WordMap.prototype.secondaryResp=function(_6f,_70,o,_72,r){
try{
_72(o.getMapping(_6f,_70));
}
catch(e){
logger.error(e);
return;
}
};
WordMap.prototype.getMapping=function(_74,_75){
if(_74=="english"){
return (new WordMapping(_75,[_75],_75));
}
var m=this.wordMap[_74][_75];
if(m&&m.engWord){
return m;
}else{
return null;
}
};
WordMap.prototype.getWordMapping=function(_77,_78,_79){
if(_77=="english"){
_79(new WordMapping(_78,[_78],_78));
return;
}
var _7a=this.wordMap[_77][_78];
if(_7a&&this.wordMap[_77].hasOwnProperty(_78)){
if(_7a.def){
_7a.def.addCallback(MochiKit.Base.partial(this.secondaryResp,_77,_78,this,_79));
}else{
_79(this.getMapping(_77,_78));
}
return;
}
var req={rand:QuillUtil.getRandom(),lang:_77,inString:_78};
var d=Quill.doAsyncRequest(QuillUtil.getServerAddr()+Quill.Config.server.processWord,req);
d.addCallbacks(MochiKit.Base.partial(this.responseFunc,_77,_78,this,_79),function(e){
logger.error("getWordMapping failed");
});
this.wordMap[_77][_78]={"def":d};
};
WordMap.prototype.setPreferredMapping=function(_7e,_7f,_80){
if(_7e=="english"){
return;
}
var wm=this.wordMap[_7e][_7f];
wm.preferred=_80;
CookieManager.setCookiePair(_7e+"_prefs",_7f,_80);
};
WordMap.prototype.getAllOptions=function(_82,_83){
if(this.wordMap[_82][_83]){
return this.wordMap[_82][_83].tWordList;
}else{
return [];
}
};
WordMap.prototype.correctionRespFunc=function(_84,_85,_86,r){
var val;
var _89;
try{
val=eval("("+r.responseText+")");
_89=this.wordMap[_84][_85].optmap;
if(_89){
for(var i in val.optmap){
if(val.optmap.hasOwnProperty(i)){
if(!_89[i]){
_89[i]=val.optmap[i];
}
}
}
}
_86(val.options,val.optmap);
}
catch(e){
logger.error(e);
}
};
WordMap.prototype.getCorrections=function(_8b,_8c,_8d,pos,_8f,loc){
req={rand:QuillUtil.getRandom(),lang:_8b,currWord:_8c.toString(),userInput:_8d,pos:pos};
var d=Quill.doAsyncRequest(QuillUtil.getServerAddr()+Quill.Config.server.correctionPrefix+loc,req);
d.addCallbacks(MochiKit.Base.method(this,MochiKit.Base.partial(this.correctionRespFunc,_8b,_8d,_8f)),function(e){
console.error("getCorrections failed");
});
};
WordMap.prototype.setUserMapping=function(_93,_94,_95){
var i;
var m=this.wordMap[_93][_94];
for(i=0;i<m.tWordList.length;i++){
if(m.tWordList[i]===_95){
return;
}
}
if(m.userMapping){
for(var i=0;i<m.userMapping.length;i++){
if(m.userMapping[i]===_95){
return;
}
}
m.userMapping.unshift(_95);
}else{
m.userMapping=[_95];
}
CookieManager.setCookiePair(_93+"_userMaps",_94,m.userMapping.toString());
};
WordMap.prototype.setUserMappingList=function(_98,_99,_9a){
var m=this.wordMap[_98][_99];
m.userMapping=_9a;
CookieManager.setCookiePair(_98+"_userMaps",_99,_9a.toString());
};
MochiKit.Base.update(Quill,{isSpecial:function(c){
if(c=="."||c=="/"||c=="^"||c=="~"){
return true;
}
return false;
},splitSpecial:function(s){
var m=s.match(/((([a-zA-Z]+[\.\^~\/]*)*[a-zA-Z]+)|([^a-zA-Z])+)/g);
if(!m){
return [];
}
return m;
},diffStr:function(_9f,_a0){
function diff(o,n){
var ns={};
var os={};
var i;
try{
for(i=0;i<n.length;++i){
if(!ns.hasOwnProperty(n[i])){
ns[n[i]]={rows:[],o:null};
}
ns[n[i]].rows.push(i);
}
for(i=0;i<o.length;++i){
if(!os.hasOwnProperty(o[i])){
os[o[i]]={rows:[],n:null};
}
os[o[i]].rows.push(i);
}
for(i in ns){
if(ns[i].rows.length==1&&os.hasOwnProperty(i)&&os[i].rows.length==1){
n[ns[i].rows[0]]={text:n[ns[i].rows[0]],row:os[i].rows[0]};
o[os[i].rows[0]]={text:o[os[i].rows[0]],row:ns[i].rows[0]};
}
}
for(i=0;i<n.length-1;++i){
if(n[i].text&&!(n[i+1].text)&&(!(o[n[i].row+1])||!(o[n[i].row+1].text))&&n[i+1]==o[n[i].row+1]){
n[i+1]={text:n[i+1],row:n[i].row+1};
o[n[i].row+1]={text:o[n[i].row+1],row:i+1};
}
}
for(i=n.length-1;i>0;--i){
if(n[i].text&&!(n[i-1].text)&&(!(o[n[i].row-1])||!(o[n[i].row-1].text))&&n[i-1]==o[n[i].row-1]){
n[i-1]={text:n[i-1],row:n[i].row-1};
o[n[i].row-1]={text:o[n[i].row-1],row:i-1};
}
}
return {o:o,n:n};
}
catch(ex){
logger.error("diff(javascript) "+ex);
}
}
function diffArray(o,n){
try{
return diff(extend(["x"," "],splitSpecial(o)),extend(["x"," "],splitSpecial(n)));
}
catch(ex){
logger.error("diffArray(javascript) "+ex);
}
}
try{
return diffArray(_9f,_a0);
}
catch(e){
logger.error(e);
}
}});
var OptMgr=function(_a8,_a9,_aa){
var i;
this.mapping=_a8;
this.options=[];
var _ac;
try{
_ac=_a9?_a9:_a8.preferred;
this.lang=_aa?_aa:QuillUtil.getLang();
MochiKit.Base.extend(this.options,_a8.tWordList);
MochiKit.Base.extend(this.options,_a8.userMapping);
}
catch(e){
_ac=null;
this.lang=_aa?_aa:QuillUtil.getLang();
}
this.numOptions=this.options.length;
for(i=0;i<this.options.length;i++){
if(this.options[i]===_ac){
this.chosenOption=i+1;
break;
}
}
};
OptMgr.prototype.chooseOptionWord=function(_ad){
var i;
for(i=0;i<this.options.length;i++){
if(this.options[i]===_ad){
this.chooseOption(i+1);
break;
}
}
};
OptMgr.prototype.chooseOption=function(idx){
if(idx<1||idx>this.numOptions){
return;
}
if(idx===this.chosenOption){
return [idx,this.options[idx-1]];
}
this.chosenOption=idx;
this.mapping.preferred=this.options[idx-1];
wm.setPreferredMapping(this.lang,this.mapping.engWord,this.options[idx-1]);
return [idx,this.options[idx-1]];
};
OptMgr.prototype.chooseNext=function(){
if(this.chosenOption>=this.numOptions){
return this.chooseOption(1);
}else{
return this.chooseOption(this.chosenOption+1);
}
};
OptMgr.prototype.choosePrevious=function(){
if(this.chosenOption<=1){
return this.chooseOption(this.numOptions);
}else{
return this.chooseOption(this.chosenOption-1);
}
};
var OptMenu=function(_b0,_b1){
this.visible=false;
this.table=null;
this.textengine=_b0;
this.TT_ifr=_b1;
this.TT_doc=this.TT_ifr.contentDocument?this.TT_ifr.contentDocument:this.TT_ifr.contentWindow.document;
};
OptMenu.prototype={enabled:function(){
return this.visible;
},update:function(_b2,_b3){
var dom=MochiKit.DOM;
var _b5=MochiKit.Base;
this.node=_b2;
this.mgr=new OptMgr(_b3,null,dom.getNodeAttribute(_b2,"lang"));
var _b6=this;
function makeTR(_b7,_b8,_b9,opt){
var td;
if(opt===_b6.mgr.mapping.preferred){
MochiKit.DOM.withDocument(_b9,function(){
td=dom.TD({style:{background:_b7}},opt);
});
}else{
MochiKit.DOM.withDocument(_b9,function(){
td=dom.TD({style:{background:_b8}},opt);
});
td.onmouseover=function(){
td.style.background=_b7;
};
td.onmouseout=function(){
td.style.background=_b8;
};
}
dom.setElementClass(td,"linkCursor");
td.style.cursor="pointer";
return MochiKit.DOM.withDocument(_b9,function(){
return dom.TR(null,td);
});
}
if(!this.mgr.mapping){
return;
}
var trs=_b5.map(_b5.partial(makeTR,"#C0DAFF","#FFF",this.TT_doc),this.mgr.mapping.tWordList);
if(this.mgr.mapping.userMapping){
_b5.extend(trs,_b5.map(_b5.partial(makeTR,"#FFBFC2","#FFFEF0",this.TT_doc),this.mgr.mapping.userMapping));
}
this.table=MochiKit.DOM.withDocument(this.TT_doc,function(){
return dom.TABLE({cellspacing:"1",cellpadding:"2","class":"optsTable"},dom.TBODY(null,trs));
});
this.table.style.border="1px #C0DAFF solid";
this.table.style.background="white";
this.table.style.padding="1px";
this.table.style.top="0px";
this.table.style.left="0px";
this.table.style.fontSize=this.textengine.getFontSize()[0];
this.table.style.lineHeight=this.textengine.getFontSize()[1];
this.sig=MochiKit.Signal.connect(this.table,"onclick",this,this.onTblClick);
var pos=dom.withDocument(this.textengine.doc,_b5.partial(dom.elementPosition,_b2));
var _be=this.textengine.iframePos();
pos.x+=_be.x;
pos.y+=_be.y+22-this.textengine.displayArea.scrollTop;
this.table.style.position="absolute";
dom.setElementPosition(this.TT_ifr,pos);
var _bf=this.TT_doc;
var _c0=this.table;
MochiKit.DOM.withDocument(this.TT_doc.body,function(){
_bf.body.appendChild(_c0);
});
this.visible=true;
this.TT_ifr.style.display="block";
var _c1=MochiKit.DOM.elementDimensions(this.table);
this.TT_ifr.width=_c1.w;
this.TT_ifr.height=_c1.h;
},onTblClick:function(evt){
var tgt=evt.target();
if(tgt!==this.table&&tgt.nodeName==="TD"){
QuillUtil.setNodeText(this.node,MochiKit.DOM.scrapeText(tgt));
this.mgr.chooseOptionWord(QuillUtil.getNodeText(tgt));
this.cleanup();
}
evt.stop();
},cleanup:function(){
MochiKit.Signal.disconnect(this.sig);
MochiKit.DOM.removeElement(this.table);
this.table=null;
this.visible=false;
this.TT_ifr.style.display="none";
}};
var DropDown=function(_c4,_c5,_c6,_c7){
this.visible=false;
this.table=null;
this.textengine=_c4;
this.myparent=_c5;
this.OPT_ifr=_c6;
this.OPT_doc=this.OPT_ifr.contentDocument?this.OPT_ifr.contentDocument:this.OPT_ifr.contentWindow.document;
this.tooltipid=_c7;
};
DropDown.prototype={enabled:function(){
return this.visible;
},update:function(_c8,_c9){
var dom=MochiKit.DOM;
var _cb=MochiKit.Base;
this.node=_c8;
this.mgr=new OptMgr(_c9,null,dom.getNodeAttribute(_c8,"lang"));
var _cc=this;
function makeTR(_cd,_ce,_cf,opt){
var td;
if(opt===_cc.mgr.mapping.preferred){
td=MochiKit.DOM.withDocument(_cf,function(){
return dom.TD({style:{background:_cd}},opt);
});
}else{
td=MochiKit.DOM.withDocument(_cf,function(){
return dom.TD({style:{background:_ce}},opt);
});
td.onmouseover=function(){
td.style.background=_cd;
};
td.onmouseout=function(){
td.style.background=_ce;
};
}
dom.setElementClass(td,"linkCursor");
td.style.cursor="pointer";
return MochiKit.DOM.withDocument(_cf,function(){
return dom.TR(null,td);
});
}
if(!this.mgr.mapping){
return;
}
var trs=_cb.map(_cb.partial(makeTR,"#C0DAFF","#FFF",this.OPT_doc),this.mgr.mapping.tWordList);
if(this.mgr.mapping.userMapping){
_cb.extend(trs,_cb.map(_cb.partial(makeTR,"#FFBFC2","#FFFEF0",this.OPT_doc),this.mgr.mapping.userMapping));
}
this.table=MochiKit.DOM.withDocument(this.OPT_doc,function(){
return dom.TABLE({cellspacing:"1",cellpadding:"2","class":"optsTableDropDown",width:"100%",background:" white"},dom.TBODY(null,trs));
});
this.table.style.border="1px #C0DAFF solid";
this.table.style.background="white";
this.table.style.padding="1px";
this.table.style.fontSize=this.textengine.getFontSize()[0];
this.table.style.lineHeight=this.textengine.getFontSize()[1];
this.sig=MochiKit.Signal.connect(this.table,"onclick",this,this.onTblClick);
var _d3=this.myparent;
var _d4=this.table;
MochiKit.DOM.withDocument(this.OPT_doc,function(){
MochiKit.DOM.appendChildNodes(_d3,_d4);
});
this.visible=true;
var _d5=this.OPT_doc.getElementById(this.tooltipid);
var _d6=MochiKit.DOM.elementDimensions(_d5);
this.OPT_ifr.width=_d6.w;
this.OPT_ifr.height=_d6.h;
},onTblClick:function(evt){
var tgt=evt.target();
if(tgt!==this.table&&tgt.nodeName==="TD"){
QuillUtil.setNodeText(this.node,MochiKit.DOM.scrapeText(tgt));
this.mgr.chooseOptionWord(QuillUtil.getNodeText(tgt));
this.cleanup();
}
evt.stop();
},cleanup:function(){
MochiKit.Signal.disconnect(this.sig);
MochiKit.DOM.removeElement(this.table);
this.table=null;
this.visible=false;
this.OPT_ifr.style.display="none";
},cleanup_table:function(){
MochiKit.Signal.disconnect(this.sig);
MochiKit.DOM.removeElement(this.table);
this.table=null;
this.visible=false;
}};
function ToolTip(_d9,_da,_db,_dc,_dd,_de){
var dom=MochiKit.DOM;
this.toolTipID=_d9;
var _e0=MochiKit.DOM.getElement(_de);
this.TT_ifr=_e0;
this.TT_doc=_e0.contentDocument?_e0.contentDocument:_e0.contentWindow.document;
this.tdiv=this.TT_doc.getElementById(_d9);
this.tdiv.style.top="0px";
this.tdiv.style.left="0px";
this.textengine=_dd;
if(QuillUtil.getBrowser()==="moz"){
this.tdiv.style.position="fixed";
this.updatePos=function(_e1){
var pos=dom.withDocument(this.textengine.doc,MochiKit.Base.partial(dom.elementPosition,_e1));
var _e3=this.textengine.iframePos();
pos.x+=_e3.x;
pos.y+=_e3.y+24-this.textengine.doc.body.scrollTop;
this.pos=pos;
pos.x-=window.pageXOffset;
pos.y-=window.pageYOffset;
dom.setElementPosition(this.TT_ifr,pos);
};
window.onscroll=MochiKit.Base.method(this,function(){
var pos=this.pos;
if(!pos){
return;
}
MochiKit.DOM.setElementPosition(this.TT_ifr,{x:pos.x-window.pageXOffset,y:pos.y-window.pageYOffset});
});
}else{
this.tdiv.style.position="absolute";
}
this.wordSpan=this.TT_doc.getElementById(_da);
this.optSpan=this.TT_doc.getElementById(_db);
this.dropdown=new DropDown(_dd,this.optSpan,this.TT_ifr,_d9);
this.editorInput=this.TT_doc.getElementById(_dc);
this.TT_ifr.width=1;
this.TT_ifr.height=1;
this.TT_ifr.style.zIndex=1000;
this.TT_ifr.style.display="block";
if(QuillUtil.getBrowser()==="ie"){
this.editorInput.onpaste=function(){
window.event.returnValue=false;
};
}else{
if(QuillUtil.getBrowser()==="moz"){
}
}
}
ToolTip.prototype={show:function(){
var _e5=this.TT_doc.getElementById(this.toolTipID);
var _e6=MochiKit.DOM.elementDimensions(_e5);
this.TT_ifr.width=_e6.w;
this.TT_ifr.height=_e6.h;
if(QuillUtil.getBrowser()==="moz"){
this.tdiv.style.display="table";
this.TT_ifr.style.display="block";
}else{
this.tdiv.style.display="block";
this.TT_ifr.style.display="block";
}
},hide:function(){
if(this.dropdown.table){
this.dropdown.cleanup();
}
this.tdiv.style.display="none";
this.TT_ifr.style.display="none";
},updatePos:function(_e7){
var dom=MochiKit.DOM;
var pos=dom.withDocument(this.textengine.doc,MochiKit.Base.partial(dom.elementPosition,_e7));
var _ea=this.textengine.iframePos();
var _eb=dom.elementDimensions(_e7).h+4;
_eb=_eb<22?22:_eb;
pos.x+=_ea.x;
pos.y+=_ea.y+_eb-this.textengine.doc.body.scrollTop;
dom.setElementPosition(this.TT_ifr,pos);
},update:function(_ec,_ed){
this.node=_ec;
this.updatePos(_ec);
this.setWord(_ed);
if(this.dropdown.table){
this.dropdown.cleanup();
}
this.show();
},changeColor:function(){
this.optSpan.style.color="#F66";
},restoreColor:function(){
this.optSpan.style.color="#66F";
},setWord:function(_ee){
this.word=_ee;
QuillUtil.setNodeText(this.wordSpan,_ee);
},updateOpts:function(_ef,mgr){
total=mgr.numOptions;
this.updatePos(this.node);
this.updateDropDown(this.node,mgr.mapping);
},getWord:function(){
return this.word;
},doneEditing:function(_f1){
clearInterval(this.timer);
MochiKit.Signal.disconnect(this.sig1);
MochiKit.Signal.disconnect(this.sig2);
MochiKit.Signal.disconnect(this.sig3);
this.editorInput.style.display="none";
this.TT_ifr.width="";
this.TT_ifr.height="";
this.TT_ifr.style.display="none";
if(QuillUtil.getBrowser()==="moz"){
this.wordSpan.style.display="table-cell";
}else{
this.wordSpan.style.display="inline";
}
this.hide();
this.restoreColor();
if(this.mode==="correction"){
logger.info("Setting user mapping",this.editorInput.value,this.mgr.mapping.preferred);
wm.setUserMapping(MochiKit.DOM.getNodeAttribute(this.node,"lang"),this.editorInput.value,this.mgr.mapping.preferred);
}
if(this.editorInput.value===""){
this.textengine.doneEditing(this.node,true);
}else{
this.textengine.doneEditing(this.node,false,_f1);
}
},editWord:function(_f2,_f3){
this.editorInput.style.display="inline";
this.wordSpan.style.display="none";
this.TT_ifr.style.display="none";
this.update(_f2,_f3);
this.oldText=_f3;
var _f4=MochiKit.DOM.getNodeAttribute(_f2,"lang");
this.mgr=new OptMgr(wm.getMapping(_f4,_f3),null,_f4);
this.mode="edit";
this.editorInput.focus();
this.editorInput.value=_f3;
this.sig1=MochiKit.Signal.connect(this.editorInput,"onkeydown",this,this.onKeyDown);
this.sig2=MochiKit.Signal.connect(this.editorInput,"onblur",this,this.doneEditing);
this.sig3=MochiKit.Signal.connect(this.editorInput,"onkeypress",this,this.onKeyPress);
this.updateOpts(this.mgr.chosenOption,this.mgr);
this.editorInput.focus();
this.timer=setInterval(MochiKit.Base.method(this,this.contentCheck),500);
},contentCheck:function(){
var dom=MochiKit.DOM;
var _f6=this.editorInput.value;
if(_f6===this.oldText){
return;
}
this.mode="edit";
this.oldText=_f6;
if(_f6.length<=0){
QuillUtil.setNodeText(this.node,"");
dom.setNodeAttribute(this.node,"word","");
return;
}
dom.setNodeAttribute(this.node,"word",_f6);
wm.getWordMapping(dom.getNodeAttribute(this.node,"lang"),_f6,MochiKit.Base.method(this,this.callbackFunc));
},callbackFunc:function(m){
this.mgr=new OptMgr(m,null,this.textengine.getLang());
this.textengine.replaceText(this.node,m.engWord,m.preferred);
this.updateOpts(this.mgr.chosenOption,this.mgr);
this.restoreColor();
},onKeyPress:function(evt){
var s=evt.key().string;
if(!s.match(/[a-zA-Z\^\/~\.]/)&&s.length>0){
evt.stop();
}
},onKeyDown:function(evt){
var s=evt.key().string;
var opt;
logger.info(s);
switch(s){
case "KEY_BACKSPACE":
case "KEY_DELETE":
case "KEY_HOME":
case "KEY_END":
break;
case "KEY_ARROW_RIGHT":
if(QuillUtil.getCursorPosition(this.editorInput)>=this.editorInput.value.length){
this.doneEditing();
}
break;
case "KEY_ARROW_LEFT":
if(QuillUtil.getCursorPosition(this.editorInput)<=0){
this.doneEditing(true);
}
break;
case "KEY_Q":
if(evt.modifier().alt){
this.makeCorrection();
evt.stop();
}
break;
case "KEY_ESCAPE":
case "KEY_ENTER":
case "KEY_SPACEBAR":
evt.stop();
this.doneEditing();
break;
case "KEY_TAB":
evt.stop();
if(evt.modifier().shift){
this.chooseOption("previous");
}else{
this.chooseOption("next");
}
break;
case "KEY_ARROW_UP":
evt.stop();
this.chooseOption("previous");
break;
case "KEY_ARROW_DOWN":
evt.stop();
this.chooseOption("next");
break;
}
},chooseOption:function(_fd){
if(_fd==="prevous"){
opt=this.mgr.choosePrevious();
}else{
opt=this.mgr.chooseNext();
}
QuillUtil.setNodeText(this.node,opt[1]);
this.updateOpts(opt[0],this.mgr);
},setCursorAtStart:function(){
QuillUtil.setCursorPosition(this.editorInput,0);
},updateDropDown:function(_fe,_ff){
if(this.dropdown.table){
this.dropdown.cleanup_table();
}
this.dropdown.update(_fe,_ff);
},makeCorrection:function(){
var pos=QuillUtil.getCursorPosition(this.editorInput);
if(pos<=0){
return;
}
this.mode="correction";
var that=this;
var lang=MochiKit.DOM.getNodeAttribute(this.node,"lang");
var opt=wm.getMapping(lang,this.editorInput.value);
var word=opt.optmap[this.editorInput.value];
function callback(opts,_106){
logger.info(lang);
that.mgr=new OptMgr(new WordMapping(opt.engWord,opts,opts[0],"",_106),opt.preferred,lang);
that.updateOpts(that.mgr.chosenOption,that.mgr);
that.changeColor();
}
QuillUtil.setNodeText(this.optSpan,"...");
if(word){
wm.getCorrections(lang,word,opt.engWord,pos-1,callback,"getCorrections");
}else{
wm.getCorrections(lang,opt.preferred,opt.engWord,pos-1,callback,"getCorrectionsStr");
}
}};
var TextEngine=function(_107,_108,_109,_10a,_10b){
this.lang=_10a||"hindi";
this.enterCallback=_10b;
this.getLang=function(){
return this.lang;
};
this.setLang=function(lang){
this.lang=lang;
};
this.getFontSize=function(){
if(Quill.Config.fontSizes&&Quill.Config.fontSizes.hasOwnProperty(this.lang)){
return Quill.Config.fontSizes[this.lang];
}else{
return ["12px","20px"];
}
};
var ifr=MochiKit.DOM.getElement(_107);
this.ifr=ifr;
this.doc=ifr.contentDocument?ifr.contentDocument:ifr.contentWindow.document;
this.win=ifr.contentWindow;
try{
this.doc.designMode="on";
}
catch(e){
var that=this;
var _10f=false;
MochiKit.Signal.connect(that.win,"onfocus",function(){
if(!_10f){
that.doc.designMode="on";
_10f=true;
}
});
}
if(this.doc.body){
this.displayArea=this.doc.body;
}else{
this.doc.write("<head></head><body></body>");
this.doc.close();
this.displayArea=this.doc.body;
}
this.displayArea.style.overflow="auto";
this.displayArea.style.margin="0px";
this.displayArea.style.padding="1px";
this.displayArea.style.lineHeight="20px";
this.displayArea.style.wordWrap="break-word";
this.setFontSizes();
this.tooltip=new ToolTip(_108+"wordTip",_108+"wordTD",_108+"optTD",_108+"editorInput",this,_108+"iframe_wordTip");
var _110=MochiKit.DOM.getElement(_108+"iframe_wordTip");
var _111=_110.contentDocument?_110.contentDocument:_110.contentWindow.document;
this.menu=new OptMenu(this,_110);
MochiKit.Signal.connect(this.doc,"onkeypress",this,this.onKeyPress);
MochiKit.Signal.connect(this.doc,"onkeydown",this,this.onKeyDown);
MochiKit.Signal.connect(this.doc,"onkeyup",this,this.onKeyUp);
MochiKit.Signal.connect(this.doc,"onclick",this,this.showOptions);
if(QuillUtil.getBrowser()==="moz"){
MochiKit.Signal.connect(this.doc,"onblur",this,this.onBlur);
this.xlitText=this.xlitTextFF;
}else{
MochiKit.Signal.connect(this.win,"onblur",this,this.onBlur);
MochiKit.Signal.connect(this.displayArea,"onpaste",this,this.onPaste);
MochiKit.Signal.connect(this.displayArea,"oncut",this,this.onCut);
}
if(Quill.Config.client.charlimit){
this.count=Quill.Config.client.charlimit;
}
this.countSpan=MochiKit.DOM.getElement(_109);
this.updateCount(0);
if(typeof (this.count)!=="undefined"){
setInterval(MochiKit.Base.method(this,this.updateCount),500);
}
this.callback=MochiKit.Base.method(this,this.callbackFunc);
this.revCallback=MochiKit.Base.method(this,this.reverseCallbackFunc);
this.revOptionsCallback=MochiKit.Base.method(this,this.reverseOptionsCallbackFunc);
};
TextEngine.prototype.charCount=function(){
var txt=this.displayArea.innerHTML;
if(QuillUtil.getBrowser()=="moz"){
txt=txt.replace(/<br>$/i,"");
}
txt=txt.replace(/(<br)/gi,"*$1").replace(/<[^>]*>/g,"").replace(/&nbsp;/gi,"*").replace(/&amp;/gi,"*");
txt=txt.replace(/&lt;/gi,"*").replace(/&gt;/gi,"*").replace(/&quot;/gi,"*").replace(/&apos;/gi,"*");
return txt.length;
};
TextEngine.prototype.removeExtraContent=function(){
var _113=Quill.Config.client.charlimit;
var node;
for(var i=this.displayArea.childNodes.length-1,_116=this.charCount();i>=0&&_116>_113;--i,_116=this.charCount()){
node=this.displayArea.childNodes[i];
if((node.nodeName==="BR")||(node.nodeName==="SPAN"&&typeof (node.word)!=="undefined")){
MochiKit.DOM.removeElement(node);
}else{
var _117=_116-_113;
var txt;
if(typeof (node.innerText)!=="undefined"){
txt=node.innerText;
}else{
if(typeof (node.textContent)!=="undefined"){
txt=node.textContent;
}else{
continue;
}
}
txt=txt.substr(0,txt.length-_117);
if(typeof (node.innerText)!=="undefined"){
node.innerText=txt;
}else{
node.textContent=txt;
}
}
}
};
TextEngine.prototype.updateCount=function(){
if(typeof (this.count)==="undefined"){
return false;
}
var _119=Quill.Config.client.charlimit;
if(_119<1){
return;
}
var _11a=this.charCount();
if(_11a>_119){
this.removeExtraContent();
_11a=this.charCount();
}
var _11b=_119-_11a;
this.count=_11b<0?0:_11b;
QuillUtil.setNodeText(this.countSpan,((_11a>_119)?_119:_11a)+" characters entered. (Max "+_119+" charaters).");
};
TextEngine.prototype.limitReached=function(){
if(typeof (this.count)==="undefined"){
return false;
}
var _11c=Quill.Config.client.charlimit;
if(_11c<1){
return false;
}
return (this.count<=0);
};
TextEngine.prototype.setFontSizes=function(){
var _11d=this.getFontSize();
this.doc.body.style.fontSize=_11d[0];
this.doc.body.style.lineHeight=_11d[1];
var idiv=MochiKit.DOM.getElement("indicDiv");
if(idiv){
idiv.style.fontSize=_11d[0];
idiv.style.lineHeight=_11d[1];
}
var copt=MochiKit.DOM.getElement("cOptions");
if(copt){
copt.style.fontSize=_11d[0];
}
var _120=MochiKit.DOM.getElement("langUnicode");
if(_120){
_120.style.fontSize=_11d[0];
}
var ki=MochiKit.DOM.getElement("keyInput");
if(ki){
ki.style.lineHeight=_11d[1];
}
};
TextEngine.prototype.prefill=function(text){
var sel=this.getSelection();
var lang=this.getLang();
var that=this;
this.setLang("english");
this.xlitText(text,function(_126){
if(sel.atAnchorStart){
if(sel.anchorNode){
that.setCursorBeforeWidget(sel.anchorNode);
}
that.doc.selection.createRange().pasteHTML(_126);
}else{
if(sel.anchorNode){
that.setCursorAfterWidget(sel.anchorNode);
}
that.doc.selection.createRange().pasteHTML(_126);
}
that.setLang(lang);
});
};
TextEngine.prototype.onPaste=function(evt){
var data=window.clipboardData.getData("Text");
var sel=this.getSelection();
var that=this;
this.xlitText(data,function(_12b){
if(sel.atAnchorStart){
if(sel.anchorNode){
that.setCursorBeforeWidget(sel.anchorNode);
}
that.doc.selection.createRange().pasteHTML(_12b);
}else{
if(sel.anchorNode){
that.setCursorAfterWidget(sel.anchorNode);
}
that.doc.selection.createRange().pasteHTML(_12b);
}
});
evt.stop();
};
TextEngine.prototype.setText=function(text){
var that=this;
this.xlitText(text,function(_12e){
logger.info("got callback",_12e);
that.displayArea.innerHTML=_12e;
});
};
TextEngine.prototype.xlitTextFF=function(text,func){
var iarr=Quill.splitSpecial(text);
var _132=iarr.length;
var that=this;
function process(text){
var s="<span>";
var i,_137;
for(i=0;i<text.length;i++){
switch(text.charAt(i)){
case " ":
_137=0;
while(i<text.length&&text.charAt(i)===" "){
_137+=1;
s+="&nbsp;";
i++;
}
if(_137>1){
s=[s.slice(0,-6)," "].join("");
}
i--;
break;
case "\n":
s=[s,"</span><br><span>"].join("");
break;
default:
s=[s,text.charAt(i)].join("");
}
}
return s+"</span>";
}
function callbk(idx,m){
_132-=1;
iarr[idx]=["<span word=\"",m.engWord,"\" lang=\"",that.getLang(),"\">",m.preferred,"</span>"].join("");
if(_132<=0){
func(iarr.join("")+"<br _moz_editor_bogus_node=\"TRUE\" _moz_dirty=\"\"/>");
}
}
for(var i=0;i<iarr.length;i++){
if(iarr[i].match(/[a-zA-Z]/)){
wm.getWordMapping(this.getLang(),iarr[i],MochiKit.Base.partial(callbk,i));
}else{
iarr[i]=process(iarr[i]);
_132-=1;
if(_132<=0){
func(iarr.join(""));
}
}
}
};
TextEngine.prototype.xlitText=function(text,func){
var iarr=Quill.splitSpecial(text);
var _13e=iarr.length;
var that=this;
function process(text){
var s="";
var i,_143;
var _144=false;
for(i=0;i<text.length;i++){
switch(text.charAt(i)){
case " ":
if(!_144){
s+="<span>";
_144=true;
}
_143=0;
while(i<text.length&&text.charAt(i)===" "){
_143+=1;
s+="&nbsp;";
i++;
}
if(_143>1){
s=[s.slice(0,-6)," "].join("");
}
i--;
break;
case "\n":
if(_144){
s=[s,"</span><br>"].join("");
_144=false;
}else{
s=[s,"<br>"].join("");
}
break;
default:
if(!_144){
s+="<span>";
_144=true;
}
s=[s,text.charAt(i)].join("");
}
}
if(_144){
s+="</span>";
}
return s;
}
function callbk(idx,m){
_13e-=1;
iarr[idx]=["<span word=\"",m.engWord,"\" lang=\"",that.getLang(),"\">",m.preferred,"</span>"].join("");
if(_13e<=0){
func(iarr.join(""));
}
}
for(var i=0;i<iarr.length;i++){
if(iarr[i].match(/[a-zA-Z]/)){
wm.getWordMapping(this.getLang(),iarr[i],MochiKit.Base.partial(callbk,i));
}else{
iarr[i]=process(iarr[i]);
_13e-=1;
if(_13e<=0){
func(iarr.join(""));
}
}
}
};
TextEngine.prototype.onCut=function(evt){
window.clipboardData.setData("Text",this.getTextSelection());
this.deleteSelection(this.getSelection(),evt);
};
TextEngine.prototype.onBlur=function(evt){
};
TextEngine.prototype.hideMenu=function(){
if(this.menu.enabled()){
this.menu.cleanup();
}
};
TextEngine.prototype.getSelection=function(){
var _14a;
var _14b;
var _14c;
var _14d;
var that=this;
var sel;
var ret={};
if(this.win.getSelection){
sel=this.win.getSelection();
if(sel.anchorNode.nodeName==="BODY"){
if(sel.anchorOffset===0){
ret.anchorNode=this.displayArea.childNodes[0];
}else{
ret.anchorNode=this.displayArea.childNodes[sel.anchorOffset-1];
}
ret.atAnchorEnd=true;
}else{
if(sel.anchorNode.parentNode&&sel.anchorNode.parentNode.nodeName!=="BODY"){
ret.anchorNode=sel.anchorNode.parentNode;
if(sel.anchorOffset===sel.anchorNode.nodeValue.length){
ret.atAnchorEnd=true;
}
}else{
ret.anchorNode=sel.anchorNode;
if(sel.anchorNode.nodeValue&&sel.anchorOffset===sel.anchorNode.nodeValue.length){
ret.atAnchorEnd=true;
}
}
if(sel.anchorOffset===0){
ret.atAnchorStart=true;
}
}
ret.anchorOffset=sel.anchorOffset;
ret.focusNode=sel.focusNode;
ret.focusOffset=sel.focusOffset;
ret.isCollapsed=sel.isCollapsed;
return ret;
}else{
_14a=this.doc.selection.createRange().duplicate();
_14a.collapse(true);
_14b=this.doc.selection.createRange().duplicate();
_14b.collapse(false);
_14a.pasteHTML("<span id=\"fuquaSpan1\"></span>");
_14c=this.doc.getElementById("fuquaSpan1");
if(_14c){
ret.anchorNode=_14c.parentNode;
try{
if(_14c.previousSibling&&_14c.previousSibling.nodeName==="#text"){
ret.anchorOffset=_14c.previousSibling.nodeValue.length;
}
}
catch(e){
if(e.message==="Invalid Argument."){
ret.anchorOffset=0;
}
}
if(!_14c.nextSibling||_14c.parentNode.nodeName==="BODY"){
ret.atAnchorEnd=true;
}
if(!_14c.previousSibling){
ret.atAnchorStart=true;
}
if(_14a.compareEndPoints("StartToStart",_14b)===0){
ret.isCollapsed=true;
MochiKit.DOM.withDocument(this.doc,function(){
MochiKit.DOM.removeElement(_14c);
});
return ret;
}else{
ret.isCollapsed=false;
}
}
_14b.pasteHTML("<span id=\"fuquaSpan2\"></span>");
_14d=this.doc.getElementById("fuquaSpan2");
if(_14d){
ret.focusNode=_14d.parentNode;
if(_14d.previousSibling&&_14d.previousSibling.nodeName==="#text"){
ret.focusOffset=_14d.previousSibling.nodeValue.length;
}
if(!_14d.previousSibling||_14d.parentNode.nodeName==="BODY"){
ret.atFocusStart=true;
}
}
if(_14c){
MochiKit.DOM.withDocument(this.doc,function(){
MochiKit.DOM.removeElement(_14c);
});
}
if(_14d){
MochiKit.DOM.withDocument(this.doc,function(){
MochiKit.DOM.removeElement(_14d);
});
}
return ret;
}
};
TextEngine.prototype.addNewline=function(node){
var n=MochiKit.DOM.withDocument(this.doc,MochiKit.DOM.BR);
this.add(n,node);
return n;
};
TextEngine.prototype.setCursor=function(_153,node){
var _155;
var sel;
if(this.win.getSelection){
_155=this.doc.createRange();
_155.selectNode(node);
_155.collapse(_153);
sel=this.win.getSelection();
sel.removeAllRanges();
sel.addRange(_155);
}else{
if(this.doc.selection){
logger.info("where",_153,node);
_155=this.displayArea.createTextRange();
_155.moveToElementText(node);
_155.collapse(_153);
_155.select();
}
}
};
TextEngine.prototype.setCursorBeforeWidget=MochiKit.Base.partial(TextEngine.prototype.setCursor,true);
TextEngine.prototype.setCursorAfterWidget=MochiKit.Base.partial(TextEngine.prototype.setCursor,false);
TextEngine.prototype.getTextSelection=function(){
if(this.win.getSelection){
return this.win.getSelection().toString();
}else{
return this.doc.selection.createRange().text;
}
};
TextEngine.prototype.getWidgetAtCursor=function(){
var n;
var sel;
var _159;
var _15a;
var elem;
if(this.win.getSelection){
sel=this.win.getSelection();
n=sel.anchorNode;
if(n.nodeName.toUpperCase()==="BODY"){
_15a=sel.anchorOffset;
if(_15a>0){
_15a-=1;
}
n=this.displayArea.childNodes[_15a];
}else{
if(n.parentNode&&n.parentNode.nodeName.toUpperCase()==="BODY"){
return n;
}
return n.parentNode;
}
return n;
}else{
_159=this.doc.selection.createRange().duplicate();
_159.collapse(true);
_159.pasteHTML("<span id=\"fuquaSpan\"></span>");
elem=this.doc.getElementById("fuquaSpan");
if(elem.parentNode&&elem.parentNode.nodeName!=="BODY"){
n=elem.parentNode;
}else{
n=elem.previousSibling;
}
MochiKit.DOM.withDocument(this.doc,function(){
MochiKit.DOM.removeElement(elem);
});
return n;
}
return null;
};
TextEngine.prototype.showOptions=function(evt){
var tgt=evt.target();
var _15e;
var mgr;
if(this.menu.enabled()){
this.menu.cleanup();
}
this.tooltip.hide();
if(!tgt||tgt===this.displayArea){
return;
}
_15e=this.getWidgetContent(tgt);
if(_15e[0]!=="word"){
return;
}
if(evt.modifier().ctrl||evt.modifier().alt){
evt.stop();
this.tooltip.editWord(tgt,_15e[1]);
}else{
this.menu.update(tgt,wm.getMapping(_15e[2],_15e[1]));
}
};
TextEngine.prototype.getWidgetContent=function(node){
var c=MochiKit.DOM.getNodeAttribute(node,"word");
if(c){
return ["word",c,MochiKit.DOM.getNodeAttribute(node,"lang")];
}
return ["",""];
};
TextEngine.prototype.addText=function(_162,_163,text,lang){
var dom=MochiKit.DOM;
var sp=dom.withDocument(this.doc,function(){
var s=dom.SPAN(text);
dom.setElementClass(s,"spanDispArea");
dom.setNodeAttribute(s,"word",_163);
dom.setNodeAttribute(s,"length",_163.length);
dom.setNodeAttribute(s,"lang",lang);
return s;
});
var font=Quill.Config.fonts[lang];
if(font){
sp.style.fontFamily=font+",'Arial Unicode MS',Arial, Verdana, Helvetica,sans-serif";
}else{
sp.style.fontFamily="Arial, Verdana, Helvetica,sans-serif";
}
var _16a=this.getFontSize();
sp.style.fontSize=_16a[0];
this.add(sp,_162);
return sp;
};
TextEngine.prototype.nuke=function(sel){
function removeRecurse(node,stop){
if(!node){
return;
}
if(node==stop){
MochiKit.DOM.withDocument(this.doc,MochiKit.Base.partial(MochiKit.DOM.removeElement,node));
}else{
removeRecurse(node.nextSibling,stop);
MochiKit.DOM.withDocument(this.doc,MochiKit.Base.partial(MochiKit.DOM.removeElement,node));
}
}
removeRecurse(sel.anchorNode,sel.focusNode);
};
TextEngine.prototype.replaceText=function(n,_16f,text){
if(n){
QuillUtil.setNodeText(n,text);
}else{
logger.warn("Tried to replace non-existent widget at",n,_16f,text);
}
};
TextEngine.prototype.add=function(node,_172){
this.displayArea.insertBefore(node,_172);
};
TextEngine.prototype.addTextNode=function(text,_174){
var n=this.doc.createTextNode(text);
this.add(n,_174);
return n;
};
TextEngine.prototype.addSpan=function(text,_177){
var _178=this.getFontSize();
var t=MochiKit.DOM.withDocument(this.doc,MochiKit.Base.partial(MochiKit.DOM.SPAN,text));
t.style.fontSize=_178[0];
this.add(t,_177);
return t;
};
TextEngine.prototype.remove=function(node){
if(!node){
logger.warn("Tried to remove non-existent widget",node);
}else{
MochiKit.DOM.removeElement(node);
}
};
TextEngine.prototype.getText=function(){
var i;
var txt="";
var ret="";
for(i=0;i<this.displayArea.childNodes.length;i++){
txt=this.displayArea.childNodes[i].innerText;
if(txt){
ret+=txt;
}else{
txt=this.displayArea.childNodes[i].textContent;
if(txt){
ret+=txt;
}else{
if(this.displayArea.childNodes[i].nodeName==="BR"){
ret+="\n";
}else{
txt=QuillUtil.getNodeText(this.displayArea.childNodes[i]);
if(typeof (txt)!=="string"){
txt=this.displayArea.childNodes[i].data;
}
ret+=txt;
}
}
}
}
return ret;
};
TextEngine.prototype.getHTML=function(){
return this.displayArea.innerHTML;
};
TextEngine.prototype.getEnglishText=function(){
var i;
var word;
var ret="";
for(i=0;i<this.displayArea.childNodes.length;i++){
word=MochiKit.DOM.getNodeAttribute(this.displayArea.childNodes[i],"word");
if(word){
ret+=word;
}else{
if(this.displayArea.childNodes[i].nodeName==="BR"){
ret+="\n";
}else{
ret+=QuillUtil.getNodeText(this.displayArea.childNodes[i]);
}
}
}
return ret;
};
TextEngine.prototype.doneEditing=function(node,_182,_183){
this.win.focus();
if(_182){
this.remove(node);
}else{
if(_183){
this.setCursorBeforeWidget(node);
}else{
this.setCursorAfterWidget(node);
}
}
};
TextEngine.prototype.forceFocus=function(){
this.win.focus();
};
TextEngine.prototype.onKeyUp=function(evt){
var s=evt.key().string;
var node;
var c;
var mgr;
var sel;
switch(s){
case "KEY_ARROW_UP":
case "KEY_ARROW_DOWN":
case "KEY_PAGE_UP":
case "KEY_PAGE_DOWN":
case "KEY_HOME":
case "KEY_END":
this.hideMenu();
node=this.getWidgetAtCursor();
c=this.getWidgetContent(node);
if(c[0]==="word"){
mgr=new OptMgr(wm.getMapping(c[2],c[1]),QuillUtil.getNodeText(node),MochiKit.DOM.getNodeAttribute(node,"lang"));
this.tooltip.update(node,c[1]);
this.tooltip.updateOpts(mgr.chosenOption,mgr);
}else{
this.tooltip.hide();
}
break;
}
};
TextEngine.prototype.onKeyDown=function(evt){
var s=evt.key().string;
var node;
var n;
var c;
var word;
var _190;
var mgr,opt;
var sel;
var _194;
switch(s){
case "KEY_ENTER":
this.tooltip.hide();
this.enterCallback();
evt.stop();
break;
case "KEY_BACKSPACE":
sel=this.getSelection();
node=sel.anchorNode;
if(!sel.isCollapsed){
this.deleteSelection(sel,evt);
return;
}
c=this.getWidgetContent(node);
if(sel.atAnchorStart){
if(QuillUtil.getBrowser()==="moz"){
this.setCursorBeforeWidget(sel.anchorNode);
}else{
if(c[0]==="word"){
this.setCursorBeforeWidget(sel.anchorNode);
}
}
return;
}
word=c[1].slice(0,-1);
if(c[0]==="word"){
evt.stop();
if(word<=0){
_190=node.prevSibling;
this.remove(node);
this.tooltip.hide();
if(_190){
this.setCursorAfterWidget(_190);
}
}else{
MochiKit.DOM.setNodeAttribute(node,"word",word);
this.tooltip.update(node,word);
wm.getWordMapping(c[2],word,MochiKit.Base.partial(this.callback,node));
this.setCursorAfterWidget(node);
}
}
break;
case "KEY_ESCAPE":
evt.stop();
break;
case "KEY_ARROW_RIGHT":
sel=this.getSelection();
if(sel.atAnchorEnd&&sel.anchorNode.nextSibling){
c=this.getWidgetContent(sel.anchorNode.nextSibling);
if(c[0]==="word"){
this.tooltip.editWord(sel.anchorNode.nextSibling,c[1]);
this.tooltip.setCursorAtStart();
evt.stop();
}
}else{
if(sel.atAnchorStart){
c=this.getWidgetContent(sel.anchorNode);
if(c[0]==="word"){
this.tooltip.editWord(sel.anchorNode,c[1]);
this.tooltip.setCursorAtStart();
evt.stop();
}
}
}
break;
case "KEY_ARROW_LEFT":
sel=this.getSelection();
if(sel.atAnchorEnd){
c=this.getWidgetContent(sel.anchorNode);
if(c[0]==="word"){
this.tooltip.editWord(sel.anchorNode,c[1]);
evt.stop();
}
}else{
if(sel.atAnchorStart&&sel.anchorNode.previousSibling){
c=this.getWidgetContent(sel.anchorNode.previousSibling);
if(c[0]==="word"){
this.tooltip.editWord(sel.anchorNode.previousSibling,c[1]);
evt.stop();
}
}
}
break;
case "KEY_DELETE":
sel=this.getSelection();
if(sel.isCollapsed){
this.deleteChar(sel,evt);
}else{
this.deleteSelection(sel,evt);
}
break;
case "KEY_TAB":
this.hideMenu();
node=this.getWidgetAtCursor();
c=this.getWidgetContent(node);
if(!c||typeof (c[2])==="undefined"){
break;
}
_194=wm.getMapping(c[2],c[1]);
if(!_194){
break;
}
if(c[0]==="word"){
evt.stop();
mgr=new OptMgr(_194,null,MochiKit.DOM.getNodeAttribute(node,"lang"));
if(evt.modifier().shift){
opt=mgr.choosePrevious();
}else{
opt=mgr.chooseNext();
}
this.tooltip.updateOpts(opt[0],mgr);
QuillUtil.setNodeText(node,opt[1]);
this.setCursorAfterWidget(node);
}
break;
case "KEY_ARROW_UP":
this.hideMenu();
node=this.getWidgetAtCursor();
c=this.getWidgetContent(node);
if(!c||typeof (c[2])==="undefined"){
break;
}
_194=wm.getMapping(c[2],c[1]);
if(!_194){
break;
}
if(c[0]==="word"){
evt.stop();
mgr=new OptMgr(_194,null,MochiKit.DOM.getNodeAttribute(node,"lang"));
opt=mgr.choosePrevious();
this.tooltip.updateOpts(opt[0],mgr);
QuillUtil.setNodeText(node,opt[1]);
this.setCursorAfterWidget(node);
}
break;
case "KEY_ARROW_DOWN":
this.hideMenu();
node=this.getWidgetAtCursor();
c=this.getWidgetContent(node);
if(!c||typeof (c[2])==="undefined"){
break;
}
_194=wm.getMapping(c[2],c[1]);
if(!_194){
break;
}
if(c[0]==="word"){
evt.stop();
mgr=new OptMgr(_194,null,MochiKit.DOM.getNodeAttribute(node,"lang"));
opt=mgr.chooseNext();
this.tooltip.updateOpts(opt[0],mgr);
QuillUtil.setNodeText(node,opt[1]);
this.setCursorAfterWidget(node);
}
break;
case "KEY_L":
if(evt.modifier().ctrl&&evt.modifier().shift){
if(this.getLang()==="english"){
QuillUtil.setLang(QuillUtil.getLangLegacy());
MochiKit.DOM.getElement("langind").checked=true;
}else{
QuillUtil.setLang("english");
MochiKit.DOM.getElement("langeng").checked=true;
}
evt.stop();
}
break;
}
};
TextEngine.prototype.deleteSelection=function(sel,evt){
if(sel.anchorNode.previousSibling){
this.setCursorAfterWidget(sel.anchorNode.previousSibling);
}
if(sel.focusNode.nextSibling){
this.setCursorBeforeWidget(sel.focusNode.nextSibling);
}
this.nuke(sel);
this.tooltip.hide();
evt.stop();
};
TextEngine.prototype.deleteChar=function(sel,evt){
var c;
if(sel.anchorNode.nodeName==="BODY"){
return;
}
logger.info(sel.anchorAtEnd);
var that=this;
function modWord(node,text,lang,_19e){
var _19f=that;
if(text.length<=1){
that.remove(node);
that.tooltip.hide();
}else{
text=text.substring(1);
MochiKit.DOM.setNodeAttribute(node,"word",text);
logger.info("node is",node);
that.tooltip.update(node,text);
wm.getWordMapping(lang,text,function(m){
_19f.callback(node,m);
if(_19e){
_19f.setCursorBeforeWidget(node);
}
});
}
}
if(sel.atAnchorEnd){
c=this.getWidgetContent(sel.anchorNode.nextSibling);
logger.info("yo1",c);
if(c[0]==="word"){
evt.stop();
modWord(sel.anchorNode.nextSibling,c[1],c[2]);
}
}else{
if(sel.atAnchorStart){
c=this.getWidgetContent(sel.anchorNode);
if(c[0]==="word"){
evt.stop();
modWord(sel.anchorNode,c[1],c[2],true);
}
}else{
c=this.getWidgetContent(sel.anchorNode);
logger.info("yo2",c);
if(c[0]==="word"){
evt.stop();
}
}
}
};
TextEngine.prototype.callbackFunc=function(node,m){
var mgr=new OptMgr(m,null,this.lang);
if(MochiKit.DOM.getNodeAttribute(node,"word")===m.engWord){
try{
this.replaceText(node,m.engWord,m.preferred);
}
catch(e){
logger.warn("Exception in callbackFunc",m,node,e);
}
}
if(this.tooltip.getWord()===m.engWord){
this.tooltip.updateOpts(mgr.chosenOption,mgr);
}
};
TextEngine.prototype.onKeyPress=function(evt){
var s=evt.key().string;
var node,_1a7;
var c;
var word;
var t;
var mod=evt.modifier();
var sel=this.getSelection();
if(mod.alt||mod.ctrl){
return;
}
this.hideMenu();
if((s.length!=0)&&this.limitReached()){
evt.stop();
return;
}
if(s.match(/[a-zA-Z]/)){
node=this.getWidgetAtCursor();
if(node){
c=this.getWidgetContent(node);
if(c[0]==="word"){
word=c[1]+s;
MochiKit.DOM.setNodeAttribute(node,"word",word);
this.tooltip.update(node,word);
wm.getWordMapping(c[2],word,MochiKit.Base.partial(this.callback,node));
this.setCursorAfterWidget(node);
}else{
if(QuillUtil.getBrowser()==="moz"&&node.nodeName==="BR"&&!node.nextSibling){
_1a7=this.addText(node,s," ",this.getLang());
_1a7.innerHTML="&nbsp;";
}else{
_1a7=this.addText(node.nextSibling,s," ",this.getLang());
if(QuillUtil.getBrowser()==="moz"){
_1a7.innerHTML="&nbsp;";
}
}
this.setCursorAfterWidget(_1a7);
this.tooltip.update(_1a7,s);
wm.getWordMapping(this.getLang(),s,MochiKit.Base.partial(this.callback,_1a7));
}
}else{
_1a7=this.addText(null,s," ",this.getLang());
this.setCursorAfterWidget(_1a7);
this.tooltip.update(_1a7,s);
wm.getWordMapping(this.getLang(),s,MochiKit.Base.partial(this.callback,_1a7));
}
evt.stop();
}else{
if(s.length!=0){
this.tooltip.hide();
node=this.getWidgetAtCursor();
if(!node){
t=this.addSpan(s,null);
evt.stop();
this.setCursorAfterWidget(t);
return;
}
c=this.getWidgetContent(node);
if(c[0]==="word"){
if(sel.atAnchorStart){
if(sel.anchorNode.previousSibling){
c=this.getWidgetContent(sel.anchorNode.previousSibling);
if(c[0]==="word"){
t=this.addSpan(s,sel.anchorNode);
this.setCursorAfterWidget(t);
evt.stop();
}else{
if(QuillUtil.getBrowser()==="moz"){
this.setCursorAfterWidget(sel.anchorNode.previousSibling);
}else{
t=this.addSpan(s,sel.anchorNode);
this.setCursorAfterWidget(t);
evt.stop();
}
}
}else{
if(QuillUtil.getBrowser()==="moz"){
this.setCursorBeforeWidget(sel.anchorNode);
}else{
t=this.addSpan(s,sel.anchorNode);
this.setCursorAfterWidget(t);
evt.stop();
}
}
return;
}
if(QuillUtil.getBrowser()==="moz"){
this.setCursorAfterWidget(node);
}else{
if(QuillUtil.getBrowser()==="ie"){
t=this.addSpan(s,node.nextSibling);
this.setCursorAfterWidget(t);
evt.stop();
}
}
}
}
}
this.updateCount(-1);
};
TextEngine.prototype.clearTextArea=function(){
var node=this.displayArea.firstChild;
while(node){
var _1ae=node.nextSibling;
MochiKit.DOM.removeElement(node);
node=_1ae;
}
this.displayArea.focus();
};
TextEngine.prototype.setFocus=function(){
if(this.displayArea.lastChild){
this.setCursorAfterWidget(this.displayArea.lastChild);
this.win.focus();
}else{
this.win.focus();
}
};
TextEngine.prototype.getSaveData=function(){
var i;
return MochiKit.Base.serializeJSON(MochiKit.Base.map(function(node){
var word=MochiKit.DOM.getNodeAttribute(node,"word");
if(word){
return ["word",word,QuillUtil.getNodeText(node),MochiKit.DOM.getNodeAttribute(node,"lang")];
}else{
if(node.nodeName==="BR"){
return ["newline"];
}else{
if(node.nodeName==="#text"){
return (node.textContent?["text",node.textContent]:["text",node.data]);
}else{
if(node.nodeName==="SPAN"){
return ["text",QuillUtil.getNodeText(node)];
}
}
}
}
},this.displayArea.childNodes));
};
TextEngine.prototype.iframePos=function(){
return MochiKit.DOM.elementPosition(this.ifr);
};
TextEngine.prototype.load=function(data){
var arr;
var i;
var s;
try{
arr=eval("("+data+")");
}
catch(e){
logger.warn("Got exception in load",e);
return;
}
function process(text){
var s="";
var i,_1b9;
for(i=0;i<text.length;i++){
switch(text.charAt(i)){
case " ":
_1b9=0;
while(i<text.length&&text.charAt(i)===" "){
_1b9+=1;
s+="&nbsp;";
i++;
}
if(_1b9>1){
s=[s.slice(0,-6)," "].join("");
}
i--;
break;
default:
s=[s,text.charAt(i)].join("");
}
}
return s;
}
var _1ba;
if(QuillUtil.getBrowser()==="moz"){
_1ba=MochiKit.DOM.removeElement(this.displayArea.lastChild);
}
for(i=0;i<arr.length;i++){
switch(arr[i][0]){
case "word":
wm.getWordMapping(arr[i][3],arr[i][1],function(){
});
this.addText(null,arr[i][1],arr[i][2],arr[i][3]);
break;
case "text":
s=MochiKit.DOM.withDocument(this.doc,MochiKit.DOM.SPAN);
QuillUtil.setNodeText(s,arr[i][1]);
MochiKit.DOM.appendChildNodes(this.displayArea,s);
break;
case "newline":
break;
default:
logger.warn("Got unknown data in load",arr[i]);
}
}
if(QuillUtil.getBrowser()==="moz"){
MochiKit.DOM.appendChildNodes(this.displayArea,_1ba);
}
this.win.focus();
if(QuillUtil.getBrowser()==="moz"){
this.setCursorBeforeWidget(this.displayArea.lastChild);
}else{
this.setCursorAfterWidget(this.displayArea.lastChild);
}
};
TextEngine.prototype.insertKeyboardChar=function(s){
var t,r;
if(this.win.getSelection){
t=this.doc.createTextNode(s);
r=this.win.getSelection().getRangeAt(0);
r.insertNode(t);
this.doc.designMode="off";
this.doc.designMode="on";
this.setCursorAfterWidget(t);
}else{
r=this.doc.selection.createRange();
r.pasteHTML(s);
r.collapse(false);
r.select();
}
};
TextEngine.prototype.addKeyboardChar=function(s){
var node,_1c0,sel,c,word,t,r;
this.win.focus();
this.hideMenu();
this.tooltip.hide();
if(!s||this.limitReached()){
return;
}
try{
sel=this.getSelection();
}
catch(e){
logger.info("Error getting selection:",e);
}
node=this.getWidgetAtCursor();
if(node){
c=this.getWidgetContent(node);
if(c[0]==="word"){
if(s===" "){
this.setCursorAfterWidget(sel.anchorNode);
}else{
if(sel.isCollapsed&&(sel.anchorNode!==sel.focusNode)&&sel.anchorNode.nodeName.toUpperCase()==="SPAN"&&sel.anchorNode.lastChild){
try{
this.setCursorAfterWidget(sel.anchorNode.lastChild);
}
catch(e){
logger.info("Moving Error: ",e);
}
}
}
this.insertKeyboardChar(s);
node=this.getWidgetAtCursor();
this.getReverseMapping(node);
}else{
if(typeof (sel.anchorNode)!=="undefined"){
if(sel.atAnchorStart){
if(sel.anchorOffset!==0){
this.setCursorBeforeWidget(sel.anchorNode);
}
}else{
if(sel.anchorNode.nodeName.toUpperCase()==="BR"){
this.setCursorBeforeWidget(sel.anchorNode);
}else{
if(sel.anchorOffset===0){
this.setCursorAfterWidget(sel.anchorNode);
}
}
}
}
if(QuillUtil.getBrowser()==="moz"&&node.nodeName==="BR"&&!node.nextSibling){
_1c0=this.addText(node," ",s,this.getLang());
}else{
_1c0=this.addText(node.nextSibling," ",s,this.getLang());
}
this.setCursorAfterWidget(_1c0);
this.getReverseMapping(_1c0);
}
}else{
_1c0=this.addText(null," ",s,this.getLang());
this.getReverseMapping(_1c0);
this.setCursorAfterWidget(_1c0);
}
};
TextEngine.prototype.getReverseMapping=function(node){
var uStr=QuillUtil.getNodeText(node);
if(this.getLang()==="english"){
MochiKit.DOM.setNodeAttribute(node,"word",uStr);
return;
}
var req={rand:QuillUtil.getRandom(),uStr1:uStr,uStr2:"",lang:this.getLang()};
var d=Quill.doAsyncRequest(QuillUtil.getServerAddr()+Quill.Config.server.reverseTrans,req);
d.addCallbacks(MochiKit.Base.partial(this.revCallback,node),function(e){
logger.error("getWordMapping failed");
});
};
TextEngine.prototype.reverseCallbackFunc=function(node,r){
var val;
if(typeof (r.responseText)!=="undefined"){
val=eval("("+r.responseText+")");
}else{
val=r;
}
MochiKit.DOM.setNodeAttribute(node,"word",val.engStr1);
this.tooltip.update(node,val.engStr1);
var uStr=QuillUtil.getNodeText(node);
wm.getWordMapping(this.getLang(),val.engStr1,MochiKit.Base.partial(this.revOptionsCallback,node,uStr));
};
TextEngine.prototype.reverseOptionsCallbackFunc=function(node,uStr,m){
m.preferred=uStr;
var mgr=new OptMgr(m,null,this.lang);
if(this.tooltip.getWord()===m.engWord){
this.tooltip.updateOpts(mgr.chosenOption,mgr);
}
};
MochiKit.Base.update(Quill,{init:function(_1d3,_1d4,_1d5,_1d6,_1d7){
var d=MochiKit.DOM.getElement(_1d3);
if(!d){
return;
}
var _1d9="Quill"+_1d3;
d.innerHTML="\n<table id=\""+_1d9+"mainTable\" class=\"QuillmainTable\" cellspacing=\"1\"> \n<tbody > \n  <tr>\n    <td class=\"QuillwhiteBorderBox\" id=\""+_1d9+"compose\" valign=\"top\" colspan=\"2\">\n      <iframe id=\""+_1d9+"indicOutput\" class=\"QuillindicOutput\" name=\"indicOutput\" frameborder=\"0\" scrolling=\"auto\"></iframe>\n    </td>\n  </tr>\n</tbody>\n</table>\n <iframe id=\""+_1d9+"iframe_wordTip\" class=\"Output\" name=\"iframe_wordTip\" frameborder=\"0\" scrolling=\"no\"></iframe>";
var _1da="\n <table id=\""+_1d9+"wordTip\" class=\"QuillwordTip\" cellspacing=\"0\" cellpadding=\"0\"  top=\"0px\" left=\"0px\" style=\"  display: none; border: 1px #CCC solid; background: #EEE; font-family: Verdana, Lucida Grande, Arial, sans-serif; color: #AAA; \">\n  <tbody>\n    <tr>\n      <td>\n        <input type=\"text\"  size=\"10\" id=\""+_1d9+"editorInput\" style=\"padding-left:2px; border: 0px; display: none\">\n      </td>\n      <td class=\"QuillmyWordTD\" id=\""+_1d9+"wordTD\" style=\"font-size: 11px; padding: 2px 4px 2px 2px;\"></td>\n    </tr>\n    <tr>\n      <td colspan=\"2\" class=\"QuillmyOptTD\" id=\""+_1d9+"optTD\" valign=\"middle\" style=\" font-size: 11px; color: #66F;\"></td>\n    </tr>\n  </tbody>\n</table>";
this.initOnce();
var that=this;
window.setTimeout(function(){
var _1dc=MochiKit.DOM.getElement(_1d9+"iframe_wordTip");
this.ifr_ttt=_1dc;
this.doc=_1dc.contentDocument?_1dc.contentDocument:_1dc.contentWindow.document;
this.win=_1dc.contentWindow;
this.doc.write("<head></head><body>"+_1da+"</body>");
this.doc.close();
this.ifr_ttt.style.display="none";
this.ifr_ttt.style.position="absolute";
var te=new TextEngine(_1d9+"indicOutput",_1d9,_1d7,_1d4,_1d5);
Quill.objects[_1d3]=te;
that.fillLangSelection(_1d6,te);
if(!Quill.objects.defaultEngine){
Quill.objects.defaultEngine=Quill.objects[_1d3];
}
},200);
},initOnce:function(){
QuillUtil.setupLogging();
QuillUtil.setCharEncoding("utf-8");
wm=new WordMap();
this.initOnce=function(){
};
},fillLangSelection:function(_1de,_1df){
var _1e0=MochiKit.DOM.getElement(_1de);
if(!_1e0){
return;
}
var lang="hindi";
var a=[];
a.push([lang,lang.charAt(0).toUpperCase()+lang.substr(1).toLowerCase()]);
for(var l in Quill.Config.supportedLanguages){
if(l!=lang){
a.push([l,l.charAt(0).toUpperCase()+l.substr(1).toLowerCase()]);
}
}
for(var i=0;i<a.length;i++){
var l=a[i][0];
if(QuillUtil.getBrowser()=="ie"){
var o=MochiKit.DOM.OPTION();
o.text=a[i][1];
o.value=l;
_1e0.add(o);
}else{
var o=MochiKit.DOM.OPTION({value:l},a[i][1]);
o.style.fontSize="12px";
_1e0.appendChild(o);
}
}
MochiKit.Signal.connect(_1e0,"onchange",function(ev){
_1df.setLang(_1e0.value);
});
},setCharLimit:function(_1e7){
Quill.Config.client.charlimit=_1e7;
},getLanguageText:function(key){
return this.getObject(key).getText();
},setFocus:function(key){
if(this.getObject(key)){
this.getObject(key).setFocus();
}else{
setTimeout(function(){
Quill.setFocus(key);
},200);
}
},clearText:function(key){
this.getObject(key).clearTextArea();
},getEnglishText:function(key){
return this.getObject(key).getEnglishText(key);
},loadText:function(text,key){
this.getObject(key).prefill(text);
},save:function(key){
return this.getObject(key).getSaveData();
},load:function(data,key){
if(this.getObject(key)){
this.getObject(key).load(data);
}else{
setTimeout(function(){
Quill.load(data,key);
},200);
}
},setLanguage:function(lang,key){
this.getObject(key).setLang(lang);
},objects:{},getObject:function(key){
if(this.objects.hasOwnProperty(key)){
return this.objects[key];
}
return this.objects.defaultEngine;
},appendChar:function(s,key){
if(this.objects.hasOwnProperty(key)){
this.getObject(key).addKeyboardChar(s);
}else{
setTimeout(function(){
Quill.appendChar(s,key);
},200);
}
}});

