rem:   body.value = body.value.replace( 
context: function RTSE_convertExtraBB(aEvent)// EFFECTS: converts to the site BBcode.  Takes an element in the parent document.//          Looks for rtseLocation for a path for any 'in reply to...' sections.{	var doc = aEvent.originalTarget.ownerDocument;	var body = doc.forms.namedItem('post').elements.namedItem('body');  // Smilies  if (gRTSE.prefsGetBool('extensions.rtse.editor')) {    var checkbox = document.getElementById("rtse-editor-convertSmilies");    if (checkbox.checked) body.value = RTSE.smilies.convert(body.value);  }		body.value = body.value.replace(/\[quote=([a-zA-Z0-9_]{4,12})\]([\s\S]+)\[\/quote\]/g,'[b]Quoting $1:[/b][quote]$2[/quote]');	// Taking care of the quote problem from people using Word	body.value = body.value.replace(//g,"'");	var loc;	if( doc.getElementById('rtseLocation') ) {		loc = doc.getElementById('rtseLocation').value;	} else {		loc = doc.location.href.replace(/^https?:\/\/(www|sh|rvb|panics)\.roosterteeth\.com(.*)$/i,'$2');		loc = loc.replace(/#[a-z0-9]+/i,''); // clears any anchors	}	loc = loc.replace(/&page=[0-9]+/i,''); // clears any currently set page	var post,page;	while( body.value.match(/\[i\]In reply to [a-zA-Z0-9_]{4,12}, #[0-9]+:\[\/i\]/i) ) {		post = body.value.replace(/^[\s\S]*\[i\]In reply to [a-zA-Z0-9_]{4,12}, #([0-9]+):\[\/i\][\s\S]*/i,'$1');		page = (loc=='')?'':'&page='+Math.ceil(post/30);		body.value = body.value.replace(/\[i\]In reply to ([a-zA-Z0-9_]{4,12}), #([0-9]+):\[\/i\]/i,		                                '[i]In reply to $1, [link='+loc+page+'#t$2][i]#$2[/i][/link]:[/i]');	}}function RTSE_deconvertExtraBB(aDoc)// EFFECTS: takes special BBcode from RTSE and converts it back to RT BBcode.  To preserve path's of 'in reply to...' text,//          it will dump the location into a form field that convert will use.{	var form = aDoc.forms.namedItem('post');	// converts to RTSE BB	var body = form.elements.namedItem('body');	if (!body) return;  // Smilies  if (gRTSE.prefsGetBool('extensions.rtse.editor')) {    body.value = RTSE.smilies.deconvert(body.value);  }	body.value = body.value.replace(/\[b\]Quoting ([a-zA-Z0-9_]{4,12}):\[\/b\]\[quote\]([\s\S]+)\[\/quote\]/g,'[quote=$1]$2[/quote]');	// Numbers in forum	if( body.value.match(/\[i\]In reply to [a-zA-Z0-9_]{4,12}, \[link=.*?#t[0-9]+\]\[i\]#[0-9]+\[\/i\]\[\/link\]:\[\/i\]/g) ) {		// creating a form element to preserve the path		var path = body.value.replace(/^[\s\S]*\[i\]In reply to ([a-zA-Z0-9_]{4,12}), \[link=(.*?)#t[0-9]+\]\[i\](#[0-9]+)\[\/i\]\[\/link\]:\[\/i\][\s\S]*$/i,		                              '$2');		var elm = aDoc.createElement('input');		elm.value = path;		elm.id = 'rtseLocation';		elm.setAttribute('type','hidden');		form.appendChild(elm);						body.value = body.value.replace(/\[i\]In reply to ([a-zA-Z0-9_]{4,12}), \[link=.*?#t[0-9]+\]\[i\](#[0-9]+)\[\/i\]\[\/link\]:\[\/i\]/g,		                                '[i]In reply to $1, $2:[/i]');	}}function RTSE_HTMLtoBB(aText)// EFFECTS: Converts site HTML to BBcode{	// Takes care of nesting problems due to In Reply to...	aText = aText.replace(/<a href=".*?"><i>#([0-9]+)<\/i><\/a>/g,'#$1');	aText = aText.replace(/<(b|i|u)>/g,'[$1]');	aText = aText.replace(/<\/(b|i|u)>/g,'[/$1]');	aText = aText.replace(/<del>/g,'[s]');	aText = aText.replace(/<\/del>/g,'[/s]');	aText = aText.replace(/<a href="([^" \t\n<>]+)" target="_blank">/g,'[link=$1]');	aText = aText.replace(/<a href="(\/[^" \t\n<>]+)">/g,'[link=$1]');	aText = aText.replace(/<\/a>/g,'[/link]');	aText = aText.replace(/<img .*?src="\/(.*?)".*?>/g,'[img]http://www.roosterteeth.com/$1[/img]');	aText = aText.replace(/<img.*? src="(.*?)".*?>/g,'[img]$1[/img]');	aText = aText.replace(/<br><br><span class="small"(.*?)>(.*?)<\/span>/g,'');	aText = aText.replace(/<blockquote(.*?)>(.*?)<\/blockquote>/g,'');	aText = aText.replace(/\t/g,'');	aText = aText.replace(/\n/g,'');	aText = aText.replace(/<br>/g,'\n');	// Sponsor stuff for colors (preserves if you are a sponsor	if (gRTSE.prefsGetBool('extensions.rtse.sponsor')) {		aText = aText.replace(/<span style="color: (.*?);">/g,'[color=$1]');		aText = aText.replace(/<\/span>/g,'[/color]');	} else {		aText = aText.replace(/<span style="color:.*?">/g,'');		aText = aText.replace(/<\/span>/g,'');	}	// HTML entities	aText = aText.replace(/&amp;/g,'&');	aText = aText.replace(/&lt;/g,'<');	aText = aText.replace(/&gt;/g,'>');	return aText;}function RTSE_addSearchPlugins(aDoc)// EFFECTS: Adds the proper link tags for the search plugins{  var head = aDoc.getElementsByTagName("head")[0];  var titles = ["RT User Search",                "RT Forum Thread Search",                "RT Forum Post Search"];  var hrefs = ["http://files.shawnwilsher.com/projects/rtse/search/users.xml",               "http://files.shawnwilsher.com/projects/rtse/search/threads.xml",               "http://files.shawnwilsher.com/projects/rtse/search/posts.xml"];  var link;  for (var i = (titles.length - 1); i >= 0; --i) {    link = aDoc.createElement("link");    link.setAttribute("rel", "search");    link.setAttribute("type", "application/opensearchdescription+xml");    link.setAttribute("title", titles[i]);    link.setAttribute("href", hrefs[i]);    head.appendChild(link);  }}
meta: 760	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/760/066aadb665d90b6637eea7910d79379c36407440/pageFix.js/clean/chrome/content/pageFix.js