rem: RTSE.editor.toggleIcon(); 
context: function RTSE_insertEditor(doc,type) {	/* Used to insert the editor in as opposed to the normal interface */	if (!gRTSE.prefsGetBool('extensions.rtse.editor') && !RTSE) return;	const DEFAULT_HEIGHT='256';	const TITLE_HEIGHT='279';	const BLANK_MESSAGE_HEIGHT='356';  RTSE.editor.toggleIcon();	// deconvert any text that needs to be	RTSE_deconvertExtraBB(doc);		try {		var form=doc.forms.namedItem('post');		var editor=doc.createElement('rtseeditor');		editor.setAttribute('id','rtseEditor');		editor.setAttribute('sponsor',(gRTSE.prefsGetBool('extensions.rtse.sponsor'))?'true':'false');		editor.setAttribute('parentFormName','post');		editor.setAttribute('bodyFormField','body');		editor.setAttribute('body',form.elements.namedItem('body').value);		if (form.elements.namedItem('title')) editor.setAttribute('title',form.elements.namedItem('title').value);		var i,width,input;		switch(type) {			case 'comment':			 var ref=doc.getElementById('Add a Comment').firstChild;			 width=ref.parentNode.clientWidth;			 editor.setAttribute('style','width:'+width+'px !important;height:'+DEFAULT_HEIGHT+'px !important;');			 ref.parentNode.previousSibling.setAttribute('style','width:'+width+'px !important;');			 break;			case 'atopic':			 var ref=doc.getElementById('Add a New Topic').firstChild;			 editor.setAttribute('showTitle','true');			 editor.setAttribute('titleFormField','title');			 width=ref.parentNode.clientWidth;			 editor.setAttribute('style','width:'+width+'px !important;height:'+TITLE_HEIGHT+'px !important;');			 ref.parentNode.previousSibling.setAttribute('style','width:'+width+'px !important;');			 break;			case 'journal':			 var ref=doc.getElementById('Make a Journal Entry').firstChild;			 editor.setAttribute('journal','true');			 editor.setAttribute('showTitle','true');			 editor.setAttribute('titleFormField','title');			 width=ref.parentNode.clientWidth;			 editor.setAttribute('style','width:'+width+'px !important;height:'+TITLE_HEIGHT+'px !important;');			 ref.parentNode.previousSibling.setAttribute('style','width:'+width+'px !important;');			 break;					case 'ejournal':			 var ref=doc.getElementById('Edit Journal Entry').firstChild;			 editor.setAttribute('journal','true');			 editor.setAttribute('showTitle','true');			 editor.setAttribute('titleFormField','title');			 width=ref.parentNode.clientWidth;			 input=doc.createElement('input');			 input.setAttribute('name','oldFriendsOnly');			 input.setAttribute('type','hidden');			 input.value=form.elements.namedItem('friendsOnly').value;			 form.appendChild(input);			 editor.setAttribute('style','width:'+width+'px !important;height:'+TITLE_HEIGHT+'px !important;');			 ref.parentNode.previousSibling.setAttribute('style','width:'+width+'px !important;');			 break;			case 'rmessage':			 var ref=doc.getElementById('Reply').firstChild;			 editor.setAttribute('showTitle','true');			 editor.setAttribute('titleFormField','title');			 editor.setAttribute('message','true');			 editor.setAttribute('lockTitle','true');			 width=ref.parentNode.clientWidth;			 editor.setAttribute('style','width:'+width+'px !important;height:'+TITLE_HEIGHT+'px !important;');			 ref.parentNode.previousSibling.setAttribute('style','width:'+width+'px !important;');			 break;			case 'bmessage':			 var ref=doc.getElementById('Send a Message').firstChild;			 editor.setAttribute('showTitle','true');			 editor.setAttribute('titleFormField','title');			 editor.setAttribute('message','true');			 width=ref.parentNode.clientWidth;			 editor.setAttribute('style','width:'+width+'px !important;height:'+BLANK_MESSAGE_HEIGHT+'px !important;');			 ref.parentNode.previousSibling.setAttribute('style','width:'+width+'px !important;');			 break;			case 'nmessage':			 var ref=doc.getElementById('Send a Message').firstChild;			 editor.setAttribute('showTitle','true');			 editor.setAttribute('titleFormField','title');			 editor.setAttribute('message','true');			 input=form.elements.namedItem('uid').cloneNode(true);			 form.appendChild(input);			 width=ref.parentNode.clientWidth;			 editor.setAttribute('style','width:'+width+'px !important;height:'+TITLE_HEIGHT+'px !important;');			 ref.parentNode.previousSibling.setAttribute('style','width:'+width+'px !important;');			 break;			case 'fcomment':			 // Same page replies			 var elms=RTSE_evaluateXPath(doc,"//td[@id='pageContent']/table/tbody/tr[2]/td/table/tbody/tr[3]/td/table/tbody/tr/td/table/tbody/tr/td[2]/table/tbody/tr[1]/td[2]/div/a[2]/b");			 for( i=(elms.length-1); i>=0; i-- ) {				elms[i].parentNode.setAttribute('href','#Post');				elms[i].addEventListener('click',RTSE_samePageReply,false);			 }			 var ref=doc.getElementById('Post').firstChild;			 width=ref.parentNode.clientWidth;			 editor.setAttribute('style','width:'+width+'px !important;height:'+DEFAULT_HEIGHT+'px !important;');			 ref.parentNode.previousSibling.setAttribute('style','width:'+width+'px !important;');			 break;			case 'freply':			 var ref=doc.getElementById('Reply').firstChild;			 width=ref.parentNode.clientWidth;			 editor.setAttribute('style','width:'+width+'px !important;height:'+DEFAULT_HEIGHT+'px !important;');			 ref.parentNode.previousSibling.setAttribute('style','width:'+width+'px !important;');			 break;			case 'cpreview':			 var test=form.elements.namedItem('to').value;			 var ref=doc.getElementById('Edit').firstChild;			 width=ref.parentNode.clientWidth;			 if( test=='/members/journal/journalPost.php' ||				 /\/members\/journal\/editEntryPost.php\?id=[0-9]+/i.test(test) ) {			 	/* Hack for journals (*sigh*) */			 	editor.setAttribute('showTitle','true');			 	editor.setAttribute('journal','true');			 	editor.setAttribute('titleFormField','title');				editor.setAttribute('style','width:'+width+'px !important;height:'+TITLE_HEIGHT+'px !important;');				ref.parentNode.previousSibling.setAttribute('style','width:'+width+'px !important;');			 } else if( /\/forum\/addTopicPost.php\?fid=.*/ig.test(test) ) {			 	/* Hack for Adding Topic */			 	editor.setAttribute('showTitle','true');			 	editor.setAttribute('titleFormField','title');			 	editor.setAttribute('style','width:'+width+'px !important;height:'+TITLE_HEIGHT+'px !important;');			 	ref.parentNode.previousSibling.setAttribute('style','width:'+width+'px !important;');			 } else			 	editor.setAttribute('style','width:'+width+'px !important;height:'+DEFAULT_HEIGHT+'px !important;');			 	ref.parentNode.previousSibling.setAttribute('style','width:'+width+'px !important;');			 break;			case 'cedit':			 var ref=doc.getElementById('Edit Post').firstChild;			 width=ref.parentNode.clientWidth;			 editor.setAttribute('style','width:'+width+'px !important;height:'+DEFAULT_HEIGHT+'px !important;');			 ref.parentNode.previousSibling.setAttribute('style','width:'+width+'px !important;');			 break;		}		// For previews		switch(type) {		 case 'comment':		 case 'freply':		 case 'fcomment':		 case 'cpreview':		 case 'cedit':		 case 'journal':		 case 'atopic':   editor.setAttribute('preview','/preview.php');		                  break;		 case 'rmessage':		 case 'nmessage': var pid = form.elements.namedItem('pid');		                  if (pid) {		                  	if (pid.value!='0') editor.setAttribute('preview','/members/messaging/previewReply.php');							else                editor.setAttribute('preview','/members/messaging/preview.php');						  } else						  	editor.setAttribute('preview','/members/messaging/preview.php');						  break;		 case 'bmessage': editor.setAttribute('preview','/members/messaging/preview.php');		                  break;		}		// Listener for Extra BB		form.addEventListener('submit',RTSE_convertExtraBB,false);		ref.parentNode.replaceChild(editor,ref);    // Adding smilies    var smilies = RTSE.smilies.items;    const XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";    var menu = doc.createElementNS(XUL, "menupopup");    var mi, key;    for (var i in smilies) {      mi = doc.createElementNS(XUL, "menuitem");      mi.setAttribute("image", smilies[i].path);      mi.setAttribute("label", smilies[i].name);      mi.setAttribute("validate", "never");      mi.setAttribute("class", "menuitem-iconic");      mi.setAttribute("key", smilies[i].key);      mi.addEventListener("command", function() {        var editor = this.ownerDocument.getElementById("rtseEditor");        editor.insertTag(this.getAttribute('key'));      }, false);      menu.appendChild(mi);    }    doc.getElementById("rtseEditor").wrappedJSObject.addSmilies(menu);	} catch(e) {		//gRTSE.sendReport(e);		throw e;	}}
meta: 760	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/760/37427066b97fc179ec9d51dfd34dbd84fa97feb4/pageFix.js/buggy/chrome/content/pageFix.js