summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-03-19 14:53:30 +0000
committeralecpl <alec@alec.pl>2010-03-19 14:53:30 +0000
commit69d05c371029b7915cf2a87d6e552d9853244644 (patch)
tree689e3a2cf571e8fc0912bd87284b7acc8e47b91d
parent258a043a31ff002d83097e45b4504e59e6559d1d (diff)
- TinyMCE 3.3.1
-rw-r--r--CHANGELOG1
-rw-r--r--program/js/tiny_mce/langs/en.js19
-rw-r--r--program/js/tiny_mce/plugins/contextmenu/editor_plugin_src.js38
-rw-r--r--program/js/tiny_mce/plugins/directionality/editor_plugin_src.js9
-rw-r--r--program/js/tiny_mce/plugins/emotions/editor_plugin.js2
-rw-r--r--program/js/tiny_mce/plugins/emotions/editor_plugin_src.js13
-rw-r--r--program/js/tiny_mce/plugins/media/editor_plugin.js2
-rw-r--r--program/js/tiny_mce/plugins/media/editor_plugin_src.js17
-rw-r--r--program/js/tiny_mce/plugins/media/media.htm9
-rw-r--r--program/js/tiny_mce/plugins/nonbreaking/editor_plugin_src.js9
-rw-r--r--program/js/tiny_mce/plugins/paste/editor_plugin.js2
-rw-r--r--program/js/tiny_mce/plugins/paste/editor_plugin_src.js620
-rw-r--r--program/js/tiny_mce/plugins/paste/pastetext.htm10
-rw-r--r--program/js/tiny_mce/plugins/paste/pasteword.htm10
-rw-r--r--program/js/tiny_mce/plugins/searchreplace/editor_plugin.js2
-rw-r--r--program/js/tiny_mce/plugins/searchreplace/editor_plugin_src.js11
-rw-r--r--program/js/tiny_mce/plugins/searchreplace/js/searchreplace.js4
-rw-r--r--program/js/tiny_mce/plugins/searchreplace/searchreplace.htm13
-rw-r--r--program/js/tiny_mce/plugins/table/cell.htm9
-rw-r--r--program/js/tiny_mce/plugins/table/editor_plugin.js2
-rw-r--r--program/js/tiny_mce/plugins/table/editor_plugin_src.js1862
-rw-r--r--program/js/tiny_mce/plugins/table/js/cell.js63
-rw-r--r--program/js/tiny_mce/plugins/table/js/merge_cells.js38
-rw-r--r--program/js/tiny_mce/plugins/table/js/row.js69
-rw-r--r--program/js/tiny_mce/plugins/table/js/table.js25
-rw-r--r--program/js/tiny_mce/plugins/table/merge_cells.htm11
-rw-r--r--program/js/tiny_mce/plugins/table/row.htm9
-rw-r--r--program/js/tiny_mce/plugins/table/table.htm9
-rw-r--r--program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js9
-rw-r--r--program/js/tiny_mce/plugins/xhtmlxtras/abbr.htm13
-rw-r--r--program/js/tiny_mce/plugins/xhtmlxtras/acronym.htm13
-rw-r--r--program/js/tiny_mce/plugins/xhtmlxtras/attributes.htm9
-rw-r--r--program/js/tiny_mce/plugins/xhtmlxtras/cite.htm13
-rw-r--r--program/js/tiny_mce/plugins/xhtmlxtras/del.htm14
-rw-r--r--program/js/tiny_mce/plugins/xhtmlxtras/editor_plugin.js2
-rw-r--r--program/js/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js14
-rw-r--r--program/js/tiny_mce/plugins/xhtmlxtras/ins.htm14
-rw-r--r--program/js/tiny_mce/plugins/xhtmlxtras/js/abbr.js13
-rw-r--r--program/js/tiny_mce/plugins/xhtmlxtras/js/acronym.js11
-rw-r--r--program/js/tiny_mce/plugins/xhtmlxtras/js/attributes.js11
-rw-r--r--program/js/tiny_mce/plugins/xhtmlxtras/js/cite.js11
-rw-r--r--program/js/tiny_mce/plugins/xhtmlxtras/js/del.js11
-rw-r--r--program/js/tiny_mce/plugins/xhtmlxtras/js/element_common.js16
-rw-r--r--program/js/tiny_mce/plugins/xhtmlxtras/js/ins.js11
-rw-r--r--program/js/tiny_mce/themes/advanced/about.htm4
-rw-r--r--program/js/tiny_mce/themes/advanced/anchor.htm9
-rw-r--r--program/js/tiny_mce/themes/advanced/color_picker.htm4
-rw-r--r--program/js/tiny_mce/themes/advanced/editor_template.js2
-rw-r--r--program/js/tiny_mce/themes/advanced/editor_template_src.js335
-rw-r--r--program/js/tiny_mce/themes/advanced/image.htm9
-rw-r--r--program/js/tiny_mce/themes/advanced/img/icons.gifbin11505 -> 11794 bytes
-rw-r--r--program/js/tiny_mce/themes/advanced/js/anchor.js14
-rw-r--r--program/js/tiny_mce/themes/advanced/js/charmap.js10
-rw-r--r--program/js/tiny_mce/themes/advanced/js/image.js4
-rw-r--r--program/js/tiny_mce/themes/advanced/link.htm9
-rw-r--r--program/js/tiny_mce/themes/advanced/skins/default/content.css9
-rw-r--r--program/js/tiny_mce/themes/advanced/skins/default/dialog.css7
-rw-r--r--program/js/tiny_mce/themes/advanced/skins/default/ui.css9
-rw-r--r--program/js/tiny_mce/themes/advanced/skins/o2k7/content.css9
-rw-r--r--program/js/tiny_mce/themes/advanced/skins/o2k7/dialog.css5
-rw-r--r--program/js/tiny_mce/themes/advanced/skins/o2k7/ui.css6
-rw-r--r--program/js/tiny_mce/themes/advanced/source_editor.htm9
-rw-r--r--program/js/tiny_mce/themes/simple/editor_template_src.js10
-rw-r--r--program/js/tiny_mce/tiny_mce.js2
-rw-r--r--program/js/tiny_mce/tiny_mce_popup.js2
-rw-r--r--program/js/tiny_mce/tiny_mce_src.js7259
-rw-r--r--program/js/tiny_mce/utils/editable_selects.js9
-rw-r--r--program/js/tiny_mce/utils/form_utils.js9
-rw-r--r--program/js/tiny_mce/utils/mctabs.js9
-rw-r--r--program/js/tiny_mce/utils/validate.js9
70 files changed, 5891 insertions, 4945 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 4fb319802..379f896ef 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG RoundCube Webmail
===========================
+- TinyMCE 3.3.1
- Implemented messages copying using drag&drop + SHIFT (#1484086)
- Improved performance of folders operations (#1486525)
- Fix blocked.gif attachment is not attached to the message (#1486516)
diff --git a/program/js/tiny_mce/langs/en.js b/program/js/tiny_mce/langs/en.js
index 8519b4de7..075bef70d 100644
--- a/program/js/tiny_mce/langs/en.js
+++ b/program/js/tiny_mce/langs/en.js
@@ -120,7 +120,9 @@ col:"Column",
cell:"Cell"
},
autosave:{
-unload_msg:"The changes you made will be lost if you navigate away from this page."
+unload_msg:"The changes you made will be lost if you navigate away from this page.",
+restore_content: "Restore auto-saved content",
+warning_message: "If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?"
},
fullscreen:{
desc:"Toggle fullscreen mode"
@@ -151,4 +153,17 @@ no_mpell:"No misspellings found."
},
pagebreak:{
desc:"Insert page break."
-}}}); \ No newline at end of file
+},
+advlist : {
+ types : 'Types',
+ def : 'Default',
+ lower_alpha : "Lower alpha",
+ lower_greek : "Lower greek",
+ lower_roman : "Lower roman",
+ upper_alpha : "Upper alpha",
+ upper_roman : "Upper roman",
+ circle : "Circle",
+ disc : "Disc",
+ square : "Square"
+}
+}}); \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/contextmenu/editor_plugin_src.js b/program/js/tiny_mce/plugins/contextmenu/editor_plugin_src.js
index a2c1866ba..26e9ce2f8 100644
--- a/program/js/tiny_mce/plugins/contextmenu/editor_plugin_src.js
+++ b/program/js/tiny_mce/plugins/contextmenu/editor_plugin_src.js
@@ -1,18 +1,43 @@
/**
- * $Id: editor_plugin_src.js 848 2008-05-15 11:54:40Z spocke $
+ * editor_plugin_src.js
*
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
var Event = tinymce.dom.Event, each = tinymce.each, DOM = tinymce.DOM;
+ /**
+ * This plugin a context menu to TinyMCE editor instances.
+ *
+ * @class tinymce.plugins.ContextMenu
+ */
tinymce.create('tinymce.plugins.ContextMenu', {
+ /**
+ * Initializes the plugin, this will be executed after the plugin has been created.
+ * This call is done before the editor instance has finished it's initialization so use the onInit event
+ * of the editor instance to intercept that event.
+ *
+ * @method init
+ * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
+ * @param {string} url Absolute URL to where the plugin is located.
+ */
init : function(ed) {
var t = this;
t.editor = ed;
+
+ /**
+ * This event gets fired when the context menu is shown.
+ *
+ * @event onContextMenu
+ * @param {tinymce.plugins.ContextMenu} sender Plugin instance sending the event.
+ * @param {tinymce.ui.DropMenu} menu Drop down menu to fill with more items if needed.
+ */
t.onContextMenu = new tinymce.util.Dispatcher(this);
ed.onContextMenu.add(function(ed, e) {
@@ -35,6 +60,13 @@
ed.onKeyDown.add(hide);
},
+ /**
+ * Returns information about the plugin as a name/value array.
+ * The current keys are longname, author, authorurl, infourl and version.
+ *
+ * @method getInfo
+ * @return {Object} Name/value array containing information about the plugin.
+ */
getInfo : function() {
return {
longname : 'Contextmenu',
diff --git a/program/js/tiny_mce/plugins/directionality/editor_plugin_src.js b/program/js/tiny_mce/plugins/directionality/editor_plugin_src.js
index 81818e37c..4444959bf 100644
--- a/program/js/tiny_mce/plugins/directionality/editor_plugin_src.js
+++ b/program/js/tiny_mce/plugins/directionality/editor_plugin_src.js
@@ -1,8 +1,11 @@
/**
- * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
+ * editor_plugin_src.js
*
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
diff --git a/program/js/tiny_mce/plugins/emotions/editor_plugin.js b/program/js/tiny_mce/plugins/emotions/editor_plugin.js
index 4783bc371..dbdd8ffb5 100644
--- a/program/js/tiny_mce/plugins/emotions/editor_plugin.js
+++ b/program/js/tiny_mce/plugins/emotions/editor_plugin.js
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.EmotionsPlugin",{init:function(a,b){a.addCommand("mceEmotion",function(){a.windowManager.open({file:b+"/emotions.htm",width:250+parseInt(a.getLang("emotions.delta_width",0)),height:160+parseInt(a.getLang("emotions.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("emotions",{title:"emotions.emotions_desc",cmd:"mceEmotion"})},getInfo:function(){return{longname:"Emotions",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("emotions",tinymce.plugins.EmotionsPlugin)})(); \ No newline at end of file
+(function(a){a.create("tinymce.plugins.EmotionsPlugin",{init:function(b,c){b.addCommand("mceEmotion",function(){b.windowManager.open({file:c+"/emotions.htm",width:250+parseInt(b.getLang("emotions.delta_width",0)),height:160+parseInt(b.getLang("emotions.delta_height",0)),inline:1},{plugin_url:c})});b.addButton("emotions",{title:"emotions.emotions_desc",cmd:"mceEmotion"})},getInfo:function(){return{longname:"Emotions",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions",version:a.majorVersion+"."+a.minorVersion}}});a.PluginManager.add("emotions",a.plugins.EmotionsPlugin)})(tinymce); \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/emotions/editor_plugin_src.js b/program/js/tiny_mce/plugins/emotions/editor_plugin_src.js
index df0d370ae..71d541697 100644
--- a/program/js/tiny_mce/plugins/emotions/editor_plugin_src.js
+++ b/program/js/tiny_mce/plugins/emotions/editor_plugin_src.js
@@ -1,11 +1,14 @@
/**
- * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
+ * editor_plugin_src.js
*
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
-(function() {
+(function(tinymce) {
tinymce.create('tinymce.plugins.EmotionsPlugin', {
init : function(ed, url) {
// Register commands
@@ -37,4 +40,4 @@
// Register plugin
tinymce.PluginManager.add('emotions', tinymce.plugins.EmotionsPlugin);
-})(); \ No newline at end of file
+})(tinymce); \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/media/editor_plugin.js b/program/js/tiny_mce/plugins/media/editor_plugin.js
index 2889be5ab..4bbe367e3 100644
--- a/program/js/tiny_mce/plugins/media/editor_plugin.js
+++ b/program/js/tiny_mce/plugins/media/editor_plugin.js
@@ -1 +1 @@
-(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.MediaPlugin",{init:function(b,c){var e=this;e.editor=b;e.url=c;function f(g){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(g.className)}b.onPreInit.add(function(){b.serializer.addRules("param[name|value|_mce_value]")});b.addCommand("mceMedia",function(){b.windowManager.open({file:c+"/media.htm",width:430+parseInt(b.getLang("media.delta_width",0)),height:470+parseInt(b.getLang("media.delta_height",0)),inline:1},{plugin_url:c})});b.addButton("media",{title:"media.desc",cmd:"mceMedia"});b.onNodeChange.add(function(h,g,i){g.setActive("media",i.nodeName=="IMG"&&f(i))});b.onInit.add(function(){var g={mceItemFlash:"flash",mceItemShockWave:"shockwave",mceItemWindowsMedia:"windowsmedia",mceItemQuickTime:"quicktime",mceItemRealMedia:"realmedia"};b.selection.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.selection.onBeforeSetContent.add(e._objectsToSpans,e);if(b.settings.content_css!==false){b.dom.loadCSS(c+"/css/content.css")}if(b.theme&&b.theme.onResolveName){b.theme.onResolveName.add(function(h,i){if(i.name=="img"){a(g,function(l,j){if(b.dom.hasClass(i.node,j)){i.name=l;i.title=b.dom.getAttrib(i.node,"title");return false}})}})}if(b&&b.plugins.contextmenu){b.plugins.contextmenu.onContextMenu.add(function(i,h,j){if(j.nodeName=="IMG"&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(j.className)){h.add({title:"media.edit",icon:"media",cmd:"mceMedia"})}})}});b.onBeforeSetContent.add(e._objectsToSpans,e);b.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.onPreProcess.add(function(g,i){var h=g.dom;if(i.set){e._spansToImgs(i.node);a(h.select("IMG",i.node),function(k){var j;if(f(k)){j=e._parse(k.title);h.setAttrib(k,"width",h.getAttrib(k,"width",j.width||100));h.setAttrib(k,"height",h.getAttrib(k,"height",j.height||100))}})}if(i.get){a(h.select("IMG",i.node),function(m){var l,j,k;if(g.getParam("media_use_script")){if(f(m)){m.className=m.className.replace(/mceItem/g,"mceTemp")}return}switch(m.className){case"mceItemFlash":l="d27cdb6e-ae6d-11cf-96b8-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="application/x-shockwave-flash";break;case"mceItemShockWave":l="166b1bca-3f9c-11cf-8075-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0";k="application/x-director";break;case"mceItemWindowsMedia":l=g.getParam("media_wmp6_compatible")?"05589fa1-c356-11ce-bf01-00aa0055595a":"6bf52a52-394a-11d3-b153-00c04f79faa6";j="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701";k="application/x-mplayer2";break;case"mceItemQuickTime":l="02bf25d5-8c17-4b23-bc80-d3488abddc6b";j="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0";k="video/quicktime";break;case"mceItemRealMedia":l="cfcdaa03-8be4-11cf-b84b-0020afbbccfa";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="audio/x-pn-realaudio-plugin";break}if(l){h.replace(e._buildObj({classid:l,codebase:j,type:k},m),m)}})}});b.onPostProcess.add(function(g,h){h.content=h.content.replace(/_mce_value=/g,"value=")});function d(g,h){h=new RegExp(h+'="([^"]+)"',"g").exec(g);return h?b.dom.decode(h[1]):""}b.onPostProcess.add(function(g,h){if(g.getParam("media_use_script")){h.content=h.content.replace(/<img[^>]+>/g,function(j){var i=d(j,"class");if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(i)){at=e._parse(d(j,"title"));at.width=d(j,"width");at.height=d(j,"height");j='<script type="text/javascript">write'+i.substring(7)+"({"+e._serialize(at)+"});<\/script>"}return j})}})},getInfo:function(){return{longname:"Media",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_objectsToSpans:function(b,e){var c=this,d=e.content;d=d.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(g,f,i){var h=c._parse(i);return'<img class="mceItem'+f+'" title="'+b.dom.encode(i)+'" src="'+c.url+'/img/trans.gif" width="'+h.width+'" height="'+h.height+'" />'});d=d.replace(/<object([^>]*)>/gi,'<span class="mceItemObject" $1>');d=d.replace(/<embed([^>]*)\/?>/gi,'<span class="mceItemEmbed" $1></span>');d=d.replace(/<embed([^>]*)>/gi,'<span class="mceItemEmbed" $1>');d=d.replace(/<\/(object)([^>]*)>/gi,"</span>");d=d.replace(/<\/embed>/gi,"");d=d.replace(/<param([^>]*)>/gi,function(g,f){return"<span "+f.replace(/value=/gi,"_mce_value=")+' class="mceItemParam"></span>'});d=d.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');e.content=d},_buildObj:function(g,h){var d,c=this.editor,f=c.dom,e=this._parse(h.title),b;b=c.getParam("media_strict",true)&&g.type=="application/x-shockwave-flash";e.width=g.width=f.getAttrib(h,"width")||100;e.height=g.height=f.getAttrib(h,"height")||100;if(e.src){e.src=c.convertURL(e.src,"src",h)}if(b){d=f.create("span",{id:e.id,mce_name:"object",type:"application/x-shockwave-flash",data:e.src,style:f.getAttrib(h,"style"),width:g.width,height:g.height})}else{d=f.create("span",{id:e.id,mce_name:"object",classid:"clsid:"+g.classid,style:f.getAttrib(h,"style"),codebase:g.codebase,width:g.width,height:g.height})}a(e,function(j,i){if(!/^(width|height|codebase|classid|id|_cx|_cy)$/.test(i)){if(g.type=="application/x-mplayer2"&&i=="src"&&!e.url){i="url"}if(j){f.add(d,"span",{mce_name:"param",name:i,_mce_value:j})}}});if(!b){f.add(d,"span",tinymce.extend({mce_name:"embed",type:g.type,style:f.getAttrib(h,"style")},e))}return d},_spansToImgs:function(e){var d=this,f=d.editor.dom,b,c;a(f.select("span",e),function(g){if(f.getAttrib(g,"class")=="mceItemObject"){c=f.getAttrib(g,"classid").toLowerCase().replace(/\s+/g,"");switch(c){case"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000":f.replace(d._createImg("mceItemFlash",g),g);break;case"clsid:166b1bca-3f9c-11cf-8075-444553540000":f.replace(d._createImg("mceItemShockWave",g),g);break;case"clsid:6bf52a52-394a-11d3-b153-00c04f79faa6":case"clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95":case"clsid:05589fa1-c356-11ce-bf01-00aa0055595a":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}return}if(f.getAttrib(g,"class")=="mceItemEmbed"){switch(f.getAttrib(g,"type")){case"application/x-shockwave-flash":f.replace(d._createImg("mceItemFlash",g),g);break;case"application/x-director":f.replace(d._createImg("mceItemShockWave",g),g);break;case"application/x-mplayer2":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"video/quicktime":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"audio/x-pn-realaudio-plugin":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}}})},_createImg:function(c,h){var b,g=this.editor.dom,f={},e="",d;d=["id","name","width","height","bgcolor","align","flashvars","src","wmode","allowfullscreen","quality","data"];b=g.create("img",{src:this.url+"/img/trans.gif",width:g.getAttrib(h,"width")||100,height:g.getAttrib(h,"height")||100,style:g.getAttrib(h,"style"),"class":c});a(d,function(i){var j=g.getAttrib(h,i);if(j){f[i]=j}});a(g.select("span",h),function(i){if(g.hasClass(i,"mceItemParam")){f[g.getAttrib(i,"name")]=g.getAttrib(i,"_mce_value")}});if(f.movie){f.src=f.movie;delete f.movie}if(!f.src){f.src=f.data;delete f.data}h=g.select(".mceItemEmbed",h)[0];if(h){a(d,function(i){var j=g.getAttrib(h,i);if(j&&!f[i]){f[i]=j}})}delete f.width;delete f.height;b.title=this._serialize(f);return b},_parse:function(b){return tinymce.util.JSON.parse("{"+b+"}")},_serialize:function(b){return tinymce.util.JSON.serialize(b).replace(/[{}]/g,"")}});tinymce.PluginManager.add("media",tinymce.plugins.MediaPlugin)})(); \ No newline at end of file
+(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.MediaPlugin",{init:function(b,c){var e=this;e.editor=b;e.url=c;function f(g){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(g.className)}b.onPreInit.add(function(){b.serializer.addRules("param[name|value|_mce_value]")});b.addCommand("mceMedia",function(){b.windowManager.open({file:c+"/media.htm",width:430+parseInt(b.getLang("media.delta_width",0)),height:470+parseInt(b.getLang("media.delta_height",0)),inline:1},{plugin_url:c})});b.addButton("media",{title:"media.desc",cmd:"mceMedia"});b.onNodeChange.add(function(h,g,i){g.setActive("media",i.nodeName=="IMG"&&f(i))});b.onInit.add(function(){var g={mceItemFlash:"flash",mceItemShockWave:"shockwave",mceItemWindowsMedia:"windowsmedia",mceItemQuickTime:"quicktime",mceItemRealMedia:"realmedia"};b.selection.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.selection.onBeforeSetContent.add(e._objectsToSpans,e);if(b.settings.content_css!==false){b.dom.loadCSS(c+"/css/content.css")}if(b.theme&&b.theme.onResolveName){b.theme.onResolveName.add(function(h,i){if(i.name=="img"){a(g,function(l,j){if(b.dom.hasClass(i.node,j)){i.name=l;i.title=b.dom.getAttrib(i.node,"title");return false}})}})}if(b&&b.plugins.contextmenu){b.plugins.contextmenu.onContextMenu.add(function(i,h,j){if(j.nodeName=="IMG"&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(j.className)){h.add({title:"media.edit",icon:"media",cmd:"mceMedia"})}})}});b.onBeforeSetContent.add(e._objectsToSpans,e);b.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.onPreProcess.add(function(g,i){var h=g.dom;if(i.set){e._spansToImgs(i.node);a(h.select("IMG",i.node),function(k){var j;if(f(k)){j=e._parse(k.title);h.setAttrib(k,"width",h.getAttrib(k,"width",j.width||100));h.setAttrib(k,"height",h.getAttrib(k,"height",j.height||100))}})}if(i.get){a(h.select("IMG",i.node),function(m){var l,j,k;if(g.getParam("media_use_script")){if(f(m)){m.className=m.className.replace(/mceItem/g,"mceTemp")}return}switch(m.className){case"mceItemFlash":l="d27cdb6e-ae6d-11cf-96b8-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="application/x-shockwave-flash";break;case"mceItemShockWave":l="166b1bca-3f9c-11cf-8075-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0";k="application/x-director";break;case"mceItemWindowsMedia":l=g.getParam("media_wmp6_compatible")?"05589fa1-c356-11ce-bf01-00aa0055595a":"6bf52a52-394a-11d3-b153-00c04f79faa6";j="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701";k="application/x-mplayer2";break;case"mceItemQuickTime":l="02bf25d5-8c17-4b23-bc80-d3488abddc6b";j="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0";k="video/quicktime";break;case"mceItemRealMedia":l="cfcdaa03-8be4-11cf-b84b-0020afbbccfa";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="audio/x-pn-realaudio-plugin";break}if(l){h.replace(e._buildObj({classid:l,codebase:j,type:k},m),m)}})}});b.onPostProcess.add(function(g,h){h.content=h.content.replace(/_mce_value=/g,"value=")});function d(g,h){h=new RegExp(h+'="([^"]+)"',"g").exec(g);return h?b.dom.decode(h[1]):""}b.onPostProcess.add(function(g,h){if(g.getParam("media_use_script")){h.content=h.content.replace(/<img[^>]+>/g,function(j){var i=d(j,"class");if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(i)){at=e._parse(d(j,"title"));at.width=d(j,"width");at.height=d(j,"height");j='<script type="text/javascript">write'+i.substring(7)+"({"+e._serialize(at)+"});<\/script>"}return j})}})},getInfo:function(){return{longname:"Media",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_objectsToSpans:function(b,e){var c=this,d=e.content;d=d.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(g,f,i){var h=c._parse(i);return'<img class="mceItem'+f+'" title="'+b.dom.encode(i)+'" src="'+c.url+'/img/trans.gif" width="'+h.width+'" height="'+h.height+'" />'});d=d.replace(/<object([^>]*)>/gi,'<span class="mceItemObject" $1>');d=d.replace(/<embed([^>]*)\/?>/gi,'<span class="mceItemEmbed" $1></span>');d=d.replace(/<embed([^>]*)>/gi,'<span class="mceItemEmbed" $1>');d=d.replace(/<\/(object)([^>]*)>/gi,"</span>");d=d.replace(/<\/embed>/gi,"");d=d.replace(/<param([^>]*)>/gi,function(g,f){return"<span "+f.replace(/value=/gi,"_mce_value=")+' class="mceItemParam"></span>'});d=d.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');e.content=d},_buildObj:function(g,h){var d,c=this.editor,f=c.dom,e=this._parse(h.title),b;b=c.getParam("media_strict",true)&&g.type=="application/x-shockwave-flash";e.width=g.width=f.getAttrib(h,"width")||100;e.height=g.height=f.getAttrib(h,"height")||100;if(e.src){e.src=c.convertURL(e.src,"src",h)}if(b){d=f.create("span",{id:e.id,_mce_name:"object",type:"application/x-shockwave-flash",data:e.src,style:f.getAttrib(h,"style"),width:g.width,height:g.height})}else{d=f.create("span",{id:e.id,_mce_name:"object",classid:"clsid:"+g.classid,style:f.getAttrib(h,"style"),codebase:g.codebase,width:g.width,height:g.height})}a(e,function(j,i){if(!/^(width|height|codebase|classid|id|_cx|_cy)$/.test(i)){if(g.type=="application/x-mplayer2"&&i=="src"&&!e.url){i="url"}if(j){f.add(d,"span",{_mce_name:"param",name:i,_mce_value:j})}}});if(!b){f.add(d,"span",tinymce.extend({_mce_name:"embed",type:g.type,style:f.getAttrib(h,"style")},e))}return d},_spansToImgs:function(e){var d=this,f=d.editor.dom,b,c;a(f.select("span",e),function(g){if(f.getAttrib(g,"class")=="mceItemObject"){c=f.getAttrib(g,"classid").toLowerCase().replace(/\s+/g,"");switch(c){case"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000":f.replace(d._createImg("mceItemFlash",g),g);break;case"clsid:166b1bca-3f9c-11cf-8075-444553540000":f.replace(d._createImg("mceItemShockWave",g),g);break;case"clsid:6bf52a52-394a-11d3-b153-00c04f79faa6":case"clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95":case"clsid:05589fa1-c356-11ce-bf01-00aa0055595a":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}return}if(f.getAttrib(g,"class")=="mceItemEmbed"){switch(f.getAttrib(g,"type")){case"application/x-shockwave-flash":f.replace(d._createImg("mceItemFlash",g),g);break;case"application/x-director":f.replace(d._createImg("mceItemShockWave",g),g);break;case"application/x-mplayer2":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"video/quicktime":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"audio/x-pn-realaudio-plugin":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}}})},_createImg:function(c,h){var b,g=this.editor.dom,f={},e="",d;d=["id","name","width","height","bgcolor","align","flashvars","src","wmode","allowfullscreen","quality","data"];b=g.create("img",{src:this.url+"/img/trans.gif",width:g.getAttrib(h,"width")||100,height:g.getAttrib(h,"height")||100,style:g.getAttrib(h,"style"),"class":c});a(d,function(i){var j=g.getAttrib(h,i);if(j){f[i]=j}});a(g.select("span",h),function(i){if(g.hasClass(i,"mceItemParam")){f[g.getAttrib(i,"name")]=g.getAttrib(i,"_mce_value")}});if(f.movie){f.src=f.movie;delete f.movie}if(!f.src){f.src=f.data;delete f.data}h=g.select(".mceItemEmbed",h)[0];if(h){a(d,function(i){var j=g.getAttrib(h,i);if(j&&!f[i]){f[i]=j}})}delete f.width;delete f.height;b.title=this._serialize(f);return b},_parse:function(b){return tinymce.util.JSON.parse("{"+b+"}")},_serialize:function(b){return tinymce.util.JSON.serialize(b).replace(/[{}]/g,"")}});tinymce.PluginManager.add("media",tinymce.plugins.MediaPlugin)})(); \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/media/editor_plugin_src.js b/program/js/tiny_mce/plugins/media/editor_plugin_src.js
index 2692e0a23..fc84e5b6c 100644
--- a/program/js/tiny_mce/plugins/media/editor_plugin_src.js
+++ b/program/js/tiny_mce/plugins/media/editor_plugin_src.js
@@ -1,8 +1,11 @@
/**
- * $Id: editor_plugin_src.js 1222 2009-09-03 17:26:47Z spocke $
+ * editor_plugin_src.js
*
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
@@ -234,7 +237,7 @@
if (stc) {
ob = dom.create('span', {
id : p.id,
- mce_name : 'object',
+ _mce_name : 'object',
type : 'application/x-shockwave-flash',
data : p.src,
style : dom.getAttrib(n, 'style'),
@@ -244,7 +247,7 @@
} else {
ob = dom.create('span', {
id : p.id,
- mce_name : 'object',
+ _mce_name : 'object',
classid : "clsid:" + o.classid,
style : dom.getAttrib(n, 'style'),
codebase : o.codebase,
@@ -260,12 +263,12 @@
k = 'url';
if (v)
- dom.add(ob, 'span', {mce_name : 'param', name : k, '_mce_value' : v});
+ dom.add(ob, 'span', {_mce_name : 'param', name : k, '_mce_value' : v});
}
});
if (!stc)
- dom.add(ob, 'span', tinymce.extend({mce_name : 'embed', type : o.type, style : dom.getAttrib(n, 'style')}, p));
+ dom.add(ob, 'span', tinymce.extend({_mce_name : 'embed', type : o.type, style : dom.getAttrib(n, 'style')}, p));
return ob;
},
diff --git a/program/js/tiny_mce/plugins/media/media.htm b/program/js/tiny_mce/plugins/media/media.htm
index 911c03dcc..73a903f7c 100644
--- a/program/js/tiny_mce/plugins/media/media.htm
+++ b/program/js/tiny_mce/plugins/media/media.htm
@@ -809,13 +809,8 @@
</div>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" id="insert" name="insert" value="{#insert}" />
- </div>
-
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#insert}" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>
diff --git a/program/js/tiny_mce/plugins/nonbreaking/editor_plugin_src.js b/program/js/tiny_mce/plugins/nonbreaking/editor_plugin_src.js
index b72375660..e3b078bfa 100644
--- a/program/js/tiny_mce/plugins/nonbreaking/editor_plugin_src.js
+++ b/program/js/tiny_mce/plugins/nonbreaking/editor_plugin_src.js
@@ -1,8 +1,11 @@
/**
- * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
+ * editor_plugin_src.js
*
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
diff --git a/program/js/tiny_mce/plugins/paste/editor_plugin.js b/program/js/tiny_mce/plugins/paste/editor_plugin.js
index 7b2bbd9b3..78fd6d73e 100644
--- a/program/js/tiny_mce/plugins/paste/editor_plugin.js
+++ b/program/js/tiny_mce/plugins/paste/editor_plugin.js
@@ -1 +1 @@
-(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.PastePlugin",{init:function(c,d){var e=this,b;e.editor=c;e.url=d;e.onPreProcess=new tinymce.util.Dispatcher(e);e.onPostProcess=new tinymce.util.Dispatcher(e);e.onPreProcess.add(e._preProcess);e.onPostProcess.add(e._postProcess);e.onPreProcess.add(function(h,i){c.execCallback("paste_preprocess",h,i)});e.onPostProcess.add(function(h,i){c.execCallback("paste_postprocess",h,i)});function g(i){var h=c.dom;e.onPreProcess.dispatch(e,i);i.node=h.create("div",0,i.content);e.onPostProcess.dispatch(e,i);i.content=c.serializer.serialize(i.node,{getInner:1});if(/<(p|h[1-6]|ul|ol)/.test(i.content)){e._insertBlockContent(c,h,i.content)}else{e._insert(i.content)}}c.addCommand("mceInsertClipboardContent",function(h,i){g(i)});function f(l){var p,k,i,j=c.selection,o=c.dom,h=c.getBody(),m;if(o.get("_mcePaste")){return}p=o.add(h,"div",{id:"_mcePaste"},"\uFEFF");if(h!=c.getDoc().body){m=o.getPos(c.selection.getStart(),h).y}else{m=h.scrollTop}o.setStyles(p,{position:"absolute",left:-10000,top:m,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){i=o.doc.body.createTextRange();i.moveToElementText(p);i.execCommand("Paste");o.remove(p);if(p.innerHTML==="\uFEFF"){c.execCommand("mcePasteWord");l.preventDefault();return}g({content:p.innerHTML});return tinymce.dom.Event.cancel(l)}else{k=c.selection.getRng();p=p.firstChild;i=c.getDoc().createRange();i.setStart(p,0);i.setEnd(p,1);j.setRng(i);window.setTimeout(function(){var q="",n=o.select("div[id=_mcePaste]");a(n,function(r){q+=(o.select("> span.Apple-style-span div",r)[0]||o.select("> span.Apple-style-span",r)[0]||r).innerHTML});a(n,function(r){o.remove(r)});if(k){j.setRng(k)}g({content:q})},0)}}if(c.getParam("paste_auto_cleanup_on_paste",true)){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){c.onKeyDown.add(function(h,i){if(((tinymce.isMac?i.metaKey:i.ctrlKey)&&i.keyCode==86)||(i.shiftKey&&i.keyCode==45)){f(i)}})}else{c.onPaste.addToTop(function(h,i){return f(i)})}}if(c.getParam("paste_block_drop")){c.onInit.add(function(){c.dom.bind(c.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(h){h.preventDefault();h.stopPropagation();return false})})}e._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(d,i){var b=this.editor,c=i.content,g,f;function g(h){a(h,function(j){if(j.constructor==RegExp){c=c.replace(j,"")}else{c=c.replace(j[0],j[1])}})}if(/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(c)||i.wordContent){i.wordContent=true;g([/^\s*(&nbsp;)+/g,/(&nbsp;|<br[^>]*>)+\s*$/g]);if(b.getParam("paste_convert_middot_lists",true)){g([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+:\s*symbol[^>]+>)/gi,"$1__MCE_ITEM__"],[/(<span[^>]+mso-list:[^>]+>)/gi,"$1__MCE_ITEM__"]])}g([/<!--[\s\S]+?-->/gi,/<\/?(img|font|meta|link|style|div|v:\w+)[^>]*>/gi,/<\\?\?xml[^>]*>/gi,/<\/?o:[^>]*>/gi,/ (id|name|language|type|on\w+|v:\w+)=\"([^\"]*)\"/gi,/ (id|name|language|type|on\w+|v:\w+)=(\w+)/gi,[/<(\/?)s>/gi,"<$1strike>"],/<script[^>]+>[\s\S]*?<\/script>/gi,[/&nbsp;/g,"\u00a0"]]);if(!b.getParam("paste_retain_style_properties")){g([/<\/?(span)[^>]*>/gi])}}f=b.getParam("paste_strip_class_attributes");if(f!="none"){function e(l,h){var k,j="";if(f=="all"){return""}h=tinymce.explode(h," ");for(k=h.length-1;k>=0;k--){if(!/^(Mso)/i.test(h[k])){j+=(!j?"":" ")+h[k]}}return' class="'+j+'"'}g([[/ class=\"([^\"]*)\"/gi,e],[/ class=(\w+)/gi,e]])}if(b.getParam("paste_remove_spans")){g([/<\/?(span)[^>]*>/gi])}i.content=c},_postProcess:function(e,g){var d=this,c=d.editor,f=c.dom,b;if(g.wordContent){a(f.select("a",g.node),function(h){if(!h.href||h.href.indexOf("#_Toc")!=-1){f.remove(h,1)}});if(d.editor.getParam("paste_convert_middot_lists",true)){d._convertLists(e,g)}b=c.getParam("paste_retain_style_properties");if(tinymce.is(b,"string")){b=tinymce.explode(b)}a(f.select("*",g.node),function(l){var m={},j=0,k,n,h;if(b){for(k=0;k<b.length;k++){n=b[k];h=f.getStyle(l,n);if(h){m[n]=h;j++}}}f.setAttrib(l,"style","");if(b&&j>0){f.setStyles(l,m)}else{if(l.nodeName=="SPAN"&&!l.className){f.remove(l,true)}}})}if(c.getParam("paste_remove_styles")||(c.getParam("paste_remove_styles_if_webkit")&&tinymce.isWebKit)){a(f.select("*[style]",g.node),function(h){h.removeAttribute("style");h.removeAttribute("mce_style")})}else{if(tinymce.isWebKit){a(f.select("*",g.node),function(h){h.removeAttribute("mce_style")})}}},_convertLists:function(e,c){var g=e.editor.dom,f,j,b=-1,d,k=[],i,h;a(g.select("p",c.node),function(r){var n,s="",q,o,l,m;for(n=r.firstChild;n&&n.nodeType==3;n=n.nextSibling){s+=n.nodeValue}s=r.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/&nbsp;/g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o]\s*\u00a0*/.test(s)){q="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0{2,}/.test(s)){q="ol"}if(q){d=parseFloat(r.style.marginLeft||0);if(d>b){k.push(d)}if(!f||q!=i){f=g.create(q);g.insertAfter(f,r)}else{if(d>b){f=j.appendChild(g.create(q))}else{if(d<b){l=tinymce.inArray(k,d);m=g.getParents(f.parentNode,q);f=m[m.length-1-l]||f}}}a(g.select("span",r),function(t){var p=t.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(q=="ul"&&/^[\u2022\u00b7\u00a7\u00d8o]/.test(p)){g.remove(t)}else{if(/^[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(p)){g.remove(t)}}});o=r.innerHTML;if(q=="ul"){o=r.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o]\s*(&nbsp;|\u00a0)+\s*/,"")}else{o=r.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/,"")}j=f.appendChild(g.create("li",0,o));g.remove(r);b=d;i=q}else{f=b=0}});h=c.node.innerHTML;if(h.indexOf("__MCE_ITEM__")!=-1){c.node.innerHTML=h.replace(/__MCE_ITEM__/g,"")}},_insertBlockContent:function(h,e,i){var c,g,d=h.selection,m,j,b,k,f;function l(p){var o;if(tinymce.isIE){o=h.getDoc().body.createTextRange();o.moveToElementText(p);o.collapse(false);o.select()}else{d.select(p,1);d.collapse(false)}}this._insert('<span id="_marker">&nbsp;</span>',1);g=e.get("_marker");c=e.getParent(g,"p,h1,h2,h3,h4,h5,h6,ul,ol,th,td");if(c&&!/TD|TH/.test(c.nodeName)){g=e.split(c,g);a(e.create("div",0,i).childNodes,function(o){m=g.parentNode.insertBefore(o.cloneNode(true),g)});l(m)}else{e.setOuterHTML(g,i);d.select(h.getBody(),1);d.collapse(0)}e.remove("_marker");j=d.getStart();b=e.getViewPort(h.getWin());k=h.dom.getPos(j).y;f=j.clientHeight;if(k<b.y||k+f>b.y+b.h){h.getDoc().body.scrollTop=k<b.y?k:k-b.h+25}},_insert:function(d,b){var c=this.editor;if(!c.selection.isCollapsed()){c.getDoc().execCommand("Delete",false,null)}c.execCommand(tinymce.isGecko?"insertHTML":"mceInsertContent",false,d,{skip_undo:b})},_legacySupport:function(){var c=this,b=c.editor;a(["mcePasteText","mcePasteWord"],function(d){b.addCommand(d,function(){b.windowManager.open({file:c.url+(d=="mcePasteText"?"/pastetext.htm":"/pasteword.htm"),width:parseInt(b.getParam("paste_dialog_width","450")),height:parseInt(b.getParam("paste_dialog_height","400")),inline:1})})});b.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});b.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"});b.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})(); \ No newline at end of file
+(function(){var c=tinymce.each,d=null,a={paste_auto_cleanup_on_paste:true,paste_block_drop:false,paste_retain_style_properties:"none",paste_strip_class_attributes:"mso",paste_remove_spans:false,paste_remove_styles:false,paste_remove_styles_if_webkit:true,paste_convert_middot_lists:true,paste_convert_headers_to_strong:false,paste_dialog_width:"450",paste_dialog_height:"400",paste_text_use_dialog:false,paste_text_sticky:false,paste_text_notifyalways:false,paste_text_linebreaktype:"p",paste_text_replacements:[[/\u2026/g,"..."],[/[\x93\x94\u201c\u201d]/g,'"'],[/[\x60\x91\x92\u2018\u2019]/g,"'"]]};function b(e,f){return e.getParam(f,a[f])}tinymce.create("tinymce.plugins.PastePlugin",{init:function(e,f){var g=this;g.editor=e;g.url=f;g.onPreProcess=new tinymce.util.Dispatcher(g);g.onPostProcess=new tinymce.util.Dispatcher(g);g.onPreProcess.add(g._preProcess);g.onPostProcess.add(g._postProcess);g.onPreProcess.add(function(j,k){e.execCallback("paste_preprocess",j,k)});g.onPostProcess.add(function(j,k){e.execCallback("paste_postprocess",j,k)});e.pasteAsPlainText=false;function i(l,j){var k=e.dom;g.onPreProcess.dispatch(g,l);l.node=k.create("div",0,l.content);g.onPostProcess.dispatch(g,l);l.content=e.serializer.serialize(l.node,{getInner:1});if((!j)&&(e.pasteAsPlainText)){g._insertPlainText(e,k,l.content);if(!b(e,"paste_text_sticky")){e.pasteAsPlainText=false;e.controlManager.setActive("pastetext",false)}}else{if(/<(p|h[1-6]|ul|ol)/.test(l.content)){g._insertBlockContent(e,k,l.content)}else{g._insert(l.content)}}}e.addCommand("mceInsertClipboardContent",function(j,k){i(k,true)});if(!b(e,"paste_text_use_dialog")){e.addCommand("mcePasteText",function(k,j){var l=tinymce.util.Cookie;e.pasteAsPlainText=!e.pasteAsPlainText;e.controlManager.setActive("pastetext",e.pasteAsPlainText);if((e.pasteAsPlainText)&&(!l.get("tinymcePasteText"))){if(b(e,"paste_text_sticky")){e.windowManager.alert("Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.")}else{e.windowManager.alert("Paste is now in plain text mode. Click again to toggle back to regular paste mode.")}if(!b(e,"paste_text_notifyalways")){l.set("tinymcePasteText","1",new Date(new Date().getFullYear()+1,12,31))}}})}e.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});e.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"});function h(s){var m,q,k,l=e.selection,p=e.dom,r=e.getBody(),j;if(p.get("_mcePaste")){return}m=p.add(r,"div",{id:"_mcePaste","class":"mcePaste"},"\uFEFF");if(r!=e.getDoc().body){j=p.getPos(e.selection.getStart(),r).y}else{j=r.scrollTop}p.setStyles(m,{position:"absolute",left:-10000,top:j,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){k=p.doc.body.createTextRange();k.moveToElementText(m);k.execCommand("Paste");p.remove(m);if(m.innerHTML==="\uFEFF"){e.execCommand("mcePasteWord");s.preventDefault();return}i({content:m.innerHTML});return tinymce.dom.Event.cancel(s)}else{function o(n){n.preventDefault()}p.bind(e.getDoc(),"mousedown",o);p.bind(e.getDoc(),"keydown",o);q=e.selection.getRng();m=m.firstChild;k=e.getDoc().createRange();k.setStart(m,0);k.setEnd(m,1);l.setRng(k);window.setTimeout(function(){var t="",n=p.select("div.mcePaste");c(n,function(u){c(p.select("div.mcePaste",u),function(v){p.remove(v,1)});t+=(p.select("> span.Apple-style-span div",u)[0]||p.select("> span.Apple-style-span",u)[0]||u).innerHTML});c(n,function(u){p.remove(u)});if(q){l.setRng(q)}i({content:t});p.unbind(e.getDoc(),"mousedown",o);p.unbind(e.getDoc(),"keydown",o)},0)}}if(b(e,"paste_auto_cleanup_on_paste")){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){e.onKeyDown.add(function(j,k){if(((tinymce.isMac?k.metaKey:k.ctrlKey)&&k.keyCode==86)||(k.shiftKey&&k.keyCode==45)){h(k)}})}else{e.onPaste.addToTop(function(j,k){return h(k)})}}if(b(e,"paste_block_drop")){e.onInit.add(function(){e.dom.bind(e.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(j){j.preventDefault();j.stopPropagation();return false})})}g._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(i,f){var l=this.editor,k=f.content,q=tinymce.grep,p=tinymce.explode,g=tinymce.trim,m,j;function e(h){c(h,function(o){if(o.constructor==RegExp){k=k.replace(o,"")}else{k=k.replace(o[0],o[1])}})}if(/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(k)||f.wordContent){f.wordContent=true;e([/^\s*(&nbsp;)+/gi,/(&nbsp;|<br[^>]*>)+\s*$/gi]);if(b(l,"paste_convert_headers_to_strong")){k=k.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"<p><strong>$1</strong></p>")}if(b(l,"paste_convert_middot_lists")){e([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi,"$1__MCE_ITEM__"]])}e([/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi,"\u00a0"]]);do{m=k.length;k=k.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi,"$1")}while(m!=k.length);if(b(l,"paste_retain_style_properties").replace(/^none$/i,"").length==0){k=k.replace(/<\/?span[^>]*>/gi,"")}else{e([[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(o,h){return(h.length>0)?h.replace(/./," ").slice(Math.floor(h.length/2)).split("").join("\u00a0"):""}],[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,function(u,h,t){var v=[],o=0,r=p(g(t).replace(/&quot;/gi,"'"),";");c(r,function(s){var w,y,z=p(s,":");function x(A){return A+((A!=="0")&&(/\d$/.test(A)))?"px":""}if(z.length==2){w=z[0].toLowerCase();y=z[1].toLowerCase();switch(w){case"mso-padding-alt":case"mso-padding-top-alt":case"mso-padding-right-alt":case"mso-padding-bottom-alt":case"mso-padding-left-alt":case"mso-margin-alt":case"mso-margin-top-alt":case"mso-margin-right-alt":case"mso-margin-bottom-alt":case"mso-margin-left-alt":case"mso-table-layout-alt":case"mso-height":case"mso-width":case"mso-vertical-align-alt":v[o++]=w.replace(/^mso-|-alt$/g,"")+":"+x(y);return;case"horiz-align":v[o++]="text-align:"+y;return;case"vert-align":v[o++]="vertical-align:"+y;return;case"font-color":case"mso-foreground":v[o++]="color:"+y;return;case"mso-background":case"mso-highlight":v[o++]="background:"+y;return;case"mso-default-height":v[o++]="min-height:"+x(y);return;case"mso-default-width":v[o++]="min-width:"+x(y);return;case"mso-padding-between-alt":v[o++]="border-collapse:separate;border-spacing:"+x(y);return;case"text-line-through":if((y=="single")||(y=="double")){v[o++]="text-decoration:line-through"}return;case"mso-zero-height":if(y=="yes"){v[o++]="display:none"}return}if(/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(w)){return}v[o++]=w+":"+z[1]}});if(o>0){return h+' style="'+v.join(";")+'"'}else{return h}}]])}}if(b(l,"paste_convert_headers_to_strong")){e([[/<h[1-6][^>]*>/gi,"<p><strong>"],[/<\/h[1-6][^>]*>/gi,"</strong></p>"]])}j=b(l,"paste_strip_class_attributes");if(j!=="none"){function n(r,o){if(j==="all"){return""}var h=q(p(o.replace(/^(["'])(.*)\1$/,"$2")," "),function(s){return(/^(?!mso)/i.test(s))});return h.length?' class="'+h.join(" ")+'"':""}k=k.replace(/ class="([^"]+)"/gi,n);k=k.replace(/ class=(\w+)/gi,n)}if(b(l,"paste_remove_spans")){k=k.replace(/<\/?span[^>]*>/gi,"")}f.content=k},_postProcess:function(h,j){var g=this,f=g.editor,i=f.dom,e;if(j.wordContent){c(i.select("a",j.node),function(k){if(!k.href||k.href.indexOf("#_Toc")!=-1){i.remove(k,1)}});if(b(f,"paste_convert_middot_lists")){g._convertLists(h,j)}e=b(f,"paste_retain_style_properties");if((tinymce.is(e,"string"))&&(e!=="all")&&(e!=="*")){e=tinymce.explode(e.replace(/^none$/i,""));c(i.select("*",j.node),function(n){var o={},l=0,m,p,k;if(e){for(m=0;m<e.length;m++){p=e[m];k=i.getStyle(n,p);if(k){o[p]=k;l++}}}i.setAttrib(n,"style","");if(e&&l>0){i.setStyles(n,o)}else{if(n.nodeName=="SPAN"&&!n.className){i.remove(n,true)}}})}}if(b(f,"paste_remove_styles")||(b(f,"paste_remove_styles_if_webkit")&&tinymce.isWebKit)){c(i.select("*[style]",j.node),function(k){k.removeAttribute("style");k.removeAttribute("_mce_style")})}else{if(tinymce.isWebKit){c(i.select("*",j.node),function(k){k.removeAttribute("_mce_style")})}}},_convertLists:function(h,f){var j=h.editor.dom,i,m,e=-1,g,n=[],l,k;c(j.select("p",f.node),function(u){var r,v="",t,s,o,q;for(r=u.firstChild;r&&r.nodeType==3;r=r.nextSibling){v+=r.nodeValue}v=u.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/&nbsp;/g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o]\s*\u00a0*/.test(v)){t="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0{2,}/.test(v)){t="ol"}if(t){g=parseFloat(u.style.marginLeft||0);if(g>e){n.push(g)}if(!i||t!=l){i=j.create(t);j.insertAfter(i,u)}else{if(g>e){i=m.appendChild(j.create(t))}else{if(g<e){o=tinymce.inArray(n,g);q=j.getParents(i.parentNode,t);i=q[q.length-1-o]||i}}}c(j.select("span",u),function(w){var p=w.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(t=="ul"&&/^[\u2022\u00b7\u00a7\u00d8o]/.test(p)){j.remove(w)}else{if(/^[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(p)){j.remove(w)}}});s=u.innerHTML;if(t=="ul"){s=u.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o]\s*(&nbsp;|\u00a0)+\s*/,"")}else{s=u.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/,"")}m=i.appendChild(j.create("li",0,s));j.remove(u);e=g;l=t}else{i=e=0}});k=f.node.innerHTML;if(k.indexOf("__MCE_ITEM__")!=-1){f.node.innerHTML=k.replace(/__MCE_ITEM__/g,"")}},_insertBlockContent:function(l,h,m){var f,j,g=l.selection,q,n,e,o,i,k="mce_marker";function p(t){var s;if(tinymce.isIE){s=l.getDoc().body.createTextRange();s.moveToElementText(t);s.collapse(false);s.select()}else{g.select(t,1);g.collapse(false)}}this._insert('<span id="'+k+'">&nbsp;</span>',1);j=h.get(k);f=h.getParent(j,"p,h1,h2,h3,h4,h5,h6,ul,ol,th,td");if(f&&!/TD|TH/.test(f.nodeName)){j=h.split(f,j);c(h.create("div",0,m).childNodes,function(r){q=j.parentNode.insertBefore(r.cloneNode(true),j)});p(q)}else{h.setOuterHTML(j,m);g.select(l.getBody(),1);g.collapse(0)}while(n=h.get(k)){h.remove(n)}n=g.getStart();e=h.getViewPort(l.getWin());o=l.dom.getPos(n).y;i=n.clientHeight;if(o<e.y||o+i>e.y+e.h){l.getDoc().body.scrollTop=o<e.y?o:o-e.h+25}},_insert:function(g,e){var f=this.editor;if(!f.selection.isCollapsed()){f.getDoc().execCommand("Delete",false,null)}f.execCommand(tinymce.isGecko?"insertHTML":"mceInsertContent",false,g,{skip_undo:e})},_insertPlainText:function(j,x,v){var t,u,l,k,r,e,p,f,n=j.getWin(),z=j.getDoc(),s=j.selection,m=tinymce.is,y=tinymce.inArray,g=b(j,"paste_text_linebreaktype"),o=b(j,"paste_text_replacements");function q(h){c(h,function(i){if(i.constructor==RegExp){v=v.replace(i,"")}else{v=v.replace(i[0],i[1])}})}if((typeof(v)==="string")&&(v.length>0)){if(!d){d=("34,quot,38,amp,39,apos,60,lt,62,gt,"+j.serializer.settings.entities).split(",")}if(/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(v)){q([/[\n\r]+/g])}else{q([/\r+/g])}q([[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi,"\n\n"],[/<br[^>]*>|<\/tr>/gi,"\n"],[/<\/t[dh]>\s*<t[dh][^>]*>/gi,"\t"],/<[a-z!\/?][^>]*>/gi,[/&nbsp;/gi," "],[/&(#\d+|[a-z0-9]{1,10});/gi,function(i,h){if(h.charAt(0)==="#"){return String.fromCharCode(h.slice(1))}else{return((i=y(d,h))>0)?String.fromCharCode(d[i-1]):" "}}],[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi,"$1"],[/\n{3,}/g,"\n\n"],/^\s+|\s+$/g]);v=x.encode(v);if(!s.isCollapsed()){z.execCommand("Delete",false,null)}if(m(o,"array")||(m(o,"array"))){q(o)}else{if(m(o,"string")){q(new RegExp(o,"gi"))}}if(g=="none"){q([[/\n+/g," "]])}else{if(g=="br"){q([[/\n/g,"<br />"]])}else{q([/^\s+|\s+$/g,[/\n\n/g,"</p><p>"],[/\n/g,"<br />"]])}}if((l=v.indexOf("</p><p>"))!=-1){k=v.lastIndexOf("</p><p>");r=s.getNode();e=[];do{if(r.nodeType==1){if(r.nodeName=="TD"||r.nodeName=="BODY"){break}e[e.length]=r}}while(r=r.parentNode);if(e.length>0){p=v.substring(0,l);f="";for(t=0,u=e.length;t<u;t++){p+="</"+e[t].nodeName.toLowerCase()+">";f+="<"+e[e.length-t-1].nodeName.toLowerCase()+">"}if(l==k){v=p+f+v.substring(l+7)}else{v=p+v.substring(l+4,k+4)+f+v.substring(k+7)}}}j.execCommand("mceInsertRawHTML",false,v+'<span id="_plain_text_marker">&nbsp;</span>');window.setTimeout(function(){var h=x.get("_plain_text_marker"),B,i,A,w;s.select(h,false);z.execCommand("Delete",false,null);h=null;B=s.getStart();i=x.getViewPort(n);A=x.getPos(B).y;w=B.clientHeight;if((A<i.y)||(A+w>i.y+i.h)){z.body.scrollTop=A<i.y?A:A-i.h+25}},0)}},_legacySupport:function(){var f=this,e=f.editor;e.addCommand("mcePasteWord",function(){e.windowManager.open({file:f.url+"/pasteword.htm",width:parseInt(b(e,"paste_dialog_width")),height:parseInt(b(e,"paste_dialog_height")),inline:1})});if(b(e,"paste_text_use_dialog")){e.addCommand("mcePasteText",function(){e.windowManager.open({file:f.url+"/pastetext.htm",width:parseInt(b(e,"paste_dialog_width")),height:parseInt(b(e,"paste_dialog_height")),inline:1})})}e.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})(); \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/paste/editor_plugin_src.js b/program/js/tiny_mce/plugins/paste/editor_plugin_src.js
index 8b6cae3d1..d85b39bd3 100644
--- a/program/js/tiny_mce/plugins/paste/editor_plugin_src.js
+++ b/program/js/tiny_mce/plugins/paste/editor_plugin_src.js
@@ -1,16 +1,46 @@
/**
- * $Id: editor_plugin_src.js 1225 2009-09-07 19:06:19Z spocke $
+ * editor_plugin_src.js
*
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
- var each = tinymce.each;
+ var each = tinymce.each,
+ entities = null,
+ defs = {
+ paste_auto_cleanup_on_paste : true,
+ paste_block_drop : false,
+ paste_retain_style_properties : "none",
+ paste_strip_class_attributes : "mso",
+ paste_remove_spans : false,
+ paste_remove_styles : false,
+ paste_remove_styles_if_webkit : true,
+ paste_convert_middot_lists : true,
+ paste_convert_headers_to_strong : false,
+ paste_dialog_width : "450",
+ paste_dialog_height : "400",
+ paste_text_use_dialog : false,
+ paste_text_sticky : false,
+ paste_text_notifyalways : false,
+ paste_text_linebreaktype : "p",
+ paste_text_replacements : [
+ [/\u2026/g, "..."],
+ [/[\x93\x94\u201c\u201d]/g, '"'],
+ [/[\x60\x91\x92\u2018\u2019]/g, "'"]
+ ]
+ };
+
+ function getParam(ed, name) {
+ return ed.getParam(name, defs[name]);
+ }
tinymce.create('tinymce.plugins.PastePlugin', {
init : function(ed, url) {
- var t = this, cb;
+ var t = this;
t.editor = ed;
t.url = url;
@@ -33,8 +63,12 @@
ed.execCallback('paste_postprocess', pl, o);
});
+ // Initialize plain text flag
+ ed.pasteAsPlainText = false;
+
// This function executes the process handlers and inserts the contents
- function process(o) {
+ // force_rich overrides plain text mode set by user, important for pasting with execCommand
+ function process(o, force_rich) {
var dom = ed.dom;
// Execute pre process handlers
@@ -49,18 +83,51 @@
// Serialize content
o.content = ed.serializer.serialize(o.node, {getInner : 1});
- // Insert cleaned content. We need to handle insertion of contents containing block elements separately
- if (/<(p|h[1-6]|ul|ol)/.test(o.content))
+ // Plain text option active?
+ if ((!force_rich) && (ed.pasteAsPlainText)) {
+ t._insertPlainText(ed, dom, o.content);
+
+ if (!getParam(ed, "paste_text_sticky")) {
+ ed.pasteAsPlainText = false;
+ ed.controlManager.setActive("pastetext", false);
+ }
+ } else if (/<(p|h[1-6]|ul|ol)/.test(o.content)) {
+ // Handle insertion of contents containing block elements separately
t._insertBlockContent(ed, dom, o.content);
- else
+ } else {
t._insert(o.content);
- };
+ }
+ }
// Add command for external usage
ed.addCommand('mceInsertClipboardContent', function(u, o) {
- process(o);
+ process(o, true);
});
+ if (!getParam(ed, "paste_text_use_dialog")) {
+ ed.addCommand('mcePasteText', function(u, v) {
+ var cookie = tinymce.util.Cookie;
+
+ ed.pasteAsPlainText = !ed.pasteAsPlainText;
+ ed.controlManager.setActive('pastetext', ed.pasteAsPlainText);
+
+ if ((ed.pasteAsPlainText) && (!cookie.get("tinymcePasteText"))) {
+ if (getParam(ed, "paste_text_sticky")) {
+ ed.windowManager.alert("Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.");
+ } else {
+ ed.windowManager.alert("Paste is now in plain text mode. Click again to toggle back to regular paste mode.");
+ }
+
+ if (!getParam(ed, "paste_text_notifyalways")) {
+ cookie.set("tinymcePasteText", "1", new Date(new Date().getFullYear() + 1, 12, 31))
+ }
+ }
+ });
+ }
+
+ ed.addButton('pastetext', {title: 'paste.paste_text_desc', cmd: 'mcePasteText'});
+ ed.addButton('selectall', {title: 'paste.selectall_desc', cmd: 'selectall'});
+
// This function grabs the contents from the clipboard by adding a
// hidden div and placing the caret inside it and after the browser paste
// is done it grabs that contents and processes that
@@ -71,7 +138,7 @@
return;
// Create container to paste into
- n = dom.add(body, 'div', {id : '_mcePaste'}, '\uFEFF');
+ n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste'}, '\uFEFF');
// If contentEditable mode we need to find out the position of the closest element
if (body != ed.getDoc().body)
@@ -112,6 +179,14 @@
// Block the real paste event
return tinymce.dom.Event.cancel(e);
} else {
+ function block(e) {
+ e.preventDefault();
+ };
+
+ // Block mousedown and click to prevent selection change
+ dom.bind(ed.getDoc(), 'mousedown', block);
+ dom.bind(ed.getDoc(), 'keydown', block);
+
or = ed.selection.getRng();
// Move caret into hidden div
@@ -123,10 +198,16 @@
// Wait a while and grab the pasted contents
window.setTimeout(function() {
- var h = '', nl = dom.select('div[id=_mcePaste]');
+ var h = '', nl = dom.select('div.mcePaste');
// WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string
each(nl, function(n) {
+ // WebKit duplicates the divs so we need to remove them
+ each(dom.select('div.mcePaste', n), function(n) {
+ dom.remove(n, 1);
+ });
+
+ // Contents in WebKit is sometimes wrapped in a apple style span so we need to grab it from that one
h += (dom.select('> span.Apple-style-span div', n)[0] || dom.select('> span.Apple-style-span', n)[0] || n).innerHTML;
});
@@ -140,12 +221,16 @@
sel.setRng(or);
process({content : h});
+
+ // Unblock events ones we got the contents
+ dom.unbind(ed.getDoc(), 'mousedown', block);
+ dom.unbind(ed.getDoc(), 'keydown', block);
}, 0);
}
- };
+ }
// Check if we should use the new auto process method
- if (ed.getParam('paste_auto_cleanup_on_paste', true)) {
+ if (getParam(ed, "paste_auto_cleanup_on_paste")) {
// Is it's Opera or older FF use key handler
if (tinymce.isOpera || /Firefox\/2/.test(navigator.userAgent)) {
ed.onKeyDown.add(function(ed, e) {
@@ -161,7 +246,7 @@
}
// Block all drag/drop events
- if (ed.getParam('paste_block_drop')) {
+ if (getParam(ed, "paste_block_drop")) {
ed.onInit.add(function() {
ed.dom.bind(ed.getBody(), ['dragend', 'dragover', 'draggesture', 'dragdrop', 'drop', 'drag'], function(e) {
e.preventDefault();
@@ -187,10 +272,15 @@
},
_preProcess : function(pl, o) {
- var ed = this.editor, h = o.content, process, stripClass;
-
//console.log('Before preprocess:' + o.content);
+ var ed = this.editor,
+ h = o.content,
+ grep = tinymce.grep,
+ explode = tinymce.explode,
+ trim = tinymce.trim,
+ len, stripClass;
+
function process(items) {
each(items, function(v) {
// Remove or replace
@@ -199,81 +289,203 @@
else
h = h.replace(v[0], v[1]);
});
- };
+ }
// Detect Word content and process it more aggressive
- if (/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(h) || o.wordContent) {
- o.wordContent = true; // Mark the pasted contents as word specific content
+ if (/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(h) || o.wordContent) {
+ o.wordContent = true; // Mark the pasted contents as word specific content
//console.log('Word contents detected.');
// Process away some basic content
process([
- /^\s*(&nbsp;)+/g, // nbsp entities at the start of contents
- /(&nbsp;|<br[^>]*>)+\s*$/g // nbsp entities at the end of contents
+ /^\s*(&nbsp;)+/gi, // &nbsp; entities at the start of contents
+ /(&nbsp;|<br[^>]*>)+\s*$/gi // &nbsp; entities at the end of contents
]);
- if (ed.getParam('paste_convert_middot_lists', true)) {
+ if (getParam(ed, "paste_convert_headers_to_strong")) {
+ h = h.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi, "<p><strong>$1</strong></p>");
+ }
+
+ if (getParam(ed, "paste_convert_middot_lists")) {
process([
- [/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'], // Convert supportLists to a list item marker
- [/(<span[^>]+:\s*symbol[^>]+>)/gi, '$1__MCE_ITEM__'], // Convert symbol spans to list items
- [/(<span[^>]+mso-list:[^>]+>)/gi, '$1__MCE_ITEM__'] // Convert mso-list to item marker
+ [/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'], // Convert supportLists to a list item marker
+ [/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi, '$1__MCE_ITEM__'] // Convert mso-list and symbol spans to item markers
]);
}
process([
- /<!--[\s\S]+?-->/gi, // Word comments
- /<\/?(img|font|meta|link|style|div|v:\w+)[^>]*>/gi, // Remove some tags including VML content
- /<\\?\?xml[^>]*>/gi, // XML namespace declarations
- /<\/?o:[^>]*>/gi, // MS namespaced elements <o:tag>
- / (id|name|language|type|on\w+|v:\w+)=\"([^\"]*)\"/gi, // on.., class, style and language attributes with quotes
- / (id|name|language|type|on\w+|v:\w+)=(\w+)/gi, // on.., class, style and language attributes without quotes (IE)
- [/<(\/?)s>/gi, '<$1strike>'], // Convert <s> into <strike> for line-though
- /<script[^>]+>[\s\S]*?<\/script>/gi, // All scripts elements for msoShowComment for example
- [/&nbsp;/g, '\u00a0'] // Replace nsbp entites to char since it's easier to handle
+ // Word comments like conditional comments etc
+ /<!--[\s\S]+?-->/gi,
+
+ // Remove comments, scripts (e.g., msoShowComment), XML tag, VML content, MS Office namespaced tags, and a few other tags
+ /<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
+
+ // Convert <s> into <strike> for line-though
+ [/<(\/?)s>/gi, "<$1strike>"],
+
+ // Replace nsbp entites to char since it's easier to handle
+ [/&nbsp;/gi, "\u00a0"]
]);
+ // Remove bad attributes, with or without quotes, ensuring that attribute text is really inside a tag.
+ // If JavaScript had a RegExp look-behind, we could have integrated this with the last process() array and got rid of the loop. But alas, it does not, so we cannot.
+ do {
+ len = h.length;
+ h = h.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");
+ } while (len != h.length);
+
// Remove all spans if no styles is to be retained
- if (!ed.getParam('paste_retain_style_properties')) {
+ if (getParam(ed, "paste_retain_style_properties").replace(/^none$/i, "").length == 0) {
+ h = h.replace(/<\/?span[^>]*>/gi, "");
+ } else {
+ // We're keeping styles, so at least clean them up.
+ // CSS Reference: http://msdn.microsoft.com/en-us/library/aa155477.aspx
+
process([
- /<\/?(span)[^>]*>/gi
+ // Convert <span style="mso-spacerun:yes">___</span> to string of alternating breaking/non-breaking spaces of same length
+ [/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
+ function(str, spaces) {
+ return (spaces.length > 0)? spaces.replace(/./, " ").slice(Math.floor(spaces.length/2)).split("").join("\u00a0") : "";
+ }
+ ],
+
+ // Examine all styles: delete junk, transform some, and keep the rest
+ [/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,
+ function(str, tag, style) {
+ var n = [],
+ i = 0,
+ s = explode(trim(style).replace(/&quot;/gi, "'"), ";");
+
+ // Examine each style definition within the tag's style attribute
+ each(s, function(v) {
+ var name, value,
+ parts = explode(v, ":");
+
+ function ensureUnits(v) {
+ return v + ((v !== "0") && (/\d$/.test(v)))? "px" : "";
+ }
+
+ if (parts.length == 2) {
+ name = parts[0].toLowerCase();
+ value = parts[1].toLowerCase();
+
+ // Translate certain MS Office styles into their CSS equivalents
+ switch (name) {
+ case "mso-padding-alt":
+ case "mso-padding-top-alt":
+ case "mso-padding-right-alt":
+ case "mso-padding-bottom-alt":
+ case "mso-padding-left-alt":
+ case "mso-margin-alt":
+ case "mso-margin-top-alt":
+ case "mso-margin-right-alt":
+ case "mso-margin-bottom-alt":
+ case "mso-margin-left-alt":
+ case "mso-table-layout-alt":
+ case "mso-height":
+ case "mso-width":
+ case "mso-vertical-align-alt":
+ n[i++] = name.replace(/^mso-|-alt$/g, "") + ":" + ensureUnits(value);
+ return;
+
+ case "horiz-align":
+ n[i++] = "text-align:" + value;
+ return;
+
+ case "vert-align":
+ n[i++] = "vertical-align:" + value;
+ return;
+
+ case "font-color":
+ case "mso-foreground":
+ n[i++] = "color:" + value;
+ return;
+
+ case "mso-background":
+ case "mso-highlight":
+ n[i++] = "background:" + value;
+ return;
+
+ case "mso-default-height":
+ n[i++] = "min-height:" + ensureUnits(value);
+ return;
+
+ case "mso-default-width":
+ n[i++] = "min-width:" + ensureUnits(value);
+ return;
+
+ case "mso-padding-between-alt":
+ n[i++] = "border-collapse:separate;border-spacing:" + ensureUnits(value);
+ return;
+
+ case "text-line-through":
+ if ((value == "single") || (value == "double")) {
+ n[i++] = "text-decoration:line-through";
+ }
+ return;
+
+ case "mso-zero-height":
+ if (value == "yes") {
+ n[i++] = "display:none";
+ }
+ return;
+ }
+
+ // Eliminate all MS Office style definitions that have no CSS equivalent by examining the first characters in the name
+ if (/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(name)) {
+ return;
+ }
+
+ // If it reached this point, it must be a valid CSS style
+ n[i++] = name + ":" + parts[1]; // Lower-case name, but keep value case
+ }
+ });
+
+ // If style attribute contained any valid styles the re-write it; otherwise delete style attribute.
+ if (i > 0) {
+ return tag + ' style="' + n.join(';') + '"';
+ } else {
+ return tag;
+ }
+ }
+ ]
]);
}
}
- // Allow for class names to be retained if desired; either all, or just the ones from Word
- // Note that the paste_strip_class_attributes: 'none, verify_css_classes: true is also a good variation.
- stripClass = ed.getParam('paste_strip_class_attributes');
- if (stripClass != 'none') {
- // Cleans everything but mceItem... classes
- function cleanClasses(str, cls) {
- var i, out = '';
+ // Replace headers with <strong>
+ if (getParam(ed, "paste_convert_headers_to_strong")) {
+ process([
+ [/<h[1-6][^>]*>/gi, "<p><strong>"],
+ [/<\/h[1-6][^>]*>/gi, "</strong></p>"]
+ ]);
+ }
- // Remove all classes
- if (stripClass == 'all')
- return '';
+ // Class attribute options are: leave all as-is ("none"), remove all ("all"), or remove only those starting with mso ("mso").
+ // Note:- paste_strip_class_attributes: "none", verify_css_classes: true is also a good variation.
+ stripClass = getParam(ed, "paste_strip_class_attributes");
- cls = tinymce.explode(cls, ' ');
+ if (stripClass !== "none") {
+ function removeClasses(match, g1) {
+ if (stripClass === "all")
+ return '';
- for (i = cls.length - 1; i >= 0; i--) {
- // Remove Mso classes
- if (!/^(Mso)/i.test(cls[i]))
- out += (!out ? '' : ' ') + cls[i];
- }
+ var cls = grep(explode(g1.replace(/^(["'])(.*)\1$/, "$2"), " "),
+ function(v) {
+ return (/^(?!mso)/i.test(v));
+ }
+ );
- return ' class="' + out + '"';
+ return cls.length ? ' class="' + cls.join(" ") + '"' : '';
};
- process([
- [/ class=\"([^\"]*)\"/gi, cleanClasses], // class attributes with quotes
- [/ class=(\w+)/gi, cleanClasses] // class attributes without quotes (IE)
- ]);
+ h = h.replace(/ class="([^"]+)"/gi, removeClasses);
+ h = h.replace(/ class=(\w+)/gi, removeClasses);
}
// Remove spans option
- if (ed.getParam('paste_remove_spans')) {
- process([
- /<\/?(span)[^>]*>/gi
- ]);
+ if (getParam(ed, "paste_remove_spans")) {
+ h = h.replace(/<\/?span[^>]*>/gi, "");
}
//console.log('After preprocess:' + h);
@@ -294,56 +506,58 @@
dom.remove(a, 1);
});
- if (t.editor.getParam('paste_convert_middot_lists', true))
+ if (getParam(ed, "paste_convert_middot_lists")) {
t._convertLists(pl, o);
+ }
// Process styles
- styleProps = ed.getParam('paste_retain_style_properties'); // retained properties
+ styleProps = getParam(ed, "paste_retain_style_properties"); // retained properties
- // If string property then split it
- if (tinymce.is(styleProps, 'string'))
- styleProps = tinymce.explode(styleProps);
+ // Process only if a string was specified and not equal to "all" or "*"
+ if ((tinymce.is(styleProps, "string")) && (styleProps !== "all") && (styleProps !== "*")) {
+ styleProps = tinymce.explode(styleProps.replace(/^none$/i, ""));
- // Retains some style properties
- each(dom.select('*', o.node), function(el) {
- var newStyle = {}, npc = 0, i, sp, sv;
-
- // Store a subset of the existing styles
- if (styleProps) {
- for (i = 0; i < styleProps.length; i++) {
- sp = styleProps[i];
- sv = dom.getStyle(el, sp);
-
- if (sv) {
- newStyle[sp] = sv;
- npc++;
+ // Retains some style properties
+ each(dom.select('*', o.node), function(el) {
+ var newStyle = {}, npc = 0, i, sp, sv;
+
+ // Store a subset of the existing styles
+ if (styleProps) {
+ for (i = 0; i < styleProps.length; i++) {
+ sp = styleProps[i];
+ sv = dom.getStyle(el, sp);
+
+ if (sv) {
+ newStyle[sp] = sv;
+ npc++;
+ }
}
}
- }
- // Remove all of the existing styles
- dom.setAttrib(el, 'style', '');
+ // Remove all of the existing styles
+ dom.setAttrib(el, 'style', '');
- if (styleProps && npc > 0)
- dom.setStyles(el, newStyle); // Add back the stored subset of styles
- else // Remove empty span tags that do not have class attributes
- if (el.nodeName == 'SPAN' && !el.className)
- dom.remove(el, true);
- });
+ if (styleProps && npc > 0)
+ dom.setStyles(el, newStyle); // Add back the stored subset of styles
+ else // Remove empty span tags that do not have class attributes
+ if (el.nodeName == 'SPAN' && !el.className)
+ dom.remove(el, true);
+ });
+ }
}
// Remove all style information or only specifically on WebKit to avoid the style bug on that browser
- if (ed.getParam("paste_remove_styles") || (ed.getParam("paste_remove_styles_if_webkit") && tinymce.isWebKit)) {
+ if (getParam(ed, "paste_remove_styles") || (getParam(ed, "paste_remove_styles_if_webkit") && tinymce.isWebKit)) {
each(dom.select('*[style]', o.node), function(el) {
el.removeAttribute('style');
- el.removeAttribute('mce_style');
+ el.removeAttribute('_mce_style');
});
} else {
if (tinymce.isWebKit) {
// We need to compress the styles on WebKit since if you paste <img border="0" /> it will become <img border="0" style="... lots of junk ..." />
// Removing the mce_style that contains the real value will force the Serializer engine to compress the styles
each(dom.select('*', o.node), function(el) {
- el.removeAttribute('mce_style');
+ el.removeAttribute('_mce_style');
});
}
}
@@ -435,7 +649,7 @@
* This logic can be improved so text nodes at the start/end remain in the start/end block elements
*/
_insertBlockContent : function(ed, dom, content) {
- var parentBlock, marker, sel = ed.selection, last, elm, vp, y, elmHeight;
+ var parentBlock, marker, sel = ed.selection, last, elm, vp, y, elmHeight, markerId = 'mce_marker';
function select(n) {
var r;
@@ -449,11 +663,11 @@
sel.select(n, 1);
sel.collapse(false);
}
- };
+ }
// Insert a marker for the caret position
- this._insert('<span id="_marker">&nbsp;</span>', 1);
- marker = dom.get('_marker');
+ this._insert('<span id="' + markerId + '">&nbsp;</span>', 1);
+ marker = dom.get(markerId);
parentBlock = dom.getParent(marker, 'p,h1,h2,h3,h4,h5,h6,ul,ol,th,td');
// If it's a parent block but not a table cell
@@ -474,7 +688,9 @@
sel.collapse(0);
}
- dom.remove('_marker'); // Remove marker if it's left
+ // Remove marker if it's left
+ while (elm = dom.get(markerId))
+ dom.remove(elm);
// Get element, position and height
elm = sel.getStart();
@@ -502,30 +718,212 @@
},
/**
+ * Instead of the old plain text method which tried to re-create a paste operation, the
+ * new approach adds a plain text mode toggle switch that changes the behavior of paste.
+ * This function is passed the same input that the regular paste plugin produces.
+ * It performs additional scrubbing and produces (and inserts) the plain text.
+ * This approach leverages all of the great existing functionality in the paste
+ * plugin, and requires minimal changes to add the new functionality.
+ * Speednet - June 2009
+ */
+ _insertPlainText : function(ed, dom, h) {
+ var i, len, pos, rpos, node, breakElms, before, after,
+ w = ed.getWin(),
+ d = ed.getDoc(),
+ sel = ed.selection,
+ is = tinymce.is,
+ inArray = tinymce.inArray,
+ linebr = getParam(ed, "paste_text_linebreaktype"),
+ rl = getParam(ed, "paste_text_replacements");
+
+ function process(items) {
+ each(items, function(v) {
+ if (v.constructor == RegExp)
+ h = h.replace(v, "");
+ else
+ h = h.replace(v[0], v[1]);
+ });
+ };
+
+ if ((typeof(h) === "string") && (h.length > 0)) {
+ if (!entities)
+ entities = ("34,quot,38,amp,39,apos,60,lt,62,gt," + ed.serializer.settings.entities).split(",");
+
+ // If HTML content with line-breaking tags, then remove all cr/lf chars because only tags will break a line
+ if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(h)) {
+ process([
+ /[\n\r]+/g
+ ]);
+ } else {
+ // Otherwise just get rid of carriage returns (only need linefeeds)
+ process([
+ /\r+/g
+ ]);
+ }
+
+ process([
+ [/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi, "\n\n"], // Block tags get a blank line after them
+ [/<br[^>]*>|<\/tr>/gi, "\n"], // Single linebreak for <br /> tags and table rows
+ [/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"], // Table cells get tabs betweem them
+ /<[a-z!\/?][^>]*>/gi, // Delete all remaining tags
+ [/&nbsp;/gi, " "], // Convert non-break spaces to regular spaces (remember, *plain text*)
+ [
+ // HTML entity
+ /&(#\d+|[a-z0-9]{1,10});/gi,
+
+ // Replace with actual character
+ function(e, s) {
+ if (s.charAt(0) === "#") {
+ return String.fromCharCode(s.slice(1));
+ }
+ else {
+ return ((e = inArray(entities, s)) > 0)? String.fromCharCode(entities[e-1]) : " ";
+ }
+ }
+ ],
+ [/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"], // Cool little RegExp deletes whitespace around linebreak chars.
+ [/\n{3,}/g, "\n\n"], // Max. 2 consecutive linebreaks
+ /^\s+|\s+$/g // Trim the front & back
+ ]);
+
+ h = dom.encode(h);
+
+ // Delete any highlighted text before pasting
+ if (!sel.isCollapsed()) {
+ d.execCommand("Delete", false, null);
+ }
+
+ // Perform default or custom replacements
+ if (is(rl, "array") || (is(rl, "array"))) {
+ process(rl);
+ }
+ else if (is(rl, "string")) {
+ process(new RegExp(rl, "gi"));
+ }
+
+ // Treat paragraphs as specified in the config
+ if (linebr == "none") {
+ process([
+ [/\n+/g, " "]
+ ]);
+ }
+ else if (linebr == "br") {
+ process([
+ [/\n/g, "<br />"]
+ ]);
+ }
+ else {
+ process([
+ /^\s+|\s+$/g,
+ [/\n\n/g, "</p><p>"],
+ [/\n/g, "<br />"]
+ ]);
+ }
+
+ // This next piece of code handles the situation where we're pasting more than one paragraph of plain
+ // text, and we are pasting the content into the middle of a block node in the editor. The block
+ // node gets split at the selection point into "Para A" and "Para B" (for the purposes of explaining).
+ // The first paragraph of the pasted text is appended to "Para A", and the last paragraph of the
+ // pasted text is prepended to "Para B". Any other paragraphs of pasted text are placed between
+ // "Para A" and "Para B". This code solves a host of problems with the original plain text plugin and
+ // now handles styles correctly. (Pasting plain text into a styled paragraph is supposed to make the
+ // plain text take the same style as the existing paragraph.)
+ if ((pos = h.indexOf("</p><p>")) != -1) {
+ rpos = h.lastIndexOf("</p><p>");
+ node = sel.getNode();
+ breakElms = []; // Get list of elements to break
+
+ do {
+ if (node.nodeType == 1) {
+ // Don't break tables and break at body
+ if (node.nodeName == "TD" || node.nodeName == "BODY") {
+ break;
+ }
+
+ breakElms[breakElms.length] = node;
+ }
+ } while (node = node.parentNode);
+
+ // Are we in the middle of a block node?
+ if (breakElms.length > 0) {
+ before = h.substring(0, pos);
+ after = "";
+
+ for (i=0, len=breakElms.length; i<len; i++) {
+ before += "</" + breakElms[i].nodeName.toLowerCase() + ">";
+ after += "<" + breakElms[breakElms.length-i-1].nodeName.toLowerCase() + ">";
+ }
+
+ if (pos == rpos) {
+ h = before + after + h.substring(pos+7);
+ }
+ else {
+ h = before + h.substring(pos+4, rpos+4) + after + h.substring(rpos+7);
+ }
+ }
+ }
+
+ // Insert content at the caret, plus add a marker for repositioning the caret
+ ed.execCommand("mceInsertRawHTML", false, h + '<span id="_plain_text_marker">&nbsp;</span>');
+
+ // Reposition the caret to the marker, which was placed immediately after the inserted content.
+ // Needs to be done asynchronously (in window.setTimeout) or else it doesn't work in all browsers.
+ // The second part of the code scrolls the content up if the caret is positioned off-screen.
+ // This is only necessary for WebKit browsers, but it doesn't hurt to use for all.
+ window.setTimeout(function() {
+ var marker = dom.get('_plain_text_marker'),
+ elm, vp, y, elmHeight;
+
+ sel.select(marker, false);
+ d.execCommand("Delete", false, null);
+ marker = null;
+
+ // Get element, position and height
+ elm = sel.getStart();
+ vp = dom.getViewPort(w);
+ y = dom.getPos(elm).y;
+ elmHeight = elm.clientHeight;
+
+ // Is element within viewport if not then scroll it into view
+ if ((y < vp.y) || (y + elmHeight > vp.y + vp.h)) {
+ d.body.scrollTop = y < vp.y ? y : y - vp.h + 25;
+ }
+ }, 0);
+ }
+ },
+
+ /**
* This method will open the old style paste dialogs. Some users might want the old behavior but still use the new cleanup engine.
*/
_legacySupport : function() {
var t = this, ed = t.editor;
- // Register commands for backwards compatibility
- each(['mcePasteText', 'mcePasteWord'], function(cmd) {
- ed.addCommand(cmd, function() {
+ // Register command(s) for backwards compatibility
+ ed.addCommand("mcePasteWord", function() {
+ ed.windowManager.open({
+ file: t.url + "/pasteword.htm",
+ width: parseInt(getParam(ed, "paste_dialog_width")),
+ height: parseInt(getParam(ed, "paste_dialog_height")),
+ inline: 1
+ });
+ });
+
+ if (getParam(ed, "paste_text_use_dialog")) {
+ ed.addCommand("mcePasteText", function() {
ed.windowManager.open({
- file : t.url + (cmd == 'mcePasteText' ? '/pastetext.htm' : '/pasteword.htm'),
- width : parseInt(ed.getParam("paste_dialog_width", "450")),
- height : parseInt(ed.getParam("paste_dialog_height", "400")),
+ file : t.url + "/pastetext.htm",
+ width: parseInt(getParam(ed, "paste_dialog_width")),
+ height: parseInt(getParam(ed, "paste_dialog_height")),
inline : 1
});
});
- });
+ }
- // Register buttons for backwards compatibility
- ed.addButton('pastetext', {title : 'paste.paste_text_desc', cmd : 'mcePasteText'});
- ed.addButton('pasteword', {title : 'paste.paste_word_desc', cmd : 'mcePasteWord'});
- ed.addButton('selectall', {title : 'paste.selectall_desc', cmd : 'selectall'});
+ // Register button for backwards compatibility
+ ed.addButton("pasteword", {title : "paste.paste_word_desc", cmd : "mcePasteWord"});
}
});
// Register plugin
- tinymce.PluginManager.add('paste', tinymce.plugins.PastePlugin);
-})(); \ No newline at end of file
+ tinymce.PluginManager.add("paste", tinymce.plugins.PastePlugin);
+})();
diff --git a/program/js/tiny_mce/plugins/paste/pastetext.htm b/program/js/tiny_mce/plugins/paste/pastetext.htm
index 42c3d9c84..b65594547 100644
--- a/program/js/tiny_mce/plugins/paste/pastetext.htm
+++ b/program/js/tiny_mce/plugins/paste/pastetext.htm
@@ -1,7 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{#paste.paste_text_desc}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="js/pastetext.js"></script>
</head>
@@ -20,13 +19,8 @@
<textarea id="content" name="content" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft" class="mceFocus"></textarea>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" name="insert" value="{#insert}" id="insert" />
- </div>
-
- <div style="float: right">
- <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
- </div>
+ <input type="submit" name="insert" value="{#insert}" id="insert" />
+ <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
</div>
</form>
</body>
diff --git a/program/js/tiny_mce/plugins/paste/pasteword.htm b/program/js/tiny_mce/plugins/paste/pasteword.htm
index f4a9b3db3..0f6bb4121 100644
--- a/program/js/tiny_mce/plugins/paste/pasteword.htm
+++ b/program/js/tiny_mce/plugins/paste/pasteword.htm
@@ -1,6 +1,5 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>{#paste.paste_word_desc}</title>
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="js/pasteword.js"></script>
@@ -14,13 +13,8 @@
<div id="iframecontainer"></div>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" id="insert" name="insert" value="{#insert}" />
- </div>
-
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#insert}" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>
diff --git a/program/js/tiny_mce/plugins/searchreplace/editor_plugin.js b/program/js/tiny_mce/plugins/searchreplace/editor_plugin.js
index c3f8358c6..cd9c985b7 100644
--- a/program/js/tiny_mce/plugins/searchreplace/editor_plugin.js
+++ b/program/js/tiny_mce/plugins/searchreplace/editor_plugin.js
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.SearchReplacePlugin",{init:function(a,c){function b(d){a.windowManager.open({file:c+"/searchreplace.htm",width:420+parseInt(a.getLang("searchreplace.delta_width",0)),height:160+parseInt(a.getLang("searchreplace.delta_height",0)),inline:1,auto_focus:0},{mode:d,search_string:a.selection.getContent({format:"text"}),plugin_url:c})}a.addCommand("mceSearch",function(){b("search")});a.addCommand("mceReplace",function(){b("replace")});a.addButton("search",{title:"searchreplace.search_desc",cmd:"mceSearch"});a.addButton("replace",{title:"searchreplace.replace_desc",cmd:"mceReplace"});a.addShortcut("ctrl+f","searchreplace.search_desc","mceSearch")},getInfo:function(){return{longname:"Search/Replace",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("searchreplace",tinymce.plugins.SearchReplacePlugin)})(); \ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.SearchReplacePlugin",{init:function(a,c){function b(d){a.windowManager.open({file:c+"/searchreplace.htm",width:420+parseInt(a.getLang("searchreplace.delta_width",0)),height:170+parseInt(a.getLang("searchreplace.delta_height",0)),inline:1,auto_focus:0},{mode:d,search_string:a.selection.getContent({format:"text"}),plugin_url:c})}a.addCommand("mceSearch",function(){b("search")});a.addCommand("mceReplace",function(){b("replace")});a.addButton("search",{title:"searchreplace.search_desc",cmd:"mceSearch"});a.addButton("replace",{title:"searchreplace.replace_desc",cmd:"mceReplace"});a.addShortcut("ctrl+f","searchreplace.search_desc","mceSearch")},getInfo:function(){return{longname:"Search/Replace",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("searchreplace",tinymce.plugins.SearchReplacePlugin)})(); \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/searchreplace/editor_plugin_src.js b/program/js/tiny_mce/plugins/searchreplace/editor_plugin_src.js
index 59edc3b25..1433a06a4 100644
--- a/program/js/tiny_mce/plugins/searchreplace/editor_plugin_src.js
+++ b/program/js/tiny_mce/plugins/searchreplace/editor_plugin_src.js
@@ -1,8 +1,11 @@
/**
- * $Id: editor_plugin_src.js 686 2008-03-09 18:13:49Z spocke $
+ * editor_plugin_src.js
*
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
@@ -12,7 +15,7 @@
ed.windowManager.open({
file : url + '/searchreplace.htm',
width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)),
- height : 160 + parseInt(ed.getLang('searchreplace.delta_height', 0)),
+ height : 170 + parseInt(ed.getLang('searchreplace.delta_height', 0)),
inline : 1,
auto_focus : 0
}, {
diff --git a/program/js/tiny_mce/plugins/searchreplace/js/searchreplace.js b/program/js/tiny_mce/plugins/searchreplace/js/searchreplace.js
index a8585cccc..c0a624329 100644
--- a/program/js/tiny_mce/plugins/searchreplace/js/searchreplace.js
+++ b/program/js/tiny_mce/plugins/searchreplace/js/searchreplace.js
@@ -75,6 +75,10 @@ var SearchReplaceDialog = {
r.select();
replace();
fo = 1;
+
+ if (b) {
+ r.moveEnd("character", -(rs.length)); // Otherwise will loop forever
+ }
}
tinyMCEPopup.storeSelection();
diff --git a/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm b/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm
index 0b42486b6..d0424cfc9 100644
--- a/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm
+++ b/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm
@@ -89,15 +89,10 @@
</div>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" id="insert" name="insert" value="{#searchreplace_dlg.findnext}" />
- <input type="button" class="button" id="replaceBtn" name="replaceBtn" value="{#searchreplace_dlg.replace}" onclick="SearchReplaceDialog.searchNext('current');" />
- <input type="button" class="button" id="replaceAllBtn" name="replaceAllBtn" value="{#searchreplace_dlg.replaceall}" onclick="SearchReplaceDialog.searchNext('all');" />
- </div>
-
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#searchreplace_dlg.findnext}" />
+ <input type="button" class="button" id="replaceBtn" name="replaceBtn" value="{#searchreplace_dlg.replace}" onclick="SearchReplaceDialog.searchNext('current');" />
+ <input type="button" class="button" id="replaceAllBtn" name="replaceAllBtn" value="{#searchreplace_dlg.replaceall}" onclick="SearchReplaceDialog.searchNext('all');" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>
diff --git a/program/js/tiny_mce/plugins/table/cell.htm b/program/js/tiny_mce/plugins/table/cell.htm
index 1fabc8dc2..d243e1d83 100644
--- a/program/js/tiny_mce/plugins/table/cell.htm
+++ b/program/js/tiny_mce/plugins/table/cell.htm
@@ -170,13 +170,8 @@
</select>
</div>
- <div style="float: left">
- <div><input type="submit" id="insert" name="insert" value="{#update}" /></div>
- </div>
-
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#update}" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>
diff --git a/program/js/tiny_mce/plugins/table/editor_plugin.js b/program/js/tiny_mce/plugins/table/editor_plugin.js
index 806ef288f..39f2c694b 100644
--- a/program/js/tiny_mce/plugins/table/editor_plugin.js
+++ b/program/js/tiny_mce/plugins/table/editor_plugin.js
@@ -1 +1 @@
-(function(){var b=tinymce.each;function a(d,e){var f=e.ownerDocument,c=f.createRange(),g;c.setStartBefore(e);c.setEnd(d.endContainer,d.endOffset);g=f.createElement("body");g.appendChild(c.cloneContents());return g.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}tinymce.create("tinymce.plugins.TablePlugin",{init:function(c,d){var e=this;e.editor=c;e.url=d;b([["table","table.desc","mceInsertTable",true],["delete_table","table.del","mceTableDelete"],["delete_col","table.delete_col_desc","mceTableDeleteCol"],["delete_row","table.delete_row_desc","mceTableDeleteRow"],["col_after","table.col_after_desc","mceTableInsertColAfter"],["col_before","table.col_before_desc","mceTableInsertColBefore"],["row_after","table.row_after_desc","mceTableInsertRowAfter"],["row_before","table.row_before_desc","mceTableInsertRowBefore"],["row_props","table.row_desc","mceTableRowProps",true],["cell_props","table.cell_desc","mceTableCellProps",true],["split_cells","table.split_cells_desc","mceTableSplitCells",true],["merge_cells","table.merge_cells_desc","mceTableMergeCells",true]],function(f){c.addButton(f[0],{title:f[1],cmd:f[2],ui:f[3]})});if(c.getParam("inline_styles")){c.onPreProcess.add(function(f,h){var g=f.dom;b(g.select("table",h.node),function(j){var i;if(i=g.getAttrib(j,"width")){g.setStyle(j,"width",i);g.setAttrib(j,"width")}if(i=g.getAttrib(j,"height")){g.setStyle(j,"height",i);g.setAttrib(j,"height")}})})}c.onInit.add(function(){if(!tinymce.isIE&&c.getParam("forced_root_block")){function f(){var g=c.getBody().lastChild;if(g&&g.nodeName=="TABLE"){c.dom.add(c.getBody(),"p",null,'<br mce_bogus="1" />')}}if(tinymce.isGecko){c.onKeyDown.add(function(h,j){var g,i,k=h.dom;if(j.keyCode==37||j.keyCode==38){g=h.selection.getRng();i=k.getParent(g.startContainer,"table");if(i&&h.getBody().firstChild==i){if(a(g,i)){g=k.createRng();g.setStartBefore(i);g.setEndBefore(i);h.selection.setRng(g);j.preventDefault()}}}})}c.onKeyUp.add(f);c.onSetContent.add(f);c.onVisualAid.add(f);c.onPreProcess.add(function(g,i){var h=i.node.lastChild;if(h&&h.childNodes.length==1&&h.firstChild.nodeName=="BR"){g.dom.remove(h)}});f()}if(c&&c.plugins.contextmenu){c.plugins.contextmenu.onContextMenu.add(function(i,g,k){var l,j=c.selection,h=j.getNode()||c.getBody();if(c.dom.getParent(k,"td")||c.dom.getParent(k,"th")){g.removeAll();if(h.nodeName=="A"&&!c.dom.getAttrib(h,"name")){g.add({title:"advanced.link_desc",icon:"link",cmd:c.plugins.advlink?"mceAdvLink":"mceLink",ui:true});g.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});g.addSeparator()}if(h.nodeName=="IMG"&&h.className.indexOf("mceItem")==-1){g.add({title:"advanced.image_desc",icon:"image",cmd:c.plugins.advimage?"mceAdvImage":"mceImage",ui:true});g.addSeparator()}g.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",ui:true,value:{action:"insert"}});g.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable",ui:true});g.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete",ui:true});g.addSeparator();l=g.addMenu({title:"table.cell"});l.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps",ui:true});l.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells",ui:true});l.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells",ui:true});l=g.addMenu({title:"table.row"});l.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps",ui:true});l.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});l.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});l.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});l.addSeparator();l.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});l.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});l.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"});l.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"});l=g.addMenu({title:"table.col"});l.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});l.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});l.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{g.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",ui:true})}})}});c.onKeyDown.add(function(f,g){if(g.keyCode==9&&f.dom.getParent(f.selection.getNode(),"TABLE")){if(!tinymce.isGecko&&!tinymce.isOpera){tinyMCE.execInstanceCommand(f.editorId,"mceTableMoveToNextRow",true);return tinymce.dom.Event.cancel(g)}f.undoManager.add()}});if(!tinymce.isIE){if(c.getParam("table_selection",true)){c.onClick.add(function(f,g){g=g.target;if(g.nodeName==="TABLE"){f.selection.select(g)}})}}c.onNodeChange.add(function(g,f,i){var h=g.dom.getParent(i,"td,th,caption");f.setActive("table",i.nodeName==="TABLE"||!!h);if(h&&h.nodeName==="CAPTION"){h=null}f.setDisabled("delete_table",!h);f.setDisabled("delete_col",!h);f.setDisabled("delete_table",!h);f.setDisabled("delete_row",!h);f.setDisabled("col_after",!h);f.setDisabled("col_before",!h);f.setDisabled("row_after",!h);f.setDisabled("row_before",!h);f.setDisabled("row_props",!h);f.setDisabled("cell_props",!h);f.setDisabled("split_cells",!h||(parseInt(g.dom.getAttrib(h,"colspan","1"))<2&&parseInt(g.dom.getAttrib(h,"rowspan","1"))<2));f.setDisabled("merge_cells",!h)});if(!tinymce.isIE){c.onBeforeSetContent.add(function(f,g){if(g.initial){g.content=g.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g,tinymce.isOpera?"<$1$2>&nbsp;</$1>":'<$1$2><br mce_bogus="1" /></$1>')}})}},execCommand:function(f,e,g){var d=this.editor,c;switch(f){case"mceTableMoveToNextRow":case"mceInsertTable":case"mceTableRowProps":case"mceTableCellProps":case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":case"mceTableDelete":d.execCommand("mceBeginUndoLevel");this._doExecCommand(f,e,g);d.execCommand("mceEndUndoLevel");return true}return false},getInfo:function(){return{longname:"Tables",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_doExecCommand:function(s,aa,af){var W=this.editor,av=W,h=this.url;var o=W.selection.getNode();var X=W.dom.getParent(o,"tr");var ar=W.dom.getParent(o,"td,th");var G=W.dom.getParent(o,"table");var l=W.contentWindow.document;var aw=G?G.getAttribute("border"):"";if(X&&ar==null){ar=X.cells[0]}function aq(y,x){for(var ay=0;ay<y.length;ay++){if(y[ay].length>0&&aq(y[ay],x)){return true}if(y[ay]==x){return true}}return false}function ak(x,i){var y;ae=f(G);x=x||0;i=i||0;x=Math.max(p.cellindex+x,0);i=Math.max(p.rowindex+i,0);W.execCommand("mceRepaint");y=e(ae,i,x);if(y){W.selection.select(y.firstChild||y);W.selection.collapse(1)}}function ai(){var i=l.createElement("td");if(!tinymce.isIE){i.innerHTML='<br mce_bogus="1"/>'}}function k(y){var x=W.dom.getAttrib(y,"colspan");var i=W.dom.getAttrib(y,"rowspan");x=x==""?1:parseInt(x);i=i==""?1:parseInt(i);return{colspan:x,rowspan:i}}function am(ay,aA){var i,az;for(az=0;az<ay.length;az++){for(i=0;i<ay[az].length;i++){if(ay[az][i]==aA){return{cellindex:i,rowindex:az}}}}return null}function e(x,y,i){if(x[y]&&x[y][i]){return x[y][i]}return null}function B(aD,ay){var aA=[],y=0,aB,az,ay,aC;for(aB=0;aB<aD.rows.length;aB++){for(az=0;az<aD.rows[aB].cells.length;az++,y++){aA[y]=aD.rows[aB].cells[az]}}for(aB=0;aB<aA.length;aB++){if(aA[aB]==ay){if(aC=aA[aB+1]){return aC}}}}function f(aF){var i=[],aG=aF.rows,aD,aC,az,aA,aE,ay,aB;for(aC=0;aC<aG.length;aC++){for(aD=0;aD<aG[aC].cells.length;aD++){az=aG[aC].cells[aD];aA=k(az);for(aE=aD;i[aC]&&i[aC][aE];aE++){}for(aB=aC;aB<aC+aA.rowspan;aB++){if(!i[aB]){i[aB]=[]}for(ay=aE;ay<aE+aA.colspan;ay++){i[aB][ay]=az}}}}return i}function n(aH,aE,az,ay){var y=f(aH),aG=am(y,az);var aI,aD;if(ay.cells.length!=aE.childNodes.length){aI=aE.childNodes;aD=null;for(var aF=0;az=e(y,aG.rowindex,aF);aF++){var aB=true;var aC=k(az);if(aq(aI,az)){ay.childNodes[aF]._delete=true}else{if((aD==null||az!=aD)&&aC.colspan>1){for(var aA=aF;aA<aF+az.colSpan;aA++){ay.childNodes[aA]._delete=true}}}if((aD==null||az!=aD)&&aC.rowspan>1){az.rowSpan=aC.rowspan+1}aD=az}C(G)}}function P(x,i){while((x=x.previousSibling)!=null){if(x.nodeName==i){return x}}return null}function ag(ay,az){var x=az.split(",");while((ay=ay.nextSibling)!=null){for(var y=0;y<x.length;y++){if(ay.nodeName.toLowerCase()==x[y].toLowerCase()){return ay}}}return null}function C(ay){if(ay.rows==0){return}var y=ay.rows[0];do{var x=ag(y,"TR");if(y._delete){y.parentNode.removeChild(y);continue}var az=y.cells[0];if(az.cells>1){do{var i=ag(az,"TD,TH");if(az._delete){az.parentNode.removeChild(az)}}while((az=i)!=null)}}while((y=x)!=null)}function q(ay,aB,aA){ay.rowSpan=1;var x=ag(aB,"TR");for(var az=1;az<aA&&x;az++){var y=l.createElement("td");if(!tinymce.isIE){y.innerHTML='<br mce_bogus="1"/>'}if(tinymce.isIE){x.insertBefore(y,x.cells(ay.cellIndex))}else{x.insertBefore(y,x.cells[ay.cellIndex])}x=ag(x,"TR")}}function T(aG,aI,aC){var y=f(aI);var ay=aC.cloneNode(false);var aH=am(y,aC.cells[0]);var aD=null;var aB=W.dom.getAttrib(aI,"border");var aA=null;for(var aF=0;aA=e(y,aH.rowindex,aF);aF++){var aE=null;if(aD!=aA){for(var az=0;az<aC.cells.length;az++){if(aA==aC.cells[az]){aE=aA.cloneNode(true);break}}}if(aE==null){aE=aG.createElement("td");if(!tinymce.isIE){aE.innerHTML='<br mce_bogus="1"/>'}}aE.colSpan=1;aE.rowSpan=1;ay.appendChild(aE);aD=aA}return ay}switch(s){case"mceTableMoveToNextRow":var M=B(G,ar);if(!M){W.execCommand("mceTableInsertRowAfter",ar);M=B(G,ar)}W.selection.select(M);W.selection.collapse(true);return true;case"mceTableRowProps":if(X==null){return true}if(aa){W.windowManager.open({url:h+"/row.htm",width:400+parseInt(W.getLang("table.rowprops_delta_width",0)),height:295+parseInt(W.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:h})}return true;case"mceTableCellProps":if(ar==null){return true}if(aa){W.windowManager.open({url:h+"/cell.htm",width:400+parseInt(W.getLang("table.cellprops_delta_width",0)),height:295+parseInt(W.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:h})}return true;case"mceInsertTable":if(aa){W.windowManager.open({url:h+"/table.htm",width:400+parseInt(W.getLang("table.table_delta_width",0)),height:320+parseInt(W.getLang("table.table_delta_height",0)),inline:1},{plugin_url:h,action:af?af.action:0})}return true;case"mceTableDelete":var H=W.dom.getParent(W.selection.getNode(),"table");if(H){H.parentNode.removeChild(H);W.execCommand("mceRepaint")}return true;case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":if(!G){return true}if(X&&G!=X.parentNode){G=X.parentNode}if(G&&X){switch(s){case"mceTableCutRow":if(!X||!ar){return true}W.tableRowClipboard=T(l,G,X);W.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!X||!ar){return true}W.tableRowClipboard=T(l,G,X);break;case"mceTablePasteRowBefore":if(!X||!ar){return true}var w=W.tableRowClipboard.cloneNode(true);var j=P(X,"TR");if(j!=null){n(G,j,j.cells[0],w)}X.parentNode.insertBefore(w,X);break;case"mceTablePasteRowAfter":if(!X||!ar){return true}var Y=ag(X,"TR");var w=W.tableRowClipboard.cloneNode(true);n(G,X,ar,w);if(Y==null){X.parentNode.appendChild(w)}else{Y.parentNode.insertBefore(w,Y)}break;case"mceTableInsertRowBefore":if(!X||!ar){return true}var ae=f(G);var p=am(ae,ar);var w=l.createElement("tr");var v=null;p.rowindex--;if(p.rowindex<0){p.rowindex=0}for(var ad=0;ar=e(ae,p.rowindex,ad);ad++){if(ar!=v){var F=k(ar);if(F.rowspan==1){var K=l.createElement("td");if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}K.colSpan=ar.colSpan;w.appendChild(K)}else{ar.rowSpan=F.rowspan+1}v=ar}}X.parentNode.insertBefore(w,X);ak(0,1);break;case"mceTableInsertRowAfter":if(!X||!ar){return true}var ae=f(G);var p=am(ae,ar);var w=l.createElement("tr");var v=null;for(var ad=0;ar=e(ae,p.rowindex,ad);ad++){if(ar!=v){var F=k(ar);if(F.rowspan==1){var K=l.createElement("td");if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}K.colSpan=ar.colSpan;w.appendChild(K)}else{ar.rowSpan=F.rowspan+1}v=ar}}if(w.hasChildNodes()){var Y=ag(X,"TR");if(Y){Y.parentNode.insertBefore(w,Y)}else{G.appendChild(w)}}ak(0,1);break;case"mceTableDeleteRow":if(!X||!ar){return true}var ae=f(G);var p=am(ae,ar);if(ae.length==1&&G.nodeName=="TBODY"){W.dom.remove(W.dom.getParent(G,"table"));return true}var E=X.cells;var Y=ag(X,"TR");for(var ad=0;ad<E.length;ad++){if(E[ad].rowSpan>1){var K=E[ad].cloneNode(true);var F=k(E[ad]);K.rowSpan=F.rowspan-1;var al=Y.cells[ad];if(al==null){Y.appendChild(K)}else{Y.insertBefore(K,al)}}}var v=null;for(var ad=0;ar=e(ae,p.rowindex,ad);ad++){if(ar!=v){var F=k(ar);if(F.rowspan>1){ar.rowSpan=F.rowspan-1}else{X=ar.parentNode;if(X.parentNode){X._delete=true}}v=ar}}C(G);ak(0,-1);break;case"mceTableInsertColBefore":if(!X||!ar){return true}var ae=f(W.dom.getParent(G,"table"));var p=am(ae,ar);var v=null;for(var ab=0;ar=e(ae,ab,p.cellindex);ab++){if(ar!=v){var F=k(ar);if(F.colspan==1){var K=l.createElement(ar.nodeName);if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}K.rowSpan=ar.rowSpan;ar.parentNode.insertBefore(K,ar)}else{ar.colSpan++}v=ar}}ak();break;case"mceTableInsertColAfter":if(!X||!ar){return true}var ae=f(W.dom.getParent(G,"table"));var p=am(ae,ar);var v=null;for(var ab=0;ar=e(ae,ab,p.cellindex);ab++){if(ar!=v){var F=k(ar);if(F.colspan==1){var K=l.createElement(ar.nodeName);if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}K.rowSpan=ar.rowSpan;var al=ag(ar,"TD,TH");if(al==null){ar.parentNode.appendChild(K)}else{al.parentNode.insertBefore(K,al)}}else{ar.colSpan++}v=ar}}ak(1);break;case"mceTableDeleteCol":if(!X||!ar){return true}var ae=f(G);var p=am(ae,ar);var v=null;if((ae.length>1&&ae[0].length<=1)&&G.nodeName=="TBODY"){W.dom.remove(W.dom.getParent(G,"table"));return true}for(var ab=0;ar=e(ae,ab,p.cellindex);ab++){if(ar!=v){var F=k(ar);if(F.colspan>1){ar.colSpan=F.colspan-1}else{if(ar.parentNode){ar.parentNode.removeChild(ar)}}v=ar}}ak(-1);break;case"mceTableSplitCells":if(!X||!ar){return true}var m=k(ar);var D=m.colspan;var I=m.rowspan;if(D>1||I>1){ar.colSpan=1;for(var an=1;an<D;an++){var K=l.createElement("td");if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}X.insertBefore(K,ag(ar,"TD,TH"));if(I>1){q(K,X,I)}}q(ar,X,I)}G=W.dom.getParent(W.selection.getNode(),"table");break;case"mceTableMergeCells":var ap=[];var S=W.selection.getSel();var ae=f(G);if(tinymce.isIE||S.rangeCount==1){if(aa){var u=k(ar);W.windowManager.open({url:h+"/merge_cells.htm",width:240+parseInt(W.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(W.getLang("table.merge_cells_delta_height",0)),inline:1},{action:"update",numcols:u.colspan,numrows:u.rowspan,plugin_url:h});return true}else{var V=parseInt(af.numrows);var d=parseInt(af.numcols);var p=am(ae,ar);if((""+V)=="NaN"){V=1}if((""+d)=="NaN"){d=1}var c=G.rows;for(var ab=p.rowindex;ab<ae.length;ab++){var ah=[];for(var ad=p.cellindex;ad<ae[ab].length;ad++){var g=e(ae,ab,ad);if(g&&!aq(ap,g)&&!aq(ah,g)){var O=am(ae,g);if(O.cellindex<p.cellindex+d&&O.rowindex<p.rowindex+V){ah[ah.length]=g}}}if(ah.length>0){ap[ap.length]=ah}var g=e(ae,p.rowindex,p.cellindex);b(av.dom.select("br",g),function(y,x){if(x>0&&av.dom.getAttrib("mce_bogus")){av.dom.remove(y)}})}}}else{var E=[];var S=W.selection.getSel();var Z=null;var ao=null;var A=-1,ax=-1,z,au;if(S.rangeCount<2){return true}for(var an=0;an<S.rangeCount;an++){var aj=S.getRangeAt(an);var ar=aj.startContainer.childNodes[aj.startOffset];if(!ar){break}if(ar.nodeName=="TD"||ar.nodeName=="TH"){E[E.length]=ar}}var c=G.rows;for(var ab=0;ab<c.length;ab++){var ah=[];for(var ad=0;ad<c[ab].cells.length;ad++){var g=c[ab].cells[ad];for(var an=0;an<E.length;an++){if(g==E[an]){ah[ah.length]=g}}}if(ah.length>0){ap[ap.length]=ah}}var ao=[];var Z=null;for(var ab=0;ab<ae.length;ab++){for(var ad=0;ad<ae[ab].length;ad++){ae[ab][ad]._selected=false;for(var an=0;an<E.length;an++){if(ae[ab][ad]==E[an]){if(A==-1){A=ad;ax=ab}z=ad;au=ab;ae[ab][ad]._selected=true}}}}for(var ab=ax;ab<=au;ab++){for(var ad=A;ad<=z;ad++){if(!ae[ab][ad]._selected){alert("Invalid selection for merge.");return true}}}}var t=1,r=1;var U=-1;for(var ab=0;ab<ap.length;ab++){var J=0;for(var ad=0;ad<ap[ab].length;ad++){var F=k(ap[ab][ad]);J+=F.colspan;if(U!=-1&&F.rowspan!=U){alert("Invalid selection for merge.");return true}U=F.rowspan}if(J>r){r=J}U=-1}var R=-1;for(var ad=0;ad<ap[0].length;ad++){var N=0;for(var ab=0;ab<ap.length;ab++){var F=k(ap[ab][ad]);N+=F.rowspan;if(R!=-1&&F.colspan!=R){alert("Invalid selection for merge.");return true}R=F.colspan}if(N>t){t=N}R=-1}ar=ap[0][0];ar.rowSpan=t;ar.colSpan=r;for(var ab=0;ab<ap.length;ab++){for(var ad=0;ad<ap[ab].length;ad++){var Q=ap[ab][ad].innerHTML;var L=Q.replace(/[ \t\r\n]/g,"");if(L!="<br/>"&&L!="<br>"&&L!='<br mce_bogus="1"/>'&&(ad+ab>0)){ar.innerHTML+=Q}if(ap[ab][ad]!=ar&&!ap[ab][ad]._deleted){var p=am(ae,ap[ab][ad]);var at=ap[ab][ad].parentNode;at.removeChild(ap[ab][ad]);ap[ab][ad]._deleted=true;if(!at.hasChildNodes()){at.parentNode.removeChild(at);var ac=null;for(var ad=0;cellElm=e(ae,p.rowindex,ad);ad++){if(cellElm!=ac&&cellElm.rowSpan>1){cellElm.rowSpan--}ac=cellElm}if(ar.rowSpan>1){ar.rowSpan--}}}}}b(av.dom.select("br",ar),function(y,x){if(x>0&&av.dom.getAttrib(y,"mce_bogus")){av.dom.remove(y)}});break}G=W.dom.getParent(W.selection.getNode(),"table");W.addVisual(G);W.nodeChanged()}return true}return false}});tinymce.PluginManager.add("table",tinymce.plugins.TablePlugin)})(); \ No newline at end of file
+(function(b){var c=b.each;function a(E,D,H){var e,I,A,n;r();n=D.getParent(H.getStart(),"th,td");if(n){I=C(n);A=F();n=v(I.x,I.y)}function r(){var J=0;e=[];c(["thead","tbody","tfoot"],function(K){var L=D.select(K+" tr",E);c(L,function(M,N){N+=J;c(D.select("td,th",M),function(T,O){var P,Q,R,S;if(e[N]){while(e[N][O]){O++}}R=g(T,"rowspan");S=g(T,"colspan");for(Q=N;Q<N+R;Q++){if(!e[Q]){e[Q]=[]}for(P=O;P<O+S;P++){e[Q][P]={part:K,real:Q==N&&P==O,elm:T,rowspan:R,colspan:S}}}})});J+=L.length})}function v(J,L){var K;K=e[L];if(K){return K[J]}}function g(K,J){return parseInt(K.getAttribute(J)||1)}function h(J){return D.hasClass(J.elm,"mceSelected")||J==n}function j(){var J=[];c(E.rows,function(K){c(K.cells,function(L){if(D.hasClass(L,"mceSelected")||L==n.elm){J.push(K);return false}})});return J}function q(){var J=D.createRng();J.setStartAfter(E);J.setEndAfter(E);H.setRng(J);D.remove(E)}function d(J){var K;b.walk(J,function(M){var L;if(M.nodeType==3){c(D.getParents(M.parentNode,null,J).reverse(),function(N){N=N.cloneNode(false);if(!K){K=L=N}else{if(L){L.appendChild(N)}}L=N});if(L){L.innerHTML=b.isIE?"&nbsp;":'<br _mce_bogus="1" />'}return false}},"childNodes");J=J.cloneNode(false);J.rowSpan=J.colSpan=1;if(K){J.appendChild(K)}else{if(!b.isIE){J.innerHTML='<br _mce_bogus="1" />'}}return J}function p(){var J=D.createRng();c(D.select("tr",E),function(K){if(K.cells.length==0){D.remove(K)}});if(D.select("tr",E).length==0){J.setStartAfter(E);J.setEndAfter(E);H.setRng(J);D.remove(E);return}c(D.select("thead,tbody,tfoot",E),function(K){if(K.rows.length==0){D.remove(K)}});r();row=e[Math.min(e.length-1,I.y)];if(row){H.select(row[Math.min(row.length-1,I.x)].elm,true);H.collapse(true)}}function s(P,N,R,O){var M,K,J,L,Q;M=e[N][P].elm.parentNode;for(J=1;J<=R;J++){M=D.getNext(M,"tr");if(M){for(K=P;K>=0;K--){Q=e[N+J][K].elm;if(Q.parentNode==M){for(L=1;L<=O;L++){D.insertAfter(d(Q),Q)}break}}if(K==-1){for(L=1;L<=O;L++){M.insertBefore(d(M.cells[0]),M.cells[0])}}}}}function z(){c(e,function(J,K){c(J,function(M,L){var P,O,Q,N;if(h(M)){M=M.elm;P=g(M,"colspan");O=g(M,"rowspan");if(P>1||O>1){M.colSpan=M.rowSpan=1;for(N=0;N<P-1;N++){D.insertAfter(d(M),M)}s(L,K,O-1,P)}}})})}function o(R,O,U){var M,L,T,S,Q,N,P,J,R,K;if(R){pos=C(R);M=pos.x;L=pos.y;T=M+(O-1);S=L+(U-1)}else{M=I.x;L=I.y;T=A.x;S=A.y}P=v(M,L);J=v(T,S);if(P&&J&&P.part==J.part){z();r();P=v(M,L).elm;P.colSpan=(T-M)+1;P.rowSpan=(S-L)+1;for(N=L;N<=S;N++){for(Q=M;Q<=T;Q++){R=e[N][Q].elm;if(R!=P){K=b.grep(R.childNodes);c(K,function(W,V){if(W.nodeName!="BR"||V!=K.length-1){P.appendChild(W)}});D.remove(R)}}}p()}}function k(M){var J,O,L,N,P,Q,K,R;c(e,function(S,T){c(S,function(V,U){if(h(V)){V=V.elm;P=V.parentNode;Q=P.cloneNode(false);J=T;if(M){return false}}});if(M){return !J}});for(N=0;N<e[0].length;N++){O=e[J][N].elm;if(O!=L){if(!M){rowSpan=g(O,"rowspan");if(rowSpan>1){O.rowSpan=rowSpan+1;continue}}else{if(J>0&&e[J-1][N]){R=e[J-1][N].elm;rowSpan=g(R,"rowspan");if(rowSpan>1){R.rowSpan=rowSpan+1;continue}}}K=d(O);K.colSpan=O.colSpan;Q.appendChild(K);L=O}}if(Q.hasChildNodes()){if(!M){D.insertAfter(Q,P)}else{P.parentNode.insertBefore(Q,P)}}}function f(K){var L,J;c(e,function(M,N){c(M,function(P,O){if(h(P)){L=O;if(K){return false}}});if(K){return !L}});c(e,function(P,Q){var M=P[L].elm,N,O;if(M!=J){O=g(M,"colspan");N=g(M,"rowspan");if(O==1){if(!K){D.insertAfter(d(M),M);s(L,Q,N-1,O)}else{M.parentNode.insertBefore(d(M),M);s(L,Q,N-1,O)}}else{M.colSpan++}J=M}})}function m(){var J=[];c(e,function(K,L){c(K,function(N,M){if(h(N)&&b.inArray(J,M)===-1){c(e,function(Q){var O=Q[M].elm,P;P=g(O,"colspan");if(P>1){O.colSpan=P-1}else{D.remove(O)}});J.push(M)}})});p()}function l(){var K;function J(N){var M,O,L;M=D.getNext(N,"tr");c(N.cells,function(P){var Q=g(P,"rowspan");if(Q>1){P.rowSpan=Q-1;O=C(P);s(O.x,O.y,1,1)}});O=C(N.cells[0]);c(e[O.y],function(P){var Q;P=P.elm;if(P!=L){Q=g(P,"rowspan");if(Q<=1){D.remove(P)}else{P.rowSpan=Q-1}L=P}})}K=j();c(K.reverse(),function(L){J(L)});p()}function B(){var J=j();D.remove(J);p();return J}function G(){var J=j();c(J,function(L,K){J[K]=L.cloneNode(true)});return J}function w(L,K){var M=j(),J=M[K?0:M.length-1],N=J.cells.length;c(e,function(P){var O;N=0;c(P,function(R,Q){if(R.real){N+=R.colspan}if(R.elm.parentNode==J){O=1}});if(O){return false}});if(!K){L.reverse()}c(L,function(Q){var P=Q.cells.length,O;for(i=0;i<P;i++){O=Q.cells[i];O.colSpan=O.rowSpan=1}for(i=P;i<N;i++){Q.appendChild(d(Q.cells[P-1]))}for(i=N;i<P;i++){D.remove(Q.cells[i])}if(K){J.parentNode.insertBefore(Q,J)}else{D.insertAfter(Q,J)}})}function C(J){var K;c(e,function(L,M){c(L,function(O,N){if(O.elm==J){K={x:N,y:M};return false}});return !K});return K}function u(J){I=C(J)}function F(){var L,K,J;K=J=0;c(e,function(M,N){c(M,function(P,O){var R,Q;if(h(P)){P=e[N][O];if(O>K){K=O}if(N>J){J=N}if(P.real){R=P.colspan-1;Q=P.rowspan-1;if(R){if(O+R>K){K=O+R}}if(Q){if(N+Q>J){J=N+Q}}}}})});return{x:K,y:J}}function t(P){var M,L,R,Q,K,J,N,O;A=C(P);if(I&&A){M=Math.min(I.x,A.x);L=Math.min(I.y,A.y);R=Math.max(I.x,A.x);Q=Math.max(I.y,A.y);K=R;J=Q;for(y=L;y<=J;y++){P=e[y][M];if(!P.real){if(M-(P.colspan-1)<M){M-=P.colspan-1}}}for(x=M;x<=K;x++){P=e[L][x];if(!P.real){if(L-(P.rowspan-1)<L){L-=P.rowspan-1}}}for(y=L;y<=Q;y++){for(x=M;x<=R;x++){P=e[y][x];if(P.real){N=P.colspan-1;O=P.rowspan-1;if(N){if(x+N>K){K=x+N}}if(O){if(y+O>J){J=y+O}}}}}D.removeClass(D.select("td.mceSelected,th.mceSelected"),"mceSelected");for(y=L;y<=J;y++){for(x=M;x<=K;x++){D.addClass(e[y][x].elm,"mceSelected")}}}}b.extend(this,{deleteTable:q,split:z,merge:o,insertRow:k,insertCol:f,deleteCols:m,deleteRows:l,cutRows:B,copyRows:G,pasteRows:w,getPos:C,setStartCell:u,setEndCell:t})}b.create("tinymce.plugins.TablePlugin",{init:function(e,f){var d,j;function h(m){var l=e.selection,k=e.dom.getParent(m||l.getNode(),"table");if(k){return new a(k,e.dom,l)}}function g(){e.getBody().style.webkitUserSelect="";e.dom.removeClass(e.dom.select("td.mceSelected,th.mceSelected"),"mceSelected")}c([["table","table.desc","mceInsertTable",true],["delete_table","table.del","mceTableDelete"],["delete_col","table.delete_col_desc","mceTableDeleteCol"],["delete_row","table.delete_row_desc","mceTableDeleteRow"],["col_after","table.col_after_desc","mceTableInsertColAfter"],["col_before","table.col_before_desc","mceTableInsertColBefore"],["row_after","table.row_after_desc","mceTableInsertRowAfter"],["row_before","table.row_before_desc","mceTableInsertRowBefore"],["row_props","table.row_desc","mceTableRowProps",true],["cell_props","table.cell_desc","mceTableCellProps",true],["split_cells","table.split_cells_desc","mceTableSplitCells",true],["merge_cells","table.merge_cells_desc","mceTableMergeCells",true]],function(k){e.addButton(k[0],{title:k[1],cmd:k[2],ui:k[3]})});if(!b.isIE){e.onClick.add(function(k,l){l=l.target;if(l.nodeName==="TABLE"){k.selection.select(l)}})}e.onNodeChange.add(function(l,k,o){var m;o=l.selection.getStart();m=l.dom.getParent(o,"td,th,caption");k.setActive("table",o.nodeName==="TABLE"||!!m);if(m&&m.nodeName==="CAPTION"){m=0}k.setDisabled("delete_table",!m);k.setDisabled("delete_col",!m);k.setDisabled("delete_table",!m);k.setDisabled("delete_row",!m);k.setDisabled("col_after",!m);k.setDisabled("col_before",!m);k.setDisabled("row_after",!m);k.setDisabled("row_before",!m);k.setDisabled("row_props",!m);k.setDisabled("cell_props",!m);k.setDisabled("split_cells",!m);k.setDisabled("merge_cells",!m)});e.onInit.add(function(l){var k,o,p=l.dom,m;d=l.windowManager;l.onMouseDown.add(function(q,r){if(r.button!=2){g();o=p.getParent(r.target,"td,th");k=p.getParent(o,"table")}});p.bind(l.getDoc(),"mouseover",function(t){var r,q,s=t.target;if(o&&(m||s!=o)&&(s.nodeName=="TD"||s.nodeName=="TH")){q=p.getParent(s,"table");if(q==k){if(!m){m=h(q);m.setStartCell(o);l.getBody().style.webkitUserSelect="none"}m.setEndCell(s)}r=l.selection.getSel();if(r.removeAllRanges){r.removeAllRanges()}else{r.empty()}t.preventDefault()}});l.onMouseUp.add(function(z,A){var r,t=z.selection,B,C=t.getSel(),q,u,s,w;if(o){if(m){z.getBody().style.webkitUserSelect=""}function v(D,F){var E=new b.dom.TreeWalker(D,D);do{if(D.nodeType==3&&b.trim(D.nodeValue).length!=0){if(F){r.setStart(D,0)}else{r.setEnd(D,D.nodeValue.length)}return}if(D.nodeName=="BR"){if(F){r.setStartBefore(D)}else{r.setEndBefore(D)}return}}while(D=(F?E.next():E.prev()))}B=p.select("td.mceSelected,th.mceSelected");if(B.length>0){r=p.createRng();u=B[0];w=B[B.length-1];v(u,1);q=new b.dom.TreeWalker(u,p.getParent(B[0],"table"));do{if(u.nodeName=="TD"||u.nodeName=="TH"){if(!p.hasClass(u,"mceSelected")){break}s=u}}while(u=q.next());v(s);t.setRng(r)}z.nodeChanged();o=m=k=null}});l.onKeyUp.add(function(q,r){g()});if(l&&l.plugins.contextmenu){l.plugins.contextmenu.onContextMenu.add(function(s,q,u){var v,t=l.selection,r=t.getNode()||l.getBody();if(l.dom.getParent(u,"td")||l.dom.getParent(u,"th")){q.removeAll();if(r.nodeName=="A"&&!l.dom.getAttrib(r,"name")){q.add({title:"advanced.link_desc",icon:"link",cmd:l.plugins.advlink?"mceAdvLink":"mceLink",ui:true});q.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});q.addSeparator()}if(r.nodeName=="IMG"&&r.className.indexOf("mceItem")==-1){q.add({title:"advanced.image_desc",icon:"image",cmd:l.plugins.advimage?"mceAdvImage":"mceImage",ui:true});q.addSeparator()}q.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",value:{action:"insert"}});q.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable"});q.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete"});q.addSeparator();v=q.addMenu({title:"table.cell"});v.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps"});v.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells"});v.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells"});v=q.addMenu({title:"table.row"});v.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps"});v.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});v.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});v.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});v.addSeparator();v.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});v.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});v.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"}).setDisabled(!j);v.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"}).setDisabled(!j);v=q.addMenu({title:"table.col"});v.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});v.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});v.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{q.add({title:"table.desc",icon:"table",cmd:"mceInsertTable"})}})}if(!b.isIE){function n(){var q;for(q=l.getBody().lastChild;q&&q.nodeType==3&&!q.nodeValue.length;q=q.previousSibling){}if(q&&q.nodeName=="TABLE"){l.dom.add(l.getBody(),"p",null,'<br mce_bogus="1" />')}}if(b.isGecko){l.onKeyDown.add(function(r,t){var q,s,u=r.dom;if(t.keyCode==37||t.keyCode==38){q=r.selection.getRng();s=u.getParent(q.startContainer,"table");if(s&&r.getBody().firstChild==s){if(isAtStart(q,s)){q=u.createRng();q.setStartBefore(s);q.setEndBefore(s);r.selection.setRng(q);t.preventDefault()}}}})}l.onKeyUp.add(n);l.onSetContent.add(n);l.onVisualAid.add(n);l.onPreProcess.add(function(q,s){var r=s.node.lastChild;if(r&&r.childNodes.length==1&&r.firstChild.nodeName=="BR"){q.dom.remove(r)}});n()}});c({mceTableSplitCells:function(k){k.split()},mceTableMergeCells:function(l){var m,n,k;k=e.dom.getParent(e.selection.getNode(),"th,td");if(k){m=k.rowSpan;n=k.colSpan}if(!e.dom.select("td.mceSelected,th.mceSelected").length){d.open({url:f+"/merge_cells.htm",width:240+parseInt(e.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(e.getLang("table.merge_cells_delta_height",0)),inline:1},{rows:m,cols:n,onaction:function(o){l.merge(k,o.cols,o.rows)},plugin_url:f})}else{l.merge()}},mceTableInsertRowBefore:function(k){k.insertRow(true)},mceTableInsertRowAfter:function(k){k.insertRow()},mceTableInsertColBefore:function(k){k.insertCol(true)},mceTableInsertColAfter:function(k){k.insertCol()},mceTableDeleteCol:function(k){k.deleteCols()},mceTableDeleteRow:function(k){k.deleteRows()},mceTableCutRow:function(k){j=k.cutRows()},mceTableCopyRow:function(k){j=k.copyRows()},mceTablePasteRowBefore:function(k){k.pasteRows(j,true)},mceTablePasteRowAfter:function(k){k.pasteRows(j)},mceTableDelete:function(k){k.deleteTable()}},function(l,k){e.addCommand(k,function(){var m=h();if(m){l(m);e.execCommand("mceRepaint");g()}})});c({mceInsertTable:function(k){d.open({url:f+"/table.htm",width:400+parseInt(e.getLang("table.table_delta_width",0)),height:320+parseInt(e.getLang("table.table_delta_height",0)),inline:1},{plugin_url:f,action:k?k.action:0})},mceTableRowProps:function(){d.open({url:f+"/row.htm",width:400+parseInt(e.getLang("table.rowprops_delta_width",0)),height:295+parseInt(e.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:f})},mceTableCellProps:function(){d.open({url:f+"/cell.htm",width:400+parseInt(e.getLang("table.cellprops_delta_width",0)),height:295+parseInt(e.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:f})}},function(l,k){e.addCommand(k,function(m,n){l(n)})})}});b.PluginManager.add("table",b.plugins.TablePlugin)})(tinymce); \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/table/editor_plugin_src.js b/program/js/tiny_mce/plugins/table/editor_plugin_src.js
index 87b10556f..2260f34a3 100644
--- a/program/js/tiny_mce/plugins/table/editor_plugin_src.js
+++ b/program/js/tiny_mce/plugins/table/editor_plugin_src.js
@@ -1,1202 +1,1118 @@
/**
- * $Id: editor_plugin_src.js 1209 2009-08-20 12:35:10Z spocke $
+ * editor_plugin_src.js
*
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
-(function() {
+(function(tinymce) {
var each = tinymce.each;
- // Checks if the selection/caret is at the start of the specified block element
- function isAtStart(rng, par) {
- var doc = par.ownerDocument, rng2 = doc.createRange(), elm;
+ /**
+ * Table Grid class.
+ */
+ function TableGrid(table, dom, selection) {
+ var grid, startPos, endPos, selectedCell;
+
+ buildGrid();
+ selectedCell = dom.getParent(selection.getStart(), 'th,td');
+ if (selectedCell) {
+ startPos = getPos(selectedCell);
+ endPos = findEndPos();
+ selectedCell = getCell(startPos.x, startPos.y);
+ }
- rng2.setStartBefore(par);
- rng2.setEnd(rng.endContainer, rng.endOffset);
+ function buildGrid() {
+ var startY = 0;
- elm = doc.createElement('body');
- elm.appendChild(rng2.cloneContents());
+ grid = [];
- // Check for text characters of other elements that should be treated as content
- return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length == 0;
- };
+ each(['thead', 'tbody', 'tfoot'], function(part) {
+ var rows = dom.select(part + ' tr', table);
- tinymce.create('tinymce.plugins.TablePlugin', {
- init : function(ed, url) {
- var t = this;
+ each(rows, function(tr, y) {
+ y += startY;
- t.editor = ed;
- t.url = url;
+ each(dom.select('td,th', tr), function(td, x) {
+ var x2, y2, rowspan, colspan;
- // Register buttons
- each([
- ['table', 'table.desc', 'mceInsertTable', true],
- ['delete_table', 'table.del', 'mceTableDelete'],
- ['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],
- ['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],
- ['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],
- ['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],
- ['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],
- ['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],
- ['row_props', 'table.row_desc', 'mceTableRowProps', true],
- ['cell_props', 'table.cell_desc', 'mceTableCellProps', true],
- ['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],
- ['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]
- ], function(c) {
- ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
- });
-
- if (ed.getParam('inline_styles')) {
- // Force move of attribs to styles in strict mode
- ed.onPreProcess.add(function(ed, o) {
- var dom = ed.dom;
+ // Skip over existing cells produced by rowspan
+ if (grid[y]) {
+ while (grid[y][x])
+ x++;
+ }
- each(dom.select('table', o.node), function(n) {
- var v;
+ // Get col/rowspan from cell
+ rowspan = getSpanVal(td, 'rowspan');
+ colspan = getSpanVal(td, 'colspan');
- if (v = dom.getAttrib(n, 'width')) {
- dom.setStyle(n, 'width', v);
- dom.setAttrib(n, 'width');
- }
+ // Fill out rowspan/colspan right and down
+ for (y2 = y; y2 < y + rowspan; y2++) {
+ if (!grid[y2])
+ grid[y2] = [];
- if (v = dom.getAttrib(n, 'height')) {
- dom.setStyle(n, 'height', v);
- dom.setAttrib(n, 'height');
+ for (x2 = x; x2 < x + colspan; x2++) {
+ grid[y2][x2] = {
+ part : part,
+ real : y2 == y && x2 == x,
+ elm : td,
+ rowspan : rowspan,
+ colspan : colspan
+ };
+ }
}
});
});
- }
- ed.onInit.add(function() {
- // Fixes an issue on Gecko where it's impossible to place the caret behind a table
- // This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
- if (!tinymce.isIE && ed.getParam('forced_root_block')) {
- function fixTableCaretPos() {
- var last = ed.getBody().lastChild;
+ startY += rows.length;
+ });
+ };
- if (last && last.nodeName == 'TABLE')
- ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');
- };
+ function getCell(x, y) {
+ var row;
- // Fixes an bug where it's impossible to place the caret before a table in Gecko
- // this fix solves it by detecting when the caret is at the beginning of such a table
- // and then manually moves the caret infront of the table
- if (tinymce.isGecko) {
- ed.onKeyDown.add(function(ed, e) {
- var rng, table, dom = ed.dom;
+ row = grid[y];
+ if (row)
+ return row[x];
+ };
- // On gecko it's not possible to place the caret before a table
- if (e.keyCode == 37 || e.keyCode == 38) {
- rng = ed.selection.getRng();
- table = dom.getParent(rng.startContainer, 'table');
+ function getSpanVal(td, name) {
+ return parseInt(td.getAttribute(name) || 1);
+ };
- if (table && ed.getBody().firstChild == table) {
- if (isAtStart(rng, table)) {
- rng = dom.createRng();
-
- rng.setStartBefore(table);
- rng.setEndBefore(table);
+ function isCellSelected(cell) {
+ return dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell;
+ };
- ed.selection.setRng(rng);
+ function getSelectedRows() {
+ var rows = [];
- e.preventDefault();
- }
- }
- }
- });
+ each(table.rows, function(row) {
+ each(row.cells, function(cell) {
+ if (dom.hasClass(cell, 'mceSelected') || cell == selectedCell.elm) {
+ rows.push(row);
+ return false;
}
+ });
+ });
- ed.onKeyUp.add(fixTableCaretPos);
- ed.onSetContent.add(fixTableCaretPos);
- ed.onVisualAid.add(fixTableCaretPos);
+ return rows;
+ };
- ed.onPreProcess.add(function(ed, o) {
- var last = o.node.lastChild;
+ function deleteTable() {
+ var rng = dom.createRng();
- if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')
- ed.dom.remove(last);
- });
+ rng.setStartAfter(table);
+ rng.setEndAfter(table);
- fixTableCaretPos();
- }
+ selection.setRng(rng);
- if (ed && ed.plugins.contextmenu) {
- ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
- var sm, se = ed.selection, el = se.getNode() || ed.getBody();
+ dom.remove(table);
+ };
- if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th')) {
- m.removeAll();
+ function cloneCell(cell) {
+ var formatNode;
- if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {
- m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
- m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
- m.addSeparator();
- }
+ // Clone formats
+ tinymce.walk(cell, function(node) {
+ var curNode;
- if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {
- m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
- m.addSeparator();
- }
+ if (node.nodeType == 3) {
+ each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) {
+ node = node.cloneNode(false);
- m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true, value : {action : 'insert'}});
- m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable', ui : true});
- m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete', ui : true});
- m.addSeparator();
-
- // Cell menu
- sm = m.addMenu({title : 'table.cell'});
- sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps', ui : true});
- sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells', ui : true});
- sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells', ui : true});
-
- // Row menu
- sm = m.addMenu({title : 'table.row'});
- sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps', ui : true});
- sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});
- sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});
- sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
- sm.addSeparator();
- sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
- sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
- sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'});
- sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'});
+ if (!formatNode)
+ formatNode = curNode = node;
+ else if (curNode)
+ curNode.appendChild(node);
- // Column menu
- sm = m.addMenu({title : 'table.col'});
- sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
- sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
- sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
- } else
- m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true});
+ curNode = node;
});
- }
- });
- // Add undo level when new rows are created using the tab key
- ed.onKeyDown.add(function(ed, e) {
- if (e.keyCode == 9 && ed.dom.getParent(ed.selection.getNode(), 'TABLE')) {
- if (!tinymce.isGecko && !tinymce.isOpera) {
- tinyMCE.execInstanceCommand(ed.editorId, "mceTableMoveToNextRow", true);
- return tinymce.dom.Event.cancel(e);
- }
+ // Add something to the inner node
+ if (curNode)
+ curNode.innerHTML = tinymce.isIE ? '&nbsp;' : '<br _mce_bogus="1" />';
- ed.undoManager.add();
+ return false;
}
- });
+ }, 'childNodes');
- // Select whole table is a table border is clicked
- if (!tinymce.isIE) {
- if (ed.getParam('table_selection', true)) {
- ed.onClick.add(function(ed, e) {
- e = e.target;
+ cell = cell.cloneNode(false);
+ cell.rowSpan = cell.colSpan = 1;
- if (e.nodeName === 'TABLE')
- ed.selection.select(e);
- });
- }
+ if (formatNode) {
+ cell.appendChild(formatNode);
+ } else {
+ if (!tinymce.isIE)
+ cell.innerHTML = '<br _mce_bogus="1" />';
}
- ed.onNodeChange.add(function(ed, cm, n) {
- var p = ed.dom.getParent(n, 'td,th,caption');
+ return cell;
+ };
- cm.setActive('table', n.nodeName === 'TABLE' || !!p);
- if (p && p.nodeName === 'CAPTION')
- p = null;
+ function cleanup() {
+ var rng = dom.createRng();
- cm.setDisabled('delete_table', !p);
- cm.setDisabled('delete_col', !p);
- cm.setDisabled('delete_table', !p);
- cm.setDisabled('delete_row', !p);
- cm.setDisabled('col_after', !p);
- cm.setDisabled('col_before', !p);
- cm.setDisabled('row_after', !p);
- cm.setDisabled('row_before', !p);
- cm.setDisabled('row_props', !p);
- cm.setDisabled('cell_props', !p);
- cm.setDisabled('split_cells', !p || (parseInt(ed.dom.getAttrib(p, 'colspan', '1')) < 2 && parseInt(ed.dom.getAttrib(p, 'rowspan', '1')) < 2));
- cm.setDisabled('merge_cells', !p);
+ // Empty rows
+ each(dom.select('tr', table), function(tr) {
+ if (tr.cells.length == 0)
+ dom.remove(tr);
});
- // Padd empty table cells
- if (!tinymce.isIE) {
- ed.onBeforeSetContent.add(function(ed, o) {
- if (o.initial)
- o.content = o.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g, tinymce.isOpera ? '<$1$2>&nbsp;</$1>' : '<$1$2><br mce_bogus="1" /></$1>');
- });
- }
- },
-
- execCommand : function(cmd, ui, val) {
- var ed = this.editor, b;
-
- // Is table command
- switch (cmd) {
- case "mceTableMoveToNextRow":
- case "mceInsertTable":
- case "mceTableRowProps":
- case "mceTableCellProps":
- case "mceTableSplitCells":
- case "mceTableMergeCells":
- case "mceTableInsertRowBefore":
- case "mceTableInsertRowAfter":
- case "mceTableDeleteRow":
- case "mceTableInsertColBefore":
- case "mceTableInsertColAfter":
- case "mceTableDeleteCol":
- case "mceTableCutRow":
- case "mceTableCopyRow":
- case "mceTablePasteRowBefore":
- case "mceTablePasteRowAfter":
- case "mceTableDelete":
- ed.execCommand('mceBeginUndoLevel');
- this._doExecCommand(cmd, ui, val);
- ed.execCommand('mceEndUndoLevel');
-
- return true;
+ // Empty table
+ if (dom.select('tr', table).length == 0) {
+ rng.setStartAfter(table);
+ rng.setEndAfter(table);
+ selection.setRng(rng);
+ dom.remove(table);
+ return;
}
- // Pass to next handler in chain
- return false;
- },
-
- getInfo : function() {
- return {
- longname : 'Tables',
- author : 'Moxiecode Systems AB',
- authorurl : 'http://tinymce.moxiecode.com',
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table',
- version : tinymce.majorVersion + "." + tinymce.minorVersion
- };
- },
-
- // Private plugin internal methods
-
- /**
- * Executes the table commands.
- */
- _doExecCommand : function(command, user_interface, value) {
- var inst = this.editor, ed = inst, url = this.url;
- var focusElm = inst.selection.getNode();
- var trElm = inst.dom.getParent(focusElm, "tr");
- var tdElm = inst.dom.getParent(focusElm, "td,th");
- var tableElm = inst.dom.getParent(focusElm, "table");
- var doc = inst.contentWindow.document;
- var tableBorder = tableElm ? tableElm.getAttribute("border") : "";
-
- // Get first TD if no TD found
- if (trElm && tdElm == null)
- tdElm = trElm.cells[0];
-
- function inArray(ar, v) {
- for (var i=0; i<ar.length; i++) {
- // Is array
- if (ar[i].length > 0 && inArray(ar[i], v))
- return true;
-
- // Found value
- if (ar[i] == v)
- return true;
- }
+ // Empty header/body/footer
+ each(dom.select('thead,tbody,tfoot', table), function(part) {
+ if (part.rows.length == 0)
+ dom.remove(part);
+ });
+
+ // Restore selection to start position if it still exists
+ buildGrid();
- return false;
+ // Restore the selection to the closest table position
+ row = grid[Math.min(grid.length - 1, startPos.y)];
+ if (row) {
+ selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true);
+ selection.collapse(true);
}
+ };
- function select(dx, dy) {
- var td;
+ function fillLeftDown(x, y, rows, cols) {
+ var tr, x2, r, c, cell;
- grid = getTableGrid(tableElm);
- dx = dx || 0;
- dy = dy || 0;
- dx = Math.max(cpos.cellindex + dx, 0);
- dy = Math.max(cpos.rowindex + dy, 0);
+ tr = grid[y][x].elm.parentNode;
+ for (r = 1; r <= rows; r++) {
+ tr = dom.getNext(tr, 'tr');
- // Recalculate grid and select
- inst.execCommand('mceRepaint');
- td = getCell(grid, dy, dx);
+ if (tr) {
+ // Loop left to find real cell
+ for (x2 = x; x2 >= 0; x2--) {
+ cell = grid[y + r][x2].elm;
- if (td) {
- inst.selection.select(td.firstChild || td);
- inst.selection.collapse(1);
- }
- };
+ if (cell.parentNode == tr) {
+ // Append clones after
+ for (c = 1; c <= cols; c++)
+ dom.insertAfter(cloneCell(cell), cell);
- function makeTD() {
- var newTD = doc.createElement("td");
+ break;
+ }
+ }
- if (!tinymce.isIE)
- newTD.innerHTML = '<br mce_bogus="1"/>';
+ if (x2 == -1) {
+ // Insert nodes before first cell
+ for (c = 1; c <= cols; c++)
+ tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]);
+ }
+ }
}
+ };
- function getColRowSpan(td) {
- var colspan = inst.dom.getAttrib(td, "colspan");
- var rowspan = inst.dom.getAttrib(td, "rowspan");
+ function split() {
+ each(grid, function(row, y) {
+ each(row, function(cell, x) {
+ var colSpan, rowSpan, newCell, i;
- colspan = colspan == "" ? 1 : parseInt(colspan);
- rowspan = rowspan == "" ? 1 : parseInt(rowspan);
+ if (isCellSelected(cell)) {
+ cell = cell.elm;
+ colSpan = getSpanVal(cell, 'colspan');
+ rowSpan = getSpanVal(cell, 'rowspan');
- return {colspan : colspan, rowspan : rowspan};
+ if (colSpan > 1 || rowSpan > 1) {
+ cell.colSpan = cell.rowSpan = 1;
+
+ // Insert cells right
+ for (i = 0; i < colSpan - 1; i++)
+ dom.insertAfter(cloneCell(cell), cell);
+
+ fillLeftDown(x, y, rowSpan - 1, colSpan);
+ }
+ }
+ });
+ });
+ };
+
+ function merge(cell, cols, rows) {
+ var startX, startY, endX, endY, x, y, startCell, endCell, cell, children;
+
+ // Use specified cell and cols/rows
+ if (cell) {
+ pos = getPos(cell);
+ startX = pos.x;
+ startY = pos.y;
+ endX = startX + (cols - 1);
+ endY = startY + (rows - 1);
+ } else {
+ // Use selection
+ startX = startPos.x;
+ startY = startPos.y;
+ endX = endPos.x;
+ endY = endPos.y;
}
- function getCellPos(grid, td) {
- var x, y;
+ // Find start/end cells
+ startCell = getCell(startX, startY);
+ endCell = getCell(endX, endY);
+
+ // Check if the cells exists and if they are of the same part for example tbody = tbody
+ if (startCell && endCell && startCell.part == endCell.part) {
+ // Split and rebuild grid
+ split();
+ buildGrid();
+
+ // Set row/col span to start cell
+ startCell = getCell(startX, startY).elm;
+ startCell.colSpan = (endX - startX) + 1;
+ startCell.rowSpan = (endY - startY) + 1;
+
+ // Remove other cells and add it's contents to the start cell
+ for (y = startY; y <= endY; y++) {
+ for (x = startX; x <= endX; x++) {
+ cell = grid[y][x].elm;
+
+ if (cell != startCell) {
+ // Move children to startCell
+ children = tinymce.grep(cell.childNodes);
+ each(children, function(node, i) {
+ // Jump over last BR element
+ if (node.nodeName != 'BR' || i != children.length - 1)
+ startCell.appendChild(node);
+ });
- for (y=0; y<grid.length; y++) {
- for (x=0; x<grid[y].length; x++) {
- if (grid[y][x] == td)
- return {cellindex : x, rowindex : y};
+ // Remove cell
+ dom.remove(cell);
+ }
}
}
- return null;
+ // Remove empty rows etc and restore caret location
+ cleanup();
}
+ };
+
+ function insertRow(before) {
+ var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell;
+
+ // Find first/last row
+ each(grid, function(row, y) {
+ each(row, function(cell, x) {
+ if (isCellSelected(cell)) {
+ cell = cell.elm;
+ rowElm = cell.parentNode;
+ newRow = rowElm.cloneNode(false);
+ posY = y;
+
+ if (before)
+ return false;
+ }
+ });
- function getCell(grid, row, col) {
- if (grid[row] && grid[row][col])
- return grid[row][col];
+ if (before)
+ return !posY;
+ });
- return null;
- }
+ for (x = 0; x < grid[0].length; x++) {
+ cell = grid[posY][x].elm;
- function getNextCell(table, cell) {
- var cells = [], x = 0, i, j, cell, nextCell;
+ if (cell != lastCell) {
+ if (!before) {
+ rowSpan = getSpanVal(cell, 'rowspan');
+ if (rowSpan > 1) {
+ cell.rowSpan = rowSpan + 1;
+ continue;
+ }
+ } else {
+ // Check if cell above can be expanded
+ if (posY > 0 && grid[posY - 1][x]) {
+ otherCell = grid[posY - 1][x].elm;
+ rowSpan = getSpanVal(otherCell, 'rowspan');
+ if (rowSpan > 1) {
+ otherCell.rowSpan = rowSpan + 1;
+ continue;
+ }
+ }
+ }
- for (i = 0; i < table.rows.length; i++)
- for (j = 0; j < table.rows[i].cells.length; j++, x++)
- cells[x] = table.rows[i].cells[j];
+ // Insert new cell into new row
+ newCell = cloneCell(cell)
+ newCell.colSpan = cell.colSpan;
+ newRow.appendChild(newCell);
- for (i = 0; i < cells.length; i++)
- if (cells[i] == cell)
- if (nextCell = cells[i+1])
- return nextCell;
+ lastCell = cell;
+ }
}
- function getTableGrid(table) {
- var grid = [], rows = table.rows, x, y, td, sd, xstart, x2, y2;
-
- for (y=0; y<rows.length; y++) {
- for (x=0; x<rows[y].cells.length; x++) {
- td = rows[y].cells[x];
- sd = getColRowSpan(td);
+ if (newRow.hasChildNodes()) {
+ if (!before)
+ dom.insertAfter(newRow, rowElm);
+ else
+ rowElm.parentNode.insertBefore(newRow, rowElm);
+ }
+ };
- // All ready filled
- for (xstart = x; grid[y] && grid[y][xstart]; xstart++) ;
+ function insertCol(before) {
+ var posX, lastCell;
- // Fill box
- for (y2=y; y2<y+sd['rowspan']; y2++) {
- if (!grid[y2])
- grid[y2] = [];
+ // Find first/last column
+ each(grid, function(row, y) {
+ each(row, function(cell, x) {
+ if (isCellSelected(cell)) {
+ posX = x;
- for (x2=xstart; x2<xstart+sd['colspan']; x2++)
- grid[y2][x2] = td;
- }
+ if (before)
+ return false;
}
- }
+ });
- return grid;
- }
+ if (before)
+ return !posX;
+ });
- function trimRow(table, tr, td, new_tr) {
- var grid = getTableGrid(table), cpos = getCellPos(grid, td);
- var cells, lastElm;
-
- // Time to crop away some
- if (new_tr.cells.length != tr.childNodes.length) {
- cells = tr.childNodes;
- lastElm = null;
-
- for (var x=0; td = getCell(grid, cpos.rowindex, x); x++) {
- var remove = true;
- var sd = getColRowSpan(td);
-
- // Remove due to rowspan
- if (inArray(cells, td)) {
- new_tr.childNodes[x]._delete = true;
- } else if ((lastElm == null || td != lastElm) && sd.colspan > 1) { // Remove due to colspan
- for (var i=x; i<x+td.colSpan; i++)
- new_tr.childNodes[i]._delete = true;
- }
+ each(grid, function(row, y) {
+ var cell = row[posX].elm, rowSpan, colSpan;
- if ((lastElm == null || td != lastElm) && sd.rowspan > 1)
- td.rowSpan = sd.rowspan + 1;
+ if (cell != lastCell) {
+ colSpan = getSpanVal(cell, 'colspan');
+ rowSpan = getSpanVal(cell, 'rowspan');
- lastElm = td;
- }
+ if (colSpan == 1) {
+ if (!before) {
+ dom.insertAfter(cloneCell(cell), cell);
+ fillLeftDown(posX, y, rowSpan - 1, colSpan);
+ } else {
+ cell.parentNode.insertBefore(cloneCell(cell), cell);
+ fillLeftDown(posX, y, rowSpan - 1, colSpan);
+ }
+ } else
+ cell.colSpan++;
- deleteMarked(tableElm);
+ lastCell = cell;
}
- }
+ });
+ };
- function prevElm(node, name) {
- while ((node = node.previousSibling) != null) {
- if (node.nodeName == name)
- return node;
- }
+ function deleteCols() {
+ var cols = [];
- return null;
- }
+ // Get selected column indexes
+ each(grid, function(row, y) {
+ each(row, function(cell, x) {
+ if (isCellSelected(cell) && tinymce.inArray(cols, x) === -1) {
+ each(grid, function(row) {
+ var cell = row[x].elm, colSpan;
- function nextElm(node, names) {
- var namesAr = names.split(',');
+ colSpan = getSpanVal(cell, 'colspan');
- while ((node = node.nextSibling) != null) {
- for (var i=0; i<namesAr.length; i++) {
- if (node.nodeName.toLowerCase() == namesAr[i].toLowerCase() )
- return node;
+ if (colSpan > 1)
+ cell.colSpan = colSpan - 1;
+ else
+ dom.remove(cell);
+ });
+
+ cols.push(x);
}
- }
+ });
+ });
- return null;
- }
+ cleanup();
+ };
- function deleteMarked(tbl) {
- if (tbl.rows == 0)
- return;
+ function deleteRows() {
+ var rows;
- var tr = tbl.rows[0];
- do {
- var next = nextElm(tr, "TR");
+ function deleteRow(tr) {
+ var nextTr, pos, lastCell;
- // Delete row
- if (tr._delete) {
- tr.parentNode.removeChild(tr);
- continue;
- }
+ nextTr = dom.getNext(tr, 'tr');
- // Delete cells
- var td = tr.cells[0];
- if (td.cells > 1) {
- do {
- var nexttd = nextElm(td, "TD,TH");
+ // Move down row spanned cells
+ each(tr.cells, function(cell) {
+ var rowSpan = getSpanVal(cell, 'rowspan');
- if (td._delete)
- td.parentNode.removeChild(td);
- } while ((td = nexttd) != null);
+ if (rowSpan > 1) {
+ cell.rowSpan = rowSpan - 1;
+ pos = getPos(cell);
+ fillLeftDown(pos.x, pos.y, 1, 1);
}
- } while ((tr = next) != null);
- }
+ });
- function addRows(td_elm, tr_elm, rowspan) {
- // Add rows
- td_elm.rowSpan = 1;
- var trNext = nextElm(tr_elm, "TR");
- for (var i=1; i<rowspan && trNext; i++) {
- var newTD = doc.createElement("td");
+ // Delete cells
+ pos = getPos(tr.cells[0]);
+ each(grid[pos.y], function(cell) {
+ var rowSpan;
- if (!tinymce.isIE)
- newTD.innerHTML = '<br mce_bogus="1"/>';
+ cell = cell.elm;
- if (tinymce.isIE)
- trNext.insertBefore(newTD, trNext.cells(td_elm.cellIndex));
- else
- trNext.insertBefore(newTD, trNext.cells[td_elm.cellIndex]);
+ if (cell != lastCell) {
+ rowSpan = getSpanVal(cell, 'rowspan');
- trNext = nextElm(trNext, "TR");
- }
- }
+ if (rowSpan <= 1)
+ dom.remove(cell);
+ else
+ cell.rowSpan = rowSpan - 1;
- function copyRow(doc, table, tr) {
- var grid = getTableGrid(table);
- var newTR = tr.cloneNode(false);
- var cpos = getCellPos(grid, tr.cells[0]);
- var lastCell = null;
- var tableBorder = inst.dom.getAttrib(table, "border");
- var tdElm = null;
-
- for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
- var newTD = null;
-
- if (lastCell != tdElm) {
- for (var i=0; i<tr.cells.length; i++) {
- if (tdElm == tr.cells[i]) {
- newTD = tdElm.cloneNode(true);
- break;
- }
- }
+ lastCell = cell;
}
+ });
+ };
- if (newTD == null) {
- newTD = doc.createElement("td");
+ // Get selected rows and move selection out of scope
+ rows = getSelectedRows();
- if (!tinymce.isIE)
- newTD.innerHTML = '<br mce_bogus="1"/>';
- }
+ // Delete all selected rows
+ each(rows.reverse(), function(tr) {
+ deleteRow(tr);
+ });
- // Reset col/row span
- newTD.colSpan = 1;
- newTD.rowSpan = 1;
+ cleanup();
+ };
- newTR.appendChild(newTD);
+ function cutRows() {
+ var rows = getSelectedRows();
- lastCell = tdElm;
- }
+ dom.remove(rows);
+ cleanup();
- return newTR;
- }
+ return rows;
+ };
- // ---- Commands -----
+ function copyRows() {
+ var rows = getSelectedRows();
- // Handle commands
- switch (command) {
- case "mceTableMoveToNextRow":
- var nextCell = getNextCell(tableElm, tdElm);
+ each(rows, function(row, i) {
+ rows[i] = row.cloneNode(true);
+ });
- if (!nextCell) {
- inst.execCommand("mceTableInsertRowAfter", tdElm);
- nextCell = getNextCell(tableElm, tdElm);
- }
+ return rows;
+ };
- inst.selection.select(nextCell);
- inst.selection.collapse(true);
+ function pasteRows(rows, before) {
+ var selectedRows = getSelectedRows(),
+ targetRow = selectedRows[before ? 0 : selectedRows.length - 1],
+ targetCellCount = targetRow.cells.length;
- return true;
+ // Calc target cell count
+ each(grid, function(row) {
+ var match;
- case "mceTableRowProps":
- if (trElm == null)
- return true;
+ targetCellCount = 0;
+ each(row, function(cell, x) {
+ if (cell.real)
+ targetCellCount += cell.colspan;
- if (user_interface) {
- inst.windowManager.open({
- url : url + '/row.htm',
- width : 400 + parseInt(inst.getLang('table.rowprops_delta_width', 0)),
- height : 295 + parseInt(inst.getLang('table.rowprops_delta_height', 0)),
- inline : 1
- }, {
- plugin_url : url
- });
- }
+ if (cell.elm.parentNode == targetRow)
+ match = 1;
+ });
- return true;
+ if (match)
+ return false;
+ });
- case "mceTableCellProps":
- if (tdElm == null)
- return true;
+ if (!before)
+ rows.reverse();
- if (user_interface) {
- inst.windowManager.open({
- url : url + '/cell.htm',
- width : 400 + parseInt(inst.getLang('table.cellprops_delta_width', 0)),
- height : 295 + parseInt(inst.getLang('table.cellprops_delta_height', 0)),
- inline : 1
- }, {
- plugin_url : url
- });
- }
+ each(rows, function(row) {
+ var cellCount = row.cells.length, cell;
- return true;
+ // Remove col/rowspans
+ for (i = 0; i < cellCount; i++) {
+ cell = row.cells[i];
+ cell.colSpan = cell.rowSpan = 1;
+ }
- case "mceInsertTable":
- if (user_interface) {
- inst.windowManager.open({
- url : url + '/table.htm',
- width : 400 + parseInt(inst.getLang('table.table_delta_width', 0)),
- height : 320 + parseInt(inst.getLang('table.table_delta_height', 0)),
- inline : 1
- }, {
- plugin_url : url,
- action : value ? value.action : 0
- });
- }
+ // Needs more cells
+ for (i = cellCount; i < targetCellCount; i++)
+ row.appendChild(cloneCell(row.cells[cellCount - 1]));
- return true;
+ // Needs less cells
+ for (i = targetCellCount; i < cellCount; i++)
+ dom.remove(row.cells[i]);
- case "mceTableDelete":
- var table = inst.dom.getParent(inst.selection.getNode(), "table");
- if (table) {
- table.parentNode.removeChild(table);
- inst.execCommand('mceRepaint');
- }
- return true;
-
- case "mceTableSplitCells":
- case "mceTableMergeCells":
- case "mceTableInsertRowBefore":
- case "mceTableInsertRowAfter":
- case "mceTableDeleteRow":
- case "mceTableInsertColBefore":
- case "mceTableInsertColAfter":
- case "mceTableDeleteCol":
- case "mceTableCutRow":
- case "mceTableCopyRow":
- case "mceTablePasteRowBefore":
- case "mceTablePasteRowAfter":
- // No table just return (invalid command)
- if (!tableElm)
- return true;
-
- // Table has a tbody use that reference
- // Changed logic by ApTest 2005.07.12 (www.aptest.com)
- // Now lookk at the focused element and take its parentNode. That will be a tbody or a table.
- if (trElm && tableElm != trElm.parentNode)
- tableElm = trElm.parentNode;
-
- if (tableElm && trElm) {
- switch (command) {
- case "mceTableCutRow":
- if (!trElm || !tdElm)
- return true;
-
- inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
- inst.execCommand("mceTableDeleteRow");
- break;
-
- case "mceTableCopyRow":
- if (!trElm || !tdElm)
- return true;
-
- inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
- break;
-
- case "mceTablePasteRowBefore":
- if (!trElm || !tdElm)
- return true;
-
- var newTR = inst.tableRowClipboard.cloneNode(true);
-
- var prevTR = prevElm(trElm, "TR");
- if (prevTR != null)
- trimRow(tableElm, prevTR, prevTR.cells[0], newTR);
-
- trElm.parentNode.insertBefore(newTR, trElm);
- break;
-
- case "mceTablePasteRowAfter":
- if (!trElm || !tdElm)
- return true;
-
- var nextTR = nextElm(trElm, "TR");
- var newTR = inst.tableRowClipboard.cloneNode(true);
-
- trimRow(tableElm, trElm, tdElm, newTR);
-
- if (nextTR == null)
- trElm.parentNode.appendChild(newTR);
- else
- nextTR.parentNode.insertBefore(newTR, nextTR);
-
- break;
-
- case "mceTableInsertRowBefore":
- if (!trElm || !tdElm)
- return true;
-
- var grid = getTableGrid(tableElm);
- var cpos = getCellPos(grid, tdElm);
- var newTR = doc.createElement("tr");
- var lastTDElm = null;
-
- cpos.rowindex--;
- if (cpos.rowindex < 0)
- cpos.rowindex = 0;
-
- // Create cells
- for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
-
- if (sd['rowspan'] == 1) {
- var newTD = doc.createElement("td");
-
- if (!tinymce.isIE)
- newTD.innerHTML = '<br mce_bogus="1"/>';
-
- newTD.colSpan = tdElm.colSpan;
-
- newTR.appendChild(newTD);
- } else
- tdElm.rowSpan = sd['rowspan'] + 1;
-
- lastTDElm = tdElm;
- }
- }
+ // Add before/after
+ if (before)
+ targetRow.parentNode.insertBefore(row, targetRow);
+ else
+ dom.insertAfter(row, targetRow);
+ });
+ };
- trElm.parentNode.insertBefore(newTR, trElm);
- select(0, 1);
- break;
+ function getPos(target) {
+ var pos;
- case "mceTableInsertRowAfter":
- if (!trElm || !tdElm)
- return true;
+ each(grid, function(row, y) {
+ each(row, function(cell, x) {
+ if (cell.elm == target) {
+ pos = {x : x, y : y};
+ return false;
+ }
+ });
- var grid = getTableGrid(tableElm);
- var cpos = getCellPos(grid, tdElm);
- var newTR = doc.createElement("tr");
- var lastTDElm = null;
+ return !pos;
+ });
- // Create cells
- for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ return pos;
+ };
- if (sd['rowspan'] == 1) {
- var newTD = doc.createElement("td");
+ function setStartCell(cell) {
+ startPos = getPos(cell);
+ };
- if (!tinymce.isIE)
- newTD.innerHTML = '<br mce_bogus="1"/>';
+ function findEndPos() {
+ var pos, maxX, maxY;
- newTD.colSpan = tdElm.colSpan;
+ maxX = maxY = 0;
- newTR.appendChild(newTD);
- } else
- tdElm.rowSpan = sd['rowspan'] + 1;
+ each(grid, function(row, y) {
+ each(row, function(cell, x) {
+ var colSpan, rowSpan;
- lastTDElm = tdElm;
- }
- }
+ if (isCellSelected(cell)) {
+ cell = grid[y][x];
- if (newTR.hasChildNodes()) {
- var nextTR = nextElm(trElm, "TR");
- if (nextTR)
- nextTR.parentNode.insertBefore(newTR, nextTR);
- else
- tableElm.appendChild(newTR);
- }
+ if (x > maxX)
+ maxX = x;
- select(0, 1);
- break;
+ if (y > maxY)
+ maxY = y;
- case "mceTableDeleteRow":
- if (!trElm || !tdElm)
- return true;
+ if (cell.real) {
+ colSpan = cell.colspan - 1;
+ rowSpan = cell.rowspan - 1;
- var grid = getTableGrid(tableElm);
- var cpos = getCellPos(grid, tdElm);
+ if (colSpan) {
+ if (x + colSpan > maxX)
+ maxX = x + colSpan;
+ }
- // Only one row, remove whole table
- if (grid.length == 1 && tableElm.nodeName == 'TBODY') {
- inst.dom.remove(inst.dom.getParent(tableElm, "table"));
- return true;
- }
+ if (rowSpan) {
+ if (y + rowSpan > maxY)
+ maxY = y + rowSpan;
+ }
+ }
+ }
+ });
+ });
- // Move down row spanned cells
- var cells = trElm.cells;
- var nextTR = nextElm(trElm, "TR");
- for (var x=0; x<cells.length; x++) {
- if (cells[x].rowSpan > 1) {
- var newTD = cells[x].cloneNode(true);
- var sd = getColRowSpan(cells[x]);
+ return {x : maxX, y : maxY};
+ };
- newTD.rowSpan = sd.rowspan - 1;
+ function setEndCell(cell) {
+ var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan;
- var nextTD = nextTR.cells[x];
+ endPos = getPos(cell);
- if (nextTD == null)
- nextTR.appendChild(newTD);
- else
- nextTR.insertBefore(newTD, nextTD);
- }
- }
+ if (startPos && endPos) {
+ // Get start/end positions
+ startX = Math.min(startPos.x, endPos.x);
+ startY = Math.min(startPos.y, endPos.y);
+ endX = Math.max(startPos.x, endPos.x);
+ endY = Math.max(startPos.y, endPos.y);
- // Delete cells
- var lastTDElm = null;
- for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ // Expand end positon to include spans
+ maxX = endX;
+ maxY = endY;
- if (sd.rowspan > 1) {
- tdElm.rowSpan = sd.rowspan - 1;
- } else {
- trElm = tdElm.parentNode;
+ // Expand startX
+ for (y = startY; y <= maxY; y++) {
+ cell = grid[y][startX];
- if (trElm.parentNode)
- trElm._delete = true;
- }
+ if (!cell.real) {
+ if (startX - (cell.colspan - 1) < startX)
+ startX -= cell.colspan - 1;
+ }
+ }
- lastTDElm = tdElm;
- }
- }
+ // Expand startY
+ for (x = startX; x <= maxX; x++) {
+ cell = grid[startY][x];
- deleteMarked(tableElm);
+ if (!cell.real) {
+ if (startY - (cell.rowspan - 1) < startY)
+ startY -= cell.rowspan - 1;
+ }
+ }
- select(0, -1);
- break;
+ // Find max X, Y
+ for (y = startY; y <= endY; y++) {
+ for (x = startX; x <= endX; x++) {
+ cell = grid[y][x];
- case "mceTableInsertColBefore":
- if (!trElm || !tdElm)
- return true;
+ if (cell.real) {
+ colSpan = cell.colspan - 1;
+ rowSpan = cell.rowspan - 1;
- var grid = getTableGrid(inst.dom.getParent(tableElm, "table"));
- var cpos = getCellPos(grid, tdElm);
- var lastTDElm = null;
+ if (colSpan) {
+ if (x + colSpan > maxX)
+ maxX = x + colSpan;
+ }
- for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ if (rowSpan) {
+ if (y + rowSpan > maxY)
+ maxY = y + rowSpan;
+ }
+ }
+ }
+ }
- if (sd['colspan'] == 1) {
- var newTD = doc.createElement(tdElm.nodeName);
+ // Remove current selection
+ dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
- if (!tinymce.isIE)
- newTD.innerHTML = '<br mce_bogus="1"/>';
+ // Add new selection
+ for (y = startY; y <= maxY; y++) {
+ for (x = startX; x <= maxX; x++)
+ dom.addClass(grid[y][x].elm, 'mceSelected');
+ }
+ }
+ };
+
+ // Expose to public
+ tinymce.extend(this, {
+ deleteTable : deleteTable,
+ split : split,
+ merge : merge,
+ insertRow : insertRow,
+ insertCol : insertCol,
+ deleteCols : deleteCols,
+ deleteRows : deleteRows,
+ cutRows : cutRows,
+ copyRows : copyRows,
+ pasteRows : pasteRows,
+ getPos : getPos,
+ setStartCell : setStartCell,
+ setEndCell : setEndCell
+ });
+ };
- newTD.rowSpan = tdElm.rowSpan;
+ tinymce.create('tinymce.plugins.TablePlugin', {
+ init : function(ed, url) {
+ var winMan, clipboardRows;
- tdElm.parentNode.insertBefore(newTD, tdElm);
- } else
- tdElm.colSpan++;
+ function createTableGrid(node) {
+ var selection = ed.selection, tblElm = ed.dom.getParent(node || selection.getNode(), 'table');
- lastTDElm = tdElm;
- }
- }
+ if (tblElm)
+ return new TableGrid(tblElm, ed.dom, selection);
+ };
- select();
- break;
+ function cleanup() {
+ // Restore selection possibilities
+ ed.getBody().style.webkitUserSelect = '';
+ ed.dom.removeClass(ed.dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
+ };
- case "mceTableInsertColAfter":
- if (!trElm || !tdElm)
- return true;
+ // Register buttons
+ each([
+ ['table', 'table.desc', 'mceInsertTable', true],
+ ['delete_table', 'table.del', 'mceTableDelete'],
+ ['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],
+ ['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],
+ ['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],
+ ['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],
+ ['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],
+ ['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],
+ ['row_props', 'table.row_desc', 'mceTableRowProps', true],
+ ['cell_props', 'table.cell_desc', 'mceTableCellProps', true],
+ ['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],
+ ['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]
+ ], function(c) {
+ ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
+ });
- var grid = getTableGrid(inst.dom.getParent(tableElm, "table"));
- var cpos = getCellPos(grid, tdElm);
- var lastTDElm = null;
+ // Select whole table is a table border is clicked
+ if (!tinymce.isIE) {
+ ed.onClick.add(function(ed, e) {
+ e = e.target;
- for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ if (e.nodeName === 'TABLE')
+ ed.selection.select(e);
+ });
+ }
- if (sd['colspan'] == 1) {
- var newTD = doc.createElement(tdElm.nodeName);
+ // Handle node change updates
+ ed.onNodeChange.add(function(ed, cm, n) {
+ var p;
- if (!tinymce.isIE)
- newTD.innerHTML = '<br mce_bogus="1"/>';
+ n = ed.selection.getStart();
+ p = ed.dom.getParent(n, 'td,th,caption');
+ cm.setActive('table', n.nodeName === 'TABLE' || !!p);
- newTD.rowSpan = tdElm.rowSpan;
+ // Disable table tools if we are in caption
+ if (p && p.nodeName === 'CAPTION')
+ p = 0;
- var nextTD = nextElm(tdElm, "TD,TH");
- if (nextTD == null)
- tdElm.parentNode.appendChild(newTD);
- else
- nextTD.parentNode.insertBefore(newTD, nextTD);
- } else
- tdElm.colSpan++;
+ cm.setDisabled('delete_table', !p);
+ cm.setDisabled('delete_col', !p);
+ cm.setDisabled('delete_table', !p);
+ cm.setDisabled('delete_row', !p);
+ cm.setDisabled('col_after', !p);
+ cm.setDisabled('col_before', !p);
+ cm.setDisabled('row_after', !p);
+ cm.setDisabled('row_before', !p);
+ cm.setDisabled('row_props', !p);
+ cm.setDisabled('cell_props', !p);
+ cm.setDisabled('split_cells', !p);
+ cm.setDisabled('merge_cells', !p);
+ });
- lastTDElm = tdElm;
- }
- }
+ ed.onInit.add(function(ed) {
+ var startTable, startCell, dom = ed.dom, tableGrid;
- select(1);
- break;
+ winMan = ed.windowManager;
- case "mceTableDeleteCol":
- if (!trElm || !tdElm)
- return true;
+ // Add cell selection logic
+ ed.onMouseDown.add(function(ed, e) {
+ if (e.button != 2) {
+ cleanup();
- var grid = getTableGrid(tableElm);
- var cpos = getCellPos(grid, tdElm);
- var lastTDElm = null;
+ startCell = dom.getParent(e.target, 'td,th');
+ startTable = dom.getParent(startCell, 'table');
+ }
+ });
- // Only one col, remove whole table
- if ((grid.length > 1 && grid[0].length <= 1) && tableElm.nodeName == 'TBODY') {
- inst.dom.remove(inst.dom.getParent(tableElm, "table"));
- return true;
- }
+ dom.bind(ed.getDoc(), 'mouseover', function(e) {
+ var sel, table, target = e.target;
- // Delete cells
- for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) {
+ table = dom.getParent(target, 'table');
+ if (table == startTable) {
+ if (!tableGrid) {
+ tableGrid = createTableGrid(table);
+ tableGrid.setStartCell(startCell);
- if (sd['colspan'] > 1)
- tdElm.colSpan = sd['colspan'] - 1;
- else {
- if (tdElm.parentNode)
- tdElm.parentNode.removeChild(tdElm);
- }
+ ed.getBody().style.webkitUserSelect = 'none';
+ }
- lastTDElm = tdElm;
- }
- }
+ tableGrid.setEndCell(target);
+ }
- select(-1);
- break;
+ // Remove current selection
+ sel = ed.selection.getSel();
- case "mceTableSplitCells":
- if (!trElm || !tdElm)
- return true;
+ if (sel.removeAllRanges)
+ sel.removeAllRanges();
+ else
+ sel.empty();
- var spandata = getColRowSpan(tdElm);
+ e.preventDefault();
+ }
+ });
- var colspan = spandata["colspan"];
- var rowspan = spandata["rowspan"];
+ ed.onMouseUp.add(function(ed, e) {
+ var rng, sel = ed.selection, selectedCells, nativeSel = sel.getSel(), walker, node, lastNode, endNode;
- // Needs splitting
- if (colspan > 1 || rowspan > 1) {
- // Generate cols
- tdElm.colSpan = 1;
- for (var i=1; i<colspan; i++) {
- var newTD = doc.createElement("td");
+ // Move selection to startCell
+ if (startCell) {
+ if (tableGrid)
+ ed.getBody().style.webkitUserSelect = '';
- if (!tinymce.isIE)
- newTD.innerHTML = '<br mce_bogus="1"/>';
+ function setPoint(node, start) {
+ var walker = new tinymce.dom.TreeWalker(node, node);
- trElm.insertBefore(newTD, nextElm(tdElm, "TD,TH"));
+ do {
+ // Text node
+ if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {
+ if (start)
+ rng.setStart(node, 0);
+ else
+ rng.setEnd(node, node.nodeValue.length);
- if (rowspan > 1)
- addRows(newTD, trElm, rowspan);
+ return;
}
- addRows(tdElm, trElm, rowspan);
- }
-
- // Apply visual aids
- tableElm = inst.dom.getParent(inst.selection.getNode(), "table");
- break;
-
- case "mceTableMergeCells":
- var rows = [];
- var sel = inst.selection.getSel();
- var grid = getTableGrid(tableElm);
-
- if (tinymce.isIE || sel.rangeCount == 1) {
- if (user_interface) {
- // Setup template
- var sp = getColRowSpan(tdElm);
-
- inst.windowManager.open({
- url : url + '/merge_cells.htm',
- width : 240 + parseInt(inst.getLang('table.merge_cells_delta_width', 0)),
- height : 110 + parseInt(inst.getLang('table.merge_cells_delta_height', 0)),
- inline : 1
- }, {
- action : "update",
- numcols : sp.colspan,
- numrows : sp.rowspan,
- plugin_url : url
- });
-
- return true;
- } else {
- var numRows = parseInt(value['numrows']);
- var numCols = parseInt(value['numcols']);
- var cpos = getCellPos(grid, tdElm);
-
- if (("" + numRows) == "NaN")
- numRows = 1;
-
- if (("" + numCols) == "NaN")
- numCols = 1;
-
- // Get rows and cells
- var tRows = tableElm.rows;
- for (var y=cpos.rowindex; y<grid.length; y++) {
- var rowCells = [];
-
- for (var x=cpos.cellindex; x<grid[y].length; x++) {
- var td = getCell(grid, y, x);
-
- if (td && !inArray(rows, td) && !inArray(rowCells, td)) {
- var cp = getCellPos(grid, td);
-
- // Within range
- if (cp.cellindex < cpos.cellindex+numCols && cp.rowindex < cpos.rowindex+numRows)
- rowCells[rowCells.length] = td;
- }
- }
-
- if (rowCells.length > 0)
- rows[rows.length] = rowCells;
-
- var td = getCell(grid, cpos.rowindex, cpos.cellindex);
- each(ed.dom.select('br', td), function(e, i) {
- if (i > 0 && ed.dom.getAttrib('mce_bogus'))
- ed.dom.remove(e);
- });
- }
+ // BR element
+ if (node.nodeName == 'BR') {
+ if (start)
+ rng.setStartBefore(node);
+ else
+ rng.setEndBefore(node);
- //return true;
+ return;
}
- } else {
- var cells = [];
- var sel = inst.selection.getSel();
- var lastTR = null;
- var curRow = null;
- var x1 = -1, y1 = -1, x2, y2;
-
- // Only one cell selected, whats the point?
- if (sel.rangeCount < 2)
- return true;
-
- // Get all selected cells
- for (var i=0; i<sel.rangeCount; i++) {
- var rng = sel.getRangeAt(i);
- var tdElm = rng.startContainer.childNodes[rng.startOffset];
-
- if (!tdElm)
+ } while (node = (start ? walker.next() : walker.prev()));
+ };
+
+ // Try to expand text selection as much as we can only Gecko supports cell selection
+ selectedCells = dom.select('td.mceSelected,th.mceSelected');
+ if (selectedCells.length > 0) {
+ rng = dom.createRng();
+ node = selectedCells[0];
+ endNode = selectedCells[selectedCells.length - 1];
+
+ setPoint(node, 1);
+ walker = new tinymce.dom.TreeWalker(node, dom.getParent(selectedCells[0], 'table'));
+
+ do {
+ if (node.nodeName == 'TD' || node.nodeName == 'TH') {
+ if (!dom.hasClass(node, 'mceSelected'))
break;
- if (tdElm.nodeName == "TD" || tdElm.nodeName == "TH")
- cells[cells.length] = tdElm;
+ lastNode = node;
}
+ } while (node = walker.next());
- // Get rows and cells
- var tRows = tableElm.rows;
- for (var y=0; y<tRows.length; y++) {
- var rowCells = [];
+ setPoint(lastNode);
- for (var x=0; x<tRows[y].cells.length; x++) {
- var td = tRows[y].cells[x];
+ sel.setRng(rng);
+ }
- for (var i=0; i<cells.length; i++) {
- if (td == cells[i]) {
- rowCells[rowCells.length] = td;
- }
- }
- }
+ ed.nodeChanged();
+ startCell = tableGrid = startTable = null;
+ }
+ });
- if (rowCells.length > 0)
- rows[rows.length] = rowCells;
- }
+ ed.onKeyUp.add(function(ed, e) {
+ cleanup();
+ });
- // Find selected cells in grid and box
- var curRow = [];
- var lastTR = null;
- for (var y=0; y<grid.length; y++) {
- for (var x=0; x<grid[y].length; x++) {
- grid[y][x]._selected = false;
-
- for (var i=0; i<cells.length; i++) {
- if (grid[y][x] == cells[i]) {
- // Get start pos
- if (x1 == -1) {
- x1 = x;
- y1 = y;
- }
-
- // Get end pos
- x2 = x;
- y2 = y;
-
- grid[y][x]._selected = true;
- }
- }
- }
- }
+ // Add context menu
+ if (ed && ed.plugins.contextmenu) {
+ ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
+ var sm, se = ed.selection, el = se.getNode() || ed.getBody();
- // Is there gaps, if so deny
- for (var y=y1; y<=y2; y++) {
- for (var x=x1; x<=x2; x++) {
- if (!grid[y][x]._selected) {
- alert("Invalid selection for merge.");
- return true;
- }
- }
- }
+ if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th')) {
+ m.removeAll();
+
+ if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {
+ m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
+ m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
+ m.addSeparator();
}
- // Validate selection and get total rowspan and colspan
- var rowSpan = 1, colSpan = 1;
+ if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {
+ m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
+ m.addSeparator();
+ }
- // Validate horizontal and get total colspan
- var lastRowSpan = -1;
- for (var y=0; y<rows.length; y++) {
- var rowColSpan = 0;
+ m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', value : {action : 'insert'}});
+ m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable'});
+ m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete'});
+ m.addSeparator();
- for (var x=0; x<rows[y].length; x++) {
- var sd = getColRowSpan(rows[y][x]);
+ // Cell menu
+ sm = m.addMenu({title : 'table.cell'});
+ sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps'});
+ sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells'});
+ sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells'});
- rowColSpan += sd['colspan'];
+ // Row menu
+ sm = m.addMenu({title : 'table.row'});
+ sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps'});
+ sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});
+ sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});
+ sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
+ sm.addSeparator();
+ sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
+ sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
+ sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}).setDisabled(!clipboardRows);
+ sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}).setDisabled(!clipboardRows);
- if (lastRowSpan != -1 && sd['rowspan'] != lastRowSpan) {
- alert("Invalid selection for merge.");
- return true;
- }
+ // Column menu
+ sm = m.addMenu({title : 'table.col'});
+ sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
+ sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
+ sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
+ } else
+ m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable'});
+ });
+ }
- lastRowSpan = sd['rowspan'];
- }
+ // Fixes an issue on Gecko where it's impossible to place the caret behind a table
+ // This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
+ if (!tinymce.isIE) {
+ function fixTableCaretPos() {
+ var last;
- if (rowColSpan > colSpan)
- colSpan = rowColSpan;
+ // Skip empty text nodes form the end
+ for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;
- lastRowSpan = -1;
- }
+ if (last && last.nodeName == 'TABLE')
+ ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');
+ };
+
+ // Fixes an bug where it's impossible to place the caret before a table in Gecko
+ // this fix solves it by detecting when the caret is at the beginning of such a table
+ // and then manually moves the caret infront of the table
+ if (tinymce.isGecko) {
+ ed.onKeyDown.add(function(ed, e) {
+ var rng, table, dom = ed.dom;
+
+ // On gecko it's not possible to place the caret before a table
+ if (e.keyCode == 37 || e.keyCode == 38) {
+ rng = ed.selection.getRng();
+ table = dom.getParent(rng.startContainer, 'table');
- // Validate vertical and get total rowspan
- var lastColSpan = -1;
- for (var x=0; x<rows[0].length; x++) {
- var colRowSpan = 0;
+ if (table && ed.getBody().firstChild == table) {
+ if (isAtStart(rng, table)) {
+ rng = dom.createRng();
- for (var y=0; y<rows.length; y++) {
- var sd = getColRowSpan(rows[y][x]);
+ rng.setStartBefore(table);
+ rng.setEndBefore(table);
- colRowSpan += sd['rowspan'];
+ ed.selection.setRng(rng);
- if (lastColSpan != -1 && sd['colspan'] != lastColSpan) {
- alert("Invalid selection for merge.");
- return true;
+ e.preventDefault();
}
-
- lastColSpan = sd['colspan'];
}
+ }
+ });
+ }
- if (colRowSpan > rowSpan)
- rowSpan = colRowSpan;
+ ed.onKeyUp.add(fixTableCaretPos);
+ ed.onSetContent.add(fixTableCaretPos);
+ ed.onVisualAid.add(fixTableCaretPos);
- lastColSpan = -1;
- }
+ ed.onPreProcess.add(function(ed, o) {
+ var last = o.node.lastChild;
- // Setup td
- tdElm = rows[0][0];
- tdElm.rowSpan = rowSpan;
- tdElm.colSpan = colSpan;
+ if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')
+ ed.dom.remove(last);
+ });
- // Merge cells
- for (var y=0; y<rows.length; y++) {
- for (var x=0; x<rows[y].length; x++) {
- var html = rows[y][x].innerHTML;
- var chk = html.replace(/[ \t\r\n]/g, "");
+ fixTableCaretPos();
+ }
+ });
- if (chk != "<br/>" && chk != "<br>" && chk != '<br mce_bogus="1"/>' && (x+y > 0))
- tdElm.innerHTML += html;
+ // Register action commands
+ each({
+ mceTableSplitCells : function(grid) {
+ grid.split();
+ },
- // Not current cell
- if (rows[y][x] != tdElm && !rows[y][x]._deleted) {
- var cpos = getCellPos(grid, rows[y][x]);
- var tr = rows[y][x].parentNode;
+ mceTableMergeCells : function(grid) {
+ var rowSpan, colSpan, cell;
- tr.removeChild(rows[y][x]);
- rows[y][x]._deleted = true;
+ cell = ed.dom.getParent(ed.selection.getNode(), 'th,td');
+ if (cell) {
+ rowSpan = cell.rowSpan;
+ colSpan = cell.colSpan;
+ }
- // Empty TR, remove it
- if (!tr.hasChildNodes()) {
- tr.parentNode.removeChild(tr);
+ if (!ed.dom.select('td.mceSelected,th.mceSelected').length) {
+ winMan.open({
+ url : url + '/merge_cells.htm',
+ width : 240 + parseInt(ed.getLang('table.merge_cells_delta_width', 0)),
+ height : 110 + parseInt(ed.getLang('table.merge_cells_delta_height', 0)),
+ inline : 1
+ }, {
+ rows : rowSpan,
+ cols : colSpan,
+ onaction : function(data) {
+ grid.merge(cell, data.cols, data.rows);
+ },
+ plugin_url : url
+ });
+ } else
+ grid.merge();
+ },
- var lastCell = null;
- for (var x=0; cellElm = getCell(grid, cpos.rowindex, x); x++) {
- if (cellElm != lastCell && cellElm.rowSpan > 1)
- cellElm.rowSpan--;
+ mceTableInsertRowBefore : function(grid) {
+ grid.insertRow(true);
+ },
- lastCell = cellElm;
- }
+ mceTableInsertRowAfter : function(grid) {
+ grid.insertRow();
+ },
- if (tdElm.rowSpan > 1)
- tdElm.rowSpan--;
- }
- }
- }
- }
+ mceTableInsertColBefore : function(grid) {
+ grid.insertCol(true);
+ },
- // Remove all but one bogus br
- each(ed.dom.select('br', tdElm), function(e, i) {
- if (i > 0 && ed.dom.getAttrib(e, 'mce_bogus'))
- ed.dom.remove(e);
- });
+ mceTableInsertColAfter : function(grid) {
+ grid.insertCol();
+ },
- break;
- }
+ mceTableDeleteCol : function(grid) {
+ grid.deleteCols();
+ },
- tableElm = inst.dom.getParent(inst.selection.getNode(), "table");
- inst.addVisual(tableElm);
- inst.nodeChanged();
- }
+ mceTableDeleteRow : function(grid) {
+ grid.deleteRows();
+ },
- return true;
- }
+ mceTableCutRow : function(grid) {
+ clipboardRows = grid.cutRows();
+ },
+
+ mceTableCopyRow : function(grid) {
+ clipboardRows = grid.copyRows();
+ },
- // Pass to next handler in chain
- return false;
+ mceTablePasteRowBefore : function(grid) {
+ grid.pasteRows(clipboardRows, true);
+ },
+
+ mceTablePasteRowAfter : function(grid) {
+ grid.pasteRows(clipboardRows);
+ },
+
+ mceTableDelete : function(grid) {
+ grid.deleteTable();
+ }
+ }, function(func, name) {
+ ed.addCommand(name, function() {
+ var grid = createTableGrid();
+
+ if (grid) {
+ func(grid);
+ ed.execCommand('mceRepaint');
+ cleanup();
+ }
+ });
+ });
+
+ // Register dialog commands
+ each({
+ mceInsertTable : function(val) {
+ winMan.open({
+ url : url + '/table.htm',
+ width : 400 + parseInt(ed.getLang('table.table_delta_width', 0)),
+ height : 320 + parseInt(ed.getLang('table.table_delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url,
+ action : val ? val.action : 0
+ });
+ },
+
+ mceTableRowProps : function() {
+ winMan.open({
+ url : url + '/row.htm',
+ width : 400 + parseInt(ed.getLang('table.rowprops_delta_width', 0)),
+ height : 295 + parseInt(ed.getLang('table.rowprops_delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ },
+
+ mceTableCellProps : function() {
+ winMan.open({
+ url : url + '/cell.htm',
+ width : 400 + parseInt(ed.getLang('table.cellprops_delta_width', 0)),
+ height : 295 + parseInt(ed.getLang('table.cellprops_delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ }
+ }, function(func, name) {
+ ed.addCommand(name, function(ui, val) {
+ func(val);
+ });
+ });
}
});
// Register plugin
tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
-})(); \ No newline at end of file
+})(tinymce); \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/table/js/cell.js b/program/js/tiny_mce/plugins/table/js/cell.js
index f23b06751..f24619172 100644
--- a/program/js/tiny_mce/plugins/table/js/cell.js
+++ b/program/js/tiny_mce/plugins/table/js/cell.js
@@ -11,7 +11,7 @@ function init() {
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor')
var inst = ed;
- var tdElm = ed.dom.getParent(ed.selection.getNode(), "td,th");
+ var tdElm = ed.dom.getParent(ed.selection.getStart(), "td,th");
var formObj = document.forms[0];
var st = ed.dom.parseStyle(ed.dom.getAttrib(tdElm, "style"));
@@ -34,38 +34,55 @@ function init() {
addClassesToList('class', 'table_cell_styles');
TinyMCE_EditableSelects.init();
- formObj.bordercolor.value = bordercolor;
- formObj.bgcolor.value = bgcolor;
- formObj.backgroundimage.value = backgroundimage;
- formObj.width.value = width;
- formObj.height.value = height;
- formObj.id.value = id;
- formObj.lang.value = lang;
- formObj.style.value = ed.dom.serializeStyle(st);
- selectByValue(formObj, 'align', align);
- selectByValue(formObj, 'valign', valign);
- selectByValue(formObj, 'class', className, true, true);
- selectByValue(formObj, 'celltype', celltype);
- selectByValue(formObj, 'dir', dir);
- selectByValue(formObj, 'scope', scope);
-
- // Resize some elements
- if (isVisible('backgroundimagebrowser'))
- document.getElementById('backgroundimage').style.width = '180px';
-
- updateColor('bordercolor_pick', 'bordercolor');
- updateColor('bgcolor_pick', 'bgcolor');
+ if (!ed.dom.hasClass(tdElm, 'mceSelected')) {
+ formObj.bordercolor.value = bordercolor;
+ formObj.bgcolor.value = bgcolor;
+ formObj.backgroundimage.value = backgroundimage;
+ formObj.width.value = width;
+ formObj.height.value = height;
+ formObj.id.value = id;
+ formObj.lang.value = lang;
+ formObj.style.value = ed.dom.serializeStyle(st);
+ selectByValue(formObj, 'align', align);
+ selectByValue(formObj, 'valign', valign);
+ selectByValue(formObj, 'class', className, true, true);
+ selectByValue(formObj, 'celltype', celltype);
+ selectByValue(formObj, 'dir', dir);
+ selectByValue(formObj, 'scope', scope);
+
+ // Resize some elements
+ if (isVisible('backgroundimagebrowser'))
+ document.getElementById('backgroundimage').style.width = '180px';
+
+ updateColor('bordercolor_pick', 'bordercolor');
+ updateColor('bgcolor_pick', 'bgcolor');
+ } else
+ tinyMCEPopup.dom.hide('action');
}
function updateAction() {
var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0];
tinyMCEPopup.restoreSelection();
- el = ed.selection.getNode();
+ el = ed.selection.getStart();
tdElm = ed.dom.getParent(el, "td,th");
trElm = ed.dom.getParent(el, "tr");
tableElm = ed.dom.getParent(el, "table");
+ // Cell is selected
+ if (ed.dom.hasClass(tdElm, 'mceSelected')) {
+ // Update all selected sells
+ tinymce.each(ed.dom.select('td.mceSelected,th.mceSelected'), function(td) {
+ updateCell(td);
+ });
+
+ ed.addVisual();
+ ed.nodeChanged();
+ inst.execCommand('mceEndUndoLevel');
+ tinyMCEPopup.close();
+ return;
+ }
+
ed.execCommand('mceBeginUndoLevel');
switch (getSelectValue(formObj, 'action')) {
diff --git a/program/js/tiny_mce/plugins/table/js/merge_cells.js b/program/js/tiny_mce/plugins/table/js/merge_cells.js
index 31d6df0ab..7ee4bf040 100644
--- a/program/js/tiny_mce/plugins/table/js/merge_cells.js
+++ b/program/js/tiny_mce/plugins/table/js/merge_cells.js
@@ -1,29 +1,27 @@
tinyMCEPopup.requireLangPack();
-function init() {
- var f = document.forms[0], v;
+var MergeCellsDialog = {
+ init : function() {
+ var f = document.forms[0];
- tinyMCEPopup.resizeToInnerSize();
+ f.numcols.value = tinyMCEPopup.getWindowArg('cols', 1);
+ f.numrows.value = tinyMCEPopup.getWindowArg('rows', 1);
+ },
- f.numcols.value = tinyMCEPopup.getWindowArg('numcols', 1);
- f.numrows.value = tinyMCEPopup.getWindowArg('numrows', 1);
-}
+ merge : function() {
+ var func, f = document.forms[0];
-function mergeCells() {
- var args = [], f = document.forms[0];
+ tinyMCEPopup.restoreSelection();
- tinyMCEPopup.restoreSelection();
+ func = tinyMCEPopup.getWindowArg('onaction');
- if (!AutoValidator.validate(f)) {
- tinyMCEPopup.alert(tinyMCEPopup.getLang('invalid_data'));
- return false;
- }
-
- args["numcols"] = f.numcols.value;
- args["numrows"] = f.numrows.value;
+ func({
+ cols : f.numcols.value,
+ rows : f.numrows.value
+ });
- tinyMCEPopup.execCommand("mceTableMergeCells", false, args);
- tinyMCEPopup.close();
-}
+ tinyMCEPopup.close();
+ }
+};
-tinyMCEPopup.onInit.add(init);
+tinyMCEPopup.onInit.add(MergeCellsDialog.init, MergeCellsDialog);
diff --git a/program/js/tiny_mce/plugins/table/js/row.js b/program/js/tiny_mce/plugins/table/js/row.js
index d25f635f6..7e188c3f0 100644
--- a/program/js/tiny_mce/plugins/table/js/row.js
+++ b/program/js/tiny_mce/plugins/table/js/row.js
@@ -8,7 +8,7 @@ function init() {
var inst = tinyMCEPopup.editor;
var dom = inst.dom;
- var trElm = dom.getParent(inst.selection.getNode(), "tr");
+ var trElm = dom.getParent(inst.selection.getStart(), "tr");
var formObj = document.forms[0];
var st = dom.parseStyle(dom.getAttrib(trElm, "style"));
@@ -24,27 +24,32 @@ function init() {
var lang = dom.getAttrib(trElm, 'lang');
var dir = dom.getAttrib(trElm, 'dir');
- // Setup form
- addClassesToList('class', 'table_row_styles');
- TinyMCE_EditableSelects.init();
-
- formObj.bgcolor.value = bgcolor;
- formObj.backgroundimage.value = backgroundimage;
- formObj.height.value = height;
- formObj.id.value = id;
- formObj.lang.value = lang;
- formObj.style.value = dom.serializeStyle(st);
- selectByValue(formObj, 'align', align);
- selectByValue(formObj, 'valign', valign);
- selectByValue(formObj, 'class', className, true, true);
selectByValue(formObj, 'rowtype', rowtype);
- selectByValue(formObj, 'dir', dir);
-
- // Resize some elements
- if (isVisible('backgroundimagebrowser'))
- document.getElementById('backgroundimage').style.width = '180px';
- updateColor('bgcolor_pick', 'bgcolor');
+ // Any cells selected
+ if (dom.select('td.mceSelected,th.mceSelected', trElm).length == 0) {
+ // Setup form
+ addClassesToList('class', 'table_row_styles');
+ TinyMCE_EditableSelects.init();
+
+ formObj.bgcolor.value = bgcolor;
+ formObj.backgroundimage.value = backgroundimage;
+ formObj.height.value = height;
+ formObj.id.value = id;
+ formObj.lang.value = lang;
+ formObj.style.value = dom.serializeStyle(st);
+ selectByValue(formObj, 'align', align);
+ selectByValue(formObj, 'valign', valign);
+ selectByValue(formObj, 'class', className, true, true);
+ selectByValue(formObj, 'dir', dir);
+
+ // Resize some elements
+ if (isVisible('backgroundimagebrowser'))
+ document.getElementById('backgroundimage').style.width = '180px';
+
+ updateColor('bgcolor_pick', 'bgcolor');
+ } else
+ tinyMCEPopup.dom.hide('action');
}
function updateAction() {
@@ -52,8 +57,28 @@ function updateAction() {
var action = getSelectValue(formObj, 'action');
tinyMCEPopup.restoreSelection();
- trElm = dom.getParent(inst.selection.getNode(), "tr");
- tableElm = dom.getParent(inst.selection.getNode(), "table");
+ trElm = dom.getParent(inst.selection.getStart(), "tr");
+ tableElm = dom.getParent(inst.selection.getStart(), "table");
+
+ // Update all selected rows
+ if (dom.select('td.mceSelected,th.mceSelected', trElm).length > 0) {
+ tinymce.each(tableElm.rows, function(tr) {
+ var i;
+
+ for (i = 0; i < tr.cells.length; i++) {
+ if (dom.hasClass(tr.cells[i], 'mceSelected')) {
+ updateRow(tr, true);
+ return;
+ }
+ }
+ });
+
+ inst.addVisual();
+ inst.nodeChanged();
+ inst.execCommand('mceEndUndoLevel');
+ tinyMCEPopup.close();
+ return;
+ }
inst.execCommand('mceBeginUndoLevel');
diff --git a/program/js/tiny_mce/plugins/table/js/table.js b/program/js/tiny_mce/plugins/table/js/table.js
index 182589d69..f4b0862ef 100644
--- a/program/js/tiny_mce/plugins/table/js/table.js
+++ b/program/js/tiny_mce/plugins/table/js/table.js
@@ -82,7 +82,7 @@ function insertTable() {
capEl = elm.ownerDocument.createElement('caption');
if (!tinymce.isIE)
- capEl.innerHTML = '<br mce_bogus="1"/>';
+ capEl.innerHTML = '<br _mce_bogus="1"/>';
elm.insertBefore(capEl, elm.firstChild);
}
@@ -151,6 +151,7 @@ function insertTable() {
html += makeAttrib('border', border);
html += makeAttrib('cellpadding', cellpadding);
html += makeAttrib('cellspacing', cellspacing);
+ html += makeAttrib('_mce_new', '1');
if (width && inst.settings.inline_styles) {
if (style)
@@ -186,7 +187,7 @@ function insertTable() {
if (caption) {
if (!tinymce.isIE)
- html += '<caption><br mce_bogus="1"/></caption>';
+ html += '<caption><br _mce_bogus="1"/></caption>';
else
html += '<caption></caption>';
}
@@ -196,7 +197,7 @@ function insertTable() {
for (var x=0; x<cols; x++) {
if (!tinymce.isIE)
- html += '<td><br mce_bogus="1"/></td>';
+ html += '<td><br _mce_bogus="1"/></td>';
else
html += '<td></td>';
}
@@ -210,9 +211,10 @@ function insertTable() {
// Move table
if (inst.settings.fix_table_elements) {
- var bm = inst.selection.getBookmark(), patt = '';
+ var patt = '';
- inst.execCommand('mceInsertContent', false, '<br class="_mce_marker" />');
+ inst.focus();
+ inst.selection.setContent('<br class="_mce_marker" />');
tinymce.each('h1,h2,h3,h4,h5,h6,p'.split(','), function(n) {
if (patt)
@@ -225,12 +227,19 @@ function insertTable() {
inst.dom.split(inst.dom.getParent(n, 'h1,h2,h3,h4,h5,h6,p'), n);
});
- dom.setOuterHTML(dom.select('._mce_marker')[0], html);
-
- inst.selection.moveToBookmark(bm);
+ dom.setOuterHTML(dom.select('br._mce_marker')[0], html);
} else
inst.execCommand('mceInsertContent', false, html);
+ tinymce.each(dom.select('table[_mce_new]'), function(node) {
+ var td = dom.select('td', node);
+
+ inst.selection.select(td[0], true);
+ inst.selection.collapse();
+
+ dom.setAttrib(node, '_mce_new', '');
+ });
+
inst.addVisual();
inst.execCommand('mceEndUndoLevel');
diff --git a/program/js/tiny_mce/plugins/table/merge_cells.htm b/program/js/tiny_mce/plugins/table/merge_cells.htm
index 25d42eb65..9736ed8c0 100644
--- a/program/js/tiny_mce/plugins/table/merge_cells.htm
+++ b/program/js/tiny_mce/plugins/table/merge_cells.htm
@@ -8,7 +8,7 @@
<script type="text/javascript" src="js/merge_cells.js"></script>
</head>
<body style="margin: 8px">
-<form onsubmit="mergeCells();return false;" action="#">
+<form onsubmit="MergeCellsDialog.merge();return false;" action="#">
<fieldset>
<legend>{#table_dlg.merge_cells_title}</legend>
<table border="0" cellpadding="0" cellspacing="3" width="100%">
@@ -24,13 +24,8 @@
</fieldset>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" id="insert" name="insert" value="{#update}" />
- </div>
-
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#update}" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>
diff --git a/program/js/tiny_mce/plugins/table/row.htm b/program/js/tiny_mce/plugins/table/row.htm
index 07ca13c98..092e6c827 100644
--- a/program/js/tiny_mce/plugins/table/row.htm
+++ b/program/js/tiny_mce/plugins/table/row.htm
@@ -147,13 +147,8 @@
</select>
</div>
- <div style="float: left">
- <div><input type="submit" id="insert" name="insert" value="{#update}" /></div>
- </div>
-
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#update}" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>
diff --git a/program/js/tiny_mce/plugins/table/table.htm b/program/js/tiny_mce/plugins/table/table.htm
index 37e615970..f26903922 100644
--- a/program/js/tiny_mce/plugins/table/table.htm
+++ b/program/js/tiny_mce/plugins/table/table.htm
@@ -179,13 +179,8 @@
</div>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" id="insert" name="insert" value="{#insert}" />
- </div>
-
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#insert}" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>
diff --git a/program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js b/program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js
index 02ec4e698..0a5275fe2 100644
--- a/program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js
+++ b/program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js
@@ -1,8 +1,11 @@
/**
- * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
+ * editor_plugin_src.js
*
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/abbr.htm b/program/js/tiny_mce/plugins/xhtmlxtras/abbr.htm
index 3928a17e1..3aeac0deb 100644
--- a/program/js/tiny_mce/plugins/xhtmlxtras/abbr.htm
+++ b/program/js/tiny_mce/plugins/xhtmlxtras/abbr.htm
@@ -132,17 +132,10 @@
</div>
</div>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" id="insert" name="insert" value="{#update}" />
- </div>
- <div style="float: left">
- <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeAbbr();" style="display: none;" />
- </div>
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#update}" />
+ <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeAbbr();" style="display: none;" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
-
</form>
</body>
</html>
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/acronym.htm b/program/js/tiny_mce/plugins/xhtmlxtras/acronym.htm
index 4d4ebaac0..31ee7b70f 100644
--- a/program/js/tiny_mce/plugins/xhtmlxtras/acronym.htm
+++ b/program/js/tiny_mce/plugins/xhtmlxtras/acronym.htm
@@ -132,17 +132,10 @@
</div>
</div>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" id="insert" name="insert" value="{#update}" />
- </div>
- <div style="float: left">
- <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeAcronym();" style="display: none;" />
- </div>
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#update}" />
+ <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeAcronym();" style="display: none;" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
-
</form>
</body>
</html>
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/attributes.htm b/program/js/tiny_mce/plugins/xhtmlxtras/attributes.htm
index 322b468e3..17054da3e 100644
--- a/program/js/tiny_mce/plugins/xhtmlxtras/attributes.htm
+++ b/program/js/tiny_mce/plugins/xhtmlxtras/attributes.htm
@@ -140,14 +140,9 @@
</div>
</div>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" id="insert" name="insert" value="{#insert}" />
- </div>
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#insert}" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
-
</form>
</body>
</html>
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/cite.htm b/program/js/tiny_mce/plugins/xhtmlxtras/cite.htm
index cdfaf4e85..d0a3e3a8e 100644
--- a/program/js/tiny_mce/plugins/xhtmlxtras/cite.htm
+++ b/program/js/tiny_mce/plugins/xhtmlxtras/cite.htm
@@ -132,17 +132,10 @@
</div>
</div>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" id="insert" name="insert" value="{#update}" />
- </div>
- <div style="float: left">
- <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeCite();" style="display: none;" />
- </div>
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#update}" />
+ <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeCite();" style="display: none;" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
-
</form>
</body>
</html>
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/del.htm b/program/js/tiny_mce/plugins/xhtmlxtras/del.htm
index f45676e3d..8b07fa842 100644
--- a/program/js/tiny_mce/plugins/xhtmlxtras/del.htm
+++ b/program/js/tiny_mce/plugins/xhtmlxtras/del.htm
@@ -152,18 +152,10 @@
</div>
</div>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" id="insert" name="insert" value="{#update}" />
- </div>
- <div style="float: left">
- <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeDel();" style="display: none;" />
- </div>
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#update}" />
+ <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeDel();" style="display: none;" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
-
</form>
-
</body>
</html>
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/editor_plugin.js b/program/js/tiny_mce/plugins/xhtmlxtras/editor_plugin.js
index 8c7f48e69..e5195265e 100644
--- a/program/js/tiny_mce/plugins/xhtmlxtras/editor_plugin.js
+++ b/program/js/tiny_mce/plugins/xhtmlxtras/editor_plugin.js
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.XHTMLXtrasPlugin",{init:function(b,c){b.addCommand("mceCite",function(){b.windowManager.open({file:c+"/cite.htm",width:350+parseInt(b.getLang("xhtmlxtras.cite_delta_width",0)),height:250+parseInt(b.getLang("xhtmlxtras.cite_delta_height",0)),inline:1},{plugin_url:c})});b.addCommand("mceAcronym",function(){b.windowManager.open({file:c+"/acronym.htm",width:350+parseInt(b.getLang("xhtmlxtras.acronym_delta_width",0)),height:250+parseInt(b.getLang("xhtmlxtras.acronym_delta_width",0)),inline:1},{plugin_url:c})});b.addCommand("mceAbbr",function(){b.windowManager.open({file:c+"/abbr.htm",width:350+parseInt(b.getLang("xhtmlxtras.abbr_delta_width",0)),height:250+parseInt(b.getLang("xhtmlxtras.abbr_delta_width",0)),inline:1},{plugin_url:c})});b.addCommand("mceDel",function(){b.windowManager.open({file:c+"/del.htm",width:340+parseInt(b.getLang("xhtmlxtras.del_delta_width",0)),height:310+parseInt(b.getLang("xhtmlxtras.del_delta_width",0)),inline:1},{plugin_url:c})});b.addCommand("mceIns",function(){b.windowManager.open({file:c+"/ins.htm",width:340+parseInt(b.getLang("xhtmlxtras.ins_delta_width",0)),height:310+parseInt(b.getLang("xhtmlxtras.ins_delta_width",0)),inline:1},{plugin_url:c})});b.addCommand("mceAttributes",function(){b.windowManager.open({file:c+"/attributes.htm",width:380,height:370,inline:1},{plugin_url:c})});b.addButton("cite",{title:"xhtmlxtras.cite_desc",cmd:"mceCite"});b.addButton("acronym",{title:"xhtmlxtras.acronym_desc",cmd:"mceAcronym"});b.addButton("abbr",{title:"xhtmlxtras.abbr_desc",cmd:"mceAbbr"});b.addButton("del",{title:"xhtmlxtras.del_desc",cmd:"mceDel"});b.addButton("ins",{title:"xhtmlxtras.ins_desc",cmd:"mceIns"});b.addButton("attribs",{title:"xhtmlxtras.attribs_desc",cmd:"mceAttributes"});if(tinymce.isIE){function a(d,e){if(e.set){e.content=e.content.replace(/<abbr([^>]+)>/gi,"<html:abbr $1>");e.content=e.content.replace(/<\/abbr>/gi,"</html:abbr>")}}b.onBeforeSetContent.add(a);b.onPostProcess.add(a)}b.onNodeChange.add(function(e,d,g,f){g=e.dom.getParent(g,"CITE,ACRONYM,ABBR,DEL,INS");d.setDisabled("cite",f);d.setDisabled("acronym",f);d.setDisabled("abbr",f);d.setDisabled("del",f);d.setDisabled("ins",f);d.setDisabled("attribs",g&&g.nodeName=="BODY");d.setActive("cite",0);d.setActive("acronym",0);d.setActive("abbr",0);d.setActive("del",0);d.setActive("ins",0);if(g){do{d.setDisabled(g.nodeName.toLowerCase(),0);d.setActive(g.nodeName.toLowerCase(),1)}while(g=g.parentNode)}})},getInfo:function(){return{longname:"XHTML Xtras Plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("xhtmlxtras",tinymce.plugins.XHTMLXtrasPlugin)})(); \ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.XHTMLXtrasPlugin",{init:function(b,c){b.addCommand("mceCite",function(){b.windowManager.open({file:c+"/cite.htm",width:350+parseInt(b.getLang("xhtmlxtras.cite_delta_width",0)),height:250+parseInt(b.getLang("xhtmlxtras.cite_delta_height",0)),inline:1},{plugin_url:c})});b.addCommand("mceAcronym",function(){b.windowManager.open({file:c+"/acronym.htm",width:350+parseInt(b.getLang("xhtmlxtras.acronym_delta_width",0)),height:250+parseInt(b.getLang("xhtmlxtras.acronym_delta_width",0)),inline:1},{plugin_url:c})});b.addCommand("mceAbbr",function(){b.windowManager.open({file:c+"/abbr.htm",width:350+parseInt(b.getLang("xhtmlxtras.abbr_delta_width",0)),height:250+parseInt(b.getLang("xhtmlxtras.abbr_delta_width",0)),inline:1},{plugin_url:c})});b.addCommand("mceDel",function(){b.windowManager.open({file:c+"/del.htm",width:340+parseInt(b.getLang("xhtmlxtras.del_delta_width",0)),height:310+parseInt(b.getLang("xhtmlxtras.del_delta_width",0)),inline:1},{plugin_url:c})});b.addCommand("mceIns",function(){b.windowManager.open({file:c+"/ins.htm",width:340+parseInt(b.getLang("xhtmlxtras.ins_delta_width",0)),height:310+parseInt(b.getLang("xhtmlxtras.ins_delta_width",0)),inline:1},{plugin_url:c})});b.addCommand("mceAttributes",function(){b.windowManager.open({file:c+"/attributes.htm",width:380,height:370,inline:1},{plugin_url:c})});b.addButton("cite",{title:"xhtmlxtras.cite_desc",cmd:"mceCite"});b.addButton("acronym",{title:"xhtmlxtras.acronym_desc",cmd:"mceAcronym"});b.addButton("abbr",{title:"xhtmlxtras.abbr_desc",cmd:"mceAbbr"});b.addButton("del",{title:"xhtmlxtras.del_desc",cmd:"mceDel"});b.addButton("ins",{title:"xhtmlxtras.ins_desc",cmd:"mceIns"});b.addButton("attribs",{title:"xhtmlxtras.attribs_desc",cmd:"mceAttributes"});if(tinymce.isIE){function a(d,e){if(e.set){e.content=e.content.replace(/<abbr([^>]+)>/gi,"<html:abbr $1>");e.content=e.content.replace(/<\/abbr>/gi,"</html:abbr>")}}b.onBeforeSetContent.add(a);b.onPostProcess.add(a)}b.onNodeChange.add(function(e,d,g,f){g=e.dom.getParent(g,"CITE,ACRONYM,ABBR,DEL,INS");d.setDisabled("cite",f);d.setDisabled("acronym",f);d.setDisabled("abbr",f);d.setDisabled("del",f);d.setDisabled("ins",f);d.setDisabled("attribs",g&&g.nodeName=="BODY");d.setActive("cite",0);d.setActive("acronym",0);d.setActive("abbr",0);d.setActive("del",0);d.setActive("ins",0);if(g){do{d.setDisabled(g.nodeName.toLowerCase(),0);d.setActive(g.nodeName.toLowerCase(),1)}while(g=g.parentNode)}});b.onPreInit.add(function(){b.dom.create("abbr")})},getInfo:function(){return{longname:"XHTML Xtras Plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("xhtmlxtras",tinymce.plugins.XHTMLXtrasPlugin)})(); \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js b/program/js/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js
index bef06f2d2..9b51b8368 100644
--- a/program/js/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js
+++ b/program/js/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js
@@ -1,8 +1,11 @@
/**
- * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
+ * editor_plugin_src.js
*
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
@@ -118,6 +121,11 @@
} while (n = n.parentNode);
}
});
+
+ ed.onPreInit.add(function() {
+ // Fixed IE issue where it can't handle these elements correctly
+ ed.dom.create('abbr');
+ });
},
getInfo : function() {
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/ins.htm b/program/js/tiny_mce/plugins/xhtmlxtras/ins.htm
index 9fa21c433..6c5470cfc 100644
--- a/program/js/tiny_mce/plugins/xhtmlxtras/ins.htm
+++ b/program/js/tiny_mce/plugins/xhtmlxtras/ins.htm
@@ -152,18 +152,10 @@
</div>
</div>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" id="insert" name="insert" value="{#update}" />
- </div>
- <div style="float: left">
- <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeIns();" style="display: none;" />
- </div>
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#update}" />
+ <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeIns();" style="display: none;" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
-
</form>
-
</body>
</html>
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/js/abbr.js b/program/js/tiny_mce/plugins/xhtmlxtras/js/abbr.js
index e84b6a837..4b51a2572 100644
--- a/program/js/tiny_mce/plugins/xhtmlxtras/js/abbr.js
+++ b/program/js/tiny_mce/plugins/xhtmlxtras/js/abbr.js
@@ -1,8 +1,11 @@
- /**
- * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
+/**
+ * abbr.js
*
- * @author Moxiecode - based on work by Andrew Tetlaw
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
function init() {
@@ -13,7 +16,7 @@ function init() {
}
function insertAbbr() {
- SXE.insertElement(tinymce.isIE ? 'html:abbr' : 'abbr');
+ SXE.insertElement('abbr');
tinyMCEPopup.close();
}
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/js/acronym.js b/program/js/tiny_mce/plugins/xhtmlxtras/js/acronym.js
index 933d122cb..6ec2f8871 100644
--- a/program/js/tiny_mce/plugins/xhtmlxtras/js/acronym.js
+++ b/program/js/tiny_mce/plugins/xhtmlxtras/js/acronym.js
@@ -1,8 +1,11 @@
- /**
- * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
+/**
+ * acronym.js
*
- * @author Moxiecode - based on work by Andrew Tetlaw
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
function init() {
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/js/attributes.js b/program/js/tiny_mce/plugins/xhtmlxtras/js/attributes.js
index 23c7fa4c2..d62a219e6 100644
--- a/program/js/tiny_mce/plugins/xhtmlxtras/js/attributes.js
+++ b/program/js/tiny_mce/plugins/xhtmlxtras/js/attributes.js
@@ -1,8 +1,11 @@
- /**
- * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
+/**
+ * attributes.js
*
- * @author Moxiecode - based on work by Andrew Tetlaw
- * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
function init() {
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/js/cite.js b/program/js/tiny_mce/plugins/xhtmlxtras/js/cite.js
index c36f7fd87..009b71546 100644
--- a/program/js/tiny_mce/plugins/xhtmlxtras/js/cite.js
+++ b/program/js/tiny_mce/plugins/xhtmlxtras/js/cite.js
@@ -1,8 +1,11 @@
- /**
- * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
+/**
+ * cite.js
*
- * @author Moxiecode - based on work by Andrew Tetlaw
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
function init() {
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/js/del.js b/program/js/tiny_mce/plugins/xhtmlxtras/js/del.js
index 7049f2beb..9e5d8c571 100644
--- a/program/js/tiny_mce/plugins/xhtmlxtras/js/del.js
+++ b/program/js/tiny_mce/plugins/xhtmlxtras/js/del.js
@@ -1,8 +1,11 @@
- /**
- * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
+/**
+ * del.js
*
- * @author Moxiecode - based on work by Andrew Tetlaw
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
function init() {
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/js/element_common.js b/program/js/tiny_mce/plugins/xhtmlxtras/js/element_common.js
index 70f168a6b..5b494a566 100644
--- a/program/js/tiny_mce/plugins/xhtmlxtras/js/element_common.js
+++ b/program/js/tiny_mce/plugins/xhtmlxtras/js/element_common.js
@@ -1,8 +1,11 @@
- /**
- * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
+/**
+ * element_common.js
*
- * @author Moxiecode - based on work by Andrew Tetlaw
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
tinyMCEPopup.requireLangPack();
@@ -157,9 +160,6 @@ SXE.insertElement = function(element_name) {
if(s.length > 0) {
tagName = element_name;
- if (tinymce.isIE && element_name.indexOf('html:') == 0)
- element_name = element_name.substring(5).toLowerCase();
-
insertInlineElement(element_name);
var elementArray = tinymce.grep(SXE.inst.dom.select(element_name));
for (var i=0; i<elementArray.length; i++) {
@@ -194,7 +194,7 @@ SXE.removeElement = function(element_name){
}
SXE.showRemoveButton = function() {
- document.getElementById("remove").style.display = 'block';
+ document.getElementById("remove").style.display = '';
}
SXE.containsClass = function(elm,cl) {
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/js/ins.js b/program/js/tiny_mce/plugins/xhtmlxtras/js/ins.js
index 4fcc99825..3774f0a18 100644
--- a/program/js/tiny_mce/plugins/xhtmlxtras/js/ins.js
+++ b/program/js/tiny_mce/plugins/xhtmlxtras/js/ins.js
@@ -1,8 +1,11 @@
- /**
- * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
+/**
+ * ins.js
*
- * @author Moxiecode - based on work by Andrew Tetlaw
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
function init() {
diff --git a/program/js/tiny_mce/themes/advanced/about.htm b/program/js/tiny_mce/themes/advanced/about.htm
index e5df7aa5a..267f837eb 100644
--- a/program/js/tiny_mce/themes/advanced/about.htm
+++ b/program/js/tiny_mce/themes/advanced/about.htm
@@ -48,9 +48,7 @@
</div>
<div class="mceActionPanel">
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="button" id="cancel" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" />
</div>
</body>
</html>
diff --git a/program/js/tiny_mce/themes/advanced/anchor.htm b/program/js/tiny_mce/themes/advanced/anchor.htm
index 42095a1c0..2bc63fcfd 100644
--- a/program/js/tiny_mce/themes/advanced/anchor.htm
+++ b/program/js/tiny_mce/themes/advanced/anchor.htm
@@ -18,13 +18,8 @@
</table>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" id="insert" name="insert" value="{#update}" />
- </div>
-
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#update}" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>
diff --git a/program/js/tiny_mce/themes/advanced/color_picker.htm b/program/js/tiny_mce/themes/advanced/color_picker.htm
index cbd6b88dc..096e7550c 100644
--- a/program/js/tiny_mce/themes/advanced/color_picker.htm
+++ b/program/js/tiny_mce/themes/advanced/color_picker.htm
@@ -60,9 +60,7 @@
</div>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" id="insert" name="insert" value="{#apply}" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#apply}" />
<div id="preview"></div>
diff --git a/program/js/tiny_mce/themes/advanced/editor_template.js b/program/js/tiny_mce/themes/advanced/editor_template.js
index 628c793cc..804289082 100644
--- a/program/js/tiny_mce/themes/advanced/editor_template.js
+++ b/program/js/tiny_mce/themes/advanced/editor_template.js
@@ -1 +1 @@
-(function(e){var d=e.DOM,b=e.dom.Event,h=e.extend,f=e.each,a=e.util.Cookie,g,c=e.explode;e.ThemeManager.requireLangPack("advanced");e.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(j,k){var l=this,m,i,n;l.editor=j;l.url=k;l.onResolveName=new e.util.Dispatcher(this);l.settings=m=h({theme_advanced_path:true,theme_advanced_toolbar_location:"bottom",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",readonly:j.settings.readonly},j.settings);if(!m.font_size_style_values){m.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(e.is(m.theme_advanced_font_sizes,"string")){m.font_size_style_values=e.explode(m.font_size_style_values);m.font_size_classes=e.explode(m.font_size_classes||"");n={};j.settings.theme_advanced_font_sizes=m.theme_advanced_font_sizes;f(j.getParam("theme_advanced_font_sizes","","hash"),function(q,p){var o;if(p==q&&q>=1&&q<=7){p=q+" ("+l.sizes[q-1]+"pt)";if(j.settings.convert_fonts_to_spans){o=m.font_size_classes[q-1];q=m.font_size_style_values[q-1]||(l.sizes[q-1]+"pt")}}if(/^\s*\./.test(q)){o=q.replace(/\./g,"")}n[p]=o?{"class":o}:{fontSize:q}});m.theme_advanced_font_sizes=n}if((i=m.theme_advanced_path_location)&&i!="none"){m.theme_advanced_statusbar_location=m.theme_advanced_path_location}if(m.theme_advanced_statusbar_location=="none"){m.theme_advanced_statusbar_location=0}j.onInit.add(function(){j.onNodeChange.add(l._nodeChanged,l);if(j.settings.content_css!==false){j.dom.loadCSS(j.baseURI.toAbsolute("themes/advanced/skins/"+j.settings.skin+"/content.css"))}});j.onSetProgressState.add(function(q,o,r){var s,t=q.id,p;if(o){l.progressTimer=setTimeout(function(){s=q.getContainer();s=s.insertBefore(d.create("DIV",{style:"position:relative"}),s.firstChild);p=d.get(q.id+"_tbl");d.add(s,"div",{id:t+"_blocker","class":"mceBlocker",style:{width:p.clientWidth+2,height:p.clientHeight+2}});d.add(s,"div",{id:t+"_progress","class":"mceProgress",style:{left:p.clientWidth/2,top:p.clientHeight/2}})},r||0)}else{d.remove(t+"_blocker");d.remove(t+"_progress");clearTimeout(l.progressTimer)}});d.loadCSS(m.editor_css?j.documentBaseURI.toAbsolute(m.editor_css):k+"/skins/"+j.settings.skin+"/ui.css");if(m.skin_variant){d.loadCSS(k+"/skins/"+j.settings.skin+"/ui_"+m.skin_variant+".css")}},createControl:function(l,i){var j,k;if(k=i.createControl(l)){return k}switch(l){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((j=this.controls[l])){return i.createButton(l,{title:"advanced."+j[0],cmd:j[1],ui:j[2],value:j[3]})}},execCommand:function(k,j,l){var i=this["_"+k];if(i){i.call(this,j,l);return true}return false},_importClasses:function(j){var i=this.editor,k=i.controlManager.get("styleselect");if(k.getLength()==0){f(i.dom.getClasses(),function(l){k.add(l["class"],l["class"])})}},_createStyleSelect:function(m){var j=this,i=j.editor,k=i.controlManager,l=k.createListBox("styleselect",{title:"advanced.style_select",onselect:function(n){if(l.selectedValue===n){i.execCommand("mceSetStyleInfo",0,{command:"removeformat"});l.select();return false}else{i.execCommand("mceSetCSSClass",0,n)}}});if(l){f(i.getParam("theme_advanced_styles","","hash"),function(o,n){if(o){l.add(j.editor.translate(n),o)}});l.onPostRender.add(function(o,p){if(!l.NativeListBox){b.add(p.id+"_text","focus",j._importClasses,j);b.add(p.id+"_text","mousedown",j._importClasses,j);b.add(p.id+"_open","focus",j._importClasses,j);b.add(p.id+"_open","mousedown",j._importClasses,j)}else{b.add(p.id,"focus",j._importClasses,j)}})}return l},_createFontSelect:function(){var k,j=this,i=j.editor;k=i.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",cmd:"FontName"});if(k){f(i.getParam("theme_advanced_fonts",j.settings.theme_advanced_fonts,"hash"),function(m,l){k.add(i.translate(l),m,{style:m.indexOf("dings")==-1?"font-family:"+m:""})})}return k},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(i){if(i.fontSize){k.execCommand("FontSize",false,i.fontSize)}else{f(m.settings.theme_advanced_font_sizes,function(p,o){if(p["class"]){j.push(p["class"])}});k.editorCommands._applyInlineStyle("span",{"class":i["class"]},{check_classes:j})}}});if(n){f(m.settings.theme_advanced_font_sizes,function(o,i){var p=o.fontSize;if(p>=1&&p<=7){p=m.sizes[parseInt(p)-1]+"pt"}n.add(i,o,{style:"font-size:"+p,"class":"mceFontSize"+(l++)+(" "+(o["class"]||""))})})}return n},_createBlockFormats:function(){var k,i={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},j=this;k=j.editor.controlManager.createListBox("formatselect",{title:"advanced.block",cmd:"FormatBlock"});if(k){f(j.editor.getParam("theme_advanced_blockformats",j.settings.theme_advanced_blockformats,"hash"),function(m,l){k.add(j.editor.translate(l!=m?l:i[m]),m,{"class":"mce_formatPreview mce_"+m})})}return k},_createForeColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_text_colors){l.colors=i}if(k.theme_advanced_default_foreground_color){l.default_color=k.theme_advanced_default_foreground_color}l.title="advanced.forecolor_desc";l.cmd="ForeColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("forecolor",l);return m},_createBackColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_background_colors){l.colors=i}if(k.theme_advanced_default_background_color){l.default_color=k.theme_advanced_default_background_color}l.title="advanced.backcolor_desc";l.cmd="HiliteColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("backcolor",l);return m},renderUI:function(k){var m,l,q,v=this,r=v.editor,w=v.settings,u,j,i;m=j=d.create("span",{id:r.id+"_parent","class":"mceEditor "+r.settings.skin+"Skin"+(w.skin_variant?" "+r.settings.skin+"Skin"+v._ufirst(w.skin_variant):"")});if(!d.boxModel){m=d.add(m,"div",{"class":"mceOldBoxModel"})}m=u=d.add(m,"table",{id:r.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});m=q=d.add(m,"tbody");switch((w.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":l=v._rowLayout(w,q,k);break;case"customlayout":l=r.execCallback("theme_advanced_custom_layout",w,q,k,j);break;default:l=v._simpleLayout(w,q,k,j)}m=k.targetNode;i=d.stdMode?u.getElementsByTagName("tr"):u.rows;d.addClass(i[0],"mceFirst");d.addClass(i[i.length-1],"mceLast");f(d.select("tr",q),function(o){d.addClass(o.firstChild,"mceFirst");d.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(d.get(w.theme_advanced_toolbar_container)){d.get(w.theme_advanced_toolbar_container).appendChild(j)}else{d.insertAfter(j,m)}b.add(r.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){v._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return b.cancel(n)}});if(!r.getParam("accessibility_focus")){b.add(d.add(j,"a",{href:"#"},"<!-- IE -->"),"focus",function(){tinyMCE.get(r.id).focus()})}if(w.theme_advanced_toolbar_location=="external"){k.deltaHeight=0}v.deltaHeight=k.deltaHeight;k.targetNode=null;return{iframeContainer:l,editorContainer:r.id+"_parent",sizeContainer:u,deltaHeight:k.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:e.majorVersion+"."+e.minorVersion}},resizeBy:function(i,j){var k=d.get(this.editor.id+"_tbl");this.resizeTo(k.clientWidth+i,k.clientHeight+j)},resizeTo:function(i,l){var j=this.editor,k=j.settings,n=d.get(j.id+"_tbl"),o=d.get(j.id+"_ifr"),m;i=Math.max(k.theme_advanced_resizing_min_width||100,i);l=Math.max(k.theme_advanced_resizing_min_height||100,l);i=Math.min(k.theme_advanced_resizing_max_width||65535,i);l=Math.min(k.theme_advanced_resizing_max_height||65535,l);m=n.clientHeight-o.clientHeight;d.setStyle(o,"height",l-m);d.setStyles(n,{width:i,height:l})},destroy:function(){var i=this.editor.id;b.clear(i+"_resize");b.clear(i+"_path_row");b.clear(i+"_external_close")},_simpleLayout:function(y,r,k,i){var x=this,u=x.editor,v=y.theme_advanced_toolbar_location,m=y.theme_advanced_statusbar_location,l,j,q,w;if(y.readonly){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});return j}if(v=="top"){x._addToolbars(r,k)}if(v=="external"){l=w=d.create("div",{style:"position:relative"});l=d.add(l,"div",{id:u.id+"_external","class":"mceExternalToolbar"});d.add(l,"a",{id:u.id+"_external_close",href:"javascript:;","class":"mceExternalClose"});l=d.add(l,"table",{id:u.id+"_tblext",cellSpacing:0,cellPadding:0});q=d.add(l,"tbody");if(i.firstChild.className=="mceOldBoxModel"){i.firstChild.appendChild(w)}else{i.insertBefore(w,i.firstChild)}x._addToolbars(q,k);u.onMouseUp.add(function(){var o=d.get(u.id+"_external");d.show(o);d.hide(g);var n=b.add(u.id+"_external_close","click",function(){d.hide(u.id+"_external");b.remove(u.id+"_external_close","click",n)});d.show(o);d.setStyle(o,"top",0-d.getRect(u.id+"_tblext").h-1);d.hide(o);d.show(o);o.style.filter="";g=u.id+"_external";o=null})}if(m=="top"){x._addStatusBar(r,k)}if(!y.theme_advanced_toolbar_container){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"})}if(v=="bottom"){x._addToolbars(r,k)}if(m=="bottom"){x._addStatusBar(r,k)}return j},_rowLayout:function(w,m,k){var v=this,p=v.editor,u,x,i=p.controlManager,l,j,r,q;u=w.theme_advanced_containers_default_class||"";x=w.theme_advanced_containers_default_align||"center";f(c(w.theme_advanced_containers||""),function(s,o){var n=w["theme_advanced_container_"+s]||"";switch(n.toLowerCase()){case"mceeditor":l=d.add(m,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});break;case"mceelementpath":v._addStatusBar(m,k);break;default:q=(w["theme_advanced_container_"+s+"_align"]||x).toLowerCase();q="mce"+v._ufirst(q);l=d.add(d.add(m,"tr"),"td",{"class":"mceToolbar "+(w["theme_advanced_container_"+s+"_class"]||u)+" "+q||x});r=i.createToolbar("toolbar"+o);v._addControls(n,r);d.setHTML(l,r.renderHTML());k.deltaHeight-=w.theme_advanced_row_height}});return j},_addControls:function(j,i){var k=this,l=k.settings,m,n=k.editor.controlManager;if(l.theme_advanced_disable&&!k._disabled){m={};f(c(l.theme_advanced_disable),function(o){m[o]=1});k._disabled=m}else{m=k._disabled}f(c(j),function(p){var o;if(m&&m[p]){return}if(p=="tablecontrols"){f(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(q){q=k.createControl(q,n);if(q){i.add(q)}});return}o=k.createControl(p,n);if(o){i.add(o)}})},_addToolbars:function(w,k){var z=this,p,m,r=z.editor,A=z.settings,y,j=r.controlManager,u,l,q=[],x;x=A.theme_advanced_toolbar_align.toLowerCase();x="mce"+z._ufirst(x);l=d.add(d.add(w,"tr"),"td",{"class":"mceToolbar "+x});if(!r.getParam("accessibility_focus")){q.push(d.createHTML("a",{href:"#",onfocus:"tinyMCE.get('"+r.id+"').focus();"},"<!-- IE -->"))}q.push(d.createHTML("a",{href:"#",accesskey:"q",title:r.getLang("advanced.toolbar_focus")},"<!-- IE -->"));for(p=1;(y=A["theme_advanced_buttons"+p]);p++){m=j.createToolbar("toolbar"+p,{"class":"mceToolbarRow"+p});if(A["theme_advanced_buttons"+p+"_add"]){y+=","+A["theme_advanced_buttons"+p+"_add"]}if(A["theme_advanced_buttons"+p+"_add_before"]){y=A["theme_advanced_buttons"+p+"_add_before"]+","+y}z._addControls(y,m);q.push(m.renderHTML());k.deltaHeight-=A.theme_advanced_row_height}q.push(d.createHTML("a",{href:"#",accesskey:"z",title:r.getLang("advanced.toolbar_focus"),onfocus:"tinyMCE.getInstanceById('"+r.id+"').focus();"},"<!-- IE -->"));d.setHTML(l,q.join(""))},_addStatusBar:function(m,j){var k,v=this,p=v.editor,w=v.settings,i,q,u,l;k=d.add(m,"tr");k=l=d.add(k,"td",{"class":"mceStatusbar"});k=d.add(k,"div",{id:p.id+"_path_row"},w.theme_advanced_path?p.translate("advanced.path")+": ":"&#160;");d.add(k,"a",{href:"#",accesskey:"x"});if(w.theme_advanced_resizing){d.add(l,"a",{id:p.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize"});if(w.theme_advanced_resizing_use_cookie){p.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+p.id+"_size"),r=d.get(p.id+"_tbl");if(!n){return}if(w.theme_advanced_resize_horizontal){r.style.width=Math.max(10,n.cw)+"px"}r.style.height=Math.max(10,n.ch)+"px";d.get(p.id+"_ifr").style.height=Math.max(10,parseInt(n.ch)+v.deltaHeight)+"px"})}p.onPostRender.add(function(){b.add(p.id+"_resize","mousedown",function(x){var z,t,o,s,y,r;z=d.get(p.id+"_tbl");o=z.clientWidth;s=z.clientHeight;miw=w.theme_advanced_resizing_min_width||100;mih=w.theme_advanced_resizing_min_height||100;maw=w.theme_advanced_resizing_max_width||65535;mah=w.theme_advanced_resizing_max_height||65535;t=d.add(d.get(p.id+"_parent"),"div",{"class":"mcePlaceHolder"});d.setStyles(t,{width:o,height:s});d.hide(z);d.show(t);i={x:x.screenX,y:x.screenY,w:o,h:s,dx:null,dy:null};q=b.add(d.doc,"mousemove",function(B){var n,A;i.dx=B.screenX-i.x;i.dy=B.screenY-i.y;n=Math.max(miw,i.w+i.dx);A=Math.max(mih,i.h+i.dy);n=Math.min(maw,n);A=Math.min(mah,A);if(w.theme_advanced_resize_horizontal){t.style.width=n+"px"}t.style.height=A+"px";return b.cancel(B)});u=b.add(d.doc,"mouseup",function(n){var A;b.remove(d.doc,"mousemove",q);b.remove(d.doc,"mouseup",u);z.style.display="";d.remove(t);if(i.dx===null){return}A=d.get(p.id+"_ifr");if(w.theme_advanced_resize_horizontal){z.style.width=Math.max(10,i.w+i.dx)+"px"}z.style.height=Math.max(10,i.h+i.dy)+"px";A.style.height=Math.max(10,A.clientHeight+i.dy)+"px";if(w.theme_advanced_resizing_use_cookie){a.setHash("TinyMCE_"+p.id+"_size",{cw:i.w+i.dx,ch:i.h+i.dy})}});return b.cancel(x)})})}j.deltaHeight-=21;k=m=null},_nodeChanged:function(l,u,k,q){var y=this,i,r=0,x,m,z=y.settings,w,j,o;if(z.readonly){return}e.each(y.stateControls,function(n){u.setActive(n,l.queryCommandState(y.controls[n][1]))});u.setActive("visualaid",l.hasVisual);u.setDisabled("undo",!l.undoManager.hasUndo()&&!l.typing);u.setDisabled("redo",!l.undoManager.hasRedo());u.setDisabled("outdent",!l.queryCommandState("Outdent"));i=d.getParent(k,"A");if(m=u.get("link")){if(!i||!i.name){m.setDisabled(!i&&q);m.setActive(!!i)}}if(m=u.get("unlink")){m.setDisabled(!i&&q);m.setActive(!!i&&!i.name)}if(m=u.get("anchor")){m.setActive(!!i&&i.name);if(e.isWebKit){i=d.getParent(k,"IMG");m.setActive(!!i&&d.getAttrib(i,"mce_name")=="a")}}i=d.getParent(k,"IMG");if(m=u.get("image")){m.setActive(!!i&&k.className.indexOf("mceItem")==-1)}if(m=u.get("styleselect")){if(k.className){y._importClasses();m.select(k.className)}else{m.select()}}if(m=u.get("formatselect")){i=d.getParent(k,d.isBlock);if(i){m.select(i.nodeName.toLowerCase())}}if(l.settings.convert_fonts_to_spans){l.dom.getParent(k,function(p){if(p.nodeName==="SPAN"){if(!w&&p.className){w=p.className}if(!j&&p.style.fontSize){j=p.style.fontSize}if(!o&&p.style.fontFamily){o=p.style.fontFamily.replace(/[\"\']+/g,"").replace(/^([^,]+).*/,"$1").toLowerCase()}}return false});if(m=u.get("fontselect")){m.select(function(n){return n.replace(/^([^,]+).*/,"$1").toLowerCase()==o})}if(m=u.get("fontsizeselect")){m.select(function(n){if(n.fontSize&&n.fontSize===j){return true}if(n["class"]&&n["class"]===w){return true}})}}else{if(m=u.get("fontselect")){m.select(l.queryCommandValue("FontName"))}if(m=u.get("fontsizeselect")){x=l.queryCommandValue("FontSize");m.select(function(n){return n.fontSize==x})}}if(z.theme_advanced_path&&z.theme_advanced_statusbar_location){i=d.get(l.id+"_path")||d.add(l.id+"_path_row","span",{id:l.id+"_path"});d.setHTML(i,"");l.dom.getParent(k,function(A){var p=A.nodeName.toLowerCase(),s,v,t="";if(A.nodeType!=1||A.nodeName==="BR"||(d.hasClass(A,"mceItemHidden")||d.hasClass(A,"mceItemRemoved"))){return}if(x=d.getAttrib(A,"mce_name")){p=x}if(e.isIE&&A.scopeName!=="HTML"){p=A.scopeName+":"+p}p=p.replace(/mce\:/g,"");switch(p){case"b":p="strong";break;case"i":p="em";break;case"img":if(x=d.getAttrib(A,"src")){t+="src: "+x+" "}break;case"a":if(x=d.getAttrib(A,"name")){t+="name: "+x+" ";p+="#"+x}if(x=d.getAttrib(A,"href")){t+="href: "+x+" "}break;case"font":if(z.convert_fonts_to_spans){p="span"}if(x=d.getAttrib(A,"face")){t+="font: "+x+" "}if(x=d.getAttrib(A,"size")){t+="size: "+x+" "}if(x=d.getAttrib(A,"color")){t+="color: "+x+" "}break;case"span":if(x=d.getAttrib(A,"style")){t+="style: "+x+" "}break}if(x=d.getAttrib(A,"id")){t+="id: "+x+" "}if(x=A.className){x=x.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g,"");if(x&&x.indexOf("mceItem")==-1){t+="class: "+x+" ";if(d.isBlock(A)||p=="img"||p=="span"){p+="."+x}}}p=p.replace(/(html:)/g,"");p={name:p,node:A,title:t};y.onResolveName.dispatch(y,p);t=p.title;p=p.name;v=d.create("a",{href:"javascript:;",onmousedown:"return false;",title:t,"class":"mcePath_"+(r++)},p);if(i.hasChildNodes()){i.insertBefore(d.doc.createTextNode(" \u00bb "),i.firstChild);i.insertBefore(v,i.firstChild)}else{i.appendChild(v)}},l.getBody())}},_sel:function(i){this.editor.execCommand("mceSelectNodeDepth",false,i)},_mceInsertAnchor:function(k,j){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/anchor.htm",width:320+parseInt(i.getLang("advanced.anchor_delta_width",0)),height:90+parseInt(i.getLang("advanced.anchor_delta_height",0)),inline:true},{theme_url:this.url})},_mceCharMap:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/charmap.htm",width:550+parseInt(i.getLang("advanced.charmap_delta_width",0)),height:250+parseInt(i.getLang("advanced.charmap_delta_height",0)),inline:true},{theme_url:this.url})},_mceHelp:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceColorPicker:function(k,j){var i=this.editor;j=j||{};i.windowManager.open({url:e.baseURL+"/themes/advanced/color_picker.htm",width:375+parseInt(i.getLang("advanced.colorpicker_delta_width",0)),height:250+parseInt(i.getLang("advanced.colorpicker_delta_height",0)),close_previous:false,inline:true},{input_color:j.color,func:j.func,theme_url:this.url})},_mceCodeEditor:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/source_editor.htm",width:parseInt(i.getParam("theme_advanced_source_editor_width",720)),height:parseInt(i.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url})},_mceImage:function(j,k){var i=this.editor;if(i.dom.getAttrib(i.selection.getNode(),"class").indexOf("mceItem")!=-1){return}i.windowManager.open({url:e.baseURL+"/themes/advanced/image.htm",width:355+parseInt(i.getLang("advanced.image_delta_width",0)),height:275+parseInt(i.getLang("advanced.image_delta_height",0)),inline:true},{theme_url:this.url})},_mceLink:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/link.htm",width:310+parseInt(i.getLang("advanced.link_delta_width",0)),height:200+parseInt(i.getLang("advanced.link_delta_height",0)),inline:true},{theme_url:this.url})},_mceNewDocument:function(){var i=this.editor;i.windowManager.confirm("advanced.newdocument",function(j){if(j){i.execCommand("mceSetContent",false,"")}})},_mceForeColor:function(){var i=this;this._mceColorPicker(0,{color:i.fgColor,func:function(j){i.fgColor=j;i.editor.execCommand("ForeColor",false,j)}})},_mceBackColor:function(){var i=this;this._mceColorPicker(0,{color:i.bgColor,func:function(j){i.bgColor=j;i.editor.execCommand("HiliteColor",false,j)}})},_ufirst:function(i){return i.substring(0,1).toUpperCase()+i.substring(1)}});e.ThemeManager.add("advanced",e.themes.AdvancedTheme)}(tinymce)); \ No newline at end of file
+(function(e){var d=e.DOM,b=e.dom.Event,h=e.extend,f=e.each,a=e.util.Cookie,g,c=e.explode;e.ThemeManager.requireLangPack("advanced");e.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(j,k){var l=this,m,i,n;l.editor=j;l.url=k;l.onResolveName=new e.util.Dispatcher(this);l.settings=m=h({theme_advanced_path:true,theme_advanced_toolbar_location:"bottom",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",readonly:j.settings.readonly},j.settings);if(!m.font_size_style_values){m.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(e.is(m.theme_advanced_font_sizes,"string")){m.font_size_style_values=e.explode(m.font_size_style_values);m.font_size_classes=e.explode(m.font_size_classes||"");n={};j.settings.theme_advanced_font_sizes=m.theme_advanced_font_sizes;f(j.getParam("theme_advanced_font_sizes","","hash"),function(q,p){var o;if(p==q&&q>=1&&q<=7){p=q+" ("+l.sizes[q-1]+"pt)";o=m.font_size_classes[q-1];q=m.font_size_style_values[q-1]||(l.sizes[q-1]+"pt")}if(/^\s*\./.test(q)){o=q.replace(/\./g,"")}n[p]=o?{"class":o}:{fontSize:q}});m.theme_advanced_font_sizes=n}if((i=m.theme_advanced_path_location)&&i!="none"){m.theme_advanced_statusbar_location=m.theme_advanced_path_location}if(m.theme_advanced_statusbar_location=="none"){m.theme_advanced_statusbar_location=0}j.onInit.add(function(){if(!j.settings.readonly){j.onNodeChange.add(l._nodeChanged,l)}if(j.settings.content_css!==false){j.dom.loadCSS(j.baseURI.toAbsolute("themes/advanced/skins/"+j.settings.skin+"/content.css"))}});j.onSetProgressState.add(function(q,o,r){var s,t=q.id,p;if(o){l.progressTimer=setTimeout(function(){s=q.getContainer();s=s.insertBefore(d.create("DIV",{style:"position:relative"}),s.firstChild);p=d.get(q.id+"_tbl");d.add(s,"div",{id:t+"_blocker","class":"mceBlocker",style:{width:p.clientWidth+2,height:p.clientHeight+2}});d.add(s,"div",{id:t+"_progress","class":"mceProgress",style:{left:p.clientWidth/2,top:p.clientHeight/2}})},r||0)}else{d.remove(t+"_blocker");d.remove(t+"_progress");clearTimeout(l.progressTimer)}});d.loadCSS(m.editor_css?j.documentBaseURI.toAbsolute(m.editor_css):k+"/skins/"+j.settings.skin+"/ui.css");if(m.skin_variant){d.loadCSS(k+"/skins/"+j.settings.skin+"/ui_"+m.skin_variant+".css")}},createControl:function(l,i){var j,k;if(k=i.createControl(l)){return k}switch(l){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((j=this.controls[l])){return i.createButton(l,{title:"advanced."+j[0],cmd:j[1],ui:j[2],value:j[3]})}},execCommand:function(k,j,l){var i=this["_"+k];if(i){i.call(this,j,l);return true}return false},_importClasses:function(k){var i=this.editor,j=i.controlManager.get("styleselect");if(j.getLength()==0){f(i.dom.getClasses(),function(n,l){var m="style_"+l;i.formatter.register(m,{inline:"span",classes:n["class"],selector:"*"});j.add(n["class"],m)})}},_createStyleSelect:function(m){var k=this,i=k.editor,j=i.controlManager,l;l=j.createListBox("styleselect",{title:"advanced.style_select",onselect:function(n){i.execCommand("mceToggleFormat",false,n);return false}});i.onInit.add(function(){var o=0,n=i.getParam("style_formats");if(n){f(n,function(p){var q,r=0;f(p,function(){r++});if(r>1){q=p.name=p.name||"style_"+(o++);i.formatter.register(q,p);l.add(p.title,q)}else{l.add(p.title)}})}else{f(i.getParam("theme_advanced_styles","","hash"),function(r,q){var p;if(r){p="style_"+(o++);i.formatter.register(p,{inline:"span",classes:r});l.add(k.editor.translate(q),p)}})}});if(l.getLength()==0){l.onPostRender.add(function(o,p){if(!l.NativeListBox){b.add(p.id+"_text","focus",k._importClasses,k);b.add(p.id+"_text","mousedown",k._importClasses,k);b.add(p.id+"_open","focus",k._importClasses,k);b.add(p.id+"_open","mousedown",k._importClasses,k)}else{b.add(p.id,"focus",k._importClasses,k)}})}return l},_createFontSelect:function(){var k,j=this,i=j.editor;k=i.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",onselect:function(l){i.execCommand("FontName",false,l);return false}});if(k){f(i.getParam("theme_advanced_fonts",j.settings.theme_advanced_fonts,"hash"),function(m,l){k.add(i.translate(l),m,{style:m.indexOf("dings")==-1?"font-family:"+m:""})})}return k},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(i){if(i.fontSize){k.execCommand("FontSize",false,i.fontSize)}else{f(m.settings.theme_advanced_font_sizes,function(p,o){if(p["class"]){j.push(p["class"])}});k.editorCommands._applyInlineStyle("span",{"class":i["class"]},{check_classes:j})}return false}});if(n){f(m.settings.theme_advanced_font_sizes,function(o,i){var p=o.fontSize;if(p>=1&&p<=7){p=m.sizes[parseInt(p)-1]+"pt"}n.add(i,o,{style:"font-size:"+p,"class":"mceFontSize"+(l++)+(" "+(o["class"]||""))})})}return n},_createBlockFormats:function(){var k,i={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},j=this;k=j.editor.controlManager.createListBox("formatselect",{title:"advanced.block",cmd:"FormatBlock"});if(k){f(j.editor.getParam("theme_advanced_blockformats",j.settings.theme_advanced_blockformats,"hash"),function(m,l){k.add(j.editor.translate(l!=m?l:i[m]),m,{"class":"mce_formatPreview mce_"+m})})}return k},_createForeColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_text_colors){l.colors=i}if(k.theme_advanced_default_foreground_color){l.default_color=k.theme_advanced_default_foreground_color}l.title="advanced.forecolor_desc";l.cmd="ForeColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("forecolor",l);return m},_createBackColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_background_colors){l.colors=i}if(k.theme_advanced_default_background_color){l.default_color=k.theme_advanced_default_background_color}l.title="advanced.backcolor_desc";l.cmd="HiliteColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("backcolor",l);return m},renderUI:function(k){var m,l,q,v=this,r=v.editor,w=v.settings,u,j,i;m=j=d.create("span",{id:r.id+"_parent","class":"mceEditor "+r.settings.skin+"Skin"+(w.skin_variant?" "+r.settings.skin+"Skin"+v._ufirst(w.skin_variant):"")});if(!d.boxModel){m=d.add(m,"div",{"class":"mceOldBoxModel"})}m=u=d.add(m,"table",{id:r.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});m=q=d.add(m,"tbody");switch((w.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":l=v._rowLayout(w,q,k);break;case"customlayout":l=r.execCallback("theme_advanced_custom_layout",w,q,k,j);break;default:l=v._simpleLayout(w,q,k,j)}m=k.targetNode;i=d.stdMode?u.getElementsByTagName("tr"):u.rows;d.addClass(i[0],"mceFirst");d.addClass(i[i.length-1],"mceLast");f(d.select("tr",q),function(o){d.addClass(o.firstChild,"mceFirst");d.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(d.get(w.theme_advanced_toolbar_container)){d.get(w.theme_advanced_toolbar_container).appendChild(j)}else{d.insertAfter(j,m)}b.add(r.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){v._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return b.cancel(n)}});if(!r.getParam("accessibility_focus")){b.add(d.add(j,"a",{href:"#"},"<!-- IE -->"),"focus",function(){tinyMCE.get(r.id).focus()})}if(w.theme_advanced_toolbar_location=="external"){k.deltaHeight=0}v.deltaHeight=k.deltaHeight;k.targetNode=null;return{iframeContainer:l,editorContainer:r.id+"_parent",sizeContainer:u,deltaHeight:k.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:e.majorVersion+"."+e.minorVersion}},resizeBy:function(i,j){var k=d.get(this.editor.id+"_tbl");this.resizeTo(k.clientWidth+i,k.clientHeight+j)},resizeTo:function(i,l){var j=this.editor,k=j.settings,m=d.get(j.id+"_tbl"),n=d.get(j.id+"_ifr");i=Math.max(k.theme_advanced_resizing_min_width||100,i);l=Math.max(k.theme_advanced_resizing_min_height||100,l);i=Math.min(k.theme_advanced_resizing_max_width||65535,i);l=Math.min(k.theme_advanced_resizing_max_height||65535,l);d.setStyles(m,{width:"",height:""});d.setStyles(n,{width:i,height:l})},destroy:function(){var i=this.editor.id;b.clear(i+"_resize");b.clear(i+"_path_row");b.clear(i+"_external_close")},_simpleLayout:function(y,r,k,i){var x=this,u=x.editor,v=y.theme_advanced_toolbar_location,m=y.theme_advanced_statusbar_location,l,j,q,w;if(y.readonly){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});return j}if(v=="top"){x._addToolbars(r,k)}if(v=="external"){l=w=d.create("div",{style:"position:relative"});l=d.add(l,"div",{id:u.id+"_external","class":"mceExternalToolbar"});d.add(l,"a",{id:u.id+"_external_close",href:"javascript:;","class":"mceExternalClose"});l=d.add(l,"table",{id:u.id+"_tblext",cellSpacing:0,cellPadding:0});q=d.add(l,"tbody");if(i.firstChild.className=="mceOldBoxModel"){i.firstChild.appendChild(w)}else{i.insertBefore(w,i.firstChild)}x._addToolbars(q,k);u.onMouseUp.add(function(){var o=d.get(u.id+"_external");d.show(o);d.hide(g);var n=b.add(u.id+"_external_close","click",function(){d.hide(u.id+"_external");b.remove(u.id+"_external_close","click",n)});d.show(o);d.setStyle(o,"top",0-d.getRect(u.id+"_tblext").h-1);d.hide(o);d.show(o);o.style.filter="";g=u.id+"_external";o=null})}if(m=="top"){x._addStatusBar(r,k)}if(!y.theme_advanced_toolbar_container){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"})}if(v=="bottom"){x._addToolbars(r,k)}if(m=="bottom"){x._addStatusBar(r,k)}return j},_rowLayout:function(w,m,k){var v=this,p=v.editor,u,x,i=p.controlManager,l,j,r,q;u=w.theme_advanced_containers_default_class||"";x=w.theme_advanced_containers_default_align||"center";f(c(w.theme_advanced_containers||""),function(s,o){var n=w["theme_advanced_container_"+s]||"";switch(n.toLowerCase()){case"mceeditor":l=d.add(m,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});break;case"mceelementpath":v._addStatusBar(m,k);break;default:q=(w["theme_advanced_container_"+s+"_align"]||x).toLowerCase();q="mce"+v._ufirst(q);l=d.add(d.add(m,"tr"),"td",{"class":"mceToolbar "+(w["theme_advanced_container_"+s+"_class"]||u)+" "+q||x});r=i.createToolbar("toolbar"+o);v._addControls(n,r);d.setHTML(l,r.renderHTML());k.deltaHeight-=w.theme_advanced_row_height}});return j},_addControls:function(j,i){var k=this,l=k.settings,m,n=k.editor.controlManager;if(l.theme_advanced_disable&&!k._disabled){m={};f(c(l.theme_advanced_disable),function(o){m[o]=1});k._disabled=m}else{m=k._disabled}f(c(j),function(p){var o;if(m&&m[p]){return}if(p=="tablecontrols"){f(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(q){q=k.createControl(q,n);if(q){i.add(q)}});return}o=k.createControl(p,n);if(o){i.add(o)}})},_addToolbars:function(w,k){var z=this,p,m,r=z.editor,A=z.settings,y,j=r.controlManager,u,l,q=[],x;x=A.theme_advanced_toolbar_align.toLowerCase();x="mce"+z._ufirst(x);l=d.add(d.add(w,"tr"),"td",{"class":"mceToolbar "+x});if(!r.getParam("accessibility_focus")){q.push(d.createHTML("a",{href:"#",onfocus:"tinyMCE.get('"+r.id+"').focus();"},"<!-- IE -->"))}q.push(d.createHTML("a",{href:"#",accesskey:"q",title:r.getLang("advanced.toolbar_focus")},"<!-- IE -->"));for(p=1;(y=A["theme_advanced_buttons"+p]);p++){m=j.createToolbar("toolbar"+p,{"class":"mceToolbarRow"+p});if(A["theme_advanced_buttons"+p+"_add"]){y+=","+A["theme_advanced_buttons"+p+"_add"]}if(A["theme_advanced_buttons"+p+"_add_before"]){y=A["theme_advanced_buttons"+p+"_add_before"]+","+y}z._addControls(y,m);q.push(m.renderHTML());k.deltaHeight-=A.theme_advanced_row_height}q.push(d.createHTML("a",{href:"#",accesskey:"z",title:r.getLang("advanced.toolbar_focus"),onfocus:"tinyMCE.getInstanceById('"+r.id+"').focus();"},"<!-- IE -->"));d.setHTML(l,q.join(""))},_addStatusBar:function(m,j){var k,v=this,p=v.editor,w=v.settings,i,q,u,l;k=d.add(m,"tr");k=l=d.add(k,"td",{"class":"mceStatusbar"});k=d.add(k,"div",{id:p.id+"_path_row"},w.theme_advanced_path?p.translate("advanced.path")+": ":"&#160;");d.add(k,"a",{href:"#",accesskey:"x"});if(w.theme_advanced_resizing){d.add(l,"a",{id:p.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize"});if(w.theme_advanced_resizing_use_cookie){p.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+p.id+"_size"),r=d.get(p.id+"_tbl");if(!n){return}v.resizeTo(n.cw,n.ch)})}p.onPostRender.add(function(){b.add(p.id+"_resize","mousedown",function(A){var r,o,D,z,x,y,C,n,B,s;function t(E){n=y+(E.screenX-z);B=C+(E.screenY-x);v.resizeTo(n,B)}A.preventDefault();z=A.screenX;x=A.screenY;s=d.get(v.editor.id+"_ifr");y=n=s.clientWidth;C=B=s.clientHeight;r=b.add(d.doc,"mousemove",t);o=b.add(p.getDoc(),"mousemove",t);D=b.add(d.doc,"mouseup",function(E){b.remove(d.doc,"mousemove",r);b.remove(p.getDoc(),"mousemove",o);b.remove(d.doc,"mouseup",D);if(w.theme_advanced_resizing_use_cookie){a.setHash("TinyMCE_"+p.id+"_size",{cw:n,ch:B})}})})})}j.deltaHeight-=21;k=m=null},_nodeChanged:function(o,x,l,u,j){var A=this,i,w=0,z,q,B=A.settings,y,k,r;e.each(A.stateControls,function(n){x.setActive(n,o.queryCommandState(A.controls[n][1]))});function m(p){var s,n=j.parents,t=p;if(typeof(p)=="string"){t=function(v){return v.nodeName==p}}for(s=0;s<n.length;s++){if(t(n[s])){return n[s]}}}x.setActive("visualaid",o.hasVisual);x.setDisabled("undo",!o.undoManager.hasUndo()&&!o.typing);x.setDisabled("redo",!o.undoManager.hasRedo());x.setDisabled("outdent",!o.queryCommandState("Outdent"));i=m("A");if(q=x.get("link")){if(!i||!i.name){q.setDisabled(!i&&u);q.setActive(!!i)}}if(q=x.get("unlink")){q.setDisabled(!i&&u);q.setActive(!!i&&!i.name)}if(q=x.get("anchor")){q.setActive(!!i&&i.name)}i=m("IMG");if(q=x.get("image")){q.setActive(!!i&&l.className.indexOf("mceItem")==-1)}if(q=x.get("styleselect")){A._importClasses();q.select(function(n){return !!o.formatter.match(n)})}if(q=x.get("formatselect")){i=m(d.isBlock);if(i){q.select(i.nodeName.toLowerCase())}}m(function(p){if(p.nodeName==="SPAN"){if(!y&&p.className){y=p.className}if(!k&&p.style.fontSize){k=p.style.fontSize}if(!r&&p.style.fontFamily){r=p.style.fontFamily.replace(/[\"\']+/g,"").replace(/^([^,]+).*/,"$1").toLowerCase()}}return false});if(q=x.get("fontselect")){q.select(function(n){return n.replace(/^([^,]+).*/,"$1").toLowerCase()==r})}if(q=x.get("fontsizeselect")){if(B.theme_advanced_runtime_fontsize&&!k&&!y){k=o.dom.getStyle(l,"fontSize",true)}q.select(function(n){if(n.fontSize&&n.fontSize===k){return true}if(n["class"]&&n["class"]===y){return true}})}if(B.theme_advanced_path&&B.theme_advanced_statusbar_location){i=d.get(o.id+"_path")||d.add(o.id+"_path_row","span",{id:o.id+"_path"});d.setHTML(i,"");m(function(C){var p=C.nodeName.toLowerCase(),s,v,t="";if(C.nodeType!=1||C.nodeName==="BR"||(d.hasClass(C,"mceItemHidden")||d.hasClass(C,"mceItemRemoved"))){return}if(z=d.getAttrib(C,"mce_name")){p=z}if(e.isIE&&C.scopeName!=="HTML"){p=C.scopeName+":"+p}p=p.replace(/mce\:/g,"");switch(p){case"b":p="strong";break;case"i":p="em";break;case"img":if(z=d.getAttrib(C,"src")){t+="src: "+z+" "}break;case"a":if(z=d.getAttrib(C,"name")){t+="name: "+z+" ";p+="#"+z}if(z=d.getAttrib(C,"href")){t+="href: "+z+" "}break;case"font":if(z=d.getAttrib(C,"face")){t+="font: "+z+" "}if(z=d.getAttrib(C,"size")){t+="size: "+z+" "}if(z=d.getAttrib(C,"color")){t+="color: "+z+" "}break;case"span":if(z=d.getAttrib(C,"style")){t+="style: "+z+" "}break}if(z=d.getAttrib(C,"id")){t+="id: "+z+" "}if(z=C.className){z=z.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g,"");if(z){t+="class: "+z+" ";if(d.isBlock(C)||p=="img"||p=="span"){p+="."+z}}}p=p.replace(/(html:)/g,"");p={name:p,node:C,title:t};A.onResolveName.dispatch(A,p);t=p.title;p=p.name;v=d.create("a",{href:"javascript:;",onmousedown:"return false;",title:t,"class":"mcePath_"+(w++)},p);if(i.hasChildNodes()){i.insertBefore(d.doc.createTextNode(" \u00bb "),i.firstChild);i.insertBefore(v,i.firstChild)}else{i.appendChild(v)}},o.getBody())}},_sel:function(i){this.editor.execCommand("mceSelectNodeDepth",false,i)},_mceInsertAnchor:function(k,j){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/anchor.htm",width:320+parseInt(i.getLang("advanced.anchor_delta_width",0)),height:90+parseInt(i.getLang("advanced.anchor_delta_height",0)),inline:true},{theme_url:this.url})},_mceCharMap:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/charmap.htm",width:550+parseInt(i.getLang("advanced.charmap_delta_width",0)),height:250+parseInt(i.getLang("advanced.charmap_delta_height",0)),inline:true},{theme_url:this.url})},_mceHelp:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceColorPicker:function(k,j){var i=this.editor;j=j||{};i.windowManager.open({url:e.baseURL+"/themes/advanced/color_picker.htm",width:375+parseInt(i.getLang("advanced.colorpicker_delta_width",0)),height:250+parseInt(i.getLang("advanced.colorpicker_delta_height",0)),close_previous:false,inline:true},{input_color:j.color,func:j.func,theme_url:this.url})},_mceCodeEditor:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/source_editor.htm",width:parseInt(i.getParam("theme_advanced_source_editor_width",720)),height:parseInt(i.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url})},_mceImage:function(j,k){var i=this.editor;if(i.dom.getAttrib(i.selection.getNode(),"class").indexOf("mceItem")!=-1){return}i.windowManager.open({url:e.baseURL+"/themes/advanced/image.htm",width:355+parseInt(i.getLang("advanced.image_delta_width",0)),height:275+parseInt(i.getLang("advanced.image_delta_height",0)),inline:true},{theme_url:this.url})},_mceLink:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/link.htm",width:310+parseInt(i.getLang("advanced.link_delta_width",0)),height:200+parseInt(i.getLang("advanced.link_delta_height",0)),inline:true},{theme_url:this.url})},_mceNewDocument:function(){var i=this.editor;i.windowManager.confirm("advanced.newdocument",function(j){if(j){i.execCommand("mceSetContent",false,"")}})},_mceForeColor:function(){var i=this;this._mceColorPicker(0,{color:i.fgColor,func:function(j){i.fgColor=j;i.editor.execCommand("ForeColor",false,j)}})},_mceBackColor:function(){var i=this;this._mceColorPicker(0,{color:i.bgColor,func:function(j){i.bgColor=j;i.editor.execCommand("HiliteColor",false,j)}})},_ufirst:function(i){return i.substring(0,1).toUpperCase()+i.substring(1)}});e.ThemeManager.add("advanced",e.themes.AdvancedTheme)}(tinymce)); \ No newline at end of file
diff --git a/program/js/tiny_mce/themes/advanced/editor_template_src.js b/program/js/tiny_mce/themes/advanced/editor_template_src.js
index 21eb259a2..0cd79c0c8 100644
--- a/program/js/tiny_mce/themes/advanced/editor_template_src.js
+++ b/program/js/tiny_mce/themes/advanced/editor_template_src.js
@@ -1,8 +1,11 @@
/**
- * $Id: editor_template_src.js 1045 2009-03-04 20:03:18Z spocke $
+ * editor_template_src.js
*
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
(function(tinymce) {
@@ -97,11 +100,8 @@
if (k == v && v >= 1 && v <= 7) {
k = v + ' (' + t.sizes[v - 1] + 'pt)';
-
- if (ed.settings.convert_fonts_to_spans) {
- cl = s.font_size_classes[v - 1];
- v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt');
- }
+ cl = s.font_size_classes[v - 1];
+ v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt');
}
if (/^\s*\./.test(v))
@@ -121,7 +121,8 @@
// Init editor
ed.onInit.add(function() {
- ed.onNodeChange.add(t._nodeChanged, t);
+ if (!ed.settings.readonly)
+ ed.onNodeChange.add(t._nodeChanged, t);
if (ed.settings.content_css !== false)
ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/" + ed.settings.skin + "/content.css"));
@@ -194,36 +195,75 @@
},
_importClasses : function(e) {
- var ed = this.editor, c = ed.controlManager.get('styleselect');
+ var ed = this.editor, ctrl = ed.controlManager.get('styleselect');
- if (c.getLength() == 0) {
- each(ed.dom.getClasses(), function(o) {
- c.add(o['class'], o['class']);
+ if (ctrl.getLength() == 0) {
+ each(ed.dom.getClasses(), function(o, idx) {
+ var name = 'style_' + idx;
+
+ ed.formatter.register(name, {
+ inline : 'span',
+ classes : o['class'],
+ selector : '*'
+ });
+
+ ctrl.add(o['class'], name);
});
}
},
_createStyleSelect : function(n) {
- var t = this, ed = t.editor, cf = ed.controlManager, c = cf.createListBox('styleselect', {
+ var t = this, ed = t.editor, ctrlMan = ed.controlManager, ctrl;
+
+ // Setup style select box
+ ctrl = ctrlMan.createListBox('styleselect', {
title : 'advanced.style_select',
- onselect : function(v) {
- if (c.selectedValue === v) {
- ed.execCommand('mceSetStyleInfo', 0, {command : 'removeformat'});
- c.select();
- return false;
- } else
- ed.execCommand('mceSetCSSClass', 0, v);
+ onselect : function(name) {
+ ed.execCommand('mceToggleFormat', false, name);
+
+ return false; // No auto select
}
});
- if (c) {
- each(ed.getParam('theme_advanced_styles', '', 'hash'), function(v, k) {
- if (v)
- c.add(t.editor.translate(k), v);
- });
+ // Handle specified format
+ ed.onInit.add(function() {
+ var counter = 0, formats = ed.getParam('style_formats');
+
+ if (formats) {
+ each(formats, function(fmt) {
+ var name, keys = 0;
+
+ each(fmt, function() {keys++;});
+
+ if (keys > 1) {
+ name = fmt.name = fmt.name || 'style_' + (counter++);
+ ed.formatter.register(name, fmt);
+ ctrl.add(fmt.title, name);
+ } else
+ ctrl.add(fmt.title);
+ });
+ } else {
+ each(ed.getParam('theme_advanced_styles', '', 'hash'), function(val, key) {
+ var name;
- c.onPostRender.add(function(ed, n) {
- if (!c.NativeListBox) {
+ if (val) {
+ name = 'style_' + (counter++);
+
+ ed.formatter.register(name, {
+ inline : 'span',
+ classes : val
+ });
+
+ ctrl.add(t.editor.translate(key), name);
+ }
+ });
+ }
+ });
+
+ // Auto import classes if the ctrl box is empty
+ if (ctrl.getLength() == 0) {
+ ctrl.onPostRender.add(function(ed, n) {
+ if (!ctrl.NativeListBox) {
Event.add(n.id + '_text', 'focus', t._importClasses, t);
Event.add(n.id + '_text', 'mousedown', t._importClasses, t);
Event.add(n.id + '_open', 'focus', t._importClasses, t);
@@ -233,13 +273,20 @@
});
}
- return c;
+ return ctrl;
},
_createFontSelect : function() {
var c, t = this, ed = t.editor;
- c = ed.controlManager.createListBox('fontselect', {title : 'advanced.fontdefault', cmd : 'FontName'});
+ c = ed.controlManager.createListBox('fontselect', {
+ title : 'advanced.fontdefault',
+ onselect : function(v) {
+ ed.execCommand('FontName', false, v);
+ return false; // No auto select
+ }
+ });
+
if (c) {
each(ed.getParam('theme_advanced_fonts', t.settings.theme_advanced_fonts, 'hash'), function(v, k) {
c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''});
@@ -263,6 +310,8 @@
ed.editorCommands._applyInlineStyle('span', {'class' : v['class']}, {check_classes : cl});
}
+
+ return false; // No auto select
}});
if (c) {
@@ -473,7 +522,7 @@
},
resizeTo : function(w, h) {
- var ed = this.editor, s = ed.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr'), dh;
+ var ed = this.editor, s = ed.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr');
// Boundery fix box
w = Math.max(s.theme_advanced_resizing_min_width || 100, w);
@@ -481,12 +530,9 @@
w = Math.min(s.theme_advanced_resizing_max_width || 0xFFFF, w);
h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h);
- // Calc difference between iframe and container
- dh = e.clientHeight - ifr.clientHeight;
-
// Resize iframe and container
- DOM.setStyle(ifr, 'height', h - dh);
- DOM.setStyles(e, {width : w, height : h});
+ DOM.setStyles(e, {width : '', height : ''});
+ DOM.setStyles(ifr, {width : w, height : h});
},
destroy : function() {
@@ -700,99 +746,48 @@
if (!o)
return;
- if (s.theme_advanced_resize_horizontal)
- c.style.width = Math.max(10, o.cw) + 'px';
-
- c.style.height = Math.max(10, o.ch) + 'px';
- DOM.get(ed.id + '_ifr').style.height = Math.max(10, parseInt(o.ch) + t.deltaHeight) + 'px';
+ t.resizeTo(o.cw, o.ch);
});
}
ed.onPostRender.add(function() {
Event.add(ed.id + '_resize', 'mousedown', function(e) {
- var c, p, w, h, n, pa;
-
- // Measure container
- c = DOM.get(ed.id + '_tbl');
- w = c.clientWidth;
- h = c.clientHeight;
-
- miw = s.theme_advanced_resizing_min_width || 100;
- mih = s.theme_advanced_resizing_min_height || 100;
- maw = s.theme_advanced_resizing_max_width || 0xFFFF;
- mah = s.theme_advanced_resizing_max_height || 0xFFFF;
-
- // Setup placeholder
- p = DOM.add(DOM.get(ed.id + '_parent'), 'div', {'class' : 'mcePlaceHolder'});
- DOM.setStyles(p, {width : w, height : h});
-
- // Replace with placeholder
- DOM.hide(c);
- DOM.show(p);
-
- // Create internal resize obj
- r = {
- x : e.screenX,
- y : e.screenY,
- w : w,
- h : h,
- dx : null,
- dy : null
- };
-
- // Start listening
- mf = Event.add(DOM.doc, 'mousemove', function(e) {
- var w, h;
-
- // Calc delta values
- r.dx = e.screenX - r.x;
- r.dy = e.screenY - r.y;
+ var mouseMoveHandler1, mouseMoveHandler2, mouseUpHandler,
+ startX, startY, startWidth, startHeight, width, height, ifrElm;
- // Boundery fix box
- w = Math.max(miw, r.w + r.dx);
- h = Math.max(mih, r.h + r.dy);
- w = Math.min(maw, w);
- h = Math.min(mah, h);
+ function resizeOnMove(e) {
+ width = startWidth + (e.screenX - startX);
+ height = startHeight + (e.screenY - startY);
- // Resize placeholder
- if (s.theme_advanced_resize_horizontal)
- p.style.width = w + 'px';
-
- p.style.height = h + 'px';
+ t.resizeTo(width, height);
+ };
- return Event.cancel(e);
- });
+ e.preventDefault();
- me = Event.add(DOM.doc, 'mouseup', function(e) {
- var ifr;
+ // Get the current rect size
+ startX = e.screenX;
+ startY = e.screenY;
+ ifrElm = DOM.get(t.editor.id + '_ifr');
+ startWidth = width = ifrElm.clientWidth;
+ startHeight = height = ifrElm.clientHeight;
+ // Register envent handlers
+ mouseMoveHandler1 = Event.add(DOM.doc, 'mousemove', resizeOnMove);
+ mouseMoveHandler2 = Event.add(ed.getDoc(), 'mousemove', resizeOnMove);
+ mouseUpHandler = Event.add(DOM.doc, 'mouseup', function(e) {
// Stop listening
- Event.remove(DOM.doc, 'mousemove', mf);
- Event.remove(DOM.doc, 'mouseup', me);
-
- c.style.display = '';
- DOM.remove(p);
-
- if (r.dx === null)
- return;
-
- ifr = DOM.get(ed.id + '_ifr');
-
- if (s.theme_advanced_resize_horizontal)
- c.style.width = Math.max(10, r.w + r.dx) + 'px';
-
- c.style.height = Math.max(10, r.h + r.dy) + 'px';
- ifr.style.height = Math.max(10, ifr.clientHeight + r.dy) + 'px';
+ Event.remove(DOM.doc, 'mousemove', mouseMoveHandler1);
+ Event.remove(ed.getDoc(), 'mousemove', mouseMoveHandler2);
+ Event.remove(DOM.doc, 'mouseup', mouseUpHandler);
+ // Store away the size
if (s.theme_advanced_resizing_use_cookie) {
Cookie.setHash("TinyMCE_" + ed.id + "_size", {
- cw : r.w + r.dx,
- ch : r.h + r.dy
+ cw : width,
+ ch : height
});
}
});
-
- return Event.cancel(e);
});
});
}
@@ -801,22 +796,34 @@
n = tb = null;
},
- _nodeChanged : function(ed, cm, n, co) {
+ _nodeChanged : function(ed, cm, n, co, ob) {
var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn;
- if (s.readonly)
- return;
-
tinymce.each(t.stateControls, function(c) {
cm.setActive(c, ed.queryCommandState(t.controls[c][1]));
});
+ function getParent(name) {
+ var i, parents = ob.parents, func = name;
+
+ if (typeof(name) == 'string') {
+ func = function(node) {
+ return node.nodeName == name;
+ };
+ }
+
+ for (i = 0; i < parents.length; i++) {
+ if (func(parents[i]))
+ return parents[i];
+ }
+ };
+
cm.setActive('visualaid', ed.hasVisual);
cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing);
cm.setDisabled('redo', !ed.undoManager.hasRedo());
cm.setDisabled('outdent', !ed.queryCommandState('Outdent'));
- p = DOM.getParent(n, 'A');
+ p = getParent('A');
if (c = cm.get('link')) {
if (!p || !p.name) {
c.setDisabled(!p && co);
@@ -831,82 +838,75 @@
if (c = cm.get('anchor')) {
c.setActive(!!p && p.name);
-
- if (tinymce.isWebKit) {
- p = DOM.getParent(n, 'IMG');
- c.setActive(!!p && DOM.getAttrib(p, 'mce_name') == 'a');
- }
}
- p = DOM.getParent(n, 'IMG');
+ p = getParent('IMG');
if (c = cm.get('image'))
c.setActive(!!p && n.className.indexOf('mceItem') == -1);
if (c = cm.get('styleselect')) {
- if (n.className) {
- t._importClasses();
- c.select(n.className);
- } else
- c.select();
+ t._importClasses();
+
+ // Check each format and update
+ c.select(function(fmt) {
+ return !!ed.formatter.match(fmt);
+ });
}
if (c = cm.get('formatselect')) {
- p = DOM.getParent(n, DOM.isBlock);
+ p = getParent(DOM.isBlock);
if (p)
c.select(p.nodeName.toLowerCase());
}
- if (ed.settings.convert_fonts_to_spans) {
- ed.dom.getParent(n, function(n) {
- if (n.nodeName === 'SPAN') {
- if (!cl && n.className)
- cl = n.className;
+ // Find out current fontSize, fontFamily and fontClass
+ getParent(function(n) {
+ if (n.nodeName === 'SPAN') {
+ if (!cl && n.className)
+ cl = n.className;
- if (!fz && n.style.fontSize)
- fz = n.style.fontSize;
+ if (!fz && n.style.fontSize)
+ fz = n.style.fontSize;
- if (!fn && n.style.fontFamily)
- fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase();
- }
+ if (!fn && n.style.fontFamily)
+ fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase();
+ }
- return false;
+ return false;
+ });
+
+ if (c = cm.get('fontselect')) {
+ c.select(function(v) {
+ return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn;
});
+ }
- if (c = cm.get('fontselect')) {
- c.select(function(v) {
- return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn;
- });
- }
+ // Select font size
+ if (c = cm.get('fontsizeselect')) {
+ // Use computed style
+ if (s.theme_advanced_runtime_fontsize && !fz && !cl)
+ fz = ed.dom.getStyle(n, 'fontSize', true);
- if (c = cm.get('fontsizeselect')) {
- c.select(function(v) {
- if (v.fontSize && v.fontSize === fz)
- return true;
+ c.select(function(v) {
+ if (v.fontSize && v.fontSize === fz)
+ return true;
- if (v['class'] && v['class'] === cl)
- return true;
- });
- }
- } else {
- if (c = cm.get('fontselect'))
- c.select(ed.queryCommandValue('FontName'));
-
- if (c = cm.get('fontsizeselect')) {
- v = ed.queryCommandValue('FontSize');
- c.select(function(iv) {
- return iv.fontSize == v;
- });
- }
+ if (v['class'] && v['class'] === cl)
+ return true;
+ });
}
if (s.theme_advanced_path && s.theme_advanced_statusbar_location) {
p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'});
DOM.setHTML(p, '');
- ed.dom.getParent(n, function(n) {
+ getParent(function(n) {
var na = n.nodeName.toLowerCase(), u, pi, ti = '';
+ /*if (n.getAttribute('_mce_bogus'))
+ return;
+*/
// Ignore non element and hidden elements
if (n.nodeType != 1 || n.nodeName === 'BR' || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved')))
return;
@@ -950,9 +950,6 @@
break;
case 'font':
- if (s.convert_fonts_to_spans)
- na = 'span';
-
if (v = DOM.getAttrib(n, 'face'))
ti += 'font: ' + v + ' ';
@@ -975,9 +972,9 @@
ti += 'id: ' + v + ' ';
if (v = n.className) {
- v = v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g, '');
+ v = v.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g, '')
- if (v && v.indexOf('mceItem') == -1) {
+ if (v) {
ti += 'class: ' + v + ' ';
if (DOM.isBlock(n) || na == 'img' || na == 'span')
diff --git a/program/js/tiny_mce/themes/advanced/image.htm b/program/js/tiny_mce/themes/advanced/image.htm
index 7ec1052ba..f30d67064 100644
--- a/program/js/tiny_mce/themes/advanced/image.htm
+++ b/program/js/tiny_mce/themes/advanced/image.htm
@@ -72,13 +72,8 @@
</div>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" id="insert" name="insert" value="{#insert}" />
- </div>
-
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#insert}" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>
diff --git a/program/js/tiny_mce/themes/advanced/img/icons.gif b/program/js/tiny_mce/themes/advanced/img/icons.gif
index ccac36f54..e46de5333 100644
--- a/program/js/tiny_mce/themes/advanced/img/icons.gif
+++ b/program/js/tiny_mce/themes/advanced/img/icons.gif
Binary files differ
diff --git a/program/js/tiny_mce/themes/advanced/js/anchor.js b/program/js/tiny_mce/themes/advanced/js/anchor.js
index b5efd1ec9..7fe781055 100644
--- a/program/js/tiny_mce/themes/advanced/js/anchor.js
+++ b/program/js/tiny_mce/themes/advanced/js/anchor.js
@@ -5,7 +5,7 @@ var AnchorDialog = {
var action, elm, f = document.forms[0];
this.editor = ed;
- elm = ed.dom.getParent(ed.selection.getNode(), 'A,IMG');
+ elm = ed.dom.getParent(ed.selection.getNode(), 'A');
v = ed.dom.getAttrib(elm, 'name');
if (v) {
@@ -17,18 +17,18 @@ var AnchorDialog = {
},
update : function() {
- var ed = this.editor;
-
+ var ed = this.editor, elm, name = document.forms[0].anchorName.value;
+
tinyMCEPopup.restoreSelection();
if (this.action != 'update')
ed.selection.collapse(1);
- // Webkit acts weird if empty inline element is inserted so we need to use a image instead
- if (tinymce.isWebKit)
- ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('img', {mce_name : 'a', name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}));
+ elm = ed.dom.getParent(ed.selection.getNode(), 'A');
+ if (elm)
+ elm.name = name;
else
- ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, ''));
+ ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : name, 'class' : 'mceItemAnchor'}, ''));
tinyMCEPopup.close();
}
diff --git a/program/js/tiny_mce/themes/advanced/js/charmap.js b/program/js/tiny_mce/themes/advanced/js/charmap.js
index 8467ef603..8c5aea172 100644
--- a/program/js/tiny_mce/themes/advanced/js/charmap.js
+++ b/program/js/tiny_mce/themes/advanced/js/charmap.js
@@ -1,3 +1,13 @@
+/**
+ * charmap.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
tinyMCEPopup.requireLangPack();
var charmap = [
diff --git a/program/js/tiny_mce/themes/advanced/js/image.js b/program/js/tiny_mce/themes/advanced/js/image.js
index 4982ce0c8..6423d9080 100644
--- a/program/js/tiny_mce/themes/advanced/js/image.js
+++ b/program/js/tiny_mce/themes/advanced/js/image.js
@@ -151,8 +151,8 @@ var ImageDialog = {
}
// Merge
- st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st));
- this.styleVal = dom.serializeStyle(st);
+ st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st), 'img');
+ this.styleVal = dom.serializeStyle(st, 'img');
}
},
diff --git a/program/js/tiny_mce/themes/advanced/link.htm b/program/js/tiny_mce/themes/advanced/link.htm
index a78bd334d..7565b9ae8 100644
--- a/program/js/tiny_mce/themes/advanced/link.htm
+++ b/program/js/tiny_mce/themes/advanced/link.htm
@@ -50,13 +50,8 @@
</div>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" id="insert" name="insert" value="{#insert}" />
- </div>
-
- <div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
- </div>
+ <input type="submit" id="insert" name="insert" value="{#insert}" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>
diff --git a/program/js/tiny_mce/themes/advanced/skins/default/content.css b/program/js/tiny_mce/themes/advanced/skins/default/content.css
index 19da1943b..36f38aba2 100644
--- a/program/js/tiny_mce/themes/advanced/skins/default/content.css
+++ b/program/js/tiny_mce/themes/advanced/skins/default/content.css
@@ -8,8 +8,8 @@ h4 {font-size: 1em}
h5 {font-size: .83em}
h6 {font-size: .75em}
.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
-a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(img/items.gif) no-repeat bottom left;}
-img.mceItemAnchor {width:12px; height:12px; background:url(img/items.gif) no-repeat;}
+a.mceItemAnchor {display:inline-block; width:11px !important; height:11px !important; background:url(img/items.gif) no-repeat 0 0;}
+td.mceSelected, th.mceSelected {background-color:#3399ff !important}
img {border:0;}
table {cursor:default}
table td, table th {cursor:text}
@@ -17,7 +17,7 @@ ins {border-bottom:1px solid green; text-decoration: none; color:green}
del {color:red; text-decoration:line-through}
cite {border-bottom:1px dashed blue}
acronym {border-bottom:1px dotted #CCC; cursor:help}
-abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help}
+abbr {border-bottom:1px dashed #CCC; cursor:help}
/* IE */
* html body {
@@ -30,3 +30,6 @@ scrollbar-highlight-color:#F0F0EE;
scrollbar-shadow-color:#F0F0EE;
scrollbar-track-color:#F5F5F5;
}
+
+img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}
+font[face=mceinline] {font-family:inherit !important}
diff --git a/program/js/tiny_mce/themes/advanced/skins/default/dialog.css b/program/js/tiny_mce/themes/advanced/skins/default/dialog.css
index 873c67e3c..f01222650 100644
--- a/program/js/tiny_mce/themes/advanced/skins/default/dialog.css
+++ b/program/js/tiny_mce/themes/advanced/skins/default/dialog.css
@@ -42,10 +42,11 @@ width:94px; height:26px;
background:url(img/buttons.png) 0 -26px;
cursor:pointer;
padding-bottom:2px;
+float:left;
}
-#insert {background:url(img/buttons.png) 0 -52px;}
-#cancel {background:url(img/buttons.png) 0 0;}
+#insert {background:url(img/buttons.png) 0 -52px}
+#cancel {background:url(img/buttons.png) 0 0; float:right}
/* Browse */
a.pickcolor, a.browse {text-decoration:none}
@@ -113,4 +114,4 @@ h3 {font-size:14px;}
#colorpicker #namedcolors {width:150px;}
#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}
#colorpicker #colornamecontainer {margin-top:5px;}
-#colorpicker #picker_panel fieldset {margin:auto;width:325px;} \ No newline at end of file
+#colorpicker #picker_panel fieldset {margin:auto;width:325px;}
diff --git a/program/js/tiny_mce/themes/advanced/skins/default/ui.css b/program/js/tiny_mce/themes/advanced/skins/default/ui.css
index 230a2ee28..01095aeea 100644
--- a/program/js/tiny_mce/themes/advanced/skins/default/ui.css
+++ b/program/js/tiny_mce/themes/advanced/skins/default/ui.css
@@ -4,7 +4,7 @@
.defaultSkin table td {vertical-align:middle}
/* Containers */
-.defaultSkin table {background:#F0F0EE}
+.defaultSkin table {direction:ltr; background:#F0F0EE}
.defaultSkin iframe {display:block; background:#FFF}
.defaultSkin .mceToolbar {height:26px}
.defaultSkin .mceLeft {text-align:left}
@@ -24,7 +24,7 @@
.defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC}
.defaultSkin .mceStatusbar {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; display:block; height:20px}
.defaultSkin .mceStatusbar div {float:left; margin:2px}
-.defaultSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize}
+.defaultSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0}
.defaultSkin .mceStatusbar a:hover {text-decoration:underline}
.defaultSkin table.mceToolbar {margin-left:3px}
.defaultSkin span.mceIcon, .defaultSkin img.mceIcon {display:block; width:20px; height:20px}
@@ -47,7 +47,6 @@
.defaultSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:2px 2px 0 4px}
/* ListBox */
-.defaultSkin .mceListBox {direction:ltr}
.defaultSkin .mceListBox, .defaultSkin .mceListBox a {display:block}
.defaultSkin .mceListBox .mceText {padding-left:4px; width:70px; text-align:left; border:1px solid #CCC; border-right:0; background:#FFF; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden}
.defaultSkin .mceListBox .mceOpen {width:9px; height:20px; background:url(../../img/icons.gif) -741px 0; margin-right:2px; border:1px solid #CCC;}
@@ -63,7 +62,7 @@
.defaultSkin .mceSplitButton {width:32px; height:20px; direction:ltr}
.defaultSkin .mceSplitButton a, .defaultSkin .mceSplitButton span {height:20px; display:block}
.defaultSkin .mceSplitButton a.mceAction {width:20px; border:1px solid #F0F0EE; border-right:0;}
-.defaultSkin .mceSplitButton span.mceAction {width:20px; background:url(../../img/icons.gif) 20px 20px;}
+.defaultSkin .mceSplitButton span.mceAction {width:20px; background-image:url(../../img/icons.gif);}
.defaultSkin .mceSplitButton a.mceOpen {width:9px; background:url(../../img/icons.gif) -741px 0; border:1px solid #F0F0EE;}
.defaultSkin .mceSplitButton span.mceOpen {display:none}
.defaultSkin table.mceSplitButtonEnabled:hover a.mceAction, .defaultSkin .mceSplitButtonHover a.mceAction, .defaultSkin .mceSplitButtonSelected a.mceAction {border:1px solid #0A246A; border-right:0; background-color:#B2BBD0}
@@ -108,7 +107,6 @@
/* Progress,Resize */
.defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50); background:#FFF}
.defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
-.defaultSkin .mcePlaceHolder {border:1px dotted gray}
/* Formats */
.defaultSkin .mce_formatPreview a {font-size:10px}
@@ -211,4 +209,5 @@
.defaultSkin span.mce_del {background-position:-940px -20px}
.defaultSkin span.mce_ins {background-position:-960px -20px}
.defaultSkin span.mce_pagebreak {background-position:0 -40px}
+.defaultSkin span.mce_restoredraft {background-position:-20px -40px}
.defaultSkin .mce_spellchecker span.mceAction {background-position:-540px -20px}
diff --git a/program/js/tiny_mce/themes/advanced/skins/o2k7/content.css b/program/js/tiny_mce/themes/advanced/skins/o2k7/content.css
index b8431d169..3cea5ff1c 100644
--- a/program/js/tiny_mce/themes/advanced/skins/o2k7/content.css
+++ b/program/js/tiny_mce/themes/advanced/skins/o2k7/content.css
@@ -8,8 +8,8 @@ h4 {font-size: 1em}
h5 {font-size: .83em}
h6 {font-size: .75em}
.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
-a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(../default/img/items.gif) no-repeat bottom left;}
-img.mceItemAnchor {width:12px; height:12px; background:url(../default/img/items.gif) no-repeat;}
+a.mceItemAnchor {display:inline-block; width:11px !important; height:11px !important; background:url(../default/img/items.gif) no-repeat 0 0;}
+td.mceSelected, th.mceSelected {background-color:#3399ff !important}
img {border:0;}
table {cursor:default}
table td, table th {cursor:text}
@@ -17,7 +17,7 @@ ins {border-bottom:1px solid green; text-decoration: none; color:green}
del {color:red; text-decoration:line-through}
cite {border-bottom:1px dashed blue}
acronym {border-bottom:1px dotted #CCC; cursor:help}
-abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help}
+abbr {border-bottom:1px dashed #CCC; cursor:help}
/* IE */
* html body {
@@ -30,3 +30,6 @@ scrollbar-highlight-color:#F0F0EE;
scrollbar-shadow-color:#F0F0EE;
scrollbar-track-color:#F5F5F5;
}
+
+img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}
+font[face=mceinline] {font-family:inherit !important}
diff --git a/program/js/tiny_mce/themes/advanced/skins/o2k7/dialog.css b/program/js/tiny_mce/themes/advanced/skins/o2k7/dialog.css
index 6c37d6fb8..e3af1396e 100644
--- a/program/js/tiny_mce/themes/advanced/skins/o2k7/dialog.css
+++ b/program/js/tiny_mce/themes/advanced/skins/o2k7/dialog.css
@@ -42,10 +42,11 @@ width:94px; height:26px;
background:url(../default/img/buttons.png) 0 -26px;
cursor:pointer;
padding-bottom:2px;
+float:left;
}
-#insert {background:url(../default/img/buttons.png) 0 -52px;}
-#cancel {background:url(../default/img/buttons.png) 0 0;}
+#insert {background:url(../default/img/buttons.png) 0 -52px}
+#cancel {background:url(../default/img/buttons.png) 0 0; float:right}
/* Browse */
a.pickcolor, a.browse {text-decoration:none}
diff --git a/program/js/tiny_mce/themes/advanced/skins/o2k7/ui.css b/program/js/tiny_mce/themes/advanced/skins/o2k7/ui.css
index c10a3f016..aae0e2bf4 100644
--- a/program/js/tiny_mce/themes/advanced/skins/o2k7/ui.css
+++ b/program/js/tiny_mce/themes/advanced/skins/o2k7/ui.css
@@ -21,7 +21,7 @@
.o2k7Skin .mceIframeContainer {border-top:1px solid #ABC6DD; border-bottom:1px solid #ABC6DD}
.o2k7Skin .mceStatusbar {display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; height:20px}
.o2k7Skin .mceStatusbar div {float:left; padding:2px}
-.o2k7Skin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize}
+.o2k7Skin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0}
.o2k7Skin .mceStatusbar a:hover {text-decoration:underline}
.o2k7Skin table.mceToolbar {margin-left:3px}
.o2k7Skin .mceToolbar .mceToolbarStart span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px; margin-left:3px;}
@@ -65,7 +65,7 @@
.o2k7Skin .mceSplitButton, .o2k7Skin .mceSplitButton a, .o2k7Skin .mceSplitButton span {display:block; height:22px}
.o2k7Skin .mceSplitButton {background:url(img/button_bg.png)}
.o2k7Skin .mceSplitButton a.mceAction {width:22px}
-.o2k7Skin .mceSplitButton span.mceAction {width:22px; background:url(../../img/icons.gif) 20px 20px}
+.o2k7Skin .mceSplitButton span.mceAction {width:22px; background-image:url(../../img/icons.gif)}
.o2k7Skin .mceSplitButton a.mceOpen {width:10px; background:url(img/button_bg.png) -44px 0}
.o2k7Skin .mceSplitButton span.mceOpen {display:none}
.o2k7Skin table.mceSplitButtonEnabled:hover a.mceAction, .o2k7Skin .mceSplitButtonHover a.mceAction, .o2k7Skin .mceSplitButtonSelected {background:url(img/button_bg.png) 0 -22px}
@@ -109,7 +109,6 @@
/* Progress,Resize */
.o2k7Skin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF}
.o2k7Skin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
-.o2k7Skin .mcePlaceHolder {border:1px dotted gray}
/* Formats */
.o2k7Skin .mce_formatPreview a {font-size:10px}
@@ -212,4 +211,5 @@
.o2k7Skin span.mce_del {background-position:-940px -20px}
.o2k7Skin span.mce_ins {background-position:-960px -20px}
.o2k7Skin span.mce_pagebreak {background-position:0 -40px}
+.o2k7Skin span.mce_restoredraft {background-position:-20px -40px}
.o2k7Skin .mce_spellchecker span.mceAction {background-position:-540px -20px}
diff --git a/program/js/tiny_mce/themes/advanced/source_editor.htm b/program/js/tiny_mce/themes/advanced/source_editor.htm
index 553e7bb2b..1c81d23ee 100644
--- a/program/js/tiny_mce/themes/advanced/source_editor.htm
+++ b/program/js/tiny_mce/themes/advanced/source_editor.htm
@@ -18,13 +18,8 @@
<textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,monospace; font-size: 12px;" dir="ltr" wrap="off" class="mceFocus"></textarea>
<div class="mceActionPanel">
- <div style="float: left">
- <input type="submit" name="insert" value="{#update}" id="insert" />
- </div>
-
- <div style="float: right">
- <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
- </div>
+ <input type="submit" name="insert" value="{#update}" id="insert" />
+ <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
</div>
</form>
</body>
diff --git a/program/js/tiny_mce/themes/simple/editor_template_src.js b/program/js/tiny_mce/themes/simple/editor_template_src.js
index fb0bd7893..4b862d49d 100644
--- a/program/js/tiny_mce/themes/simple/editor_template_src.js
+++ b/program/js/tiny_mce/themes/simple/editor_template_src.js
@@ -1,11 +1,11 @@
/**
- * $Id: editor_template_src.js 920 2008-09-09 14:05:33Z spocke $
+ * editor_template_src.js
*
- * This file is meant to showcase how to create a simple theme. The advanced
- * theme is more suitable for production use.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
*
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
diff --git a/program/js/tiny_mce/tiny_mce.js b/program/js/tiny_mce/tiny_mce.js
index babc91e6a..e96c95151 100644
--- a/program/js/tiny_mce/tiny_mce.js
+++ b/program/js/tiny_mce/tiny_mce.js
@@ -1 +1 @@
-var tinymce={majorVersion:"3",minorVersion:"2.7",releaseDate:"2009-09-22",_init:function(){var o=this,k=document,l=window,j=navigator,b=j.userAgent,h,a,g,f,e,m;o.isOpera=l.opera&&opera.buildNumber;o.isWebKit=/WebKit/.test(b);o.isIE=!o.isWebKit&&!o.isOpera&&(/MSIE/gi).test(b)&&(/Explorer/gi).test(j.appName);o.isIE6=o.isIE&&/MSIE [56]/.test(b);o.isGecko=!o.isWebKit&&/Gecko/.test(b);o.isMac=b.indexOf("Mac")!=-1;o.isAir=/adobeair/i.test(b);if(l.tinyMCEPreInit){o.suffix=tinyMCEPreInit.suffix;o.baseURL=tinyMCEPreInit.base;o.query=tinyMCEPreInit.query;return}o.suffix="";a=k.getElementsByTagName("base");for(h=0;h<a.length;h++){if(m=a[h].href){if(/^https?:\/\/[^\/]+$/.test(m)){m+="/"}f=m?m.match(/.*\//)[0]:""}}function c(d){if(d.src&&/tiny_mce(|_gzip|_jquery|_prototype)(_dev|_src)?.js/.test(d.src)){if(/_(src|dev)\.js/g.test(d.src)){o.suffix="_src"}if((e=d.src.indexOf("?"))!=-1){o.query=d.src.substring(e+1)}o.baseURL=d.src.substring(0,d.src.lastIndexOf("/"));if(f&&o.baseURL.indexOf("://")==-1&&o.baseURL.indexOf("/")!==0){o.baseURL=f+o.baseURL}return o.baseURL}return null}a=k.getElementsByTagName("script");for(h=0;h<a.length;h++){if(c(a[h])){return}}g=k.getElementsByTagName("head")[0];if(g){a=g.getElementsByTagName("script");for(h=0;h<a.length;h++){if(c(a[h])){return}}}return},is:function(b,a){var c=typeof(b);if(!a){return c!="undefined"}if(a=="array"&&(b.hasOwnProperty&&b instanceof Array)){return true}return c==a},each:function(d,a,c){var e,b;if(!d){return 0}c=c||d;if(typeof(d.length)!="undefined"){for(e=0,b=d.length;e<b;e++){if(a.call(c,d[e],e,d)===false){return 0}}}else{for(e in d){if(d.hasOwnProperty(e)){if(a.call(c,d[e],e,d)===false){return 0}}}}return 1},map:function(b,c){var d=[];tinymce.each(b,function(a){d.push(c(a))});return d},grep:function(b,c){var d=[];tinymce.each(b,function(a){if(!c||c(a)){d.push(a)}});return d},inArray:function(c,d){var e,b;if(c){for(e=0,b=c.length;e<b;e++){if(c[e]===d){return e}}}return -1},extend:function(f,d){var c,b=arguments;for(c=1;c<b.length;c++){d=b[c];tinymce.each(d,function(a,e){if(typeof(a)!=="undefined"){f[e]=a}})}return f},trim:function(a){return(a?""+a:"").replace(/^\s*|\s*$/g,"")},create:function(j,a){var i=this,b,e,f,g,d,h=0;j=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(j);f=j[3].match(/(^|\.)(\w+)$/i)[2];e=i.createNS(j[3].replace(/\.\w+$/,""));if(e[f]){return}if(j[2]=="static"){e[f]=a;if(this.onCreate){this.onCreate(j[2],j[3],e[f])}return}if(!a[f]){a[f]=function(){};h=1}e[f]=a[f];i.extend(e[f].prototype,a);if(j[5]){b=i.resolve(j[5]).prototype;g=j[5].match(/\.(\w+)$/i)[1];d=e[f];if(h){e[f]=function(){return b[g].apply(this,arguments)}}else{e[f]=function(){this.parent=b[g];return d.apply(this,arguments)}}e[f].prototype[f]=e[f];i.each(b,function(c,k){e[f].prototype[k]=b[k]});i.each(a,function(c,k){if(b[k]){e[f].prototype[k]=function(){this.parent=b[k];return c.apply(this,arguments)}}else{if(k!=f){e[f].prototype[k]=c}}})}i.each(a["static"],function(c,k){e[f][k]=c});if(this.onCreate){this.onCreate(j[2],j[3],e[f].prototype)}},walk:function(c,b,d,a){a=a||this;if(c){if(d){c=c[d]}tinymce.each(c,function(f,e){if(b.call(a,f,e,d)===false){return false}tinymce.walk(f,b,d,a)})}},createNS:function(d,c){var b,a;c=c||window;d=d.split(".");for(b=0;b<d.length;b++){a=d[b];if(!c[a]){c[a]={}}c=c[a]}return c},resolve:function(d,c){var b,a;c=c||window;d=d.split(".");for(b=0,a=d.length;b<a;b++){c=c[d[b]];if(!c){break}}return c},addUnload:function(e,d){var c=this,a=window;e={func:e,scope:d||this};if(!c.unloads){function b(){var f=c.unloads,h,i;if(f){for(i in f){h=f[i];if(h&&h.func){h.func.call(h.scope,1)}}if(a.detachEvent){a.detachEvent("onbeforeunload",g);a.detachEvent("onunload",b)}else{if(a.removeEventListener){a.removeEventListener("unload",b,false)}}c.unloads=h=f=a=b=0;if(window.CollectGarbage){window.CollectGarbage()}}}function g(){var h=document;if(h.readyState=="interactive"){function f(){h.detachEvent("onstop",f);if(b){b()}h=0}if(h){h.attachEvent("onstop",f)}window.setTimeout(function(){if(h){h.detachEvent("onstop",f)}},0)}}if(a.attachEvent){a.attachEvent("onunload",b);a.attachEvent("onbeforeunload",g)}else{if(a.addEventListener){a.addEventListener("unload",b,false)}}c.unloads=[e]}else{c.unloads.push(e)}return e},removeUnload:function(c){var a=this.unloads,b=null;tinymce.each(a,function(e,d){if(e&&e.func==c){a.splice(d,1);b=c;return false}});return b},explode:function(a,b){return a?tinymce.map(a.split(b||","),tinymce.trim):a},_addVer:function(b){var a;if(!this.query){return b}a=(b.indexOf("?")==-1?"?":"&")+this.query;if(b.indexOf("#")==-1){return b+a}return b.replace("#",a+"#")}};window.tinymce=tinymce;tinymce._init();tinymce.create("tinymce.util.Dispatcher",{scope:null,listeners:null,Dispatcher:function(a){this.scope=a||this;this.listeners=[]},add:function(a,b){this.listeners.push({cb:a,scope:b||this.scope});return a},addToTop:function(a,b){this.listeners.unshift({cb:a,scope:b||this.scope});return a},remove:function(a){var b=this.listeners,c=null;tinymce.each(b,function(e,d){if(a==e.cb){c=a;b.splice(d,1);return false}});return c},dispatch:function(){var f,d=arguments,e,b=this.listeners,g;for(e=0;e<b.length;e++){g=b[e];f=g.cb.apply(g.scope,d);if(f===false){break}}return f}});(function(){var a=tinymce.each;tinymce.create("tinymce.util.URI",{URI:function(e,g){var f=this,h,d,c;e=tinymce.trim(e);g=f.settings=g||{};if(/^(mailto|tel|news|javascript|about|data):/i.test(e)||/^\s*#/.test(e)){f.source=e;return}if(e.indexOf("/")===0&&e.indexOf("//")!==0){e=(g.base_uri?g.base_uri.protocol||"http":"http")+"://mce_host"+e}if(!/^\w*:?\/\//.test(e)){e=(g.base_uri.protocol||"http")+"://mce_host"+f.toAbsPath(g.base_uri.path,e)}e=e.replace(/@@/g,"(mce_at)");e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);a(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(b,j){var k=e[j];if(k){k=k.replace(/\(mce_at\)/g,"@@")}f[b]=k});if(c=g.base_uri){if(!f.protocol){f.protocol=c.protocol}if(!f.userInfo){f.userInfo=c.userInfo}if(!f.port&&f.host=="mce_host"){f.port=c.port}if(!f.host||f.host=="mce_host"){f.host=c.host}f.source=""}},setPath:function(c){var b=this;c=/^(.*?)\/?(\w+)?$/.exec(c);b.path=c[0];b.directory=c[1];b.file=c[2];b.source="";b.getURI()},toRelative:function(b){var c=this,d;if(b==="./"){return b}b=new tinymce.util.URI(b,{base_uri:c});if((b.host!="mce_host"&&c.host!=b.host&&b.host)||c.port!=b.port||c.protocol!=b.protocol){return b.getURI()}d=c.toRelPath(c.path,b.path);if(b.query){d+="?"+b.query}if(b.anchor){d+="#"+b.anchor}return d},toAbsolute:function(b,c){var b=new tinymce.util.URI(b,{base_uri:this});return b.getURI(this.host==b.host&&this.protocol==b.protocol?c:0)},toRelPath:function(g,h){var c,f=0,d="",e,b;g=g.substring(0,g.lastIndexOf("/"));g=g.split("/");c=h.split("/");if(g.length>=c.length){for(e=0,b=g.length;e<b;e++){if(e>=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length<c.length){for(e=0,b=c.length;e<b;e++){if(e>=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e<b;e++){d+="../"}for(e=f-1,b=c.length;e<b;e++){if(e!=f-1){d+="/"+c[e]}else{d+=c[e]}}return d},toAbsPath:function(e,f){var c,b=0,h=[],d,g;d=/\/$/.test(f)?"/":"";e=e.split("/");f=f.split("/");a(e,function(i){if(i){h.push(i)}});e=h;for(c=f.length-1,h=[];c>=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();tinymce.create("static tinymce.util.JSON",{serialize:function(e){var c,a,d=tinymce.util.JSON.serialize,b;if(e==null){return"null"}b=typeof e;if(b=="string"){a="\bb\tt\nn\ff\rr\"\"''\\\\";return'"'+e.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(g,f){c=a.indexOf(f);if(c+1){return"\\"+a.charAt(c+1)}g=f.charCodeAt().toString(16);return"\\u"+"0000".substring(g.length)+g})+'"'}if(b=="object"){if(e.hasOwnProperty&&e instanceof Array){for(c=0,a="[";c<e.length;c++){a+=(c>0?",":"")+d(e[c])}return a+"]"}a="{";for(c in e){a+=typeof e[c]!="function"?(a.length>1?',"':'"')+c+'":'+d(e[c]):""}return a+"}"}return""+e},parse:function(s){try{return eval("("+s+")")}catch(ex){}}});tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.setRequestHeader("X-Requested-With","XMLHttpRequest");a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){e.call(f.error_scope||f.scope,h,g)};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(c){var e=c.each,b=c.is;var d=c.isWebKit,a=c.isIE;c.create("tinymce.dom.DOMUtils",{doc:null,root:null,files:null,pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value",id:"id",name:"name",type:"type"},DOMUtils:function(i,g){var f=this;f.doc=i;f.win=window;f.files={};f.cssFlicker=false;f.counter=0;f.boxModel=!c.isIE||i.compatMode=="CSS1Compat";f.stdMode=i.documentMode===8;f.settings=g=c.extend({keep_values:false,hex_colors:1,process_html:1},g);if(c.isIE6){try{i.execCommand("BackgroundImageCache",false,true)}catch(h){f.cssFlicker=true}}c.addUnload(f.destroy,f)},getRoot:function(){var f=this,g=f.settings;return(g&&f.get(g.root_element))||f.doc.body},getViewPort:function(g){var h,f;g=!g?this.win:g;h=g.document;f=this.boxModel?h.documentElement:h.body;return{x:g.pageXOffset||f.scrollLeft,y:g.pageYOffset||f.scrollTop,w:g.innerWidth||f.clientWidth,h:g.innerHeight||f.clientHeight}},getRect:function(i){var h,f=this,g;i=f.get(i);h=f.getPos(i);g=f.getSize(i);return{x:h.x,y:h.y,w:g.w,h:g.h}},getSize:function(j){var g=this,f,i;j=g.get(j);f=g.getStyle(j,"width");i=g.getStyle(j,"height");if(f.indexOf("px")===-1){f=0}if(i.indexOf("px")===-1){i=0}return{w:parseInt(f)||j.offsetWidth||j.clientWidth,h:parseInt(i)||j.offsetHeight||j.clientHeight}},getParent:function(i,h,g){return this.getParents(i,h,g,false)},getParents:function(p,k,i,m){var h=this,g,j=h.settings,l=[];p=h.get(p);m=m===undefined;if(j.strict_root){i=i||h.getRoot()}if(b(k,"string")){g=k;if(k==="*"){k=function(f){return f.nodeType==1}}else{k=function(f){return h.is(f,g)}}}while(p){if(p==i||!p.nodeType||p.nodeType===9){break}if(!k||k(p)){if(m){l.push(p)}else{return p}}p=p.parentNode}return m?l:null},get:function(f){var g;if(f&&this.doc&&typeof(f)=="string"){g=f;f=this.doc.getElementById(f);if(f&&f.id!==g){return this.doc.getElementsByName(g)[1]}}return f},getNext:function(g,f){return this._findSib(g,f,"nextSibling")},getPrev:function(g,f){return this._findSib(g,f,"previousSibling")},select:function(h,g){var f=this;return c.dom.Sizzle(h,f.get(g)||f.get(f.settings.root_element)||f.doc,[])},is:function(g,f){return c.dom.Sizzle.matches(f,g.nodeType?[g]:g).length>0},add:function(j,l,f,i,k){var g=this;return this.run(j,function(n){var m,h;m=b(l,"string")?g.doc.createElement(l):l;g.setAttribs(m,f);if(i){if(i.nodeType){m.appendChild(i)}else{g.setHTML(m,i)}}return !k?n.appendChild(m):m})},create:function(i,f,g){return this.add(this.doc.createElement(i),i,f,g,1)},createHTML:function(m,f,j){var l="",i=this,g;l+="<"+m;for(g in f){if(f.hasOwnProperty(g)){l+=" "+g+'="'+i.encode(f[g])+'"'}}if(c.is(j)){return l+">"+j+"</"+m+">"}return l+" />"},remove:function(h,f){var g=this;return this.run(h,function(m){var l,k,j;l=m.parentNode;if(!l){return null}if(f){for(j=m.childNodes.length-1;j>=0;j--){g.insertAfter(m.childNodes[j],m)}}if(g.fixPsuedoLeaks){l=m.cloneNode(true);f="IELeakGarbageBin";k=g.get(f)||g.add(g.doc.body,"div",{id:f,style:"display:none"});k.appendChild(m);k.innerHTML="";return l}return l.removeChild(m)})},setStyle:function(i,f,g){var h=this;return h.run(i,function(l){var k,j;k=l.style;f=f.replace(/-(\D)/g,function(n,m){return m.toUpperCase()});if(h.pixelStyles.test(f)&&(c.is(g,"number")||/^[\-0-9\.]+$/.test(g))){g+="px"}switch(f){case"opacity":if(a){k.filter=g===""?"":"alpha(opacity="+(g*100)+")";if(!i.currentStyle||!i.currentStyle.hasLayout){k.display="inline-block"}}k[f]=k["-moz-opacity"]=k["-khtml-opacity"]=g||"";break;case"float":a?k.styleFloat=g:k.cssFloat=g;break;default:k[f]=g||""}if(h.settings.update_styles){h.setAttrib(l,"mce_style")}})},getStyle:function(i,f,h){i=this.get(i);if(!i){return false}if(this.doc.defaultView&&h){f=f.replace(/[A-Z]/g,function(j){return"-"+j});try{return this.doc.defaultView.getComputedStyle(i,null).getPropertyValue(f)}catch(g){return null}}f=f.replace(/-(\D)/g,function(k,j){return j.toUpperCase()});if(f=="float"){f=a?"styleFloat":"cssFloat"}if(i.currentStyle&&h){return i.currentStyle[f]}return i.style[f]},setStyles:function(i,j){var g=this,h=g.settings,f;f=h.update_styles;h.update_styles=0;e(j,function(k,l){g.setStyle(i,l,k)});h.update_styles=f;if(h.update_styles){g.setAttrib(i,h.cssText)}},setAttrib:function(h,i,f){var g=this;if(!h||!i){return}if(g.settings.strict){i=i.toLowerCase()}return this.run(h,function(k){var j=g.settings;switch(i){case"style":if(!b(f,"string")){e(f,function(l,m){g.setStyle(k,m,l)});return}if(j.keep_values){if(f&&!g._isRes(f)){k.setAttribute("mce_style",f,2)}else{k.removeAttribute("mce_style",2)}}k.style.cssText=f;break;case"class":k.className=f||"";break;case"src":case"href":if(j.keep_values){if(j.url_converter){f=j.url_converter.call(j.url_converter_scope||g,f,i,k)}g.setAttrib(k,"mce_"+i,f,2)}break;case"shape":k.setAttribute("mce_style",f);break}if(b(f)&&f!==null&&f.length!==0){k.setAttribute(i,""+f,2)}else{k.removeAttribute(i,2)}})},setAttribs:function(g,h){var f=this;return this.run(g,function(i){e(h,function(j,k){f.setAttrib(i,k,j)})})},getAttrib:function(i,j,h){var f,g=this;i=g.get(i);if(!i||i.nodeType!==1){return false}if(!b(h)){h=""}if(/^(src|href|style|coords|shape)$/.test(j)){f=i.getAttribute("mce_"+j);if(f){return f}}if(a&&g.props[j]){f=i[g.props[j]];f=f&&f.nodeValue?f.nodeValue:f}if(!f){f=i.getAttribute(j,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(j)){if(i[g.props[j]]===true&&f===""){return j}return f?j:""}if(i.nodeName==="FORM"&&i.getAttributeNode(j)){return i.getAttributeNode(j).nodeValue}if(j==="style"){f=f||i.style.cssText;if(f){f=g.serializeStyle(g.parseStyle(f));if(g.settings.keep_values&&!g._isRes(f)){i.setAttribute("mce_style",f)}}}if(d&&j==="class"&&f){f=f.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(a){switch(j){case"rowspan":case"colspan":if(f===1){f=""}break;case"size":if(f==="+0"||f===20||f===0){f=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(f===0){f=""}break;case"hspace":if(f===-1){f=""}break;case"maxlength":case"tabindex":if(f===32768||f===2147483647||f==="32768"){f=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(f===65535){return j}return h;case"shape":f=f.toLowerCase();break;default:if(j.indexOf("on")===0&&f){f=(""+f).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1")}}}return(f!==undefined&&f!==null&&f!=="")?""+f:h},getPos:function(m,i){var g=this,f=0,l=0,j,k=g.doc,h;m=g.get(m);i=i||k.body;if(m){if(a&&!g.stdMode){m=m.getBoundingClientRect();j=g.boxModel?k.documentElement:k.body;f=g.getStyle(g.select("html")[0],"borderWidth");f=(f=="medium"||g.boxModel&&!g.isIE6)&&2||f;m.top+=g.win.self!=g.win.top?2:0;return{x:m.left+j.scrollLeft-f,y:m.top+j.scrollTop-f}}h=m;while(h&&h!=i&&h.nodeType){f+=h.offsetLeft||0;l+=h.offsetTop||0;h=h.offsetParent}h=m.parentNode;while(h&&h!=i&&h.nodeType){f-=h.scrollLeft||0;l-=h.scrollTop||0;h=h.parentNode}}return{x:f,y:l}},parseStyle:function(h){var i=this,j=i.settings,k={};if(!h){return k}function f(w,q,v){var o,u,m,n;o=k[w+"-top"+q];if(!o){return}u=k[w+"-right"+q];if(o!=u){return}m=k[w+"-bottom"+q];if(u!=m){return}n=k[w+"-left"+q];if(m!=n){return}k[v]=n;delete k[w+"-top"+q];delete k[w+"-right"+q];delete k[w+"-bottom"+q];delete k[w+"-left"+q]}function g(n,m,l,p){var o;o=k[m];if(!o){return}o=k[l];if(!o){return}o=k[p];if(!o){return}k[n]=k[m]+" "+k[l]+" "+k[p];delete k[m];delete k[l];delete k[p]}h=h.replace(/&(#?[a-z0-9]+);/g,"&$1_MCE_SEMI_");e(h.split(";"),function(m){var l,n=[];if(m){m=m.replace(/_MCE_SEMI_/g,";");m=m.replace(/url\([^\)]+\)/g,function(o){n.push(o);return"url("+n.length+")"});m=m.split(":");l=c.trim(m[1]);l=l.replace(/url\(([^\)]+)\)/g,function(p,o){return n[parseInt(o)-1]});l=l.replace(/rgb\([^\)]+\)/g,function(o){return i.toHex(o)});if(j.url_converter){l=l.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(o,p){return"url("+j.url_converter.call(j.url_converter_scope||i,i.decode(p),"style",null)+")"})}k[c.trim(m[0]).toLowerCase()]=l}});f("border","","border");f("border","-width","border-width");f("border","-color","border-color");f("border","-style","border-style");f("padding","","padding");f("margin","","margin");g("border","border-width","border-style","border-color");if(a){if(k.border=="medium none"){k.border=""}}return k},serializeStyle:function(g){var f="";e(g,function(i,h){if(h&&i){if(c.isGecko&&h.indexOf("-moz-")===0){return}switch(h){case"color":case"background-color":i=i.toLowerCase();break}f+=(f?" ":"")+h+": "+i+";"}});return f},loadCSS:function(f){var h=this,i=h.doc,g;if(!f){f=""}g=h.select("head")[0];e(f.split(","),function(j){var k;if(h.files[j]){return}h.files[j]=true;k=h.create("link",{rel:"stylesheet",href:c._addVer(j)});if(a&&i.documentMode){k.onload=function(){i.recalc();k.onload=null}}g.appendChild(k)})},addClass:function(f,g){return this.run(f,function(h){var i;if(!g){return 0}if(this.hasClass(h,g)){return h.className}i=this.removeClass(h,g);return h.className=(i!=""?(i+" "):"")+g})},removeClass:function(h,i){var f=this,g;return f.run(h,function(k){var j;if(f.hasClass(k,i)){if(!g){g=new RegExp("(^|\\s+)"+i+"(\\s+|$)","g")}j=k.className.replace(g," ");return k.className=c.trim(j!=" "?j:"")}return k.className})},hasClass:function(g,f){g=this.get(g);if(!g||!f){return false}return(" "+g.className+" ").indexOf(" "+f+" ")!==-1},show:function(f){return this.setStyle(f,"display","block")},hide:function(f){return this.setStyle(f,"display","none")},isHidden:function(f){f=this.get(f);return !f||f.style.display=="none"||this.getStyle(f,"display")=="none"},uniqueId:function(f){return(!f?"mce_":f)+(this.counter++)},setHTML:function(i,g){var f=this;return this.run(i,function(m){var h,k,j,q,l,h;g=f.processHTML(g);if(a){function o(){try{m.innerHTML="<br />"+g;m.removeChild(m.firstChild)}catch(n){while(m.firstChild){m.firstChild.removeNode()}h=f.create("div");h.innerHTML="<br />"+g;e(h.childNodes,function(r,p){if(p){m.appendChild(r)}})}}if(f.settings.fix_ie_paragraphs){g=g.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi,'<p$1 mce_keep="true">&nbsp;</p>')}o();if(f.settings.fix_ie_paragraphs){j=m.getElementsByTagName("p");for(k=j.length-1,h=0;k>=0;k--){q=j[k];if(!q.hasChildNodes()){if(!q.mce_keep){h=1;break}q.removeAttribute("mce_keep")}}}if(h){g=g.replace(/<p ([^>]+)>|<p>/ig,'<div $1 mce_tmp="1">');g=g.replace(/<\/p>/g,"</div>");o();if(f.settings.fix_ie_paragraphs){j=m.getElementsByTagName("DIV");for(k=j.length-1;k>=0;k--){q=j[k];if(q.mce_tmp){l=f.doc.createElement("p");q.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(p,n){var r;if(n!=="mce_tmp"){r=q.getAttribute(n);if(!r&&n==="class"){r=q.className}l.setAttribute(n,r)}});for(h=0;h<q.childNodes.length;h++){l.appendChild(q.childNodes[h].cloneNode(true))}q.swapNode(l)}}}}}else{m.innerHTML=g}return g})},processHTML:function(j){var g=this,i=g.settings,k=[];if(!i.process_html){return j}if(c.isGecko){j=j.replace(/<(\/?)strong>|<strong( [^>]+)>/gi,"<$1b$2>");j=j.replace(/<(\/?)em>|<em( [^>]+)>/gi,"<$1i$2>")}else{if(a){j=j.replace(/&apos;/g,"&#39;");j=j.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi,"")}}j=j.replace(/<a( )([^>]+)\/>|<a\/>/gi,"<a$1$2></a>");if(i.keep_values){if(/<script|noscript|style/i.test(j)){function f(h){h=h.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n");h=h.replace(/^[\r\n]*|[\r\n]*$/g,"");h=h.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g,"");h=h.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g,"");return h}j=j.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/gi,function(h,m,l){if(!m){m=' type="text/javascript"'}m=m.replace(/src=\"([^\"]+)\"?/i,function(n,o){if(i.url_converter){o=g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(o),"src","script"))}return'mce_src="'+o+'"'});if(c.trim(l)){k.push(f(l));l="<!--\nMCE_SCRIPT:"+(k.length-1)+"\n// -->"}return"<mce:script"+m+">"+l+"</mce:script>"});j=j.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/gi,function(h,m,l){if(l){k.push(f(l));l="<!--\nMCE_SCRIPT:"+(k.length-1)+"\n-->"}return"<mce:style"+m+">"+l+"</mce:style><style "+m+' mce_bogus="1">'+l+"</style>"});j=j.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g,function(h,m,l){return"<mce:noscript"+m+"><!--"+g.encode(l).replace(/--/g,"&#45;&#45;")+"--></mce:noscript>"})}j=j.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g,"<!--[CDATA[$1]]-->");j=j.replace(/<([\w:]+) [^>]*(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)[^>]*>/gi,function(l){function h(o,m,n){if(n==="false"||n==="0"){return""}return" "+m+'="'+m+'"'}l=l.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=[\"]([^\"]+)[\"]/gi,h);l=l.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=[\']([^\']+)[\']/gi,h);l=l.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=([^\s\"\'>]+)/gi,h);l=l.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)([\s>])/gi,' $1="$1"$2');return l});j=j.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(h,m){function l(o,n,q){var p=q;if(h.indexOf("mce_"+n)!=-1){return o}if(n=="style"){if(g._isRes(q)){return o}p=g.encode(g.serializeStyle(g.parseStyle(p)))}else{if(n!="coords"&&n!="shape"){if(i.url_converter){p=g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(q),n,m))}}}return" "+n+'="'+q+'" mce_'+n+'="'+p+'"'}h=h.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,l);h=h.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,l);return h.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,l)});j=j.replace(/MCE_SCRIPT:([0-9]+)/g,function(l,h){return k[h]})}return j},getOuterHTML:function(f){var g;f=this.get(f);if(!f){return null}if(f.outerHTML!==undefined){return f.outerHTML}g=(f.ownerDocument||this.doc).createElement("body");g.appendChild(f.cloneNode(true));return g.innerHTML},setOuterHTML:function(j,g,k){var f=this;function i(m,l,p){var q,o;o=p.createElement("body");o.innerHTML=l;q=o.lastChild;while(q){f.insertAfter(q.cloneNode(true),m);q=q.previousSibling}f.remove(m)}return this.run(j,function(l){l=f.get(l);if(l.nodeType==1){k=k||l.ownerDocument||f.doc;if(a){try{if(a&&l.nodeType==1){l.outerHTML=g}else{i(l,g,k)}}catch(h){i(l,g,k)}}else{i(l,g,k)}}})},decode:function(g){var h,i,f;if(/&[^;]+;/.test(g)){h=this.doc.createElement("div");h.innerHTML=g;i=h.firstChild;f="";if(i){do{f+=i.nodeValue}while(i.nextSibling)}return f||g}return g},encode:function(f){return f?(""+f).replace(/[<>&\"]/g,function(h,g){switch(h){case"&":return"&amp;";case'"':return"&quot;";case"<":return"&lt;";case">":return"&gt;"}return h}):f},insertAfter:function(h,g){var f=this;g=f.get(g);return this.run(h,function(k){var j,i;j=g.parentNode;i=g.nextSibling;if(i){j.insertBefore(k,i)}else{j.appendChild(k)}return k})},isBlock:function(f){if(f.nodeType&&f.nodeType!==1){return false}f=f.nodeName||f;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TH|TBODY|TR|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(f)},replace:function(i,h,f){var g=this;if(b(h,"array")){i=i.cloneNode(true)}return g.run(h,function(j){if(f){e(j.childNodes,function(k){i.appendChild(k.cloneNode(true))})}if(g.fixPsuedoLeaks&&j.nodeType===1){j.parentNode.insertBefore(i,j);g.remove(j);return i}return j.parentNode.replaceChild(i,j)})},findCommonAncestor:function(h,f){var i=h,g;while(i){g=f;while(g&&i!=g){g=g.parentNode}if(i==g){break}i=i.parentNode}if(!i&&h.ownerDocument){return h.ownerDocument.documentElement}return i},toHex:function(f){var h=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(f);function g(i){i=parseInt(i).toString(16);return i.length>1?i:"0"+i}if(h){f="#"+g(h[1])+g(h[2])+g(h[3]);return f}return f},getClasses:function(){var l=this,g=[],k,m={},n=l.settings.class_filter,j;if(l.classes){return l.classes}function o(f){e(f.imports,function(i){o(i)});e(f.cssRules||f.rules,function(i){switch(i.type||1){case 1:if(i.selectorText){e(i.selectorText.split(","),function(p){p=p.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(p)||!/\.[\w\-]+$/.test(p)){return}j=p;p=p.replace(/.*\.([a-z0-9_\-]+).*/i,"$1");if(n&&!(p=n(p,j))){return}if(!m[p]){g.push({"class":p});m[p]=1}})}break;case 3:o(i.styleSheet);break}})}try{e(l.doc.styleSheets,o)}catch(h){}if(g.length>0){l.classes=g}return g},run:function(j,i,h){var g=this,k;if(g.doc&&typeof(j)==="string"){j=g.get(j)}if(!j){return false}h=h||this;if(!j.nodeType&&(j.length||j.length===0)){k=[];e(j,function(l,f){if(l){if(typeof(l)=="string"){l=g.doc.getElementById(l)}k.push(i.call(h,l,f))}});return k}return i.call(h,j)},getAttribs:function(g){var f;g=this.get(g);if(!g){return[]}if(a){f=[];if(g.nodeName=="OBJECT"){return g.attributes}if(g.nodeName==="OPTION"&&this.getAttrib(g,"selected")){f.push({specified:1,nodeName:"selected"})}g.cloneNode(false).outerHTML.replace(/<\/?[\w:]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=\w+|>/gi,"").replace(/[\w:]+/gi,function(h){f.push({specified:1,nodeName:h})});return f}return g.attributes},destroy:function(g){var f=this;if(f.events){f.events.destroy()}f.win=f.doc=f.root=f.events=null;if(!g){c.removeUnload(f.destroy)}},createRng:function(){var f=this.doc;return f.createRange?f.createRange():new c.dom.Range(this)},split:function(l,k,o){var p=this,f=p.createRng(),m,j,n;function g(r,q){r=r[q];if(r&&r[q]&&r[q].nodeType==1&&i(r[q])){p.remove(r[q])}}function i(q){q=p.getOuterHTML(q);q=q.replace(/<(img|hr|table)/gi,"-");q=q.replace(/<[^>]+>/g,"");return q.replace(/[ \t\r\n]+|&nbsp;|&#160;/g,"")==""}function h(r){var q=0;while(r.previousSibling){q++;r=r.previousSibling}return q}if(l&&k){f.setStart(l.parentNode,h(l));f.setEnd(k.parentNode,h(k));m=f.extractContents();f=p.createRng();f.setStart(k.parentNode,h(k)+1);f.setEnd(l.parentNode,h(l)+1);j=f.extractContents();n=l.parentNode;g(m,"lastChild");if(!i(m)){n.insertBefore(m,l)}if(o){n.replaceChild(o,k)}else{n.insertBefore(k,l)}g(j,"firstChild");if(!i(j)){n.insertBefore(j,l)}p.remove(l);return o||k}},bind:function(j,f,i,h){var g=this;if(!g.events){g.events=new c.dom.EventUtils()}return g.events.add(j,f,i,h||this)},unbind:function(i,f,h){var g=this;if(!g.events){g.events=new c.dom.EventUtils()}return g.events.remove(i,f,h)},_findSib:function(j,g,h){var i=this,k=g;if(j){if(b(k,"string")){k=function(f){return i.is(f,g)}}for(j=j[h];j;j=j[h]){if(k(j)){return j}}}return null},_isRes:function(f){return/^(top|left|bottom|right|width|height)/i.test(f)||/;\s*(top|left|bottom|right|width|height)/i.test(f)}});c.DOM=new c.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(f){var h=0,c=1,e=2,d=tinymce.extend;function g(m,k){var j,l;if(m.parentNode!=k){return -1}for(l=k.firstChild,j=0;l!=m;l=l.nextSibling){j++}return j}function b(k){var j=0;while(k.previousSibling){j++;k=k.previousSibling}return j}function i(j,k){var l;if(j.nodeType==3){return j}if(k<0){return j}l=j.firstChild;while(l!=null&&k>0){--k;l=l.nextSibling}if(l!=null){return l}return j}function a(k){var j=k.doc;d(this,{dom:k,startContainer:j,startOffset:0,endContainer:j,endOffset:0,collapsed:true,commonAncestorContainer:j,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3})}d(a.prototype,{setStart:function(k,j){this._setEndPoint(true,k,j)},setEnd:function(k,j){this._setEndPoint(false,k,j)},setStartBefore:function(j){this.setStart(j.parentNode,b(j))},setStartAfter:function(j){this.setStart(j.parentNode,b(j)+1)},setEndBefore:function(j){this.setEnd(j.parentNode,b(j))},setEndAfter:function(j){this.setEnd(j.parentNode,b(j)+1)},collapse:function(k){var j=this;if(k){j.endContainer=j.startContainer;j.endOffset=j.startOffset}else{j.startContainer=j.endContainer;j.startOffset=j.endOffset}j.collapsed=true},selectNode:function(j){this.setStartBefore(j);this.setEndAfter(j)},selectNodeContents:function(j){this.setStart(j,0);this.setEnd(j,j.nodeType===1?j.childNodes.length:j.nodeValue.length)},compareBoundaryPoints:function(m,n){var l=this,p=l.startContainer,o=l.startOffset,k=l.endContainer,j=l.endOffset;if(m===0){return l._compareBoundaryPoints(p,o,p,o)}if(m===1){return l._compareBoundaryPoints(p,o,k,j)}if(m===2){return l._compareBoundaryPoints(k,j,k,j)}if(m===3){return l._compareBoundaryPoints(k,j,p,o)}},deleteContents:function(){this._traverse(e)},extractContents:function(){return this._traverse(h)},cloneContents:function(){return this._traverse(c)},insertNode:function(m){var j=this,l,k;if(m.nodeType===3||m.nodeType===4){l=j.startContainer.splitText(j.startOffset);j.startContainer.parentNode.insertBefore(m,l)}else{if(j.startContainer.childNodes.length>0){k=j.startContainer.childNodes[j.startOffset]}j.startContainer.insertBefore(m,k)}},surroundContents:function(l){var j=this,k=j.extractContents();j.insertNode(l);l.appendChild(k);j.selectNode(l)},cloneRange:function(){var j=this;return d(new a(j.dom),{startContainer:j.startContainer,startOffset:j.startOffset,endContainer:j.endContainer,endOffset:j.endOffset,collapsed:j.collapsed,commonAncestorContainer:j.commonAncestorContainer})},_isCollapsed:function(){return(this.startContainer==this.endContainer&&this.startOffset==this.endOffset)},_compareBoundaryPoints:function(m,p,k,o){var q,l,j,r,t,s;if(m==k){if(p==o){return 0}else{if(p<o){return -1}else{return 1}}}q=k;while(q&&q.parentNode!=m){q=q.parentNode}if(q){l=0;j=m.firstChild;while(j!=q&&l<p){l++;j=j.nextSibling}if(p<=l){return -1}else{return 1}}q=m;while(q&&q.parentNode!=k){q=q.parentNode}if(q){l=0;j=k.firstChild;while(j!=q&&l<o){l++;j=j.nextSibling}if(l<o){return -1}else{return 1}}r=this.dom.findCommonAncestor(m,k);t=m;while(t&&t.parentNode!=r){t=t.parentNode}if(!t){t=r}s=k;while(s&&s.parentNode!=r){s=s.parentNode}if(!s){s=r}if(t==s){return 0}j=r.firstChild;while(j){if(j==t){return -1}if(j==s){return 1}j=j.nextSibling}},_setEndPoint:function(k,q,p){var l=this,j,m;if(k){l.startContainer=q;l.startOffset=p}else{l.endContainer=q;l.endOffset=p}j=l.endContainer;while(j.parentNode){j=j.parentNode}m=l.startContainer;while(m.parentNode){m=m.parentNode}if(m!=j){l.collapse(k)}else{if(l._compareBoundaryPoints(l.startContainer,l.startOffset,l.endContainer,l.endOffset)>0){l.collapse(k)}}l.collapsed=l._isCollapsed();l.commonAncestorContainer=l.dom.findCommonAncestor(l.startContainer,l.endContainer)},_traverse:function(r){var s=this,q,m=0,v=0,k,o,l,n,j,u;if(s.startContainer==s.endContainer){return s._traverseSameContainer(r)}for(q=s.endContainer,k=q.parentNode;k!=null;q=k,k=k.parentNode){if(k==s.startContainer){return s._traverseCommonStartContainer(q,r)}++m}for(q=s.startContainer,k=q.parentNode;k!=null;q=k,k=k.parentNode){if(k==s.endContainer){return s._traverseCommonEndContainer(q,r)}++v}o=v-m;l=s.startContainer;while(o>0){l=l.parentNode;o--}n=s.endContainer;while(o<0){n=n.parentNode;o++}for(j=l.parentNode,u=n.parentNode;j!=u;j=j.parentNode,u=u.parentNode){l=j;n=u}return s._traverseCommonAncestors(l,n,r)},_traverseSameContainer:function(o){var r=this,q,u,j,k,l,p,m;if(o!=e){q=r.dom.doc.createDocumentFragment()}if(r.startOffset==r.endOffset){return q}if(r.startContainer.nodeType==3){u=r.startContainer.nodeValue;j=u.substring(r.startOffset,r.endOffset);if(o!=c){r.startContainer.deleteData(r.startOffset,r.endOffset-r.startOffset);r.collapse(true)}if(o==e){return null}q.appendChild(r.dom.doc.createTextNode(j));return q}k=i(r.startContainer,r.startOffset);l=r.endOffset-r.startOffset;while(l>0){p=k.nextSibling;m=r._traverseFullySelected(k,o);if(q){q.appendChild(m)}--l;k=p}if(o!=c){r.collapse(true)}return q},_traverseCommonStartContainer:function(j,p){var s=this,r,k,l,m,q,o;if(p!=e){r=s.dom.doc.createDocumentFragment()}k=s._traverseRightBoundary(j,p);if(r){r.appendChild(k)}l=g(j,s.startContainer);m=l-s.startOffset;if(m<=0){if(p!=c){s.setEndBefore(j);s.collapse(false)}return r}k=j.previousSibling;while(m>0){q=k.previousSibling;o=s._traverseFullySelected(k,p);if(r){r.insertBefore(o,r.firstChild)}--m;k=q}if(p!=c){s.setEndBefore(j);s.collapse(false)}return r},_traverseCommonEndContainer:function(m,p){var s=this,r,o,j,k,q,l;if(p!=e){r=s.dom.doc.createDocumentFragment()}j=s._traverseLeftBoundary(m,p);if(r){r.appendChild(j)}o=g(m,s.endContainer);++o;k=s.endOffset-o;j=m.nextSibling;while(k>0){q=j.nextSibling;l=s._traverseFullySelected(j,p);if(r){r.appendChild(l)}--k;j=q}if(p!=c){s.setStartAfter(m);s.collapse(true)}return r},_traverseCommonAncestors:function(p,j,s){var w=this,l,v,o,q,r,k,u,m;if(s!=e){v=w.dom.doc.createDocumentFragment()}l=w._traverseLeftBoundary(p,s);if(v){v.appendChild(l)}o=p.parentNode;q=g(p,o);r=g(j,o);++q;k=r-q;u=p.nextSibling;while(k>0){m=u.nextSibling;l=w._traverseFullySelected(u,s);if(v){v.appendChild(l)}u=m;--k}l=w._traverseRightBoundary(j,s);if(v){v.appendChild(l)}if(s!=c){w.setStartAfter(p);w.collapse(true)}return v},_traverseRightBoundary:function(p,q){var s=this,l=i(s.endContainer,s.endOffset-1),r,o,n,j,k;var m=l!=s.endContainer;if(l==p){return s._traverseNode(l,m,false,q)}r=l.parentNode;o=s._traverseNode(r,false,false,q);while(r!=null){while(l!=null){n=l.previousSibling;j=s._traverseNode(l,m,false,q);if(q!=e){o.insertBefore(j,o.firstChild)}m=true;l=n}if(r==p){return o}l=r.previousSibling;r=r.parentNode;k=s._traverseNode(r,false,false,q);if(q!=e){k.appendChild(o)}o=k}return null},_traverseLeftBoundary:function(p,q){var s=this,m=i(s.startContainer,s.startOffset);var n=m!=s.startContainer,r,o,l,j,k;if(m==p){return s._traverseNode(m,n,true,q)}r=m.parentNode;o=s._traverseNode(r,false,true,q);while(r!=null){while(m!=null){l=m.nextSibling;j=s._traverseNode(m,n,true,q);if(q!=e){o.appendChild(j)}n=true;m=l}if(r==p){return o}m=r.nextSibling;r=r.parentNode;k=s._traverseNode(r,false,true,q);if(q!=e){k.appendChild(o)}o=k}return null},_traverseNode:function(j,o,r,s){var u=this,m,l,p,k,q;if(o){return u._traverseFullySelected(j,s)}if(j.nodeType==3){m=j.nodeValue;if(r){k=u.startOffset;l=m.substring(k);p=m.substring(0,k)}else{k=u.endOffset;l=m.substring(0,k);p=m.substring(k)}if(s!=c){j.nodeValue=p}if(s==e){return null}q=j.cloneNode(false);q.nodeValue=l;return q}if(s==e){return null}return j.cloneNode(false)},_traverseFullySelected:function(l,k){var j=this;if(k!=e){return k==c?l.cloneNode(true):l}l.parentNode.removeChild(l);return null}});f.Range=a})(tinymce.dom);(function(){function a(e){var d=this,h="\uFEFF",b,g;function c(j,i){if(j&&i){if(j.item&&i.item&&j.item(0)===i.item(0)){return 1}if(j.isEqual&&i.isEqual&&i.isEqual(j)){return 1}}return 0}function f(){var m=e.dom,j=e.getRng(),s=m.createRng(),p,k,n,q,o,l;function i(v){var t=v.parentNode.childNodes,u;for(u=t.length-1;u>=0;u--){if(t[u]==v){return u}}return -1}function r(v){var t=j.duplicate(),B,y,u,w,x=0,z=0,A,C;t.collapse(v);B=t.parentElement();t.pasteHTML(h);u=B.childNodes;for(y=0;y<u.length;y++){w=u[y];if(y>0&&(w.nodeType!==3||u[y-1].nodeType!==3)){z++}if(w.nodeType===3){A=w.nodeValue.indexOf(h);if(A!==-1){x+=A;break}x+=w.nodeValue.length}else{x=0}}t.moveStart("character",-1);t.text="";return{index:z,offset:x,parent:B}}n=j.item?j.item(0):j.parentElement();if(n.ownerDocument!=m.doc){return s}if(j.item||!n.hasChildNodes()){s.setStart(n.parentNode,i(n));s.setEnd(s.startContainer,s.startOffset+1);return s}l=e.isCollapsed();p=r(true);k=r(false);p.parent.normalize();k.parent.normalize();q=p.parent.childNodes[Math.min(p.index,p.parent.childNodes.length-1)];if(q.nodeType!=3){s.setStart(p.parent,p.index)}else{s.setStart(p.parent.childNodes[p.index],p.offset)}o=k.parent.childNodes[Math.min(k.index,k.parent.childNodes.length-1)];if(o.nodeType!=3){if(!l){k.index++}s.setEnd(k.parent,k.index)}else{s.setEnd(k.parent.childNodes[k.index],k.offset)}if(!l){q=s.startContainer;if(q.nodeType==1){s.setStart(q,Math.min(s.startOffset,q.childNodes.length))}o=s.endContainer;if(o.nodeType==1){s.setEnd(o,Math.min(s.endOffset,o.childNodes.length))}}d.addRange(s);return s}this.addRange=function(j){var o,m=e.dom.doc.body,p,k,q,l,n,i;q=j.startContainer;l=j.startOffset;n=j.endContainer;i=j.endOffset;o=m.createTextRange();q=q.nodeType==1?q.childNodes[Math.min(l,q.childNodes.length-1)]:q;n=n.nodeType==1?n.childNodes[Math.min(l==i?i:i-1,n.childNodes.length-1)]:n;if(q==n&&q.nodeType==1){if(/^(IMG|TABLE)$/.test(q.nodeName)&&l!=i){o=m.createControlRange();o.addElement(q)}else{o=m.createTextRange();if(!q.hasChildNodes()&&q.canHaveHTML){q.innerHTML=h}o.moveToElementText(q);if(q.innerHTML==h){o.collapse(true);q.removeChild(q.firstChild)}}if(l==i){o.collapse(i<=j.endContainer.childNodes.length-1)}o.select();return}function r(t,v){var u,s,w;if(t.nodeType!=3){return -1}u=t.nodeValue;s=m.createTextRange();t.nodeValue=u.substring(0,v)+h+u.substring(v);s.moveToElementText(t.parentNode);s.findText(h);w=Math.abs(s.moveStart("character",-1048575));t.nodeValue=u;return w}if(j.collapsed){pos=r(q,l);o=m.createTextRange();o.move("character",pos);o.select();return}else{if(q==n&&q.nodeType==3){p=r(q,l);o=m.createTextRange();o.move("character",p);o.moveEnd("character",i-l);o.select();return}p=r(q,l);k=r(n,i);o=m.createTextRange();if(p==-1){o.moveToElementText(q);p=0}else{o.move("character",p)}tmpRng=m.createTextRange();if(k==-1){tmpRng.moveToElementText(n)}else{tmpRng.move("character",k)}o.setEndPoint("EndToEnd",tmpRng);o.select();return}};this.getRangeAt=function(){if(!b||!c(g,e.getRng())){b=f();g=e.getRng()}return b};this.destroy=function(){g=b=null}}tinymce.dom.TridentSelection=a})();(function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,i=0,d=Object.prototype.toString,n=false;var b=function(D,t,A,v){A=A||[];var e=t=t||document;if(t.nodeType!==1&&t.nodeType!==9){return[]}if(!D||typeof D!=="string"){return A}var B=[],C,y,G,F,z,s,r=true,w=o(t);p.lastIndex=0;while((C=p.exec(D))!==null){B.push(C[1]);if(C[2]){s=RegExp.rightContext;break}}if(B.length>1&&j.exec(D)){if(B.length===2&&f.relative[B[0]]){y=g(B[0]+B[1],t)}else{y=f.relative[B[0]]?[t]:b(B.shift(),t);while(B.length){D=B.shift();if(f.relative[D]){D+=B.shift()}y=g(D,y)}}}else{if(!v&&B.length>1&&t.nodeType===9&&!w&&f.match.ID.test(B[0])&&!f.match.ID.test(B[B.length-1])){var H=b.find(B.shift(),t,w);t=H.expr?b.filter(H.expr,H.set)[0]:H.set[0]}if(t){var H=v?{expr:B.pop(),set:a(v)}:b.find(B.pop(),B.length===1&&(B[0]==="~"||B[0]==="+")&&t.parentNode?t.parentNode:t,w);y=H.expr?b.filter(H.expr,H.set):H.set;if(B.length>0){G=a(y)}else{r=false}while(B.length){var u=B.pop(),x=u;if(!f.relative[u]){u=""}else{x=B.pop()}if(x==null){x=t}f.relative[u](G,x,w)}}else{G=B=[]}}if(!G){G=y}if(!G){throw"Syntax error, unrecognized expression: "+(u||D)}if(d.call(G)==="[object Array]"){if(!r){A.push.apply(A,G)}else{if(t&&t.nodeType===1){for(var E=0;G[E]!=null;E++){if(G[E]&&(G[E]===true||G[E].nodeType===1&&h(t,G[E]))){A.push(y[E])}}}else{for(var E=0;G[E]!=null;E++){if(G[E]&&G[E].nodeType===1){A.push(y[E])}}}}}else{a(G,A)}if(s){b(s,e,A,v);b.uniqueSort(A)}return A};b.uniqueSort=function(r){if(c){n=false;r.sort(c);if(n){for(var e=1;e<r.length;e++){if(r[e]===r[e-1]){r.splice(e--,1)}}}}};b.matches=function(e,r){return b(e,null,null,r)};b.find=function(x,e,y){var w,u;if(!x){return[]}for(var t=0,s=f.order.length;t<s;t++){var v=f.order[t],u;if((u=f.match[v].exec(x))){var r=RegExp.leftContext;if(r.substr(r.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");w=f.find[v](u,e,y);if(w!=null){x=x.replace(f.match[v],"");break}}}}if(!w){w=e.getElementsByTagName("*")}return{set:w,expr:x}};b.filter=function(A,z,D,t){var s=A,F=[],x=z,v,e,w=z&&z[0]&&o(z[0]);while(A&&z.length){for(var y in f.filter){if((v=f.match[y].exec(A))!=null){var r=f.filter[y],E,C;e=false;if(x==F){F=[]}if(f.preFilter[y]){v=f.preFilter[y](v,x,D,F,t,w);if(!v){e=E=true}else{if(v===true){continue}}}if(v){for(var u=0;(C=x[u])!=null;u++){if(C){E=r(C,v,u,x);var B=t^!!E;if(D&&E!=null){if(B){e=true}else{x[u]=false}}else{if(B){F.push(C);e=true}}}}}if(E!==undefined){if(!D){x=F}A=A.replace(f.match[y],"");if(!e){return[]}break}}}if(A==s){if(e==null){throw"Syntax error, unrecognized expression: "+A}else{break}}s=A}return x};var f=b.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(x,e,w){var u=typeof e==="string",y=u&&!/\W/.test(e),v=u&&!y;if(y&&!w){e=e.toUpperCase()}for(var t=0,s=x.length,r;t<s;t++){if((r=x[t])){while((r=r.previousSibling)&&r.nodeType!==1){}x[t]=v||r&&r.nodeName===e?r||false:r===e}}if(v){b.filter(e,x,true)}},">":function(w,r,x){var u=typeof r==="string";if(u&&!/\W/.test(r)){r=x?r:r.toUpperCase();for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){var t=v.parentNode;w[s]=t.nodeName===r?t:false}}}else{for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){w[s]=u?v.parentNode:v.parentNode===r}}if(u){b.filter(r,w,true)}}},"":function(t,r,v){var s=i++,e=q;if(!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("parentNode",r,s,t,u,v)},"~":function(t,r,v){var s=i++,e=q;if(typeof r==="string"&&!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("previousSibling",r,s,t,u,v)}},find:{ID:function(r,s,t){if(typeof s.getElementById!=="undefined"&&!t){var e=s.getElementById(r[1]);return e?[e]:[]}},NAME:function(s,v,w){if(typeof v.getElementsByName!=="undefined"){var r=[],u=v.getElementsByName(s[1]);for(var t=0,e=u.length;t<e;t++){if(u[t].getAttribute("name")===s[1]){r.push(u[t])}}return r.length===0?null:r}},TAG:function(e,r){return r.getElementsByTagName(e[1])}},preFilter:{CLASS:function(t,r,s,e,w,x){t=" "+t[1].replace(/\\/g,"")+" ";if(x){return t}for(var u=0,v;(v=r[u])!=null;u++){if(v){if(w^(v.className&&(" "+v.className+" ").indexOf(t)>=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){for(var s=0;e[s]===false;s++){}return e[s]&&o(e[s])?r[1]:r[1].toUpperCase()},CHILD:function(e){if(e[1]=="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]=="even"&&"2n"||e[2]=="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=i++;return e},ATTR:function(u,r,s,e,v,w){var t=u[1].replace(/\\/g,"");if(!w&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if(u[3].match(p).length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toUpperCase()==="BUTTON"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return r<e[3]-0},gt:function(s,r,e){return r>e[3]-0},nth:function(s,r,e){return e[3]-0==r},eq:function(s,r,e){return e[3]-0==r}},filter:{PSEUDO:function(w,s,t,x){var r=s[1],u=f.filters[r];if(u){return u(w,t,s,x)}else{if(r==="contains"){return(w.textContent||w.innerText||"").indexOf(s[3])>=0}else{if(r==="not"){var v=s[3];for(var t=0,e=v.length;t<e;t++){if(v[t]===w){return false}}return true}}}},CHILD:function(e,t){var w=t[1],r=e;switch(w){case"only":case"first":while(r=r.previousSibling){if(r.nodeType===1){return false}}if(w=="first"){return true}r=e;case"last":while(r=r.nextSibling){if(r.nodeType===1){return false}}return true;case"nth":var s=t[2],z=t[3];if(s==1&&z==0){return true}var v=t[0],y=e.parentNode;if(y&&(y.sizcache!==v||!e.nodeIndex)){var u=0;for(r=y.firstChild;r;r=r.nextSibling){if(r.nodeType===1){r.nodeIndex=++u}}y.sizcache=v}var x=e.nodeIndex-z;if(s==0){return x==0}else{return(x%s==0&&x/s>=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),w=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?w===r:u==="*="?w.indexOf(r)>=0:u==="~="?(" "+w+" ").indexOf(r)>=0:!r?w&&e!==false:u==="!="?w!=r:u==="^="?w.indexOf(r)===0:u==="$="?w.substr(w.length-r.length)===r:u==="|="?w===r||w.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var j=f.match.POS;for(var l in f.match){f.match[l]=new RegExp(f.match[l].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var a=function(r,e){r=Array.prototype.slice.call(r);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(k){a=function(u,t){var r=t||[];if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var s=0,e=u.length;s<e;s++){r.push(u[s])}}else{for(var s=0;u[s];s++){r.push(u[s])}}}return r}}var c;if(document.documentElement.compareDocumentPosition){c=function(r,e){var s=r.compareDocumentPosition(e)&4?-1:r===e?0:1;if(s===0){n=true}return s}}else{if("sourceIndex" in document.documentElement){c=function(r,e){var s=r.sourceIndex-e.sourceIndex;if(s===0){n=true}return s}}else{if(document.createRange){c=function(t,r){var s=t.ownerDocument.createRange(),e=r.ownerDocument.createRange();s.setStart(t,0);s.setEnd(t,0);e.setStart(r,0);e.setEnd(r,0);var u=s.compareBoundaryPoints(Range.START_TO_END,e);if(u===0){n=true}return u}}}}(function(){var r=document.createElement("div"),s="script"+(new Date).getTime();r.innerHTML="<a name='"+s+"'/>";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(!!document.getElementById(s)){f.find.ID=function(u,v,w){if(typeof v.getElementById!=="undefined"&&!w){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r)})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="<p class='TEST'></p>";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(w,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!o(v)){try{return a(v.querySelectorAll(w),t)}catch(x){}}return e(w,v,t,u)};for(var r in e){b[r]=e[r]}})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}}})()}function m(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1&&!z){e.sizcache=v;e.sizset=t}if(e.nodeName===w){u=e;break}e=e[r]}A[t]=u}}}function q(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1){if(!z){e.sizcache=v;e.sizset=t}if(typeof w!=="string"){if(e===w){u=true;break}}else{if(b.filter(w,[e]).length>0){u=e;break}}}e=e[r]}A[t]=u}}}var h=document.compareDocumentPosition?function(r,e){return r.compareDocumentPosition(e)&16}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};var o=function(e){return e.nodeType===9&&e.documentElement.nodeName!=="HTML"||!!e.ownerDocument&&e.ownerDocument.documentElement.nodeName!=="HTML"};var g=function(e,x){var t=[],u="",v,s=x.nodeType?[x]:x;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var w=0,r=s.length;w<r;w++){b(e,s[w],t)}return b.filter(u,t)};window.tinymce.dom.Sizzle=b})();(function(d){var f=d.each,c=d.DOM,b=d.isIE,e=d.isWebKit,a;d.create("tinymce.dom.EventUtils",{EventUtils:function(){this.inits=[];this.events=[]},add:function(m,p,l,j){var g,h=this,i=h.events,k;if(p instanceof Array){k=[];f(p,function(o){k.push(h.add(m,o,l,j))});return k}if(m&&m.hasOwnProperty&&m instanceof Array){k=[];f(m,function(n){n=c.get(n);k.push(h.add(n,p,l,j))});return k}m=c.get(m);if(!m){return}g=function(n){if(h.disabled){return}n=n||window.event;if(n&&b){if(!n.target){n.target=n.srcElement}d.extend(n,h._stoppers)}if(!j){return l(n)}return l.call(j,n)};if(p=="unload"){d.unloads.unshift({func:g});return g}if(p=="init"){if(h.domLoaded){g()}else{h.inits.push(g)}return g}i.push({obj:m,name:p,func:l,cfunc:g,scope:j});h._add(m,p,g);return l},remove:function(l,m,k){var h=this,g=h.events,i=false,j;if(l&&l.hasOwnProperty&&l instanceof Array){j=[];f(l,function(n){n=c.get(n);j.push(h.remove(n,m,k))});return j}l=c.get(l);f(g,function(o,n){if(o.obj==l&&o.name==m&&(!k||(o.func==k||o.cfunc==k))){g.splice(n,1);h._remove(l,m,o.cfunc);i=true;return false}});return i},clear:function(l){var j=this,g=j.events,h,k;if(l){l=c.get(l);for(h=g.length-1;h>=0;h--){k=g[h];if(k.obj===l){j._remove(k.obj,k.name,k.cfunc);k.obj=k.cfunc=null;g.splice(h,1)}}}},cancel:function(g){if(!g){return false}this.stop(g);return this.prevent(g)},stop:function(g){if(g.stopPropagation){g.stopPropagation()}else{g.cancelBubble=true}return false},prevent:function(g){if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false},destroy:function(){var g=this;f(g.events,function(j,h){g._remove(j.obj,j.name,j.cfunc);j.obj=j.cfunc=null});g.events=[];g=null},_add:function(h,i,g){if(h.attachEvent){h.attachEvent("on"+i,g)}else{if(h.addEventListener){h.addEventListener(i,g,false)}else{h["on"+i]=g}}},_remove:function(i,j,h){if(i){try{if(i.detachEvent){i.detachEvent("on"+j,h)}else{if(i.removeEventListener){i.removeEventListener(j,h,false)}else{i["on"+j]=null}}}catch(g){}}},_pageInit:function(h){var g=this;if(g.domLoaded){return}g.domLoaded=true;f(g.inits,function(i){i()});g.inits=[]},_wait:function(i){var g=this,h=i.document;if(i.tinyMCE_GZ&&tinyMCE_GZ.loaded){g.domLoaded=1;return}if(h.attachEvent){h.attachEvent("onreadystatechange",function(){if(h.readyState==="complete"){h.detachEvent("onreadystatechange",arguments.callee);g._pageInit(i)}});if(h.documentElement.doScroll&&i==i.top){(function(){if(g.domLoaded){return}try{h.documentElement.doScroll("left")}catch(j){setTimeout(arguments.callee,0);return}g._pageInit(i)})()}}else{if(h.addEventListener){g._add(i,"DOMContentLoaded",function(){g._pageInit(i)})}}g._add(i,"load",function(){g._pageInit(i)})},_stoppers:{preventDefault:function(){this.returnValue=false},stopPropagation:function(){this.cancelBubble=true}}});a=d.dom.Event=new d.dom.EventUtils();a._wait(window);d.addUnload(function(){a.destroy()})})(tinymce);(function(a){var b=a.each;a.create("tinymce.dom.Element",{Element:function(g,e){var c=this,f,d;e=e||{};c.id=g;c.dom=f=e.dom||a.DOM;c.settings=e;if(!a.isIE){d=c.dom.get(c.id)}b(["getPos","getRect","getParent","add","setStyle","getStyle","setStyles","setAttrib","setAttribs","getAttrib","addClass","removeClass","hasClass","getOuterHTML","setOuterHTML","remove","show","hide","isHidden","setHTML","get"],function(h){c[h]=function(){var j=[g],k;for(k=0;k<arguments.length;k++){j.push(arguments[k])}j=f[h].apply(f,j);c.update(h);return j}})},on:function(e,d,c){return a.dom.Event.add(this.id,e,d,c)},getXY:function(){return{x:parseInt(this.getStyle("left")),y:parseInt(this.getStyle("top"))}},getSize:function(){var c=this.dom.get(this.id);return{w:parseInt(this.getStyle("width")||c.clientWidth),h:parseInt(this.getStyle("height")||c.clientHeight)}},moveTo:function(c,d){this.setStyles({left:c,top:d})},moveBy:function(c,e){var d=this.getXY();this.moveTo(d.x+c,d.y+e)},resizeTo:function(c,d){this.setStyles({width:c,height:d})},resizeBy:function(c,e){var d=this.getSize();this.resizeTo(d.w+c,d.h+e)},update:function(d){var e=this,c,f=e.dom;if(a.isIE6&&e.settings.blocker){d=d||"";if(d.indexOf("get")===0||d.indexOf("has")===0||d.indexOf("is")===0){return}if(d=="remove"){f.remove(e.blocker);return}if(!e.blocker){e.blocker=f.uniqueId();c=f.add(e.settings.container||f.getRoot(),"iframe",{id:e.blocker,style:"position:absolute;",frameBorder:0,src:'javascript:""'});f.setStyle(c,"opacity",0)}else{c=f.get(e.blocker)}f.setStyle(c,"left",e.getStyle("left",1));f.setStyle(c,"top",e.getStyle("top",1));f.setStyle(c,"width",e.getStyle("width",1));f.setStyle(c,"height",e.getStyle("height",1));f.setStyle(c,"display",e.getStyle("display",1));f.setStyle(c,"zIndex",parseInt(e.getStyle("zIndex",1)||0)-1)}}})})(tinymce);(function(c){function e(f){return f.replace(/[\n\r]+/g,"")}var b=c.is,a=c.isIE,d=c.each;c.create("tinymce.dom.Selection",{Selection:function(i,h,g){var f=this;f.dom=i;f.win=h;f.serializer=g;d(["onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent"],function(j){f[j]=new c.util.Dispatcher(f)});if(!f.win.getSelection){f.tridentSel=new c.dom.TridentSelection(f)}c.addUnload(f.destroy,f)},getContent:function(g){var f=this,h=f.getRng(),l=f.dom.create("body"),j=f.getSel(),i,k,m;g=g||{};i=k="";g.get=true;g.format=g.format||"html";f.onBeforeGetContent.dispatch(f,g);if(g.format=="text"){return f.isCollapsed()?"":(h.text||(j.toString?j.toString():""))}if(h.cloneContents){m=h.cloneContents();if(m){l.appendChild(m)}}else{if(b(h.item)||b(h.htmlText)){l.innerHTML=h.item?h.item(0).outerHTML:h.htmlText}else{l.innerHTML=h.toString()}}if(/^\s/.test(l.innerHTML)){i=" "}if(/\s+$/.test(l.innerHTML)){k=" "}g.getInner=true;g.content=f.isCollapsed()?"":i+f.serializer.serialize(l,g)+k;f.onGetContent.dispatch(f,g);return g.content},setContent:function(i,g){var f=this,j=f.getRng(),l,k=f.win.document;g=g||{format:"html"};g.set=true;i=g.content=f.dom.processHTML(i);f.onBeforeSetContent.dispatch(f,g);i=g.content;if(j.insertNode){i+='<span id="__caret">_</span>';j.deleteContents();j.insertNode(f.getRng().createContextualFragment(i));l=f.dom.get("__caret");j=k.createRange();j.setStartBefore(l);j.setEndAfter(l);f.setRng(j);f.dom.remove("__caret")}else{if(j.item){k.execCommand("Delete",false,null);j=f.getRng()}j.pasteHTML(i)}f.onSetContent.dispatch(f,g)},getStart:function(){var f=this,g=f.getRng(),h;if(a){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(1);h=g.parentElement();if(h&&h.nodeName=="BODY"){return h.firstChild}return h}else{h=g.startContainer;if(h.nodeName=="BODY"){return h.firstChild}return f.dom.getParent(h,"*")}},getEnd:function(){var f=this,g=f.getRng(),h;if(a){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(0);h=g.parentElement();if(h&&h.nodeName=="BODY"){return h.lastChild}return h}else{h=g.endContainer;if(h.nodeName=="BODY"){return h.lastChild}return f.dom.getParent(h,"*")}},getBookmark:function(x){var j=this,m=j.getRng(),f,n,l,u=j.dom.getViewPort(j.win),v,p,z,o,w=-16777215,k,h=j.dom.getRoot(),g=0,i=0,y;n=u.x;l=u.y;if(x){return{rng:m,scrollX:n,scrollY:l}}if(a){if(m.item){v=m.item(0);d(j.dom.select(v.nodeName),function(s,r){if(v==s){p=r;return false}});return{tag:v.nodeName,index:p,scrollX:n,scrollY:l}}f=j.dom.doc.body.createTextRange();f.moveToElementText(h);f.collapse(true);z=Math.abs(f.move("character",w));f=m.duplicate();f.collapse(true);p=Math.abs(f.move("character",w));f=m.duplicate();f.collapse(false);o=Math.abs(f.move("character",w))-p;return{start:p-z,length:o,scrollX:n,scrollY:l}}v=j.getNode();k=j.getSel();if(!k){return null}if(v&&v.nodeName=="IMG"){return{scrollX:n,scrollY:l}}function q(A,D,t){var s=j.dom.doc.createTreeWalker(A,NodeFilter.SHOW_TEXT,null,false),E,B=0,C={};while((E=s.nextNode())!=null){if(E==D){C.start=B}if(E==t){C.end=B;return C}B+=e(E.nodeValue||"").length}return null}if(k.anchorNode==k.focusNode&&k.anchorOffset==k.focusOffset){v=q(h,k.anchorNode,k.focusNode);if(!v){return{scrollX:n,scrollY:l}}e(k.anchorNode.nodeValue||"").replace(/^\s+/,function(r){g=r.length});return{start:Math.max(v.start+k.anchorOffset-g,0),end:Math.max(v.end+k.focusOffset-g,0),scrollX:n,scrollY:l,beg:k.anchorOffset-g==0}}else{v=q(h,m.startContainer,m.endContainer);if(!v){return{scrollX:n,scrollY:l}}return{start:Math.max(v.start+m.startOffset-g,0),end:Math.max(v.end+m.endOffset-i,0),scrollX:n,scrollY:l,beg:m.startOffset-g==0}}},moveToBookmark:function(n){var o=this,g=o.getRng(),p=o.getSel(),j=o.dom.getRoot(),m,h,k;function i(q,t,D){var B=o.dom.doc.createTreeWalker(q,NodeFilter.SHOW_TEXT,null,false),x,s=0,A={},u,C,z,y;while((x=B.nextNode())!=null){z=y=0;k=x.nodeValue||"";h=e(k).length;s+=h;if(s>=t&&!A.startNode){u=t-(s-h);if(n.beg&&u>=h){continue}A.startNode=x;A.startOffset=u+y}if(s>=D){A.endNode=x;A.endOffset=D-(s-h)+y;return A}}return null}if(!n){return false}o.win.scrollTo(n.scrollX,n.scrollY);if(a){o.tridentSel.destroy();if(g=n.rng){try{g.select()}catch(l){}return true}o.win.focus();if(n.tag){g=j.createControlRange();d(o.dom.select(n.tag),function(r,q){if(q==n.index){g.addElement(r)}})}else{try{if(n.start<0){return true}g=p.createRange();g.moveToElementText(j);g.collapse(true);g.moveStart("character",n.start);g.moveEnd("character",n.length)}catch(f){return true}}try{g.select()}catch(l){}return true}if(!p){return false}if(n.rng){p.removeAllRanges();p.addRange(n.rng)}else{if(b(n.start)&&b(n.end)){try{m=i(j,n.start,n.end);if(m){g=o.dom.doc.createRange();g.setStart(m.startNode,m.startOffset);g.setEnd(m.endNode,m.endOffset);p.removeAllRanges();p.addRange(g)}if(!c.isOpera){o.win.focus()}}catch(l){}}}},select:function(g,l){var p=this,f=p.getRng(),q=p.getSel(),o,m,k,j=p.win.document;function h(u,t){var s,r;if(u){s=j.createTreeWalker(u,NodeFilter.SHOW_TEXT,null,false);while(u=s.nextNode()){r=u;if(c.trim(u.nodeValue).length!=0){if(t){return u}else{r=u}}}}return r}if(a){try{o=j.body;if(/^(IMG|TABLE)$/.test(g.nodeName)){f=o.createControlRange();f.addElement(g)}else{f=o.createTextRange();f.moveToElementText(g)}f.select()}catch(i){}}else{if(l){m=h(g,1)||p.dom.select("br:first",g)[0];k=h(g,0)||p.dom.select("br:last",g)[0];if(m&&k){f=j.createRange();if(m.nodeName=="BR"){f.setStartBefore(m)}else{f.setStart(m,0)}if(k.nodeName=="BR"){f.setEndBefore(k)}else{f.setEnd(k,k.nodeValue.length)}}else{f.selectNode(g)}}else{f.selectNode(g)}p.setRng(f)}return g},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}return !g||h.boundingWidth==0||h.collapsed},collapse:function(f){var g=this,h=g.getRng(),i;if(h.item){i=h.item(0);h=this.win.document.body.createTextRange();h.moveToElementText(i)}h.collapse(!!f);g.setRng(h)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(j){var g=this,h,i;if(j&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():g.win.document.createRange())}}catch(f){}if(!i){i=a?g.win.document.body.createTextRange():g.win.document.createRange()}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){h.removeAllRanges();h.addRange(i)}}else{if(i.cloneRange){g.tridentSel.addRange(i);return}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var f=this,h=f.getRng(),g=f.getSel(),i;if(!a){if(!h){return f.dom.getRoot()}i=h.commonAncestorContainer;if(!h.collapsed){if(c.isWebKit&&g.anchorNode&&g.anchorNode.nodeType==1){return g.anchorNode.childNodes[g.anchorOffset]}if(h.startContainer==h.endContainer){if(h.startOffset-h.endOffset<2){if(h.startContainer.hasChildNodes()){i=h.startContainer.childNodes[h.startOffset]}}}}return f.dom.getParent(i,"*")}return h.item?h.item(0):h.parentElement()},getSelectedBlocks:function(g,f){var i=this,j=i.dom,m,h,l,k=[];m=j.getParent(g||i.getStart(),j.isBlock);h=j.getParent(f||i.getEnd(),j.isBlock);if(m){k.push(m)}if(m&&h&&m!=h){l=m;while((l=l.nextSibling)&&l!=h){if(j.isBlock(l)){k.push(l)}}}if(h&&m!=h){k.push(h)}return k},destroy:function(g){var f=this;f.win=null;if(f.tridentSel){f.tridentSel.destroy()}if(!g){c.removeUnload(f.destroy)}}})})(tinymce);(function(a){a.create("tinymce.dom.XMLWriter",{node:null,XMLWriter:function(c){function b(){var e=document.implementation;if(!e||!e.createDocument){try{return new ActiveXObject("MSXML2.DOMDocument")}catch(d){}try{return new ActiveXObject("Microsoft.XmlDom")}catch(d){}}else{return e.createDocument("","",null)}}this.doc=b();this.valid=a.isOpera||a.isWebKit;this.reset()},reset:function(){var b=this,c=b.doc;if(c.firstChild){c.removeChild(c.firstChild)}b.node=c.appendChild(c.createElement("html"))},writeStartElement:function(c){var b=this;b.node=b.node.appendChild(b.doc.createElement(c))},writeAttribute:function(c,b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.setAttribute(c,b)},writeEndElement:function(){this.node=this.node.parentNode},writeFullEndElement:function(){var b=this,c=b.node;c.appendChild(b.doc.createTextNode(""));b.node=c.parentNode},writeText:function(b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.appendChild(this.doc.createTextNode(b))},writeCDATA:function(b){this.node.appendChild(this.doc.createCDATASection(b))},writeComment:function(b){if(a.isIE){b=b.replace(/^\-|\-$/g," ")}this.node.appendChild(this.doc.createComment(b.replace(/\-\-/g," ")))},getContent:function(){var b;b=this.doc.xml||new XMLSerializer().serializeToString(this.doc);b=b.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g,"");b=b.replace(/ ?\/>/g," />");if(this.valid){b=b.replace(/\%MCGT%/g,"&gt;")}return b}})})(tinymce);(function(a){a.create("tinymce.dom.StringWriter",{str:null,tags:null,count:0,settings:null,indent:null,StringWriter:function(b){this.settings=a.extend({indent_char:" ",indentation:0},b);this.reset()},reset:function(){this.indent="";this.str="";this.tags=[];this.count=0},writeStartElement:function(b){this._writeAttributesEnd();this.writeRaw("<"+b);this.tags.push(b);this.inAttr=true;this.count++;this.elementCount=this.count},writeAttribute:function(d,b){var c=this;c.writeRaw(" "+c.encode(d)+'="'+c.encode(b)+'"')},writeEndElement:function(){var b;if(this.tags.length>0){b=this.tags.pop();if(this._writeAttributesEnd(1)){this.writeRaw("</"+b+">")}if(this.settings.indentation>0){this.writeRaw("\n")}}},writeFullEndElement:function(){if(this.tags.length>0){this._writeAttributesEnd();this.writeRaw("</"+this.tags.pop()+">");if(this.settings.indentation>0){this.writeRaw("\n")}}},writeText:function(b){this._writeAttributesEnd();this.writeRaw(this.encode(b));this.count++},writeCDATA:function(b){this._writeAttributesEnd();this.writeRaw("<![CDATA["+b+"]]>");this.count++},writeComment:function(b){this._writeAttributesEnd();this.writeRaw("<!-- "+b+"-->");this.count++},writeRaw:function(b){this.str+=b},encode:function(b){return b.replace(/[<>&"]/g,function(c){switch(c){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case'"':return"&quot;"}return c})},getContent:function(){return this.str},_writeAttributesEnd:function(b){if(!this.inAttr){return}this.inAttr=false;if(b&&this.elementCount==this.count){this.writeRaw(" />");return false}this.writeRaw(">");return true}})})(tinymce);(function(e){var g=e.extend,f=e.each,b=e.util.Dispatcher,d=e.isIE,a=e.isGecko;function c(h){return h.replace(/([?+*])/g,".$1")}e.create("tinymce.dom.Serializer",{Serializer:function(j){var i=this;i.key=0;i.onPreProcess=new b(i);i.onPostProcess=new b(i);try{i.writer=new e.dom.XMLWriter()}catch(h){i.writer=new e.dom.StringWriter()}i.settings=j=g({dom:e.DOM,valid_nodes:0,node_filter:0,attr_filter:0,invalid_attrs:/^(mce_|_moz_|sizset|sizcache)/,closed:/^(br|hr|input|meta|img|link|param|area)$/,entity_encoding:"named",entities:"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,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",valid_elements:"*[*]",extended_valid_elements:0,valid_child_elements:0,invalid_elements:0,fix_table_elements:1,fix_list_elements:true,fix_content_duplication:true,convert_fonts_to_spans:false,font_size_classes:0,font_size_style_values:0,apply_source_formatting:0,indent_mode:"simple",indent_char:"\t",indent_levels:1,remove_linebreaks:1,remove_redundant_brs:1,element_format:"xhtml"},j);i.dom=j.dom;if(j.remove_redundant_brs){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/(<br \/>\s*)+<\/(p|h[1-6]|div|li)>/gi,function(n,m,o){if(/^<br \/>\s*<\//.test(n)){return"</"+o+">"}return n})})}if(j.element_format=="html"){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/<([^>]+) \/>/g,"<$1>")})}if(j.fix_list_elements){i.onPreProcess.add(function(v,s){var l,y,w=["ol","ul"],u,t,q,k=/^(OL|UL)$/,z;function m(r,x){var o=x.split(","),p;while((r=r.previousSibling)!=null){for(p=0;p<o.length;p++){if(r.nodeName==o[p]){return r}}}return null}for(y=0;y<w.length;y++){l=i.dom.select(w[y],s.node);for(u=0;u<l.length;u++){t=l[u];q=t.parentNode;if(k.test(q.nodeName)){z=m(t,"LI");if(!z){z=i.dom.create("li");z.innerHTML="&nbsp;";z.appendChild(t);q.insertBefore(z,q.firstChild)}else{z.appendChild(t)}}}}})}if(j.fix_table_elements){i.onPreProcess.add(function(k,l){if(!e.isOpera||opera.buildNumber()>=1767){f(i.dom.select("p table",l.node).reverse(),function(p){var o=i.dom.getParent(p.parentNode,"table,p");if(o.nodeName!="TABLE"){try{i.dom.split(o,p)}catch(m){}}})}})}},setEntities:function(p){var n=this,j,m,h={},o="",k;if(n.entityLookup){return}j=p.split(",");for(m=0;m<j.length;m+=2){k=j[m];if(k==34||k==38||k==60||k==62){continue}h[String.fromCharCode(j[m])]=j[m+1];k=parseInt(j[m]).toString(16);o+="\\u"+"0000".substring(k.length)+k}if(!o){n.settings.entity_encoding="raw";return}n.entitiesRE=new RegExp("["+o+"]","g");n.entityLookup=h},setValidChildRules:function(h){this.childRules=null;this.addValidChildRules(h)},addValidChildRules:function(k){var j=this,l,h,i;if(!k){return}l="A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment";h="A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment";i="H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP";f(k.split(","),function(n){var o=n.split(/\[|\]/),m;n="";f(o[1].split("|"),function(p){if(n){n+="|"}switch(p){case"%itrans":p=h;break;case"%itrans_na":p=h.substring(2);break;case"%istrict":p=l;break;case"%istrict_na":p=l.substring(2);break;case"%btrans":p=i;break;case"%bstrict":p=i;break}n+=p});m=new RegExp("^("+n.toLowerCase()+")$","i");f(o[0].split("/"),function(p){j.childRules=j.childRules||{};j.childRules[p]=m})});k="";f(j.childRules,function(n,m){if(k){k+="|"}k+=m});j.parentElementsRE=new RegExp("^("+k.toLowerCase()+")$","i")},setRules:function(i){var h=this;h._setup();h.rules={};h.wildRules=[];h.validElements={};return h.addRules(i)},addRules:function(i){var h=this,j;if(!i){return}h._setup();f(i.split(","),function(m){var q=m.split(/\[|\]/),l=q[0].split("/"),r,k,o,n=[];if(j){k=e.extend([],j.attribs)}if(q.length>1){f(q[1].split("|"),function(u){var p={},t;k=k||[];u=u.replace(/::/g,"~");u=/^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(u);u[2]=u[2].replace(/~/g,":");if(u[1]=="!"){r=r||[];r.push(u[2])}if(u[1]=="-"){for(t=0;t<k.length;t++){if(k[t].name==u[2]){k.splice(t,1);return}}}switch(u[3]){case"=":p.defaultVal=u[4]||"";break;case":":p.forcedVal=u[4];break;case"<":p.validVals=u[4].split("?");break}if(/[*.?]/.test(u[2])){o=o||[];p.nameRE=new RegExp("^"+c(u[2])+"$");o.push(p)}else{p.name=u[2];k.push(p)}n.push(u[2])})}f(l,function(v,u){var w=v.charAt(0),t=1,p={};if(j){if(j.noEmpty){p.noEmpty=j.noEmpty}if(j.fullEnd){p.fullEnd=j.fullEnd}if(j.padd){p.padd=j.padd}}switch(w){case"-":p.noEmpty=true;break;case"+":p.fullEnd=true;break;case"#":p.padd=true;break;default:t=0}l[u]=v=v.substring(t);h.validElements[v]=1;if(/[*.?]/.test(l[0])){p.nameRE=new RegExp("^"+c(l[0])+"$");h.wildRules=h.wildRules||{};h.wildRules.push(p)}else{p.name=l[0];if(l[0]=="@"){j=p}h.rules[v]=p}p.attribs=k;if(r){p.requiredAttribs=r}if(o){v="";f(n,function(s){if(v){v+="|"}v+="("+c(s)+")"});p.validAttribsRE=new RegExp("^"+v.toLowerCase()+"$");p.wildAttribs=o}})});i="";f(h.validElements,function(m,l){if(i){i+="|"}if(l!="@"){i+=l}});h.validElementsRE=new RegExp("^("+c(i.toLowerCase())+")$")},findRule:function(m){var j=this,l=j.rules,h,k;j._setup();k=l[m];if(k){return k}l=j.wildRules;for(h=0;h<l.length;h++){if(l[h].nameRE.test(m)){return l[h]}}return null},findAttribRule:function(h,l){var j,k=h.wildAttribs;for(j=0;j<k.length;j++){if(k[j].nameRE.test(l)){return k[j]}}return null},serialize:function(r,q){var m,k=this,p,i,j,l;k._setup();q=q||{};q.format=q.format||"html";k.processObj=q;if(d){l=[];f(r.getElementsByTagName("option"),function(o){var h=k.dom.getAttrib(o,"selected");l.push(h?h:null)})}r=r.cloneNode(true);if(d){f(r.getElementsByTagName("option"),function(o,h){k.dom.setAttrib(o,"selected",l[h])})}j=r.ownerDocument.implementation;if(j.createHTMLDocument&&(e.isOpera&&opera.buildNumber()>=1767)){p=j.createHTMLDocument("");f(r.nodeName=="BODY"?r.childNodes:[r],function(h){p.body.appendChild(p.importNode(h,true))});if(r.nodeName!="BODY"){r=p.body.firstChild}else{r=p.body}i=k.dom.doc;k.dom.doc=p}k.key=""+(parseInt(k.key)+1);if(!q.no_events){q.node=r;k.onPreProcess.dispatch(k,q)}k.writer.reset();k._serializeNode(r,q.getInner);q.content=k.writer.getContent();if(i){k.dom.doc=i}if(!q.no_events){k.onPostProcess.dispatch(k,q)}k._postProcess(q);q.node=null;return e.trim(q.content)},_postProcess:function(n){var i=this,k=i.settings,j=n.content,m=[],l;if(n.format=="html"){l=i._protect({content:j,patterns:[{pattern:/(<script[^>]*>)(.*?)(<\/script>)/g},{pattern:/(<noscript[^>]*>)(.*?)(<\/noscript>)/g},{pattern:/(<style[^>]*>)(.*?)(<\/style>)/g},{pattern:/(<pre[^>]*>)(.*?)(<\/pre>)/g,encode:1},{pattern:/(<!--\[CDATA\[)(.*?)(\]\]-->)/g}]});j=l.content;if(k.entity_encoding!=="raw"){j=i._encode(j)}if(!n.set){j=j.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g,k.entity_encoding=="numeric"?"<p$1>&#160;</p>":"<p$1>&nbsp;</p>");if(k.remove_linebreaks){j=j.replace(/\r?\n|\r/g," ");j=j.replace(/(<[^>]+>)\s+/g,"$1 ");j=j.replace(/\s+(<\/[^>]+>)/g," $1");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g,"<$1 $2>");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g,"<$1>");j=j.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g,"</$1>")}if(k.apply_source_formatting&&k.indent_mode=="simple"){j=j.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g,"\n<$1$2$3>\n");j=j.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g,"\n<$1$2>");j=j.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g,"</$1>\n");j=j.replace(/\n\n/g,"\n")}}j=i._unprotect(j,l);j=j.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g,"<![CDATA[$1]]>");if(k.entity_encoding=="raw"){j=j.replace(/<p>&nbsp;<\/p>|<p([^>]+)>&nbsp;<\/p>/g,"<p$1>\u00a0</p>")}j=j.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g,function(h,p,o){return"<noscript"+p+">"+i.dom.decode(o.replace(/<!--|-->/g,""))+"</noscript>"})}n.content=j},_serializeNode:function(D,o){var z=this,A=z.settings,x=z.writer,q,j,u,F,E,G,B,h,y,k,r,C,p,m;if(!A.node_filter||A.node_filter(D)){switch(D.nodeType){case 1:if(D.hasAttribute?D.hasAttribute("mce_bogus"):D.getAttribute("mce_bogus")){return}p=false;q=D.hasChildNodes();k=D.getAttribute("mce_name")||D.nodeName.toLowerCase();if(d){if(D.scopeName!=="HTML"&&D.scopeName!=="html"){k=D.scopeName+":"+k}}if(k.indexOf("mce:")===0){k=k.substring(4)}if(!z.validElementsRE||!z.validElementsRE.test(k)||(z.invalidElementsRE&&z.invalidElementsRE.test(k))||o){p=true;break}if(d){if(A.fix_content_duplication){if(D.mce_serialized==z.key){return}D.mce_serialized=z.key}if(k.charAt(0)=="/"){k=k.substring(1)}}else{if(a){if(D.nodeName==="BR"&&D.getAttribute("type")=="_moz"){return}}}if(z.childRules){if(z.parentElementsRE.test(z.elementName)){if(!z.childRules[z.elementName].test(k)){p=true;break}}z.elementName=k}r=z.findRule(k);k=r.name||k;m=A.closed.test(k);if((!q&&r.noEmpty)||(d&&!k)){p=true;break}if(r.requiredAttribs){G=r.requiredAttribs;for(F=G.length-1;F>=0;F--){if(this.dom.getAttrib(D,G[F])!==""){break}}if(F==-1){p=true;break}}x.writeStartElement(k);if(r.attribs){for(F=0,B=r.attribs,E=B.length;F<E;F++){G=B[F];y=z._getAttrib(D,G);if(y!==null){x.writeAttribute(G.name,y)}}}if(r.validAttribsRE){B=z.dom.getAttribs(D);for(F=B.length-1;F>-1;F--){h=B[F];if(h.specified){G=h.nodeName.toLowerCase();if(A.invalid_attrs.test(G)||!r.validAttribsRE.test(G)){continue}C=z.findAttribRule(r,G);y=z._getAttrib(D,C,G);if(y!==null){x.writeAttribute(G,y)}}}}if(k==="script"&&e.trim(D.innerHTML)){x.writeText("// ");x.writeCDATA(D.innerHTML.replace(/<!--|-->|<\[CDATA\[|\]\]>/g,""));q=false;break}if(r.padd){if(q&&(u=D.firstChild)&&u.nodeType===1&&D.childNodes.length===1){if(u.hasAttribute?u.hasAttribute("mce_bogus"):u.getAttribute("mce_bogus")){x.writeText("\u00a0")}}else{if(!q){x.writeText("\u00a0")}}}break;case 3:if(z.childRules&&z.parentElementsRE.test(z.elementName)){if(!z.childRules[z.elementName].test(D.nodeName)){return}}return x.writeText(D.nodeValue);case 4:return x.writeCDATA(D.nodeValue);case 8:return x.writeComment(D.nodeValue)}}else{if(D.nodeType==1){q=D.hasChildNodes()}}if(q&&!m){u=D.firstChild;while(u){z._serializeNode(u);z.elementName=k;u=u.nextSibling}}if(!p){if(!m){x.writeFullEndElement()}else{x.writeEndElement()}}},_protect:function(j){var i=this;j.items=j.items||[];function h(l){return l.replace(/[\r\n\\]/g,function(m){if(m==="\n"){return"\\n"}else{if(m==="\\"){return"\\\\"}}return"\\r"})}function k(l){return l.replace(/\\[\\rn]/g,function(m){if(m==="\\n"){return"\n"}else{if(m==="\\\\"){return"\\"}}return"\r"})}f(j.patterns,function(l){j.content=k(h(j.content).replace(l.pattern,function(n,o,m,p){m=k(m);if(l.encode){m=i._encode(m)}j.items.push(m);return o+"<!--mce:"+(j.items.length-1)+"-->"+p}))});return j},_unprotect:function(i,j){i=i.replace(/\<!--mce:([0-9]+)--\>/g,function(k,h){return j.items[parseInt(h)]});j.items=[];return i},_encode:function(m){var j=this,k=j.settings,i;if(k.entity_encoding!=="raw"){if(k.entity_encoding.indexOf("named")!=-1){j.setEntities(k.entities);i=j.entityLookup;m=m.replace(j.entitiesRE,function(h){var l;if(l=i[h]){h="&"+l+";"}return h})}if(k.entity_encoding.indexOf("numeric")!=-1){m=m.replace(/[\u007E-\uFFFF]/g,function(h){return"&#"+h.charCodeAt(0)+";"})}}return m},_setup:function(){var h=this,i=this.settings;if(h.done){return}h.done=1;h.setRules(i.valid_elements);h.addRules(i.extended_valid_elements);h.addValidChildRules(i.valid_child_elements);if(i.invalid_elements){h.invalidElementsRE=new RegExp("^("+c(i.invalid_elements.replace(/,/g,"|").toLowerCase())+")$")}if(i.attrib_value_filter){h.attribValueFilter=i.attribValueFilter}},_getAttrib:function(m,j,h){var l,k;h=h||j.name;if(j.forcedVal&&(k=j.forcedVal)){if(k==="{$uid}"){return this.dom.uniqueId()}return k}k=this.dom.getAttrib(m,h);switch(h){case"rowspan":case"colspan":if(k=="1"){k=""}break}if(this.attribValueFilter){k=this.attribValueFilter(h,k,m)}if(j.validVals){for(l=j.validVals.length-1;l>=0;l--){if(k==j.validVals[l]){break}}if(l==-1){return null}}if(k===""&&typeof(j.defaultVal)!="undefined"){k=j.defaultVal;if(k==="{$uid}"){return this.dom.uniqueId()}return k}else{if(h=="class"&&this.processObj.get){k=k.replace(/\s?mceItem\w+\s?/g,"")}}if(k===""){return null}return k}})})(tinymce);(function(tinymce){var each=tinymce.each,Event=tinymce.dom.Event;tinymce.create("tinymce.dom.ScriptLoader",{ScriptLoader:function(s){this.settings=s||{};this.queue=[];this.lookup={}},isDone:function(u){return this.lookup[u]?this.lookup[u].state==2:0},markDone:function(u){this.lookup[u]={state:2,url:u}},add:function(u,cb,s,pr){var t=this,lo=t.lookup,o;if(o=lo[u]){if(cb&&o.state==2){cb.call(s||this)}return o}o={state:0,url:u,func:cb,scope:s||this};if(pr){t.queue.unshift(o)}else{t.queue.push(o)}lo[u]=o;return o},load:function(u,cb,s){var t=this,o;if(o=t.lookup[u]){if(cb&&o.state==2){cb.call(s||t)}return o}function loadScript(u){if(Event.domLoaded||t.settings.strict_mode){tinymce.util.XHR.send({url:tinymce._addVer(u),error:t.settings.error,async:false,success:function(co){t.eval(co)}})}else{document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"><\/script>')}}if(!tinymce.is(u,"string")){each(u,function(u){loadScript(u)});if(cb){cb.call(s||t)}}else{loadScript(u);if(cb){cb.call(s||t)}}},loadQueue:function(cb,s){var t=this;if(!t.queueLoading){t.queueLoading=1;t.queueCallbacks=[];t.loadScripts(t.queue,function(){t.queueLoading=0;if(cb){cb.call(s||t)}each(t.queueCallbacks,function(o){o.func.call(o.scope)})})}else{if(cb){t.queueCallbacks.push({func:cb,scope:s||t})}}},eval:function(co){var w=window;if(!w.execScript){try{eval.call(w,co)}catch(ex){eval(co,w)}}else{w.execScript(co)}},loadScripts:function(sc,cb,s){var t=this,lo=t.lookup;function done(o){o.state=2;if(o.func){o.func.call(o.scope||t)}}function allDone(){var l;l=sc.length;each(sc,function(o){o=lo[o.url];if(o.state===2){done(o);l--}else{load(o)}});if(l===0&&cb){cb.call(s||t);cb=0}}function load(o){if(o.state>0){return}o.state=1;tinymce.dom.ScriptLoader.loadScript(o.url,function(){done(o);allDone()})}each(sc,function(o){var u=o.url;if(!lo[u]){lo[u]=o;t.queue.push(o)}else{o=lo[u]}if(o.state>0){return}if(!Event.domLoaded&&!t.settings.strict_mode){var ix,ol="";if(cb||o.func){o.state=1;ix=tinymce.dom.ScriptLoader._addOnLoad(function(){done(o);allDone()});if(tinymce.isIE){ol=' onreadystatechange="'}else{ol=' onload="'}ol+="tinymce.dom.ScriptLoader._onLoad(this,'"+u+"',"+ix+');"'}document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"'+ol+"><\/script>");if(!o.func){done(o)}}else{load(o)}});allDone()},"static":{_addOnLoad:function(f){var t=this;t._funcs=t._funcs||[];t._funcs.push(f);return t._funcs.length-1},_onLoad:function(e,u,ix){if(!tinymce.isIE||e.readyState=="complete"){this._funcs[ix].call(this)}},loadScript:function(u,cb){var id=tinymce.DOM.uniqueId(),e;function done(){Event.clear(id);tinymce.DOM.remove(id);if(cb){cb.call(document,u);cb=0}}if(tinymce.isIE){tinymce.util.XHR.send({url:tinymce._addVer(u),async:false,success:function(co){window.execScript(co);done()}})}else{e=tinymce.DOM.create("script",{id:id,type:"text/javascript",src:tinymce._addVer(u)});Event.add(e,"load",done);(document.getElementsByTagName("head")[0]||document.body).appendChild(e)}}}});tinymce.ScriptLoader=new tinymce.dom.ScriptLoader()})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(e,d){this.id=e;this.settings=d=d||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=d.scope||this;this.disabled=0;this.active=0},setDisabled:function(d){var f;if(d!=this.disabled){f=b.get(this.id);if(f&&this.settings.unavailable_prefix){if(d){this.prevTitle=f.title;f.title=this.settings.unavailable_prefix+": "+f.title}else{f.title=this.prevTitle}}this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(b,a){this.parent(b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator"},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeight<j.max_height){c.setStyle(l,"overflow","hidden")}}},showMenu:function(p,n,r){var z=this,A=z.settings,o,g=c.getViewPort(),u,l,v,q,i=2,k,j,m=z.classPrefix;z.collapse(1);if(z.isMenuVisible){return}if(!z.rendered){o=c.add(z.settings.container,z.renderNode());f(z.items,function(h){h.postRender()});z.element=new b("menu_"+z.id,{blocker:1,container:A.container})}else{o=c.get("menu_"+z.id)}if(!e.isOpera){c.setStyles(o,{left:-65535,top:-65535})}c.show(o);z.update();p+=A.offset_x||0;n+=A.offset_y||0;g.w-=4;g.h-=4;if(A.constrain){u=o.clientWidth-i;l=o.clientHeight-i;v=g.x+g.w;q=g.y+g.h;if((p+A.vp_offset_x+u)>v){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return a.cancel(s)}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(w){var h,t,s;w=w.target;if(w&&(w=c.getParent(w,"tr"))){h=z.items[w.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(w&&c.hasClass(w,m+"ItemSub")){t=c.getRect(w);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}z.onShowMenu.dispatch(z);if(A.keyboard_focus){a.add(o,"keydown",z._keyHandler,z);c.select("a","menu_"+z.id)[0].focus();z._focusIdx=0}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);a.remove(h,"mouseover",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000"});k=c.add(g,"div",{id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_keyHandler:function(j){var i=this,h=j.keyCode;function g(m){var k=i._focusIdx+m,l=c.select("a","menu_"+i.id)[k];if(l){i._focusIdx=k;l.focus()}}switch(h){case 38:g(-1);return;case 40:g(1);return;case 13:return;case 27:return this.hideMenu()}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,"td");i=p=c.add(i,"a",{href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(d,c){this.parent(d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='<a id="'+this.id+'" href="javascript:;" class="'+f+" "+f+"Enabled "+e["class"]+(c?" "+f+"Labeled":"")+'" onmousedown="return false;" onclick="return false;" title="'+a.encode(e.title)+'">';if(e.image){d+='<img class="mceIcon" src="'+e.image+'" />'+c+"</a>"}else{d+='<span class="mceIcon '+e["class"]+'"></span>'+(c?'<span class="'+f+'Label">'+c+"</span>":"")+"</a>"}return d},postRender:function(){var c=this,d=c.settings;b.dom.Event.add(c.id,"click",function(f){if(!c.isDisabled()){return d.onclick.call(d.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(h,g){var f=this;f.parent(h,g);f.items=[];f.onChange=new a(f);f.onPostRender=new a(f);f.onAdd=new a(f);f.onRenderMenu=new d.util.Dispatcher(this);f.classPrefix="mceListBox"},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var g=this,h,i;if(f!=g.selectedIndex){h=c.get(g.id+"_text");i=g.items[f];if(i){g.selectedValue=i.value;g.selectedIndex=f;c.setHTML(h,c.encode(i.title));c.removeClass(h,"mceTitle")}else{c.setHTML(h,c.encode(g.settings.title));c.addClass(h,"mceTitle");g.selectedValue=g.selectedIndex=null}h=0}},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='<table id="'+f.id+'" cellpadding="0" cellspacing="0" class="'+j+" "+j+"Enabled"+(g["class"]?(" "+g["class"]):"")+'"><tbody><tr>';i+="<td>"+c.createHTML("a",{id:f.id+"_text",href:"javascript:;","class":"mceText",onclick:"return false;",onmousedown:"return false;"},c.encode(f.settings.title))+"</td>";i+="<td>"+c.createHTML("a",{id:f.id+"_open",tabindex:-1,href:"javascript:;","class":"mceOpen",onclick:"return false;",onmousedown:"return false;"},"<span></span>")+"</td>";i+="</tr></tbody></table>";return i},showMenu:function(){var g=this,j,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}j=c.getPos(this.settings.menu_container);i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(k){if(k.value===g.selectedValue){f.items[k.id].setSelected(1);g.oldID=k.id}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(g.hideMenu,g);f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){h.id=c.uniqueId();h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id+"_text","focus",function(h){if(!f._focused){f.keyDownHandler=b.add(f.id+"_text","keydown",function(l){var i=-1,j,k=l.keyCode;e(f.items,function(m,n){if(f.selectedValue==m.value){i=n}});if(k==38){j=f.items[i-1]}else{if(k==40){j=f.items[i+1]}else{if(k==13){j=f.selectedValue;f.selectedValue=null;f.settings.onselect(j);return b.cancel(l)}}}if(j){f.hideMenu();f.select(j.value)}})}f._focused=1});b.add(f.id+"_text","blur",function(){b.remove(f.id+"_text","keydown",f.keyDownHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text");b.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return c.get(this.id).options.length-1},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox"},g);return g},postRender:function(){var g=this,h;g.rendered=true;function f(j){var i=g.items[j.target.selectedIndex-1];if(i&&(i=i.value)){g.onChange.dispatch(g,i);if(g.settings.onselect){g.settings.onselect(i)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(j){var i;b.remove(g.id,"change",h);i=b.add(g.id,"blur",function(){b.add(g.id,"change",f);b.remove(g.id,"blur",i)});if(j.keyCode==13||j.keyCode==32){f(j);return b.cancel(j)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(f,e){this.parent(f,e);this.onRenderMenu=new c.util.Dispatcher(this);e.menu_container=e.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(f.hideMenu,f);f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(f,e){this.parent(f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="<tbody><tr>";if(g.image){e=b.createHTML("img ",{src:g.image,"class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}i+="<td>"+b.createHTML("a",{id:f.id+"_action",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";e=b.createHTML("span",{"class":"mceOpen "+g["class"]});i+="<td>"+b.createHTML("a",{id:f.id+"_open",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";i+="</tr></tbody>";return b.createHTML("table",{id:f.id,"class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",onmousedown:"return false;",title:g.title},i)},postRender:function(){var e=this,f=e.settings;if(f.onclick){a.add(e.id+"_action","click",function(){if(!e.isDisabled()){f.onclick(e.value)}})}a.add(e.id+"_open","click",e.showMenu,e);a.add(e.id+"_open","focus",function(){e._focused=1});a.add(e.id+"_open","blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(h,g){var f=this;f.parent(h,g);f.settings=g=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},f.settings);f.onShowMenu=new d.util.Dispatcher(f);f.onHideMenu=new d.util.Dispatcher(f);f.value=g.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.isMenuVisible=1},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.onHideMenu.dispatch(f);f.isMenuVisible=0},renderMenu:function(){var k=this,f,j=0,l=k.settings,p,h,o,g;g=c.add(l.menu_container,"div",{id:k.id+"_menu","class":l.menu_class+" "+l["class"],style:"position:absolute;left:0;top:-1000px;"});f=c.add(g,"div",{"class":l["class"]+" mceSplitButtonMenu"});c.add(f,"span",{"class":"mceMenuLine"});p=c.add(f,"table",{"class":"mceColorSplitMenu"});h=c.add(p,"tbody");j=0;e(b(l.colors,"array")?l.colors:l.colors.split(","),function(i){i=i.replace(/^#/,"");if(!j--){o=c.add(h,"tr");j=l.grid_width-1}p=c.add(o,"td");p=c.add(p,"a",{href:"javascript:;",style:{backgroundColor:"#"+i},mce_color:"#"+i})});if(l.more_colors_func){p=c.add(h,"tr");p=c.add(p,"td",{colspan:l.grid_width,"class":"mceMoreColors"});p=c.add(p,"a",{id:k.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},l.more_colors_title);a.add(p,"click",function(i){l.more_colors_func.call(l.more_colors_scope||this);return a.cancel(i)})}c.addClass(f,"mceColorSplitMenu");a.add(k.id+"_menu","click",function(i){var m;i=i.target;if(i.nodeName=="A"&&(m=i.getAttribute("mce_color"))){k.setColor(m)}return a.cancel(i)});return g},setColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g;f.hideMenu();f.settings.onselect(g)},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);tinymce.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var l=this,e="",g,j,b=tinymce.DOM,m=l.settings,d,a,f,k;k=l.controls;for(d=0;d<k.length;d++){j=k[d];a=k[d-1];f=k[d+1];if(d===0){g="mceToolbarStart";if(j.Button){g+=" mceToolbarStartButton"}else{if(j.SplitButton){g+=" mceToolbarStartSplitButton"}else{if(j.ListBox){g+=" mceToolbarStartListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"))}if(a&&j.ListBox){if(a.Button||a.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarEnd"},b.createHTML("span",null,"<!-- IE -->"))}}if(b.stdMode){e+='<td style="position: relative">'+j.renderHTML()+"</td>"}else{e+="<td>"+j.renderHTML()+"</td>"}if(f&&j.ListBox){if(f.Button||f.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarStart"},b.createHTML("span",null,"<!-- IE -->"))}}}g="mceToolbarEnd";if(j.Button){g+=" mceToolbarEndButton"}else{if(j.SplitButton){g+=" mceToolbarEndSplitButton"}else{if(j.ListBox){g+=" mceToolbarEndListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"));return b.createHTML("table",{id:l.id,"class":"mceToolbar"+(m["class"]?" "+m["class"]:""),cellpadding:"0",cellspacing:"0",align:l.settings.align||""},"<tbody><tr>"+e+"</tr></tbody>")}});(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{items:[],urls:{},lookup:{},onAdd:new a(this),get:function(d){return this.lookup[d]},requireLangPack:function(f){var d,e=b.EditorManager.settings;if(e&&e.language){d=this.urls[f]+"/langs/"+e.language+".js";if(!b.dom.Event.domLoaded&&!e.strict_mode){b.ScriptLoader.load(d)}else{b.ScriptLoader.add(d)}}},add:function(e,d){this.items.push(d);this.lookup[e]=d;this.onAdd.dispatch(this,e,d);return d},load:function(h,e,d,g){var f=this;if(f.urls[h]){return}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}f.urls[h]=e.substring(0,e.lastIndexOf("/"));b.ScriptLoader.add(e,d,g)}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(f){var g=f.each,h=f.extend,e=f.DOM,a=f.dom.Event,c=f.ThemeManager,b=f.PluginManager,d=f.explode;f.create("static tinymce.EditorManager",{editors:{},i18n:{},activeEditor:null,preInit:function(){var i=this,j=window.location;f.documentBaseURL=j.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(f.documentBaseURL)){f.documentBaseURL+="/"}f.baseURL=new f.util.URI(f.documentBaseURL).toAbsolute(f.baseURL);f.EditorManager.baseURI=new f.util.URI(f.baseURL);i.onBeforeUnload=new f.util.Dispatcher(i);a.add(window,"beforeunload",function(k){i.onBeforeUnload.dispatch(i,k)})},init:function(q){var p=this,l,k=f.ScriptLoader,o,n,i=[],m;function j(u,v,r){var t=u[v];if(!t){return}if(f.is(t,"string")){r=t.replace(/\.\w+$/,"");r=r?f.resolve(r):0;t=f.resolve(t)}return t.apply(r||this,Array.prototype.slice.call(arguments,2))}q=h({theme:"simple",language:"en",strict_loading_mode:document.contentType=="application/xhtml+xml"},q);p.settings=q;if(!a.domLoaded&&!q.strict_loading_mode){if(q.language){k.add(f.baseURL+"/langs/"+q.language+".js")}if(q.theme&&q.theme.charAt(0)!="-"&&!c.urls[q.theme]){c.load(q.theme,"themes/"+q.theme+"/editor_template"+f.suffix+".js")}if(q.plugins){l=d(q.plugins);g(l,function(r){if(r&&r.charAt(0)!="-"&&!b.urls[r]){if(!f.isWebKit&&r=="safari"){return}b.load(r,"plugins/"+r+"/editor_plugin"+f.suffix+".js")}})}k.loadQueue()}a.add(document,"init",function(){var r,t;j(q,"onpageload");if(q.browsers){r=false;g(d(q.browsers),function(u){switch(u){case"ie":case"msie":if(f.isIE){r=true}break;case"gecko":if(f.isGecko){r=true}break;case"safari":case"webkit":if(f.isWebKit){r=true}break;case"opera":if(f.isOpera){r=true}break}});if(!r){return}}switch(q.mode){case"exact":r=q.elements||"";if(r.length>0){g(d(r),function(u){if(e.get(u)){m=new f.Editor(u,q);i.push(m);m.render(1)}else{o=0;g(document.forms,function(v){g(v.elements,function(w){if(w.name===u){u="mce_editor_"+o;e.setAttrib(w,"id",u);m=new f.Editor(u,q);i.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function s(v,u){return u.constructor===RegExp?u.test(v.className):e.hasClass(v,u)}g(e.select("textarea"),function(u){if(q.editor_deselector&&s(u,q.editor_deselector)){return}if(!q.editor_selector||s(u,q.editor_selector)){n=e.get(u.name);if(!u.id&&!n){u.id=u.name}if(!u.id||p.get(u.id)){u.id=e.uniqueId()}m=new f.Editor(u.id,q);i.push(m);m.render(1)}});break}if(q.oninit){r=t=0;g(i,function(u){t++;if(!u.initialized){u.onInit.add(function(){r++;if(r==t){j(q,"oninit")}})}else{r++}if(r==t){j(q,"oninit")}})}})},get:function(i){return this.editors[i]},getInstanceById:function(i){return this.get(i)},add:function(i){this.editors[i.id]=i;this._setActive(i);return i},remove:function(j){var i=this;if(!i.editors[j.id]){return null}delete i.editors[j.id];if(i.activeEditor==j){i._setActive(null);g(i.editors,function(k){i._setActive(k);return false})}j.destroy();return j},execCommand:function(o,m,l){var n=this,k=n.get(l),i;switch(o){case"mceFocus":k.focus();return true;case"mceAddEditor":case"mceAddControl":if(!n.get(l)){new f.Editor(l,n.settings).render()}return true;case"mceAddFrameControl":i=l.window;i.tinyMCE=tinyMCE;i.tinymce=f;f.DOM.doc=i.document;f.DOM.win=i;k=new f.Editor(l.element_id,l);k.render();if(f.isIE){function j(){k.destroy();i.detachEvent("onunload",j);i=i.tinyMCE=i.tinymce=null}i.attachEvent("onunload",j)}l.page_window=null;return true;case"mceRemoveEditor":case"mceRemoveControl":if(k){k.remove()}return true;case"mceToggleEditor":if(!k){n.execCommand("mceAddControl",0,l);return true}if(k.isHidden()){k.show()}else{k.hide()}return true}if(n.activeEditor){return n.activeEditor.execCommand(o,m,l)}return false},execInstanceCommand:function(m,l,k,j){var i=this.get(m);if(i){return i.execCommand(l,k,j)}return false},triggerSave:function(){g(this.editors,function(i){i.save()})},addI18n:function(k,l){var i,j=this.i18n;if(!f.is(k,"string")){g(k,function(n,m){g(n,function(q,p){g(q,function(s,r){if(p==="common"){j[m+"."+r]=s}else{j[m+"."+p+"."+r]=s}})})})}else{g(l,function(n,m){j[k+"."+m]=n})}},_setActive:function(i){this.selectedInstance=this.activeEditor=i}});f.EditorManager.preInit()})(tinymce);var tinyMCE=window.tinyMCE=tinymce.EditorManager;(function(n){var o=n.DOM,k=n.dom.Event,f=n.extend,l=n.util.Dispatcher;var j=n.each,a=n.isGecko,b=n.isIE,e=n.isWebKit;var d=n.is,h=n.ThemeManager,c=n.PluginManager,i=n.EditorManager;var p=n.inArray,m=n.grep,g=n.explode;n.create("tinymce.Editor",{Editor:function(u,r){var q=this;q.id=q.editorId=u;q.execCommands={};q.queryStateCommands={};q.queryValueCommands={};q.isNotDirty=false;q.plugins={};j(["onPreInit","onBeforeRenderUI","onPostRender","onInit","onRemove","onActivate","onDeactivate","onClick","onEvent","onMouseUp","onMouseDown","onDblClick","onKeyDown","onKeyUp","onKeyPress","onContextMenu","onSubmit","onReset","onPaste","onPreProcess","onPostProcess","onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent","onLoadContent","onSaveContent","onNodeChange","onChange","onBeforeExecCommand","onExecCommand","onUndo","onRedo","onVisualAid","onSetProgressState"],function(s){q[s]=new l(q)});q.settings=r=f({id:u,language:"en",docs_language:"en",theme:"simple",skin:"default",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:n.documentBaseURL,add_form_submit_trigger:1,submit_patch:1,add_unload_trigger:1,convert_urls:1,relative_urls:1,remove_script_host:1,table_inline_editing:0,object_resizing:1,cleanup:1,accessibility_focus:1,custom_shortcuts:1,custom_undo_redo_keyboard_shortcuts:1,custom_undo_redo_restore_selection:1,custom_undo_redo:1,doctype:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',visual_table_class:"mceItemTable",visual:1,inline_styles:true,convert_fonts_to_spans:true,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",valid_elements:"@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p,-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,removeformat_selector:"span,b,strong,em,i,font,u,strike"},r);q.documentBaseURI=new n.util.URI(r.document_base_url||n.documentBaseURL,{base_uri:tinyMCE.baseURI});q.baseURI=i.baseURI;q.execCallback("setup",q)},render:function(u){var v=this,w=v.settings,x=v.id,q=n.ScriptLoader;if(!k.domLoaded){k.add(document,"init",function(){v.render()});return}if(!u){w.strict_loading_mode=1;tinyMCE.settings=w}if(!v.getElement()){return}if(w.strict_loading_mode){q.settings.strict_mode=w.strict_loading_mode;n.DOM.settings.strict=1}if(!/TEXTAREA|INPUT/i.test(v.getElement().nodeName)&&w.hidden_input&&o.getParent(x,"form")){o.insertAfter(o.create("input",{type:"hidden",name:x}),x)}if(n.WindowManager){v.windowManager=new n.WindowManager(v)}if(w.encoding=="xml"){v.onGetContent.add(function(s,t){if(t.save){t.content=o.encode(t.content)}})}if(w.add_form_submit_trigger){v.onSubmit.addToTop(function(){if(v.initialized){v.save();v.isNotDirty=1}})}if(w.add_unload_trigger){v._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(v.initialized&&!v.destroyed&&!v.isHidden()){v.save({format:"raw",no_events:true})}})}n.addUnload(v.destroy,v);if(w.submit_patch){v.onBeforeRenderUI.add(function(){var s=v.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){v.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){i.triggerSave();v.isNotDirty=1;return v.formElement._mceOldSubmit(v.formElement)}}s=null})}function r(){if(w.language){q.add(n.baseURL+"/langs/"+w.language+".js")}if(w.theme&&w.theme.charAt(0)!="-"&&!h.urls[w.theme]){h.load(w.theme,"themes/"+w.theme+"/editor_template"+n.suffix+".js")}j(g(w.plugins),function(s){if(s&&s.charAt(0)!="-"&&!c.urls[s]){if(!e&&s=="safari"){return}c.load(s,"plugins/"+s+"/editor_plugin"+n.suffix+".js")}});q.loadQueue(function(){if(!v.removed){v.init()}})}r()},init:function(){var v,F=this,G=F.settings,C,z,B=F.getElement(),r,q,D,y,A,E;i.add(F);if(G.theme){G.theme=G.theme.replace(/-/,"");r=h.get(G.theme);F.theme=new r();if(F.theme.init&&G.init_theme){F.theme.init(F,h.urls[G.theme]||n.documentBaseURL.replace(/\/$/,""))}}j(g(G.plugins.replace(/\-/g,"")),function(w){var H=c.get(w),t=c.urls[w]||n.documentBaseURL.replace(/\/$/,""),s;if(H){s=new H(F,t);F.plugins[w]=s;if(s.init){s.init(F,t)}}});if(G.popup_css!==false){if(G.popup_css){G.popup_css=F.documentBaseURI.toAbsolute(G.popup_css)}else{G.popup_css=F.baseURI.toAbsolute("themes/"+G.theme+"/skins/"+G.skin+"/dialog.css")}}if(G.popup_css_add){G.popup_css+=","+F.documentBaseURI.toAbsolute(G.popup_css_add)}F.controlManager=new n.ControlManager(F);F.undoManager=new n.UndoManager(F);F.undoManager.onAdd.add(function(t,s){if(!s.initial){return F.onChange.dispatch(F,s,t)}});F.undoManager.onUndo.add(function(t,s){return F.onUndo.dispatch(F,s,t)});F.undoManager.onRedo.add(function(t,s){return F.onRedo.dispatch(F,s,t)});if(G.custom_undo_redo){F.onExecCommand.add(function(t,w,u,H,s){if(w!="Undo"&&w!="Redo"&&w!="mceRepaint"&&(!s||!s.skip_undo)){F.undoManager.add()}})}F.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){F.nodeChanged()}});if(a){function x(s,t){if(!t||!t.initial){F.execCommand("mceRepaint")}}F.onUndo.add(x);F.onRedo.add(x);F.onSetContent.add(x)}F.onBeforeRenderUI.dispatch(F,F.controlManager);if(G.render_ui){C=G.width||B.style.width||B.offsetWidth;z=G.height||B.style.height||B.offsetHeight;F.orgDisplay=B.style.display;E=/^[0-9\.]+(|px)$/i;if(E.test(""+C)){C=Math.max(parseInt(C)+(r.deltaWidth||0),100)}if(E.test(""+z)){z=Math.max(parseInt(z)+(r.deltaHeight||0),100)}r=F.theme.renderUI({targetNode:B,width:C,height:z,deltaWidth:G.delta_width,deltaHeight:G.delta_height});F.editorContainer=r.editorContainer}if(document.domain&&location.hostname!=document.domain){n.relaxedDomain=document.domain}o.setStyles(r.sizeContainer||r.editorContainer,{width:C,height:z});z=(r.iframeHeight||z)+(typeof(z)=="number"?(r.deltaHeight||0):"");if(z<100){z=100}F.iframeHTML=G.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml">';if(G.document_base_url!=n.documentBaseURL){F.iframeHTML+='<base href="'+F.documentBaseURI.getURI()+'" />'}F.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';if(n.relaxedDomain){F.iframeHTML+='<script type="text/javascript">document.domain = "'+n.relaxedDomain+'";<\/script>'}y=G.body_id||"tinymce";if(y.indexOf("=")!=-1){y=F.getParam("body_id","","hash");y=y[F.id]||y}A=G.body_class||"";if(A.indexOf("=")!=-1){A=F.getParam("body_class","","hash");A=A[F.id]||""}F.iframeHTML+='</head><body id="'+y+'" class="mceContentBody '+A+'"></body></html>';if(n.relaxedDomain){if(b||(n.isOpera&&parseFloat(opera.version())>=9.5)){D='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+F.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}else{if(n.isOpera){D='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()'}}}v=o.add(r.iframeContainer,"iframe",{id:F.id+"_ifr",src:D||'javascript:""',frameBorder:"0",style:{width:"100%",height:z}});F.contentAreaContainer=r.iframeContainer;o.get(r.editorContainer).style.display=F.orgDisplay;o.get(F.id).style.display="none";if(!b||!n.relaxedDomain){F.setupIframe()}B=v=r=null},setupIframe:function(){var z=this,A=z.settings,u=o.get(z.id),v=z.getDoc(),r,x;if(!b||!n.relaxedDomain){v.open();v.write(z.iframeHTML);v.close()}if(!b){try{if(!A.readonly){v.designMode="On"}}catch(w){}}if(b){x=z.getBody();o.hide(x);if(!A.readonly){x.contentEditable=true}o.show(x)}z.dom=new n.dom.DOMUtils(z.getDoc(),{keep_values:true,url_converter:z.convertURL,url_converter_scope:z,hex_colors:A.force_hex_style_colors,class_filter:A.class_filter,update_styles:1,fix_ie_paragraphs:1});z.serializer=new n.dom.Serializer(f(A,{valid_elements:A.verify_html===false?"*[*]":A.valid_elements,dom:z.dom}));z.selection=new n.dom.Selection(z.dom,z.getWin(),z.serializer);z.forceBlocks=new n.ForceBlocks(z,{forced_root_block:A.forced_root_block});z.editorCommands=new n.EditorCommands(z);z.serializer.onPreProcess.add(function(s,t){return z.onPreProcess.dispatch(z,t,s)});z.serializer.onPostProcess.add(function(s,t){return z.onPostProcess.dispatch(z,t,s)});z.onPreInit.dispatch(z);if(!A.gecko_spellcheck){z.getBody().spellcheck=0}if(!A.readonly){z._addEvents()}z.controlManager.onPostRender.dispatch(z,z.controlManager);z.onPostRender.dispatch(z);if(A.directionality){z.getBody().dir=A.directionality}if(A.nowrap){z.getBody().style.whiteSpace="nowrap"}if(A.custom_elements){function y(s,t){j(g(A.custom_elements),function(B){var C;if(B.indexOf("~")===0){B=B.substring(1);C="span"}else{C="div"}t.content=t.content.replace(new RegExp("<("+B+")([^>]*)>","g"),"<"+C+' mce_name="$1"$2>');t.content=t.content.replace(new RegExp("</("+B+")>","g"),"</"+C+">")})}z.onBeforeSetContent.add(y);z.onPostProcess.add(function(s,t){if(t.set){y(s,t)}})}if(A.handle_node_change_callback){z.onNodeChange.add(function(t,s,B){z.execCallback("handle_node_change_callback",z.id,B,-1,-1,true,z.selection.isCollapsed())})}if(A.save_callback){z.onSaveContent.add(function(s,B){var t=z.execCallback("save_callback",z.id,B.content,z.getBody());if(t){B.content=t}})}if(A.onchange_callback){z.onChange.add(function(t,s){z.execCallback("onchange_callback",z,s)})}if(A.convert_newlines_to_brs){z.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"<br />")}})}if(A.fix_nesting&&b){z.onBeforeSetContent.add(function(s,t){t.content=z._fixNesting(t.content)})}if(A.preformatted){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*<pre.*?>/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='<pre class="mceItemHidden">'+t.content+"</pre>"}})}if(A.verify_css_classes){z.serializer.attribValueFilter=function(D,B){var C,t;if(D=="class"){if(!z.classesRE){t=z.dom.getClasses();if(t.length>0){C="";j(t,function(s){C+=(C?"|":"")+s["class"]});z.classesRE=new RegExp("("+C+")","gi")}}return !z.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(B)||z.classesRE.test(B)?B:""}return B}}if(A.convert_fonts_to_spans){z._convertFonts()}if(A.inline_styles){z._convertInlineElements()}if(A.cleanup_callback){z.onBeforeSetContent.add(function(s,t){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)});z.onPreProcess.add(function(s,t){if(t.set){z.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){z.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});z.onPostProcess.add(function(s,t){if(t.set){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=z.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(A.save_callback){z.onGetContent.add(function(s,t){if(t.save){t.content=z.execCallback("save_callback",z.id,t.content,z.getBody())}})}if(A.handle_event_callback){z.onEvent.add(function(s,t,B){if(z.execCallback("handle_event_callback",t,s,B)===false){k.cancel(t)}})}z.onSetContent.add(function(){z.addVisual(z.getBody())});if(A.padd_empty_editor){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")})}if(a){function q(s,t){j(s.dom.select("a"),function(C){var B=C.parentNode;if(s.dom.isBlock(B)&&B.lastChild===C){s.dom.add(B,"br",{mce_bogus:1})}})}z.onExecCommand.add(function(s,t){if(t==="CreateLink"){q(s)}});z.onSetContent.add(z.selection.onSetContent.add(q));if(!A.readonly){try{v.designMode="Off";v.designMode="On"}catch(w){}}}setTimeout(function(){if(z.removed){return}z.load({initial:true,format:(A.cleanup_on_startup?"html":"raw")});z.startContent=z.getContent({format:"raw"});z.undoManager.add({initial:true});z.initialized=true;z.onInit.dispatch(z);z.execCallback("setupcontent_callback",z.id,z.getBody(),z.getDoc());z.execCallback("init_instance_callback",z);z.focus(true);z.nodeChanged({initial:1});if(A.content_css){n.each(g(A.content_css),function(s){z.dom.loadCSS(z.documentBaseURI.toAbsolute(s))})}if(A.auto_focus){setTimeout(function(){var s=i.get(A.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getWin().focus()},100)}},1);u=null},focus:function(r){var u,q=this,s=q.settings.content_editable;if(!r){if(!s&&(!b||q.selection.getNode().ownerDocument!=q.getDoc())){q.getWin().focus()}}if(i.activeEditor!=q){if((u=i.activeEditor)!=null){u.onDeactivate.dispatch(u,q)}q.onActivate.dispatch(q,u)}i._setActive(q)},execCallback:function(v){var q=this,u=q.settings[v],r;if(!u){return}if(q.callbackLookup&&(r=q.callbackLookup[v])){u=r.func;r=r.scope}if(d(u,"string")){r=u.replace(/\.\w+$/,"");r=r?n.resolve(r):0;u=n.resolve(u);q.callbackLookup=q.callbackLookup||{};q.callbackLookup[v]={func:u,scope:r}}return u.apply(r||q,Array.prototype.slice.call(arguments,1))},translate:function(q){var t=this.settings.language||"en",r=i.i18n;if(!q){return""}return r[t+"."+q]||q.replace(/{\#([^}]+)\}/g,function(u,s){return r[t+"."+s]||"{#"+s+"}"})},getLang:function(r,q){return i.i18n[(this.settings.language||"en")+"."+r]||(d(q)?q:"{#"+r+"}")},getParam:function(w,s,q){var t=n.trim,r=d(this.settings[w])?this.settings[w]:s,u;if(q==="hash"){u={};if(d(r,"string")){j(r.indexOf("=")>0?r.split(/[;,](?![^=;,]*(?:[;,]|$))/):r.split(","),function(x){x=x.split("=");if(x.length>1){u[t(x[0])]=t(x[1])}else{u[t(x[0])]=t(x)}})}else{u=r}return u}return r},nodeChanged:function(u){var q=this,r=q.selection,v=r.getNode()||q.getBody();if(q.initialized){q.onNodeChange.dispatch(q,u?u.controlManager||q.controlManager:q.controlManager,b&&v.ownerDocument!=q.getDoc()?q.getBody():v,r.isCollapsed(),u)}},addButton:function(u,r){var q=this;q.buttons=q.buttons||{};q.buttons[u]=r},addCommand:function(t,r,q){this.execCommands[t]={func:r,scope:q||this}},addQueryStateHandler:function(t,r,q){this.queryStateCommands[t]={func:r,scope:q||this}},addQueryValueHandler:function(t,r,q){this.queryValueCommands[t]={func:r,scope:q||this}},addShortcut:function(s,v,q,u){var r=this,w;if(!r.settings.custom_shortcuts){return false}r.shortcuts=r.shortcuts||{};if(d(q,"string")){w=q;q=function(){r.execCommand(w,false,null)}}if(d(q,"object")){w=q;q=function(){r.execCommand(w[0],w[1],w[2])}}j(g(s),function(t){var x={func:q,scope:u||this,desc:v,alt:false,ctrl:false,shift:false};j(g(t,"+"),function(y){switch(y){case"alt":case"ctrl":case"shift":x[y]=true;break;default:x.charCode=y.charCodeAt(0);x.keyCode=y.toUpperCase().charCodeAt(0)}});r.shortcuts[(x.ctrl?"ctrl":"")+","+(x.alt?"alt":"")+","+(x.shift?"shift":"")+","+x.keyCode]=x});return true},execCommand:function(x,w,z,q){var u=this,v=0,y,r;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(x)&&(!q||!q.skip_focus)){u.focus()}y={};u.onBeforeExecCommand.dispatch(u,x,w,z,y);if(y.terminate){return false}if(u.execCallback("execcommand_callback",u.id,u.selection.getNode(),x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(y=u.execCommands[x]){r=y.func.call(y.scope,w,z);if(r!==true){u.onExecCommand.dispatch(u,x,w,z,q);return r}}j(u.plugins,function(s){if(s.execCommand&&s.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);v=1;return false}});if(v){return true}if(u.theme&&u.theme.execCommand&&u.theme.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(n.GlobalCommands.execCommand(u,x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(u.editorCommands.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}u.getDoc().execCommand(x,w,z);u.onExecCommand.dispatch(u,x,w,z,q)},queryCommandState:function(w){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryStateCommands[w]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandState(w);if(v!==-1){return v}try{return this.getDoc().queryCommandState(w)}catch(q){}},queryCommandValue:function(w){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryValueCommands[w]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandValue(w);if(d(v)){return v}try{return this.getDoc().queryCommandValue(w)}catch(q){}},show:function(){var q=this;o.show(q.getContainer());o.hide(q.id);q.load()},hide:function(){var q=this,r=q.getDoc();if(b&&r){r.execCommand("SelectAll")}q.save();o.hide(q.getContainer());o.setStyle(q.id,"display",q.orgDisplay)},isHidden:function(){return !o.isHidden(this.id)},setProgressState:function(q,r,s){this.onSetProgressState.dispatch(this,q,r,s);return q},load:function(u){var q=this,s=q.getElement(),r;if(s){u=u||{};u.load=true;r=q.setContent(d(s.value)?s.value:s.innerHTML,u);u.element=s;if(!u.no_events){q.onLoadContent.dispatch(q,u)}u.element=s=null;return r}},save:function(v){var q=this,u=q.getElement(),r,s;if(!u||!q.initialized){return}v=v||{};v.save=true;if(!v.no_events){q.undoManager.typing=0;q.undoManager.add()}v.element=u;r=v.content=q.getContent(v);if(!v.no_events){q.onSaveContent.dispatch(q,v)}r=v.content;if(!/TEXTAREA|INPUT/i.test(u.nodeName)){u.innerHTML=r;if(s=o.getParent(q.id,"form")){j(s.elements,function(t){if(t.name==q.id){t.value=r;return false}})}}else{u.value=r}v.element=u=null;return r},setContent:function(r,s){var q=this;s=s||{};s.format=s.format||"html";s.set=true;s.content=r;if(!s.no_events){q.onBeforeSetContent.dispatch(q,s)}if(!n.isIE&&(r.length===0||/^\s+$/.test(r))){s.content=q.dom.setHTML(q.getBody(),'<br mce_bogus="1" />');s.format="raw"}s.content=q.dom.setHTML(q.getBody(),n.trim(s.content));if(s.format!="raw"&&q.settings.cleanup){s.getInner=true;s.content=q.dom.setHTML(q.getBody(),q.serializer.serialize(q.getBody(),s))}if(!s.no_events){q.onSetContent.dispatch(q,s)}return s.content},getContent:function(s){var q=this,r;s=s||{};s.format=s.format||"html";s.get=true;if(!s.no_events){q.onBeforeGetContent.dispatch(q,s)}if(s.format!="raw"&&q.settings.cleanup){s.getInner=true;r=q.serializer.serialize(q.getBody(),s)}else{r=q.getBody().innerHTML}r=r.replace(/^\s*|\s*$/g,"");s.content=r;if(!s.no_events){q.onGetContent.dispatch(q,s)}return s.content},isDirty:function(){var q=this;return n.trim(q.startContent)!=n.trim(q.getContent({format:"raw",no_events:1}))&&!q.isNotDirty},getContainer:function(){var q=this;if(!q.container){q.container=o.get(q.editorContainer||q.id+"_parent")}return q.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return o.get(this.settings.content_element||this.id)},getWin:function(){var q=this,r;if(!q.contentWindow){r=o.get(q.id+"_ifr");if(r){q.contentWindow=r.contentWindow}}return q.contentWindow},getDoc:function(){var r=this,q;if(!r.contentDocument){q=r.getWin();if(q){r.contentDocument=q.document}}return r.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(q,x,w){var r=this,v=r.settings;if(v.urlconverter_callback){return r.execCallback("urlconverter_callback",q,w,true,x)}if(!v.convert_urls||(w&&w.nodeName=="LINK")||q.indexOf("file:")===0){return q}if(v.relative_urls){return r.documentBaseURI.toRelative(q)}q=r.documentBaseURI.toAbsolute(q,v.remove_script_host);return q},addVisual:function(u){var q=this,r=q.settings;u=u||q.getBody();if(!d(q.hasVisual)){q.hasVisual=r.visual}j(q.dom.select("table,a",u),function(t){var s;switch(t.nodeName){case"TABLE":s=q.dom.getAttrib(t,"border");if(!s||s=="0"){if(q.hasVisual){q.dom.addClass(t,r.visual_table_class)}else{q.dom.removeClass(t,r.visual_table_class)}}return;case"A":s=q.dom.getAttrib(t,"name");if(s){if(q.hasVisual){q.dom.addClass(t,"mceItemAnchor")}else{q.dom.removeClass(t,"mceItemAnchor")}}return}});q.onVisualAid.dispatch(q,u,q.hasVisual)},remove:function(){var q=this,r=q.getContainer();q.removed=1;q.hide();q.execCallback("remove_instance_callback",q);q.onRemove.dispatch(q);q.onExecCommand.listeners=[];i.remove(q);o.remove(r)},destroy:function(r){var q=this;if(q.destroyed){return}if(!r){n.removeUnload(q.destroy);tinyMCE.onBeforeUnload.remove(q._beforeUnload);if(q.theme&&q.theme.destroy){q.theme.destroy()}q.controlManager.destroy();q.selection.destroy();q.dom.destroy();if(!q.settings.content_editable){k.clear(q.getWin());k.clear(q.getDoc())}k.clear(q.getBody());k.clear(q.formElement)}if(q.formElement){q.formElement.submit=q.formElement._mceOldSubmit;q.formElement._mceOldSubmit=null}q.contentAreaContainer=q.formElement=q.container=q.settings.content_element=q.bodyElement=q.contentDocument=q.contentWindow=null;if(q.selection){q.selection=q.selection.win=q.selection.dom=q.selection.dom.doc=null}q.destroyed=1},_addEvents:function(){var w=this,v,y=w.settings,x={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function u(t,A){var s=t.type;if(w.removed){return}if(w.onEvent.dispatch(w,t,A)!==false){w[x[t.fakeType||t.type]].dispatch(w,t,A)}}j(x,function(t,s){switch(s){case"contextmenu":if(n.isOpera){w.dom.bind(w.getBody(),"mousedown",function(A){if(A.ctrlKey){A.fakeType="contextmenu";u(A)}})}else{w.dom.bind(w.getBody(),s,u)}break;case"paste":w.dom.bind(w.getBody(),s,function(A){u(A)});break;case"submit":case"reset":w.dom.bind(w.getElement().form||o.getParent(w.id,"form"),s,u);break;default:w.dom.bind(y.content_editable?w.getBody():w.getDoc(),s,u)}});w.dom.bind(y.content_editable?w.getBody():(a?w.getDoc():w.getWin()),"focus",function(s){w.focus(true)});if(n.isGecko){w.dom.bind(w.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("mce_src"))){t.src=w.documentBaseURI.toAbsolute(s)}})}if(a){function q(){var B=this,D=B.getDoc(),C=B.settings;if(a&&!C.readonly){if(B._isHidden()){try{if(!C.content_editable){D.designMode="On"}}catch(A){}}try{D.execCommand("styleWithCSS",0,false)}catch(A){if(!B._isHidden()){try{D.execCommand("useCSS",0,true)}catch(A){}}}if(!C.table_inline_editing){try{D.execCommand("enableInlineTableEditing",false,false)}catch(A){}}if(!C.object_resizing){try{D.execCommand("enableObjectResizing",false,false)}catch(A){}}}}w.onBeforeExecCommand.add(q);w.onMouseDown.add(q)}w.onMouseUp.add(w.nodeChanged);w.onClick.add(w.nodeChanged);w.onKeyUp.add(function(s,t){var A=t.keyCode;if((A>=33&&A<=36)||(A>=37&&A<=40)||A==13||A==45||A==46||A==8||(n.isMac&&(A==91||A==93))||t.ctrlKey){w.nodeChanged()}});w.onReset.add(function(){w.setContent(w.startContent,{format:"raw"})});if(y.custom_shortcuts){if(y.custom_undo_redo_keyboard_shortcuts){w.addShortcut("ctrl+z",w.getLang("undo_desc"),"Undo");w.addShortcut("ctrl+y",w.getLang("redo_desc"),"Redo")}if(a){w.addShortcut("ctrl+b",w.getLang("bold_desc"),"Bold");w.addShortcut("ctrl+i",w.getLang("italic_desc"),"Italic");w.addShortcut("ctrl+u",w.getLang("underline_desc"),"Underline")}for(v=1;v<=6;v++){w.addShortcut("ctrl+"+v,"",["FormatBlock",false,"<h"+v+">"])}w.addShortcut("ctrl+7","",["FormatBlock",false,"<p>"]);w.addShortcut("ctrl+8","",["FormatBlock",false,"<div>"]);w.addShortcut("ctrl+9","",["FormatBlock",false,"<address>"]);function z(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}j(w.shortcuts,function(A){if(n.isMac&&A.ctrl!=t.metaKey){return}else{if(!n.isMac&&A.ctrl!=t.ctrlKey){return}}if(A.alt!=t.altKey){return}if(A.shift!=t.shiftKey){return}if(t.keyCode==A.keyCode||(t.charCode&&t.charCode==A.charCode)){s=A;return false}});return s}w.onKeyUp.add(function(s,t){var A=z(t);if(A){return k.cancel(t)}});w.onKeyPress.add(function(s,t){var A=z(t);if(A){return k.cancel(t)}});w.onKeyDown.add(function(s,t){var A=z(t);if(A){A.func.call(A.scope);return k.cancel(t)}})}if(n.isIE){w.dom.bind(w.getDoc(),"controlselect",function(A){var t=w.resizeInfo,s;A=A.target;if(A.nodeName!=="IMG"){return}if(t){w.dom.unbind(t.node,t.ev,t.cb)}if(!w.dom.hasClass(A,"mceItemNoResize")){ev="resizeend";s=w.dom.bind(A,ev,function(C){var B;C=C.target;if(B=w.dom.getStyle(C,"width")){w.dom.setAttrib(C,"width",B.replace(/[^0-9%]+/g,""));w.dom.setStyle(C,"width","")}if(B=w.dom.getStyle(C,"height")){w.dom.setAttrib(C,"height",B.replace(/[^0-9%]+/g,""));w.dom.setStyle(C,"height","")}})}else{ev="resizestart";s=w.dom.bind(A,"resizestart",k.cancel,k)}t=w.resizeInfo={node:A,ev:ev,cb:s}});w.onKeyDown.add(function(s,t){switch(t.keyCode){case 8:if(w.selection.getRng().item){w.selection.getRng().item(0).removeNode();return k.cancel(t)}}})}if(n.isOpera){w.onClick.add(function(s,t){k.prevent(t)})}if(y.custom_undo_redo){function r(){w.undoManager.typing=0;w.undoManager.add()}if(n.isIE){w.dom.bind(w.getWin(),"blur",function(s){var t;if(w.selection){t=w.selection.getNode();if(!w.removed&&t.ownerDocument&&t.ownerDocument!=w.getDoc()){r()}}})}else{w.dom.bind(w.getDoc(),"blur",function(){if(w.selection&&!w.removed){r()}})}w.onMouseDown.add(r);w.onKeyUp.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45||t.ctrlKey){w.undoManager.typing=0;w.undoManager.add()}});w.onKeyDown.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45){if(w.undoManager.typing){w.undoManager.add();w.undoManager.typing=0}return}if(!w.undoManager.typing){w.undoManager.add();w.undoManager.typing=1}})}},_convertInlineElements:function(){var z=this,B=z.settings,r=z.dom,y,w,u,A,q;function x(s,t){if(!B.inline_styles){return}if(t.get){j(z.dom.select("table,u,strike",t.node),function(v){switch(v.nodeName){case"TABLE":if(y=r.getAttrib(v,"height")){r.setStyle(v,"height",y);r.setAttrib(v,"height","")}break;case"U":case"STRIKE":v.style.textDecoration=v.nodeName=="U"?"underline":"line-through";r.setAttrib(v,"mce_style","");r.setAttrib(v,"mce_name","span");break}})}else{if(t.set){j(z.dom.select("table,span",t.node).reverse(),function(v){if(v.nodeName=="TABLE"){if(y=r.getStyle(v,"height")){r.setAttrib(v,"height",y.replace(/[^0-9%]+/g,""))}}else{if(v.style.textDecoration=="underline"){u="u"}else{if(v.style.textDecoration=="line-through"){u="strike"}else{u=""}}if(u){v.style.textDecoration="";r.setAttrib(v,"mce_style","");w=r.create(u,{style:r.getAttrib(v,"style")});r.replace(w,v,1)}}})}}}z.onPreProcess.add(x);if(!B.cleanup_on_startup){z.onSetContent.add(function(s,t){if(t.initial){x(z,{node:z.getBody(),set:1})}})}},_convertFonts:function(){var w=this,x=w.settings,z=w.dom,v,r,q,u;if(!x.inline_styles){return}v=[8,10,12,14,18,24,36];r=["xx-small","x-small","small","medium","large","x-large","xx-large"];if(q=x.font_size_style_values){q=g(q)}if(u=x.font_size_classes){u=g(u)}function y(B){var C,A,t,s;if(!x.inline_styles){return}t=w.dom.select("font",B);for(s=t.length-1;s>=0;s--){C=t[s];A=z.create("span",{style:z.getAttrib(C,"style"),"class":z.getAttrib(C,"class")});z.setStyles(A,{fontFamily:z.getAttrib(C,"face"),color:z.getAttrib(C,"color"),backgroundColor:C.style.backgroundColor});if(C.size){if(q){z.setStyle(A,"fontSize",q[parseInt(C.size)-1])}else{z.setAttrib(A,"class",u[parseInt(C.size)-1])}}z.setAttrib(A,"mce_style","");z.replace(A,C,1)}}w.onPreProcess.add(function(s,t){if(t.get){y(t.node)}});w.onSetContent.add(function(s,t){if(t.initial){y(t.node)}})},_isHidden:function(){var q;if(!a){return 0}q=this.selection.getSel();return(!q||!q.rangeCount||q.rangeCount==0)},_fixNesting:function(r){var t=[],q;r=r.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(u,s,w){var v;if(s==="/"){if(!t.length){return""}if(w!==t[t.length-1].tag){for(q=t.length-1;q>=0;q--){if(t[q].tag===w){t[q].close=1;break}}return""}else{t.pop();if(t.length&&t[t.length-1].close){u=u+"</"+t[t.length-1].tag+">";t.pop()}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(w)){return u}if(/\/>$/.test(u)){return u}t.push({tag:w})}return u});for(q=t.length-1;q>=0;q--){r+="</"+t[q].tag+">"}return r}})})(tinymce);(function(d){var f=d.each,c=d.isIE,a=d.isGecko,b=d.isOpera,e=d.isWebKit;d.create("tinymce.EditorCommands",{EditorCommands:function(g){this.editor=g},execCommand:function(k,j,l){var h=this,g=h.editor,i;switch(k){case"mceResetDesignMode":case"mceBeginUndoLevel":return true;case"unlink":h.UnLink();return true;case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":h.mceJustify(k,k.substring(7).toLowerCase());return true;default:i=this[k];if(i){i.call(this,j,l);return true}}return false},Indent:function(){var g=this.editor,l=g.dom,j=g.selection,k,h,i;h=g.settings.indentation;i=/[a-z%]+$/i.exec(h);h=parseInt(h);if(g.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){f(j.getSelectedBlocks(),function(m){l.setStyle(m,"paddingLeft",(parseInt(m.style.paddingLeft||0)+h)+i)});return}g.getDoc().execCommand("Indent",false,null);if(c){l.getParent(j.getNode(),function(m){if(m.nodeName=="BLOCKQUOTE"){m.dir=m.style.cssText=""}})}},Outdent:function(){var h=this.editor,m=h.dom,k=h.selection,l,g,i,j;i=h.settings.indentation;j=/[a-z%]+$/i.exec(i);i=parseInt(i);if(h.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){f(k.getSelectedBlocks(),function(n){g=Math.max(0,parseInt(n.style.paddingLeft||0)-i);m.setStyle(n,"paddingLeft",g?g+j:"")});return}h.getDoc().execCommand("Outdent",false,null)},mceSetContent:function(h,g){this.editor.setContent(g)},mceToggleVisualAid:function(){var g=this.editor;g.hasVisual=!g.hasVisual;g.addVisual()},mceReplaceContent:function(h,g){var i=this.editor.selection;i.setContent(g.replace(/\{\$selection\}/g,i.getContent({format:"text"})))},mceInsertLink:function(i,h){var g=this.editor,j=g.selection,k=g.dom.getParent(j.getNode(),"a");if(d.is(h,"string")){h={href:h}}function l(m){f(h,function(o,n){g.dom.setAttrib(m,n,o)})}if(!k){g.execCommand("CreateLink",false,"javascript:mctmp(0);");f(g.dom.select("a[href=javascript:mctmp(0);]"),function(m){l(m)})}else{if(h.href){l(k)}else{g.dom.remove(k,1)}}},UnLink:function(){var g=this.editor,h=g.selection;if(h.isCollapsed()){h.select(h.getNode())}g.getDoc().execCommand("unlink",false,null);h.collapse(0)},FontName:function(i,h){var j=this,g=j.editor,k=g.selection,l;if(!h){if(k.isCollapsed()){k.select(k.getNode())}}else{if(g.settings.convert_fonts_to_spans){j._applyInlineStyle("span",{style:{fontFamily:h}})}else{g.getDoc().execCommand("FontName",false,h)}}},FontSize:function(j,i){var h=this.editor,l=h.settings,k,g;if(l.convert_fonts_to_spans&&i>=1&&i<=7){g=d.explode(l.font_size_style_values);k=d.explode(l.font_size_classes);if(k){i=k[i-1]||i}else{i=g[i-1]||i}}if(i>=1&&i<=7){h.getDoc().execCommand("FontSize",false,i)}else{this._applyInlineStyle("span",{style:{fontSize:i}})}},queryCommandValue:function(h){var g=this["queryValue"+h];if(g){return g.call(this,h)}return false},queryCommandState:function(h){var g;switch(h){case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":return this.queryStateJustify(h,h.substring(7).toLowerCase());default:if(g=this["queryState"+h]){return g.call(this,h)}}return -1},_queryState:function(h){try{return this.editor.getDoc().queryCommandState(h)}catch(g){}},_queryVal:function(h){try{return this.editor.getDoc().queryCommandValue(h)}catch(g){}},queryValueFontSize:function(){var h=this.editor,g=0,i;if(i=h.dom.getParent(h.selection.getNode(),"span")){g=i.style.fontSize}if(!g&&(b||e)){if(i=h.dom.getParent(h.selection.getNode(),"font")){g=i.size}return g}return g||this._queryVal("FontSize")},queryValueFontName:function(){var h=this.editor,g=0,i;if(i=h.dom.getParent(h.selection.getNode(),"font")){g=i.face}if(i=h.dom.getParent(h.selection.getNode(),"span")){g=i.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}if(!g){g=this._queryVal("FontName")}return g},mceJustify:function(o,p){var k=this.editor,m=k.selection,g=m.getNode(),q=g.nodeName,h,j,i=k.dom,l;if(k.settings.inline_styles&&this.queryStateJustify(o,p)){l=1}h=i.getParent(g,k.dom.isBlock);if(q=="IMG"){if(p=="full"){return}if(l){if(p=="center"){i.setStyle(h||g.parentNode,"textAlign","")}i.setStyle(g,"float","");this.mceRepaint();return}if(p=="center"){if(h&&/^(TD|TH)$/.test(h.nodeName)){h=0}if(!h||h.childNodes.length>1){j=i.create("p");j.appendChild(g.cloneNode(false));if(h){i.insertAfter(j,h)}else{i.insertAfter(j,g)}i.remove(g);g=j.firstChild;h=j}i.setStyle(h,"textAlign",p);i.setStyle(g,"float","")}else{i.setStyle(g,"float",p);i.setStyle(h||g.parentNode,"textAlign","")}this.mceRepaint();return}if(k.settings.inline_styles&&k.settings.forced_root_block){if(l){p=""}f(m.getSelectedBlocks(i.getParent(m.getStart(),i.isBlock),i.getParent(m.getEnd(),i.isBlock)),function(n){i.setAttrib(n,"align","");i.setStyle(n,"textAlign",p=="full"?"justify":p)});return}else{if(!l){k.getDoc().execCommand(o,false,null)}}if(k.settings.inline_styles){if(l){i.getParent(k.selection.getNode(),function(r){if(r.style&&r.style.textAlign){i.setStyle(r,"textAlign","")}});return}f(i.select("*"),function(s){var r=s.align;if(r){if(r=="full"){r="justify"}i.setStyle(s,"textAlign",r);i.setAttrib(s,"align","")}})}},mceSetCSSClass:function(h,g){this.mceSetStyleInfo(0,{command:"setattrib",name:"class",value:g})},getSelectedElement:function(){var w=this,o=w.editor,n=o.dom,s=o.selection,h=s.getRng(),l,k,u,p,j,g,q,i,x,v;if(s.isCollapsed()||h.item){return s.getNode()}v=o.settings.merge_styles_invalid_parents;if(d.is(v,"string")){v=new RegExp(v,"i")}if(c){l=h.duplicate();l.collapse(true);u=l.parentElement();k=h.duplicate();k.collapse(false);p=k.parentElement();if(u!=p){l.move("character",1);u=l.parentElement()}if(u==p){l=h.duplicate();l.moveToElementText(u);if(l.compareEndPoints("StartToStart",h)==0&&l.compareEndPoints("EndToEnd",h)==0){return v&&v.test(u.nodeName)?null:u}}}else{function m(r){return n.getParent(r,"*")}u=h.startContainer;p=h.endContainer;j=h.startOffset;g=h.endOffset;if(!h.collapsed){if(u==p){if(j-g<2){if(u.hasChildNodes()){i=u.childNodes[j];return v&&v.test(i.nodeName)?null:i}}}}if(u.nodeType!=3||p.nodeType!=3){return null}if(j==0){i=m(u);if(i&&i.firstChild!=u){i=null}}if(j==u.nodeValue.length){q=u.nextSibling;if(q&&q.nodeType==1){i=u.nextSibling}}if(g==0){q=p.previousSibling;if(q&&q.nodeType==1){x=q}}if(g==p.nodeValue.length){x=m(p);if(x&&x.lastChild!=p){x=null}}if(i==x){return v&&i&&v.test(i.nodeName)?null:i}}return null},mceSetStyleInfo:function(n,m){var q=this,h=q.editor,j=h.getDoc(),g=h.dom,i,k,r=h.selection,p=m.wrapper||"span",k=r.getBookmark(),o;function l(t,s){if(t.nodeType==1){switch(m.command){case"setattrib":return g.setAttrib(t,m.name,m.value);case"setstyle":return g.setStyle(t,m.name,m.value);case"removeformat":return g.setAttrib(t,"class","")}}}o=h.settings.merge_styles_invalid_parents;if(d.is(o,"string")){o=new RegExp(o,"i")}if((i=q.getSelectedElement())&&!h.settings.force_span_wrappers){l(i,1)}else{j.execCommand("FontName",false,"__");f(g.select("span,font"),function(u){var s,t;if(g.getAttrib(u,"face")=="__"||u.style.fontFamily==="__"){s=g.create(p,{mce_new:"1"});l(s);f(u.childNodes,function(v){s.appendChild(v.cloneNode(true))});g.replace(s,u)}})}f(g.select(p).reverse(),function(t){var s=t.parentNode;if(!g.getAttrib(t,"mce_new")){s=g.getParent(t,"*[mce_new]");if(s){g.remove(t,1)}}});f(g.select(p).reverse(),function(t){var s=t.parentNode;if(!s||!g.getAttrib(t,"mce_new")){return}if(h.settings.force_span_wrappers&&s.nodeName!="SPAN"){return}if(s.nodeName==p.toUpperCase()&&s.childNodes.length==1){return g.remove(s,1)}if(t.nodeType==1&&(!o||!o.test(s.nodeName))&&s.childNodes.length==1){l(s);g.setAttrib(t,"class","")}});f(g.select(p).reverse(),function(s){if(g.getAttrib(s,"mce_new")||(g.getAttribs(s).length<=1&&s.className==="")){if(!g.getAttrib(s,"class")&&!g.getAttrib(s,"style")){return g.remove(s,1)}g.setAttrib(s,"mce_new","")}});r.moveToBookmark(k)},queryStateJustify:function(k,h){var g=this.editor,j=g.selection.getNode(),i=g.dom;if(j&&j.nodeName=="IMG"){if(i.getStyle(j,"float")==h){return 1}return j.parentNode.style.textAlign==h}j=i.getParent(g.selection.getStart(),function(l){return l.nodeType==1&&l.style.textAlign});if(h=="full"){h="justify"}if(g.settings.inline_styles){return(j&&j.style.textAlign==h)}return this._queryState(k)},ForeColor:function(i,h){var g=this.editor;if(g.settings.convert_fonts_to_spans){this._applyInlineStyle("span",{style:{color:h}});return}else{g.getDoc().execCommand("ForeColor",false,h)}},HiliteColor:function(i,k){var h=this,g=h.editor,j=g.getDoc();if(g.settings.convert_fonts_to_spans){this._applyInlineStyle("span",{style:{backgroundColor:k}});return}function l(n){if(!a){return}try{j.execCommand("styleWithCSS",0,n)}catch(m){j.execCommand("useCSS",0,!n)}}if(a||b){l(true);j.execCommand("hilitecolor",false,k);l(false)}else{j.execCommand("BackColor",false,k)}},FormatBlock:function(n,h){var o=this,l=o.editor,p=l.selection,j=l.dom,g,k,m;function i(q){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(q.nodeName)}g=j.getParent(p.getNode(),function(q){return i(q)});if(g){if((c&&i(g.parentNode))||g.nodeName=="DIV"){k=l.dom.create(h);f(j.getAttribs(g),function(q){j.setAttrib(k,q.nodeName,j.getAttrib(g,q.nodeName))});m=p.getBookmark();j.replace(k,g,1);p.moveToBookmark(m);l.nodeChanged();return}}h=l.settings.forced_root_block?(h||"<p>"):h;if(h.indexOf("<")==-1){h="<"+h+">"}if(d.isGecko){h=h.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,"$1")}l.getDoc().execCommand("FormatBlock",false,h)},mceCleanup:function(){var h=this.editor,i=h.selection,g=i.getBookmark();h.setContent(h.getContent());i.moveToBookmark(g)},mceRemoveNode:function(j,k){var h=this.editor,i=h.selection,g,l=k||i.getNode();if(l==h.getBody()){return}g=i.getBookmark();h.dom.remove(l,1);i.moveToBookmark(g);h.nodeChanged()},mceSelectNodeDepth:function(i,j){var g=this.editor,h=g.selection,k=0;g.dom.getParent(h.getNode(),function(l){if(l.nodeType==1&&k++==j){h.select(l);g.nodeChanged();return false}},g.getBody())},mceSelectNode:function(h,g){this.editor.selection.select(g)},mceInsertContent:function(g,h){this.editor.selection.setContent(h)},mceInsertRawHTML:function(h,i){var g=this.editor;g.selection.setContent("tiny_mce_marker");g.setContent(g.getContent().replace(/tiny_mce_marker/g,i))},mceRepaint:function(){var i,g,j=this.editor;if(d.isGecko){try{i=j.selection;g=i.getBookmark(true);if(i.getSel()){i.getSel().selectAllChildren(j.getBody())}i.collapse(true);i.moveToBookmark(g)}catch(h){}}},queryStateUnderline:function(){var g=this.editor,h=g.selection.getNode();if(h&&h.nodeName=="A"){return false}return this._queryState("Underline")},queryStateOutdent:function(){var g=this.editor,h;if(g.settings.inline_styles){if((h=g.dom.getParent(g.selection.getStart(),g.dom.isBlock))&&parseInt(h.style.paddingLeft)>0){return true}if((h=g.dom.getParent(g.selection.getEnd(),g.dom.isBlock))&&parseInt(h.style.paddingLeft)>0){return true}}return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList()||(!g.settings.inline_styles&&!!g.dom.getParent(g.selection.getNode(),"BLOCKQUOTE"))},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),"UL")},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),"OL")},queryStatemceBlockQuote:function(){return !!this.editor.dom.getParent(this.editor.selection.getStart(),function(g){return g.nodeName==="BLOCKQUOTE"})},_applyInlineStyle:function(o,j,m){var q=this,n=q.editor,l=n.dom,i,p={},k,r;o=o.toUpperCase();if(m&&m.check_classes&&j["class"]){m.check_classes.push(j["class"])}function h(){f(l.select(o).reverse(),function(t){var s=0;f(l.getAttribs(t),function(u){if(u.nodeName.substring(0,1)!="_"&&l.getAttrib(t,u.nodeName)!=""){s++}});if(s==0){l.remove(t,1)}})}function g(){var s;f(l.select("span,font"),function(t){if(t.style.fontFamily=="mceinline"||t.face=="mceinline"){if(!s){s=n.selection.getBookmark()}j._mce_new="1";l.replace(l.create(o,j),t,1)}});f(l.select(o+"[_mce_new]"),function(u){function t(v){if(v.nodeType==1){f(j.style,function(x,w){l.setStyle(v,w,"")});if(j["class"]&&v.className&&m){f(m.check_classes,function(w){if(l.hasClass(v,w)){l.removeClass(v,w)}})}}}f(l.select(o,u),t);if(u.parentNode&&u.parentNode.nodeType==1&&u.parentNode.childNodes.length==1){t(u.parentNode)}l.getParent(u.parentNode,function(v){if(v.nodeType==1){if(j.style){f(j.style,function(y,x){var w;if(!p[x]&&(w=l.getStyle(v,x))){if(w===y){l.setStyle(u,x,"")}p[x]=1}})}if(j["class"]&&v.className&&m){f(m.check_classes,function(w){if(l.hasClass(v,w)){l.removeClass(u,w)}})}}return false});u.removeAttribute("_mce_new")});h();n.selection.moveToBookmark(s);return !!s}n.focus();n.getDoc().execCommand("FontName",false,"mceinline");g();if(k=q._applyInlineStyle.keyhandler){n.onKeyUp.remove(k);n.onKeyPress.remove(k);n.onKeyDown.remove(k);n.onSetContent.remove(q._applyInlineStyle.chandler)}if(n.selection.isCollapsed()){if(!c){f(l.getParents(n.selection.getNode(),"span"),function(s){f(j.style,function(u,t){var w;if(w=l.getStyle(s,t)){if(w==u){l.setStyle(s,t,"");r=2;return false}r=1;return false}});if(r){return false}});if(r==2){i=n.selection.getBookmark();h();n.selection.moveToBookmark(i);window.setTimeout(function(){n.nodeChanged()},1);return}}q._pendingStyles=d.extend(q._pendingStyles||{},j.style);q._applyInlineStyle.chandler=n.onSetContent.add(function(){delete q._pendingStyles});q._applyInlineStyle.keyhandler=k=function(s){if(q._pendingStyles){j.style=q._pendingStyles;delete q._pendingStyles}if(g()){n.onKeyDown.remove(q._applyInlineStyle.keyhandler);n.onKeyPress.remove(q._applyInlineStyle.keyhandler)}if(s.type=="keyup"){n.onKeyUp.remove(q._applyInlineStyle.keyhandler)}};n.onKeyDown.add(k);n.onKeyPress.add(k);n.onKeyUp.add(k)}else{q._pendingStyles=0}}})})(tinymce);(function(a){a.create("tinymce.UndoManager",{index:0,data:null,typing:0,UndoManager:function(c){var d=this,b=a.util.Dispatcher;d.editor=c;d.data=[];d.onAdd=new b(this);d.onUndo=new b(this);d.onRedo=new b(this)},add:function(d){var g=this,f,e=g.editor,c,h=e.settings,j;d=d||{};d.content=d.content||e.getContent({format:"raw",no_events:1});d.content=d.content.replace(/^\s*|\s*$/g,"");j=g.data[g.index>0&&(g.index==0||g.index==g.data.length)?g.index-1:g.index];if(!d.initial&&j&&d.content==j.content){return null}if(h.custom_undo_redo_levels){if(g.data.length>h.custom_undo_redo_levels){for(f=0;f<g.data.length-1;f++){g.data[f]=g.data[f+1]}g.data.length--;g.index=g.data.length}}if(h.custom_undo_redo_restore_selection&&!d.initial){d.bookmark=c=d.bookmark||e.selection.getBookmark()}if(g.index<g.data.length){g.index++}if(g.data.length===0&&!d.initial){return null}g.data.length=g.index+1;g.data[g.index++]=d;if(d.initial){g.index=0}if(g.data.length==2&&g.data[0].initial){g.data[0].bookmark=c}g.onAdd.dispatch(g,d);e.isNotDirty=0;return d},undo:function(){var e=this,c=e.editor,b=b,d;if(e.typing){e.add();e.typing=0}if(e.index>0){if(e.index==e.data.length&&e.index>1){d=e.index;e.typing=0;if(!e.add()){e.index=d}--e.index}b=e.data[--e.index];c.setContent(b.content,{format:"raw"});c.selection.moveToBookmark(b.bookmark);e.onUndo.dispatch(e,b)}return b},redo:function(){var d=this,c=d.editor,b=null;if(d.index<d.data.length-1){b=d.data[++d.index];c.setContent(b.content,{format:"raw"});c.selection.moveToBookmark(b.bookmark);d.onRedo.dispatch(d,b)}return b},clear:function(){var b=this;b.data=[];b.index=0;b.typing=0;b.add({initial:true})},hasUndo:function(){return this.index!=0||this.typing},hasRedo:function(){return this.index<this.data.length-1}})})(tinymce);(function(i){var h,c,a,b,g,f;h=i.dom.Event;c=i.isIE;a=i.isGecko;b=i.isOpera;g=i.each;f=i.extend;function e(k,l){var j=l.ownerDocument.createRange();j.setStart(k.endContainer,k.endOffset);j.setEndAfter(l);return j.cloneContents().textContent.length==0}function d(j){j=j.innerHTML;j=j.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi,"-");j=j.replace(/<[^>]+>/g,"");return j.replace(/[ \t\r\n]+/g,"")==""}i.create("tinymce.ForceBlocks",{ForceBlocks:function(k){var l=this,m=k.settings,n;l.editor=k;l.dom=k.dom;n=(m.forced_root_block||"p").toLowerCase();m.element=n.toUpperCase();k.onPreInit.add(l.setup,l);l.reOpera=new RegExp("(\\u00a0|&#160;|&nbsp;)</"+n+">","gi");l.rePadd=new RegExp("<p( )([^>]+)><\\/p>|<p( )([^>]+)\\/>|<p( )([^>]+)>\\s+<\\/p>|<p><\\/p>|<p\\/>|<p>\\s+<\\/p>".replace(/p/g,n),"gi");l.reNbsp2BR1=new RegExp("<p( )([^>]+)>[\\s\\u00a0]+<\\/p>|<p>[\\s\\u00a0]+<\\/p>".replace(/p/g,n),"gi");l.reNbsp2BR2=new RegExp("<%p()([^>]+)>(&nbsp;|&#160;)<\\/%p>|<%p>(&nbsp;|&#160;)<\\/%p>".replace(/%p/g,n),"gi");l.reBR2Nbsp=new RegExp("<p( )([^>]+)>\\s*<br \\/>\\s*<\\/p>|<p>\\s*<br \\/>\\s*<\\/p>".replace(/p/g,n),"gi");function j(p,q){if(b){q.content=q.content.replace(l.reOpera,"</"+n+">")}q.content=q.content.replace(l.rePadd,"<"+n+"$1$2$3$4$5$6>\u00a0</"+n+">");if(!c&&!b&&q.set){q.content=q.content.replace(l.reNbsp2BR1,"<"+n+"$1$2><br /></"+n+">");q.content=q.content.replace(l.reNbsp2BR2,"<"+n+"$1$2><br /></"+n+">")}else{q.content=q.content.replace(l.reBR2Nbsp,"<"+n+"$1$2>\u00a0</"+n+">")}}k.onBeforeSetContent.add(j);k.onPostProcess.add(j);if(m.forced_root_block){k.onInit.add(l.forceRoots,l);k.onSetContent.add(l.forceRoots,l);k.onBeforeGetContent.add(l.forceRoots,l)}},setup:function(){var k=this,j=k.editor,l=j.settings;if(l.forced_root_block){j.onKeyUp.add(k.forceRoots,k);j.onPreProcess.add(k.forceRoots,k)}if(l.force_br_newlines){if(c){j.onKeyPress.add(function(o,q){var r,p=o.selection;if(q.keyCode==13&&p.getNode().nodeName!="LI"){p.setContent('<br id="__" /> ',{format:"raw"});r=o.dom.get("__");r.removeAttribute("id");p.select(r);p.collapse();return h.cancel(q)}})}return}if(!c&&l.force_p_newlines){j.onKeyPress.add(function(n,o){if(o.keyCode==13&&!o.shiftKey){if(!k.insertPara(o)){h.cancel(o)}}});if(a){j.onKeyDown.add(function(n,o){if((o.keyCode==8||o.keyCode==46)&&!o.shiftKey){k.backspaceDelete(o,o.keyCode==8)}})}}function m(o,n){var p=j.dom.create(n);g(o.attributes,function(q){if(q.specified&&q.nodeValue){p.setAttribute(q.nodeName.toLowerCase(),q.nodeValue)}});g(o.childNodes,function(q){p.appendChild(q.cloneNode(true))});o.parentNode.replaceChild(p,o);return p}j.onPreProcess.add(function(n,p){g(n.dom.select("p,h1,h2,h3,h4,h5,h6,div",p.node),function(o){if(d(o)){g(n.dom.select("span,em,strong,b,i",p.node),function(q){if(!q.hasChildNodes()){q.appendChild(n.getDoc().createTextNode("\u00a0"));return false}})}})});if(c){if(l.element!="P"){j.onKeyPress.add(function(n,o){k.lastElm=n.selection.getNode().nodeName});j.onKeyUp.add(function(p,r){var t,q=p.selection,s=q.getNode(),o=p.getBody();if(o.childNodes.length===1&&s.nodeName=="P"){s=m(s,l.element);q.select(s);q.collapse();p.nodeChanged()}else{if(r.keyCode==13&&!r.shiftKey&&k.lastElm!="P"){t=p.dom.getParent(s,"p");if(t){m(t,l.element);p.nodeChanged()}}}})}}},find:function(p,l,m){var k=this.editor,j=k.getDoc().createTreeWalker(p,4,null,false),o=-1;while(p=j.nextNode()){o++;if(l==0&&p==m){return o}if(l==1&&o==m){return p}}return -1},forceRoots:function(p,D){var u=this,p=u.editor,H=p.getBody(),E=p.getDoc(),K=p.selection,v=K.getSel(),w=K.getRng(),I=-2,o,B,j,k,F=-16777215;var G,l,J,A,x,m=H.childNodes,z,y,q;for(z=m.length-1;z>=0;z--){G=m[z];if(G.nodeType===3||(!u.dom.isBlock(G)&&G.nodeType!==8&&!/^(script|mce:script|style|mce:style)$/i.test(G.nodeName))){if(!l){if(G.nodeType!=3||/[^\s]/g.test(G.nodeValue)){if(I==-2&&w){if(!c){if(w.startContainer.nodeType==1&&(y=w.startContainer.childNodes[w.startOffset])&&y.nodeType==1){q=y.getAttribute("id");y.setAttribute("id","__mce")}else{if(p.dom.getParent(w.startContainer,function(n){return n===H})){B=w.startOffset;j=w.endOffset;I=u.find(H,0,w.startContainer);o=u.find(H,0,w.endContainer)}}}else{k=E.body.createTextRange();k.moveToElementText(H);k.collapse(1);J=k.move("character",F)*-1;k=w.duplicate();k.collapse(1);A=k.move("character",F)*-1;k=w.duplicate();k.collapse(0);x=(k.move("character",F)*-1)-A;I=A-J;o=x}}l=p.dom.create(p.settings.forced_root_block);G.parentNode.replaceChild(l,G);l.appendChild(G)}}else{if(l.hasChildNodes()){l.insertBefore(G,l.firstChild)}else{l.appendChild(G)}}}else{l=null}}if(I!=-2){if(!c){l=H.getElementsByTagName(p.settings.element)[0];w=E.createRange();if(I!=-1){w.setStart(u.find(H,1,I),B)}else{w.setStart(l,0)}if(o!=-1){w.setEnd(u.find(H,1,o),j)}else{w.setEnd(l,0)}if(v){v.removeAllRanges();v.addRange(w)}}else{try{w=v.createRange();w.moveToElementText(H);w.collapse(1);w.moveStart("character",I);w.moveEnd("character",o);w.select()}catch(C){}}}else{if(!c&&(y=p.dom.get("__mce"))){if(q){y.setAttribute("id",q)}else{y.removeAttribute("id")}w=E.createRange();w.setStartBefore(y);w.setEndBefore(y);K.setRng(w)}}},getParentBlock:function(k){var j=this.dom;return j.getParent(k,j.isBlock)},insertPara:function(N){var B=this,p=B.editor,J=p.dom,O=p.getDoc(),S=p.settings,C=p.selection.getSel(),D=C.getRangeAt(0),R=O.body;var G,H,E,L,K,m,k,o,u,j,z,Q,l,q,F,I=J.getViewPort(p.getWin()),x,A,w;G=O.createRange();G.setStart(C.anchorNode,C.anchorOffset);G.collapse(true);H=O.createRange();H.setStart(C.focusNode,C.focusOffset);H.collapse(true);E=G.compareBoundaryPoints(G.START_TO_END,H)<0;L=E?C.anchorNode:C.focusNode;K=E?C.anchorOffset:C.focusOffset;m=E?C.focusNode:C.anchorNode;k=E?C.focusOffset:C.anchorOffset;if(L===m&&/^(TD|TH)$/.test(L.nodeName)){if(L.firstChild.nodeName=="BR"){J.remove(L.firstChild)}if(L.childNodes.length==0){p.dom.add(L,S.element,null,"<br />");Q=p.dom.add(L,S.element,null,"<br />")}else{F=L.innerHTML;L.innerHTML="";p.dom.add(L,S.element,null,F);Q=p.dom.add(L,S.element,null,"<br />")}D=O.createRange();D.selectNodeContents(Q);D.collapse(1);p.selection.setRng(D);return false}if(L==R&&m==R&&R.firstChild&&p.dom.isBlock(R.firstChild)){L=m=L.firstChild;K=k=0;G=O.createRange();G.setStart(L,0);H=O.createRange();H.setStart(m,0)}L=L.nodeName=="HTML"?O.body:L;L=L.nodeName=="BODY"?L.firstChild:L;m=m.nodeName=="HTML"?O.body:m;m=m.nodeName=="BODY"?m.firstChild:m;o=B.getParentBlock(L);u=B.getParentBlock(m);j=o?o.nodeName:S.element;if(B.dom.getParent(o,"ol,ul,pre")){return true}if(o&&(o.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(J.getStyle(o,"position",1)))){j=S.element;o=null}if(u&&(u.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(J.getStyle(o,"position",1)))){j=S.element;u=null}if(/(TD|TABLE|TH|CAPTION)/.test(j)||(o&&j=="DIV"&&/left|right/gi.test(J.getStyle(o,"float",1)))){j=S.element;o=u=null}z=(o&&o.nodeName==j)?o.cloneNode(0):p.dom.create(j);Q=(u&&u.nodeName==j)?u.cloneNode(0):p.dom.create(j);Q.removeAttribute("id");if(/^(H[1-6])$/.test(j)&&e(D,o)){Q=p.dom.create(S.element)}F=l=L;do{if(F==R||F.nodeType==9||B.dom.isBlock(F)||/(TD|TABLE|TH|CAPTION)/.test(F.nodeName)){break}l=F}while((F=F.previousSibling?F.previousSibling:F.parentNode));F=q=m;do{if(F==R||F.nodeType==9||B.dom.isBlock(F)||/(TD|TABLE|TH|CAPTION)/.test(F.nodeName)){break}q=F}while((F=F.nextSibling?F.nextSibling:F.parentNode));if(l.nodeName==j){G.setStart(l,0)}else{G.setStartBefore(l)}G.setEnd(L,K);z.appendChild(G.cloneContents()||O.createTextNode(""));try{H.setEndAfter(q)}catch(M){}H.setStart(m,k);Q.appendChild(H.cloneContents()||O.createTextNode(""));D=O.createRange();if(!l.previousSibling&&l.parentNode.nodeName==j){D.setStartBefore(l.parentNode)}else{if(G.startContainer.nodeName==j&&G.startOffset==0){D.setStartBefore(G.startContainer)}else{D.setStart(G.startContainer,G.startOffset)}}if(!q.nextSibling&&q.parentNode.nodeName==j){D.setEndAfter(q.parentNode)}else{D.setEnd(H.endContainer,H.endOffset)}D.deleteContents();if(b){p.getWin().scrollTo(0,I.y)}if(z.firstChild&&z.firstChild.nodeName==j){z.innerHTML=z.firstChild.innerHTML}if(Q.firstChild&&Q.firstChild.nodeName==j){Q.innerHTML=Q.firstChild.innerHTML}if(d(z)){z.innerHTML="<br />"}function P(y,s){var r=[],U,T,t;y.innerHTML="";if(S.keep_styles){T=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(T.nodeName)){U=T.cloneNode(false);J.setAttrib(U,"id","");r.push(U)}}while(T=T.parentNode)}if(r.length>0){for(t=r.length-1,U=y;t>=0;t--){U=U.appendChild(r[t])}r[0].innerHTML=b?"&nbsp;":"<br />";return r[0]}else{y.innerHTML=b?"&nbsp;":"<br />"}}if(d(Q)){w=P(Q,m)}if(b&&parseFloat(opera.version())<9.5){D.insertNode(z);D.insertNode(Q)}else{D.insertNode(Q);D.insertNode(z)}Q.normalize();z.normalize();function v(r){return O.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false).nextNode()||r}D=O.createRange();D.selectNodeContents(a?v(w||Q):w||Q);D.collapse(1);C.removeAllRanges();C.addRange(D);x=p.dom.getPos(Q).y;A=Q.clientHeight;if(x<I.y||x+A>I.y+I.h){p.getWin().scrollTo(0,x<I.y?x:x-I.h+25)}return false},backspaceDelete:function(o,x){var z=this,m=z.editor,s=m.getBody(),l=m.dom,k,p=m.selection,j=p.getRng(),q=j.startContainer,k,u,v;if(q&&m.dom.isBlock(q)&&!/^(TD|TH)$/.test(q.nodeName)&&x){if(q.childNodes.length==0||(q.childNodes.length==1&&q.firstChild.nodeName=="BR")){k=q;while((k=k.previousSibling)&&!m.dom.isBlock(k)){}if(k){if(q!=s.firstChild){u=m.dom.doc.createTreeWalker(k,NodeFilter.SHOW_TEXT,null,false);while(v=u.nextNode()){k=v}j=m.getDoc().createRange();j.setStart(k,k.nodeValue?k.nodeValue.length:0);j.setEnd(k,k.nodeValue?k.nodeValue.length:0);p.setRng(j);m.dom.remove(q)}return h.cancel(o)}}}function y(n){var r;n=n.target;if(n&&n.parentNode&&n.nodeName=="BR"&&(k=z.getParentBlock(n))){r=n.previousSibling;h.remove(s,"DOMNodeInserted",y);if(r&&r.nodeType==3&&/\s+$/.test(r.nodeValue)){return}if(n.previousSibling||n.nextSibling){m.dom.remove(n)}}}h._add(s,"DOMNodeInserted",y);window.setTimeout(function(){h._remove(s,"DOMNodeInserted",y)},1)}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each,e=c.extend;c.create("tinymce.ControlManager",{ControlManager:function(f,j){var h=this,g;j=j||{};h.editor=f;h.controls={};h.onAdd=new c.util.Dispatcher(h);h.onPostRender=new c.util.Dispatcher(h);h.prefix=j.prefix||f.id+"_";h._cls={};h.onPostRender.add(function(){d(h.controls,function(i){i.postRender()})})},get:function(f){return this.controls[this.prefix+f]||this.controls[f]},setActive:function(h,f){var g=null;if(g=this.get(h)){g.setActive(f)}return g},setDisabled:function(h,f){var g=null;if(g=this.get(h)){g.setDisabled(f)}return g},add:function(g){var f=this;if(g){f.controls[g.id]=g;f.onAdd.dispatch(g,f)}return g},createControl:function(i){var h,g=this,f=g.editor;d(f.plugins,function(j){if(j.createControl){h=j.createControl(i,g);if(h){return false}}});switch(i){case"|":case"separator":return g.createSeparator()}if(!h&&f.buttons&&(h=f.buttons[i])){return g.createButton(i,h)}return g.add(h)},createDropMenu:function(f,n,h){var m=this,i=m.editor,j,g,k,l;n=e({"class":"mceDropDown",constrain:i.settings.constrain_menus},n);n["class"]=n["class"]+" "+i.getParam("skin")+"Skin";if(k=i.getParam("skin_variant")){n["class"]+=" "+i.getParam("skin")+"Skin"+k.substring(0,1).toUpperCase()+k.substring(1)}f=m.prefix+f;l=h||m._cls.dropmenu||c.ui.DropMenu;j=m.controls[f]=new l(f,n);j.onAddItem.add(function(r,q){var p=q.settings;p.title=i.getLang(p.title,p.title);if(!p.onclick){p.onclick=function(o){i.execCommand(p.cmd,p.ui||false,p.value)}}});i.onRemove.add(function(){j.destroy()});if(c.isIE){j.onShowMenu.add(function(){i.focus();g=i.selection.getBookmark(1)});j.onHideMenu.add(function(){if(g){i.selection.moveToBookmark(g);g=0}})}return m.add(j)},createListBox:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;if(g.settings.use_native_selects){k=new c.ui.NativeListBox(m,i)}else{f=l||h._cls.listbox||c.ui.ListBox;k=new f(m,i)}h.controls[m]=k;if(c.isWebKit){k.onPostRender.add(function(p,o){a.add(o,"mousedown",function(){g.bookmark=g.selection.getBookmark(1)});a.add(o,"focus",function(){g.selection.moveToBookmark(g.bookmark);g.bookmark=null})})}if(k.hideMenu){g.onMouseDown.add(k.hideMenu,k)}return h.add(k)},createButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.label=g.translate(i.label);i.scope=i.scope||g;if(!i.onclick&&!i.menu_button){i.onclick=function(){g.execCommand(i.cmd,i.ui||false,i.value)}}i=e({title:i.title,"class":"mce_"+m,unavailable_prefix:g.getLang("unavailable",""),scope:i.scope,control_manager:h},i);m=h.prefix+m;if(i.menu_button){f=l||h._cls.menubutton||c.ui.MenuButton;k=new f(m,i);g.onMouseDown.add(k.hideMenu,k)}else{f=h._cls.button||c.ui.Button;k=new f(m,i)}return h.add(k)},createMenuButton:function(h,f,g){f=f||{};f.menu_button=1;return this.createButton(h,f,g)},createSplitButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onclick){i.onclick=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;f=l||h._cls.splitbutton||c.ui.SplitButton;k=h.add(new f(m,i));g.onMouseDown.add(k.hideMenu,k);return k},createColorSplitButton:function(f,n,h){var l=this,j=l.editor,i,k,m,g;if(l.get(f)){return null}n.title=j.translate(n.title);n.scope=n.scope||j;if(!n.onclick){n.onclick=function(o){if(c.isIE){g=j.selection.getBookmark(1)}j.execCommand(n.cmd,n.ui||false,o||n.value)}}if(!n.onselect){n.onselect=function(o){j.execCommand(n.cmd,n.ui||false,o||n.value)}}n=e({title:n.title,"class":"mce_"+f,menu_class:j.getParam("skin")+"Skin",scope:n.scope,more_colors_title:j.getLang("more_colors")},n);f=l.prefix+f;m=h||l._cls.colorsplitbutton||c.ui.ColorSplitButton;k=new m(f,n);j.onMouseDown.add(k.hideMenu,k);j.onRemove.add(function(){k.destroy()});if(c.isIE){k.onShowMenu.add(function(){j.focus();g=j.selection.getBookmark(1)});k.onHideMenu.add(function(){if(g){j.selection.moveToBookmark(g);g=0}})}return l.add(k)},createToolbar:function(k,h,j){var i,g=this,f;k=g.prefix+k;f=j||g._cls.toolbar||c.ui.Toolbar;i=new f(k,h);if(g.get(k)){return null}return g.add(i)},createSeparator:function(g){var f=g||this._cls.separator||c.ui.Separator;return new f()},setControlType:function(g,f){return this._cls[g.toLowerCase()]=f},destroy:function(){d(this.controls,function(f){f.destroy()});this.controls=null}})})(tinymce);(function(d){var a=d.util.Dispatcher,e=d.each,c=d.isIE,b=d.isOpera;d.create("tinymce.WindowManager",{WindowManager:function(f){var g=this;g.editor=f;g.onOpen=new a(g);g.onClose=new a(g);g.params={};g.features={}},open:function(z,h){var v=this,k="",n,m,i=v.editor.settings.dialog_type=="modal",q,o,j,g=d.DOM.getViewPort(),r;z=z||{};h=h||{};o=b?g.w:screen.width;j=b?g.h:screen.height;z.name=z.name||"mc_"+new Date().getTime();z.width=parseInt(z.width||320);z.height=parseInt(z.height||240);z.resizable=true;z.left=z.left||parseInt(o/2)-(z.width/2);z.top=z.top||parseInt(j/2)-(z.height/2);h.inline=false;h.mce_width=z.width;h.mce_height=z.height;h.mce_auto_focus=z.auto_focus;if(i){if(c){z.center=true;z.help=false;z.dialogWidth=z.width+"px";z.dialogHeight=z.height+"px";z.scroll=z.scrollbars||false}}e(z,function(p,f){if(d.is(p,"boolean")){p=p?"yes":"no"}if(!/^(name|url)$/.test(f)){if(c&&i){k+=(k?";":"")+f+":"+p}else{k+=(k?",":"")+f+"="+p}}});v.features=z;v.params=h;v.onOpen.dispatch(v,z,h);r=z.url||z.file;r=d._addVer(r);try{if(c&&i){q=1;window.showModalDialog(r,window,k)}else{q=window.open(r,z.name,k)}}catch(l){}if(!q){alert(v.editor.getLang("popup_blocked"))}},close:function(f){f.close();this.onClose.dispatch(this)},createInstance:function(i,h,g,m,l,k){var j=d.resolve(i);return new j(h,g,m,l,k)},confirm:function(h,f,i,g){g=g||window;f.call(i||this,g.confirm(this._decode(this.editor.getLang(h,h))))},alert:function(h,f,j,g){var i=this;g=g||window;g.alert(i._decode(i.editor.getLang(h,h)));if(f){f.call(j||i)}},_decode:function(f){return d.DOM.decode(f).replace(/\\n/g,"\n")}})}(tinymce));(function(a){a.CommandManager=function(){var c={},b={},d={};function e(i,h,g,f){if(typeof(h)=="string"){h=[h]}a.each(h,function(j){i[j.toLowerCase()]={func:g,scope:f}})}a.extend(this,{add:function(h,g,f){e(c,h,g,f)},addQueryStateHandler:function(h,g,f){e(b,h,g,f)},addQueryValueHandler:function(h,g,f){e(d,h,g,f)},execCommand:function(g,j,i,h,f){if(j=c[j.toLowerCase()]){if(j.func.call(g||j.scope,i,h,f)!==false){return true}}},queryCommandValue:function(){if(cmd=d[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}},queryCommandState:function(){if(cmd=b[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}}})};a.GlobalCommands=new a.CommandManager()})(tinymce);(function(b){function a(i,d,h,m){var j,g,e,l,f;function k(p,o){do{if(p.parentNode==o){return p}p=p.parentNode}while(p)}function c(o){m(o);b.walk(o,m,"childNodes")}j=i.findCommonAncestor(d,h);e=k(d,j)||d;l=k(h,j)||h;for(g=d;g&&g!=e;g=g.parentNode){for(f=g.nextSibling;f;f=f.nextSibling){c(f)}}if(e!=l){for(g=e.nextSibling;g&&g!=l;g=g.nextSibling){c(g)}}else{c(e)}for(g=h;g&&g!=l;g=g.parentNode){for(f=g.previousSibling;f;f=f.previousSibling){c(f)}}}b.GlobalCommands.add("RemoveFormat",function(){var m=this,l=m.dom,u=m.selection,d=u.getRng(1),e=[],h,f,j,q,g,o,c,i;function k(s){var r;l.getParent(s,function(v){if(l.is(v,m.getParam("removeformat_selector"))){r=v}return l.isBlock(v)},m.getBody());return r}function p(r){if(l.is(r,m.getParam("removeformat_selector"))){e.push(r)}}function t(r){p(r);b.walk(r,p,"childNodes")}h=u.getBookmark();q=d.startContainer;o=d.endContainer;g=d.startOffset;c=d.endOffset;q=q.nodeType==1?q.childNodes[Math.min(g,q.childNodes.length-1)]:q;o=o.nodeType==1?o.childNodes[Math.min(g==c?c:c-1,o.childNodes.length-1)]:o;if(q==o){f=k(q);if(q.nodeType==3){if(f&&f.nodeType==1){i=q.splitText(g);i.splitText(c-g);l.split(f,i);u.moveToBookmark(h)}return}t(l.split(f,q)||q)}else{f=k(q);j=k(o);if(f){if(q.nodeType==3){if(g==q.nodeValue.length){q.nodeValue+="\uFEFF"}q=q.splitText(g)}}if(j){if(o.nodeType==3){o.splitText(c)}}if(f&&f==j){l.replace(l.create("span",{id:"__end"},o.cloneNode(true)),o)}if(f){f=l.split(f,q)}else{f=q}if(i=l.get("__end")){o=i;j=k(o)}if(j){j=l.split(j,o)}else{j=o}a(l,f,j,p);if(q.nodeValue=="\uFEFF"){q.nodeValue=""}t(o);t(q)}b.each(e,function(r){l.remove(r,1)});l.remove("__end",1);u.moveToBookmark(h)})})(tinymce);(function(a){a.GlobalCommands.add("mceBlockQuote",function(){var j=this,o=j.selection,f=j.dom,l,k,e,d,p,c,m,h,b;function g(i){return f.getParent(i,function(q){return q.nodeName==="BLOCKQUOTE"})}l=f.getParent(o.getStart(),f.isBlock);k=f.getParent(o.getEnd(),f.isBlock);if(p=g(l)){if(l!=k||l.childNodes.length>1||(l.childNodes.length==1&&l.firstChild.nodeName!="BR")){d=o.getBookmark()}if(g(k)){m=p.cloneNode(false);while(e=k.nextSibling){m.appendChild(e.parentNode.removeChild(e))}}if(m){f.insertAfter(m,p)}b=o.getSelectedBlocks(l,k);for(h=b.length-1;h>=0;h--){f.insertAfter(b[h],p)}if(/^\s*$/.test(p.innerHTML)){f.remove(p,1)}if(m&&/^\s*$/.test(m.innerHTML)){f.remove(m,1)}if(!d){if(!a.isIE){c=j.getDoc().createRange();c.setStart(l,0);c.setEnd(l,0);o.setRng(c)}else{o.select(l);o.collapse(0);if(f.getParent(o.getStart(),f.isBlock)!=l){c=o.getRng();c.move("character",-1);c.select()}}}else{j.selection.moveToBookmark(d)}return}if(a.isIE&&!l&&!k){j.getDoc().execCommand("Indent");e=g(o.getNode());e.style.margin=e.dir="";return}if(!l||!k){return}if(l!=k||l.childNodes.length>1||(l.childNodes.length==1&&l.firstChild.nodeName!="BR")){d=o.getBookmark()}a.each(o.getSelectedBlocks(g(o.getStart()),g(o.getEnd())),function(i){if(i.nodeName=="BLOCKQUOTE"&&!p){p=i;return}if(!p){p=f.create("blockquote");i.parentNode.insertBefore(p,i)}if(i.nodeName=="BLOCKQUOTE"&&p){e=i.firstChild;while(e){p.appendChild(e.cloneNode(true));e=e.nextSibling}f.remove(i);return}p.appendChild(f.remove(i))});if(!d){if(!a.isIE){c=j.getDoc().createRange();c.setStart(l,0);c.setEnd(l,0);o.setRng(c)}else{o.select(l);o.collapse(1)}}else{o.moveToBookmark(d)}})})(tinymce);(function(a){a.each(["Cut","Copy","Paste"],function(b){a.GlobalCommands.add(b,function(){var c=this,e=c.getDoc();try{e.execCommand(b,false,null);if(!e.queryCommandEnabled(b)){throw"Error"}}catch(d){if(a.isGecko){c.windowManager.confirm(c.getLang("clipboard_msg"),function(f){if(f){open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}})}else{c.windowManager.alert(c.getLang("clipboard_no_support"))}}})})})(tinymce);(function(a){a.GlobalCommands.add("InsertHorizontalRule",function(){if(a.isOpera){return this.getDoc().execCommand("InsertHorizontalRule",false,"")}this.selection.setContent("<hr />")})})(tinymce);(function(){var a=tinymce.GlobalCommands;a.add(["mceEndUndoLevel","mceAddUndoLevel"],function(){this.undoManager.add()});a.add("Undo",function(){var b=this;if(b.settings.custom_undo_redo){b.undoManager.undo();b.nodeChanged();return true}return false});a.add("Redo",function(){var b=this;if(b.settings.custom_undo_redo){b.undoManager.redo();b.nodeChanged();return true}return false})})(); \ No newline at end of file
+(function(c){var a=/^\s*|\s*$/g,d;var b={majorVersion:"3",minorVersion:"3.1",releaseDate:"2010-03-18",_init:function(){var r=this,o=document,m=navigator,f=m.userAgent,l,e,k,j,h,q;r.isOpera=c.opera&&opera.buildNumber;r.isWebKit=/WebKit/.test(f);r.isIE=!r.isWebKit&&!r.isOpera&&(/MSIE/gi).test(f)&&(/Explorer/gi).test(m.appName);r.isIE6=r.isIE&&/MSIE [56]/.test(f);r.isGecko=!r.isWebKit&&/Gecko/.test(f);r.isMac=f.indexOf("Mac")!=-1;r.isAir=/adobeair/i.test(f);if(c.tinyMCEPreInit){r.suffix=tinyMCEPreInit.suffix;r.baseURL=tinyMCEPreInit.base;r.query=tinyMCEPreInit.query;return}r.suffix="";e=o.getElementsByTagName("base");for(l=0;l<e.length;l++){if(q=e[l].href){if(/^https?:\/\/[^\/]+$/.test(q)){q+="/"}j=q?q.match(/.*\//)[0]:""}}function g(i){if(i.src&&/tiny_mce(|_gzip|_jquery|_prototype)(_dev|_src)?.js/.test(i.src)){if(/_(src|dev)\.js/g.test(i.src)){r.suffix="_src"}if((h=i.src.indexOf("?"))!=-1){r.query=i.src.substring(h+1)}r.baseURL=i.src.substring(0,i.src.lastIndexOf("/"));if(j&&r.baseURL.indexOf("://")==-1&&r.baseURL.indexOf("/")!==0){r.baseURL=j+r.baseURL}return r.baseURL}return null}e=o.getElementsByTagName("script");for(l=0;l<e.length;l++){if(g(e[l])){return}}k=o.getElementsByTagName("head")[0];if(k){e=k.getElementsByTagName("script");for(l=0;l<e.length;l++){if(g(e[l])){return}}}return},is:function(f,e){if(!e){return f!==d}if(e=="array"&&(f.hasOwnProperty&&f instanceof Array)){return true}return typeof(f)==e},each:function(h,e,g){var i,f;if(!h){return 0}g=g||h;if(h.length!==d){for(i=0,f=h.length;i<f;i++){if(e.call(g,h[i],i,h)===false){return 0}}}else{for(i in h){if(h.hasOwnProperty(i)){if(e.call(g,h[i],i,h)===false){return 0}}}}return 1},map:function(e,g){var h=[];b.each(e,function(f){h.push(g(f))});return h},grep:function(e,g){var h=[];b.each(e,function(f){if(!g||g(f)){h.push(f)}});return h},inArray:function(f,g){var h,e;if(f){for(h=0,e=f.length;h<e;h++){if(f[h]===g){return h}}}return -1},extend:function(k,j){var h,g,f=arguments;for(h=1,g=f.length;h<g;h++){j=f[h];b.each(j,function(e,i){if(e!==d){k[i]=e}})}return k},trim:function(e){return(e?""+e:"").replace(a,"")},create:function(m,e){var l=this,f,h,i,j,g,k=0;m=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(m);i=m[3].match(/(^|\.)(\w+)$/i)[2];h=l.createNS(m[3].replace(/\.\w+$/,""));if(h[i]){return}if(m[2]=="static"){h[i]=e;if(this.onCreate){this.onCreate(m[2],m[3],h[i])}return}if(!e[i]){e[i]=function(){};k=1}h[i]=e[i];l.extend(h[i].prototype,e);if(m[5]){f=l.resolve(m[5]).prototype;j=m[5].match(/\.(\w+)$/i)[1];g=h[i];if(k){h[i]=function(){return f[j].apply(this,arguments)}}else{h[i]=function(){this.parent=f[j];return g.apply(this,arguments)}}h[i].prototype[i]=h[i];l.each(f,function(o,p){h[i].prototype[p]=f[p]});l.each(e,function(o,p){if(f[p]){h[i].prototype[p]=function(){this.parent=f[p];return o.apply(this,arguments)}}else{if(p!=i){h[i].prototype[p]=o}}})}l.each(e["static"],function(o,p){h[i][p]=o});if(this.onCreate){this.onCreate(m[2],m[3],h[i].prototype)}},walk:function(h,g,i,e){e=e||this;if(h){if(i){h=h[i]}b.each(h,function(j,f){if(g.call(e,j,f,i)===false){return false}b.walk(j,g,i,e)})}},createNS:function(h,g){var f,e;g=g||c;h=h.split(".");for(f=0;f<h.length;f++){e=h[f];if(!g[e]){g[e]={}}g=g[e]}return g},resolve:function(h,g){var f,e;g=g||c;h=h.split(".");for(f=0,e=h.length;f<e;f++){g=g[h[f]];if(!g){break}}return g},addUnload:function(i,h){var g=this;i={func:i,scope:h||this};if(!g.unloads){function e(){var f=g.unloads,k,l;if(f){for(l in f){k=f[l];if(k&&k.func){k.func.call(k.scope,1)}}if(c.detachEvent){c.detachEvent("onbeforeunload",j);c.detachEvent("onunload",e)}else{if(c.removeEventListener){c.removeEventListener("unload",e,false)}}g.unloads=k=f=w=e=0;if(c.CollectGarbage){CollectGarbage()}}}function j(){var k=document;if(k.readyState=="interactive"){function f(){k.detachEvent("onstop",f);if(e){e()}k=0}if(k){k.attachEvent("onstop",f)}c.setTimeout(function(){if(k){k.detachEvent("onstop",f)}},0)}}if(c.attachEvent){c.attachEvent("onunload",e);c.attachEvent("onbeforeunload",j)}else{if(c.addEventListener){c.addEventListener("unload",e,false)}}g.unloads=[i]}else{g.unloads.push(i)}return i},removeUnload:function(h){var e=this.unloads,g=null;b.each(e,function(j,f){if(j&&j.func==h){e.splice(f,1);g=h;return false}});return g},explode:function(e,f){return e?b.map(e.split(f||","),b.trim):e},_addVer:function(f){var e;if(!this.query){return f}e=(f.indexOf("?")==-1?"?":"&")+this.query;if(f.indexOf("#")==-1){return f+e}return f.replace("#",e+"#")}};b._init();c.tinymce=c.tinyMCE=b})(window);tinymce.create("tinymce.util.Dispatcher",{scope:null,listeners:null,Dispatcher:function(a){this.scope=a||this;this.listeners=[]},add:function(a,b){this.listeners.push({cb:a,scope:b||this.scope});return a},addToTop:function(a,b){this.listeners.unshift({cb:a,scope:b||this.scope});return a},remove:function(a){var b=this.listeners,c=null;tinymce.each(b,function(e,d){if(a==e.cb){c=a;b.splice(d,1);return false}});return c},dispatch:function(){var f,d=arguments,e,b=this.listeners,g;for(e=0;e<b.length;e++){g=b[e];f=g.cb.apply(g.scope,d);if(f===false){break}}return f}});(function(){var a=tinymce.each;tinymce.create("tinymce.util.URI",{URI:function(e,g){var f=this,h,d,c;e=tinymce.trim(e);g=f.settings=g||{};if(/^(mailto|tel|news|javascript|about|data):/i.test(e)||/^\s*#/.test(e)){f.source=e;return}if(e.indexOf("/")===0&&e.indexOf("//")!==0){e=(g.base_uri?g.base_uri.protocol||"http":"http")+"://mce_host"+e}if(!/^\w*:?\/\//.test(e)){e=(g.base_uri.protocol||"http")+"://mce_host"+f.toAbsPath(g.base_uri.path,e)}e=e.replace(/@@/g,"(mce_at)");e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);a(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(b,j){var k=e[j];if(k){k=k.replace(/\(mce_at\)/g,"@@")}f[b]=k});if(c=g.base_uri){if(!f.protocol){f.protocol=c.protocol}if(!f.userInfo){f.userInfo=c.userInfo}if(!f.port&&f.host=="mce_host"){f.port=c.port}if(!f.host||f.host=="mce_host"){f.host=c.host}f.source=""}},setPath:function(c){var b=this;c=/^(.*?)\/?(\w+)?$/.exec(c);b.path=c[0];b.directory=c[1];b.file=c[2];b.source="";b.getURI()},toRelative:function(b){var c=this,d;if(b==="./"){return b}b=new tinymce.util.URI(b,{base_uri:c});if((b.host!="mce_host"&&c.host!=b.host&&b.host)||c.port!=b.port||c.protocol!=b.protocol){return b.getURI()}d=c.toRelPath(c.path,b.path);if(b.query){d+="?"+b.query}if(b.anchor){d+="#"+b.anchor}return d},toAbsolute:function(b,c){var b=new tinymce.util.URI(b,{base_uri:this});return b.getURI(this.host==b.host&&this.protocol==b.protocol?c:0)},toRelPath:function(g,h){var c,f=0,d="",e,b;g=g.substring(0,g.lastIndexOf("/"));g=g.split("/");c=h.split("/");if(g.length>=c.length){for(e=0,b=g.length;e<b;e++){if(e>=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length<c.length){for(e=0,b=c.length;e<b;e++){if(e>=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e<b;e++){d+="../"}for(e=f-1,b=c.length;e<b;e++){if(e!=f-1){d+="/"+c[e]}else{d+=c[e]}}return d},toAbsPath:function(e,f){var c,b=0,h=[],d,g;d=/\/$/.test(f)?"/":"";e=e.split("/");f=f.split("/");a(e,function(i){if(i){h.push(i)}});e=h;for(c=f.length-1,h=[];c>=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();tinymce.create("static tinymce.util.JSON",{serialize:function(e){var c,a,d=tinymce.util.JSON.serialize,b;if(e==null){return"null"}b=typeof e;if(b=="string"){a="\bb\tt\nn\ff\rr\"\"''\\\\";return'"'+e.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(g,f){c=a.indexOf(f);if(c+1){return"\\"+a.charAt(c+1)}g=f.charCodeAt().toString(16);return"\\u"+"0000".substring(g.length)+g})+'"'}if(b=="object"){if(e.hasOwnProperty&&e instanceof Array){for(c=0,a="[";c<e.length;c++){a+=(c>0?",":"")+d(e[c])}return a+"]"}a="{";for(c in e){a+=typeof e[c]!="function"?(a.length>1?',"':'"')+c+'":'+d(e[c]):""}return a+"}"}return""+e},parse:function(s){try{return eval("("+s+")")}catch(ex){}}});tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.setRequestHeader("X-Requested-With","XMLHttpRequest");a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){e.call(f.error_scope||f.scope,h,g)};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(m){var k=m.each,j=m.is,i=m.isWebKit,d=m.isIE,a=/^(H[1-6R]|P|DIV|ADDRESS|PRE|FORM|T(ABLE|BODY|HEAD|FOOT|H|R|D)|LI|OL|UL|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|MENU|ISINDEX|SAMP)$/,e=g("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),f=g("src,href,style,coords,shape"),c={"&":"&amp;",'"':"&quot;","<":"&lt;",">":"&gt;"},n=/[<>&\"]/g,b=/^([a-z0-9],?)+$/i,h=/<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)(\s*\/?)>/g,l=/(\w+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;function g(q){var p={},o;q=q.split(",");for(o=q.length;o>=0;o--){p[q[o]]=1}return p}m.create("tinymce.dom.DOMUtils",{doc:null,root:null,files:null,pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value",id:"id",name:"name",type:"type"},DOMUtils:function(u,q){var p=this,o;p.doc=u;p.win=window;p.files={};p.cssFlicker=false;p.counter=0;p.boxModel=!m.isIE||u.compatMode=="CSS1Compat";p.stdMode=u.documentMode===8;p.settings=q=m.extend({keep_values:false,hex_colors:1,process_html:1},q);if(m.isIE6){try{u.execCommand("BackgroundImageCache",false,true)}catch(r){p.cssFlicker=true}}if(q.valid_styles){p._styles={};k(q.valid_styles,function(t,s){p._styles[s]=m.explode(t)})}m.addUnload(p.destroy,p)},getRoot:function(){var o=this,p=o.settings;return(p&&o.get(p.root_element))||o.doc.body},getViewPort:function(p){var q,o;p=!p?this.win:p;q=p.document;o=this.boxModel?q.documentElement:q.body;return{x:p.pageXOffset||o.scrollLeft,y:p.pageYOffset||o.scrollTop,w:p.innerWidth||o.clientWidth,h:p.innerHeight||o.clientHeight}},getRect:function(s){var r,o=this,q;s=o.get(s);r=o.getPos(s);q=o.getSize(s);return{x:r.x,y:r.y,w:q.w,h:q.h}},getSize:function(r){var p=this,o,q;r=p.get(r);o=p.getStyle(r,"width");q=p.getStyle(r,"height");if(o.indexOf("px")===-1){o=0}if(q.indexOf("px")===-1){q=0}return{w:parseInt(o)||r.offsetWidth||r.clientWidth,h:parseInt(q)||r.offsetHeight||r.clientHeight}},getParent:function(q,p,o){return this.getParents(q,p,o,false)},getParents:function(z,v,s,y){var q=this,p,u=q.settings,x=[];z=q.get(z);y=y===undefined;if(u.strict_root){s=s||q.getRoot()}if(j(v,"string")){p=v;if(v==="*"){v=function(o){return o.nodeType==1}}else{v=function(o){return q.is(o,p)}}}while(z){if(z==s||!z.nodeType||z.nodeType===9){break}if(!v||v(z)){if(y){x.push(z)}else{return z}}z=z.parentNode}return y?x:null},get:function(o){var p;if(o&&this.doc&&typeof(o)=="string"){p=o;o=this.doc.getElementById(o);if(o&&o.id!==p){return this.doc.getElementsByName(p)[1]}}return o},getNext:function(p,o){return this._findSib(p,o,"nextSibling")},getPrev:function(p,o){return this._findSib(p,o,"previousSibling")},select:function(q,p){var o=this;return m.dom.Sizzle(q,o.get(p)||o.get(o.settings.root_element)||o.doc,[])},is:function(q,o){var p;if(q.length===undefined){if(o==="*"){return q.nodeType==1}if(b.test(o)){o=o.toLowerCase().split(/,/);q=q.nodeName.toLowerCase();for(p=o.length-1;p>=0;p--){if(o[p]==q){return true}}return false}}return m.dom.Sizzle.matches(o,q.nodeType?[q]:q).length>0},add:function(s,v,o,r,u){var q=this;return this.run(s,function(y){var x,t;x=j(v,"string")?q.doc.createElement(v):v;q.setAttribs(x,o);if(r){if(r.nodeType){x.appendChild(r)}else{q.setHTML(x,r)}}return !u?y.appendChild(x):x})},create:function(q,o,p){return this.add(this.doc.createElement(q),q,o,p,1)},createHTML:function(v,p,s){var u="",r=this,q;u+="<"+v;for(q in p){if(p.hasOwnProperty(q)){u+=" "+q+'="'+r.encode(p[q])+'"'}}if(m.is(s)){return u+">"+s+"</"+v+">"}return u+" />"},remove:function(o,p){return this.run(o,function(r){var q,s;q=r.parentNode;if(!q){return null}if(p){while(s=r.firstChild){if(s.nodeType!==3||s.nodeValue){q.insertBefore(s,r)}else{r.removeChild(s)}}}return q.removeChild(r)})},setStyle:function(r,o,p){var q=this;return q.run(r,function(v){var u,t;u=v.style;o=o.replace(/-(\D)/g,function(x,s){return s.toUpperCase()});if(q.pixelStyles.test(o)&&(m.is(p,"number")||/^[\-0-9\.]+$/.test(p))){p+="px"}switch(o){case"opacity":if(d){u.filter=p===""?"":"alpha(opacity="+(p*100)+")";if(!r.currentStyle||!r.currentStyle.hasLayout){u.display="inline-block"}}u[o]=u["-moz-opacity"]=u["-khtml-opacity"]=p||"";break;case"float":d?u.styleFloat=p:u.cssFloat=p;break;default:u[o]=p||""}if(q.settings.update_styles){q.setAttrib(v,"_mce_style")}})},getStyle:function(r,o,q){r=this.get(r);if(!r){return false}if(this.doc.defaultView&&q){o=o.replace(/[A-Z]/g,function(s){return"-"+s});try{return this.doc.defaultView.getComputedStyle(r,null).getPropertyValue(o)}catch(p){return null}}o=o.replace(/-(\D)/g,function(t,s){return s.toUpperCase()});if(o=="float"){o=d?"styleFloat":"cssFloat"}if(r.currentStyle&&q){return r.currentStyle[o]}return r.style[o]},setStyles:function(u,v){var q=this,r=q.settings,p;p=r.update_styles;r.update_styles=0;k(v,function(o,s){q.setStyle(u,s,o)});r.update_styles=p;if(r.update_styles){q.setAttrib(u,r.cssText)}},setAttrib:function(q,r,o){var p=this;if(!q||!r){return}if(p.settings.strict){r=r.toLowerCase()}return this.run(q,function(u){var t=p.settings;switch(r){case"style":if(!j(o,"string")){k(o,function(s,x){p.setStyle(u,x,s)});return}if(t.keep_values){if(o&&!p._isRes(o)){u.setAttribute("_mce_style",o,2)}else{u.removeAttribute("_mce_style",2)}}u.style.cssText=o;break;case"class":u.className=o||"";break;case"src":case"href":if(t.keep_values){if(t.url_converter){o=t.url_converter.call(t.url_converter_scope||p,o,r,u)}p.setAttrib(u,"_mce_"+r,o,2)}break;case"shape":u.setAttribute("_mce_style",o);break}if(j(o)&&o!==null&&o.length!==0){u.setAttribute(r,""+o,2)}else{u.removeAttribute(r,2)}})},setAttribs:function(q,r){var p=this;return this.run(q,function(o){k(r,function(s,t){p.setAttrib(o,t,s)})})},getAttrib:function(r,s,q){var o,p=this;r=p.get(r);if(!r||r.nodeType!==1){return false}if(!j(q)){q=""}if(/^(src|href|style|coords|shape)$/.test(s)){o=r.getAttribute("_mce_"+s);if(o){return o}}if(d&&p.props[s]){o=r[p.props[s]];o=o&&o.nodeValue?o.nodeValue:o}if(!o){o=r.getAttribute(s,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(s)){if(r[p.props[s]]===true&&o===""){return s}return o?s:""}if(r.nodeName==="FORM"&&r.getAttributeNode(s)){return r.getAttributeNode(s).nodeValue}if(s==="style"){o=o||r.style.cssText;if(o){o=p.serializeStyle(p.parseStyle(o),r.nodeName);if(p.settings.keep_values&&!p._isRes(o)){r.setAttribute("_mce_style",o)}}}if(i&&s==="class"&&o){o=o.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(d){switch(s){case"rowspan":case"colspan":if(o===1){o=""}break;case"size":if(o==="+0"||o===20||o===0){o=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(o===0){o=""}break;case"hspace":if(o===-1){o=""}break;case"maxlength":case"tabindex":if(o===32768||o===2147483647||o==="32768"){o=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(o===65535){return s}return q;case"shape":o=o.toLowerCase();break;default:if(s.indexOf("on")===0&&o){o=(""+o).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1")}}}return(o!==undefined&&o!==null&&o!=="")?""+o:q},getPos:function(A,s){var p=this,o=0,z=0,u,v=p.doc,q;A=p.get(A);s=s||v.body;if(A){if(d&&!p.stdMode){A=A.getBoundingClientRect();u=p.boxModel?v.documentElement:v.body;o=p.getStyle(p.select("html")[0],"borderWidth");o=(o=="medium"||p.boxModel&&!p.isIE6)&&2||o;A.top+=p.win.self!=p.win.top?2:0;return{x:A.left+u.scrollLeft-o,y:A.top+u.scrollTop-o}}q=A;while(q&&q!=s&&q.nodeType){o+=q.offsetLeft||0;z+=q.offsetTop||0;q=q.offsetParent}q=A.parentNode;while(q&&q!=s&&q.nodeType){o-=q.scrollLeft||0;z-=q.scrollTop||0;q=q.parentNode}}return{x:o,y:z}},parseStyle:function(r){var u=this,v=u.settings,x={};if(!r){return x}function p(D,A,C){var z,B,o,y;z=x[D+"-top"+A];if(!z){return}B=x[D+"-right"+A];if(z!=B){return}o=x[D+"-bottom"+A];if(B!=o){return}y=x[D+"-left"+A];if(o!=y){return}x[C]=y;delete x[D+"-top"+A];delete x[D+"-right"+A];delete x[D+"-bottom"+A];delete x[D+"-left"+A]}function q(y,s,o,A){var z;z=x[s];if(!z){return}z=x[o];if(!z){return}z=x[A];if(!z){return}x[y]=x[s]+" "+x[o]+" "+x[A];delete x[s];delete x[o];delete x[A]}r=r.replace(/&(#?[a-z0-9]+);/g,"&$1_MCE_SEMI_");k(r.split(";"),function(s){var o,t=[];if(s){s=s.replace(/_MCE_SEMI_/g,";");s=s.replace(/url\([^\)]+\)/g,function(y){t.push(y);return"url("+t.length+")"});s=s.split(":");o=m.trim(s[1]);o=o.replace(/url\(([^\)]+)\)/g,function(z,y){return t[parseInt(y)-1]});o=o.replace(/rgb\([^\)]+\)/g,function(y){return u.toHex(y)});if(v.url_converter){o=o.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(y,z){return"url("+v.url_converter.call(v.url_converter_scope||u,u.decode(z),"style",null)+")"})}x[m.trim(s[0]).toLowerCase()]=o}});p("border","","border");p("border","-width","border-width");p("border","-color","border-color");p("border","-style","border-style");p("padding","","padding");p("margin","","margin");q("border","border-width","border-style","border-color");if(d){if(x.border=="medium none"){x.border=""}}return x},serializeStyle:function(v,p){var q=this,r="";function u(s,o){if(o&&s){if(o.indexOf("-")===0){return}switch(o){case"font-weight":if(s==700){s="bold"}break;case"color":case"background-color":s=s.toLowerCase();break}r+=(r?" ":"")+o+": "+s+";"}}if(p&&q._styles){k(q._styles["*"],function(o){u(v[o],o)});k(q._styles[p.toLowerCase()],function(o){u(v[o],o)})}else{k(v,u)}return r},loadCSS:function(o){var q=this,r=q.doc,p;if(!o){o=""}p=q.select("head")[0];k(o.split(","),function(s){var t;if(q.files[s]){return}q.files[s]=true;t=q.create("link",{rel:"stylesheet",href:m._addVer(s)});if(d&&r.documentMode){t.onload=function(){r.recalc();t.onload=null}}p.appendChild(t)})},addClass:function(o,p){return this.run(o,function(q){var r;if(!p){return 0}if(this.hasClass(q,p)){return q.className}r=this.removeClass(q,p);return q.className=(r!=""?(r+" "):"")+p})},removeClass:function(q,r){var o=this,p;return o.run(q,function(t){var s;if(o.hasClass(t,r)){if(!p){p=new RegExp("(^|\\s+)"+r+"(\\s+|$)","g")}s=t.className.replace(p," ");s=m.trim(s!=" "?s:"");t.className=s;if(!s){t.removeAttribute("class");t.removeAttribute("className")}return s}return t.className})},hasClass:function(p,o){p=this.get(p);if(!p||!o){return false}return(" "+p.className+" ").indexOf(" "+o+" ")!==-1},show:function(o){return this.setStyle(o,"display","block")},hide:function(o){return this.setStyle(o,"display","none")},isHidden:function(o){o=this.get(o);return !o||o.style.display=="none"||this.getStyle(o,"display")=="none"},uniqueId:function(o){return(!o?"mce_":o)+(this.counter++)},setHTML:function(q,p){var o=this;return this.run(q,function(v){var r,t,s,z,u,r;p=o.processHTML(p);if(d){function y(){while(v.firstChild){v.firstChild.removeNode()}try{v.innerHTML="<br />"+p;v.removeChild(v.firstChild)}catch(x){r=o.create("div");r.innerHTML="<br />"+p;k(r.childNodes,function(B,A){if(A){v.appendChild(B)}})}}if(o.settings.fix_ie_paragraphs){p=p.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi,'<p$1 _mce_keep="true">&nbsp;</p>')}y();if(o.settings.fix_ie_paragraphs){s=v.getElementsByTagName("p");for(t=s.length-1,r=0;t>=0;t--){z=s[t];if(!z.hasChildNodes()){if(!z._mce_keep){r=1;break}z.removeAttribute("_mce_keep")}}}if(r){p=p.replace(/<p ([^>]+)>|<p>/ig,'<div $1 _mce_tmp="1">');p=p.replace(/<\/p>/g,"</div>");y();if(o.settings.fix_ie_paragraphs){s=v.getElementsByTagName("DIV");for(t=s.length-1;t>=0;t--){z=s[t];if(z._mce_tmp){u=o.doc.createElement("p");z.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(A,x){var B;if(x!=="_mce_tmp"){B=z.getAttribute(x);if(!B&&x==="class"){B=z.className}u.setAttribute(x,B)}});for(r=0;r<z.childNodes.length;r++){u.appendChild(z.childNodes[r].cloneNode(true))}z.swapNode(u)}}}}}else{v.innerHTML=p}return p})},processHTML:function(r){var p=this,q=p.settings,v=[];if(!q.process_html){return r}if(d){r=r.replace(/&apos;/g,"&#39;");r=r.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi,"")}r=r.replace(/<a( )([^>]+)\/>|<a\/>/gi,"<a$1$2></a>");if(q.keep_values){if(/<script|noscript|style/i.test(r)){function o(t){t=t.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n");t=t.replace(/^[\r\n]*|[\r\n]*$/g,"");t=t.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g,"");t=t.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g,"");return t}r=r.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/gi,function(s,x,t){if(!x){x=' type="text/javascript"'}x=x.replace(/src=\"([^\"]+)\"?/i,function(y,z){if(q.url_converter){z=p.encode(q.url_converter.call(q.url_converter_scope||p,p.decode(z),"src","script"))}return'_mce_src="'+z+'"'});if(m.trim(t)){v.push(o(t));t="<!--\nMCE_SCRIPT:"+(v.length-1)+"\n// -->"}return"<mce:script"+x+">"+t+"</mce:script>"});r=r.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/gi,function(s,x,t){if(t){v.push(o(t));t="<!--\nMCE_SCRIPT:"+(v.length-1)+"\n-->"}return"<mce:style"+x+">"+t+"</mce:style><style "+x+' _mce_bogus="1">'+t+"</style>"});r=r.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g,function(s,x,t){return"<mce:noscript"+x+"><!--"+p.encode(t).replace(/--/g,"&#45;&#45;")+"--></mce:noscript>"})}r=r.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g,"<!--[CDATA[$1]]-->");function u(s){return s.replace(h,function(y,z,x,t){return"<"+z+x.replace(l,function(B,A,E,D,C){var F;A=A.toLowerCase();E=E||D||C||"";if(e[A]){if(E==="false"||E==="0"){return}return A+'="'+A+'"'}if(f[A]&&x.indexOf("_mce_"+A)==-1){F=p.decode(E);if(q.url_converter&&(A=="src"||A=="href")){F=q.url_converter.call(q.url_converter_scope||p,F,A,z)}if(A=="style"){F=p.serializeStyle(p.parseStyle(F),A)}return A+'="'+E+'" _mce_'+A+'="'+p.encode(F)+'"'}return B})+t+">"})}r=u(r);r=r.replace(/MCE_SCRIPT:([0-9]+)/g,function(t,s){return v[s]})}return r},getOuterHTML:function(o){var p;o=this.get(o);if(!o){return null}if(o.outerHTML!==undefined){return o.outerHTML}p=(o.ownerDocument||this.doc).createElement("body");p.appendChild(o.cloneNode(true));return p.innerHTML},setOuterHTML:function(r,p,s){var o=this;function q(u,t,x){var y,v;v=x.createElement("body");v.innerHTML=t;y=v.lastChild;while(y){o.insertAfter(y.cloneNode(true),u);y=y.previousSibling}o.remove(u)}return this.run(r,function(u){u=o.get(u);if(u.nodeType==1){s=s||u.ownerDocument||o.doc;if(d){try{if(d&&u.nodeType==1){u.outerHTML=p}else{q(u,p,s)}}catch(t){q(u,p,s)}}else{q(u,p,s)}}})},decode:function(p){var q,r,o;if(/&[\w#]+;/.test(p)){q=this.doc.createElement("div");q.innerHTML=p;r=q.firstChild;o="";if(r){do{o+=r.nodeValue}while(r=r.nextSibling)}return o||p}return p},encode:function(o){return(""+o).replace(n,function(p){return c[p]})},insertAfter:function(o,p){p=this.get(p);return this.run(o,function(r){var q,s;q=p.parentNode;s=p.nextSibling;if(s){q.insertBefore(r,s)}else{q.appendChild(r)}return r})},isBlock:function(o){if(o.nodeType&&o.nodeType!==1){return false}o=o.nodeName||o;return a.test(o)},replace:function(s,r,p){var q=this;if(j(r,"array")){s=s.cloneNode(true)}return q.run(r,function(t){if(p){k(m.grep(t.childNodes),function(o){s.appendChild(o)})}return t.parentNode.replaceChild(s,t)})},rename:function(r,o){var q=this,p;if(r.nodeName!=o.toUpperCase()){p=q.create(o);k(q.getAttribs(r),function(s){q.setAttrib(p,s.nodeName,q.getAttrib(r,s.nodeName))});q.replace(p,r,1)}return p||r},findCommonAncestor:function(q,o){var r=q,p;while(r){p=o;while(p&&r!=p){p=p.parentNode}if(r==p){break}r=r.parentNode}if(!r&&q.ownerDocument){return q.ownerDocument.documentElement}return r},toHex:function(o){var q=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(o);function p(r){r=parseInt(r).toString(16);return r.length>1?r:"0"+r}if(q){o="#"+p(q[1])+p(q[2])+p(q[3]);return o}return o},getClasses:function(){var s=this,o=[],r,u={},v=s.settings.class_filter,q;if(s.classes){return s.classes}function x(t){k(t.imports,function(y){x(y)});k(t.cssRules||t.rules,function(y){switch(y.type||1){case 1:if(y.selectorText){k(y.selectorText.split(","),function(z){z=z.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(z)||!/\.[\w\-]+$/.test(z)){return}q=z;z=z.replace(/.*\.([a-z0-9_\-]+).*/i,"$1");if(v&&!(z=v(z,q))){return}if(!u[z]){o.push({"class":z});u[z]=1}})}break;case 3:x(y.styleSheet);break}})}try{k(s.doc.styleSheets,x)}catch(p){}if(o.length>0){s.classes=o}return o},run:function(u,r,q){var p=this,v;if(p.doc&&typeof(u)==="string"){u=p.get(u)}if(!u){return false}q=q||this;if(!u.nodeType&&(u.length||u.length===0)){v=[];k(u,function(s,o){if(s){if(typeof(s)=="string"){s=p.doc.getElementById(s)}v.push(r.call(q,s,o))}});return v}return r.call(q,u)},getAttribs:function(q){var p;q=this.get(q);if(!q){return[]}if(d){p=[];if(q.nodeName=="OBJECT"){return q.attributes}if(q.nodeName==="OPTION"&&this.getAttrib(q,"selected")){p.push({specified:1,nodeName:"selected"})}q.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi,"").replace(/[\w:\-]+/gi,function(o){p.push({specified:1,nodeName:o})});return p}return q.attributes},destroy:function(p){var o=this;if(o.events){o.events.destroy()}o.win=o.doc=o.root=o.events=null;if(!p){m.removeUnload(o.destroy)}},createRng:function(){var o=this.doc;return o.createRange?o.createRange():new m.dom.Range(this)},nodeIndex:function(r,s){var o=0,q,p;if(r){for(q=r.nodeType,r=r.previousSibling,lastNode=r;r;r=r.previousSibling){p=r.nodeType;if(!s||p!=3||(q!=p&&r.nodeValue.length)){o++}q=p}}return o},split:function(u,s,y){var z=this,o=z.createRng(),v,q,x;function p(A){var t,r=A.childNodes;if(A.nodeType==1&&A.getAttribute("_mce_type")=="bookmark"){return}for(t=r.length-1;t>=0;t--){p(r[t])}if(A.nodeType!=9){if(A.nodeType==3&&A.nodeValue.length>0){return}if(A.nodeType==1){r=A.childNodes;if(r.length==1&&r[0]&&r[0].nodeType==1&&r[0].getAttribute("_mce_type")=="bookmark"){A.parentNode.insertBefore(r[0],A)}if(r.length||/^(br|hr|input|img)$/i.test(A.nodeName)){return}}z.remove(A)}return A}if(u&&s){o.setStart(u.parentNode,z.nodeIndex(u));o.setEnd(s.parentNode,z.nodeIndex(s));v=o.extractContents();o=z.createRng();o.setStart(s.parentNode,z.nodeIndex(s)+1);o.setEnd(u.parentNode,z.nodeIndex(u)+1);q=o.extractContents();x=u.parentNode;x.insertBefore(p(v),u);if(y){x.replaceChild(y,s)}else{x.insertBefore(s,u)}x.insertBefore(p(q),u);z.remove(u);return y||s}},bind:function(s,o,r,q){var p=this;if(!p.events){p.events=new m.dom.EventUtils()}return p.events.add(s,o,r,q||this)},unbind:function(r,o,q){var p=this;if(!p.events){p.events=new m.dom.EventUtils()}return p.events.remove(r,o,q)},_findSib:function(r,o,p){var q=this,s=o;if(r){if(j(s,"string")){s=function(t){return q.is(t,o)}}for(r=r[p];r;r=r[p]){if(s(r)){return r}}}return null},_isRes:function(o){return/^(top|left|bottom|right|width|height)/i.test(o)||/;\s*(top|left|bottom|right|width|height)/i.test(o)}});m.DOM=new m.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(a){function b(c){var N=this,e=c.doc,S=0,E=1,j=2,D=true,R=false,U="startOffset",h="startContainer",P="endContainer",z="endOffset",k=tinymce.extend,n=c.nodeIndex;k(N,{startContainer:e,startOffset:0,endContainer:e,endOffset:0,collapsed:D,commonAncestorContainer:e,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:q,setEnd:s,setStartBefore:g,setStartAfter:I,setEndBefore:J,setEndAfter:u,collapse:A,selectNode:x,selectNodeContents:F,compareBoundaryPoints:v,deleteContents:p,extractContents:H,cloneContents:d,insertNode:C,surroundContents:M,cloneRange:K});function q(V,t){B(D,V,t)}function s(V,t){B(R,V,t)}function g(t){q(t.parentNode,n(t))}function I(t){q(t.parentNode,n(t)+1)}function J(t){s(t.parentNode,n(t))}function u(t){s(t.parentNode,n(t)+1)}function A(t){if(t){N[P]=N[h];N[z]=N[U]}else{N[h]=N[P];N[U]=N[z]}N.collapsed=D}function x(t){g(t);u(t)}function F(t){q(t,0);s(t,t.nodeType===1?t.childNodes.length:t.nodeValue.length)}function v(W,X){var Z=N[h],Y=N[U],V=N[P],t=N[z];if(W===0){return G(Z,Y,Z,Y)}if(W===1){return G(Z,Y,V,t)}if(W===2){return G(V,t,V,t)}if(W===3){return G(V,t,Z,Y)}}function p(){m(j)}function H(){return m(S)}function d(){return m(E)}function C(Y){var V=this[h],t=this[U],X,W;if((V.nodeType===3||V.nodeType===4)&&V.nodeValue){if(!t){V.parentNode.insertBefore(Y,V)}else{if(t>=V.nodeValue.length){c.insertAfter(Y,V)}else{X=V.splitText(t);V.parentNode.insertBefore(Y,X)}}}else{if(V.childNodes.length>0){W=V.childNodes[t]}if(W){V.insertBefore(Y,W)}else{V.appendChild(Y)}}}function M(V){var t=N.extractContents();N.insertNode(V);V.appendChild(t);N.selectNode(V)}function K(){return k(new b(c),{startContainer:N[h],startOffset:N[U],endContainer:N[P],endOffset:N[z],collapsed:N.collapsed,commonAncestorContainer:N.commonAncestorContainer})}function O(t,V){var W;if(t.nodeType==3){return t}if(V<0){return t}W=t.firstChild;while(W&&V>0){--V;W=W.nextSibling}if(W){return W}return t}function l(){return(N[h]==N[P]&&N[U]==N[z])}function G(X,Z,V,Y){var aa,W,t,ab,ad,ac;if(X==V){if(Z==Y){return 0}if(Z<Y){return -1}return 1}aa=V;while(aa&&aa.parentNode!=X){aa=aa.parentNode}if(aa){W=0;t=X.firstChild;while(t!=aa&&W<Z){W++;t=t.nextSibling}if(Z<=W){return -1}return 1}aa=X;while(aa&&aa.parentNode!=V){aa=aa.parentNode}if(aa){W=0;t=V.firstChild;while(t!=aa&&W<Y){W++;t=t.nextSibling}if(W<Y){return -1}return 1}ab=c.findCommonAncestor(X,V);ad=X;while(ad&&ad.parentNode!=ab){ad=ad.parentNode}if(!ad){ad=ab}ac=V;while(ac&&ac.parentNode!=ab){ac=ac.parentNode}if(!ac){ac=ab}if(ad==ac){return 0}t=ab.firstChild;while(t){if(t==ad){return -1}if(t==ac){return 1}t=t.nextSibling}}function B(V,Y,X){var t,W;if(V){N[h]=Y;N[U]=X}else{N[P]=Y;N[z]=X}t=N[P];while(t.parentNode){t=t.parentNode}W=N[h];while(W.parentNode){W=W.parentNode}if(W==t){if(G(N[h],N[U],N[P],N[z])>0){N.collapse(V)}}else{N.collapse(V)}N.collapsed=l();N.commonAncestorContainer=c.findCommonAncestor(N[h],N[P])}function m(ab){var aa,X=0,ad=0,V,Z,W,Y,t,ac;if(N[h]==N[P]){return f(ab)}for(aa=N[P],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[h]){return r(aa,ab)}++X}for(aa=N[h],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[P]){return T(aa,ab)}++ad}Z=ad-X;W=N[h];while(Z>0){W=W.parentNode;Z--}Y=N[P];while(Z<0){Y=Y.parentNode;Z++}for(t=W.parentNode,ac=Y.parentNode;t!=ac;t=t.parentNode,ac=ac.parentNode){W=t;Y=ac}return o(W,Y,ab)}function f(Z){var ab,Y,X,aa,t,W,V;if(Z!=j){ab=e.createDocumentFragment()}if(N[U]==N[z]){return ab}if(N[h].nodeType==3){Y=N[h].nodeValue;X=Y.substring(N[U],N[z]);if(Z!=E){N[h].deleteData(N[U],N[z]-N[U]);N.collapse(D)}if(Z==j){return}ab.appendChild(e.createTextNode(X));return ab}aa=O(N[h],N[U]);t=N[z]-N[U];while(t>0){W=aa.nextSibling;V=y(aa,Z);if(ab){ab.appendChild(V)}--t;aa=W}if(Z!=E){N.collapse(D)}return ab}function r(ab,Y){var aa,Z,V,t,X,W;if(Y!=j){aa=e.createDocumentFragment()}Z=i(ab,Y);if(aa){aa.appendChild(Z)}V=n(ab);t=V-N[U];if(t<=0){if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}Z=ab.previousSibling;while(t>0){X=Z.previousSibling;W=y(Z,Y);if(aa){aa.insertBefore(W,aa.firstChild)}--t;Z=X}if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}function T(Z,Y){var ab,V,aa,t,X,W;if(Y!=j){ab=e.createDocumentFragment()}aa=Q(Z,Y);if(ab){ab.appendChild(aa)}V=n(Z);++V;t=N[z]-V;aa=Z.nextSibling;while(t>0){X=aa.nextSibling;W=y(aa,Y);if(ab){ab.appendChild(W)}--t;aa=X}if(Y!=E){N.setStartAfter(Z);N.collapse(D)}return ab}function o(Z,t,ac){var W,ae,Y,aa,ab,V,ad,X;if(ac!=j){ae=e.createDocumentFragment()}W=Q(Z,ac);if(ae){ae.appendChild(W)}Y=Z.parentNode;aa=n(Z);ab=n(t);++aa;V=ab-aa;ad=Z.nextSibling;while(V>0){X=ad.nextSibling;W=y(ad,ac);if(ae){ae.appendChild(W)}ad=X;--V}W=i(t,ac);if(ae){ae.appendChild(W)}if(ac!=E){N.setStartAfter(Z);N.collapse(D)}return ae}function i(aa,ab){var W=O(N[P],N[z]-1),ac,Z,Y,t,V,X=W!=N[P];if(W==aa){return L(W,X,R,ab)}ac=W.parentNode;Z=L(ac,R,R,ab);while(ac){while(W){Y=W.previousSibling;t=L(W,X,R,ab);if(ab!=j){Z.insertBefore(t,Z.firstChild)}X=D;W=Y}if(ac==aa){return Z}W=ac.previousSibling;ac=ac.parentNode;V=L(ac,R,R,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function Q(aa,ab){var X=O(N[h],N[U]),Y=X!=N[h],ac,Z,W,t,V;if(X==aa){return L(X,Y,D,ab)}ac=X.parentNode;Z=L(ac,R,D,ab);while(ac){while(X){W=X.nextSibling;t=L(X,Y,D,ab);if(ab!=j){Z.appendChild(t)}Y=D;X=W}if(ac==aa){return Z}X=ac.nextSibling;ac=ac.parentNode;V=L(ac,R,D,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function L(t,Y,ab,ac){var X,W,Z,V,aa;if(Y){return y(t,ac)}if(t.nodeType==3){X=t.nodeValue;if(ab){V=N[U];W=X.substring(V);Z=X.substring(0,V)}else{V=N[z];W=X.substring(0,V);Z=X.substring(V)}if(ac!=E){t.nodeValue=Z}if(ac==j){return}aa=t.cloneNode(R);aa.nodeValue=W;return aa}if(ac==j){return}return t.cloneNode(R)}function y(V,t){if(t!=j){return t==E?V.cloneNode(D):V}V.parentNode.removeChild(V)}}a.Range=b})(tinymce.dom);(function(){function a(h){var j=this,k="\uFEFF",f,i,e=h.dom,d=true,g=false;function c(m,l){if(m&&l){if(m.item&&l.item&&m.item(0)===l.item(0)){return d}if(m.isEqual&&l.isEqual&&l.isEqual(m)){try{f.startContainer.nextSibling;return d}catch(n){}}}return g}function b(){var p=h.getRng(),l=e.createRng(),m,n,r,q;n=p.item?p.item(0):p.parentElement();if(n.ownerDocument!=e.doc){return l}if(p.item||!n.hasChildNodes()){l.setStart(n.parentNode,e.nodeIndex(n));l.setEnd(l.startContainer,l.startOffset+1);return l}m=p.duplicate();r=h.isCollapsed();p.collapse();p.pasteHTML('<span id="_mce_start" style="display:none;line-height:0">'+k+"</span>");if(!r){m.collapse(g);m.pasteHTML('<span id="_mce_end" style="display:none;line-height:0">'+k+"</span>")}function o(x){var t,v,s,u;s=e.get("_mce_"+(x?"start":"end"));u=s.previousSibling;if(u&&u.nodeType==3){t=u;v=t.nodeValue.length;e.remove(s);u=t.nextSibling;if(u&&u.nodeType==3){q=d;t.appendData(u.nodeValue);e.remove(u)}}else{u=s.nextSibling;if(u&&u.nodeType==3){t=u;v=0}else{if(u){v=e.nodeIndex(u)-1}else{v=e.nodeIndex(s)}t=s.parentNode}e.remove(s)}if(x){l.setStart(t,v)}if(!x||r){l.setEnd(t,v)}}o(d);if(!r){o(g)}if(q){j.addRange(l)}return l}this.addRange=function(m){var u,A,z=h.dom.doc,s=z.body,v,o,y,p,t,l,q,r,x,n;this.destroy();y=m.startContainer;p=m.startOffset;t=m.endContainer;l=m.endOffset;u=s.createTextRange();if(y==z||t==z){u=s.createTextRange();u.collapse();u.select();return}if(y.nodeType==1&&y.hasChildNodes()){r=y.childNodes.length-1;if(p>r){x=1;y=y.childNodes[r]}else{y=y.childNodes[p]}if(y.nodeType==3){p=0}}if(t.nodeType==1&&t.hasChildNodes()){r=t.childNodes.length-1;if(l==0){n=1;t=t.childNodes[0]}else{t=t.childNodes[Math.min(r,l-1)];if(t.nodeType==3){l=t.nodeValue.length}}}if(y==t&&y.nodeType==1){if(/^(IMG|TABLE)$/.test(y.nodeName)&&p!=l){u=s.createControlRange();u.addElement(y)}else{u=s.createTextRange();if(!y.hasChildNodes()&&y.canHaveHTML){y.innerHTML=k}u.moveToElementText(y);if(y.innerHTML==k){u.collapse(d);y.removeChild(y.firstChild)}}if(p==l){u.collapse(l<=m.endContainer.childNodes.length-1)}u.select();u.scrollIntoView();return}u=s.createTextRange();q=z.createElement("span");q.innerHTML=" ";if(y.nodeType==3){if(x){e.insertAfter(q,y)}else{y.parentNode.insertBefore(q,y)}u.moveToElementText(q);q.parentNode.removeChild(q);u.move("character",p)}else{u.moveToElementText(y);if(x){u.collapse(g)}}if(y==t&&y.nodeType==3){u.moveEnd("character",l-p);u.select();u.scrollIntoView();return}A=s.createTextRange();if(t.nodeType==3){t.parentNode.insertBefore(q,t);A.moveToElementText(q);q.parentNode.removeChild(q);A.move("character",l);u.setEndPoint("EndToStart",A)}else{A.moveToElementText(t);A.collapse(!!n);u.setEndPoint("EndToEnd",A)}u.select();u.scrollIntoView()};this.getRangeAt=function(){if(!f||!c(i,h.getRng())){f=b();i=h.getRng()}return f};this.destroy=function(){i=f=null};if(h.dom.boxModel){(function(){var r=e.doc,m=r.body,o,p;r.documentElement.unselectable=d;function q(s,v){var t=m.createTextRange();try{t.moveToPoint(s,v)}catch(u){t=null}return t}function n(t){var s;if(t.button){s=q(t.x,t.y);if(s){if(s.compareEndPoints("StartToStart",p)>0){s.setEndPoint("StartToStart",p)}else{s.setEndPoint("EndToEnd",p)}s.select()}}else{l()}}function l(){e.unbind(r,"mouseup",l);e.unbind(r,"mousemove",n);o=0}e.bind(r,"mousedown",function(s){if(s.target.nodeName==="HTML"){if(o){l()}o=1;p=q(s.x,s.y);if(p){e.bind(r,"mouseup",l);e.bind(r,"mousemove",n);p.select()}}})})()}}tinymce.dom.TridentSelection=a})();(function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,i=0,d=Object.prototype.toString,n=false;var b=function(E,t,B,v){B=B||[];var e=t=t||document;if(t.nodeType!==1&&t.nodeType!==9){return[]}if(!E||typeof E!=="string"){return B}var C=[],D,z,H,G,A,s,r=true,x=o(t);p.lastIndex=0;while((D=p.exec(E))!==null){C.push(D[1]);if(D[2]){s=RegExp.rightContext;break}}if(C.length>1&&j.exec(E)){if(C.length===2&&f.relative[C[0]]){z=g(C[0]+C[1],t)}else{z=f.relative[C[0]]?[t]:b(C.shift(),t);while(C.length){E=C.shift();if(f.relative[E]){E+=C.shift()}z=g(E,z)}}}else{if(!v&&C.length>1&&t.nodeType===9&&!x&&f.match.ID.test(C[0])&&!f.match.ID.test(C[C.length-1])){var I=b.find(C.shift(),t,x);t=I.expr?b.filter(I.expr,I.set)[0]:I.set[0]}if(t){var I=v?{expr:C.pop(),set:a(v)}:b.find(C.pop(),C.length===1&&(C[0]==="~"||C[0]==="+")&&t.parentNode?t.parentNode:t,x);z=I.expr?b.filter(I.expr,I.set):I.set;if(C.length>0){H=a(z)}else{r=false}while(C.length){var u=C.pop(),y=u;if(!f.relative[u]){u=""}else{y=C.pop()}if(y==null){y=t}f.relative[u](H,y,x)}}else{H=C=[]}}if(!H){H=z}if(!H){throw"Syntax error, unrecognized expression: "+(u||E)}if(d.call(H)==="[object Array]"){if(!r){B.push.apply(B,H)}else{if(t&&t.nodeType===1){for(var F=0;H[F]!=null;F++){if(H[F]&&(H[F]===true||H[F].nodeType===1&&h(t,H[F]))){B.push(z[F])}}}else{for(var F=0;H[F]!=null;F++){if(H[F]&&H[F].nodeType===1){B.push(z[F])}}}}}else{a(H,B)}if(s){b(s,e,B,v);b.uniqueSort(B)}return B};b.uniqueSort=function(r){if(c){n=false;r.sort(c);if(n){for(var e=1;e<r.length;e++){if(r[e]===r[e-1]){r.splice(e--,1)}}}}};b.matches=function(e,r){return b(e,null,null,r)};b.find=function(y,e,z){var x,u;if(!y){return[]}for(var t=0,s=f.order.length;t<s;t++){var v=f.order[t],u;if((u=f.match[v].exec(y))){var r=RegExp.leftContext;if(r.substr(r.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");x=f.find[v](u,e,z);if(x!=null){y=y.replace(f.match[v],"");break}}}}if(!x){x=e.getElementsByTagName("*")}return{set:x,expr:y}};b.filter=function(B,A,E,t){var s=B,G=[],y=A,v,e,x=A&&A[0]&&o(A[0]);while(B&&A.length){for(var z in f.filter){if((v=f.match[z].exec(B))!=null){var r=f.filter[z],F,D;e=false;if(y==G){G=[]}if(f.preFilter[z]){v=f.preFilter[z](v,y,E,G,t,x);if(!v){e=F=true}else{if(v===true){continue}}}if(v){for(var u=0;(D=y[u])!=null;u++){if(D){F=r(D,v,u,y);var C=t^!!F;if(E&&F!=null){if(C){e=true}else{y[u]=false}}else{if(C){G.push(D);e=true}}}}}if(F!==undefined){if(!E){y=G}B=B.replace(f.match[z],"");if(!e){return[]}break}}}if(B==s){if(e==null){throw"Syntax error, unrecognized expression: "+B}else{break}}s=B}return y};var f=b.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(y,e,x){var u=typeof e==="string",z=u&&!/\W/.test(e),v=u&&!z;if(z&&!x){e=e.toUpperCase()}for(var t=0,s=y.length,r;t<s;t++){if((r=y[t])){while((r=r.previousSibling)&&r.nodeType!==1){}y[t]=v||r&&r.nodeName===e?r||false:r===e}}if(v){b.filter(e,y,true)}},">":function(x,r,y){var u=typeof r==="string";if(u&&!/\W/.test(r)){r=y?r:r.toUpperCase();for(var s=0,e=x.length;s<e;s++){var v=x[s];if(v){var t=v.parentNode;x[s]=t.nodeName===r?t:false}}}else{for(var s=0,e=x.length;s<e;s++){var v=x[s];if(v){x[s]=u?v.parentNode:v.parentNode===r}}if(u){b.filter(r,x,true)}}},"":function(t,r,v){var s=i++,e=q;if(!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("parentNode",r,s,t,u,v)},"~":function(t,r,v){var s=i++,e=q;if(typeof r==="string"&&!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("previousSibling",r,s,t,u,v)}},find:{ID:function(r,s,t){if(typeof s.getElementById!=="undefined"&&!t){var e=s.getElementById(r[1]);return e?[e]:[]}},NAME:function(s,v,x){if(typeof v.getElementsByName!=="undefined"){var r=[],u=v.getElementsByName(s[1]);for(var t=0,e=u.length;t<e;t++){if(u[t].getAttribute("name")===s[1]){r.push(u[t])}}return r.length===0?null:r}},TAG:function(e,r){return r.getElementsByTagName(e[1])}},preFilter:{CLASS:function(t,r,s,e,x,y){t=" "+t[1].replace(/\\/g,"")+" ";if(y){return t}for(var u=0,v;(v=r[u])!=null;u++){if(v){if(x^(v.className&&(" "+v.className+" ").indexOf(t)>=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){for(var s=0;e[s]===false;s++){}return e[s]&&o(e[s])?r[1]:r[1].toUpperCase()},CHILD:function(e){if(e[1]=="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]=="even"&&"2n"||e[2]=="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=i++;return e},ATTR:function(u,r,s,e,v,x){var t=u[1].replace(/\\/g,"");if(!x&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if(u[3].match(p).length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toUpperCase()==="BUTTON"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return r<e[3]-0},gt:function(s,r,e){return r>e[3]-0},nth:function(s,r,e){return e[3]-0==r},eq:function(s,r,e){return e[3]-0==r}},filter:{PSEUDO:function(x,s,t,y){var r=s[1],u=f.filters[r];if(u){return u(x,t,s,y)}else{if(r==="contains"){return(x.textContent||x.innerText||"").indexOf(s[3])>=0}else{if(r==="not"){var v=s[3];for(var t=0,e=v.length;t<e;t++){if(v[t]===x){return false}}return true}}}},CHILD:function(e,t){var x=t[1],r=e;switch(x){case"only":case"first":while(r=r.previousSibling){if(r.nodeType===1){return false}}if(x=="first"){return true}r=e;case"last":while(r=r.nextSibling){if(r.nodeType===1){return false}}return true;case"nth":var s=t[2],A=t[3];if(s==1&&A==0){return true}var v=t[0],z=e.parentNode;if(z&&(z.sizcache!==v||!e.nodeIndex)){var u=0;for(r=z.firstChild;r;r=r.nextSibling){if(r.nodeType===1){r.nodeIndex=++u}}z.sizcache=v}var y=e.nodeIndex-A;if(s==0){return y==0}else{return(y%s==0&&y/s>=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),x=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?x===r:u==="*="?x.indexOf(r)>=0:u==="~="?(" "+x+" ").indexOf(r)>=0:!r?x&&e!==false:u==="!="?x!=r:u==="^="?x.indexOf(r)===0:u==="$="?x.substr(x.length-r.length)===r:u==="|="?x===r||x.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var j=f.match.POS;for(var l in f.match){f.match[l]=new RegExp(f.match[l].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var a=function(r,e){r=Array.prototype.slice.call(r);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(k){a=function(u,t){var r=t||[];if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var s=0,e=u.length;s<e;s++){r.push(u[s])}}else{for(var s=0;u[s];s++){r.push(u[s])}}}return r}}var c;if(document.documentElement.compareDocumentPosition){c=function(r,e){var s=r.compareDocumentPosition(e)&4?-1:r===e?0:1;if(s===0){n=true}return s}}else{if("sourceIndex" in document.documentElement){c=function(r,e){var s=r.sourceIndex-e.sourceIndex;if(s===0){n=true}return s}}else{if(document.createRange){c=function(t,r){var s=t.ownerDocument.createRange(),e=r.ownerDocument.createRange();s.setStart(t,0);s.setEnd(t,0);e.setStart(r,0);e.setEnd(r,0);var u=s.compareBoundaryPoints(Range.START_TO_END,e);if(u===0){n=true}return u}}}}(function(){var r=document.createElement("div"),s="script"+(new Date).getTime();r.innerHTML="<a name='"+s+"'/>";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(!!document.getElementById(s)){f.find.ID=function(u,v,x){if(typeof v.getElementById!=="undefined"&&!x){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r)})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="<p class='TEST'></p>";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(x,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!o(v)){try{return a(v.querySelectorAll(x),t)}catch(y){}}return e(x,v,t,u)};for(var r in e){b[r]=e[r]}})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}}})()}function m(r,x,v,B,y,A){var z=r=="previousSibling"&&!A;for(var t=0,s=B.length;t<s;t++){var e=B[t];if(e){if(z&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=B[e.sizset];break}if(e.nodeType===1&&!A){e.sizcache=v;e.sizset=t}if(e.nodeName===x){u=e;break}e=e[r]}B[t]=u}}}function q(r,x,v,B,y,A){var z=r=="previousSibling"&&!A;for(var t=0,s=B.length;t<s;t++){var e=B[t];if(e){if(z&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=B[e.sizset];break}if(e.nodeType===1){if(!A){e.sizcache=v;e.sizset=t}if(typeof x!=="string"){if(e===x){u=true;break}}else{if(b.filter(x,[e]).length>0){u=e;break}}}e=e[r]}B[t]=u}}}var h=document.compareDocumentPosition?function(r,e){return r.compareDocumentPosition(e)&16}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};var o=function(e){return e.nodeType===9&&e.documentElement.nodeName!=="HTML"||!!e.ownerDocument&&e.ownerDocument.documentElement.nodeName!=="HTML"};var g=function(e,y){var t=[],u="",v,s=y.nodeType?[y]:y;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var x=0,r=s.length;x<r;x++){b(e,s[x],t)}return b.filter(u,t)};window.tinymce.dom.Sizzle=b})();(function(d){var f=d.each,c=d.DOM,b=d.isIE,e=d.isWebKit,a;d.create("tinymce.dom.EventUtils",{EventUtils:function(){this.inits=[];this.events=[]},add:function(m,p,l,j){var g,h=this,i=h.events,k;if(p instanceof Array){k=[];f(p,function(o){k.push(h.add(m,o,l,j))});return k}if(m&&m.hasOwnProperty&&m instanceof Array){k=[];f(m,function(n){n=c.get(n);k.push(h.add(n,p,l,j))});return k}m=c.get(m);if(!m){return}g=function(n){if(h.disabled){return}n=n||window.event;if(n&&b){if(!n.target){n.target=n.srcElement}d.extend(n,h._stoppers)}if(!j){return l(n)}return l.call(j,n)};if(p=="unload"){d.unloads.unshift({func:g});return g}if(p=="init"){if(h.domLoaded){g()}else{h.inits.push(g)}return g}i.push({obj:m,name:p,func:l,cfunc:g,scope:j});h._add(m,p,g);return l},remove:function(l,m,k){var h=this,g=h.events,i=false,j;if(l&&l.hasOwnProperty&&l instanceof Array){j=[];f(l,function(n){n=c.get(n);j.push(h.remove(n,m,k))});return j}l=c.get(l);f(g,function(o,n){if(o.obj==l&&o.name==m&&(!k||(o.func==k||o.cfunc==k))){g.splice(n,1);h._remove(l,m,o.cfunc);i=true;return false}});return i},clear:function(l){var j=this,g=j.events,h,k;if(l){l=c.get(l);for(h=g.length-1;h>=0;h--){k=g[h];if(k.obj===l){j._remove(k.obj,k.name,k.cfunc);k.obj=k.cfunc=null;g.splice(h,1)}}}},cancel:function(g){if(!g){return false}this.stop(g);return this.prevent(g)},stop:function(g){if(g.stopPropagation){g.stopPropagation()}else{g.cancelBubble=true}return false},prevent:function(g){if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false},destroy:function(){var g=this;f(g.events,function(j,h){g._remove(j.obj,j.name,j.cfunc);j.obj=j.cfunc=null});g.events=[];g=null},_add:function(h,i,g){if(h.attachEvent){h.attachEvent("on"+i,g)}else{if(h.addEventListener){h.addEventListener(i,g,false)}else{h["on"+i]=g}}},_remove:function(i,j,h){if(i){try{if(i.detachEvent){i.detachEvent("on"+j,h)}else{if(i.removeEventListener){i.removeEventListener(j,h,false)}else{i["on"+j]=null}}}catch(g){}}},_pageInit:function(h){var g=this;if(g.domLoaded){return}g.domLoaded=true;f(g.inits,function(i){i()});g.inits=[]},_wait:function(i){var g=this,h=i.document;if(i.tinyMCE_GZ&&tinyMCE_GZ.loaded){g.domLoaded=1;return}if(h.attachEvent){h.attachEvent("onreadystatechange",function(){if(h.readyState==="complete"){h.detachEvent("onreadystatechange",arguments.callee);g._pageInit(i)}});if(h.documentElement.doScroll&&i==i.top){(function(){if(g.domLoaded){return}try{h.documentElement.doScroll("left")}catch(j){setTimeout(arguments.callee,0);return}g._pageInit(i)})()}}else{if(h.addEventListener){g._add(i,"DOMContentLoaded",function(){g._pageInit(i)})}}g._add(i,"load",function(){g._pageInit(i)})},_stoppers:{preventDefault:function(){this.returnValue=false},stopPropagation:function(){this.cancelBubble=true}}});a=d.dom.Event=new d.dom.EventUtils();a._wait(window);d.addUnload(function(){a.destroy()})})(tinymce);(function(a){a.dom.Element=function(f,d){var b=this,e,c;b.settings=d=d||{};b.id=f;b.dom=e=d.dom||a.DOM;if(!a.isIE){c=e.get(b.id)}a.each(("getPos,getRect,getParent,add,setStyle,getStyle,setStyles,setAttrib,setAttribs,getAttrib,addClass,removeClass,hasClass,getOuterHTML,setOuterHTML,remove,show,hide,isHidden,setHTML,get").split(/,/),function(g){b[g]=function(){var h=[f],j;for(j=0;j<arguments.length;j++){h.push(arguments[j])}h=e[g].apply(e,h);b.update(g);return h}});a.extend(b,{on:function(i,h,g){return a.dom.Event.add(b.id,i,h,g)},getXY:function(){return{x:parseInt(b.getStyle("left")),y:parseInt(b.getStyle("top"))}},getSize:function(){var g=e.get(b.id);return{w:parseInt(b.getStyle("width")||g.clientWidth),h:parseInt(b.getStyle("height")||g.clientHeight)}},moveTo:function(g,h){b.setStyles({left:g,top:h})},moveBy:function(g,i){var h=b.getXY();b.moveTo(h.x+g,h.y+i)},resizeTo:function(g,i){b.setStyles({width:g,height:i})},resizeBy:function(g,j){var i=b.getSize();b.resizeTo(i.w+g,i.h+j)},update:function(h){var g;if(a.isIE6&&d.blocker){h=h||"";if(h.indexOf("get")===0||h.indexOf("has")===0||h.indexOf("is")===0){return}if(h=="remove"){e.remove(b.blocker);return}if(!b.blocker){b.blocker=e.uniqueId();g=e.add(d.container||e.getRoot(),"iframe",{id:b.blocker,style:"position:absolute;",frameBorder:0,src:'javascript:""'});e.setStyle(g,"opacity",0)}else{g=e.get(b.blocker)}e.setStyles(g,{left:b.getStyle("left",1),top:b.getStyle("top",1),width:b.getStyle("width",1),height:b.getStyle("height",1),display:b.getStyle("display",1),zIndex:parseInt(b.getStyle("zIndex",1)||0)-1})}}})}})(tinymce);(function(c){function e(f){return f.replace(/[\n\r]+/g,"")}var b=c.is,a=c.isIE,d=c.each;c.create("tinymce.dom.Selection",{Selection:function(i,h,g){var f=this;f.dom=i;f.win=h;f.serializer=g;d(["onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent"],function(j){f[j]=new c.util.Dispatcher(f)});if(!f.win.getSelection){f.tridentSel=new c.dom.TridentSelection(f)}c.addUnload(f.destroy,f)},getContent:function(g){var f=this,h=f.getRng(),l=f.dom.create("body"),j=f.getSel(),i,k,m;g=g||{};i=k="";g.get=true;g.format=g.format||"html";f.onBeforeGetContent.dispatch(f,g);if(g.format=="text"){return f.isCollapsed()?"":(h.text||(j.toString?j.toString():""))}if(h.cloneContents){m=h.cloneContents();if(m){l.appendChild(m)}}else{if(b(h.item)||b(h.htmlText)){l.innerHTML=h.item?h.item(0).outerHTML:h.htmlText}else{l.innerHTML=h.toString()}}if(/^\s/.test(l.innerHTML)){i=" "}if(/\s+$/.test(l.innerHTML)){k=" "}g.getInner=true;g.content=f.isCollapsed()?"":i+f.serializer.serialize(l,g)+k;f.onGetContent.dispatch(f,g);return g.content},setContent:function(i,g){var f=this,j=f.getRng(),l,k=f.win.document;g=g||{format:"html"};g.set=true;i=g.content=f.dom.processHTML(i);f.onBeforeSetContent.dispatch(f,g);i=g.content;if(j.insertNode){i+='<span id="__caret">_</span>';if(j.startContainer==k&&j.endContainer==k){k.body.innerHTML=i}else{j.deleteContents();j.insertNode(f.getRng().createContextualFragment(i))}l=f.dom.get("__caret");j=k.createRange();j.setStartBefore(l);j.setEndBefore(l);f.setRng(j);f.dom.remove("__caret")}else{if(j.item){k.execCommand("Delete",false,null);j=f.getRng()}j.pasteHTML(i)}f.onSetContent.dispatch(f,g)},getStart:function(){var f=this,g=f.getRng(),h;if(a){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(1);h=g.parentElement();if(h&&h.nodeName=="BODY"){return h.firstChild||h}return h}else{h=g.startContainer;if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[Math.min(h.childNodes.length-1,g.startOffset)]}if(h&&h.nodeType==3){return h.parentNode}return h}},getEnd:function(){var g=this,h=g.getRng(),i,f;if(a){if(h.item){return h.item(0)}h=h.duplicate();h.collapse(0);i=h.parentElement();if(i&&i.nodeName=="BODY"){return i.lastChild||i}return i}else{i=h.endContainer;f=h.endOffset;if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[f>0?f-1:f]}if(i&&i.nodeType==3){return i.parentNode}return i}},getBookmark:function(q,r){var u=this,m=u.dom,g,j,i,n,h,o,p,l="\uFEFF",s;function f(v,x){var t=0;d(m.select(v),function(z,y){if(z==x){t=y}});return t}if(q==2){function k(){var v=u.getRng(true),t=m.getRoot(),x={};function y(B,F){var A=B[F?"startContainer":"endContainer"],E=B[F?"startOffset":"endOffset"],z=[],D,C=0;if(A.nodeType==3){if(r){for(node=A.previousSibling;node&&node.nodeType==3;node=node.previousSibling){E+=node.nodeValue.length}}z.push(E)}else{D=A.childNodes;if(E>=D.length){C=1;E=D.length-1}z.push(u.dom.nodeIndex(D[E],r)+C)}for(;A&&A!=t;A=A.parentNode){z.push(u.dom.nodeIndex(A,r))}return z}x.start=y(v,true);if(!u.isCollapsed()){x.end=y(v)}return x}return k()}if(q){return{rng:u.getRng()}}g=u.getRng();i=m.uniqueId();n=tinyMCE.activeEditor.selection.isCollapsed();s="overflow:hidden;line-height:0px";if(g.duplicate||g.item){if(!g.item){j=g.duplicate();g.collapse();g.pasteHTML('<span _mce_type="bookmark" id="'+i+'_start" style="'+s+'">'+l+"</span>");if(!n){j.collapse(false);j.pasteHTML('<span _mce_type="bookmark" id="'+i+'_end" style="'+s+'">'+l+"</span>")}}else{o=g.item(0);h=o.nodeName;return{name:h,index:f(h,o)}}}else{o=u.getNode();h=o.nodeName;if(h=="IMG"){return{name:h,index:f(h,o)}}j=g.cloneRange();if(!n){j.collapse(false);j.insertNode(m.create("span",{_mce_type:"bookmark",id:i+"_end",style:s},l))}g.collapse(true);g.insertNode(m.create("span",{_mce_type:"bookmark",id:i+"_start",style:s},l))}u.moveToBookmark({id:i,keep:1});return{id:i}},moveToBookmark:function(l){var n=this,k=n.dom,i,h,f,m;if(n.tridentSel){n.tridentSel.destroy()}if(l){if(l.start){f=k.createRng();m=k.getRoot();function g(s){var o=l[s?"start":"end"],p,q,r;if(o){for(q=m,p=o.length-1;p>=1;p--){q=q.childNodes[o[p]]}if(s){f.setStart(q,o[0])}else{f.setEnd(q,o[0])}}}g(true);g();n.setRng(f)}else{if(l.id){f=k.createRng();function j(u){var p=k.get(l.id+"_"+u),t,o,r,s,q=l.keep;if(p){t=p.parentNode;if(u=="start"){if(!q){o=k.nodeIndex(p)}else{t=p;o=1}f.setStart(t,o);f.setEnd(t,o)}else{if(!q){o=k.nodeIndex(p)}else{t=p;o=1}f.setEnd(t,o)}if(!q){s=p.previousSibling;r=p.nextSibling;d(c.grep(p.childNodes),function(v){if(v.nodeType==3){v.nodeValue=v.nodeValue.replace(/\uFEFF/g,"")}});while(p=k.get(l.id+"_"+u)){k.remove(p,1)}if(s&&r&&s.nodeType==r.nodeType&&s.nodeType==3){o=s.nodeValue.length;s.appendData(r.nodeValue);k.remove(r);if(u=="start"){f.setStart(s,o);f.setEnd(s,o)}else{f.setEnd(s,o)}}}}}j("start");j("end");n.setRng(f)}else{if(l.name){n.select(k.select(l.name)[l.index])}else{if(l.rng){n.setRng(l.rng)}}}}}},select:function(k,j){var i=this,l=i.dom,g=l.createRng(),f;f=l.nodeIndex(k);g.setStart(k.parentNode,f);g.setEnd(k.parentNode,f+1);if(j){function h(m,o){var n=new c.dom.TreeWalker(m,m);do{if(m.nodeType==3&&c.trim(m.nodeValue).length!=0){if(o){g.setStart(m,0)}else{g.setEnd(m,m.nodeValue.length)}return}if(m.nodeName=="BR"){if(o){g.setStartBefore(m)}else{g.setEndBefore(m)}return}}while(m=(o?n.next():n.prev()))}h(k,1);h(k)}i.setRng(g);return k},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}if(h.compareEndPoints){return h.compareEndPoints("StartToEnd",h)===0}return !g||h.collapsed},collapse:function(f){var g=this,h=g.getRng(),i;if(h.item){i=h.item(0);h=this.win.document.body.createTextRange();h.moveToElementText(i)}h.collapse(!!f);g.setRng(h)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(j){var g=this,h,i;if(j&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():g.win.document.createRange())}}catch(f){}if(!i){i=a?g.win.document.body.createTextRange():g.win.document.createRange()}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){h.removeAllRanges();h.addRange(i)}}else{if(i.cloneRange){g.tridentSel.addRange(i);return}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var g=this,f=g.getRng(),h=g.getSel(),i;if(!a){if(!f){return g.dom.getRoot()}i=f.commonAncestorContainer;if(!f.collapsed){if(f.startContainer==f.endContainer){if(f.startOffset-f.endOffset<2){if(f.startContainer.hasChildNodes()){i=f.startContainer.childNodes[f.startOffset]}}}if(c.isWebKit&&h.anchorNode&&h.anchorNode.nodeType==1){return h.anchorNode.childNodes[h.anchorOffset]}}if(i&&i.nodeType==3){return i.parentNode}return i}return f.item?f.item(0):f.parentElement()},getSelectedBlocks:function(g,f){var i=this,j=i.dom,m,h,l,k=[];m=j.getParent(g||i.getStart(),j.isBlock);h=j.getParent(f||i.getEnd(),j.isBlock);if(m){k.push(m)}if(m&&h&&m!=h){l=m;while((l=l.nextSibling)&&l!=h){if(j.isBlock(l)){k.push(l)}}}if(h&&m!=h){k.push(h)}return k},destroy:function(g){var f=this;f.win=null;if(f.tridentSel){f.tridentSel.destroy()}if(!g){c.removeUnload(f.destroy)}}})})(tinymce);(function(a){a.create("tinymce.dom.XMLWriter",{node:null,XMLWriter:function(c){function b(){var e=document.implementation;if(!e||!e.createDocument){try{return new ActiveXObject("MSXML2.DOMDocument")}catch(d){}try{return new ActiveXObject("Microsoft.XmlDom")}catch(d){}}else{return e.createDocument("","",null)}}this.doc=b();this.valid=a.isOpera||a.isWebKit;this.reset()},reset:function(){var b=this,c=b.doc;if(c.firstChild){c.removeChild(c.firstChild)}b.node=c.appendChild(c.createElement("html"))},writeStartElement:function(c){var b=this;b.node=b.node.appendChild(b.doc.createElement(c))},writeAttribute:function(c,b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.setAttribute(c,b)},writeEndElement:function(){this.node=this.node.parentNode},writeFullEndElement:function(){var b=this,c=b.node;c.appendChild(b.doc.createTextNode(""));b.node=c.parentNode},writeText:function(b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.appendChild(this.doc.createTextNode(b))},writeCDATA:function(b){this.node.appendChild(this.doc.createCDATASection(b))},writeComment:function(b){if(a.isIE){b=b.replace(/^\-|\-$/g," ")}this.node.appendChild(this.doc.createComment(b.replace(/\-\-/g," ")))},getContent:function(){var b;b=this.doc.xml||new XMLSerializer().serializeToString(this.doc);b=b.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g,"");b=b.replace(/ ?\/>/g," />");if(this.valid){b=b.replace(/\%MCGT%/g,"&gt;")}return b}})})(tinymce);(function(a){a.create("tinymce.dom.StringWriter",{str:null,tags:null,count:0,settings:null,indent:null,StringWriter:function(b){this.settings=a.extend({indent_char:" ",indentation:0},b);this.reset()},reset:function(){this.indent="";this.str="";this.tags=[];this.count=0},writeStartElement:function(b){this._writeAttributesEnd();this.writeRaw("<"+b);this.tags.push(b);this.inAttr=true;this.count++;this.elementCount=this.count},writeAttribute:function(d,b){var c=this;c.writeRaw(" "+c.encode(d)+'="'+c.encode(b)+'"')},writeEndElement:function(){var b;if(this.tags.length>0){b=this.tags.pop();if(this._writeAttributesEnd(1)){this.writeRaw("</"+b+">")}if(this.settings.indentation>0){this.writeRaw("\n")}}},writeFullEndElement:function(){if(this.tags.length>0){this._writeAttributesEnd();this.writeRaw("</"+this.tags.pop()+">");if(this.settings.indentation>0){this.writeRaw("\n")}}},writeText:function(b){this._writeAttributesEnd();this.writeRaw(this.encode(b));this.count++},writeCDATA:function(b){this._writeAttributesEnd();this.writeRaw("<![CDATA["+b+"]]>");this.count++},writeComment:function(b){this._writeAttributesEnd();this.writeRaw("<!-- "+b+"-->");this.count++},writeRaw:function(b){this.str+=b},encode:function(b){return b.replace(/[<>&"]/g,function(c){switch(c){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case'"':return"&quot;"}return c})},getContent:function(){return this.str},_writeAttributesEnd:function(b){if(!this.inAttr){return}this.inAttr=false;if(b&&this.elementCount==this.count){this.writeRaw(" />");return false}this.writeRaw(">");return true}})})(tinymce);(function(e){var g=e.extend,f=e.each,b=e.util.Dispatcher,d=e.isIE,a=e.isGecko;function c(h){return h.replace(/([?+*])/g,".$1")}e.create("tinymce.dom.Serializer",{Serializer:function(j){var i=this;i.key=0;i.onPreProcess=new b(i);i.onPostProcess=new b(i);try{i.writer=new e.dom.XMLWriter()}catch(h){i.writer=new e.dom.StringWriter()}i.settings=j=g({dom:e.DOM,valid_nodes:0,node_filter:0,attr_filter:0,invalid_attrs:/^(_mce_|_moz_|sizset|sizcache)/,closed:/^(br|hr|input|meta|img|link|param|area)$/,entity_encoding:"named",entities:"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,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",valid_elements:"*[*]",extended_valid_elements:0,invalid_elements:0,fix_table_elements:1,fix_list_elements:true,fix_content_duplication:true,convert_fonts_to_spans:false,font_size_classes:0,apply_source_formatting:0,indent_mode:"simple",indent_char:"\t",indent_levels:1,remove_linebreaks:1,remove_redundant_brs:1,element_format:"xhtml"},j);i.dom=j.dom;i.schema=j.schema;if(j.entity_encoding=="named"&&!j.entities){j.entity_encoding="raw"}if(j.remove_redundant_brs){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/(<br \/>\s*)+<\/(p|h[1-6]|div|li)>/gi,function(n,m,o){if(/^<br \/>\s*<\//.test(n)){return"</"+o+">"}return n})})}if(j.element_format=="html"){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/<([^>]+) \/>/g,"<$1>")})}if(j.fix_list_elements){i.onPreProcess.add(function(v,s){var l,z,y=["ol","ul"],u,t,q,k=/^(OL|UL)$/,A;function m(r,x){var o=x.split(","),p;while((r=r.previousSibling)!=null){for(p=0;p<o.length;p++){if(r.nodeName==o[p]){return r}}}return null}for(z=0;z<y.length;z++){l=i.dom.select(y[z],s.node);for(u=0;u<l.length;u++){t=l[u];q=t.parentNode;if(k.test(q.nodeName)){A=m(t,"LI");if(!A){A=i.dom.create("li");A.innerHTML="&nbsp;";A.appendChild(t);q.insertBefore(A,q.firstChild)}else{A.appendChild(t)}}}}})}if(j.fix_table_elements){i.onPreProcess.add(function(k,l){if(!e.isOpera||opera.buildNumber()>=1767){f(i.dom.select("p table",l.node).reverse(),function(p){var o=i.dom.getParent(p.parentNode,"table,p");if(o.nodeName!="TABLE"){try{i.dom.split(o,p)}catch(m){}}})}})}},setEntities:function(o){var n=this,j,m,h={},k;if(n.entityLookup){return}j=o.split(",");for(m=0;m<j.length;m+=2){k=j[m];if(k==34||k==38||k==60||k==62){continue}h[String.fromCharCode(j[m])]=j[m+1];k=parseInt(j[m]).toString(16)}n.entityLookup=h},setRules:function(i){var h=this;h._setup();h.rules={};h.wildRules=[];h.validElements={};return h.addRules(i)},addRules:function(i){var h=this,j;if(!i){return}h._setup();f(i.split(","),function(m){var q=m.split(/\[|\]/),l=q[0].split("/"),r,k,o,n=[];if(j){k=e.extend([],j.attribs)}if(q.length>1){f(q[1].split("|"),function(u){var p={},t;k=k||[];u=u.replace(/::/g,"~");u=/^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(u);u[2]=u[2].replace(/~/g,":");if(u[1]=="!"){r=r||[];r.push(u[2])}if(u[1]=="-"){for(t=0;t<k.length;t++){if(k[t].name==u[2]){k.splice(t,1);return}}}switch(u[3]){case"=":p.defaultVal=u[4]||"";break;case":":p.forcedVal=u[4];break;case"<":p.validVals=u[4].split("?");break}if(/[*.?]/.test(u[2])){o=o||[];p.nameRE=new RegExp("^"+c(u[2])+"$");o.push(p)}else{p.name=u[2];k.push(p)}n.push(u[2])})}f(l,function(v,u){var y=v.charAt(0),t=1,p={};if(j){if(j.noEmpty){p.noEmpty=j.noEmpty}if(j.fullEnd){p.fullEnd=j.fullEnd}if(j.padd){p.padd=j.padd}}switch(y){case"-":p.noEmpty=true;break;case"+":p.fullEnd=true;break;case"#":p.padd=true;break;default:t=0}l[u]=v=v.substring(t);h.validElements[v]=1;if(/[*.?]/.test(l[0])){p.nameRE=new RegExp("^"+c(l[0])+"$");h.wildRules=h.wildRules||{};h.wildRules.push(p)}else{p.name=l[0];if(l[0]=="@"){j=p}h.rules[v]=p}p.attribs=k;if(r){p.requiredAttribs=r}if(o){v="";f(n,function(s){if(v){v+="|"}v+="("+c(s)+")"});p.validAttribsRE=new RegExp("^"+v.toLowerCase()+"$");p.wildAttribs=o}})});i="";f(h.validElements,function(m,l){if(i){i+="|"}if(l!="@"){i+=l}});h.validElementsRE=new RegExp("^("+c(i.toLowerCase())+")$")},findRule:function(m){var j=this,l=j.rules,h,k;j._setup();k=l[m];if(k){return k}l=j.wildRules;for(h=0;h<l.length;h++){if(l[h].nameRE.test(m)){return l[h]}}return null},findAttribRule:function(h,l){var j,k=h.wildAttribs;for(j=0;j<k.length;j++){if(k[j].nameRE.test(l)){return k[j]}}return null},serialize:function(r,q){var m,k=this,p,i,j,l;k._setup();q=q||{};q.format=q.format||"html";k.processObj=q;if(d){l=[];f(r.getElementsByTagName("option"),function(o){var h=k.dom.getAttrib(o,"selected");l.push(h?h:null)})}r=r.cloneNode(true);if(d){f(r.getElementsByTagName("option"),function(o,h){k.dom.setAttrib(o,"selected",l[h])})}j=r.ownerDocument.implementation;if(j.createHTMLDocument&&(e.isOpera&&opera.buildNumber()>=1767)){p=j.createHTMLDocument("");f(r.nodeName=="BODY"?r.childNodes:[r],function(h){p.body.appendChild(p.importNode(h,true))});if(r.nodeName!="BODY"){r=p.body.firstChild}else{r=p.body}i=k.dom.doc;k.dom.doc=p}k.key=""+(parseInt(k.key)+1);if(!q.no_events){q.node=r;k.onPreProcess.dispatch(k,q)}k.writer.reset();k._info=q;k._serializeNode(r,q.getInner);q.content=k.writer.getContent();if(i){k.dom.doc=i}if(!q.no_events){k.onPostProcess.dispatch(k,q)}k._postProcess(q);q.node=null;return e.trim(q.content)},_postProcess:function(n){var i=this,k=i.settings,j=n.content,m=[],l;if(n.format=="html"){l=i._protect({content:j,patterns:[{pattern:/(<script[^>]*>)(.*?)(<\/script>)/g},{pattern:/(<noscript[^>]*>)(.*?)(<\/noscript>)/g},{pattern:/(<style[^>]*>)(.*?)(<\/style>)/g},{pattern:/(<pre[^>]*>)(.*?)(<\/pre>)/g,encode:1},{pattern:/(<!--\[CDATA\[)(.*?)(\]\]-->)/g}]});j=l.content;if(k.entity_encoding!=="raw"){j=i._encode(j)}if(!n.set){j=j.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g,k.entity_encoding=="numeric"?"<p$1>&#160;</p>":"<p$1>&nbsp;</p>");if(k.remove_linebreaks){j=j.replace(/\r?\n|\r/g," ");j=j.replace(/(<[^>]+>)\s+/g,"$1 ");j=j.replace(/\s+(<\/[^>]+>)/g," $1");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g,"<$1 $2>");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g,"<$1>");j=j.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g,"</$1>")}if(k.apply_source_formatting&&k.indent_mode=="simple"){j=j.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g,"\n<$1$2$3>\n");j=j.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g,"\n<$1$2>");j=j.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g,"</$1>\n");j=j.replace(/\n\n/g,"\n")}}j=i._unprotect(j,l);j=j.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g,"<![CDATA[$1]]>");if(k.entity_encoding=="raw"){j=j.replace(/<p>&nbsp;<\/p>|<p([^>]+)>&nbsp;<\/p>/g,"<p$1>\u00a0</p>")}j=j.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g,function(h,p,o){return"<noscript"+p+">"+i.dom.decode(o.replace(/<!--|-->/g,""))+"</noscript>"})}n.content=j},_serializeNode:function(D,I){var z=this,A=z.settings,x=z.writer,q,j,u,F,E,H,B,h,y,k,r,C,p,m,G,o;if(!A.node_filter||A.node_filter(D)){switch(D.nodeType){case 1:if(D.hasAttribute?D.hasAttribute("_mce_bogus"):D.getAttribute("_mce_bogus")){return}p=G=false;q=D.hasChildNodes();k=D.getAttribute("_mce_name")||D.nodeName.toLowerCase();o=D.getAttribute("_mce_type");if(o){if(!z._info.cleanup){p=true;return}else{G=1}}if(d){if(D.scopeName!=="HTML"&&D.scopeName!=="html"){k=D.scopeName+":"+k}}if(k.indexOf("mce:")===0){k=k.substring(4)}if(!G){if(!z.validElementsRE||!z.validElementsRE.test(k)||(z.invalidElementsRE&&z.invalidElementsRE.test(k))||I){p=true;break}}if(d){if(A.fix_content_duplication){if(D._mce_serialized==z.key){return}D._mce_serialized=z.key}if(k.charAt(0)=="/"){k=k.substring(1)}}else{if(a){if(D.nodeName==="BR"&&D.getAttribute("type")=="_moz"){return}}}if(A.validate_children){if(z.elementName&&!z.schema.isValid(z.elementName,k)){p=true;break}z.elementName=k}r=z.findRule(k);if(!r){p=true;break}k=r.name||k;m=A.closed.test(k);if((!q&&r.noEmpty)||(d&&!k)){p=true;break}if(r.requiredAttribs){H=r.requiredAttribs;for(F=H.length-1;F>=0;F--){if(this.dom.getAttrib(D,H[F])!==""){break}}if(F==-1){p=true;break}}x.writeStartElement(k);if(r.attribs){for(F=0,B=r.attribs,E=B.length;F<E;F++){H=B[F];y=z._getAttrib(D,H);if(y!==null){x.writeAttribute(H.name,y)}}}if(r.validAttribsRE){B=z.dom.getAttribs(D);for(F=B.length-1;F>-1;F--){h=B[F];if(h.specified){H=h.nodeName.toLowerCase();if(A.invalid_attrs.test(H)||!r.validAttribsRE.test(H)){continue}C=z.findAttribRule(r,H);y=z._getAttrib(D,C,H);if(y!==null){x.writeAttribute(H,y)}}}}if(o&&G){x.writeAttribute("_mce_type",o)}if(k==="script"&&e.trim(D.innerHTML)){x.writeText("// ");x.writeCDATA(D.innerHTML.replace(/<!--|-->|<\[CDATA\[|\]\]>/g,""));q=false;break}if(r.padd){if(q&&(u=D.firstChild)&&u.nodeType===1&&D.childNodes.length===1){if(u.hasAttribute?u.hasAttribute("_mce_bogus"):u.getAttribute("_mce_bogus")){x.writeText("\u00a0")}}else{if(!q){x.writeText("\u00a0")}}}break;case 3:if(A.validate_children&&z.elementName&&!z.schema.isValid(z.elementName,"#text")){return}return x.writeText(D.nodeValue);case 4:return x.writeCDATA(D.nodeValue);case 8:return x.writeComment(D.nodeValue)}}else{if(D.nodeType==1){q=D.hasChildNodes()}}if(q&&!m){u=D.firstChild;while(u){z._serializeNode(u);z.elementName=k;u=u.nextSibling}}if(!p){if(!m){x.writeFullEndElement()}else{x.writeEndElement()}}},_protect:function(j){var i=this;j.items=j.items||[];function h(l){return l.replace(/[\r\n\\]/g,function(m){if(m==="\n"){return"\\n"}else{if(m==="\\"){return"\\\\"}}return"\\r"})}function k(l){return l.replace(/\\[\\rn]/g,function(m){if(m==="\\n"){return"\n"}else{if(m==="\\\\"){return"\\"}}return"\r"})}f(j.patterns,function(l){j.content=k(h(j.content).replace(l.pattern,function(n,o,m,p){m=k(m);if(l.encode){m=i._encode(m)}j.items.push(m);return o+"<!--mce:"+(j.items.length-1)+"-->"+p}))});return j},_unprotect:function(i,j){i=i.replace(/\<!--mce:([0-9]+)--\>/g,function(k,h){return j.items[parseInt(h)]});j.items=[];return i},_encode:function(m){var j=this,k=j.settings,i;if(k.entity_encoding!=="raw"){if(k.entity_encoding.indexOf("named")!=-1){j.setEntities(k.entities);i=j.entityLookup;m=m.replace(/[\u007E-\uFFFF]/g,function(h){var l;if(l=i[h]){h="&"+l+";"}return h})}if(k.entity_encoding.indexOf("numeric")!=-1){m=m.replace(/[\u007E-\uFFFF]/g,function(h){return"&#"+h.charCodeAt(0)+";"})}}return m},_setup:function(){var h=this,i=this.settings;if(h.done){return}h.done=1;h.setRules(i.valid_elements);h.addRules(i.extended_valid_elements);if(i.invalid_elements){h.invalidElementsRE=new RegExp("^("+c(i.invalid_elements.replace(/,/g,"|").toLowerCase())+")$")}if(i.attrib_value_filter){h.attribValueFilter=i.attribValueFilter}},_getAttrib:function(m,j,h){var l,k;h=h||j.name;if(j.forcedVal&&(k=j.forcedVal)){if(k==="{$uid}"){return this.dom.uniqueId()}return k}k=this.dom.getAttrib(m,h);switch(h){case"rowspan":case"colspan":if(k=="1"){k=""}break}if(this.attribValueFilter){k=this.attribValueFilter(h,k,m)}if(j.validVals){for(l=j.validVals.length-1;l>=0;l--){if(k==j.validVals[l]){break}}if(l==-1){return null}}if(k===""&&typeof(j.defaultVal)!="undefined"){k=j.defaultVal;if(k==="{$uid}"){return this.dom.uniqueId()}return k}else{if(h=="class"&&this.processObj.get){k=k.replace(/\s?mceItem\w+\s?/g,"")}}if(k===""){return null}return k}})})(tinymce);(function(a){a.dom.ScriptLoader=function(h){var c=0,k=1,i=2,l={},j=[],f={},d=[],g=0,e;function b(m,u){var v=this,q=a.DOM,s,o,r,n;function p(){q.remove(n);if(s){s.onreadystatechange=s.onload=s=null}u()}n=q.uniqueId();if(a.isIE6){o=new a.util.URI(m);r=location;if(o.host==r.hostname&&o.port==r.port&&(o.protocol+":")==r.protocol){a.util.XHR.send({url:a._addVer(o.getURI()),success:function(x){var t=q.create("script",{type:"text/javascript"});t.text=x;document.getElementsByTagName("head")[0].appendChild(t);q.remove(t);p()}});return}}s=q.create("script",{id:n,type:"text/javascript",src:a._addVer(m)});s.onload=p;s.onreadystatechange=function(){var t=s.readyState;if(t=="complete"||t=="loaded"){p()}};(document.getElementsByTagName("head")[0]||document.body).appendChild(s)}this.isDone=function(m){return l[m]==i};this.markDone=function(m){l[m]=i};this.add=this.load=function(m,q,n){var o,p=l[m];if(p==e){j.push(m);l[m]=c}if(q){if(!f[m]){f[m]=[]}f[m].push({func:q,scope:n||this})}};this.loadQueue=function(n,m){this.loadScripts(j,n,m)};this.loadScripts=function(m,q,p){var o;function n(r){a.each(f[r],function(s){s.func.call(s.scope)});f[r]=e}d.push({func:q,scope:p||this});o=function(){var r=a.grep(m);m.length=0;a.each(r,function(s){if(l[s]==i){n(s);return}if(l[s]!=k){l[s]=k;g++;b(s,function(){l[s]=i;g--;n(s);o()})}});if(!g){a.each(d,function(s){s.func.call(s.scope)});d.length=0}};o()}};a.ScriptLoader=new a.dom.ScriptLoader()})(tinymce);tinymce.dom.TreeWalker=function(a,c){var b=a;function d(i,f,e,j){var h,g;if(i){if(!j&&i[f]){return i[f]}if(i!=c){h=i[e];if(h){return h}for(g=i.parentNode;g&&g!=c;g=g.parentNode){h=g[e];if(h){return h}}}}}this.current=function(){return b};this.next=function(e){return(b=d(b,"firstChild","nextSibling",e))};this.prev=function(e){return(b=d(b,"lastChild","lastSibling",e))}};(function(){var a={};function b(f,e){var d;function c(g){return g.replace(/[A-Z]+/g,function(h){return c(f[h])})}for(d in f){if(f.hasOwnProperty(d)){f[d]=c(f[d])}}c(e).replace(/#/g,"#text").replace(/(\w+)\[([^\]]+)\]/g,function(l,g,j){var h,k={};j=j.split(/\|/);for(h=j.length-1;h>=0;h--){k[j[h]]=1}a[g]=k})}b({Z:"#|H|K|N|O|P",Y:"#|X|form|R|Q",X:"p|T|div|U|W|isindex|fieldset|table",W:"pre|hr|blockquote|address|center|noframes",U:"ul|ol|dl|menu|dir",ZC:"#|p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q",T:"h1|h2|h3|h4|h5|h6",ZB:"#|X|S|Q",S:"R|P",ZA:"#|a|G|J|M|O|P",R:"#|a|H|K|N|O",Q:"noscript|P",P:"ins|del|script",O:"input|select|textarea|label|button",N:"M|L",M:"em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym",L:"sub|sup",K:"J|I",J:"tt|i|b|u|s|strike",I:"big|small|font|basefont",H:"G|F",G:"br|span|bdo",F:"object|applet|img|map|iframe"},"script[]style[]object[#|param|X|form|a|H|K|N|O|Q]param[]p[S]a[Z]br[]span[S]bdo[S]applet[#|param|X|form|a|H|K|N|O|Q]h1[S]img[]map[X|form|Q|area]h2[S]iframe[#|X|form|a|H|K|N|O|Q]h3[S]tt[S]i[S]b[S]u[S]s[S]strike[S]big[S]small[S]font[S]basefont[]em[S]strong[S]dfn[S]code[S]q[S]samp[S]kbd[S]var[S]cite[S]abbr[S]acronym[S]sub[S]sup[S]input[]select[optgroup|option]optgroup[option]option[]textarea[]label[S]button[#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]h4[S]ins[#|X|form|a|H|K|N|O|Q]h5[S]del[#|X|form|a|H|K|N|O|Q]h6[S]div[#|X|form|a|H|K|N|O|Q]ul[li]li[#|X|form|a|H|K|N|O|Q]ol[li]dl[dt|dd]dt[S]dd[#|X|form|a|H|K|N|O|Q]menu[li]dir[li]pre[ZA]hr[]blockquote[#|X|form|a|H|K|N|O|Q]address[S|p]center[#|X|form|a|H|K|N|O|Q]noframes[#|X|form|a|H|K|N|O|Q]isindex[]fieldset[#|legend|X|form|a|H|K|N|O|Q]legend[S]table[caption|col|colgroup|thead|tfoot|tbody|tr]caption[S]col[]colgroup[col]thead[tr]tr[th|td]th[#|X|form|a|H|K|N|O|Q]form[#|X|a|H|K|N|O|Q]noscript[#|X|form|a|H|K|N|O|Q]td[#|X|form|a|H|K|N|O|Q]tfoot[tr]tbody[tr]area[]base[]body[#|X|form|a|H|K|N|O|Q]");tinymce.dom.Schema=function(){var c=this,d=a;c.isValid=function(f,e){var g=d[f];return !!(g&&(!e||g[e]))}}})();(function(a){a.dom.RangeUtils=function(c){var b="\uFEFF";this.walk=function(d,r){var h=d.startContainer,k=d.startOffset,s=d.endContainer,l=d.endOffset,i,f,n,g,q,p,e;e=c.select("td.mceSelected,th.mceSelected");if(e.length>0){a.each(e,function(t){r([t])});return}function o(v,u,t){var x=[];for(;v&&v!=t;v=v[u]){x.push(v)}return x}function m(u,t){do{if(u.parentNode==t){return u}u=u.parentNode}while(u)}function j(v,u,x){var t=x?"nextSibling":"previousSibling";for(g=v,q=g.parentNode;g&&g!=u;g=q){q=g.parentNode;p=o(g==v?g:g[t],t);if(p.length){if(!x){p.reverse()}r(p)}}}if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[k]}if(s.nodeType==1&&s.hasChildNodes()){s=s.childNodes[Math.min(k==l?l:l-1,s.childNodes.length-1)]}i=c.findCommonAncestor(h,s);if(h==s){return r([h])}for(g=h;g;g=g.parentNode){if(g==s){return j(h,i,true)}if(g==i){break}}for(g=s;g;g=g.parentNode){if(g==h){return j(s,i)}if(g==i){break}}f=m(h,i)||h;n=m(s,i)||s;j(h,f,true);p=o(f==h?f:f.nextSibling,"nextSibling",n==s?n.nextSibling:n);if(p.length){r(p)}j(s,n)}}})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(e,d){this.id=e;this.settings=d=d||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=d.scope||this;this.disabled=0;this.active=0},setDisabled:function(d){var f;if(d!=this.disabled){f=b.get(this.id);if(f&&this.settings.unavailable_prefix){if(d){this.prevTitle=f.title;f.title=this.settings.unavailable_prefix+": "+f.title}else{f.title=this.prevTitle}}this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(b,a){this.parent(b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator"},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeight<j.max_height){c.setStyle(l,"overflow","hidden")}}},showMenu:function(p,n,r){var z=this,A=z.settings,o,g=c.getViewPort(),u,l,v,q,i=2,k,j,m=z.classPrefix;z.collapse(1);if(z.isMenuVisible){return}if(!z.rendered){o=c.add(z.settings.container,z.renderNode());f(z.items,function(h){h.postRender()});z.element=new b("menu_"+z.id,{blocker:1,container:A.container})}else{o=c.get("menu_"+z.id)}if(!e.isOpera){c.setStyles(o,{left:-65535,top:-65535})}c.show(o);z.update();p+=A.offset_x||0;n+=A.offset_y||0;g.w-=4;g.h-=4;if(A.constrain){u=o.clientWidth-i;l=o.clientHeight-i;v=g.x+g.w;q=g.y+g.h;if((p+A.vp_offset_x+u)>v){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return a.cancel(s)}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(x){var h,t,s;x=x.target;if(x&&(x=c.getParent(x,"tr"))){h=z.items[x.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(x&&c.hasClass(x,m+"ItemSub")){t=c.getRect(x);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}z.onShowMenu.dispatch(z);if(A.keyboard_focus){a.add(o,"keydown",z._keyHandler,z);c.select("a","menu_"+z.id)[0].focus();z._focusIdx=0}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);a.remove(h,"mouseover",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000"});k=c.add(g,"div",{id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_keyHandler:function(j){var i=this,h=j.keyCode;function g(m){var k=i._focusIdx+m,l=c.select("a","menu_"+i.id)[k];if(l){i._focusIdx=k;l.focus()}}switch(h){case 38:g(-1);return;case 40:g(1);return;case 13:return;case 27:return this.hideMenu()}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,"td");i=p=c.add(i,"a",{href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(d,c){this.parent(d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='<a id="'+this.id+'" href="javascript:;" class="'+f+" "+f+"Enabled "+e["class"]+(c?" "+f+"Labeled":"")+'" onmousedown="return false;" onclick="return false;" title="'+a.encode(e.title)+'">';if(e.image){d+='<img class="mceIcon" src="'+e.image+'" />'+c+"</a>"}else{d+='<span class="mceIcon '+e["class"]+'"></span>'+(c?'<span class="'+f+'Label">'+c+"</span>":"")+"</a>"}return d},postRender:function(){var c=this,d=c.settings;b.dom.Event.add(c.id,"click",function(f){if(!c.isDisabled()){return d.onclick.call(d.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(h,g){var f=this;f.parent(h,g);f.items=[];f.onChange=new a(f);f.onPostRender=new a(f);f.onAdd=new a(f);f.onRenderMenu=new d.util.Dispatcher(this);f.classPrefix="mceListBox"},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var g=this,h,i;if(f!=g.selectedIndex){h=c.get(g.id+"_text");i=g.items[f];if(i){g.selectedValue=i.value;g.selectedIndex=f;c.setHTML(h,c.encode(i.title));c.removeClass(h,"mceTitle")}else{c.setHTML(h,c.encode(g.settings.title));c.addClass(h,"mceTitle");g.selectedValue=g.selectedIndex=null}h=0}},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='<table id="'+f.id+'" cellpadding="0" cellspacing="0" class="'+j+" "+j+"Enabled"+(g["class"]?(" "+g["class"]):"")+'"><tbody><tr>';i+="<td>"+c.createHTML("a",{id:f.id+"_text",href:"javascript:;","class":"mceText",onclick:"return false;",onmousedown:"return false;"},c.encode(f.settings.title))+"</td>";i+="<td>"+c.createHTML("a",{id:f.id+"_open",tabindex:-1,href:"javascript:;","class":"mceOpen",onclick:"return false;",onmousedown:"return false;"},"<span></span>")+"</td>";i+="</tr></tbody></table>";return i},showMenu:function(){var g=this,j,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}j=c.getPos(this.settings.menu_container);i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(k){if(k.value===g.selectedValue){f.items[k.id].setSelected(1);g.oldID=k.id}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(f.menu&&f.menu.isMenuVisible){if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(g.hideMenu,g);f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){if(h.value===undefined){f.add({title:h.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}})}else{h.id=c.uniqueId();h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)}});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id+"_text","focus",function(h){if(!f._focused){f.keyDownHandler=b.add(f.id+"_text","keydown",function(l){var i=-1,j,k=l.keyCode;e(f.items,function(m,n){if(f.selectedValue==m.value){i=n}});if(k==38){j=f.items[i-1]}else{if(k==40){j=f.items[i+1]}else{if(k==13){j=f.selectedValue;f.selectedValue=null;f.settings.onselect(j);return b.cancel(l)}}}if(j){f.hideMenu();f.select(j.value)}})}f._focused=1});b.add(f.id+"_text","blur",function(){b.remove(f.id+"_text","keydown",f.keyDownHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text");b.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return c.get(this.id).options.length-1},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox"},g);return g},postRender:function(){var g=this,h;g.rendered=true;function f(j){var i=g.items[j.target.selectedIndex-1];if(i&&(i=i.value)){g.onChange.dispatch(g,i);if(g.settings.onselect){g.settings.onselect(i)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(j){var i;b.remove(g.id,"change",h);i=b.add(g.id,"blur",function(){b.add(g.id,"change",f);b.remove(g.id,"blur",i)});if(j.keyCode==13||j.keyCode==32){f(j);return b.cancel(j)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(f,e){this.parent(f,e);this.onRenderMenu=new c.util.Dispatcher(this);e.menu_container=e.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(f.hideMenu,f);f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(f,e){this.parent(f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="<tbody><tr>";if(g.image){e=b.createHTML("img ",{src:g.image,"class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}i+="<td>"+b.createHTML("a",{id:f.id+"_action",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";e=b.createHTML("span",{"class":"mceOpen "+g["class"]});i+="<td>"+b.createHTML("a",{id:f.id+"_open",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";i+="</tr></tbody>";return b.createHTML("table",{id:f.id,"class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",onmousedown:"return false;",title:g.title},i)},postRender:function(){var e=this,f=e.settings;if(f.onclick){a.add(e.id+"_action","click",function(){if(!e.isDisabled()){f.onclick(e.value)}})}a.add(e.id+"_open","click",e.showMenu,e);a.add(e.id+"_open","focus",function(){e._focused=1});a.add(e.id+"_open","blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(h,g){var f=this;f.parent(h,g);f.settings=g=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},f.settings);f.onShowMenu=new d.util.Dispatcher(f);f.onHideMenu=new d.util.Dispatcher(f);f.value=g.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.isMenuVisible=1},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.onHideMenu.dispatch(f);f.isMenuVisible=0},renderMenu:function(){var k=this,f,j=0,l=k.settings,p,h,o,g;g=c.add(l.menu_container,"div",{id:k.id+"_menu","class":l.menu_class+" "+l["class"],style:"position:absolute;left:0;top:-1000px;"});f=c.add(g,"div",{"class":l["class"]+" mceSplitButtonMenu"});c.add(f,"span",{"class":"mceMenuLine"});p=c.add(f,"table",{"class":"mceColorSplitMenu"});h=c.add(p,"tbody");j=0;e(b(l.colors,"array")?l.colors:l.colors.split(","),function(i){i=i.replace(/^#/,"");if(!j--){o=c.add(h,"tr");j=l.grid_width-1}p=c.add(o,"td");p=c.add(p,"a",{href:"javascript:;",style:{backgroundColor:"#"+i},_mce_color:"#"+i})});if(l.more_colors_func){p=c.add(h,"tr");p=c.add(p,"td",{colspan:l.grid_width,"class":"mceMoreColors"});p=c.add(p,"a",{id:k.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},l.more_colors_title);a.add(p,"click",function(i){l.more_colors_func.call(l.more_colors_scope||this);return a.cancel(i)})}c.addClass(f,"mceColorSplitMenu");a.add(k.id+"_menu","click",function(i){var m;i=i.target;if(i.nodeName=="A"&&(m=i.getAttribute("_mce_color"))){k.setColor(m)}return a.cancel(i)});return g},setColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g;f.hideMenu();f.settings.onselect(g)},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);tinymce.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var l=this,e="",g,j,b=tinymce.DOM,m=l.settings,d,a,f,k;k=l.controls;for(d=0;d<k.length;d++){j=k[d];a=k[d-1];f=k[d+1];if(d===0){g="mceToolbarStart";if(j.Button){g+=" mceToolbarStartButton"}else{if(j.SplitButton){g+=" mceToolbarStartSplitButton"}else{if(j.ListBox){g+=" mceToolbarStartListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"))}if(a&&j.ListBox){if(a.Button||a.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarEnd"},b.createHTML("span",null,"<!-- IE -->"))}}if(b.stdMode){e+='<td style="position: relative">'+j.renderHTML()+"</td>"}else{e+="<td>"+j.renderHTML()+"</td>"}if(f&&j.ListBox){if(f.Button||f.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarStart"},b.createHTML("span",null,"<!-- IE -->"))}}}g="mceToolbarEnd";if(j.Button){g+=" mceToolbarEndButton"}else{if(j.SplitButton){g+=" mceToolbarEndSplitButton"}else{if(j.ListBox){g+=" mceToolbarEndListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"));return b.createHTML("table",{id:l.id,"class":"mceToolbar"+(m["class"]?" "+m["class"]:""),cellpadding:"0",cellspacing:"0",align:l.settings.align||""},"<tbody><tr>"+e+"</tr></tbody>")}});(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{items:[],urls:{},lookup:{},onAdd:new a(this),get:function(d){return this.lookup[d]},requireLangPack:function(e){var d=b.settings;if(d&&d.language){b.ScriptLoader.add(this.urls[e]+"/langs/"+d.language+".js")}},add:function(e,d){this.items.push(d);this.lookup[e]=d;this.onAdd.dispatch(this,e,d);return d},load:function(h,e,d,g){var f=this;if(f.urls[h]){return}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}f.urls[h]=e.substring(0,e.lastIndexOf("/"));b.ScriptLoader.add(e,d,g)}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(j){var g=j.each,d=j.extend,k=j.DOM,i=j.dom.Event,f=j.ThemeManager,b=j.PluginManager,e=j.explode,h=j.util.Dispatcher,a,c=0;j.documentBaseURL=window.location.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(j.documentBaseURL)){j.documentBaseURL+="/"}j.baseURL=new j.util.URI(j.documentBaseURL).toAbsolute(j.baseURL);j.baseURI=new j.util.URI(j.baseURL);j.onBeforeUnload=new h(j);i.add(window,"beforeunload",function(l){j.onBeforeUnload.dispatch(j,l)});j.onAddEditor=new h(j);j.onRemoveEditor=new h(j);j.EditorManager=d(j,{editors:[],i18n:{},activeEditor:null,init:function(q){var n=this,p,l=j.ScriptLoader,u,o=[],m;function r(x,y,t){var v=x[y];if(!v){return}if(j.is(v,"string")){t=v.replace(/\.\w+$/,"");t=t?j.resolve(t):0;v=j.resolve(v)}return v.apply(t||this,Array.prototype.slice.call(arguments,2))}q=d({theme:"simple",language:"en"},q);n.settings=q;i.add(document,"init",function(){var s,v;r(q,"onpageload");switch(q.mode){case"exact":s=q.elements||"";if(s.length>0){g(e(s),function(x){if(k.get(x)){m=new j.Editor(x,q);o.push(m);m.render(1)}else{g(document.forms,function(y){g(y.elements,function(z){if(z.name===x){x="mce_editor_"+c++;k.setAttrib(z,"id",x);m=new j.Editor(x,q);o.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function t(y,x){return x.constructor===RegExp?x.test(y.className):k.hasClass(y,x)}g(k.select("textarea"),function(x){if(q.editor_deselector&&t(x,q.editor_deselector)){return}if(!q.editor_selector||t(x,q.editor_selector)){u=k.get(x.name);if(!x.id&&!u){x.id=x.name}if(!x.id||n.get(x.id)){x.id=k.uniqueId()}m=new j.Editor(x.id,q);o.push(m);m.render(1)}});break}if(q.oninit){s=v=0;g(o,function(x){v++;if(!x.initialized){x.onInit.add(function(){s++;if(s==v){r(q,"oninit")}})}else{s++}if(s==v){r(q,"oninit")}})}})},get:function(l){if(l===a){return this.editors}return this.editors[l]},getInstanceById:function(l){return this.get(l)},add:function(m){var l=this,n=l.editors;n[m.id]=m;n.push(m);l._setActive(m);l.onAddEditor.dispatch(l,m);return m},remove:function(n){var m=this,l,o=m.editors;if(!o[n.id]){return null}delete o[n.id];for(l=0;l<o.length;l++){if(o[l]==n){o.splice(l,1);break}}if(m.activeEditor==n){m._setActive(o[0])}n.destroy();m.onRemoveEditor.dispatch(m,n);return n},execCommand:function(r,p,o){var q=this,n=q.get(o),l;switch(r){case"mceFocus":n.focus();return true;case"mceAddEditor":case"mceAddControl":if(!q.get(o)){new j.Editor(o,q.settings).render()}return true;case"mceAddFrameControl":l=o.window;l.tinyMCE=tinyMCE;l.tinymce=j;j.DOM.doc=l.document;j.DOM.win=l;n=new j.Editor(o.element_id,o);n.render();if(j.isIE){function m(){n.destroy();l.detachEvent("onunload",m);l=l.tinyMCE=l.tinymce=null}l.attachEvent("onunload",m)}o.page_window=null;return true;case"mceRemoveEditor":case"mceRemoveControl":if(n){n.remove()}return true;case"mceToggleEditor":if(!n){q.execCommand("mceAddControl",0,o);return true}if(n.isHidden()){n.show()}else{n.hide()}return true}if(q.activeEditor){return q.activeEditor.execCommand(r,p,o)}return false},execInstanceCommand:function(p,o,n,m){var l=this.get(p);if(l){return l.execCommand(o,n,m)}return false},triggerSave:function(){g(this.editors,function(l){l.save()})},addI18n:function(n,q){var l,m=this.i18n;if(!j.is(n,"string")){g(n,function(r,p){g(r,function(t,s){g(t,function(v,u){if(s==="common"){m[p+"."+u]=v}else{m[p+"."+s+"."+u]=v}})})})}else{g(q,function(r,p){m[n+"."+p]=r})}},_setActive:function(l){this.selectedInstance=this.activeEditor=l}})})(tinymce);(function(m){var n=m.DOM,j=m.dom.Event,f=m.extend,k=m.util.Dispatcher,i=m.each,a=m.isGecko,b=m.isIE,e=m.isWebKit,d=m.is,h=m.ThemeManager,c=m.PluginManager,o=m.inArray,l=m.grep,g=m.explode;m.create("tinymce.Editor",{Editor:function(r,q){var p=this;p.id=p.editorId=r;p.execCommands={};p.queryStateCommands={};p.queryValueCommands={};p.isNotDirty=false;p.plugins={};i(["onPreInit","onBeforeRenderUI","onPostRender","onInit","onRemove","onActivate","onDeactivate","onClick","onEvent","onMouseUp","onMouseDown","onDblClick","onKeyDown","onKeyUp","onKeyPress","onContextMenu","onSubmit","onReset","onPaste","onPreProcess","onPostProcess","onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent","onLoadContent","onSaveContent","onNodeChange","onChange","onBeforeExecCommand","onExecCommand","onUndo","onRedo","onVisualAid","onSetProgressState"],function(s){p[s]=new k(p)});p.settings=q=f({id:r,language:"en",docs_language:"en",theme:"simple",skin:"default",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:m.documentBaseURL,add_form_submit_trigger:1,submit_patch:1,add_unload_trigger:1,convert_urls:1,relative_urls:1,remove_script_host:1,table_inline_editing:0,object_resizing:1,cleanup:1,accessibility_focus:1,custom_shortcuts:1,custom_undo_redo_keyboard_shortcuts:1,custom_undo_redo_restore_selection:1,custom_undo_redo:1,doctype:m.isIE6?'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">':"<!DOCTYPE>",visual_table_class:"mceItemTable",visual:1,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",valid_elements:"@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p,-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,inline_styles:1,convert_fonts_to_spans:true},q);p.documentBaseURI=new m.util.URI(q.document_base_url||m.documentBaseURL,{base_uri:tinyMCE.baseURI});p.baseURI=m.baseURI;p.execCallback("setup",p)},render:function(r){var u=this,v=u.settings,x=u.id,p=m.ScriptLoader;if(!j.domLoaded){j.add(document,"init",function(){u.render()});return}tinyMCE.settings=v;if(!u.getElement()){return}if(!/TEXTAREA|INPUT/i.test(u.getElement().nodeName)&&v.hidden_input&&n.getParent(x,"form")){n.insertAfter(n.create("input",{type:"hidden",name:x}),x)}if(m.WindowManager){u.windowManager=new m.WindowManager(u)}if(v.encoding=="xml"){u.onGetContent.add(function(s,t){if(t.save){t.content=n.encode(t.content)}})}if(v.add_form_submit_trigger){u.onSubmit.addToTop(function(){if(u.initialized){u.save();u.isNotDirty=1}})}if(v.add_unload_trigger){u._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(u.initialized&&!u.destroyed&&!u.isHidden()){u.save({format:"raw",no_events:true})}})}m.addUnload(u.destroy,u);if(v.submit_patch){u.onBeforeRenderUI.add(function(){var s=u.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){u.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){m.triggerSave();u.isNotDirty=1;return u.formElement._mceOldSubmit(u.formElement)}}s=null})}function q(){if(v.language){p.add(m.baseURL+"/langs/"+v.language+".js")}if(v.theme&&v.theme.charAt(0)!="-"&&!h.urls[v.theme]){h.load(v.theme,"themes/"+v.theme+"/editor_template"+m.suffix+".js")}i(g(v.plugins),function(s){if(s&&s.charAt(0)!="-"&&!c.urls[s]){if(s=="safari"){return}c.load(s,"plugins/"+s+"/editor_plugin"+m.suffix+".js")}});p.loadQueue(function(){if(!u.removed){u.init()}})}q()},init:function(){var r,E=this,F=E.settings,B,y,A=E.getElement(),q,p,C,x,z,D;m.add(E);if(F.theme){F.theme=F.theme.replace(/-/,"");q=h.get(F.theme);E.theme=new q();if(E.theme.init&&F.init_theme){E.theme.init(E,h.urls[F.theme]||m.documentBaseURL.replace(/\/$/,""))}}i(g(F.plugins.replace(/\-/g,"")),function(G){var H=c.get(G),t=c.urls[G]||m.documentBaseURL.replace(/\/$/,""),s;if(H){s=new H(E,t);E.plugins[G]=s;if(s.init){s.init(E,t)}}});if(F.popup_css!==false){if(F.popup_css){F.popup_css=E.documentBaseURI.toAbsolute(F.popup_css)}else{F.popup_css=E.baseURI.toAbsolute("themes/"+F.theme+"/skins/"+F.skin+"/dialog.css")}}if(F.popup_css_add){F.popup_css+=","+E.documentBaseURI.toAbsolute(F.popup_css_add)}E.controlManager=new m.ControlManager(E);if(F.custom_undo_redo){E.onBeforeExecCommand.add(function(t,G,u,H,s){if(G!="Undo"&&G!="Redo"&&G!="mceRepaint"&&(!s||!s.skip_undo)){if(!E.undoManager.hasUndo()){E.undoManager.add()}}});E.onExecCommand.add(function(t,G,u,H,s){if(G!="Undo"&&G!="Redo"&&G!="mceRepaint"&&(!s||!s.skip_undo)){E.undoManager.add()}})}E.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){E.nodeChanged()}});if(a){function v(s,t){if(!t||!t.initial){E.execCommand("mceRepaint")}}E.onUndo.add(v);E.onRedo.add(v);E.onSetContent.add(v)}E.onBeforeRenderUI.dispatch(E,E.controlManager);if(F.render_ui){B=F.width||A.style.width||A.offsetWidth;y=F.height||A.style.height||A.offsetHeight;E.orgDisplay=A.style.display;D=/^[0-9\.]+(|px)$/i;if(D.test(""+B)){B=Math.max(parseInt(B)+(q.deltaWidth||0),100)}if(D.test(""+y)){y=Math.max(parseInt(y)+(q.deltaHeight||0),100)}q=E.theme.renderUI({targetNode:A,width:B,height:y,deltaWidth:F.delta_width,deltaHeight:F.delta_height});E.editorContainer=q.editorContainer}if(document.domain&&location.hostname!=document.domain){m.relaxedDomain=document.domain}n.setStyles(q.sizeContainer||q.editorContainer,{width:B,height:y});y=(q.iframeHeight||y)+(typeof(y)=="number"?(q.deltaHeight||0):"");if(y<100){y=100}E.iframeHTML=F.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml">';if(F.document_base_url!=m.documentBaseURL){E.iframeHTML+='<base href="'+E.documentBaseURI.getURI()+'" />'}E.iframeHTML+='<meta http-equiv="X-UA-Compatible" content="IE=7" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';if(m.relaxedDomain){E.iframeHTML+='<script type="text/javascript">document.domain = "'+m.relaxedDomain+'";<\/script>'}x=F.body_id||"tinymce";if(x.indexOf("=")!=-1){x=E.getParam("body_id","","hash");x=x[E.id]||x}z=F.body_class||"";if(z.indexOf("=")!=-1){z=E.getParam("body_class","","hash");z=z[E.id]||""}E.iframeHTML+='</head><body id="'+x+'" class="mceContentBody '+z+'"></body></html>';if(m.relaxedDomain){if(b||(m.isOpera&&parseFloat(opera.version())>=9.5)){C='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+E.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}else{if(m.isOpera){C='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()'}}}r=n.add(q.iframeContainer,"iframe",{id:E.id+"_ifr",src:C||'javascript:""',frameBorder:"0",style:{width:"100%",height:y}});E.contentAreaContainer=q.iframeContainer;n.get(q.editorContainer).style.display=E.orgDisplay;n.get(E.id).style.display="none";if(!b||!m.relaxedDomain){E.setupIframe()}A=r=q=null},setupIframe:function(){var z=this,A=z.settings,r=n.get(z.id),u=z.getDoc(),q,x;if(!b||!m.relaxedDomain){u.open();u.write(z.iframeHTML);u.close()}if(!b){try{if(!A.readonly){u.designMode="On"}}catch(v){}}if(b){x=z.getBody();n.hide(x);if(!A.readonly){x.contentEditable=true}n.show(x)}z.dom=new m.dom.DOMUtils(z.getDoc(),{keep_values:true,url_converter:z.convertURL,url_converter_scope:z,hex_colors:A.force_hex_style_colors,class_filter:A.class_filter,update_styles:1,fix_ie_paragraphs:1,valid_styles:A.valid_styles});z.schema=new m.dom.Schema();z.serializer=new m.dom.Serializer(f(A,{valid_elements:A.verify_html===false?"*[*]":A.valid_elements,dom:z.dom,schema:z.schema}));z.selection=new m.dom.Selection(z.dom,z.getWin(),z.serializer);z.formatter=new m.Formatter(this);z.formatter.register({alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"}},{selector:"img,table",styles:{"float":"left"}}],aligncenter:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"}},{selector:"img",styles:{display:"block",marginLeft:"auto",marginRight:"auto"}},{selector:"table",styles:{marginLeft:"auto",marginRight:"auto"}}],alignright:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"}},{selector:"img,table",styles:{"float":"right"}}],alignfull:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"justify"}}],bold:[{inline:"strong"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b"}],italic:[{inline:"em"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i"}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:true},{inline:"u"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:true},{inline:"u"}],forecolor:{inline:"span",styles:{color:"%value"}},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"}},fontname:{inline:"span",styles:{fontFamily:"%value"}},fontsize:{inline:"span",styles:{fontSize:"%value"}},blockquote:{block:"blockquote",wrapper:1},removeformat:[{selector:"b,strong,em,i,font,u,strike",remove:"all",split:true,expand:false,block_expand:true,deep:true},{selector:"span",attributes:["style","class"],remove:"empty",split:true,expand:false,deep:true},{selector:"*",attributes:["style","class"],split:false,expand:false,deep:true}]});i("p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp".split(/\s/),function(s){z.formatter.register(s,{block:s})});z.formatter.register(z.settings.formats);z.undoManager=new m.UndoManager(z);z.undoManager.onAdd.add(function(t,s){if(!s.initial){return z.onChange.dispatch(z,s,t)}});z.undoManager.onUndo.add(function(t,s){return z.onUndo.dispatch(z,s,t)});z.undoManager.onRedo.add(function(t,s){return z.onRedo.dispatch(z,s,t)});z.forceBlocks=new m.ForceBlocks(z,{forced_root_block:A.forced_root_block});z.editorCommands=new m.EditorCommands(z);z.serializer.onPreProcess.add(function(s,t){return z.onPreProcess.dispatch(z,t,s)});z.serializer.onPostProcess.add(function(s,t){return z.onPostProcess.dispatch(z,t,s)});z.onPreInit.dispatch(z);if(!A.gecko_spellcheck){z.getBody().spellcheck=0}if(!A.readonly){z._addEvents()}z.controlManager.onPostRender.dispatch(z,z.controlManager);z.onPostRender.dispatch(z);if(A.directionality){z.getBody().dir=A.directionality}if(A.nowrap){z.getBody().style.whiteSpace="nowrap"}if(A.custom_elements){function y(s,t){i(g(A.custom_elements),function(B){var C;if(B.indexOf("~")===0){B=B.substring(1);C="span"}else{C="div"}t.content=t.content.replace(new RegExp("<("+B+")([^>]*)>","g"),"<"+C+' _mce_name="$1"$2>');t.content=t.content.replace(new RegExp("</("+B+")>","g"),"</"+C+">")})}z.onBeforeSetContent.add(y);z.onPostProcess.add(function(s,t){if(t.set){y(s,t)}})}if(A.handle_node_change_callback){z.onNodeChange.add(function(t,s,B){z.execCallback("handle_node_change_callback",z.id,B,-1,-1,true,z.selection.isCollapsed())})}if(A.save_callback){z.onSaveContent.add(function(s,B){var t=z.execCallback("save_callback",z.id,B.content,z.getBody());if(t){B.content=t}})}if(A.onchange_callback){z.onChange.add(function(t,s){z.execCallback("onchange_callback",z,s)})}if(A.convert_newlines_to_brs){z.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"<br />")}})}if(A.fix_nesting&&b){z.onBeforeSetContent.add(function(s,t){t.content=z._fixNesting(t.content)})}if(A.preformatted){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*<pre.*?>/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='<pre class="mceItemHidden">'+t.content+"</pre>"}})}if(A.verify_css_classes){z.serializer.attribValueFilter=function(D,B){var C,t;if(D=="class"){if(!z.classesRE){t=z.dom.getClasses();if(t.length>0){C="";i(t,function(s){C+=(C?"|":"")+s["class"]});z.classesRE=new RegExp("("+C+")","gi")}}return !z.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(B)||z.classesRE.test(B)?B:""}return B}}if(A.cleanup_callback){z.onBeforeSetContent.add(function(s,t){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)});z.onPreProcess.add(function(s,t){if(t.set){z.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){z.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});z.onPostProcess.add(function(s,t){if(t.set){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=z.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(A.save_callback){z.onGetContent.add(function(s,t){if(t.save){t.content=z.execCallback("save_callback",z.id,t.content,z.getBody())}})}if(A.handle_event_callback){z.onEvent.add(function(s,t,B){if(z.execCallback("handle_event_callback",t,s,B)===false){j.cancel(t)}})}z.onSetContent.add(function(){z.addVisual(z.getBody())});if(A.padd_empty_editor){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")})}if(a){function p(s,t){i(s.dom.select("a"),function(C){var B=C.parentNode;if(s.dom.isBlock(B)&&B.lastChild===C){s.dom.add(B,"br",{_mce_bogus:1})}})}z.onExecCommand.add(function(s,t){if(t==="CreateLink"){p(s)}});z.onSetContent.add(z.selection.onSetContent.add(p));if(!A.readonly){try{u.designMode="Off";u.designMode="On"}catch(v){}}}setTimeout(function(){if(z.removed){return}z.load({initial:true,format:(A.cleanup_on_startup?"html":"raw")});z.startContent=z.getContent({format:"raw"});z.initialized=true;z.onInit.dispatch(z);z.execCallback("setupcontent_callback",z.id,z.getBody(),z.getDoc());z.execCallback("init_instance_callback",z);z.focus(true);z.nodeChanged({initial:1});if(A.content_css){m.each(g(A.content_css),function(s){z.dom.loadCSS(z.documentBaseURI.toAbsolute(s))})}if(A.auto_focus){setTimeout(function(){var s=m.get(A.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getWin().focus()},100)}},1);r=null},focus:function(q){var s,p=this,r=p.settings.content_editable;if(!q){if(!r){p.getWin().focus()}}if(m.activeEditor!=p){if((s=m.activeEditor)!=null){s.onDeactivate.dispatch(s,p)}p.onActivate.dispatch(p,s)}m._setActive(p)},execCallback:function(u){var p=this,r=p.settings[u],q;if(!r){return}if(p.callbackLookup&&(q=p.callbackLookup[u])){r=q.func;q=q.scope}if(d(r,"string")){q=r.replace(/\.\w+$/,"");q=q?m.resolve(q):0;r=m.resolve(r);p.callbackLookup=p.callbackLookup||{};p.callbackLookup[u]={func:r,scope:q}}return r.apply(q||p,Array.prototype.slice.call(arguments,1))},translate:function(p){var r=this.settings.language||"en",q=m.i18n;if(!p){return""}return q[r+"."+p]||p.replace(/{\#([^}]+)\}/g,function(t,s){return q[r+"."+s]||"{#"+s+"}"})},getLang:function(q,p){return m.i18n[(this.settings.language||"en")+"."+q]||(d(p)?p:"{#"+q+"}")},getParam:function(u,r,p){var s=m.trim,q=d(this.settings[u])?this.settings[u]:r,t;if(p==="hash"){t={};if(d(q,"string")){i(q.indexOf("=")>0?q.split(/[;,](?![^=;,]*(?:[;,]|$))/):q.split(","),function(x){x=x.split("=");if(x.length>1){t[s(x[0])]=s(x[1])}else{t[s(x[0])]=s(x)}})}else{t=q}return t}return q},nodeChanged:function(r){var p=this,q=p.selection,u=q.getNode()||p.getBody();if(p.initialized){r=r||{};u=b&&u.ownerDocument!=p.getDoc()?p.getBody():u;r.parents=[];p.dom.getParent(u,function(s){if(s.nodeName=="BODY"){return true}r.parents.push(s)});p.onNodeChange.dispatch(p,r?r.controlManager||p.controlManager:p.controlManager,u,q.isCollapsed(),r)}},addButton:function(r,q){var p=this;p.buttons=p.buttons||{};p.buttons[r]=q},addCommand:function(r,q,p){this.execCommands[r]={func:q,scope:p||this}},addQueryStateHandler:function(r,q,p){this.queryStateCommands[r]={func:q,scope:p||this}},addQueryValueHandler:function(r,q,p){this.queryValueCommands[r]={func:q,scope:p||this}},addShortcut:function(r,u,p,s){var q=this,v;if(!q.settings.custom_shortcuts){return false}q.shortcuts=q.shortcuts||{};if(d(p,"string")){v=p;p=function(){q.execCommand(v,false,null)}}if(d(p,"object")){v=p;p=function(){q.execCommand(v[0],v[1],v[2])}}i(g(r),function(t){var x={func:p,scope:s||this,desc:u,alt:false,ctrl:false,shift:false};i(g(t,"+"),function(y){switch(y){case"alt":case"ctrl":case"shift":x[y]=true;break;default:x.charCode=y.charCodeAt(0);x.keyCode=y.toUpperCase().charCodeAt(0)}});q.shortcuts[(x.ctrl?"ctrl":"")+","+(x.alt?"alt":"")+","+(x.shift?"shift":"")+","+x.keyCode]=x});return true},execCommand:function(x,v,z,p){var r=this,u=0,y,q;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(x)&&(!p||!p.skip_focus)){r.focus()}y={};r.onBeforeExecCommand.dispatch(r,x,v,z,y);if(y.terminate){return false}if(r.execCallback("execcommand_callback",r.id,r.selection.getNode(),x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}if(y=r.execCommands[x]){q=y.func.call(y.scope,v,z);if(q!==true){r.onExecCommand.dispatch(r,x,v,z,p);return q}}i(r.plugins,function(s){if(s.execCommand&&s.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);u=1;return false}});if(u){return true}if(r.theme&&r.theme.execCommand&&r.theme.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}if(m.GlobalCommands.execCommand(r,x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}if(r.editorCommands.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}r.getDoc().execCommand(x,v,z);r.onExecCommand.dispatch(r,x,v,z,p)},queryCommandState:function(u){var q=this,v,r;if(q._isHidden()){return}if(v=q.queryStateCommands[u]){r=v.func.call(v.scope);if(r!==true){return r}}v=q.editorCommands.queryCommandState(u);if(v!==-1){return v}try{return this.getDoc().queryCommandState(u)}catch(p){}},queryCommandValue:function(v){var q=this,u,r;if(q._isHidden()){return}if(u=q.queryValueCommands[v]){r=u.func.call(u.scope);if(r!==true){return r}}u=q.editorCommands.queryCommandValue(v);if(d(u)){return u}try{return this.getDoc().queryCommandValue(v)}catch(p){}},show:function(){var p=this;n.show(p.getContainer());n.hide(p.id);p.load()},hide:function(){var p=this,q=p.getDoc();if(b&&q){q.execCommand("SelectAll")}p.save();n.hide(p.getContainer());n.setStyle(p.id,"display",p.orgDisplay)},isHidden:function(){return !n.isHidden(this.id)},setProgressState:function(p,q,r){this.onSetProgressState.dispatch(this,p,q,r);return p},load:function(s){var p=this,r=p.getElement(),q;if(r){s=s||{};s.load=true;q=p.setContent(d(r.value)?r.value:r.innerHTML,s);s.element=r;if(!s.no_events){p.onLoadContent.dispatch(p,s)}s.element=r=null;return q}},save:function(u){var p=this,s=p.getElement(),q,r;if(!s||!p.initialized){return}u=u||{};u.save=true;if(!u.no_events){p.undoManager.typing=0;p.undoManager.add()}u.element=s;q=u.content=p.getContent(u);if(!u.no_events){p.onSaveContent.dispatch(p,u)}q=u.content;if(!/TEXTAREA|INPUT/i.test(s.nodeName)){s.innerHTML=q;if(r=n.getParent(p.id,"form")){i(r.elements,function(t){if(t.name==p.id){t.value=q;return false}})}}else{s.value=q}u.element=s=null;return q},setContent:function(q,r){var p=this;r=r||{};r.format=r.format||"html";r.set=true;r.content=q;if(!r.no_events){p.onBeforeSetContent.dispatch(p,r)}if(!m.isIE&&(q.length===0||/^\s+$/.test(q))){r.content=p.dom.setHTML(p.getBody(),'<br _mce_bogus="1" />');r.format="raw"}r.content=p.dom.setHTML(p.getBody(),m.trim(r.content));if(r.format!="raw"&&p.settings.cleanup){r.getInner=true;r.content=p.dom.setHTML(p.getBody(),p.serializer.serialize(p.getBody(),r))}if(!r.no_events){p.onSetContent.dispatch(p,r)}return r.content},getContent:function(r){var p=this,q;r=r||{};r.format=r.format||"html";r.get=true;if(!r.no_events){p.onBeforeGetContent.dispatch(p,r)}if(r.format!="raw"&&p.settings.cleanup){r.getInner=true;q=p.serializer.serialize(p.getBody(),r)}else{q=p.getBody().innerHTML}q=q.replace(/^\s*|\s*$/g,"");r.content=q;if(!r.no_events){p.onGetContent.dispatch(p,r)}return r.content},isDirty:function(){var p=this;return m.trim(p.startContent)!=m.trim(p.getContent({format:"raw",no_events:1}))&&!p.isNotDirty},getContainer:function(){var p=this;if(!p.container){p.container=n.get(p.editorContainer||p.id+"_parent")}return p.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return n.get(this.settings.content_element||this.id)},getWin:function(){var p=this,q;if(!p.contentWindow){q=n.get(p.id+"_ifr");if(q){p.contentWindow=q.contentWindow}}return p.contentWindow},getDoc:function(){var q=this,p;if(!q.contentDocument){p=q.getWin();if(p){q.contentDocument=p.document}}return q.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(p,x,v){var q=this,r=q.settings;if(r.urlconverter_callback){return q.execCallback("urlconverter_callback",p,v,true,x)}if(!r.convert_urls||(v&&v.nodeName=="LINK")||p.indexOf("file:")===0){return p}if(r.relative_urls){return q.documentBaseURI.toRelative(p)}p=q.documentBaseURI.toAbsolute(p,r.remove_script_host);return p},addVisual:function(r){var p=this,q=p.settings;r=r||p.getBody();if(!d(p.hasVisual)){p.hasVisual=q.visual}i(p.dom.select("table,a",r),function(t){var s;switch(t.nodeName){case"TABLE":s=p.dom.getAttrib(t,"border");if(!s||s=="0"){if(p.hasVisual){p.dom.addClass(t,q.visual_table_class)}else{p.dom.removeClass(t,q.visual_table_class)}}return;case"A":s=p.dom.getAttrib(t,"name");if(s){if(p.hasVisual){p.dom.addClass(t,"mceItemAnchor")}else{p.dom.removeClass(t,"mceItemAnchor")}}return}});p.onVisualAid.dispatch(p,r,p.hasVisual)},remove:function(){var p=this,q=p.getContainer();p.removed=1;p.hide();p.execCallback("remove_instance_callback",p);p.onRemove.dispatch(p);p.onExecCommand.listeners=[];m.remove(p);n.remove(q)},destroy:function(q){var p=this;if(p.destroyed){return}if(!q){m.removeUnload(p.destroy);tinyMCE.onBeforeUnload.remove(p._beforeUnload);if(p.theme&&p.theme.destroy){p.theme.destroy()}p.controlManager.destroy();p.selection.destroy();p.dom.destroy();if(!p.settings.content_editable){j.clear(p.getWin());j.clear(p.getDoc())}j.clear(p.getBody());j.clear(p.formElement)}if(p.formElement){p.formElement.submit=p.formElement._mceOldSubmit;p.formElement._mceOldSubmit=null}p.contentAreaContainer=p.formElement=p.container=p.settings.content_element=p.bodyElement=p.contentDocument=p.contentWindow=null;if(p.selection){p.selection=p.selection.win=p.selection.dom=p.selection.dom.doc=null}p.destroyed=1},_addEvents:function(){var v=this,u,y=v.settings,x={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function r(t,A){var s=t.type;if(v.removed){return}if(v.onEvent.dispatch(v,t,A)!==false){v[x[t.fakeType||t.type]].dispatch(v,t,A)}}i(x,function(t,s){switch(s){case"contextmenu":if(m.isOpera){v.dom.bind(v.getBody(),"mousedown",function(A){if(A.ctrlKey){A.fakeType="contextmenu";r(A)}})}else{v.dom.bind(v.getBody(),s,r)}break;case"paste":v.dom.bind(v.getBody(),s,function(A){r(A)});break;case"submit":case"reset":v.dom.bind(v.getElement().form||n.getParent(v.id,"form"),s,r);break;default:v.dom.bind(y.content_editable?v.getBody():v.getDoc(),s,r)}});v.dom.bind(y.content_editable?v.getBody():(a?v.getDoc():v.getWin()),"focus",function(s){v.focus(true)});if(m.isGecko){v.dom.bind(v.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("_mce_src"))){t.src=v.documentBaseURI.toAbsolute(s)}})}if(a){function p(){var B=this,D=B.getDoc(),C=B.settings;if(a&&!C.readonly){if(B._isHidden()){try{if(!C.content_editable){D.designMode="On"}}catch(A){}}try{D.execCommand("styleWithCSS",0,false)}catch(A){if(!B._isHidden()){try{D.execCommand("useCSS",0,true)}catch(A){}}}if(!C.table_inline_editing){try{D.execCommand("enableInlineTableEditing",false,false)}catch(A){}}if(!C.object_resizing){try{D.execCommand("enableObjectResizing",false,false)}catch(A){}}}}v.onBeforeExecCommand.add(p);v.onMouseDown.add(p)}if(m.isWebKit){v.onClick.add(function(s,t){t=t.target;if(t.nodeName=="IMG"||(t.nodeName=="A"&&v.dom.hasClass(t,"mceItemAnchor"))){v.selection.getSel().setBaseAndExtent(t,0,t,1)}})}v.onMouseUp.add(v.nodeChanged);v.onClick.add(v.nodeChanged);v.onKeyUp.add(function(s,t){var A=t.keyCode;if((A>=33&&A<=36)||(A>=37&&A<=40)||A==13||A==45||A==46||A==8||(m.isMac&&(A==91||A==93))||t.ctrlKey){v.nodeChanged()}});v.onReset.add(function(){v.setContent(v.startContent,{format:"raw"})});if(y.custom_shortcuts){if(y.custom_undo_redo_keyboard_shortcuts){v.addShortcut("ctrl+z",v.getLang("undo_desc"),"Undo");v.addShortcut("ctrl+y",v.getLang("redo_desc"),"Redo")}if(a){v.addShortcut("ctrl+b",v.getLang("bold_desc"),"Bold");v.addShortcut("ctrl+i",v.getLang("italic_desc"),"Italic");v.addShortcut("ctrl+u",v.getLang("underline_desc"),"Underline")}for(u=1;u<=6;u++){v.addShortcut("ctrl+"+u,"",["FormatBlock",false,"h"+u])}v.addShortcut("ctrl+7","",["FormatBlock",false,"<p>"]);v.addShortcut("ctrl+8","",["FormatBlock",false,"<div>"]);v.addShortcut("ctrl+9","",["FormatBlock",false,"<address>"]);function z(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}i(v.shortcuts,function(A){if(m.isMac&&A.ctrl!=t.metaKey){return}else{if(!m.isMac&&A.ctrl!=t.ctrlKey){return}}if(A.alt!=t.altKey){return}if(A.shift!=t.shiftKey){return}if(t.keyCode==A.keyCode||(t.charCode&&t.charCode==A.charCode)){s=A;return false}});return s}v.onKeyUp.add(function(s,t){var A=z(t);if(A){return j.cancel(t)}});v.onKeyPress.add(function(s,t){var A=z(t);if(A){return j.cancel(t)}});v.onKeyDown.add(function(s,t){var A=z(t);if(A){A.func.call(A.scope);return j.cancel(t)}})}if(m.isIE){v.dom.bind(v.getDoc(),"controlselect",function(A){var t=v.resizeInfo,s;A=A.target;if(A.nodeName!=="IMG"){return}if(t){v.dom.unbind(t.node,t.ev,t.cb)}if(!v.dom.hasClass(A,"mceItemNoResize")){ev="resizeend";s=v.dom.bind(A,ev,function(C){var B;C=C.target;if(B=v.dom.getStyle(C,"width")){v.dom.setAttrib(C,"width",B.replace(/[^0-9%]+/g,""));v.dom.setStyle(C,"width","")}if(B=v.dom.getStyle(C,"height")){v.dom.setAttrib(C,"height",B.replace(/[^0-9%]+/g,""));v.dom.setStyle(C,"height","")}})}else{ev="resizestart";s=v.dom.bind(A,"resizestart",j.cancel,j)}t=v.resizeInfo={node:A,ev:ev,cb:s}});v.onKeyDown.add(function(s,t){switch(t.keyCode){case 8:if(v.selection.getRng().item){s.dom.remove(v.selection.getRng().item(0));return j.cancel(t)}}})}if(m.isOpera){v.onClick.add(function(s,t){j.prevent(t)})}if(y.custom_undo_redo){function q(){v.undoManager.typing=0;v.undoManager.add()}v.dom.bind(v.getDoc(),"focusout",function(s){if(!v.removed&&v.undoManager.typing){q()}});v.onKeyUp.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45||t.ctrlKey){q()}});v.onKeyDown.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45){if(v.undoManager.typing){q()}return}if(!v.undoManager.typing){v.undoManager.add();v.undoManager.typing=1}});v.onMouseDown.add(function(){if(v.undoManager.typing){q()}})}},_isHidden:function(){var p;if(!a){return 0}p=this.selection.getSel();return(!p||!p.rangeCount||p.rangeCount==0)},_fixNesting:function(q){var r=[],p;q=q.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(t,s,v){var u;if(s==="/"){if(!r.length){return""}if(v!==r[r.length-1].tag){for(p=r.length-1;p>=0;p--){if(r[p].tag===v){r[p].close=1;break}}return""}else{r.pop();if(r.length&&r[r.length-1].close){t=t+"</"+r[r.length-1].tag+">";r.pop()}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(v)){return t}if(/\/>$/.test(t)){return t}r.push({tag:v})}return t});for(p=r.length-1;p>=0;p--){q+="</"+r[p].tag+">"}return q}})})(tinymce);(function(c){var d=c.each,e,a=true,b=false;c.EditorCommands=function(n){var l=n.dom,p=n.selection,j={state:{},exec:{},value:{}},k=n.settings,o;function q(y,x,v){var u;y=y.toLowerCase();if(u=j.exec[y]){u(y,x,v);return a}return b}function m(v){var u;v=v.toLowerCase();if(u=j.state[v]){return u(v)}return -1}function h(v){var u;v=v.toLowerCase();if(u=j.value[v]){return u(v)}return b}function t(u,v){v=v||"exec";d(u,function(y,x){d(x.toLowerCase().split(","),function(z){j[v][z]=y})})}c.extend(this,{execCommand:q,queryCommandState:m,queryCommandValue:h,addCommands:t});function f(x,v,u){if(v===e){v=b}if(u===e){u=null}return n.getDoc().execCommand(x,v,u)}function s(u){return n.formatter.match(u)}function r(u,v){n.formatter.toggle(u,v?{value:v}:e)}function i(u){o=p.getBookmark(u)}function g(){p.moveToBookmark(o)}t({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){n.undoManager.add()},"Cut,Copy,Paste":function(y){var x=n.getDoc(),u;try{f(y)}catch(v){u=a}if(u||!x.queryCommandEnabled(y)){if(c.isGecko){n.windowManager.confirm(n.getLang("clipboard_msg"),function(z){if(z){open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}})}else{n.windowManager.alert(n.getLang("clipboard_no_support"))}}},unlink:function(u){if(p.isCollapsed()){p.select(p.getNode())}f(u);p.collapse(b)},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(u){var v=u.substring(7);d("left,center,right,full".split(","),function(x){if(v!=x){n.formatter.remove("align"+x)}});r("align"+v)},"InsertUnorderedList,InsertOrderedList":function(x){var u,v;f(x);u=l.getParent(p.getNode(),"ol,ul");if(u){v=u.parentNode;if(/^(H[1-6]|P|ADDRESS|PRE)$/.test(v.nodeName)){i();l.split(v,u);g()}}},"Bold,Italic,Underline,Strikethrough":function(u){r(u)},"ForeColor,HiliteColor,FontName":function(x,v,u){r(x,u)},FontSize:function(y,x,v){var u,z;if(v>=1&&v<=7){z=c.explode(k.font_size_style_values);u=c.explode(k.font_size_classes);if(u){v=u[v-1]||v}else{v=z[v-1]||v}}r(y,v)},RemoveFormat:function(u){n.formatter.remove(u)},mceBlockQuote:function(u){r("blockquote")},FormatBlock:function(x,v,u){return r(u)},mceCleanup:function(){i();n.setContent(n.getContent({cleanup:a}),{cleanup:a});g()},mceRemoveNode:function(y,x,v){var u=v||p.getNode();if(u!=ed.getBody()){i();n.dom.remove(u,a);g()}},mceSelectNodeDepth:function(y,x,v){var u=0;l.getParent(p.getNode(),function(z){if(z.nodeType==1&&u++==v){p.select(z);return b}},n.getBody())},mceSelectNode:function(x,v,u){p.select(u)},mceInsertContent:function(x,v,u){p.setContent(u)},mceInsertRawHTML:function(x,v,u){p.setContent("tiny_mce_marker");n.setContent(n.getContent().replace(/tiny_mce_marker/g,u))},mceSetContent:function(x,v,u){n.setContent(u)},"Indent,Outdent":function(y){var v,u,x;v=k.indentation;u=/[a-z%]+$/i.exec(v);v=parseInt(v);if(!m("InsertUnorderedList")&&!m("InsertOrderedList")){d(p.getSelectedBlocks(),function(z){if(y=="outdent"){x=Math.max(0,parseInt(z.style.paddingLeft||0)-v);l.setStyle(z,"paddingLeft",x?x+u:"")}else{l.setStyle(z,"paddingLeft",(parseInt(z.style.paddingLeft||0)+v)+u)}})}else{f(y)}},mceRepaint:function(){var v;if(c.isGecko){try{i(a);if(p.getSel()){p.getSel().selectAllChildren(n.getBody())}p.collapse(a);g()}catch(u){}}},mceToggleFormat:function(x,v,u){n.formatter.toggle(u)},InsertHorizontalRule:function(){p.setContent("<hr />")},mceToggleVisualAid:function(){n.hasVisual=!n.hasVisual;n.addVisual()},mceReplaceContent:function(x,v,u){p.setContent(u.replace(/\{\$selection\}/g,p.getContent({format:"text"})))},mceInsertLink:function(y,x,v){var u=l.getParent(p.getNode(),"a");if(c.is(v,"string")){v={href:v}}if(!u){f("CreateLink",b,"javascript:mctmp(0);");d(l.select("a[href=javascript:mctmp(0);]"),function(z){l.setAttribs(z,v)})}else{if(v.href){l.setAttribs(u,v)}else{ed.dom.remove(u,a)}}}});t({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(u){return s("align"+u.substring(7))},"Bold,Italic,Underline,Strikethrough":function(u){return s(u)},mceBlockQuote:function(){return s("blockquote")},Outdent:function(){var u;if(k.inline_styles){if((u=l.getParent(p.getStart(),l.isBlock))&&parseInt(u.style.paddingLeft)>0){return a}if((u=l.getParent(p.getEnd(),l.isBlock))&&parseInt(u.style.paddingLeft)>0){return a}}return m("InsertUnorderedList")||m("InsertOrderedList")||(!k.inline_styles&&!!l.getParent(p.getNode(),"BLOCKQUOTE"))},"InsertUnorderedList,InsertOrderedList":function(u){return l.getParent(p.getNode(),u=="insertunorderedlist"?"UL":"OL")}},"state");t({"FontSize,FontName":function(x){var v=0,u;if(u=l.getParent(p.getNode(),"span")){if(x=="fontsize"){v=u.style.fontSize}else{v=u.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}}return v}},"value");if(k.custom_undo_redo){t({Undo:function(){n.undoManager.undo()},Redo:function(){n.undoManager.redo()}})}}})(tinymce);(function(b){var a=b.util.Dispatcher;b.UndoManager=function(e){var c,d=0,g=[];function f(){return b.trim(e.getContent({format:"raw",no_events:1}))}return c={typing:0,onAdd:new a(c),onUndo:new a(c),onRedo:new a(c),add:function(l){var h,j=e.settings,k;l=l||{};l.content=f();k=g[d];if(k&&k.content==l.content){if(d>0||g.length==1){return null}}if(j.custom_undo_redo_levels){if(g.length>j.custom_undo_redo_levels){for(h=0;h<g.length-1;h++){g[h]=g[h+1]}g.length--;d=g.length}}l.bookmark=e.selection.getBookmark(2,true);if(d<g.length-1){if(d==0){g=[]}else{g.length=d+1}}g.push(l);d=g.length-1;c.onAdd.dispatch(c,l);e.isNotDirty=0;return l},undo:function(){var j,h;if(c.typing){c.add();c.typing=0}if(d>0){j=g[--d];e.setContent(j.content,{format:"raw"});e.selection.moveToBookmark(j.bookmark);c.onUndo.dispatch(c,j)}return j},redo:function(){var h;if(d<g.length-1){h=g[++d];e.setContent(h.content,{format:"raw"});e.selection.moveToBookmark(h.bookmark);c.onRedo.dispatch(c,h)}return h},clear:function(){g=[];d=c.typing=0},hasUndo:function(){return d>0||c.typing},hasRedo:function(){return d<g.length-1}}}})(tinymce);(function(l){var k=l.dom.Event,c=l.isIE,a=l.isGecko,b=l.isOpera,j=l.each,i=l.extend,d=true,h=false;function g(n,o){var m=o.ownerDocument.createRange();m.setStart(n.endContainer,n.endOffset);m.setEndAfter(o);return m.cloneContents().textContent.length==0}function f(m){m=m.innerHTML;m=m.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi,"-");m=m.replace(/<[^>]+>/g,"");return m.replace(/[ \u00a0\t\r\n]+/g,"")==""}function e(o,q,m){var n,p;if(f(m)){n=q.getParent(m,"ul,ol");if(!q.getParent(n.parentNode,"ul,ol")){q.split(n,m);p=q.create("p",0,'<br _mce_bogus="1" />');q.replace(p,m);o.select(p,1)}return h}return d}l.create("tinymce.ForceBlocks",{ForceBlocks:function(n){var o=this,p=n.settings,q;o.editor=n;o.dom=n.dom;q=(p.forced_root_block||"p").toLowerCase();p.element=q.toUpperCase();n.onPreInit.add(o.setup,o);o.reOpera=new RegExp("(\\u00a0|&#160;|&nbsp;)</"+q+">","gi");o.rePadd=new RegExp("<p( )([^>]+)><\\/p>|<p( )([^>]+)\\/>|<p( )([^>]+)>\\s+<\\/p>|<p><\\/p>|<p\\/>|<p>\\s+<\\/p>".replace(/p/g,q),"gi");o.reNbsp2BR1=new RegExp("<p( )([^>]+)>[\\s\\u00a0]+<\\/p>|<p>[\\s\\u00a0]+<\\/p>".replace(/p/g,q),"gi");o.reNbsp2BR2=new RegExp("<%p()([^>]+)>(&nbsp;|&#160;)<\\/%p>|<%p>(&nbsp;|&#160;)<\\/%p>".replace(/%p/g,q),"gi");o.reBR2Nbsp=new RegExp("<p( )([^>]+)>\\s*<br \\/>\\s*<\\/p>|<p>\\s*<br \\/>\\s*<\\/p>".replace(/p/g,q),"gi");function m(r,s){if(b){s.content=s.content.replace(o.reOpera,"</"+q+">")}s.content=s.content.replace(o.rePadd,"<"+q+"$1$2$3$4$5$6>\u00a0</"+q+">");if(!c&&!b&&s.set){s.content=s.content.replace(o.reNbsp2BR1,"<"+q+"$1$2><br /></"+q+">");s.content=s.content.replace(o.reNbsp2BR2,"<"+q+"$1$2><br /></"+q+">")}else{s.content=s.content.replace(o.reBR2Nbsp,"<"+q+"$1$2>\u00a0</"+q+">")}}n.onBeforeSetContent.add(m);n.onPostProcess.add(m);if(p.forced_root_block){n.onInit.add(o.forceRoots,o);n.onSetContent.add(o.forceRoots,o);n.onBeforeGetContent.add(o.forceRoots,o)}},setup:function(){var n=this,m=n.editor,p=m.settings,r=m.dom,o=m.selection;if(p.forced_root_block){m.onBeforeExecCommand.add(n.forceRoots,n);m.onKeyUp.add(n.forceRoots,n);m.onPreProcess.add(n.forceRoots,n)}if(p.force_br_newlines){if(c){m.onKeyPress.add(function(s,t){var u;if(t.keyCode==13&&o.getNode().nodeName!="LI"){o.setContent('<br id="__" /> ',{format:"raw"});u=r.get("__");u.removeAttribute("id");o.select(u);o.collapse();return k.cancel(t)}})}}if(!c&&p.force_p_newlines){m.onKeyPress.add(function(s,t){if(t.keyCode==13&&!t.shiftKey&&!n.insertPara(t)){k.cancel(t)}});if(a){m.onKeyDown.add(function(s,t){if((t.keyCode==8||t.keyCode==46)&&!t.shiftKey){n.backspaceDelete(t,t.keyCode==8)}})}}if(l.isWebKit){function q(t){var s=o.getRng(),u,y=r.create("div",null," "),x,v=r.getViewPort(t.getWin()).h;s.insertNode(u=r.create("br"));s.setStartAfter(u);s.setEndAfter(u);o.setRng(s);if(o.getSel().focusNode==u.previousSibling){o.select(r.insertAfter(r.doc.createTextNode("\u00a0"),u));o.collapse(d)}r.insertAfter(y,u);x=r.getPos(y).y;r.remove(y);if(x>v){t.getWin().scrollTo(0,x)}}m.onKeyPress.add(function(s,t){if(t.keyCode==13&&(t.shiftKey||p.force_br_newlines)){q(s);k.cancel(t)}})}m.onPreProcess.add(function(s,t){j(r.select("p,h1,h2,h3,h4,h5,h6,div",t.node),function(u){if(f(u)){j(r.select("span,em,strong,b,i",t.node),function(v){if(!v.hasChildNodes()){v.appendChild(s.getDoc().createTextNode("\u00a0"));return h}})}})});if(c){if(p.element!="P"){m.onKeyPress.add(function(s,t){n.lastElm=o.getNode().nodeName});m.onKeyUp.add(function(t,u){var x,v=o.getNode(),s=t.getBody();if(s.childNodes.length===1&&v.nodeName=="P"){v=r.rename(v,p.element);o.select(v);o.collapse();t.nodeChanged()}else{if(u.keyCode==13&&!u.shiftKey&&n.lastElm!="P"){x=r.getParent(v,"p");if(x){r.rename(x,p.element);t.nodeChanged()}}}})}}},find:function(u,p,q){var o=this.editor,m=o.getDoc().createTreeWalker(u,4,null,h),r=-1;while(u=m.nextNode()){r++;if(p==0&&u==q){return r}if(p==1&&r==q){return u}}return -1},forceRoots:function(v,H){var y=this,v=y.editor,L=v.getBody(),I=v.getDoc(),O=v.selection,z=O.getSel(),A=O.getRng(),M=-2,u,F,m,o,J=-16777215;var K,p,N,E,B,q=L.childNodes,D,C,x;for(D=q.length-1;D>=0;D--){K=q[D];if(K.nodeType===1&&K.getAttribute("_mce_type")){p=null;continue}if(K.nodeType===3||(!y.dom.isBlock(K)&&K.nodeType!==8&&!/^(script|mce:script|style|mce:style)$/i.test(K.nodeName))){if(!p){if(K.nodeType!=3||/[^\s]/g.test(K.nodeValue)){if(M==-2&&A){if(!c){if(A.startContainer.nodeType==1&&(C=A.startContainer.childNodes[A.startOffset])&&C.nodeType==1){x=C.getAttribute("id");C.setAttribute("id","__mce")}else{if(v.dom.getParent(A.startContainer,function(n){return n===L})){F=A.startOffset;m=A.endOffset;M=y.find(L,0,A.startContainer);u=y.find(L,0,A.endContainer)}}}else{o=I.body.createTextRange();o.moveToElementText(L);o.collapse(1);N=o.move("character",J)*-1;o=A.duplicate();o.collapse(1);E=o.move("character",J)*-1;o=A.duplicate();o.collapse(0);B=(o.move("character",J)*-1)-E;M=E-N;u=B}}p=v.dom.create(v.settings.forced_root_block);K.parentNode.replaceChild(p,K);p.appendChild(K)}}else{if(p.hasChildNodes()){p.insertBefore(K,p.firstChild)}else{p.appendChild(K)}}}else{p=null}}if(M!=-2){if(!c){p=L.getElementsByTagName(v.settings.element)[0];A=I.createRange();if(M!=-1){A.setStart(y.find(L,1,M),F)}else{A.setStart(p,0)}if(u!=-1){A.setEnd(y.find(L,1,u),m)}else{A.setEnd(p,0)}if(z){z.removeAllRanges();z.addRange(A)}}else{try{A=z.createRange();A.moveToElementText(L);A.collapse(1);A.moveStart("character",M);A.moveEnd("character",u);A.select()}catch(G){}}}else{if(!c&&(C=v.dom.get("__mce"))){if(x){C.setAttribute("id",x)}else{C.removeAttribute("id")}A=I.createRange();A.setStartBefore(C);A.setEndBefore(C);O.setRng(A)}}},getParentBlock:function(o){var m=this.dom;return m.getParent(o,m.isBlock)},insertPara:function(R){var F=this,v=F.editor,N=v.dom,S=v.getDoc(),W=v.settings,G=v.selection.getSel(),H=G.getRangeAt(0),V=S.body;var K,L,I,P,O,q,o,u,z,m,D,U,p,x,J,M=N.getViewPort(v.getWin()),C,E,B;K=S.createRange();K.setStart(G.anchorNode,G.anchorOffset);K.collapse(d);L=S.createRange();L.setStart(G.focusNode,G.focusOffset);L.collapse(d);I=K.compareBoundaryPoints(K.START_TO_END,L)<0;P=I?G.anchorNode:G.focusNode;O=I?G.anchorOffset:G.focusOffset;q=I?G.focusNode:G.anchorNode;o=I?G.focusOffset:G.anchorOffset;if(P===q&&/^(TD|TH)$/.test(P.nodeName)){if(P.firstChild.nodeName=="BR"){N.remove(P.firstChild)}if(P.childNodes.length==0){v.dom.add(P,W.element,null,"<br />");U=v.dom.add(P,W.element,null,"<br />")}else{J=P.innerHTML;P.innerHTML="";v.dom.add(P,W.element,null,J);U=v.dom.add(P,W.element,null,"<br />")}H=S.createRange();H.selectNodeContents(U);H.collapse(1);v.selection.setRng(H);return h}if(P==V&&q==V&&V.firstChild&&v.dom.isBlock(V.firstChild)){P=q=P.firstChild;O=o=0;K=S.createRange();K.setStart(P,0);L=S.createRange();L.setStart(q,0)}P=P.nodeName=="HTML"?S.body:P;P=P.nodeName=="BODY"?P.firstChild:P;q=q.nodeName=="HTML"?S.body:q;q=q.nodeName=="BODY"?q.firstChild:q;u=F.getParentBlock(P);z=F.getParentBlock(q);m=u?u.nodeName:W.element;if(J=F.dom.getParent(u,"li,pre")){if(J.nodeName=="LI"){return e(v.selection,F.dom,J)}return d}if(u&&(u.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(N.getStyle(u,"position",1)))){m=W.element;u=null}if(z&&(z.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(N.getStyle(u,"position",1)))){m=W.element;z=null}if(/(TD|TABLE|TH|CAPTION)/.test(m)||(u&&m=="DIV"&&/left|right/gi.test(N.getStyle(u,"float",1)))){m=W.element;u=z=null}D=(u&&u.nodeName==m)?u.cloneNode(0):v.dom.create(m);U=(z&&z.nodeName==m)?z.cloneNode(0):v.dom.create(m);U.removeAttribute("id");if(/^(H[1-6])$/.test(m)&&g(H,u)){U=v.dom.create(W.element)}J=p=P;do{if(J==V||J.nodeType==9||F.dom.isBlock(J)||/(TD|TABLE|TH|CAPTION)/.test(J.nodeName)){break}p=J}while((J=J.previousSibling?J.previousSibling:J.parentNode));J=x=q;do{if(J==V||J.nodeType==9||F.dom.isBlock(J)||/(TD|TABLE|TH|CAPTION)/.test(J.nodeName)){break}x=J}while((J=J.nextSibling?J.nextSibling:J.parentNode));if(p.nodeName==m){K.setStart(p,0)}else{K.setStartBefore(p)}K.setEnd(P,O);D.appendChild(K.cloneContents()||S.createTextNode(""));try{L.setEndAfter(x)}catch(Q){}L.setStart(q,o);U.appendChild(L.cloneContents()||S.createTextNode(""));H=S.createRange();if(!p.previousSibling&&p.parentNode.nodeName==m){H.setStartBefore(p.parentNode)}else{if(K.startContainer.nodeName==m&&K.startOffset==0){H.setStartBefore(K.startContainer)}else{H.setStart(K.startContainer,K.startOffset)}}if(!x.nextSibling&&x.parentNode.nodeName==m){H.setEndAfter(x.parentNode)}else{H.setEnd(L.endContainer,L.endOffset)}H.deleteContents();if(b){v.getWin().scrollTo(0,M.y)}if(D.firstChild&&D.firstChild.nodeName==m){D.innerHTML=D.firstChild.innerHTML}if(U.firstChild&&U.firstChild.nodeName==m){U.innerHTML=U.firstChild.innerHTML}if(f(D)){D.innerHTML="<br />"}function T(y,s){var r=[],Y,X,t;y.innerHTML="";if(W.keep_styles){X=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(X.nodeName)){Y=X.cloneNode(h);N.setAttrib(Y,"id","");r.push(Y)}}while(X=X.parentNode)}if(r.length>0){for(t=r.length-1,Y=y;t>=0;t--){Y=Y.appendChild(r[t])}r[0].innerHTML=b?"&nbsp;":"<br />";return r[0]}else{y.innerHTML=b?"&nbsp;":"<br />"}}if(f(U)){B=T(U,q)}if(b&&parseFloat(opera.version())<9.5){H.insertNode(D);H.insertNode(U)}else{H.insertNode(U);H.insertNode(D)}U.normalize();D.normalize();function A(r){return S.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,h).nextNode()||r}H=S.createRange();H.selectNodeContents(a?A(B||U):B||U);H.collapse(1);G.removeAllRanges();G.addRange(H);C=v.dom.getPos(U).y;E=U.clientHeight;if(C<M.y||C+E>M.y+M.h){v.getWin().scrollTo(0,C<M.y?C:C-M.h+25)}return h},backspaceDelete:function(s,A){var C=this,q=C.editor,x=q.getBody(),p=q.dom,o,u=q.selection,m=u.getRng(),v=m.startContainer,o,y,z;if(v&&q.dom.isBlock(v)&&!/^(TD|TH)$/.test(v.nodeName)&&A){if(v.childNodes.length==0||(v.childNodes.length==1&&v.firstChild.nodeName=="BR")){o=v;while((o=o.previousSibling)&&!q.dom.isBlock(o)){}if(o){if(v!=x.firstChild){y=q.dom.doc.createTreeWalker(o,NodeFilter.SHOW_TEXT,null,h);while(z=y.nextNode()){o=z}m=q.getDoc().createRange();m.setStart(o,o.nodeValue?o.nodeValue.length:0);m.setEnd(o,o.nodeValue?o.nodeValue.length:0);u.setRng(m);q.dom.remove(v)}return k.cancel(s)}}}function B(n){var r;n=n.target;if(n&&n.parentNode&&n.nodeName=="BR"&&(o=C.getParentBlock(n))){r=n.previousSibling;k.remove(x,"DOMNodeInserted",B);if(r&&r.nodeType==3&&/\s+$/.test(r.nodeValue)){return}if(n.previousSibling||n.nextSibling){q.dom.remove(n)}}}k._add(x,"DOMNodeInserted",B);window.setTimeout(function(){k._remove(x,"DOMNodeInserted",B)},1)}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each,e=c.extend;c.create("tinymce.ControlManager",{ControlManager:function(f,j){var h=this,g;j=j||{};h.editor=f;h.controls={};h.onAdd=new c.util.Dispatcher(h);h.onPostRender=new c.util.Dispatcher(h);h.prefix=j.prefix||f.id+"_";h._cls={};h.onPostRender.add(function(){d(h.controls,function(i){i.postRender()})})},get:function(f){return this.controls[this.prefix+f]||this.controls[f]},setActive:function(h,f){var g=null;if(g=this.get(h)){g.setActive(f)}return g},setDisabled:function(h,f){var g=null;if(g=this.get(h)){g.setDisabled(f)}return g},add:function(g){var f=this;if(g){f.controls[g.id]=g;f.onAdd.dispatch(g,f)}return g},createControl:function(i){var h,g=this,f=g.editor;d(f.plugins,function(j){if(j.createControl){h=j.createControl(i,g);if(h){return false}}});switch(i){case"|":case"separator":return g.createSeparator()}if(!h&&f.buttons&&(h=f.buttons[i])){return g.createButton(i,h)}return g.add(h)},createDropMenu:function(f,n,h){var m=this,i=m.editor,j,g,k,l;n=e({"class":"mceDropDown",constrain:i.settings.constrain_menus},n);n["class"]=n["class"]+" "+i.getParam("skin")+"Skin";if(k=i.getParam("skin_variant")){n["class"]+=" "+i.getParam("skin")+"Skin"+k.substring(0,1).toUpperCase()+k.substring(1)}f=m.prefix+f;l=h||m._cls.dropmenu||c.ui.DropMenu;j=m.controls[f]=new l(f,n);j.onAddItem.add(function(r,q){var p=q.settings;p.title=i.getLang(p.title,p.title);if(!p.onclick){p.onclick=function(o){if(p.cmd){i.execCommand(p.cmd,p.ui||false,p.value)}}}});i.onRemove.add(function(){j.destroy()});if(c.isIE){j.onShowMenu.add(function(){i.focus();g=i.selection.getBookmark(1)});j.onHideMenu.add(function(){if(g){i.selection.moveToBookmark(g);g=0}})}return m.add(j)},createListBox:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;if(g.settings.use_native_selects){k=new c.ui.NativeListBox(m,i)}else{f=l||h._cls.listbox||c.ui.ListBox;k=new f(m,i)}h.controls[m]=k;if(c.isWebKit){k.onPostRender.add(function(p,o){a.add(o,"mousedown",function(){g.bookmark=g.selection.getBookmark(1)});a.add(o,"focus",function(){g.selection.moveToBookmark(g.bookmark);g.bookmark=null})})}if(k.hideMenu){g.onMouseDown.add(k.hideMenu,k)}return h.add(k)},createButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.label=g.translate(i.label);i.scope=i.scope||g;if(!i.onclick&&!i.menu_button){i.onclick=function(){g.execCommand(i.cmd,i.ui||false,i.value)}}i=e({title:i.title,"class":"mce_"+m,unavailable_prefix:g.getLang("unavailable",""),scope:i.scope,control_manager:h},i);m=h.prefix+m;if(i.menu_button){f=l||h._cls.menubutton||c.ui.MenuButton;k=new f(m,i);g.onMouseDown.add(k.hideMenu,k)}else{f=h._cls.button||c.ui.Button;k=new f(m,i)}return h.add(k)},createMenuButton:function(h,f,g){f=f||{};f.menu_button=1;return this.createButton(h,f,g)},createSplitButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onclick){i.onclick=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;f=l||h._cls.splitbutton||c.ui.SplitButton;k=h.add(new f(m,i));g.onMouseDown.add(k.hideMenu,k);return k},createColorSplitButton:function(f,n,h){var l=this,j=l.editor,i,k,m,g;if(l.get(f)){return null}n.title=j.translate(n.title);n.scope=n.scope||j;if(!n.onclick){n.onclick=function(o){if(c.isIE){g=j.selection.getBookmark(1)}j.execCommand(n.cmd,n.ui||false,o||n.value)}}if(!n.onselect){n.onselect=function(o){j.execCommand(n.cmd,n.ui||false,o||n.value)}}n=e({title:n.title,"class":"mce_"+f,menu_class:j.getParam("skin")+"Skin",scope:n.scope,more_colors_title:j.getLang("more_colors")},n);f=l.prefix+f;m=h||l._cls.colorsplitbutton||c.ui.ColorSplitButton;k=new m(f,n);j.onMouseDown.add(k.hideMenu,k);j.onRemove.add(function(){k.destroy()});if(c.isIE){k.onShowMenu.add(function(){j.focus();g=j.selection.getBookmark(1)});k.onHideMenu.add(function(){if(g){j.selection.moveToBookmark(g);g=0}})}return l.add(k)},createToolbar:function(k,h,j){var i,g=this,f;k=g.prefix+k;f=j||g._cls.toolbar||c.ui.Toolbar;i=new f(k,h);if(g.get(k)){return null}return g.add(i)},createSeparator:function(g){var f=g||this._cls.separator||c.ui.Separator;return new f()},setControlType:function(g,f){return this._cls[g.toLowerCase()]=f},destroy:function(){d(this.controls,function(f){f.destroy()});this.controls=null}})})(tinymce);(function(d){var a=d.util.Dispatcher,e=d.each,c=d.isIE,b=d.isOpera;d.create("tinymce.WindowManager",{WindowManager:function(f){var g=this;g.editor=f;g.onOpen=new a(g);g.onClose=new a(g);g.params={};g.features={}},open:function(z,h){var v=this,k="",n,m,i=v.editor.settings.dialog_type=="modal",q,o,j,g=d.DOM.getViewPort(),r;z=z||{};h=h||{};o=b?g.w:screen.width;j=b?g.h:screen.height;z.name=z.name||"mc_"+new Date().getTime();z.width=parseInt(z.width||320);z.height=parseInt(z.height||240);z.resizable=true;z.left=z.left||parseInt(o/2)-(z.width/2);z.top=z.top||parseInt(j/2)-(z.height/2);h.inline=false;h.mce_width=z.width;h.mce_height=z.height;h.mce_auto_focus=z.auto_focus;if(i){if(c){z.center=true;z.help=false;z.dialogWidth=z.width+"px";z.dialogHeight=z.height+"px";z.scroll=z.scrollbars||false}}e(z,function(p,f){if(d.is(p,"boolean")){p=p?"yes":"no"}if(!/^(name|url)$/.test(f)){if(c&&i){k+=(k?";":"")+f+":"+p}else{k+=(k?",":"")+f+"="+p}}});v.features=z;v.params=h;v.onOpen.dispatch(v,z,h);r=z.url||z.file;r=d._addVer(r);try{if(c&&i){q=1;window.showModalDialog(r,window,k)}else{q=window.open(r,z.name,k)}}catch(l){}if(!q){alert(v.editor.getLang("popup_blocked"))}},close:function(f){f.close();this.onClose.dispatch(this)},createInstance:function(i,h,g,m,l,k){var j=d.resolve(i);return new j(h,g,m,l,k)},confirm:function(h,f,i,g){g=g||window;f.call(i||this,g.confirm(this._decode(this.editor.getLang(h,h))))},alert:function(h,f,j,g){var i=this;g=g||window;g.alert(i._decode(i.editor.getLang(h,h)));if(f){f.call(j||i)}},resizeBy:function(f,g,h){h.resizeBy(f,g)},_decode:function(f){return d.DOM.decode(f).replace(/\\n/g,"\n")}})}(tinymce));(function(a){function b(){var d={},c={},e={};function f(j,i,h,g){if(typeof(i)=="string"){i=[i]}a.each(i,function(k){j[k.toLowerCase()]={func:h,scope:g}})}a.extend(this,{add:function(i,h,g){f(d,i,h,g)},addQueryStateHandler:function(i,h,g){f(c,i,h,g)},addQueryValueHandler:function(i,h,g){f(e,i,h,g)},execCommand:function(h,k,j,i,g){if(k=d[k.toLowerCase()]){if(k.func.call(h||k.scope,j,i,g)!==false){return true}}},queryCommandValue:function(){if(cmd=e[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}},queryCommandState:function(){if(cmd=c[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}}})}a.GlobalCommands=new b()})(tinymce);(function(a){a.Formatter=function(R){var I={},K=a.each,c=R.dom,p=R.selection,s=a.dom.TreeWalker,G=new a.dom.RangeUtils(c),d=R.schema.isValid,C=c.isBlock,k=R.settings.forced_root_block,r=c.nodeIndex,B="\uFEFF",e=/^(src|href|style)$/,O=false,y=true,o,L={apply:[],remove:[]};function l(T,S){return c.getParents(T,S,c.getRoot())}function b(S){return S.nodeType===1&&(S.face==="mceinline"||S.style.fontFamily==="mceinline")}function N(S){return S?I[S]:I}function j(S,T){if(S){if(typeof(S)!=="string"){K(S,function(V,U){j(U,V)})}else{T=T.length?T:[T];K(T,function(U){if(U.deep===o){U.deep=!U.selector}if(U.split===o){U.split=!U.selector||U.inline}if(U.remove===o&&U.selector&&!U.inline){U.remove="none"}if(U.selector&&U.inline){U.mixed=true;U.block_expand=true}if(typeof(U.classes)==="string"){U.classes=U.classes.split(/\s+/)}});I[S]=T}}}function P(U,aa,W){var X=N(U),ab=X[0],Z,T,Y;function V(ae){var ad=ae.startContainer,ah=ae.startOffset,ag,af;if(ad.nodeType==1||ad.nodeValue===""){ag=new s(ad.childNodes[ah]);for(af=ag.current();af;af=ag.next()){if(af.nodeType==3&&!C(af.parentNode)&&!f(af)){ae.setStart(af,0);break}}}return ae}function S(ae,ad){ad=ad||ab;if(ae){K(ad.styles,function(ag,af){c.setStyle(ae,af,q(ag,aa))});K(ad.attributes,function(ag,af){c.setAttrib(ae,af,q(ag,aa))});K(ad.classes,function(af){af=q(af,aa);if(!c.hasClass(ae,af)){c.addClass(ae,af)}})}}function ac(ae){var ad=[],ag,af;ag=ab.inline||ab.block;af=c.create(ag);S(af);G.walk(ae,function(ah){var ai;function aj(ak){var an=ak.nodeName.toLowerCase(),am=ak.parentNode.nodeName.toLowerCase(),al;if(g(an,"br")){ai=0;if(ab.block){c.remove(ak)}return}if(ab.wrapper&&u(ak,U,aa)){ai=0;return}if(ab.block&&!ab.wrapper&&D(an)){ak=c.rename(ak,ag);S(ak);ad.push(ak);ai=0;return}if(ab.selector){K(X,function(ao){if(c.is(ak,ao.selector)&&!b(ak)){S(ak,ao);al=true}});if(!ab.inline||al){ai=0;return}}if(d(ag,an)&&d(am,ag)){if(!ai){ai=af.cloneNode(O);ak.parentNode.insertBefore(ai,ak);ad.push(ai)}ai.appendChild(ak)}else{ai=0;K(a.grep(ak.childNodes),aj);ai=0}}K(ah,aj)});K(ad,function(aj){var ah;function ak(am){var al=0;K(am.childNodes,function(an){if(!f(an)&&!E(an)){al++}});return al}function ai(al){var an,am;K(al.childNodes,function(ao){if(ao.nodeType==1&&!E(ao)&&!b(ao)){an=ao;return O}});if(an&&h(an,ab)){am=an.cloneNode(O);S(am);c.replace(am,al,y);c.remove(an,1)}return am||al}ah=ak(aj);if(ah===0){c.remove(aj,1);return}if(ab.inline||ab.wrapper){if(!ab.exact&&ah===1){aj=ai(aj)}K(X,function(al){K(c.select(al.inline,aj),function(am){Q(al,aa,am,al.exact?am:null)})});c.getParent(aj.parentNode,function(al){if(u(al,U,aa)){c.remove(aj,1);aj=0;return y}});if(aj){aj=t(z(aj),aj);aj=t(aj,z(aj,y))}}})}if(ab){if(W){T=c.createRng();T.setStartBefore(W);T.setEndAfter(W);ac(T)}else{if(!p.isCollapsed()||!ab.inline){Z=p.getBookmark();ac(n(p.getRng(y),X));p.moveToBookmark(Z);p.setRng(V(p.getRng(y)));R.nodeChanged()}else{M("apply",U,aa)}}}}function x(U,ac,W){var X=N(U),ae=X[0],ab,aa,T;function V(aj){var ai,ah,ag;ai=a.grep(aj.childNodes);for(ah=0,ag=X.length;ah<ag;ah++){if(Q(X[ah],ac,aj,aj)){break}}if(ae.deep){for(ah=0,ag=ai.length;ah<ag;ah++){V(ai[ah])}}}function Y(ag){var ah;K(l(ag.parentNode).reverse(),function(ai){var aj;if(!ah&&ai.id!="_start"&&ai.id!="_end"){aj=u(ai,U,ac);if(aj&&aj.split!==false){ah=ai}}});return ah}function S(aj,ag,al,ao){var ap,an,am,ai,ak,ah;if(aj){ah=aj.parentNode;for(ap=ag.parentNode;ap&&ap!=ah;ap=ap.parentNode){an=ap.cloneNode(O);for(ak=0;ak<X.length;ak++){if(Q(X[ak],ac,an,an)){an=0;break}}if(an){if(am){an.appendChild(am)}if(!ai){ai=an}am=an}}if(ao&&(!ae.mixed||!C(aj))){ag=c.split(aj,ag)}if(am){al.parentNode.insertBefore(am,al);ai.appendChild(al)}}return ag}function ad(ag){return S(Y(ag),ag,ag,true)}function Z(ai){var ah=c.get(ai?"_start":"_end"),ag=ah[ai?"firstChild":"lastChild"];c.remove(ah,1);return ag}function af(ag){var ah,ai;ag=n(ag,X,y);if(ae.split){ah=F(ag,y);ai=F(ag);if(ah!=ai){ah=J(ah,"span",{id:"_start",_mce_type:"bookmark"});ai=J(ai,"span",{id:"_end",_mce_type:"bookmark"});ad(ah);ad(ai);ah=Z(y);ai=Z()}else{ah=ai=ad(ah)}ag.startContainer=ah.parentNode;ag.startOffset=r(ah);ag.endContainer=ai.parentNode;ag.endOffset=r(ai)+1}G.walk(ag,function(aj){K(aj,function(ak){V(ak)})})}if(W){T=c.createRng();T.setStartBefore(W);T.setEndAfter(W);af(T);return}if(!p.isCollapsed()||!ae.inline){ab=p.getBookmark();af(p.getRng(y));p.moveToBookmark(ab);R.nodeChanged()}else{M("remove",U,ac)}}function A(S,U,T){if(i(S,U,T)){x(S,U,T)}else{P(S,U,T)}}function u(V,S,X){var Y=N(S),W,U,T;function Z(ad,af,ag){var ac,ae,aa=af[ag],ab;if(aa){if(aa.length===o){for(ac in aa){if(aa.hasOwnProperty(ac)){if(ag==="attributes"){ae=c.getAttrib(ad,ac)}else{ae=H(ad,ac)}if(!g(ae,q(aa[ac],X))){return}}}}else{for(ab=0;ab<aa.length;ab++){if(ag==="attributes"?c.getAttrib(ad,aa[ab]):H(ad,aa[ab])){return af}}}}return af}if(Y&&V){for(U=0;U<Y.length;U++){W=Y[U];if(h(V,W)&&Z(V,W,"attributes")&&Z(V,W,"styles")){if(T=W.classes){for(U=0;U<T.length;U++){if(!c.hasClass(V,T[U])){return}}}return W}}}}function i(U,X,W){var T,V;function S(Y){Y=c.getParent(Y,function(Z){return !!u(Z,U,X)});return u(Y,U,X)}if(W){return S(W)}if(p.isCollapsed()){for(V=L.apply.length-1;V>=0;V--){if(L.apply[V].name==U){return true}}for(V=L.remove.length-1;V>=0;V--){if(L.remove[V].name==U){return false}}return S(p.getNode())}W=p.getNode();if(S(W)){return y}T=p.getStart();if(T!=W){if(S(T)){return y}}return O}function v(W){var Y=N(W),V,U,X,T,S;if(Y){V=p.getStart();U=l(V);for(T=Y.length-1;T>=0;T--){S=Y[T].selector;if(!S){return y}for(X=U.length-1;X>=0;X--){if(c.is(U[X],S)){return y}}}}return O}a.extend(this,{get:N,register:j,apply:P,remove:x,toggle:A,match:i,matchNode:u,canApply:v});function h(S,T){if(g(S,T.inline)){return y}if(g(S,T.block)){return y}if(T.selector){return c.is(S,T.selector)}}function g(T,S){T=T||"";S=S||"";T=T.nodeName||T;S=S.nodeName||S;return T.toLowerCase()==S.toLowerCase()}function H(T,S){var U=c.getStyle(T,S);if(S=="color"||S=="backgroundColor"){U=c.toHex(U)}if(S=="fontWeight"&&U==700){U="bold"}return""+U}function q(S,T){if(typeof(S)!="string"){S=S(T)}else{if(T){S=S.replace(/%(\w+)/g,function(V,U){return T[U]||V})}}return S}function f(S){return S&&S.nodeType===3&&/^\s*$/.test(S.nodeValue)}function J(U,T,S){var V=c.create(T,S);U.parentNode.insertBefore(V,U);V.appendChild(U);return V}function n(S,aa,V){var U=S.startContainer,X=S.startOffset,ad=S.endContainer,Y=S.endOffset,ac,Z;function ab(ag,ah,ae,af){var ai,aj;af=af||c.getRoot();for(;;){ai=ag.parentNode;if(ai==af||(!aa[0].block_expand&&C(ai))){return ag}for(ac=ai[ah];ac&&ac!=ag;ac=ac[ae]){if(ac.nodeType==1&&!E(ac)){return ag}if(ac.nodeType==3&&!f(ac)){return ag}}ag=ag.parentNode}return ag}if(U.nodeType==1&&U.hasChildNodes()){Z=U.childNodes.length-1;U=U.childNodes[X>Z?Z:X];if(U.nodeType==3){X=0}}if(ad.nodeType==1&&ad.hasChildNodes()){Z=ad.childNodes.length-1;ad=ad.childNodes[Y>Z?Z:Y-1];if(ad.nodeType==3){Y=ad.nodeValue.length}}if(E(U.parentNode)){U=U.parentNode}if(E(U)){U=U.nextSibling||U}if(E(ad.parentNode)){ad=ad.parentNode}if(E(ad)){ad=ad.previousSibling||ad}if(aa[0].inline||aa[0].block_expand){U=ab(U,"firstChild","nextSibling");ad=ab(ad,"lastChild","previousSibling")}if(aa[0].selector&&aa[0].expand!==O&&!aa[0].inline){function W(af,ae){var ag,ah,ai;if(af.nodeType==3&&af.nodeValue.length==0&&af[ae]){af=af[ae]}ag=l(af);for(ah=0;ah<ag.length;ah++){for(ai=0;ai<aa.length;ai++){if(c.is(ag[ah],aa[ai].selector)){return ag[ah]}}}return af}U=W(U,"previousSibling");ad=W(ad,"nextSibling")}if(aa[0].block||aa[0].selector){function T(af,ae,ah){var ag;if(!aa[0].wrapper){ag=c.getParent(af,aa[0].block)}if(!ag){ag=c.getParent(af.nodeType==3?af.parentNode:af,C)}if(ag&&aa[0].wrapper){ag=l(ag,"ul,ol").reverse()[0]||ag}if(!ag){ag=af;while(ag[ae]&&!C(ag[ae])){ag=ag[ae];if(g(ag,"br")){break}}}return ag||af}U=T(U,"previousSibling");ad=T(ad,"nextSibling");if(aa[0].block){if(!C(U)){U=ab(U,"firstChild","nextSibling")}if(!C(ad)){ad=ab(ad,"lastChild","previousSibling")}}}if(U.nodeType==1){X=r(U);U=U.parentNode}if(ad.nodeType==1){Y=r(ad)+1;ad=ad.parentNode}return{startContainer:U,startOffset:X,endContainer:ad,endOffset:Y}}function Q(Y,X,V,S){var U,T,W;if(!h(V,Y)){return O}if(Y.remove!="all"){K(Y.styles,function(aa,Z){aa=q(aa,X);if(typeof(Z)==="number"){Z=aa;S=0}if(!S||g(H(S,Z),aa)){c.setStyle(V,Z,"")}W=1});if(W&&c.getAttrib(V,"style")==""){V.removeAttribute("style");V.removeAttribute("_mce_style")}K(Y.attributes,function(ab,Z){var aa;ab=q(ab,X);if(typeof(Z)==="number"){Z=ab;S=0}if(!S||g(c.getAttrib(S,Z),ab)){if(Z=="class"){ab=c.getAttrib(V,Z);if(ab){aa="";K(ab.split(/\s+/),function(ac){if(/mce\w+/.test(ac)){aa+=(aa?" ":"")+ac}});if(aa){c.setAttrib(V,Z,aa);return}}}if(Z=="class"){V.removeAttribute("className")}if(e.test(Z)){V.removeAttribute("_mce_"+Z)}V.removeAttribute(Z)}});K(Y.classes,function(Z){Z=q(Z,X);if(!S||c.hasClass(S,Z)){c.removeClass(V,Z)}});T=c.getAttribs(V);for(U=0;U<T.length;U++){if(T[U].nodeName.indexOf("_")!==0){return O}}}if(Y.remove!="none"){m(V,Y);return y}}function m(U,V){var S=U.parentNode,T;if(V.block){if(!k){function W(Y,X,Z){Y=z(Y,X,Z);return !Y||(Y.nodeName=="BR"||C(Y))}if(C(U)&&!C(S)){if(!W(U,O)&&!W(U.firstChild,y,1)){U.insertBefore(c.create("br"),U.firstChild)}if(!W(U,y)&&!W(U.lastChild,O,1)){U.appendChild(c.create("br"))}}}else{if(S==c.getRoot()){if(!V.list_block||!g(U,V.list_block)){K(a.grep(U.childNodes),function(X){if(d(k,X.nodeName.toLowerCase())){if(!T){T=J(X,k)}else{T.appendChild(X)}}else{T=0}})}}}}if(V.selector&&V.inline&&!g(V.inline,U)){return}c.remove(U,1)}function z(T,S,U){if(T){S=S?"nextSibling":"previousSibling";for(T=U?T:T[S];T;T=T[S]){if(T.nodeType==1||!f(T)){return T}}}}function E(S){return S&&S.nodeType==1&&S.getAttribute("_mce_type")=="bookmark"}function t(W,V){var S,U,T;function Y(ab,aa){if(ab.nodeName!=aa.nodeName){return O}function Z(ad){var ae={};K(c.getAttribs(ad),function(af){var ag=af.nodeName.toLowerCase();if(ag.indexOf("_")!==0&&ag!=="style"){ae[ag]=c.getAttrib(ad,ag)}});return ae}function ac(ag,af){var ae,ad;for(ad in ag){if(ag.hasOwnProperty(ad)){ae=af[ad];if(ae===o){return O}if(ag[ad]!=ae){return O}delete af[ad]}}for(ad in af){if(af.hasOwnProperty(ad)){return O}}return y}if(!ac(Z(ab),Z(aa))){return O}if(!ac(c.parseStyle(c.getAttrib(ab,"style")),c.parseStyle(c.getAttrib(aa,"style")))){return O}return y}if(W&&V){function X(aa,Z){for(U=aa;U;U=U[Z]){if(U.nodeType==3&&!f(U)){return aa}if(U.nodeType==1&&!E(U)){return U}}return aa}W=X(W,"previousSibling");V=X(V,"nextSibling");if(Y(W,V)){for(U=W.nextSibling;U&&U!=V;){T=U;U=U.nextSibling;W.appendChild(T)}c.remove(V);K(a.grep(V.childNodes),function(Z){W.appendChild(Z)});return W}}return V}function D(S){return/^(h[1-6]|p|div|pre|address)$/.test(S)}function F(T,W){var S,V,U;S=T[W?"startContainer":"endContainer"];V=T[W?"startOffset":"endOffset"];if(S.nodeType==1){U=S.childNodes.length-1;if(!W&&V){V--}S=S.childNodes[V>U?U:V]}return S}function M(X,T,W){var U,S=L[X],Y=L[X=="apply"?"remove":"apply"];function Z(){return L.apply.length||L.remove.length}function V(){L.apply=[];L.remove=[]}function aa(ab){K(L.apply.reverse(),function(ac){P(ac.name,ac.vars,ab)});K(L.remove.reverse(),function(ac){x(ac.name,ac.vars,ab)});c.remove(ab,1);V()}for(U=S.length-1;U>=0;U--){if(S[U].name==T){return}}S.push({name:T,vars:W});for(U=Y.length-1;U>=0;U--){if(Y[U].name==T){Y.splice(U,1)}}if(Z()){R.getDoc().execCommand("FontName",false,"mceinline");K(c.select("font,span"),function(ac){var ab;if(b(ac)){ab=p.getBookmark();aa(ac);p.moveToBookmark(ab);R.nodeChanged()}});if(!L.isListening&&Z()){L.isListening=true;K("onKeyDown,onKeyUp,onKeyPress,onMouseUp".split(","),function(ab){R[ab].addToTop(function(ac,ad){if(Z()){K(c.select("font,span"),function(ag){var af,ah,ae;if(b(ag)){ah=ag.firstChild;aa(ag);ae=c.createRng();ae.setStart(ah,ah.nodeValue.length);ae.setEnd(ah,ah.nodeValue.length);p.setRng(ae);ac.nodeChanged()}});if(ad.type=="keyup"||ad.type=="mouseup"){V()}}})})}}}}})(tinymce);tinymce.onAddEditor.add(function(e,a){var d,h,g,c=a.settings;if(c.inline_styles){h=e.explode(c.font_size_style_values);function b(j,i){g.replace(g.create("span",{style:i}),j,1)}d={font:function(j,i){b(i,{backgroundColor:i.style.backgroundColor,color:i.color,fontFamily:i.face,fontSize:h[parseInt(i.size)-1]})},u:function(j,i){b(i,{textDecoration:"underline"})},strike:function(j,i){b(i,{textDecoration:"line-through"})}};function f(i,j){g=i.dom;if(c.convert_fonts_to_spans){e.each(g.select("font,u,strike",j.node),function(k){d[k.nodeName.toLowerCase()](a.dom,k)})}}a.onPreProcess.add(f);a.onInit.add(function(){a.selection.onSetContent.add(f)})}}); \ No newline at end of file
diff --git a/program/js/tiny_mce/tiny_mce_popup.js b/program/js/tiny_mce/tiny_mce_popup.js
index c9bf1fe4c..3ef3acb1f 100644
--- a/program/js/tiny_mce/tiny_mce_popup.js
+++ b/program/js/tiny_mce/tiny_mce_popup.js
@@ -2,4 +2,4 @@
// Uncomment and change this document.domain value if you are loading the script cross subdomains
// document.domain = 'moxiecode.com';
-var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var e=this,g,a=document.body,c=e.dom.getViewPort(window),d,f;d=e.getWindowArg("mce_width")-c.w;f=e.getWindowArg("mce_height")-c.h;if(e.isWindow){window.resizeBy(d,f)}else{e.editor.windowManager.resizeBy(d,f,e.id)}},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.domLoaded){return}b.domLoaded=1;if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){tinymce.dom.Event._add(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){a=a.target||a.srcElement;if(a.onchange){a.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_wait:function(){if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);tinyMCEPopup._onDOMLoaded()}});if(document.documentElement.doScroll&&window==window.top){(function(){if(tinyMCEPopup.domLoaded){return}try{document.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}tinyMCEPopup._onDOMLoaded()})()}document.attachEvent("onload",tinyMCEPopup._onDOMLoaded)}else{if(document.addEventListener){window.addEventListener("DOMContentLoaded",tinyMCEPopup._onDOMLoaded,false);window.addEventListener("load",tinyMCEPopup._onDOMLoaded,false)}}}};tinyMCEPopup.init();tinyMCEPopup._wait(); \ No newline at end of file
+var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},0)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.domLoaded){return}b.domLoaded=1;if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){tinymce.dom.Event._add(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){a=a.target||a.srcElement;if(a.onchange){a.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_wait:function(){if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);tinyMCEPopup._onDOMLoaded()}});if(document.documentElement.doScroll&&window==window.top){(function(){if(tinyMCEPopup.domLoaded){return}try{document.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}tinyMCEPopup._onDOMLoaded()})()}document.attachEvent("onload",tinyMCEPopup._onDOMLoaded)}else{if(document.addEventListener){window.addEventListener("DOMContentLoaded",tinyMCEPopup._onDOMLoaded,false);window.addEventListener("load",tinyMCEPopup._onDOMLoaded,false)}}}};tinyMCEPopup.init();tinyMCEPopup._wait(); \ No newline at end of file
diff --git a/program/js/tiny_mce/tiny_mce_src.js b/program/js/tiny_mce/tiny_mce_src.js
index 6f86af440..5cbcced76 100644
--- a/program/js/tiny_mce/tiny_mce_src.js
+++ b/program/js/tiny_mce/tiny_mce_src.js
@@ -1,436 +1,443 @@
-var tinymce = {
- majorVersion : '3',
- minorVersion : '2.7',
- releaseDate : '2009-09-22',
+(function(win) {
+ var whiteSpaceRe = /^\s*|\s*$/g,
+ undefined;
- _init : function() {
- var t = this, d = document, w = window, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
+ var tinymce = {
+ majorVersion : '3',
- t.isOpera = w.opera && opera.buildNumber;
+ minorVersion : '3.1',
- t.isWebKit = /WebKit/.test(ua);
+ releaseDate : '2010-03-18',
- t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(na.appName);
+ _init : function() {
+ var t = this, d = document, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
- t.isIE6 = t.isIE && /MSIE [56]/.test(ua);
+ t.isOpera = win.opera && opera.buildNumber;
- t.isGecko = !t.isWebKit && /Gecko/.test(ua);
+ t.isWebKit = /WebKit/.test(ua);
- t.isMac = ua.indexOf('Mac') != -1;
+ t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(na.appName);
- t.isAir = /adobeair/i.test(ua);
+ t.isIE6 = t.isIE && /MSIE [56]/.test(ua);
- // TinyMCE .NET webcontrol might be setting the values for TinyMCE
- if (w.tinyMCEPreInit) {
- t.suffix = tinyMCEPreInit.suffix;
- t.baseURL = tinyMCEPreInit.base;
- t.query = tinyMCEPreInit.query;
- return;
- }
+ t.isGecko = !t.isWebKit && /Gecko/.test(ua);
- // Get suffix and base
- t.suffix = '';
+ t.isMac = ua.indexOf('Mac') != -1;
- // If base element found, add that infront of baseURL
- nl = d.getElementsByTagName('base');
- for (i=0; i<nl.length; i++) {
- if (v = nl[i].href) {
- // Host only value like http://site.com or http://site.com:8008
- if (/^https?:\/\/[^\/]+$/.test(v))
- v += '/';
+ t.isAir = /adobeair/i.test(ua);
- base = v ? v.match(/.*\//)[0] : ''; // Get only directory
+ // TinyMCE .NET webcontrol might be setting the values for TinyMCE
+ if (win.tinyMCEPreInit) {
+ t.suffix = tinyMCEPreInit.suffix;
+ t.baseURL = tinyMCEPreInit.base;
+ t.query = tinyMCEPreInit.query;
+ return;
}
- }
- function getBase(n) {
- if (n.src && /tiny_mce(|_gzip|_jquery|_prototype)(_dev|_src)?.js/.test(n.src)) {
- if (/_(src|dev)\.js/g.test(n.src))
- t.suffix = '_src';
+ // Get suffix and base
+ t.suffix = '';
- if ((p = n.src.indexOf('?')) != -1)
- t.query = n.src.substring(p + 1);
+ // If base element found, add that infront of baseURL
+ nl = d.getElementsByTagName('base');
+ for (i=0; i<nl.length; i++) {
+ if (v = nl[i].href) {
+ // Host only value like http://site.com or http://site.com:8008
+ if (/^https?:\/\/[^\/]+$/.test(v))
+ v += '/';
- t.baseURL = n.src.substring(0, n.src.lastIndexOf('/'));
+ base = v ? v.match(/.*\//)[0] : ''; // Get only directory
+ }
+ }
- // If path to script is relative and a base href was found add that one infront
- // the src property will always be an absolute one on non IE browsers and IE 8
- // so this logic will basically only be executed on older IE versions
- if (base && t.baseURL.indexOf('://') == -1 && t.baseURL.indexOf('/') !== 0)
- t.baseURL = base + t.baseURL;
+ function getBase(n) {
+ if (n.src && /tiny_mce(|_gzip|_jquery|_prototype)(_dev|_src)?.js/.test(n.src)) {
+ if (/_(src|dev)\.js/g.test(n.src))
+ t.suffix = '_src';
- return t.baseURL;
- }
+ if ((p = n.src.indexOf('?')) != -1)
+ t.query = n.src.substring(p + 1);
- return null;
- };
+ t.baseURL = n.src.substring(0, n.src.lastIndexOf('/'));
- // Check document
- nl = d.getElementsByTagName('script');
- for (i=0; i<nl.length; i++) {
- if (getBase(nl[i]))
- return;
- }
+ // If path to script is relative and a base href was found add that one infront
+ // the src property will always be an absolute one on non IE browsers and IE 8
+ // so this logic will basically only be executed on older IE versions
+ if (base && t.baseURL.indexOf('://') == -1 && t.baseURL.indexOf('/') !== 0)
+ t.baseURL = base + t.baseURL;
+
+ return t.baseURL;
+ }
+
+ return null;
+ };
- // Check head
- n = d.getElementsByTagName('head')[0];
- if (n) {
- nl = n.getElementsByTagName('script');
+ // Check document
+ nl = d.getElementsByTagName('script');
for (i=0; i<nl.length; i++) {
if (getBase(nl[i]))
return;
}
- }
- return;
- },
+ // Check head
+ n = d.getElementsByTagName('head')[0];
+ if (n) {
+ nl = n.getElementsByTagName('script');
+ for (i=0; i<nl.length; i++) {
+ if (getBase(nl[i]))
+ return;
+ }
+ }
- is : function(o, t) {
- var n = typeof(o);
+ return;
+ },
- if (!t)
- return n != 'undefined';
+ is : function(o, t) {
+ if (!t)
+ return o !== undefined;
- if (t == 'array' && (o.hasOwnProperty && o instanceof Array))
- return true;
+ if (t == 'array' && (o.hasOwnProperty && o instanceof Array))
+ return true;
- return n == t;
- },
+ return typeof(o) == t;
+ },
- each : function(o, cb, s) {
- var n, l;
+ each : function(o, cb, s) {
+ var n, l;
- if (!o)
- return 0;
+ if (!o)
+ return 0;
- s = s || o;
+ s = s || o;
- if (typeof(o.length) != 'undefined') {
- // Indexed arrays, needed for Safari
- for (n=0, l = o.length; n<l; n++) {
- if (cb.call(s, o[n], n, o) === false)
- return 0;
- }
- } else {
- // Hashtables
- for (n in o) {
- if (o.hasOwnProperty(n)) {
+ if (o.length !== undefined) {
+ // Indexed arrays, needed for Safari
+ for (n=0, l = o.length; n < l; n++) {
if (cb.call(s, o[n], n, o) === false)
return 0;
}
+ } else {
+ // Hashtables
+ for (n in o) {
+ if (o.hasOwnProperty(n)) {
+ if (cb.call(s, o[n], n, o) === false)
+ return 0;
+ }
+ }
}
- }
- return 1;
- },
+ return 1;
+ },
- map : function(a, f) {
- var o = [];
+ map : function(a, f) {
+ var o = [];
- tinymce.each(a, function(v) {
- o.push(f(v));
- });
+ tinymce.each(a, function(v) {
+ o.push(f(v));
+ });
- return o;
- },
+ return o;
+ },
- grep : function(a, f) {
- var o = [];
+ grep : function(a, f) {
+ var o = [];
- tinymce.each(a, function(v) {
- if (!f || f(v))
- o.push(v);
- });
+ tinymce.each(a, function(v) {
+ if (!f || f(v))
+ o.push(v);
+ });
- return o;
- },
+ return o;
+ },
- inArray : function(a, v) {
- var i, l;
+ inArray : function(a, v) {
+ var i, l;
- if (a) {
- for (i = 0, l = a.length; i < l; i++) {
- if (a[i] === v)
- return i;
+ if (a) {
+ for (i = 0, l = a.length; i < l; i++) {
+ if (a[i] === v)
+ return i;
+ }
}
- }
-
- return -1;
- },
- extend : function(o, e) {
- var i, a = arguments;
+ return -1;
+ },
- for (i=1; i<a.length; i++) {
- e = a[i];
+ extend : function(o, e) {
+ var i, l, a = arguments;
- tinymce.each(e, function(v, n) {
- if (typeof(v) !== 'undefined')
- o[n] = v;
- });
- }
+ for (i = 1, l = a.length; i < l; i++) {
+ e = a[i];
- return o;
- },
+ tinymce.each(e, function(v, n) {
+ if (v !== undefined)
+ o[n] = v;
+ });
+ }
+ return o;
+ },
- trim : function(s) {
- return (s ? '' + s : '').replace(/^\s*|\s*$/g, '');
- },
- create : function(s, p) {
- var t = this, sp, ns, cn, scn, c, de = 0;
+ trim : function(s) {
+ return (s ? '' + s : '').replace(whiteSpaceRe, '');
+ },
- // Parse : <prefix> <class>:<super class>
- s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s);
- cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name
+ create : function(s, p) {
+ var t = this, sp, ns, cn, scn, c, de = 0;
- // Create namespace for new class
- ns = t.createNS(s[3].replace(/\.\w+$/, ''));
+ // Parse : <prefix> <class>:<super class>
+ s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s);
+ cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name
- // Class already exists
- if (ns[cn])
- return;
+ // Create namespace for new class
+ ns = t.createNS(s[3].replace(/\.\w+$/, ''));
- // Make pure static class
- if (s[2] == 'static') {
- ns[cn] = p;
+ // Class already exists
+ if (ns[cn])
+ return;
- if (this.onCreate)
- this.onCreate(s[2], s[3], ns[cn]);
+ // Make pure static class
+ if (s[2] == 'static') {
+ ns[cn] = p;
- return;
- }
+ if (this.onCreate)
+ this.onCreate(s[2], s[3], ns[cn]);
- // Create default constructor
- if (!p[cn]) {
- p[cn] = function() {};
- de = 1;
- }
+ return;
+ }
- // Add constructor and methods
- ns[cn] = p[cn];
- t.extend(ns[cn].prototype, p);
-
- // Extend
- if (s[5]) {
- sp = t.resolve(s[5]).prototype;
- scn = s[5].match(/\.(\w+)$/i)[1]; // Class name
-
- // Extend constructor
- c = ns[cn];
- if (de) {
- // Add passthrough constructor
- ns[cn] = function() {
- return sp[scn].apply(this, arguments);
- };
- } else {
- // Add inherit constructor
- ns[cn] = function() {
- this.parent = sp[scn];
- return c.apply(this, arguments);
- };
+ // Create default constructor
+ if (!p[cn]) {
+ p[cn] = function() {};
+ de = 1;
}
- ns[cn].prototype[cn] = ns[cn];
- // Add super methods
- t.each(sp, function(f, n) {
- ns[cn].prototype[n] = sp[n];
- });
+ // Add constructor and methods
+ ns[cn] = p[cn];
+ t.extend(ns[cn].prototype, p);
+
+ // Extend
+ if (s[5]) {
+ sp = t.resolve(s[5]).prototype;
+ scn = s[5].match(/\.(\w+)$/i)[1]; // Class name
- // Add overridden methods
- t.each(p, function(f, n) {
- // Extend methods if needed
- if (sp[n]) {
- ns[cn].prototype[n] = function() {
- this.parent = sp[n];
- return f.apply(this, arguments);
+ // Extend constructor
+ c = ns[cn];
+ if (de) {
+ // Add passthrough constructor
+ ns[cn] = function() {
+ return sp[scn].apply(this, arguments);
};
} else {
- if (n != cn)
- ns[cn].prototype[n] = f;
+ // Add inherit constructor
+ ns[cn] = function() {
+ this.parent = sp[scn];
+ return c.apply(this, arguments);
+ };
}
- });
- }
+ ns[cn].prototype[cn] = ns[cn];
- // Add static methods
- t.each(p['static'], function(f, n) {
- ns[cn][n] = f;
- });
+ // Add super methods
+ t.each(sp, function(f, n) {
+ ns[cn].prototype[n] = sp[n];
+ });
- if (this.onCreate)
- this.onCreate(s[2], s[3], ns[cn].prototype);
- },
+ // Add overridden methods
+ t.each(p, function(f, n) {
+ // Extend methods if needed
+ if (sp[n]) {
+ ns[cn].prototype[n] = function() {
+ this.parent = sp[n];
+ return f.apply(this, arguments);
+ };
+ } else {
+ if (n != cn)
+ ns[cn].prototype[n] = f;
+ }
+ });
+ }
- walk : function(o, f, n, s) {
- s = s || this;
+ // Add static methods
+ t.each(p['static'], function(f, n) {
+ ns[cn][n] = f;
+ });
- if (o) {
- if (n)
- o = o[n];
+ if (this.onCreate)
+ this.onCreate(s[2], s[3], ns[cn].prototype);
+ },
- tinymce.each(o, function(o, i) {
- if (f.call(s, o, i, n) === false)
- return false;
+ walk : function(o, f, n, s) {
+ s = s || this;
- tinymce.walk(o, f, n, s);
- });
- }
- },
+ if (o) {
+ if (n)
+ o = o[n];
+
+ tinymce.each(o, function(o, i) {
+ if (f.call(s, o, i, n) === false)
+ return false;
- createNS : function(n, o) {
- var i, v;
+ tinymce.walk(o, f, n, s);
+ });
+ }
+ },
- o = o || window;
+ createNS : function(n, o) {
+ var i, v;
- n = n.split('.');
- for (i=0; i<n.length; i++) {
- v = n[i];
+ o = o || win;
- if (!o[v])
- o[v] = {};
+ n = n.split('.');
+ for (i=0; i<n.length; i++) {
+ v = n[i];
- o = o[v];
- }
+ if (!o[v])
+ o[v] = {};
- return o;
- },
+ o = o[v];
+ }
- resolve : function(n, o) {
- var i, l;
+ return o;
+ },
- o = o || window;
+ resolve : function(n, o) {
+ var i, l;
- n = n.split('.');
- for (i = 0, l = n.length; i < l; i++) {
- o = o[n[i]];
+ o = o || win;
- if (!o)
- break;
- }
+ n = n.split('.');
+ for (i = 0, l = n.length; i < l; i++) {
+ o = o[n[i]];
- return o;
- },
+ if (!o)
+ break;
+ }
- addUnload : function(f, s) {
- var t = this, w = window;
+ return o;
+ },
- f = {func : f, scope : s || this};
+ addUnload : function(f, s) {
+ var t = this;
- if (!t.unloads) {
- function unload() {
- var li = t.unloads, o, n;
+ f = {func : f, scope : s || this};
- if (li) {
- // Call unload handlers
- for (n in li) {
- o = li[n];
+ if (!t.unloads) {
+ function unload() {
+ var li = t.unloads, o, n;
- if (o && o.func)
- o.func.call(o.scope, 1); // Send in one arg to distinct unload and user destroy
- }
+ if (li) {
+ // Call unload handlers
+ for (n in li) {
+ o = li[n];
- // Detach unload function
- if (w.detachEvent) {
- w.detachEvent('onbeforeunload', fakeUnload);
- w.detachEvent('onunload', unload);
- } else if (w.removeEventListener)
- w.removeEventListener('unload', unload, false);
+ if (o && o.func)
+ o.func.call(o.scope, 1); // Send in one arg to distinct unload and user destroy
+ }
- // Destroy references
- t.unloads = o = li = w = unload = 0;
+ // Detach unload function
+ if (win.detachEvent) {
+ win.detachEvent('onbeforeunload', fakeUnload);
+ win.detachEvent('onunload', unload);
+ } else if (win.removeEventListener)
+ win.removeEventListener('unload', unload, false);
- // Run garbarge collector on IE
- if (window.CollectGarbage)
- window.CollectGarbage();
- }
- };
+ // Destroy references
+ t.unloads = o = li = w = unload = 0;
- function fakeUnload() {
- var d = document;
+ // Run garbarge collector on IE
+ if (win.CollectGarbage)
+ CollectGarbage();
+ }
+ };
- // Is there things still loading, then do some magic
- if (d.readyState == 'interactive') {
- function stop() {
- // Prevent memory leak
- d.detachEvent('onstop', stop);
+ function fakeUnload() {
+ var d = document;
- // Call unload handler
- if (unload)
- unload();
+ // Is there things still loading, then do some magic
+ if (d.readyState == 'interactive') {
+ function stop() {
+ // Prevent memory leak
+ d.detachEvent('onstop', stop);
- d = 0;
- };
+ // Call unload handler
+ if (unload)
+ unload();
- // Fire unload when the currently loading page is stopped
- if (d)
- d.attachEvent('onstop', stop);
+ d = 0;
+ };
- // Remove onstop listener after a while to prevent the unload function
- // to execute if the user presses cancel in an onbeforeunload
- // confirm dialog and then presses the browser stop button
- window.setTimeout(function() {
+ // Fire unload when the currently loading page is stopped
if (d)
- d.detachEvent('onstop', stop);
- }, 0);
- }
- };
+ d.attachEvent('onstop', stop);
+
+ // Remove onstop listener after a while to prevent the unload function
+ // to execute if the user presses cancel in an onbeforeunload
+ // confirm dialog and then presses the browser stop button
+ win.setTimeout(function() {
+ if (d)
+ d.detachEvent('onstop', stop);
+ }, 0);
+ }
+ };
- // Attach unload handler
- if (w.attachEvent) {
- w.attachEvent('onunload', unload);
- w.attachEvent('onbeforeunload', fakeUnload);
- } else if (w.addEventListener)
- w.addEventListener('unload', unload, false);
+ // Attach unload handler
+ if (win.attachEvent) {
+ win.attachEvent('onunload', unload);
+ win.attachEvent('onbeforeunload', fakeUnload);
+ } else if (win.addEventListener)
+ win.addEventListener('unload', unload, false);
- // Setup initial unload handler array
- t.unloads = [f];
- } else
- t.unloads.push(f);
+ // Setup initial unload handler array
+ t.unloads = [f];
+ } else
+ t.unloads.push(f);
- return f;
- },
+ return f;
+ },
- removeUnload : function(f) {
- var u = this.unloads, r = null;
+ removeUnload : function(f) {
+ var u = this.unloads, r = null;
- tinymce.each(u, function(o, i) {
- if (o && o.func == f) {
- u.splice(i, 1);
- r = f;
- return false;
- }
- });
+ tinymce.each(u, function(o, i) {
+ if (o && o.func == f) {
+ u.splice(i, 1);
+ r = f;
+ return false;
+ }
+ });
- return r;
- },
+ return r;
+ },
- explode : function(s, d) {
- return s ? tinymce.map(s.split(d || ','), tinymce.trim) : s;
- },
+ explode : function(s, d) {
+ return s ? tinymce.map(s.split(d || ','), tinymce.trim) : s;
+ },
- _addVer : function(u) {
- var v;
+ _addVer : function(u) {
+ var v;
- if (!this.query)
- return u;
+ if (!this.query)
+ return u;
- v = (u.indexOf('?') == -1 ? '?' : '&') + this.query;
+ v = (u.indexOf('?') == -1 ? '?' : '&') + this.query;
- if (u.indexOf('#') == -1)
- return u + v;
+ if (u.indexOf('#') == -1)
+ return u + v;
- return u.replace('#', v + '#');
- }
+ return u.replace('#', v + '#');
+ }
- };
+ };
+
+ // Initialize the API
+ tinymce._init();
+
+ // Expose tinymce namespace to the global namespace (window)
+ win.tinymce = win.tinyMCE = tinymce;
+})(window);
-// Required for GZip AJAX loading
-window.tinymce = tinymce;
-// Initialize the API
-tinymce._init();
tinymce.create('tinymce.util.Dispatcher', {
scope : null,
listeners : null,
@@ -483,6 +490,7 @@ tinymce.create('tinymce.util.Dispatcher', {
}
});
+
(function() {
var each = tinymce.each;
@@ -723,6 +731,7 @@ tinymce.create('tinymce.util.Dispatcher', {
}
});
})();
+
(function() {
var each = tinymce.each;
@@ -793,6 +802,7 @@ tinymce.create('tinymce.util.Dispatcher', {
}
});
})();
+
tinymce.create('static tinymce.util.JSON', {
serialize : function(o) {
var i, v, s = tinymce.util.JSON.serialize, t;
@@ -845,6 +855,7 @@ tinymce.create('static tinymce.util.JSON', {
}
});
+
tinymce.create('static tinymce.util.XHR', {
send : function(o) {
var x, t, w = window, c = 0;
@@ -903,6 +914,7 @@ tinymce.create('static tinymce.util.XHR', {
}
}
});
+
(function() {
var extend = tinymce.extend, JSON = tinymce.util.JSON, XHR = tinymce.util.XHR;
@@ -955,10 +967,31 @@ tinymce.create('static tinymce.util.XHR', {
}
}
});
-}());(function(tinymce) {
+}());
+(function(tinymce) {
// Shorten names
- var each = tinymce.each, is = tinymce.is;
- var isWebKit = tinymce.isWebKit, isIE = tinymce.isIE;
+ var each = tinymce.each,
+ is = tinymce.is,
+ isWebKit = tinymce.isWebKit,
+ isIE = tinymce.isIE,
+ blockRe = /^(H[1-6R]|P|DIV|ADDRESS|PRE|FORM|T(ABLE|BODY|HEAD|FOOT|H|R|D)|LI|OL|UL|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|MENU|ISINDEX|SAMP)$/,
+ boolAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'),
+ mceAttribs = makeMap('src,href,style,coords,shape'),
+ encodedChars = {'&' : '&amp;', '"' : '&quot;', '<' : '&lt;', '>' : '&gt;'},
+ encodeCharsRe = /[<>&\"]/g,
+ simpleSelectorRe = /^([a-z0-9],?)+$/i,
+ tagRegExp = /<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)(\s*\/?)>/g,
+ attrRegExp = /(\w+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
+
+ function makeMap(str) {
+ var map = {}, i;
+
+ str = str.split(',');
+ for (i = str.length; i >= 0; i--)
+ map[str[i]] = 1;
+
+ return map;
+ };
tinymce.create('tinymce.dom.DOMUtils', {
doc : null,
@@ -981,7 +1014,7 @@ tinymce.create('static tinymce.util.XHR', {
},
DOMUtils : function(d, s) {
- var t = this;
+ var t = this, globalStyle;
t.doc = d;
t.win = window;
@@ -1006,6 +1039,16 @@ tinymce.create('static tinymce.util.XHR', {
}
}
+ // Build styles list
+ if (s.valid_styles) {
+ t._styles = {};
+
+ // Convert styles into a rule list
+ each(s.valid_styles, function(value, key) {
+ t._styles[key] = tinymce.explode(value);
+ });
+ }
+
tinymce.addUnload(t.destroy, t);
},
@@ -1140,8 +1183,30 @@ tinymce.create('static tinymce.util.XHR', {
return tinymce.dom.Sizzle(pa, t.get(s) || t.get(t.settings.root_element) || t.doc, []);
},
- is : function(n, patt) {
- return tinymce.dom.Sizzle.matches(patt, n.nodeType ? [n] : n).length > 0;
+ is : function(n, selector) {
+ var i;
+
+ // If it isn't an array then try to do some simple selectors instead of Sizzle for to boost performance
+ if (n.length === undefined) {
+ // Simple all selector
+ if (selector === '*')
+ return n.nodeType == 1;
+
+ // Simple selector just elements
+ if (simpleSelectorRe.test(selector)) {
+ selector = selector.toLowerCase().split(/,/);
+ n = n.nodeName.toLowerCase();
+
+ for (i = selector.length - 1; i >= 0; i--) {
+ if (selector[i] == n)
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ return tinymce.dom.Sizzle.matches(selector, n.nodeType ? [n] : n).length > 0;
},
@@ -1185,38 +1250,26 @@ tinymce.create('static tinymce.util.XHR', {
return o + ' />';
},
- remove : function(n, k) {
- var t = this;
-
- return this.run(n, function(n) {
- var p, g, i;
+ remove : function(node, keep_children) {
+ return this.run(node, function(node) {
+ var parent, child;
- p = n.parentNode;
+ parent = node.parentNode;
- if (!p)
+ if (!parent)
return null;
- if (k) {
- for (i = n.childNodes.length - 1; i >= 0; i--)
- t.insertAfter(n.childNodes[i], n);
-
- //each(n.childNodes, function(c) {
- // p.insertBefore(c.cloneNode(true), n);
- //});
- }
-
- // Fix IE psuedo leak
- if (t.fixPsuedoLeaks) {
- p = n.cloneNode(true);
- k = 'IELeakGarbageBin';
- g = t.get(k) || t.add(t.doc.body, 'div', {id : k, style : 'display:none'});
- g.appendChild(n);
- g.innerHTML = '';
-
- return p;
+ if (keep_children) {
+ while (child = node.firstChild) {
+ // IE 8 will crash if you don't remove completely empty text nodes
+ if (child.nodeType !== 3 || child.nodeValue)
+ parent.insertBefore(child, node);
+ else
+ node.removeChild(child);
+ }
}
- return p.removeChild(n);
+ return parent.removeChild(node);
});
},
@@ -1261,7 +1314,7 @@ tinymce.create('static tinymce.util.XHR', {
// Force update of the style data
if (t.settings.update_styles)
- t.setAttrib(e, 'mce_style');
+ t.setAttrib(e, '_mce_style');
});
},
@@ -1344,9 +1397,9 @@ tinymce.create('static tinymce.util.XHR', {
// No mce_style for elements with these since they might get resized by the user
if (s.keep_values) {
if (v && !t._isRes(v))
- e.setAttribute('mce_style', v, 2);
+ e.setAttribute('_mce_style', v, 2);
else
- e.removeAttribute('mce_style', 2);
+ e.removeAttribute('_mce_style', 2);
}
e.style.cssText = v;
@@ -1362,13 +1415,13 @@ tinymce.create('static tinymce.util.XHR', {
if (s.url_converter)
v = s.url_converter.call(s.url_converter_scope || t, v, n, e);
- t.setAttrib(e, 'mce_' + n, v, 2);
+ t.setAttrib(e, '_mce_' + n, v, 2);
}
break;
case "shape":
- e.setAttribute('mce_style', v);
+ e.setAttribute('_mce_style', v);
break;
}
@@ -1402,7 +1455,7 @@ tinymce.create('static tinymce.util.XHR', {
// Try the mce variant for these
if (/^(src|href|style|coords|shape)$/.test(n)) {
- v = e.getAttribute("mce_" + n);
+ v = e.getAttribute("_mce_" + n);
if (v)
return v;
@@ -1432,10 +1485,10 @@ tinymce.create('static tinymce.util.XHR', {
v = v || e.style.cssText;
if (v) {
- v = t.serializeStyle(t.parseStyle(v));
+ v = t.serializeStyle(t.parseStyle(v), e.nodeName);
if (t.settings.keep_values && !t._isRes(v))
- e.setAttribute('mce_style', v);
+ e.setAttribute('_mce_style', v);
}
}
@@ -1645,15 +1698,23 @@ tinymce.create('static tinymce.util.XHR', {
return o;
},
- serializeStyle : function(o) {
- var s = '';
+ serializeStyle : function(o, name) {
+ var t = this, s = '';
- each(o, function(v, k) {
+ function add(v, k) {
if (k && v) {
- if (tinymce.isGecko && k.indexOf('-moz-') === 0)
+ // Remove browser specific styles like -moz- or -webkit-
+ if (k.indexOf('-') === 0)
return;
switch (k) {
+ case 'font-weight':
+ // Opera will output bold as 700
+ if (v == 700)
+ v = 'bold';
+
+ break;
+
case 'color':
case 'background-color':
v = v.toLowerCase();
@@ -1662,7 +1723,19 @@ tinymce.create('static tinymce.util.XHR', {
s += (s ? ' ' : '') + k + ': ' + v + ';';
}
- });
+ };
+
+ // Validate style output
+ if (name && t._styles) {
+ each(t._styles['*'], function(name) {
+ add(o[name], name);
+ });
+
+ each(t._styles[name.toLowerCase()], function(name) {
+ add(o[name], name);
+ });
+ } else
+ each(o, add);
return s;
},
@@ -1725,8 +1798,17 @@ tinymce.create('static tinymce.util.XHR', {
re = new RegExp("(^|\\s+)" + c + "(\\s+|$)", "g");
v = e.className.replace(re, ' ');
+ v = tinymce.trim(v != ' ' ? v : '');
- return e.className = tinymce.trim(v != ' ' ? v : '');
+ e.className = v;
+
+ // Empty class attr
+ if (!v) {
+ e.removeAttribute('class');
+ e.removeAttribute('className');
+ }
+
+ return v;
}
return e.className;
@@ -1770,6 +1852,10 @@ tinymce.create('static tinymce.util.XHR', {
if (isIE) {
function set() {
+ // Remove all child nodes
+ while (e.firstChild)
+ e.firstChild.removeNode();
+
try {
// IE will remove comments from the beginning
// unless you padd the contents with something
@@ -1779,10 +1865,6 @@ tinymce.create('static tinymce.util.XHR', {
// IE sometimes produces an unknown runtime error on innerHTML if it's an block element within a block element for example a div inside a p
// This seems to fix this problem
- // Remove all child nodes
- while (e.firstChild)
- e.firstChild.removeNode();
-
// Create new div with HTML contents and a BR infront to keep comments
x = t.create('div');
x.innerHTML = '<br />' + h;
@@ -1800,7 +1882,7 @@ tinymce.create('static tinymce.util.XHR', {
// DOM tree if contents like this <p><ul><li>Item 1</li></ul></p> is inserted
// It seems to be that IE doesn't like a root block element placed inside another root block element
if (t.settings.fix_ie_paragraphs)
- h = h.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi, '<p$1 mce_keep="true">&nbsp;</p>');
+ h = h.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi, '<p$1 _mce_keep="true">&nbsp;</p>');
set();
@@ -1811,12 +1893,12 @@ tinymce.create('static tinymce.util.XHR', {
n = nl[i];
if (!n.hasChildNodes()) {
- if (!n.mce_keep) {
+ if (!n._mce_keep) {
x = 1; // Is broken
break;
}
- n.removeAttribute('mce_keep');
+ n.removeAttribute('_mce_keep');
}
}
}
@@ -1825,13 +1907,13 @@ tinymce.create('static tinymce.util.XHR', {
if (x) {
// So if we replace the p elements with divs and mark them and then replace them back to paragraphs
// after we use innerHTML we can fix the DOM tree
- h = h.replace(/<p ([^>]+)>|<p>/ig, '<div $1 mce_tmp="1">');
+ h = h.replace(/<p ([^>]+)>|<p>/ig, '<div $1 _mce_tmp="1">');
h = h.replace(/<\/p>/g, '</div>');
// Set the new HTML with DIVs
set();
- // Replace all DIV elements with he mce_tmp attibute back to paragraphs
+ // Replace all DIV elements with the _mce_tmp attibute back to paragraphs
// This is needed since IE has a annoying bug see above for details
// This is a slow process but it has to be done. :(
if (t.settings.fix_ie_paragraphs) {
@@ -1840,7 +1922,7 @@ tinymce.create('static tinymce.util.XHR', {
n = nl[i];
// Is it a temp div
- if (n.mce_tmp) {
+ if (n._mce_tmp) {
// Create new paragraph
p = t.doc.createElement('p');
@@ -1848,7 +1930,7 @@ tinymce.create('static tinymce.util.XHR', {
n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi, function(a, b) {
var v;
- if (b !== 'mce_tmp') {
+ if (b !== '_mce_tmp') {
v = n.getAttribute(b);
if (!v && b === 'class')
@@ -1881,11 +1963,7 @@ tinymce.create('static tinymce.util.XHR', {
if (!s.process_html)
return h;
- // Convert strong and em to b and i in FF since it can't handle them
- if (tinymce.isGecko) {
- h = h.replace(/<(\/?)strong>|<strong( [^>]+)>/gi, '<$1b$2>');
- h = h.replace(/<(\/?)em>|<em( [^>]+)>/gi, '<$1i$2>');
- } else if (isIE) {
+ if (isIE) {
h = h.replace(/&apos;/g, '&#39;'); // IE can't handle apos
h = h.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi, ''); // IE doesn't handle default values correct
}
@@ -1893,7 +1971,7 @@ tinymce.create('static tinymce.util.XHR', {
// Fix some issues
h = h.replace(/<a( )([^>]+)\/>|<a\/>/gi, '<a$1$2></a>'); // Force open
- // Store away src and href in mce_src and mce_href since browsers mess them up
+ // Store away src and href in _mce_src and mce_href since browsers mess them up
if (s.keep_values) {
// Wrap scripts and styles in comments for serialization purposes
if (/<script|noscript|style/i.test(h)) {
@@ -1918,7 +1996,7 @@ tinymce.create('static tinymce.util.XHR', {
if (s.url_converter)
url = t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(url), 'src', 'script'));
- return 'mce_src="' + url + '"';
+ return '_mce_src="' + url + '"';
});
// Wrap text contents
@@ -1938,7 +2016,7 @@ tinymce.create('static tinymce.util.XHR', {
text = '<!--\nMCE_SCRIPT:' + (codeBlocks.length - 1) + '\n-->';
}
- return '<mce:style' + attribs + '>' + text + '</mce:style><style ' + attribs + ' mce_bogus="1">' + text + '</style>';
+ return '<mce:style' + attribs + '>' + text + '</mce:style><style ' + attribs + ' _mce_bogus="1">' + text + '</style>';
});
// Wrap noscript elements
@@ -1949,53 +2027,46 @@ tinymce.create('static tinymce.util.XHR', {
h = h.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g, '<!--[CDATA[$1]]-->');
- // Remove false bool attributes and force attributes into xhtml style attr="attr"
- h = h.replace(/<([\w:]+) [^>]*(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)[^>]*>/gi, function(val) {
- function handle(val, name, value) {
- // Remove false/0 attribs
- if (value === 'false' || value === '0')
- return '';
-
- return ' ' + name + '="' + name + '"';
- };
+ // This function processes the attributes in the HTML string to force boolean
+ // attributes to the attr="attr" format and convert style, src and href to _mce_ versions
+ function processTags(html) {
+ return html.replace(tagRegExp, function(match, elm_name, attrs, end) {
+ return '<' + elm_name + attrs.replace(attrRegExp, function(match, name, value, val2, val3) {
+ var mceValue;
- val = val.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=[\"]([^\"]+)[\"]/gi, handle); // W3C
- val = val.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=[\']([^\']+)[\']/gi, handle); // W3C
- val = val.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=([^\s\"\'>]+)/gi, handle); // IE
- val = val.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)([\s>])/gi, ' $1="$1"$2'); // Force attr="attr"
+ name = name.toLowerCase();
+ value = value || val2 || val3 || "";
- return val;
- });
+ // Treat boolean attributes
+ if (boolAttrs[name]) {
+ // false or 0 is treated as a missing attribute
+ if (value === 'false' || value === '0')
+ return;
- // Process all tags with src, href or style
- h = h.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi, function(a, n) {
- function handle(m, b, c) {
- var u = c;
+ return name + '="' + name + '"';
+ }
- // Tag already got a mce_ version
- if (a.indexOf('mce_' + b) != -1)
- return m;
+ // Is attribute one that needs special treatment
+ if (mceAttribs[name] && attrs.indexOf('_mce_' + name) == -1) {
+ mceValue = t.decode(value);
- if (b == 'style') {
- // No mce_style for elements with these since they might get resized by the user
- if (t._isRes(c))
- return m;
+ // Convert URLs to relative/absolute ones
+ if (s.url_converter && (name == "src" || name == "href"))
+ mceValue = s.url_converter.call(s.url_converter_scope || t, mceValue, name, elm_name);
- // Parse and serialize the style to convert for example uppercase styles like "BORDER: 1px"
- u = t.encode(t.serializeStyle(t.parseStyle(u)));
- } else if (b != 'coords' && b != 'shape') {
- if (s.url_converter)
- u = t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(c), b, n));
- }
+ // Process styles lowercases them and compresses them
+ if (name == 'style')
+ mceValue = t.serializeStyle(t.parseStyle(mceValue), name);
- return ' ' + b + '="' + c + '" mce_' + b + '="' + u + '"';
- };
+ return name + '="' + value + '"' + ' _mce_' + name + '="' + t.encode(mceValue) + '"';
+ }
- a = a.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi, handle); // W3C
- a = a.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi, handle); // W3C
+ return match;
+ }) + end + '>';
+ });
+ };
- return a.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi, handle); // IE
- });
+ h = processTags(h);
// Restore script blocks
h = h.replace(/MCE_SCRIPT:([0-9]+)/g, function(val, idx) {
@@ -2028,7 +2099,7 @@ tinymce.create('static tinymce.util.XHR', {
function setHTML(e, h, d) {
var n, tp;
-
+
tp = d.createElement("body");
tp.innerHTML = h;
@@ -2069,7 +2140,7 @@ tinymce.create('static tinymce.util.XHR', {
var e, n, v;
// Look for entities to decode
- if (/&[^;]+;/.test(s)) {
+ if (/&[\w#]+;/.test(s)) {
// Decode the entities using a div element not super efficient but less code
e = this.doc.createElement("div");
e.innerHTML = s;
@@ -2079,7 +2150,7 @@ tinymce.create('static tinymce.util.XHR', {
if (n) {
do {
v += n.nodeValue;
- } while (n.nextSibling);
+ } while (n = n.nextSibling);
}
return v || s;
@@ -2088,43 +2159,27 @@ tinymce.create('static tinymce.util.XHR', {
return s;
},
- encode : function(s) {
- return s ? ('' + s).replace(/[<>&\"]/g, function (c, b) {
- switch (c) {
- case '&':
- return '&amp;';
-
- case '"':
- return '&quot;';
-
- case '<':
- return '&lt;';
-
- case '>':
- return '&gt;';
- }
-
- return c;
- }) : s;
+ encode : function(str) {
+ return ('' + str).replace(encodeCharsRe, function(chr) {
+ return encodedChars[chr];
+ });
},
- insertAfter : function(n, r) {
- var t = this;
-
- r = t.get(r);
+ insertAfter : function(node, reference_node) {
+ reference_node = this.get(reference_node);
- return this.run(n, function(n) {
- var p, ns;
+ return this.run(node, function(node) {
+ var parent, nextSibling;
- p = r.parentNode;
- ns = r.nextSibling;
+ parent = reference_node.parentNode;
+ nextSibling = reference_node.nextSibling;
- if (ns)
- p.insertBefore(n, ns);
+ if (nextSibling)
+ parent.insertBefore(node, nextSibling);
else
- p.appendChild(n);
+ parent.appendChild(node);
- return n;
+ return node;
});
},
@@ -2134,7 +2189,7 @@ tinymce.create('static tinymce.util.XHR', {
n = n.nodeName || n;
- return /^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TH|TBODY|TR|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n);
+ return blockRe.test(n);
},
replace : function(n, o, k) {
@@ -2145,23 +2200,34 @@ tinymce.create('static tinymce.util.XHR', {
return t.run(o, function(o) {
if (k) {
- each(o.childNodes, function(c) {
- n.appendChild(c.cloneNode(true));
+ each(tinymce.grep(o.childNodes), function(c) {
+ n.appendChild(c);
});
}
- // Fix IE psuedo leak for elements since replacing elements if fairly common
- // Will break parentNode for some unknown reason
- if (t.fixPsuedoLeaks && o.nodeType === 1) {
- o.parentNode.insertBefore(n, o);
- t.remove(o);
- return n;
- }
-
return o.parentNode.replaceChild(n, o);
});
},
+ rename : function(elm, name) {
+ var t = this, newElm;
+
+ if (elm.nodeName != name.toUpperCase()) {
+ // Rename block element
+ newElm = t.create(name);
+
+ // Copy attribs to new block
+ each(t.getAttribs(elm), function(attr_node) {
+ t.setAttrib(newElm, attr_node.nodeName, t.getAttrib(elm, attr_node.nodeName));
+ });
+
+ // Replace block
+ t.replace(newElm, elm, 1);
+ }
+
+ return newElm || elm;
+ },
+
findCommonAncestor : function(a, b) {
var ps = a, pe;
@@ -2310,7 +2376,7 @@ tinymce.create('static tinymce.util.XHR', {
o.push({specified : 1, nodeName : 'selected'});
// It's crazy that this is faster in IE but it's because it returns all attributes all the time
- n.cloneNode(false).outerHTML.replace(/<\/?[\w:]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=\w+|>/gi, '').replace(/[\w:]+/gi, function(a) {
+ n.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi, '').replace(/[\w:\-]+/gi, function(a) {
o.push({specified : 1, nodeName : a});
});
@@ -2339,77 +2405,90 @@ tinymce.create('static tinymce.util.XHR', {
return d.createRange ? d.createRange() : new tinymce.dom.Range(this);
},
+ nodeIndex : function(node, normalized) {
+ var idx = 0, lastNodeType, nodeType;
+
+ if (node) {
+ for (lastNodeType = node.nodeType, node = node.previousSibling, lastNode = node; node; node = node.previousSibling) {
+ nodeType = node.nodeType;
+
+ // Handle normalization of text nodes
+ if (!normalized || nodeType != 3 || (lastNodeType != nodeType && node.nodeValue.length))
+ idx++;
+
+ lastNodeType = nodeType;
+ }
+ }
+
+ return idx;
+ },
+
split : function(pe, e, re) {
var t = this, r = t.createRng(), bef, aft, pa;
- // W3C valid browsers tend to leave empty nodes to the left/right side of the contents, this makes sence
- // but we don't want that in our code since it serves no purpose
+ // W3C valid browsers tend to leave empty nodes to the left/right side of the contents, this makes sense
+ // but we don't want that in our code since it serves no purpose for the end user
// For example if this is chopped:
// <p>text 1<span><b>CHOP</b></span>text 2</p>
// would produce:
// <p>text 1<span></span></p><b>CHOP</b><p><span></span>text 2</p>
// this function will then trim of empty edges and produce:
// <p>text 1</p><b>CHOP</b><p>text 2</p>
- function trimEdge(n, na) {
- n = n[na];
+ function trim(node) {
+ var i, children = node.childNodes;
- if (n && n[na] && n[na].nodeType == 1 && isEmpty(n[na]))
- t.remove(n[na]);
- };
+ if (node.nodeType == 1 && node.getAttribute('_mce_type') == 'bookmark')
+ return;
- function isEmpty(n) {
- n = t.getOuterHTML(n);
- n = n.replace(/<(img|hr|table)/gi, '-'); // Keep these convert them to - chars
- n = n.replace(/<[^>]+>/g, ''); // Remove all tags
+ for (i = children.length - 1; i >= 0; i--)
+ trim(children[i]);
- return n.replace(/[ \t\r\n]+|&nbsp;|&#160;/g, '') == '';
- };
+ if (node.nodeType != 9) {
+ // Keep non whitespace text nodes
+ if (node.nodeType == 3 && node.nodeValue.length > 0)
+ return;
- // Added until Gecko can create real HTML documents using implementation.createHTMLDocument
- // this is to future proof it if Gecko decides to implement the error checking for range methods.
- function nodeIndex(n) {
- var i = 0;
+ if (node.nodeType == 1) {
+ // If the only child is a bookmark then move it up
+ children = node.childNodes;
+ if (children.length == 1 && children[0] && children[0].nodeType == 1 && children[0].getAttribute('_mce_type') == 'bookmark')
+ node.parentNode.insertBefore(children[0], node);
- while (n.previousSibling) {
- i++;
- n = n.previousSibling;
+ // Keep non empty elements or img, hr etc
+ if (children.length || /^(br|hr|input|img)$/i.test(node.nodeName))
+ return;
+ }
+
+ t.remove(node);
}
- return i;
+ return node;
};
if (pe && e) {
// Get before chunk
- r.setStart(pe.parentNode, nodeIndex(pe));
- r.setEnd(e.parentNode, nodeIndex(e));
+ r.setStart(pe.parentNode, t.nodeIndex(pe));
+ r.setEnd(e.parentNode, t.nodeIndex(e));
bef = r.extractContents();
// Get after chunk
r = t.createRng();
- r.setStart(e.parentNode, nodeIndex(e) + 1);
- r.setEnd(pe.parentNode, nodeIndex(pe) + 1);
+ r.setStart(e.parentNode, t.nodeIndex(e) + 1);
+ r.setEnd(pe.parentNode, t.nodeIndex(pe) + 1);
aft = r.extractContents();
- // Insert chunks and remove parent
+ // Insert before chunk
pa = pe.parentNode;
+ pa.insertBefore(trim(bef), pe);
- // Remove right side edge of the before contents
- trimEdge(bef, 'lastChild');
-
- if (!isEmpty(bef))
- pa.insertBefore(bef, pe);
-
+ // Insert middle chunk
if (re)
pa.replaceChild(re, e);
else
pa.insertBefore(e, pe);
- // Remove left site edge of the after contents
- trimEdge(aft, 'firstChild');
-
- if (!isEmpty(aft))
- pa.insertBefore(aft, pe);
-
+ // Insert after chunk
+ pa.insertBefore(trim(aft), pe);
t.remove(pe);
return re || e;
@@ -2494,231 +2573,235 @@ tinymce.create('static tinymce.util.XHR', {
tinymce.DOM = new tinymce.dom.DOMUtils(document, {process_html : 0});
})(tinymce);
-(function(ns) {
- // Traverse constants
- var EXTRACT = 0, CLONE = 1, DELETE = 2, extend = tinymce.extend;
-
- function indexOf(child, parent) {
- var i, node;
-
- if (child.parentNode != parent)
- return -1;
-
- for (node = parent.firstChild, i = 0; node != child; node = node.nextSibling)
- i++;
-
- return i;
- };
-
- function nodeIndex(n) {
- var i = 0;
-
- while (n.previousSibling) {
- i++;
- n = n.previousSibling;
- }
-
- return i;
- };
-
- function getSelectedNode(container, offset) {
- var child;
-
- if (container.nodeType == 3 /* TEXT_NODE */)
- return container;
-
- if (offset < 0)
- return container;
-
- child = container.firstChild;
- while (child != null && offset > 0) {
- --offset;
- child = child.nextSibling;
- }
-
- if (child != null)
- return child;
-
- return container;
- };
+(function(ns) {
// Range constructor
function Range(dom) {
- var d = dom.doc;
-
- extend(this, {
- dom : dom,
-
+ var t = this,
+ doc = dom.doc,
+ EXTRACT = 0,
+ CLONE = 1,
+ DELETE = 2,
+ TRUE = true,
+ FALSE = false,
+ START_OFFSET = 'startOffset',
+ START_CONTAINER = 'startContainer',
+ END_CONTAINER = 'endContainer',
+ END_OFFSET = 'endOffset',
+ extend = tinymce.extend,
+ nodeIndex = dom.nodeIndex;
+
+ extend(t, {
// Inital states
- startContainer : d,
+ startContainer : doc,
startOffset : 0,
- endContainer : d,
+ endContainer : doc,
endOffset : 0,
- collapsed : true,
- commonAncestorContainer : d,
+ collapsed : TRUE,
+ commonAncestorContainer : doc,
// Range constants
START_TO_START : 0,
START_TO_END : 1,
END_TO_END : 2,
- END_TO_START : 3
+ END_TO_START : 3,
+
+ // Public methods
+ setStart : setStart,
+ setEnd : setEnd,
+ setStartBefore : setStartBefore,
+ setStartAfter : setStartAfter,
+ setEndBefore : setEndBefore,
+ setEndAfter : setEndAfter,
+ collapse : collapse,
+ selectNode : selectNode,
+ selectNodeContents : selectNodeContents,
+ compareBoundaryPoints : compareBoundaryPoints,
+ deleteContents : deleteContents,
+ extractContents : extractContents,
+ cloneContents : cloneContents,
+ insertNode : insertNode,
+ surroundContents : surroundContents,
+ cloneRange : cloneRange
});
- };
- // Add range methods
- extend(Range.prototype, {
- setStart : function(n, o) {
- this._setEndPoint(true, n, o);
- },
-
- setEnd : function(n, o) {
- this._setEndPoint(false, n, o);
- },
+ function setStart(n, o) {
+ _setEndPoint(TRUE, n, o);
+ };
- setStartBefore : function(n) {
- this.setStart(n.parentNode, nodeIndex(n));
- },
+ function setEnd(n, o) {
+ _setEndPoint(FALSE, n, o);
+ };
- setStartAfter : function(n) {
- this.setStart(n.parentNode, nodeIndex(n) + 1);
- },
+ function setStartBefore(n) {
+ setStart(n.parentNode, nodeIndex(n));
+ };
- setEndBefore : function(n) {
- this.setEnd(n.parentNode, nodeIndex(n));
- },
+ function setStartAfter(n) {
+ setStart(n.parentNode, nodeIndex(n) + 1);
+ };
- setEndAfter : function(n) {
- this.setEnd(n.parentNode, nodeIndex(n) + 1);
- },
+ function setEndBefore(n) {
+ setEnd(n.parentNode, nodeIndex(n));
+ };
- collapse : function(ts) {
- var t = this;
+ function setEndAfter(n) {
+ setEnd(n.parentNode, nodeIndex(n) + 1);
+ };
+ function collapse(ts) {
if (ts) {
- t.endContainer = t.startContainer;
- t.endOffset = t.startOffset;
+ t[END_CONTAINER] = t[START_CONTAINER];
+ t[END_OFFSET] = t[START_OFFSET];
} else {
- t.startContainer = t.endContainer;
- t.startOffset = t.endOffset;
+ t[START_CONTAINER] = t[END_CONTAINER];
+ t[START_OFFSET] = t[END_OFFSET];
}
- t.collapsed = true;
- },
+ t.collapsed = TRUE;
+ };
- selectNode : function(n) {
- this.setStartBefore(n);
- this.setEndAfter(n);
- },
+ function selectNode(n) {
+ setStartBefore(n);
+ setEndAfter(n);
+ };
- selectNodeContents : function(n) {
- this.setStart(n, 0);
- this.setEnd(n, n.nodeType === 1 ? n.childNodes.length : n.nodeValue.length);
- },
+ function selectNodeContents(n) {
+ setStart(n, 0);
+ setEnd(n, n.nodeType === 1 ? n.childNodes.length : n.nodeValue.length);
+ };
- compareBoundaryPoints : function(h, r) {
- var t = this, sc = t.startContainer, so = t.startOffset, ec = t.endContainer, eo = t.endOffset;
+ function compareBoundaryPoints(h, r) {
+ var sc = t[START_CONTAINER], so = t[START_OFFSET], ec = t[END_CONTAINER], eo = t[END_OFFSET];
// Check START_TO_START
if (h === 0)
- return t._compareBoundaryPoints(sc, so, sc, so);
+ return _compareBoundaryPoints(sc, so, sc, so);
// Check START_TO_END
if (h === 1)
- return t._compareBoundaryPoints(sc, so, ec, eo);
+ return _compareBoundaryPoints(sc, so, ec, eo);
// Check END_TO_END
if (h === 2)
- return t._compareBoundaryPoints(ec, eo, ec, eo);
+ return _compareBoundaryPoints(ec, eo, ec, eo);
// Check END_TO_START
if (h === 3)
- return t._compareBoundaryPoints(ec, eo, sc, so);
- },
+ return _compareBoundaryPoints(ec, eo, sc, so);
+ };
- deleteContents : function() {
- this._traverse(DELETE);
- },
+ function deleteContents() {
+ _traverse(DELETE);
+ };
- extractContents : function() {
- return this._traverse(EXTRACT);
- },
+ function extractContents() {
+ return _traverse(EXTRACT);
+ };
- cloneContents : function() {
- return this._traverse(CLONE);
- },
+ function cloneContents() {
+ return _traverse(CLONE);
+ };
- insertNode : function(n) {
- var t = this, nn, o;
+ function insertNode(n) {
+ var startContainer = this[START_CONTAINER],
+ startOffset = this[START_OFFSET], nn, o;
// Node is TEXT_NODE or CDATA
- if (n.nodeType === 3 || n.nodeType === 4) {
- nn = t.startContainer.splitText(t.startOffset);
- t.startContainer.parentNode.insertBefore(n, nn);
+ if ((startContainer.nodeType === 3 || startContainer.nodeType === 4) && startContainer.nodeValue) {
+ if (!startOffset) {
+ // At the start of text
+ startContainer.parentNode.insertBefore(n, startContainer);
+ } else if (startOffset >= startContainer.nodeValue.length) {
+ // At the end of text
+ dom.insertAfter(n, startContainer);
+ } else {
+ // Middle, need to split
+ nn = startContainer.splitText(startOffset);
+ startContainer.parentNode.insertBefore(n, nn);
+ }
} else {
// Insert element node
- if (t.startContainer.childNodes.length > 0)
- o = t.startContainer.childNodes[t.startOffset];
+ if (startContainer.childNodes.length > 0)
+ o = startContainer.childNodes[startOffset];
- t.startContainer.insertBefore(n, o);
+ if (o)
+ startContainer.insertBefore(n, o);
+ else
+ startContainer.appendChild(n);
}
- },
+ };
- surroundContents : function(n) {
- var t = this, f = t.extractContents();
+ function surroundContents(n) {
+ var f = t.extractContents();
t.insertNode(n);
n.appendChild(f);
t.selectNode(n);
- },
-
- cloneRange : function() {
- var t = this;
+ };
- return extend(new Range(t.dom), {
- startContainer : t.startContainer,
- startOffset : t.startOffset,
- endContainer : t.endContainer,
- endOffset : t.endOffset,
+ function cloneRange() {
+ return extend(new Range(dom), {
+ startContainer : t[START_CONTAINER],
+ startOffset : t[START_OFFSET],
+ endContainer : t[END_CONTAINER],
+ endOffset : t[END_OFFSET],
collapsed : t.collapsed,
commonAncestorContainer : t.commonAncestorContainer
});
- },
+ };
-/*
- detach : function() {
- // Not implemented
- },
-*/
- // Internal methods
+ // Private methods
- _isCollapsed : function() {
- return (this.startContainer == this.endContainer && this.startOffset == this.endOffset);
- },
+ function _getSelectedNode(container, offset) {
+ var child;
- _compareBoundaryPoints : function (containerA, offsetA, containerB, offsetB) {
+ if (container.nodeType == 3 /* TEXT_NODE */)
+ return container;
+
+ if (offset < 0)
+ return container;
+
+ child = container.firstChild;
+ while (child && offset > 0) {
+ --offset;
+ child = child.nextSibling;
+ }
+
+ if (child)
+ return child;
+
+ return container;
+ };
+
+ function _isCollapsed() {
+ return (t[START_CONTAINER] == t[END_CONTAINER] && t[START_OFFSET] == t[END_OFFSET]);
+ };
+
+ function _compareBoundaryPoints(containerA, offsetA, containerB, offsetB) {
var c, offsetC, n, cmnRoot, childA, childB;
- // In the first case the boundary-points have the same container. A is before B
- // if its offset is less than the offset of B, A is equal to B if its offset is
- // equal to the offset of B, and A is after B if its offset is greater than the
+ // In the first case the boundary-points have the same container. A is before B
+ // if its offset is less than the offset of B, A is equal to B if its offset is
+ // equal to the offset of B, and A is after B if its offset is greater than the
// offset of B.
if (containerA == containerB) {
- if (offsetA == offsetB) {
+ if (offsetA == offsetB)
return 0; // equal
- } else if (offsetA < offsetB) {
+
+ if (offsetA < offsetB)
return -1; // before
- } else {
- return 1; // after
- }
+
+ return 1; // after
}
- // In the second case a child node C of the container of A is an ancestor
- // container of B. In this case, A is before B if the offset of A is less than or
+ // In the second case a child node C of the container of A is an ancestor
+ // container of B. In this case, A is before B if the offset of A is less than or
// equal to the index of the child node C and A is after B otherwise.
c = containerB;
- while (c && c.parentNode != containerA) {
+ while (c && c.parentNode != containerA)
c = c.parentNode;
- }
+
if (c) {
offsetC = 0;
n = containerA.firstChild;
@@ -2728,15 +2811,14 @@ tinymce.create('static tinymce.util.XHR', {
n = n.nextSibling;
}
- if (offsetA <= offsetC) {
+ if (offsetA <= offsetC)
return -1; // before
- } else {
- return 1; // after
- }
+
+ return 1; // after
}
- // In the third case a child node C of the container of B is an ancestor container
- // of A. In this case, A is before B if the index of the child node C is less than
+ // In the third case a child node C of the container of B is an ancestor container
+ // of A. In this case, A is before B if the index of the child node C is less than
// the offset of B and A is after B otherwise.
c = containerA;
while (c && c.parentNode != containerB) {
@@ -2752,124 +2834,113 @@ tinymce.create('static tinymce.util.XHR', {
n = n.nextSibling;
}
- if (offsetC < offsetB) {
+ if (offsetC < offsetB)
return -1; // before
- } else {
- return 1; // after
- }
+
+ return 1; // after
}
- // In the fourth case, none of three other cases hold: the containers of A and B
- // are siblings or descendants of sibling nodes. In this case, A is before B if
+ // In the fourth case, none of three other cases hold: the containers of A and B
+ // are siblings or descendants of sibling nodes. In this case, A is before B if
// the container of A is before the container of B in a pre-order traversal of the
// Ranges' context tree and A is after B otherwise.
- cmnRoot = this.dom.findCommonAncestor(containerA, containerB);
+ cmnRoot = dom.findCommonAncestor(containerA, containerB);
childA = containerA;
- while (childA && childA.parentNode != cmnRoot) {
- childA = childA.parentNode;
- }
+ while (childA && childA.parentNode != cmnRoot)
+ childA = childA.parentNode;
- if (!childA) {
+ if (!childA)
childA = cmnRoot;
- }
childB = containerB;
- while (childB && childB.parentNode != cmnRoot) {
+ while (childB && childB.parentNode != cmnRoot)
childB = childB.parentNode;
- }
- if (!childB) {
+ if (!childB)
childB = cmnRoot;
- }
- if (childA == childB) {
+ if (childA == childB)
return 0; // equal
- }
n = cmnRoot.firstChild;
while (n) {
- if (n == childA) {
+ if (n == childA)
return -1; // before
- }
- if (n == childB) {
+ if (n == childB)
return 1; // after
- }
n = n.nextSibling;
}
- },
+ };
- _setEndPoint : function(st, n, o) {
- var t = this, ec, sc;
+ function _setEndPoint(st, n, o) {
+ var ec, sc;
if (st) {
- t.startContainer = n;
- t.startOffset = o;
+ t[START_CONTAINER] = n;
+ t[START_OFFSET] = o;
} else {
- t.endContainer = n;
- t.endOffset = o;
+ t[END_CONTAINER] = n;
+ t[END_OFFSET] = o;
}
- // If one boundary-point of a Range is set to have a root container
- // other than the current one for the Range, the Range is collapsed to
+ // If one boundary-point of a Range is set to have a root container
+ // other than the current one for the Range, the Range is collapsed to
// the new position. This enforces the restriction that both boundary-
// points of a Range must have the same root container.
- ec = t.endContainer;
+ ec = t[END_CONTAINER];
while (ec.parentNode)
ec = ec.parentNode;
- sc = t.startContainer;
+ sc = t[START_CONTAINER];
while (sc.parentNode)
sc = sc.parentNode;
- if (sc != ec) {
- t.collapse(st);
- } else {
- // The start position of a Range is guaranteed to never be after the
- // end position. To enforce this restriction, if the start is set to
- // be at a position after the end, the Range is collapsed to that
+ if (sc == ec) {
+ // The start position of a Range is guaranteed to never be after the
+ // end position. To enforce this restriction, if the start is set to
+ // be at a position after the end, the Range is collapsed to that
// position.
- if (t._compareBoundaryPoints(t.startContainer, t.startOffset, t.endContainer, t.endOffset) > 0)
+ if (_compareBoundaryPoints(t[START_CONTAINER], t[START_OFFSET], t[END_CONTAINER], t[END_OFFSET]) > 0)
t.collapse(st);
- }
-
- t.collapsed = t._isCollapsed();
- t.commonAncestorContainer = t.dom.findCommonAncestor(t.startContainer, t.endContainer);
- },
+ } else
+ t.collapse(st);
- // This code is heavily "inspired" by the Apache Xerces implementation. I hope they don't mind. :)
+ t.collapsed = _isCollapsed();
+ t.commonAncestorContainer = dom.findCommonAncestor(t[START_CONTAINER], t[END_CONTAINER]);
+ };
- _traverse : function(how) {
- var t = this, c, endContainerDepth = 0, startContainerDepth = 0, p, depthDiff, startNode, endNode, sp, ep;
+ function _traverse(how) {
+ var c, endContainerDepth = 0, startContainerDepth = 0, p, depthDiff, startNode, endNode, sp, ep;
- if (t.startContainer == t.endContainer)
- return t._traverseSameContainer(how);
+ if (t[START_CONTAINER] == t[END_CONTAINER])
+ return _traverseSameContainer(how);
- for (c = t.endContainer, p = c.parentNode; p != null; c = p, p = p.parentNode) {
- if (p == t.startContainer)
- return t._traverseCommonStartContainer(c, how);
+ for (c = t[END_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) {
+ if (p == t[START_CONTAINER])
+ return _traverseCommonStartContainer(c, how);
++endContainerDepth;
}
- for (c = t.startContainer, p = c.parentNode; p != null; c = p, p = p.parentNode) {
- if (p == t.endContainer)
- return t._traverseCommonEndContainer(c, how);
+ for (c = t[START_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) {
+ if (p == t[END_CONTAINER])
+ return _traverseCommonEndContainer(c, how);
++startContainerDepth;
}
depthDiff = startContainerDepth - endContainerDepth;
- startNode = t.startContainer;
+ startNode = t[START_CONTAINER];
while (depthDiff > 0) {
startNode = startNode.parentNode;
depthDiff--;
}
- endNode = t.endContainer;
+ endNode = t[END_CONTAINER];
while (depthDiff < 0) {
endNode = endNode.parentNode;
depthDiff++;
@@ -2881,47 +2952,47 @@ tinymce.create('static tinymce.util.XHR', {
endNode = ep;
}
- return t._traverseCommonAncestors(startNode, endNode, how);
- },
+ return _traverseCommonAncestors(startNode, endNode, how);
+ };
- _traverseSameContainer : function(how) {
- var t = this, frag, s, sub, n, cnt, sibling, xferNode;
+ function _traverseSameContainer(how) {
+ var frag, s, sub, n, cnt, sibling, xferNode;
if (how != DELETE)
- frag = t.dom.doc.createDocumentFragment();
+ frag = doc.createDocumentFragment();
// If selection is empty, just return the fragment
- if (t.startOffset == t.endOffset)
+ if (t[START_OFFSET] == t[END_OFFSET])
return frag;
// Text node needs special case handling
- if (t.startContainer.nodeType == 3 /* TEXT_NODE */) {
+ if (t[START_CONTAINER].nodeType == 3 /* TEXT_NODE */) {
// get the substring
- s = t.startContainer.nodeValue;
- sub = s.substring(t.startOffset, t.endOffset);
+ s = t[START_CONTAINER].nodeValue;
+ sub = s.substring(t[START_OFFSET], t[END_OFFSET]);
// set the original text node to its new value
if (how != CLONE) {
- t.startContainer.deleteData(t.startOffset, t.endOffset - t.startOffset);
+ t[START_CONTAINER].deleteData(t[START_OFFSET], t[END_OFFSET] - t[START_OFFSET]);
// Nothing is partially selected, so collapse to start point
- t.collapse(true);
+ t.collapse(TRUE);
}
if (how == DELETE)
- return null;
+ return;
- frag.appendChild(t.dom.doc.createTextNode(sub));
+ frag.appendChild(doc.createTextNode(sub));
return frag;
}
// Copy nodes between the start/end offsets.
- n = getSelectedNode(t.startContainer, t.startOffset);
- cnt = t.endOffset - t.startOffset;
+ n = _getSelectedNode(t[START_CONTAINER], t[START_OFFSET]);
+ cnt = t[END_OFFSET] - t[START_OFFSET];
while (cnt > 0) {
sibling = n.nextSibling;
- xferNode = t._traverseFullySelected(n, how);
+ xferNode = _traverseFullySelected(n, how);
if (frag)
frag.appendChild( xferNode );
@@ -2932,31 +3003,31 @@ tinymce.create('static tinymce.util.XHR', {
// Nothing is partially selected, so collapse to start point
if (how != CLONE)
- t.collapse(true);
+ t.collapse(TRUE);
return frag;
- },
+ };
- _traverseCommonStartContainer : function(endAncestor, how) {
- var t = this, frag, n, endIdx, cnt, sibling, xferNode;
+ function _traverseCommonStartContainer(endAncestor, how) {
+ var frag, n, endIdx, cnt, sibling, xferNode;
if (how != DELETE)
- frag = t.dom.doc.createDocumentFragment();
+ frag = doc.createDocumentFragment();
- n = t._traverseRightBoundary(endAncestor, how);
+ n = _traverseRightBoundary(endAncestor, how);
if (frag)
frag.appendChild(n);
- endIdx = indexOf(endAncestor, t.startContainer);
- cnt = endIdx - t.startOffset;
+ endIdx = nodeIndex(endAncestor);
+ cnt = endIdx - t[START_OFFSET];
if (cnt <= 0) {
- // Collapse to just before the endAncestor, which
+ // Collapse to just before the endAncestor, which
// is partially selected.
if (how != CLONE) {
t.setEndBefore(endAncestor);
- t.collapse(false);
+ t.collapse(FALSE);
}
return frag;
@@ -2965,7 +3036,7 @@ tinymce.create('static tinymce.util.XHR', {
n = endAncestor.previousSibling;
while (cnt > 0) {
sibling = n.previousSibling;
- xferNode = t._traverseFullySelected(n, how);
+ xferNode = _traverseFullySelected(n, how);
if (frag)
frag.insertBefore(xferNode, frag.firstChild);
@@ -2974,34 +3045,34 @@ tinymce.create('static tinymce.util.XHR', {
n = sibling;
}
- // Collapse to just before the endAncestor, which
+ // Collapse to just before the endAncestor, which
// is partially selected.
if (how != CLONE) {
t.setEndBefore(endAncestor);
- t.collapse(false);
+ t.collapse(FALSE);
}
return frag;
- },
+ };
- _traverseCommonEndContainer : function(startAncestor, how) {
- var t = this, frag, startIdx, n, cnt, sibling, xferNode;
+ function _traverseCommonEndContainer(startAncestor, how) {
+ var frag, startIdx, n, cnt, sibling, xferNode;
if (how != DELETE)
- frag = t.dom.doc.createDocumentFragment();
+ frag = doc.createDocumentFragment();
- n = t._traverseLeftBoundary(startAncestor, how);
+ n = _traverseLeftBoundary(startAncestor, how);
if (frag)
frag.appendChild(n);
- startIdx = indexOf(startAncestor, t.endContainer);
+ startIdx = nodeIndex(startAncestor);
++startIdx; // Because we already traversed it....
- cnt = t.endOffset - startIdx;
+ cnt = t[END_OFFSET] - startIdx;
n = startAncestor.nextSibling;
while (cnt > 0) {
sibling = n.nextSibling;
- xferNode = t._traverseFullySelected(n, how);
+ xferNode = _traverseFullySelected(n, how);
if (frag)
frag.appendChild(xferNode);
@@ -3012,25 +3083,25 @@ tinymce.create('static tinymce.util.XHR', {
if (how != CLONE) {
t.setStartAfter(startAncestor);
- t.collapse(true);
+ t.collapse(TRUE);
}
return frag;
- },
+ };
- _traverseCommonAncestors : function(startAncestor, endAncestor, how) {
- var t = this, n, frag, commonParent, startOffset, endOffset, cnt, sibling, nextSibling;
+ function _traverseCommonAncestors(startAncestor, endAncestor, how) {
+ var n, frag, commonParent, startOffset, endOffset, cnt, sibling, nextSibling;
if (how != DELETE)
- frag = t.dom.doc.createDocumentFragment();
+ frag = doc.createDocumentFragment();
- n = t._traverseLeftBoundary(startAncestor, how);
+ n = _traverseLeftBoundary(startAncestor, how);
if (frag)
frag.appendChild(n);
commonParent = startAncestor.parentNode;
- startOffset = indexOf(startAncestor, commonParent);
- endOffset = indexOf(endAncestor, commonParent);
+ startOffset = nodeIndex(startAncestor);
+ endOffset = nodeIndex(endAncestor);
++startOffset;
cnt = endOffset - startOffset;
@@ -3038,7 +3109,7 @@ tinymce.create('static tinymce.util.XHR', {
while (cnt > 0) {
nextSibling = sibling.nextSibling;
- n = t._traverseFullySelected(sibling, how);
+ n = _traverseFullySelected(sibling, how);
if (frag)
frag.appendChild(n);
@@ -3047,38 +3118,37 @@ tinymce.create('static tinymce.util.XHR', {
--cnt;
}
- n = t._traverseRightBoundary(endAncestor, how);
+ n = _traverseRightBoundary(endAncestor, how);
if (frag)
frag.appendChild(n);
if (how != CLONE) {
t.setStartAfter(startAncestor);
- t.collapse(true);
+ t.collapse(TRUE);
}
return frag;
- },
+ };
- _traverseRightBoundary : function(root, how) {
- var t = this, next = getSelectedNode(t.endContainer, t.endOffset - 1), parent, clonedParent, prevSibling, clonedChild, clonedGrandParent;
- var isFullySelected = next != t.endContainer;
+ function _traverseRightBoundary(root, how) {
+ var next = _getSelectedNode(t[END_CONTAINER], t[END_OFFSET] - 1), parent, clonedParent, prevSibling, clonedChild, clonedGrandParent, isFullySelected = next != t[END_CONTAINER];
if (next == root)
- return t._traverseNode(next, isFullySelected, false, how);
+ return _traverseNode(next, isFullySelected, FALSE, how);
parent = next.parentNode;
- clonedParent = t._traverseNode(parent, false, false, how);
+ clonedParent = _traverseNode(parent, FALSE, FALSE, how);
- while (parent != null) {
- while (next != null) {
+ while (parent) {
+ while (next) {
prevSibling = next.previousSibling;
- clonedChild = t._traverseNode(next, isFullySelected, false, how);
+ clonedChild = _traverseNode(next, isFullySelected, FALSE, how);
if (how != DELETE)
clonedParent.insertBefore(clonedChild, clonedParent.firstChild);
- isFullySelected = true;
+ isFullySelected = TRUE;
next = prevSibling;
}
@@ -3088,37 +3158,33 @@ tinymce.create('static tinymce.util.XHR', {
next = parent.previousSibling;
parent = parent.parentNode;
- clonedGrandParent = t._traverseNode(parent, false, false, how);
+ clonedGrandParent = _traverseNode(parent, FALSE, FALSE, how);
if (how != DELETE)
clonedGrandParent.appendChild(clonedParent);
clonedParent = clonedGrandParent;
}
+ };
- // should never occur
- return null;
- },
-
- _traverseLeftBoundary : function(root, how) {
- var t = this, next = getSelectedNode(t.startContainer, t.startOffset);
- var isFullySelected = next != t.startContainer, parent, clonedParent, nextSibling, clonedChild, clonedGrandParent;
+ function _traverseLeftBoundary(root, how) {
+ var next = _getSelectedNode(t[START_CONTAINER], t[START_OFFSET]), isFullySelected = next != t[START_CONTAINER], parent, clonedParent, nextSibling, clonedChild, clonedGrandParent;
if (next == root)
- return t._traverseNode(next, isFullySelected, true, how);
+ return _traverseNode(next, isFullySelected, TRUE, how);
parent = next.parentNode;
- clonedParent = t._traverseNode(parent, false, true, how);
+ clonedParent = _traverseNode(parent, FALSE, TRUE, how);
- while (parent != null) {
- while (next != null) {
+ while (parent) {
+ while (next) {
nextSibling = next.nextSibling;
- clonedChild = t._traverseNode(next, isFullySelected, true, how);
+ clonedChild = _traverseNode(next, isFullySelected, TRUE, how);
if (how != DELETE)
clonedParent.appendChild(clonedChild);
- isFullySelected = true;
+ isFullySelected = TRUE;
next = nextSibling;
}
@@ -3128,33 +3194,30 @@ tinymce.create('static tinymce.util.XHR', {
next = parent.nextSibling;
parent = parent.parentNode;
- clonedGrandParent = t._traverseNode(parent, false, true, how);
+ clonedGrandParent = _traverseNode(parent, FALSE, TRUE, how);
if (how != DELETE)
clonedGrandParent.appendChild(clonedParent);
clonedParent = clonedGrandParent;
}
+ };
- // should never occur
- return null;
- },
-
- _traverseNode : function(n, isFullySelected, isLeft, how) {
- var t = this, txtValue, newNodeValue, oldNodeValue, offset, newNode;
+ function _traverseNode(n, isFullySelected, isLeft, how) {
+ var txtValue, newNodeValue, oldNodeValue, offset, newNode;
if (isFullySelected)
- return t._traverseFullySelected(n, how);
+ return _traverseFullySelected(n, how);
if (n.nodeType == 3 /* TEXT_NODE */) {
txtValue = n.nodeValue;
if (isLeft) {
- offset = t.startOffset;
+ offset = t[START_OFFSET];
newNodeValue = txtValue.substring(offset);
oldNodeValue = txtValue.substring(0, offset);
} else {
- offset = t.endOffset;
+ offset = t[END_OFFSET];
newNodeValue = txtValue.substring(0, offset);
oldNodeValue = txtValue.substring(offset);
}
@@ -3163,102 +3226,64 @@ tinymce.create('static tinymce.util.XHR', {
n.nodeValue = oldNodeValue;
if (how == DELETE)
- return null;
+ return;
- newNode = n.cloneNode(false);
+ newNode = n.cloneNode(FALSE);
newNode.nodeValue = newNodeValue;
return newNode;
}
if (how == DELETE)
- return null;
-
- return n.cloneNode(false);
- },
+ return;
- _traverseFullySelected : function(n, how) {
- var t = this;
+ return n.cloneNode(FALSE);
+ };
+ function _traverseFullySelected(n, how) {
if (how != DELETE)
- return how == CLONE ? n.cloneNode(true) : n;
+ return how == CLONE ? n.cloneNode(TRUE) : n;
n.parentNode.removeChild(n);
- return null;
- }
- });
+ };
+ };
ns.Range = Range;
})(tinymce.dom);
+
(function() {
function Selection(selection) {
- var t = this, invisibleChar = '\uFEFF', range, lastIERng;
+ var t = this, invisibleChar = '\uFEFF', range, lastIERng, dom = selection.dom, TRUE = true, FALSE = false;
+ // Compares two IE specific ranges to see if they are different
+ // this method is useful when invalidating the cached selection range
function compareRanges(rng1, rng2) {
if (rng1 && rng2) {
// Both are control ranges and the selected element matches
if (rng1.item && rng2.item && rng1.item(0) === rng2.item(0))
- return 1;
+ return TRUE;
// Both are text ranges and the range matches
- if (rng1.isEqual && rng2.isEqual && rng2.isEqual(rng1))
- return 1;
+ if (rng1.isEqual && rng2.isEqual && rng2.isEqual(rng1)) {
+ // IE will say that the range is equal then produce an invalid argument exception
+ // if you perform specific operations in a keyup event. For example Ctrl+Del.
+ // This hack will invalidate the range cache if the exception occurs
+ try {
+ // Try accessing nextSibling will producer an invalid argument some times
+ range.startContainer.nextSibling;
+ return TRUE;
+ } catch (ex) {
+ // Ignore
+ }
+ }
}
- return 0;
+ return FALSE;
};
+ // Returns a W3C DOM compatible range object by using the IE Range API
function getRange() {
- var dom = selection.dom, ieRange = selection.getRng(), domRange = dom.createRng(), startPos, endPos, element, sc, ec, collapsed;
-
- function findIndex(element) {
- var nl = element.parentNode.childNodes, i;
-
- for (i = nl.length - 1; i >= 0; i--) {
- if (nl[i] == element)
- return i;
- }
-
- return -1;
- };
-
- function findEndPoint(start) {
- var rng = ieRange.duplicate(), parent, i, nl, n, offset = 0, index = 0, pos, tmpRng;
-
- // Insert marker character
- rng.collapse(start);
- parent = rng.parentElement();
- rng.pasteHTML(invisibleChar); // Needs to be a pasteHTML instead of .text = since IE has a bug with nodeValue
-
- // Find marker character
- nl = parent.childNodes;
- for (i = 0; i < nl.length; i++) {
- n = nl[i];
-
- // Calculate node index excluding text node fragmentation
- if (i > 0 && (n.nodeType !== 3 || nl[i - 1].nodeType !== 3))
- index++;
-
- // If text node then calculate offset
- if (n.nodeType === 3) {
- // Look for marker
- pos = n.nodeValue.indexOf(invisibleChar);
- if (pos !== -1) {
- offset += pos;
- break;
- }
-
- offset += n.nodeValue.length;
- } else
- offset = 0;
- }
-
- // Remove marker character
- rng.moveStart('character', -1);
- rng.text = '';
-
- return {index : index, offset : offset, parent : parent};
- };
+ var ieRange = selection.getRng(), domRange = dom.createRng(), ieRange2, element, collapsed, isMerged;
// If selection is outside the current document just return an empty range
element = ieRange.item ? ieRange.item(0) : ieRange.parentElement();
@@ -3267,61 +3292,98 @@ tinymce.create('static tinymce.util.XHR', {
// Handle control selection or text selection of a image
if (ieRange.item || !element.hasChildNodes()) {
- domRange.setStart(element.parentNode, findIndex(element));
+ domRange.setStart(element.parentNode, dom.nodeIndex(element));
domRange.setEnd(domRange.startContainer, domRange.startOffset + 1);
return domRange;
}
- // Check collapsed state
+ // Duplicare IE selection range and check if the range is collapsed
+ ieRange2 = ieRange.duplicate();
collapsed = selection.isCollapsed();
- // Find start and end pos index and offset
- startPos = findEndPoint(true);
- endPos = findEndPoint(false);
+ // Insert invisible start marker
+ ieRange.collapse();
+ ieRange.pasteHTML('<span id="_mce_start" style="display:none;line-height:0">' + invisibleChar + '</span>');
- // Normalize the elements to avoid fragmented dom
- startPos.parent.normalize();
- endPos.parent.normalize();
+ // Insert invisible end marker
+ if (!collapsed) {
+ ieRange2.collapse(FALSE);
+ ieRange2.pasteHTML('<span id="_mce_end" style="display:none;line-height:0">' + invisibleChar + '</span>');
+ }
+
+ // Sets the end point of the range by looking for the marker
+ // This method also merges the text nodes it splits so that
+ // the DOM doesn't get fragmented.
+ function setEndPoint(start) {
+ var container, offset, marker, sibling;
+
+ // Look for endpoint marker
+ marker = dom.get('_mce_' + (start ? 'start' : 'end'));
+ sibling = marker.previousSibling;
+
+ // Is marker after a text node
+ if (sibling && sibling.nodeType == 3) {
+ // Get container node and calc offset
+ container = sibling;
+ offset = container.nodeValue.length;
+ dom.remove(marker);
+
+ // Merge text nodes to reduce DOM fragmentation
+ sibling = container.nextSibling;
+ if (sibling && sibling.nodeType == 3) {
+ isMerged = TRUE;
+ container.appendData(sibling.nodeValue);
+ dom.remove(sibling);
+ }
+ } else {
+ sibling = marker.nextSibling;
- // Set start container and offset
- sc = startPos.parent.childNodes[Math.min(startPos.index, startPos.parent.childNodes.length - 1)];
+ // Is marker before a text node
+ if (sibling && sibling.nodeType == 3) {
+ container = sibling;
+ offset = 0;
+ } else {
+ // Is marker before an element
+ if (sibling)
+ offset = dom.nodeIndex(sibling) - 1;
+ else
+ offset = dom.nodeIndex(marker);
- if (sc.nodeType != 3)
- domRange.setStart(startPos.parent, startPos.index);
- else
- domRange.setStart(startPos.parent.childNodes[startPos.index], startPos.offset);
+ container = marker.parentNode;
+ }
- // Set end container and offset
- ec = endPos.parent.childNodes[Math.min(endPos.index, endPos.parent.childNodes.length - 1)];
+ dom.remove(marker);
+ }
- if (ec.nodeType != 3) {
- if (!collapsed)
- endPos.index++;
+ // Set start of range
+ if (start)
+ domRange.setStart(container, offset);
- domRange.setEnd(endPos.parent, endPos.index);
- } else
- domRange.setEnd(endPos.parent.childNodes[endPos.index], endPos.offset);
+ // Set end of range or automatically if it's collapsed to increase performance
+ if (!start || collapsed)
+ domRange.setEnd(container, offset);
+ };
- // If not collapsed then make sure offsets are valid
- if (!collapsed) {
- sc = domRange.startContainer;
- if (sc.nodeType == 1)
- domRange.setStart(sc, Math.min(domRange.startOffset, sc.childNodes.length));
+ // Set start of range
+ setEndPoint(TRUE);
- ec = domRange.endContainer;
- if (ec.nodeType == 1)
- domRange.setEnd(ec, Math.min(domRange.endOffset, ec.childNodes.length));
- }
+ // Set end of range if needed
+ if (!collapsed)
+ setEndPoint(FALSE);
- // Restore selection to new range
- t.addRange(domRange);
+ // Restore selection if the range contents was merged
+ // since the selection was then moved since the text nodes got changed
+ if (isMerged)
+ t.addRange(domRange);
return domRange;
};
this.addRange = function(rng) {
- var ieRng, body = selection.dom.doc.body, startPos, endPos, sc, so, ec, eo;
+ var ieRng, ieRng2, doc = selection.dom.doc, body = doc.body, startPos, endPos, sc, so, ec, eo, marker, lastIndex, skipStart, skipEnd;
+
+ this.destroy();
// Setup some shorter versions
sc = rng.startContainer;
@@ -3330,9 +3392,45 @@ tinymce.create('static tinymce.util.XHR', {
eo = rng.endOffset;
ieRng = body.createTextRange();
- // Find element
- sc = sc.nodeType == 1 ? sc.childNodes[Math.min(so, sc.childNodes.length - 1)] : sc;
- ec = ec.nodeType == 1 ? ec.childNodes[Math.min(so == eo ? eo : eo - 1, ec.childNodes.length - 1)] : ec;
+ // If document selection move caret to first node in document
+ if (sc == doc || ec == doc) {
+ ieRng = body.createTextRange();
+ ieRng.collapse();
+ ieRng.select();
+ return;
+ }
+
+ // If child index resolve it
+ if (sc.nodeType == 1 && sc.hasChildNodes()) {
+ lastIndex = sc.childNodes.length - 1;
+
+ // Index is higher that the child count then we need to jump over the start container
+ if (so > lastIndex) {
+ skipStart = 1;
+ sc = sc.childNodes[lastIndex];
+ } else
+ sc = sc.childNodes[so];
+
+ // Child was text node then move offset to start of it
+ if (sc.nodeType == 3)
+ so = 0;
+ }
+
+ // If child index resolve it
+ if (ec.nodeType == 1 && ec.hasChildNodes()) {
+ lastIndex = ec.childNodes.length - 1;
+
+ if (eo == 0) {
+ skipEnd = 1;
+ ec = ec.childNodes[0];
+ } else {
+ ec = ec.childNodes[Math.min(lastIndex, eo - 1)];
+
+ // Child was text node then move offset to end of text node
+ if (ec.nodeType == 3)
+ eo = ec.nodeValue.length;
+ }
+ }
// Single element selection
if (sc == ec && sc.nodeType == 1) {
@@ -3352,7 +3450,7 @@ tinymce.create('static tinymce.util.XHR', {
// If it's only containing a padding remove it so the caret remains
if (sc.innerHTML == invisibleChar) {
- ieRng.collapse(true);
+ ieRng.collapse(TRUE);
sc.removeChild(sc.firstChild);
}
}
@@ -3361,78 +3459,61 @@ tinymce.create('static tinymce.util.XHR', {
ieRng.collapse(eo <= rng.endContainer.childNodes.length - 1);
ieRng.select();
-
+ ieRng.scrollIntoView();
return;
}
- function getCharPos(container, offset) {
- var nodeVal, rng, pos;
-
- if (container.nodeType != 3)
- return -1;
-
- nodeVal = container.nodeValue;
- rng = body.createTextRange();
-
- // Insert marker at offset position
- container.nodeValue = nodeVal.substring(0, offset) + invisibleChar + nodeVal.substring(offset);
+ // Create range and marker
+ ieRng = body.createTextRange();
+ marker = doc.createElement('span');
+ marker.innerHTML = ' ';
- // Find char pos of marker and remove it
- rng.moveToElementText(container.parentNode);
- rng.findText(invisibleChar);
- pos = Math.abs(rng.moveStart('character', -0xFFFFF));
- container.nodeValue = nodeVal;
+ // Set start of range to startContainer/startOffset
+ if (sc.nodeType == 3) {
+ // Insert marker after/before startContainer
+ if (skipStart)
+ dom.insertAfter(marker, sc);
+ else
+ sc.parentNode.insertBefore(marker, sc);
- return pos;
- };
+ // Select marker the caret to offset position
+ ieRng.moveToElementText(marker);
+ marker.parentNode.removeChild(marker);
+ ieRng.move('character', so);
+ } else {
+ ieRng.moveToElementText(sc);
- // Collapsed range
- if (rng.collapsed) {
- pos = getCharPos(sc, so);
+ if (skipStart)
+ ieRng.collapse(FALSE);
+ }
- ieRng = body.createTextRange();
- ieRng.move('character', pos);
+ // If same text container then we can do a more simple move
+ if (sc == ec && sc.nodeType == 3) {
+ ieRng.moveEnd('character', eo - so);
ieRng.select();
-
+ ieRng.scrollIntoView();
return;
- } else {
- // If same text container
- if (sc == ec && sc.nodeType == 3) {
- startPos = getCharPos(sc, so);
-
- ieRng = body.createTextRange();
- ieRng.move('character', startPos);
- ieRng.moveEnd('character', eo - so);
- ieRng.select();
-
- return;
- }
-
- // Get caret positions
- startPos = getCharPos(sc, so);
- endPos = getCharPos(ec, eo);
- ieRng = body.createTextRange();
-
- // Move start of range to start character position or start element
- if (startPos == -1) {
- ieRng.moveToElementText(sc);
- startPos = 0;
- } else
- ieRng.move('character', startPos);
-
- // Move end of range to end character position or end element
- tmpRng = body.createTextRange();
-
- if (endPos == -1)
- tmpRng.moveToElementText(ec);
- else
- tmpRng.move('character', endPos);
+ }
- ieRng.setEndPoint('EndToEnd', tmpRng);
- ieRng.select();
+ // Set end of range to endContainer/endOffset
+ ieRng2 = body.createTextRange();
+ if (ec.nodeType == 3) {
+ // Insert marker after/before startContainer
+ ec.parentNode.insertBefore(marker, ec);
- return;
+ // Move selection to end marker and move caret to end offset
+ ieRng2.moveToElementText(marker);
+ marker.parentNode.removeChild(marker);
+ ieRng2.move('character', eo);
+ ieRng.setEndPoint('EndToStart', ieRng2);
+ } else {
+ ieRng2.moveToElementText(ec);
+ ieRng2.collapse(!!skipEnd);
+ ieRng.setEndPoint('EndToEnd', ieRng2);
}
+
+ ieRng.select();
+ ieRng.scrollIntoView();
};
this.getRangeAt = function() {
@@ -3452,12 +3533,86 @@ tinymce.create('static tinymce.util.XHR', {
// Destroy cached range and last IE range to avoid memory leaks
lastIERng = range = null;
};
+
+ // IE has an issue where you can't select/move the caret by clicking outside the body if the document is in standards mode
+ if (selection.dom.boxModel) {
+ (function() {
+ var doc = dom.doc, body = doc.body, started, startRng;
+
+ // Make HTML element unselectable since we are going to handle selection by hand
+ doc.documentElement.unselectable = TRUE;
+
+ // Return range from point or null if it failed
+ function rngFromPoint(x, y) {
+ var rng = body.createTextRange();
+
+ try {
+ rng.moveToPoint(x, y);
+ } catch (ex) {
+ // IE sometimes throws and exception, so lets just ignore it
+ rng = null;
+ }
+
+ return rng;
+ };
+
+ // Fires while the selection is changing
+ function selectionChange(e) {
+ var pointRng;
+
+ // Check if the button is down or not
+ if (e.button) {
+ // Create range from mouse position
+ pointRng = rngFromPoint(e.x, e.y);
+
+ if (pointRng) {
+ // Check if pointRange is before/after selection then change the endPoint
+ if (pointRng.compareEndPoints('StartToStart', startRng) > 0)
+ pointRng.setEndPoint('StartToStart', startRng);
+ else
+ pointRng.setEndPoint('EndToEnd', startRng);
+
+ pointRng.select();
+ }
+ } else
+ endSelection();
+ }
+
+ // Removes listeners
+ function endSelection() {
+ dom.unbind(doc, 'mouseup', endSelection);
+ dom.unbind(doc, 'mousemove', selectionChange);
+ started = 0;
+ };
+
+ // Detect when user selects outside BODY
+ dom.bind(doc, 'mousedown', function(e) {
+ if (e.target.nodeName === 'HTML') {
+ if (started)
+ endSelection();
+
+ started = 1;
+
+ // Setup start position
+ startRng = rngFromPoint(e.x, e.y);
+ if (startRng) {
+ // Listen for selection change events
+ dom.bind(doc, 'mouseup', endSelection);
+ dom.bind(doc, 'mousemove', selectionChange);
+
+ startRng.select();
+ }
+ }
+ });
+ })();
+ }
};
// Expose the selection object
tinymce.dom.TridentSelection = Selection;
})();
+
/*
* Sizzle CSS Selector Engine - v1.0
* Copyright 2009, The Dojo Foundation
@@ -4430,6 +4585,7 @@ window.tinymce.dom.Sizzle = Sizzle;
})();
+
(function(tinymce) {
// Shorten names
var each = tinymce.each, DOM = tinymce.DOM, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, Event;
@@ -4713,45 +4869,25 @@ window.tinymce.dom.Sizzle = Sizzle;
Event.destroy();
});
})(tinymce);
-(function(tinymce) {
- var each = tinymce.each;
-
- tinymce.create('tinymce.dom.Element', {
- Element : function(id, s) {
- var t = this, dom, el;
-
- s = s || {};
- t.id = id;
- t.dom = dom = s.dom || tinymce.DOM;
- t.settings = s;
-
- // Only IE leaks DOM references, this is a lot faster
- if (!tinymce.isIE)
- el = t.dom.get(t.id);
- each([
- 'getPos',
- 'getRect',
- 'getParent',
- 'add',
- 'setStyle',
- 'getStyle',
- 'setStyles',
- 'setAttrib',
- 'setAttribs',
- 'getAttrib',
- 'addClass',
- 'removeClass',
- 'hasClass',
- 'getOuterHTML',
- 'setOuterHTML',
- 'remove',
- 'show',
- 'hide',
- 'isHidden',
- 'setHTML',
- 'get'
- ], function(k) {
+(function(tinymce) {
+ tinymce.dom.Element = function(id, settings) {
+ var t = this, dom, el;
+
+ t.settings = settings = settings || {};
+ t.id = id;
+ t.dom = dom = settings.dom || tinymce.DOM;
+
+ // Only IE leaks DOM references, this is a lot faster
+ if (!tinymce.isIE)
+ el = dom.get(t.id);
+
+ tinymce.each(
+ ('getPos,getRect,getParent,add,setStyle,getStyle,setStyles,' +
+ 'setAttrib,setAttribs,getAttrib,addClass,removeClass,' +
+ 'hasClass,getOuterHTML,setOuterHTML,remove,show,hide,' +
+ 'isHidden,setHTML,get').split(/,/)
+ , function(k) {
t[k] = function() {
var a = [id], i;
@@ -4763,82 +4899,86 @@ window.tinymce.dom.Sizzle = Sizzle;
return a;
};
- });
- },
-
- on : function(n, f, s) {
- return tinymce.dom.Event.add(this.id, n, f, s);
- },
+ });
- getXY : function() {
- return {
- x : parseInt(this.getStyle('left')),
- y : parseInt(this.getStyle('top'))
- };
- },
+ tinymce.extend(t, {
+ on : function(n, f, s) {
+ return tinymce.dom.Event.add(t.id, n, f, s);
+ },
- getSize : function() {
- var n = this.dom.get(this.id);
+ getXY : function() {
+ return {
+ x : parseInt(t.getStyle('left')),
+ y : parseInt(t.getStyle('top'))
+ };
+ },
- return {
- w : parseInt(this.getStyle('width') || n.clientWidth),
- h : parseInt(this.getStyle('height') || n.clientHeight)
- };
- },
+ getSize : function() {
+ var n = dom.get(t.id);
- moveTo : function(x, y) {
- this.setStyles({left : x, top : y});
- },
+ return {
+ w : parseInt(t.getStyle('width') || n.clientWidth),
+ h : parseInt(t.getStyle('height') || n.clientHeight)
+ };
+ },
- moveBy : function(x, y) {
- var p = this.getXY();
+ moveTo : function(x, y) {
+ t.setStyles({left : x, top : y});
+ },
- this.moveTo(p.x + x, p.y + y);
- },
+ moveBy : function(x, y) {
+ var p = t.getXY();
- resizeTo : function(w, h) {
- this.setStyles({width : w, height : h});
- },
+ t.moveTo(p.x + x, p.y + y);
+ },
- resizeBy : function(w, h) {
- var s = this.getSize();
+ resizeTo : function(w, h) {
+ t.setStyles({width : w, height : h});
+ },
- this.resizeTo(s.w + w, s.h + h);
- },
+ resizeBy : function(w, h) {
+ var s = t.getSize();
- update : function(k) {
- var t = this, b, dom = t.dom;
+ t.resizeTo(s.w + w, s.h + h);
+ },
- if (tinymce.isIE6 && t.settings.blocker) {
- k = k || '';
+ update : function(k) {
+ var b;
- // Ignore getters
- if (k.indexOf('get') === 0 || k.indexOf('has') === 0 || k.indexOf('is') === 0)
- return;
+ if (tinymce.isIE6 && settings.blocker) {
+ k = k || '';
- // Remove blocker on remove
- if (k == 'remove') {
- dom.remove(t.blocker);
- return;
- }
+ // Ignore getters
+ if (k.indexOf('get') === 0 || k.indexOf('has') === 0 || k.indexOf('is') === 0)
+ return;
- if (!t.blocker) {
- t.blocker = dom.uniqueId();
- b = dom.add(t.settings.container || dom.getRoot(), 'iframe', {id : t.blocker, style : 'position:absolute;', frameBorder : 0, src : 'javascript:""'});
- dom.setStyle(b, 'opacity', 0);
- } else
- b = dom.get(t.blocker);
+ // Remove blocker on remove
+ if (k == 'remove') {
+ dom.remove(t.blocker);
+ return;
+ }
- dom.setStyle(b, 'left', t.getStyle('left', 1));
- dom.setStyle(b, 'top', t.getStyle('top', 1));
- dom.setStyle(b, 'width', t.getStyle('width', 1));
- dom.setStyle(b, 'height', t.getStyle('height', 1));
- dom.setStyle(b, 'display', t.getStyle('display', 1));
- dom.setStyle(b, 'zIndex', parseInt(t.getStyle('zIndex', 1) || 0) - 1);
+ if (!t.blocker) {
+ t.blocker = dom.uniqueId();
+ b = dom.add(settings.container || dom.getRoot(), 'iframe', {id : t.blocker, style : 'position:absolute;', frameBorder : 0, src : 'javascript:""'});
+ dom.setStyle(b, 'opacity', 0);
+ } else
+ b = dom.get(t.blocker);
+
+ dom.setStyles(b, {
+ left : t.getStyle('left', 1),
+ top : t.getStyle('top', 1),
+ width : t.getStyle('width', 1),
+ height : t.getStyle('height', 1),
+ display : t.getStyle('display', 1),
+ zIndex : parseInt(t.getStyle('zIndex', 1) || 0) - 1
+ });
+ }
}
- }
- });
+ });
+ };
})(tinymce);
+
(function(tinymce) {
function trimNl(s) {
return s.replace(/[\n\r]+/g, '');
@@ -4926,8 +5066,13 @@ window.tinymce.dom.Sizzle = Sizzle;
h += '<span id="__caret">_</span>';
// Delete and insert new node
- r.deleteContents();
- r.insertNode(t.getRng().createContextualFragment(h));
+ if (r.startContainer == d && r.endContainer == d) {
+ // WebKit will fail if the body is empty since the range is then invalid and it can't insert contents
+ d.body.innerHTML = h;
+ } else {
+ r.deleteContents();
+ r.insertNode(t.getRng().createContextualFragment(h));
+ }
// Move to caret marker
c = t.dom.get('__caret');
@@ -4935,14 +5080,9 @@ window.tinymce.dom.Sizzle = Sizzle;
// Make sure we wrap it compleatly, Opera fails with a simple select call
r = d.createRange();
r.setStartBefore(c);
- r.setEndAfter(c);
+ r.setEndBefore(c);
t.setRng(r);
- // Delete the marker, and hopefully the caret gets placed in the right location
- // Removed this since it seems to remove &nbsp; in FF and simply deleting it
- // doesn't seem to affect the caret position in any browser
- //d.execCommand('Delete', false, null);
-
// Remove the caret position
t.dom.remove('__caret');
} else {
@@ -4971,21 +5111,24 @@ window.tinymce.dom.Sizzle = Sizzle;
e = r.parentElement();
if (e && e.nodeName == 'BODY')
- return e.firstChild;
+ return e.firstChild || e;
return e;
} else {
e = r.startContainer;
- if (e.nodeName == 'BODY')
- return e.firstChild;
+ if (e.nodeType == 1 && e.hasChildNodes())
+ e = e.childNodes[Math.min(e.childNodes.length - 1, r.startOffset)];
+
+ if (e && e.nodeType == 3)
+ return e.parentNode;
- return t.dom.getParent(e, '*');
+ return e;
}
},
getEnd : function() {
- var t = this, r = t.getRng(), e;
+ var t = this, r = t.getRng(), e, eo;
if (isIE) {
if (r.item)
@@ -4996,333 +5139,282 @@ window.tinymce.dom.Sizzle = Sizzle;
e = r.parentElement();
if (e && e.nodeName == 'BODY')
- return e.lastChild;
+ return e.lastChild || e;
return e;
} else {
e = r.endContainer;
+ eo = r.endOffset;
+
+ if (e.nodeType == 1 && e.hasChildNodes())
+ e = e.childNodes[eo > 0 ? eo - 1 : eo];
- if (e.nodeName == 'BODY')
- return e.lastChild;
+ if (e && e.nodeType == 3)
+ return e.parentNode;
- return t.dom.getParent(e, '*');
+ return e;
}
},
- getBookmark : function(si) {
- var t = this, r = t.getRng(), tr, sx, sy, vp = t.dom.getViewPort(t.win), e, sp, bp, le, c = -0xFFFFFF, s, ro = t.dom.getRoot(), wb = 0, wa = 0, nv;
- sx = vp.x;
- sy = vp.y;
+ getBookmark : function(type, normalized) {
+ var t = this, dom = t.dom, rng, rng2, id, collapsed, name, element, index, chr = '\uFEFF', styles;
- // Simple bookmark fast but not as persistent
- if (si)
- return {rng : r, scrollX : sx, scrollY : sy};
+ function findIndex(name, element) {
+ var index = 0;
- // Handle IE
- if (isIE) {
- // Control selection
- if (r.item) {
- e = r.item(0);
-
- each(t.dom.select(e.nodeName), function(n, i) {
- if (e == n) {
- sp = i;
- return false;
- }
- });
+ each(dom.select(name), function(node, i) {
+ if (node == element)
+ index = i;
+ });
- return {
- tag : e.nodeName,
- index : sp,
- scrollX : sx,
- scrollY : sy
- };
- }
+ return index;
+ };
- // Text selection
- tr = t.dom.doc.body.createTextRange();
- tr.moveToElementText(ro);
- tr.collapse(true);
- bp = Math.abs(tr.move('character', c));
+ if (type == 2) {
+ function getLocation() {
+ var rng = t.getRng(true), root = dom.getRoot(), bookmark = {};
- tr = r.duplicate();
- tr.collapse(true);
- sp = Math.abs(tr.move('character', c));
+ function getPoint(rng, start) {
+ var container = rng[start ? 'startContainer' : 'endContainer'],
+ offset = rng[start ? 'startOffset' : 'endOffset'], point = [], childNodes, after = 0;
- tr = r.duplicate();
- tr.collapse(false);
- le = Math.abs(tr.move('character', c)) - sp;
+ if (container.nodeType == 3) {
+ if (normalized) {
+ for (node = container.previousSibling; node && node.nodeType == 3; node = node.previousSibling)
+ offset += node.nodeValue.length;
+ }
- return {
- start : sp - bp,
- length : le,
- scrollX : sx,
- scrollY : sy
- };
- }
+ point.push(offset);
+ } else {
+ childNodes = container.childNodes;
+
+ if (offset >= childNodes.length) {
+ after = 1;
+ offset = childNodes.length - 1;
+ }
- // Handle W3C
- e = t.getNode();
- s = t.getSel();
+ point.push(t.dom.nodeIndex(childNodes[offset], normalized) + after);
+ }
- if (!s)
- return null;
+ for (; container && container != root; container = container.parentNode)
+ point.push(t.dom.nodeIndex(container, normalized));
- // Image selection
- if (e && e.nodeName == 'IMG') {
- return {
- scrollX : sx,
- scrollY : sy
- };
- }
+ return point;
+ };
- // Text selection
+ bookmark.start = getPoint(rng, true);
- function getPos(r, sn, en) {
- var w = t.dom.doc.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {};
+ if (!t.isCollapsed())
+ bookmark.end = getPoint(rng);
- while ((n = w.nextNode()) != null) {
- if (n == sn)
- d.start = p;
+ return bookmark;
+ };
- if (n == en) {
- d.end = p;
- return d;
- }
+ return getLocation();
+ }
- p += trimNl(n.nodeValue || '').length;
- }
+ // Handle simple range
+ if (type)
+ return {rng : t.getRng()};
- return null;
- };
+ rng = t.getRng();
+ id = dom.uniqueId();
+ collapsed = tinyMCE.activeEditor.selection.isCollapsed();
+ styles = 'overflow:hidden;line-height:0px';
- // Caret or selection
- if (s.anchorNode == s.focusNode && s.anchorOffset == s.focusOffset) {
- e = getPos(ro, s.anchorNode, s.focusNode);
+ // Explorer method
+ if (rng.duplicate || rng.item) {
+ // Text selection
+ if (!rng.item) {
+ rng2 = rng.duplicate();
- if (!e)
- return {scrollX : sx, scrollY : sy};
+ // Insert start marker
+ rng.collapse();
+ rng.pasteHTML('<span _mce_type="bookmark" id="' + id + '_start" style="' + styles + '">' + chr + '</span>');
- // Count whitespace before
- trimNl(s.anchorNode.nodeValue || '').replace(/^\s+/, function(a) {wb = a.length;});
+ // Insert end marker
+ if (!collapsed) {
+ rng2.collapse(false);
+ rng2.pasteHTML('<span _mce_type="bookmark" id="' + id + '_end" style="' + styles + '">' + chr + '</span>');
+ }
+ } else {
+ // Control selection
+ element = rng.item(0);
+ name = element.nodeName;
- return {
- start : Math.max(e.start + s.anchorOffset - wb, 0),
- end : Math.max(e.end + s.focusOffset - wb, 0),
- scrollX : sx,
- scrollY : sy,
- beg : s.anchorOffset - wb == 0
- };
+ return {name : name, index : findIndex(name, element)};
+ }
} else {
- e = getPos(ro, r.startContainer, r.endContainer);
+ element = t.getNode();
+ name = element.nodeName;
+ if (name == 'IMG')
+ return {name : name, index : findIndex(name, element)};
- // Count whitespace before start and end container
- //(r.startContainer.nodeValue || '').replace(/^\s+/, function(a) {wb = a.length;});
- //(r.endContainer.nodeValue || '').replace(/^\s+/, function(a) {wa = a.length;});
+ // W3C method
+ rng2 = rng.cloneRange();
- if (!e)
- return {scrollX : sx, scrollY : sy};
+ // Insert end marker
+ if (!collapsed) {
+ rng2.collapse(false);
+ rng2.insertNode(dom.create('span', {_mce_type : "bookmark", id : id + '_end', style : styles}, chr));
+ }
- return {
- start : Math.max(e.start + r.startOffset - wb, 0),
- end : Math.max(e.end + r.endOffset - wa, 0),
- scrollX : sx,
- scrollY : sy,
- beg : r.startOffset - wb == 0
- };
+ rng.collapse(true);
+ rng.insertNode(dom.create('span', {_mce_type : "bookmark", id : id + '_start', style : styles}, chr));
}
- },
-
- moveToBookmark : function(b) {
- var t = this, r = t.getRng(), s = t.getSel(), ro = t.dom.getRoot(), sd, nvl, nv;
-
- function getPos(r, sp, ep) {
- var w = t.dom.doc.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {}, o, v, wa, wb;
- while ((n = w.nextNode()) != null) {
- wa = wb = 0;
+ t.moveToBookmark({id : id, keep : 1});
- nv = n.nodeValue || '';
- //nv.replace(/^\s+[^\s]/, function(a) {wb = a.length - 1;});
- //nv.replace(/[^\s]\s+$/, function(a) {wa = a.length - 1;});
+ return {id : id};
+ },
- nvl = trimNl(nv).length;
- p += nvl;
+ moveToBookmark : function(bookmark) {
+ var t = this, dom = t.dom, marker1, marker2, rng, root;
- if (p >= sp && !d.startNode) {
- o = sp - (p - nvl);
+ // Clear selection cache
+ if (t.tridentSel)
+ t.tridentSel.destroy();
- // Fix for odd quirk in FF
- if (b.beg && o >= nvl)
- continue;
+ if (bookmark) {
+ if (bookmark.start) {
+ rng = dom.createRng();
+ root = dom.getRoot();
- d.startNode = n;
- d.startOffset = o + wb;
- }
+ function setEndPoint(start) {
+ var point = bookmark[start ? 'start' : 'end'], i, node, offset;
- if (p >= ep) {
- d.endNode = n;
- d.endOffset = ep - (p - nvl) + wb;
- return d;
- }
- }
+ if (point) {
+ // Find container node
+ for (node = root, i = point.length - 1; i >= 1; i--)
+ node = node.childNodes[point[i]];
- return null;
- };
+ // Set offset within container node
+ if (start)
+ rng.setStart(node, point[0]);
+ else
+ rng.setEnd(node, point[0]);
+ }
+ };
- if (!b)
- return false;
+ setEndPoint(true);
+ setEndPoint();
- t.win.scrollTo(b.scrollX, b.scrollY);
+ t.setRng(rng);
+ } else if (bookmark.id) {
+ rng = dom.createRng();
- // Handle explorer
- if (isIE) {
- t.tridentSel.destroy();
+ function restoreEndPoint(suffix) {
+ var marker = dom.get(bookmark.id + '_' + suffix), node, idx, next, prev, keep = bookmark.keep;
- // Handle simple
- if (r = b.rng) {
- try {
- r.select();
- } catch (ex) {
- // Ignore
- }
+ if (marker) {
+ node = marker.parentNode;
- return true;
- }
-
- t.win.focus();
-
- // Handle control bookmark
- if (b.tag) {
- r = ro.createControlRange();
-
- each(t.dom.select(b.tag), function(n, i) {
- if (i == b.index)
- r.addElement(n);
- });
- } else {
- // Try/catch needed since this operation breaks when TinyMCE is placed in hidden divs/tabs
- try {
- // Incorrect bookmark
- if (b.start < 0)
- return true;
+ if (suffix == 'start') {
+ if (!keep) {
+ idx = dom.nodeIndex(marker);
+ } else {
+ node = marker;
+ idx = 1;
+ }
- r = s.createRange();
- r.moveToElementText(ro);
- r.collapse(true);
- r.moveStart('character', b.start);
- r.moveEnd('character', b.length);
- } catch (ex2) {
- return true;
- }
- }
+ rng.setStart(node, idx);
+ rng.setEnd(node, idx);
+ } else {
+ if (!keep) {
+ idx = dom.nodeIndex(marker);
+ } else {
+ node = marker;
+ idx = 1;
+ }
- try {
- r.select();
- } catch (ex) {
- // Needed for some odd IE bug #1843306
- }
+ rng.setEnd(node, idx);
+ }
- return true;
- }
+ if (!keep) {
+ prev = marker.previousSibling;
+ next = marker.nextSibling;
- // Handle W3C
- if (!s)
- return false;
+ // Remove all marker text nodes
+ each(tinymce.grep(marker.childNodes), function(node) {
+ if (node.nodeType == 3)
+ node.nodeValue = node.nodeValue.replace(/\uFEFF/g, '');
+ });
- // Handle simple
- if (b.rng) {
- s.removeAllRanges();
- s.addRange(b.rng);
- } else {
- if (is(b.start) && is(b.end)) {
- try {
- sd = getPos(ro, b.start, b.end);
-
- if (sd) {
- r = t.dom.doc.createRange();
- r.setStart(sd.startNode, sd.startOffset);
- r.setEnd(sd.endNode, sd.endOffset);
- s.removeAllRanges();
- s.addRange(r);
+ // Remove marker but keep children if for example contents where inserted into the marker
+ // Also remove duplicated instances of the marker for example by a split operation or by WebKit auto split on paste feature
+ while (marker = dom.get(bookmark.id + '_' + suffix))
+ dom.remove(marker, 1);
+
+ // If siblings are text nodes then merge them
+ if (prev && next && prev.nodeType == next.nodeType && prev.nodeType == 3) {
+ idx = prev.nodeValue.length;
+ prev.appendData(next.nodeValue);
+ dom.remove(next);
+
+ if (suffix == 'start') {
+ rng.setStart(prev, idx);
+ rng.setEnd(prev, idx);
+ } else
+ rng.setEnd(prev, idx);
+ }
+ }
}
+ };
- if (!tinymce.isOpera)
- t.win.focus();
- } catch (ex) {
- // Ignore
- }
- }
+ // Restore start/end points
+ restoreEndPoint('start');
+ restoreEndPoint('end');
+
+ t.setRng(rng);
+ } else if (bookmark.name) {
+ t.select(dom.select(bookmark.name)[bookmark.index]);
+ } else if (bookmark.rng)
+ t.setRng(bookmark.rng);
}
},
- select : function(n, c) {
- var t = this, r = t.getRng(), s = t.getSel(), b, fn, ln, d = t.win.document;
-
- function find(n, start) {
- var walker, o;
+ select : function(node, content) {
+ var t = this, dom = t.dom, rng = dom.createRng(), idx;
- if (n) {
- walker = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
+ idx = dom.nodeIndex(node);
+ rng.setStart(node.parentNode, idx);
+ rng.setEnd(node.parentNode, idx + 1);
- // Find first/last non empty text node
- while (n = walker.nextNode()) {
- o = n;
+ // Find first/last text node or BR element
+ if (content) {
+ function setPoint(node, start) {
+ var walker = new tinymce.dom.TreeWalker(node, node);
- if (tinymce.trim(n.nodeValue).length != 0) {
+ do {
+ // Text node
+ if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {
if (start)
- return n;
+ rng.setStart(node, 0);
else
- o = n;
- }
- }
- }
-
- return o;
- };
-
- if (isIE) {
- try {
- b = d.body;
-
- if (/^(IMG|TABLE)$/.test(n.nodeName)) {
- r = b.createControlRange();
- r.addElement(n);
- } else {
- r = b.createTextRange();
- r.moveToElementText(n);
- }
-
- r.select();
- } catch (ex) {
- // Throws illigal agrument in IE some times
- }
- } else {
- if (c) {
- fn = find(n, 1) || t.dom.select('br:first', n)[0];
- ln = find(n, 0) || t.dom.select('br:last', n)[0];
+ rng.setEnd(node, node.nodeValue.length);
- if (fn && ln) {
- r = d.createRange();
+ return;
+ }
- if (fn.nodeName == 'BR')
- r.setStartBefore(fn);
- else
- r.setStart(fn, 0);
+ // BR element
+ if (node.nodeName == 'BR') {
+ if (start)
+ rng.setStartBefore(node);
+ else
+ rng.setEndBefore(node);
- if (ln.nodeName == 'BR')
- r.setEndBefore(ln);
- else
- r.setEnd(ln, ln.nodeValue.length);
- } else
- r.selectNode(n);
- } else
- r.selectNode(n);
+ return;
+ }
+ } while (node = (start ? walker.next() : walker.prev()));
+ };
- t.setRng(r);
+ setPoint(node, 1);
+ setPoint(node);
}
- return n;
+ t.setRng(rng);
+
+ return node;
},
isCollapsed : function() {
@@ -5331,7 +5423,10 @@ window.tinymce.dom.Sizzle = Sizzle;
if (!r || r.item)
return false;
- return !s || r.boundingWidth == 0 || r.collapsed;
+ if (r.compareEndPoints)
+ return r.compareEndPoints('StartToEnd', r) === 0;
+
+ return !s || r.collapsed;
},
collapse : function(b) {
@@ -5412,33 +5507,36 @@ window.tinymce.dom.Sizzle = Sizzle;
},
getNode : function() {
- var t = this, r = t.getRng(), s = t.getSel(), e;
+ var t = this, rng = t.getRng(), sel = t.getSel(), elm;
if (!isIE) {
// Range maybe lost after the editor is made visible again
- if (!r)
+ if (!rng)
return t.dom.getRoot();
- e = r.commonAncestorContainer;
+ elm = rng.commonAncestorContainer;
// Handle selection a image or other control like element such as anchors
- if (!r.collapsed) {
- // If the anchor node is a element instead of a text node then return this element
- if (tinymce.isWebKit && s.anchorNode && s.anchorNode.nodeType == 1)
- return s.anchorNode.childNodes[s.anchorOffset];
-
- if (r.startContainer == r.endContainer) {
- if (r.startOffset - r.endOffset < 2) {
- if (r.startContainer.hasChildNodes())
- e = r.startContainer.childNodes[r.startOffset];
+ if (!rng.collapsed) {
+ if (rng.startContainer == rng.endContainer) {
+ if (rng.startOffset - rng.endOffset < 2) {
+ if (rng.startContainer.hasChildNodes())
+ elm = rng.startContainer.childNodes[rng.startOffset];
}
}
+
+ // If the anchor node is a element instead of a text node then return this element
+ if (tinymce.isWebKit && sel.anchorNode && sel.anchorNode.nodeType == 1)
+ return sel.anchorNode.childNodes[sel.anchorOffset];
}
- return t.dom.getParent(e, '*');
+ if (elm && elm.nodeType == 3)
+ return elm.parentNode;
+
+ return elm;
}
- return r.item ? r.item(0) : r.parentElement();
+ return rng.item ? rng.item(0) : rng.parentElement();
},
getSelectedBlocks : function(st, en) {
@@ -5479,6 +5577,7 @@ window.tinymce.dom.Sizzle = Sizzle;
}
});
})(tinymce);
+
(function(tinymce) {
tinymce.create('tinymce.dom.XMLWriter', {
node : null,
@@ -5570,6 +5669,7 @@ window.tinymce.dom.Sizzle = Sizzle;
}
});
})(tinymce);
+
(function(tinymce) {
tinymce.create('tinymce.dom.StringWriter', {
str : null,
@@ -5696,6 +5796,7 @@ window.tinymce.dom.Sizzle = Sizzle;
}
});
})(tinymce);
+
(function(tinymce) {
// Shorten names
var extend = tinymce.extend, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher, isIE = tinymce.isIE, isGecko = tinymce.isGecko;
@@ -5725,20 +5826,18 @@ window.tinymce.dom.Sizzle = Sizzle;
valid_nodes : 0,
node_filter : 0,
attr_filter : 0,
- invalid_attrs : /^(mce_|_moz_|sizset|sizcache)/,
+ invalid_attrs : /^(_mce_|_moz_|sizset|sizcache)/,
closed : /^(br|hr|input|meta|img|link|param|area)$/,
entity_encoding : 'named',
entities : '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,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',
valid_elements : '*[*]',
extended_valid_elements : 0,
- valid_child_elements : 0,
invalid_elements : 0,
fix_table_elements : 1,
fix_list_elements : true,
fix_content_duplication : true,
convert_fonts_to_spans : false,
font_size_classes : 0,
- font_size_style_values : 0,
apply_source_formatting : 0,
indent_mode : 'simple',
indent_char : '\t',
@@ -5749,6 +5848,11 @@ window.tinymce.dom.Sizzle = Sizzle;
}, s);
t.dom = s.dom;
+ t.schema = s.schema;
+
+ // Use raw entities if no entities are defined
+ if (s.entity_encoding == 'named' && !s.entities)
+ s.entity_encoding = 'raw';
if (s.remove_redundant_brs) {
t.onPostProcess.add(function(se, o) {
@@ -5832,7 +5936,7 @@ window.tinymce.dom.Sizzle = Sizzle;
},
setEntities : function(s) {
- var t = this, a, i, l = {}, re = '', v;
+ var t = this, a, i, l = {}, v;
// No need to setup more than once
if (t.entityLookup)
@@ -5850,94 +5954,11 @@ window.tinymce.dom.Sizzle = Sizzle;
l[String.fromCharCode(a[i])] = a[i + 1];
v = parseInt(a[i]).toString(16);
- re += '\\u' + '0000'.substring(v.length) + v;
- }
-
- if (!re) {
- t.settings.entity_encoding = 'raw';
- return;
}
- t.entitiesRE = new RegExp('[' + re + ']', 'g');
t.entityLookup = l;
},
- setValidChildRules : function(s) {
- this.childRules = null;
- this.addValidChildRules(s);
- },
-
- addValidChildRules : function(s) {
- var t = this, inst, intr, bloc;
-
- if (!s)
- return;
-
- inst = 'A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';
- intr = 'A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';
- bloc = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';
-
- each(s.split(','), function(s) {
- var p = s.split(/\[|\]/), re;
-
- s = '';
- each(p[1].split('|'), function(v) {
- if (s)
- s += '|';
-
- switch (v) {
- case '%itrans':
- v = intr;
- break;
-
- case '%itrans_na':
- v = intr.substring(2);
- break;
-
- case '%istrict':
- v = inst;
- break;
-
- case '%istrict_na':
- v = inst.substring(2);
- break;
-
- case '%btrans':
- v = bloc;
- break;
-
- case '%bstrict':
- v = bloc;
- break;
- }
-
- s += v;
- });
- re = new RegExp('^(' + s.toLowerCase() + ')$', 'i');
-
- each(p[0].split('/'), function(s) {
- t.childRules = t.childRules || {};
- t.childRules[s] = re;
- });
- });
-
- // Build regex
- s = '';
- each(t.childRules, function(v, k) {
- if (s)
- s += '|';
-
- s += k;
- });
-
- t.parentElementsRE = new RegExp('^(' + s.toLowerCase() + ')$', 'i');
-
- /*console.debug(t.parentElementsRE.toString());
- each(t.childRules, function(v) {
- console.debug(v.toString());
- });*/
- },
-
setRules : function(s) {
var t = this;
@@ -6204,6 +6225,7 @@ window.tinymce.dom.Sizzle = Sizzle;
// Serialize HTML DOM into a string
t.writer.reset();
+ t._info = o;
t._serializeNode(n, o.getInner);
// Post process
@@ -6296,18 +6318,28 @@ window.tinymce.dom.Sizzle = Sizzle;
o.content = h;
},
- _serializeNode : function(n, inn) {
- var t = this, s = t.settings, w = t.writer, hc, el, cn, i, l, a, at, no, v, nn, ru, ar, iv, closed;
+ _serializeNode : function(n, inner) {
+ var t = this, s = t.settings, w = t.writer, hc, el, cn, i, l, a, at, no, v, nn, ru, ar, iv, closed, keep, type;
if (!s.node_filter || s.node_filter(n)) {
switch (n.nodeType) {
case 1: // Element
- if (n.hasAttribute ? n.hasAttribute('mce_bogus') : n.getAttribute('mce_bogus'))
+ if (n.hasAttribute ? n.hasAttribute('_mce_bogus') : n.getAttribute('_mce_bogus'))
return;
- iv = false;
+ iv = keep = false;
hc = n.hasChildNodes();
- nn = n.getAttribute('mce_name') || n.nodeName.toLowerCase();
+ nn = n.getAttribute('_mce_name') || n.nodeName.toLowerCase();
+
+ // Get internal type
+ type = n.getAttribute('_mce_type');
+ if (type) {
+ if (!t._info.cleanup) {
+ iv = true;
+ return;
+ } else
+ keep = 1;
+ }
// Add correct prefix on IE
if (isIE) {
@@ -6320,18 +6352,20 @@ window.tinymce.dom.Sizzle = Sizzle;
nn = nn.substring(4);
// Check if valid
- if (!t.validElementsRE || !t.validElementsRE.test(nn) || (t.invalidElementsRE && t.invalidElementsRE.test(nn)) || inn) {
- iv = true;
- break;
+ if (!keep) {
+ if (!t.validElementsRE || !t.validElementsRE.test(nn) || (t.invalidElementsRE && t.invalidElementsRE.test(nn)) || inner) {
+ iv = true;
+ break;
+ }
}
if (isIE) {
// Fix IE content duplication (DOM can have multiple copies of the same node)
if (s.fix_content_duplication) {
- if (n.mce_serialized == t.key)
+ if (n._mce_serialized == t.key)
return;
- n.mce_serialized = t.key;
+ n._mce_serialized = t.key;
}
// IE sometimes adds a / infront of the node name
@@ -6344,18 +6378,23 @@ window.tinymce.dom.Sizzle = Sizzle;
}
// Check if valid child
- if (t.childRules) {
- if (t.parentElementsRE.test(t.elementName)) {
- if (!t.childRules[t.elementName].test(nn)) {
- iv = true;
- break;
- }
+ if (s.validate_children) {
+ if (t.elementName && !t.schema.isValid(t.elementName, nn)) {
+ iv = true;
+ break;
}
t.elementName = nn;
}
ru = t.findRule(nn);
+
+ // No valid rule for this element could be found then skip it
+ if (!ru) {
+ iv = true;
+ break;
+ }
+
nn = ru.name || nn;
closed = s.closed.test(nn);
@@ -6415,6 +6454,10 @@ window.tinymce.dom.Sizzle = Sizzle;
}
}
+ // Keep type attribute
+ if (type && keep)
+ w.writeAttribute('_mce_type', type);
+
// Write text from script
if (nn === 'script' && tinymce.trim(n.innerHTML)) {
w.writeText('// '); // Padd it with a comment so it will parse on older browsers
@@ -6427,7 +6470,7 @@ window.tinymce.dom.Sizzle = Sizzle;
if (ru.padd) {
// If it has only one bogus child, padd it anyway workaround for <td><br /></td> bug
if (hc && (cn = n.firstChild) && cn.nodeType === 1 && n.childNodes.length === 1) {
- if (cn.hasAttribute ? cn.hasAttribute('mce_bogus') : cn.getAttribute('mce_bogus'))
+ if (cn.hasAttribute ? cn.hasAttribute('_mce_bogus') : cn.getAttribute('_mce_bogus'))
w.writeText('\u00a0');
} else if (!hc)
w.writeText('\u00a0'); // No children then padd it
@@ -6437,10 +6480,8 @@ window.tinymce.dom.Sizzle = Sizzle;
case 3: // Text
// Check if valid child
- if (t.childRules && t.parentElementsRE.test(t.elementName)) {
- if (!t.childRules[t.elementName].test(n.nodeName))
- return;
- }
+ if (s.validate_children && t.elementName && !t.schema.isValid(t.elementName, '#text'))
+ return;
return w.writeText(n.nodeValue);
@@ -6533,7 +6574,7 @@ window.tinymce.dom.Sizzle = Sizzle;
t.setEntities(s.entities);
l = t.entityLookup;
- h = h.replace(t.entitiesRE, function(a) {
+ h = h.replace(/[\u007E-\uFFFF]/g, function(a) {
var v;
if (v = l[a])
@@ -6563,7 +6604,6 @@ window.tinymce.dom.Sizzle = Sizzle;
t.setRules(s.valid_elements);
t.addRules(s.extended_valid_elements);
- t.addValidChildRules(s.valid_child_elements);
if (s.invalid_elements)
t.invalidElementsRE = new RegExp('^(' + wildcardToRE(s.invalid_elements.replace(/,/g, '|').toLowerCase()) + ')$');
@@ -6630,281 +6670,548 @@ window.tinymce.dom.Sizzle = Sizzle;
}
});
})(tinymce);
+
(function(tinymce) {
- var each = tinymce.each, Event = tinymce.dom.Event;
+ tinymce.dom.ScriptLoader = function(settings) {
+ var QUEUED = 0,
+ LOADING = 1,
+ LOADED = 2,
+ states = {},
+ queue = [],
+ scriptLoadedCallbacks = {},
+ queueLoadedCallbacks = [],
+ loading = 0,
+ undefined;
+
+ function loadScript(url, callback) {
+ var t = this, dom = tinymce.DOM, elm, uri, loc, id;
+
+ // Execute callback when script is loaded
+ function done() {
+ dom.remove(id);
+
+ if (elm)
+ elm.onreadystatechange = elm.onload = elm = null;
+
+ callback();
+ };
- tinymce.create('tinymce.dom.ScriptLoader', {
- ScriptLoader : function(s) {
- this.settings = s || {};
- this.queue = [];
- this.lookup = {};
- },
+ id = dom.uniqueId();
- isDone : function(u) {
- return this.lookup[u] ? this.lookup[u].state == 2 : 0;
- },
+ if (tinymce.isIE6) {
+ uri = new tinymce.util.URI(url);
+ loc = location;
- markDone : function(u) {
- this.lookup[u] = {state : 2, url : u};
- },
+ // If script is from same domain and we
+ // use IE 6 then use XHR since it's more reliable
+ if (uri.host == loc.hostname && uri.port == loc.port && (uri.protocol + ':') == loc.protocol) {
+ tinymce.util.XHR.send({
+ url : tinymce._addVer(uri.getURI()),
+ success : function(content) {
+ // Create new temp script element
+ var script = dom.create('script', {
+ type : 'text/javascript'
+ });
- add : function(u, cb, s, pr) {
- var t = this, lo = t.lookup, o;
+ // Evaluate script in global scope
+ script.text = content;
+ document.getElementsByTagName('head')[0].appendChild(script);
+ dom.remove(script);
- if (o = lo[u]) {
- // Is loaded fire callback
- if (cb && o.state == 2)
- cb.call(s || this);
+ done();
+ }
+ });
- return o;
+ return;
+ }
}
- o = {state : 0, url : u, func : cb, scope : s || this};
+ // Create new script element
+ elm = dom.create('script', {
+ id : id,
+ type : 'text/javascript',
+ src : tinymce._addVer(url)
+ });
+
+ // Add onload and readystate listeners
+ elm.onload = done;
+ elm.onreadystatechange = function() {
+ var state = elm.readyState;
- if (pr)
- t.queue.unshift(o);
- else
- t.queue.push(o);
+ // Loaded state is passed on IE 6 however there
+ // are known issues with this method but we can't use
+ // XHR in a cross domain loading
+ if (state == 'complete' || state == 'loaded')
+ done();
+ };
- lo[u] = o;
+ // Most browsers support this feature so we report errors
+ // for those at least to help users track their missing plugins etc
+ // todo: Removed since it produced error if the document is unloaded by navigating away, re-add it as an option
+ /*elm.onerror = function() {
+ alert('Failed to load: ' + url);
+ };*/
- return o;
- },
+ // Add script to document
+ (document.getElementsByTagName('head')[0] || document.body).appendChild(elm);
+ };
- load : function(u, cb, s) {
- var t = this, o;
+ this.isDone = function(url) {
+ return states[url] == LOADED;
+ };
- if (o = t.lookup[u]) {
- // Is loaded fire callback
- if (cb && o.state == 2)
- cb.call(s || t);
+ this.markDone = function(url) {
+ states[url] = LOADED;
+ };
- return o;
+ this.add = this.load = function(url, callback, scope) {
+ var item, state = states[url];
+
+ // Add url to load queue
+ if (state == undefined) {
+ queue.push(url);
+ states[url] = QUEUED;
}
- function loadScript(u) {
- if (Event.domLoaded || t.settings.strict_mode) {
- tinymce.util.XHR.send({
- url : tinymce._addVer(u),
- error : t.settings.error,
- async : false,
- success : function(co) {
- t.eval(co);
- }
- });
- } else
- document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"></script>');
- };
+ if (callback) {
+ // Store away callback for later execution
+ if (!scriptLoadedCallbacks[url])
+ scriptLoadedCallbacks[url] = [];
- if (!tinymce.is(u, 'string')) {
- each(u, function(u) {
- loadScript(u);
+ scriptLoadedCallbacks[url].push({
+ func : callback,
+ scope : scope || this
});
+ }
+ };
- if (cb)
- cb.call(s || t);
- } else {
- loadScript(u);
+ this.loadQueue = function(callback, scope) {
+ this.loadScripts(queue, callback, scope);
+ };
- if (cb)
- cb.call(s || t);
- }
- },
+ this.loadScripts = function(scripts, callback, scope) {
+ var loadScripts;
- loadQueue : function(cb, s) {
- var t = this;
+ function execScriptLoadedCallbacks(url) {
+ // Execute URL callback functions
+ tinymce.each(scriptLoadedCallbacks[url], function(callback) {
+ callback.func.call(callback.scope);
+ });
+
+ scriptLoadedCallbacks[url] = undefined;
+ };
- if (!t.queueLoading) {
- t.queueLoading = 1;
- t.queueCallbacks = [];
+ queueLoadedCallbacks.push({
+ func : callback,
+ scope : scope || this
+ });
- t.loadScripts(t.queue, function() {
- t.queueLoading = 0;
+ loadScripts = function() {
+ var loadingScripts = tinymce.grep(scripts);
- if (cb)
- cb.call(s || t);
+ // Current scripts has been handled
+ scripts.length = 0;
- each(t.queueCallbacks, function(o) {
- o.func.call(o.scope);
- });
+ // Load scripts that needs to be loaded
+ tinymce.each(loadingScripts, function(url) {
+ // Script is already loaded then execute script callbacks directly
+ if (states[url] == LOADED) {
+ execScriptLoadedCallbacks(url);
+ return;
+ }
+
+ // Is script not loading then start loading it
+ if (states[url] != LOADING) {
+ states[url] = LOADING;
+ loading++;
+
+ loadScript(url, function() {
+ states[url] = LOADED;
+ loading--;
+
+ execScriptLoadedCallbacks(url);
+
+ // Load more scripts if they where added by the recently loaded script
+ loadScripts();
+ });
+ }
});
- } else if (cb)
- t.queueCallbacks.push({func : cb, scope : s || t});
- },
- eval : function(co) {
- var w = window;
+ // No scripts are currently loading then execute all pending queue loaded callbacks
+ if (!loading) {
+ tinymce.each(queueLoadedCallbacks, function(callback) {
+ callback.func.call(callback.scope);
+ });
- // Evaluate script
- if (!w.execScript) {
- try {
- eval.call(w, co);
- } catch (ex) {
- eval(co, w); // Firefox 3.0a8
+ queueLoadedCallbacks.length = 0;
}
- } else
- w.execScript(co); // IE
- },
+ };
- loadScripts : function(sc, cb, s) {
- var t = this, lo = t.lookup;
+ loadScripts();
+ };
+ };
- function done(o) {
- o.state = 2; // Has been loaded
+ // Global script loader
+ tinymce.ScriptLoader = new tinymce.dom.ScriptLoader();
+})(tinymce);
- // Run callback
- if (o.func)
- o.func.call(o.scope || t);
- };
+tinymce.dom.TreeWalker = function(start_node, root_node) {
+ var node = start_node;
- function allDone() {
- var l;
+ function findSibling(node, start_name, sibling_name, shallow) {
+ var sibling, parent;
- // Check if all files are loaded
- l = sc.length;
- each(sc, function(o) {
- o = lo[o.url];
+ if (node) {
+ // Walk into nodes if it has a start
+ if (!shallow && node[start_name])
+ return node[start_name];
- if (o.state === 2) {// It has finished loading
- done(o);
- l--;
- } else
- load(o);
- });
+ // Return the sibling if it has one
+ if (node != root_node) {
+ sibling = node[sibling_name];
+ if (sibling)
+ return sibling;
- // They are all loaded
- if (l === 0 && cb) {
- cb.call(s || t);
- cb = 0;
+ // Walk up the parents to look for siblings
+ for (parent = node.parentNode; parent && parent != root_node; parent = parent.parentNode) {
+ sibling = parent[sibling_name];
+ if (sibling)
+ return sibling;
}
- };
+ }
+ }
+ };
- function load(o) {
- if (o.state > 0)
- return;
+ this.current = function() {
+ return node;
+ };
+
+ this.next = function(shallow) {
+ return (node = findSibling(node, 'firstChild', 'nextSibling', shallow));
+ };
+
+ this.prev = function(shallow) {
+ return (node = findSibling(node, 'lastChild', 'lastSibling', shallow));
+ };
+};
+
+(function() {
+ var transitional = {};
- o.state = 1; // Is loading
+ function unpack(lookup, data) {
+ var key;
- tinymce.dom.ScriptLoader.loadScript(o.url, function() {
- done(o);
- allDone();
+ function replace(value) {
+ return value.replace(/[A-Z]+/g, function(key) {
+ return replace(lookup[key]);
+ });
+ };
+
+ // Unpack lookup
+ for (key in lookup) {
+ if (lookup.hasOwnProperty(key))
+ lookup[key] = replace(lookup[key]);
+ }
+
+ // Unpack and parse data into object map
+ replace(data).replace(/#/g, '#text').replace(/(\w+)\[([^\]]+)\]/g, function(str, name, children) {
+ var i, map = {};
+
+ children = children.split(/\|/);
+
+ for (i = children.length - 1; i >= 0; i--)
+ map[children[i]] = 1;
+
+ transitional[name] = map;
+ });
+ };
+
+ // This is the XHTML 1.0 transitional elements with it's children packed to reduce it's size
+ // we will later include the attributes here and use it as a default for valid elements but it
+ // requires us to rewrite the serializer engine
+ unpack({
+ Z : '#|H|K|N|O|P',
+ Y : '#|X|form|R|Q',
+ X : 'p|T|div|U|W|isindex|fieldset|table',
+ W : 'pre|hr|blockquote|address|center|noframes',
+ U : 'ul|ol|dl|menu|dir',
+ ZC : '#|p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q',
+ T : 'h1|h2|h3|h4|h5|h6',
+ ZB : '#|X|S|Q',
+ S : 'R|P',
+ ZA : '#|a|G|J|M|O|P',
+ R : '#|a|H|K|N|O',
+ Q : 'noscript|P',
+ P : 'ins|del|script',
+ O : 'input|select|textarea|label|button',
+ N : 'M|L',
+ M : 'em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym',
+ L : 'sub|sup',
+ K : 'J|I',
+ J : 'tt|i|b|u|s|strike',
+ I : 'big|small|font|basefont',
+ H : 'G|F',
+ G : 'br|span|bdo',
+ F : 'object|applet|img|map|iframe'
+ }, 'script[]' +
+ 'style[]' +
+ 'object[#|param|X|form|a|H|K|N|O|Q]' +
+ 'param[]' +
+ 'p[S]' +
+ 'a[Z]' +
+ 'br[]' +
+ 'span[S]' +
+ 'bdo[S]' +
+ 'applet[#|param|X|form|a|H|K|N|O|Q]' +
+ 'h1[S]' +
+ 'img[]' +
+ 'map[X|form|Q|area]' +
+ 'h2[S]' +
+ 'iframe[#|X|form|a|H|K|N|O|Q]' +
+ 'h3[S]' +
+ 'tt[S]' +
+ 'i[S]' +
+ 'b[S]' +
+ 'u[S]' +
+ 's[S]' +
+ 'strike[S]' +
+ 'big[S]' +
+ 'small[S]' +
+ 'font[S]' +
+ 'basefont[]' +
+ 'em[S]' +
+ 'strong[S]' +
+ 'dfn[S]' +
+ 'code[S]' +
+ 'q[S]' +
+ 'samp[S]' +
+ 'kbd[S]' +
+ 'var[S]' +
+ 'cite[S]' +
+ 'abbr[S]' +
+ 'acronym[S]' +
+ 'sub[S]' +
+ 'sup[S]' +
+ 'input[]' +
+ 'select[optgroup|option]' +
+ 'optgroup[option]' +
+ 'option[]' +
+ 'textarea[]' +
+ 'label[S]' +
+ 'button[#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]' +
+ 'h4[S]' +
+ 'ins[#|X|form|a|H|K|N|O|Q]' +
+ 'h5[S]' +
+ 'del[#|X|form|a|H|K|N|O|Q]' +
+ 'h6[S]' +
+ 'div[#|X|form|a|H|K|N|O|Q]' +
+ 'ul[li]' +
+ 'li[#|X|form|a|H|K|N|O|Q]' +
+ 'ol[li]' +
+ 'dl[dt|dd]' +
+ 'dt[S]' +
+ 'dd[#|X|form|a|H|K|N|O|Q]' +
+ 'menu[li]' +
+ 'dir[li]' +
+ 'pre[ZA]' +
+ 'hr[]' +
+ 'blockquote[#|X|form|a|H|K|N|O|Q]' +
+ 'address[S|p]' +
+ 'center[#|X|form|a|H|K|N|O|Q]' +
+ 'noframes[#|X|form|a|H|K|N|O|Q]' +
+ 'isindex[]' +
+ 'fieldset[#|legend|X|form|a|H|K|N|O|Q]' +
+ 'legend[S]' +
+ 'table[caption|col|colgroup|thead|tfoot|tbody|tr]' +
+ 'caption[S]' +
+ 'col[]' +
+ 'colgroup[col]' +
+ 'thead[tr]' +
+ 'tr[th|td]' +
+ 'th[#|X|form|a|H|K|N|O|Q]' +
+ 'form[#|X|a|H|K|N|O|Q]' +
+ 'noscript[#|X|form|a|H|K|N|O|Q]' +
+ 'td[#|X|form|a|H|K|N|O|Q]' +
+ 'tfoot[tr]' +
+ 'tbody[tr]' +
+ 'area[]' +
+ 'base[]' +
+ 'body[#|X|form|a|H|K|N|O|Q]'
+ );
+
+ tinymce.dom.Schema = function() {
+ var t = this, elements = transitional;
+
+ t.isValid = function(name, child_name) {
+ var element = elements[name];
+
+ return !!(element && (!child_name || element[child_name]));
+ };
+ };
+})();
+(function(tinymce) {
+ tinymce.dom.RangeUtils = function(dom) {
+ var INVISIBLE_CHAR = '\uFEFF';
+
+ this.walk = function(rng, callback) {
+ var startContainer = rng.startContainer,
+ startOffset = rng.startOffset,
+ endContainer = rng.endContainer,
+ endOffset = rng.endOffset,
+ ancestor, startPoint,
+ endPoint, node, parent, siblings, nodes;
+
+ // Handle table cell selection the table plugin enables
+ // you to fake select table cells and perform formatting actions on them
+ nodes = dom.select('td.mceSelected,th.mceSelected');
+ if (nodes.length > 0) {
+ tinymce.each(nodes, function(node) {
+ callback([node]);
});
- /*
- tinymce.util.XHR.send({
- url : o.url,
- error : t.settings.error,
- success : function(co) {
- t.eval(co);
- done(o);
- allDone();
+ return;
+ }
+
+ function collectSiblings(node, name, end_node) {
+ var siblings = [];
+
+ for (; node && node != end_node; node = node[name])
+ siblings.push(node);
+
+ return siblings;
+ };
+
+ function findEndPoint(node, root) {
+ do {
+ if (node.parentNode == root)
+ return node;
+
+ node = node.parentNode;
+ } while(node);
+ };
+
+ function walkBoundary(start_node, end_node, next) {
+ var siblingName = next ? 'nextSibling' : 'previousSibling';
+
+ for (node = start_node, parent = node.parentNode; node && node != end_node; node = parent) {
+ parent = node.parentNode;
+ siblings = collectSiblings(node == start_node ? node : node[siblingName], siblingName);
+
+ if (siblings.length) {
+ if (!next)
+ siblings.reverse();
+
+ callback(siblings);
}
- });
- */
+ }
};
- each(sc, function(o) {
- var u = o.url;
+ // If index based start position then resolve it
+ if (startContainer.nodeType == 1 && startContainer.hasChildNodes())
+ startContainer = startContainer.childNodes[startOffset];
- // Add to queue if needed
- if (!lo[u]) {
- lo[u] = o;
- t.queue.push(o);
- } else
- o = lo[u];
+ // If index based end position then resolve it
+ if (endContainer.nodeType == 1 && endContainer.hasChildNodes())
+ endContainer = endContainer.childNodes[Math.min(startOffset == endOffset ? endOffset : endOffset - 1, endContainer.childNodes.length - 1)];
- // Is already loading or has been loaded
- if (o.state > 0)
- return;
+ // Find common ancestor and end points
+ ancestor = dom.findCommonAncestor(startContainer, endContainer);
- if (!Event.domLoaded && !t.settings.strict_mode) {
- var ix, ol = '';
+ // Same container
+ if (startContainer == endContainer)
+ return callback([startContainer]);
- // Add onload events
- if (cb || o.func) {
- o.state = 1; // Is loading
+ // Process left side
+ for (node = startContainer; node; node = node.parentNode) {
+ if (node == endContainer)
+ return walkBoundary(startContainer, ancestor, true);
- ix = tinymce.dom.ScriptLoader._addOnLoad(function() {
- done(o);
- allDone();
- });
+ if (node == ancestor)
+ break;
+ }
- if (tinymce.isIE)
- ol = ' onreadystatechange="';
- else
- ol = ' onload="';
+ // Process right side
+ for (node = endContainer; node; node = node.parentNode) {
+ if (node == startContainer)
+ return walkBoundary(endContainer, ancestor);
- ol += 'tinymce.dom.ScriptLoader._onLoad(this,\'' + u + '\',' + ix + ');"';
- }
+ if (node == ancestor)
+ break;
+ }
- document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"' + ol + '></script>');
+ // Find start/end point
+ startPoint = findEndPoint(startContainer, ancestor) || startContainer;
+ endPoint = findEndPoint(endContainer, ancestor) || endContainer;
- if (!o.func)
- done(o);
- } else
- load(o);
- });
+ // Walk left leaf
+ walkBoundary(startContainer, startPoint, true);
- allDone();
- },
+ // Walk the middle from start to end point
+ siblings = collectSiblings(
+ startPoint == startContainer ? startPoint : startPoint.nextSibling,
+ 'nextSibling',
+ endPoint == endContainer ? endPoint.nextSibling : endPoint
+ );
- // Static methods
- 'static' : {
- _addOnLoad : function(f) {
- var t = this;
+ if (siblings.length)
+ callback(siblings);
- t._funcs = t._funcs || [];
- t._funcs.push(f);
+ // Walk right leaf
+ walkBoundary(endContainer, endPoint);
+ };
- return t._funcs.length - 1;
- },
+ /* this.split = function(rng) {
+ var startContainer = rng.startContainer,
+ startOffset = rng.startOffset,
+ endContainer = rng.endContainer,
+ endOffset = rng.endOffset;
- _onLoad : function(e, u, ix) {
- if (!tinymce.isIE || e.readyState == 'complete')
- this._funcs[ix].call(this);
- },
+ function splitText(node, offset) {
+ if (offset == node.nodeValue.length)
+ node.appendData(INVISIBLE_CHAR);
- loadScript : function(u, cb) {
- var id = tinymce.DOM.uniqueId(), e;
+ node = node.splitText(offset);
- function done() {
- Event.clear(id);
- tinymce.DOM.remove(id);
+ if (node.nodeValue === INVISIBLE_CHAR)
+ node.nodeValue = '';
- if (cb) {
- cb.call(document, u);
- cb = 0;
- }
- };
+ return node;
+ };
- if (tinymce.isIE) {
-/* Event.add(e, 'readystatechange', function(e) {
- if (e.target && e.target.readyState == 'complete')
- done();
- });*/
+ // Handle single text node
+ if (startContainer == endContainer) {
+ if (startContainer.nodeType == 3) {
+ if (startOffset != 0)
+ startContainer = endContainer = splitText(startContainer, startOffset);
- tinymce.util.XHR.send({
- url : tinymce._addVer(u),
- async : false,
- success : function(co) {
- window.execScript(co);
- done();
- }
- });
- } else {
- e = tinymce.DOM.create('script', {id : id, type : 'text/javascript', src : tinymce._addVer(u)});
- Event.add(e, 'load', done);
+ if (endOffset - startOffset != startContainer.nodeValue.length)
+ splitText(startContainer, endOffset - startOffset);
+ }
+ } else {
+ // Split startContainer text node if needed
+ if (startContainer.nodeType == 3 && startOffset != 0) {
+ startContainer = splitText(startContainer, startOffset);
+ startOffset = 0;
+ }
- // Check for head or body
- (document.getElementsByTagName('head')[0] || document.body).appendChild(e);
+ // Split endContainer text node if needed
+ if (endContainer.nodeType == 3 && endOffset != endContainer.nodeValue.length) {
+ endContainer = splitText(endContainer, endOffset).previousSibling;
+ endOffset = endContainer.nodeValue.length;
}
}
- }
- });
- // Global script loader
- tinymce.ScriptLoader = new tinymce.dom.ScriptLoader();
+ return {
+ startContainer : startContainer,
+ startOffset : startOffset,
+ endContainer : endContainer,
+ endOffset : endOffset
+ };
+ };
+*/
+ };
})(tinymce);
+
(function(tinymce) {
// Shorten class names
var DOM = tinymce.DOM, is = tinymce.is;
@@ -7005,7 +7312,8 @@ window.tinymce.dom.Sizzle = Sizzle;
tinymce.dom.Event.clear(this.id);
}
});
-})(tinymce);tinymce.create('tinymce.ui.Container:tinymce.ui.Control', {
+})(tinymce);
+tinymce.create('tinymce.ui.Container:tinymce.ui.Control', {
Container : function(id, s) {
this.parent(id, s);
@@ -7026,6 +7334,7 @@ window.tinymce.dom.Sizzle = Sizzle;
}
});
+
tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
Separator : function(id, s) {
this.parent(id, s);
@@ -7036,6 +7345,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
return tinymce.DOM.createHTML('span', {'class' : this.classPrefix});
}
});
+
(function(tinymce) {
var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, walk = tinymce.walk;
@@ -7065,6 +7375,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
}
});
})(tinymce);
+
(function(tinymce) {
var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, walk = tinymce.walk;
@@ -7162,7 +7473,8 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
return m;
}
});
-})(tinymce);(function(tinymce) {
+})(tinymce);
+(function(tinymce) {
var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, Event = tinymce.dom.Event, Element = tinymce.dom.Element;
tinymce.create('tinymce.ui.DropMenu:tinymce.ui.Menu', {
@@ -7489,7 +7801,8 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
DOM.addClass(ro, 'mceLast');
}
});
-})(tinymce);(function(tinymce) {
+})(tinymce);
+(function(tinymce) {
var DOM = tinymce.DOM;
tinymce.create('tinymce.ui.Button:tinymce.ui.Control', {
@@ -7522,6 +7835,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
}
});
})(tinymce);
+
(function(tinymce) {
var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher;
@@ -7669,16 +7983,16 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
hideMenu : function(e) {
var t = this;
- // Prevent double toogles by canceling the mouse click event to the button
- if (e && e.type == "mousedown" && (e.target.id == t.id + '_text' || e.target.id == t.id + '_open'))
- return;
-
- if (!e || !DOM.getParent(e.target, '.mceMenu')) {
- DOM.removeClass(t.id, t.classPrefix + 'Selected');
- Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);
+ if (t.menu && t.menu.isMenuVisible) {
+ // Prevent double toogles by canceling the mouse click event to the button
+ if (e && e.type == "mousedown" && (e.target.id == t.id + '_text' || e.target.id == t.id + '_open'))
+ return;
- if (t.menu)
+ if (!e || !DOM.getParent(e.target, '.mceMenu')) {
+ DOM.removeClass(t.id, t.classPrefix + 'Selected');
+ Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);
t.menu.hideMenu();
+ }
}
},
@@ -7704,13 +8018,25 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
});
each(t.items, function(o) {
- o.id = DOM.uniqueId();
- o.onclick = function() {
- if (t.settings.onselect(o.value) !== false)
- t.select(o.value); // Must be runned after
- };
+ // No value then treat it as a title
+ if (o.value === undefined) {
+ m.add({
+ title : o.title,
+ 'class' : 'mceMenuItemTitle',
+ onclick : function() {
+ if (t.settings.onselect('') !== false)
+ t.select(''); // Must be runned after
+ }
+ });
+ } else {
+ o.id = DOM.uniqueId();
+ o.onclick = function() {
+ if (t.settings.onselect(o.value) !== false)
+ t.select(o.value); // Must be runned after
+ };
- m.add(o);
+ m.add(o);
+ }
});
t.onRenderMenu.dispatch(t, m);
@@ -7779,7 +8105,8 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
Event.clear(this.id + '_open');
}
});
-})(tinymce);(function(tinymce) {
+})(tinymce);
+(function(tinymce) {
var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher;
tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox', {
@@ -7907,7 +8234,8 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
t.onPostRender.dispatch(t, DOM.get(t.id));
}
});
-})(tinymce);(function(tinymce) {
+})(tinymce);
+(function(tinymce) {
var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;
tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button', {
@@ -7996,6 +8324,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
}
});
})(tinymce);
+
(function(tinymce) {
var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;
@@ -8061,6 +8390,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
}
});
})(tinymce);
+
(function(tinymce) {
var DOM = tinymce.DOM, Event = tinymce.dom.Event, is = tinymce.is, each = tinymce.each;
@@ -8169,7 +8499,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
style : {
backgroundColor : '#' + c
},
- mce_color : '#' + c
+ _mce_color : '#' + c
});
});
@@ -8191,7 +8521,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
e = e.target;
- if (e.nodeName == 'A' && (c = e.getAttribute('mce_color')))
+ if (e.nodeName == 'A' && (c = e.getAttribute('_mce_color')))
t.setColor(c);
return Event.cancel(e); // Prevent IE auto save warning
@@ -8227,6 +8557,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
}
});
})(tinymce);
+
tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
renderHTML : function() {
var t = this, h = '', c, co, dom = tinymce.DOM, s = t.settings, i, pr, nx, cl;
@@ -8289,6 +8620,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
return dom.createHTML('table', {id : t.id, 'class' : 'mceToolbar' + (s['class'] ? ' ' + s['class'] : ''), cellpadding : '0', cellspacing : '0', align : t.settings.align || ''}, '<tbody><tr>' + h + '</tr></tbody>');
}
});
+
(function(tinymce) {
var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each;
@@ -8304,16 +8636,10 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
},
requireLangPack : function(n) {
- var u, s = tinymce.EditorManager.settings;
-
- if (s && s.language) {
- u = this.urls[n] + '/langs/' + s.language + '.js';
+ var s = tinymce.settings;
- if (!tinymce.dom.Event.domLoaded && !s.strict_mode)
- tinymce.ScriptLoader.load(u);
- else
- tinymce.ScriptLoader.add(u);
- }
+ if (s && s.language)
+ tinymce.ScriptLoader.add(this.urls[n] + '/langs/' + s.language + '.js');
},
add : function(id, o) {
@@ -8345,39 +8671,44 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
(function(tinymce) {
// Shorten names
- var each = tinymce.each, extend = tinymce.extend, DOM = tinymce.DOM, Event = tinymce.dom.Event, ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager, explode = tinymce.explode;
+ var each = tinymce.each, extend = tinymce.extend,
+ DOM = tinymce.DOM, Event = tinymce.dom.Event,
+ ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager,
+ explode = tinymce.explode,
+ Dispatcher = tinymce.util.Dispatcher, undefined, instanceCounter = 0;
- tinymce.create('static tinymce.EditorManager', {
- editors : {},
+ // Setup some URLs where the editor API is located and where the document is
+ tinymce.documentBaseURL = window.location.href.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');
+ if (!/[\/\\]$/.test(tinymce.documentBaseURL))
+ tinymce.documentBaseURL += '/';
- i18n : {},
-
- activeEditor : null,
+ tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);
- preInit : function() {
- var t = this, lo = window.location;
+ tinymce.baseURI = new tinymce.util.URI(tinymce.baseURL);
- // Setup some URLs where the editor API is located and where the document is
- tinymce.documentBaseURL = lo.href.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');
- if (!/[\/\\]$/.test(tinymce.documentBaseURL))
- tinymce.documentBaseURL += '/';
+ // Add before unload listener
+ // This was required since IE was leaking memory if you added and removed beforeunload listeners
+ // with attachEvent/detatchEvent so this only adds one listener and instances can the attach to the onBeforeUnload event
+ tinymce.onBeforeUnload = new Dispatcher(tinymce);
- tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);
- tinymce.EditorManager.baseURI = new tinymce.util.URI(tinymce.baseURL);
+ // Must be on window or IE will leak if the editor is placed in frame or iframe
+ Event.add(window, 'beforeunload', function(e) {
+ tinymce.onBeforeUnload.dispatch(tinymce, e);
+ });
- // Add before unload listener
- // This was required since IE was leaking memory if you added and removed beforeunload listeners
- // with attachEvent/detatchEvent so this only adds one listener and instances can the attach to the onBeforeUnload event
- t.onBeforeUnload = new tinymce.util.Dispatcher(t);
+ tinymce.onAddEditor = new Dispatcher(tinymce);
- // Must be on window or IE will leak if the editor is placed in frame or iframe
- Event.add(window, 'beforeunload', function(e) {
- t.onBeforeUnload.dispatch(t, e);
- });
- },
+ tinymce.onRemoveEditor = new Dispatcher(tinymce);
+
+ tinymce.EditorManager = extend(tinymce, {
+ editors : [],
+
+ i18n : {},
+
+ activeEditor : null,
init : function(s) {
- var t = this, pl, sl = tinymce.ScriptLoader, c, e, el = [], ed;
+ var t = this, pl, sl = tinymce.ScriptLoader, e, el = [], ed;
function execCallback(se, n, s) {
var f = se[n];
@@ -8396,83 +8727,17 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
s = extend({
theme : "simple",
- language : "en",
- strict_loading_mode : document.contentType == 'application/xhtml+xml'
+ language : "en"
}, s);
t.settings = s;
- // If page not loaded and strict mode isn't enabled then load them
- if (!Event.domLoaded && !s.strict_loading_mode) {
- // Load language
- if (s.language)
- sl.add(tinymce.baseURL + '/langs/' + s.language + '.js');
-
- // Load theme
- if (s.theme && s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme])
- ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js');
-
- // Load plugins
- if (s.plugins) {
- pl = explode(s.plugins);
-
- // Load rest if plugins
- each(pl, function(v) {
- if (v && v.charAt(0) != '-' && !PluginManager.urls[v]) {
- // Skip safari plugin for other browsers
- if (!tinymce.isWebKit && v == 'safari')
- return;
-
- PluginManager.load(v, 'plugins/' + v + '/editor_plugin' + tinymce.suffix + '.js');
- }
- });
- }
-
- sl.loadQueue();
- }
-
// Legacy call
Event.add(document, 'init', function() {
var l, co;
execCallback(s, 'onpageload');
- // Verify that it's a valid browser
- if (s.browsers) {
- l = false;
-
- each(explode(s.browsers), function(v) {
- switch (v) {
- case 'ie':
- case 'msie':
- if (tinymce.isIE)
- l = true;
- break;
-
- case 'gecko':
- if (tinymce.isGecko)
- l = true;
- break;
-
- case 'safari':
- case 'webkit':
- if (tinymce.isWebKit)
- l = true;
- break;
-
- case 'opera':
- if (tinymce.isOpera)
- l = true;
-
- break;
- }
- });
-
- // Not a valid one
- if (!l)
- return;
- }
-
switch (s.mode) {
case "exact":
l = s.elements || '';
@@ -8484,12 +8749,10 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
el.push(ed);
ed.render(1);
} else {
- c = 0;
-
each(document.forms, function(f) {
each(f.elements, function(e) {
if (e.name === v) {
- v = 'mce_editor_' + c;
+ v = 'mce_editor_' + instanceCounter++;
DOM.setAttrib(e, 'id', v);
ed = new tinymce.Editor(v, s);
@@ -8535,7 +8798,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
if (s.oninit) {
l = co = 0;
- each (el, function(ed) {
+ each(el, function(ed) {
co++;
if (!ed.initialized) {
@@ -8559,6 +8822,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
},
get : function(id) {
+ if (id === undefined)
+ return this.editors;
+
return this.editors[id];
},
@@ -8566,35 +8832,44 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
return this.get(id);
},
- add : function(e) {
- this.editors[e.id] = e;
- this._setActive(e);
+ add : function(editor) {
+ var self = this, editors = self.editors;
- return e;
+ // Add named and index editor instance
+ editors[editor.id] = editor;
+ editors.push(editor);
+
+ self._setActive(editor);
+ self.onAddEditor.dispatch(self, editor);
+
+
+ return editor;
},
- remove : function(e) {
- var t = this;
+ remove : function(editor) {
+ var t = this, i, editors = t.editors;
// Not in the collection
- if (!t.editors[e.id])
+ if (!editors[editor.id])
return null;
- delete t.editors[e.id];
-
- // Select another editor since the active one was removed
- if (t.activeEditor == e) {
- t._setActive(null);
+ delete editors[editor.id];
- each(t.editors, function(e) {
- t._setActive(e);
- return false; // Break
- });
+ for (i = 0; i < editors.length; i++) {
+ if (editors[i] == editor) {
+ editors.splice(i, 1);
+ break;
+ }
}
- e.destroy();
+ // Select another editor since the active one was removed
+ if (t.activeEditor == editor)
+ t._setActive(editors[0]);
+
+ editor.destroy();
+ t.onRemoveEditor.dispatch(t, editor);
- return e;
+ return editor;
},
execCommand : function(c, u, v) {
@@ -8707,20 +8982,19 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
// Private methods
- _setActive : function(e) {
- this.selectedInstance = this.activeEditor = e;
+ _setActive : function(editor) {
+ this.selectedInstance = this.activeEditor = editor;
}
});
-
- tinymce.EditorManager.preInit();
})(tinymce);
-var tinyMCE = window.tinyMCE = tinymce.EditorManager;
(function(tinymce) {
- var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, Dispatcher = tinymce.util.Dispatcher;
- var each = tinymce.each, isGecko = tinymce.isGecko, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit;
- var is = tinymce.is, ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager, EditorManager = tinymce.EditorManager;
- var inArray = tinymce.inArray, grep = tinymce.grep, explode = tinymce.explode;
+ // Shorten these names
+ var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend,
+ Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isGecko = tinymce.isGecko,
+ isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, is = tinymce.is,
+ ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager,
+ inArray = tinymce.inArray, grep = tinymce.grep, explode = tinymce.explode;
tinymce.create('tinymce.Editor', {
Editor : function(id, s) {
@@ -8836,11 +9110,9 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
custom_undo_redo_keyboard_shortcuts : 1,
custom_undo_redo_restore_selection : 1,
custom_undo_redo : 1,
- doctype : '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
+ doctype : tinymce.isIE6 ? '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' : '<!DOCTYPE>', // Use old doctype on IE 6 to avoid horizontal scroll
visual_table_class : 'mceItemTable',
visual : 1,
- inline_styles : true,
- convert_fonts_to_spans : true,
font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large',
apply_source_formatting : 1,
directionality : 'ltr',
@@ -8854,14 +9126,15 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
indentation : '30px',
keep_styles : 1,
fix_table_elements : 1,
- removeformat_selector : 'span,b,strong,em,i,font,u,strike'
+ inline_styles : 1,
+ convert_fonts_to_spans : true
}, s);
t.documentBaseURI = new tinymce.util.URI(s.document_base_url || tinymce.documentBaseURL, {
base_uri : tinyMCE.baseURI
});
- t.baseURI = EditorManager.baseURI;
+ t.baseURI = tinymce.baseURI;
// Call setup
t.execCallback('setup', t);
@@ -8878,21 +9151,12 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
return;
}
- // Force strict loading mode if render us called by user and not internally
- if (!nst) {
- s.strict_loading_mode = 1;
- tinyMCE.settings = s;
- }
+ tinyMCE.settings = s;
// Element not found, then skip initialization
if (!t.getElement())
return;
- if (s.strict_loading_mode) {
- sl.settings.strict_mode = s.strict_loading_mode;
- tinymce.DOM.settings.strict = 1;
- }
-
// Add hidden input for non input elements inside form elements
if (!/TEXTAREA|INPUT/i.test(t.getElement().nodeName) && s.hidden_input && DOM.getParent(id, 'form'))
DOM.insertAfter(DOM.create('input', {type : 'hidden', name : id}), id);
@@ -8942,7 +9206,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
n._mceOldSubmit = n.submit;
n.submit = function() {
// Save all instances
- EditorManager.triggerSave();
+ tinymce.triggerSave();
t.isNotDirty = 1;
return t.formElement._mceOldSubmit(t.formElement);
@@ -8963,8 +9227,8 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
each(explode(s.plugins), function(p) {
if (p && p.charAt(0) != '-' && !PluginManager.urls[p]) {
- // Skip safari plugin for other browsers
- if (!isWebKit && p == 'safari')
+ // Skip safari plugin, since it is removed as of 3.3b1
+ if (p == 'safari')
return;
PluginManager.load(p, 'plugins/' + p + '/editor_plugin' + tinymce.suffix + '.js');
@@ -8984,7 +9248,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
init : function() {
var n, t = this, s = t.settings, w, h, e = t.getElement(), o, ti, u, bi, bc, re;
- EditorManager.add(t);
+ tinymce.add(t);
if (s.theme) {
s.theme = s.theme.replace(/-/, '');
@@ -9022,23 +9286,15 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
t.controlManager = new tinymce.ControlManager(t);
- t.undoManager = new tinymce.UndoManager(t);
-
- // Pass through
- t.undoManager.onAdd.add(function(um, l) {
- if (!l.initial)
- return t.onChange.dispatch(t, l, um);
- });
-
- t.undoManager.onUndo.add(function(um, l) {
- return t.onUndo.dispatch(t, l, um);
- });
-
- t.undoManager.onRedo.add(function(um, l) {
- return t.onRedo.dispatch(t, l, um);
- });
-
if (s.custom_undo_redo) {
+ // Add initial undo level
+ t.onBeforeExecCommand.add(function(ed, cmd, ui, val, a) {
+ if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!a || !a.skip_undo)) {
+ if (!t.undoManager.hasUndo())
+ t.undoManager.add();
+ }
+ });
+
t.onExecCommand.add(function(ed, cmd, ui, val, a) {
if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!a || !a.skip_undo))
t.undoManager.add();
@@ -9113,7 +9369,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
if (s.document_base_url != tinymce.documentBaseURL)
t.iframeHTML += '<base href="' + t.documentBaseURI.getURI() + '" />';
- t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
+ t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=7" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
if (tinymce.relaxedDomain)
t.iframeHTML += '<script type="text/javascript">document.domain = "' + tinymce.relaxedDomain + '";</script>';
@@ -9202,19 +9458,107 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
hex_colors : s.force_hex_style_colors,
class_filter : s.class_filter,
update_styles : 1,
- fix_ie_paragraphs : 1
+ fix_ie_paragraphs : 1,
+ valid_styles : s.valid_styles
});
+ t.schema = new tinymce.dom.Schema();
+
t.serializer = new tinymce.dom.Serializer(extend(s, {
valid_elements : s.verify_html === false ? '*[*]' : s.valid_elements,
- dom : t.dom
+ dom : t.dom,
+ schema : t.schema
}));
t.selection = new tinymce.dom.Selection(t.dom, t.getWin(), t.serializer);
+ t.formatter = new tinymce.Formatter(this);
+
+ // Register default formats
+ t.formatter.register({
+ alignleft : [
+ {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'left'}},
+ {selector : 'img,table', styles : {'float' : 'left'}}
+ ],
+
+ aligncenter : [
+ {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'center'}},
+ {selector : 'img', styles : {display : 'block', marginLeft : 'auto', marginRight : 'auto'}},
+ {selector : 'table', styles : {marginLeft : 'auto', marginRight : 'auto'}}
+ ],
+
+ alignright : [
+ {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'right'}},
+ {selector : 'img,table', styles : {'float' : 'right'}}
+ ],
+
+ alignfull : [
+ {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'justify'}}
+ ],
+
+ bold : [
+ {inline : 'strong'},
+ {inline : 'span', styles : {fontWeight : 'bold'}},
+ {inline : 'b'}
+ ],
+
+ italic : [
+ {inline : 'em'},
+ {inline : 'span', styles : {fontStyle : 'italic'}},
+ {inline : 'i'}
+ ],
+
+ underline : [
+ {inline : 'span', styles : {textDecoration : 'underline'}, exact : true},
+ {inline : 'u'}
+ ],
+
+ strikethrough : [
+ {inline : 'span', styles : {textDecoration : 'line-through'}, exact : true},
+ {inline : 'u'}
+ ],
+
+ forecolor : {inline : 'span', styles : {color : '%value'}},
+ hilitecolor : {inline : 'span', styles : {backgroundColor : '%value'}},
+ fontname : {inline : 'span', styles : {fontFamily : '%value'}},
+ fontsize : {inline : 'span', styles : {fontSize : '%value'}},
+ blockquote : {block : 'blockquote', wrapper : 1},
+
+ removeformat : [
+ {selector : 'b,strong,em,i,font,u,strike', remove : 'all', split : true, expand : false, block_expand : true, deep : true},
+ {selector : 'span', attributes : ['style', 'class'], remove : 'empty', split : true, expand : false, deep : true},
+ {selector : '*', attributes : ['style', 'class'], split : false, expand : false, deep : true}
+ ]
+ });
+
+ // Register default block formats
+ each('p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp'.split(/\s/), function(name) {
+ t.formatter.register(name, {block : name});
+ });
+
+ // Register user defined formats
+ t.formatter.register(t.settings.formats);
+
+ t.undoManager = new tinymce.UndoManager(t);
+
+ // Pass through
+ t.undoManager.onAdd.add(function(um, l) {
+ if (!l.initial)
+ return t.onChange.dispatch(t, l, um);
+ });
+
+ t.undoManager.onUndo.add(function(um, l) {
+ return t.onUndo.dispatch(t, l, um);
+ });
+
+ t.undoManager.onRedo.add(function(um, l) {
+ return t.onRedo.dispatch(t, l, um);
+ });
+
t.forceBlocks = new tinymce.ForceBlocks(t, {
forced_root_block : s.forced_root_block
});
+
t.editorCommands = new tinymce.EditorCommands(t);
// Pass through
@@ -9254,7 +9598,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
} else
n = 'div';
- o.content = o.content.replace(new RegExp('<(' + v + ')([^>]*)>', 'g'), '<' + n + ' mce_name="$1"$2>');
+ o.content = o.content.replace(new RegExp('<(' + v + ')([^>]*)>', 'g'), '<' + n + ' _mce_name="$1"$2>');
o.content = o.content.replace(new RegExp('</(' + v + ')>', 'g'), '</' + n + '>');
});
};
@@ -9337,12 +9681,6 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
};
}
- if (s.convert_fonts_to_spans)
- t._convertFonts();
-
- if (s.inline_styles)
- t._convertInlineElements();
-
if (s.cleanup_callback) {
t.onBeforeSetContent.add(function(ed, o) {
o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o);
@@ -9399,7 +9737,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
var pn = n.parentNode;
if (ed.dom.isBlock(pn) && pn.lastChild === n)
- ed.dom.add(pn, 'br', {'mce_bogus' : 1});
+ ed.dom.add(pn, 'br', {'_mce_bogus' : 1});
});
};
@@ -9430,7 +9768,6 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
t.load({initial : true, format : (s.cleanup_on_startup ? 'html' : 'raw')});
t.startContent = t.getContent({format : 'raw'});
- t.undoManager.add({initial : true});
t.initialized = true;
t.onInit.dispatch(t);
@@ -9449,7 +9786,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
// Handle auto focus
if (s.auto_focus) {
setTimeout(function () {
- var ed = EditorManager.get(s.auto_focus);
+ var ed = tinymce.get(s.auto_focus);
ed.selection.select(ed.getBody(), 1);
ed.selection.collapse(1);
@@ -9466,22 +9803,20 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
var oed, t = this, ce = t.settings.content_editable;
if (!sf) {
- // Is not content editable or the selection is outside the area in IE
- // the IE statement is needed to avoid bluring if element selections inside layers since
- // the layer is like it's own document in IE
- if (!ce && (!isIE || t.selection.getNode().ownerDocument != t.getDoc()))
+ // Is not content editable
+ if (!ce)
t.getWin().focus();
}
- if (EditorManager.activeEditor != t) {
- if ((oed = EditorManager.activeEditor) != null)
+ if (tinymce.activeEditor != t) {
+ if ((oed = tinymce.activeEditor) != null)
oed.onDeactivate.dispatch(oed, t);
t.onActivate.dispatch(t, oed);
}
- EditorManager._setActive(t);
+ tinymce._setActive(t);
},
execCallback : function(n) {
@@ -9508,7 +9843,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
},
translate : function(s) {
- var c = this.settings.language || 'en', i18n = EditorManager.i18n;
+ var c = this.settings.language || 'en', i18n = tinymce.i18n;
if (!s)
return '';
@@ -9519,7 +9854,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
},
getLang : function(n, dv) {
- return EditorManager.i18n[(this.settings.language || 'en') + '.' + n] || (is(dv) ? dv : '{#' + n + '}');
+ return tinymce.i18n[(this.settings.language || 'en') + '.' + n] || (is(dv) ? dv : '{#' + n + '}');
},
getParam : function(n, dv, ty) {
@@ -9551,10 +9886,22 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
// Fix for bug #1896577 it seems that this can not be fired while the editor is loading
if (t.initialized) {
+ o = o || {};
+ n = isIE && n.ownerDocument != t.getDoc() ? t.getBody() : n; // Fix for IE initial state
+
+ // Get parents and add them to object
+ o.parents = [];
+ t.dom.getParent(n, function(node) {
+ if (node.nodeName == 'BODY')
+ return true;
+
+ o.parents.push(node);
+ });
+
t.onNodeChange.dispatch(
t,
o ? o.controlManager || t.controlManager : t.controlManager,
- isIE && n.ownerDocument != t.getDoc() ? t.getBody() : n, // Fix for IE initial state
+ n,
s.isCollapsed(),
o
);
@@ -9697,7 +10044,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
t.onExecCommand.dispatch(t, cmd, ui, val, a);
},
- queryCommandState : function(c) {
+ queryCommandState : function(cmd) {
var t = this, o, s;
// Is hidden then return undefined
@@ -9705,7 +10052,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
return;
// Registred commands
- if (o = t.queryStateCommands[c]) {
+ if (o = t.queryStateCommands[cmd]) {
s = o.func.call(o.scope);
// Fall though on true
@@ -9714,13 +10061,13 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
}
// Registred commands
- o = t.editorCommands.queryCommandState(c);
+ o = t.editorCommands.queryCommandState(cmd);
if (o !== -1)
return o;
// Browser commands
try {
- return this.getDoc().queryCommandState(c);
+ return this.getDoc().queryCommandState(cmd);
} catch (ex) {
// Fails sometimes see bug: 1896577
}
@@ -9863,7 +10210,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
// Padd empty content in Gecko and Safari. Commands will otherwise fail on the content
// It will also be impossible to place the caret in the editor unless there is a BR element present
if (!tinymce.isIE && (h.length === 0 || /^\s+$/.test(h))) {
- o.content = t.dom.setHTML(t.getBody(), '<br mce_bogus="1" />');
+ o.content = t.dom.setHTML(t.getBody(), '<br _mce_bogus="1" />');
o.format = 'raw';
}
@@ -10032,7 +10379,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
// Clear all execCommand listeners this is required to avoid errors if the editor was removed inside another command
t.onExecCommand.listeners = [];
- EditorManager.remove(t);
+ tinymce.remove(t);
DOM.remove(e);
},
@@ -10159,7 +10506,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
each(ed.dom.select('img'), function(e) {
var v;
- if (v = e.getAttribute('mce_src'))
+ if (v = e.getAttribute('_mce_src'))
e.src = t.documentBaseURI.toAbsolute(v);
})
});*/
@@ -10169,7 +10516,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
e = e.target;
- if (e.nodeType === 1 && e.nodeName === 'IMG' && (v = e.getAttribute('mce_src')))
+ if (e.nodeType === 1 && e.nodeName === 'IMG' && (v = e.getAttribute('_mce_src')))
e.src = t.documentBaseURI.toAbsolute(v);
});
}
@@ -10210,6 +10557,19 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
t.onMouseDown.add(setOpts);
}
+ // Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250
+ // WebKit can't even do simple things like selecting an image
+ // This also fixes so it's possible to select mceItemAnchors
+ if (tinymce.isWebKit) {
+ t.onClick.add(function(ed, e) {
+ e = e.target;
+
+ // Needs tobe the setBaseAndExtend or it will fail to select floated images
+ if (e.nodeName == 'IMG' || (e.nodeName == 'A' && t.dom.hasClass(e, 'mceItemAnchor')))
+ t.selection.getSel().setBaseAndExtent(e, 0, e, 1);
+ });
+ }
+
// Add node change handlers
t.onMouseUp.add(t.nodeChanged);
t.onClick.add(t.nodeChanged);
@@ -10241,7 +10601,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
// BlockFormat shortcuts keys
for (i=1; i<=6; i++)
- t.addShortcut('ctrl+' + i, '', ['FormatBlock', false, '<h' + i + '>']);
+ t.addShortcut('ctrl+' + i, '', ['FormatBlock', false, 'h' + i]);
t.addShortcut('ctrl+7', '', ['FormatBlock', false, '<p>']);
t.addShortcut('ctrl+8', '', ['FormatBlock', false, '<div>']);
@@ -10347,7 +10707,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
case 8:
// Fix IE control + backspace browser bug
if (t.selection.getRng().item) {
- t.selection.getRng().item(0).removeNode();
+ ed.dom.remove(t.selection.getRng().item(0));
return Event.cancel(e);
}
}
@@ -10377,43 +10737,21 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
t.undoManager.add();
};
- // Add undo level on editor blur
- if (tinymce.isIE) {
- t.dom.bind(t.getWin(), 'blur', function(e) {
- var n;
-
- // Check added for fullscreen bug
- if (t.selection) {
- n = t.selection.getNode();
-
- // Add undo level is selection was lost to another document
- if (!t.removed && n.ownerDocument && n.ownerDocument != t.getDoc())
- addUndo();
- }
- });
- } else {
- t.dom.bind(t.getDoc(), 'blur', function() {
- if (t.selection && !t.removed)
- addUndo();
- });
- }
-
- t.onMouseDown.add(addUndo);
+ t.dom.bind(t.getDoc(), 'focusout', function(e) {
+ if (!t.removed && t.undoManager.typing)
+ addUndo();
+ });
t.onKeyUp.add(function(ed, e) {
- if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.ctrlKey) {
- t.undoManager.typing = 0;
- t.undoManager.add();
- }
+ if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.ctrlKey)
+ addUndo();
});
t.onKeyDown.add(function(ed, e) {
// Is caracter positon keys
if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45) {
- if (t.undoManager.typing) {
- t.undoManager.add();
- t.undoManager.typing = 0;
- }
+ if (t.undoManager.typing)
+ addUndo();
return;
}
@@ -10423,137 +10761,14 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
t.undoManager.typing = 1;
}
});
- }
- },
- _convertInlineElements : function() {
- var t = this, s = t.settings, dom = t.dom, v, e, na, st, sp;
-
- function convert(ed, o) {
- if (!s.inline_styles)
- return;
-
- if (o.get) {
- each(t.dom.select('table,u,strike', o.node), function(n) {
- switch (n.nodeName) {
- case 'TABLE':
- if (v = dom.getAttrib(n, 'height')) {
- dom.setStyle(n, 'height', v);
- dom.setAttrib(n, 'height', '');
- }
- break;
-
- case 'U':
- case 'STRIKE':
- //sp = dom.create('span', {style : dom.getAttrib(n, 'style')});
- n.style.textDecoration = n.nodeName == 'U' ? 'underline' : 'line-through';
- dom.setAttrib(n, 'mce_style', '');
- dom.setAttrib(n, 'mce_name', 'span');
- break;
- }
- });
- } else if (o.set) {
- each(t.dom.select('table,span', o.node).reverse(), function(n) {
- if (n.nodeName == 'TABLE') {
- if (v = dom.getStyle(n, 'height'))
- dom.setAttrib(n, 'height', v.replace(/[^0-9%]+/g, ''));
- } else {
- // Convert spans to elements
- if (n.style.textDecoration == 'underline')
- na = 'u';
- else if (n.style.textDecoration == 'line-through')
- na = 'strike';
- else
- na = '';
-
- if (na) {
- n.style.textDecoration = '';
- dom.setAttrib(n, 'mce_style', '');
-
- e = dom.create(na, {
- style : dom.getAttrib(n, 'style')
- });
-
- dom.replace(e, n, 1);
- }
- }
- });
- }
- };
-
- t.onPreProcess.add(convert);
-
- if (!s.cleanup_on_startup) {
- t.onSetContent.add(function(ed, o) {
- if (o.initial)
- convert(t, {node : t.getBody(), set : 1});
+ t.onMouseDown.add(function() {
+ if (t.undoManager.typing)
+ addUndo();
});
}
},
- _convertFonts : function() {
- var t = this, s = t.settings, dom = t.dom, fz, fzn, sl, cl;
-
- // No need
- if (!s.inline_styles)
- return;
-
- // Font pt values and font size names
- fz = [8, 10, 12, 14, 18, 24, 36];
- fzn = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large'];
-
- if (sl = s.font_size_style_values)
- sl = explode(sl);
-
- if (cl = s.font_size_classes)
- cl = explode(cl);
-
- function process(no) {
- var n, sp, nl, x;
-
- // Keep unit tests happy
- if (!s.inline_styles)
- return;
-
- nl = t.dom.select('font', no);
- for (x = nl.length - 1; x >= 0; x--) {
- n = nl[x];
-
- sp = dom.create('span', {
- style : dom.getAttrib(n, 'style'),
- 'class' : dom.getAttrib(n, 'class')
- });
-
- dom.setStyles(sp, {
- fontFamily : dom.getAttrib(n, 'face'),
- color : dom.getAttrib(n, 'color'),
- backgroundColor : n.style.backgroundColor
- });
-
- if (n.size) {
- if (sl)
- dom.setStyle(sp, 'fontSize', sl[parseInt(n.size) - 1]);
- else
- dom.setAttrib(sp, 'class', cl[parseInt(n.size) - 1]);
- }
-
- dom.setAttrib(sp, 'mce_style', '');
- dom.replace(sp, n, 1);
- }
- };
-
- // Run on cleanup
- t.onPreProcess.add(function(ed, o) {
- if (o.get)
- process(o.node);
- });
-
- t.onSetContent.add(function(ed, o) {
- if (o.initial)
- process(o.node);
- });
- },
-
_isHidden : function() {
var s;
@@ -10617,1070 +10832,519 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
}
});
})(tinymce);
-(function(tinymce) {
- var each = tinymce.each, isIE = tinymce.isIE, isGecko = tinymce.isGecko, isOpera = tinymce.isOpera, isWebKit = tinymce.isWebKit;
-
- tinymce.create('tinymce.EditorCommands', {
- EditorCommands : function(ed) {
- this.editor = ed;
- },
-
- execCommand : function(cmd, ui, val) {
- var t = this, ed = t.editor, f;
- switch (cmd) {
- // Ignore these
- case 'mceResetDesignMode':
- case 'mceBeginUndoLevel':
- return true;
-
- // Ignore these
- case 'unlink':
- t.UnLink();
- return true;
-
- // Bundle these together
- case 'JustifyLeft':
- case 'JustifyCenter':
- case 'JustifyRight':
- case 'JustifyFull':
- t.mceJustify(cmd, cmd.substring(7).toLowerCase());
- return true;
-
- default:
- f = this[cmd];
-
- if (f) {
- f.call(this, ui, val);
- return true;
- }
- }
-
- return false;
- },
-
- Indent : function() {
- var ed = this.editor, d = ed.dom, s = ed.selection, e, iv, iu;
-
- // Setup indent level
- iv = ed.settings.indentation;
- iu = /[a-z%]+$/i.exec(iv);
- iv = parseInt(iv);
-
- if (ed.settings.inline_styles && (!this.queryStateInsertUnorderedList() && !this.queryStateInsertOrderedList())) {
- each(s.getSelectedBlocks(), function(e) {
- d.setStyle(e, 'paddingLeft', (parseInt(e.style.paddingLeft || 0) + iv) + iu);
- });
-
- return;
- }
-
- ed.getDoc().execCommand('Indent', false, null);
-
- if (isIE) {
- d.getParent(s.getNode(), function(n) {
- if (n.nodeName == 'BLOCKQUOTE') {
- n.dir = n.style.cssText = '';
- }
- });
- }
- },
-
- Outdent : function() {
- var ed = this.editor, d = ed.dom, s = ed.selection, e, v, iv, iu;
-
- // Setup indent level
- iv = ed.settings.indentation;
- iu = /[a-z%]+$/i.exec(iv);
- iv = parseInt(iv);
-
- if (ed.settings.inline_styles && (!this.queryStateInsertUnorderedList() && !this.queryStateInsertOrderedList())) {
- each(s.getSelectedBlocks(), function(e) {
- v = Math.max(0, parseInt(e.style.paddingLeft || 0) - iv);
- d.setStyle(e, 'paddingLeft', v ? v + iu : '');
- });
-
- return;
- }
-
- ed.getDoc().execCommand('Outdent', false, null);
- },
-
-/*
- mceSetAttribute : function(u, v) {
- var ed = this.editor, d = ed.dom, e;
-
- if (e = d.getParent(ed.selection.getNode(), d.isBlock))
- d.setAttrib(e, v.name, v.value);
- },
-*/
- mceSetContent : function(u, v) {
- this.editor.setContent(v);
- },
-
- mceToggleVisualAid : function() {
- var ed = this.editor;
-
- ed.hasVisual = !ed.hasVisual;
- ed.addVisual();
- },
-
- mceReplaceContent : function(u, v) {
- var s = this.editor.selection;
-
- s.setContent(v.replace(/\{\$selection\}/g, s.getContent({format : 'text'})));
- },
-
- mceInsertLink : function(u, v) {
- var ed = this.editor, s = ed.selection, e = ed.dom.getParent(s.getNode(), 'a');
-
- if (tinymce.is(v, 'string'))
- v = {href : v};
-
- function set(e) {
- each(v, function(v, k) {
- ed.dom.setAttrib(e, k, v);
- });
- };
-
- if (!e) {
- ed.execCommand('CreateLink', false, 'javascript:mctmp(0);');
- each(ed.dom.select('a[href=javascript:mctmp(0);]'), function(e) {
- set(e);
- });
- } else {
- if (v.href)
- set(e);
- else
- ed.dom.remove(e, 1);
- }
- },
-
- UnLink : function() {
- var ed = this.editor, s = ed.selection;
-
- if (s.isCollapsed())
- s.select(s.getNode());
-
- ed.getDoc().execCommand('unlink', false, null);
- s.collapse(0);
- },
-
- FontName : function(u, v) {
- var t = this, ed = t.editor, s = ed.selection, e;
-
- if (!v) {
- if (s.isCollapsed())
- s.select(s.getNode());
- } else {
- if (ed.settings.convert_fonts_to_spans)
- t._applyInlineStyle('span', {style : {fontFamily : v}});
- else
- ed.getDoc().execCommand('FontName', false, v);
- }
- },
+(function(tinymce) {
+ // Added for compression purposes
+ var each = tinymce.each, undefined, TRUE = true, FALSE = false;
- FontSize : function(u, v) {
- var ed = this.editor, s = ed.settings, fc, fs;
+ tinymce.EditorCommands = function(editor) {
+ var dom = editor.dom,
+ selection = editor.selection,
+ commands = {state: {}, exec : {}, value : {}},
+ settings = editor.settings,
+ bookmark;
- // Use style options instead
- if (s.convert_fonts_to_spans && v >= 1 && v <= 7) {
- fs = tinymce.explode(s.font_size_style_values);
- fc = tinymce.explode(s.font_size_classes);
+ function execCommand(command, ui, value) {
+ var func;
- if (fc)
- v = fc[v - 1] || v;
- else
- v = fs[v - 1] || v;
+ command = command.toLowerCase();
+ if (func = commands.exec[command]) {
+ func(command, ui, value);
+ return TRUE;
}
- if (v >= 1 && v <= 7)
- ed.getDoc().execCommand('FontSize', false, v);
- else
- this._applyInlineStyle('span', {style : {fontSize : v}});
- },
-
- queryCommandValue : function(c) {
- var f = this['queryValue' + c];
-
- if (f)
- return f.call(this, c);
-
- return false;
- },
-
- queryCommandState : function(cmd) {
- var f;
+ return FALSE;
+ };
- switch (cmd) {
- // Bundle these together
- case 'JustifyLeft':
- case 'JustifyCenter':
- case 'JustifyRight':
- case 'JustifyFull':
- return this.queryStateJustify(cmd, cmd.substring(7).toLowerCase());
+ function queryCommandState(command) {
+ var func;
- default:
- if (f = this['queryState' + cmd])
- return f.call(this, cmd);
- }
+ command = command.toLowerCase();
+ if (func = commands.state[command])
+ return func(command);
return -1;
- },
+ };
- _queryState : function(c) {
- try {
- return this.editor.getDoc().queryCommandState(c);
- } catch (ex) {
- // Ignore exception
- }
- },
+ function queryCommandValue(command) {
+ var func;
- _queryVal : function(c) {
- try {
- return this.editor.getDoc().queryCommandValue(c);
- } catch (ex) {
- // Ignore exception
- }
- },
+ command = command.toLowerCase();
+ if (func = commands.value[command])
+ return func(command);
- queryValueFontSize : function() {
- var ed = this.editor, v = 0, p;
+ return FALSE;
+ };
- if (p = ed.dom.getParent(ed.selection.getNode(), 'span'))
- v = p.style.fontSize;
+ function addCommands(command_list, type) {
+ type = type || 'exec';
- if (!v && (isOpera || isWebKit)) {
- if (p = ed.dom.getParent(ed.selection.getNode(), 'font'))
- v = p.size;
+ each(command_list, function(callback, command) {
+ each(command.toLowerCase().split(','), function(command) {
+ commands[type][command] = callback;
+ });
+ });
+ };
- return v;
- }
+ // Expose public methods
+ tinymce.extend(this, {
+ execCommand : execCommand,
+ queryCommandState : queryCommandState,
+ queryCommandValue : queryCommandValue,
+ addCommands : addCommands
+ });
- return v || this._queryVal('FontSize');
- },
+ // Private methods
- queryValueFontName : function() {
- var ed = this.editor, v = 0, p;
+ function execNativeCommand(command, ui, value) {
+ if (ui === undefined)
+ ui = FALSE;
- if (p = ed.dom.getParent(ed.selection.getNode(), 'font'))
- v = p.face;
+ if (value === undefined)
+ value = null;
- if (p = ed.dom.getParent(ed.selection.getNode(), 'span'))
- v = p.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase();
+ return editor.getDoc().execCommand(command, ui, value);
+ };
- if (!v)
- v = this._queryVal('FontName');
+ function isFormatMatch(name) {
+ return editor.formatter.match(name);
+ };
- return v;
- },
+ function toggleFormat(name, value) {
+ editor.formatter.toggle(name, value ? {value : value} : undefined);
+ };
- mceJustify : function(c, v) {
- var ed = this.editor, se = ed.selection, n = se.getNode(), nn = n.nodeName, bl, nb, dom = ed.dom, rm;
+ function storeSelection(type) {
+ bookmark = selection.getBookmark(type);
+ };
- if (ed.settings.inline_styles && this.queryStateJustify(c, v))
- rm = 1;
+ function restoreSelection() {
+ selection.moveToBookmark(bookmark);
+ };
- bl = dom.getParent(n, ed.dom.isBlock);
+ // Add execCommand overrides
+ addCommands({
+ // Ignore these, added for compatibility
+ 'mceResetDesignMode,mceBeginUndoLevel' : function() {},
- if (nn == 'IMG') {
- if (v == 'full')
- return;
+ // Add undo manager logic
+ 'mceEndUndoLevel,mceAddUndoLevel' : function() {
+ editor.undoManager.add();
+ },
- if (rm) {
- if (v == 'center')
- dom.setStyle(bl || n.parentNode, 'textAlign', '');
+ 'Cut,Copy,Paste' : function(command) {
+ var doc = editor.getDoc(), failed;
- dom.setStyle(n, 'float', '');
- this.mceRepaint();
- return;
+ // Try executing the native command
+ try {
+ execNativeCommand(command);
+ } catch (ex) {
+ // Command failed
+ failed = TRUE;
}
- if (v == 'center') {
- // Do not change table elements
- if (bl && /^(TD|TH)$/.test(bl.nodeName))
- bl = 0;
-
- if (!bl || bl.childNodes.length > 1) {
- nb = dom.create('p');
- nb.appendChild(n.cloneNode(false));
-
- if (bl)
- dom.insertAfter(nb, bl);
- else
- dom.insertAfter(nb, n);
-
- dom.remove(n);
- n = nb.firstChild;
- bl = nb;
- }
-
- dom.setStyle(bl, 'textAlign', v);
- dom.setStyle(n, 'float', '');
- } else {
- dom.setStyle(n, 'float', v);
- dom.setStyle(bl || n.parentNode, 'textAlign', '');
+ // Present alert message about clipboard access not being available
+ if (failed || !doc.queryCommandEnabled(command)) {
+ if (tinymce.isGecko) {
+ editor.windowManager.confirm(editor.getLang('clipboard_msg'), function(state) {
+ if (state)
+ open('http://www.mozilla.org/editor/midasdemo/securityprefs.html', '_blank');
+ });
+ } else
+ editor.windowManager.alert(editor.getLang('clipboard_no_support'));
}
+ },
- this.mceRepaint();
- return;
- }
-
- // Handle the alignment outselfs, less quirks in all browsers
- if (ed.settings.inline_styles && ed.settings.forced_root_block) {
- if (rm)
- v = '';
-
- each(se.getSelectedBlocks(dom.getParent(se.getStart(), dom.isBlock), dom.getParent(se.getEnd(), dom.isBlock)), function(e) {
- dom.setAttrib(e, 'align', '');
- dom.setStyle(e, 'textAlign', v == 'full' ? 'justify' : v);
- });
-
- return;
- } else if (!rm)
- ed.getDoc().execCommand(c, false, null);
-
- if (ed.settings.inline_styles) {
- if (rm) {
- dom.getParent(ed.selection.getNode(), function(n) {
- if (n.style && n.style.textAlign)
- dom.setStyle(n, 'textAlign', '');
- });
+ // Override unlink command
+ unlink : function(command) {
+ if (selection.isCollapsed())
+ selection.select(selection.getNode());
- return;
- }
-
- each(dom.select('*'), function(n) {
- var v = n.align;
+ execNativeCommand(command);
+ selection.collapse(FALSE);
+ },
- if (v) {
- if (v == 'full')
- v = 'justify';
+ // Override justify commands to use the text formatter engine
+ 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull' : function(command) {
+ var align = command.substring(7);
- dom.setStyle(n, 'textAlign', v);
- dom.setAttrib(n, 'align', '');
- }
+ // Remove all other alignments first
+ each('left,center,right,full'.split(','), function(name) {
+ if (align != name)
+ editor.formatter.remove('align' + name);
});
- }
- },
-
- mceSetCSSClass : function(u, v) {
- this.mceSetStyleInfo(0, {command : 'setattrib', name : 'class', value : v});
- },
-
- getSelectedElement : function() {
- var t = this, ed = t.editor, dom = ed.dom, se = ed.selection, r = se.getRng(), r1, r2, sc, ec, so, eo, e, sp, ep, re;
-
- if (se.isCollapsed() || r.item)
- return se.getNode();
-
- // Setup regexp
- re = ed.settings.merge_styles_invalid_parents;
- if (tinymce.is(re, 'string'))
- re = new RegExp(re, 'i');
-
- if (isIE) {
- r1 = r.duplicate();
- r1.collapse(true);
- sc = r1.parentElement();
- r2 = r.duplicate();
- r2.collapse(false);
- ec = r2.parentElement();
-
- if (sc != ec) {
- r1.move('character', 1);
- sc = r1.parentElement();
- }
+ toggleFormat('align' + align);
+ },
- if (sc == ec) {
- r1 = r.duplicate();
- r1.moveToElementText(sc);
+ // Override list commands to fix WebKit bug
+ 'InsertUnorderedList,InsertOrderedList' : function(command) {
+ var listElm, listParent;
- if (r1.compareEndPoints('StartToStart', r) == 0 && r1.compareEndPoints('EndToEnd', r) == 0)
- return re && re.test(sc.nodeName) ? null : sc;
- }
- } else {
- function getParent(n) {
- return dom.getParent(n, '*');
- };
+ execNativeCommand(command);
- sc = r.startContainer;
- ec = r.endContainer;
- so = r.startOffset;
- eo = r.endOffset;
+ // WebKit produces lists within block elements so we need to split them
+ // we will replace the native list creation logic to custom logic later on
+ // TODO: Remove this when the list creation logic is removed
+ listElm = dom.getParent(selection.getNode(), 'ol,ul');
+ if (listElm) {
+ listParent = listElm.parentNode;
- if (!r.collapsed) {
- if (sc == ec) {
- if (so - eo < 2) {
- if (sc.hasChildNodes()) {
- sp = sc.childNodes[so];
- return re && re.test(sp.nodeName) ? null : sp;
- }
- }
+ // If list is within a text block then split that block
+ if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) {
+ storeSelection();
+ dom.split(listParent, listElm);
+ restoreSelection();
}
}
+ },
- if (sc.nodeType != 3 || ec.nodeType != 3)
- return null;
-
- if (so == 0) {
- sp = getParent(sc);
-
- if (sp && sp.firstChild != sc)
- sp = null;
- }
+ // Override commands to use the text formatter engine
+ 'Bold,Italic,Underline,Strikethrough' : function(command) {
+ toggleFormat(command);
+ },
- if (so == sc.nodeValue.length) {
- e = sc.nextSibling;
+ // Override commands to use the text formatter engine
+ 'ForeColor,HiliteColor,FontName' : function(command, ui, value) {
+ toggleFormat(command, value);
+ },
- if (e && e.nodeType == 1)
- sp = sc.nextSibling;
- }
+ FontSize : function(command, ui, value) {
+ var fontClasses, fontSizes;
- if (eo == 0) {
- e = ec.previousSibling;
+ // Convert font size 1-7 to styles
+ if (value >= 1 && value <= 7) {
+ fontSizes = tinymce.explode(settings.font_size_style_values);
+ fontClasses = tinymce.explode(settings.font_size_classes);
- if (e && e.nodeType == 1)
- ep = e;
+ if (fontClasses)
+ value = fontClasses[value - 1] || value;
+ else
+ value = fontSizes[value - 1] || value;
}
- if (eo == ec.nodeValue.length) {
- ep = getParent(ec);
-
- if (ep && ep.lastChild != ec)
- ep = null;
- }
+ toggleFormat(command, value);
+ },
- // Same element
- if (sp == ep)
- return re && sp && re.test(sp.nodeName) ? null : sp;
- }
+ RemoveFormat : function(command) {
+ editor.formatter.remove(command);
+ },
- return null;
- },
+ mceBlockQuote : function(command) {
+ toggleFormat('blockquote');
+ },
- mceSetStyleInfo : function(u, v) {
- var t = this, ed = t.editor, d = ed.getDoc(), dom = ed.dom, e, b, s = ed.selection, nn = v.wrapper || 'span', b = s.getBookmark(), re;
+ FormatBlock : function(command, ui, value) {
+ return toggleFormat(value);
+ },
- function set(n, e) {
- if (n.nodeType == 1) {
- switch (v.command) {
- case 'setattrib':
- return dom.setAttrib(n, v.name, v.value);
+ mceCleanup : function() {
+ storeSelection();
+ editor.setContent(editor.getContent({cleanup : TRUE}), {cleanup : TRUE});
+ restoreSelection();
+ },
- case 'setstyle':
- return dom.setStyle(n, v.name, v.value);
+ mceRemoveNode : function(command, ui, value) {
+ var node = value || selection.getNode();
- case 'removeformat':
- return dom.setAttrib(n, 'class', '');
- }
+ // Make sure that the body node isn't removed
+ if (node != ed.getBody()) {
+ storeSelection();
+ editor.dom.remove(node, TRUE);
+ restoreSelection();
}
- };
-
- // Setup regexp
- re = ed.settings.merge_styles_invalid_parents;
- if (tinymce.is(re, 'string'))
- re = new RegExp(re, 'i');
-
- // Set style info on selected element
- if ((e = t.getSelectedElement()) && !ed.settings.force_span_wrappers)
- set(e, 1);
- else {
- // Generate wrappers and set styles on them
- d.execCommand('FontName', false, '__');
- each(dom.select('span,font'), function(n) {
- var sp, e;
-
- if (dom.getAttrib(n, 'face') == '__' || n.style.fontFamily === '__') {
- sp = dom.create(nn, {mce_new : '1'});
-
- set(sp);
+ },
- each (n.childNodes, function(n) {
- sp.appendChild(n.cloneNode(true));
- });
+ mceSelectNodeDepth : function(command, ui, value) {
+ var counter = 0;
- dom.replace(sp, n);
+ dom.getParent(selection.getNode(), function(node) {
+ if (node.nodeType == 1 && counter++ == value) {
+ selection.select(node);
+ return FALSE;
}
- });
- }
-
- // Remove wrappers inside new ones
- each(dom.select(nn).reverse(), function(n) {
- var p = n.parentNode;
-
- // Check if it's an old span in a new wrapper
- if (!dom.getAttrib(n, 'mce_new')) {
- // Find new wrapper
- p = dom.getParent(n, '*[mce_new]');
-
- if (p)
- dom.remove(n, 1);
- }
- });
-
- // Merge wrappers with parent wrappers
- each(dom.select(nn).reverse(), function(n) {
- var p = n.parentNode;
-
- if (!p || !dom.getAttrib(n, 'mce_new'))
- return;
-
- if (ed.settings.force_span_wrappers && p.nodeName != 'SPAN')
- return;
-
- // Has parent of the same type and only child
- if (p.nodeName == nn.toUpperCase() && p.childNodes.length == 1)
- return dom.remove(p, 1);
-
- // Has parent that is more suitable to have the class and only child
- if (n.nodeType == 1 && (!re || !re.test(p.nodeName)) && p.childNodes.length == 1) {
- set(p); // Set style info on parent instead
- dom.setAttrib(n, 'class', '');
- }
- });
-
- // Remove empty wrappers
- each(dom.select(nn).reverse(), function(n) {
- if (dom.getAttrib(n, 'mce_new') || (dom.getAttribs(n).length <= 1 && n.className === '')) {
- if (!dom.getAttrib(n, 'class') && !dom.getAttrib(n, 'style'))
- return dom.remove(n, 1);
-
- dom.setAttrib(n, 'mce_new', ''); // Remove mce_new marker
- }
- });
-
- s.moveToBookmark(b);
- },
-
- queryStateJustify : function(c, v) {
- var ed = this.editor, n = ed.selection.getNode(), dom = ed.dom;
-
- if (n && n.nodeName == 'IMG') {
- if (dom.getStyle(n, 'float') == v)
- return 1;
+ }, editor.getBody());
+ },
- return n.parentNode.style.textAlign == v;
- }
+ mceSelectNode : function(command, ui, value) {
+ selection.select(value);
+ },
- n = dom.getParent(ed.selection.getStart(), function(n) {
- return n.nodeType == 1 && n.style.textAlign;
- });
+ mceInsertContent : function(command, ui, value) {
+ selection.setContent(value);
+ },
- if (v == 'full')
- v = 'justify';
+ mceInsertRawHTML : function(command, ui, value) {
+ selection.setContent('tiny_mce_marker');
+ editor.setContent(editor.getContent().replace(/tiny_mce_marker/g, value));
+ },
- if (ed.settings.inline_styles)
- return (n && n.style.textAlign == v);
+ mceSetContent : function(command, ui, value) {
+ editor.setContent(value);
+ },
- return this._queryState(c);
- },
+ 'Indent,Outdent' : function(command) {
+ var intentValue, indentUnit, value;
- ForeColor : function(ui, v) {
- var ed = this.editor;
+ // Setup indent level
+ intentValue = settings.indentation;
+ indentUnit = /[a-z%]+$/i.exec(intentValue);
+ intentValue = parseInt(intentValue);
- if (ed.settings.convert_fonts_to_spans) {
- this._applyInlineStyle('span', {style : {color : v}});
- return;
- } else
- ed.getDoc().execCommand('ForeColor', false, v);
- },
+ if (!queryCommandState('InsertUnorderedList') && !queryCommandState('InsertOrderedList')) {
+ each(selection.getSelectedBlocks(), function(element) {
+ if (command == 'outdent') {
+ value = Math.max(0, parseInt(element.style.paddingLeft || 0) - intentValue);
+ dom.setStyle(element, 'paddingLeft', value ? value + indentUnit : '');
+ } else
+ dom.setStyle(element, 'paddingLeft', (parseInt(element.style.paddingLeft || 0) + intentValue) + indentUnit);
+ });
+ } else
+ execNativeCommand(command);
+ },
- HiliteColor : function(ui, val) {
- var t = this, ed = t.editor, d = ed.getDoc();
+ mceRepaint : function() {
+ var bookmark;
- if (ed.settings.convert_fonts_to_spans) {
- this._applyInlineStyle('span', {style : {backgroundColor : val}});
- return;
- }
+ if (tinymce.isGecko) {
+ try {
+ storeSelection(TRUE);
- function set(s) {
- if (!isGecko)
- return;
+ if (selection.getSel())
+ selection.getSel().selectAllChildren(editor.getBody());
- try {
- // Try new Gecko method
- d.execCommand("styleWithCSS", 0, s);
- } catch (ex) {
- // Use old
- d.execCommand("useCSS", 0, !s);
+ selection.collapse(TRUE);
+ restoreSelection();
+ } catch (ex) {
+ // Ignore
+ }
}
- };
+ },
- if (isGecko || isOpera) {
- set(true);
- d.execCommand('hilitecolor', false, val);
- set(false);
- } else
- d.execCommand('BackColor', false, val);
- },
+ mceToggleFormat : function(command, ui, value) {
+ editor.formatter.toggle(value);
+ },
- FormatBlock : function(ui, val) {
- var t = this, ed = t.editor, s = ed.selection, dom = ed.dom, bl, nb, b;
+ InsertHorizontalRule : function() {
+ selection.setContent('<hr />');
+ },
- function isBlock(n) {
- return /^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(n.nodeName);
- };
+ mceToggleVisualAid : function() {
+ editor.hasVisual = !editor.hasVisual;
+ editor.addVisual();
+ },
- bl = dom.getParent(s.getNode(), function(n) {
- return isBlock(n);
- });
+ mceReplaceContent : function(command, ui, value) {
+ selection.setContent(value.replace(/\{\$selection\}/g, selection.getContent({format : 'text'})));
+ },
- // IE has an issue where it removes the parent div if you change format on the paragrah in <div><p>Content</p></div>
- // FF and Opera doesn't change parent DIV elements if you switch format
- if (bl) {
- if ((isIE && isBlock(bl.parentNode)) || bl.nodeName == 'DIV') {
- // Rename block element
- nb = ed.dom.create(val);
+ mceInsertLink : function(command, ui, value) {
+ var link = dom.getParent(selection.getNode(), 'a');
- each(dom.getAttribs(bl), function(v) {
- dom.setAttrib(nb, v.nodeName, dom.getAttrib(bl, v.nodeName));
- });
+ if (tinymce.is(value, 'string'))
+ value = {href : value};
- b = s.getBookmark();
- dom.replace(nb, bl, 1);
- s.moveToBookmark(b);
- ed.nodeChanged();
- return;
+ if (!link) {
+ execNativeCommand('CreateLink', FALSE, 'javascript:mctmp(0);');
+ each(dom.select('a[href=javascript:mctmp(0);]'), function(link) {
+ dom.setAttribs(link, value);
+ });
+ } else {
+ if (value.href)
+ dom.setAttribs(link, value);
+ else
+ ed.dom.remove(link, TRUE);
}
}
+ });
- val = ed.settings.forced_root_block ? (val || '<p>') : val;
-
- if (val.indexOf('<') == -1)
- val = '<' + val + '>';
-
- if (tinymce.isGecko)
- val = val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi, '$1');
-
- ed.getDoc().execCommand('FormatBlock', false, val);
- },
-
- mceCleanup : function() {
- var ed = this.editor, s = ed.selection, b = s.getBookmark();
- ed.setContent(ed.getContent());
- s.moveToBookmark(b);
- },
+ // Add queryCommandState overrides
+ addCommands({
+ // Override justify commands
+ 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull' : function(command) {
+ return isFormatMatch('align' + command.substring(7));
+ },
- mceRemoveNode : function(ui, val) {
- var ed = this.editor, s = ed.selection, b, n = val || s.getNode();
+ 'Bold,Italic,Underline,Strikethrough' : function(command) {
+ return isFormatMatch(command);
+ },
- // Make sure that the body node isn't removed
- if (n == ed.getBody())
- return;
+ mceBlockQuote : function() {
+ return isFormatMatch('blockquote');
+ },
- b = s.getBookmark();
- ed.dom.remove(n, 1);
- s.moveToBookmark(b);
- ed.nodeChanged();
- },
+ Outdent : function() {
+ var node;
- mceSelectNodeDepth : function(ui, val) {
- var ed = this.editor, s = ed.selection, c = 0;
+ if (settings.inline_styles) {
+ if ((node = dom.getParent(selection.getStart(), dom.isBlock)) && parseInt(node.style.paddingLeft) > 0)
+ return TRUE;
- ed.dom.getParent(s.getNode(), function(n) {
- if (n.nodeType == 1 && c++ == val) {
- s.select(n);
- ed.nodeChanged();
- return false;
+ if ((node = dom.getParent(selection.getEnd(), dom.isBlock)) && parseInt(node.style.paddingLeft) > 0)
+ return TRUE;
}
- }, ed.getBody());
- },
-
- mceSelectNode : function(u, v) {
- this.editor.selection.select(v);
- },
-
- mceInsertContent : function(ui, val) {
- this.editor.selection.setContent(val);
- },
-
- mceInsertRawHTML : function(ui, val) {
- var ed = this.editor;
-
- ed.selection.setContent('tiny_mce_marker');
- ed.setContent(ed.getContent().replace(/tiny_mce_marker/g, val));
- },
- mceRepaint : function() {
- var s, b, e = this.editor;
-
- if (tinymce.isGecko) {
- try {
- s = e.selection;
- b = s.getBookmark(true);
-
- if (s.getSel())
- s.getSel().selectAllChildren(e.getBody());
+ return queryCommandState('InsertUnorderedList') || queryCommandState('InsertOrderedList') || (!settings.inline_styles && !!dom.getParent(selection.getNode(), 'BLOCKQUOTE'));
+ },
- s.collapse(true);
- s.moveToBookmark(b);
- } catch (ex) {
- // Ignore
- }
+ 'InsertUnorderedList,InsertOrderedList' : function(command) {
+ return dom.getParent(selection.getNode(), command == 'insertunorderedlist' ? 'UL' : 'OL');
}
- },
+ }, 'state');
- queryStateUnderline : function() {
- var ed = this.editor, n = ed.selection.getNode();
+ // Add queryCommandValue overrides
+ addCommands({
+ 'FontSize,FontName' : function(command) {
+ var value = 0, parent;
- if (n && n.nodeName == 'A')
- return false;
-
- return this._queryState('Underline');
- },
-
- queryStateOutdent : function() {
- var ed = this.editor, n;
-
- if (ed.settings.inline_styles) {
- if ((n = ed.dom.getParent(ed.selection.getStart(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0)
- return true;
+ if (parent = dom.getParent(selection.getNode(), 'span')) {
+ if (command == 'fontsize')
+ value = parent.style.fontSize;
+ else
+ value = parent.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase();
+ }
- if ((n = ed.dom.getParent(ed.selection.getEnd(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0)
- return true;
+ return value;
}
+ }, 'value');
- return this.queryStateInsertUnorderedList() || this.queryStateInsertOrderedList() || (!ed.settings.inline_styles && !!ed.dom.getParent(ed.selection.getNode(), 'BLOCKQUOTE'));
- },
-
- queryStateInsertUnorderedList : function() {
- return this.editor.dom.getParent(this.editor.selection.getNode(), 'UL');
- },
-
- queryStateInsertOrderedList : function() {
- return this.editor.dom.getParent(this.editor.selection.getNode(), 'OL');
- },
-
- queryStatemceBlockQuote : function() {
- return !!this.editor.dom.getParent(this.editor.selection.getStart(), function(n) {return n.nodeName === 'BLOCKQUOTE';});
- },
-
- _applyInlineStyle : function(na, at, op) {
- var t = this, ed = t.editor, dom = ed.dom, bm, lo = {}, kh, found;
-
- na = na.toUpperCase();
-
- if (op && op.check_classes && at['class'])
- op.check_classes.push(at['class']);
-
- function removeEmpty() {
- each(dom.select(na).reverse(), function(n) {
- var c = 0;
-
- // Check if there is any attributes
- each(dom.getAttribs(n), function(an) {
- if (an.nodeName.substring(0, 1) != '_' && dom.getAttrib(n, an.nodeName) != '') {
- //console.log(dom.getOuterHTML(n), dom.getAttrib(n, an.nodeName));
- c++;
- }
- });
-
- // No attributes then remove the element and keep the children
- if (c == 0)
- dom.remove(n, 1);
- });
- };
-
- function replaceFonts() {
- var bm;
-
- each(dom.select('span,font'), function(n) {
- if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline') {
- if (!bm)
- bm = ed.selection.getBookmark();
-
- at._mce_new = '1';
- dom.replace(dom.create(na, at), n, 1);
- }
- });
-
- // Remove redundant elements
- each(dom.select(na + '[_mce_new]'), function(n) {
- function removeStyle(n) {
- if (n.nodeType == 1) {
- each(at.style, function(v, k) {
- dom.setStyle(n, k, '');
- });
-
- // Remove spans with the same class or marked classes
- if (at['class'] && n.className && op) {
- each(op.check_classes, function(c) {
- if (dom.hasClass(n, c))
- dom.removeClass(n, c);
- });
- }
- }
- };
-
- // Remove specified style information from child elements
- each(dom.select(na, n), removeStyle);
-
- // Remove the specified style information on parent if current node is only child (IE)
- if (n.parentNode && n.parentNode.nodeType == 1 && n.parentNode.childNodes.length == 1)
- removeStyle(n.parentNode);
-
- // Remove the child elements style info if a parent already has it
- dom.getParent(n.parentNode, function(pn) {
- if (pn.nodeType == 1) {
- if (at.style) {
- each(at.style, function(v, k) {
- var sv;
-
- if (!lo[k] && (sv = dom.getStyle(pn, k))) {
- if (sv === v)
- dom.setStyle(n, k, '');
-
- lo[k] = 1;
- }
- });
- }
-
- // Remove spans with the same class or marked classes
- if (at['class'] && pn.className && op) {
- each(op.check_classes, function(c) {
- if (dom.hasClass(pn, c))
- dom.removeClass(n, c);
- });
- }
- }
-
- return false;
- });
+ // Add undo manager logic
+ if (settings.custom_undo_redo) {
+ addCommands({
+ Undo : function() {
+ editor.undoManager.undo();
+ },
- n.removeAttribute('_mce_new');
- });
-
- removeEmpty();
- ed.selection.moveToBookmark(bm);
-
- return !!bm;
- };
-
- // Create inline elements
- ed.focus();
- ed.getDoc().execCommand('FontName', false, 'mceinline');
- replaceFonts();
-
- if (kh = t._applyInlineStyle.keyhandler) {
- ed.onKeyUp.remove(kh);
- ed.onKeyPress.remove(kh);
- ed.onKeyDown.remove(kh);
- ed.onSetContent.remove(t._applyInlineStyle.chandler);
- }
-
- if (ed.selection.isCollapsed()) {
- // IE will format the current word so this code can't be executed on that browser
- if (!isIE) {
- each(dom.getParents(ed.selection.getNode(), 'span'), function(n) {
- each(at.style, function(v, k) {
- var kv;
-
- if (kv = dom.getStyle(n, k)) {
- if (kv == v) {
- dom.setStyle(n, k, '');
- found = 2;
- return false;
- }
+ Redo : function() {
+ editor.undoManager.redo();
+ }
+ });
+ }
+ };
+})(tinymce);
+(function(tinymce) {
+ var Dispatcher = tinymce.util.Dispatcher;
- found = 1;
- return false;
- }
- });
+ tinymce.UndoManager = function(editor) {
+ var self, index = 0, data = [];
- if (found)
- return false;
- });
+ function getContent() {
+ return tinymce.trim(editor.getContent({format : 'raw', no_events : 1}));
+ };
- if (found == 2) {
- bm = ed.selection.getBookmark();
+ return self = {
+ typing : 0,
- removeEmpty();
+ onAdd : new Dispatcher(self),
+ onUndo : new Dispatcher(self),
+ onRedo : new Dispatcher(self),
- ed.selection.moveToBookmark(bm);
+ add : function(level) {
+ var i, settings = editor.settings, lastLevel;
- // Node change needs to be detached since the onselect event
- // for the select box will run the onclick handler after onselect call. Todo: Add a nicer fix!
- window.setTimeout(function() {
- ed.nodeChanged();
- }, 1);
+ level = level || {};
+ level.content = getContent();
- return;
- }
+ // Add undo level if needed
+ lastLevel = data[index];
+ if (lastLevel && lastLevel.content == level.content) {
+ if (index > 0 || data.length == 1)
+ return null;
}
- // Start collecting styles
- t._pendingStyles = tinymce.extend(t._pendingStyles || {}, at.style);
-
- t._applyInlineStyle.chandler = ed.onSetContent.add(function() {
- delete t._pendingStyles;
- });
+ // Time to compress
+ if (settings.custom_undo_redo_levels) {
+ if (data.length > settings.custom_undo_redo_levels) {
+ for (i = 0; i < data.length - 1; i++)
+ data[i] = data[i + 1];
- t._applyInlineStyle.keyhandler = kh = function(e) {
- // Use pending styles
- if (t._pendingStyles) {
- at.style = t._pendingStyles;
- delete t._pendingStyles;
+ data.length--;
+ index = data.length;
}
+ }
- if (replaceFonts()) {
- ed.onKeyDown.remove(t._applyInlineStyle.keyhandler);
- ed.onKeyPress.remove(t._applyInlineStyle.keyhandler);
- }
-
- if (e.type == 'keyup')
- ed.onKeyUp.remove(t._applyInlineStyle.keyhandler);
- };
-
- ed.onKeyDown.add(kh);
- ed.onKeyPress.add(kh);
- ed.onKeyUp.add(kh);
- } else
- t._pendingStyles = 0;
- }
- });
-})(tinymce);(function(tinymce) {
- tinymce.create('tinymce.UndoManager', {
- index : 0,
- data : null,
- typing : 0,
-
- UndoManager : function(ed) {
- var t = this, Dispatcher = tinymce.util.Dispatcher;
-
- t.editor = ed;
- t.data = [];
- t.onAdd = new Dispatcher(this);
- t.onUndo = new Dispatcher(this);
- t.onRedo = new Dispatcher(this);
- },
-
- add : function(l) {
- var t = this, i, ed = t.editor, b, s = ed.settings, la;
-
- l = l || {};
- l.content = l.content || ed.getContent({format : 'raw', no_events : 1});
-
- // Add undo level if needed
- l.content = l.content.replace(/^\s*|\s*$/g, '');
- la = t.data[t.index > 0 && (t.index == 0 || t.index == t.data.length) ? t.index - 1 : t.index];
- if (!l.initial && la && l.content == la.content)
- return null;
-
- // Time to compress
- if (s.custom_undo_redo_levels) {
- if (t.data.length > s.custom_undo_redo_levels) {
- for (i = 0; i < t.data.length - 1; i++)
- t.data[i] = t.data[i + 1];
+ // Get a non intrusive normalized bookmark
+ level.bookmark = editor.selection.getBookmark(2, true);
- t.data.length--;
- t.index = t.data.length;
+ // Crop array if needed
+ if (index < data.length - 1) {
+ // Treat first level as initial
+ if (index == 0)
+ data = [];
+ else
+ data.length = index + 1;
}
- }
-
- if (s.custom_undo_redo_restore_selection && !l.initial)
- l.bookmark = b = l.bookmark || ed.selection.getBookmark();
- if (t.index < t.data.length)
- t.index++;
+ data.push(level);
+ index = data.length - 1;
- // Only initial marked undo levels should be allowed as first item
- // This to workaround a bug with Firefox and the blur event
- if (t.data.length === 0 && !l.initial)
- return null;
+ self.onAdd.dispatch(self, level);
+ editor.isNotDirty = 0;
- // Add level
- t.data.length = t.index + 1;
- t.data[t.index++] = l;
+ return level;
+ },
- if (l.initial)
- t.index = 0;
+ undo : function() {
+ var level, i;
- // Set initial bookmark use first real undo level
- if (t.data.length == 2 && t.data[0].initial)
- t.data[0].bookmark = b;
+ if (self.typing) {
+ self.add();
+ self.typing = 0;
+ }
- t.onAdd.dispatch(t, l);
- ed.isNotDirty = 0;
+ if (index > 0) {
+ level = data[--index];
- //console.dir(t.data);
+ editor.setContent(level.content, {format : 'raw'});
+ editor.selection.moveToBookmark(level.bookmark);
- return l;
- },
+ self.onUndo.dispatch(self, level);
+ }
- undo : function() {
- var t = this, ed = t.editor, l = l, i;
+ return level;
+ },
- if (t.typing) {
- t.add();
- t.typing = 0;
- }
+ redo : function() {
+ var level;
- if (t.index > 0) {
- // If undo on last index then take snapshot
- if (t.index == t.data.length && t.index > 1) {
- i = t.index;
- t.typing = 0;
+ if (index < data.length - 1) {
+ level = data[++index];
- if (!t.add())
- t.index = i;
+ editor.setContent(level.content, {format : 'raw'});
+ editor.selection.moveToBookmark(level.bookmark);
- --t.index;
+ self.onRedo.dispatch(self, level);
}
- l = t.data[--t.index];
- ed.setContent(l.content, {format : 'raw'});
- ed.selection.moveToBookmark(l.bookmark);
-
- t.onUndo.dispatch(t, l);
- }
-
- return l;
- },
+ return level;
+ },
- redo : function() {
- var t = this, ed = t.editor, l = null;
+ clear : function() {
+ data = [];
+ index = self.typing = 0;
+ },
- if (t.index < t.data.length - 1) {
- l = t.data[++t.index];
- ed.setContent(l.content, {format : 'raw'});
- ed.selection.moveToBookmark(l.bookmark);
+ hasUndo : function() {
+ return index > 0 || self.typing;
+ },
- t.onRedo.dispatch(t, l);
+ hasRedo : function() {
+ return index < data.length - 1;
}
-
- return l;
- },
-
- clear : function() {
- var t = this;
-
- t.data = [];
- t.index = 0;
- t.typing = 0;
- t.add({initial : true});
- },
-
- hasUndo : function() {
- return this.index != 0 || this.typing;
- },
-
- hasRedo : function() {
- return this.index < this.data.length - 1;
- }
- });
+ };
+ };
})(tinymce);
+
(function(tinymce) {
// Shorten names
- var Event, isIE, isGecko, isOpera, each, extend;
-
- Event = tinymce.dom.Event;
- isIE = tinymce.isIE;
- isGecko = tinymce.isGecko;
- isOpera = tinymce.isOpera;
- each = tinymce.each;
- extend = tinymce.extend;
+ var Event = tinymce.dom.Event,
+ isIE = tinymce.isIE,
+ isGecko = tinymce.isGecko,
+ isOpera = tinymce.isOpera,
+ each = tinymce.each,
+ extend = tinymce.extend,
+ TRUE = true,
+ FALSE = false;
// Checks if the selection/caret is at the end of the specified block element
function isAtEnd(rng, par) {
@@ -11699,7 +11363,26 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
n = n.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi, '-'); // Keep these convert them to - chars
n = n.replace(/<[^>]+>/g, ''); // Remove all tags
- return n.replace(/[ \t\r\n]+/g, '') == '';
+ return n.replace(/[ \u00a0\t\r\n]+/g, '') == '';
+ };
+
+ function splitList(selection, dom, li) {
+ var listBlock, block;
+
+ if (isEmpty(li)) {
+ listBlock = dom.getParent(li, 'ul,ol');
+
+ if (!dom.getParent(listBlock.parentNode, 'ul,ol')) {
+ dom.split(listBlock, li);
+ block = dom.create('p', 0, '<br _mce_bogus="1" />');
+ dom.replace(block, li);
+ selection.select(block, 1);
+ }
+
+ return FALSE;
+ }
+
+ return TRUE;
};
tinymce.create('tinymce.ForceBlocks', {
@@ -11744,10 +11427,11 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
},
setup : function() {
- var t = this, ed = t.editor, s = ed.settings;
+ var t = this, ed = t.editor, s = ed.settings, dom = ed.dom, selection = ed.selection;
// Force root blocks when typing and when getting output
if (s.forced_root_block) {
+ ed.onBeforeExecCommand.add(t.forceRoots, t);
ed.onKeyUp.add(t.forceRoots, t);
ed.onPreProcess.add(t.forceRoots, t);
}
@@ -11756,39 +11440,24 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
// Force IE to produce BRs on enter
if (isIE) {
ed.onKeyPress.add(function(ed, e) {
- var n, s = ed.selection;
+ var n;
- if (e.keyCode == 13 && s.getNode().nodeName != 'LI') {
- s.setContent('<br id="__" /> ', {format : 'raw'});
- n = ed.dom.get('__');
+ if (e.keyCode == 13 && selection.getNode().nodeName != 'LI') {
+ selection.setContent('<br id="__" /> ', {format : 'raw'});
+ n = dom.get('__');
n.removeAttribute('id');
- s.select(n);
- s.collapse();
+ selection.select(n);
+ selection.collapse();
return Event.cancel(e);
}
});
}
-
- return;
}
if (!isIE && s.force_p_newlines) {
-/* ed.onPreProcess.add(function(ed, o) {
- each(ed.dom.select('br', o.node), function(n) {
- var p = n.parentNode;
-
- // Replace <p><br /></p> with <p>&nbsp;</p>
- if (p && p.nodeName == 'p' && (p.childNodes.length == 1 || p.lastChild == n)) {
- p.replaceChild(ed.getDoc().createTextNode('\u00a0'), n);
- }
- });
- });*/
-
ed.onKeyPress.add(function(ed, e) {
- if (e.keyCode == 13 && !e.shiftKey) {
- if (!t.insertPara(e))
- Event.cancel(e);
- }
+ if (e.keyCode == 13 && !e.shiftKey && !t.insertPara(e))
+ Event.cancel(e);
});
if (isGecko) {
@@ -11799,32 +11468,53 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
}
}
- function ren(rn, na) {
- var ne = ed.dom.create(na);
+ // Workaround for missing shift+enter support, http://bugs.webkit.org/show_bug.cgi?id=16973
+ if (tinymce.isWebKit) {
+ function insertBr(ed) {
+ var rng = selection.getRng(), br, div = dom.create('div', null, ' '), divYPos, vpHeight = dom.getViewPort(ed.getWin()).h;
- each(rn.attributes, function(a) {
- if (a.specified && a.nodeValue)
- ne.setAttribute(a.nodeName.toLowerCase(), a.nodeValue);
- });
+ // Insert BR element
+ rng.insertNode(br = dom.create('br'));
- each(rn.childNodes, function(n) {
- ne.appendChild(n.cloneNode(true));
- });
+ // Place caret after BR
+ rng.setStartAfter(br);
+ rng.setEndAfter(br);
+ selection.setRng(rng);
- rn.parentNode.replaceChild(ne, rn);
+ // Could not place caret after BR then insert an nbsp entity and move the caret
+ if (selection.getSel().focusNode == br.previousSibling) {
+ selection.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'), br));
+ selection.collapse(TRUE);
+ }
- return ne;
- };
+ // Create a temporary DIV after the BR and get the position as it
+ // seems like getPos() returns 0 for text nodes and BR elements.
+ dom.insertAfter(div, br);
+ divYPos = dom.getPos(div).y;
+ dom.remove(div);
+
+ // Scroll to new position, scrollIntoView can't be used due to bug: http://bugs.webkit.org/show_bug.cgi?id=16117
+ if (divYPos > vpHeight) // It is not necessary to scroll if the DIV is inside the view port.
+ ed.getWin().scrollTo(0, divYPos);
+ };
+
+ ed.onKeyPress.add(function(ed, e) {
+ if (e.keyCode == 13 && (e.shiftKey || s.force_br_newlines)) {
+ insertBr(ed);
+ Event.cancel(e);
+ }
+ });
+ }
// Padd empty inline elements within block elements
// For example: <p><strong><em></em></strong></p> becomes <p><strong><em>&nbsp;</em></strong></p>
ed.onPreProcess.add(function(ed, o) {
- each(ed.dom.select('p,h1,h2,h3,h4,h5,h6,div', o.node), function(p) {
+ each(dom.select('p,h1,h2,h3,h4,h5,h6,div', o.node), function(p) {
if (isEmpty(p)) {
- each(ed.dom.select('span,em,strong,b,i', o.node), function(n) {
+ each(dom.select('span,em,strong,b,i', o.node), function(n) {
if (!n.hasChildNodes()) {
n.appendChild(ed.getDoc().createTextNode('\u00a0'));
- return false; // Break the loop one padding is enough
+ return FALSE; // Break the loop one padding is enough
}
});
}
@@ -11836,22 +11526,22 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
// Replaces IE:s auto generated paragraphs with the specified element name
if (s.element != 'P') {
ed.onKeyPress.add(function(ed, e) {
- t.lastElm = ed.selection.getNode().nodeName;
+ t.lastElm = selection.getNode().nodeName;
});
ed.onKeyUp.add(function(ed, e) {
- var bl, sel = ed.selection, n = sel.getNode(), b = ed.getBody();
+ var bl, n = selection.getNode(), b = ed.getBody();
if (b.childNodes.length === 1 && n.nodeName == 'P') {
- n = ren(n, s.element);
- sel.select(n);
- sel.collapse();
+ n = dom.rename(n, s.element);
+ selection.select(n);
+ selection.collapse();
ed.nodeChanged();
} else if (e.keyCode == 13 && !e.shiftKey && t.lastElm != 'P') {
- bl = ed.dom.getParent(n, 'p');
+ bl = dom.getParent(n, 'p');
if (bl) {
- ren(bl, s.element);
+ dom.rename(bl, s.element);
ed.nodeChanged();
}
}
@@ -11861,7 +11551,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
},
find : function(n, t, s) {
- var ed = this.editor, w = ed.getDoc().createTreeWalker(n, 4, null, false), c = -1;
+ var ed = this.editor, w = ed.getDoc().createTreeWalker(n, 4, null, FALSE), c = -1;
while (n = w.nextNode()) {
c++;
@@ -11884,12 +11574,18 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
// Fix for bug #1863847
//if (e && e.keyCode == 13)
- // return true;
+ // return TRUE;
// Wrap non blocks into blocks
for (i = nl.length - 1; i >= 0; i--) {
nx = nl[i];
+ // Ignore internal elements
+ if (nx.nodeType === 1 && nx.getAttribute('_mce_type')) {
+ bl = null;
+ continue;
+ }
+
// Is text or non block element
if (nx.nodeType === 3 || (!t.dom.isBlock(nx) && nx.nodeType !== 8 && !/^(script|mce:script|style|mce:style)$/i.test(nx.nodeName))) {
if (!bl) {
@@ -12009,21 +11705,21 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
// If root blocks are forced then use Operas default behavior since it's really good
// Removed due to bug: #1853816
// if (se.forced_root_block && isOpera)
-// return true;
+// return TRUE;
// Setup before range
rb = d.createRange();
// If is before the first block element and in body, then move it into first block element
rb.setStart(s.anchorNode, s.anchorOffset);
- rb.collapse(true);
+ rb.collapse(TRUE);
// Setup after range
ra = d.createRange();
// If is before the first block element and in body, then move it into first block element
ra.setStart(s.focusNode, s.focusOffset);
- ra.collapse(true);
+ ra.collapse(TRUE);
// Setup start/end points
dir = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0;
@@ -12054,7 +11750,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
r.collapse(1);
ed.selection.setRng(r);
- return false;
+ return FALSE;
}
// If the caret is in an invalid location in FF we need to move it into the first block
@@ -12079,8 +11775,12 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
bn = sb ? sb.nodeName : se.element; // Get block name to create
// Return inside list use default browser behavior
- if (t.dom.getParent(sb, 'ol,ul,pre'))
- return true;
+ if (n = t.dom.getParent(sb, 'li,pre')) {
+ if (n.nodeName == 'LI')
+ return splitList(ed.selection, t.dom, n);
+
+ return TRUE;
+ }
// If caption or absolute layers then always generate new blocks within
if (sb && (sb.nodeName == 'CAPTION' || /absolute|relative|fixed/gi.test(dom.getStyle(sb, 'position', 1)))) {
@@ -12192,7 +11892,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
do {
// We only want style specific elements
if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(n.nodeName)) {
- nn = n.cloneNode(false);
+ nn = n.cloneNode(FALSE);
dom.setAttrib(nn, 'id', ''); // Remove ID since it needs to be unique
nl.push(nn);
}
@@ -12229,7 +11929,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
bef.normalize();
function first(n) {
- return d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false).nextNode() || n;
+ return d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, FALSE).nextNode() || n;
};
// Move cursor and scroll into view
@@ -12249,51 +11949,12 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
//console.debug('SCROLL!', 'vp.y: ' + vp.y, 'y' + y, 'vp.h' + vp.h, 'clientHeight' + aft.clientHeight, 'yyy: ' + (y < vp.y ? y : y - vp.h + aft.clientHeight));
}
- return false;
+ return FALSE;
},
backspaceDelete : function(e, bs) {
var t = this, ed = t.editor, b = ed.getBody(), dom = ed.dom, n, se = ed.selection, r = se.getRng(), sc = r.startContainer, n, w, tn;
- /*
- var par, rng, nextBlock;
-
- // Delete key will not merge paragraphs on Gecko so we need to do this manually
- // Hitting the delete key at the following caret position doesn't merge the elements <p>A|</p><p>B</p>
- // This logic will merge them into this: <p>A|B</p>
- if (e.keyCode == 46) {
- if (r.collapsed) {
- par = dom.getParent(sc, 'p,h1,h2,h3,h4,h5,h6,div');
-
- if (par) {
- rng = dom.createRng();
-
- rng.setStart(sc, r.startOffset);
- rng.setEndAfter(par);
-
- // Get number of characters to the right of the cursor if it's zero then we are at the end and need to merge the next block element
- if (dom.getOuterHTML(rng.cloneContents()).replace(/<[^>]+>/g, '').length == 0) {
- nextBlock = dom.getNext(par, 'p,h1,h2,h3,h4,h5,h6,div');
-
- // Copy all children from next sibling block and remove it
- if (nextBlock) {
- each(nextBlock.childNodes, function(node) {
- par.appendChild(node.cloneNode(true));
- });
-
- dom.remove(nextBlock);
- }
-
- // Block the default even since the Gecko team might eventually fix this
- // We will remove this logic once they do we can't feature detect this one
- e.preventDefault();
- return;
- }
- }
- }
- }
- */
-
// The caret sometimes gets stuck in Gecko if you delete empty paragraphs
// This workaround removes the element by hand and moves the caret to the previous element
if (sc && ed.dom.isBlock(sc) && !/^(TD|TH)$/.test(sc.nodeName) && bs) {
@@ -12305,7 +11966,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
if (n) {
if (sc != b.firstChild) {
// Find last text node
- w = ed.dom.doc.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
+ w = ed.dom.doc.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, FALSE);
while (tn = w.nextNode())
n = tn;
@@ -12357,6 +12018,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
}
});
})(tinymce);
+
(function(tinymce) {
// Shorten names
var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, extend = tinymce.extend;
@@ -12459,7 +12121,8 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
if (!s.onclick) {
s.onclick = function(v) {
- ed.execCommand(s.cmd, s.ui || false, s.value);
+ if (s.cmd)
+ ed.execCommand(s.cmd, s.ui || false, s.value);
};
}
});
@@ -12717,6 +12380,7 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
}
});
})(tinymce);
+
(function(tinymce) {
var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isIE = tinymce.isIE, isOpera = tinymce.isOpera;
@@ -12821,14 +12485,19 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
cb.call(s || t);
},
+ resizeBy : function(dw, dh, win) {
+ win.resizeBy(dw, dh);
+ },
+
// Internal functions
_decode : function(s) {
return tinymce.DOM.decode(s).replace(/\\n/g, '\n');
}
});
-}(tinymce));(function(tinymce) {
- tinymce.CommandManager = function() {
+}(tinymce));
+(function(tinymce) {
+ function CommandManager() {
var execCommands = {}, queryStateCommands = {}, queryValueCommands = {};
function add(collection, cmd, func, scope) {
@@ -12872,360 +12541,1268 @@ var tinyMCE = window.tinyMCE = tinymce.EditorManager;
});
};
- tinymce.GlobalCommands = new tinymce.CommandManager();
-})(tinymce);(function(tinymce) {
- function processRange(dom, start, end, callback) {
- var ancestor, n, startPoint, endPoint, sib;
+ tinymce.GlobalCommands = new CommandManager();
+})(tinymce);
+(function(tinymce) {
+ tinymce.Formatter = function(ed) {
+ var formats = {},
+ each = tinymce.each,
+ dom = ed.dom,
+ selection = ed.selection,
+ TreeWalker = tinymce.dom.TreeWalker,
+ rangeUtils = new tinymce.dom.RangeUtils(dom),
+ isValid = ed.schema.isValid,
+ isBlock = dom.isBlock,
+ forcedRootBlock = ed.settings.forced_root_block,
+ nodeIndex = dom.nodeIndex,
+ INVISIBLE_CHAR = '\uFEFF',
+ MCE_ATTR_RE = /^(src|href|style)$/,
+ FALSE = false,
+ TRUE = true,
+ undefined,
+ pendingFormats = {apply : [], remove : []};
+
+ function getParents(node, selector) {
+ return dom.getParents(node, selector, dom.getRoot());
+ };
- function findEndPoint(n, c) {
- do {
- if (n.parentNode == c)
- return n;
+ function isCaretNode(node) {
+ return node.nodeType === 1 && (node.face === 'mceinline' || node.style.fontFamily === 'mceinline');
+ };
- n = n.parentNode;
- } while(n);
+ // Public functions
+
+ function get(name) {
+ return name ? formats[name] : formats;
};
- function process(n) {
- callback(n);
- tinymce.walk(n, callback, 'childNodes');
+ function register(name, format) {
+ if (name) {
+ if (typeof(name) !== 'string') {
+ each(name, function(format, name) {
+ register(name, format);
+ });
+ } else {
+ // Force format into array and add it to internal collection
+ format = format.length ? format : [format];
+
+ each(format, function(format) {
+ // Set deep to false by default on selector formats this to avoid removing
+ // alignment on images inside paragraphs when alignment is changed on paragraphs
+ if (format.deep === undefined)
+ format.deep = !format.selector;
+
+ // Default to true
+ if (format.split === undefined)
+ format.split = !format.selector || format.inline;
+
+ // Default to true
+ if (format.remove === undefined && format.selector && !format.inline)
+ format.remove = 'none';
+
+ // Mark format as a mixed format inline + block level
+ if (format.selector && format.inline) {
+ format.mixed = true;
+ format.block_expand = true;
+ }
+
+ // Split classes if needed
+ if (typeof(format.classes) === 'string')
+ format.classes = format.classes.split(/\s+/);
+ });
+
+ formats[name] = format;
+ }
+ }
};
- // Find common ancestor and end points
- ancestor = dom.findCommonAncestor(start, end);
- startPoint = findEndPoint(start, ancestor) || start;
- endPoint = findEndPoint(end, ancestor) || end;
+ function apply(name, vars, node) {
+ var formatList = get(name), format = formatList[0], bookmark, rng, i;
- // Process left leaf
- for (n = start; n && n != startPoint; n = n.parentNode) {
- for (sib = n.nextSibling; sib; sib = sib.nextSibling)
- process(sib);
- }
+ function moveStart(rng) {
+ var container = rng.startContainer,
+ offset = rng.startOffset,
+ walker, node;
- // Process middle from start to end point
- if (startPoint != endPoint) {
- for (n = startPoint.nextSibling; n && n != endPoint; n = n.nextSibling)
- process(n);
- } else
- process(startPoint);
-
- // Process right leaf
- for (n = end; n && n != endPoint; n = n.parentNode) {
- for (sib = n.previousSibling; sib; sib = sib.previousSibling)
- process(sib);
- }
- };
+ // Move startContainer/startOffset in to a suitable node
+ if (container.nodeType == 1 || container.nodeValue === "") {
+ walker = new TreeWalker(container.childNodes[offset]);
+ for (node = walker.current(); node; node = walker.next()) {
+ if (node.nodeType == 3 && !isBlock(node.parentNode) && !isWhiteSpaceNode(node)) {
+ rng.setStart(node, 0);
+ break;
+ }
+ }
+ }
+
+ return rng;
+ };
+
+ function setElementFormat(elm, fmt) {
+ fmt = fmt || format;
+
+ if (elm) {
+ each(fmt.styles, function(value, name) {
+ dom.setStyle(elm, name, replaceVars(value, vars));
+ });
+
+ each(fmt.attributes, function(value, name) {
+ dom.setAttrib(elm, name, replaceVars(value, vars));
+ });
+
+ each(fmt.classes, function(value) {
+ value = replaceVars(value, vars);
+
+ if (!dom.hasClass(elm, value))
+ dom.addClass(elm, value);
+ });
+ }
+ };
+
+ function applyRngStyle(rng) {
+ var newWrappers = [], wrapName, wrapElm;
+
+ // Setup wrapper element
+ wrapName = format.inline || format.block;
+ wrapElm = dom.create(wrapName);
+ setElementFormat(wrapElm);
+
+ rangeUtils.walk(rng, function(nodes) {
+ var currentWrapElm;
- tinymce.GlobalCommands.add('RemoveFormat', function() {
- var ed = this, dom = ed.dom, s = ed.selection, r = s.getRng(1), nodes = [], bm, start, end, sc, so, ec, eo, n;
+ function process(node) {
+ var nodeName = node.nodeName.toLowerCase(), parentName = node.parentNode.nodeName.toLowerCase(), found;
- function findFormatRoot(n) {
- var sp;
+ // Stop wrapping on br elements
+ if (isEq(nodeName, 'br')) {
+ currentWrapElm = 0;
- dom.getParent(n, function(n) {
- if (dom.is(n, ed.getParam('removeformat_selector')))
- sp = n;
+ // Remove any br elements when we wrap things
+ if (format.block)
+ dom.remove(node);
- return dom.isBlock(n);
- }, ed.getBody());
+ return;
+ }
+
+ // If node is wrapper type
+ if (format.wrapper && matchNode(node, name, vars)) {
+ currentWrapElm = 0;
+ return;
+ }
+
+ // Can we rename the block
+ if (format.block && !format.wrapper && isTextBlock(nodeName)) {
+ node = dom.rename(node, wrapName);
+ setElementFormat(node);
+ newWrappers.push(node);
+ currentWrapElm = 0;
+ return;
+ }
- return sp;
+ // Handle selector patterns
+ if (format.selector) {
+ // Look for matching formats
+ each(formatList, function(format) {
+ if (dom.is(node, format.selector) && !isCaretNode(node)) {
+ setElementFormat(node, format);
+ found = true;
+ }
+ });
+
+ // Contine processing if a selector match wasn't found and a inline element is defined
+ if (!format.inline || found) {
+ currentWrapElm = 0;
+ return;
+ }
+ }
+
+ // Is it valid to wrap this item
+ if (isValid(wrapName, nodeName) && isValid(parentName, wrapName)) {
+ // Start wrapping
+ if (!currentWrapElm) {
+ // Wrap the node
+ currentWrapElm = wrapElm.cloneNode(FALSE);
+ node.parentNode.insertBefore(currentWrapElm, node);
+ newWrappers.push(currentWrapElm);
+ }
+
+ currentWrapElm.appendChild(node);
+ } else {
+ // Start a new wrapper for possible children
+ currentWrapElm = 0;
+
+ each(tinymce.grep(node.childNodes), process);
+
+ // End the last wrapper
+ currentWrapElm = 0;
+ }
+ };
+
+ // Process siblings from range
+ each(nodes, process);
+ });
+
+ // Cleanup
+ each(newWrappers, function(node) {
+ var childCount;
+
+ function getChildCount(node) {
+ var count = 0;
+
+ each(node.childNodes, function(node) {
+ if (!isWhiteSpaceNode(node) && !isBookmarkNode(node))
+ count++;
+ });
+
+ return count;
+ };
+
+ function mergeStyles(node) {
+ var child, clone;
+
+ each(node.childNodes, function(node) {
+ if (node.nodeType == 1 && !isBookmarkNode(node) && !isCaretNode(node)) {
+ child = node;
+ return FALSE; // break loop
+ }
+ });
+
+ // If child was found and of the same type as the current node
+ if (child && matchName(child, format)) {
+ clone = child.cloneNode(FALSE);
+ setElementFormat(clone);
+
+ dom.replace(clone, node, TRUE);
+ dom.remove(child, 1);
+ }
+
+ return clone || node;
+ };
+
+ childCount = getChildCount(node);
+
+ // Remove empty nodes
+ if (childCount === 0) {
+ dom.remove(node, 1);
+ return;
+ }
+
+ if (format.inline || format.wrapper) {
+ // Merges the current node with it's children of similar type to reduce the number of elements
+ if (!format.exact && childCount === 1)
+ node = mergeStyles(node);
+
+ // Remove/merge children
+ each(formatList, function(format) {
+ // Merge all children of similar type will move styles from child to parent
+ // this: <span style="color:red"><b><span style="color:red; font-size:10px">text</span></b></span>
+ // will become: <span style="color:red"><b><span style="font-size:10px">text</span></b></span>
+ each(dom.select(format.inline, node), function(child) {
+ removeFormat(format, vars, child, format.exact ? child : null);
+ });
+ });
+
+ // Look for parent with similar style format
+ dom.getParent(node.parentNode, function(parent) {
+ if (matchNode(parent, name, vars)) {
+ dom.remove(node, 1);
+ node = 0;
+ return TRUE;
+ }
+ });
+
+ // Merge next and previous siblings if they are similar <b>text</b><b>text</b> becomes <b>texttext</b>
+ if (node) {
+ node = mergeSiblings(getNonWhiteSpaceSibling(node), node);
+ node = mergeSiblings(node, getNonWhiteSpaceSibling(node, TRUE));
+ }
+ }
+ });
+ };
+
+ if (format) {
+ if (node) {
+ rng = dom.createRng();
+
+ rng.setStartBefore(node);
+ rng.setEndAfter(node);
+
+ applyRngStyle(rng);
+ } else {
+ if (!selection.isCollapsed() || !format.inline) {
+ // Apply formatting to selection
+ bookmark = selection.getBookmark();
+ applyRngStyle(expandRng(selection.getRng(TRUE), formatList));
+
+ selection.moveToBookmark(bookmark);
+ selection.setRng(moveStart(selection.getRng(TRUE)));
+ ed.nodeChanged();
+ } else
+ performCaretAction('apply', name, vars);
+ }
+ }
};
- function collect(n) {
- if (dom.is(n, ed.getParam('removeformat_selector')))
- nodes.push(n);
+ function remove(name, vars, node) {
+ var formatList = get(name), format = formatList[0], bookmark, i, rng;
+
+ // Merges the styles for each node
+ function process(node) {
+ var children, i, l;
+
+ // Grab the children first since the nodelist might be changed
+ children = tinymce.grep(node.childNodes);
+
+ // Process current node
+ for (i = 0, l = formatList.length; i < l; i++) {
+ if (removeFormat(formatList[i], vars, node, node))
+ break;
+ }
+
+ // Process the children
+ if (format.deep) {
+ for (i = 0, l = children.length; i < l; i++)
+ process(children[i]);
+ }
+ };
+
+ function findFormatRoot(container) {
+ var formatRoot;
+
+ // Find format root
+ each(getParents(container.parentNode).reverse(), function(parent) {
+ var format;
+
+ // Find format root element
+ if (!formatRoot && parent.id != '_start' && parent.id != '_end') {
+ // Is the node matching the format we are looking for
+ format = matchNode(parent, name, vars);
+ if (format && format.split !== false)
+ formatRoot = parent;
+ }
+ });
+
+ return formatRoot;
+ };
+
+ function wrapAndSplit(format_root, container, target, split) {
+ var parent, clone, lastClone, firstClone, i, formatRootParent;
+
+ // Format root found then clone formats and split it
+ if (format_root) {
+ formatRootParent = format_root.parentNode;
+
+ for (parent = container.parentNode; parent && parent != formatRootParent; parent = parent.parentNode) {
+ clone = parent.cloneNode(FALSE);
+
+ for (i = 0; i < formatList.length; i++) {
+ if (removeFormat(formatList[i], vars, clone, clone)) {
+ clone = 0;
+ break;
+ }
+ }
+
+ // Build wrapper node
+ if (clone) {
+ if (lastClone)
+ clone.appendChild(lastClone);
+
+ if (!firstClone)
+ firstClone = clone;
+
+ lastClone = clone;
+ }
+ }
+
+ // Never split block elements if the format is mixed
+ if (split && (!format.mixed || !isBlock(format_root)))
+ container = dom.split(format_root, container);
+
+ // Wrap container in cloned formats
+ if (lastClone) {
+ target.parentNode.insertBefore(lastClone, target);
+ firstClone.appendChild(target);
+ }
+ }
+
+ return container;
+ };
+
+ function splitToFormatRoot(container) {
+ return wrapAndSplit(findFormatRoot(container), container, container, true);
+ };
+
+ function unwrap(start) {
+ var node = dom.get(start ? '_start' : '_end'),
+ out = node[start ? 'firstChild' : 'lastChild'];
+
+ dom.remove(node, 1);
+
+ return out;
+ };
+
+ function removeRngStyle(rng) {
+ var startContainer, endContainer;
+
+ rng = expandRng(rng, formatList, TRUE);
+
+ if (format.split) {
+ startContainer = getContainer(rng, TRUE);
+ endContainer = getContainer(rng);
+
+ if (startContainer != endContainer) {
+ // Wrap start/end nodes in span element since these might be cloned/moved
+ startContainer = wrap(startContainer, 'span', {id : '_start', _mce_type : 'bookmark'});
+ endContainer = wrap(endContainer, 'span', {id : '_end', _mce_type : 'bookmark'});
+
+ // Split start/end
+ splitToFormatRoot(startContainer);
+ splitToFormatRoot(endContainer);
+
+ // Unwrap start/end to get real elements again
+ startContainer = unwrap(TRUE);
+ endContainer = unwrap();
+ } else
+ startContainer = endContainer = splitToFormatRoot(startContainer);
+
+ // Update range positions since they might have changed after the split operations
+ rng.startContainer = startContainer.parentNode;
+ rng.startOffset = nodeIndex(startContainer);
+ rng.endContainer = endContainer.parentNode;
+ rng.endOffset = nodeIndex(endContainer) + 1;
+ }
+
+ // Remove items between start/end
+ rangeUtils.walk(rng, function(nodes) {
+ each(nodes, function(node) {
+ process(node);
+ });
+ });
+ };
+
+ // Handle node
+ if (node) {
+ rng = dom.createRng();
+ rng.setStartBefore(node);
+ rng.setEndAfter(node);
+ removeRngStyle(rng);
+ return;
+ }
+
+ if (!selection.isCollapsed() || !format.inline) {
+ bookmark = selection.getBookmark();
+ removeRngStyle(selection.getRng(TRUE));
+ selection.moveToBookmark(bookmark);
+ ed.nodeChanged();
+ } else
+ performCaretAction('remove', name, vars);
};
- function walk(n) {
- collect(n);
- tinymce.walk(n, collect, 'childNodes');
+ function toggle(name, vars, node) {
+ if (match(name, vars, node))
+ remove(name, vars, node);
+ else
+ apply(name, vars, node);
};
- bm = s.getBookmark();
- sc = r.startContainer;
- ec = r.endContainer;
- so = r.startOffset;
- eo = r.endOffset;
- sc = sc.nodeType == 1 ? sc.childNodes[Math.min(so, sc.childNodes.length - 1)] : sc;
- ec = ec.nodeType == 1 ? ec.childNodes[Math.min(so == eo ? eo : eo - 1, ec.childNodes.length - 1)] : ec;
+ function matchNode(node, name, vars) {
+ var formatList = get(name), format, i, classes;
- // Same container
- if (sc == ec) { // TEXT_NODE
- start = findFormatRoot(sc);
+ function matchItems(node, format, item_name) {
+ var key, value, items = format[item_name], i;
- // Handle single text node
- if (sc.nodeType == 3) {
- if (start && start.nodeType == 1) { // ELEMENT
- n = sc.splitText(so);
- n.splitText(eo - so);
- dom.split(start, n);
+ // Check all items
+ if (items) {
+ // Non indexed object
+ if (items.length === undefined) {
+ for (key in items) {
+ if (items.hasOwnProperty(key)) {
+ if (item_name === 'attributes')
+ value = dom.getAttrib(node, key);
+ else
+ value = getStyle(node, key);
- s.moveToBookmark(bm);
+ if (!isEq(value, replaceVars(items[key], vars)))
+ return;
+ }
+ }
+ } else {
+ // Only one match needed for indexed arrays
+ for (i = 0; i < items.length; i++) {
+ if (item_name === 'attributes' ? dom.getAttrib(node, items[i]) : getStyle(node, items[i]))
+ return format;
+ }
+ }
}
- return;
+ return format;
+ };
+
+ if (formatList && node) {
+ // Check each format in list
+ for (i = 0; i < formatList.length; i++) {
+ format = formatList[i];
+
+ // Name name, attributes, styles and classes
+ if (matchName(node, format) && matchItems(node, format, 'attributes') && matchItems(node, format, 'styles')) {
+ // Match classes
+ if (classes = format.classes) {
+ for (i = 0; i < classes.length; i++) {
+ if (!dom.hasClass(node, classes[i]))
+ return;
+ }
+ }
+
+ return format;
+ }
+ }
}
+ };
- // Handle single element
- walk(dom.split(start, sc) || sc);
- } else {
- // Find start/end format root
- start = findFormatRoot(sc);
- end = findFormatRoot(ec);
+ function match(name, vars, node) {
+ var startNode, i;
+
+ function matchParents(node) {
+ // Find first node with similar format settings
+ node = dom.getParent(node, function(node) {
+ return !!matchNode(node, name, vars);
+ });
- // Split start text node
- if (start) {
- if (sc.nodeType == 3) { // TEXT
- // Since IE doesn't support white space nodes in the DOM we need to
- // add this invisible character so that the splitText function can split the contents
- if (so == sc.nodeValue.length)
- sc.nodeValue += '\uFEFF'; // Yet another pesky IE fix
+ // Do an exact check on the similar format element
+ return matchNode(node, name, vars);
+ };
+
+ // Check specified node
+ if (node)
+ return matchParents(node);
+
+ // Check pending formats
+ if (selection.isCollapsed()) {
+ for (i = pendingFormats.apply.length - 1; i >= 0; i--) {
+ if (pendingFormats.apply[i].name == name)
+ return true;
+ }
- sc = sc.splitText(so);
+ for (i = pendingFormats.remove.length - 1; i >= 0; i--) {
+ if (pendingFormats.remove[i].name == name)
+ return false;
}
+
+ return matchParents(selection.getNode());
}
- // Split end text node
- if (end) {
- if (ec.nodeType == 3) // TEXT
- ec.splitText(eo);
+ // Check selected node
+ node = selection.getNode();
+ if (matchParents(node))
+ return TRUE;
+
+ // Check start node if it's different
+ startNode = selection.getStart();
+ if (startNode != node) {
+ if (matchParents(startNode))
+ return TRUE;
}
- // If the start and end format root is the same then we need to wrap
- // the end node in a span since the split calls might change the reference
- // Example: <p><b><em>x[yz<span>---</span>12]3</em></b></p>
- if (start && start == end)
- dom.replace(dom.create('span', {id : '__end'}, ec.cloneNode(true)), ec);
+ return FALSE;
+ };
- // Split all start containers down to the format root
- if (start)
- start = dom.split(start, sc);
- else
- start = sc;
+ function canApply(name) {
+ var formatList = get(name), startNode, parents, i, x, selector;
- // If there is a span wrapper use that one instead
- if (n = dom.get('__end')) {
- ec = n;
- end = findFormatRoot(ec);
- }
+ if (formatList) {
+ startNode = selection.getStart();
+ parents = getParents(startNode);
- // Split all end containers down to the format root
- if (end)
- end = dom.split(end, ec);
- else
- end = ec;
+ for (x = formatList.length - 1; x >= 0; x--) {
+ selector = formatList[x].selector;
- // Collect nodes in between
- processRange(dom, start, end, collect);
+ // Format is not selector based, then always return TRUE
+ if (!selector)
+ return TRUE;
- // Remove invisible character for IE workaround if we find it
- if (sc.nodeValue == '\uFEFF')
- sc.nodeValue = '';
+ for (i = parents.length - 1; i >= 0; i--) {
+ if (dom.is(parents[i], selector))
+ return TRUE;
+ }
+ }
+ }
- // Process start/end container elements
- walk(ec);
- walk(sc);
- }
+ return FALSE;
+ };
- // Remove all collected nodes
- tinymce.each(nodes, function(n) {
- dom.remove(n, 1);
+ // Expose to public
+ tinymce.extend(this, {
+ get : get,
+ register : register,
+ apply : apply,
+ remove : remove,
+ toggle : toggle,
+ match : match,
+ matchNode : matchNode,
+ canApply : canApply
});
- // Remove leftover wrapper
- dom.remove('__end', 1);
+ // Private functions
- s.moveToBookmark(bm);
- });
-})(tinymce);
-(function(tinymce) {
- tinymce.GlobalCommands.add('mceBlockQuote', function() {
- var ed = this, s = ed.selection, dom = ed.dom, sb, eb, n, bm, bq, r, bq2, i, nl;
+ function matchName(node, format) {
+ // Check for inline match
+ if (isEq(node, format.inline))
+ return TRUE;
+
+ // Check for block match
+ if (isEq(node, format.block))
+ return TRUE;
+
+ // Check for selector match
+ if (format.selector)
+ return dom.is(node, format.selector);
+ };
- function getBQ(e) {
- return dom.getParent(e, function(n) {return n.nodeName === 'BLOCKQUOTE';});
+ function isEq(str1, str2) {
+ str1 = str1 || '';
+ str2 = str2 || '';
+
+ str1 = str1.nodeName || str1;
+ str2 = str2.nodeName || str2;
+
+ return str1.toLowerCase() == str2.toLowerCase();
};
- // Get start/end block
- sb = dom.getParent(s.getStart(), dom.isBlock);
- eb = dom.getParent(s.getEnd(), dom.isBlock);
+ function getStyle(node, name) {
+ var styleVal = dom.getStyle(node, name);
- // Remove blockquote(s)
- if (bq = getBQ(sb)) {
- if (sb != eb || sb.childNodes.length > 1 || (sb.childNodes.length == 1 && sb.firstChild.nodeName != 'BR'))
- bm = s.getBookmark();
+ // Force the format to hex
+ if (name == 'color' || name == 'backgroundColor')
+ styleVal = dom.toHex(styleVal);
- // Move all elements after the end block into new bq
- if (getBQ(eb)) {
- bq2 = bq.cloneNode(false);
+ // Opera will return bold as 700
+ if (name == 'fontWeight' && styleVal == 700)
+ styleVal = 'bold';
+
+ return '' + styleVal;
+ };
- while (n = eb.nextSibling)
- bq2.appendChild(n.parentNode.removeChild(n));
+ function replaceVars(value, vars) {
+ if (typeof(value) != "string")
+ value = value(vars);
+ else if (vars) {
+ value = value.replace(/%(\w+)/g, function(str, name) {
+ return vars[name] || str;
+ });
}
- // Add new bq after
- if (bq2)
- dom.insertAfter(bq2, bq);
+ return value;
+ };
- // Move all selected blocks after the current bq
- nl = s.getSelectedBlocks(sb, eb);
- for (i = nl.length - 1; i >= 0; i--) {
- dom.insertAfter(nl[i], bq);
+ function isWhiteSpaceNode(node) {
+ return node && node.nodeType === 3 && /^\s*$/.test(node.nodeValue);
+ };
+
+ function wrap(node, name, attrs) {
+ var wrapper = dom.create(name, attrs);
+
+ node.parentNode.insertBefore(wrapper, node);
+ wrapper.appendChild(node);
+
+ return wrapper;
+ };
+
+ function expandRng(rng, format, remove) {
+ var startContainer = rng.startContainer,
+ startOffset = rng.startOffset,
+ endContainer = rng.endContainer,
+ endOffset = rng.endOffset, sibling, lastIdx;
+
+ // This function walks up the tree if there is no siblings before/after the node
+ function findParentContainer(container, child_name, sibling_name, root) {
+ var parent, child;
+
+ root = root || dom.getRoot();
+
+ for (;;) {
+ // Check if we can move up are we at root level or body level
+ parent = container.parentNode;
+
+ // Stop expanding on block elements or root depending on format
+ if (parent == root || (!format[0].block_expand && isBlock(parent)))
+ return container;
+
+ for (sibling = parent[child_name]; sibling && sibling != container; sibling = sibling[sibling_name]) {
+ if (sibling.nodeType == 1 && !isBookmarkNode(sibling))
+ return container;
+
+ if (sibling.nodeType == 3 && !isWhiteSpaceNode(sibling))
+ return container;
+ }
+
+ container = container.parentNode;
+ }
+
+ return container;
+ };
+
+ // If index based start position then resolve it
+ if (startContainer.nodeType == 1 && startContainer.hasChildNodes()) {
+ lastIdx = startContainer.childNodes.length - 1;
+ startContainer = startContainer.childNodes[startOffset > lastIdx ? lastIdx : startOffset];
+
+ if (startContainer.nodeType == 3)
+ startOffset = 0;
}
- // Empty bq, then remove it
- if (/^\s*$/.test(bq.innerHTML))
- dom.remove(bq, 1); // Keep children so boomark restoration works correctly
+ // If index based end position then resolve it
+ if (endContainer.nodeType == 1 && endContainer.hasChildNodes()) {
+ lastIdx = endContainer.childNodes.length - 1;
+ endContainer = endContainer.childNodes[endOffset > lastIdx ? lastIdx : endOffset - 1];
- // Empty bq, then remote it
- if (bq2 && /^\s*$/.test(bq2.innerHTML))
- dom.remove(bq2, 1); // Keep children so boomark restoration works correctly
+ if (endContainer.nodeType == 3)
+ endOffset = endContainer.nodeValue.length;
+ }
- if (!bm) {
- // Move caret inside empty block element
- if (!tinymce.isIE) {
- r = ed.getDoc().createRange();
- r.setStart(sb, 0);
- r.setEnd(sb, 0);
- s.setRng(r);
- } else {
- s.select(sb);
- s.collapse(0);
+ // Exclude bookmark nodes if possible
+ if (isBookmarkNode(startContainer.parentNode))
+ startContainer = startContainer.parentNode;
- // IE misses the empty block some times element so we must move back the caret
- if (dom.getParent(s.getStart(), dom.isBlock) != sb) {
- r = s.getRng();
- r.move('character', -1);
- r.select();
+ if (isBookmarkNode(startContainer))
+ startContainer = startContainer.nextSibling || startContainer;
+
+ if (isBookmarkNode(endContainer.parentNode))
+ endContainer = endContainer.parentNode;
+
+ if (isBookmarkNode(endContainer))
+ endContainer = endContainer.previousSibling || endContainer;
+
+ // Move start/end point up the tree if the leaves are sharp and if we are in different containers
+ // Example * becomes !: !<p><b><i>*text</i><i>text*</i></b></p>!
+ // This will reduce the number of wrapper elements that needs to be created
+ // Move start point up the tree
+ if (format[0].inline || format[0].block_expand) {
+ startContainer = findParentContainer(startContainer, 'firstChild', 'nextSibling');
+ endContainer = findParentContainer(endContainer, 'lastChild', 'previousSibling');
+ }
+
+ // Expand start/end container to matching selector
+ if (format[0].selector && format[0].expand !== FALSE && !format[0].inline) {
+ function findSelectorEndPoint(container, sibling_name) {
+ var parents, i, y;
+
+ if (container.nodeType == 3 && container.nodeValue.length == 0 && container[sibling_name])
+ container = container[sibling_name];
+
+ parents = getParents(container);
+ for (i = 0; i < parents.length; i++) {
+ for (y = 0; y < format.length; y++) {
+ if (dom.is(parents[i], format[y].selector))
+ return parents[i];
+ }
}
+
+ return container;
+ };
+
+ // Find new startContainer/endContainer if there is better one
+ startContainer = findSelectorEndPoint(startContainer, 'previousSibling');
+ endContainer = findSelectorEndPoint(endContainer, 'nextSibling');
+ }
+
+ // Expand start/end container to matching block element or text node
+ if (format[0].block || format[0].selector) {
+ function findBlockEndPoint(container, sibling_name, sibling_name2) {
+ var node;
+
+ // Expand to block of similar type
+ if (!format[0].wrapper)
+ node = dom.getParent(container, format[0].block);
+
+ // Expand to first wrappable block element or any block element
+ if (!node)
+ node = dom.getParent(container.nodeType == 3 ? container.parentNode : container, isBlock);
+
+ // Exclude inner lists from wrapping
+ if (node && format[0].wrapper)
+ node = getParents(node, 'ul,ol').reverse()[0] || node;
+
+ // Didn't find a block element look for first/last wrappable element
+ if (!node) {
+ node = container;
+
+ while (node[sibling_name] && !isBlock(node[sibling_name])) {
+ node = node[sibling_name];
+
+ // Break on BR but include it will be removed later on
+ // we can't remove it now since we need to check if it can be wrapped
+ if (isEq(node, 'br'))
+ break;
+ }
+ }
+
+ return node || container;
+ };
+
+ // Find new startContainer/endContainer if there is better one
+ startContainer = findBlockEndPoint(startContainer, 'previousSibling');
+ endContainer = findBlockEndPoint(endContainer, 'nextSibling');
+
+ // Non block element then try to expand up the leaf
+ if (format[0].block) {
+ if (!isBlock(startContainer))
+ startContainer = findParentContainer(startContainer, 'firstChild', 'nextSibling');
+
+ if (!isBlock(endContainer))
+ endContainer = findParentContainer(endContainer, 'lastChild', 'previousSibling');
}
- } else
- ed.selection.moveToBookmark(bm);
+ }
- return;
- }
+ // Setup index for startContainer
+ if (startContainer.nodeType == 1) {
+ startOffset = nodeIndex(startContainer);
+ startContainer = startContainer.parentNode;
+ }
- // Since IE can start with a totally empty document we need to add the first bq and paragraph
- if (tinymce.isIE && !sb && !eb) {
- ed.getDoc().execCommand('Indent');
- n = getBQ(s.getNode());
- n.style.margin = n.dir = ''; // IE adds margin and dir to bq
- return;
+ // Setup index for endContainer
+ if (endContainer.nodeType == 1) {
+ endOffset = nodeIndex(endContainer) + 1;
+ endContainer = endContainer.parentNode;
+ }
+
+ // Return new range like object
+ return {
+ startContainer : startContainer,
+ startOffset : startOffset,
+ endContainer : endContainer,
+ endOffset : endOffset
+ };
}
- if (!sb || !eb)
- return;
+ function removeFormat(format, vars, node, compare_node) {
+ var i, attrs, stylesModified;
- // If empty paragraph node then do not use bookmark
- if (sb != eb || sb.childNodes.length > 1 || (sb.childNodes.length == 1 && sb.firstChild.nodeName != 'BR'))
- bm = s.getBookmark();
+ // Check if node matches format
+ if (!matchName(node, format))
+ return FALSE;
- // Move selected block elements into a bq
- tinymce.each(s.getSelectedBlocks(getBQ(s.getStart()), getBQ(s.getEnd())), function(e) {
- // Found existing BQ add to this one
- if (e.nodeName == 'BLOCKQUOTE' && !bq) {
- bq = e;
- return;
+ // Should we compare with format attribs and styles
+ if (format.remove != 'all') {
+ // Remove styles
+ each(format.styles, function(value, name) {
+ value = replaceVars(value, vars);
+
+ // Indexed array
+ if (typeof(name) === 'number') {
+ name = value;
+ compare_node = 0;
+ }
+
+ if (!compare_node || isEq(getStyle(compare_node, name), value))
+ dom.setStyle(node, name, '');
+
+ stylesModified = 1;
+ });
+
+ // Remove style attribute if it's empty
+ if (stylesModified && dom.getAttrib(node, 'style') == '') {
+ node.removeAttribute('style');
+ node.removeAttribute('_mce_style');
+ }
+
+ // Remove attributes
+ each(format.attributes, function(value, name) {
+ var valueOut;
+
+ value = replaceVars(value, vars);
+
+ // Indexed array
+ if (typeof(name) === 'number') {
+ name = value;
+ compare_node = 0;
+ }
+
+ if (!compare_node || isEq(dom.getAttrib(compare_node, name), value)) {
+ // Keep internal classes
+ if (name == 'class') {
+ value = dom.getAttrib(node, name);
+ if (value) {
+ // Build new class value where everything is removed except the internal prefixed classes
+ valueOut = '';
+ each(value.split(/\s+/), function(cls) {
+ if (/mce\w+/.test(cls))
+ valueOut += (valueOut ? ' ' : '') + cls;
+ });
+
+ // We got some internal classes left
+ if (valueOut) {
+ dom.setAttrib(node, name, valueOut);
+ return;
+ }
+ }
+ }
+
+ // IE6 has a bug where the attribute doesn't get removed correctly
+ if (name == "class")
+ node.removeAttribute('className');
+
+ // Remove mce prefixed attributes
+ if (MCE_ATTR_RE.test(name))
+ node.removeAttribute('_mce_' + name);
+
+ node.removeAttribute(name);
+ }
+ });
+
+ // Remove classes
+ each(format.classes, function(value) {
+ value = replaceVars(value, vars);
+
+ if (!compare_node || dom.hasClass(compare_node, value))
+ dom.removeClass(node, value);
+ });
+
+ // Check for non internal attributes
+ attrs = dom.getAttribs(node);
+ for (i = 0; i < attrs.length; i++) {
+ if (attrs[i].nodeName.indexOf('_') !== 0)
+ return FALSE;
+ }
}
- // No BQ found, create one
- if (!bq) {
- bq = dom.create('blockquote');
- e.parentNode.insertBefore(bq, e);
+ // Remove the inline child if it's empty for example <b> or <span>
+ if (format.remove != 'none') {
+ removeNode(node, format);
+ return TRUE;
}
+ };
- // Add children from existing BQ
- if (e.nodeName == 'BLOCKQUOTE' && bq) {
- n = e.firstChild;
+ function removeNode(node, format) {
+ var parentNode = node.parentNode, rootBlockElm;
- while (n) {
- bq.appendChild(n.cloneNode(true));
- n = n.nextSibling;
+ if (format.block) {
+ if (!forcedRootBlock) {
+ function find(node, next, inc) {
+ node = getNonWhiteSpaceSibling(node, next, inc);
+
+ return !node || (node.nodeName == 'BR' || isBlock(node));
+ };
+
+ // Append BR elements if needed before we remove the block
+ if (isBlock(node) && !isBlock(parentNode)) {
+ if (!find(node, FALSE) && !find(node.firstChild, TRUE, 1))
+ node.insertBefore(dom.create('br'), node.firstChild);
+
+ if (!find(node, TRUE) && !find(node.lastChild, FALSE, 1))
+ node.appendChild(dom.create('br'));
+ }
+ } else {
+ // Wrap the block in a forcedRootBlock if we are at the root of document
+ if (parentNode == dom.getRoot()) {
+ if (!format.list_block || !isEq(node, format.list_block)) {
+ each(tinymce.grep(node.childNodes), function(node) {
+ if (isValid(forcedRootBlock, node.nodeName.toLowerCase())) {
+ if (!rootBlockElm)
+ rootBlockElm = wrap(node, forcedRootBlock);
+ else
+ rootBlockElm.appendChild(node);
+ } else
+ rootBlockElm = 0;
+ });
+ }
+ }
}
+ }
- dom.remove(e);
+ // Never remove nodes that isn't the specified inline element if a selector is specified too
+ if (format.selector && format.inline && !isEq(format.inline, node))
return;
+
+ dom.remove(node, 1);
+ };
+
+ function getNonWhiteSpaceSibling(node, next, inc) {
+ if (node) {
+ next = next ? 'nextSibling' : 'previousSibling';
+
+ for (node = inc ? node : node[next]; node; node = node[next]) {
+ if (node.nodeType == 1 || !isWhiteSpaceNode(node))
+ return node;
+ }
}
+ };
- // Add non BQ element to BQ
- bq.appendChild(dom.remove(e));
- });
+ function isBookmarkNode(node) {
+ return node && node.nodeType == 1 && node.getAttribute('_mce_type') == 'bookmark';
+ };
- if (!bm) {
- // Move caret inside empty block element
- if (!tinymce.isIE) {
- r = ed.getDoc().createRange();
- r.setStart(sb, 0);
- r.setEnd(sb, 0);
- s.setRng(r);
- } else {
- s.select(sb);
- s.collapse(1);
+ function mergeSiblings(prev, next) {
+ var marker, sibling, tmpSibling;
+
+ function compareElements(node1, node2) {
+ // Not the same name
+ if (node1.nodeName != node2.nodeName)
+ return FALSE;
+
+ function getAttribs(node) {
+ var attribs = {};
+
+ each(dom.getAttribs(node), function(attr) {
+ var name = attr.nodeName.toLowerCase();
+
+ // Don't compare internal attributes or style
+ if (name.indexOf('_') !== 0 && name !== 'style')
+ attribs[name] = dom.getAttrib(node, name);
+ });
+
+ return attribs;
+ };
+
+ function compareObjects(obj1, obj2) {
+ var value, name;
+
+ for (name in obj1) {
+ // Obj1 has item obj2 doesn't have
+ if (obj1.hasOwnProperty(name)) {
+ value = obj2[name];
+
+ // Obj2 doesn't have obj1 item
+ if (value === undefined)
+ return FALSE;
+
+ // Obj2 item has a different value
+ if (obj1[name] != value)
+ return FALSE;
+
+ // Delete similar value
+ delete obj2[name];
+ }
+ }
+
+ // Check if obj 2 has something obj 1 doesn't have
+ for (name in obj2) {
+ // Obj2 has item obj1 doesn't have
+ if (obj2.hasOwnProperty(name))
+ return FALSE;
+ }
+
+ return TRUE;
+ };
+
+ // Attribs are not the same
+ if (!compareObjects(getAttribs(node1), getAttribs(node2)))
+ return FALSE;
+
+ // Styles are not the same
+ if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style'))))
+ return FALSE;
+
+ return TRUE;
+ };
+
+ // Check if next/prev exists and that they are elements
+ if (prev && next) {
+ function findElementSibling(node, sibling_name) {
+ for (sibling = node; sibling; sibling = sibling[sibling_name]) {
+ if (sibling.nodeType == 3 && !isWhiteSpaceNode(sibling))
+ return node;
+
+ if (sibling.nodeType == 1 && !isBookmarkNode(sibling))
+ return sibling;
+ }
+
+ return node;
+ };
+
+ // If previous sibling is empty then jump over it
+ prev = findElementSibling(prev, 'previousSibling');
+ next = findElementSibling(next, 'nextSibling');
+
+ // Compare next and previous nodes
+ if (compareElements(prev, next)) {
+ // Append nodes between
+ for (sibling = prev.nextSibling; sibling && sibling != next;) {
+ tmpSibling = sibling;
+ sibling = sibling.nextSibling;
+ prev.appendChild(tmpSibling);
+ }
+
+ // Remove next node
+ dom.remove(next);
+
+ // Move children into prev node
+ each(tinymce.grep(next.childNodes), function(node) {
+ prev.appendChild(node);
+ });
+
+ return prev;
+ }
}
- } else
- s.moveToBookmark(bm);
- });
-})(tinymce);
-(function(tinymce) {
- tinymce.each(['Cut', 'Copy', 'Paste'], function(cmd) {
- tinymce.GlobalCommands.add(cmd, function() {
- var ed = this, doc = ed.getDoc();
- try {
- doc.execCommand(cmd, false, null);
+ return next;
+ };
- // On WebKit the command will just be ignored if it's not enabled
- if (!doc.queryCommandEnabled(cmd))
- throw 'Error';
- } catch (ex) {
- if (tinymce.isGecko) {
- ed.windowManager.confirm(ed.getLang('clipboard_msg'), function(s) {
- if (s)
- open('http://www.mozilla.org/editor/midasdemo/securityprefs.html', '_blank');
+ function isTextBlock(name) {
+ return /^(h[1-6]|p|div|pre|address)$/.test(name);
+ };
+
+ function getContainer(rng, start) {
+ var container, offset, lastIdx;
+
+ container = rng[start ? 'startContainer' : 'endContainer'];
+ offset = rng[start ? 'startOffset' : 'endOffset'];
+
+ if (container.nodeType == 1) {
+ lastIdx = container.childNodes.length - 1;
+
+ if (!start && offset)
+ offset--;
+
+ container = container.childNodes[offset > lastIdx ? lastIdx : offset];
+ }
+
+ return container;
+ };
+
+ function performCaretAction(type, name, vars) {
+ var i, currentPendingFormats = pendingFormats[type],
+ otherPendingFormats = pendingFormats[type == 'apply' ? 'remove' : 'apply'];
+
+ function hasPending() {
+ return pendingFormats.apply.length || pendingFormats.remove.length;
+ };
+
+ function resetPending() {
+ pendingFormats.apply = [];
+ pendingFormats.remove = [];
+ };
+
+ function perform(caret_node) {
+ // Apply pending formats
+ each(pendingFormats.apply.reverse(), function(item) {
+ apply(item.name, item.vars, caret_node);
+ });
+
+ // Remove pending formats
+ each(pendingFormats.remove.reverse(), function(item) {
+ remove(item.name, item.vars, caret_node);
+ });
+
+ dom.remove(caret_node, 1);
+ resetPending();
+ };
+
+ // Check if it already exists then ignore it
+ for (i = currentPendingFormats.length - 1; i >= 0; i--) {
+ if (currentPendingFormats[i].name == name)
+ return;
+ }
+
+ currentPendingFormats.push({name : name, vars : vars});
+
+ // Check if it's in the other type, then remove it
+ for (i = otherPendingFormats.length - 1; i >= 0; i--) {
+ if (otherPendingFormats[i].name == name)
+ otherPendingFormats.splice(i, 1);
+ }
+
+ // Pending apply or remove formats
+ if (hasPending()) {
+ ed.getDoc().execCommand('FontName', false, 'mceinline');
+
+ // IE will convert the current word
+ each(dom.select('font,span'), function(node) {
+ var bookmark;
+
+ if (isCaretNode(node)) {
+ bookmark = selection.getBookmark();
+ perform(node);
+ selection.moveToBookmark(bookmark);
+ ed.nodeChanged();
+ }
+ });
+
+ // Only register listeners once if we need to
+ if (!pendingFormats.isListening && hasPending()) {
+ pendingFormats.isListening = true;
+
+ each('onKeyDown,onKeyUp,onKeyPress,onMouseUp'.split(','), function(event) {
+ ed[event].addToTop(function(ed, e) {
+ if (hasPending()) {
+ each(dom.select('font,span'), function(node) {
+ var bookmark, textNode, rng;
+
+ // Look for marker
+ if (isCaretNode(node)) {
+ textNode = node.firstChild;
+
+ perform(node);
+
+ rng = dom.createRng();
+ rng.setStart(textNode, textNode.nodeValue.length);
+ rng.setEnd(textNode, textNode.nodeValue.length);
+ selection.setRng(rng);
+ ed.nodeChanged();
+ }
+ });
+
+ // Always unbind and clear pending styles on keyup
+ if (e.type == 'keyup' || e.type == 'mouseup')
+ resetPending();
+ }
+ });
});
- } else
- ed.windowManager.alert(ed.getLang('clipboard_no_support'));
+ }
}
- });
- });
+ };
+ };
})(tinymce);
-(function(tinymce) {
- tinymce.GlobalCommands.add('InsertHorizontalRule', function() {
- if (tinymce.isOpera)
- return this.getDoc().execCommand('InsertHorizontalRule', false, '');
- this.selection.setContent('<hr />');
- });
-})(tinymce);
-(function() {
- var cmds = tinymce.GlobalCommands;
+tinymce.onAddEditor.add(function(tinymce, ed) {
+ var filters, fontSizes, dom, settings = ed.settings;
- cmds.add(['mceEndUndoLevel', 'mceAddUndoLevel'], function() {
- this.undoManager.add();
- });
+ if (settings.inline_styles) {
+ fontSizes = tinymce.explode(settings.font_size_style_values);
- cmds.add('Undo', function() {
- var ed = this;
+ function replaceWithSpan(node, styles) {
+ dom.replace(dom.create('span', {
+ style : styles
+ }), node, 1);
+ };
- if (ed.settings.custom_undo_redo) {
- ed.undoManager.undo();
- ed.nodeChanged();
- return true;
- }
+ filters = {
+ font : function(dom, node) {
+ replaceWithSpan(node, {
+ backgroundColor : node.style.backgroundColor,
+ color : node.color,
+ fontFamily : node.face,
+ fontSize : fontSizes[parseInt(node.size) - 1]
+ });
+ },
- return false; // Run browser command
- });
+ u : function(dom, node) {
+ replaceWithSpan(node, {
+ textDecoration : 'underline'
+ });
+ },
- cmds.add('Redo', function() {
- var ed = this;
+ strike : function(dom, node) {
+ replaceWithSpan(node, {
+ textDecoration : 'line-through'
+ });
+ }
+ };
- if (ed.settings.custom_undo_redo) {
- ed.undoManager.redo();
- ed.nodeChanged();
- return true;
- }
+ function convert(editor, params) {
+ dom = editor.dom;
+
+ if (settings.convert_fonts_to_spans) {
+ tinymce.each(dom.select('font,u,strike', params.node), function(node) {
+ filters[node.nodeName.toLowerCase()](ed.dom, node);
+ });
+ }
+ };
+
+ ed.onPreProcess.add(convert);
+
+ ed.onInit.add(function() {
+ ed.selection.onSetContent.add(convert);
+ });
+ }
+});
- return false; // Run browser command
- });
-})();
diff --git a/program/js/tiny_mce/utils/editable_selects.js b/program/js/tiny_mce/utils/editable_selects.js
index fff496392..fd943c0f8 100644
--- a/program/js/tiny_mce/utils/editable_selects.js
+++ b/program/js/tiny_mce/utils/editable_selects.js
@@ -1,10 +1,11 @@
/**
- * $Id: editable_selects.js 867 2008-06-09 20:33:40Z spocke $
+ * editable_selects.js
*
- * Makes select boxes editable.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
*
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
var TinyMCE_EditableSelects = {
diff --git a/program/js/tiny_mce/utils/form_utils.js b/program/js/tiny_mce/utils/form_utils.js
index 9bc2bad4b..2617a26ed 100644
--- a/program/js/tiny_mce/utils/form_utils.js
+++ b/program/js/tiny_mce/utils/form_utils.js
@@ -1,10 +1,11 @@
/**
- * $Id: form_utils.js 1184 2009-08-11 11:47:27Z spocke $
+ * form_utils.js
*
- * Various form utilitiy functions.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
*
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme"));
diff --git a/program/js/tiny_mce/utils/mctabs.js b/program/js/tiny_mce/utils/mctabs.js
index 284501ee9..825d4c143 100644
--- a/program/js/tiny_mce/utils/mctabs.js
+++ b/program/js/tiny_mce/utils/mctabs.js
@@ -1,10 +1,11 @@
/**
- * $Id: mctabs.js 758 2008-03-30 13:53:29Z spocke $
+ * mctabs.js
*
- * Moxiecode DHTML Tabs script.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
*
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
function MCTabs() {
diff --git a/program/js/tiny_mce/utils/validate.js b/program/js/tiny_mce/utils/validate.js
index cde4c9798..a6fcf9701 100644
--- a/program/js/tiny_mce/utils/validate.js
+++ b/program/js/tiny_mce/utils/validate.js
@@ -1,10 +1,11 @@
/**
- * $Id: validate.js 758 2008-03-30 13:53:29Z spocke $
+ * validate.js
*
- * Various form validation methods.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
*
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
*/
/**