Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • osian/sucs-site
  • kais58/sucs-site
  • imranh/sucs-site
  • foshjedi2004/sucs-site
  • gigosaurus/sucs-site
  • matstn/sucs-site
  • ripp_/sucs-site
  • eggnog/sucs-site
  • sucssite/sucs-site
  • elbows/sucs-site
  • realitykiller/sucs-site
  • crox/sucs-site
  • vectre/sucs-site
  • welshbyte/sucs-site
  • paperclipman/sucs-site
15 results
Show changes
Showing
with 0 additions and 7659 deletions
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
TinyMCE_Cleanup.class.js
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title=" TinyMCE_Cleanup.class.js";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<H3 class="FrameHeadingFont"><B></B></H3>
<FONT size="+1" CLASS="FrameHeadingFont">
<B><a href="overview-summary-TinyMCE_Cleanup.class.js.html"
target="classFrame">TinyMCE_Cleanup.class.js</a></B></FONT>
<BR>
<TABLE BORDER="0" WIDTH="100%">
<TR>
<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="TinyMCE_Cleanup.html" TARGET="classFrame">TinyMCE_Cleanup</A>
<BR>
</FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
TinyMCE_Control.class.js
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title=" TinyMCE_Control.class.js";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<H3 class="FrameHeadingFont"><B></B></H3>
<FONT size="+1" CLASS="FrameHeadingFont">
<B><a href="overview-summary-TinyMCE_Control.class.js.html"
target="classFrame">TinyMCE_Control.class.js</a></B></FONT>
<BR>
<TABLE BORDER="0" WIDTH="100%">
<TR>
<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="TinyMCE_Control.html" TARGET="classFrame">TinyMCE_Control</A>
<BR>
</FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
TinyMCE_DOMUtils.class.js
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title=" TinyMCE_DOMUtils.class.js";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<H3 class="FrameHeadingFont"><B></B></H3>
<FONT size="+1" CLASS="FrameHeadingFont">
<B><a href="overview-summary-TinyMCE_DOMUtils.class.js.html"
target="classFrame">TinyMCE_DOMUtils.class.js</a></B></FONT>
<BR>
<TABLE BORDER="0" WIDTH="100%">
</TABLE>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
TinyMCE_Debug.class.js
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title=" TinyMCE_Debug.class.js";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<H3 class="FrameHeadingFont"><B></B></H3>
<FONT size="+1" CLASS="FrameHeadingFont">
<B><a href="overview-summary-TinyMCE_Debug.class.js.html"
target="classFrame">TinyMCE_Debug.class.js</a></B></FONT>
<BR>
<TABLE BORDER="0" WIDTH="100%">
</TABLE>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
TinyMCE_Engine.class.js
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title=" TinyMCE_Engine.class.js";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<H3 class="FrameHeadingFont"><B></B></H3>
<FONT size="+1" CLASS="FrameHeadingFont">
<B><a href="overview-summary-TinyMCE_Engine.class.js.html"
target="classFrame">TinyMCE_Engine.class.js</a></B></FONT>
<BR>
<TABLE BORDER="0" WIDTH="100%">
<TR>
<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="TinyMCE_Engine.html" TARGET="classFrame">TinyMCE_Engine</A>
<BR>
</FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
TinyMCE_Event.class.js
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title=" TinyMCE_Event.class.js";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<H3 class="FrameHeadingFont"><B></B></H3>
<FONT size="+1" CLASS="FrameHeadingFont">
<B><a href="overview-summary-TinyMCE_Event.class.js.html"
target="classFrame">TinyMCE_Event.class.js</a></B></FONT>
<BR>
<TABLE BORDER="0" WIDTH="100%">
</TABLE>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
TinyMCE_ForceParagraphs.class.js
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title=" TinyMCE_ForceParagraphs.class.js";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<H3 class="FrameHeadingFont"><B></B></H3>
<FONT size="+1" CLASS="FrameHeadingFont">
<B><a href="overview-summary-TinyMCE_ForceParagraphs.class.js.html"
target="classFrame">TinyMCE_ForceParagraphs.class.js</a></B></FONT>
<BR>
<TABLE BORDER="0" WIDTH="100%">
</TABLE>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
TinyMCE_Layer.class.js
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title=" TinyMCE_Layer.class.js";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<H3 class="FrameHeadingFont"><B></B></H3>
<FONT size="+1" CLASS="FrameHeadingFont">
<B><a href="overview-summary-TinyMCE_Layer.class.js.html"
target="classFrame">TinyMCE_Layer.class.js</a></B></FONT>
<BR>
<TABLE BORDER="0" WIDTH="100%">
<TR>
<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="TinyMCE_Layer.html" TARGET="classFrame">TinyMCE_Layer</A>
<BR>
</FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
TinyMCE_Menu.class.js
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title=" TinyMCE_Menu.class.js";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<H3 class="FrameHeadingFont"><B></B></H3>
<FONT size="+1" CLASS="FrameHeadingFont">
<B><a href="overview-summary-TinyMCE_Menu.class.js.html"
target="classFrame">TinyMCE_Menu.class.js</a></B></FONT>
<BR>
<TABLE BORDER="0" WIDTH="100%">
</TABLE>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
TinyMCE_Popup.class.js
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title=" TinyMCE_Popup.class.js";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<H3 class="FrameHeadingFont"><B></B></H3>
<FONT size="+1" CLASS="FrameHeadingFont">
<B><a href="overview-summary-TinyMCE_Popup.class.js.html"
target="classFrame">TinyMCE_Popup.class.js</a></B></FONT>
<BR>
<TABLE BORDER="0" WIDTH="100%">
<TR>
<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="TinyMCE_Popup.html" TARGET="classFrame">TinyMCE_Popup</A>
<BR>
</FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
TinyMCE_Selection.class.js
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title=" TinyMCE_Selection.class.js";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<H3 class="FrameHeadingFont"><B></B></H3>
<FONT size="+1" CLASS="FrameHeadingFont">
<B><a href="overview-summary-TinyMCE_Selection.class.js.html"
target="classFrame">TinyMCE_Selection.class.js</a></B></FONT>
<BR>
<TABLE BORDER="0" WIDTH="100%">
<TR>
<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="TinyMCE_Selection.html" TARGET="classFrame">TinyMCE_Selection</A>
<BR>
</FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
TinyMCE_URL.class.js
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title=" TinyMCE_URL.class.js";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<H3 class="FrameHeadingFont"><B></B></H3>
<FONT size="+1" CLASS="FrameHeadingFont">
<B><a href="overview-summary-TinyMCE_URL.class.js.html"
target="classFrame">TinyMCE_URL.class.js</a></B></FONT>
<BR>
<TABLE BORDER="0" WIDTH="100%">
</TABLE>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
TinyMCE_UndoRedo.class.js
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title=" TinyMCE_UndoRedo.class.js";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<H3 class="FrameHeadingFont"><B></B></H3>
<FONT size="+1" CLASS="FrameHeadingFont">
<B><a href="overview-summary-TinyMCE_UndoRedo.class.js.html"
target="classFrame">TinyMCE_UndoRedo.class.js</a></B></FONT>
<BR>
<TABLE BORDER="0" WIDTH="100%">
<TR>
<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="TinyMCE_UndoRedo.html" TARGET="classFrame">TinyMCE_UndoRedo</A>
<BR>
</FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>
Overview ()
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title="Overview ()";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<H3 class="FrameHeadingFont"><B></B></H3>
<TABLE BORDER="0" WIDTH="100%">
<TR>
<B></B></FONT></TD>
</TR>
</TABLE>
<TABLE BORDER="0" WIDTH="100%">
<TR>
<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="allclasses-frame.html" TARGET="packageFrame">All Classes</A></FONT>
<P>
<FONT size="+1" CLASS="FrameHeadingFont">
Files</FONT>
<BR>
<FONT CLASS="FrameItemFont"><A HREF="overview-TinyMCE_Array.class.js.html" TARGET="packageFrame">TinyMCE_Array.class.js</A></FONT><BR>
<FONT CLASS="FrameItemFont"><A HREF="overview-TinyMCE_Cleanup.class.js.html" TARGET="packageFrame">TinyMCE_Cleanup.class.js</A></FONT><BR>
<FONT CLASS="FrameItemFont"><A HREF="overview-TinyMCE_Control.class.js.html" TARGET="packageFrame">TinyMCE_Control.class.js</A></FONT><BR>
<FONT CLASS="FrameItemFont"><A HREF="overview-TinyMCE_Debug.class.js.html" TARGET="packageFrame">TinyMCE_Debug.class.js</A></FONT><BR>
<FONT CLASS="FrameItemFont"><A HREF="overview-TinyMCE_DOMUtils.class.js.html" TARGET="packageFrame">TinyMCE_DOMUtils.class.js</A></FONT><BR>
<FONT CLASS="FrameItemFont"><A HREF="overview-TinyMCE_Engine.class.js.html" TARGET="packageFrame">TinyMCE_Engine.class.js</A></FONT><BR>
<FONT CLASS="FrameItemFont"><A HREF="overview-TinyMCE_Event.class.js.html" TARGET="packageFrame">TinyMCE_Event.class.js</A></FONT><BR>
<FONT CLASS="FrameItemFont"><A HREF="overview-TinyMCE_ForceParagraphs.class.js.html" TARGET="packageFrame">TinyMCE_ForceParagraphs.class.js</A></FONT><BR>
<FONT CLASS="FrameItemFont"><A HREF="overview-TinyMCE_Layer.class.js.html" TARGET="packageFrame">TinyMCE_Layer.class.js</A></FONT><BR>
<FONT CLASS="FrameItemFont"><A HREF="overview-TinyMCE_Menu.class.js.html" TARGET="packageFrame">TinyMCE_Menu.class.js</A></FONT><BR>
<FONT CLASS="FrameItemFont"><A HREF="overview-TinyMCE_Popup.class.js.html" TARGET="packageFrame">TinyMCE_Popup.class.js</A></FONT><BR>
<FONT CLASS="FrameItemFont"><A HREF="overview-TinyMCE_Selection.class.js.html" TARGET="packageFrame">TinyMCE_Selection.class.js</A></FONT><BR>
<FONT CLASS="FrameItemFont"><A HREF="overview-TinyMCE_UndoRedo.class.js.html" TARGET="packageFrame">TinyMCE_UndoRedo.class.js</A></FONT><BR>
<FONT CLASS="FrameItemFont"><A HREF="overview-TinyMCE_URL.class.js.html" TARGET="packageFrame">TinyMCE_URL.class.js</A></FONT><BR>
</TD>
</TR>
</TABLE>
<P>
&nbsp;
</BODY>
</HTML>
<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
parent.document.title="TinyMCE_Array.class.js Overview";
}
</script>
</head>
<body bgcolor="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> &nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a> &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<center>
<h2>TinyMCE_Array.class.js</h2>
</center>
<h4>Summary</h4>
<p>
No overview generated for 'TinyMCE_Array.class.js'<BR/><BR/>
</p>
<hr>
<!-- ========== METHOD SUMMARY =========== -->
<!-- ========== END METHOD SUMMARY =========== -->
<pre class="sourceview"><span class="comment">/**
* $RCSfile: overview-summary-TinyMCE_Array.class.js.html,v $
* $Revision: 1.42 $
* $Date: 2006/04/14 20:00:28 $
*
* <span class="attrib">@author</span> Moxiecode
* <span class="attrib">@copyright</span> Copyright 2004-2006, Moxiecode Systems AB, All rights reserved.
*
* The contents of this file will be wrapped in a class later on.
*/</span>
<span class="comment">/**
* Returns a cleared array, since some external libraries tend to extend the Array core object
* arrays needs to be cleaned from these extended functions. So this function simply sets any
* named properties back to null.
*
* <span class="attrib">@param</span> {Array} Name/Value array to clear.
* <span class="attrib">@return</span> Cleared name/value array.
* <span class="attrib">@type</span> Array
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.clearArray = <span class="reserved">function</span>(a) {
<span class="reserved">for</span> (var k in a)
a[k] = null;
<span class="reserved">return</span> a;
};
</pre>
<hr>
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> &nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a> &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<font size="-1">
</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Fri Apr 14 21:59:23 2006</div>
</body>
</html>
<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
parent.document.title="TinyMCE_Cleanup.class.js Overview";
}
</script>
</head>
<body bgcolor="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> &nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a> &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<center>
<h2>TinyMCE_Cleanup.class.js</h2>
</center>
<h4>Summary</h4>
<p>
No overview generated for 'TinyMCE_Cleanup.class.js'<BR/><BR/>
</p>
<hr>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
<td colspan=2><font size="+2">
<b>Class Summary</b>
</font></td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td width="15%"><b><a href="TinyMCE_Cleanup.html">TinyMCE_Cleanup</a></b></td>
<td>&nbsp;</td>
</tr>
</table>
<hr/>
<!-- ========== METHOD SUMMARY =========== -->
<!-- ========== END METHOD SUMMARY =========== -->
<pre class="sourceview"><span class="comment">/**
* $RCSfile: overview-summary-TinyMCE_Cleanup.class.js.html,v $
* $Revision: 1.42 $
* $Date: 2006/04/14 20:00:28 $
*
* <span class="attrib">@author</span> Moxiecode
* <span class="attrib">@copyright</span> Copyright 2004-2006, Moxiecode Systems AB, All rights reserved.
*
* Some of the contents of this file will be wrapped in a class later on it will also be replaced with the new cleanup logic.
*/</span>
<span class="comment">/**
* Makes some preprocessing cleanup routines on the specified HTML string.
* This includes forcing some tags to be open so MSIE doesn't fail. Forcing other to close and
* padding paragraphs with non breaking spaces. This function is used when the editor gets
* initialized with content.
*
* <span class="attrib">@param</span> {string} s HTML string to cleanup.
* <span class="attrib">@return</span> Cleaned HTML string.
* <span class="attrib">@type</span> string
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.cleanupHTMLCode = <span class="reserved">function</span>(s) {
s = s.replace(new RegExp(<span class="literal">'&lt;p \\/&gt;'</span>, <span class="literal">'gi'</span>), <span class="literal">'&lt;p&gt;&amp;nbsp;&lt;/p&gt;'</span>);
s = s.replace(new RegExp(<span class="literal">'&lt;p&gt;\\s*&lt;\\/p&gt;'</span>, <span class="literal">'gi'</span>), <span class="literal">'&lt;p&gt;&amp;nbsp;&lt;/p&gt;'</span>);
<span class="comment">// Fix close BR elements</span>
s = s.replace(new RegExp(<span class="literal">'&lt;br&gt;\\s*&lt;\\/br&gt;'</span>, <span class="literal">'gi'</span>), <span class="literal">'&lt;br /&gt;'</span>);
<span class="comment">// Open closed tags like &lt;b/&gt; to &lt;b&gt;&lt;/b&gt;</span>
s = s.replace(new RegExp(<span class="literal">'&lt;(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|&gt;]*)\\/&gt;'</span>, <span class="literal">'gi'</span>), <span class="literal">'&lt;$1$2$3&gt;&lt;/$1$2&gt;'</span>);
<span class="comment">// Remove trailing space &lt;b &gt; to &lt;b&gt;</span>
s = s.replace(new RegExp(<span class="literal">'\\s+&gt;&lt;/'</span>, <span class="literal">'gi'</span>), <span class="literal">'&gt;&lt;/'</span>);
<span class="comment">// Close tags &lt;img&gt;&lt;/img&gt; to &lt;img/&gt;</span>
s = s.replace(new RegExp(<span class="literal">'&lt;(img|br|hr)([^&gt;]*)&gt;&lt;\\/(img|br|hr)&gt;'</span>, <span class="literal">'gi'</span>), <span class="literal">'&lt;$1$2 /&gt;'</span>);
<span class="comment">// Weird MSIE bug, &lt;p&gt;&lt;hr /&gt;&lt;/p&gt; breaks runtime?</span>
<span class="reserved">if</span> (tinyMCE.isMSIE)
s = s.replace(new RegExp(<span class="literal">'&lt;p&gt;&lt;hr \\/&gt;&lt;\\/p&gt;'</span>, <span class="literal">'gi'</span>), <span class="literal">"&lt;hr&gt;"</span>);
<span class="comment">// Convert relative anchors to absolute URLs ex: #something to file.htm#something</span>
<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">'convert_urls'</span>))
s = s.replace(new RegExp(<span class="literal">'(href=\"{0,1})(\\s*#)'</span>, <span class="literal">'gi'</span>), <span class="literal">'$1'</span> + tinyMCE.settings[<span class="literal">'document_base_url'</span>] + <span class="literal">"#"</span>);
<span class="reserved">return</span> s;
};
<span class="comment">/**
* Parses the specified HTML style data. This will parse for example
* "border-left: 1px; background-color: red" into an key/value array.
*
* <span class="attrib">@param</span> {string} str Style data to parse.
* <span class="attrib">@return</span> Name/Value array of style items.
* <span class="attrib">@type</span> Array
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.parseStyle = <span class="reserved">function</span>(str) {
var ar = new Array();
<span class="reserved">if</span> (str == null)
<span class="reserved">return</span> ar;
var st = str.split(<span class="literal">';'</span>);
tinyMCE.clearArray(ar);
<span class="reserved">for</span> (var i=0; i&lt;st.length; i++) {
<span class="reserved">if</span> (st[i] == <span class="literal">''</span>)
continue;
var re = new RegExp(<span class="literal">'^\\s*([^:]*):\\s*(.*)\\s*$'</span>);
var pa = st[i].replace(re, <span class="literal">'$1||$2'</span>).split(<span class="literal">'||'</span>);
<span class="comment">//tinyMCE.debug(str, pa[0] + "=" + pa[1], st[i].replace(re, '$1||$2'));</span>
<span class="reserved">if</span> (pa.length == 2)
ar[pa[0].toLowerCase()] = pa[1];
}
<span class="reserved">return</span> ar;
};
<span class="comment">/**
* Compresses larger styles into a smaller. Since MSIE automaticly converts
* border: 1px solid red to border-left: 1px solid red, border-righ: 1px solid red and so forth.'
* This will bundle them together again if the information is the same in each item.
*
* <span class="attrib">@param</span> {Array} ar Style name/value array with items.
* <span class="attrib">@param</span> {string} pr Style item prefix to bundle for example border.
* <span class="attrib">@param</span> {string} sf Style item suffix to bunlde for example -width or -width.
* <span class="attrib">@param</span> {string} res Result name, for example border-width.
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.compressStyle = <span class="reserved">function</span>(ar, pr, sf, res) {
var box = new Array();
box[0] = ar[pr + <span class="literal">'-top'</span> + sf];
box[1] = ar[pr + <span class="literal">'-left'</span> + sf];
box[2] = ar[pr + <span class="literal">'-right'</span> + sf];
box[3] = ar[pr + <span class="literal">'-bottom'</span> + sf];
<span class="reserved">for</span> (var i=0; i&lt;box.length; i++) {
<span class="reserved">if</span> (box[i] == null)
<span class="reserved">return</span>;
<span class="reserved">for</span> (var a=0; a&lt;box.length; a++) {
<span class="reserved">if</span> (box[a] != box[i])
<span class="reserved">return</span>;
}
}
<span class="comment">// They are all the same</span>
ar[res] = box[0];
ar[pr + <span class="literal">'-top'</span> + sf] = null;
ar[pr + <span class="literal">'-left'</span> + sf] = null;
ar[pr + <span class="literal">'-right'</span> + sf] = null;
ar[pr + <span class="literal">'-bottom'</span> + sf] = null;
};
<span class="comment">/**
* Serializes the specified style item name/value array into a HTML string. This function
* will force HEX colors in Firefox and convert the URL items of a style correctly.
*
* <span class="attrib">@param</span> {Array} ar Name/Value array of items to serialize.
* <span class="attrib">@return</span> Serialized HTML string containing the items.
* <span class="attrib">@type</span> string
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.serializeStyle = <span class="reserved">function</span>(ar) {
var str = <span class="literal">""</span>;
<span class="comment">// Compress box</span>
tinyMCE.compressStyle(ar, <span class="literal">"border"</span>, <span class="literal">""</span>, <span class="literal">"border"</span>);
tinyMCE.compressStyle(ar, <span class="literal">"border"</span>, <span class="literal">"-width"</span>, <span class="literal">"border-width"</span>);
tinyMCE.compressStyle(ar, <span class="literal">"border"</span>, <span class="literal">"-color"</span>, <span class="literal">"border-color"</span>);
tinyMCE.compressStyle(ar, <span class="literal">"border"</span>, <span class="literal">"-style"</span>, <span class="literal">"border-style"</span>);
tinyMCE.compressStyle(ar, <span class="literal">"padding"</span>, <span class="literal">""</span>, <span class="literal">"padding"</span>);
tinyMCE.compressStyle(ar, <span class="literal">"margin"</span>, <span class="literal">""</span>, <span class="literal">"margin"</span>);
<span class="reserved">for</span> (var key in ar) {
var val = ar[key];
<span class="reserved">if</span> (typeof(val) == <span class="literal">'function'</span>)
continue;
<span class="reserved">if</span> (key.indexOf(<span class="literal">'mso-'</span>) == 0)
continue;
<span class="reserved">if</span> (val != null &amp;&amp; val != <span class="literal">''</span>) {
val = <span class="literal">''</span> + val; <span class="comment">// Force string</span>
<span class="comment">// Fix style URL</span>
val = val.replace(new RegExp(<span class="literal">"url\\(\\'?([^\\']*)\\'?\\)"</span>, <span class="literal">'gi'</span>), <span class="literal">"url('$1')"</span>);
<span class="comment">// Convert URL</span>
<span class="reserved">if</span> (val.indexOf(<span class="literal">'url('</span>) != -1 &amp;&amp; tinyMCE.getParam(<span class="literal">'convert_urls'</span>)) {
var m = new RegExp(<span class="literal">"url\\('(.*?)'\\)"</span>).exec(val);
<span class="reserved">if</span> (m.length &gt; 1)
val = <span class="literal">"url('"</span> + eval(tinyMCE.getParam(<span class="literal">'urlconverter_callback'</span>) + <span class="literal">"(m[1], null, true);"</span>) + <span class="literal">"')"</span>;
}
<span class="comment">// Force HEX colors</span>
<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">"force_hex_style_colors"</span>))
val = tinyMCE.convertRGBToHex(val, true);
<span class="reserved">if</span> (val != <span class="literal">"url('')"</span>)
str += key.toLowerCase() + <span class="literal">": "</span> + val + <span class="literal">"; "</span>;
}
}
<span class="reserved">if</span> (new RegExp(<span class="literal">'; $'</span>).test(str))
str = str.substring(0, str.length - 2);
<span class="reserved">return</span> str;
};
<span class="comment">/**
* Returns a hexadecimal version of the specified rgb(1,2,3) string.
*
* <span class="attrib">@param</span> {string} s RGB string to parse, if this doesn't isn't a rgb(n,n,n) it will passthrough the string.
* <span class="attrib">@param</span> {boolean} k Keep before/after contents. If enabled contents before after the rgb(n,n,n) will be intact.
* <span class="attrib">@return</span> Hexadecimal version of the specified rgb(1,2,3) string.
* <span class="attrib">@type</span> string
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.convertRGBToHex = <span class="reserved">function</span>(s, k) {
<span class="reserved">if</span> (s.toLowerCase().indexOf(<span class="literal">'rgb'</span>) != -1) {
var re = new RegExp(<span class="literal">"(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)"</span>, <span class="literal">"gi"</span>);
var rgb = s.replace(re, <span class="literal">"$1,$2,$3,$4,$5"</span>).split(<span class="literal">','</span>);
<span class="reserved">if</span> (rgb.length == 5) {
r = parseInt(rgb[1]).toString(16);
g = parseInt(rgb[2]).toString(16);
b = parseInt(rgb[3]).toString(16);
r = r.length == 1 ? <span class="literal">'0'</span> + r : r;
g = g.length == 1 ? <span class="literal">'0'</span> + g : g;
b = b.length == 1 ? <span class="literal">'0'</span> + b : b;
s = <span class="literal">"#"</span> + r + g + b;
<span class="reserved">if</span> (k)
s = rgb[0] + s + rgb[4];
}
}
<span class="reserved">return</span> s;
};
<span class="comment">/**
* Returns a rgb(n,n,n) string from a hexadecimal value.
*
* <span class="attrib">@param</span> {string} s Hexadecimal string to parse.
* <span class="attrib">@return</span> rgb(n,n,n) string from a hexadecimal value.
* <span class="attrib">@type</span> string
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.convertHexToRGB = <span class="reserved">function</span>(s) {
<span class="reserved">if</span> (s.indexOf(<span class="literal">'#'</span>) != -1) {
s = s.replace(new RegExp(<span class="literal">'[^0-9A-F]'</span>, <span class="literal">'gi'</span>), <span class="literal">''</span>);
<span class="reserved">return</span> <span class="literal">"rgb("</span> + parseInt(s.substring(0, 2), 16) + <span class="literal">","</span> + parseInt(s.substring(2, 4), 16) + <span class="literal">","</span> + parseInt(s.substring(4, 6), 16) + <span class="literal">")"</span>;
}
<span class="reserved">return</span> s;
};
<span class="comment">/**
* Converts span elements to font elements in the specified document instance.
* Todo: Move this function into a XHTML plugin or simmilar.
*
* <span class="attrib">@param</span> {DOMDocument} doc Document instance to convert spans in.
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.convertSpansToFonts = <span class="reserved">function</span>(doc) {
var sizes = tinyMCE.getParam(<span class="literal">'font_size_style_values'</span>).replace(/\s+/, <span class="literal">''</span>).split(<span class="literal">','</span>);
var h = doc.body.innerHTML;
h = h.replace(/&lt;span/gi, <span class="literal">'&lt;font'</span>);
h = h.replace(/&lt;\/span/gi, <span class="literal">'&lt;/font'</span>);
doc.body.innerHTML = h;
var s = doc.getElementsByTagName(<span class="literal">"font"</span>);
<span class="reserved">for</span> (var i=0; i&lt;s.length; i++) {
var size = tinyMCE.trim(s[i].style.fontSize).toLowerCase();
var fSize = 0;
<span class="reserved">for</span> (var x=0; x&lt;sizes.length; x++) {
<span class="reserved">if</span> (sizes[x] == size) {
fSize = x + 1;
break;
}
}
<span class="reserved">if</span> (fSize &gt; 0) {
tinyMCE.setAttrib(s[i], <span class="literal">'size'</span>, fSize);
s[i].style.fontSize = <span class="literal">''</span>;
}
var fFace = s[i].style.fontFamily;
<span class="reserved">if</span> (fFace != null &amp;&amp; fFace != <span class="literal">""</span>) {
tinyMCE.setAttrib(s[i], <span class="literal">'face'</span>, fFace);
s[i].style.fontFamily = <span class="literal">''</span>;
}
var fColor = s[i].style.color;
<span class="reserved">if</span> (fColor != null &amp;&amp; fColor != <span class="literal">""</span>) {
tinyMCE.setAttrib(s[i], <span class="literal">'color'</span>, tinyMCE.convertRGBToHex(fColor));
s[i].style.color = <span class="literal">''</span>;
}
}
};
<span class="comment">/**
* Convers fonts to spans in the specified document.
* Todo: Move this function into a XHTML plugin or simmilar.
*
* <span class="attrib">@param</span> {DOMDocument} doc Document instance to convert fonts in.
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.convertFontsToSpans = <span class="reserved">function</span>(doc) {
var sizes = tinyMCE.getParam(<span class="literal">'font_size_style_values'</span>).replace(/\s+/, <span class="literal">''</span>).split(<span class="literal">','</span>);
var h = doc.body.innerHTML;
h = h.replace(/&lt;font/gi, <span class="literal">'&lt;span'</span>);
h = h.replace(/&lt;\/font/gi, <span class="literal">'&lt;/span'</span>);
doc.body.innerHTML = h;
var fsClasses = tinyMCE.getParam(<span class="literal">'font_size_classes'</span>);
<span class="reserved">if</span> (fsClasses != <span class="literal">''</span>)
fsClasses = fsClasses.replace(/\s+/, <span class="literal">''</span>).split(<span class="literal">','</span>);
<span class="reserved">else</span>
fsClasses = null;
var s = doc.getElementsByTagName(<span class="literal">"span"</span>);
<span class="reserved">for</span> (var i=0; i&lt;s.length; i++) {
var fSize, fFace, fColor;
fSize = tinyMCE.getAttrib(s[i], <span class="literal">'size'</span>);
fFace = tinyMCE.getAttrib(s[i], <span class="literal">'face'</span>);
fColor = tinyMCE.getAttrib(s[i], <span class="literal">'color'</span>);
<span class="reserved">if</span> (fSize != <span class="literal">""</span>) {
fSize = parseInt(fSize);
<span class="reserved">if</span> (fSize &gt; 0 &amp;&amp; fSize &lt; 8) {
<span class="reserved">if</span> (fsClasses != null)
tinyMCE.setAttrib(s[i], <span class="literal">'class'</span>, fsClasses[fSize-1]);
<span class="reserved">else</span>
s[i].style.fontSize = sizes[fSize-1];
}
s[i].removeAttribute(<span class="literal">'size'</span>);
}
<span class="reserved">if</span> (fFace != <span class="literal">""</span>) {
s[i].style.fontFamily = fFace;
s[i].removeAttribute(<span class="literal">'face'</span>);
}
<span class="reserved">if</span> (fColor != <span class="literal">""</span>) {
s[i].style.color = fColor;
s[i].removeAttribute(<span class="literal">'color'</span>);
}
}
};
<span class="comment">/**
* Moves the contents of a anchor outside and after the anchor. Only if the anchor doesn't
* have a href.
*
* <span class="attrib">@param</span> {DOMDocument} doc DOM document instance to fix anchors in.
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.cleanupAnchors = <span class="reserved">function</span>(doc) {
var i, cn, x, an = doc.getElementsByTagName(<span class="literal">"a"</span>);
<span class="comment">// Loops backwards due to bug #1467987</span>
<span class="reserved">for</span> (i=an.length-1; i&gt;=0; i--) {
<span class="reserved">if</span> (tinyMCE.getAttrib(an[i], <span class="literal">"name"</span>) != <span class="literal">""</span> &amp;&amp; tinyMCE.getAttrib(an[i], <span class="literal">"href"</span>) == <span class="literal">""</span>) {
cn = an[i].childNodes;
<span class="reserved">for</span> (x=cn.length-1; x&gt;=0; x--)
tinyMCE.insertAfter(cn[x], an[i]);
}
}
};
<span class="comment">/**
* Returns the HTML contents of the specified editor instance id.
*
* <span class="attrib">@param</span> {string} editor_id Editor instance id to retrive HTML code from.
* <span class="attrib">@return</span> HTML contents of editor id or null if it wasn't found.
* <span class="attrib">@type</span> string
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.getContent = <span class="reserved">function</span>(editor_id) {
var h;
<span class="reserved">if</span> (typeof(editor_id) != <span class="literal">"undefined"</span>)
tinyMCE.selectedInstance = tinyMCE.getInstanceById(editor_id);
<span class="reserved">if</span> (tinyMCE.selectedInstance) {
h = tinyMCE._cleanupHTML(<span class="reserved">this</span>.selectedInstance, <span class="reserved">this</span>.selectedInstance.getDoc(), tinyMCE.settings, <span class="reserved">this</span>.selectedInstance.getBody(), false, true);
<span class="comment">// When editing always use fonts internaly</span>
<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">"convert_fonts_to_spans"</span>))
tinyMCE.convertSpansToFonts(<span class="reserved">this</span>.selectedInstance.getDoc());
<span class="reserved">return</span> h;
}
<span class="reserved">return</span> null;
};
<span class="comment">/**
* Fixes invalid ul/ol elements so the document is more XHTML valid.
*
* <span class="attrib">@param</span> {DOMDocument} d HTML DOM document to fix list elements in.
* <span class="attrib">@private</span>
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>._fixListElements = <span class="reserved">function</span>(d) {
var nl, x, a = [<span class="literal">'ol'</span>, <span class="literal">'ul'</span>], i, n, p, r = new RegExp(<span class="literal">'^(OL|UL)$'</span>), np;
<span class="reserved">for</span> (x=0; x&lt;a.length; x++) {
nl = d.getElementsByTagName(a[x]);
<span class="reserved">for</span> (i=0; i&lt;nl.length; i++) {
n = nl[i];
p = n.parentNode;
<span class="reserved">if</span> (r.test(p.nodeName)) {
np = tinyMCE.prevNode(n, <span class="literal">'LI'</span>);
<span class="reserved">if</span> (!np) {
np = d.createElement(<span class="literal">'li'</span>);
np.innerHTML = <span class="literal">'&amp;nbsp;'</span>;
np.appendChild(n);
p.insertBefore(np, p.firstChild);
} <span class="reserved">else</span>
np.appendChild(n);
}
}
}
};
<span class="comment">/**
* Moves table elements out of block elements to produce more valid XHTML.
*
* <span class="attrib">@param</span> {DOMDocument} d HTML DOM document to fix list elements in.
* <span class="attrib">@private</span>
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>._fixTables = <span class="reserved">function</span>(d) {
var nl, i, n, p, np, x, t;
nl = d.getElementsByTagName(<span class="literal">'table'</span>);
<span class="reserved">for</span> (i=0; i&lt;nl.length; i++) {
n = nl[i];
<span class="reserved">if</span> ((p = tinyMCE.getParentElement(n, <span class="literal">'p,div,h1,h2,h3,h4,h5,h6'</span>)) != null) {
np = p.cloneNode(false);
np.removeAttribute(<span class="literal">'id'</span>);
t = n;
<span class="reserved">while</span> ((n = n.nextSibling))
np.appendChild(n);
tinyMCE.insertAfter(np, p);
tinyMCE.insertAfter(t, p);
}
}
};
<span class="comment">/**
* Performces cleanup of the contents of the specified instance.
* Todo: Finish documentation, and remove useless parameters.
*
* <span class="attrib">@param</span> {TinyMCE_Control} inst Editor instance.
* <span class="attrib">@param</span> {DOMDocument} doc ...
* <span class="attrib">@param</span> {Array} config ...
* <span class="attrib">@param</span> {HTMLElement} elm ...
* <span class="attrib">@param</span> {boolean} visual ...
* <span class="attrib">@param</span> {boolean} on_save ...
* <span class="attrib">@param</span> {boolean} on_submit ...
* <span class="attrib">@return</span> Cleaned HTML contents of editor instance.
* <span class="attrib">@type</span> string
* <span class="attrib">@private</span>
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>._cleanupHTML = <span class="reserved">function</span>(inst, doc, config, elm, visual, on_save, on_submit) {
var h, d, t1, t2, t3, t4, t5, c, s;
<span class="reserved">if</span> (!tinyMCE.getParam(<span class="literal">'cleanup'</span>))
<span class="reserved">return</span> elm.innerHTML;
on_save = typeof(on_save) == <span class="literal">'undefined'</span> ? false : on_save;
c = inst.cleanup;
s = inst.settings;
d = c.settings.debug;
<span class="reserved">if</span> (d)
t1 = new Date().getTime();
<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">"convert_fonts_to_spans"</span>))
tinyMCE.convertFontsToSpans(doc);
<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">"fix_list_elements"</span>))
tinyMCE._fixListElements(doc);
<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">"fix_table_elements"</span>))
tinyMCE._fixTables(doc);
<span class="comment">// Call custom cleanup code</span>
tinyMCE._customCleanup(inst, on_save ? <span class="literal">"get_from_editor_dom"</span> : <span class="literal">"insert_to_editor_dom"</span>, doc.body);
<span class="reserved">if</span> (d)
t2 = new Date().getTime();
c.settings.on_save = on_save;
<span class="comment">//for (var i=0; i&lt;100; i++)</span>
c.idCount = 0;
c.serializationId++;
c.serializedNodes = new Array();
c.sourceIndex = -1;
<span class="reserved">if</span> (s.cleanup_serializer == <span class="literal">"xml"</span>)
h = c.serializeNodeAsXML(elm);
<span class="reserved">else</span>
h = c.serializeNodeAsHTML(elm);
<span class="reserved">if</span> (d)
t3 = new Date().getTime();
<span class="comment">// Post processing</span>
h = h.replace(/&lt;\/?(body|head|html)[^&gt;]*&gt;/gi, <span class="literal">''</span>);
h = h.replace(new RegExp(<span class="literal">' (rowspan="1"|colspan="1")'</span>, <span class="literal">'g'</span>), <span class="literal">''</span>);
h = h.replace(/&lt;p&gt;&lt;hr \/&gt;&lt;\/p&gt;/g, <span class="literal">'&lt;hr /&gt;'</span>);
h = h.replace(/&lt;p&gt;(&amp;nbsp;|&amp;#160;)&lt;\/p&gt;&lt;hr \/&gt;&lt;p&gt;(&amp;nbsp;|&amp;#160;)&lt;\/p&gt;/g, <span class="literal">'&lt;hr /&gt;'</span>);
h = h.replace(/&lt;td&gt;\s*&lt;br \/&gt;\s*&lt;\/td&gt;/g, <span class="literal">'&lt;td&gt;&amp;nbsp;&lt;/td&gt;'</span>);
h = h.replace(/&lt;p&gt;\s*&lt;br \/&gt;\s*&lt;\/p&gt;/g, <span class="literal">'&lt;p&gt;&amp;nbsp;&lt;/p&gt;'</span>);
h = h.replace(/&lt;p&gt;\s*(&amp;nbsp;|&amp;#160;)\s*&lt;br \/&gt;\s*(&amp;nbsp;|&amp;#160;)\s*&lt;\/p&gt;/g, <span class="literal">'&lt;p&gt;&amp;nbsp;&lt;/p&gt;'</span>);
h = h.replace(/&lt;p&gt;\s*(&amp;nbsp;|&amp;#160;)\s*&lt;br \/&gt;\s*&lt;\/p&gt;/g, <span class="literal">'&lt;p&gt;&amp;nbsp;&lt;/p&gt;'</span>);
h = h.replace(/&lt;p&gt;\s*&lt;br \/&gt;\s*&amp;nbsp;\s*&lt;\/p&gt;/g, <span class="literal">'&lt;p&gt;&amp;nbsp;&lt;/p&gt;'</span>);
h = h.replace(new RegExp(<span class="literal">'&lt;a&gt;(.*?)&lt;\\/a&gt;'</span>, <span class="literal">'g'</span>), <span class="literal">'$1'</span>);
h = h.replace(/&lt;p([^&gt;]*)&gt;\s*&lt;\/p&gt;/g, <span class="literal">'&lt;p$1&gt;&amp;nbsp;&lt;/p&gt;'</span>);
<span class="comment">// Clean body</span>
<span class="reserved">if</span> (/^\s*(&lt;br \/&gt;|&lt;p&gt;&amp;nbsp;&lt;\/p&gt;|&lt;p&gt;&amp;#160;&lt;\/p&gt;|&lt;p&gt;&lt;\/p&gt;)\s*$/.test(h))
h = <span class="literal">''</span>;
<span class="comment">// If preformatted</span>
<span class="reserved">if</span> (s.preformatted) {
h = h.replace(/^&lt;pre&gt;/, <span class="literal">''</span>);
h = h.replace(/&lt;\/pre&gt;$/, <span class="literal">''</span>);
h = <span class="literal">'&lt;pre&gt;'</span> + h + <span class="literal">'&lt;/pre&gt;'</span>;
}
<span class="comment">// Gecko specific processing</span>
<span class="reserved">if</span> (tinyMCE.isGecko) {
h = h.replace(/&lt;o:p _moz-userdefined=<span class="literal">""</span> \/&gt;/g, <span class="literal">''</span>);
h = h.replace(/&lt;td([^&gt;]*)&gt;\s*&lt;br \/&gt;\s*&lt;\/td&gt;/g, <span class="literal">'&lt;td$1&gt;&amp;nbsp;&lt;/td&gt;'</span>);
}
<span class="reserved">if</span> (s.force_br_newlines)
h = h.replace(/&lt;p&gt;(&amp;nbsp;|&amp;#160;)&lt;\/p&gt;/g, <span class="literal">'&lt;br /&gt;'</span>);
<span class="comment">// Call custom cleanup code</span>
h = tinyMCE._customCleanup(inst, on_save ? <span class="literal">"get_from_editor"</span> : <span class="literal">"insert_to_editor"</span>, h);
<span class="comment">// Remove internal classes</span>
<span class="reserved">if</span> (on_save) {
h = h.replace(new RegExp(<span class="literal">' ?(mceItem[a-zA-Z0-9]*|'</span> + s.visual_table_class + <span class="literal">')'</span>, <span class="literal">'g'</span>), <span class="literal">''</span>);
h = h.replace(new RegExp(<span class="literal">' ?class=""'</span>, <span class="literal">'g'</span>), <span class="literal">''</span>);
}
<span class="reserved">if</span> (s.remove_linebreaks &amp;&amp; !c.settings.indent)
h = h.replace(/\n|\r/g, <span class="literal">' '</span>);
<span class="reserved">if</span> (d)
t4 = new Date().getTime();
<span class="reserved">if</span> (on_save &amp;&amp; c.settings.indent)
h = c.formatHTML(h);
<span class="comment">// If encoding (not recommended option)</span>
<span class="reserved">if</span> (on_submit &amp;&amp; (s.encoding == <span class="literal">"xml"</span> || s.encoding == <span class="literal">"html"</span>))
h = c.xmlEncode(h);
<span class="reserved">if</span> (d)
t5 = new Date().getTime();
<span class="reserved">if</span> (c.settings.debug)
tinyMCE.debug(<span class="literal">"Cleanup in ms: Pre="</span> + (t2-t1) + <span class="literal">", Serialize: "</span> + (t3-t2) + <span class="literal">", Post: "</span> + (t4-t3) + <span class="literal">", Format: "</span> + (t5-t4) + <span class="literal">", Sum: "</span> + (t5-t1) + <span class="literal">"."</span>);
<span class="reserved">return</span> h;
};
<span class="comment">/**
* TinyMCE_Cleanup class.
*/</span>
<span class="reserved">function</span> TinyMCE_Cleanup() {
<span class="reserved">this</span>.isMSIE = (navigator.appName == <span class="literal">"Microsoft Internet Explorer"</span>);
<span class="reserved">this</span>.rules = tinyMCE.clearArray(new Array());
<span class="comment">// Default config</span>
<span class="reserved">this</span>.settings = {
indent_elements : <span class="literal">'head,table,tbody,thead,tfoot,form,tr,ul,ol,blockquote,object'</span>,
newline_before_elements : <span class="literal">'h1,h2,h3,h4,h5,h6,pre,address,div,ul,ol,li,meta,option,area,title,link,base,script,td'</span>,
newline_after_elements : <span class="literal">'br,hr,p,pre,address,div,ul,ol,meta,option,area,link,base,script'</span>,
newline_before_after_elements : <span class="literal">'html,head,body,table,thead,tbody,tfoot,tr,form,ul,ol,blockquote,p,object,param,hr,div'</span>,
indent_char : <span class="literal">'\t'</span>,
indent_levels : 1,
entity_encoding : <span class="literal">'raw'</span>,
valid_elements : <span class="literal">'*[*]'</span>,
entities : <span class="literal">''</span>,
url_converter : <span class="literal">''</span>,
invalid_elements : <span class="literal">''</span>,
verify_html : false
};
<span class="reserved">this</span>.vElements = tinyMCE.clearArray(new Array());
<span class="reserved">this</span>.vElementsRe = <span class="literal">''</span>;
<span class="reserved">this</span>.closeElementsRe = /^(IMG|BR|HR|LINK|META|BASE|INPUT|BUTTON|AREA)$/;
<span class="reserved">this</span>.codeElementsRe = /^(SCRIPT|STYLE)$/;
<span class="reserved">this</span>.serializationId = 0;
<span class="reserved">this</span>.mceAttribs = {
href : <span class="literal">'mce_href'</span>,
src : <span class="literal">'mce_src'</span>,
type : <span class="literal">'mce_type'</span>
};
}
TinyMCE_Cleanup.<span class="reserved">prototype</span> = {
<span class="comment">/**
* Initializes the cleanup engine with the specified config.
*
* <span class="attrib">@param</span> {Array} s Name/Value array with config settings.
*/</span>
init : <span class="reserved">function</span>(s) {
var n, a, i, ir, or, st;
<span class="reserved">for</span> (n in s)
<span class="reserved">this</span>.settings[n] = s[n];
<span class="comment">// Setup code formating</span>
s = <span class="reserved">this</span>.settings;
<span class="comment">// Setup regexps</span>
<span class="reserved">this</span>.inRe = <span class="reserved">this</span>._arrayToRe(s.indent_elements.split(<span class="literal">','</span>), <span class="literal">''</span>, <span class="literal">'^&lt;('</span>, <span class="literal">')[^&gt;]*'</span>);
<span class="reserved">this</span>.ouRe = <span class="reserved">this</span>._arrayToRe(s.indent_elements.split(<span class="literal">','</span>), <span class="literal">''</span>, <span class="literal">'^&lt;\\/('</span>, <span class="literal">')[^&gt;]*'</span>);
<span class="reserved">this</span>.nlBeforeRe = <span class="reserved">this</span>._arrayToRe(s.newline_before_elements.split(<span class="literal">','</span>), <span class="literal">'gi'</span>, <span class="literal">'&lt;('</span>, <span class="literal">')([^&gt;]*)&gt;'</span>);
<span class="reserved">this</span>.nlAfterRe = <span class="reserved">this</span>._arrayToRe(s.newline_after_elements.split(<span class="literal">','</span>), <span class="literal">'gi'</span>, <span class="literal">'&lt;('</span>, <span class="literal">')([^&gt;]*)&gt;'</span>);
<span class="reserved">this</span>.nlBeforeAfterRe = <span class="reserved">this</span>._arrayToRe(s.newline_before_after_elements.split(<span class="literal">','</span>), <span class="literal">'gi'</span>, <span class="literal">'&lt;(\\/?)('</span>, <span class="literal">')([^&gt;]*)&gt;'</span>);
<span class="reserved">if</span> (s.invalid_elements != <span class="literal">''</span>)
<span class="reserved">this</span>.iveRe = <span class="reserved">this</span>._arrayToRe(s.invalid_elements.toUpperCase().split(<span class="literal">','</span>), <span class="literal">'g'</span>, <span class="literal">'^('</span>, <span class="literal">')$'</span>);
<span class="reserved">else</span>
<span class="reserved">this</span>.iveRe = null;
<span class="comment">// Setup separator</span>
st = <span class="literal">''</span>;
<span class="reserved">for</span> (i=0; i&lt;s.indent_levels; i++)
st += s.indent_char;
<span class="reserved">this</span>.inStr = st;
<span class="comment">// If verify_html if false force *[*]</span>
<span class="reserved">if</span> (!s.verify_html) {
s.valid_elements = <span class="literal">'*[*]'</span>;
s.extended_valid_elements = <span class="literal">''</span>;
}
<span class="reserved">this</span>.fillStr = s.entity_encoding == <span class="literal">"named"</span> ? <span class="literal">"&amp;nbsp;"</span> : <span class="literal">"&amp;#160;"</span>;
<span class="reserved">this</span>.idCount = 0;
},
<span class="comment">/**
* Adds a cleanup rule string, for example: a[href|name|title=title|class=class1?class2?class3].
* These rules are then used when serializing the DOM tree as a HTML string, it gives the possibility
* to control the valid elements and attributes and force attribute values or default them.
*
* <span class="attrib">@param</span> {string} s Rule string to parse and add to the cleanup rules array.
*/</span>
addRuleStr : <span class="reserved">function</span>(s) {
var r = <span class="reserved">this</span>.parseRuleStr(s);
var n;
<span class="reserved">for</span> (n in r) {
<span class="reserved">if</span> (r[n])
<span class="reserved">this</span>.rules[n] = r[n];
}
<span class="reserved">this</span>.vElements = tinyMCE.clearArray(new Array());
<span class="reserved">for</span> (n in <span class="reserved">this</span>.rules) {
<span class="reserved">if</span> (<span class="reserved">this</span>.rules[n])
<span class="reserved">this</span>.vElements[<span class="reserved">this</span>.vElements.length] = <span class="reserved">this</span>.rules[n].tag;
}
<span class="reserved">this</span>.vElementsRe = <span class="reserved">this</span>._arrayToRe(<span class="reserved">this</span>.vElements, <span class="literal">''</span>);
},
<span class="comment">/**
* Parses a cleanup rule string, for example: a[href|name|title=title|class=class1?class2?class3].
* These rules are then used when serializing the DOM tree as a HTML string, it gives the possibility
* to control the valid elements and attributes and force attribute values or default them.
*
* <span class="attrib">@param</span> {string} s Rule string to parse as a name/value rule array.
* <span class="attrib">@return</span> Parsed name/value rule array.
* <span class="attrib">@type</span> Array
*/</span>
parseRuleStr : <span class="reserved">function</span>(s) {
var ta, p, r, a, i, x, px, t, tn, y, av, or = tinyMCE.clearArray(new Array()), dv;
<span class="reserved">if</span> (s == null || s.length == 0)
<span class="reserved">return</span> or;
ta = s.split(<span class="literal">','</span>);
<span class="reserved">for</span> (x=0; x&lt;ta.length; x++) {
s = ta[x];
<span class="reserved">if</span> (s.length == 0)
continue;
<span class="comment">// Split tag/attrs</span>
p = <span class="reserved">this</span>.split(/\[|\]/, s);
<span class="reserved">if</span> (p == null || p.length &lt; 1)
t = s.toUpperCase();
<span class="reserved">else</span>
t = p[0].toUpperCase();
<span class="comment">// Handle all tag names</span>
tn = <span class="reserved">this</span>.split(<span class="literal">'/'</span>, t);
<span class="reserved">for</span> (y=0; y&lt;tn.length; y++) {
r = {};
r.tag = tn[y];
r.forceAttribs = null;
r.defaultAttribs = null;
r.validAttribValues = null;
<span class="comment">// Handle prefixes</span>
px = r.tag.charAt(0);
r.forceOpen = px == <span class="literal">'+'</span>;
r.removeEmpty = px == <span class="literal">'-'</span>;
r.fill = px == <span class="literal">'#'</span>;
r.tag = r.tag.replace(/\+|-|#/g, <span class="literal">''</span>);
r.oTagName = tn[0].replace(/\+|-|#/g, <span class="literal">''</span>).toLowerCase();
r.isWild = new RegExp(<span class="literal">'\\*|\\?|\\+'</span>, <span class="literal">'g'</span>).test(r.tag);
r.validRe = new RegExp(<span class="reserved">this</span>._wildcardToRe(<span class="literal">'^'</span> + r.tag + <span class="literal">'$'</span>));
<span class="comment">// Setup valid attributes</span>
<span class="reserved">if</span> (p.length &gt; 1) {
r.vAttribsRe = <span class="literal">'^('</span>;
a = <span class="reserved">this</span>.split(/\|/, p[1]);
<span class="reserved">for</span> (i=0; i&lt;a.length; i++) {
t = a[i];
av = new RegExp(<span class="literal">'(=|:|&lt;)(.*?)$'</span>).exec(t);
t = t.replace(new RegExp(<span class="literal">'(=|:|&lt;).*?$'</span>), <span class="literal">''</span>);
<span class="reserved">if</span> (av &amp;&amp; av.length &gt; 0) {
<span class="reserved">if</span> (av[0].charAt(0) == <span class="literal">':'</span>) {
<span class="reserved">if</span> (!r.forceAttribs)
r.forceAttribs = tinyMCE.clearArray(new Array());
r.forceAttribs[t.toLowerCase()] = av[0].substring(1);
} <span class="reserved">else</span> <span class="reserved">if</span> (av[0].charAt(0) == <span class="literal">'='</span>) {
<span class="reserved">if</span> (!r.defaultAttribs)
r.defaultAttribs = tinyMCE.clearArray(new Array());
dv = av[0].substring(1);
r.defaultAttribs[t.toLowerCase()] = dv == <span class="literal">""</span> ? <span class="literal">"mce_empty"</span> : dv;
} <span class="reserved">else</span> <span class="reserved">if</span> (av[0].charAt(0) == <span class="literal">'&lt;'</span>) {
<span class="reserved">if</span> (!r.validAttribValues)
r.validAttribValues = tinyMCE.clearArray(new Array());
r.validAttribValues[t.toLowerCase()] = <span class="reserved">this</span>._arrayToRe(<span class="reserved">this</span>.split(<span class="literal">'?'</span>, av[0].substring(1)), <span class="literal">''</span>);
}
}
r.vAttribsRe += <span class="literal">''</span> + t.toLowerCase() + (i != a.length - 1 ? <span class="literal">'|'</span> : <span class="literal">''</span>);
a[i] = t.toLowerCase();
}
r.vAttribsRe += <span class="literal">')$'</span>;
r.vAttribsRe = <span class="reserved">this</span>._wildcardToRe(r.vAttribsRe);
r.vAttribsReIsWild = new RegExp(<span class="literal">'\\*|\\?|\\+'</span>, <span class="literal">'g'</span>).test(r.vAttribsRe);
r.vAttribsRe = new RegExp(r.vAttribsRe);
r.vAttribs = a.reverse();
<span class="comment">//tinyMCE.debug(r.tag, r.oTagName, r.vAttribsRe, r.vAttribsReWC);</span>
} <span class="reserved">else</span> {
r.vAttribsRe = <span class="literal">''</span>;
r.vAttribs = tinyMCE.clearArray(new Array());
r.vAttribsReIsWild = false;
}
or[r.tag] = r;
}
}
<span class="reserved">return</span> or;
},
<span class="comment">/**
* Serializes the specified node as a HTML string. This uses the XML parser and serializer
* to generate a XHTML string.
*
* <span class="attrib">@param</span> {HTMLNode} n Node to serialize as a XHTML string.
* <span class="attrib">@return</span> Serialized XHTML string based on specified node.
* <span class="attrib">@type</span> string
*/</span>
serializeNodeAsXML : <span class="reserved">function</span>(n) {
var s, b;
<span class="reserved">if</span> (!<span class="reserved">this</span>.xmlDoc) {
<span class="reserved">if</span> (<span class="reserved">this</span>.isMSIE) {
try {<span class="reserved">this</span>.xmlDoc = new ActiveXObject(<span class="literal">'MSXML2.DOMDocument'</span>);} catch (e) {}
<span class="reserved">if</span> (!<span class="reserved">this</span>.xmlDoc)
try {<span class="reserved">this</span>.xmlDoc = new ActiveXObject(<span class="literal">'Microsoft.XmlDom'</span>);} catch (e) {}
} <span class="reserved">else</span>
<span class="reserved">this</span>.xmlDoc = document.implementation.createDocument(<span class="literal">''</span>, <span class="literal">''</span>, null);
<span class="reserved">if</span> (!<span class="reserved">this</span>.xmlDoc)
alert(<span class="literal">"Error XML Parser could not be found."</span>);
}
<span class="reserved">if</span> (<span class="reserved">this</span>.xmlDoc.firstChild)
<span class="reserved">this</span>.xmlDoc.removeChild(<span class="reserved">this</span>.xmlDoc.firstChild);
b = <span class="reserved">this</span>.xmlDoc.createElement(<span class="literal">"html"</span>);
b = <span class="reserved">this</span>.xmlDoc.appendChild(b);
<span class="reserved">this</span>._convertToXML(n, b);
<span class="reserved">if</span> (<span class="reserved">this</span>.isMSIE)
<span class="reserved">return</span> <span class="reserved">this</span>.xmlDoc.xml;
<span class="reserved">else</span>
<span class="reserved">return</span> new XMLSerializer().serializeToString(<span class="reserved">this</span>.xmlDoc);
},
<span class="comment">/**
* Converts and adds the specified HTML DOM node to a XML DOM node.
*
* <span class="attrib">@param</span> {HTMLNode} n HTML Node to add as a XML node.
* <span class="attrib">@param</span> {XMLNode} xn XML Node to add the HTML node to.
* <span class="attrib">@private</span>
*/</span>
_convertToXML : <span class="reserved">function</span>(n, xn) {
var xd, el, i, l, cn, at, no, hc = false;
<span class="reserved">if</span> (<span class="reserved">this</span>._isDuplicate(n))
<span class="reserved">return</span>;
xd = <span class="reserved">this</span>.xmlDoc;
switch (n.nodeType) {
case 1: <span class="comment">// Element</span>
hc = n.hasChildNodes();
el = xd.createElement(n.nodeName.toLowerCase());
at = n.attributes;
<span class="reserved">for</span> (i=at.length-1; i&gt;-1; i--) {
no = at[i];
<span class="reserved">if</span> (no.specified &amp;&amp; no.nodeValue)
el.setAttribute(no.nodeName.toLowerCase(), no.nodeValue);
}
<span class="reserved">if</span> (!hc &amp;&amp; !<span class="reserved">this</span>.closeElementsRe.test(n.nodeName))
el.appendChild(xd.createTextNode(<span class="literal">""</span>));
xn = xn.appendChild(el);
break;
case 3: <span class="comment">// Text</span>
xn.appendChild(xd.createTextNode(n.nodeValue));
<span class="reserved">return</span>;
case 8: <span class="comment">// Comment</span>
xn.appendChild(xd.createComment(n.nodeValue));
<span class="reserved">return</span>;
}
<span class="reserved">if</span> (hc) {
cn = n.childNodes;
<span class="reserved">for</span> (i=0, l=cn.length; i&lt;l; i++)
<span class="reserved">this</span>._convertToXML(cn[i], xn);
}
},
<span class="comment">/**
* Serializes the specified node as a XHTML string. This uses the TinyMCE serializer logic since it gives more
* control over the output than the build in browser XML serializer.
*
* <span class="attrib">@param</span> {HTMLNode} n Node to serialize as a XHTML string.
* <span class="attrib">@return</span> Serialized XHTML string based on specified node.
* <span class="attrib">@type</span> string
*/</span>
serializeNodeAsHTML : <span class="reserved">function</span>(n) {
var en, no, h = <span class="literal">''</span>, i, l, r, cn, va = false, f = false, at, hc;
<span class="reserved">this</span>._setupRules(); <span class="comment">// Will initialize cleanup rules</span>
<span class="reserved">if</span> (<span class="reserved">this</span>._isDuplicate(n))
<span class="reserved">return</span> <span class="literal">''</span>;
switch (n.nodeType) {
case 1: <span class="comment">// Element</span>
hc = n.hasChildNodes();
<span class="comment">// MSIE sometimes produces &lt;//tag&gt;</span>
<span class="reserved">if</span> ((tinyMCE.isMSIE &amp;&amp; !tinyMCE.isOpera) &amp;&amp; n.nodeName.indexOf(<span class="literal">'/'</span>) != -1)
break;
<span class="reserved">if</span> (<span class="reserved">this</span>.vElementsRe.test(n.nodeName) &amp;&amp; (!<span class="reserved">this</span>.iveRe || !<span class="reserved">this</span>.iveRe.test(n.nodeName))) {
va = true;
r = <span class="reserved">this</span>.rules[n.nodeName];
<span class="reserved">if</span> (!r) {
at = <span class="reserved">this</span>.rules;
<span class="reserved">for</span> (no in at) {
<span class="reserved">if</span> (at[no] &amp;&amp; at[no].validRe.test(n.nodeName)) {
r = at[no];
break;
}
}
}
en = r.isWild ? n.nodeName.toLowerCase() : r.oTagName;
f = r.fill;
<span class="reserved">if</span> (r.removeEmpty &amp;&amp; !hc)
<span class="reserved">return</span> <span class="literal">""</span>;
h += <span class="literal">'&lt;'</span> + en;
<span class="reserved">if</span> (r.vAttribsReIsWild) {
<span class="comment">// Serialize wildcard attributes</span>
at = n.attributes;
<span class="reserved">for</span> (i=at.length-1; i&gt;-1; i--) {
no = at[i];
<span class="reserved">if</span> (no.specified &amp;&amp; r.vAttribsRe.test(no.nodeName))
h += <span class="reserved">this</span>._serializeAttribute(n, r, no.nodeName);
}
} <span class="reserved">else</span> {
<span class="comment">// Serialize specific attributes</span>
<span class="reserved">for</span> (i=r.vAttribs.length-1; i&gt;-1; i--)
h += <span class="reserved">this</span>._serializeAttribute(n, r, r.vAttribs[i]);
}
<span class="comment">// Serialize mce_ atts</span>
<span class="reserved">if</span> (!<span class="reserved">this</span>.settings.on_save) {
at = <span class="reserved">this</span>.mceAttribs;
<span class="reserved">for</span> (no in at) {
<span class="reserved">if</span> (at[no])
h += <span class="reserved">this</span>._serializeAttribute(n, r, at[no]);
}
}
<span class="comment">// Close these</span>
<span class="reserved">if</span> (<span class="reserved">this</span>.closeElementsRe.test(n.nodeName))
<span class="reserved">return</span> h + <span class="literal">' /&gt;'</span>;
h += <span class="literal">'&gt;'</span>;
<span class="reserved">if</span> (<span class="reserved">this</span>.isMSIE &amp;&amp; <span class="reserved">this</span>.codeElementsRe.test(n.nodeName))
h += n.innerHTML;
}
break;
case 3: <span class="comment">// Text</span>
<span class="reserved">if</span> (n.parentNode &amp;&amp; <span class="reserved">this</span>.codeElementsRe.test(n.parentNode.nodeName))
<span class="reserved">return</span> <span class="reserved">this</span>.isMSIE ? <span class="literal">''</span> : n.nodeValue;
<span class="reserved">return</span> <span class="reserved">this</span>.xmlEncode(n.nodeValue);
case 8: <span class="comment">// Comment</span>
<span class="reserved">return</span> <span class="literal">"&lt;!--"</span> + <span class="reserved">this</span>._trimComment(n.nodeValue) + <span class="literal">"--&gt;"</span>;
}
<span class="reserved">if</span> (hc) {
cn = n.childNodes;
<span class="reserved">for</span> (i=0, l=cn.length; i&lt;l; i++)
h += <span class="reserved">this</span>.serializeNodeAsHTML(cn[i]);
}
<span class="comment">// Fill empty nodes</span>
<span class="reserved">if</span> (f &amp;&amp; !hc)
h += <span class="reserved">this</span>.fillStr;
<span class="comment">// End element</span>
<span class="reserved">if</span> (va)
h += <span class="literal">'&lt;/'</span> + en + <span class="literal">'&gt;'</span>;
<span class="reserved">return</span> h;
},
<span class="comment">/**
* Serializes the specified attribute as a XHTML string chunk.
*
* <span class="attrib">@param</span> {HTMLNode} n HTML node to get attribute from.
* <span class="attrib">@param</span> {TinyMCE_CleanupRule} r Cleanup rule to use in serialization.
* <span class="attrib">@param</span> {string} an Attribute name to lookfor and serialize.
* <span class="attrib">@return</span> XHTML chunk containing attribute data if it was found.
* <span class="attrib">@type</span> string
* <span class="attrib">@private</span>
*/</span>
_serializeAttribute : <span class="reserved">function</span>(n, r, an) {
var av = <span class="literal">''</span>, t, os = <span class="reserved">this</span>.settings.on_save;
<span class="reserved">if</span> (os &amp;&amp; (an.indexOf(<span class="literal">'mce_'</span>) == 0 || an.indexOf(<span class="literal">'_moz'</span>) == 0))
<span class="reserved">return</span> <span class="literal">''</span>;
<span class="reserved">if</span> (os &amp;&amp; <span class="reserved">this</span>.mceAttribs[an])
av = <span class="reserved">this</span>._getAttrib(n, <span class="reserved">this</span>.mceAttribs[an]);
<span class="reserved">if</span> (av.length == 0)
av = <span class="reserved">this</span>._getAttrib(n, an);
<span class="reserved">if</span> (av.length == 0 &amp;&amp; r.defaultAttribs &amp;&amp; (t = r.defaultAttribs[an])) {
av = t;
<span class="reserved">if</span> (av == <span class="literal">"mce_empty"</span>)
<span class="reserved">return</span> <span class="literal">" "</span> + an + <span class="literal">'=""'</span>;
}
<span class="reserved">if</span> (r.forceAttribs &amp;&amp; (t = r.forceAttribs[an]))
av = t;
<span class="reserved">if</span> (os &amp;&amp; av.length != 0 &amp;&amp; <span class="reserved">this</span>.settings.url_converter.length != 0 &amp;&amp; /^(src|href|longdesc)$/.test(an))
av = eval(<span class="reserved">this</span>.settings.url_converter + <span class="literal">'(this, n, av)'</span>);
<span class="reserved">if</span> (av.length != 0 &amp;&amp; r.validAttribValues &amp;&amp; r.validAttribValues[an] &amp;&amp; !r.validAttribValues[an].test(av))
<span class="reserved">return</span> <span class="literal">""</span>;
<span class="reserved">if</span> (av.length != 0 &amp;&amp; av == <span class="literal">"{$uid}"</span>)
av = <span class="literal">"uid_"</span> + (<span class="reserved">this</span>.idCount++);
<span class="reserved">if</span> (av.length != 0)
<span class="reserved">return</span> <span class="literal">" "</span> + an + <span class="literal">"="</span> + <span class="literal">'"'</span> + <span class="reserved">this</span>.xmlEncode(av) + <span class="literal">'"'</span>;
<span class="reserved">return</span> <span class="literal">""</span>;
},
<span class="comment">/**
* Applies source formatting/indentation on the specified HTML string.
*
* <span class="attrib">@param</span> {string} h HTML string to apply formatting to.
* <span class="attrib">@return</span> Formatted HTML string.
* <span class="attrib">@type</span> string
*/</span>
formatHTML : <span class="reserved">function</span>(h) {
var s = <span class="reserved">this</span>.settings, p = <span class="literal">''</span>, i = 0, li = 0, o = <span class="literal">''</span>, l;
h = h.replace(/\r/g, <span class="literal">''</span>); <span class="comment">// Windows sux, isn't carriage return a thing of the past :)</span>
h = <span class="literal">'\n'</span> + h;
h = h.replace(new RegExp(<span class="literal">'\\n\\s+'</span>, <span class="literal">'gi'</span>), <span class="literal">'\n'</span>); <span class="comment">// Remove previous formatting</span>
h = h.replace(<span class="reserved">this</span>.nlBeforeRe, <span class="literal">'\n&lt;$1$2&gt;'</span>);
h = h.replace(<span class="reserved">this</span>.nlAfterRe, <span class="literal">'&lt;$1$2&gt;\n'</span>);
h = h.replace(<span class="reserved">this</span>.nlBeforeAfterRe, <span class="literal">'\n&lt;$1$2$3&gt;\n'</span>);
h += <span class="literal">'\n'</span>;
<span class="comment">//tinyMCE.debug(h);</span>
<span class="reserved">while</span> ((i = h.indexOf(<span class="literal">'\n'</span>, i + 1)) != -1) {
<span class="reserved">if</span> ((l = h.substring(li + 1, i)).length != 0) {
<span class="reserved">if</span> (<span class="reserved">this</span>.ouRe.test(l) &amp;&amp; p.length &gt;= s.indent_levels)
p = p.substring(s.indent_levels);
o += p + l + <span class="literal">'\n'</span>;
<span class="reserved">if</span> (<span class="reserved">this</span>.inRe.test(l))
p += <span class="reserved">this</span>.inStr;
}
li = i;
}
<span class="comment">//tinyMCE.debug(h);</span>
<span class="reserved">return</span> o;
},
<span class="comment">/**
* XML Encodes the specified string based on configured entity encoding. The entity encoding modes
* are raw, numeric and named. Where raw is the fastest and named is default.
*
* <span class="attrib">@param</span> {string} s String to convert to XML.
* <span class="attrib">@return</span> Encoded XML string based on configured entity encoding.
* <span class="attrib">@type</span> string
*/</span>
xmlEncode : <span class="reserved">function</span>(s) {
var i, l, e, o = <span class="literal">''</span>, c;
<span class="reserved">this</span>._setupEntities(); <span class="comment">// Will intialize lookup table</span>
switch (<span class="reserved">this</span>.settings.entity_encoding) {
case <span class="literal">"raw"</span>:
<span class="reserved">return</span> tinyMCE.xmlEncode(s);
case <span class="literal">"named"</span>:
<span class="reserved">for</span> (i=0, l=s.length; i&lt;l; i++) {
c = s.charCodeAt(i);
e = <span class="reserved">this</span>.entities[c];
<span class="reserved">if</span> (e &amp;&amp; e != <span class="literal">''</span>)
o += <span class="literal">'&amp;'</span> + e + <span class="literal">';'</span>;
<span class="reserved">else</span>
o += String.fromCharCode(c);
}
<span class="reserved">return</span> o;
case <span class="literal">"numeric"</span>:
<span class="reserved">for</span> (i=0, l=s.length; i&lt;l; i++) {
c = s.charCodeAt(i);
<span class="reserved">if</span> (c &gt; 127 || c == 60 || c == 62 || c == 38 || c == 39 || c == 34)
o += <span class="literal">'&amp;#'</span> + c + <span class="literal">";"</span>;
<span class="reserved">else</span>
o += String.fromCharCode(c);
}
<span class="reserved">return</span> o;
}
<span class="reserved">return</span> s;
},
<span class="comment">/**
* Splits the specified string and removed empty chunks.
*
* <span class="attrib">@param</span> {RegEx} re RegEx to split string by.
* <span class="attrib">@param</span> {string} s String value to split.
* <span class="attrib">@return</span> Array with parts from specified string.
* <span class="attrib">@type</span> string
*/</span>
split : <span class="reserved">function</span>(re, s) {
var c = s.split(re);
var i, l, o = new Array();
<span class="reserved">for</span> (i=0, l=c.length; i&lt;l; i++) {
<span class="reserved">if</span> (c[i] != <span class="literal">''</span>)
o[i] = c[i];
}
<span class="reserved">return</span> o;
},
<span class="comment">/**
* Removes contents that got added by TinyMCE to comments.
*
* <span class="attrib">@param</span> {string} s Comment string data to trim.
* <span class="attrib">@return</span> Cleaned string from TinyMCE specific content.
* <span class="attrib">@type</span> string
* <span class="attrib">@private</span>
*/</span>
_trimComment : <span class="reserved">function</span>(s) {
<span class="comment">// Remove mce_src, mce_href</span>
s = s.replace(new RegExp(<span class="literal">'\\smce_src=\"[^\"]*\"'</span>, <span class="literal">'gi'</span>), <span class="literal">""</span>);
s = s.replace(new RegExp(<span class="literal">'\\smce_href=\"[^\"]*\"'</span>, <span class="literal">'gi'</span>), <span class="literal">""</span>);
<span class="reserved">return</span> s;
},
<span class="comment">/**
* Returns the value of the specified attribute name or default value if it wasn't found.
*
* <span class="attrib">@param</span> {HTMLElement} e HTML element to get attribute from.
* <span class="attrib">@param</span> {string} n Attribute name to get from element.
* <span class="attrib">@param</span> {string} d Default value to return if attribute wasn't found.
* <span class="attrib">@return</span> Attribute value based on specified attribute name.
* <span class="attrib">@type</span> string
* <span class="attrib">@private</span>
*/</span>
_getAttrib : <span class="reserved">function</span>(e, n, d) {
<span class="reserved">if</span> (typeof(d) == <span class="literal">"undefined"</span>)
d = <span class="literal">""</span>;
<span class="reserved">if</span> (!e || e.nodeType != 1)
<span class="reserved">return</span> d;
var v = e.getAttribute(n, 0);
<span class="reserved">if</span> (n == <span class="literal">"class"</span> &amp;&amp; !v)
v = e.className;
<span class="reserved">if</span> (<span class="reserved">this</span>.isMSIE &amp;&amp; n == <span class="literal">"http-equiv"</span>)
v = e.httpEquiv;
<span class="reserved">if</span> (<span class="reserved">this</span>.isMSIE &amp;&amp; e.nodeName == <span class="literal">"FORM"</span> &amp;&amp; n == <span class="literal">"enctype"</span> &amp;&amp; v == <span class="literal">"application/x-www-form-urlencoded"</span>)
v = <span class="literal">""</span>;
<span class="reserved">if</span> (<span class="reserved">this</span>.isMSIE &amp;&amp; e.nodeName == <span class="literal">"INPUT"</span> &amp;&amp; n == <span class="literal">"size"</span> &amp;&amp; v == <span class="literal">"20"</span>)
v = <span class="literal">""</span>;
<span class="reserved">if</span> (<span class="reserved">this</span>.isMSIE &amp;&amp; e.nodeName == <span class="literal">"INPUT"</span> &amp;&amp; n == <span class="literal">"maxlength"</span> &amp;&amp; v == <span class="literal">"2147483647"</span>)
v = <span class="literal">""</span>;
<span class="reserved">if</span> (n == <span class="literal">"style"</span> &amp;&amp; !tinyMCE.isOpera)
v = e.style.cssText;
<span class="reserved">if</span> (n == <span class="literal">'style'</span>)
v = tinyMCE.serializeStyle(tinyMCE.parseStyle(v));
<span class="reserved">if</span> (<span class="reserved">this</span>.settings.on_save &amp;&amp; n.indexOf(<span class="literal">'on'</span>) != -1 &amp;&amp; <span class="reserved">this</span>.settings.on_save &amp;&amp; v &amp;&amp; v != <span class="literal">""</span>)
v = tinyMCE.cleanupEventStr(v);
<span class="reserved">return</span> (v &amp;&amp; v != <span class="literal">""</span>) ? <span class="literal">''</span> + v : d;
},
<span class="comment">/**
* Internal URL converter callback function. This simply converts URLs based
* on some settings.
*
* <span class="attrib">@param</span> {TinyMCE_Cleanup} c Cleanup instance.
* <span class="attrib">@param</span> {HTMLNode} n HTML node that holds the URL.
* <span class="attrib">@param</span> {string} v URL value to convert.
* <span class="attrib">@return</span> Converted URL value.
* <span class="attrib">@type</span> string
* <span class="attrib">@private</span>
*/</span>
_urlConverter : <span class="reserved">function</span>(c, n, v) {
<span class="reserved">if</span> (!c.settings.on_save)
<span class="reserved">return</span> tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, v);
<span class="reserved">else</span> <span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">'convert_urls'</span>))
<span class="reserved">return</span> eval(tinyMCE.settings.urlconverter_callback + <span class="literal">"(v, n, true);"</span>);
<span class="reserved">return</span> v;
},
<span class="comment">/**
* Converts a array into a regex.
*
* <span class="attrib">@param</span> {Array} a Array to convert into a regex.
* <span class="attrib">@param</span> {string} op RegEx options like, gi.
* <span class="attrib">@param</span> {string} be Before chunk, beginning of expression.
* <span class="attrib">@param</span> {string} af After chunk, end of expression.
* <span class="attrib">@return</span> RegEx instance based in input information.
* <span class="attrib">@type</span> string
* <span class="attrib">@private</span>
*/</span>
_arrayToRe : <span class="reserved">function</span>(a, op, be, af) {
var i, r;
op = typeof(op) == <span class="literal">"undefined"</span> ? <span class="literal">"gi"</span> : op;
be = typeof(be) == <span class="literal">"undefined"</span> ? <span class="literal">"^("</span> : be;
af = typeof(af) == <span class="literal">"undefined"</span> ? <span class="literal">")$"</span> : af;
r = be;
<span class="reserved">for</span> (i=0; i&lt;a.length; i++)
r += <span class="reserved">this</span>._wildcardToRe(a[i]) + (i != a.length-1 ? <span class="literal">"|"</span> : <span class="literal">""</span>);
r += af;
<span class="reserved">return</span> new RegExp(r, op);
},
<span class="comment">/**
* Converts a wildcard string into a regex.
*
* <span class="attrib">@param</span> {string} s Wildcard string to convert into RegEx.
* <span class="attrib">@return</span> RegEx string based on input.
* <span class="attrib">@type</span> string
* <span class="attrib">@private</span>
*/</span>
_wildcardToRe : <span class="reserved">function</span>(s) {
s = s.replace(/\?/g, <span class="literal">'(\\S?)'</span>);
s = s.replace(/\+/g, <span class="literal">'(\\S+)'</span>);
s = s.replace(/\*/g, <span class="literal">'(\\S*)'</span>);
<span class="reserved">return</span> s;
},
<span class="comment">/**
* Sets up the entity name lookup table ones. This moves the entity lookup pasing time
* from init to first xmlEncode call.
*
* <span class="attrib">@private</span>
*/</span>
_setupEntities : <span class="reserved">function</span>() {
var n, a, i, s = <span class="reserved">this</span>.settings;
<span class="comment">// Setup entities</span>
<span class="reserved">if</span> (!<span class="reserved">this</span>.entitiesDone) {
<span class="reserved">if</span> (s.entity_encoding == <span class="literal">"named"</span>) {
n = tinyMCE.clearArray(new Array());
a = <span class="reserved">this</span>.split(<span class="literal">','</span>, s.entities);
<span class="reserved">for</span> (i=0; i&lt;a.length; i+=2)
n[a[i]] = a[i+1];
<span class="reserved">this</span>.entities = n;
}
<span class="reserved">this</span>.entitiesDone = true;
}
},
<span class="comment">/**
* Sets up the cleanup rules ones. This moves the cleanup rule pasing time
* from init to first cleanup call.
*
* <span class="attrib">@private</span>
*/</span>
_setupRules : <span class="reserved">function</span>() {
var s = <span class="reserved">this</span>.settings;
<span class="comment">// Setup default rule</span>
<span class="reserved">if</span> (!<span class="reserved">this</span>.rulesDone) {
<span class="reserved">this</span>.addRuleStr(s.valid_elements);
<span class="reserved">this</span>.addRuleStr(s.extended_valid_elements);
<span class="reserved">this</span>.rulesDone = true;
}
},
<span class="comment">/**
* Checks if the specified node is a duplicate in other words has it been processed/serialized before.
*
* <span class="attrib">@param</span> {DOMNode} n DOM Node that is to be checked.
* <span class="attrib">@return</span> true/false if the node is a duplicate or not.
* <span class="attrib">@type</span> boolean
* <span class="attrib">@private</span>
*/</span>
_isDuplicate : <span class="reserved">function</span>(n) {
var i;
<span class="reserved">if</span> (!<span class="reserved">this</span>.settings.fix_content_duplication)
<span class="reserved">return</span> false;
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; !tinyMCE.isOpera &amp;&amp; n.nodeType == 1) {
<span class="comment">// Mark elements</span>
<span class="reserved">if</span> (n.mce_serialized == <span class="reserved">this</span>.serializationId)
<span class="reserved">return</span> true;
n.setAttribute(<span class="literal">'mce_serialized'</span>, <span class="reserved">this</span>.serializationId);
} <span class="reserved">else</span> {
<span class="comment">// Search lookup table for text nodes and comments</span>
<span class="reserved">for</span> (i=0; i&lt;<span class="reserved">this</span>.serializedNodes.length; i++) {
<span class="reserved">if</span> (<span class="reserved">this</span>.serializedNodes[i] == n)
<span class="reserved">return</span> true;
}
<span class="reserved">this</span>.serializedNodes[<span class="reserved">this</span>.serializedNodes.length] = n;
}
<span class="reserved">return</span> false;
}
};
</pre>
<hr>
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> &nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a> &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<font size="-1">
</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Fri Apr 14 21:59:23 2006</div>
</body>
</html>
<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
parent.document.title="TinyMCE_Control.class.js Overview";
}
</script>
</head>
<body bgcolor="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> &nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a> &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<center>
<h2>TinyMCE_Control.class.js</h2>
</center>
<h4>Summary</h4>
<p>
No overview generated for 'TinyMCE_Control.class.js'<BR/><BR/>
</p>
<hr>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
<td colspan=2><font size="+2">
<b>Class Summary</b>
</font></td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td width="15%"><b><a href="TinyMCE_Control.html">TinyMCE_Control</a></b></td>
<td>&nbsp;</td>
</tr>
</table>
<hr/>
<!-- ========== METHOD SUMMARY =========== -->
<!-- ========== END METHOD SUMMARY =========== -->
<pre class="sourceview"><span class="comment">/**
* $RCSfile: overview-summary-TinyMCE_Control.class.js.html,v $
* $Revision: 1.42 $
* $Date: 2006/04/14 20:00:28 $
*
* <span class="attrib">@author</span> Moxiecode
* <span class="attrib">@copyright</span> Copyright 2004-2006, Moxiecode Systems AB, All rights reserved.
*/</span>
<span class="comment">/**
* This is the TinyMCE editor control instance class. A instance of this class will is made for each
* converted text area.
*
* <span class="attrib">@constructor</span>
* <span class="attrib">@param</span> {Array} settings Name/Value array of instance specific configuration settings.
*/</span>
<span class="reserved">function</span> TinyMCE_Control(settings) {
var t, i, to, fu, p, x, fn, fu, pn, s = settings;
<span class="reserved">this</span>.undoRedoLevel = true;
<span class="reserved">this</span>.isTinyMCE_Control = true;
<span class="comment">// Default settings</span>
<span class="reserved">this</span>.settings = s;
<span class="reserved">this</span>.settings[<span class="literal">'theme'</span>] = tinyMCE.getParam(<span class="literal">"theme"</span>, <span class="literal">"default"</span>);
<span class="reserved">this</span>.settings[<span class="literal">'width'</span>] = tinyMCE.getParam(<span class="literal">"width"</span>, -1);
<span class="reserved">this</span>.settings[<span class="literal">'height'</span>] = tinyMCE.getParam(<span class="literal">"height"</span>, -1);
<span class="reserved">this</span>.selection = new TinyMCE_Selection(<span class="reserved">this</span>);
<span class="reserved">this</span>.undoRedo = new TinyMCE_UndoRedo(<span class="reserved">this</span>);
<span class="reserved">this</span>.cleanup = new TinyMCE_Cleanup();
<span class="reserved">this</span>.shortcuts = new Array();
<span class="reserved">this</span>.hasMouseMoved = false;
<span class="reserved">this</span>.cleanup.init({
valid_elements : s.valid_elements,
extended_valid_elements : s.extended_valid_elements,
entities : s.entities,
entity_encoding : s.entity_encoding,
debug : s.cleanup_debug,
url_converter : <span class="literal">'TinyMCE_Cleanup.prototype._urlConverter'</span>,
indent : s.apply_source_formatting,
invalid_elements : s.invalid_elements,
verify_html : s.verify_html,
fix_content_duplication : s.fix_content_duplication
});
<span class="comment">// Wrap old theme</span>
t = <span class="reserved">this</span>.settings[<span class="literal">'theme'</span>];
<span class="reserved">if</span> (!tinyMCE.hasTheme(t)) {
fn = tinyMCE.callbacks;
to = {};
<span class="reserved">for</span> (i=0; i&lt;fn.length; i++) {
<span class="reserved">if</span> ((fu = window[<span class="literal">'TinyMCE_'</span> + t + <span class="literal">"_"</span> + fn[i]]))
to[fn[i]] = fu;
}
tinyMCE.addTheme(t, to);
}
<span class="comment">// Wrap old plugins</span>
<span class="reserved">this</span>.plugins = new Array();
p = tinyMCE.getParam(<span class="literal">'plugins'</span>, <span class="literal">''</span>, true, <span class="literal">','</span>);
<span class="reserved">if</span> (p.length &gt; 0) {
<span class="reserved">for</span> (i=0; i&lt;p.length; i++) {
pn = p[i];
<span class="reserved">if</span> (pn.charAt(0) == <span class="literal">'-'</span>)
pn = pn.substring(1);
<span class="reserved">if</span> (!tinyMCE.hasPlugin(pn)) {
fn = tinyMCE.callbacks;
to = {};
<span class="reserved">for</span> (x=0; x&lt;fn.length; x++) {
<span class="reserved">if</span> ((fu = window[<span class="literal">'TinyMCE_'</span> + pn + <span class="literal">"_"</span> + fn[x]]))
to[fn[x]] = fu;
}
tinyMCE.addPlugin(pn, to);
}
<span class="reserved">this</span>.plugins[<span class="reserved">this</span>.plugins.length] = pn;
}
}
};
TinyMCE_Control.<span class="reserved">prototype</span> = {
<span class="comment">/**
* Returns true/false if the instance has the current plugin available.
*
* <span class="attrib">@param</span> {string} n Plugin name to check for.
* <span class="attrib">@return</span> true/false if the instance has the current plugin available.
* <span class="attrib">@type</span> boolean
*/</span>
hasPlugin : <span class="reserved">function</span>(n) {
var i;
<span class="reserved">for</span> (i=0; i&lt;<span class="reserved">this</span>.plugins.length; i++) {
<span class="reserved">if</span> (<span class="reserved">this</span>.plugins[i] == n)
<span class="reserved">return</span> true;
}
<span class="reserved">return</span> false;
},
<span class="comment">/**
* Adds a plugin to the editor instance. This will also add it globaly.
*
* <span class="attrib">@param</span> {string} n Plugin name to check for.
* <span class="attrib">@param</span> {TinyMCE_Plugin} n TinyMCE plugin instance.
*/</span>
addPlugin : <span class="reserved">function</span>(n, p) {
<span class="reserved">if</span> (!<span class="reserved">this</span>.hasPlugin(n)) {
tinyMCE.addPlugin(n, p);
<span class="reserved">this</span>.plugins[<span class="reserved">this</span>.plugins.length] = n;
}
},
<span class="comment">/**
* Repaints the editarea in Gecko browsers. This method removes ghost resize handlers
* and other trailing graphics.
*/</span>
repaint : <span class="reserved">function</span>() {
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; !tinyMCE.isOpera)
<span class="reserved">return</span>;
try {
var s = <span class="reserved">this</span>.selection;
var b = s.getBookmark(true);
<span class="reserved">this</span>.getBody().style.display = <span class="literal">'none'</span>;
<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">'selectall'</span>, false, null);
<span class="reserved">this</span>.getSel().collapseToStart();
<span class="reserved">this</span>.getBody().style.display = <span class="literal">'block'</span>;
s.moveToBookmark(b);
} catch (ex) {
<span class="comment">// Ignore</span>
}
},
<span class="comment">/**
* Switches the global TinyMCE settings to the current instance settings. This method is
* used to handle multiple configurations.
*/</span>
switchSettings : <span class="reserved">function</span>() {
<span class="reserved">if</span> (tinyMCE.configs.length &gt; 1 &amp;&amp; tinyMCE.currentConfig != <span class="reserved">this</span>.settings[<span class="literal">'index'</span>]) {
tinyMCE.settings = <span class="reserved">this</span>.settings;
tinyMCE.currentConfig = <span class="reserved">this</span>.settings[<span class="literal">'index'</span>];
}
},
<span class="comment">/**
* Returns the body element of a editor instance.
*
* <span class="attrib">@return</span> Body element of a editor instance.
* <span class="attrib">@type</span> HTMLElement
*/</span>
getBody : <span class="reserved">function</span>() {
<span class="reserved">return</span> <span class="reserved">this</span>.getDoc().body;
},
<span class="comment">/**
* Returns the DOM document of a editor instance.
*
* <span class="attrib">@return</span> DOM document of a editor instance.
* <span class="attrib">@type</span> DOMDocument
*/</span>
getDoc : <span class="reserved">function</span>() {
<span class="reserved">return</span> <span class="reserved">this</span>.contentWindow.document;
},
<span class="comment">/**
* Returns the window of a editor instance.
*
* <span class="attrib">@return</span> Window of a editor instance.
* <span class="attrib">@type</span> Window
*/</span>
getWin : <span class="reserved">function</span>() {
<span class="reserved">return</span> <span class="reserved">this</span>.contentWindow;
},
<span class="comment">/**
* Adds a keyboard shortcut to a specific command. These shortcuts can for example be added
* at the initInstance callback of a plugin. The shortcut description can be a language variable name
* or a string describing the function. If you don't specify a command, the shortcut will simply be a blocker
* shortcut. This enables you to remove built in shortcuts or remove theme specific shortcuts from a plugin.&lt;br /&gt;
* Example shortcut inst.addShortcut('ctrl,alt', 'k', 'mceSomeCommand', false, 'somevalue');
* Example blocker inst.addShortcut('ctrl,alt', 'k');
*
* <span class="attrib">@param</span> {string} m List of shortcut modifiers keys, for example "ctrl,alt".
* <span class="attrib">@param</span> {Object} k Shortcut key char for example "s" or a keycode value "13".
* <span class="attrib">@param</span> {string} d Optional Shortcut description, this will be presented in the about dialog.
* <span class="attrib">@param</span> {string} cmd Optional Command name to execute, for example mceLink or Bold.
* <span class="attrib">@param</span> {boolean} ui Optional True/false state if a UI (dialog) should be presented or not.
* <span class="attrib">@param</span> {Object} va Optional command value, this can be anything.
* <span class="attrib">@return</span> true/false if the shortcut was added or not
* <span class="attrib">@type</span> boolean
*/</span>
addShortcut : <span class="reserved">function</span>(m, k, d, cmd, ui, va) {
var n = typeof(k) == <span class="literal">"number"</span>, ie = tinyMCE.isMSIE, c, sc, i;
var scl = <span class="reserved">this</span>.shortcuts;
<span class="reserved">if</span> (!tinyMCE.getParam(<span class="literal">'custom_shortcuts'</span>))
<span class="reserved">return</span> false;
m = m.toLowerCase();
k = ie &amp;&amp; !n ? k.toUpperCase() : k;
c = n ? null : k.charCodeAt(0);
d = d &amp;&amp; d.indexOf(<span class="literal">'lang_'</span>) == 0 ? tinyMCE.getLang(d) : d;
sc = {
alt : m.indexOf(<span class="literal">'alt'</span>) != -1,
ctrl : m.indexOf(<span class="literal">'ctrl'</span>) != -1,
shift : m.indexOf(<span class="literal">'shift'</span>) != -1,
charCode : c,
keyCode : n ? k : (ie ? c : null),
desc : d,
cmd : cmd,
ui : ui,
val : va
};
<span class="reserved">for</span> (i=0; i&lt;scl.length; i++) {
<span class="reserved">if</span> (sc.alt == scl[i].alt &amp;&amp; sc.ctrl == scl[i].ctrl &amp;&amp; sc.shift == scl[i].shift
&amp;&amp; sc.charCode == scl[i].charCode &amp;&amp; sc.keyCode == scl[i].keyCode) {
<span class="reserved">return</span> false;
}
}
scl[scl.length] = sc;
<span class="reserved">return</span> true;
},
<span class="comment">/**
* Executes shortcuts based on the event information.
*
* <span class="attrib">@param</span> {DOMEvent} e Keyboard event to handle.
* <span class="attrib">@return</span> true/false if the shortcut was found and executed or not.
* <span class="attrib">@type</span> boolean
*/</span>
handleShortcut : <span class="reserved">function</span>(e) {
var i, s = <span class="reserved">this</span>.shortcuts, o;
<span class="reserved">for</span> (i=0; i&lt;s.length; i++) {
o = s[i];
<span class="reserved">if</span> (o.alt == e.altKey &amp;&amp; o.ctrl == e.ctrlKey &amp;&amp; (o.keyCode == e.keyCode || o.charCode == e.charCode)) {
<span class="reserved">if</span> (o.cmd &amp;&amp; (e.type == <span class="literal">"keydown"</span> || (e.type == <span class="literal">"keypress"</span> &amp;&amp; !tinyMCE.isOpera)))
tinyMCE.execCommand(o.cmd, o.ui, o.val);
tinyMCE.cancelEvent(e);
<span class="reserved">return</span> true;
}
}
<span class="reserved">return</span> false;
},
<span class="comment">/**
* Auto resets the design mode of the document if it gets lost.
* This is a Gecko specific function since it's a workaround for a bug where Gecko browsers
* loose the designMode state if the editor is hidden and shown in a tab or div.
*/</span>
autoResetDesignMode : <span class="reserved">function</span>() {
<span class="comment">// Add fix for tab/style.display none/block problems in Gecko</span>
<span class="reserved">if</span> (!tinyMCE.isMSIE &amp;&amp; <span class="reserved">this</span>.isHidden() &amp;&amp; tinyMCE.getParam(<span class="literal">'auto_reset_designmode'</span>))
eval(<span class="literal">'try { this.getDoc().designMode = "On"; } catch(e) {}'</span>);
},
<span class="comment">/**
* Returns if the instance is hidden or not. This is a Gecko specific function
* other browsers will always return false. This function is used to workaround the lost
* designMode bug in Gecko browsers.
*
* <span class="attrib">@return</span> Returns if the instance is hidden or not.
* <span class="attrib">@type</span> boolean
*/</span>
isHidden : <span class="reserved">function</span>() {
<span class="reserved">if</span> (tinyMCE.isMSIE)
<span class="reserved">return</span> false;
var s = <span class="reserved">this</span>.getSel();
<span class="comment">// Weird, wheres that cursor selection?</span>
<span class="reserved">return</span> (!s || !s.rangeCount || s.rangeCount == 0);
},
<span class="comment">/**
* Returns true/false if the editor instance is dirty or not. In other words if it has been modified
* or not.
*
* <span class="attrib">@return</span> Editor instance dirty state.
* <span class="attrib">@type</span> boolean
*/</span>
isDirty : <span class="reserved">function</span>() {
<span class="comment">// Is content modified and not in a submit procedure</span>
<span class="reserved">return</span> <span class="reserved">this</span>.startContent != tinyMCE.trim(<span class="reserved">this</span>.getBody().innerHTML) &amp;&amp; !tinyMCE.isNotDirty;
},
<span class="comment">/**
* ..
*
* <span class="attrib">@private</span>
*/</span>
_mergeElements : <span class="reserved">function</span>(scmd, pa, ch, override) {
<span class="reserved">if</span> (scmd == <span class="literal">"removeformat"</span>) {
pa.className = <span class="literal">""</span>;
pa.style.cssText = <span class="literal">""</span>;
ch.className = <span class="literal">""</span>;
ch.style.cssText = <span class="literal">""</span>;
<span class="reserved">return</span>;
}
var st = tinyMCE.parseStyle(tinyMCE.getAttrib(pa, <span class="literal">"style"</span>));
var stc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, <span class="literal">"style"</span>));
var className = tinyMCE.getAttrib(pa, <span class="literal">"class"</span>);
className += <span class="literal">" "</span> + tinyMCE.getAttrib(ch, <span class="literal">"class"</span>);
<span class="reserved">if</span> (override) {
<span class="reserved">for</span> (var n in st) {
<span class="reserved">if</span> (typeof(st[n]) == <span class="literal">'function'</span>)
continue;
stc[n] = st[n];
}
} <span class="reserved">else</span> {
<span class="reserved">for</span> (var n in stc) {
<span class="reserved">if</span> (typeof(stc[n]) == <span class="literal">'function'</span>)
continue;
st[n] = stc[n];
}
}
tinyMCE.setAttrib(pa, <span class="literal">"style"</span>, tinyMCE.serializeStyle(st));
tinyMCE.setAttrib(pa, <span class="literal">"class"</span>, tinyMCE.trim(className));
ch.className = <span class="literal">""</span>;
ch.style.cssText = <span class="literal">""</span>;
ch.removeAttribute(<span class="literal">"class"</span>);
ch.removeAttribute(<span class="literal">"style"</span>);
},
<span class="comment">/**
* Sets the useCSS mode in Gecko browsers. This will also remove the build in
* inline table editing controls since they are buggy when it comes to col/rowspans.
*
* <span class="attrib">@param</span> {boolean} b UseCSS state true/false.
* <span class="attrib">@private</span>
*/</span>
_setUseCSS : <span class="reserved">function</span>(b) {
var d = <span class="reserved">this</span>.getDoc();
try {d.execCommand(<span class="literal">"useCSS"</span>, false, !b);} catch (ex) {}
try {d.execCommand(<span class="literal">"styleWithCSS"</span>, false, b);} catch (ex) {}
<span class="reserved">if</span> (!tinyMCE.getParam(<span class="literal">"table_inline_editing"</span>))
try {d.execCommand(<span class="literal">'enableInlineTableEditing'</span>, false, <span class="literal">"false"</span>);} catch (ex) {}
<span class="reserved">if</span> (!tinyMCE.getParam(<span class="literal">"object_resizing"</span>))
try {d.execCommand(<span class="literal">'enableObjectResizing'</span>, false, <span class="literal">"false"</span>);} catch (ex) {}
},
<span class="comment">/**
* Executes a command on the current instance. These commands can be TinyMCE internal commands prefixed with "mce" or
* they can be build in browser commands such as "Bold". A compleate list of browser commands is available on MSDN or Mozilla.org.
* This function will dispatch the execCommand function on each plugin, theme or the execcommand_callback option if none of these
* return true it will handle the command as a internal browser command.
*
* <span class="attrib">@param</span> {string} command Command name to execute, for example mceLink or Bold.
* <span class="attrib">@param</span> {boolean} user_interface True/false state if a UI (dialog) should be presented or not.
* <span class="attrib">@param</span> {mixed} value Optional command value, this can be anything.
*/</span>
execCommand : <span class="reserved">function</span>(command, user_interface, value) {
var doc = <span class="reserved">this</span>.getDoc();
var win = <span class="reserved">this</span>.getWin();
var focusElm = <span class="reserved">this</span>.getFocusElement();
<span class="comment">// Is non udno specific command</span>
<span class="reserved">if</span> (!new RegExp(<span class="literal">'mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel'</span>, <span class="literal">'gi'</span>).test(command))
<span class="reserved">this</span>.undoBookmark = null;
<span class="reserved">if</span> (<span class="reserved">this</span>.lastSafariSelection &amp;&amp; !new RegExp(<span class="literal">'mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel'</span>, <span class="literal">'gi'</span>).test(command)) {
<span class="reserved">this</span>.selection.moveToBookmark(<span class="reserved">this</span>.lastSafariSelection);
tinyMCE.selectedElement = <span class="reserved">this</span>.lastSafariSelectedElement;
}
<span class="comment">// Mozilla issue</span>
<span class="reserved">if</span> (!tinyMCE.isMSIE &amp;&amp; !<span class="reserved">this</span>.useCSS) {
<span class="reserved">this</span>._setUseCSS(false);
<span class="reserved">this</span>.useCSS = true;
}
<span class="comment">//debug("command: " + command + ", user_interface: " + user_interface + ", value: " + value);</span>
<span class="reserved">this</span>.contentDocument = doc; <span class="comment">// &lt;-- Strange, unless this is applied Mozilla 1.3 breaks</span>
<span class="reserved">if</span> (tinyMCE.execCommandCallback(<span class="reserved">this</span>, <span class="literal">'execcommand_callback'</span>, <span class="literal">'execCommand'</span>, <span class="reserved">this</span>.editorId, <span class="reserved">this</span>.getBody(), command, user_interface, value))
<span class="reserved">return</span>;
<span class="comment">// Fix align on images</span>
<span class="reserved">if</span> (focusElm &amp;&amp; focusElm.nodeName == <span class="literal">"IMG"</span>) {
var align = focusElm.getAttribute(<span class="literal">'align'</span>);
var img = command == <span class="literal">"JustifyCenter"</span> ? focusElm.cloneNode(false) : focusElm;
switch (command) {
case <span class="literal">"JustifyLeft"</span>:
<span class="reserved">if</span> (align == <span class="literal">'left'</span>)
img.removeAttribute(<span class="literal">'align'</span>);
<span class="reserved">else</span>
img.setAttribute(<span class="literal">'align'</span>, <span class="literal">'left'</span>);
<span class="comment">// Remove the div</span>
var div = focusElm.parentNode;
<span class="reserved">if</span> (div &amp;&amp; div.nodeName == <span class="literal">"DIV"</span> &amp;&amp; div.childNodes.length == 1 &amp;&amp; div.parentNode)
div.parentNode.replaceChild(img, div);
<span class="reserved">this</span>.selection.selectNode(img);
<span class="reserved">this</span>.repaint();
tinyMCE.triggerNodeChange();
<span class="reserved">return</span>;
case <span class="literal">"JustifyCenter"</span>:
img.removeAttribute(<span class="literal">'align'</span>);
<span class="comment">// Is centered</span>
var div = tinyMCE.getParentElement(focusElm, <span class="literal">"div"</span>);
<span class="reserved">if</span> (div &amp;&amp; div.style.textAlign == <span class="literal">"center"</span>) {
<span class="comment">// Remove div</span>
<span class="reserved">if</span> (div.nodeName == <span class="literal">"DIV"</span> &amp;&amp; div.childNodes.length == 1 &amp;&amp; div.parentNode)
div.parentNode.replaceChild(img, div);
} <span class="reserved">else</span> {
<span class="comment">// Add div</span>
var div = <span class="reserved">this</span>.getDoc().createElement(<span class="literal">"div"</span>);
div.style.textAlign = <span class="literal">'center'</span>;
div.appendChild(img);
focusElm.parentNode.replaceChild(div, focusElm);
}
<span class="reserved">this</span>.selection.selectNode(img);
<span class="reserved">this</span>.repaint();
tinyMCE.triggerNodeChange();
<span class="reserved">return</span>;
case <span class="literal">"JustifyRight"</span>:
<span class="reserved">if</span> (align == <span class="literal">'right'</span>)
img.removeAttribute(<span class="literal">'align'</span>);
<span class="reserved">else</span>
img.setAttribute(<span class="literal">'align'</span>, <span class="literal">'right'</span>);
<span class="comment">// Remove the div</span>
var div = focusElm.parentNode;
<span class="reserved">if</span> (div &amp;&amp; div.nodeName == <span class="literal">"DIV"</span> &amp;&amp; div.childNodes.length == 1 &amp;&amp; div.parentNode)
div.parentNode.replaceChild(img, div);
<span class="reserved">this</span>.selection.selectNode(img);
<span class="reserved">this</span>.repaint();
tinyMCE.triggerNodeChange();
<span class="reserved">return</span>;
}
}
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'force_br_newlines'</span>]) {
var alignValue = <span class="literal">""</span>;
<span class="reserved">if</span> (doc.selection.type != <span class="literal">"Control"</span>) {
switch (command) {
case <span class="literal">"JustifyLeft"</span>:
alignValue = <span class="literal">"left"</span>;
break;
case <span class="literal">"JustifyCenter"</span>:
alignValue = <span class="literal">"center"</span>;
break;
case <span class="literal">"JustifyFull"</span>:
alignValue = <span class="literal">"justify"</span>;
break;
case <span class="literal">"JustifyRight"</span>:
alignValue = <span class="literal">"right"</span>;
break;
}
<span class="reserved">if</span> (alignValue != <span class="literal">""</span>) {
var rng = doc.selection.createRange();
<span class="reserved">if</span> ((divElm = tinyMCE.getParentElement(rng.parentElement(), <span class="literal">"div"</span>)) != null)
divElm.setAttribute(<span class="literal">"align"</span>, alignValue);
<span class="reserved">else</span> <span class="reserved">if</span> (rng.pasteHTML &amp;&amp; rng.htmlText.length &gt; 0)
rng.pasteHTML(<span class="literal">'&lt;div align="'</span> + alignValue + <span class="literal">'"&gt;'</span> + rng.htmlText + <span class="literal">"&lt;/div&gt;"</span>);
tinyMCE.triggerNodeChange();
<span class="reserved">return</span>;
}
}
}
switch (command) {
case <span class="literal">"mceRepaint"</span>:
<span class="reserved">this</span>.repaint();
<span class="reserved">return</span> true;
case <span class="literal">"InsertUnorderedList"</span>:
case <span class="literal">"InsertOrderedList"</span>:
var tag = (command == <span class="literal">"InsertUnorderedList"</span>) ? <span class="literal">"ul"</span> : <span class="literal">"ol"</span>;
<span class="reserved">if</span> (tinyMCE.isSafari)
<span class="reserved">this</span>.execCommand(<span class="literal">"mceInsertContent"</span>, false, <span class="literal">"&lt;"</span> + tag + <span class="literal">"&gt;&lt;li&gt;&amp;nbsp;&lt;/li&gt;&lt;"</span> + tag + <span class="literal">"&gt;"</span>);
<span class="reserved">else</span>
<span class="reserved">this</span>.getDoc().execCommand(command, user_interface, value);
tinyMCE.triggerNodeChange();
break;
case <span class="literal">"Strikethrough"</span>:
<span class="reserved">if</span> (tinyMCE.isSafari)
<span class="reserved">this</span>.execCommand(<span class="literal">"mceInsertContent"</span>, false, <span class="literal">"&lt;strike&gt;"</span> + <span class="reserved">this</span>.selection.getSelectedHTML() + <span class="literal">"&lt;/strike&gt;"</span>);
<span class="reserved">else</span>
<span class="reserved">this</span>.getDoc().execCommand(command, user_interface, value);
tinyMCE.triggerNodeChange();
break;
case <span class="literal">"mceSelectNode"</span>:
<span class="reserved">this</span>.selection.selectNode(value);
tinyMCE.triggerNodeChange();
tinyMCE.selectedNode = value;
break;
case <span class="literal">"FormatBlock"</span>:
<span class="reserved">if</span> (value == null || value == <span class="literal">""</span>) {
var elm = tinyMCE.getParentElement(<span class="reserved">this</span>.getFocusElement(), <span class="literal">"p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp"</span>);
<span class="reserved">if</span> (elm)
<span class="reserved">this</span>.execCommand(<span class="literal">"mceRemoveNode"</span>, false, elm);
} <span class="reserved">else</span> {
<span class="reserved">if</span> (tinyMCE.isGecko &amp;&amp; new RegExp(<span class="literal">'&lt;(div|blockquote|code|dt|dd|dl|samp)&gt;'</span>, <span class="literal">'gi'</span>).test(value))
value = value.replace(/[^a-z]/gi, <span class="literal">''</span>);
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; new RegExp(<span class="literal">'blockquote|code|samp'</span>, <span class="literal">'gi'</span>).test(value)) {
var b = <span class="reserved">this</span>.selection.getBookmark();
<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">"FormatBlock"</span>, false, <span class="literal">'&lt;p&gt;'</span>);
tinyMCE.renameElement(tinyMCE.getParentBlockElement(<span class="reserved">this</span>.getFocusElement()), value);
<span class="reserved">this</span>.selection.moveToBookmark(b);
} <span class="reserved">else</span>
<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">"FormatBlock"</span>, false, value);
}
tinyMCE.triggerNodeChange();
break;
case <span class="literal">"mceRemoveNode"</span>:
<span class="reserved">if</span> (!value)
value = tinyMCE.getParentElement(<span class="reserved">this</span>.getFocusElement());
<span class="reserved">if</span> (tinyMCE.isMSIE) {
value.outerHTML = value.innerHTML;
} <span class="reserved">else</span> {
var rng = value.ownerDocument.createRange();
rng.setStartBefore(value);
rng.setEndAfter(value);
rng.deleteContents();
rng.insertNode(rng.createContextualFragment(value.innerHTML));
}
tinyMCE.triggerNodeChange();
break;
case <span class="literal">"mceSelectNodeDepth"</span>:
var parentNode = <span class="reserved">this</span>.getFocusElement();
<span class="reserved">for</span> (var i=0; parentNode; i++) {
<span class="reserved">if</span> (parentNode.nodeName.toLowerCase() == <span class="literal">"body"</span>)
break;
<span class="reserved">if</span> (parentNode.nodeName.toLowerCase() == <span class="literal">"#text"</span>) {
i--;
parentNode = parentNode.parentNode;
continue;
}
<span class="reserved">if</span> (i == value) {
<span class="reserved">this</span>.selection.selectNode(parentNode, false);
tinyMCE.triggerNodeChange();
tinyMCE.selectedNode = parentNode;
<span class="reserved">return</span>;
}
parentNode = parentNode.parentNode;
}
break;
case <span class="literal">"SetStyleInfo"</span>:
var rng = <span class="reserved">this</span>.getRng();
var sel = <span class="reserved">this</span>.getSel();
var scmd = value[<span class="literal">'command'</span>];
var sname = value[<span class="literal">'name'</span>];
var svalue = value[<span class="literal">'value'</span>] == null ? <span class="literal">''</span> : value[<span class="literal">'value'</span>];
<span class="comment">//var svalue = value['value'] == null ? '' : value['value'];</span>
var wrapper = value[<span class="literal">'wrapper'</span>] ? value[<span class="literal">'wrapper'</span>] : <span class="literal">"span"</span>;
var parentElm = null;
var invalidRe = new RegExp(<span class="literal">"^BODY|HTML$"</span>, <span class="literal">"g"</span>);
var invalidParentsRe = tinyMCE.settings[<span class="literal">'merge_styles_invalid_parents'</span>] != <span class="literal">''</span> ? new RegExp(tinyMCE.settings[<span class="literal">'merge_styles_invalid_parents'</span>], <span class="literal">"gi"</span>) : null;
<span class="comment">// Whole element selected check</span>
<span class="reserved">if</span> (tinyMCE.isMSIE) {
<span class="comment">// Control range</span>
<span class="reserved">if</span> (rng.item)
parentElm = rng.item(0);
<span class="reserved">else</span> {
var pelm = rng.parentElement();
var prng = doc.selection.createRange();
prng.moveToElementText(pelm);
<span class="reserved">if</span> (rng.htmlText == prng.htmlText || rng.boundingWidth == 0) {
<span class="reserved">if</span> (invalidParentsRe == null || !invalidParentsRe.test(pelm.nodeName))
parentElm = pelm;
}
}
} <span class="reserved">else</span> {
var felm = <span class="reserved">this</span>.getFocusElement();
<span class="reserved">if</span> (sel.isCollapsed || (new RegExp(<span class="literal">'td|tr|tbody|table'</span>, <span class="literal">'gi'</span>).test(felm.nodeName) &amp;&amp; sel.anchorNode == felm.parentNode))
parentElm = felm;
}
<span class="comment">// Whole element selected</span>
<span class="reserved">if</span> (parentElm &amp;&amp; !invalidRe.test(parentElm.nodeName)) {
<span class="reserved">if</span> (scmd == <span class="literal">"setstyle"</span>)
tinyMCE.setStyleAttrib(parentElm, sname, svalue);
<span class="reserved">if</span> (scmd == <span class="literal">"setattrib"</span>)
tinyMCE.setAttrib(parentElm, sname, svalue);
<span class="reserved">if</span> (scmd == <span class="literal">"removeformat"</span>) {
parentElm.style.cssText = <span class="literal">''</span>;
tinyMCE.setAttrib(parentElm, <span class="literal">'class'</span>, <span class="literal">''</span>);
}
<span class="comment">// Remove style/attribs from all children</span>
var ch = tinyMCE.getNodeTree(parentElm, new Array(), 1);
<span class="reserved">for</span> (var z=0; z&lt;ch.length; z++) {
<span class="reserved">if</span> (ch[z] == parentElm)
continue;
<span class="reserved">if</span> (scmd == <span class="literal">"setstyle"</span>)
tinyMCE.setStyleAttrib(ch[z], sname, <span class="literal">''</span>);
<span class="reserved">if</span> (scmd == <span class="literal">"setattrib"</span>)
tinyMCE.setAttrib(ch[z], sname, <span class="literal">''</span>);
<span class="reserved">if</span> (scmd == <span class="literal">"removeformat"</span>) {
ch[z].style.cssText = <span class="literal">''</span>;
tinyMCE.setAttrib(ch[z], <span class="literal">'class'</span>, <span class="literal">''</span>);
}
}
} <span class="reserved">else</span> {
<span class="reserved">this</span>._setUseCSS(false); <span class="comment">// Bug in FF when running in fullscreen</span>
doc.execCommand(<span class="literal">"FontName"</span>, false, <span class="literal">"#mce_temp_font#"</span>);
var elementArray = tinyMCE.getElementsByAttributeValue(<span class="reserved">this</span>.getBody(), <span class="literal">"font"</span>, <span class="literal">"face"</span>, <span class="literal">"#mce_temp_font#"</span>);
<span class="comment">// Change them all</span>
<span class="reserved">for</span> (var x=0; x&lt;elementArray.length; x++) {
elm = elementArray[x];
<span class="reserved">if</span> (elm) {
var spanElm = doc.createElement(wrapper);
<span class="reserved">if</span> (scmd == <span class="literal">"setstyle"</span>)
tinyMCE.setStyleAttrib(spanElm, sname, svalue);
<span class="reserved">if</span> (scmd == <span class="literal">"setattrib"</span>)
tinyMCE.setAttrib(spanElm, sname, svalue);
<span class="reserved">if</span> (scmd == <span class="literal">"removeformat"</span>) {
spanElm.style.cssText = <span class="literal">''</span>;
tinyMCE.setAttrib(spanElm, <span class="literal">'class'</span>, <span class="literal">''</span>);
}
<span class="reserved">if</span> (elm.hasChildNodes()) {
<span class="reserved">for</span> (var i=0; i&lt;elm.childNodes.length; i++)
spanElm.appendChild(elm.childNodes[i].cloneNode(true));
}
spanElm.setAttribute(<span class="literal">"mce_new"</span>, <span class="literal">"true"</span>);
elm.parentNode.replaceChild(spanElm, elm);
<span class="comment">// Remove style/attribs from all children</span>
var ch = tinyMCE.getNodeTree(spanElm, new Array(), 1);
<span class="reserved">for</span> (var z=0; z&lt;ch.length; z++) {
<span class="reserved">if</span> (ch[z] == spanElm)
continue;
<span class="reserved">if</span> (scmd == <span class="literal">"setstyle"</span>)
tinyMCE.setStyleAttrib(ch[z], sname, <span class="literal">''</span>);
<span class="reserved">if</span> (scmd == <span class="literal">"setattrib"</span>)
tinyMCE.setAttrib(ch[z], sname, <span class="literal">''</span>);
<span class="reserved">if</span> (scmd == <span class="literal">"removeformat"</span>) {
ch[z].style.cssText = <span class="literal">''</span>;
tinyMCE.setAttrib(ch[z], <span class="literal">'class'</span>, <span class="literal">''</span>);
}
}
}
}
}
<span class="comment">// Cleaup wrappers</span>
var nodes = doc.getElementsByTagName(wrapper);
<span class="reserved">for</span> (var i=nodes.length-1; i&gt;=0; i--) {
var elm = nodes[i];
var isNew = tinyMCE.getAttrib(elm, <span class="literal">"mce_new"</span>) == <span class="literal">"true"</span>;
elm.removeAttribute(<span class="literal">"mce_new"</span>);
<span class="comment">// Is only child a element</span>
<span class="reserved">if</span> (elm.childNodes &amp;&amp; elm.childNodes.length == 1 &amp;&amp; elm.childNodes[0].nodeType == 1) {
<span class="comment">//tinyMCE.debug("merge1" + isNew);</span>
<span class="reserved">this</span>._mergeElements(scmd, elm, elm.childNodes[0], isNew);
continue;
}
<span class="comment">// Is I the only child</span>
<span class="reserved">if</span> (elm.parentNode.childNodes.length == 1 &amp;&amp; !invalidRe.test(elm.nodeName) &amp;&amp; !invalidRe.test(elm.parentNode.nodeName)) {
<span class="comment">//tinyMCE.debug("merge2" + isNew + "," + elm.nodeName + "," + elm.parentNode.nodeName);</span>
<span class="reserved">if</span> (invalidParentsRe == null || !invalidParentsRe.test(elm.parentNode.nodeName))
<span class="reserved">this</span>._mergeElements(scmd, elm.parentNode, elm, false);
}
}
<span class="comment">// Remove empty wrappers</span>
var nodes = doc.getElementsByTagName(wrapper);
<span class="reserved">for</span> (var i=nodes.length-1; i&gt;=0; i--) {
var elm = nodes[i];
var isEmpty = true;
<span class="comment">// Check if it has any attribs</span>
var tmp = doc.createElement(<span class="literal">"body"</span>);
tmp.appendChild(elm.cloneNode(false));
<span class="comment">// Is empty span, remove it</span>
tmp.innerHTML = tmp.innerHTML.replace(new RegExp(<span class="literal">'style=""|class=""'</span>, <span class="literal">'gi'</span>), <span class="literal">''</span>);
<span class="comment">//tinyMCE.debug(tmp.innerHTML);</span>
<span class="reserved">if</span> (new RegExp(<span class="literal">'&lt;span&gt;'</span>, <span class="literal">'gi'</span>).test(tmp.innerHTML)) {
<span class="reserved">for</span> (var x=0; x&lt;elm.childNodes.length; x++) {
<span class="reserved">if</span> (elm.parentNode != null)
elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true), elm);
}
elm.parentNode.removeChild(elm);
}
}
<span class="comment">// Re add the visual aids</span>
<span class="reserved">if</span> (scmd == <span class="literal">"removeformat"</span>)
tinyMCE.handleVisualAid(<span class="reserved">this</span>.getBody(), true, <span class="reserved">this</span>.visualAid, <span class="reserved">this</span>);
tinyMCE.triggerNodeChange();
break;
case <span class="literal">"FontName"</span>:
<span class="reserved">if</span> (value == null) {
var s = <span class="reserved">this</span>.getSel();
<span class="comment">// Find font and select it</span>
<span class="reserved">if</span> (tinyMCE.isGecko &amp;&amp; s.isCollapsed) {
var f = tinyMCE.getParentElement(<span class="reserved">this</span>.getFocusElement(), <span class="literal">"font"</span>);
<span class="reserved">if</span> (f != null)
<span class="reserved">this</span>.selection.selectNode(f, false);
}
<span class="comment">// Remove format</span>
<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">"RemoveFormat"</span>, false, null);
<span class="comment">// Collapse range if font was found</span>
<span class="reserved">if</span> (f != null &amp;&amp; tinyMCE.isGecko) {
var r = <span class="reserved">this</span>.getRng().cloneRange();
r.collapse(true);
s.removeAllRanges();
s.addRange(r);
}
} <span class="reserved">else</span>
<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">'FontName'</span>, false, value);
<span class="reserved">if</span> (tinyMCE.isGecko)
window.setTimeout(<span class="literal">'tinyMCE.triggerNodeChange(false);'</span>, 1);
<span class="reserved">return</span>;
case <span class="literal">"FontSize"</span>:
<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">'FontSize'</span>, false, value);
<span class="reserved">if</span> (tinyMCE.isGecko)
window.setTimeout(<span class="literal">'tinyMCE.triggerNodeChange(false);'</span>, 1);
<span class="reserved">return</span>;
case <span class="literal">"forecolor"</span>:
<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">'forecolor'</span>, false, value);
break;
case <span class="literal">"HiliteColor"</span>:
<span class="reserved">if</span> (tinyMCE.isGecko) {
<span class="reserved">this</span>._setUseCSS(true);
<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">'hilitecolor'</span>, false, value);
<span class="reserved">this</span>._setUseCSS(false);
} <span class="reserved">else</span>
<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">'BackColor'</span>, false, value);
break;
case <span class="literal">"Cut"</span>:
case <span class="literal">"Copy"</span>:
case <span class="literal">"Paste"</span>:
var cmdFailed = false;
<span class="comment">// Try executing command</span>
eval(<span class="literal">'try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}'</span>);
<span class="reserved">if</span> (tinyMCE.isOpera &amp;&amp; cmdFailed)
alert(<span class="literal">'Currently not supported by your browser, use keyboard shortcuts instead.'</span>);
<span class="comment">// Alert error in gecko if command failed</span>
<span class="reserved">if</span> (tinyMCE.isGecko &amp;&amp; cmdFailed) {
<span class="comment">// Confirm more info</span>
<span class="reserved">if</span> (confirm(tinyMCE.entityDecode(tinyMCE.getLang(<span class="literal">'lang_clipboard_msg'</span>))))
window.open(<span class="literal">'http://www.mozilla.org/editor/midasdemo/securityprefs.html'</span>, <span class="literal">'mceExternal'</span>);
<span class="reserved">return</span>;
} <span class="reserved">else</span>
tinyMCE.triggerNodeChange();
break;
case <span class="literal">"mceSetContent"</span>:
<span class="reserved">if</span> (!value)
value = <span class="literal">""</span>;
<span class="comment">// Call custom cleanup code</span>
value = tinyMCE.storeAwayURLs(value);
value = tinyMCE._customCleanup(<span class="reserved">this</span>, <span class="literal">"insert_to_editor"</span>, value);
tinyMCE._setHTML(doc, value);
tinyMCE.setInnerHTML(doc.body, tinyMCE._cleanupHTML(<span class="reserved">this</span>, doc, tinyMCE.settings, doc.body));
tinyMCE.convertAllRelativeURLs(doc.body);
<span class="comment">// Cleanup any mess left from storyAwayURLs</span>
tinyMCE._removeInternal(<span class="reserved">this</span>.getBody());
<span class="comment">// When editing always use fonts internaly</span>
<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">"convert_fonts_to_spans"</span>))
tinyMCE.convertSpansToFonts(doc);
tinyMCE.handleVisualAid(doc.body, true, <span class="reserved">this</span>.visualAid, <span class="reserved">this</span>);
tinyMCE._setEventsEnabled(doc.body, false);
<span class="reserved">return</span> true;
case <span class="literal">"mceCleanup"</span>:
var b = <span class="reserved">this</span>.selection.getBookmark();
tinyMCE._setHTML(<span class="reserved">this</span>.contentDocument, <span class="reserved">this</span>.getBody().innerHTML);
tinyMCE.setInnerHTML(<span class="reserved">this</span>.getBody(), tinyMCE._cleanupHTML(<span class="reserved">this</span>, <span class="reserved">this</span>.contentDocument, <span class="reserved">this</span>.settings, <span class="reserved">this</span>.getBody(), <span class="reserved">this</span>.visualAid));
tinyMCE.convertAllRelativeURLs(doc.body);
<span class="comment">// When editing always use fonts internaly</span>
<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">"convert_fonts_to_spans"</span>))
tinyMCE.convertSpansToFonts(doc);
tinyMCE.handleVisualAid(<span class="reserved">this</span>.getBody(), true, <span class="reserved">this</span>.visualAid, <span class="reserved">this</span>);
tinyMCE._setEventsEnabled(<span class="reserved">this</span>.getBody(), false);
<span class="reserved">this</span>.repaint();
<span class="reserved">this</span>.selection.moveToBookmark(b);
tinyMCE.triggerNodeChange();
break;
case <span class="literal">"mceReplaceContent"</span>:
<span class="comment">// Force empty string</span>
<span class="reserved">if</span> (!value)
value = <span class="literal">''</span>;
<span class="reserved">this</span>.getWin().focus();
var selectedText = <span class="literal">""</span>;
<span class="reserved">if</span> (tinyMCE.isMSIE) {
var rng = doc.selection.createRange();
selectedText = rng.text;
} <span class="reserved">else</span>
selectedText = <span class="reserved">this</span>.getSel().toString();
<span class="reserved">if</span> (selectedText.length &gt; 0) {
value = tinyMCE.replaceVar(value, <span class="literal">"selection"</span>, selectedText);
tinyMCE.execCommand(<span class="literal">'mceInsertContent'</span>, false, value);
}
tinyMCE.triggerNodeChange();
break;
case <span class="literal">"mceSetAttribute"</span>:
<span class="reserved">if</span> (typeof(value) == <span class="literal">'object'</span>) {
var targetElms = (typeof(value[<span class="literal">'targets'</span>]) == <span class="literal">"undefined"</span>) ? <span class="literal">"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address"</span> : value[<span class="literal">'targets'</span>];
var targetNode = tinyMCE.getParentElement(<span class="reserved">this</span>.getFocusElement(), targetElms);
<span class="reserved">if</span> (targetNode) {
targetNode.setAttribute(value[<span class="literal">'name'</span>], value[<span class="literal">'value'</span>]);
tinyMCE.triggerNodeChange();
}
}
break;
case <span class="literal">"mceSetCSSClass"</span>:
<span class="reserved">this</span>.execCommand(<span class="literal">"SetStyleInfo"</span>, false, {command : <span class="literal">"setattrib"</span>, name : <span class="literal">"class"</span>, value : value});
break;
case <span class="literal">"mceInsertRawHTML"</span>:
var key = <span class="literal">'tiny_mce_marker'</span>;
<span class="reserved">this</span>.execCommand(<span class="literal">'mceBeginUndoLevel'</span>);
<span class="comment">// Insert marker key</span>
<span class="reserved">this</span>.execCommand(<span class="literal">'mceInsertContent'</span>, false, key);
<span class="comment">// Store away scroll pos</span>
var scrollX = <span class="reserved">this</span>.getDoc().body.scrollLeft + <span class="reserved">this</span>.getDoc().documentElement.scrollLeft;
var scrollY = <span class="reserved">this</span>.getDoc().body.scrollTop + <span class="reserved">this</span>.getDoc().documentElement.scrollTop;
<span class="comment">// Find marker and replace with RAW HTML</span>
var html = <span class="reserved">this</span>.getBody().innerHTML;
<span class="reserved">if</span> ((pos = html.indexOf(key)) != -1)
tinyMCE.setInnerHTML(<span class="reserved">this</span>.getBody(), html.substring(0, pos) + value + html.substring(pos + key.length));
<span class="comment">// Restore scoll pos</span>
<span class="reserved">this</span>.contentWindow.scrollTo(scrollX, scrollY);
<span class="reserved">this</span>.execCommand(<span class="literal">'mceEndUndoLevel'</span>);
break;
case <span class="literal">"mceInsertContent"</span>:
<span class="comment">// Force empty string</span>
<span class="reserved">if</span> (!value)
value = <span class="literal">''</span>;
var insertHTMLFailed = false;
<span class="reserved">this</span>.getWin().focus();
<span class="reserved">if</span> (tinyMCE.isGecko || tinyMCE.isOpera) {
try {
<span class="comment">// Is plain text or HTML, &amp;amp;, &amp;nbsp; etc will be encoded wrong in FF</span>
<span class="reserved">if</span> (value.indexOf(<span class="literal">'&lt;'</span>) == -1 &amp;&amp; !value.match(/(&amp;#38;|&amp;#160;|&amp;#60;|&amp;#62;)/g)) {
var r = <span class="reserved">this</span>.getRng();
var n = <span class="reserved">this</span>.getDoc().createTextNode(tinyMCE.entityDecode(value));
var s = <span class="reserved">this</span>.getSel();
var r2 = r.cloneRange();
<span class="comment">// Insert text at cursor position</span>
s.removeAllRanges();
r.deleteContents();
r.insertNode(n);
<span class="comment">// Move the cursor to the end of text</span>
r2.selectNode(n);
r2.collapse(false);
s.removeAllRanges();
s.addRange(r2);
} <span class="reserved">else</span> {
value = tinyMCE.fixGeckoBaseHREFBug(1, <span class="reserved">this</span>.getDoc(), value);
<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">'inserthtml'</span>, false, value);
tinyMCE.fixGeckoBaseHREFBug(2, <span class="reserved">this</span>.getDoc(), value);
}
} catch (ex) {
insertHTMLFailed = true;
}
<span class="reserved">if</span> (!insertHTMLFailed) {
tinyMCE.triggerNodeChange();
<span class="reserved">return</span>;
}
}
<span class="comment">// Ugly hack in Opera due to non working "inserthtml"</span>
<span class="reserved">if</span> (tinyMCE.isOpera &amp;&amp; insertHTMLFailed) {
<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">"insertimage"</span>, false, tinyMCE.uniqueURL);
var ar = tinyMCE.getElementsByAttributeValue(<span class="reserved">this</span>.getBody(), <span class="literal">"img"</span>, <span class="literal">"src"</span>, tinyMCE.uniqueURL);
ar[0].outerHTML = value;
<span class="reserved">return</span>;
}
<span class="reserved">if</span> (!tinyMCE.isMSIE) {
var isHTML = value.indexOf(<span class="literal">'&lt;'</span>) != -1;
var sel = <span class="reserved">this</span>.getSel();
var rng = <span class="reserved">this</span>.getRng();
<span class="reserved">if</span> (isHTML) {
<span class="reserved">if</span> (tinyMCE.isSafari) {
var tmpRng = <span class="reserved">this</span>.getDoc().createRange();
tmpRng.setStart(<span class="reserved">this</span>.getBody(), 0);
tmpRng.setEnd(<span class="reserved">this</span>.getBody(), 0);
value = tmpRng.createContextualFragment(value);
} <span class="reserved">else</span>
value = rng.createContextualFragment(value);
} <span class="reserved">else</span> {
<span class="comment">// Setup text node</span>
var el = document.createElement(<span class="literal">"div"</span>);
el.innerHTML = value;
value = el.firstChild.nodeValue;
value = doc.createTextNode(value);
}
<span class="comment">// Insert plain text in Safari</span>
<span class="reserved">if</span> (tinyMCE.isSafari &amp;&amp; !isHTML) {
<span class="reserved">this</span>.execCommand(<span class="literal">'InsertText'</span>, false, value.nodeValue);
tinyMCE.triggerNodeChange();
<span class="reserved">return</span> true;
} <span class="reserved">else</span> <span class="reserved">if</span> (tinyMCE.isSafari &amp;&amp; isHTML) {
rng.deleteContents();
rng.insertNode(value);
tinyMCE.triggerNodeChange();
<span class="reserved">return</span> true;
}
rng.deleteContents();
<span class="comment">// If target node is text do special treatment, (Mozilla 1.3 fix)</span>
<span class="reserved">if</span> (rng.startContainer.nodeType == 3) {
var node = rng.startContainer.splitText(rng.startOffset);
node.parentNode.insertBefore(value, node);
} <span class="reserved">else</span>
rng.insertNode(value);
<span class="reserved">if</span> (!isHTML) {
<span class="comment">// Removes weird selection trails</span>
sel.selectAllChildren(doc.body);
sel.removeAllRanges();
<span class="comment">// Move cursor to end of content</span>
var rng = doc.createRange();
rng.selectNode(value);
rng.collapse(false);
sel.addRange(rng);
} <span class="reserved">else</span>
rng.collapse(false);
tinyMCE.fixGeckoBaseHREFBug(2, <span class="reserved">this</span>.getDoc(), value);
} <span class="reserved">else</span> {
var rng = doc.selection.createRange();
var c = value.indexOf(<span class="literal">'&lt;!--'</span>) != -1;
<span class="comment">// Fix comment bug, add tag before comments</span>
<span class="reserved">if</span> (c)
value = tinyMCE.uniqueTag + value;
<span class="reserved">if</span> (rng.item)
rng.item(0).outerHTML = value;
<span class="reserved">else</span>
rng.pasteHTML(value);
<span class="comment">// Remove unique tag</span>
<span class="reserved">if</span> (c) {
var e = <span class="reserved">this</span>.getDoc().getElementById(<span class="literal">'mceTMPElement'</span>);
e.parentNode.removeChild(e);
}
}
tinyMCE.triggerNodeChange();
break;
case <span class="literal">"mceStartTyping"</span>:
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'custom_undo_redo'</span>] &amp;&amp; <span class="reserved">this</span>.undoRedo.typingUndoIndex == -1) {
<span class="reserved">this</span>.undoRedo.typingUndoIndex = <span class="reserved">this</span>.undoRedo.undoIndex;
<span class="reserved">this</span>.execCommand(<span class="literal">'mceAddUndoLevel'</span>);
<span class="comment">//tinyMCE.debug("mceStartTyping");</span>
}
break;
case <span class="literal">"mceEndTyping"</span>:
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'custom_undo_redo'</span>] &amp;&amp; <span class="reserved">this</span>.undoRedo.typingUndoIndex != -1) {
<span class="reserved">this</span>.execCommand(<span class="literal">'mceAddUndoLevel'</span>);
<span class="reserved">this</span>.undoRedo.typingUndoIndex = -1;
<span class="comment">//tinyMCE.debug("mceEndTyping");</span>
}
break;
case <span class="literal">"mceBeginUndoLevel"</span>:
<span class="reserved">this</span>.undoRedoLevel = false;
break;
case <span class="literal">"mceEndUndoLevel"</span>:
<span class="reserved">this</span>.undoRedoLevel = true;
<span class="reserved">this</span>.execCommand(<span class="literal">'mceAddUndoLevel'</span>);
break;
case <span class="literal">"mceAddUndoLevel"</span>:
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'custom_undo_redo'</span>] &amp;&amp; <span class="reserved">this</span>.undoRedoLevel) {
<span class="reserved">if</span> (<span class="reserved">this</span>.undoRedo.add())
tinyMCE.triggerNodeChange(false);
}
break;
case <span class="literal">"Undo"</span>:
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'custom_undo_redo'</span>]) {
tinyMCE.execCommand(<span class="literal">"mceEndTyping"</span>);
<span class="reserved">this</span>.undoRedo.undo();
tinyMCE.triggerNodeChange();
} <span class="reserved">else</span>
<span class="reserved">this</span>.getDoc().execCommand(command, user_interface, value);
break;
case <span class="literal">"Redo"</span>:
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'custom_undo_redo'</span>]) {
tinyMCE.execCommand(<span class="literal">"mceEndTyping"</span>);
<span class="reserved">this</span>.undoRedo.redo();
tinyMCE.triggerNodeChange();
} <span class="reserved">else</span>
<span class="reserved">this</span>.getDoc().execCommand(command, user_interface, value);
break;
case <span class="literal">"mceToggleVisualAid"</span>:
<span class="reserved">this</span>.visualAid = !<span class="reserved">this</span>.visualAid;
tinyMCE.handleVisualAid(<span class="reserved">this</span>.getBody(), true, <span class="reserved">this</span>.visualAid, <span class="reserved">this</span>);
tinyMCE.triggerNodeChange();
break;
case <span class="literal">"Indent"</span>:
<span class="reserved">this</span>.getDoc().execCommand(command, user_interface, value);
tinyMCE.triggerNodeChange();
<span class="reserved">if</span> (tinyMCE.isMSIE) {
var n = tinyMCE.getParentElement(<span class="reserved">this</span>.getFocusElement(), <span class="literal">"blockquote"</span>);
do {
<span class="reserved">if</span> (n &amp;&amp; n.nodeName == <span class="literal">"BLOCKQUOTE"</span>) {
n.removeAttribute(<span class="literal">"dir"</span>);
n.removeAttribute(<span class="literal">"style"</span>);
}
} <span class="reserved">while</span> (n != null &amp;&amp; (n = n.parentNode) != null);
}
break;
case <span class="literal">"removeformat"</span>:
var text = <span class="reserved">this</span>.selection.getSelectedText();
<span class="reserved">if</span> (tinyMCE.isOpera) {
<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">"RemoveFormat"</span>, false, null);
<span class="reserved">return</span>;
}
<span class="reserved">if</span> (tinyMCE.isMSIE) {
try {
var rng = doc.selection.createRange();
rng.execCommand(<span class="literal">"RemoveFormat"</span>, false, null);
} catch (e) {
<span class="comment">// Do nothing</span>
}
<span class="reserved">this</span>.execCommand(<span class="literal">"SetStyleInfo"</span>, false, {command : <span class="literal">"removeformat"</span>});
} <span class="reserved">else</span> {
<span class="reserved">this</span>.getDoc().execCommand(command, user_interface, value);
<span class="reserved">this</span>.execCommand(<span class="literal">"SetStyleInfo"</span>, false, {command : <span class="literal">"removeformat"</span>});
}
<span class="comment">// Remove class</span>
<span class="reserved">if</span> (text.length == 0)
<span class="reserved">this</span>.execCommand(<span class="literal">"mceSetCSSClass"</span>, false, <span class="literal">""</span>);
tinyMCE.triggerNodeChange();
break;
default:
<span class="reserved">this</span>.getDoc().execCommand(command, user_interface, value);
<span class="reserved">if</span> (tinyMCE.isGecko)
window.setTimeout(<span class="literal">'tinyMCE.triggerNodeChange(false);'</span>, 1);
<span class="reserved">else</span>
tinyMCE.triggerNodeChange();
}
<span class="comment">// Add undo level after modification</span>
<span class="reserved">if</span> (command != <span class="literal">"mceAddUndoLevel"</span> &amp;&amp; command != <span class="literal">"Undo"</span> &amp;&amp; command != <span class="literal">"Redo"</span> &amp;&amp; command != <span class="literal">"mceStartTyping"</span> &amp;&amp; command != <span class="literal">"mceEndTyping"</span>)
tinyMCE.execCommand(<span class="literal">"mceAddUndoLevel"</span>);
},
<span class="comment">/**
* Returns a command specific value, for example the current font size.
*
* <span class="attrib">@param</span> {string} c Command to query value from.
* <span class="attrib">@return</span> Command specific value, for example the current font size.
* <span class="attrib">@type</span> mixed
*/</span>
queryCommandValue : <span class="reserved">function</span>(c) {
try {
<span class="reserved">return</span> <span class="reserved">this</span>.getDoc().queryCommandValue(c);
} catch (e) {
<span class="reserved">return</span> null;
}
},
<span class="comment">/**
* Returns a command specific state, for example if bold is enabled or not.
*
* <span class="attrib">@param</span> {string} c Command to query state from.
* <span class="attrib">@return</span> Command specific state, for example if bold is enabled or not.
* <span class="attrib">@type</span> boolean
*/</span>
queryCommandState : <span class="reserved">function</span>(c) {
<span class="reserved">return</span> <span class="reserved">this</span>.getDoc().queryCommandState(c);
},
<span class="comment">/**
* Gets executed when the editor control instance is added.
*
* <span class="attrib">@param</span> {HTMLElement} replace_element Element to replace with a editor instance.
* <span class="attrib">@param</span> {string} form_element_name Form element name that gets replaced.
* <span class="attrib">@param</span> {DOMDocument} target_document Target document reference where the element is located.
* <span class="attrib">@private</span>
*/</span>
_onAdd : <span class="reserved">function</span>(replace_element, form_element_name, target_document) {
var hc, th, to, editorTemplate;
th = <span class="reserved">this</span>.settings[<span class="literal">'theme'</span>];
to = tinyMCE.themes[th];
var targetDoc = target_document ? target_document : document;
<span class="reserved">this</span>.targetDoc = targetDoc;
tinyMCE.themeURL = tinyMCE.baseURL + <span class="literal">"/themes/"</span> + <span class="reserved">this</span>.settings[<span class="literal">'theme'</span>];
<span class="reserved">this</span>.settings[<span class="literal">'themeurl'</span>] = tinyMCE.themeURL;
<span class="reserved">if</span> (!replace_element) {
alert(<span class="literal">"Error: Could not find the target element."</span>);
<span class="reserved">return</span> false;
}
<span class="reserved">if</span> (to.getEditorTemplate)
editorTemplate = to.getEditorTemplate(<span class="reserved">this</span>.settings, <span class="reserved">this</span>.editorId);
var deltaWidth = editorTemplate[<span class="literal">'delta_width'</span>] ? editorTemplate[<span class="literal">'delta_width'</span>] : 0;
var deltaHeight = editorTemplate[<span class="literal">'delta_height'</span>] ? editorTemplate[<span class="literal">'delta_height'</span>] : 0;
var html = <span class="literal">'&lt;span id="'</span> + <span class="reserved">this</span>.editorId + <span class="literal">'_parent" class="mceEditorContainer"&gt;'</span> + editorTemplate[<span class="literal">'html'</span>];
html = tinyMCE.replaceVar(html, <span class="literal">"editor_id"</span>, <span class="reserved">this</span>.editorId);
<span class="reserved">this</span>.settings[<span class="literal">'default_document'</span>] = tinyMCE.baseURL + <span class="literal">"/blank.htm"</span>;
<span class="reserved">this</span>.settings[<span class="literal">'old_width'</span>] = <span class="reserved">this</span>.settings[<span class="literal">'width'</span>];
<span class="reserved">this</span>.settings[<span class="literal">'old_height'</span>] = <span class="reserved">this</span>.settings[<span class="literal">'height'</span>];
<span class="comment">// Set default width, height</span>
<span class="reserved">if</span> (<span class="reserved">this</span>.settings[<span class="literal">'width'</span>] == -1)
<span class="reserved">this</span>.settings[<span class="literal">'width'</span>] = replace_element.offsetWidth;
<span class="reserved">if</span> (<span class="reserved">this</span>.settings[<span class="literal">'height'</span>] == -1)
<span class="reserved">this</span>.settings[<span class="literal">'height'</span>] = replace_element.offsetHeight;
<span class="comment">// Try the style width</span>
<span class="reserved">if</span> (<span class="reserved">this</span>.settings[<span class="literal">'width'</span>] == 0)
<span class="reserved">this</span>.settings[<span class="literal">'width'</span>] = replace_element.style.width;
<span class="comment">// Try the style height</span>
<span class="reserved">if</span> (<span class="reserved">this</span>.settings[<span class="literal">'height'</span>] == 0)
<span class="reserved">this</span>.settings[<span class="literal">'height'</span>] = replace_element.style.height;
<span class="comment">// If no width/height then default to 320x240, better than nothing</span>
<span class="reserved">if</span> (<span class="reserved">this</span>.settings[<span class="literal">'width'</span>] == 0)
<span class="reserved">this</span>.settings[<span class="literal">'width'</span>] = 320;
<span class="reserved">if</span> (<span class="reserved">this</span>.settings[<span class="literal">'height'</span>] == 0)
<span class="reserved">this</span>.settings[<span class="literal">'height'</span>] = 240;
<span class="reserved">this</span>.settings[<span class="literal">'area_width'</span>] = parseInt(<span class="reserved">this</span>.settings[<span class="literal">'width'</span>]);
<span class="reserved">this</span>.settings[<span class="literal">'area_height'</span>] = parseInt(<span class="reserved">this</span>.settings[<span class="literal">'height'</span>]);
<span class="reserved">this</span>.settings[<span class="literal">'area_width'</span>] += deltaWidth;
<span class="reserved">this</span>.settings[<span class="literal">'area_height'</span>] += deltaHeight;
<span class="comment">// Special % handling</span>
<span class="reserved">if</span> ((<span class="literal">""</span> + <span class="reserved">this</span>.settings[<span class="literal">'width'</span>]).indexOf(<span class="literal">'%'</span>) != -1)
<span class="reserved">this</span>.settings[<span class="literal">'area_width'</span>] = <span class="literal">"100%"</span>;
<span class="reserved">if</span> ((<span class="literal">""</span> + <span class="reserved">this</span>.settings[<span class="literal">'height'</span>]).indexOf(<span class="literal">'%'</span>) != -1)
<span class="reserved">this</span>.settings[<span class="literal">'area_height'</span>] = <span class="literal">"100%"</span>;
<span class="reserved">if</span> ((<span class="literal">""</span> + replace_element.style.width).indexOf(<span class="literal">'%'</span>) != -1) {
<span class="reserved">this</span>.settings[<span class="literal">'width'</span>] = replace_element.style.width;
<span class="reserved">this</span>.settings[<span class="literal">'area_width'</span>] = <span class="literal">"100%"</span>;
}
<span class="reserved">if</span> ((<span class="literal">""</span> + replace_element.style.height).indexOf(<span class="literal">'%'</span>) != -1) {
<span class="reserved">this</span>.settings[<span class="literal">'height'</span>] = replace_element.style.height;
<span class="reserved">this</span>.settings[<span class="literal">'area_height'</span>] = <span class="literal">"100%"</span>;
}
html = tinyMCE.applyTemplate(html);
<span class="reserved">this</span>.settings[<span class="literal">'width'</span>] = <span class="reserved">this</span>.settings[<span class="literal">'old_width'</span>];
<span class="reserved">this</span>.settings[<span class="literal">'height'</span>] = <span class="reserved">this</span>.settings[<span class="literal">'old_height'</span>];
<span class="reserved">this</span>.visualAid = <span class="reserved">this</span>.settings[<span class="literal">'visual'</span>];
<span class="reserved">this</span>.formTargetElementId = form_element_name;
<span class="comment">// Get replace_element contents</span>
<span class="reserved">if</span> (replace_element.nodeName == <span class="literal">"TEXTAREA"</span> || replace_element.nodeName == <span class="literal">"INPUT"</span>)
<span class="reserved">this</span>.startContent = replace_element.value;
<span class="reserved">else</span>
<span class="reserved">this</span>.startContent = replace_element.innerHTML;
<span class="comment">// If not text area or input</span>
<span class="reserved">if</span> (replace_element.nodeName != <span class="literal">"TEXTAREA"</span> &amp;&amp; replace_element.nodeName != <span class="literal">"INPUT"</span>) {
<span class="reserved">this</span>.oldTargetElement = replace_element;
<span class="comment">// Debug mode</span>
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'debug'</span>]) {
hc = <span class="literal">'&lt;textarea wrap="off" id="'</span> + form_element_name + <span class="literal">'" name="'</span> + form_element_name + <span class="literal">'" cols="100" rows="15"&gt;&lt;/textarea&gt;'</span>;
} <span class="reserved">else</span> {
hc = <span class="literal">'&lt;input type="hidden" type="text" id="'</span> + form_element_name + <span class="literal">'" name="'</span> + form_element_name + <span class="literal">'" /&gt;'</span>;
<span class="reserved">this</span>.oldTargetElement.style.display = <span class="literal">"none"</span>;
}
html += <span class="literal">'&lt;/span&gt;'</span>;
<span class="reserved">if</span> (tinyMCE.isGecko)
html = hc + html;
<span class="reserved">else</span>
html += hc;
<span class="comment">// Output HTML and set editable</span>
<span class="reserved">if</span> (tinyMCE.isGecko) {
var rng = replace_element.ownerDocument.createRange();
rng.setStartBefore(replace_element);
var fragment = rng.createContextualFragment(html);
tinyMCE.insertAfter(fragment, replace_element);
} <span class="reserved">else</span>
replace_element.insertAdjacentHTML(<span class="literal">"beforeBegin"</span>, html);
} <span class="reserved">else</span> {
html += <span class="literal">'&lt;/span&gt;'</span>;
<span class="comment">// Just hide the textarea element</span>
<span class="reserved">this</span>.oldTargetElement = replace_element;
<span class="reserved">if</span> (!tinyMCE.settings[<span class="literal">'debug'</span>])
<span class="reserved">this</span>.oldTargetElement.style.display = <span class="literal">"none"</span>;
<span class="comment">// Output HTML and set editable</span>
<span class="reserved">if</span> (tinyMCE.isGecko) {
var rng = replace_element.ownerDocument.createRange();
rng.setStartBefore(replace_element);
var fragment = rng.createContextualFragment(html);
tinyMCE.insertAfter(fragment, replace_element);
} <span class="reserved">else</span>
replace_element.insertAdjacentHTML(<span class="literal">"beforeBegin"</span>, html);
}
<span class="comment">// Setup iframe</span>
var dynamicIFrame = false;
var tElm = targetDoc.getElementById(<span class="reserved">this</span>.editorId);
<span class="reserved">if</span> (!tinyMCE.isMSIE) {
<span class="reserved">if</span> (tElm &amp;&amp; tElm.nodeName == <span class="literal">"SPAN"</span>) {
tElm = tinyMCE._createIFrame(tElm, targetDoc);
dynamicIFrame = true;
}
<span class="reserved">this</span>.targetElement = tElm;
<span class="reserved">this</span>.iframeElement = tElm;
<span class="reserved">this</span>.contentDocument = tElm.contentDocument;
<span class="reserved">this</span>.contentWindow = tElm.contentWindow;
<span class="comment">//this.getDoc().designMode = "on";</span>
} <span class="reserved">else</span> {
<span class="reserved">if</span> (tElm &amp;&amp; tElm.nodeName == <span class="literal">"SPAN"</span>)
tElm = tinyMCE._createIFrame(tElm, targetDoc, targetDoc.parentWindow);
<span class="reserved">else</span>
tElm = targetDoc.frames[<span class="reserved">this</span>.editorId];
<span class="reserved">this</span>.targetElement = tElm;
<span class="reserved">this</span>.iframeElement = targetDoc.getElementById(<span class="reserved">this</span>.editorId);
<span class="reserved">if</span> (tinyMCE.isOpera) {
<span class="reserved">this</span>.contentDocument = <span class="reserved">this</span>.iframeElement.contentDocument;
<span class="reserved">this</span>.contentWindow = <span class="reserved">this</span>.iframeElement.contentWindow;
dynamicIFrame = true;
} <span class="reserved">else</span> {
<span class="reserved">this</span>.contentDocument = tElm.window.document;
<span class="reserved">this</span>.contentWindow = tElm.window;
}
<span class="reserved">this</span>.getDoc().designMode = <span class="literal">"on"</span>;
}
<span class="comment">// Setup base HTML</span>
var doc = <span class="reserved">this</span>.contentDocument;
<span class="reserved">if</span> (dynamicIFrame) {
var html = tinyMCE.getParam(<span class="literal">'doctype'</span>) + <span class="literal">'&lt;html&gt;&lt;head xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;base href="'</span> + tinyMCE.settings[<span class="literal">'base_href'</span>] + <span class="literal">'" /&gt;&lt;title&gt;blank_page&lt;/title&gt;&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;&lt;/head&gt;&lt;body class="mceContentBody"&gt;&lt;/body&gt;&lt;/html&gt;'</span>;
try {
<span class="reserved">if</span> (!<span class="reserved">this</span>.isHidden())
<span class="reserved">this</span>.getDoc().designMode = <span class="literal">"on"</span>;
doc.open();
doc.write(html);
doc.close();
} catch (e) {
<span class="comment">// Failed Mozilla 1.3</span>
<span class="reserved">this</span>.getDoc().location.href = tinyMCE.baseURL + <span class="literal">"/blank.htm"</span>;
}
}
<span class="comment">// This timeout is needed in MSIE 5.5 for some odd reason</span>
<span class="comment">// it seems that the document.frames isn't initialized yet?</span>
<span class="reserved">if</span> (tinyMCE.isMSIE)
window.setTimeout(<span class="literal">"tinyMCE.addEventHandlers(tinyMCE.instances[\"</span><span class="literal">" + this.editorId + "</span>\<span class="literal">"]);"</span>, 1);
tinyMCE.setupContent(<span class="reserved">this</span>.editorId, true);
<span class="reserved">return</span> true;
},
<span class="comment">/**
* Sets the base href url of the current document instance. This method is used
* to temporarly remove the base url during copy/paste and drag/drop operations
* of relative links from external sites into TinyMCE. MSIE has a bug and converts
* relative links from external sites to absolute links incorrectly.
*
* <span class="attrib">@param</span> {string} u URL to set as base URL or null to remove it.
*/</span>
setBaseHREF : <span class="reserved">function</span>(u) {
var h, b, d, nl;
d = <span class="reserved">this</span>.getDoc();
nl = d.getElementsByTagName(<span class="literal">"base"</span>);
b = nl.length &gt; 0 ? nl[0] : null;
<span class="reserved">if</span> (!b) {
nl = d.getElementsByTagName(<span class="literal">"head"</span>);
h = nl.length &gt; 0 ? nl[0] : null;
b = d.createElement(<span class="literal">"base"</span>);
b.setAttribute(<span class="literal">'href'</span>, u);
h.appendChild(b);
} <span class="reserved">else</span> {
<span class="reserved">if</span> (u == <span class="literal">""</span> || u == null)
b.parentNode.removeChild(b);
<span class="reserved">else</span>
b.setAttribute(<span class="literal">'href'</span>, u);
}
},
<span class="comment">/**
* Returns the currently selected element. This is was added for compatiblity and is deprecated.
* Please use inst.selection.getFocusElement instead.
*
* <span class="attrib">@return</span> Currently selected element.
* <span class="attrib">@type</span> HTMLElement
* <span class="attrib">@deprecated</span>
*/</span>
getFocusElement : <span class="reserved">function</span>() {
<span class="reserved">return</span> <span class="reserved">this</span>.selection.getFocusElement();
},
<span class="comment">/**
* Returns the browsers selection instance. This is was added for compatiblity and is deprecated.
* Please use inst.selection.getSel instead.
*
* <span class="attrib">@return</span> Browser selection instance.
* <span class="attrib">@type</span> DOMSelection
* <span class="attrib">@deprecated</span>
*/</span>
getSel : <span class="reserved">function</span>() {
<span class="reserved">return</span> <span class="reserved">this</span>.selection.getSel();
},
<span class="comment">/**
* Returns the browsers selections first range instance. This is was added for compatiblity and is deprecated.
* Please use inst.selection.getRng instead.
*
* <span class="attrib">@return</span> Browsers selections first range instance.
* <span class="attrib">@type</span> DOMRange
* <span class="attrib">@deprecated</span>
*/</span>
getRng : <span class="reserved">function</span>() {
<span class="reserved">return</span> <span class="reserved">this</span>.selection.getRng();
},
<span class="comment">/**
* Moves the contents from the TinyMCE editor control instance to the hidden textarea
* that got replaced with TinyMCE. This is executed automaticly on for example form submit unless you configure otherwice.
*
* <span class="attrib">@param</span> {boolean} skip_cleanup Optional Skip cleanup, simply move the contents as fast as possible.
* <span class="attrib">@param</span> {boolean} skip_callback Optional Skip callback, don't call the save_callback function.
*/</span>
triggerSave : <span class="reserved">function</span>(skip_cleanup, skip_callback) {
<span class="reserved">this</span>.switchSettings();
tinyMCE.settings[<span class="literal">'preformatted'</span>] = false;
<span class="comment">// Default to false</span>
<span class="reserved">if</span> (typeof(skip_cleanup) == <span class="literal">"undefined"</span>)
skip_cleanup = false;
<span class="comment">// Default to false</span>
<span class="reserved">if</span> (typeof(skip_callback) == <span class="literal">"undefined"</span>)
skip_callback = false;
tinyMCE._setHTML(<span class="reserved">this</span>.getDoc(), <span class="reserved">this</span>.getBody().innerHTML);
<span class="comment">// Remove visual aids when cleanup is disabled</span>
<span class="reserved">if</span> (<span class="reserved">this</span>.settings[<span class="literal">'cleanup'</span>] == false) {
tinyMCE.handleVisualAid(<span class="reserved">this</span>.getBody(), true, false, <span class="reserved">this</span>);
tinyMCE._setEventsEnabled(<span class="reserved">this</span>.getBody(), true);
}
tinyMCE._customCleanup(<span class="reserved">this</span>, <span class="literal">"submit_content_dom"</span>, <span class="reserved">this</span>.contentWindow.document.body);
var htm = skip_cleanup ? <span class="reserved">this</span>.getBody().innerHTML : tinyMCE._cleanupHTML(<span class="reserved">this</span>, <span class="reserved">this</span>.getDoc(), <span class="reserved">this</span>.settings, <span class="reserved">this</span>.getBody(), tinyMCE.visualAid, true, true);
htm = tinyMCE._customCleanup(<span class="reserved">this</span>, <span class="literal">"submit_content"</span>, htm);
<span class="reserved">if</span> (!skip_callback &amp;&amp; tinyMCE.settings[<span class="literal">'save_callback'</span>] != <span class="literal">""</span>)
var content = eval(tinyMCE.settings[<span class="literal">'save_callback'</span>] + <span class="literal">"(this.formTargetElementId,htm,this.getBody());"</span>);
<span class="comment">// Use callback content if available</span>
<span class="reserved">if</span> ((typeof(content) != <span class="literal">"undefined"</span>) &amp;&amp; content != null)
htm = content;
<span class="comment">// Replace some weird entities (Bug: #1056343)</span>
htm = tinyMCE.regexpReplace(htm, <span class="literal">"&amp;#40;"</span>, <span class="literal">"("</span>, <span class="literal">"gi"</span>);
htm = tinyMCE.regexpReplace(htm, <span class="literal">"&amp;#41;"</span>, <span class="literal">")"</span>, <span class="literal">"gi"</span>);
htm = tinyMCE.regexpReplace(htm, <span class="literal">"&amp;#59;"</span>, <span class="literal">";"</span>, <span class="literal">"gi"</span>);
htm = tinyMCE.regexpReplace(htm, <span class="literal">"&amp;#34;"</span>, <span class="literal">"&amp;quot;"</span>, <span class="literal">"gi"</span>);
htm = tinyMCE.regexpReplace(htm, <span class="literal">"&amp;#94;"</span>, <span class="literal">"^"</span>, <span class="literal">"gi"</span>);
<span class="reserved">if</span> (<span class="reserved">this</span>.formElement)
<span class="reserved">this</span>.formElement.value = htm;
<span class="reserved">if</span> (tinyMCE.isSafari &amp;&amp; <span class="reserved">this</span>.formElement)
<span class="reserved">this</span>.formElement.innerText = htm;
}
};
</pre>
<hr>
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> &nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a> &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<font size="-1">
</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Fri Apr 14 21:59:23 2006</div>
</body>
</html>
<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
parent.document.title="TinyMCE_DOMUtils.class.js Overview";
}
</script>
</head>
<body bgcolor="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> &nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a> &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<center>
<h2>TinyMCE_DOMUtils.class.js</h2>
</center>
<h4>Summary</h4>
<p>
No overview generated for 'TinyMCE_DOMUtils.class.js'<BR/><BR/>
</p>
<hr>
<!-- ========== METHOD SUMMARY =========== -->
<!-- ========== END METHOD SUMMARY =========== -->
<pre class="sourceview"><span class="comment">/**
* $RCSfile: overview-summary-TinyMCE_DOMUtils.class.js.html,v $
* $Revision: 1.42 $
* $Date: 2006/04/14 20:00:29 $
*
* <span class="attrib">@author</span> Moxiecode
* <span class="attrib">@copyright</span> Copyright 2004-2006, Moxiecode Systems AB, All rights reserved.
*
* The contents of this file will be wrapped in a class later on.
*/</span>
<span class="comment">/**
* Returns a element by a specific attribute and it's value.
*
* <span class="attrib">@param</span> {HTMLElement} n Element to search in.
* <span class="attrib">@param</span> {string} e Element name to search for.
* <span class="attrib">@param</span> {string} a Attribute name to search for.
* <span class="attrib">@param</span> {string} v Attribute value to search for.
* <span class="attrib">@return</span> HTML element that matched the criterias or null on failure.
* <span class="attrib">@type</span> HTMLElement
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.getElementByAttributeValue = <span class="reserved">function</span>(n, e, a, v) {
<span class="reserved">return</span> (n = <span class="reserved">this</span>.getElementsByAttributeValue(n, e, a, v)).length == 0 ? null : n[0];
};
<span class="comment">/**
* Returns a element array by a specific attribute and it's value.
*
* <span class="attrib">@param</span> {HTMLElement} n Element to search in.
* <span class="attrib">@param</span> {string} e Element name to search for.
* <span class="attrib">@param</span> {string} a Attribute name to search for.
* <span class="attrib">@param</span> {string} v Attribute value to search for.
* <span class="attrib">@return</span> HTML element array that matched the criterias or null on failure.
* <span class="attrib">@type</span> Array
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.getElementsByAttributeValue = <span class="reserved">function</span>(n, e, a, v) {
var i, nl = n.getElementsByTagName(e), o = new Array();
<span class="reserved">for</span> (i=0; i&lt;nl.length; i++) {
<span class="reserved">if</span> (tinyMCE.getAttrib(nl[i], a).indexOf(v) != -1)
o[o.length] = nl[i];
}
<span class="reserved">return</span> o;
};
<span class="comment">/**
* Returns true/false if the specified node is a block element or not.
*
* <span class="attrib">@param</span> {HTMLNode} n Node to verify.
* <span class="attrib">@return</span> true/false if the specified node is a block element or not.
* <span class="attrib">@type</span> boolean
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.isBlockElement = <span class="reserved">function</span>(n) {
<span class="reserved">return</span> n != null &amp;&amp; n.nodeType == 1 &amp;&amp; <span class="reserved">this</span>.blockRegExp.test(n.nodeName);
};
<span class="comment">/**
* Returns the first block element parent of the specified node.
*
* <span class="attrib">@param</span> {HTMLNode} n Node get parent block element for.
* <span class="attrib">@return</span> First block element parent of the specified node or null if it wasn't found.
* <span class="attrib">@type</span> HTMLElement
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.getParentBlockElement = <span class="reserved">function</span>(n) {
<span class="reserved">while</span> (n) {
<span class="reserved">if</span> (<span class="reserved">this</span>.isBlockElement(n))
<span class="reserved">return</span> n;
n = n.parentNode;
}
<span class="reserved">return</span> null;
};
<span class="comment">/**
* Inserts a node after the specific node.
*
* <span class="attrib">@param</span> {HTMLNode} n New node to insert.
* <span class="attrib">@param</span> {HTMLNode} r Reference node to insert after.
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.insertAfter = <span class="reserved">function</span>(n, r){
<span class="reserved">if</span> (r.nextSibling)
r.parentNode.insertBefore(n, r.nextSibling);
<span class="reserved">else</span>
r.parentNode.appendChild(n);
};
<span class="comment">/**
* Sets the innerHTML property of a element, this function also
* fixes a MSIE bug where the first comment is removed.
*
* <span class="attrib">@param</span> {HTMLElement} e Element to insert HTML in.
* <span class="attrib">@param</span> {string} h HTML code to insert into innerHTML.
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.setInnerHTML = <span class="reserved">function</span>(e, h) {
var i, nl, n;
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; !tinyMCE.isOpera) {
<span class="comment">// Since MSIE handles invalid HTML better that valid XHTML we</span>
<span class="comment">// need to make some things invalid. &lt;hr /&gt; gets converted to &lt;hr&gt;.</span>
h = h.replace(/\s\/&gt;/g, <span class="literal">'&gt;'</span>);
<span class="comment">// Since MSIE auto generated emtpy P tags some times we must tell it to keep the real ones</span>
h = h.replace(/&lt;p([^&gt;]*)&gt;\u00A0?&lt;\/p&gt;/gi, <span class="literal">'&lt;p$1 mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt;'</span>); <span class="comment">// Keep empty paragraphs</span>
h = h.replace(/&lt;p([^&gt;]*)&gt;\s*&amp;nbsp;\s*&lt;\/p&gt;/gi, <span class="literal">'&lt;p$1 mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt;'</span>); <span class="comment">// Keep empty paragraphs</span>
h = h.replace(/&lt;p([^&gt;]*)&gt;\s+&lt;\/p&gt;/gi, <span class="literal">'&lt;p$1 mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt;'</span>); <span class="comment">// Keep empty paragraphs</span>
<span class="comment">// Remove first comment</span>
e.innerHTML = tinyMCE.uniqueTag + h;
e.firstChild.removeNode(true);
<span class="comment">// Remove weird auto generated empty paragraphs unless it's supposed to be there</span>
nl = e.getElementsByTagName(<span class="literal">"p"</span>);
<span class="reserved">for</span> (i=nl.length-1; i&gt;=0; i--) {
n = nl[i];
<span class="reserved">if</span> (n.nodeName == <span class="literal">'P'</span> &amp;&amp; !n.hasChildNodes() &amp;&amp; !n.mce_keep)
n.parentNode.removeChild(n);
}
} <span class="reserved">else</span> {
h = <span class="reserved">this</span>.fixGeckoBaseHREFBug(1, e, h);
e.innerHTML = h;
<span class="reserved">this</span>.fixGeckoBaseHREFBug(2, e, h);
}
};
<span class="comment">/**
* Returns the outer HTML of a element, this uses the outerHTML
* property in MSIE and Opera and a workaround for Gecko.
*
* <span class="attrib">@param</span> {HTMLElement} e HTML element to get outerHTML from.
* <span class="attrib">@return</span> HTML content string.
* <span class="attrib">@type</span> string
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.getOuterHTML = <span class="reserved">function</span>(e) {
<span class="reserved">if</span> (tinyMCE.isMSIE)
<span class="reserved">return</span> e.outerHTML;
var d = e.ownerDocument.createElement(<span class="literal">"body"</span>);
d.appendChild(e);
<span class="reserved">return</span> d.innerHTML;
};
<span class="comment">/**
* Sets the outer HTML of a element, this uses the outerHTML
* property in MSIE and Opera and a workaround for Gecko.
*
* <span class="attrib">@param</span> {HTMLElement} e HTML element to set outerHTML on.
* <span class="attrib">@param</span> {string} h HTML string to set in property.
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.setOuterHTML = <span class="reserved">function</span>(e, h) {
<span class="reserved">if</span> (tinyMCE.isMSIE) {
e.outerHTML = h;
<span class="reserved">return</span>;
}
var d = e.ownerDocument.createElement(<span class="literal">"body"</span>);
d.innerHTML = h;
e.parentNode.replaceChild(d.firstChild, e);
};
<span class="comment">/**
* Returns a element by id, this will also search the form names to match the id.
*
* <span class="attrib">@param</span> {string} id Id of element.
* <span class="attrib">@param</span> {DOMDocument} d Optional document.
* <span class="attrib">@return</span> HTML element that matches the id.
* <span class="attrib">@type</span> HTMLElement
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>._getElementById = <span class="reserved">function</span>(id, d) {
var e, i, j, f;
<span class="reserved">if</span> (typeof(d) == <span class="literal">"undefined"</span>)
d = document;
e = d.getElementById(id);
<span class="reserved">if</span> (!e) {
f = d.forms;
<span class="reserved">for</span> (i=0; i&lt;f.length; i++) {
<span class="reserved">for</span> (j=0; j&lt;f[i].elements.length; j++) {
<span class="reserved">if</span> (f[i].elements[j].name == id) {
e = f[i].elements[j];
break;
}
}
}
}
<span class="reserved">return</span> e;
};
<span class="comment">/**
* Returns a array of nodes selected retrived from the child nodes of the specified node.
*
* <span class="attrib">@param</span> {HTMLNode} n Node to get children from.
* <span class="attrib">@param</span> {Array} na Array to fill with children.
* <span class="attrib">@param</span> {int} t Node type to get.
* <span class="attrib">@param</span> {string} nn Node name of items to retrive.
* <span class="attrib">@return</span> Node array.
* <span class="attrib">@type</span> Array
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.getNodeTree = <span class="reserved">function</span>(n, na, t, nn) {
var i;
<span class="reserved">if</span> (typeof(t) == <span class="literal">"undefined"</span> || n.nodeType == t &amp;&amp; (typeof(nn) == <span class="literal">"undefined"</span> || n.nodeName == nn))
na[na.length] = n;
<span class="reserved">if</span> (n.hasChildNodes()) {
<span class="reserved">for</span> (i=0; i&lt;n.childNodes.length; i++)
tinyMCE.getNodeTree(n.childNodes[i], na, t, nn);
}
<span class="reserved">return</span> na;
};
<span class="comment">/**
* Returns the parent element of the specified node based on the search criteria.
*
* <span class="attrib">@param</span> {HTMLNode} node Node to get parent element of.
* <span class="attrib">@param</span> {string} names Comma separated list of element names to get.
* <span class="attrib">@param</span> {string} attrib_name Optional attribute name to match.
* <span class="attrib">@param</span> {string} attrib_value Optional attribute value to match.
* <span class="attrib">@return</span> HTMLElement or null based on search criteras.
* <span class="attrib">@type</span> HTMLElement
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.getParentElement = <span class="reserved">function</span>(node, names, attrib_name, attrib_value) {
<span class="reserved">if</span> (typeof(names) == <span class="literal">"undefined"</span>) {
<span class="reserved">if</span> (node.nodeType == 1)
<span class="reserved">return</span> node;
<span class="comment">// Find parent node that is a element</span>
<span class="reserved">while</span> ((node = node.parentNode) != null &amp;&amp; node.nodeType != 1) ;
<span class="reserved">return</span> node;
}
<span class="reserved">if</span> (node == null)
<span class="reserved">return</span> null;
var namesAr = names.toUpperCase().split(<span class="literal">','</span>);
do {
<span class="reserved">for</span> (var i=0; i&lt;namesAr.length; i++) {
<span class="reserved">if</span> (node.nodeName == namesAr[i] || names == <span class="literal">"*"</span>) {
<span class="reserved">if</span> (typeof(attrib_name) == <span class="literal">"undefined"</span>)
<span class="reserved">return</span> node;
<span class="reserved">else</span> <span class="reserved">if</span> (node.getAttribute(attrib_name)) {
<span class="reserved">if</span> (typeof(attrib_value) == <span class="literal">"undefined"</span>) {
<span class="reserved">if</span> (node.getAttribute(attrib_name) != <span class="literal">""</span>)
<span class="reserved">return</span> node;
} <span class="reserved">else</span> <span class="reserved">if</span> (node.getAttribute(attrib_name) == attrib_value)
<span class="reserved">return</span> node;
}
}
}
} <span class="reserved">while</span> ((node = node.parentNode) != null);
<span class="reserved">return</span> null;
};
<span class="comment">/**
* Returns a node by the specified selector function. This function will
* loop through all parent nodes and call the specified function for each node.
* If the function then returns true it will stop the execution and return that node.
*
* <span class="attrib">@param</span> {DOMNode} n HTML node to search parents on.
* <span class="attrib">@param</span> {function} f Selection function to execute on each node.
* <span class="attrib">@return</span> DOMNode or null if it wasn't found.
* <span class="attrib">@type</span> DOMNode
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.getParentNode = <span class="reserved">function</span>(n, f) {
<span class="reserved">while</span> (n) {
<span class="reserved">if</span> (f(n))
<span class="reserved">return</span> n;
n = n.parentNode;
}
<span class="reserved">return</span> null;
};
<span class="comment">/**
* Returns the attribute value of a element or the default value if it wasn't found.
*
* <span class="attrib">@param</span> {HTMLElement} elm HTML element to get attribute from.
* <span class="attrib">@param</span> {string} name Attribute name to retrive.
* <span class="attrib">@param</span> {string} default_value Optional default value to return, this value defaults to a empty string.
* <span class="attrib">@return</span> Attribute value or default value if it wasn't found in element.
* <span class="attrib">@type</span> string
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.getAttrib = <span class="reserved">function</span>(elm, name, default_value) {
<span class="reserved">if</span> (typeof(default_value) == <span class="literal">"undefined"</span>)
default_value = <span class="literal">""</span>;
<span class="comment">// Not a element</span>
<span class="reserved">if</span> (!elm || elm.nodeType != 1)
<span class="reserved">return</span> default_value;
var v = elm.getAttribute(name);
<span class="comment">// Try className for class attrib</span>
<span class="reserved">if</span> (name == <span class="literal">"class"</span> &amp;&amp; !v)
v = elm.className;
<span class="comment">// Workaround for a issue with Firefox 1.5rc2+</span>
<span class="reserved">if</span> (tinyMCE.isGecko &amp;&amp; name == <span class="literal">"src"</span> &amp;&amp; elm.src != null &amp;&amp; elm.src != <span class="literal">""</span>)
v = elm.src;
<span class="comment">// Workaround for a issue with Firefox 1.5rc2+</span>
<span class="reserved">if</span> (tinyMCE.isGecko &amp;&amp; name == <span class="literal">"href"</span> &amp;&amp; elm.href != null &amp;&amp; elm.href != <span class="literal">""</span>)
v = elm.href;
<span class="reserved">if</span> (name == <span class="literal">"http-equiv"</span> &amp;&amp; tinyMCE.isMSIE)
v = elm.httpEquiv;
<span class="reserved">if</span> (name == <span class="literal">"style"</span> &amp;&amp; !tinyMCE.isOpera)
v = elm.style.cssText;
<span class="reserved">return</span> (v &amp;&amp; v != <span class="literal">""</span>) ? v : default_value;
};
<span class="comment">/**
* Sets the attribute value for a specific attribute.
*
* <span class="attrib">@param</span> {HTMLElement} element HTML element to set attribute on.
* <span class="attrib">@param</span> {string} name Attribute name to set.
* <span class="attrib">@param</span> {string} value Attribute value to set.
* <span class="attrib">@param</span> {boolean} fix_value Optional fix value state, if true only number data will be accepted.
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.setAttrib = <span class="reserved">function</span>(element, name, value, fix_value) {
<span class="reserved">if</span> (typeof(value) == <span class="literal">"number"</span> &amp;&amp; value != null)
value = <span class="literal">""</span> + value;
<span class="reserved">if</span> (fix_value) {
<span class="reserved">if</span> (value == null)
value = <span class="literal">""</span>;
var re = new RegExp(<span class="literal">'[^0-9%]'</span>, <span class="literal">'g'</span>);
value = value.replace(re, <span class="literal">''</span>);
}
<span class="reserved">if</span> (name == <span class="literal">"style"</span>)
element.style.cssText = value;
<span class="reserved">if</span> (name == <span class="literal">"class"</span>)
element.className = value;
<span class="reserved">if</span> (value != null &amp;&amp; value != <span class="literal">""</span> &amp;&amp; value != -1)
element.setAttribute(name, value);
<span class="reserved">else</span>
element.removeAttribute(name);
};
<span class="comment">/**
* Sets a style attribute item value.
*
* <span class="attrib">@param</span> {HTMLElement} elm HTML element to set style attribute item on.
* <span class="attrib">@param</span> {string} name Style item name to set.
* <span class="attrib">@param</span> {string} value Style item value to set.
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.setStyleAttrib = <span class="reserved">function</span>(elm, name, value) {
eval(<span class="literal">'elm.style.'</span> + name + <span class="literal">'=value;'</span>);
<span class="comment">// Style attrib deleted</span>
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; value == null || value == <span class="literal">''</span>) {
var str = tinyMCE.serializeStyle(tinyMCE.parseStyle(elm.style.cssText));
elm.style.cssText = str;
elm.setAttribute(<span class="literal">"style"</span>, str);
}
};
<span class="comment">/**
* Switches the CSS class of the specified element. This method also caches the
* elements in a lookup table for performance. This should only be used for TinyMCE main UI controls
* like buttons or select elements.
*
* <span class="attrib">@param</span> {HTMLElement} ei Element to set CSS class on.
* <span class="attrib">@param</span> {string} c CSS class to set.
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.switchClass = <span class="reserved">function</span>(ei, c) {
var e;
<span class="reserved">if</span> (tinyMCE.switchClassCache[ei])
e = tinyMCE.switchClassCache[ei];
<span class="reserved">else</span>
e = tinyMCE.switchClassCache[ei] = document.getElementById(ei);
<span class="reserved">if</span> (e) {
<span class="comment">// Keep tile mode</span>
<span class="reserved">if</span> (tinyMCE.settings.button_tile_map &amp;&amp; e.className &amp;&amp; e.className.indexOf(<span class="literal">'mceTiledButton'</span>) == 0)
c = <span class="literal">'mceTiledButton '</span> + c;
e.className = c;
}
};
<span class="comment">/**
* Returns the absolute x, y position of a node. The position will be returned in a object with
* two properties absLeft and absTop.
*
* <span class="attrib">@param</span> {HTMLNode} n HTML element to get x, y position from.
* <span class="attrib">@return</span> Absolute position of the specified element.
* <span class="attrib">@type</span> TinyMCE_ElementPosition
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.getAbsPosition = <span class="reserved">function</span>(n) {
var p = {absLeft : 0, absTop : 0};
<span class="reserved">while</span> (n) {
p.absLeft += n.offsetLeft;
p.absTop += n.offsetTop;
n = n.offsetParent;
}
<span class="reserved">return</span> p;
};
<span class="comment">/**
* Finds any previous element by name. This will loop through the siblings
* inorder to find the specified element by name. If the element wasn't found
* it will return a null value.
*
* <span class="attrib">@param</span> {HTMLNode} e HTML node to search from.
* <span class="attrib">@param</span> {string} n Comma separated list of element names to search for.
* <span class="attrib">@return</span> HTML Element or null if it wasn't found.
* <span class="attrib">@type</span> HTMLElement
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.prevNode = <span class="reserved">function</span>(e, n) {
var a = n.split(<span class="literal">','</span>), i;
<span class="reserved">while</span> ((e = e.previousSibling) != null) {
<span class="reserved">for</span> (i=0; i&lt;a.length; i++) {
<span class="reserved">if</span> (e.nodeName == a[i])
<span class="reserved">return</span> e;
}
}
<span class="reserved">return</span> null;
};
<span class="comment">/**
* Finds any element after the current one by name. This will loop through the siblings
* inorder to find the specified element by name. If the element wasn't found
* it will return a null value.
*
* <span class="attrib">@param</span> {HTMLNode} e HTML node to search from.
* <span class="attrib">@param</span> {string} n Comma separated list of element names to search for.
* <span class="attrib">@return</span> HTML Element or null if it wasn't found.
* <span class="attrib">@type</span> HTMLElement
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.nextNode = <span class="reserved">function</span>(e, n) {
var a = n.split(<span class="literal">','</span>), i;
<span class="reserved">while</span> ((e = e.nextSibling) != null) {
<span class="reserved">for</span> (i=0; i&lt;a.length; i++) {
<span class="reserved">if</span> (e.nodeName == a[i])
<span class="reserved">return</span> e;
}
}
<span class="reserved">return</span> null;
};
<span class="comment">/**
* Returns a array of nodes when the specified function matches a node.
*
* <span class="attrib">@param</span> {DOMNode} n Node to select children from.
* <span class="attrib">@param</span> {function} f Function that returns true/false if the node is to be added or not.
* <span class="attrib">@param</span> {Array} a Optional array to fill with nodes.
* <span class="attrib">@return</span> Array with selected nodes.
* <span class="attrib">@type</span> Array
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.selectNodes = <span class="reserved">function</span>(n, f, a) {
var i;
<span class="reserved">if</span> (!a)
a = new Array();
<span class="reserved">if</span> (f(n))
a[a.length] = n;
<span class="reserved">if</span> (n.hasChildNodes()) {
<span class="reserved">for</span> (i=0; i&lt;n.childNodes.length; i++)
tinyMCE.selectNodes(n.childNodes[i], f, a);
}
<span class="reserved">return</span> a;
};
<span class="comment">/**
* Adds a CSS class to the specified element. It will remove any previous item with the same name
* so adding a class that already exists will move it to the end.
*
* <span class="attrib">@param</span> {HTMLElement} e HTML element to add CSS class to.
* <span class="attrib">@param</span> {string] c CSS class to add to HTML element.
* <span class="attrib">@param</span> {boolean] b Optional parameter, if set to true, class will be added to the beginning.
* <span class="attrib">@return</span> Returns the new class attribute value.
* <span class="attrib">@type</span> string
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.addCSSClass = <span class="reserved">function</span>(e, c, b) {
var o = <span class="reserved">this</span>.removeCSSClass(e, c);
<span class="reserved">return</span> e.className = b ? c + (o != <span class="literal">''</span> ? (<span class="literal">' '</span> + o) : <span class="literal">''</span>) : (o != <span class="literal">''</span> ? (o + <span class="literal">' '</span>) : <span class="literal">''</span>) + c;
};
<span class="comment">/**
* Removes the specified CSS class from the element.
*
* <span class="attrib">@param</span> {HTMLElement} e HTML element to remove CSS class to.
* <span class="attrib">@param</span> {string] c CSS class to remove to HTML element.
* <span class="attrib">@return</span> Returns the new class attribute value.
* <span class="attrib">@type</span> string
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.removeCSSClass = <span class="reserved">function</span>(e, c) {
var a = <span class="reserved">this</span>.explode(<span class="literal">' '</span>, e.className), i;
<span class="reserved">for</span> (i=0; i&lt;a.length; i++) {
<span class="reserved">if</span> (a[i] == c)
a[i] = <span class="literal">''</span>;
}
<span class="reserved">return</span> e.className = a.join(<span class="literal">' '</span>);
};
<span class="comment">/**
* Renames the specified element to the specified name.
*
* <span class="attrib">@param</span> {HTMLElement} e Element to rename.
* <span class="attrib">@param</span> {string} n New name of the element.
* <span class="attrib">@param</span> {DOMDocument} d Optional document reference.
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.renameElement = <span class="reserved">function</span>(e, n, d) {
var ne, i, ar;
d = typeof(d) == <span class="literal">"undefined"</span> ? tinyMCE.selectedInstance.getDoc() : d;
<span class="reserved">if</span> (e) {
ne = d.createElement(n);
ar = e.attributes;
<span class="reserved">for</span> (i=ar.length-1; i&gt;-1; i--) {
<span class="reserved">if</span> (ar[i].specified &amp;&amp; ar[i].nodeValue)
ne.setAttribute(ar[i].nodeName.toLowerCase(), ar[i].nodeValue);
}
ar = e.childNodes;
<span class="reserved">for</span> (i=0; i&lt;ar.length; i++)
ne.appendChild(ar[i].cloneNode(true));
e.parentNode.replaceChild(ne, e);
}
};
</pre>
<hr>
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> &nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a> &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<font size="-1">
</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Fri Apr 14 21:59:23 2006</div>
</body>
</html>
<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
parent.document.title="TinyMCE_Debug.class.js Overview";
}
</script>
</head>
<body bgcolor="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> &nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a> &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<center>
<h2>TinyMCE_Debug.class.js</h2>
</center>
<h4>Summary</h4>
<p>
No overview generated for 'TinyMCE_Debug.class.js'<BR/><BR/>
</p>
<hr>
<!-- ========== METHOD SUMMARY =========== -->
<!-- ========== END METHOD SUMMARY =========== -->
<pre class="sourceview"><span class="comment">/**
* $RCSfile: overview-summary-TinyMCE_Debug.class.js.html,v $
* $Revision: 1.42 $
* $Date: 2006/04/14 20:00:29 $
*
* <span class="attrib">@author</span> Moxiecode
* <span class="attrib">@copyright</span> Copyright 2004-2006, Moxiecode Systems AB, All rights reserved.
*
* The contents of this file will be wrapped in a class later on.
*/</span>
<span class="comment">/**
* Debugs the specified message to a screen.
*
* <span class="attrib">@param</span> {1..n} Numerous arguments that will be outputed.
*/</span>
TinyMCE_Engine.<span class="reserved">prototype</span>.debug = <span class="reserved">function</span>() {
var m = <span class="literal">""</span>, e, a, i;
e = document.getElementById(<span class="literal">"tinymce_debug"</span>);
<span class="reserved">if</span> (!e) {
var d = document.createElement(<span class="literal">"div"</span>);
d.setAttribute(<span class="literal">"className"</span>, <span class="literal">"debugger"</span>);
d.className = <span class="literal">"debugger"</span>;
d.innerHTML = <span class="literal">'Debug output:&lt;textarea id="tinymce_debug" style="width: 100%; height: 300px" wrap="nowrap" mce_editable="false"&gt;&lt;/textarea&gt;'</span>;
document.body.appendChild(d);
e = document.getElementById(<span class="literal">"tinymce_debug"</span>);
}
a = <span class="reserved">this</span>.debug.arguments;
<span class="reserved">for</span> (i=0; i&lt;a.length; i++) {
m += a[i];
<span class="reserved">if</span> (i&lt;a.length-1)
m += <span class="literal">', '</span>;
}
e.value += m + <span class="literal">"\n"</span>;
};
</pre>
<hr>
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> &nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a> &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<font size="-1">
</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Fri Apr 14 21:59:23 2006</div>
</body>
</html>
<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
parent.document.title="TinyMCE_Engine.class.js Overview";
}
</script>
</head>
<body bgcolor="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> &nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a> &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<center>
<h2>TinyMCE_Engine.class.js</h2>
</center>
<h4>Summary</h4>
<p>
No overview generated for 'TinyMCE_Engine.class.js'<BR/><BR/>
</p>
<hr>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
<td colspan=2><font size="+2">
<b>Class Summary</b>
</font></td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td width="15%"><b><a href="TinyMCE_Engine.html">TinyMCE_Engine</a></b></td>
<td>&nbsp;</td>
</tr>
</table>
<hr/>
<!-- ========== METHOD SUMMARY =========== -->
<!-- ========== END METHOD SUMMARY =========== -->
<pre class="sourceview"><span class="comment">/**
* $RCSfile: overview-summary-TinyMCE_Engine.class.js.html,v $
* $Revision: 1.42 $
* $Date: 2006/04/14 20:00:29 $
*
* <span class="attrib">@author</span> Moxiecode
* <span class="attrib">@copyright</span> Copyright 2004-2006, Moxiecode Systems AB, All rights reserved.
*/</span>
<span class="comment">/**
* Core engine class for TinyMCE, a instance of this class is available as a global called tinyMCE.
*
* <span class="attrib">@constructor</span>
*/</span>
<span class="reserved">function</span> TinyMCE_Engine() {
<span class="reserved">this</span>.majorVersion = <span class="literal">"2"</span>;
<span class="reserved">this</span>.minorVersion = <span class="literal">"0.6"</span>;
<span class="reserved">this</span>.releaseDate = <span class="literal">"2006-xx-xx"</span>;
<span class="reserved">this</span>.instances = new Array();
<span class="reserved">this</span>.switchClassCache = new Array();
<span class="reserved">this</span>.windowArgs = new Array();
<span class="reserved">this</span>.loadedFiles = new Array();
<span class="reserved">this</span>.configs = new Array();
<span class="reserved">this</span>.currentConfig = 0;
<span class="reserved">this</span>.eventHandlers = new Array();
<span class="comment">// Browser check</span>
var ua = navigator.userAgent;
<span class="reserved">this</span>.isMSIE = (navigator.appName == <span class="literal">"Microsoft Internet Explorer"</span>);
<span class="reserved">this</span>.isMSIE5 = <span class="reserved">this</span>.isMSIE &amp;&amp; (ua.indexOf(<span class="literal">'MSIE 5'</span>) != -1);
<span class="reserved">this</span>.isMSIE5_0 = <span class="reserved">this</span>.isMSIE &amp;&amp; (ua.indexOf(<span class="literal">'MSIE 5.0'</span>) != -1);
<span class="reserved">this</span>.isGecko = ua.indexOf(<span class="literal">'Gecko'</span>) != -1;
<span class="reserved">this</span>.isSafari = ua.indexOf(<span class="literal">'Safari'</span>) != -1;
<span class="reserved">this</span>.isOpera = ua.indexOf(<span class="literal">'Opera'</span>) != -1;
<span class="reserved">this</span>.isMac = ua.indexOf(<span class="literal">'Mac'</span>) != -1;
<span class="reserved">this</span>.isNS7 = ua.indexOf(<span class="literal">'Netscape/7'</span>) != -1;
<span class="reserved">this</span>.isNS71 = ua.indexOf(<span class="literal">'Netscape/7.1'</span>) != -1;
<span class="reserved">this</span>.dialogCounter = 0;
<span class="reserved">this</span>.plugins = new Array();
<span class="reserved">this</span>.themes = new Array();
<span class="reserved">this</span>.menus = new Array();
<span class="reserved">this</span>.loadedPlugins = new Array();
<span class="reserved">this</span>.buttonMap = new Array();
<span class="reserved">this</span>.isLoaded = false;
<span class="comment">// Fake MSIE on Opera and if Opera fakes IE, Gecko or Safari cancel those</span>
<span class="reserved">if</span> (<span class="reserved">this</span>.isOpera) {
<span class="reserved">this</span>.isMSIE = true;
<span class="reserved">this</span>.isGecko = false;
<span class="reserved">this</span>.isSafari = false;
}
<span class="comment">// TinyMCE editor id instance counter</span>
<span class="reserved">this</span>.idCounter = 0;
};
TinyMCE_Engine.<span class="reserved">prototype</span> = {
<span class="comment">/**
* Initializes TinyMCE with the specific configuration settings. This method
* may be called multiple times when multiple instances with diffrent settings is to be created.
*
* <span class="attrib">@param</span> {Array} Name/Value array of initialization settings.
*/</span>
init : <span class="reserved">function</span>(settings) {
var theme;
<span class="reserved">this</span>.settings = settings;
<span class="comment">// Check if valid browser has execcommand support</span>
<span class="reserved">if</span> (typeof(document.execCommand) == <span class="literal">'undefined'</span>)
<span class="reserved">return</span>;
<span class="comment">// Get script base path</span>
<span class="reserved">if</span> (!tinyMCE.baseURL) {
var elements = document.getElementsByTagName(<span class="literal">'script'</span>);
<span class="reserved">for</span> (var i=0; i&lt;elements.length; i++) {
<span class="reserved">if</span> (elements[i].src &amp;&amp; (elements[i].src.indexOf(<span class="literal">"tiny_mce.js"</span>) != -1 || elements[i].src.indexOf(<span class="literal">"tiny_mce_dev.js"</span>) != -1 || elements[i].src.indexOf(<span class="literal">"tiny_mce_src.js"</span>) != -1 || elements[i].src.indexOf(<span class="literal">"tiny_mce_gzip"</span>) != -1)) {
var src = elements[i].src;
tinyMCE.srcMode = (src.indexOf(<span class="literal">'_src'</span>) != -1 || src.indexOf(<span class="literal">'_dev'</span>) != -1) ? <span class="literal">'_src'</span> : <span class="literal">''</span>;
tinyMCE.gzipMode = src.indexOf(<span class="literal">'_gzip'</span>) != -1;
src = src.substring(0, src.lastIndexOf(<span class="literal">'/'</span>));
<span class="reserved">if</span> (settings.exec_mode == <span class="literal">"src"</span> || settings.exec_mode == <span class="literal">"normal"</span>)
tinyMCE.srcMode = settings.exec_mode == <span class="literal">"src"</span> ? <span class="literal">'_src'</span> : <span class="literal">''</span>;
tinyMCE.baseURL = src;
break;
}
}
}
<span class="comment">// Get document base path</span>
<span class="reserved">this</span>.documentBasePath = document.location.href;
<span class="reserved">if</span> (<span class="reserved">this</span>.documentBasePath.indexOf(<span class="literal">'?'</span>) != -1)
<span class="reserved">this</span>.documentBasePath = <span class="reserved">this</span>.documentBasePath.substring(0, <span class="reserved">this</span>.documentBasePath.indexOf(<span class="literal">'?'</span>));
<span class="reserved">this</span>.documentURL = <span class="reserved">this</span>.documentBasePath;
<span class="reserved">this</span>.documentBasePath = <span class="reserved">this</span>.documentBasePath.substring(0, <span class="reserved">this</span>.documentBasePath.lastIndexOf(<span class="literal">'/'</span>));
<span class="comment">// If not HTTP absolute</span>
<span class="reserved">if</span> (tinyMCE.baseURL.indexOf(<span class="literal">'://'</span>) == -1 &amp;&amp; tinyMCE.baseURL.charAt(0) != <span class="literal">'/'</span>) {
<span class="comment">// If site absolute</span>
tinyMCE.baseURL = <span class="reserved">this</span>.documentBasePath + <span class="literal">"/"</span> + tinyMCE.baseURL;
}
<span class="comment">// Set default values on settings</span>
<span class="reserved">this</span>._def(<span class="literal">"mode"</span>, <span class="literal">"none"</span>);
<span class="reserved">this</span>._def(<span class="literal">"theme"</span>, <span class="literal">"advanced"</span>);
<span class="reserved">this</span>._def(<span class="literal">"plugins"</span>, <span class="literal">""</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"language"</span>, <span class="literal">"en"</span>);
<span class="reserved">this</span>._def(<span class="literal">"docs_language"</span>, <span class="reserved">this</span>.settings[<span class="literal">'language'</span>]);
<span class="reserved">this</span>._def(<span class="literal">"elements"</span>, <span class="literal">""</span>);
<span class="reserved">this</span>._def(<span class="literal">"textarea_trigger"</span>, <span class="literal">"mce_editable"</span>);
<span class="reserved">this</span>._def(<span class="literal">"editor_selector"</span>, <span class="literal">""</span>);
<span class="reserved">this</span>._def(<span class="literal">"editor_deselector"</span>, <span class="literal">"mceNoEditor"</span>);
<span class="reserved">this</span>._def(<span class="literal">"valid_elements"</span>, <span class="literal">"+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],-td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[id|style|dir|class|align],-h2[id|style|dir|class|align],-h3[id|style|dir|class|align],-h4[id|style|dir|class|align],-h5[id|style|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],-font[face|size|style|id|class|dir|color],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang]"</span>);
<span class="reserved">this</span>._def(<span class="literal">"extended_valid_elements"</span>, <span class="literal">""</span>);
<span class="reserved">this</span>._def(<span class="literal">"invalid_elements"</span>, <span class="literal">""</span>);
<span class="reserved">this</span>._def(<span class="literal">"encoding"</span>, <span class="literal">""</span>);
<span class="reserved">this</span>._def(<span class="literal">"urlconverter_callback"</span>, tinyMCE.getParam(<span class="literal">"urlconvertor_callback"</span>, <span class="literal">"TinyMCE_Engine.prototype.convertURL"</span>));
<span class="reserved">this</span>._def(<span class="literal">"save_callback"</span>, <span class="literal">""</span>);
<span class="reserved">this</span>._def(<span class="literal">"debug"</span>, false);
<span class="reserved">this</span>._def(<span class="literal">"force_br_newlines"</span>, false);
<span class="reserved">this</span>._def(<span class="literal">"force_p_newlines"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"add_form_submit_trigger"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"relative_urls"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"remove_script_host"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"focus_alert"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"document_base_url"</span>, <span class="reserved">this</span>.documentURL);
<span class="reserved">this</span>._def(<span class="literal">"visual"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"visual_table_class"</span>, <span class="literal">"mceVisualAid"</span>);
<span class="reserved">this</span>._def(<span class="literal">"setupcontent_callback"</span>, <span class="literal">""</span>);
<span class="reserved">this</span>._def(<span class="literal">"fix_content_duplication"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"custom_undo_redo"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"custom_undo_redo_levels"</span>, -1);
<span class="reserved">this</span>._def(<span class="literal">"custom_undo_redo_keyboard_shortcuts"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"custom_undo_redo_restore_selection"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"verify_html"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"apply_source_formatting"</span>, false);
<span class="reserved">this</span>._def(<span class="literal">"directionality"</span>, <span class="literal">"ltr"</span>);
<span class="reserved">this</span>._def(<span class="literal">"cleanup_on_startup"</span>, false);
<span class="reserved">this</span>._def(<span class="literal">"inline_styles"</span>, false);
<span class="reserved">this</span>._def(<span class="literal">"convert_newlines_to_brs"</span>, false);
<span class="reserved">this</span>._def(<span class="literal">"auto_reset_designmode"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"entities"</span>, <span class="literal">"39,#39,160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,34,quot,38,amp,60,lt,62,gt,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"entity_encoding"</span>, <span class="literal">"named"</span>);
<span class="reserved">this</span>._def(<span class="literal">"cleanup_callback"</span>, <span class="literal">""</span>);
<span class="reserved">this</span>._def(<span class="literal">"add_unload_trigger"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"ask"</span>, false);
<span class="reserved">this</span>._def(<span class="literal">"nowrap"</span>, false);
<span class="reserved">this</span>._def(<span class="literal">"auto_resize"</span>, false);
<span class="reserved">this</span>._def(<span class="literal">"auto_focus"</span>, false);
<span class="reserved">this</span>._def(<span class="literal">"cleanup"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"remove_linebreaks"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"button_tile_map"</span>, false);
<span class="reserved">this</span>._def(<span class="literal">"submit_patch"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"browsers"</span>, <span class="literal">"msie,safari,gecko,opera"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"dialog_type"</span>, <span class="literal">"window"</span>);
<span class="reserved">this</span>._def(<span class="literal">"accessibility_warnings"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"accessibility_focus"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"merge_styles_invalid_parents"</span>, <span class="literal">""</span>);
<span class="reserved">this</span>._def(<span class="literal">"force_hex_style_colors"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"trim_span_elements"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"convert_fonts_to_spans"</span>, false);
<span class="reserved">this</span>._def(<span class="literal">"doctype"</span>, <span class="literal">'&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt;'</span>);
<span class="reserved">this</span>._def(<span class="literal">"font_size_classes"</span>, <span class="literal">''</span>);
<span class="reserved">this</span>._def(<span class="literal">"font_size_style_values"</span>, <span class="literal">'xx-small,x-small,small,medium,large,x-large,xx-large'</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"event_elements"</span>, <span class="literal">'a,img'</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"convert_urls"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"table_inline_editing"</span>, false);
<span class="reserved">this</span>._def(<span class="literal">"object_resizing"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"custom_shortcuts"</span>, true);
<span class="reserved">this</span>._def(<span class="literal">"convert_on_click"</span>, false);
<span class="reserved">this</span>._def(<span class="literal">"content_css"</span>, <span class="literal">''</span>);
<span class="reserved">this</span>._def(<span class="literal">"fix_list_elements"</span>, false);
<span class="reserved">this</span>._def(<span class="literal">"fix_table_elements"</span>, false);
<span class="comment">// Browser check IE</span>
<span class="reserved">if</span> (<span class="reserved">this</span>.isMSIE &amp;&amp; <span class="reserved">this</span>.settings[<span class="literal">'browsers'</span>].indexOf(<span class="literal">'msie'</span>) == -1)
<span class="reserved">return</span>;
<span class="comment">// Browser check Gecko</span>
<span class="reserved">if</span> (<span class="reserved">this</span>.isGecko &amp;&amp; <span class="reserved">this</span>.settings[<span class="literal">'browsers'</span>].indexOf(<span class="literal">'gecko'</span>) == -1)
<span class="reserved">return</span>;
<span class="comment">// Browser check Safari</span>
<span class="reserved">if</span> (<span class="reserved">this</span>.isSafari &amp;&amp; <span class="reserved">this</span>.settings[<span class="literal">'browsers'</span>].indexOf(<span class="literal">'safari'</span>) == -1)
<span class="reserved">return</span>;
<span class="comment">// Browser check Opera</span>
<span class="reserved">if</span> (<span class="reserved">this</span>.isOpera &amp;&amp; <span class="reserved">this</span>.settings[<span class="literal">'browsers'</span>].indexOf(<span class="literal">'opera'</span>) == -1)
<span class="reserved">return</span>;
<span class="comment">// If not super absolute make it so</span>
var baseHREF = tinyMCE.settings[<span class="literal">'document_base_url'</span>];
var h = document.location.href;
var p = h.indexOf(<span class="literal">'://'</span>);
<span class="reserved">if</span> (p &gt; 0 &amp;&amp; document.location.protocol != <span class="literal">"file:"</span>) {
p = h.indexOf(<span class="literal">'/'</span>, p + 3);
h = h.substring(0, p);
<span class="reserved">if</span> (baseHREF.indexOf(<span class="literal">'://'</span>) == -1)
baseHREF = h + baseHREF;
tinyMCE.settings[<span class="literal">'document_base_url'</span>] = baseHREF;
tinyMCE.settings[<span class="literal">'document_base_prefix'</span>] = h;
}
<span class="comment">// Trim away query part</span>
<span class="reserved">if</span> (baseHREF.indexOf(<span class="literal">'?'</span>) != -1)
baseHREF = baseHREF.substring(0, baseHREF.indexOf(<span class="literal">'?'</span>));
<span class="reserved">this</span>.settings[<span class="literal">'base_href'</span>] = baseHREF.substring(0, baseHREF.lastIndexOf(<span class="literal">'/'</span>)) + <span class="literal">"/"</span>;
theme = <span class="reserved">this</span>.settings[<span class="literal">'theme'</span>];
<span class="reserved">this</span>.blockRegExp = new RegExp(<span class="literal">"^(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|blockquote|center|dl|dt|dd|dir|fieldset|form|noscript|noframes|menu|isindex|samp)$"</span>, <span class="literal">"i"</span>);
<span class="reserved">this</span>.posKeyCodes = new Array(13,45,36,35,33,34,37,38,39,40);
<span class="reserved">this</span>.uniqueURL = <span class="literal">'javascript:TINYMCE_UNIQUEURL();'</span>; <span class="comment">// Make unique URL non real URL</span>
<span class="reserved">this</span>.uniqueTag = <span class="literal">'&lt;div id="mceTMPElement" style="display: none"&gt;TMP&lt;/div&gt;'</span>;
<span class="reserved">this</span>.callbacks = new Array(<span class="literal">'onInit'</span>, <span class="literal">'getInfo'</span>, <span class="literal">'getEditorTemplate'</span>, <span class="literal">'setupContent'</span>, <span class="literal">'onChange'</span>, <span class="literal">'onPageLoad'</span>, <span class="literal">'handleNodeChange'</span>, <span class="literal">'initInstance'</span>, <span class="literal">'execCommand'</span>, <span class="literal">'getControlHTML'</span>, <span class="literal">'handleEvent'</span>, <span class="literal">'cleanup'</span>);
<span class="comment">// Theme url</span>
<span class="reserved">this</span>.settings[<span class="literal">'theme_href'</span>] = tinyMCE.baseURL + <span class="literal">"/themes/"</span> + theme;
<span class="reserved">if</span> (!tinyMCE.isMSIE)
<span class="reserved">this</span>.settings[<span class="literal">'force_br_newlines'</span>] = false;
<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">"popups_css"</span>, false)) {
var cssPath = tinyMCE.getParam(<span class="literal">"popups_css"</span>, <span class="literal">""</span>);
<span class="comment">// Is relative</span>
<span class="reserved">if</span> (cssPath.indexOf(<span class="literal">'://'</span>) == -1 &amp;&amp; cssPath.charAt(0) != <span class="literal">'/'</span>)
<span class="reserved">this</span>.settings[<span class="literal">'popups_css'</span>] = <span class="reserved">this</span>.documentBasePath + <span class="literal">"/"</span> + cssPath;
<span class="reserved">else</span>
<span class="reserved">this</span>.settings[<span class="literal">'popups_css'</span>] = cssPath;
} <span class="reserved">else</span>
<span class="reserved">this</span>.settings[<span class="literal">'popups_css'</span>] = tinyMCE.baseURL + <span class="literal">"/themes/"</span> + theme + <span class="literal">"/css/editor_popup.css"</span>;
<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">"editor_css"</span>, false)) {
var cssPath = tinyMCE.getParam(<span class="literal">"editor_css"</span>, <span class="literal">""</span>);
<span class="comment">// Is relative</span>
<span class="reserved">if</span> (cssPath.indexOf(<span class="literal">'://'</span>) == -1 &amp;&amp; cssPath.charAt(0) != <span class="literal">'/'</span>)
<span class="reserved">this</span>.settings[<span class="literal">'editor_css'</span>] = <span class="reserved">this</span>.documentBasePath + <span class="literal">"/"</span> + cssPath;
<span class="reserved">else</span>
<span class="reserved">this</span>.settings[<span class="literal">'editor_css'</span>] = cssPath;
} <span class="reserved">else</span>
<span class="reserved">this</span>.settings[<span class="literal">'editor_css'</span>] = tinyMCE.baseURL + <span class="literal">"/themes/"</span> + theme + <span class="literal">"/css/editor_ui.css"</span>;
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'debug'</span>]) {
var msg = <span class="literal">"Debug: \n"</span>;
msg += <span class="literal">"baseURL: "</span> + <span class="reserved">this</span>.baseURL + <span class="literal">"\n"</span>;
msg += <span class="literal">"documentBasePath: "</span> + <span class="reserved">this</span>.documentBasePath + <span class="literal">"\n"</span>;
msg += <span class="literal">"content_css: "</span> + <span class="reserved">this</span>.settings[<span class="literal">'content_css'</span>] + <span class="literal">"\n"</span>;
msg += <span class="literal">"popups_css: "</span> + <span class="reserved">this</span>.settings[<span class="literal">'popups_css'</span>] + <span class="literal">"\n"</span>;
msg += <span class="literal">"editor_css: "</span> + <span class="reserved">this</span>.settings[<span class="literal">'editor_css'</span>] + <span class="literal">"\n"</span>;
alert(msg);
}
<span class="comment">// Only do this once</span>
<span class="reserved">if</span> (<span class="reserved">this</span>.configs.length == 0) {
<span class="comment">// Is Safari enabled</span>
<span class="reserved">if</span> (<span class="reserved">this</span>.isSafari &amp;&amp; <span class="reserved">this</span>.getParam(<span class="literal">'safari_warning'</span>, false))
alert(<span class="literal">"Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.\nYou can disable this message by setting: safari_warning option to false"</span>);
<span class="reserved">if</span> (typeof(TinyMCECompressed) == <span class="literal">"undefined"</span>) {
tinyMCE.addEvent(window, <span class="literal">"DOMContentLoaded"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>.onLoad);
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; !tinyMCE.isOpera) {
<span class="reserved">if</span> (document.body)
tinyMCE.addEvent(document.body, <span class="literal">"readystatechange"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>.onLoad);
<span class="reserved">else</span>
tinyMCE.addEvent(document, <span class="literal">"readystatechange"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>.onLoad);
}
tinyMCE.addEvent(window, <span class="literal">"load"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>.onLoad);
tinyMCE._addUnloadEvents();
}
}
<span class="reserved">this</span>.loadScript(tinyMCE.baseURL + <span class="literal">'/themes/'</span> + <span class="reserved">this</span>.settings[<span class="literal">'theme'</span>] + <span class="literal">'/editor_template'</span> + tinyMCE.srcMode + <span class="literal">'.js'</span>);
<span class="reserved">this</span>.loadScript(tinyMCE.baseURL + <span class="literal">'/langs/'</span> + <span class="reserved">this</span>.settings[<span class="literal">'language'</span>] + <span class="literal">'.js'</span>);
<span class="reserved">this</span>.loadCSS(<span class="reserved">this</span>.settings[<span class="literal">'editor_css'</span>]);
<span class="comment">// Add plugins</span>
var p = tinyMCE.getParam(<span class="literal">'plugins'</span>, <span class="literal">''</span>, true, <span class="literal">','</span>);
<span class="reserved">if</span> (p.length &gt; 0) {
<span class="reserved">for</span> (var i=0; i&lt;p.length; i++) {
<span class="reserved">if</span> (p[i].charAt(0) != <span class="literal">'-'</span>)
<span class="reserved">this</span>.loadScript(tinyMCE.baseURL + <span class="literal">'/plugins/'</span> + p[i] + <span class="literal">'/editor_plugin'</span> + tinyMCE.srcMode + <span class="literal">'.js'</span>);
}
}
<span class="comment">// Setup entities</span>
settings[<span class="literal">'cleanup_entities'</span>] = new Array();
var entities = tinyMCE.getParam(<span class="literal">'entities'</span>, <span class="literal">''</span>, true, <span class="literal">','</span>);
<span class="reserved">for</span> (var i=0; i&lt;entities.length; i+=2)
settings[<span class="literal">'cleanup_entities'</span>][<span class="literal">'c'</span> + entities[i]] = entities[i+1];
<span class="comment">// Save away this config</span>
settings[<span class="literal">'index'</span>] = <span class="reserved">this</span>.configs.length;
<span class="reserved">this</span>.configs[<span class="reserved">this</span>.configs.length] = settings;
},
<span class="comment">/**
* Adds unload event handles to execute triggerSave.
*
* <span class="attrib">@private</span>
*/</span>
_addUnloadEvents : <span class="reserved">function</span>() {
<span class="reserved">if</span> (tinyMCE.isMSIE) {
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'add_unload_trigger'</span>]) {
tinyMCE.addEvent(window, <span class="literal">"unload"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>.unloadHandler);
tinyMCE.addEvent(window.document, <span class="literal">"beforeunload"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>.unloadHandler);
}
} <span class="reserved">else</span> {
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'add_unload_trigger'</span>])
tinyMCE.addEvent(window, <span class="literal">"unload"</span>, <span class="reserved">function</span> () {tinyMCE.triggerSave(true, true);});
}
},
<span class="comment">/**
* Assigns a default value for a specific config parameter.
*
* <span class="attrib">@param</span> {string} key Settings key to add default value to.
* <span class="attrib">@param</span> {object} def_val Default value to assign if the settings option isn't defined.
* <span class="attrib">@param</span> {boolean} t Trim all white space, if true all whitespace will be removed from option value.
* <span class="attrib">@private</span>
*/</span>
_def : <span class="reserved">function</span>(key, def_val, t) {
var v = tinyMCE.getParam(key, def_val);
v = t ? v.replace(/\s+/g,<span class="literal">""</span>) : v;
<span class="reserved">this</span>.settings[key] = v;
},
<span class="comment">/**
* Returns true/false if the specified plugin is loaded or not.
*
* <span class="attrib">@param</span> {string} n Plugin name to look for.
* <span class="attrib">@return</span> true/false if the specified plugin is loaded or not.
* <span class="attrib">@type</span> boolean
*/</span>
hasPlugin : <span class="reserved">function</span>(n) {
<span class="reserved">return</span> typeof(<span class="reserved">this</span>.plugins[n]) != <span class="literal">"undefined"</span> &amp;&amp; <span class="reserved">this</span>.plugins[n] != null;
},
<span class="comment">/**
* Adds the specified plugin to the list of loaded plugins, this will also setup the baseURL
* property of the plugin.
*
* <span class="attrib">@param</span> {string} Plugin name/id.
* <span class="attrib">@param</span> {TinyMCE_Plugin} p Plugin instance to add.
*/</span>
addPlugin : <span class="reserved">function</span>(n, p) {
var op = <span class="reserved">this</span>.plugins[n];
<span class="comment">// Use the previous plugin object base URL used when loading external plugins</span>
p.baseURL = op ? op.baseURL : tinyMCE.baseURL + <span class="literal">"/plugins/"</span> + n;
<span class="reserved">this</span>.plugins[n] = p;
},
<span class="comment">/**
* Sets the baseURL of the specified plugin, this is useful if the plugin is loaded from
* a external location.
*
* <span class="attrib">@param</span> {string} n Plugin name/id to set base URL on. This have to be added before.
* <span class="attrib">@param</span> {string} u Base URL of plugin, this string should be the URL prefix for the plugin without a trailing slash.
*/</span>
setPluginBaseURL : <span class="reserved">function</span>(n, u) {
var op = <span class="reserved">this</span>.plugins[n];
<span class="reserved">if</span> (op)
op.baseURL = u;
<span class="reserved">else</span>
<span class="reserved">this</span>.plugins[n] = {baseURL : u};
},
<span class="comment">/**
* Load plugin from external URL.
*
* <span class="attrib">@param</span> {string} n Plugin name for example \"emotions\".
* <span class="attrib">@param</span> {string} u URL of plugin directory to load.
*/</span>
loadPlugin : <span class="reserved">function</span>(n, u) {
u = u.indexOf(<span class="literal">'.js'</span>) != -1 ? u.substring(0, u.lastIndexOf(<span class="literal">'/'</span>)) : u;
u = u.charAt(u.length-1) == <span class="literal">'/'</span> ? u.substring(0, u.length-1) : u;
<span class="reserved">this</span>.plugins[n] = {baseURL : u};
<span class="reserved">this</span>.loadScript(u + <span class="literal">"/editor_plugin"</span> + (tinyMCE.srcMode ? <span class="literal">'_src'</span> : <span class="literal">''</span>) + <span class="literal">".js"</span>);
},
<span class="comment">/**
* Returns true/false if the specified theme is loaded or not.
*
* <span class="attrib">@param</span> {string} n Theme name/id to check for.
* <span class="attrib">@return</span> true/false if the specified theme is loaded or not.
* <span class="attrib">@type</span> boolean
*/</span>
hasTheme : <span class="reserved">function</span>(n) {
<span class="reserved">return</span> typeof(<span class="reserved">this</span>.themes[n]) != <span class="literal">"undefined"</span> &amp;&amp; <span class="reserved">this</span>.themes[n] != null;
},
<span class="comment">/**
* Adds the specified theme in to the list of loaded themes.
*
* <span class="attrib">@param</span> {string} n Theme name/id to add the object reference to.
* <span class="attrib">@param</span> {TinyMCE_Theme} t Theme instance to add to the loaded list.
*/</span>
addTheme : <span class="reserved">function</span>(n, t) {
<span class="reserved">this</span>.themes[n] = t;
},
<span class="comment">/**
* Adds a floating menu instance to TinyMCE.
*
* <span class="attrib">@param</span> {string} n TinyMCE menu id.
* <span class="attrib">@param</span> {TinyMCE_Menu} m TinyMCE menu instance.
*/</span>
addMenu : <span class="reserved">function</span>(n, m) {
<span class="reserved">this</span>.menus[n] = m;
},
<span class="comment">/**
* Checks if the specified menu by name is added to TinyMCE.
*
* <span class="attrib">@param</span> {string} n TinyMCE menu id.
* <span class="attrib">@return</span> true/false if it exists or not.
* <span class="attrib">@type</span> boolean
*/</span>
hasMenu : <span class="reserved">function</span>(n) {
<span class="reserved">return</span> typeof(<span class="reserved">this</span>.plugins[n]) != <span class="literal">"undefined"</span> &amp;&amp; <span class="reserved">this</span>.plugins[n] != null;
},
<span class="comment">/**
* Loads the specified script by writing the a script tag to the current page.
* This will also check if the file has been loaded before. This function should only be used
* when the page is loading.
*
* <span class="attrib">@param</span> {string} url Script URL to load.
*/</span>
loadScript : <span class="reserved">function</span>(url) {
<span class="reserved">for</span> (var i=0; i&lt;<span class="reserved">this</span>.loadedFiles.length; i++) {
<span class="reserved">if</span> (<span class="reserved">this</span>.loadedFiles[i] == url)
<span class="reserved">return</span>;
}
document.write(<span class="literal">'&lt;sc'</span>+<span class="literal">'ript language="javascript" type="text/javascript" src="'</span> + url + <span class="literal">'"&gt;&lt;/script&gt;'</span>);
<span class="reserved">this</span>.loadedFiles[<span class="reserved">this</span>.loadedFiles.length] = url;
},
<span class="comment">/**
* Loads the specified CSS by writing the a link tag to the current page.
* This will also check if the file has been loaded before. This function should only be used
* when the page is loading.
*
* <span class="attrib">@param</span> {string} url CSS file URL to load or comma separated list of files.
*/</span>
loadCSS : <span class="reserved">function</span>(url) {
var ar = url.replace(/\s+/, <span class="literal">''</span>).split(<span class="literal">','</span>);
var lflen = 0, csslen = 0;
var skip = false;
var x = 0, i = 0;
<span class="reserved">for</span> (x = 0,csslen = ar.length; x&lt;csslen; x++) {
ignore_css = false;
<span class="reserved">if</span> (ar[x] != null &amp;&amp; ar[x] != <span class="literal">'null'</span> &amp;&amp; ar[x].length &gt; 0) {
<span class="comment">/* Make sure it doesn't exist. */</span>
<span class="reserved">for</span> (i=0, lflen=<span class="reserved">this</span>.loadedFiles.length; i&lt;lflen; i++) {
<span class="reserved">if</span> (<span class="reserved">this</span>.loadedFiles[i] == ar[x]) {
skip = true;
break;
}
}
<span class="reserved">if</span> (!skip) {
document.write(<span class="literal">'&lt;link href="'</span> + ar[x] + <span class="literal">'" rel="stylesheet" type="text/css" /&gt;'</span>);
<span class="reserved">this</span>.loadedFiles[<span class="reserved">this</span>.loadedFiles.length] = ar[x];
}
}
}
},
<span class="comment">/**
* Imports a CSS file into a allready loaded document. This will add a link element
* to the head element of the document.
*
* <span class="attrib">@param</span> {DOMDocument} doc DOM Document to load CSS into.
* <span class="attrib">@param</span> {string} css CSS File URL to load or comma separated list of files.
*/</span>
importCSS : <span class="reserved">function</span>(doc, css) {
var css_ary = css.replace(/\s+/, <span class="literal">''</span>).split(<span class="literal">','</span>);
var csslen, elm, headArr, x, css_file;
<span class="reserved">for</span> (x = 0, csslen = css_ary.length; x&lt;csslen; x++) {
css_file = css_ary[x];
<span class="reserved">if</span> (css_file != null &amp;&amp; css_file != <span class="literal">'null'</span> &amp;&amp; css_file.length &gt; 0) {
<span class="comment">// Is relative, make absolute</span>
<span class="reserved">if</span> (css_file.indexOf(<span class="literal">'://'</span>) == -1 &amp;&amp; css_file.charAt(0) != <span class="literal">'/'</span>)
css_file = <span class="reserved">this</span>.documentBasePath + <span class="literal">"/"</span> + css_file;
<span class="reserved">if</span> (typeof(doc.createStyleSheet) == <span class="literal">"undefined"</span>) {
elm = doc.createElement(<span class="literal">"link"</span>);
elm.rel = <span class="literal">"stylesheet"</span>;
elm.href = css_file;
<span class="reserved">if</span> ((headArr = doc.getElementsByTagName(<span class="literal">"head"</span>)) != null &amp;&amp; headArr.length &gt; 0)
headArr[0].appendChild(elm);
} <span class="reserved">else</span>
doc.createStyleSheet(css_file);
}
}
},
<span class="comment">/**
* Displays a confirm dialog when a user clicks/focus a textarea that is to be converted into
* a TinyMCE instance.
*
* <span class="attrib">@param</span> {DOMEvent} e DOM event instance.
* <span class="attrib">@param</span> {Array} settings Name/Value array of initialization settings.
*/</span>
confirmAdd : <span class="reserved">function</span>(e, settings) {
var elm = tinyMCE.isMSIE ? event.srcElement : e.target;
var elementId = elm.name ? elm.name : elm.id;
tinyMCE.settings = settings;
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'convert_on_click'</span>] || (!elm.getAttribute(<span class="literal">'mce_noask'</span>) &amp;&amp; confirm(tinyMCELang[<span class="literal">'lang_edit_confirm'</span>])))
tinyMCE.addMCEControl(elm, elementId);
elm.setAttribute(<span class="literal">'mce_noask'</span>, <span class="literal">'true'</span>);
},
<span class="comment">/**
* Moves the contents from the hidden textarea to the editor that gets inserted.
*
* <span class="attrib">@param</span> {string} form_element_name Form element name to move contents from.
* <span class="attrib">@deprecated</span>
*/</span>
updateContent : <span class="reserved">function</span>(form_element_name) {
<span class="comment">// Find MCE instance linked to given form element and copy it's value</span>
var formElement = document.getElementById(form_element_name);
<span class="reserved">for</span> (var n in tinyMCE.instances) {
var inst = tinyMCE.instances[n];
<span class="reserved">if</span> (!tinyMCE.isInstance(inst))
continue;
inst.switchSettings();
<span class="reserved">if</span> (inst.formElement == formElement) {
var doc = inst.getDoc();
tinyMCE._setHTML(doc, inst.formElement.value);
<span class="reserved">if</span> (!tinyMCE.isMSIE)
doc.body.innerHTML = tinyMCE._cleanupHTML(inst, doc, <span class="reserved">this</span>.settings, doc.body, inst.visualAid);
}
}
},
<span class="comment">/**
* Adds a TinyMCE editor control instance to a specific form element.
*
* <span class="attrib">@param</span> {HTMLElement} replace_element HTML element object to replace.
* <span class="attrib">@param</span> {string} form_element_name HTML form element name,
* <span class="attrib">@param</span> {DOMDocument} target_document Target document that holds the element.
*/</span>
addMCEControl : <span class="reserved">function</span>(replace_element, form_element_name, target_document) {
var id = <span class="literal">"mce_editor_"</span> + tinyMCE.idCounter++;
var inst = new TinyMCE_Control(tinyMCE.settings);
inst.editorId = id;
<span class="reserved">this</span>.instances[id] = inst;
inst._onAdd(replace_element, form_element_name, target_document);
},
<span class="comment">/**
* Removes a TinyMCE editor control instance by id.
*
* <span class="attrib">@param</span> {string} editor_id Id of editor instance to remove.
*/</span>
removeMCEControl : <span class="reserved">function</span>(editor_id) {
var inst = tinyMCE.getInstanceById(editor_id);
<span class="reserved">if</span> (inst) {
inst.switchSettings();
editor_id = inst.editorId;
var html = tinyMCE.getContent(editor_id);
<span class="comment">// Remove editor instance from instances array</span>
var tmpInstances = new Array();
<span class="reserved">for</span> (var instanceName in tinyMCE.instances) {
var instance = tinyMCE.instances[instanceName];
<span class="reserved">if</span> (!tinyMCE.isInstance(instance))
continue;
<span class="reserved">if</span> (instanceName != editor_id)
tmpInstances[instanceName] = instance;
}
tinyMCE.instances = tmpInstances;
tinyMCE.selectedElement = null;
tinyMCE.selectedInstance = null;
<span class="comment">// Remove element</span>
var replaceElement = document.getElementById(editor_id + <span class="literal">"_parent"</span>);
var oldTargetElement = inst.oldTargetElement;
var targetName = oldTargetElement.nodeName.toLowerCase();
<span class="reserved">if</span> (targetName == <span class="literal">"textarea"</span> || targetName == <span class="literal">"input"</span>) {
<span class="comment">// Just show the old text area</span>
replaceElement.parentNode.removeChild(replaceElement);
oldTargetElement.style.display = <span class="literal">"inline"</span>;
oldTargetElement.value = html;
} <span class="reserved">else</span> {
oldTargetElement.innerHTML = html;
oldTargetElement.style.display = <span class="literal">'block'</span>;
replaceElement.parentNode.insertBefore(oldTargetElement, replaceElement);
replaceElement.parentNode.removeChild(replaceElement);
}
}
},
<span class="comment">/**
* Moves the contents from a TinyMCE editor control instance to the hidden textarea
* that got replaced with TinyMCE. This is executed automaticly on for example form submit.
*
* <span class="attrib">@param</span> {boolean} skip_cleanup Optional Skip cleanup, simply move the contents as fast as possible.
* <span class="attrib">@param</span> {boolean} skip_callback Optional Skip callback, don't call the save_callback function.
*/</span>
triggerSave : <span class="reserved">function</span>(skip_cleanup, skip_callback) {
var inst, n;
<span class="comment">// Default to false</span>
<span class="reserved">if</span> (typeof(skip_cleanup) == <span class="literal">"undefined"</span>)
skip_cleanup = false;
<span class="comment">// Default to false</span>
<span class="reserved">if</span> (typeof(skip_callback) == <span class="literal">"undefined"</span>)
skip_callback = false;
<span class="comment">// Cleanup and set all form fields</span>
<span class="reserved">for</span> (n in tinyMCE.instances) {
inst = tinyMCE.instances[n];
<span class="reserved">if</span> (!tinyMCE.isInstance(inst))
continue;
inst.triggerSave(skip_cleanup, skip_callback);
}
},
<span class="comment">/**
* Resets a forms TinyMCE instances based on form index.
*
* <span class="attrib">@param</span> {int} form_index Form index to reset.
*/</span>
resetForm : <span class="reserved">function</span>(form_index) {
var i, inst, n, formObj = document.forms[form_index];
<span class="reserved">for</span> (n in tinyMCE.instances) {
inst = tinyMCE.instances[n];
<span class="reserved">if</span> (!tinyMCE.isInstance(inst))
continue;
inst.switchSettings();
<span class="reserved">for</span> (i=0; i&lt;formObj.elements.length; i++) {
<span class="reserved">if</span> (inst.formTargetElementId == formObj.elements[i].name)
inst.getBody().innerHTML = inst.startContent;
}
}
},
<span class="comment">/**
* Executes a command on a specific editor instance by id.
*
* <span class="attrib">@param</span> {string} editor_id TinyMCE editor control instance id to perform comman on.
* <span class="attrib">@param</span> {string} command Command name to execute, for example mceLink or Bold.
* <span class="attrib">@param</span> {boolean} user_interface True/false state if a UI (dialog) should be presented or not.
* <span class="attrib">@param</span> {object} value Optional command value, this can be anything.
* <span class="attrib">@param</span> {boolean} focus True/false if the editor instance should be focused first.
*/</span>
execInstanceCommand : <span class="reserved">function</span>(editor_id, command, user_interface, value, focus) {
var inst = tinyMCE.getInstanceById(editor_id);
<span class="reserved">if</span> (inst) {
<span class="reserved">if</span> (typeof(focus) == <span class="literal">"undefined"</span>)
focus = true;
<span class="reserved">if</span> (focus)
inst.contentWindow.focus();
<span class="comment">// Reset design mode if lost</span>
inst.autoResetDesignMode();
<span class="reserved">this</span>.selectedElement = inst.getFocusElement();
<span class="reserved">this</span>.selectedInstance = inst;
tinyMCE.execCommand(command, user_interface, value);
<span class="comment">// Cancel event so it doesn't call onbeforeonunlaod</span>
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; window.event != null)
tinyMCE.cancelEvent(window.event);
}
},
<span class="comment">/**
* Executes a command on the selected or last selected TinyMCE editor control instance. This function also handles
* some non instance specific commands like mceAddControl, mceRemoveControl, mceHelp or mceFocus.
*
* <span class="attrib">@param</span> {string} command Command name to execute, for example mceLink or Bold.
* <span class="attrib">@param</span> {boolean} user_interface True/false state if a UI (dialog) should be presented or not.
* <span class="attrib">@param</span> {object} value Optional command value, this can be anything.
*/</span>
execCommand : <span class="reserved">function</span>(command, user_interface, value) {
<span class="comment">// Default input</span>
user_interface = user_interface ? user_interface : false;
value = value ? value : null;
<span class="reserved">if</span> (tinyMCE.selectedInstance)
tinyMCE.selectedInstance.switchSettings();
switch (command) {
case <span class="literal">'mceHelp'</span>:
tinyMCE.openWindow({
file : <span class="literal">'about.htm'</span>,
width : 480,
height : 380
}, {
tinymce_version : tinyMCE.majorVersion + <span class="literal">"."</span> + tinyMCE.minorVersion,
tinymce_releasedate : tinyMCE.releaseDate,
inline : <span class="literal">"yes"</span>
});
<span class="reserved">return</span>;
case <span class="literal">'mceFocus'</span>:
var inst = tinyMCE.getInstanceById(value);
<span class="reserved">if</span> (inst)
inst.contentWindow.focus();
<span class="reserved">return</span>;
case <span class="literal">"mceAddControl"</span>:
case <span class="literal">"mceAddEditor"</span>:
tinyMCE.addMCEControl(tinyMCE._getElementById(value), value);
<span class="reserved">return</span>;
case <span class="literal">"mceAddFrameControl"</span>:
tinyMCE.addMCEControl(tinyMCE._getElementById(value[<span class="literal">'element'</span>], value[<span class="literal">'document'</span>]), value[<span class="literal">'element'</span>], value[<span class="literal">'document'</span>]);
<span class="reserved">return</span>;
case <span class="literal">"mceRemoveControl"</span>:
case <span class="literal">"mceRemoveEditor"</span>:
tinyMCE.removeMCEControl(value);
<span class="reserved">return</span>;
case <span class="literal">"mceResetDesignMode"</span>:
<span class="comment">// Resets the designmode state of the editors in Gecko</span>
<span class="reserved">if</span> (!tinyMCE.isMSIE) {
<span class="reserved">for</span> (var n in tinyMCE.instances) {
<span class="reserved">if</span> (!tinyMCE.isInstance(tinyMCE.instances[n]))
continue;
try {
tinyMCE.instances[n].getDoc().designMode = <span class="literal">"on"</span>;
} catch (e) {
<span class="comment">// Ignore any errors</span>
}
}
}
<span class="reserved">return</span>;
}
<span class="reserved">if</span> (<span class="reserved">this</span>.selectedInstance) {
<span class="reserved">this</span>.selectedInstance.execCommand(command, user_interface, value);
} <span class="reserved">else</span> <span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'focus_alert'</span>])
alert(tinyMCELang[<span class="literal">'lang_focus_alert'</span>]);
},
<span class="comment">/**
* Creates a iframe editor container for the specified element.
*
* <span class="attrib">@param</span> {HTMLElement} replace_element Element to replace with iframe element.
* <span class="attrib">@param</span> {DOMDocument} doc Optional document to use with iframe replacement.
* <span class="attrib">@param</span> {DOMWindow} win Optional window to use with iframe replacement.
* <span class="attrib">@private</span>
*/</span>
_createIFrame : <span class="reserved">function</span>(replace_element, doc, win) {
var iframe, id = replace_element.getAttribute(<span class="literal">"id"</span>);
var aw, ah;
<span class="reserved">if</span> (typeof(doc) == <span class="literal">"undefined"</span>)
doc = document;
<span class="reserved">if</span> (typeof(win) == <span class="literal">"undefined"</span>)
win = window;
iframe = doc.createElement(<span class="literal">"iframe"</span>);
aw = <span class="literal">""</span> + tinyMCE.settings[<span class="literal">'area_width'</span>];
ah = <span class="literal">""</span> + tinyMCE.settings[<span class="literal">'area_height'</span>];
<span class="reserved">if</span> (aw.indexOf(<span class="literal">'%'</span>) == -1) {
aw = parseInt(aw);
aw = aw &lt; 0 ? 300 : aw;
aw = aw + <span class="literal">"px"</span>;
}
<span class="reserved">if</span> (ah.indexOf(<span class="literal">'%'</span>) == -1) {
ah = parseInt(ah);
ah = ah &lt; 0 ? 240 : ah;
ah = ah + <span class="literal">"px"</span>;
}
iframe.setAttribute(<span class="literal">"id"</span>, id);
iframe.setAttribute(<span class="literal">"className"</span>, <span class="literal">"mceEditorIframe"</span>);
iframe.setAttribute(<span class="literal">"border"</span>, <span class="literal">"0"</span>);
iframe.setAttribute(<span class="literal">"frameBorder"</span>, <span class="literal">"0"</span>);
iframe.setAttribute(<span class="literal">"marginWidth"</span>, <span class="literal">"0"</span>);
iframe.setAttribute(<span class="literal">"marginHeight"</span>, <span class="literal">"0"</span>);
iframe.setAttribute(<span class="literal">"leftMargin"</span>, <span class="literal">"0"</span>);
iframe.setAttribute(<span class="literal">"topMargin"</span>, <span class="literal">"0"</span>);
iframe.setAttribute(<span class="literal">"width"</span>, aw);
iframe.setAttribute(<span class="literal">"height"</span>, ah);
iframe.setAttribute(<span class="literal">"allowtransparency"</span>, <span class="literal">"true"</span>);
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">"auto_resize"</span>])
iframe.setAttribute(<span class="literal">"scrolling"</span>, <span class="literal">"no"</span>);
<span class="comment">// Must have a src element in MSIE HTTPs breaks aswell as absoute URLs</span>
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; !tinyMCE.isOpera)
iframe.setAttribute(<span class="literal">"src"</span>, <span class="reserved">this</span>.settings[<span class="literal">'default_document'</span>]);
iframe.style.width = aw;
iframe.style.height = ah;
<span class="comment">// MSIE 5.0 issue</span>
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; !tinyMCE.isOpera)
replace_element.outerHTML = iframe.outerHTML;
<span class="reserved">else</span>
replace_element.parentNode.replaceChild(iframe, replace_element);
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; !tinyMCE.isOpera)
<span class="reserved">return</span> win.frames[id];
<span class="reserved">else</span>
<span class="reserved">return</span> iframe;
},
<span class="comment">/**
* Setups the contents of TinyMCE editor instance and fills it with contents.
*
* <span class="attrib">@param</span> {string} editor_id TinyMCE editor instance control id to fill.
*/</span>
setupContent : <span class="reserved">function</span>(editor_id) {
var inst = tinyMCE.instances[editor_id];
var doc = inst.getDoc();
var head = doc.getElementsByTagName(<span class="literal">'head'</span>).item(0);
var content = inst.startContent;
inst.switchSettings();
<span class="comment">// Not loaded correctly hit it again, Mozilla bug #997860</span>
<span class="reserved">if</span> (!tinyMCE.isMSIE &amp;&amp; tinyMCE.getParam(<span class="literal">"setupcontent_reload"</span>, false) &amp;&amp; doc.title != <span class="literal">"blank_page"</span>) {
<span class="comment">// This part will remove the designMode status</span>
<span class="comment">// Failes first time in Firefox 1.5b2 on Mac</span>
try {doc.location.href = tinyMCE.baseURL + <span class="literal">"/blank.htm"</span>;} catch (ex) {}
window.setTimeout(<span class="literal">"tinyMCE.setupContent('"</span> + editor_id + <span class="literal">"');"</span>, 1000);
<span class="reserved">return</span>;
}
<span class="reserved">if</span> (!head) {
window.setTimeout(<span class="literal">"tinyMCE.setupContent('"</span> + editor_id + <span class="literal">"');"</span>, 10);
<span class="reserved">return</span>;
}
<span class="comment">// Import theme specific content CSS the user specific</span>
tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + <span class="literal">"/themes/"</span> + inst.settings[<span class="literal">'theme'</span>] + <span class="literal">"/css/editor_content.css"</span>);
tinyMCE.importCSS(inst.getDoc(), inst.settings[<span class="literal">'content_css'</span>]);
tinyMCE.dispatchCallback(inst, <span class="literal">'init_instance_callback'</span>, <span class="literal">'initInstance'</span>, inst);
<span class="comment">// Setup keyboard shortcuts</span>
<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">'custom_undo_redo_keyboard_shortcuts'</span>)) {
inst.addShortcut(<span class="literal">'ctrl'</span>, <span class="literal">'z'</span>, <span class="literal">'lang_undo_desc'</span>, <span class="literal">'Undo'</span>);
inst.addShortcut(<span class="literal">'ctrl'</span>, <span class="literal">'y'</span>, <span class="literal">'lang_redo_desc'</span>, <span class="literal">'Redo'</span>);
}
<span class="comment">// Add default shortcuts for gecko</span>
<span class="reserved">if</span> (tinyMCE.isGecko) {
inst.addShortcut(<span class="literal">'ctrl'</span>, <span class="literal">'b'</span>, <span class="literal">'lang_bold_desc'</span>, <span class="literal">'Bold'</span>);
inst.addShortcut(<span class="literal">'ctrl'</span>, <span class="literal">'i'</span>, <span class="literal">'lang_italic_desc'</span>, <span class="literal">'Italic'</span>);
inst.addShortcut(<span class="literal">'ctrl'</span>, <span class="literal">'u'</span>, <span class="literal">'lang_underline_desc'</span>, <span class="literal">'Underline'</span>);
}
<span class="comment">// Setup span styles</span>
<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">"convert_fonts_to_spans"</span>))
inst.getDoc().body.setAttribute(<span class="literal">'id'</span>, <span class="literal">'mceSpanFonts'</span>);
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'nowrap'</span>])
doc.body.style.whiteSpace = <span class="literal">"nowrap"</span>;
doc.body.dir = <span class="reserved">this</span>.settings[<span class="literal">'directionality'</span>];
doc.editorId = editor_id;
<span class="comment">// Add on document element in Mozilla</span>
<span class="reserved">if</span> (!tinyMCE.isMSIE)
doc.documentElement.editorId = editor_id;
inst.setBaseHREF(tinyMCE.settings[<span class="literal">'base_href'</span>]);
<span class="comment">// Replace new line characters to BRs</span>
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'convert_newlines_to_brs'</span>]) {
content = tinyMCE.regexpReplace(content, <span class="literal">"\r\n"</span>, <span class="literal">"&lt;br /&gt;"</span>, <span class="literal">"gi"</span>);
content = tinyMCE.regexpReplace(content, <span class="literal">"\r"</span>, <span class="literal">"&lt;br /&gt;"</span>, <span class="literal">"gi"</span>);
content = tinyMCE.regexpReplace(content, <span class="literal">"\n"</span>, <span class="literal">"&lt;br /&gt;"</span>, <span class="literal">"gi"</span>);
}
<span class="comment">// Open closed anchors</span>
<span class="comment">// content = content.replace(new RegExp('&lt;a(.*?)/&gt;', 'gi'), '&lt;a$1&gt;&lt;/a&gt;');</span>
<span class="comment">// Call custom cleanup code</span>
content = tinyMCE.storeAwayURLs(content);
content = tinyMCE._customCleanup(inst, <span class="literal">"insert_to_editor"</span>, content);
<span class="reserved">if</span> (tinyMCE.isMSIE) {
<span class="comment">// Ugly!!!</span>
window.setInterval(<span class="literal">'try{tinyMCE.getCSSClasses(tinyMCE.instances["'</span> + editor_id + <span class="literal">'"].getDoc(), "'</span> + editor_id + <span class="literal">'");}catch(e){}'</span>, 500);
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">"force_br_newlines"</span>])
doc.styleSheets[0].addRule(<span class="literal">"p"</span>, <span class="literal">"margin: 0;"</span>);
var body = inst.getBody();
body.editorId = editor_id;
}
content = tinyMCE.cleanupHTMLCode(content);
<span class="comment">// Fix for bug #958637</span>
<span class="reserved">if</span> (!tinyMCE.isMSIE) {
var contentElement = inst.getDoc().createElement(<span class="literal">"body"</span>);
var doc = inst.getDoc();
contentElement.innerHTML = content;
<span class="comment">// Remove weridness!</span>
<span class="reserved">if</span> (tinyMCE.isGecko &amp;&amp; tinyMCE.settings[<span class="literal">'remove_lt_gt'</span>])
content = content.replace(new RegExp(<span class="literal">'&amp;lt;&amp;gt;'</span>, <span class="literal">'g'</span>), <span class="literal">""</span>);
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'cleanup_on_startup'</span>])
tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, doc, <span class="reserved">this</span>.settings, contentElement));
<span class="reserved">else</span> {
<span class="comment">// Convert all strong/em to b/i</span>
content = tinyMCE.regexpReplace(content, <span class="literal">"&lt;strong"</span>, <span class="literal">"&lt;b"</span>, <span class="literal">"gi"</span>);
content = tinyMCE.regexpReplace(content, <span class="literal">"&lt;em(/?)&gt;"</span>, <span class="literal">"&lt;i$1&gt;"</span>, <span class="literal">"gi"</span>);
content = tinyMCE.regexpReplace(content, <span class="literal">"&lt;em "</span>, <span class="literal">"&lt;i "</span>, <span class="literal">"gi"</span>);
content = tinyMCE.regexpReplace(content, <span class="literal">"&lt;/strong&gt;"</span>, <span class="literal">"&lt;/b&gt;"</span>, <span class="literal">"gi"</span>);
content = tinyMCE.regexpReplace(content, <span class="literal">"&lt;/em&gt;"</span>, <span class="literal">"&lt;/i&gt;"</span>, <span class="literal">"gi"</span>);
tinyMCE.setInnerHTML(inst.getBody(), content);
}
tinyMCE.convertAllRelativeURLs(inst.getBody());
} <span class="reserved">else</span> {
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'cleanup_on_startup'</span>]) {
tinyMCE._setHTML(inst.getDoc(), content);
<span class="comment">// Produces permission denied error in MSIE 5.5</span>
eval(<span class="literal">'try {tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody()));} catch(e) {}'</span>);
} <span class="reserved">else</span>
tinyMCE._setHTML(inst.getDoc(), content);
}
<span class="comment">// Fix for bug #957681</span>
<span class="comment">//inst.getDoc().designMode = inst.getDoc().designMode;</span>
<span class="comment">// Setup element references</span>
var parentElm = inst.targetDoc.getElementById(inst.editorId + <span class="literal">'_parent'</span>);
inst.formElement = tinyMCE.isGecko ? parentElm.previousSibling : parentElm.nextSibling;
tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings[<span class="literal">'visual'</span>], inst);
tinyMCE.dispatchCallback(inst, <span class="literal">'setupcontent_callback'</span>, <span class="literal">'setupContent'</span>, editor_id, inst.getBody(), inst.getDoc());
<span class="comment">// Re-add design mode on mozilla</span>
<span class="reserved">if</span> (!tinyMCE.isMSIE)
tinyMCE.addEventHandlers(inst);
<span class="comment">// Add blur handler</span>
<span class="reserved">if</span> (tinyMCE.isMSIE) {
tinyMCE.addEvent(inst.getBody(), <span class="literal">"blur"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>._eventPatch);
tinyMCE.addEvent(inst.getBody(), <span class="literal">"beforedeactivate"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>._eventPatch); <span class="comment">// Bug #1439953</span>
<span class="comment">// Workaround for drag drop/copy paste base href bug</span>
<span class="reserved">if</span> (!tinyMCE.isOpera) {
tinyMCE.addEvent(doc.body, <span class="literal">"mousemove"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>.onMouseMove);
tinyMCE.addEvent(doc.body, <span class="literal">"beforepaste"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>._eventPatch);
tinyMCE.addEvent(doc.body, <span class="literal">"drop"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>._eventPatch);
}
}
<span class="comment">// Trigger node change, this call locks buttons for tables and so forth</span>
tinyMCE.selectedInstance = inst;
tinyMCE.selectedElement = inst.contentWindow.document.body;
<span class="comment">// Call custom DOM cleanup</span>
tinyMCE._customCleanup(inst, <span class="literal">"insert_to_editor_dom"</span>, inst.getBody());
tinyMCE._customCleanup(inst, <span class="literal">"setup_content_dom"</span>, inst.getBody());
tinyMCE._setEventsEnabled(inst.getBody(), false);
tinyMCE.cleanupAnchors(inst.getDoc());
<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">"convert_fonts_to_spans"</span>))
tinyMCE.convertSpansToFonts(inst.getDoc());
inst.startContent = tinyMCE.trim(inst.getBody().innerHTML);
inst.undoRedo.add({ content : inst.startContent });
<span class="comment">// Cleanup any mess left from storyAwayURLs</span>
<span class="reserved">if</span> (tinyMCE.isGecko) {
<span class="comment">// Remove mce_src from textnodes and comments</span>
tinyMCE.selectNodes(inst.getBody(), <span class="reserved">function</span>(n) {
<span class="reserved">if</span> (n.nodeType == 3 || n.nodeType == 8) {
n.nodeValue = n.nodeValue.replace(new RegExp(<span class="literal">'\\smce_src=\"[^\"]*\"'</span>, <span class="literal">'gi'</span>), <span class="literal">""</span>);
n.nodeValue = n.nodeValue.replace(new RegExp(<span class="literal">'\\smce_href=\"[^\"]*\"'</span>, <span class="literal">'gi'</span>), <span class="literal">""</span>);
}
<span class="reserved">return</span> false;
});
}
<span class="comment">// Cleanup any mess left from storyAwayURLs</span>
tinyMCE._removeInternal(inst.getBody());
tinyMCE.selectedInstance = inst;
tinyMCE.triggerNodeChange(false, true);
},
<span class="comment">/**
* Stores away the src and href attribute values in separate mce_src and mce_href attributes.
* This is needed since both MSIE and Gecko messes with these attributes. The old
* src and href will be intact, this simply adds them to a separate attribute.
*
* <span class="attrib">@param</span> {string} s HTML string to replace src and href attributes in.
* <span class="attrib">@return</span> HTML string with replaced src and href attributes.
* <span class="attrib">@type</span> string
*/</span>
storeAwayURLs : <span class="reserved">function</span>(s) {
<span class="comment">// Remove all mce_src, mce_href and replace them with new ones</span>
<span class="comment">// s = s.replace(new RegExp('mce_src\\s*=\\s*\"[^ &gt;\"]*\"', 'gi'), '');</span>
<span class="comment">// s = s.replace(new RegExp('mce_href\\s*=\\s*\"[^ &gt;\"]*\"', 'gi'), '');</span>
<span class="reserved">if</span> (!s.match(/(mce_src|mce_href)/gi, s)) {
s = s.replace(new RegExp(<span class="literal">'src\\s*=\\s*\"([^ &gt;\"]*)\"'</span>, <span class="literal">'gi'</span>), <span class="literal">'src="$1" mce_src="$1"'</span>);
s = s.replace(new RegExp(<span class="literal">'href\\s*=\\s*\"([^ &gt;\"]*)\"'</span>, <span class="literal">'gi'</span>), <span class="literal">'href="$1" mce_href="$1"'</span>);
}
<span class="reserved">return</span> s;
},
<span class="comment">/**
* Removes any internal content inserted by regexps.
*
* <span class="attrib">@param</span> {DOMNode} n Node to remove internal content from.
*/</span>
_removeInternal : <span class="reserved">function</span>(n) {
<span class="reserved">if</span> (tinyMCE.isGecko) {
<span class="comment">// Remove mce_src from textnodes and comments</span>
tinyMCE.selectNodes(n, <span class="reserved">function</span>(n) {
<span class="reserved">if</span> (n.nodeType == 3 || n.nodeType == 8) {
n.nodeValue = n.nodeValue.replace(new RegExp(<span class="literal">'\\smce_src=\"[^\"]*\"'</span>, <span class="literal">'gi'</span>), <span class="literal">""</span>);
n.nodeValue = n.nodeValue.replace(new RegExp(<span class="literal">'\\smce_href=\"[^\"]*\"'</span>, <span class="literal">'gi'</span>), <span class="literal">""</span>);
}
<span class="reserved">return</span> false;
});
}
},
<span class="comment">/**
* Removes/disables TinyMCE built in form elements such as select boxes for font sizes etc.
* These are disabled when the user submits a form so they don't get picked up by the backend script
* that intercepts the contents.
*
* <span class="attrib">@param</span> {HTMLElement} form_obj Form object to loop through for TinyMCE specific form elements.
*/</span>
removeTinyMCEFormElements : <span class="reserved">function</span>(form_obj) {
<span class="comment">// Check if form is valid</span>
<span class="reserved">if</span> (typeof(form_obj) == <span class="literal">"undefined"</span> || form_obj == null)
<span class="reserved">return</span>;
<span class="comment">// If not a form, find the form</span>
<span class="reserved">if</span> (form_obj.nodeName != <span class="literal">"FORM"</span>) {
<span class="reserved">if</span> (form_obj.form)
form_obj = form_obj.form;
<span class="reserved">else</span>
form_obj = tinyMCE.getParentElement(form_obj, <span class="literal">"form"</span>);
}
<span class="comment">// Still nothing</span>
<span class="reserved">if</span> (form_obj == null)
<span class="reserved">return</span>;
<span class="comment">// Disable all UI form elements that TinyMCE created</span>
<span class="reserved">for</span> (var i=0; i&lt;form_obj.elements.length; i++) {
var elementId = form_obj.elements[i].name ? form_obj.elements[i].name : form_obj.elements[i].id;
<span class="reserved">if</span> (elementId.indexOf(<span class="literal">'mce_editor_'</span>) == 0)
form_obj.elements[i].disabled = true;
}
},
<span class="comment">/**
* Event handler function that gets executed each time a event occurs in a TinyMCE editor control instance.
* Todo: Fix the return statements so they return true or false.
*
* <span class="attrib">@param</span> {DOMEvent} e DOM event object reference.
* <span class="attrib">@return</span> true - if the event is to be chained, false - if the event chain is to be canceled.
* <span class="attrib">@type</span> boolean
*/</span>
handleEvent : <span class="reserved">function</span>(e) {
var inst = tinyMCE.selectedInstance;
<span class="comment">// Remove odd, error</span>
<span class="reserved">if</span> (typeof(tinyMCE) == <span class="literal">"undefined"</span>)
<span class="reserved">return</span> true;
<span class="comment">//tinyMCE.debug(e.type + " " + e.target.nodeName + " " + (e.relatedTarget ? e.relatedTarget.nodeName : ""));</span>
<span class="reserved">if</span> (tinyMCE.executeCallback(tinyMCE.selectedInstance, <span class="literal">'handle_event_callback'</span>, <span class="literal">'handleEvent'</span>, e))
<span class="reserved">return</span> false;
switch (e.type) {
case <span class="literal">"beforedeactivate"</span>: <span class="comment">// Was added due to bug #1439953</span>
case <span class="literal">"blur"</span>:
<span class="reserved">if</span> (tinyMCE.selectedInstance)
tinyMCE.selectedInstance.execCommand(<span class="literal">'mceEndTyping'</span>);
tinyMCE.hideMenus();
<span class="reserved">return</span>;
<span class="comment">// Workaround for drag drop/copy paste base href bug</span>
case <span class="literal">"drop"</span>:
case <span class="literal">"beforepaste"</span>:
<span class="reserved">if</span> (tinyMCE.selectedInstance)
tinyMCE.selectedInstance.setBaseHREF(null);
window.setTimeout(<span class="literal">"tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings['base_href']);"</span>, 1);
<span class="reserved">return</span>;
case <span class="literal">"submit"</span>:
tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE ? window.event.srcElement : e.target);
tinyMCE.triggerSave();
tinyMCE.isNotDirty = true;
<span class="reserved">return</span>;
case <span class="literal">"reset"</span>:
var formObj = tinyMCE.isMSIE ? window.event.srcElement : e.target;
<span class="reserved">for</span> (var i=0; i&lt;document.forms.length; i++) {
<span class="reserved">if</span> (document.forms[i] == formObj)
window.setTimeout(<span class="literal">'tinyMCE.resetForm('</span> + i + <span class="literal">');'</span>, 10);
}
<span class="reserved">return</span>;
case <span class="literal">"keypress"</span>:
<span class="reserved">if</span> (inst &amp;&amp; inst.handleShortcut(e))
<span class="reserved">return</span> false;
<span class="reserved">if</span> (e.target.editorId) {
tinyMCE.selectedInstance = tinyMCE.instances[e.target.editorId];
} <span class="reserved">else</span> {
<span class="reserved">if</span> (e.target.ownerDocument.editorId)
tinyMCE.selectedInstance = tinyMCE.instances[e.target.ownerDocument.editorId];
}
<span class="reserved">if</span> (tinyMCE.selectedInstance)
tinyMCE.selectedInstance.switchSettings();
<span class="comment">// Insert P element</span>
<span class="reserved">if</span> (tinyMCE.isGecko &amp;&amp; tinyMCE.settings[<span class="literal">'force_p_newlines'</span>] &amp;&amp; e.keyCode == 13 &amp;&amp; !e.shiftKey) {
<span class="comment">// Insert P element instead of BR</span>
<span class="reserved">if</span> (TinyMCE_ForceParagraphs._insertPara(tinyMCE.selectedInstance, e)) {
<span class="comment">// Cancel event</span>
tinyMCE.execCommand(<span class="literal">"mceAddUndoLevel"</span>);
tinyMCE.cancelEvent(e);
<span class="reserved">return</span> false;
}
}
<span class="comment">// Handle backspace</span>
<span class="reserved">if</span> (tinyMCE.isGecko &amp;&amp; tinyMCE.settings[<span class="literal">'force_p_newlines'</span>] &amp;&amp; (e.keyCode == 8 || e.keyCode == 46) &amp;&amp; !e.shiftKey) {
<span class="comment">// Insert P element instead of BR</span>
<span class="reserved">if</span> (TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance, e.type)) {
<span class="comment">// Cancel event</span>
tinyMCE.execCommand(<span class="literal">"mceAddUndoLevel"</span>);
tinyMCE.cancelEvent(e);
<span class="reserved">return</span> false;
}
}
<span class="comment">// Return key pressed</span>
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; tinyMCE.settings[<span class="literal">'force_br_newlines'</span>] &amp;&amp; e.keyCode == 13) {
<span class="reserved">if</span> (e.target.editorId)
tinyMCE.selectedInstance = tinyMCE.instances[e.target.editorId];
<span class="reserved">if</span> (tinyMCE.selectedInstance) {
var sel = tinyMCE.selectedInstance.getDoc().selection;
var rng = sel.createRange();
<span class="reserved">if</span> (tinyMCE.getParentElement(rng.parentElement(), <span class="literal">"li"</span>) != null)
<span class="reserved">return</span> false;
<span class="comment">// Cancel event</span>
e.returnValue = false;
e.cancelBubble = true;
<span class="comment">// Insert BR element</span>
rng.pasteHTML(<span class="literal">"&lt;br /&gt;"</span>);
rng.collapse(false);
rng.select();
tinyMCE.execCommand(<span class="literal">"mceAddUndoLevel"</span>);
tinyMCE.triggerNodeChange(false);
<span class="reserved">return</span> false;
}
}
<span class="comment">// Backspace or delete</span>
<span class="reserved">if</span> (e.keyCode == 8 || e.keyCode == 46) {
tinyMCE.selectedElement = e.target;
tinyMCE.linkElement = tinyMCE.getParentElement(e.target, <span class="literal">"a"</span>);
tinyMCE.imgElement = tinyMCE.getParentElement(e.target, <span class="literal">"img"</span>);
tinyMCE.triggerNodeChange(false);
}
<span class="reserved">return</span> false;
break;
case <span class="literal">"keyup"</span>:
case <span class="literal">"keydown"</span>:
tinyMCE.hideMenus();
tinyMCE.hasMouseMoved = false;
<span class="reserved">if</span> (inst &amp;&amp; inst.handleShortcut(e))
<span class="reserved">return</span> false;
<span class="reserved">if</span> (e.target.editorId)
tinyMCE.selectedInstance = tinyMCE.instances[e.target.editorId];
<span class="reserved">else</span>
<span class="reserved">return</span>;
<span class="reserved">if</span> (tinyMCE.selectedInstance)
tinyMCE.selectedInstance.switchSettings();
var inst = tinyMCE.selectedInstance;
<span class="comment">// Handle backspace</span>
<span class="reserved">if</span> (tinyMCE.isGecko &amp;&amp; tinyMCE.settings[<span class="literal">'force_p_newlines'</span>] &amp;&amp; (e.keyCode == 8 || e.keyCode == 46) &amp;&amp; !e.shiftKey) {
<span class="comment">// Insert P element instead of BR</span>
<span class="reserved">if</span> (TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance, e.type)) {
<span class="comment">// Cancel event</span>
tinyMCE.execCommand(<span class="literal">"mceAddUndoLevel"</span>);
e.preventDefault();
<span class="reserved">return</span> false;
}
}
tinyMCE.selectedElement = null;
tinyMCE.selectedNode = null;
var elm = tinyMCE.selectedInstance.getFocusElement();
tinyMCE.linkElement = tinyMCE.getParentElement(elm, <span class="literal">"a"</span>);
tinyMCE.imgElement = tinyMCE.getParentElement(elm, <span class="literal">"img"</span>);
tinyMCE.selectedElement = elm;
<span class="comment">// Update visualaids on tabs</span>
<span class="reserved">if</span> (tinyMCE.isGecko &amp;&amp; e.type == <span class="literal">"keyup"</span> &amp;&amp; e.keyCode == 9)
tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(), true, tinyMCE.settings[<span class="literal">'visual'</span>], tinyMCE.selectedInstance);
<span class="comment">// Fix empty elements on return/enter, check where enter occured</span>
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; e.type == <span class="literal">"keydown"</span> &amp;&amp; e.keyCode == 13)
tinyMCE.enterKeyElement = tinyMCE.selectedInstance.getFocusElement();
<span class="comment">// Fix empty elements on return/enter</span>
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; e.type == <span class="literal">"keyup"</span> &amp;&amp; e.keyCode == 13) {
var elm = tinyMCE.enterKeyElement;
<span class="reserved">if</span> (elm) {
var re = new RegExp(<span class="literal">'^HR|IMG|BR$'</span>,<span class="literal">'g'</span>); <span class="comment">// Skip these</span>
var dre = new RegExp(<span class="literal">'^H[1-6]$'</span>,<span class="literal">'g'</span>); <span class="comment">// Add double on these</span>
<span class="reserved">if</span> (!elm.hasChildNodes() &amp;&amp; !re.test(elm.nodeName)) {
<span class="reserved">if</span> (dre.test(elm.nodeName))
elm.innerHTML = <span class="literal">"&amp;nbsp;&amp;nbsp;"</span>;
<span class="reserved">else</span>
elm.innerHTML = <span class="literal">"&amp;nbsp;"</span>;
}
}
}
<span class="comment">// Check if it's a position key</span>
var keys = tinyMCE.posKeyCodes;
var posKey = false;
<span class="reserved">for</span> (var i=0; i&lt;keys.length; i++) {
<span class="reserved">if</span> (keys[i] == e.keyCode) {
posKey = true;
break;
}
}
<span class="comment">// MSIE custom key handling</span>
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; tinyMCE.settings[<span class="literal">'custom_undo_redo'</span>]) {
var keys = new Array(8,46); <span class="comment">// Backspace,Delete</span>
<span class="reserved">for</span> (var i=0; i&lt;keys.length; i++) {
<span class="reserved">if</span> (keys[i] == e.keyCode) {
<span class="reserved">if</span> (e.type == <span class="literal">"keyup"</span>)
tinyMCE.triggerNodeChange(false);
}
}
}
<span class="comment">// If Ctrl key</span>
<span class="reserved">if</span> (e.keyCode == 17)
<span class="reserved">return</span> true;
<span class="comment">// Handle Undo/Redo when typing content</span>
<span class="comment">// Start typing (non position key)</span>
<span class="reserved">if</span> (!posKey &amp;&amp; e.type == <span class="literal">"keyup"</span>)
tinyMCE.execCommand(<span class="literal">"mceStartTyping"</span>);
<span class="comment">// Store undo bookmark</span>
<span class="reserved">if</span> (e.type == <span class="literal">"keydown"</span> &amp;&amp; (posKey || e.ctrlKey) &amp;&amp; inst)
inst.undoBookmark = inst.selection.getBookmark();
<span class="comment">// End typing (position key) or some Ctrl event</span>
<span class="reserved">if</span> (e.type == <span class="literal">"keyup"</span> &amp;&amp; (posKey || e.ctrlKey))
tinyMCE.execCommand(<span class="literal">"mceEndTyping"</span>);
<span class="reserved">if</span> (posKey &amp;&amp; e.type == <span class="literal">"keyup"</span>)
tinyMCE.triggerNodeChange(false);
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; e.ctrlKey)
window.setTimeout(<span class="literal">'tinyMCE.triggerNodeChange(false);'</span>, 1);
break;
case <span class="literal">"mousedown"</span>:
case <span class="literal">"mouseup"</span>:
case <span class="literal">"click"</span>:
case <span class="literal">"focus"</span>:
tinyMCE.hideMenus();
<span class="reserved">if</span> (tinyMCE.selectedInstance) {
tinyMCE.selectedInstance.switchSettings();
tinyMCE.selectedInstance.isFocused = true;
}
<span class="comment">// Check instance event trigged on</span>
var targetBody = tinyMCE.getParentElement(e.target, <span class="literal">"body"</span>);
<span class="reserved">for</span> (var instanceName in tinyMCE.instances) {
<span class="reserved">if</span> (!tinyMCE.isInstance(tinyMCE.instances[instanceName]))
continue;
var inst = tinyMCE.instances[instanceName];
<span class="comment">// Reset design mode if lost (on everything just in case)</span>
inst.autoResetDesignMode();
<span class="reserved">if</span> (inst.getBody() == targetBody) {
tinyMCE.selectedInstance = inst;
tinyMCE.selectedElement = e.target;
tinyMCE.linkElement = tinyMCE.getParentElement(tinyMCE.selectedElement, <span class="literal">"a"</span>);
tinyMCE.imgElement = tinyMCE.getParentElement(tinyMCE.selectedElement, <span class="literal">"img"</span>);
break;
}
}
<span class="comment">// Add first bookmark location</span>
<span class="reserved">if</span> (!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark)
tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark = tinyMCE.selectedInstance.selection.getBookmark();
<span class="reserved">if</span> (tinyMCE.isSafari) {
tinyMCE.selectedInstance.lastSafariSelection = tinyMCE.selectedInstance.selection.getBookmark();
tinyMCE.selectedInstance.lastSafariSelectedElement = tinyMCE.selectedElement;
var lnk = tinyMCE.getParentElement(tinyMCE.selectedElement, <span class="literal">"a"</span>);
<span class="comment">// Patch the darned link</span>
<span class="reserved">if</span> (lnk &amp;&amp; e.type == <span class="literal">"mousedown"</span>) {
lnk.setAttribute(<span class="literal">"mce_real_href"</span>, lnk.getAttribute(<span class="literal">"href"</span>));
lnk.setAttribute(<span class="literal">"href"</span>, <span class="literal">"javascript:void(0);"</span>);
}
<span class="comment">// Patch back</span>
<span class="reserved">if</span> (lnk &amp;&amp; e.type == <span class="literal">"click"</span>) {
window.setTimeout(<span class="reserved">function</span>() {
lnk.setAttribute(<span class="literal">"href"</span>, lnk.getAttribute(<span class="literal">"mce_real_href"</span>));
lnk.removeAttribute(<span class="literal">"mce_real_href"</span>);
}, 10);
}
}
<span class="comment">// Reset selected node</span>
<span class="reserved">if</span> (e.type != <span class="literal">"focus"</span>)
tinyMCE.selectedNode = null;
tinyMCE.triggerNodeChange(false);
tinyMCE.execCommand(<span class="literal">"mceEndTyping"</span>);
<span class="reserved">if</span> (e.type == <span class="literal">"mouseup"</span>)
tinyMCE.execCommand(<span class="literal">"mceAddUndoLevel"</span>);
<span class="comment">// Just in case</span>
<span class="reserved">if</span> (!tinyMCE.selectedInstance &amp;&amp; e.target.editorId)
tinyMCE.selectedInstance = tinyMCE.instances[e.target.editorId];
<span class="reserved">return</span> false;
break;
}
},
<span class="comment">/**
* Returns the HTML code for a normal button control.
*
* <span class="attrib">@param</span> {string} id Button control id, this will be the suffix for the element id, the prefix is the editor id.
* <span class="attrib">@param</span> {string} lang Language variable key name to insert as the title/alt of the button image.
* <span class="attrib">@param</span> {string} img Image URL to insert, {$themeurl} and {$pluginurl} will be replaced.
* <span class="attrib">@param</span> {string} cmd Command to execute when the user clicks the button.
* <span class="attrib">@param</span> {string} ui Optional user interface boolean for command.
* <span class="attrib">@param</span> {string} val Optional value for command.
* <span class="attrib">@return</span> HTML code for a normal button based in input information.
* <span class="attrib">@type</span> string
*/</span>
getButtonHTML : <span class="reserved">function</span>(id, lang, img, cmd, ui, val) {
var h = <span class="literal">''</span>, m, x;
cmd = <span class="literal">'tinyMCE.execInstanceCommand(\'</span>{$editor_id}\<span class="literal">',\'</span><span class="literal">' + cmd + '</span>\<span class="literal">''</span>;
<span class="reserved">if</span> (typeof(ui) != <span class="literal">"undefined"</span> &amp;&amp; ui != null)
cmd += <span class="literal">','</span> + ui;
<span class="reserved">if</span> (typeof(val) != <span class="literal">"undefined"</span> &amp;&amp; val != null)
cmd += <span class="literal">",'"</span> + val + <span class="literal">"'"</span>;
cmd += <span class="literal">');'</span>;
<span class="comment">// Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled</span>
<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">'button_tile_map'</span>) &amp;&amp; (!tinyMCE.isMSIE || tinyMCE.isOpera) &amp;&amp; (m = <span class="reserved">this</span>.buttonMap[id]) != null &amp;&amp; (tinyMCE.getParam(<span class="literal">"language"</span>) == <span class="literal">"en"</span> || img.indexOf(<span class="literal">'$lang'</span>) == -1)) {
<span class="comment">// Tiled button</span>
x = 0 - (m * 20) == 0 ? <span class="literal">'0'</span> : 0 - (m * 20);
h += <span class="literal">'&lt;a id="{$editor_id}_'</span> + id + <span class="literal">'" href="javascript:'</span> + cmd + <span class="literal">'" onclick="'</span> + cmd + <span class="literal">'return false;" onmousedown="return false;" class="mceTiledButton mceButtonNormal" target="_self"&gt;'</span>;
h += <span class="literal">'&lt;img src="{$themeurl}/images/spacer.gif" style="background-position: '</span> + x + <span class="literal">'px 0" title="{$'</span> + lang + <span class="literal">'}" /&gt;'</span>;
h += <span class="literal">'&lt;/a&gt;'</span>;
} <span class="reserved">else</span> {
<span class="comment">// Normal button</span>
h += <span class="literal">'&lt;a id="{$editor_id}_'</span> + id + <span class="literal">'" href="javascript:'</span> + cmd + <span class="literal">'" onclick="'</span> + cmd + <span class="literal">'return false;" onmousedown="return false;" class="mceButtonNormal" target="_self"&gt;'</span>;
h += <span class="literal">'&lt;img src="'</span> + img + <span class="literal">'" title="{$'</span> + lang + <span class="literal">'}" /&gt;'</span>;
h += <span class="literal">'&lt;/a&gt;'</span>;
}
<span class="reserved">return</span> h;
},
<span class="comment">/**
* Adds a list of buttons available in the tiled button image used by the button_tile_map option.
*
* <span class="attrib">@param</span> {string} m Comma separated list of buttons that are available in tiled image.
*/</span>
addButtonMap : <span class="reserved">function</span>(m) {
var i, a = m.replace(/\s+/, <span class="literal">''</span>).split(<span class="literal">','</span>);
<span class="reserved">for</span> (i=0; i&lt;a.length; i++)
<span class="reserved">this</span>.buttonMap[a[i]] = i;
},
<span class="comment">/**
* Piggyback onsubmit event handler function, this will remove/hide the TinyMCE specific form elements
* call triggerSave to fill the textarea with the correct contents then call the old piggy backed event handler.
*/</span>
submitPatch : <span class="reserved">function</span>() {
tinyMCE.removeTinyMCEFormElements(<span class="reserved">this</span>);
tinyMCE.triggerSave();
<span class="reserved">this</span>.mceOldSubmit();
tinyMCE.isNotDirty = true;
},
<span class="comment">/**
* Gets executed when the page loads or get intitialized. This function will then convert all textareas/divs that
* is to be converted into TinyMCE editor controls.
*
* <span class="attrib">@return</span> true - if the event is to be chained, false - if the event chain is to be canceled.
* <span class="attrib">@type</span> boolean
*/</span>
onLoad : <span class="reserved">function</span>() {
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; !tinyMCE.isOpera &amp;&amp; window.event.type == <span class="literal">"readystatechange"</span> &amp;&amp; document.readyState != <span class="literal">"complete"</span>)
<span class="reserved">return</span> true;
<span class="reserved">if</span> (tinyMCE.isLoaded)
<span class="reserved">return</span> true;
tinyMCE.isLoaded = true;
tinyMCE.dispatchCallback(null, <span class="literal">'onpageload'</span>, <span class="literal">'onPageLoad'</span>);
<span class="reserved">for</span> (var c=0; c&lt;tinyMCE.configs.length; c++) {
tinyMCE.settings = tinyMCE.configs[c];
var selector = tinyMCE.getParam(<span class="literal">"editor_selector"</span>);
var deselector = tinyMCE.getParam(<span class="literal">"editor_deselector"</span>);
var elementRefAr = new Array();
<span class="comment">// Add submit triggers</span>
<span class="reserved">if</span> (document.forms &amp;&amp; tinyMCE.settings[<span class="literal">'add_form_submit_trigger'</span>] &amp;&amp; !tinyMCE.submitTriggers) {
<span class="reserved">for</span> (var i=0; i&lt;document.forms.length; i++) {
var form = document.forms[i];
tinyMCE.addEvent(form, <span class="literal">"submit"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>.handleEvent);
tinyMCE.addEvent(form, <span class="literal">"reset"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>.handleEvent);
tinyMCE.submitTriggers = true; <span class="comment">// Do it only once</span>
<span class="comment">// Patch the form.submit function</span>
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'submit_patch'</span>]) {
try {
form.mceOldSubmit = form.submit;
form.submit = TinyMCE_Engine.<span class="reserved">prototype</span>.submitPatch;
} catch (e) {
<span class="comment">// Do nothing</span>
}
}
}
}
<span class="comment">// Add editor instances based on mode</span>
var mode = tinyMCE.settings[<span class="literal">'mode'</span>];
switch (mode) {
case <span class="literal">"exact"</span>:
var elements = tinyMCE.getParam(<span class="literal">'elements'</span>, <span class="literal">''</span>, true, <span class="literal">','</span>);
<span class="reserved">for</span> (var i=0; i&lt;elements.length; i++) {
var element = tinyMCE._getElementById(elements[i]);
var trigger = element ? element.getAttribute(tinyMCE.settings[<span class="literal">'textarea_trigger'</span>]) : <span class="literal">""</span>;
<span class="reserved">if</span> (tinyMCE.getAttrib(element, <span class="literal">"class"</span>).indexOf(deselector) != -1)
continue;
<span class="reserved">if</span> (trigger == <span class="literal">"false"</span>)
continue;
<span class="reserved">if</span> ((tinyMCE.settings[<span class="literal">'ask'</span>] || tinyMCE.settings[<span class="literal">'convert_on_click'</span>]) &amp;&amp; element) {
elementRefAr[elementRefAr.length] = element;
continue;
}
<span class="reserved">if</span> (element)
tinyMCE.addMCEControl(element, elements[i]);
<span class="reserved">else</span> <span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'debug'</span>])
alert(<span class="literal">"Error: Could not find element by id or name: "</span> + elements[i]);
}
break;
case <span class="literal">"specific_textareas"</span>:
case <span class="literal">"textareas"</span>:
var nodeList = document.getElementsByTagName(<span class="literal">"textarea"</span>);
<span class="reserved">for</span> (var i=0; i&lt;nodeList.length; i++) {
var elm = nodeList.item(i);
var trigger = elm.getAttribute(tinyMCE.settings[<span class="literal">'textarea_trigger'</span>]);
<span class="reserved">if</span> (selector != <span class="literal">''</span> &amp;&amp; tinyMCE.getAttrib(elm, <span class="literal">"class"</span>).indexOf(selector) == -1)
continue;
<span class="reserved">if</span> (selector != <span class="literal">''</span>)
trigger = selector != <span class="literal">""</span> ? <span class="literal">"true"</span> : <span class="literal">""</span>;
<span class="reserved">if</span> (tinyMCE.getAttrib(elm, <span class="literal">"class"</span>).indexOf(deselector) != -1)
continue;
<span class="reserved">if</span> ((mode == <span class="literal">"specific_textareas"</span> &amp;&amp; trigger == <span class="literal">"true"</span>) || (mode == <span class="literal">"textareas"</span> &amp;&amp; trigger != <span class="literal">"false"</span>))
elementRefAr[elementRefAr.length] = elm;
}
break;
}
<span class="reserved">for</span> (var i=0; i&lt;elementRefAr.length; i++) {
var element = elementRefAr[i];
var elementId = element.name ? element.name : element.id;
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'ask'</span>] || tinyMCE.settings[<span class="literal">'convert_on_click'</span>]) {
<span class="comment">// Focus breaks in Mozilla</span>
<span class="reserved">if</span> (tinyMCE.isGecko) {
var settings = tinyMCE.settings;
tinyMCE.addEvent(element, <span class="literal">"focus"</span>, <span class="reserved">function</span> (e) {window.setTimeout(<span class="reserved">function</span>() {TinyMCE_Engine.<span class="reserved">prototype</span>.confirmAdd(e, settings);}, 10);});
<span class="reserved">if</span> (element.nodeName != <span class="literal">"TEXTAREA"</span> &amp;&amp; element.nodeName != <span class="literal">"INPUT"</span>)
tinyMCE.addEvent(element, <span class="literal">"click"</span>, <span class="reserved">function</span> (e) {window.setTimeout(<span class="reserved">function</span>() {TinyMCE_Engine.<span class="reserved">prototype</span>.confirmAdd(e, settings);}, 10);});
<span class="comment">// tinyMCE.addEvent(element, "mouseover", function (e) {window.setTimeout(function() {TinyMCE_Engine.prototype.confirmAdd(e, settings);}, 10);});</span>
} <span class="reserved">else</span> {
var settings = tinyMCE.settings;
tinyMCE.addEvent(element, <span class="literal">"focus"</span>, <span class="reserved">function</span> () { TinyMCE_Engine.<span class="reserved">prototype</span>.confirmAdd(null, settings); });
tinyMCE.addEvent(element, <span class="literal">"click"</span>, <span class="reserved">function</span> () { TinyMCE_Engine.<span class="reserved">prototype</span>.confirmAdd(null, settings); });
<span class="comment">// tinyMCE.addEvent(element, "mouseenter", function () { TinyMCE_Engine.prototype.confirmAdd(null, settings); });</span>
}
} <span class="reserved">else</span>
tinyMCE.addMCEControl(element, elementId);
}
<span class="comment">// Handle auto focus</span>
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'auto_focus'</span>]) {
window.setTimeout(<span class="reserved">function</span> () {
var inst = tinyMCE.getInstanceById(tinyMCE.settings[<span class="literal">'auto_focus'</span>]);
inst.selection.selectNode(inst.getBody(), true, true);
inst.contentWindow.focus();
}, 10);
}
tinyMCE.dispatchCallback(null, <span class="literal">'oninit'</span>, <span class="literal">'onInit'</span>);
}
},
<span class="comment">/**
* Returns true/false if a specific object is a TinyMCE_Control instance or not.
*
* <span class="attrib">@param</span> {object} o Object to check.
* <span class="attrib">@return</span> true/false if it's a control or not.
* <span class="attrib">@type</span> boolean
*/</span>
isInstance : <span class="reserved">function</span>(o) {
<span class="reserved">return</span> o != null &amp;&amp; typeof(o) == <span class="literal">"object"</span> &amp;&amp; o.isTinyMCE_Control;
},
<span class="comment">/**
* Returns a specific configuration setting or the default value if it wasn't found.
*
* <span class="attrib">@param</span> {string} name Configuration setting to get.
* <span class="attrib">@param</span> {string} default_value Default value to return if it wasn't found.
* <span class="attrib">@param</span> {boolean} strip_whitespace Optional remove all whitespace.
* <span class="attrib">@param</span> {string} split_chr Split char/regex/string.
* <span class="attrib">@return</span> Number, string or other object based in parameter and default_value.
* <span class="attrib">@type</span> object
*/</span>
getParam : <span class="reserved">function</span>(name, default_value, strip_whitespace, split_chr) {
var value = (typeof(<span class="reserved">this</span>.settings[name]) == <span class="literal">"undefined"</span>) ? default_value : <span class="reserved">this</span>.settings[name];
<span class="comment">// Fix bool values</span>
<span class="reserved">if</span> (value == <span class="literal">"true"</span> || value == <span class="literal">"false"</span>)
<span class="reserved">return</span> (value == <span class="literal">"true"</span>);
<span class="reserved">if</span> (strip_whitespace)
value = tinyMCE.regexpReplace(value, <span class="literal">"[ \t\r\n]"</span>, <span class="literal">""</span>);
<span class="reserved">if</span> (typeof(split_chr) != <span class="literal">"undefined"</span> &amp;&amp; split_chr != null) {
value = value.split(split_chr);
var outArray = new Array();
<span class="reserved">for</span> (var i=0; i&lt;value.length; i++) {
<span class="reserved">if</span> (value[i] &amp;&amp; value[i] != <span class="literal">""</span>)
outArray[outArray.length] = value[i];
}
value = outArray;
}
<span class="reserved">return</span> value;
},
<span class="comment">/**
* Returns a language variable value from the language packs.
*
* <span class="attrib">@param</span> {string} name Name of the key to retrive.
* <span class="attrib">@param</span> {string} default_value Optional default value to return if it wasn't found.
* <span class="attrib">@param</span> {boolean} parse_entities Is HTML entities to be resolved or not.
* <span class="attrib">@param</span> {Array} va Optional name/value array of variables to replace in language string.
* <span class="attrib">@return</span> Language string value could be a number if it's a relative dimenstion.
* <span class="attrib">@type</span> object
*/</span>
getLang : <span class="reserved">function</span>(name, default_value, parse_entities, va) {
var v = (typeof(tinyMCELang[name]) == <span class="literal">"undefined"</span>) ? default_value : tinyMCELang[name], n;
<span class="reserved">if</span> (parse_entities)
v = tinyMCE.entityDecode(v);
<span class="reserved">if</span> (va) {
<span class="reserved">for</span> (n in va)
v = <span class="reserved">this</span>.replaceVar(v, n, va[n]);
}
<span class="reserved">return</span> v;
},
<span class="comment">/**
* HTML entity decode a string, replaces &amp;lt; with &lt;.
*
* <span class="attrib">@param</span> {string} s Entity string to decode into normal string.
* <span class="attrib">@return</span> Entity decoded string.
* <span class="attrib">@type</span> string
*/</span>
entityDecode : <span class="reserved">function</span>(s) {
var e = document.createElement(<span class="literal">"div"</span>);
e.innerHTML = s;
<span class="reserved">return</span> e.innerHTML;
},
<span class="comment">/**
* Adds language items to the global language array.
*
* <span class="attrib">@param</span> {string} prefix Prefix string to add infront of every array item before adding it.
* <span class="attrib">@param</span> {Array} ar Language item array to add to global language array.
*/</span>
addToLang : <span class="reserved">function</span>(prefix, ar) {
<span class="reserved">for</span> (var key in ar) {
<span class="reserved">if</span> (typeof(ar[key]) == <span class="literal">'function'</span>)
continue;
tinyMCELang[(key.indexOf(<span class="literal">'lang_'</span>) == -1 ? <span class="literal">'lang_'</span> : <span class="literal">''</span>) + (prefix != <span class="literal">''</span> ? (prefix + <span class="literal">"_"</span>) : <span class="literal">''</span>) + key] = ar[key];
}
<span class="comment">// for (var key in ar)</span>
<span class="comment">// tinyMCELang[(key.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix != '' ? (prefix + "_") : '') + key] = "|" + ar[key] + "|";</span>
},
<span class="comment">/**
* Triggers a nodeChange event to every theme and plugin. This will be executed when the cursor moves or
* when a command that modifies the editor contents is executed.
*
* <span class="attrib">@param</span> {boolean} focus Optional state if the last selected editor instance is to be focused or not.
* <span class="attrib">@param</span> {boolean} setup_content Optional state if it's called from setup content function or not.
*/</span>
triggerNodeChange : <span class="reserved">function</span>(focus, setup_content) {
<span class="reserved">if</span> (tinyMCE.selectedInstance) {
var inst = tinyMCE.selectedInstance;
var editorId = inst.editorId;
var elm = (typeof(setup_content) != <span class="literal">"undefined"</span> &amp;&amp; setup_content) ? tinyMCE.selectedElement : inst.getFocusElement();
var undoIndex = -1;
var undoLevels = -1;
var anySelection = false;
var selectedText = inst.selection.getSelectedText();
<span class="reserved">if</span> (setup_content &amp;&amp; tinyMCE.isGecko &amp;&amp; inst.isHidden())
elm = inst.getBody();
inst.switchSettings();
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">"auto_resize"</span>]) {
var doc = inst.getDoc();
inst.iframeElement.style.width = doc.body.offsetWidth + <span class="literal">"px"</span>;
inst.iframeElement.style.height = doc.body.offsetHeight + <span class="literal">"px"</span>;
}
<span class="reserved">if</span> (tinyMCE.selectedElement)
anySelection = (tinyMCE.selectedElement.nodeName.toLowerCase() == <span class="literal">"img"</span>) || (selectedText &amp;&amp; selectedText.length &gt; 0);
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'custom_undo_redo'</span>]) {
undoIndex = inst.undoRedo.undoIndex;
undoLevels = inst.undoRedo.undoLevels.length;
}
tinyMCE.dispatchCallback(inst, <span class="literal">'handle_node_change_callback'</span>, <span class="literal">'handleNodeChange'</span>, editorId, elm, undoIndex, undoLevels, inst.visualAid, anySelection, setup_content);
}
<span class="reserved">if</span> (<span class="reserved">this</span>.selectedInstance &amp;&amp; (typeof(focus) == <span class="literal">"undefined"</span> || focus))
<span class="reserved">this</span>.selectedInstance.contentWindow.focus();
},
<span class="comment">/**
* Executes the custom cleanup functions on the specified content.
*
* <span class="attrib">@param</span> {TinyMCE_Control} inst TinyMCE editor control instance.
* <span class="attrib">@param</span> {string} type Event type to call.
* <span class="attrib">@param</span> {object} content DOM element or string to pass to handlers depending on type.
* <span class="attrib">@return</span> string or DOM element depending on type.
* <span class="attrib">@private</span>
*/</span>
_customCleanup : <span class="reserved">function</span>(inst, type, content) {
var pl, po, i;
<span class="comment">// Call custom cleanup</span>
var customCleanup = tinyMCE.settings[<span class="literal">'cleanup_callback'</span>];
<span class="reserved">if</span> (customCleanup != <span class="literal">""</span> &amp;&amp; eval(<span class="literal">"typeof("</span> + customCleanup + <span class="literal">")"</span>) != <span class="literal">"undefined"</span>)
content = eval(customCleanup + <span class="literal">"(type, content, inst);"</span>);
<span class="comment">// Trigger plugin cleanups</span>
pl = inst.plugins;
<span class="reserved">for</span> (i=0; i&lt;pl.length; i++) {
po = tinyMCE.plugins[pl[i]];
<span class="reserved">if</span> (po &amp;&amp; po.cleanup)
content = po.cleanup(type, content, inst);
}
<span class="reserved">return</span> content;
},
<span class="comment">/**
* Sets the HTML contents of the selected editor instance.
*
* <span class="attrib">@param</span> {string} h HTML contents to set in the selected instance.
* <span class="attrib">@deprecated</span>
*/</span>
setContent : <span class="reserved">function</span>(h) {
<span class="reserved">if</span> (tinyMCE.selectedInstance) {
tinyMCE.selectedInstance.execCommand(<span class="literal">'mceSetContent'</span>, false, h);
tinyMCE.selectedInstance.repaint();
}
},
<span class="comment">/**
* Loads a theme specific language pack.
*
* <span class="attrib">@param</span> {string} name Optional name of the theme to load language pack from.
*/</span>
importThemeLanguagePack : <span class="reserved">function</span>(name) {
<span class="reserved">if</span> (typeof(name) == <span class="literal">"undefined"</span>)
name = tinyMCE.settings[<span class="literal">'theme'</span>];
tinyMCE.loadScript(tinyMCE.baseURL + <span class="literal">'/themes/'</span> + name + <span class="literal">'/langs/'</span> + tinyMCE.settings[<span class="literal">'language'</span>] + <span class="literal">'.js'</span>);
},
<span class="comment">/**
* Loads a plugin specific language pack.
*
* <span class="attrib">@param</span> {string} name Plugin name/id to load language pack for.
* <span class="attrib">@param</span> {string} valid_languages Comma separated list of valid languages for the plugin.
*/</span>
importPluginLanguagePack : <span class="reserved">function</span>(name, valid_languages) {
var lang = <span class="literal">"en"</span>, b = tinyMCE.baseURL + <span class="literal">'/plugins/'</span> + name;
valid_languages = valid_languages.split(<span class="literal">','</span>);
<span class="reserved">for</span> (var i=0; i&lt;valid_languages.length; i++) {
<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'language'</span>] == valid_languages[i])
lang = tinyMCE.settings[<span class="literal">'language'</span>];
}
<span class="reserved">if</span> (<span class="reserved">this</span>.plugins[name])
b = <span class="reserved">this</span>.plugins[name].baseURL;
tinyMCE.loadScript(b + <span class="literal">'/langs/'</span> + lang + <span class="literal">'.js'</span>);
},
<span class="comment">/**
* Replaces language, args and settings variables in a HTML string.
*
* <span class="attrib">@param</span> {string} h HTML string to replace language variables in.
* <span class="attrib">@param</span> {Array} as Optional arguments array to take variables from.
* <span class="attrib">@return</span> HTML string with replaced varliables.
* <span class="attrib">@type</span> string
*/</span>
applyTemplate : <span class="reserved">function</span>(h, as) {
var i, s, ar = h.match(new RegExp(<span class="literal">'\\{\\$[a-z0-9_]+\\}'</span>, <span class="literal">'gi'</span>));
<span class="reserved">if</span> (ar &amp;&amp; ar.length &gt; 0) {
<span class="reserved">for</span> (i=ar.length-1; i&gt;=0; i--) {
s = ar[i].substring(2, ar[i].length-1);
<span class="reserved">if</span> (s.indexOf(<span class="literal">'lang_'</span>) == 0 &amp;&amp; tinyMCELang[s])
h = tinyMCE.replaceVar(h, s, tinyMCELang[s]);
<span class="reserved">else</span> <span class="reserved">if</span> (as &amp;&amp; as[s])
h = tinyMCE.replaceVar(h, s, as[s]);
<span class="reserved">else</span> <span class="reserved">if</span> (tinyMCE.settings[s])
h = tinyMCE.replaceVar(h, s, tinyMCE.settings[s]);
}
}
h = tinyMCE.replaceVar(h, <span class="literal">"themeurl"</span>, tinyMCE.themeURL);
<span class="reserved">return</span> h;
},
<span class="comment">/**
* Replaces a specific variable in the string with a nother string.
*
* <span class="attrib">@param</span> {string} h String to search in for the variable.
* <span class="attrib">@param</span> {string} r Variable name to search for.
* <span class="attrib">@param</span> {string} v Value to insert where a variable is found.
* <span class="attrib">@return</span> String with replaced variable.
* <span class="attrib">@type</span> string
*/</span>
replaceVar : <span class="reserved">function</span>(h, r, v) {
<span class="reserved">return</span> h.replace(new RegExp(<span class="literal">'{\\\$'</span> + r + <span class="literal">'}'</span>, <span class="literal">'g'</span>), v);
},
<span class="comment">/**
* Opens a popup window based in the specified input data. This function
* is used for all popup windows in TinyMCE.
*
* These are the current template keys: file, width, height, close_previous.
*
* <span class="attrib">@param</span> {Array} template Popup template data such as with, height etc.
* <span class="attrib">@param</span> {Array} args Popup arguments that is to be passed to the popup such as custom data.
*/</span>
openWindow : <span class="reserved">function</span>(template, args) {
var html, width, height, x, y, resizable, scrollbars, url;
args[<span class="literal">'mce_template_file'</span>] = template[<span class="literal">'file'</span>];
args[<span class="literal">'mce_width'</span>] = template[<span class="literal">'width'</span>];
args[<span class="literal">'mce_height'</span>] = template[<span class="literal">'height'</span>];
tinyMCE.windowArgs = args;
html = template[<span class="literal">'html'</span>];
<span class="reserved">if</span> (!(width = parseInt(template[<span class="literal">'width'</span>])))
width = 320;
<span class="reserved">if</span> (!(height = parseInt(template[<span class="literal">'height'</span>])))
height = 200;
<span class="comment">// Add to height in M$ due to SP2 WHY DON'T YOU GUYS IMPLEMENT innerWidth of windows!!</span>
<span class="reserved">if</span> (tinyMCE.isMSIE)
height += 40;
<span class="reserved">else</span>
height += 20;
x = parseInt(screen.width / 2.0) - (width / 2.0);
y = parseInt(screen.height / 2.0) - (height / 2.0);
resizable = (args &amp;&amp; args[<span class="literal">'resizable'</span>]) ? args[<span class="literal">'resizable'</span>] : <span class="literal">"no"</span>;
scrollbars = (args &amp;&amp; args[<span class="literal">'scrollbars'</span>]) ? args[<span class="literal">'scrollbars'</span>] : <span class="literal">"no"</span>;
<span class="reserved">if</span> (template[<span class="literal">'file'</span>].charAt(0) != <span class="literal">'/'</span> &amp;&amp; template[<span class="literal">'file'</span>].indexOf(<span class="literal">'://'</span>) == -1)
url = tinyMCE.baseURL + <span class="literal">"/themes/"</span> + tinyMCE.getParam(<span class="literal">"theme"</span>) + <span class="literal">"/"</span> + template[<span class="literal">'file'</span>];
<span class="reserved">else</span>
url = template[<span class="literal">'file'</span>];
<span class="comment">// Replace all args as variables in URL</span>
<span class="reserved">for</span> (var name in args) {
<span class="reserved">if</span> (typeof(args[name]) == <span class="literal">'function'</span>)
continue;
url = tinyMCE.replaceVar(url, name, escape(args[name]));
}
<span class="reserved">if</span> (html) {
html = tinyMCE.replaceVar(html, <span class="literal">"css"</span>, <span class="reserved">this</span>.settings[<span class="literal">'popups_css'</span>]);
html = tinyMCE.applyTemplate(html, args);
var win = window.open(<span class="literal">""</span>, <span class="literal">"mcePopup"</span> + new Date().getTime(), <span class="literal">"top="</span> + y + <span class="literal">",left="</span> + x + <span class="literal">",scrollbars="</span> + scrollbars + <span class="literal">",dialog=yes,minimizable="</span> + resizable + <span class="literal">",modal=yes,width="</span> + width + <span class="literal">",height="</span> + height + <span class="literal">",resizable="</span> + resizable);
<span class="reserved">if</span> (win == null) {
alert(tinyMCELang[<span class="literal">'lang_popup_blocked'</span>]);
<span class="reserved">return</span>;
}
win.document.write(html);
win.document.close();
win.resizeTo(width, height);
win.focus();
} <span class="reserved">else</span> {
<span class="reserved">if</span> ((tinyMCE.isMSIE &amp;&amp; !tinyMCE.isOpera) &amp;&amp; resizable != <span class="literal">'yes'</span> &amp;&amp; tinyMCE.settings[<span class="literal">"dialog_type"</span>] == <span class="literal">"modal"</span>) {
height += 10;
var features = <span class="literal">"resizable:"</span> + resizable
+ <span class="literal">";scroll:"</span>
+ scrollbars + <span class="literal">";status:yes;center:yes;help:no;dialogWidth:"</span>
+ width + <span class="literal">"px;dialogHeight:"</span> + height + <span class="literal">"px;"</span>;
window.showModalDialog(url, window, features);
} <span class="reserved">else</span> {
var modal = (resizable == <span class="literal">"yes"</span>) ? <span class="literal">"no"</span> : <span class="literal">"yes"</span>;
<span class="reserved">if</span> (tinyMCE.isGecko &amp;&amp; tinyMCE.isMac)
modal = <span class="literal">"no"</span>;
<span class="reserved">if</span> (template[<span class="literal">'close_previous'</span>] != <span class="literal">"no"</span>)
try {tinyMCE.lastWindow.close();} catch (ex) {}
var win = window.open(url, <span class="literal">"mcePopup"</span> + new Date().getTime(), <span class="literal">"top="</span> + y + <span class="literal">",left="</span> + x + <span class="literal">",scrollbars="</span> + scrollbars + <span class="literal">",dialog="</span> + modal + <span class="literal">",minimizable="</span> + resizable + <span class="literal">",modal="</span> + modal + <span class="literal">",width="</span> + width + <span class="literal">",height="</span> + height + <span class="literal">",resizable="</span> + resizable);
<span class="reserved">if</span> (win == null) {
alert(tinyMCELang[<span class="literal">'lang_popup_blocked'</span>]);
<span class="reserved">return</span>;
}
<span class="reserved">if</span> (template[<span class="literal">'close_previous'</span>] != <span class="literal">"no"</span>)
tinyMCE.lastWindow = win;
eval(<span class="literal">'try { win.resizeTo(width, height); } catch(e) { }'</span>);
<span class="comment">// Make it bigger if statusbar is forced</span>
<span class="reserved">if</span> (tinyMCE.isGecko) {
<span class="reserved">if</span> (win.document.defaultView.statusbar.visible)
win.resizeBy(0, tinyMCE.isMac ? 10 : 24);
}
win.focus();
}
}
},
<span class="comment">/**
* Closes the specified window. This function is deprecated and should be replaced with
* tinyMCEPopup.close();.
*
* <span class="attrib">@param</span> {DOMWindow} win Window reference to close.
* <span class="attrib">@deprecated</span>
*/</span>
closeWindow : <span class="reserved">function</span>(win) {
win.close();
},
<span class="comment">/**
* Returns the visual aid class string, this will add/remove the visual aid class.
*
* <span class="attrib">@param</span> {string} class_name Class name value to add/remove visual aid classes from.
* <span class="attrib">@param</span> {boolean} state true/false if the classes should be added or removed.
* <span class="attrib">@return</span> New class value containing the visual aid classes or not.
* <span class="attrib">@type</span> string
*/</span>
getVisualAidClass : <span class="reserved">function</span>(class_name, state) {
var aidClass = tinyMCE.settings[<span class="literal">'visual_table_class'</span>];
<span class="reserved">if</span> (typeof(state) == <span class="literal">"undefined"</span>)
state = tinyMCE.settings[<span class="literal">'visual'</span>];
<span class="comment">// Split</span>
var classNames = new Array();
var ar = class_name.split(<span class="literal">' '</span>);
<span class="reserved">for</span> (var i=0; i&lt;ar.length; i++) {
<span class="reserved">if</span> (ar[i] == aidClass)
ar[i] = <span class="literal">""</span>;
<span class="reserved">if</span> (ar[i] != <span class="literal">""</span>)
classNames[classNames.length] = ar[i];
}
<span class="reserved">if</span> (state)
classNames[classNames.length] = aidClass;
<span class="comment">// Glue</span>
var className = <span class="literal">""</span>;
<span class="reserved">for</span> (var i=0; i&lt;classNames.length; i++) {
<span class="reserved">if</span> (i &gt; 0)
className += <span class="literal">" "</span>;
className += classNames[i];
}
<span class="reserved">return</span> className;
},
<span class="comment">/**
* Adds visual aid classes to all elements that need them recursive in the DOM tree.
*
* <span class="attrib">@param</span> {HTMLElement} el HTML element to add visual aid classes to.
* <span class="attrib">@param</span> {boolean} deep Should they be added to all children aswell.
* <span class="attrib">@param</span> {boolean} state Should they be added or removed.
* <span class="attrib">@param</span> {TinyMCE_Control} inst TinyMCE editor control instance to add/remove them to/from.
*/</span>
handleVisualAid : <span class="reserved">function</span>(el, deep, state, inst, skip_dispatch) {
<span class="reserved">if</span> (!el)
<span class="reserved">return</span>;
<span class="reserved">if</span> (!skip_dispatch)
tinyMCE.dispatchCallback(inst, <span class="literal">'handle_visual_aid_callback'</span>, <span class="literal">'handleVisualAid'</span>, el, deep, state, inst);
var tableElement = null;
switch (el.nodeName) {
case <span class="literal">"TABLE"</span>:
var oldW = el.style.width;
var oldH = el.style.height;
var bo = tinyMCE.getAttrib(el, <span class="literal">"border"</span>);
bo = bo == <span class="literal">""</span> || bo == <span class="literal">"0"</span> ? true : false;
tinyMCE.setAttrib(el, <span class="literal">"class"</span>, tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el, <span class="literal">"class"</span>), state &amp;&amp; bo));
el.style.width = oldW;
el.style.height = oldH;
<span class="reserved">for</span> (var y=0; y&lt;el.rows.length; y++) {
<span class="reserved">for</span> (var x=0; x&lt;el.rows[y].cells.length; x++) {
var cn = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x], <span class="literal">"class"</span>), state &amp;&amp; bo);
tinyMCE.setAttrib(el.rows[y].cells[x], <span class="literal">"class"</span>, cn);
}
}
break;
case <span class="literal">"A"</span>:
var anchorName = tinyMCE.getAttrib(el, <span class="literal">"name"</span>);
<span class="reserved">if</span> (anchorName != <span class="literal">''</span> &amp;&amp; state) {
el.title = anchorName;
el.className = <span class="literal">'mceItemAnchor'</span>;
} <span class="reserved">else</span> <span class="reserved">if</span> (anchorName != <span class="literal">''</span> &amp;&amp; !state)
el.className = <span class="literal">''</span>;
break;
}
<span class="reserved">if</span> (deep &amp;&amp; el.hasChildNodes()) {
<span class="reserved">for</span> (var i=0; i&lt;el.childNodes.length; i++)
tinyMCE.handleVisualAid(el.childNodes[i], deep, state, inst, true);
}
},
<span class="comment">/*
applyClassesToFonts : function(doc, size) {
var f = doc.getElementsByTagName("font");
for (var i=0; i&lt;f.length; i++) {
var s = tinyMCE.getAttrib(f[i], "size");
if (s != "")
tinyMCE.setAttrib(f[i], 'class', "mceItemFont" + s);
}
if (typeof(size) != "undefined") {
var css = "";
for (var x=0; x&lt;doc.styleSheets.length; x++) {
for (var i=0; i&lt;doc.styleSheets[x].rules.length; i++) {
if (doc.styleSheets[x].rules[i].selectorText == '#mceSpanFonts .mceItemFont' + size) {
css = doc.styleSheets[x].rules[i].style.cssText;
break;
}
}
if (css != "")
break;
}
if (doc.styleSheets[0].rules[0].selectorText == "FONT")
doc.styleSheets[0].removeRule(0);
doc.styleSheets[0].addRule("FONT", css, 0);
}
},
*/</span>
<span class="comment">/**
* Fixes a Gecko specific bug where href, src attribute values gets converted incorrectly
* when inserted into editor. This function will replace all src, href with mce_tsrc and mce_thref
* to keep the values from chaging when they get inserted.
*
* <span class="attrib">@param</span> {boolean} m Mode state, true is to replace the src, href attributes to mce_tsrc and mce_thref.
* <span class="attrib">@param</span> {HTMLElement} e HTML element to replace them in. (Will be used if m is 0)
* <span class="attrib">@param</span> {string} h HTML code to replace them in. (Will be used if m is 1)
* <span class="attrib">@return</span> Converted string or the specified HTML value depending on mode.
* <span class="attrib">@type</span> string
*/</span>
fixGeckoBaseHREFBug : <span class="reserved">function</span>(m, e, h) {
var nl, i, a, n, xsrc, xhref, el;
<span class="reserved">if</span> (tinyMCE.isGecko) {
<span class="reserved">if</span> (m == 1) {
h = h.replace(/\ssrc=/gi, <span class="literal">" mce_tsrc="</span>);
h = h.replace(/\shref=/gi, <span class="literal">" mce_thref="</span>);
<span class="reserved">return</span> h;
} <span class="reserved">else</span> {
el = new Array(<span class="literal">'a'</span>,<span class="literal">'img'</span>,<span class="literal">'select'</span>,<span class="literal">'area'</span>,<span class="literal">'iframe'</span>,<span class="literal">'base'</span>,<span class="literal">'input'</span>,<span class="literal">'script'</span>,<span class="literal">'embed'</span>,<span class="literal">'object'</span>,<span class="literal">'link'</span>);
<span class="reserved">for</span> (a=0; a&lt;el.length; a++) {
n = e.getElementsByTagName(el[a]);
<span class="reserved">for</span> (i=0; i&lt;n.length; i++) {
xsrc = tinyMCE.getAttrib(n[i], <span class="literal">"mce_tsrc"</span>);
xhref = tinyMCE.getAttrib(n[i], <span class="literal">"mce_thref"</span>);
<span class="reserved">if</span> (xsrc != <span class="literal">""</span>) {
try {
n[i].src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings[<span class="literal">'base_href'</span>], xsrc);
} catch (e) {
<span class="comment">// Ignore, Firefox cast exception if local file wasn't found</span>
}
n[i].removeAttribute(<span class="literal">"mce_tsrc"</span>);
}
<span class="reserved">if</span> (xhref != <span class="literal">""</span>) {
try {
n[i].href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings[<span class="literal">'base_href'</span>], xhref);
} catch (e) {
<span class="comment">// Ignore, Firefox cast exception if local file wasn't found</span>
}
n[i].removeAttribute(<span class="literal">"mce_thref"</span>);
}
}
}
el = tinyMCE.selectNodes(e, <span class="reserved">function</span>(n) {
<span class="reserved">if</span> (n.nodeType == 3 || n.nodeType == 8) {
n.nodeValue = n.nodeValue.replace(/\smce_tsrc=/gi, <span class="literal">" src="</span>);
n.nodeValue = n.nodeValue.replace(/\smce_thref=/gi, <span class="literal">" href="</span>);
}
<span class="reserved">return</span> false;
});
}
}
<span class="reserved">return</span> h;
},
<span class="comment">/**
* Sets the HTML code of a specific document.
* Todo: Try to merge/remove this one.
*
* <span class="attrib">@param</span> {DOMDocument} doc DOM document to set the HTML code in.
* <span class="attrib">@param</span> {string} html_content HTML contents to set in DOM document.
* <span class="attrib">@private</span>
*/</span>
_setHTML : <span class="reserved">function</span>(doc, html_content) {
<span class="comment">// Force closed anchors open</span>
<span class="comment">//html_content = html_content.replace(new RegExp('&lt;a(.*?)/&gt;', 'gi'), '&lt;a$1&gt;&lt;/a&gt;');</span>
html_content = tinyMCE.cleanupHTMLCode(html_content);
<span class="comment">// Try innerHTML if it fails use pasteHTML in MSIE</span>
try {
tinyMCE.setInnerHTML(doc.body, html_content);
} catch (e) {
<span class="reserved">if</span> (<span class="reserved">this</span>.isMSIE)
doc.body.createTextRange().pasteHTML(html_content);
}
<span class="comment">// Content duplication bug fix</span>
<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; tinyMCE.settings[<span class="literal">'fix_content_duplication'</span>]) {
<span class="comment">// Remove P elements in P elements</span>
var paras = doc.getElementsByTagName(<span class="literal">"P"</span>);
<span class="reserved">for</span> (var i=0; i&lt;paras.length; i++) {
var node = paras[i];
<span class="reserved">while</span> ((node = node.parentNode) != null) {
<span class="reserved">if</span> (node.nodeName == <span class="literal">"P"</span>)
node.outerHTML = node.innerHTML;
}
}
<span class="comment">// Content duplication bug fix (Seems to be word crap)</span>
var html = doc.body.innerHTML;
<span class="comment">/*
if (html.indexOf('="mso') != -1) {
for (var i=0; i&lt;doc.body.all.length; i++) {
var el = doc.body.all[i];
el.removeAttribute("className","",0);
el.removeAttribute("style","",0);
}
html = doc.body.innerHTML;
html = tinyMCE.regexpReplace(html, "&lt;o:p&gt;&lt;\/o:p&gt;", "&lt;br /&gt;");
html = tinyMCE.regexpReplace(html, "&lt;o:p&gt;&amp;nbsp;&lt;\/o:p&gt;", "");
html = tinyMCE.regexpReplace(html, "&lt;st1:.*?&gt;", "");
html = tinyMCE.regexpReplace(html, "&lt;p&gt;&lt;\/p&gt;", "");
html = tinyMCE.regexpReplace(html, "&lt;p&gt;&lt;\/p&gt;\r\n&lt;p&gt;&lt;\/p&gt;", "");
html = tinyMCE.regexpReplace(html, "&lt;p&gt;&amp;nbsp;&lt;\/p&gt;", "&lt;br /&gt;");
html = tinyMCE.regexpReplace(html, "&lt;p&gt;\s*(&lt;p&gt;\s*)?", "&lt;p&gt;");
html = tinyMCE.regexpReplace(html, "&lt;\/p&gt;\s*(&lt;\/p&gt;\s*)?", "&lt;/p&gt;");
}*/</span>
<span class="comment">// Always set the htmlText output</span>
tinyMCE.setInnerHTML(doc.body, html);
}
tinyMCE.cleanupAnchors(doc);
<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">"convert_fonts_to_spans"</span>))
tinyMCE.convertSpansToFonts(doc);
},
<span class="comment">/**
* Returns the editor instance id of a specific form element.
*
* <span class="attrib">@param</span> {string} form_element Form element name to get instance id for.
* <span class="attrib">@return</span> TinyMCE editor instance id or null if it wasn't found.
* <span class="attrib">@type</span> string
*/</span>
getEditorId : <span class="reserved">function</span>(form_element) {
var inst = <span class="reserved">this</span>.getInstanceById(form_element);
<span class="reserved">if</span> (!inst)
<span class="reserved">return</span> null;
<span class="reserved">return</span> inst.editorId;
},
<span class="comment">/**
* Returns a TinyMCE editor instance by the specified editor id or null if it wasn't found.
*
* <span class="attrib">@param</span> {string} editor_id Editor id to get instance for.
* <span class="attrib">@return</span> TinyMCE editor control instance or null if it wasn't found.
* <span class="attrib">@type</span> TinyMCE_Control
*/</span>
getInstanceById : <span class="reserved">function</span>(editor_id) {
var inst = <span class="reserved">this</span>.instances[editor_id];
<span class="reserved">if</span> (!inst) {
<span class="reserved">for</span> (var n in tinyMCE.instances) {
var instance = tinyMCE.instances[n];
<span class="reserved">if</span> (!tinyMCE.isInstance(instance))
continue;
<span class="reserved">if</span> (instance.formTargetElementId == editor_id) {
inst = instance;
break;
}
}
}
<span class="reserved">return</span> inst;
},
<span class="comment">/**
* Queries a command value for a specific command on a specific editor instance.
*
* <span class="attrib">@param</span> {string} editor_id Editor id to query command value on.
* <span class="attrib">@param</span> {string} command Command to query for.
* <span class="attrib">@return</span> Command value passed from browser.
* <span class="attrib">@type</span> object
*/</span>
queryInstanceCommandValue : <span class="reserved">function</span>(editor_id, command) {
var inst = tinyMCE.getInstanceById(editor_id);
<span class="reserved">if</span> (inst)
<span class="reserved">return</span> inst.queryCommandValue(command);
<span class="reserved">return</span> false;
},
<span class="comment">/**
* Queries a command state for a specific command on a specific editor instance.
*
* <span class="attrib">@param</span> {string} editor_id Editor id to query command state on.
* <span class="attrib">@param</span> {string} command Command to query for.
* <span class="attrib">@return</span> Command state passed from browser.
* <span class="attrib">@type</span> boolean
*/</span>
queryInstanceCommandState : <span class="reserved">function</span>(editor_id, command) {
var inst = tinyMCE.getInstanceById(editor_id);
<span class="reserved">if</span> (inst)
<span class="reserved">return</span> inst.queryCommandState(command);
<span class="reserved">return</span> null;
},
<span class="comment">/**
* Sets the window argument to be passed to TinyMCE popup.
*
* <span class="attrib">@param</span> {string} n Window argument name.
* <span class="attrib">@param</span> {string} v Window argument value.
*/</span>
setWindowArg : <span class="reserved">function</span>(n, v) {
<span class="reserved">this</span>.windowArgs[n] = v;
},
<span class="comment">/**
* Returns the window argument to be passed to TinyMCE popup.
* Use: tinyMCEPopup.getWindowArg instead.
*
* <span class="attrib">@param</span> {string} n Window argument name.
* <span class="attrib">@return</span> Argument value or default value if it wasn't found.
* <span class="attrib">@deprecated</span>
*/</span>
getWindowArg : <span class="reserved">function</span>(n, d) {
<span class="reserved">return</span> (typeof(<span class="reserved">this</span>.windowArgs[n]) == <span class="literal">"undefined"</span>) ? d : <span class="reserved">this</span>.windowArgs[n];
},
<span class="comment">/**
* Returns a array of CSS classes that is available in a document.
* Todo: Fix this one, it's so ugly. :)
*
* <span class="attrib">@param</span> {string} editor_id Editor id to get CSS classes from.
* <span class="attrib">@param</span> {DOMDocument} doc DOM document to get the CSS classes from.
* <span class="attrib">@return</span> Array of CSS classes that is available in a document.
* <span class="attrib">@type</span> Array
*/</span>
getCSSClasses : <span class="reserved">function</span>(editor_id, doc) {
var output = new Array();
<span class="comment">// Is cached, use that</span>
<span class="reserved">if</span> (typeof(tinyMCE.cssClasses) != <span class="literal">"undefined"</span>)
<span class="reserved">return</span> tinyMCE.cssClasses;
<span class="reserved">if</span> (typeof(editor_id) == <span class="literal">"undefined"</span> &amp;&amp; typeof(doc) == <span class="literal">"undefined"</span>) {
var instance;
<span class="reserved">for</span> (var instanceName in tinyMCE.instances) {
instance = tinyMCE.instances[instanceName];
<span class="reserved">if</span> (!tinyMCE.isInstance(instance))
continue;
break;
}
doc = instance.getDoc();
}
<span class="reserved">if</span> (typeof(doc) == <span class="literal">"undefined"</span>) {
var instance = tinyMCE.getInstanceById(editor_id);
doc = instance.getDoc();
}
<span class="reserved">if</span> (doc) {
var styles = doc.styleSheets;
<span class="reserved">if</span> (styles &amp;&amp; styles.length &gt; 0) {
<span class="reserved">for</span> (var x=0; x&lt;styles.length; x++) {
var csses = null;
<span class="comment">// Just ignore any errors</span>
eval(<span class="literal">"try {var csses = tinyMCE.isMSIE ? doc.styleSheets("</span> + x + <span class="literal">").rules : styles["</span> + x + <span class="literal">"].cssRules;} catch(e) {}"</span>);
<span class="reserved">if</span> (!csses)
<span class="reserved">return</span> new Array();
<span class="reserved">for</span> (var i=0; i&lt;csses.length; i++) {
var selectorText = csses[i].selectorText;
<span class="comment">// Can be multiple rules per selector</span>
<span class="reserved">if</span> (selectorText) {
var rules = selectorText.split(<span class="literal">','</span>);
<span class="reserved">for</span> (var c=0; c&lt;rules.length; c++) {
var rule = rules[c];
<span class="comment">// Strip spaces between selectors</span>
<span class="reserved">while</span> (rule.indexOf(<span class="literal">' '</span>) == 0)
rule = rule.substring(1);
<span class="comment">// Invalid rule</span>
<span class="reserved">if</span> (rule.indexOf(<span class="literal">' '</span>) != -1 || rule.indexOf(<span class="literal">':'</span>) != -1 || rule.indexOf(<span class="literal">'mceItem'</span>) != -1)
continue;
<span class="reserved">if</span> (rule.indexOf(tinyMCE.settings[<span class="literal">'visual_table_class'</span>]) != -1 || rule.indexOf(<span class="literal">'mceEditable'</span>) != -1 || rule.indexOf(<span class="literal">'mceNonEditable'</span>) != -1)
continue;
<span class="comment">// Is class rule</span>
<span class="reserved">if</span> (rule.indexOf(<span class="literal">'.'</span>) != -1) {
var cssClass = rule.substring(rule.indexOf(<span class="literal">'.'</span>) + 1);
var addClass = true;
<span class="reserved">for</span> (var p=0; p&lt;output.length &amp;&amp; addClass; p++) {
<span class="reserved">if</span> (output[p] == cssClass)
addClass = false;
}
<span class="reserved">if</span> (addClass)
output[output.length] = cssClass;
}
}
}
}
}
}
}
<span class="comment">// Cache em</span>
<span class="reserved">if</span> (output.length &gt; 0)
tinyMCE.cssClasses = output;
<span class="reserved">return</span> output;
},
<span class="comment">/**
* Regexp replaces the contents of a string. Use normal replace instead.
*
* <span class="attrib">@param</span> {string} in_str String to replace in.
* <span class="attrib">@param</span> {string} reg_exp Regexp to replace.
* <span class="attrib">@param</span> {string} replace_str String to replace with.
* <span class="attrib">@param</span> {string} in_str Optional regexp options like "gi".
* <span class="attrib">@return</span> Replaced string value.
* <span class="attrib">@type</span> string
* <span class="attrib">@deprecated</span>
*/</span>
regexpReplace : <span class="reserved">function</span>(in_str, reg_exp, replace_str, opts) {
<span class="reserved">if</span> (in_str == null)
<span class="reserved">return</span> in_str;
<span class="reserved">if</span> (typeof(opts) == <span class="literal">"undefined"</span>)
opts = <span class="literal">'g'</span>;
var re = new RegExp(reg_exp, opts);
<span class="reserved">return</span> in_str.replace(re, replace_str);
},
<span class="comment">/**
* Removes all prefix, suffix whitespace of a string.
*
* <span class="attrib">@param</span> {string} s String to replace whitespace in.
* <span class="attrib">@return</span> Replaced string value.
* <span class="attrib">@type</span> string
*/</span>
trim : <span class="reserved">function</span>(s) {
<span class="reserved">return</span> s.replace(/^\s*|\s*$/g, <span class="literal">""</span>);
},
<span class="comment">/**
* Removes MSIE 5.5 specific event wrapper function form a event string.
* This will also remove the event blocker if it's added in front of the event.
*
* <span class="attrib">@param</span> {string} s String to replace event data in.
* <span class="attrib">@return</span> Replaced string value.
* <span class="attrib">@type</span> string
*/</span>
cleanupEventStr : <span class="reserved">function</span>(s) {
s = <span class="literal">""</span> + s;
s = s.replace(<span class="literal">'function anonymous()\n{\n'</span>, <span class="literal">''</span>);
s = s.replace(<span class="literal">'\n}'</span>, <span class="literal">''</span>);
s = s.replace(/^<span class="reserved">return</span> true;/gi, <span class="literal">''</span>); <span class="comment">// Remove event blocker</span>
<span class="reserved">return</span> s;
},
<span class="comment">/**
* Returns the HTML for the specified control this will loop through
* the theme and all plugins inorder to find the control. The callback for each
* theme and plugin is called getControlHTML.
*
* <span class="attrib">@param</span> {string} c Control name/id to get HTML code for.
* <span class="attrib">@return</span> HTML code for the specified control or empty string if it wasn't found.
* <span class="attrib">@type</span> string
*/</span>
getControlHTML : <span class="reserved">function</span>(c) {
var i, l, n, o, v;
l = tinyMCE.plugins;
<span class="reserved">for</span> (n in l) {
o = l[n];
<span class="reserved">if</span> (o.getControlHTML &amp;&amp; (v = o.getControlHTML(c)) != <span class="literal">''</span>)
<span class="reserved">return</span> tinyMCE.replaceVar(v, <span class="literal">"pluginurl"</span>, o.baseURL);
}
o = tinyMCE.themes[tinyMCE.settings[<span class="literal">'theme'</span>]];
<span class="reserved">if</span> (o.getControlHTML &amp;&amp; (v = o.getControlHTML(c)) != <span class="literal">''</span>)
<span class="reserved">return</span> v;
<span class="reserved">return</span> <span class="literal">''</span>;
},
<span class="comment">/**
* Evaluates the specified function and uses the array of arguments.
*
* <span class="attrib">@param</span> {string} f Function reference to execute.
* <span class="attrib">@param</span> {int} idx Index in array to start grabbing arguments from.
* <span class="attrib">@param</span> {Array} a Array of function arguments.
* <span class="attrib">@return</span> Value returned from the evaluated function.
* <span class="attrib">@type</span> object
*/</span>
evalFunc : <span class="reserved">function</span>(f, idx, a) {
var s = <span class="literal">'('</span>, i;
<span class="reserved">for</span> (i=idx; i&lt;a.length; i++) {
s += <span class="literal">'a['</span> + i + <span class="literal">']'</span>;
<span class="reserved">if</span> (i &lt; a.length-1)
s += <span class="literal">','</span>;
}
s += <span class="literal">');'</span>;
<span class="reserved">return</span> eval(<span class="literal">"f"</span> + s);
},
<span class="comment">/**
* Dispatches the specified callback on all options, plugins and themes. This will not
* chain them, so all functions callbacks will be executed regardless if the return true/false.
*
* <span class="attrib">@param</span> {TinyMCE_Control} i TinyMCE editor control instance to execute callback on.
* <span class="attrib">@param</span> {string} p TinyMCE callback parameter to execute.
* <span class="attrib">@param</span> {string} n Function name to execute.
* <span class="attrib">@return</span> true/false if they where dispatched.
*/</span>
dispatchCallback : <span class="reserved">function</span>(i, p, n) {
<span class="reserved">return</span> <span class="reserved">this</span>.callFunc(i, p, n, 0, <span class="reserved">this</span>.dispatchCallback.arguments);
},
<span class="comment">/**
* Executes the specified callback on all options, plugins and themes. This will
* chain them, so callback chain will be broken if one function returns false.
*
* <span class="attrib">@param</span> {TinyMCE_Control} i TinyMCE editor control instance to execute callback on.
* <span class="attrib">@param</span> {string} p TinyMCE callback parameter to execute.
* <span class="attrib">@param</span> {string} n Function name to execute.
* <span class="attrib">@return</span> true/false if a callback was executed.
*/</span>
executeCallback : <span class="reserved">function</span>(i, p, n) {
<span class="reserved">return</span> <span class="reserved">this</span>.callFunc(i, p, n, 1, <span class="reserved">this</span>.executeCallback.arguments);
},
<span class="comment">/**
* Executes the specified execcommand callback on all options, plugins and themes. This will
* chain them, so callback chain will be broken if one function returns true.
*
* <span class="attrib">@param</span> {TinyMCE_Control} i TinyMCE editor control instance to execute callback on.
* <span class="attrib">@param</span> {string} p TinyMCE callback parameter to execute.
* <span class="attrib">@param</span> {string} n Function name to execute.
* <span class="attrib">@return</span> true/false if a callback was executed.
*/</span>
execCommandCallback : <span class="reserved">function</span>(i, p, n) {
<span class="reserved">return</span> <span class="reserved">this</span>.callFunc(i, p, n, 2, <span class="reserved">this</span>.execCommandCallback.arguments);
},
<span class="comment">/**
* Executes callback chain. Callback order: Option, Plugins, Themes.
*
* <span class="attrib">@param</span> {TinyMCE_Control} ins TinyMCE editor control instance to execute callback on.
* <span class="attrib">@param</span> {string} p TinyMCE callback parameter name.
* <span class="attrib">@param</span> {string} n Function name to execute.
* <span class="attrib">@param</span> {int} m Execution mode value, 0 = no chain, 1 = event chain, 2 = execcommand chain.
* <span class="attrib">@param</span> {Array} a Array with function arguments.
* <span class="attrib">@return</span> true - if the callback was executed, false if it wasn't.
* <span class="attrib">@type</span> boolean
*/</span>
callFunc : <span class="reserved">function</span>(ins, p, n, m, a) {
var l, i, on, o, s, v;
s = m == 2;
l = tinyMCE.getParam(p, <span class="literal">''</span>);
<span class="reserved">if</span> (l != <span class="literal">''</span> &amp;&amp; (v = tinyMCE.evalFunc(typeof(l) == <span class="literal">"function"</span> ? l : eval(l), 3, a)) == s &amp;&amp; m &gt; 0)
<span class="reserved">return</span> true;
<span class="reserved">if</span> (ins != null) {
<span class="reserved">for</span> (i=0, l = ins.plugins; i&lt;l.length; i++) {
o = tinyMCE.plugins[l[i]];
<span class="reserved">if</span> (o[n] &amp;&amp; (v = tinyMCE.evalFunc(o[n], 3, a)) == s &amp;&amp; m &gt; 0)
<span class="reserved">return</span> true;
}
}
l = tinyMCE.themes;
<span class="reserved">for</span> (on in l) {
o = l[on];
<span class="reserved">if</span> (o[n] &amp;&amp; (v = tinyMCE.evalFunc(o[n], 3, a)) == s &amp;&amp; m &gt; 0)
<span class="reserved">return</span> true;
}
<span class="reserved">return</span> false;
},
<span class="comment">/**
* Encodes the string to raw XML entities. This will only convert the most common ones.
* For real entity encoding use the xmlEncode method of the Cleanup class.
*
* <span class="attrib">@param</span> {string} s String to encode.
* <span class="attrib">@return</span> XML Encoded string.
* <span class="attrib">@type</span> string
*/</span>
xmlEncode : <span class="reserved">function</span>(s) {
s = <span class="literal">""</span> + s;
s = s.replace(/&amp;/g, <span class="literal">'&amp;amp;'</span>);
s = s.replace(new RegExp(<span class="literal">'"'</span>, <span class="literal">'g'</span>), <span class="literal">'&amp;quot;'</span>);
s = s.replace(/\<span class="literal">'/g, '</span>&amp;#39;<span class="literal">'); // &amp;apos; is not working in MSIE
s = s.replace(/&lt;/g, '</span>&amp;lt;<span class="literal">');
s = s.replace(/&gt;/g, '</span>&amp;gt;');
<span class="reserved">return</span> s;
},
<span class="comment">/**
* Extends the specified prototype with new methods.
*
* <span class="attrib">@param</span> {Object} p Prototype to extend with new methods.
* <span class="attrib">@param</span> {Object} np New prototype to extend the other one with.
* <span class="attrib">@return</span> Extended prototype array.
* <span class="attrib">@type</span> Object
*/</span>
extend : <span class="reserved">function</span>(p, np) {
var o = {};
o.parent = p;
<span class="reserved">for</span> (n in p)
o[n] = p[n];
<span class="reserved">for</span> (n in np)
o[n] = np[n];
<span class="reserved">return</span> o;
},
<span class="comment">/**
* Hides any visible menu layers.
*
* <span class="attrib">@private</span>
*/</span>
hideMenus : <span class="reserved">function</span>() {
var e = tinyMCE.lastSelectedMenuBtn;
<span class="reserved">if</span> (tinyMCE.lastMenu) {
tinyMCE.lastMenu.hide();
tinyMCE.lastMenu = null;
}
<span class="reserved">if</span> (e) {
tinyMCE.switchClass(e, tinyMCE.lastMenuBtnClass);
tinyMCE.lastSelectedMenuBtn = null;
}
},
<span class="comment">/**
* Splits a string by the specified delimiter and skips any empty items.
*
* <span class="attrib">@param</span> {string} d Delimiter to split by.
* <span class="attrib">@param</span> {string} s String to split.
* <span class="attrib">@return</span> Array with chunks from string.
* <span class="attrib">@type</span> Array
*/</span>
explode : <span class="reserved">function</span>(d, s) {
var ar = s.split(d), oar = new Array(), i;
<span class="reserved">for</span> (i = 0; i&lt;ar.length; i++) {
<span class="reserved">if</span> (ar[i] != <span class="literal">""</span>)
oar[oar.length] = ar[i];
}
<span class="reserved">return</span> oar;
}
};
<span class="comment">// Global instances</span>
var TinyMCE = TinyMCE_Engine; <span class="comment">// Compatiblity with gzip compressors</span>
var tinyMCE = new TinyMCE_Engine();
var tinyMCELang = {};
</pre>
<hr>
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> &nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a> &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<font size="-1">
</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Fri Apr 14 21:59:23 2006</div>
</body>
</html>