1TINY={}; 2 3function T$(i){ 4 return document.getElementById(i) 5} 6function T$$$(){ 7 return document.all?1:0 8} 9 10TINY.editor=function(){ 11 var c=[], offset=-30; 12 c['cut']=[1,'Cut','a','cut',1]; 13 c['copy']=[2,'Copy','a','copy',1]; 14 c['paste']=[3,'Paste','a','paste',1]; 15 c['bold']=[4,'Bold','a','bold']; 16 c['italic']=[5,'Italic','a','italic']; 17 c['underline']=[6,'Underline','a','underline']; 18 c['strikethrough']=[7,'Strikethrough','a','strikethrough']; 19 c['subscript']=[8,'Subscript','a','subscript']; 20 c['superscript']=[9,'Superscript','a','superscript']; 21 c['orderedlist']=[10,'Insert Ordered List','a','insertorderedlist']; 22 c['unorderedlist']=[11,'Insert Unordered List','a','insertunorderedlist']; 23 c['outdent']=[12,'Outdent','a','outdent']; 24 c['indent']=[13,'Indent','a','indent']; 25 c['leftalign']=[14,'Left Align','a','justifyleft']; 26 c['centeralign']=[15,'Center Align','a','justifycenter']; 27 c['rightalign']=[16,'Right Align','a','justifyright']; 28 c['blockjustify']=[17,'Block Justify','a','justifyfull']; 29 c['undo']=[18,'Undo','a','undo']; 30 c['redo']=[19,'Redo','a','redo']; 31 c['image']=[20,'Insert Image','i','insertimage','Enter Image URL:','http://']; 32 c['hr']=[21,'Insert Horizontal Rule','a','inserthorizontalrule']; 33 c['link']=[22,'Insert Hyperlink','i','createlink','Enter URL:','http://']; 34 c['unlink']=[23,'Remove Hyperlink','a','unlink']; 35 c['unformat']=[24,'Remove Formatting','a','removeformat']; 36 c['print']=[25,'Print','a','print']; 37 function edit(n,obj){ 38 this.n=n; 39 window[n]=this; 40 this.t=T$(obj.id); 41 this.obj=obj; 42 this.xhtml=obj.xhtml; 43 var p=document.createElement('div'), w=document.createElement('div'), h=document.createElement('div'), 44 l=obj.controls.length, i=0; 45 this.i=document.createElement('iframe'); 46 this.i.id = "myframe" 47 this.i.frameBorder=0; 48 this.i.width=obj.width||'500'; 49 this.i.height=obj.height||'250'; 50 this.ie=T$$$(); 51 h.className=obj.rowclass||'teheader'; 52 p.className=obj.cssclass||'te'; 53 p.style.width=this.i.width+'px'; 54 p.appendChild(h); 55 for(i;i<l;i++){ 56 var id=obj.controls[i]; 57 if(id=='n'){ 58 h=document.createElement('div'); 59 h.className=obj.rowclass||'teheader'; 60 p.appendChild(h) 61 }else if(id=='|'){ 62 var d=document.createElement('div'); 63 d.className=obj.dividerclass||'tedivider'; 64 h.appendChild(d) 65 }else if(id=='font'){ 66 var sel=document.createElement('select'), fonts=obj.fonts||['Verdana','Arial','Georgia'], fl=fonts.length, x=0; 67 sel.className='tefont'; 68 sel.onchange=new Function(this.n+'.ddaction(this,"fontname")'); 69 sel.options[0]=new Option('Font',''); 70 for(x;x<fl;x++){ 71 var font=fonts[x]; 72 sel.options[x+1]=new Option(font,font) 73 } 74 h.appendChild(sel) 75 }else if(id=='size'){ 76 var sel=document.createElement('select'), sizes=obj.sizes||[1,2,3,4,5,6,7], sl=sizes.length, x=0; 77 sel.className='tesize'; 78 sel.onchange=new Function(this.n+'.ddaction(this,"fontsize")'); 79 for(x;x<sl;x++){ 80 var size=sizes[x]; 81 sel.options[x]=new Option(size,size) 82 } 83 h.appendChild(sel) 84 }else if(id=='style'){ 85 var sel=document.createElement('select'), 86 styles=obj.styles||[['Style',''],['Paragraph','<p>'],['Header 1','<h1>'],['Header 2','<h2>'],['Header 3','<h3>'],['Header 4','<h4>'],['Header 5','<h5>'],['Header 6','<h6>']], 87 sl=styles.length, x=0; 88 sel.className='testyle'; 89 sel.onchange=new Function(this.n+'.ddaction(this,"formatblock")'); 90 for(x;x<sl;x++){ 91 var style=styles[x]; 92 sel.options[x]=new Option(style[0],style[1]) 93 } 94 h.appendChild(sel) 95 }else if(c[id]){ 96 var div=document.createElement('div'), x=c[id], func=x[2], ex, pos=x[0]*offset; 97 div.className=obj.controlclass; 98 div.style.backgroundPosition='0px '+pos+'px'; 99 div.title=x[1]; 100 ex=func=='a'?'.action("'+x[3]+'",0,'+(x[4]||0)+')':'.insert("'+x[4]+'","'+x[5]+'","'+x[3]+'")'; 101 div.onclick=new Function(this.n+(id=='print'?'.print()':ex)); 102 div.onmouseover=new Function(this.n+'.hover(this,'+pos+',1)'); 103 div.onmouseout=new Function(this.n+'.hover(this,'+pos+',0)'); 104 h.appendChild(div); 105 if(this.ie){ 106 div.unselectable='on' 107 } 108 } 109 } 110 this.t.parentNode.insertBefore(p,this.t); 111 this.t.style.width=this.i.width+'px'; 112 w.appendChild(this.t); 113 w.appendChild(this.i); 114 p.appendChild(w); 115 p.style.background = "#ffffff"; 116 this.t.style.display='none'; 117 if(obj.footer){ 118 var f=document.createElement('div'); 119 f.className=obj.footerclass||'tefooter'; 120 if(obj.toggle){ 121 122 var to=obj.toggle, ts=document.createElement('div'); 123 ts.className=to.cssclass||'toggle'; 124 //ts.innerHTML=obj.toggletext||'xxxxxxxxxxxxxxxxx'; 125 if(!obj.tefootertips || obj.tefootertips == ""){ 126 obj.tefootertips = "Enter between 20 to 3,000 characters."; 127 } 128 ts.innerHTML = '<span style="font:10px verdana;color:#888;">'+obj.tefootertips+'</span>'; 129 ts.onclick = function(){ 130 return false;
131 } 132 //ts.onclick=new Function(this.n+'.toggle(0,this);return false'); 133 f.appendChild(ts) 134 } 135 if(obj.resize){ 136 var ro=obj.resize, rs=document.createElement('div'); 137 rs.className=ro.cssclass||'resize'; 138 rs.onmousedown=new Function('event',this.n+'.resize(event);return false'); 139 rs.onselectstart=function(){ 140 return false 141 }; 142 f.appendChild(rs) 143 } 144 p.appendChild(f) 145 } 146 this.e=this.i.contentWindow.document; 147 this.e.open(); 148 var m='<html><head>', bodyid=obj.bodyid?" id=\""+obj.bodyid+"\"":""; 149 if(obj.cssfile){ 150 m+='<link rel="stylesheet" href="'+obj.cssfile+'" />' 151 } 152 if(obj.css){ 153 m+='<style type="text/css">'+obj.css+'</style>' 154 } 155 m+='</head><body'+bodyid+'>'+(obj.content||this.t.value); 156 m+='</body></html>'; 157 this.e.write(m); 158 this.e.close(); 159 this.e.designMode='on'; 160 this.d=1; 161 if(this.xhtml){ 162 try{ 163 this.e.execCommand("styleWithCSS",0,0) 164 } 165 catch(e){ 166 try{ 167 this.e.execCommand("useCSS",0,1) 168 }catch(e){} 169 } 170 } 171 }; 172 edit.prototype.print=function(){ 173 this.i.contentWindow.print() 174 }, 175 edit.prototype.hover=function(div,pos,dir){ 176 div.style.backgroundPosition=(dir?'34px ':'0px ')+(pos)+'px' 177 }, 178 edit.prototype.ddaction=function(dd,a){ 179 var i=dd.selectedIndex, v=dd.options[i].value; 180 this.action(a,v) 181 }, 182 edit.prototype.action=function(cmd,val,ie){ 183 if(ie&&!this.ie){ 184 alert('Your browser does not support this function.') 185 }else{ 186 this.e.execCommand(cmd,0,val||null) 187 } 188 }, 189 edit.prototype.insert=function(pro,msg,cmd){ 190 var val=prompt(pro,msg); 191 if(val!=null&&val!=''){ 192 this.e.execCommand(cmd,0,val) 193 } 194 }, 195 edit.prototype.setfont=function(){ 196 execCommand('formatblock',0,hType) 197 }, 198 edit.prototype.resize=function(e){ 199 if(this.mv){ 200 this.freeze() 201 } 202 this.i.bcs=TINY.cursor.top(e); 203 this.mv=new Function('event',this.n+'.move(event)'); 204 this.sr=new Function(this.n+'.freeze()'); 205 if(this.ie){ 206 document.attachEvent('onmousemove',this.mv); 207 document.attachEvent('onmouseup',this.sr) 208 }else{ 209 document.addEventListener('mousemove',this.mv,1); 210 document.addEventListener('mouseup',this.sr,1) 211 } 212 }, 213 edit.prototype.move=function(e){ 214 var pos=TINY.cursor.top(e); 215 this.i.height=parseInt(this.i.height)+pos-this.i.bcs; 216 this.i.bcs=pos 217 }, 218 edit.prototype.freeze=function(){ 219 if(this.ie){ 220 document.detachEvent('onmousemove',this.mv); 221 document.detachEvent('onmouseup',this.sr) 222 }else{ 223 document.removeEventListener('mousemove',this.mv,1); 224 document.removeEventListener('mouseup',this.sr,1) 225 } 226 }, 227 edit.prototype.toggle=function(post,div){ 228 if(!this.d){ 229 var v=this.t.value; 230 if(div){ 231 div.innerHTML=this.obj.toggletext||'source' 232 } 233 if(this.xhtml&&!this.ie){ 234 v=v.replace(/<strong>(.*)<\/strong>/gi,'<span style="font-weight: bold;">$1</span>'); 235 v=v.replace(/<em>(.*)<\/em>/gi,'<span style="font-weight: italic;">$1</span>') 236 } 237 this.e.body.innerHTML=v; 238 this.t.style.display='none'; 239 this.i.style.display='block'; 240 this.d=1 241 }else{ 242 var v=this.e.body.innerHTML; 243 if(this.xhtml){ 244 v=v.replace(/<span class="apple-style-span">(.*)<\/span>/gi,'$1'); 245 v=v.replace(/ class="apple-style-span"/gi,''); 246 v=v.replace(/<span style="">/gi,''); 247 v=v.replace(/<br>/gi,'<br />'); 248 v=v.replace(/<br ?\/?>$/gi,''); 249 v=v.replace(/^<br ?\/?>/gi,''); 250 v=v.replace(/(<img [^>]+[^\/])>/gi,'$1 />'); 251 v=v.replace(/<b\b[^>]*>(.*?)<\/b[^>]*>/gi,'<strong>$1</strong>'); 252 v=v.replace(/<i\b[^>]*>(.*?)<\/i[^>]*>/gi,'<em>$1</em>'); 253 v=v.replace(/<u\b[^>]*>(.*?)<\/u[^>]*>/gi,'<span style="text-decoration:underline">$1</span>'); 254 v=v.replace(/<(b|strong|em|i|u) style="font-weight: normal;?">(.*)<\/(b|strong|em|i|u)>/gi,'$2'); 255 v=v.replace(/<(b|strong|em|i|u) style="(.*)">(.*)<\/(b|strong|em|i|u)>/gi,'<span style="$2"><$4>$3</$4></span>'); 256 v=v.replace(/<span style="font-weight: normal;?">(.*)<\/span>/gi,'$1'); 257 v=v.replace(/<span style="font-weight: bold;?">(.*)<\/span>/gi,'<strong>$1</strong>'); 258 v=v.replace(/<span style="font-style: italic;?">(.*)<\/span>/gi,'<em>$1</em>'); 259 v=v.replace(/<span style="font-weight: bold;?">(.*)<\/span>|<b\b[^>]*>(.*?)<\/b[^>]*>/gi,'<strong>$1</strong>') 260 } 261 if(div){ 262 div.innerHTML=this.obj.toggletext||'wysiwyg' 263 } 264 this.t.value=v; 265 if(!post){ 266 this.t.style.height=this.i.height+'px'; 267 this.i.style.display='none'; 268 this.t.style.display='block'; 269 this.d=0 270 } 271 } 272 }, 273 edit.prototype.post=function(){ 274 if(this.d){ 275 this.toggle(1) 276 } 277 }; 278 return{ 279 edit:edit 280 } 281}(); 282 283TINY.cursor=function(){ 284 return{ 285 top:function(e){ 286 return T$$$()?window.event.clientY+document.documentElement.scrollTop+document.body.scrollTop:e.clientY+window.scrollY 287 } 288 } 289}();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.