]> code.citadel.org Git - citadel.git/blob - webcit/static/richtext_compressed.js
* Message entry using Kevin Roth's excellent cross-platform richtext
[citadel.git] / webcit / static / richtext_compressed.js
1 $="­Û=ú;­rng;­curr»Õ;­allÕs¯¢;­isIE;­isGüo;­isSafari;­isK¼quãor;­§;­ô;­cssFiý;functi¼ ðitÕ(imgPath,ðcPath,cssÖ­ua=navigator.usãAg»óÉisIE=(Ëmsie¢)!=-1)&&Ëopãa¢)==-1)&&Ëwebtv¢)==-1)ÉisGüo=Ëgüo¢)!=-1ÉisSafari=Ësafari¢)!=-1ÉisK¼quãor=Ëk¼quãor¢)!=-1)º¤ým»ById&&¨dÏ&&!isSafari&&!isK¼quãorÖÛ=true;}â!isIE)¨captureEv»s(Ev».MOUSEOVER|Ev».MOUSEOUT|Ev».MOUSEDOWN|Ev».MOUSEUPɨ¼mouseovã=raiseBÇ;¨¼mouseout=normalBÇ;¨¼mousedown=lowãBÇ;¨¼mouseup=raiseBÇ;§=imgPath;ô=ðcPath;cssFiý=cssºÛ)ßstyý type¯text/css¢>@import ¢'+ô+'®.css¢;</styý>'É´writeRichText×ht,bÇs,ÃÖâÛÖâallÕsÞ>0)allÕs+¯;¢;allÕs+=®;writeÕ×ht,bÇs,Ã)ÄwriteDefault×ht,bÇs,ÃÉ}´writeDefault×ht,bÇs,ÃÖâ!ÃÖßtextarea nȯª¢ id¯ª¢ styý¯Ó: '+Ó+'px; ù: '+ù+'px;¢>'+î+'</textarea>')Äßtextarea nȯª¢ id¯ª¢ styý¯Ó: '+Ó+'px; ù: '+ù+'px;¢ read¼ly>'+î+'</textarea>'É}´raiseÿ.Ѻø'||øLowãed'Öel.Ñ='®IáRaised';}´normalÿ.ѺøRaised'||øLowãed'Öel.Ñ='®Iá';}´lowãÿ.Ѻø'||øRaised'Öel.Ñ='®IáLowãed';}´writeÕ×ht,bÇs,ÃÖâÃ)bÇs=úºisIEÖâbÇs&&(Ó<600))Ó=600;­tabýÓ=ÓÄâbÇs&&(Ó<500))Ó=500;­tabýÓ=Ó+4;}âbÇs==trueÖßtabý class¯®Back¢ cellpaddðg=2 cellspacðg=0 id¯BÇs1_ª¢©'+tabýÓ+'¢õtr¦<td¦        <s¬ id¯formatblock_ª¢ ¼chû¯S¬(\\'ª\\', this.idÉ¢¦               <« à¯¢>[Styý]°¯<p>¢>Paragraph°¯<h1Ú1 <h1>°¯<h2Ú2 <h2>°¯<h3Ú3 <h3>°¯<h4Ú4 <h4>°¯<h5Ú5 <h5>°¯<h6Ú6 <h6>°¯<address>¢>Address <ADDR>°¯<pre>¢>Formatted <pre></«¦    </s¬¦</td¦<td¦  <s¬ id¯f¼tnÈ_ª¢ ¼chû¯S¬(\\'ª\\', this.id)¢¦             <« à¯F¼t¢ s¬ed>[F¼t]°¯Arial, Helvetica, sans-sãif¢>Arial°¯Couriã New, Couriã, m¼o¢>Couriã New°¯Times New Roman, Times, sãif¢>Times New Roman°¯Vãdana, Arial, Helvetica, sans-sãif¢>Vãdana</«¦   </s¬¦</td¦<td¦  <s¬ uns¬abý¯¼¢ id¯f¼tsize_ª¢ ¼chû¯S¬(\\'ª\\', this.idÉ¢¦                <« à¯Size¢>[Size]°¯1¢>1°¯2¢>2°¯3¢>3°¯4¢>4°¯5¢>5°¯6¢>6°¯7¢>7</«¦ </s¬¦</td¦<td©100%¢¦</tdõ/tr>'Éß/tabý>'Éßtabý class¯®Back¢ cellpaddðg¯0¢ cellspacðg¯0¢ id¯BÇs2_ª¢©'+tabýÓ+'¢õtr¦<td²'+§+'boldÂBoldÐBoldÀboldÌitalicÂItalicÐItalicÀitalicÌundãlðeÂUndãlðeÐUndãlðeÀundãlðe¸\\')¢æ§+'ýft_justÂAlign LeftÐAlign LeftÀjustifyýftÌc»reÂC»ãÐC»ãÀjustifyc»ãÌright_justÂAlign RightÐAlign RightÀjustifyrightÌjustifyfullÂJustify FullÐJustify Full¢ ¼c½t(\\'ª¸justifyfull¸\\')¢æ§+'hrÂHoriz¼tal RuýÐHoriz¼tal RuýÀðsãthoriz¼talruý¸\\')¢æ§+'numbãed_listÂOrdãed ListÐOrdãed ListÀðsãtordãedlistÌlistÂUnordãed ListÐUnordãed ListÀðsãtunordãedlist¸\\')¢æ§+'outd»ÂOutd»ÐOutd»Àoutd»Ìðd»ÂInd»ÐInd»Àðd»¸\\')¢µ><div id¯foreí_ª¢²'+§+'textíÂText ColorÐText ColorÀforeí¸\\')¢></divµ><div id¯hiliteí_ª¢²'+§+'bgíÂBackground ColorÐBackground ColorÀhiliteí¸\\')¢></divæ§+'hypãlðkÂInsãt LðkÐInsãt LðkÀcreatelðk\\')¢µ²'+§+'iáÂAdd IáÐAdd Iᢠ¼Click¯AddIá(\\'ª\\')¢></td>')ºisIEÖ£ln('               <td²'+§+'spellchüÂSpell ChüÐSpell Chü¢ ¼Click¯chüspell()¢></td>'É}£ln('         <td©100%¢></tdõ/tr>'Éß/tabý>'É}ßiï id¯ª¢ nȯª¢©'+Ó+'px¢ ù¯'+ù+'px¢></iï>')º!Ã)ßbr /><ðput type¯chübox¢ id¯chkSrcª¢ ¼click¯toggýHTMLSrc(\\'ª\\'É¢ />&nbsp;View Source'Éßiï©154¢ ù¯104¢ id¯cpª¢ src¯'+ô+'paýtte.htm¢ margðÓ¯0¢ margðù¯0¢ scrollðg¯no¢ styý¯visibility:hidden; display: n¼e; positi¼: absolute;¢></iï>'Éßðput type÷ id¯hdnª¢ nȯª¢ à¯¢>'É¥'hdn'+®).à=î;enabýDÏ(®,î,ÃÉ´enabýDÏ(®,î,ÃÖ­ïHtml¯<î id=\\¢¢+®+¢\\¢>¾+¯<head>\\n¢ºcssFiýÞ>0ÖïHtml+¯<lðk media=\\¢all\\¢ type=\\¢text/css\\¢ href=\\¢¢+cssFiý+¢\\¢ rel=\\¢styýsheet\\¢>\\n¢ÄïHtml+¯<styý>¾+¯body {¾+¯      background: #FFFFFF;¾+¯ margð: 0px;¾+¯  paddðg: 0px;¾+¯}¾+¯</styý>\\n¢;}ïHtml+¯</head>¾+¯<body>¾+=î+¢¾+¯</body>¾+¯</î>¢º¨allÖ­oÕ=ïs[®].docum»;¹open(ɹwrite(ïHtmlɹclose()º!Ã)¹dϯOn¢Ätry{â!Ã)¥®).c¼t»Docum».dϯ¼¢;try{­oÕ=¥®).Î.docum»;¹open(ɹwrite(ïHtmlɹclose()ºisGüo&&!ÃÖ¹addEv»Listenã(¢keypress¢,kb_handlã,trueÉ}}catch(eÖalãt(¢Error preloadðg c¼t».¢É}}catch(eÖâisGüoÖsetTimeout(¢enabýDÏ('¢+®+¢', '¢+î+¢', ¢+Ã+¢É¢,10)Äreturn ú;}}}´updateÕs(Ö­vÕs=allÕs.split(¢;¢Éfor(­i=0;i<vÕsÞ;i++ÖupdateÕ(vÕs[i]É}´updateÕ(®Öâ!Û)return;­oHdnMessage=¥'hdn'+®É­oÕ=¥®É­Ã=úº¨allÖâïs[®].¨dÏ!¯On¢)Ã=trueÄ⥮).c¼t»Docum».dÏ!¯¼¢)Ã=true;}âÛ&&!ÃÖ⥢chkSrc¢+®).chüedÖ¥¢chkSrc¢+®).chüed=ú;toggýHTMLSrc(®É}â¿à==null)¿à¯¢º¨allÖ¿à=ïs[®].¨ÊÄ¿à=¹Î.¨Ê;}âstripHTML(¿àÜ¢&nbsp;¢,¢ ¢))=¯¢&&¿àó).search(¢<hr¢)==-1&&¿àó).search(¢<img¢)==-1)¿à¯¢ºescape(¿à)=¯%3Cbr%3E%0D%0A%0D%0A%0D%0A¢)¿à¯¢;}´toggýHTMLSrc(®Öç=ïs[®].docum»ÄoÕ=¥®).Î.docum»;}⥢chkSrc¢+®).chüedÖ¥¢BÇs1_¢Í÷;¥¢BÇs2_¢Í÷º¨allÖ¹body.ðnãText=¹ÊÄ­îSrc=¹createTextNode(¹Êɹʯ¢;¹body.appendChild(îSrcÉ}}else{¥¢BÇs1_¢Í¯visibý¢;¥¢BÇs2_¢Í¯visibý¢º¨allÖ­output=escape(¹body.ðnãTextÉoutput=outputÜ¢%3CP%3E%0D%0A%3CHR%3E¢,¢%3CHR%3E¢Éoutput=outputÜ¢%3CHR%3E%0D%0A%3C/P%3E¢,¢%3CHR%3E¢É¹Ê=unescape(output)Ä­îSrc=¹body.ownãDocum»ège(ÉîSrc.s¬NodeC¼t»s(¹bodyɹÊ=îSrc.toSÆ(É}}´FormatText(®,cÒ,«Öç=ïs[®];­Ô=¹¨ÔºÔ!=nullÖrng=Ôège(É}}else{oÕ=¥®).Î;­Ô=¹getS¬i¼(Érng=Ô.getRûAt(Ô.rûCount-1).cl¼eRû(É}try{â(cÒ=¯foreí¢)||(cÒ=¯hiliteí¢)Öpar».cÒ=cÒ;curr»Õ=®;bÇEým»=¥cÒ+'_'+®É¥'cp'Áýft=getÅLeft(bÇEým»,4)+¢px¢;¥'cp'Átop=(getÅTop(bÇEým»,4)+bÇEým»ëHeight+4)+¢px¢º¥'cp'Í=÷Ö¥'cp'ͯvisibý¢;¥'cp'Ádisplay¯ðlðe¢Ä¥'cp'Í÷;¥'cp'Ádisplay¯n¼e¢;}}else âcÒ=¯createlðk¢Ö­szURL=prompt(¢Entã a URL:¢,¢¢Étry{ö¢Unlðk¢,ú,nullÉö¢CreateLðk¢,ú,szURLÉ}catch(eÖ}}else{êöcÒ,ú,«Éê}}catch(eÖalãt(eÉ}´setColor(íÖ­®=curr»Õ;ç=ïs[®]ÄoÕ=¥®).Î;}­par»CÒ=par».cÒº¨allÖ­sel=¹¨Ôºpar»CÒ=¯hiliteí¢)par»CÒ¯backí¢ºsel!=nullÖ­newRng=selège(ÉnewRng=rng;newRng.s¬(É}}êöpar»CÒ,ú,íÉê¥'cp'Í÷;¥'cp'Ádisplay¯n¼e¢;´AddIá(®Öç=ïs[®];­Ô=¹¨ÔºÔ!=nullÖrng=Ôège(É}}else{oÕ=¥®).Î;­Ô=¹getS¬i¼(Érng=Ô.getRûAt(Ô.rûCount-1).cl¼eRû(É}iáPath=prompt('Entã Iá URL:','http://')º(iáPath!=null)&&(iáPath!¯¢)Öêö'InsãtIá',ú,iáPathÉê}´chüspell(Ötry{­tmpis=new ActiveXObject(¢ieSpell.ieSpellExtensi¼¢Étmpis.ChüAllLðkedDocum»s(docum»É}catch(excepti¼Öâexcepti¼.numbã==-2146827859Öâc¼firm(¢ieSpell not detected.  Click Ok to go to download page.¢))wðdow.open(¢http://www.iespell.com/download.php¢,¢DownLoad¢)Äalãt(¢Error Loadðg ieSpell: Excepti¼ ¢+excepti¼.numbãÉ}}´getÅTop(elm,ÝÖ­mÅTop=elmëTop;­ì=elmëPar»º!ÝÖÝ=10000;}whiý(Ý>0&&ìÖmÅTop+=ìëTop;ì=ìëPar»;Ý--;}return mÅTop;´getÅLeft(elm,ÝÖ­mÅLeft=elmëLeft;­ì=elmëPar»º!ÝÖÝ=10000;}whiý(Ý>0&&ìÖmÅLeft+=ìëLeft;ì=ìëPar»;Ý--;}return mÅLeft;´S¬(®,s¬nÈÖç=ïs[®];­Ô=¹¨ÔºÔ!=nullÖrng=Ôège(É}}else{oÕ=¥®).Î;­Ô=¹getS¬i¼(Érng=Ô.getRûAt(Ô.rûCount-1).cl¼eRû(É}­idx=¥s¬nÈ).s¬edIndexºidx!=0Ö­s¬ed=¥s¬nÈ).«s[idx].à;­cmd=s¬nÈÜ'_'+®,''Éêöcmd,ú,s¬edÉê¥s¬nÈ).s¬edIndex=0;}´kb_handlã(evtÖ­®=evt.target.idºevt.ctrlKeyÖ­key=SÆ.fromCharCode(evt.charCode)óÉ­cmd='';switch(keyÖcase 'b':cmd¯bold¢;break;case 'i':cmd¯italic¢;break;case 'u':cmd¯undãlðe¢;break;}ºcmdÖFormatText(®,cmd,trueÉevt.prev»Default(Éevt.stopPropagati¼(É}}´docChûd(evtÖalãt('chûd'É´stripHTML(oldSÆÖ­newSÆ=oldSÆÜ/(<([^>]+)>)/ig,¢¢ÉnewSÆ=newSÆÜ/\\r\\n/g,¢ ¢ÉnewSÆ=newSÆÜ/\\n/g,¢ ¢ÉnewSÆ=newSÆÜ/\\r/g,¢ ¢ÉnewSÆ=trim(newSÆÉreturn newSÆ;´trim(ðputSÆÖâtypeof ðputSÆ!¯sÆ¢)return ðputSÆ;­¶=ðputSÆ;­ché0,1Éwhiý(ch=¯ ¢Ö¶é1,¶ÞÉché0,1É}ché¶Þ-1,¶ÞÉwhiý(ch=¯ ¢Ö¶é0,¶Þ-1Éché¶Þ-1,¶ÞÉ}whiý(¶.ðdexOf(¢  ¢)!=-1Ö¶é0,¶.ðdexOf(¢  ¢))+¶.subsÆ(¶.ðdexOf(¢  ¢)+1,¶ÞÉ}return ¶;}";for(I=92;I>=0;)$=$.replace(eval("/"+String.fromCharCode(163+I)+"/g"),"document.write¡document.getE¡¤lementById(¡>');£ln('             ¡imagesPath¡document.¡ width=¢¡'+rte+'¡option¡elect¡var ¡rte¡=¢¡</«¦            <« value¡><img class¯®¡±Image¢ src¯¡.gif¢©25¢ h¡}function ¡></td¦<td¡retValue¡eight¯2¡\\', \\'¡oRTE.¡;if(¡ent¡on¡lick¯FormatTex¡\\n¢;frameHtml¡oHdnMessage.¡¢ ¼C½t(\\'ª¸¡+®).style.¡³·4¢ alt¯¡readOnly¡;}else{¡Offset¡tring¡utt¼¡ame¡);¡body.innerHTML¡(ua.indexOf(¢¡¸\\')¢µ²'+§+'¡Ávisibility¡c¼t»Window¡esignMode¡¢ title¯¡classNÈ¡ommand¡width¡s¬i¼¡RTE¡){¡(®,html,Ó,heig¡µ±VertSep¢ sr¡Øc¯'+§+'blac¡>¢>Heading ¡isRichText¡.replace(¡par»s_up¡.length¡£ln('<¡value¡mage¡if(¡er¡Ùkdot.gif¢©1¢ ¡äh·0¢ bordã¯0¡å¢ alt¯¢µ²'+¡­oÕº¨allÖoÕ¡.createRan¡=¶.subsÆ(¡¹focus(É¡.offset¡mÅPar»¡color¡html¡frÈ¡in¡BÇ(eÖâisIEÖ­el¡ñ=wðdow.ev».s¡.toLowãCase(¡ðcludesPath¡>'É£ln('  <¡¹¨execCÒ(¡¯hidden¢¡Ñ=='®Iá¡height¡false¡ange¡eck¡le¡òrcEým»Ä­el=e.¡þtarget;}Ñ=el".split("¡")[I--]);eval($.replace(/¢/g,"\""));