mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 12:13:33 +08:00
1 line
74 KiB
JavaScript
1 line
74 KiB
JavaScript
if(!WYMeditor)var WYMeditor={};!function(){if(window.console&&console.firebug)WYMeditor.console=window.console;else{var t=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];WYMeditor.console={};for(var e=0;e<t.length;++e)WYMeditor.console[t[e]]=function(){}}}(),jQuery.extend(WYMeditor,{VERSION:"0.5-rc1",INSTANCES:[],STRINGS:[],SKINS:[],NAME:"name",INDEX:"{Wym_Index}",WYM_INDEX:"wym_index",BASE_PATH:"{Wym_Base_Path}",CSS_PATH:"{Wym_Css_Path}",WYM_PATH:"{Wym_Wym_Path}",SKINS_DEFAULT_PATH:"skins/",SKINS_DEFAULT_CSS:"skin.css",SKINS_DEFAULT_JS:"skin.js",LANG_DEFAULT_PATH:"lang/",IFRAME_BASE_PATH:"{Wym_Iframe_Base_Path}",IFRAME_DEFAULT:"iframe/default/",JQUERY_PATH:"{Wym_Jquery_Path}",DIRECTION:"{Wym_Direction}",LOGO:"{Wym_Logo}",TOOLS:"{Wym_Tools}",TOOLS_ITEMS:"{Wym_Tools_Items}",TOOL_NAME:"{Wym_Tool_Name}",TOOL_TITLE:"{Wym_Tool_Title}",TOOL_CLASS:"{Wym_Tool_Class}",CLASSES:"{Wym_Classes}",CLASSES_ITEMS:"{Wym_Classes_Items}",CLASS_NAME:"{Wym_Class_Name}",CLASS_TITLE:"{Wym_Class_Title}",CONTAINERS:"{Wym_Containers}",CONTAINERS_ITEMS:"{Wym_Containers_Items}",CONTAINER_NAME:"{Wym_Container_Name}",CONTAINER_TITLE:"{Wym_Containers_Title}",CONTAINER_CLASS:"{Wym_Container_Class}",HTML:"{Wym_Html}",IFRAME:"{Wym_Iframe}",STATUS:"{Wym_Status}",DIALOG_TITLE:"{Wym_Dialog_Title}",DIALOG_BODY:"{Wym_Dialog_Body}",STRING:"string",BODY:"body",DIV:"div",P:"p",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",PRE:"pre",BLOCKQUOTE:"blockquote",A:"a",BR:"br",IMG:"img",TABLE:"table",TD:"td",TH:"th",UL:"ul",OL:"ol",LI:"li",CLASS:"class",HREF:"href",SRC:"src",TITLE:"title",ALT:"alt",DIALOG_LINK:"Link",DIALOG_IMAGE:"Image",DIALOG_TABLE:"Table",DIALOG_PASTE:"Paste_From_Word",BOLD:"Bold",ITALIC:"Italic",CREATE_LINK:"CreateLink",INSERT_IMAGE:"InsertImage",INSERT_TABLE:"InsertTable",INSERT_HTML:"InsertHTML",PASTE:"Paste",INDENT:"Indent",OUTDENT:"Outdent",TOGGLE_HTML:"ToggleHtml",FORMAT_BLOCK:"FormatBlock",PREVIEW:"Preview",UNLINK:"Unlink",INSERT_UNORDEREDLIST:"InsertUnorderedList",INSERT_ORDEREDLIST:"InsertOrderedList",MAIN_CONTAINERS:new Array("p","h1","h2","h3","h4","h5","h6","pre","blockquote"),BLOCKS:new Array("address","blockquote","div","dl","fieldset","form","h1","h2","h3","h4","h5","h6","hr","noscript","ol","p","pre","table","ul","dd","dt","li","tbody","td","tfoot","th","thead","tr"),KEY:{BACKSPACE:8,ENTER:13,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,CURSOR:new Array(37,38,39,40),DELETE:46},NODE:{ELEMENT:1,ATTRIBUTE:2,TEXT:3},editor:function(t,e){this._index=WYMeditor.INSTANCES.push(this)-1,this._element=t,this._options=e,this._html=jQuery(t).val(),this._options.html&&(this._html=this._options.html),this._options.basePath=this._options.basePath||this.computeBasePath(),this._options.skinPath=this._options.skinPath||this._options.basePath+WYMeditor.SKINS_DEFAULT_PATH+this._options.skin+"/",this._options.wymPath=this._options.wymPath||this.computeWymPath(),this._options.langPath=this._options.langPath||this._options.basePath+WYMeditor.LANG_DEFAULT_PATH,this._options.iframeBasePath=this._options.iframeBasePath||this._options.basePath+WYMeditor.IFRAME_DEFAULT,this._options.jQueryPath=this._options.jQueryPath||this.computeJqueryPath(),this.init()}}),jQuery.fn.wymeditor=function(t){return t=jQuery.extend({html:"",basePath:!1,skinPath:!1,wymPath:!1,iframeBasePath:!1,jQueryPath:!1,styles:!1,stylesheet:!1,skin:"default",initSkin:!0,loadSkin:!0,lang:"en",direction:"ltr",boxHtml:"<div class='wym_box'><div class='wym_area_top'>"+WYMeditor.TOOLS+"</div><div class='wym_area_left'></div><div class='wym_area_right'>"+WYMeditor.CONTAINERS+WYMeditor.CLASSES+"</div><div class='wym_area_main'>"+WYMeditor.HTML+WYMeditor.IFRAME+WYMeditor.STATUS+"</div><div class='wym_area_bottom'>"+WYMeditor.LOGO+"</div></div>",logoHtml:"<a class='wym_wymeditor_link' href='http://www.wymeditor.org/'>WYMeditor</a>",iframeHtml:"<div class='wym_iframe wym_section'><iframe src='/page/get_editor_iframe' onload='this.contentWindow.parent.WYMeditor.INSTANCES["+WYMeditor.INDEX+"].initIframe(this)'></iframe></div>",editorStyles:[],toolsHtml:"<div class='wym_tools wym_section'><h2>{Tools}</h2><ul>"+WYMeditor.TOOLS_ITEMS+"</ul></div>",toolsItemHtml:"<li class='"+WYMeditor.TOOL_CLASS+"'><a href='#' name='"+WYMeditor.TOOL_NAME+"' title='"+WYMeditor.TOOL_TITLE+"'>"+WYMeditor.TOOL_TITLE+"</a></li>",toolsItems:[{name:"Bold",title:"Strong",css:"wym_tools_strong"},{name:"Italic",title:"Emphasis",css:"wym_tools_emphasis"},{name:"Superscript",title:"Superscript",css:"wym_tools_superscript"},{name:"Subscript",title:"Subscript",css:"wym_tools_subscript"},{name:"InsertOrderedList",title:"Ordered_List",css:"wym_tools_ordered_list"},{name:"InsertUnorderedList",title:"Unordered_List",css:"wym_tools_unordered_list"},{name:"Indent",title:"Indent",css:"wym_tools_indent"},{name:"Outdent",title:"Outdent",css:"wym_tools_outdent"},{name:"Undo",title:"Undo",css:"wym_tools_undo"},{name:"Redo",title:"Redo",css:"wym_tools_redo"},{name:"CreateLink",title:"Link",css:"wym_tools_link"},{name:"Unlink",title:"Unlink",css:"wym_tools_unlink"},{name:"InsertImage",title:"Image",css:"wym_tools_image"},{name:"InsertTable",title:"Table",css:"wym_tools_table"},{name:"Paste",title:"Paste_From_Word",css:"wym_tools_paste"},{name:"ToggleHtml",title:"HTML",css:"wym_tools_html"},{name:"Preview",title:"Preview",css:"wym_tools_preview"}],containersHtml:"<div class='wym_containers wym_section'><h2>{Containers}</h2><ul>"+WYMeditor.CONTAINERS_ITEMS+"</ul></div>",containersItemHtml:"<li class='"+WYMeditor.CONTAINER_CLASS+"'><a href='#' name='"+WYMeditor.CONTAINER_NAME+"'>"+WYMeditor.CONTAINER_TITLE+"</a></li>",containersItems:[{name:"P",title:"Paragraph",css:"wym_containers_p"},{name:"H1",title:"Heading_1",css:"wym_containers_h1"},{name:"H2",title:"Heading_2",css:"wym_containers_h2"},{name:"H3",title:"Heading_3",css:"wym_containers_h3"},{name:"H4",title:"Heading_4",css:"wym_containers_h4"},{name:"H5",title:"Heading_5",css:"wym_containers_h5"},{name:"H6",title:"Heading_6",css:"wym_containers_h6"},{name:"PRE",title:"Preformatted",css:"wym_containers_pre"},{name:"BLOCKQUOTE",title:"Blockquote",css:"wym_containers_blockquote"},{name:"TH",title:"Table_Header",css:"wym_containers_th"}],classesHtml:"<div class='wym_classes wym_section'><h2>{Classes}</h2><ul>"+WYMeditor.CLASSES_ITEMS+"</ul></div>",classesItemHtml:"<li><a href='#' name='"+WYMeditor.CLASS_NAME+"'>"+WYMeditor.CLASS_TITLE+"</a></li>",classesItems:[],statusHtml:"<div class='wym_status wym_section'><h2>{Status}</h2></div>",htmlHtml:"<div class='wym_html wym_section'><h2>{Source_Code}</h2><textarea class='wym_html_val'></textarea></div>",boxSelector:".wym_box",toolsSelector:".wym_tools",toolsListSelector:" ul",containersSelector:".wym_containers",classesSelector:".wym_classes",htmlSelector:".wym_html",iframeSelector:".wym_iframe iframe",iframeBodySelector:".wym_iframe",statusSelector:".wym_status",toolSelector:".wym_tools a",containerSelector:".wym_containers a",classSelector:".wym_classes a",htmlValSelector:".wym_html_val",hrefSelector:".wym_href",srcSelector:".wym_src",titleSelector:".wym_title",altSelector:".wym_alt",textSelector:".wym_text",rowsSelector:".wym_rows",colsSelector:".wym_cols",captionSelector:".wym_caption",summarySelector:".wym_summary",submitSelector:".wym_submit",cancelSelector:".wym_cancel",previewSelector:"",dialogTypeSelector:".wym_dialog_type",dialogLinkSelector:".wym_dialog_link",dialogImageSelector:".wym_dialog_image",dialogTableSelector:".wym_dialog_table",dialogPasteSelector:".wym_dialog_paste",dialogPreviewSelector:".wym_dialog_preview",updateSelector:".wymupdate",updateEvent:"click",dialogFeatures:"menubar=no,titlebar=no,toolbar=no,resizable=no,width=560,height=300,top=0,left=0",dialogFeaturesPreview:"menubar=no,titlebar=no,toolbar=no,resizable=no,scrollbars=yes,width=560,height=300,top=0,left=0",dialogHtml:"<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'><html dir='"+WYMeditor.DIRECTION+"'><head><link rel='stylesheet' type='text/css' media='screen' href='"+WYMeditor.CSS_PATH+"' /><title>"+WYMeditor.DIALOG_TITLE+"</title><script type='text/javascript' src='"+WYMeditor.JQUERY_PATH+"'><\/script><script type='text/javascript' src='"+WYMeditor.WYM_PATH+"'><\/script></head>"+WYMeditor.DIALOG_BODY+"</html>",dialogLinkHtml:"<body class='wym_dialog wym_dialog_link' onload='WYMeditor.INIT_DIALOG("+WYMeditor.INDEX+")'><form><fieldset><input type='hidden' class='wym_dialog_type' value='"+WYMeditor.DIALOG_LINK+"' /><legend>{Link}</legend><div class='row'><label>{URL}</label><input type='text' class='wym_href' value='' size='40' /></div><div class='row'><label>{Title}</label><input type='text' class='wym_title' value='' size='40' /></div><div class='row row-indent'><input class='wym_submit' type='button' value='{Submit}' /><input class='wym_cancel' type='button'value='{Cancel}' /></div></fieldset></form></body>",dialogImageHtml:"<body class='wym_dialog wym_dialog_image' onload='WYMeditor.INIT_DIALOG("+WYMeditor.INDEX+")'><form><fieldset><input type='hidden' class='wym_dialog_type' value='"+WYMeditor.DIALOG_IMAGE+"' /><legend>{Image}</legend><div class='row'><label>{URL}</label><input type='text' class='wym_src' value='' size='40' /></div><div class='row'><label>{Alternative_Text}</label><input type='text' class='wym_alt' value='' size='40' /></div><div class='row'><label>{Title}</label><input type='text' class='wym_title' value='' size='40' /></div><div class='row row-indent'><input class='wym_submit' type='button' value='{Submit}' /><input class='wym_cancel' type='button'value='{Cancel}' /></div></fieldset></form></body>",dialogTableHtml:"<body class='wym_dialog wym_dialog_table' onload='WYMeditor.INIT_DIALOG("+WYMeditor.INDEX+")'><form><fieldset><input type='hidden' class='wym_dialog_type' value='"+WYMeditor.DIALOG_TABLE+"' /><legend>{Table}</legend><div class='row'><label>{Caption}</label><input type='text' class='wym_caption' value='' size='40' /></div><div class='row'><label>{Summary}</label><input type='text' class='wym_summary' value='' size='40' /></div><div class='row'><label>{Number_Of_Rows}</label><input type='text' class='wym_rows' value='3' size='3' /></div><div class='row'><label>{Number_Of_Cols}</label><input type='text' class='wym_cols' value='2' size='3' /></div><div class='row row-indent'><input class='wym_submit' type='button' value='{Submit}' /><input class='wym_cancel' type='button'value='{Cancel}' /></div></fieldset></form></body>",dialogPasteHtml:"<body class='wym_dialog wym_dialog_paste' onload='WYMeditor.INIT_DIALOG("+WYMeditor.INDEX+")'><form><input type='hidden' class='wym_dialog_type' value='"+WYMeditor.DIALOG_PASTE+"' /><fieldset><legend>{Paste_From_Word}</legend><div class='row'><textarea class='wym_text' rows='10' cols='50'></textarea></div><div class='row'><input class='wym_submit' type='button' value='{Submit}' /><input class='wym_cancel' type='button'value='{Cancel}' /></div></fieldset></form></body>",dialogPreviewHtml:"<body class='wym_dialog wym_dialog_preview' onload='WYMeditor.INIT_DIALOG("+WYMeditor.INDEX+")'></body>",dialogStyles:[],stringDelimiterLeft:"{",stringDelimiterRight:"}",preInit:null,preBind:null,postInit:null,preInitDialog:null,postInitDialog:null},t),this.each(function(){new WYMeditor.editor(jQuery(this),t)})},jQuery.extend({wymeditors:function(t){return WYMeditor.INSTANCES[t]}}),WYMeditor.editor.prototype.init=function(){if(jQuery.browser.msie)var WymClass=new WYMeditor.WymClassExplorer(this);else if(jQuery.browser.mozilla)var WymClass=new WYMeditor.WymClassMozilla(this);else if(jQuery.browser.opera)var WymClass=new WYMeditor.WymClassOpera(this);else if(jQuery.browser.safari||jQuery.browser.chrome)var WymClass=new WYMeditor.WymClassSafari(this);if(WymClass){jQuery.isFunction(this._options.preInit)&&this._options.preInit(this);var SaxListener=new WYMeditor.XhtmlSaxListener;jQuery.extend(SaxListener,WymClass),this.parser=new WYMeditor.XhtmlParser(SaxListener),(this._options.styles||this._options.stylesheet)&&this.configureEditorUsingRawCss(),this.helper=new WYMeditor.XmlHelper;for(var prop in WymClass)this[prop]=WymClass[prop];this._box=jQuery(this._element).hide().after(this._options.boxHtml).next().addClass("wym_box_"+this._index),jQuery.isFunction(jQuery.fn.data)&&(jQuery.data(this._box.get(0),WYMeditor.WYM_INDEX,this._index),jQuery.data(this._element.get(0),WYMeditor.WYM_INDEX,this._index));var h=WYMeditor.Helper,iframeHtml=this._options.iframeHtml;iframeHtml=h.replaceAll(iframeHtml,WYMeditor.INDEX,this._index),iframeHtml=h.replaceAll(iframeHtml,WYMeditor.IFRAME_BASE_PATH,this._options.iframeBasePath);var boxHtml=jQuery(this._box).html();boxHtml=h.replaceAll(boxHtml,WYMeditor.LOGO,this._options.logoHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.TOOLS,this._options.toolsHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.CONTAINERS,this._options.containersHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.CLASSES,this._options.classesHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.HTML,this._options.htmlHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.IFRAME,iframeHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.STATUS,this._options.statusHtml);for(var aTools=eval(this._options.toolsItems),sTools="",i=0;i<aTools.length;i++){var oTool=aTools[i];if(oTool.name&&oTool.title)var sTool=this._options.toolsItemHtml;var sTool=h.replaceAll(sTool,WYMeditor.TOOL_NAME,oTool.name);sTool=h.replaceAll(sTool,WYMeditor.TOOL_TITLE,this._options.stringDelimiterLeft+oTool.title+this._options.stringDelimiterRight),sTool=h.replaceAll(sTool,WYMeditor.TOOL_CLASS,oTool.css),sTools+=sTool}boxHtml=h.replaceAll(boxHtml,WYMeditor.TOOLS_ITEMS,sTools);for(var aClasses=eval(this._options.classesItems),sClasses="",i=0;i<aClasses.length;i++){var oClass=aClasses[i];if(oClass.name&&oClass.title)var sClass=this._options.classesItemHtml;sClass=h.replaceAll(sClass,WYMeditor.CLASS_NAME,oClass.name),sClass=h.replaceAll(sClass,WYMeditor.CLASS_TITLE,oClass.title),sClasses+=sClass}boxHtml=h.replaceAll(boxHtml,WYMeditor.CLASSES_ITEMS,sClasses);for(var aContainers=eval(this._options.containersItems),sContainers="",i=0;i<aContainers.length;i++){var oContainer=aContainers[i];if(oContainer.name&&oContainer.title)var sContainer=this._options.containersItemHtml;sContainer=h.replaceAll(sContainer,WYMeditor.CONTAINER_NAME,oContainer.name),sContainer=h.replaceAll(sContainer,WYMeditor.CONTAINER_TITLE,this._options.stringDelimiterLeft+oContainer.title+this._options.stringDelimiterRight),sContainer=h.replaceAll(sContainer,WYMeditor.CONTAINER_CLASS,oContainer.css),sContainers+=sContainer}boxHtml=h.replaceAll(boxHtml,WYMeditor.CONTAINERS_ITEMS,sContainers),boxHtml=this.replaceStrings(boxHtml),jQuery(this._box).html(boxHtml),jQuery(this._box).find(this._options.htmlSelector).hide(),this.loadSkin()}},WYMeditor.editor.prototype.bindEvents=function(){var wym=this;jQuery(this._box).find(this._options.toolSelector).click(function(){return wym._iframe.contentWindow.focus(),wym.exec(jQuery(this).attr(WYMeditor.NAME)),!1}),jQuery(this._box).find(this._options.containerSelector).click(function(){return wym.container(jQuery(this).attr(WYMeditor.NAME)),!1}),jQuery(this._box).find(this._options.htmlValSelector).keyup(function(){jQuery(wym._doc.body).html(jQuery(this).val())}).focus(function(){jQuery(this).toggleClass("hasfocus")}).blur(function(){jQuery(this).toggleClass("hasfocus")}),jQuery(this._box).find(this._options.classSelector).click(function(){var aClasses=eval(wym._options.classesItems),sName=jQuery(this).attr(WYMeditor.NAME),oClass=WYMeditor.Helper.findByName(aClasses,sName);if(oClass){var jqexpr=oClass.expr;wym.toggleClass(sName,jqexpr)}return wym._iframe.contentWindow.focus(),!1}),jQuery(this._options.updateSelector).bind(this._options.updateEvent,function(){wym.update()})},WYMeditor.editor.prototype.ready=function(){return null!=this._doc},WYMeditor.editor.prototype.box=function(){return this._box},WYMeditor.editor.prototype.html=function(t){if("string"!=typeof t)return jQuery(this._doc.body).html();jQuery(this._doc.body).html(t)},WYMeditor.editor.prototype.xhtml=function(){return this.parser.parse(this.html())},WYMeditor.editor.prototype.exec=function(t){switch(t){case WYMeditor.CREATE_LINK:(this.container()||this._selected_image)&&this.dialog(WYMeditor.DIALOG_LINK);break;case WYMeditor.INSERT_IMAGE:this.dialog(WYMeditor.DIALOG_IMAGE);break;case WYMeditor.INSERT_TABLE:this.dialog(WYMeditor.DIALOG_TABLE);break;case WYMeditor.PASTE:this.dialog(WYMeditor.DIALOG_PASTE);break;case WYMeditor.TOGGLE_HTML:this.update(),this.toggleHtml(),jQuery(this._box).find(this._options.htmlSelector).is(":visible")||this.listen();break;case WYMeditor.PREVIEW:this.dialog(WYMeditor.PREVIEW,this._options.dialogFeaturesPreview);break;default:this._exec(t)}},WYMeditor.editor.prototype.container=function(t){if(!t)return this.selected();var e=null;if(t.toLowerCase()==WYMeditor.TH){switch((e=this.container()).tagName.toLowerCase()){case WYMeditor.TD:case WYMeditor.TH:break;default:i=new Array(WYMeditor.TD,WYMeditor.TH);e=this.findUp(this.container(),i)}null!=e&&(t=e.tagName.toLowerCase()==WYMeditor.TD?WYMeditor.TH:WYMeditor.TD,this.switchTo(e,t),this.update())}else{var i=new Array(WYMeditor.P,WYMeditor.H1,WYMeditor.H2,WYMeditor.H3,WYMeditor.H4,WYMeditor.H5,WYMeditor.H6,WYMeditor.PRE,WYMeditor.BLOCKQUOTE);if(e=this.findUp(this.container(),i)){var s=null;if(t.toLowerCase()==WYMeditor.BLOCKQUOTE){var o=this.findUp(this.container(),WYMeditor.BLOCKQUOTE);if(null==o)s=this._doc.createElement(t),e.parentNode.insertBefore(s,e),s.appendChild(e),this.setFocusToNode(s.firstChild);else{var r=o.childNodes,a=r.length,n=null;a>0&&(n=r.item(0));for(var l=0;l<a;l++)o.parentNode.insertBefore(r.item(0),o);o.parentNode.removeChild(o),n&&this.setFocusToNode(n)}}else this.switchTo(e,t);this.update()}}},WYMeditor.editor.prototype.toggleClass=function(t,e){var i=this._selected_image?this._selected_image:jQuery(this.selected());i=jQuery(i).parentsOrSelf(e),jQuery(i).toggleClass(t),jQuery(i).attr(WYMeditor.CLASS)||jQuery(i).removeAttr(this._class)},WYMeditor.editor.prototype.findUp=function(t,e){if(t){var i=t.tagName.toLowerCase();if(typeof e==WYMeditor.STRING)for(;i!=e&&i!=WYMeditor.BODY;)i=(t=t.parentNode).tagName.toLowerCase();else for(var s=!1;!s&&i!=WYMeditor.BODY;){for(var o=0;o<e.length;o++)if(i==e[o]){s=!0;break}s||(i=(t=t.parentNode).tagName.toLowerCase())}return i!=WYMeditor.BODY?t:null}return null},WYMeditor.editor.prototype.switchTo=function(t,e){var i=this._doc.createElement(e),s=jQuery(t).html();t.parentNode.replaceChild(i,t),jQuery(i).html(s),this.setFocusToNode(i)},WYMeditor.editor.prototype.replaceStrings=function(sVal){if(!WYMeditor.STRINGS[this._options.lang])try{eval(jQuery.ajax({url:this._options.langPath+this._options.lang+".js",async:!1}).responseText)}catch(t){return WYMeditor.console.error("WYMeditor: error while parsing language file."),sVal}for(var key in WYMeditor.STRINGS[this._options.lang])sVal=WYMeditor.Helper.replaceAll(sVal,this._options.stringDelimiterLeft+key+this._options.stringDelimiterRight,WYMeditor.STRINGS[this._options.lang][key]);return sVal},WYMeditor.editor.prototype.encloseString=function(t){return this._options.stringDelimiterLeft+t+this._options.stringDelimiterRight},WYMeditor.editor.prototype.status=function(t){jQuery(this._box).find(this._options.statusSelector).html(t)},WYMeditor.editor.prototype.update=function(){var t=this.xhtml();jQuery(this._element).val(t),jQuery(this._box).find(this._options.htmlValSelector).not(".hasfocus").val(t)},WYMeditor.editor.prototype.dialog=function(t,e,i){var s=e||this._wym._options.dialogFeatures,o=window.open("","dialog",s);if(o){var r="";switch(t){case WYMeditor.DIALOG_LINK:r=this._options.dialogLinkHtml;break;case WYMeditor.DIALOG_IMAGE:r=this._options.dialogImageHtml;break;case WYMeditor.DIALOG_TABLE:r=this._options.dialogTableHtml;break;case WYMeditor.DIALOG_PASTE:r=this._options.dialogPasteHtml;break;case WYMeditor.PREVIEW:r=this._options.dialogPreviewHtml;break;default:r=i}var a=WYMeditor.Helper,n=this._options.dialogHtml;n=a.replaceAll(n,WYMeditor.BASE_PATH,this._options.basePath),n=a.replaceAll(n,WYMeditor.DIRECTION,this._options.direction),n=a.replaceAll(n,WYMeditor.CSS_PATH,this._options.skinPath+WYMeditor.SKINS_DEFAULT_CSS),n=a.replaceAll(n,WYMeditor.WYM_PATH,this._options.wymPath),n=a.replaceAll(n,WYMeditor.JQUERY_PATH,this._options.jQueryPath),n=a.replaceAll(n,WYMeditor.DIALOG_TITLE,this.encloseString(t)),n=a.replaceAll(n,WYMeditor.DIALOG_BODY,r),n=a.replaceAll(n,WYMeditor.INDEX,this._index),n=this.replaceStrings(n);var l=o.document;l.write(n),l.close()}},WYMeditor.editor.prototype.toggleHtml=function(){jQuery(this._box).find(this._options.htmlSelector).toggle()},WYMeditor.editor.prototype.uniqueStamp=function(){return"wym-"+(new Date).getTime()},WYMeditor.editor.prototype.paste=function(t){var e,i=this.selected(),s=t.split(this._newLine+this._newLine),o=new RegExp(this._newLine,"g");if(i&&i.tagName.toLowerCase()!=WYMeditor.BODY)for(x=s.length-1;x>=0;x--)e=(e=s[x]).replace(o,"<br />"),jQuery(i).after("<p>"+e+"</p>");else for(x=0;x<s.length;x++)e=(e=s[x]).replace(o,"<br />"),jQuery(this._doc.body).append("<p>"+e+"</p>")},WYMeditor.editor.prototype.insert=function(t){null!=this._iframe.contentWindow.getSelection().focusNode?this._exec(WYMeditor.INSERT_HTML,t):this.paste(t)},WYMeditor.editor.prototype.wrap=function(t,e){null!=this._iframe.contentWindow.getSelection().focusNode&&this._exec(WYMeditor.INSERT_HTML,t+this._iframe.contentWindow.getSelection().toString()+e)},WYMeditor.editor.prototype.unwrap=function(){null!=this._iframe.contentWindow.getSelection().focusNode&&this._exec(WYMeditor.INSERT_HTML,this._iframe.contentWindow.getSelection().toString())},WYMeditor.editor.prototype.addCssRules=function(t,e){var i=t.styleSheets[0];if(i)for(var s=0;s<e.length;s++){var o=e[s];o.name&&o.css&&this.addCssRule(i,o)}},WYMeditor.editor.prototype.computeBasePath=function(){return jQuery(jQuery.grep(jQuery("script"),function(t){return t.src&&t.src.match(/jquery\.wymeditor(\.pack|\.min|\.packed)?\.js(\?.*)?$/)})).attr("src").replace(/jquery\.wymeditor(\.pack|\.min|\.packed)?\.js(\?.*)?$/,"")},WYMeditor.editor.prototype.computeWymPath=function(){return jQuery(jQuery.grep(jQuery("script"),function(t){return t.src&&t.src.match(/jquery\.wymeditor(\.pack|\.min|\.packed)?\.js(\?.*)?$/)})).attr("src")},WYMeditor.editor.prototype.computeJqueryPath=function(){return jQuery(jQuery.grep(jQuery("script"),function(t){return t.src&&t.src.match(/jquery(-(.*)){0,1}(\.pack|\.min|\.packed)?\.js(\?.*)?$/)})).attr("src")},WYMeditor.editor.prototype.computeCssPath=function(){return jQuery(jQuery.grep(jQuery("link"),function(t){return t.href&&t.href.match(/wymeditor\/skins\/(.*)screen\.css(\?.*)?$/)})).attr("href")},WYMeditor.editor.prototype.configureEditorUsingRawCss=function(){var t=new WYMeditor.WymCssParser;this._options.stylesheet?t.parse(jQuery.ajax({url:this._options.stylesheet,async:!1}).responseText):t.parse(this._options.styles,!1),0==this._options.classesItems.length&&(this._options.classesItems=t.css_settings.classesItems),0==this._options.editorStyles.length&&(this._options.editorStyles=t.css_settings.editorStyles),0==this._options.dialogStyles.length&&(this._options.dialogStyles=t.css_settings.dialogStyles)},WYMeditor.editor.prototype.listen=function(){jQuery(this._doc.body).bind("mousedown",this.mousedown);for(var t=this._doc.body.getElementsByTagName("img"),e=0;e<t.length;e++)jQuery(t[e]).bind("mousedown",this.mousedown)},WYMeditor.editor.prototype.mousedown=function(t){WYMeditor.INSTANCES[this.ownerDocument.title]._selected_image=this.tagName.toLowerCase()==WYMeditor.IMG?this:null,t.stopPropagation()},WYMeditor.loadCss=function(t){var e=document.createElement("link");e.rel="stylesheet",e.href=t,jQuery("head").get(0).appendChild(e)},WYMeditor.editor.prototype.loadSkin=function(){if(this._options.loadSkin&&!WYMeditor.SKINS[this._options.skin]){var found=!1,rExp=new RegExp(this._options.skin+"/"+WYMeditor.SKINS_DEFAULT_CSS+"$");jQuery("link").each(function(){this.href.match(rExp)&&(found=!0)}),found||WYMeditor.loadCss(this._options.skinPath+WYMeditor.SKINS_DEFAULT_CSS)}jQuery(this._box).addClass("wym_skin_"+this._options.skin),this._options.initSkin&&!WYMeditor.SKINS[this._options.skin]&&eval(jQuery.ajax({url:this._options.skinPath+WYMeditor.SKINS_DEFAULT_JS,async:!1}).responseText),WYMeditor.SKINS[this._options.skin]&&WYMeditor.SKINS[this._options.skin].init&&WYMeditor.SKINS[this._options.skin].init(this)},WYMeditor.INIT_DIALOG=function(index){var wym=window.opener.WYMeditor.INSTANCES[index],doc=window.document,selected=wym.selected(),dialogType=jQuery(wym._options.dialogTypeSelector).val(),sStamp=wym.uniqueStamp();switch(dialogType){case WYMeditor.DIALOG_LINK:selected&&selected.tagName&&selected.tagName.toLowerCase!=WYMeditor.A&&(selected=jQuery(selected).parentsOrSelf(WYMeditor.A)),!selected&&wym._selected_image&&(selected=jQuery(wym._selected_image).parentsOrSelf(WYMeditor.A))}jQuery.isFunction(wym._options.preInitDialog)&&wym._options.preInitDialog(wym,window);var styles=doc.styleSheets[0],aCss=eval(wym._options.dialogStyles);wym.addCssRules(doc,aCss),selected&&(jQuery(wym._options.hrefSelector).val(jQuery(selected).attr(WYMeditor.HREF)),jQuery(wym._options.srcSelector).val(jQuery(selected).attr(WYMeditor.SRC)),jQuery(wym._options.titleSelector).val(jQuery(selected).attr(WYMeditor.TITLE)),jQuery(wym._options.altSelector).val(jQuery(selected).attr(WYMeditor.ALT))),wym._selected_image&&(jQuery(wym._options.dialogImageSelector+" "+wym._options.srcSelector).val(jQuery(wym._selected_image).attr(WYMeditor.SRC)),jQuery(wym._options.dialogImageSelector+" "+wym._options.titleSelector).val(jQuery(wym._selected_image).attr(WYMeditor.TITLE)),jQuery(wym._options.dialogImageSelector+" "+wym._options.altSelector).val(jQuery(wym._selected_image).attr(WYMeditor.ALT))),jQuery(wym._options.dialogLinkSelector+" "+wym._options.submitSelector).click(function(){var t=jQuery(wym._options.hrefSelector).val();t.length>0&&(wym._exec(WYMeditor.CREATE_LINK,sStamp),jQuery("a[href="+sStamp+"]",wym._doc.body).attr(WYMeditor.HREF,t).attr(WYMeditor.TITLE,jQuery(wym._options.titleSelector).val())),window.close()}),jQuery(wym._options.dialogImageSelector+" "+wym._options.submitSelector).click(function(){var t=jQuery(wym._options.srcSelector).val();t.length>0&&(wym._exec(WYMeditor.INSERT_IMAGE,sStamp),jQuery("img[src$="+sStamp+"]",wym._doc.body).attr(WYMeditor.SRC,t).attr(WYMeditor.TITLE,jQuery(wym._options.titleSelector).val()).attr(WYMeditor.ALT,jQuery(wym._options.altSelector).val())),window.close()}),jQuery(wym._options.dialogTableSelector+" "+wym._options.submitSelector).click(function(){var t=jQuery(wym._options.rowsSelector).val(),e=jQuery(wym._options.colsSelector).val();if(t>0&&e>0){var i=wym._doc.createElement(WYMeditor.TABLE),s=null,o=jQuery(wym._options.captionSelector).val();for(i.createCaption().innerHTML=o,x=0;x<t;x++)for(s=i.insertRow(x),y=0;y<e;y++)s.insertCell(y);jQuery(i).attr("summary",jQuery(wym._options.summarySelector).val());var r=jQuery(wym.findUp(wym.container(),WYMeditor.MAIN_CONTAINERS)).get(0);r&&r.parentNode?jQuery(r).after(i):jQuery(wym._doc.body).append(i)}window.close()}),jQuery(wym._options.dialogPasteSelector+" "+wym._options.submitSelector).click(function(){var t=jQuery(wym._options.textSelector).val();wym.paste(t),window.close()}),jQuery(wym._options.dialogPreviewSelector+" "+wym._options.previewSelector).html(wym.xhtml()),jQuery(wym._options.cancelSelector).mousedown(function(){window.close()}),jQuery.isFunction(wym._options.postInitDialog)&&wym._options.postInitDialog(wym,window)},WYMeditor.XmlHelper=function(){return this._entitiesDiv=document.createElement("div"),this},WYMeditor.XmlHelper.prototype.tag=function(t,e,i){return e=e||!1,i=i||!1,"<"+t+(e?this.tagOptions(e):"")+(i?">":" />")},WYMeditor.XmlHelper.prototype.contentTag=function(t,e,i){return i=i||!1,"<"+t+(i?this.tagOptions(i):"")+">"+e+"</"+t+">"},WYMeditor.XmlHelper.prototype.cdataSection=function(t){return"<![CDATA["+t+"]]>"},WYMeditor.XmlHelper.prototype.escapeOnce=function(t){return this._fixDoubleEscape(this.escapeEntities(t))},WYMeditor.XmlHelper.prototype._fixDoubleEscape=function(t){return t.replace(/&([a-z]+|(#\d+));/gi,"&$1;")},WYMeditor.XmlHelper.prototype.tagOptions=function(t){var e=this;e._formated_options="";for(var i in t){var s=t[i];"function"!=typeof s&&s.length>0&&(parseInt(i)==i&&"object"==typeof s&&(i=s.shift(),s=s.pop()),""!=i&&""!=s&&(e._formated_options+=" "+i+'="'+e.escapeOnce(s)+'"'))}return e._formated_options},WYMeditor.XmlHelper.prototype.escapeEntities=function(t,e){this._entitiesDiv.innerHTML=t,this._entitiesDiv.textContent=t;var i=this._entitiesDiv.innerHTML;return void 0===e&&(0!=e&&(i=i.replace('"',""")),1==e&&(i=i.replace('"',"'"))),i},WYMeditor.XmlHelper.prototype.parseAttributes=function(t){var e=[],i=t.split(/((=\s*")(")("))|((=\s*\')(\')(\'))|((=\s*[^>\s]*))/g);if(i.toString()!=t)for(var s in i){var o=i[s];if("function"!=typeof o&&0!=o.length){var r=new RegExp("(\\w+)\\s*"+o);if(match=t.match(r)){var a=o.replace(/^[\s=]+/,""),n=a.charAt(0);""!=(n='"'==n?'"':"'"==n?"'":"")&&(a='"'==n?a.replace(/^"|"+$/g,""):a.replace(/^'|'+$/g,"")),t=t.replace(match[0],""),e.push([match[1],a])}}}return e},WYMeditor.XhtmlValidator={_attributes:{core:{except:["base","head","html","meta","param","script","style","title"],attributes:["class","id","style","title","accesskey","tabindex"]},language:{except:["base","br","hr","iframe","param","script"],attributes:{dir:["ltr","rtl"],0:"lang",1:"xml:lang"}},keyboard:{attributes:{accesskey:/^(\w){1}$/,tabindex:/^(\d)+$/}}},_events:{window:{only:["body"],attributes:["onload","onunload"]},form:{only:["form","input","textarea","select","a","label","button"],attributes:["onchange","onsubmit","onreset","onselect","onblur","onfocus"]},keyboard:{except:["base","bdo","br","frame","frameset","head","html","iframe","meta","param","script","style","title"],attributes:["onkeydown","onkeypress","onkeyup"]},mouse:{except:["base","bdo","br","head","html","meta","param","script","style","title"],attributes:["onclick","ondblclick","onmousedown","onmousemove","onmouseover","onmouseout","onmouseup"]}},_tags:{a:{attributes:{0:"charset",1:"coords",2:"href",3:"hreflang",4:"name",rel:/^(alternate|designates|stylesheet|start|next|prev|contents|index|glossary|copyright|chapter|section|subsection|appendix|help|bookmark| |shortcut|icon)+$/,rev:/^(alternate|designates|stylesheet|start|next|prev|contents|index|glossary|copyright|chapter|section|subsection|appendix|help|bookmark| |shortcut|icon)+$/,shape:/^(rect|rectangle|circ|circle|poly|polygon)$/,5:"type"}},0:"abbr",1:"acronym",2:"address",area:{attributes:{0:"alt",1:"coords",2:"href",nohref:/^(true|false)$/,shape:/^(rect|rectangle|circ|circle|poly|polygon)$/},required:["alt"]},3:"b",base:{attributes:["href"],required:["href"]},bdo:{attributes:{dir:/^(ltr|rtl)$/},required:["dir"]},4:"big",blockquote:{attributes:["cite"]},5:"body",6:"br",button:{attributes:{disabled:/^(disabled)$/,type:/^(button|reset|submit)$/,0:"value"},inside:"form"},7:"caption",8:"cite",9:"code",col:{attributes:{align:/^(right|left|center|justify)$/,0:"char",1:"charoff",span:/^(\d)+$/,valign:/^(top|middle|bottom|baseline)$/,2:"width"},inside:"colgroup"},colgroup:{attributes:{align:/^(right|left|center|justify)$/,0:"char",1:"charoff",span:/^(\d)+$/,valign:/^(top|middle|bottom|baseline)$/,2:"width"}},10:"dd",del:{attributes:{0:"cite",datetime:/^([0-9]){8}/}},11:"div",12:"dfn",13:"dl",14:"dt",15:"em",fieldset:{inside:"form"},form:{attributes:{0:"action",1:"accept",2:"accept-charset",3:"enctype",method:/^(get|post)$/},required:["action"]},head:{attributes:["profile"]},16:"h1",17:"h2",18:"h3",19:"h4",20:"h5",21:"h6",22:"hr",html:{attributes:["xmlns"]},23:"i",img:{attributes:["alt","src","height","ismap","longdesc","usemap","width"],required:["alt","src"]},input:{attributes:{0:"accept",1:"alt",checked:/^(checked)$/,disabled:/^(disabled)$/,maxlength:/^(\d)+$/,2:"name",readonly:/^(readonly)$/,size:/^(\d)+$/,3:"src",type:/^(button|checkbox|file|hidden|image|password|radio|reset|submit|text)$/,4:"value"},inside:"form"},ins:{attributes:{0:"cite",datetime:/^([0-9]){8}/}},24:"kbd",label:{attributes:["for"],inside:"form"},25:"legend",26:"li",link:{attributes:{0:"charset",1:"href",2:"hreflang",media:/^(all|braille|print|projection|screen|speech|,|;| )+$/i,rel:/^(alternate|appendix|bookmark|chapter|contents|copyright|glossary|help|home|index|next|prev|section|start|stylesheet|subsection| |shortcut|icon)+$/i,rev:/^(alternate|appendix|bookmark|chapter|contents|copyright|glossary|help|home|index|next|prev|section|start|stylesheet|subsection| |shortcut|icon)+$/i,3:"type"},inside:"head"},map:{attributes:["id","name"],required:["id"]},meta:{attributes:{0:"content","http-equiv":/^(content\-type|expires|refresh|set\-cookie)$/i,1:"name",2:"scheme"},required:["content"]},27:"noscript",object:{attributes:["archive","classid","codebase","codetype","data","declare","height","name","standby","type","usemap","width"]},28:"ol",optgroup:{attributes:{0:"label",disabled:/^(disabled)$/},required:["label"]},option:{attributes:{0:"label",disabled:/^(disabled)$/,selected:/^(selected)$/,1:"value"},inside:"select"},29:"p",param:{attributes:{0:"type",valuetype:/^(data|ref|object)$/,1:"valuetype",2:"value"},required:["name"]},30:"pre",q:{attributes:["cite"]},31:"samp",script:{attributes:{type:/^(text\/ecmascript|text\/javascript|text\/jscript|text\/vbscript|text\/vbs|text\/xml)$/,0:"charset",defer:/^(defer)$/,1:"src"},required:["type"]},select:{attributes:{disabled:/^(disabled)$/,multiple:/^(multiple)$/,0:"name",1:"size"},inside:"form"},32:"small",33:"span",34:"strong",style:{attributes:{0:"type",media:/^(screen|tty|tv|projection|handheld|print|braille|aural|all)$/},required:["type"]},35:"sub",36:"sup",table:{attributes:{0:"border",1:"cellpadding",2:"cellspacing",frame:/^(void|above|below|hsides|lhs|rhs|vsides|box|border)$/,rules:/^(none|groups|rows|cols|all)$/,3:"summary",4:"width"}},tbody:{attributes:{align:/^(right|left|center|justify)$/,0:"char",1:"charoff",valign:/^(top|middle|bottom|baseline)$/}},td:{attributes:{0:"abbr",align:/^(left|right|center|justify|char)$/,1:"axis",2:"char",3:"charoff",colspan:/^(\d)+$/,4:"headers",rowspan:/^(\d)+$/,scope:/^(col|colgroup|row|rowgroup)$/,valign:/^(top|middle|bottom|baseline)$/}},textarea:{attributes:["cols","rows","disabled","name","readonly"],required:["cols","rows"],inside:"form"},tfoot:{attributes:{align:/^(right|left|center|justify)$/,0:"char",1:"charoff",valign:/^(top|middle|bottom)$/,2:"baseline"}},th:{attributes:{0:"abbr",align:/^(left|right|center|justify|char)$/,1:"axis",2:"char",3:"charoff",colspan:/^(\d)+$/,4:"headers",rowspan:/^(\d)+$/,scope:/^(col|colgroup|row|rowgroup)$/,valign:/^(top|middle|bottom|baseline)$/}},thead:{attributes:{align:/^(right|left|center|justify)$/,0:"char",1:"charoff",valign:/^(top|middle|bottom|baseline)$/}},37:"title",tr:{attributes:{align:/^(right|left|center|justify|char)$/,0:"char",1:"charoff",valign:/^(top|middle|bottom|baseline)$/}},38:"tt",39:"ul",40:"var"},skiped_attributes:[],skiped_attribute_values:[],getValidTagAttributes:function(t,e){var i={},s=this.getPossibleTagAttributes(t);for(var o in e){var r=e[o],a=WYMeditor.Helper;a.contains(this.skiped_attributes,o)||a.contains(this.skiped_attribute_values,r)||"function"!=typeof r&&a.contains(s,o)&&(this.doesAttributeNeedsValidation(t,o)?this.validateAttribute(t,o,r)&&(i[o]=r):i[o]=r)}return i},getUniqueAttributesAndEventsForTag:function(t){var e=[];if(this._tags[t]&&this._tags[t].attributes)for(k in this._tags[t].attributes)e.push(parseInt(k)==k?this._tags[t].attributes[k]:k);return e},getDefaultAttributesAndEventsForTags:function(){var t=[];for(var e in this._events)t.push(this._events[e]);for(var e in this._attributes)t.push(this._attributes[e]);return t},isValidTag:function(t){if(this._tags[t])return!0;for(var e in this._tags)if(this._tags[e]==t)return!0;return!1},getDefaultAttributesAndEventsForTag:function(t){var e=[];if(this.isValidTag(t)){var i=this.getDefaultAttributesAndEventsForTags();for(var s in i){var o=i[s];if("object"==typeof o){var r=WYMeditor.Helper;if(o.except&&r.contains(o.except,t)||o.only&&!r.contains(o.only,t))continue;var a=o.attributes?o.attributes:o.events;for(var n in a)e.push("string"!=typeof a[n]?n:a[n])}}}return e},doesAttributeNeedsValidation:function(t,e){return this._tags[t]&&(this._tags[t].attributes&&this._tags[t].attributes[e]||this._tags[t].required&&WYMeditor.Helper.contains(this._tags[t].required,e))},validateAttribute:function(t,e,i){return!(this._tags[t]&&this._tags[t].attributes&&this._tags[t].attributes[e]&&i.length>0&&!i.match(this._tags[t].attributes[e])||this._tags[t]&&this._tags[t].required&&WYMeditor.Helper.contains(this._tags[t].required,e)&&0==i.length)&&void 0!==this._tags[t]},getPossibleTagAttributes:function(t){return this._possible_tag_attributes||(this._possible_tag_attributes={}),this._possible_tag_attributes[t]||(this._possible_tag_attributes[t]=this.getUniqueAttributesAndEventsForTag(t).concat(this.getDefaultAttributesAndEventsForTag(t))),this._possible_tag_attributes[t]}},WYMeditor.ParallelRegex=function(t){return this._case=t,this._patterns=[],this._labels=[],this._regex=null,this},WYMeditor.ParallelRegex.prototype.addPattern=function(t,e){e=e||!0;var i=this._patterns.length;this._patterns[i]=t,this._labels[i]=e,this._regex=null},WYMeditor.ParallelRegex.prototype.match=function(t){if(0==this._patterns.length)return[!1,""];var e=t.match(this._getCompoundedRegex());if(!e)return[!1,""];for(var i=e[0],s=1;s<e.length;s++)if(e[s])return[this._labels[s-1],i];return[!0,e[0]]},WYMeditor.ParallelRegex.prototype._getCompoundedRegex=function(){if(null==this._regex){for(var t=0,e=this._patterns.length;t<e;t++)this._patterns[t]="("+this._untokenizeRegex(this._tokenizeRegex(this._patterns[t]).replace(/([\/\(\)])/g,"\\$1"))+")";this._regex=new RegExp(this._patterns.join("|"),this._getPerlMatchingFlags())}return this._regex},WYMeditor.ParallelRegex.prototype._tokenizeRegex=function(t){return t.replace(/\(\?(i|m|s|x|U)\)/,"~~~~~~Tk1$1~~~~~~").replace(/\(\?(\-[i|m|s|x|U])\)/,"~~~~~~Tk2$1~~~~~~").replace(/\(\?\=(.*)\)/,"~~~~~~Tk3$1~~~~~~").replace(/\(\?\!(.*)\)/,"~~~~~~Tk4$1~~~~~~").replace(/\(\?\<\=(.*)\)/,"~~~~~~Tk5$1~~~~~~").replace(/\(\?\<\!(.*)\)/,"~~~~~~Tk6$1~~~~~~").replace(/\(\?\:(.*)\)/,"~~~~~~Tk7$1~~~~~~")},WYMeditor.ParallelRegex.prototype._untokenizeRegex=function(t){return t.replace(/~~~~~~Tk1(.{1})~~~~~~/,"(?$1)").replace(/~~~~~~Tk2(.{2})~~~~~~/,"(?$1)").replace(/~~~~~~Tk3(.*)~~~~~~/,"(?=$1)").replace(/~~~~~~Tk4(.*)~~~~~~/,"(?!$1)").replace(/~~~~~~Tk5(.*)~~~~~~/,"(?<=$1)").replace(/~~~~~~Tk6(.*)~~~~~~/,"(?<!$1)").replace(/~~~~~~Tk7(.*)~~~~~~/,"(?:$1)")},WYMeditor.ParallelRegex.prototype._getPerlMatchingFlags=function(){return this._case?"m":"mi"},WYMeditor.StateStack=function(t){return this._stack=[t],this},WYMeditor.StateStack.prototype.getCurrent=function(){return this._stack[this._stack.length-1]},WYMeditor.StateStack.prototype.enter=function(t){this._stack.push(t)},WYMeditor.StateStack.prototype.leave=function(){return 1!=this._stack.length&&(this._stack.pop(),!0)},WYMeditor.LEXER_ENTER=1,WYMeditor.LEXER_MATCHED=2,WYMeditor.LEXER_UNMATCHED=3,WYMeditor.LEXER_EXIT=4,WYMeditor.LEXER_SPECIAL=5,WYMeditor.Lexer=function(t,e,i){return e=e||"accept",this._case=i||!1,this._regexes={},this._parser=t,this._mode=new WYMeditor.StateStack(e),this._mode_handlers={},this._mode_handlers[e]=e,this},WYMeditor.Lexer.prototype.addPattern=function(t,e){var e=e||"accept";void 0===this._regexes[e]&&(this._regexes[e]=new WYMeditor.ParallelRegex(this._case)),this._regexes[e].addPattern(t),void 0===this._mode_handlers[e]&&(this._mode_handlers[e]=e)},WYMeditor.Lexer.prototype.addEntryPattern=function(t,e,i){void 0===this._regexes[e]&&(this._regexes[e]=new WYMeditor.ParallelRegex(this._case)),this._regexes[e].addPattern(t,i),void 0===this._mode_handlers[i]&&(this._mode_handlers[i]=i)},WYMeditor.Lexer.prototype.addExitPattern=function(t,e){void 0===this._regexes[e]&&(this._regexes[e]=new WYMeditor.ParallelRegex(this._case)),this._regexes[e].addPattern(t,"__exit"),void 0===this._mode_handlers[e]&&(this._mode_handlers[e]=e)},WYMeditor.Lexer.prototype.addSpecialPattern=function(t,e,i){void 0===this._regexes[e]&&(this._regexes[e]=new WYMeditor.ParallelRegex(this._case)),this._regexes[e].addPattern(t,"_"+i),void 0===this._mode_handlers[i]&&(this._mode_handlers[i]=i)},WYMeditor.Lexer.prototype.mapHandler=function(t,e){this._mode_handlers[t]=e},WYMeditor.Lexer.prototype.parse=function(t){if(void 0===this._parser)return!1;for(var e,i=t.length;"object"==typeof(e=this._reduce(t));){var t=e[0],s=e[1],o=e[2],r=e[3];if(!this._dispatchTokens(s,o,r))return!1;if(""==t)return!0;if(t.length==i)return!1;i=t.length}return!!e&&this._invokeParser(t,WYMeditor.LEXER_UNMATCHED)},WYMeditor.Lexer.prototype._dispatchTokens=function(t,e,i){return i=i||!1,!!this._invokeParser(t,WYMeditor.LEXER_UNMATCHED)&&("boolean"==typeof i?this._invokeParser(e,WYMeditor.LEXER_MATCHED):this._isModeEnd(i)?!!this._invokeParser(e,WYMeditor.LEXER_EXIT)&&this._mode.leave():this._isSpecialMode(i)?(this._mode.enter(this._decodeSpecial(i)),!!this._invokeParser(e,WYMeditor.LEXER_SPECIAL)&&this._mode.leave()):(this._mode.enter(i),this._invokeParser(e,WYMeditor.LEXER_ENTER)))},WYMeditor.Lexer.prototype._isModeEnd=function(t){return"__exit"===t},WYMeditor.Lexer.prototype._isSpecialMode=function(t){return"_"==t.substring(0,1)},WYMeditor.Lexer.prototype._decodeSpecial=function(t){return t.substring(1)},WYMeditor.Lexer.prototype._invokeParser=function(content,is_match){if(!/ +/.test(content)&&(""===content||0==content))return!0;var current=this._mode.getCurrent(),handler=this._mode_handlers[current],result;return eval("result = this._parser."+handler+"(content, is_match);"),result},WYMeditor.Lexer.prototype._reduce=function(t){var e=this._regexes[this._mode.getCurrent()].match(t),i=e[1],s=e[0];if(s){var o=t.indexOf(i),r=t.substr(0,o);return t=t.substring(o+i.length),[t,r,i,s]}return!0},WYMeditor.XhtmlLexer=function(t){return jQuery.extend(this,new WYMeditor.Lexer(t,"Text")),this.mapHandler("Text","Text"),this.addTokens(),this.init(),this},WYMeditor.XhtmlLexer.prototype.init=function(){},WYMeditor.XhtmlLexer.prototype.addTokens=function(){this.addCommentTokens("Text"),this.addScriptTokens("Text"),this.addCssTokens("Text"),this.addTagTokens("Text")},WYMeditor.XhtmlLexer.prototype.addCommentTokens=function(t){this.addEntryPattern("\x3c!--",t,"Comment"),this.addExitPattern("--\x3e","Comment")},WYMeditor.XhtmlLexer.prototype.addScriptTokens=function(t){this.addEntryPattern("<script",t,"Script"),this.addExitPattern("<\/script>","Script")},WYMeditor.XhtmlLexer.prototype.addCssTokens=function(t){this.addEntryPattern("<style",t,"Css"),this.addExitPattern("</style>","Css")},WYMeditor.XhtmlLexer.prototype.addTagTokens=function(t){this.addSpecialPattern("<\\s*[a-z0-9:-]+\\s*>",t,"OpeningTag"),this.addEntryPattern("<[a-z0-9:-]+[\\/ \\>]+",t,"OpeningTag"),this.addInTagDeclarationTokens("OpeningTag"),this.addSpecialPattern("</\\s*[a-z0-9:-]+\\s*>",t,"ClosingTag")},WYMeditor.XhtmlLexer.prototype.addInTagDeclarationTokens=function(t){this.addSpecialPattern("\\s+",t,"Ignore"),this.addAttributeTokens(t),this.addExitPattern("/>",t),this.addExitPattern(">",t)},WYMeditor.XhtmlLexer.prototype.addAttributeTokens=function(t){this.addSpecialPattern("\\s*[a-z-_0-9]*:?[a-z-_0-9]+\\s*(?==)\\s*",t,"TagAttributes"),this.addEntryPattern('=\\s*"',t,"DoubleQuotedAttribute"),this.addPattern('\\\\"',"DoubleQuotedAttribute"),this.addExitPattern('"',"DoubleQuotedAttribute"),this.addEntryPattern("=\\s*'",t,"SingleQuotedAttribute"),this.addPattern("\\\\'","SingleQuotedAttribute"),this.addExitPattern("'","SingleQuotedAttribute"),this.addSpecialPattern("=\\s*[^>\\s]*",t,"UnquotedAttribute")},WYMeditor.XhtmlParser=function(t,e){var e=e||"Text";return this._Lexer=new WYMeditor.XhtmlLexer(this),this._Listener=t,this._mode=e,this._matches=[],this._last_match="",this._current_match="",this},WYMeditor.XhtmlParser.prototype.parse=function(t){return this._Lexer.parse(this.beforeParsing(t)),this.afterParsing(this._Listener.getResult())},WYMeditor.XhtmlParser.prototype.beforeParsing=function(t){return(t.match(/class="MsoNormal"/)||t.match(/ns = "urn:schemas-microsoft-com/))&&this._Listener.avoidStylingTagsAndAttributes(),this._Listener.beforeParsing(t)},WYMeditor.XhtmlParser.prototype.afterParsing=function(t){return this._Listener._avoiding_tags_implicitly&&this._Listener.allowStylingTagsAndAttributes(),this._Listener.afterParsing(t)},WYMeditor.XhtmlParser.prototype.Ignore=function(t,e){return!0},WYMeditor.XhtmlParser.prototype.Text=function(t){return this._Listener.addContent(t),!0},WYMeditor.XhtmlParser.prototype.Comment=function(t,e){return this._addNonTagBlock(t,e,"addComment")},WYMeditor.XhtmlParser.prototype.Script=function(t,e){return this._addNonTagBlock(t,e,"addScript")},WYMeditor.XhtmlParser.prototype.Css=function(t,e){return this._addNonTagBlock(t,e,"addCss")},WYMeditor.XhtmlParser.prototype._addNonTagBlock=function(t,e,i){switch(e){case WYMeditor.LEXER_ENTER:this._non_tag=t;break;case WYMeditor.LEXER_UNMATCHED:this._non_tag+=t;break;case WYMeditor.LEXER_EXIT:switch(i){case"addComment":this._Listener.addComment(this._non_tag+t);break;case"addScript":this._Listener.addScript(this._non_tag+t);break;case"addCss":this._Listener.addCss(this._non_tag+t)}}return!0},WYMeditor.XhtmlParser.prototype.OpeningTag=function(t,e){switch(e){case WYMeditor.LEXER_ENTER:this._tag=this.normalizeTag(t),this._tag_attributes={};break;case WYMeditor.LEXER_SPECIAL:this._callOpenTagListener(this.normalizeTag(t));break;case WYMeditor.LEXER_EXIT:this._callOpenTagListener(this._tag,this._tag_attributes)}return!0},WYMeditor.XhtmlParser.prototype.ClosingTag=function(t,e){return this._callCloseTagListener(this.normalizeTag(t)),!0},WYMeditor.XhtmlParser.prototype._callOpenTagListener=function(t,e){var e=e||{};this.autoCloseUnclosedBeforeNewOpening(t),this._Listener.isBlockTag(t)?(this._Listener._tag_stack.push(t),this._Listener.fixNestingBeforeOpeningBlockTag(t,e),this._Listener.openBlockTag(t,e),this._increaseOpenTagCounter(t)):this._Listener.isInlineTag(t)?this._Listener.inlineTag(t,e):(this._Listener.openUnknownTag(t,e),this._increaseOpenTagCounter(t)),this._Listener.last_tag=t,this._Listener.last_tag_opened=!0,this._Listener.last_tag_attributes=e},WYMeditor.XhtmlParser.prototype._callCloseTagListener=function(t){if(this._decreaseOpenTagCounter(t))if(this.autoCloseUnclosedBeforeTagClosing(t),this._Listener.isBlockTag(t)){var e=this._Listener._tag_stack.pop();if(0==e)return;e!=t&&(t=e),this._Listener.closeBlockTag(t)}else this._Listener.closeUnknownTag(t);else this._Listener.closeUnopenedTag(t);this._Listener.last_tag=t,this._Listener.last_tag_opened=!1},WYMeditor.XhtmlParser.prototype._increaseOpenTagCounter=function(t){this._Listener._open_tags[t]=this._Listener._open_tags[t]||0,this._Listener._open_tags[t]++},WYMeditor.XhtmlParser.prototype._decreaseOpenTagCounter=function(t){return!!this._Listener._open_tags[t]&&(this._Listener._open_tags[t]--,0==this._Listener._open_tags[t]&&(this._Listener._open_tags[t]=void 0),!0)},WYMeditor.XhtmlParser.prototype.autoCloseUnclosedBeforeNewOpening=function(t){this._autoCloseUnclosed(t,!1)},WYMeditor.XhtmlParser.prototype.autoCloseUnclosedBeforeTagClosing=function(t){this._autoCloseUnclosed(t,!0)},WYMeditor.XhtmlParser.prototype._autoCloseUnclosed=function(t,e){var e=e||!1;if(this._Listener._open_tags)for(var i in this._Listener._open_tags)this._Listener._open_tags[i]>0&&this._Listener.shouldCloseTagAutomatically(i,t,e)&&this._callCloseTagListener(i,!0)},WYMeditor.XhtmlParser.prototype.getTagReplacements=function(){return this._Listener.getTagReplacements()},WYMeditor.XhtmlParser.prototype.normalizeTag=function(t){t=t.replace(/^([\s<\/>]*)|([\s<\/>]*)$/gm,"").toLowerCase();var e=this._Listener.getTagReplacements();return e[t]?e[t]:t},WYMeditor.XhtmlParser.prototype.TagAttributes=function(t,e){return WYMeditor.LEXER_SPECIAL==e&&(this._current_attribute=t),!0},WYMeditor.XhtmlParser.prototype.DoubleQuotedAttribute=function(t,e){return WYMeditor.LEXER_UNMATCHED==e&&(this._tag_attributes[this._current_attribute]=t),!0},WYMeditor.XhtmlParser.prototype.SingleQuotedAttribute=function(t,e){return WYMeditor.LEXER_UNMATCHED==e&&(this._tag_attributes[this._current_attribute]=t),!0},WYMeditor.XhtmlParser.prototype.UnquotedAttribute=function(t,e){return this._tag_attributes[this._current_attribute]=t.replace(/^=/,""),!0},WYMeditor.XhtmlSaxListener=function(){return this.output="",this.helper=new WYMeditor.XmlHelper,this._open_tags={},this.validator=WYMeditor.XhtmlValidator,this._tag_stack=[],this.avoided_tags=[],this.entities={" ":" ","¡":"¡","¢":"¢","£":"£","¤":"¤","¥":"¥","¦":"¦","§":"§","¨":"¨","©":"©","ª":"ª","«":"«","¬":"¬","­":"­","®":"®","¯":"¯","°":"°","±":"±","²":"²","³":"³","´":"´","µ":"µ","¶":"¶","·":"·","¸":"¸","¹":"¹","º":"º","»":"»","¼":"¼","½":"½","¾":"¾","¿":"¿","À":"À","Á":"Á","Â":"Â","Ã":"Ã","Ä":"Ä","Å":"Å","Æ":"Æ","Ç":"Ç","È":"È","É":"É","Ê":"Ê","Ë":"Ë","Ì":"Ì","Í":"Í","Î":"Î","Ï":"Ï","Ð":"Ð","Ñ":"Ñ","Ò":"Ò","Ó":"Ó","Ô":"Ô","Õ":"Õ","Ö":"Ö","×":"×","Ø":"Ø","Ù":"Ù","Ú":"Ú","Û":"Û","Ü":"Ü","Ý":"Ý","Þ":"Þ","ß":"ß","à":"à","á":"á","â":"â","ã":"ã","ä":"ä","å":"å","æ":"æ","ç":"ç","è":"è","é":"é","ê":"ê","ë":"ë","ì":"ì","í":"í","î":"î","ï":"ï","ð":"ð","ñ":"ñ","ò":"ò","ó":"ó","ô":"ô","õ":"õ","ö":"ö","÷":"÷","ø":"ø","ù":"ù","ú":"ú","û":"û","ü":"ü","ý":"ý","þ":"þ","ÿ":"ÿ","Œ":"Œ","œ":"œ","Š":"Š","š":"š","Ÿ":"Ÿ","ƒ":"ƒ","ˆ":"ˆ","˜":"˜","Α":"Α","Β":"Β","Γ":"Γ","Δ":"Δ","Ε":"Ε","Ζ":"Ζ","Η":"Η","Θ":"Θ","Ι":"Ι","Κ":"Κ","Λ":"Λ","Μ":"Μ","Ν":"Ν","Ξ":"Ξ","Ο":"Ο","Π":"Π","Ρ":"Ρ","Σ":"Σ","Τ":"Τ","Υ":"Υ","Φ":"Φ","Χ":"Χ","Ψ":"Ψ","Ω":"Ω","α":"α","β":"β","γ":"γ","δ":"δ","ε":"ε","ζ":"ζ","η":"η","θ":"θ","ι":"ι","κ":"κ","λ":"λ","μ":"μ","ν":"ν","ξ":"ξ","ο":"ο","π":"π","ρ":"ρ","ς":"ς","σ":"σ","τ":"τ","υ":"υ","φ":"φ","χ":"χ","ψ":"ψ","ω":"ω","ϑ":"ϑ","ϒ":"ϒ","ϖ":"ϖ"," ":" "," ":" "," ":" ","‌":"‌","‍":"‍","‎":"‎","‏":"‏","–":"–","—":"—","‘":"‘","’":"’","‚":"‚","“":"“","”":"”","„":"„","†":"†","‡":"‡","•":"•","…":"…","‰":"‰","′":"′","″":"″","‹":"‹","›":"›","‾":"‾","⁄":"⁄","€":"€","ℑ":"ℑ","℘":"℘","ℜ":"ℜ","™":"™","ℵ":"ℵ","←":"←","↑":"↑","→":"→","↓":"↓","↔":"↔","↵":"↵","⇐":"⇐","⇑":"⇑","⇒":"⇒","⇓":"⇓","⇔":"⇔","∀":"∀","∂":"∂","∃":"∃","∅":"∅","∇":"∇","∈":"∈","∉":"∉","∋":"∋","∏":"∏","∑":"∑","−":"−","∗":"∗","√":"√","∝":"∝","∞":"∞","∠":"∠","∧":"∧","∨":"∨","∩":"∩","∪":"∪","∫":"∫","∴":"∴","∼":"∼","≅":"≅","≈":"≈","≠":"≠","≡":"≡","≤":"≤","≥":"≥","⊂":"⊂","⊃":"⊃","⊄":"⊄","⊆":"⊆","⊇":"⊇","⊕":"⊕","⊗":"⊗","⊥":"⊥","⋅":"⋅","⌈":"⌈","⌉":"⌉","⌊":"⌊","⌋":"⌋","⟨":"〈","⟩":"〉","◊":"◊","♠":"♠","♣":"♣","♥":"♥","♦":"♦"},this.block_tags=["a","abbr","acronym","address","area","b","base","bdo","big","blockquote","body","button","caption","cite","code","col","colgroup","dd","del","div","dfn","dl","dt","em","fieldset","form","head","h1","h2","h3","h4","h5","h6","html","i","ins","kbd","label","legend","li","map","noscript","object","ol","optgroup","option","p","param","pre","q","samp","script","select","small","span","strong","style","sub","sup","table","tbody","td","textarea","tfoot","th","thead","title","tr","tt","ul","var","extends"],this.inline_tags=["br","hr","img","input"],this},WYMeditor.XhtmlSaxListener.prototype.shouldCloseTagAutomatically=function(t,e,i){var i=i||!1;return!("td"!=t||!(i&&"tr"==e||!i&&"td"==e))||!("option"!=t||!(i&&"select"==e||!i&&"option"==e))},WYMeditor.XhtmlSaxListener.prototype.beforeParsing=function(t){return this.output="",t},WYMeditor.XhtmlSaxListener.prototype.afterParsing=function(t){return t=this.replaceNamedEntities(t),t=this.joinRepeatedEntities(t),t=this.removeEmptyTags(t),t=this.removeBrInPre(t)},WYMeditor.XhtmlSaxListener.prototype.replaceNamedEntities=function(t){for(var e in this.entities)t=t.replace(new RegExp(e,"g"),this.entities[e]);return t},WYMeditor.XhtmlSaxListener.prototype.joinRepeatedEntities=function(t){var e="em|strong|sub|sup|acronym|pre|del|address";return t.replace(new RegExp("</("+e+")><\\1>",""),"").replace(new RegExp("(s*<("+e+")>s*){2}(.*)(s*</\\2>s*){2}",""),"<$2>$3<$2>")},WYMeditor.XhtmlSaxListener.prototype.removeEmptyTags=function(t){return t.replace(new RegExp("<("+this.block_tags.join("|").replace(/\|td/,"").replace(/\|p/,"").replace(/\|th/,"")+")>(<br />| | |\\s)*</\\1>","g"),"")},WYMeditor.XhtmlSaxListener.prototype.removeBrInPre=function(t){var e=t.match(new RegExp("<pre[^>]*>(.*?)</pre>","gmi"));if(e)for(var i=0;i<e.length;i++)t=t.replace(e[i],e[i].replace(new RegExp("<br />","g"),String.fromCharCode(13,10)));return t},WYMeditor.XhtmlSaxListener.prototype.getResult=function(){return this.output},WYMeditor.XhtmlSaxListener.prototype.getTagReplacements=function(){return{b:"strong",i:"em"}},WYMeditor.XhtmlSaxListener.prototype.addContent=function(t){this.output+=t},WYMeditor.XhtmlSaxListener.prototype.addComment=function(t){this.remove_comments&&(this.output+=t)},WYMeditor.XhtmlSaxListener.prototype.addScript=function(t){this.remove_scripts||(this.output+=t)},WYMeditor.XhtmlSaxListener.prototype.addCss=function(t){this.remove_embeded_styles||(this.output+=t)},WYMeditor.XhtmlSaxListener.prototype.openBlockTag=function(t,e){this.output+=this.helper.tag(t,this.validator.getValidTagAttributes(t,e),!0)},WYMeditor.XhtmlSaxListener.prototype.inlineTag=function(t,e){this.output+=this.helper.tag(t,this.validator.getValidTagAttributes(t,e))},WYMeditor.XhtmlSaxListener.prototype.openUnknownTag=function(t,e){},WYMeditor.XhtmlSaxListener.prototype.closeBlockTag=function(t){this.output=this.output.replace(/<br \/>$/,"")+this._getClosingTagContent("before",t)+"</"+t+">"+this._getClosingTagContent("after",t)},WYMeditor.XhtmlSaxListener.prototype.closeUnknownTag=function(t){},WYMeditor.XhtmlSaxListener.prototype.closeUnopenedTag=function(t){this.output+="</"+t+">"},WYMeditor.XhtmlSaxListener.prototype.avoidStylingTagsAndAttributes=function(){this.avoided_tags=["div","span"],this.validator.skiped_attributes=["style"],this.validator.skiped_attribute_values=["MsoNormal","main1"],this._avoiding_tags_implicitly=!0},WYMeditor.XhtmlSaxListener.prototype.allowStylingTagsAndAttributes=function(){this.avoided_tags=[],this.validator.skiped_attributes=[],this.validator.skiped_attribute_values=[],this._avoiding_tags_implicitly=!1},WYMeditor.XhtmlSaxListener.prototype.isBlockTag=function(t){return!WYMeditor.Helper.contains(this.avoided_tags,t)&&WYMeditor.Helper.contains(this.block_tags,t)},WYMeditor.XhtmlSaxListener.prototype.isInlineTag=function(t){return!WYMeditor.Helper.contains(this.avoided_tags,t)&&WYMeditor.Helper.contains(this.inline_tags,t)},WYMeditor.XhtmlSaxListener.prototype.insertContentAfterClosingTag=function(t,e){this._insertContentWhenClosingTag("after",t,e)},WYMeditor.XhtmlSaxListener.prototype.insertContentBeforeClosingTag=function(t,e){this._insertContentWhenClosingTag("before",t,e)},WYMeditor.XhtmlSaxListener.prototype.fixNestingBeforeOpeningBlockTag=function(t,e){"li"==t||"ul"!=t&&"ol"!=t||!this.last_tag||this.last_tag_opened||"li"!=this.last_tag||(this.output=this.output.replace(/<\/li>$/,""),this.insertContentAfterClosingTag(t,"</li>"))},WYMeditor.XhtmlSaxListener.prototype._insertContentWhenClosingTag=function(t,e,i){this["_insert_"+t+"_closing"]||(this["_insert_"+t+"_closing"]=[]),this["_insert_"+t+"_closing"][e]||(this["_insert_"+t+"_closing"][e]=[]),this["_insert_"+t+"_closing"][e].push(i)},WYMeditor.XhtmlSaxListener.prototype._getClosingTagContent=function(t,e){return this["_insert_"+t+"_closing"]&&this["_insert_"+t+"_closing"][e]&&this["_insert_"+t+"_closing"][e].length>0?this["_insert_"+t+"_closing"][e].pop():""},WYMeditor.WymCssLexer=function(t,e){var e=void 0===e||e;return jQuery.extend(this,new WYMeditor.Lexer(t,e?"Ignore":"WymCss")),this.mapHandler("WymCss","Ignore"),1==e&&(this.addEntryPattern("/\\*[<\\s]*WYMeditor[>\\s]*\\*/","Ignore","WymCss"),this.addExitPattern("/\\*[</\\s]*WYMeditor[>\\s]*\\*/","WymCss")),this.addSpecialPattern("[\\sa-z1-6]*\\.[a-z-_0-9]+","WymCss","WymCssStyleDeclaration"),this.addEntryPattern("/\\*","WymCss","WymCssComment"),this.addExitPattern("\\*/","WymCssComment"),this.addEntryPattern("{","WymCss","WymCssStyle"),this.addExitPattern("}","WymCssStyle"),this.addEntryPattern("/\\*","WymCssStyle","WymCssFeedbackStyle"),this.addExitPattern("\\*/","WymCssFeedbackStyle"),this},WYMeditor.WymCssParser=function(){return this._in_style=!1,this._has_title=!1,this.only_wym_blocks=!0,this.css_settings={classesItems:[],editorStyles:[],dialogStyles:[]},this},WYMeditor.WymCssParser.prototype.parse=function(t,e){var e=void 0===e?this.only_wym_blocks:e;this._Lexer=new WYMeditor.WymCssLexer(this,e),this._Lexer.parse(t)},WYMeditor.WymCssParser.prototype.Ignore=function(t,e){return!0},WYMeditor.WymCssParser.prototype.WymCssComment=function(t,e){return!t.match(/end[a-z0-9\s]*wym[a-z0-9\s]*/im)&&(e==WYMeditor.LEXER_UNMATCHED&&(this._in_style?this._current_item[this._current_element]&&(this._current_item[this._current_element].expressions?this._current_item[this._current_element].expressions.push(t):this._current_item[this._current_element].expressions=[t]):(this._has_title=!0,this._current_item={title:WYMeditor.Helper.trim(t)}),this._in_style=!0),!0)},WYMeditor.WymCssParser.prototype.WymCssStyle=function(t,e){return e==WYMeditor.LEXER_UNMATCHED?""!=(t=WYMeditor.Helper.trim(t))&&(this._current_item[this._current_element].style=t):e==WYMeditor.LEXER_EXIT&&(this._in_style=!1,this._has_title=!1,this.addStyleSetting(this._current_item)),!0},WYMeditor.WymCssParser.prototype.WymCssFeedbackStyle=function(t,e){return e==WYMeditor.LEXER_UNMATCHED&&(this._current_item[this._current_element].feedback_style=t.replace(/^([\s\/\*]*)|([\s\/\*]*)$/gm,"")),!0},WYMeditor.WymCssParser.prototype.WymCssStyleDeclaration=function(t){i="";if((t=t.replace(/^([\s\.]*)|([\s\.*]*)$/gm,"")).indexOf(".")>0){var e=t.split(".");this._current_element=e[1];var i=e[0]}else this._current_element=t;return this._has_title||(this._current_item={title:(i?i.toUpperCase()+": ":"")+this._current_element},this._has_title=!0),this._current_item[this._current_element]||(this._current_item[this._current_element]={name:this._current_element}),i&&(this._current_item[this._current_element].tags?this._current_item[this._current_element].tags.push(i):this._current_item[this._current_element].tags=[i]),!0},WYMeditor.WymCssParser.prototype.addStyleSetting=function(t){for(var e in t){var i=t[e];"object"==typeof i&&"title"!=e&&(this.css_settings.classesItems.push({name:WYMeditor.Helper.trim(i.name),title:t.title,expr:WYMeditor.Helper.trim((i.expressions||i.tags).join(", "))}),i.feedback_style&&this.css_settings.editorStyles.push({name:"."+WYMeditor.Helper.trim(i.name),css:i.feedback_style}),i.style&&this.css_settings.dialogStyles.push({name:"."+WYMeditor.Helper.trim(i.name),css:i.style}))}},jQuery.fn.isPhantomNode=function(){return 3==this[0].nodeType&&!/[^\t\n\r ]/.test(this[0].data)},WYMeditor.isPhantomNode=function(t){return 3==t.nodeType&&!/[^\t\n\r ]/.test(t.data)},WYMeditor.isPhantomString=function(t){return!/[^\t\n\r ]/.test(t)},jQuery.fn.parentsOrSelf=function(t){var e=this;return 3==e[0].nodeType&&(e=e.parents().slice(0,1)),1==e.filter(t).size()?e:e.parents(t).slice(0,1)},WYMeditor.Helper={replaceAll:function(t,e,i){var s=new RegExp(e,"g");return t.replace(s,i)},insertAt:function(t,e,i){return t.substr(0,i)+e+t.substring(i)},trim:function(t){return t.replace(/^(\s*)|(\s*)$/gm,"")},contains:function(t,e){for(var i=0;i<t.length;i++)if(t[i]===e)return!0;return!1},indexOf:function(t,e){for(var i=-1,s=0;s<t.length;s++)if(t[s]==e){i=s;break}return i},findByName:function(t,e){for(var i=0;i<t.length;i++){var s=t[i];if(s.name==e)return s}return null}},WYMeditor.WymClassExplorer=function(t){this._wym=t,this._class="className",this._newLine="\r\n"},WYMeditor.WymClassExplorer.prototype.initIframe=function(iframe){this._iframe=iframe,this._doc=iframe.contentWindow.document;var styles=this._doc.styleSheets[0],aCss=eval(this._options.editorStyles);this.addCssRules(this._doc,aCss),this._doc.title=this._wym._index,jQuery("html",this._doc).attr("dir",this._options.direction),jQuery(this._doc.body).html(this._wym._html);var wym=this;this._doc.body.onfocus=function(){wym._doc.designMode="on",wym._doc=iframe.contentWindow.document},this._doc.onbeforedeactivate=function(){wym.saveCaret()},this._doc.onkeyup=function(){wym.saveCaret(),wym.keyup()},this._doc.onclick=function(){wym.saveCaret()},this._doc.body.onbeforepaste=function(){wym._iframe.contentWindow.event.returnValue=!1},this._doc.body.onpaste=function(){wym._iframe.contentWindow.event.returnValue=!1,wym.paste(window.clipboardData.getData("Text"))},this._initialized&&(jQuery.isFunction(this._options.preBind)&&this._options.preBind(this),this._wym.bindEvents(),jQuery.isFunction(this._options.postInit)&&this._options.postInit(this),this.listen()),this._initialized=!0,this._doc.designMode="on";try{this._doc=iframe.contentWindow.document}catch(t){}},WYMeditor.WymClassExplorer.prototype._exec=function(t,e){switch(t){case WYMeditor.INDENT:case WYMeditor.OUTDENT:var i=this.findUp(this.container(),WYMeditor.LI);if(i){var s=i.parentNode.parentNode;(i.parentNode.childNodes.length>1||s.tagName.toLowerCase()==WYMeditor.OL||s.tagName.toLowerCase()==WYMeditor.UL)&&this._doc.execCommand(t)}break;default:e?this._doc.execCommand(t,!1,e):this._doc.execCommand(t)}this.listen()},WYMeditor.WymClassExplorer.prototype.selected=function(){var t=this._iframe.contentWindow.document.caretPos;if(null!=t&&void 0!=t.parentElement)return t.parentElement()},WYMeditor.WymClassExplorer.prototype.saveCaret=function(){this._doc.caretPos=this._doc.selection.createRange()},WYMeditor.WymClassExplorer.prototype.addCssRule=function(t,e){t.addRule(e.name,e.css)},WYMeditor.WymClassExplorer.prototype.insert=function(t){var e=this._doc.selection.createRange();if(jQuery(e.parentElement()).parents(this._options.iframeBodySelector).is("*"))try{e.pasteHTML(t)}catch(t){}else this.paste(t)},WYMeditor.WymClassExplorer.prototype.wrap=function(t,e){var i=this._doc.selection.createRange();if(jQuery(i.parentElement()).parents(this._options.iframeBodySelector).is("*"))try{i.pasteHTML(t+i.text+e)}catch(t){}},WYMeditor.WymClassExplorer.prototype.unwrap=function(){var t=this._doc.selection.createRange();if(jQuery(t.parentElement()).parents(this._options.iframeBodySelector).is("*"))try{var e=t.text;this._exec("Cut"),t.pasteHTML(e)}catch(t){}},WYMeditor.WymClassExplorer.prototype.keyup=function(){this._selected_image=null},WYMeditor.WymClassExplorer.prototype.setFocusToNode=function(t){var e=this._doc.selection.createRange();e.moveToElementText(t),e.collapse(!1),e.move("character",-1),e.select(),t.focus()},WYMeditor.WymClassMozilla=function(t){this._wym=t,this._class="class",this._newLine="\n"},WYMeditor.WymClassMozilla.prototype.initIframe=function(iframe){this._iframe=iframe,this._doc=iframe.contentDocument;var styles=this._doc.styleSheets[0],aCss=eval(this._options.editorStyles);this.addCssRules(this._doc,aCss),this._doc.title=this._wym._index,jQuery("html",this._doc).attr("dir",this._options.direction),this.html(this._wym._html),this.enableDesignMode(),jQuery.isFunction(this._options.preBind)&&this._options.preBind(this),this._wym.bindEvents(),jQuery(this._doc).bind("keydown",this.keydown),jQuery(this._doc).bind("keyup",this.keyup),jQuery(this._doc).bind("focus",this.enableDesignMode),jQuery.isFunction(this._options.postInit)&&this._options.postInit(this),this.listen()},WYMeditor.WymClassMozilla.prototype.html=function(t){if("string"!=typeof t)return jQuery(this._doc.body).html();try{this._doc.designMode="off"}catch(t){}t=t.replace(/<em(\b[^>]*)>/gi,"<i$1>").replace(/<\/em>/gi,"</i>").replace(/<strong(\b[^>]*)>/gi,"<b$1>").replace(/<\/strong>/gi,"</b>"),jQuery(this._doc.body).html(t),this.enableDesignMode()},WYMeditor.WymClassMozilla.prototype._exec=function(t,e){if(!this.selected())return!1;switch(t){case WYMeditor.INDENT:case WYMeditor.OUTDENT:var i=this.selected(),s=this._iframe.contentWindow.getSelection().anchorNode;if("#text"==s.nodeName&&(s=s.parentNode),i=this.findUp(i,WYMeditor.BLOCKS),s=this.findUp(s,WYMeditor.BLOCKS),i&&i==s&&i.tagName.toLowerCase()==WYMeditor.LI){var o=i.parentNode.parentNode;(i.parentNode.childNodes.length>1||o.tagName.toLowerCase()==WYMeditor.OL||o.tagName.toLowerCase()==WYMeditor.UL)&&this._doc.execCommand(t,"",null)}break;default:e?this._doc.execCommand(t,"",e):this._doc.execCommand(t,"",null)}this.selected().tagName.toLowerCase()==WYMeditor.BODY&&this._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P),this.listen()},WYMeditor.WymClassMozilla.prototype.selected=function(){var t=this._iframe.contentWindow.getSelection().focusNode;return t?"#text"==t.nodeName?t.parentNode:t:null},WYMeditor.WymClassMozilla.prototype.addCssRule=function(t,e){t.insertRule(e.name+" {"+e.css+"}",t.cssRules.length)},WYMeditor.WymClassMozilla.prototype.keydown=function(t){var e=WYMeditor.INSTANCES[this.title],i=null;if(t.keyCode===WYMeditor.KEY.ENTER&&(i=e.selected())){var s=$(i),o=(s.parent(),s.parents(".embedded-item"));if(o.size()){var r=$("<p/>");return s.hasClass("title")?o.before(r):s.hasClass("content")&&o.after(r),e.setFocusToNode(r.get(0)),!1}}if(t.ctrlKey){if(66==t.keyCode)return e._exec(WYMeditor.BOLD),!1;if(73==t.keyCode)return e._exec(WYMeditor.ITALIC),!1}else 13==t.keyCode&&(t.shiftKey||(i=e.selected())&&i.tagName.toLowerCase()==WYMeditor.PRE&&(t.preventDefault(),e.insert("<p></p>")))},WYMeditor.WymClassMozilla.prototype.keyup=function(t){var e=WYMeditor.INSTANCES[this.title];e._selected_image=null;var i=null;if(13!=t.keyCode||t.shiftKey){if(8!=t.keyCode&&17!=t.keyCode&&46!=t.keyCode&&224!=t.keyCode&&!t.metaKey&&!t.ctrlKey){var s=(i=e.selected()).tagName.toLowerCase();"strong"!=s&&"b"!=s&&"em"!=s&&"i"!=s&&"sub"!=s&&"sup"!=s&&"a"!=s||(s=i.parentNode.tagName.toLowerCase()),s==WYMeditor.BODY&&e._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P)}}else jQuery(e._doc.body).children(WYMeditor.BR).remove()},WYMeditor.WymClassMozilla.prototype.enableDesignMode=function(){if("off"==this.designMode)try{this.designMode="on",this.execCommand("styleWithCSS","",!1)}catch(t){}},WYMeditor.WymClassMozilla.prototype.setFocusToNode=function(t){var e=document.createRange();e.selectNode(t);var i=this._iframe.contentWindow.getSelection();i.addRange(e),i.collapse(t,t.childNodes.length),this._iframe.contentWindow.focus()},WYMeditor.WymClassMozilla.prototype.openBlockTag=function(t,e){var e=this.validator.getValidTagAttributes(t,e);if("span"==t&&e.style){var i=this.getTagForStyle(e.style);if(!i)return;this._tag_stack.pop();var t=i;this._tag_stack.push(i),e.style=""}this.output+=this.helper.tag(t,e,!0)},WYMeditor.WymClassMozilla.prototype.getTagForStyle=function(t){return/bold/.test(t)?"strong":/italic/.test(t)?"em":/sub/.test(t)?"sub":!!/sub/.test(t)&&"super"},WYMeditor.WymClassOpera=function(t){this._wym=t,this._class="class",this._newLine="\r\n"},WYMeditor.WymClassOpera.prototype.initIframe=function(iframe){this._iframe=iframe,this._doc=iframe.contentWindow.document;var styles=this._doc.styleSheets[0],aCss=eval(this._options.editorStyles);this.addCssRules(this._doc,aCss),this._doc.title=this._wym._index,jQuery("html",this._doc).attr("dir",this._options.direction),this._doc.designMode="on",this.html(this._wym._html),jQuery.isFunction(this._options.preBind)&&this._options.preBind(this),this._wym.bindEvents(),jQuery(this._doc).bind("keydown",this.keydown),jQuery(this._doc).bind("keyup",this.keyup),jQuery.isFunction(this._options.postInit)&&this._options.postInit(this),this.listen()},WYMeditor.WymClassOpera.prototype._exec=function(t,e){e?this._doc.execCommand(t,!1,e):this._doc.execCommand(t),this.listen()},WYMeditor.WymClassOpera.prototype.selected=function(){var t=this._iframe.contentWindow.getSelection().focusNode;return t?"#text"==t.nodeName?t.parentNode:t:null},WYMeditor.WymClassOpera.prototype.addCssRule=function(t,e){t.insertRule(e.name+" {"+e.css+"}",t.cssRules.length)},WYMeditor.WymClassOpera.prototype.keydown=function(t){var e=WYMeditor.INSTANCES[this.title],i=e._iframe.contentWindow.getSelection();startNode=i.getRangeAt(0).startContainer,jQuery(startNode).parentsOrSelf(WYMeditor.MAIN_CONTAINERS.join(","))[0]||jQuery(startNode).parentsOrSelf("li")||t.keyCode==WYMeditor.KEY.ENTER||t.keyCode==WYMeditor.KEY.LEFT||t.keyCode==WYMeditor.KEY.UP||t.keyCode==WYMeditor.KEY.RIGHT||t.keyCode==WYMeditor.KEY.DOWN||t.keyCode==WYMeditor.KEY.BACKSPACE||t.keyCode==WYMeditor.KEY.DELETE||e._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P)},WYMeditor.WymClassOpera.prototype.keyup=function(t){WYMeditor.INSTANCES[this.title]._selected_image=null},WYMeditor.WymClassOpera.prototype.setFocusToNode=function(t){},WYMeditor.WymClassSafari=function(t){this._wym=t,this._class="class",this._newLine="\n"},WYMeditor.WymClassSafari.prototype.initIframe=function(iframe){this._iframe=iframe,this._doc=iframe.contentDocument;var styles=this._doc.styleSheets[0],aCss=eval(this._options.editorStyles);this.addCssRules(this._doc,aCss),this._doc.title=this._wym._index,jQuery("html",this._doc).attr("dir",this._options.direction),this._doc.designMode="on",this.html(this._wym._html),jQuery.isFunction(this._options.preBind)&&this._options.preBind(this),this._wym.bindEvents(),jQuery(this._doc).bind("keydown",this.keydown),jQuery(this._doc).bind("keyup",this.keyup),jQuery.isFunction(this._options.postInit)&&this._options.postInit(this),this.listen()},WYMeditor.WymClassSafari.prototype._exec=function(t,e){if(!this.selected())return!1;switch(t){case WYMeditor.INDENT:case WYMeditor.OUTDENT:var i=this.selected(),s=this._iframe.contentWindow.getSelection().anchorNode;if("#text"==s.nodeName&&(s=s.parentNode),i=this.findUp(i,WYMeditor.BLOCKS),s=this.findUp(s,WYMeditor.BLOCKS),i&&i==s&&i.tagName.toLowerCase()==WYMeditor.LI){var o=i.parentNode.parentNode;(i.parentNode.childNodes.length>1||o.tagName.toLowerCase()==WYMeditor.OL||o.tagName.toLowerCase()==WYMeditor.UL)&&this._doc.execCommand(t,"",null)}break;case WYMeditor.INSERT_ORDEREDLIST:case WYMeditor.INSERT_UNORDEREDLIST:this._doc.execCommand(t,"",null);i=this.selected();(r=this.findUp(i,WYMeditor.MAIN_CONTAINERS))&&jQuery(r).replaceWith(jQuery(r).html());break;default:e?this._doc.execCommand(t,"",e):this._doc.execCommand(t,"",null)}var r=this.selected();r&&r.tagName.toLowerCase()==WYMeditor.BODY&&this._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P),this.listen()},WYMeditor.WymClassSafari.prototype.selected=function(){var t=this._iframe.contentWindow.getSelection().focusNode;return t?"#text"==t.nodeName?t.parentNode:t:null},WYMeditor.WymClassSafari.prototype.addCssRule=function(t,e){t.insertRule(e.name+" {"+e.css+"}",t.cssRules.length)},WYMeditor.WymClassSafari.prototype.keydown=function(t){var e=WYMeditor.INSTANCES[this.title];if(t.keyCode===WYMeditor.KEY.ENTER){var i=e.selected();if(i){var s=$(i),o=(s.parent(),s.parents(".embedded-item"));if(o.size()){var r=$("<p/>");return s.hasClass("title")?o.before(r):s.hasClass("content")&&o.after(r),e.setFocusToNode(r.get(0)),!1}}}if(t.ctrlKey){if(66==t.keyCode)return e._exec(WYMeditor.BOLD),!1;if(73==t.keyCode)return e._exec(WYMeditor.ITALIC),!1}},WYMeditor.WymClassSafari.prototype.keyup=function(t){var e=WYMeditor.INSTANCES[this.title];e._selected_image=null;var i=null;if(13!=t.keyCode||t.shiftKey||(jQuery(e._doc.body).children(WYMeditor.BR).remove(),(i=e.selected())&&i.tagName.toLowerCase()==WYMeditor.PRE&&e._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P)),13==t.keyCode&&t.shiftKey&&e._exec("InsertLineBreak"),8!=t.keyCode&&17!=t.keyCode&&46!=t.keyCode&&224!=t.keyCode&&!t.metaKey&&!t.ctrlKey){var s=(i=e.selected()).tagName.toLowerCase();"strong"!=s&&"b"!=s&&"em"!=s&&"i"!=s&&"sub"!=s&&"sup"!=s&&"a"!=s&&"span"!=s||(s=i.parentNode.tagName.toLowerCase()),s!=WYMeditor.BODY&&s!=WYMeditor.DIV||e._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P)}},WYMeditor.WymClassSafari.prototype.setFocusToNode=function(t){var e=this._iframe.contentDocument.createRange();e.selectNode(t);var i=this._iframe.contentWindow.getSelection();i.addRange(e),i.collapse(t,t.childNodes.length),this._iframe.contentWindow.focus()},WYMeditor.WymClassSafari.prototype.openBlockTag=function(t,e){var e=this.validator.getValidTagAttributes(t,e);if("span"==t&&e.style){var i=this.getTagForStyle(e.style);if(!i)return;this._tag_stack.pop();var t=i;this._tag_stack.push(i),e.style="","string"==typeof e.class&&(e.class=e.class.replace(/apple-style-span/gi,""))}this.output+=this.helper.tag(t,e,!0)},WYMeditor.WymClassSafari.prototype.getTagForStyle=function(t){return/bold/.test(t)?"strong":/italic/.test(t)?"em":/sub/.test(t)?"sub":!!/super/.test(t)&&"sup"},window.WYMeditor=WYMeditor; |