23 lines
98 KiB
JavaScript
23 lines
98 KiB
JavaScript
|
/*
|
||
|
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
|
||
|
Code licensed under the BSD License:
|
||
|
http://developer.yahoo.net/yui/license.txt
|
||
|
version: 2.6.0
|
||
|
*/
|
||
|
(function(){var B=YAHOO.util.Dom,A=YAHOO.util.Event,C=YAHOO.lang;if(YAHOO.widget.Button){YAHOO.widget.ToolbarButtonAdvanced=YAHOO.widget.Button;YAHOO.widget.ToolbarButtonAdvanced.prototype.buttonType="rich";YAHOO.widget.ToolbarButtonAdvanced.prototype.checkValue=function(F){var E=this.getMenu().getItems();if(E.length===0){this.getMenu()._onBeforeShow();E=this.getMenu().getItems();}for(var D=0;D<E.length;D++){E[D].cfg.setProperty("checked",false);if(E[D].value==F){E[D].cfg.setProperty("checked",true);}}};}else{YAHOO.widget.ToolbarButtonAdvanced=function(){};}YAHOO.widget.ToolbarButton=function(E,D){if(C.isObject(arguments[0])&&!B.get(E).nodeType){D=E;}var G=(D||{});var F={element:null,attributes:G};if(!F.attributes.type){F.attributes.type="push";}F.element=document.createElement("span");F.element.setAttribute("unselectable","on");F.element.className="yui-button yui-"+F.attributes.type+"-button";F.element.innerHTML='<span class="first-child"><a href="#">LABEL</a></span>';F.element.firstChild.firstChild.tabIndex="-1";F.attributes.id=B.generateId();YAHOO.widget.ToolbarButton.superclass.constructor.call(this,F.element,F.attributes);};YAHOO.extend(YAHOO.widget.ToolbarButton,YAHOO.util.Element,{buttonType:"normal",_handleMouseOver:function(){if(!this.get("disabled")){this.addClass("yui-button-hover");this.addClass("yui-"+this.get("type")+"-button-hover");}},_handleMouseOut:function(){this.removeClass("yui-button-hover");this.removeClass("yui-"+this.get("type")+"-button-hover");},checkValue:function(F){if(this.get("type")=="menu"){var E=this._button.options;for(var D=0;D<E.length;D++){if(E[D].value==F){E.selectedIndex=D;}}}},init:function(E,D){YAHOO.widget.ToolbarButton.superclass.init.call(this,E,D);this.on("mouseover",this._handleMouseOver,this,true);this.on("mouseout",this._handleMouseOut,this,true);},initAttributes:function(D){YAHOO.widget.ToolbarButton.superclass.initAttributes.call(this,D);this.setAttributeConfig("value",{value:D.value});this.setAttributeConfig("menu",{value:D.menu||false});this.setAttributeConfig("type",{value:D.type,writeOnce:true,method:function(H){var G,F;if(!this._button){this._button=this.get("element").getElementsByTagName("a")[0];}switch(H){case"select":case"menu":G=document.createElement("select");var I=this.get("menu");for(var E=0;E<I.length;E++){F=document.createElement("option");F.innerHTML=I[E].text;F.value=I[E].value;if(I[E].checked){F.selected=true;}G.appendChild(F);}this._button.parentNode.replaceChild(G,this._button);A.on(G,"change",this._handleSelect,this,true);this._button=G;break;}}});this.setAttributeConfig("disabled",{value:D.disabled||false,method:function(E){if(E){this.addClass("yui-button-disabled");this.addClass("yui-"+this.get("type")+"-button-disabled");}else{this.removeClass("yui-button-disabled");this.removeClass("yui-"+this.get("type")+"-button-disabled");}if(this.get("type")=="menu"){this._button.disabled=E;}}});this.setAttributeConfig("label",{value:D.label,method:function(E){if(!this._button){this._button=this.get("element").getElementsByTagName("a")[0];}if(this.get("type")=="push"){this._button.innerHTML=E;}}});this.setAttributeConfig("title",{value:D.title});this.setAttributeConfig("container",{value:null,writeOnce:true,method:function(E){this.appendTo(E);}});},_handleSelect:function(E){var D=A.getTarget(E);var F=D.options[D.selectedIndex].value;this.fireEvent("change",{type:"change",value:F});},getMenu:function(){return this.get("menu");},destroy:function(){A.purgeElement(this.get("element"),true);this.get("element").parentNode.removeChild(this.get("element"));for(var D in this){if(C.hasOwnProperty(this,D)){this[D]=null;}}},fireEvent:function(E,D){if(this.DOM_EVENTS[E]&&this.get("disabled")){return ;}YAHOO.widget.ToolbarButton.superclass.fireEvent.call(this,E,D);},toString:function(){return"ToolbarButton ("+this.get("id")+")";}});})();(function(){var C=YAHOO.util.Dom,A=YAHOO.util.Event,D=YAHOO.lang;var B=function(F){var E=F;if(D.isString(F)){E=this.getButtonById(F);}if(D.isNumber(F)){E=this.getButtonByIndex(F);}if((!(E instanceof YAHOO.widget.ToolbarButton))&&(!(E inst
|
||
|
},initAttributes:function(E){YAHOO.widget.Toolbar.superclass.initAttributes.call(this,E);this.addClass(this.CLASS_CONTAINER);this.setAttributeConfig("buttonType",{value:E.buttonType||"basic",writeOnce:true,validator:function(F){switch(F){case"advanced":case"basic":return true;}return false;},method:function(F){if(F=="advanced"){if(YAHOO.widget.Button){this.buttonType=YAHOO.widget.ToolbarButtonAdvanced;}else{this.buttonType=YAHOO.widget.ToolbarButton;}}else{this.buttonType=YAHOO.widget.ToolbarButton;}}});this.setAttributeConfig("buttons",{value:[],writeOnce:true,method:function(G){for(var F in G){if(D.hasOwnProperty(G,F)){if(G[F].type=="separator"){this.addSeparator();}else{if(G[F].group!==undefined){this.addButtonGroup(G[F]);}else{this.addButton(G[F]);}}}}}});this.setAttributeConfig("disabled",{value:false,method:function(F){if(this.get("disabled")===F){return false;}if(F){this.addClass(this.CLASS_DISABLED);this.set("draggable",false);this.disableAllButtons();}else{this.removeClass(this.CLASS_DISABLED);if(this._configs.draggable._initialConfig.value){this.set("draggable",true);}this.resetAllButtons();}}});this.setAttributeConfig("cont",{value:E.cont,readOnly:true});this.setAttributeConfig("grouplabels",{value:((E.grouplabels===false)?false:true),method:function(F){if(F){C.removeClass(this.get("cont"),(this.CLASS_PREFIX+"-nogrouplabels"));}else{C.addClass(this.get("cont"),(this.CLASS_PREFIX+"-nogrouplabels"));}}});this.setAttributeConfig("titlebar",{value:false,method:function(G){if(G){if(this._titlebar&&this._titlebar.parentNode){this._titlebar.parentNode.removeChild(this._titlebar);}this._titlebar=document.createElement("DIV");this._titlebar.tabIndex="-1";A.on(this._titlebar,"focus",function(){this._handleFocus();},this,true);C.addClass(this._titlebar,this.CLASS_PREFIX+"-titlebar");if(D.isString(G)){var F=document.createElement("h2");F.tabIndex="-1";F.innerHTML='<a href="#" tabIndex="0">'+G+"</a>";this._titlebar.appendChild(F);A.on(F.firstChild,"click",function(H){A.stopEvent(H);});A.on([F,F.firstChild],"focus",function(){this._handleFocus();},this,true);}if(this.get("firstChild")){this.insertBefore(this._titlebar,this.get("firstChild"));}else{this.appendChild(this._titlebar);}if(this.get("collapse")){this.set("collapse",true);}}else{if(this._titlebar){if(this._titlebar&&this._titlebar.parentNode){this._titlebar.parentNode.removeChild(this._titlebar);}}}}});this.setAttributeConfig("collapse",{value:false,method:function(H){if(this._titlebar){var G=null;var F=C.getElementsByClassName("collapse","span",this._titlebar);if(H){if(F.length>0){return true;}G=document.createElement("SPAN");G.innerHTML="X";G.title=this.STR_COLLAPSE;C.addClass(G,"collapse");this._titlebar.appendChild(G);A.addListener(G,"click",function(){if(C.hasClass(this.get("cont").parentNode,"yui-toolbar-container-collapsed")){this.collapse(false);}else{this.collapse();}},this,true);}else{G=C.getElementsByClassName("collapse","span",this._titlebar);if(G[0]){if(C.hasClass(this.get("cont").parentNode,"yui-toolbar-container-collapsed")){this.collapse(false);}G[0].parentNode.removeChild(G[0]);}}}}});this.setAttributeConfig("draggable",{value:(E.draggable||false),method:function(F){if(F&&!this.get("titlebar")){if(!this._dragHandle){this._dragHandle=document.createElement("SPAN");this._dragHandle.innerHTML="|";this._dragHandle.setAttribute("title","Click to drag the toolbar");this._dragHandle.id=this.get("id")+"_draghandle";C.addClass(this._dragHandle,this.CLASS_DRAGHANDLE);if(this.get("cont").hasChildNodes()){this.get("cont").insertBefore(this._dragHandle,this.get("cont").firstChild);}else{this.get("cont").appendChild(this._dragHandle);}this.dd=new YAHOO.util.DD(this.get("id"));this.dd.setHandleElId(this._dragHandle.id);}}else{if(this._dragHandle){this._dragHandle.parentNode.removeChild(this._dragHandle);this._dragHandle=null;this.dd=null;}}if(this._titlebar){if(F){this.dd=new YAHOO.util.DD(this.get("id"));this.dd.setHandleElId(this._titlebar);C.addClass(this._titlebar,"draggable");}else{C.removeClass(this._titlebar,"draggable");if(this.dd){this.dd.unreg();this.d
|
||
|
}if(Q.type=="color"){if(YAHOO.widget.Overlay){Q=this._makeColorButton(Q);}else{N=true;}}if(Q.menu){if((YAHOO.widget.Overlay)&&(J.menu instanceof YAHOO.widget.Overlay)){J.menu.showEvent.subscribe(function(){this._button=Q;});}else{for(var O=0;O<Q.menu.length;O++){if(!Q.menu[O].value){Q.menu[O].value=Q.menu[O].text;}}if(this.browser.webkit){Q.focusmenu=false;}}}if(N){J=false;}else{this._configs.buttons.value[this._configs.buttons.value.length]=J;var T=new this.buttonType(Q);T.get("element").tabIndex="-1";T.get("element").setAttribute("role","button");T._selected=true;if(this.get("disabled")){T.set("disabled",true);}if(!J.id){J.id=T.get("id");}if(I){var F=T.get("element");var M=null;if(I.get){M=I.get("element").nextSibling;}else{if(I.nextSibling){M=I.nextSibling;}}if(M){M.parentNode.insertBefore(F,M);}}T.addClass(this.CLASS_PREFIX+"-"+T.get("value"));var S=document.createElement("span");S.className=this.CLASS_PREFIX+"-icon";T.get("element").insertBefore(S,T.get("firstChild"));if(T._button.tagName.toLowerCase()=="button"){T.get("element").setAttribute("unselectable","on");var U=document.createElement("a");U.innerHTML=T._button.innerHTML;U.href="#";U.tabIndex="-1";A.on(U,"click",function(W){A.stopEvent(W);});T._button.parentNode.replaceChild(U,T._button);T._button=U;}if(J.type=="select"){if(T._button.tagName.toLowerCase()=="select"){S.parentNode.removeChild(S);var G=T._button;var R=T.get("element");R.parentNode.replaceChild(G,R);}else{T.addClass(this.CLASS_PREFIX+"-select");}}if(J.type=="spin"){if(!D.isArray(J.range)){J.range=[10,100];}this._makeSpinButton(T,J);}T.get("element").setAttribute("title",T.get("label"));if(J.type!="spin"){if((YAHOO.widget.Overlay)&&(Q.menu instanceof YAHOO.widget.Overlay)){var H=function(Y){var W=true;if(Y.keyCode&&(Y.keyCode==9)){W=false;}if(W){if(this._colorPicker){this._colorPicker._button=J.value;}var X=T.getMenu().element;if(C.getStyle(X,"visibility")=="hidden"){T.getMenu().show();}else{T.getMenu().hide();}}YAHOO.util.Event.stopEvent(Y);};T.on("mousedown",H,J,this);T.on("keydown",H,J,this);}else{if((J.type!="menu")&&(J.type!="select")){T.on("keypress",this._buttonClick,J,this);T.on("mousedown",function(W){YAHOO.util.Event.stopEvent(W);this._buttonClick(W,J);},J,this);T.on("click",function(W){YAHOO.util.Event.stopEvent(W);});}else{T.on("mousedown",function(W){YAHOO.util.Event.stopEvent(W);});T.on("click",function(W){YAHOO.util.Event.stopEvent(W);});T.on("change",function(W){if(!J.menucmd){J.menucmd=J.value;}J.value=W.value;this._buttonClick(W,J);},this,true);var K=this;T.on("appendTo",function(){var W=this;if(W.getMenu()&&W.getMenu().mouseDownEvent){W.getMenu().mouseDownEvent.subscribe(function(Z,Y){var X=Y[1];YAHOO.util.Event.stopEvent(Y[0]);W._onMenuClick(Y[0],W);if(!J.menucmd){J.menucmd=J.value;}J.value=((X.value)?X.value:X._oText.nodeValue);K._buttonClick.call(K,Y[1],J);W._hideMenu();return false;});W.getMenu().clickEvent.subscribe(function(Y,X){YAHOO.util.Event.stopEvent(X[0]);});W.getMenu().mouseUpEvent.subscribe(function(Y,X){YAHOO.util.Event.stopEvent(X[0]);});}});}}}else{T.on("mousedown",function(W){YAHOO.util.Event.stopEvent(W);});T.on("click",function(W){YAHOO.util.Event.stopEvent(W);});}if(this.browser.ie){}if(this.browser.webkit){T.hasFocus=function(){return true;};}this._buttonList[this._buttonList.length]=T;if((J.type=="menu")||(J.type=="split")||(J.type=="select")){if(D.isArray(J.menu)){var E=T.getMenu();if(E&&E.renderEvent){E.renderEvent.subscribe(this._addMenuClasses,T);if(J.renderer){E.renderEvent.subscribe(J.renderer,T);}}}}}return J;},addSeparator:function(E,H){if(!this.get("element")){this._queue[this._queue.length]=["addSeparator",arguments];return false;}var F=((E)?E:this.get("cont"));if(!this.get("element")){this._queue[this._queue.length]=["addSeparator",arguments];return false;}if(this._sepCount===null){this._sepCount=0;}if(!this._sep){this._sep=document.createElement("SPAN");C.addClass(this._sep,this.CLASS_SEPARATOR);this._sep.innerHTML="|";}var G=this._sep.cloneNode(true);this._sepCount++;C.addClass(G,this.CLASS_SEPARATOR+"-"+this._sepCount);if(H){var I=null;if(H.
|
||
|
E.innerHTML="";},_makeColorButton:function(E){if(!this._colorPicker){this._createColorPicker(this.get("id"));}E.type="color";E.menu=new YAHOO.widget.Overlay(this.get("id")+"_"+E.value+"_menu",{visible:false,position:"absolute",iframe:true});E.menu.setBody("");E.menu.render(this.get("cont"));C.addClass(E.menu.element,"yui-button-menu");C.addClass(E.menu.element,"yui-color-button-menu");E.menu.beforeShowEvent.subscribe(function(){E.menu.cfg.setProperty("zindex",5);E.menu.cfg.setProperty("context",[this.getButtonById(E.id).get("element"),"tl","bl"]);this._resetColorPicker();var F=this._colorPicker;if(F.parentNode){F.parentNode.removeChild(F);}E.menu.setBody("");E.menu.appendToBody(F);this._colorPicker.style.display="block";},this,true);return E;},_makeSpinButton:function(R,L){R.addClass(this.CLASS_PREFIX+"-spinbutton");var S=this,N=R._button.parentNode.parentNode,I=L.range,H=document.createElement("a"),G=document.createElement("a");H.href="#";G.href="#";H.tabIndex="-1";G.tabIndex="-1";H.className="up";H.title=this.STR_SPIN_UP;H.innerHTML=this.STR_SPIN_UP;G.className="down";G.title=this.STR_SPIN_DOWN;G.innerHTML=this.STR_SPIN_DOWN;N.appendChild(H);N.appendChild(G);var M=YAHOO.lang.substitute(this.STR_SPIN_LABEL,{VALUE:R.get("label")});R.set("title",M);var Q=function(T){T=((T<I[0])?I[0]:T);T=((T>I[1])?I[1]:T);return T;};var P=this.browser;var F=false;var K=this.STR_SPIN_LABEL;if(this._titlebar&&this._titlebar.firstChild){F=this._titlebar.firstChild;}var E=function(U){YAHOO.util.Event.stopEvent(U);if(!R.get("disabled")&&(U.keyCode!=9)){var V=parseInt(R.get("label"),10);V++;V=Q(V);R.set("label",""+V);var T=YAHOO.lang.substitute(K,{VALUE:R.get("label")});R.set("title",T);if(!P.webkit&&F){}S._buttonClick(U,L);}};var O=function(U){YAHOO.util.Event.stopEvent(U);if(!R.get("disabled")&&(U.keyCode!=9)){var V=parseInt(R.get("label"),10);V--;V=Q(V);R.set("label",""+V);var T=YAHOO.lang.substitute(K,{VALUE:R.get("label")});R.set("title",T);if(!P.webkit&&F){}S._buttonClick(U,L);}};var J=function(T){if(T.keyCode==38){E(T);}else{if(T.keyCode==40){O(T);}else{if(T.keyCode==107&&T.shiftKey){E(T);}else{if(T.keyCode==109&&T.shiftKey){O(T);}}}}};R.on("keydown",J,this,true);A.on(H,"mousedown",function(T){A.stopEvent(T);},this,true);A.on(G,"mousedown",function(T){A.stopEvent(T);},this,true);A.on(H,"click",E,this,true);A.on(G,"click",O,this,true);},_buttonClick:function(L,F){var E=true;if(L&&L.type=="keypress"){if(L.keyCode==9){E=false;}else{if((L.keyCode===13)||(L.keyCode===0)||(L.keyCode===32)){}else{E=false;}}}if(E){var N=true,H=false;F.isSelected=this.isSelected(F.id);if(F.value){H=this.fireEvent(F.value+"Click",{type:F.value+"Click",target:this.get("element"),button:F});if(H===false){N=false;}}if(F.menucmd&&N){H=this.fireEvent(F.menucmd+"Click",{type:F.menucmd+"Click",target:this.get("element"),button:F});if(H===false){N=false;}}if(N){this.fireEvent("buttonClick",{type:"buttonClick",target:this.get("element"),button:F});}if(F.type=="select"){var K=this.getButtonById(F.id);if(K.buttonType=="rich"){var J=F.value;for(var I=0;I<F.menu.length;I++){if(F.menu[I].value==F.value){J=F.menu[I].text;break;}}K.set("label",'<span class="yui-toolbar-'+F.menucmd+"-"+(F.value).replace(/ /g,"-").toLowerCase()+'">'+J+"</span>");var M=K.getMenu().getItems();for(var G=0;G<M.length;G++){if(M[G].value.toLowerCase()==F.value.toLowerCase()){M[G].cfg.setProperty("checked",true);}else{M[G].cfg.setProperty("checked",false);}}}}if(L){A.stopEvent(L);}}},_keyNav:null,_navCounter:null,_navigateButtons:function(F){switch(F.keyCode){case 37:case 39:if(F.keyCode==37){this._navCounter--;}else{this._navCounter++;}if(this._navCounter>(this._buttonList.length-1)){this._navCounter=0;}if(this._navCounter<0){this._navCounter=(this._buttonList.length-1);}if(this._buttonList[this._navCounter]){var E=this._buttonList[this._navCounter].get("element");if(this.browser.ie){E=this._buttonList[this._navCounter].get("element").getElementsByTagName("a")[0];}if(this._buttonList[this._navCounter].get("disabled")){this._navigateButtons(F);}else{E.focus();}}break;}},_handleFocus:function(){if(!this._
|
||
|
}}}}}else{return false;}},deselectButton:function(F){var E=B.call(this,F);if(E){E.removeClass("yui-button-selected");E.removeClass("yui-button-"+E.get("value")+"-selected");E.removeClass("yui-button-hover");E._selected=false;}else{return false;}},deselectAllButtons:function(){var E=this._buttonList.length;for(var F=0;F<E;F++){this.deselectButton(this._buttonList[F]);}},disableAllButtons:function(){if(this.get("disabled")){return false;}var E=this._buttonList.length;for(var F=0;F<E;F++){this.disableButton(this._buttonList[F]);}},enableAllButtons:function(){if(this.get("disabled")){return false;}var E=this._buttonList.length;for(var F=0;F<E;F++){this.enableButton(this._buttonList[F]);}},resetAllButtons:function(I){if(!D.isObject(I)){I={};}if(this.get("disabled")){return false;}var E=this._buttonList.length;for(var F=0;F<E;F++){var H=this._buttonList[F];if(H){var G=H._configs.disabled._initialConfig.value;if(I[H.get("id")]){this.enableButton(H);this.selectButton(H);}else{if(G){this.disableButton(H);}else{this.enableButton(H);}this.deselectButton(H);}}}},destroyButton:function(I){var G=B.call(this,I);if(G){var H=G.get("id");G.destroy();var E=this._buttonList.length;for(var F=0;F<E;F++){if(this._buttonList[F]&&this._buttonList[F].get("id")==H){this._buttonList[F]=null;}}}else{return false;}},destroy:function(){this.get("element").innerHTML="";this.get("element").className="";for(var E in this){if(D.hasOwnProperty(this,E)){this[E]=null;}}return true;},collapse:function(F){var E=C.getElementsByClassName("collapse","span",this._titlebar);if(F===false){C.removeClass(this.get("cont").parentNode,"yui-toolbar-container-collapsed");if(E[0]){C.removeClass(E[0],"collapsed");}this.fireEvent("toolbarExpanded",{type:"toolbarExpanded",target:this});}else{if(E[0]){C.addClass(E[0],"collapsed");}C.addClass(this.get("cont").parentNode,"yui-toolbar-container-collapsed");this.fireEvent("toolbarCollapsed",{type:"toolbarCollapsed",target:this});}},toString:function(){return"Toolbar (#"+this.get("element").id+") with "+this._buttonList.length+" buttons.";}});})();(function(){var C=YAHOO.util.Dom,A=YAHOO.util.Event,D=YAHOO.lang,B=YAHOO.widget.Toolbar;YAHOO.widget.SimpleEditor=function(H,M){var G={};if(D.isObject(H)&&(!H.tagName)&&!M){D.augmentObject(G,H);H=document.createElement("textarea");this.DOMReady=true;if(G.container){var K=C.get(G.container);K.appendChild(H);}else{document.body.appendChild(H);}}else{if(M){D.augmentObject(G,M);}}var I={element:null,attributes:G},F=null;if(D.isString(H)){F=H;}else{if(I.attributes.id){F=I.attributes.id;}else{this.DOMReady=true;F=C.generateId(H);}}I.element=H;var J=document.createElement("DIV");I.attributes.element_cont=new YAHOO.util.Element(J,{id:F+"_container"});var E=document.createElement("div");C.addClass(E,"first-child");I.attributes.element_cont.appendChild(E);if(!I.attributes.toolbar_cont){I.attributes.toolbar_cont=document.createElement("DIV");I.attributes.toolbar_cont.id=F+"_toolbar";E.appendChild(I.attributes.toolbar_cont);}var L=document.createElement("DIV");E.appendChild(L);I.attributes.editor_wrapper=L;YAHOO.widget.SimpleEditor.superclass.constructor.call(this,I.element,I.attributes);};YAHOO.extend(YAHOO.widget.SimpleEditor,YAHOO.util.Element,{_resizeConfig:{handles:["br"],autoRatio:true,status:true,proxy:true,useShim:true,setSize:false},_setupResize:function(){if(!YAHOO.util.DD||!YAHOO.util.Resize){return false;}if(this.get("resize")){var E={};D.augmentObject(E,this._resizeConfig);this.resize=new YAHOO.util.Resize(this.get("element_cont").get("element"),E);this.resize.on("resize",function(G){var K=this.get("animate");this.set("animate",false);this.set("width",G.width+"px");var H=G.height,I=(this.toolbar.get("element").clientHeight+2),J=0;if(this.dompath){J=(this.dompath.clientHeight+1);}var F=(H-I-J);this.set("height",F+"px");this.get("element_cont").setStyle("height","");this.set("animate",K);},this,true);}},resize:null,_setupDD:function(){if(!YAHOO.util.DD){return false;}if(this.get("drag")){var F=this.get("drag"),E=YAHOO.util.DD;if(F==="proxy"){E=YAHOO.util.DDProxy;}this.dd=new E(this.get("el
|
||
|
}(),_lastImage:null,_blankImageLoaded:null,_fixNodesTimer:null,_nodeChangeTimer:null,_lastNodeChangeEvent:null,_lastNodeChange:0,_rendered:null,DOMReady:null,_selection:null,_mask:null,_showingHiddenElements:null,currentWindow:null,currentEvent:null,operaEvent:null,currentFont:null,currentElement:null,dompath:null,beforeElement:null,afterElement:null,invalidHTML:{form:true,input:true,button:true,select:true,link:true,html:true,body:true,iframe:true,script:true,style:true,textarea:true},toolbar:null,_contentTimer:null,_contentTimerCounter:0,_disabled:["createlink","fontname","fontsize","forecolor","backcolor"],_alwaysDisabled:{undo:true,redo:true},_alwaysEnabled:{},_semantic:{"bold":true,"italic":true,"underline":true},_tag2cmd:{"b":"bold","strong":"bold","i":"italic","em":"italic","u":"underline","sup":"superscript","sub":"subscript","img":"insertimage","a":"createlink","ul":"insertunorderedlist","ol":"insertorderedlist"},_createIframe:function(){var I=document.createElement("iframe");I.id=this.get("id")+"_editor";var G={border:"0",frameBorder:"0",marginWidth:"0",marginHeight:"0",leftMargin:"0",topMargin:"0",allowTransparency:"true",width:"100%"};if(this.get("autoHeight")){G.scrolling="no";}for(var H in G){if(D.hasOwnProperty(G,H)){I.setAttribute(H,G[H]);}}var F="javascript:;";if(this.browser.ie){F="javascript:false;";}I.setAttribute("src",F);var E=new YAHOO.util.Element(I);E.setStyle("visibility","hidden");return E;},_isElement:function(F,E){if(F&&F.tagName&&(F.tagName.toLowerCase()==E)){return true;}if(F&&F.getAttribute&&(F.getAttribute("tag")==E)){return true;}return false;},_hasParent:function(F,E){if(!F||!F.parentNode){return false;}while(F.parentNode){if(this._isElement(F,E)){return F;}if(F.parentNode){F=F.parentNode;}else{return false;}}return false;},_getDoc:function(){var E=false;if(this.get){if(this.get("iframe")){if(this.get("iframe").get){if(this.get("iframe").get("element")){try{if(this.get("iframe").get("element").contentWindow){if(this.get("iframe").get("element").contentWindow.document){E=this.get("iframe").get("element").contentWindow.document;return E;}}}catch(F){}}}}}return false;},_getWindow:function(){return this.get("iframe").get("element").contentWindow;},_focusWindow:function(E){if(this.browser.webkit){if(E){this._getSelection().setBaseAndExtent(this._getDoc().body.firstChild,0,this._getDoc().body.firstChild,1);if(this.browser.webkit3){this._getSelection().collapseToStart();}else{this._getSelection().collapse(false);}}else{this._getSelection().setBaseAndExtent(this._getDoc().body,1,this._getDoc().body,1);if(this.browser.webkit3){this._getSelection().collapseToStart();}else{this._getSelection().collapse(false);}}this._getWindow().focus();}else{this._getWindow().focus();}},_hasSelection:function(){var G=this._getSelection();var E=this._getRange();var F=false;if(!G||!E){return F;}if(this.browser.ie||this.browser.opera){if(E.text){F=true;}if(E.html){F=true;}}else{if(this.browser.webkit){if(G+""!==""){F=true;}}else{if(G&&(G.toString()!=="")&&(G!==undefined)){F=true;}}}return F;},_getSelection:function(){var E=null;if(this._getDoc()&&this._getWindow()){if(this._getDoc().selection){E=this._getDoc().selection;}else{E=this._getWindow().getSelection();}if(this.browser.webkit){if(E.baseNode){this._selection={};this._selection.baseNode=E.baseNode;this._selection.baseOffset=E.baseOffset;this._selection.extentNode=E.extentNode;this._selection.extentOffset=E.extentOffset;}else{if(this._selection!==null){E=this._getWindow().getSelection();E.setBaseAndExtent(this._selection.baseNode,this._selection.baseOffset,this._selection.extentNode,this._selection.extentOffset);this._selection=null;}}}}return E;},_selectNode:function(F,I){if(!F){return false;}var G=this._getSelection(),E=null;if(this.browser.ie){try{E=this._getDoc().body.createTextRange();E.moveToElementText(F);E.select();}catch(H){}}else{if(this.browser.webkit){if(I){G.setBaseAndExtent(F,1,F,F.innerText.length);}else{G.setBaseAndExtent(F,0,F,F.innerText.length);}}else{if(this.browser.opera){G=this._getWindow().getSelection();E=this._getDoc().createRange();E.
|
||
|
this._contentTimerCounter=0;}}if(!this._getDoc().body){this._contentTimerCounter=0;this._checkLoaded();return false;}this.toolbar.on("buttonClick",this._handleToolbarClick,this,true);if(!this.get("disabled")){this._initEditorEvents();this.toolbar.set("disabled",false);}this.fireEvent("editorContentLoaded",{type:"editorLoaded",target:this});if(this.get("dompath")){var E=this;setTimeout(function(){E._writeDomPath.call(E);E._setupResize.call(E);},150);}var G=[];for(var F in this.browser){if(this.browser[F]){G.push(F);}}if(this.get("ptags")){G.push("ptags");}C.addClass(this._getDoc().body,G.join(" "));this.nodeChange(true);},_checkLoaded:function(){this._contentTimerCounter++;if(this._contentTimer){clearTimeout(this._contentTimer);}if(this._contentTimerCounter>500){return false;}var G=false;try{if(this._getDoc()&&this._getDoc().body){if(this.browser.ie){if(this._getDoc().body.readyState=="complete"){G=true;}}else{if(this._getDoc().body._rteLoaded===true){G=true;}}}}catch(F){G=false;}if(G===true){this._initEditor();}else{var E=this;this._contentTimer=setTimeout(function(){E._checkLoaded.call(E);},20);}},_setInitialContent:function(){var H=((this._textarea)?this.get("element").value:this.get("element").innerHTML),J=null;var F=D.substitute(this.get("html"),{TITLE:this.STR_TITLE,CONTENT:this._cleanIncomingHTML(H),CSS:this.get("css"),HIDDEN_CSS:((this.get("hiddencss"))?this.get("hiddencss"):"/* No Hidden CSS */"),EXTRA_CSS:((this.get("extracss"))?this.get("extracss"):"/* No Extra CSS */")}),E=true;if(document.compatMode!="BackCompat"){F=this._docType+"\n"+F;}else{}if(this.browser.ie||this.browser.webkit||this.browser.opera||(navigator.userAgent.indexOf("Firefox/1.5")!=-1)){try{if(this.browser.air){J=this._getDoc().implementation.createHTMLDocument();var K=this._getDoc();K.open();K.close();J.open();J.write(F);J.close();var G=K.importNode(J.getElementsByTagName("html")[0],true);K.replaceChild(G,K.getElementsByTagName("html")[0]);K.body._rteLoaded=true;}else{J=this._getDoc();J.open();J.write(F);J.close();}}catch(I){E=false;}}else{this.get("iframe").get("element").src="data:text/html;charset=utf-8,"+encodeURIComponent(F);}this.get("iframe").setStyle("visibility","");if(E){this._checkLoaded();}},_setMarkupType:function(E){switch(this.get("markup")){case"css":this._setEditorStyle(true);break;case"default":this._setEditorStyle(false);break;case"semantic":case"xhtml":if(this._semantic[E]){this._setEditorStyle(false);}else{this._setEditorStyle(true);}break;}},_setEditorStyle:function(F){try{this._getDoc().execCommand("useCSS",false,!F);}catch(E){}},_getSelectedElement:function(){var I=this._getDoc(),F=null,G=null,J=null,E=true;if(this.browser.ie){this.currentEvent=this._getWindow().event;F=this._getRange();if(F){J=F.item?F.item(0):F.parentElement();if(this._hasSelection()){}if(J===I.body){J=null;}}if((this.currentEvent!==null)&&(this.currentEvent.keyCode===0)){J=A.getTarget(this.currentEvent);}}else{G=this._getSelection();F=this._getRange();if(!G||!F){return null;}if(!this._hasSelection()&&this.browser.webkit3){}if(this.browser.gecko){if(F.startContainer){E=false;if(F.startContainer.nodeType===3){J=F.startContainer.parentNode;}else{if(F.startContainer.nodeType===1){J=F.startContainer;}else{E=true;}}if(!E){this.currentEvent=null;}}}if(E){if(G.anchorNode&&(G.anchorNode.nodeType==3)){if(G.anchorNode.parentNode){J=G.anchorNode.parentNode;}if(G.anchorNode.nextSibling!=G.focusNode.nextSibling){J=G.anchorNode.nextSibling;}}if(this._isElement(J,"br")){J=null;}if(!J){J=F.commonAncestorContainer;if(!F.collapsed){if(F.startContainer==F.endContainer){if(F.startOffset-F.endOffset<2){if(F.startContainer.hasChildNodes()){J=F.startContainer.childNodes[F.startOffset];}}}}}}}if(this.currentEvent!==null){try{switch(this.currentEvent.type){case"click":case"mousedown":case"mouseup":if(this.browser.webkit){J=A.getTarget(this.currentEvent);}break;default:break;}}catch(H){}}else{if((this.currentElement&&this.currentElement[0])&&(!this.browser.ie)){}}if(this.browser.opera||this.browser.webkit){if(this.currentEvent&&!J){J=YAHOO.util.Event.getTarget(this.currentEv
|
||
|
if(F.length){for(var G=0;G<F.length;G++){H.push(F[G]);}}}}}for(var I=0;I<H.length;I++){if(H[I].parentNode){if(D.isObject(this.invalidHTML[H[I].tagName.toLowerCase()])&&this.invalidHTML[H[I].tagName.toLowerCase()].keepContents){this._swapEl(H[I],"span",function(L){L.className="yui-non";});}else{H[I].parentNode.removeChild(H[I]);}}}var K=this._getDoc().getElementsByTagName("img");C.addClass(K,"yui-img");},_isNonEditable:function(G){if(this.get("allowNoEdit")){var F=A.getTarget(G);if(this._isElement(F,"html")){F=null;}var J=this._getDomPath(F);for(var E=(J.length-1);E>-1;E--){if(C.hasClass(J[E],this.CLASS_NOEDIT)){try{this._getDoc().execCommand("enableObjectResizing",false,"false");}catch(I){}this.nodeChange();A.stopEvent(G);return true;}}try{this._getDoc().execCommand("enableObjectResizing",false,"true");}catch(H){}}return false;},_setCurrentEvent:function(E){this.currentEvent=E;},_handleClick:function(G){var F=this.fireEvent("beforeEditorClick",{type:"beforeEditorClick",target:this,ev:G});if(F===false){return false;}if(this._isNonEditable(G)){return false;}this._setCurrentEvent(G);if(this.currentWindow){this.closeWindow();}if(this.currentWindow){this.closeWindow();}if(this.browser.webkit){var E=A.getTarget(G);if(this._isElement(E,"a")||this._isElement(E.parentNode,"a")){A.stopEvent(G);this.nodeChange();}}else{this.nodeChange();}this.fireEvent("editorClick",{type:"editorClick",target:this,ev:G});},_handleMouseUp:function(G){var F=this.fireEvent("beforeEditorMouseUp",{type:"beforeEditorMouseUp",target:this,ev:G});if(F===false){return false;}if(this._isNonEditable(G)){return false;}var E=this;if(this.browser.opera){var H=A.getTarget(G);if(this._isElement(H,"img")){this.nodeChange();if(this.operaEvent){clearTimeout(this.operaEvent);this.operaEvent=null;this._handleDoubleClick(G);}else{this.operaEvent=window.setTimeout(function(){E.operaEvent=false;},700);}}}if(this.browser.webkit||this.browser.opera){if(this.browser.webkit){A.stopEvent(G);}}this.nodeChange();this.fireEvent("editorMouseUp",{type:"editorMouseUp",target:this,ev:G});},_handleMouseDown:function(F){var E=this.fireEvent("beforeEditorMouseDown",{type:"beforeEditorMouseDown",target:this,ev:F});if(E===false){return false;}if(this._isNonEditable(F)){return false;}this._setCurrentEvent(F);var G=A.getTarget(F);if(this.browser.webkit&&this._hasSelection()){var H=this._getSelection();if(!this.browser.webkit3){H.collapse(true);}else{H.collapseToStart();}}if(this.browser.webkit&&this._lastImage){C.removeClass(this._lastImage,"selected");this._lastImage=null;}if(this._isElement(G,"img")||this._isElement(G,"a")){if(this.browser.webkit){A.stopEvent(F);if(this._isElement(G,"img")){C.addClass(G,"selected");this._lastImage=G;}}if(this.currentWindow){this.closeWindow();}this.nodeChange();}this.fireEvent("editorMouseDown",{type:"editorMouseDown",target:this,ev:F});},_handleDoubleClick:function(F){var E=this.fireEvent("beforeEditorDoubleClick",{type:"beforeEditorDoubleClick",target:this,ev:F});if(E===false){return false;}if(this._isNonEditable(F)){return false;}this._setCurrentEvent(F);var G=A.getTarget(F);if(this._isElement(G,"img")){this.currentElement[0]=G;this.toolbar.fireEvent("insertimageClick",{type:"insertimageClick",target:this.toolbar});this.fireEvent("afterExecCommand",{type:"afterExecCommand",target:this});}else{if(this._hasParent(G,"a")){this.currentElement[0]=this._hasParent(G,"a");this.toolbar.fireEvent("createlinkClick",{type:"createlinkClick",target:this.toolbar});this.fireEvent("afterExecCommand",{type:"afterExecCommand",target:this});}}this.nodeChange();this.fireEvent("editorDoubleClick",{type:"editorDoubleClick",target:this,ev:F});},_handleKeyUp:function(G){var F=this.fireEvent("beforeEditorKeyUp",{type:"beforeEditorKeyUp",target:this,ev:G});if(F===false){return false;}if(this._isNonEditable(G)){return false;}this._setCurrentEvent(G);switch(G.keyCode){case this._keyMap.SELECT_ALL.key:if(this._checkKey(this._keyMap.SELECT_ALL,G)){this.nodeChange();}break;case 32:case 35:case 36:case 37:case 38:case 39:case 40:case 46:case 8:case this._keyMap.CLOSE_WINDOW.key:if((G.
|
||
|
if(this.get("limitCommands")){if(!this.toolbar.getButtonByValue("createlink")){E=false;}}if(E){this.execCommand("createlink","");this.toolbar.fireEvent("createlinkClick",{type:"createlinkClick",target:this.toolbar});this.fireEvent("afterExecCommand",{type:"afterExecCommand",target:this});L=false;}}}break;case this._keyMap.UNDO.key:case this._keyMap.REDO.key:if(this._checkKey(this._keyMap.REDO,M)){G="redo";L=true;}else{if(this._checkKey(this._keyMap.UNDO,M)){G="undo";L=true;}}break;case this._keyMap.BOLD.key:if(this._checkKey(this._keyMap.BOLD,M)){G="bold";L=true;}break;case this._keyMap.ITALIC.key:if(this._checkKey(this._keyMap.ITALIC,M)){G="italic";L=true;}break;case this._keyMap.UNDERLINE.key:if(this._checkKey(this._keyMap.UNDERLINE,M)){G="underline";L=true;}break;case 9:if(this.browser.ie){K=this._getRange();I=this._getSelectedElement();if(!this._isElement(I,"li")){if(K){K.pasteHTML(" ");K.collapse(false);K.select();}A.stopEvent(M);}}if(this.browser.gecko>1.8){I=this._getSelectedElement();if(this._isElement(I,"li")){if(M.shiftKey){this._getDoc().execCommand("outdent",null,"");}else{this._getDoc().execCommand("indent",null,"");}}else{if(!this._hasSelection()){this.execCommand("inserthtml"," ");}}A.stopEvent(M);}break;case 13:if(this.get("ptags")&&!M.shiftKey){if(this.browser.gecko){I=this._getSelectedElement();if(!this._isElement(I,"li")){L=true;G="insertparagraph";A.stopEvent(M);}}if(this.browser.webkit){I=this._getSelectedElement();if(!this._hasParent(I,"li")){L=true;G="insertparagraph";A.stopEvent(M);}}}else{if(this.browser.ie){K=this._getRange();I=this._getSelectedElement();if(!this._isElement(I,"li")){if(K){K.pasteHTML("<br>");K.collapse(false);K.select();}A.stopEvent(M);}}}break;}if(this.browser.ie){this._listFix(M);}if(L&&G){this.execCommand(G,null);A.stopEvent(M);this.nodeChange();}this.fireEvent("editorKeyDown",{type:"editorKeyDown",target:this,ev:M});},_listFix:function(K){var M=null,I=null,E=false,G=null;if(this.browser.webkit){if(K.keyCode&&(K.keyCode==13)){if(this._hasParent(this._getSelectedElement(),"li")){var H=this._hasParent(this._getSelectedElement(),"li");if(H.previousSibling){if(H.firstChild&&(H.firstChild.length==1)){this._selectNode(H);}}}}}if(K.keyCode&&((!this.browser.webkit3&&(K.keyCode==25))||((this.browser.webkit3||!this.browser.webkit)&&((K.keyCode==9)&&K.shiftKey)))){M=this._getSelectedElement();if(this._hasParent(M,"li")){M=this._hasParent(M,"li");if(this._hasParent(M,"ul")||this._hasParent(M,"ol")){I=this._hasParent(M,"ul");if(!I){I=this._hasParent(M,"ol");}if(this._isElement(I.previousSibling,"li")){I.removeChild(M);I.parentNode.insertBefore(M,I.nextSibling);if(this.browser.ie){G=this._getDoc().body.createTextRange();G.moveToElementText(M);G.collapse(false);G.select();}if(this.browser.webkit){this._selectNode(M.firstChild);}A.stopEvent(K);}}}}if(K.keyCode&&((K.keyCode==9)&&(!K.shiftKey))){var F=this._getSelectedElement();if(this._hasParent(F,"li")){E=this._hasParent(F,"li").innerHTML;}if(this.browser.webkit){this._getDoc().execCommand("inserttext",false,"\t");}M=this._getSelectedElement();if(this._hasParent(M,"li")){I=this._hasParent(M,"li");var J=this._getDoc().createElement(I.parentNode.tagName.toLowerCase());if(this.browser.webkit){var L=C.getElementsByClassName("Apple-tab-span","span",I);if(L[0]){I.removeChild(L[0]);I.innerHTML=D.trim(I.innerHTML);if(E){I.innerHTML='<span class="yui-non">'+E+"</span> ";}else{I.innerHTML='<span class="yui-non"> </span> ';}}}else{if(E){I.innerHTML=E+" ";}else{I.innerHTML=" ";}}I.parentNode.replaceChild(J,I);J.appendChild(I);if(this.browser.webkit){this._getSelection().setBaseAndExtent(I.firstChild,1,I.firstChild,I.firstChild.innerText.length);if(!this.browser.webkit3){I.parentNode.parentNode.style.display="list-item";setTimeout(function(){I.parentNode.parentNode.style.display="block";},1);}}else{if(this.browser.ie){G=this._getDoc().body.createTextRange();G.moveToElementText(I);G.collapse(false);G.select();}else{this._selectNode(I);}}A.stopEvent(K);}if(this.browser.webkit){A.stopEv
|
||
|
X<S.length;X++){c=S[X].tagName.toLowerCase();if(S[X].getAttribute("tag")){c=S[X].getAttribute("tag").toLowerCase();}W=this._tag2cmd[c];if(W===undefined){W=[];}if(!D.isArray(W)){W=[W];}if(S[X].style.fontWeight.toLowerCase()=="bold"){W[W.length]="bold";}if(S[X].style.fontStyle.toLowerCase()=="italic"){W[W.length]="italic";}if(S[X].style.textDecoration.toLowerCase()=="underline"){W[W.length]="underline";}if(S[X].style.textDecoration.toLowerCase()=="line-through"){W[W.length]="strikethrough";}if(W.length>0){for(var V=0;V<W.length;V++){this.toolbar.selectButton(W[V]);this.toolbar.enableButton(W[V]);}}switch(S[X].style.textAlign.toLowerCase()){case"left":case"right":case"center":case"justify":var U=S[X].style.textAlign.toLowerCase();if(S[X].style.textAlign.toLowerCase()=="justify"){U="full";}this.toolbar.selectButton("justify"+U);this.toolbar.enableButton("justify"+U);break;}}if(M){var Y=M._configs.label._initialConfig.value;M.set("label",'<span class="yui-toolbar-fontname-'+this._cleanClassName(Y)+'">'+Y+"</span>");this._updateMenuChecked("fontname",Y);}if(L){L.set("label",L._configs.label._initialConfig.value);}var K=this.toolbar.getButtonByValue("heading");if(K){K.set("label",K._configs.label._initialConfig.value);this._updateMenuChecked("heading","none");}var I=this.toolbar.getButtonByValue("insertimage");if(I&&this.currentWindow&&(this.currentWindow.name=="insertimage")){this.toolbar.disableButton(I);}if(this._lastButton&&this._lastButton.isSelected){this.toolbar.deselectButton(this._lastButton.id);}this._undoNodeChange();}}this.fireEvent("afterNodeChange",{type:"afterNodeChange",target:this});},_updateMenuChecked:function(E,F,H){if(!H){H=this.toolbar;}var G=H.getButtonByValue(E);G.checkValue(F);},_handleToolbarClick:function(F){var H="";var I="";var G=F.button.value;if(F.button.menucmd){H=G;G=F.button.menucmd;}this._lastButton=F.button;if(this.STOP_EXEC_COMMAND){this.STOP_EXEC_COMMAND=false;return false;}else{this.execCommand(G,H);if(!this.browser.webkit){var E=this;setTimeout(function(){E._focusWindow.call(E);},5);}}A.stopEvent(F);},_setupAfterElement:function(){if(!this.beforeElement){this.beforeElement=document.createElement("h2");this.beforeElement.className="yui-editor-skipheader";this.beforeElement.tabIndex="-1";this.beforeElement.innerHTML=this.STR_BEFORE_EDITOR;this.get("element_cont").get("firstChild").insertBefore(this.beforeElement,this.toolbar.get("nextSibling"));}if(!this.afterElement){this.afterElement=document.createElement("h2");this.afterElement.className="yui-editor-skipheader";this.afterElement.tabIndex="-1";this.afterElement.innerHTML=this.STR_LEAVE_EDITOR;this.get("element_cont").get("firstChild").appendChild(this.afterElement);}},_disableEditor:function(F){if(F){this._removeEditorEvents();if(!this._mask){if(!!this.browser.ie){this._setDesignMode("off");}if(this.toolbar){this.toolbar.set("disabled",true);}this._mask=document.createElement("DIV");C.setStyle(this._mask,"height","100%");C.setStyle(this._mask,"width","100%");C.setStyle(this._mask,"position","absolute");C.setStyle(this._mask,"top","0");C.setStyle(this._mask,"left","0");C.setStyle(this._mask,"opacity",".5");C.addClass(this._mask,"yui-editor-masked");this.get("iframe").get("parentNode").appendChild(this._mask);}}else{this._initEditorEvents();if(this._mask){this._mask.parentNode.removeChild(this._mask);this._mask=null;if(this.toolbar){this.toolbar.set("disabled",false);}this._setDesignMode("on");this._focusWindow();var E=this;window.setTimeout(function(){E.nodeChange.call(E);},100);}}},SEP_DOMPATH:"<",STR_LEAVE_EDITOR:"You have left the Rich Text Editor.",STR_BEFORE_EDITOR:"This text field can contain stylized text and graphics. To cycle through all formatting options, use the keyboard shortcut Shift + Escape to place focus on the toolbar and navigate between options with your arrow keys. To exit this text editor use the Escape key and continue tabbing. <h4>Common formatting keyboard shortcuts:</h4><ul><li>Control Shift B sets text to bold</li> <li>Control Shift I sets text to italic</li> <li>Control Shift U underlines text</li> <li>Control
|
||
|
}YAHOO.widget.SimpleEditor.superclass.init.call(this,F,E);YAHOO.widget.EditorInfo._instances[this.get("id")]=this;this.currentElement=[];this.on("contentReady",function(){this.DOMReady=true;this.fireQueue();},this,true);},initAttributes:function(E){YAHOO.widget.SimpleEditor.superclass.initAttributes.call(this,E);var F=this;this.setAttributeConfig("nodeChangeDelay",{value:((E.nodeChangeDelay===false)?false:true)});this.setAttributeConfig("maxUndo",{writeOnce:true,value:E.maxUndo||30});this.setAttributeConfig("ptags",{writeOnce:true,value:E.ptags||false});this.setAttributeConfig("insert",{writeOnce:true,value:E.insert||false,method:function(K){if(K){var J={fontname:true,fontsize:true,forecolor:true,backcolor:true};var I=this._defaultToolbar.buttons;for(var H=0;H<I.length;H++){if(I[H].buttons){for(var G=0;G<I[H].buttons.length;G++){if(I[H].buttons[G].value){if(J[I[H].buttons[G].value]){delete I[H].buttons[G].disabled;}}}}}}}});this.setAttributeConfig("container",{writeOnce:true,value:E.container||false});this.setAttributeConfig("plainText",{writeOnce:true,value:E.plainText||false});this.setAttributeConfig("iframe",{value:null});this.setAttributeConfig("textarea",{value:null,writeOnce:true});this.setAttributeConfig("container",{readOnly:true,value:null});this.setAttributeConfig("nodeChangeThreshold",{value:E.nodeChangeThreshold||3,validator:YAHOO.lang.isNumber});this.setAttributeConfig("allowNoEdit",{value:E.allowNoEdit||false,validator:YAHOO.lang.isBoolean});this.setAttributeConfig("limitCommands",{value:E.limitCommands||false,validator:YAHOO.lang.isBoolean});this.setAttributeConfig("element_cont",{value:E.element_cont});this.setAttributeConfig("editor_wrapper",{value:E.editor_wrapper||null,writeOnce:true});this.setAttributeConfig("height",{value:E.height||C.getStyle(F.get("element"),"height"),method:function(G){if(this._rendered){if(this.get("animate")){var H=new YAHOO.util.Anim(this.get("iframe").get("parentNode"),{height:{to:parseInt(G,10)}},0.5);H.animate();}else{C.setStyle(this.get("iframe").get("parentNode"),"height",G);}}}});this.setAttributeConfig("autoHeight",{value:E.autoHeight||false,method:function(G){if(G){if(this.get("iframe")){this.get("iframe").get("element").setAttribute("scrolling","no");}this.on("afterNodeChange",this._handleAutoHeight,this,true);this.on("editorKeyDown",this._handleAutoHeight,this,true);this.on("editorKeyPress",this._handleAutoHeight,this,true);}else{if(this.get("iframe")){this.get("iframe").get("element").setAttribute("scrolling","auto");}this.unsubscribe("afterNodeChange",this._handleAutoHeight);this.unsubscribe("editorKeyDown",this._handleAutoHeight);this.unsubscribe("editorKeyPress",this._handleAutoHeight);}}});this.setAttributeConfig("width",{value:E.width||C.getStyle(this.get("element"),"width"),method:function(G){if(this._rendered){if(this.get("animate")){var H=new YAHOO.util.Anim(this.get("element_cont").get("element"),{width:{to:parseInt(G,10)}},0.5);H.animate();}else{this.get("element_cont").setStyle("width",G);}}}});this.setAttributeConfig("blankimage",{value:E.blankimage||this._getBlankImage()});this.setAttributeConfig("css",{value:E.css||this._defaultCSS,writeOnce:true});this.setAttributeConfig("html",{value:E.html||'<html><head><title>{TITLE}</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><base href="'+this._baseHREF+'"><style>{CSS}</style><style>{HIDDEN_CSS}</style><style>{EXTRA_CSS}</style></head><body onload="document.body._rteLoaded = true;">{CONTENT}</body></html>',writeOnce:true});this.setAttributeConfig("extracss",{value:E.extracss||"",writeOnce:true});this.setAttributeConfig("handleSubmit",{value:E.handleSubmit||false,method:function(G){if(this.get("element").form){if(!this._formButtons){this._formButtons=[];}if(G){A.on(this.get("element").form,"submit",this._handleFormSubmit,this,true);var H=this.get("element").form.getElementsByTagName("input");for(var J=0;J<H.length;J++){var I=H[J].getAttribute("type");if(I&&(I.toLowerCase()=="submit")){A.on(H[J],"click",this._handleFormButtonClick,this,true);this._formButtons[this._formButtons.length
|
||
|
this.setAttributeConfig("drag",{writeOnce:true,value:E.drag||false});this.setAttributeConfig("resize",{writeOnce:true,value:E.resize||false});},_getBlankImage:function(){if(!this.DOMReady){this._queue[this._queue.length]=["_getBlankImage",arguments];return"";}var E="";if(!this._blankImageLoaded){if(YAHOO.widget.EditorInfo.blankImage){this.set("blankimage",YAHOO.widget.EditorInfo.blankImage);this._blankImageLoaded=true;}else{var F=document.createElement("div");F.style.position="absolute";F.style.top="-9999px";F.style.left="-9999px";F.className=this.CLASS_PREFIX+"-blankimage";document.body.appendChild(F);E=YAHOO.util.Dom.getStyle(F,"background-image");E=E.replace("url(","").replace(")","").replace(/"/g,"");E=E.replace("app:/","");this.set("blankimage",E);this._blankImageLoaded=true;F.parentNode.removeChild(F);YAHOO.widget.EditorInfo.blankImage=E;}}else{E=this.get("blankimage");}return E;},_handleAutoHeight:function(){var I=this._getDoc(),F=I.body,J=I.documentElement;var E=parseInt(C.getStyle(this.get("editor_wrapper"),"height"),10);var G=F.scrollHeight;if(this.browser.webkit){G=J.scrollHeight;}if(G<parseInt(this.get("height"),10)){G=parseInt(this.get("height"),10);}if((E!=G)&&(G>=parseInt(this.get("height"),10))){C.setStyle(this.get("editor_wrapper"),"height",G+"px");if(this.browser.ie){this.get("iframe").setStyle("height","99%");this.get("iframe").setStyle("zoom","1");var H=this;window.setTimeout(function(){H.get("iframe").setStyle("height","100%");},1);}}},_formButtons:null,_formButtonClicked:null,_handleFormButtonClick:function(F){var E=A.getTarget(F);this._formButtonClicked=E;},_handleFormSubmit:function(H){this.saveHTML();var G=this.get("element").form,E=this._formButtonClicked||false;A.removeListener(G,"submit",this._handleFormSubmit);if(YAHOO.env.ua.ie){if(E&&!E.disabled){E.click();}}else{if(E&&!E.disabled){E.click();}var F=document.createEvent("HTMLEvents");F.initEvent("submit",true,true);G.dispatchEvent(F);if(YAHOO.env.ua.webkit){if(YAHOO.lang.isFunction(G.submit)){G.submit();}}}},_handleFontSize:function(G){var E=this.toolbar.getButtonById(G.button.id);var F=E.get("label")+"px";this.execCommand("fontsize",F);this.STOP_EXEC_COMMAND=true;},_handleColorPicker:function(G){var F=G.button;var E="#"+G.color;if((F=="forecolor")||(F=="backcolor")){this.execCommand(F,E);}},_handleAlign:function(H){var G=null;for(var E=0;E<H.button.menu.length;E++){if(H.button.menu[E].value==H.button.value){G=H.button.menu[E].value;}}var F=this._getSelection();this.execCommand(G,F);this.STOP_EXEC_COMMAND=true;},_handleAfterNodeChange:function(){var Q=this._getDomPath(),L=null,H=null,M=null,F=false,J=this.toolbar.getButtonByValue("fontname"),K=this.toolbar.getButtonByValue("fontsize"),E=this.toolbar.getButtonByValue("heading");for(var G=0;G<Q.length;G++){L=Q[G];var P=L.tagName.toLowerCase();if(L.getAttribute("tag")){P=L.getAttribute("tag");}H=L.getAttribute("face");if(C.getStyle(L,"font-family")){H=C.getStyle(L,"font-family");H=H.replace(/'/g,"");}if(P.substring(0,1)=="h"){if(E){for(var I=0;I<E._configs.menu.value.length;I++){if(E._configs.menu.value[I].value.toLowerCase()==P){E.set("label",E._configs.menu.value[I].text);}}this._updateMenuChecked("heading",P);}}}if(J){for(var O=0;O<J._configs.menu.value.length;O++){if(H&&J._configs.menu.value[O].text.toLowerCase()==H.toLowerCase()){F=true;H=J._configs.menu.value[O].text;}}if(!F){H=J._configs.label._initialConfig.value;}var N='<span class="yui-toolbar-fontname-'+this._cleanClassName(H)+'">'+H+"</span>";if(J.get("label")!=N){J.set("label",N);this._updateMenuChecked("fontname",H);}}if(K){M=parseInt(C.getStyle(L,"fontSize"),10);if((M===null)||isNaN(M)){M=K._configs.label._initialConfig.value;}K.set("label",""+M);}if(!this._isElement(L,"body")&&!this._isElement(L,"img")){this.toolbar.enableButton(J);this.toolbar.enableButton(K);this.toolbar.enableButton("forecolor");this.toolbar.enableButton("backcolor");}if(this._isElement(L,"img")){if(YAHOO.widget.Overlay){this.toolbar.enableButton("createlink");}}if(this._hasParent(L,"blockquote")){this.toolbar.selectButton("indent");this.toolbar.disableButto
|
||
|
},render:function(){if(this._rendered){return false;}if(!this.DOMReady){this._queue[this._queue.length]=["render",arguments];return false;}if(this.get("element")){if(this.get("element").tagName){this._textarea=true;if(this.get("element").tagName.toLowerCase()!=="textarea"){this._textarea=false;}}else{return false;}}else{return false;}this._rendered=true;var E=this;window.setTimeout(function(){E._render.call(E);},4);},_render:function(){var E=this;this.set("textarea",this.get("element"));this.get("element_cont").setStyle("display","none");this.get("element_cont").addClass(this.CLASS_CONTAINER);this.set("iframe",this._createIframe());window.setTimeout(function(){E._setInitialContent.call(E);},10);this.get("editor_wrapper").appendChild(this.get("iframe").get("element"));if(this.get("disabled")){this._disableEditor(true);}var F=this.get("toolbar");if(F instanceof B){this.toolbar=F;this.toolbar.set("disabled",true);}else{F.disabled=true;this.toolbar=new B(this.get("toolbar_cont"),F);}this.fireEvent("toolbarLoaded",{type:"toolbarLoaded",target:this.toolbar});this.toolbar.on("toolbarCollapsed",function(){if(this.currentWindow){this.moveWindow();}},this,true);this.toolbar.on("toolbarExpanded",function(){if(this.currentWindow){this.moveWindow();}},this,true);this.toolbar.on("fontsizeClick",this._handleFontSize,this,true);this.toolbar.on("colorPickerClicked",function(G){this._handleColorPicker(G);return false;},this,true);this.toolbar.on("alignClick",this._handleAlign,this,true);this.on("afterNodeChange",this._handleAfterNodeChange,this,true);this.toolbar.on("insertimageClick",this._handleInsertImageClick,this,true);this.on("windowinsertimageClose",this._handleInsertImageWindowClose,this,true);this.toolbar.on("createlinkClick",this._handleCreateLinkClick,this,true);this.on("windowcreatelinkClose",this._handleCreateLinkWindowClose,this,true);this.get("parentNode").replaceChild(this.get("element_cont").get("element"),this.get("element"));this.setStyle("visibility","hidden");this.setStyle("position","absolute");this.setStyle("top","-9999px");this.setStyle("left","-9999px");this.get("element_cont").appendChild(this.get("element"));this.get("element_cont").setStyle("display","block");C.addClass(this.get("iframe").get("parentNode"),this.CLASS_EDITABLE_CONT);this.get("iframe").addClass(this.CLASS_EDITABLE);this.get("element_cont").setStyle("width",this.get("width"));C.setStyle(this.get("iframe").get("parentNode"),"height",this.get("height"));this.get("iframe").setStyle("width","100%");this.get("iframe").setStyle("height","100%");this._setupDD();window.setTimeout(function(){E._setupAfterElement.call(E);},0);this.fireEvent("afterRender",{type:"afterRender",target:this});},execCommand:function(G,F){var J=this.fireEvent("beforeExecCommand",{type:"beforeExecCommand",target:this,args:arguments});if((J===false)||(this.STOP_EXEC_COMMAND)){this.STOP_EXEC_COMMAND=false;return false;}this._lastCommand=G;this._setMarkupType(G);if(this.browser.ie){this._getWindow().focus();}var E=true;if(this.get("limitCommands")){if(!this.toolbar.getButtonByValue(G)){E=false;}}this.editorDirty=true;if((typeof this["cmd_"+G.toLowerCase()]=="function")&&E){var I=this["cmd_"+G.toLowerCase()](F);E=I[0];if(I[1]){G=I[1];}if(I[2]){F=I[2];}}if(E){try{this._getDoc().execCommand(G,false,F);}catch(H){}}else{}this.on("afterExecCommand",function(){this.unsubscribeAll("afterExecCommand");this.nodeChange();},this,true);this.fireEvent("afterExecCommand",{type:"afterExecCommand",target:this});},cmd_underline:function(F){if(!this.browser.webkit){var E=this._getSelectedElement();if(E&&this._isElement(E,"span")){if(E.style.textDecoration=="underline"){E.style.textDecoration="none";}else{E.style.textDecoration="underline";}return[false];}}return[true];},cmd_backcolor:function(H){var E=true,F=this._getSelectedElement(),G="backcolor";if(this.browser.gecko||this.browser.opera){this._setEditorStyle(true);G="hilitecolor";}if(!this._isElement(F,"body")&&!this._hasSelection()){C.setStyle(F,"background-color",H);this._selectNode(F);E=false;}else{if(!this._isElement(F,"body")&&this._hasSelectio
|
||
|
F.setAttribute("src",J);YAHOO.util.Dom.addClass(F,"yui-img");this.currentElement[0].parentNode.replaceChild(F,this.currentElement[0]);}this.currentElement[0]=F;E=false;}}return[E];},cmd_inserthtml:function(H){var E=true,G="inserthtml",F=null,I=null;if(this.browser.webkit&&!this._getDoc().queryCommandEnabled(G)){this._createCurrentElement("img");F=this._getDoc().createElement("span");F.innerHTML=H;this.currentElement[0].parentNode.replaceChild(F,this.currentElement[0]);E=false;}else{if(this.browser.ie){I=this._getRange();if(I.item){I.item(0).outerHTML=H;}else{I.pasteHTML(H);}E=false;}}return[E];},cmd_list:function(Y){var S=true,V=null,M=0,G=null,R="",W=this._getSelectedElement(),T="insertorderedlist";if(Y=="ul"){T="insertunorderedlist";}if(this.browser.webkit){if(this._isElement(W,"li")&&this._isElement(W.parentNode,Y)){G=W.parentNode;V=this._getDoc().createElement("span");YAHOO.util.Dom.addClass(V,"yui-non");R="";var F=G.getElementsByTagName("li");for(M=0;M<F.length;M++){R+="<div>"+F[M].innerHTML+"</div>";}V.innerHTML=R;this.currentElement[0]=G;this.currentElement[0].parentNode.replaceChild(V,this.currentElement[0]);}else{this._createCurrentElement(Y.toLowerCase());V=this._getDoc().createElement(Y);for(M=0;M<this.currentElement.length;M++){var J=this._getDoc().createElement("li");J.innerHTML=this.currentElement[M].innerHTML+'<span class="yui-non"> </span> ';V.appendChild(J);if(M>0){this.currentElement[M].parentNode.removeChild(this.currentElement[M]);}}this.currentElement[0].parentNode.replaceChild(V,this.currentElement[0]);this.currentElement[0]=V;var H=this.currentElement[0].firstChild;H=C.getElementsByClassName("yui-non","span",H)[0];this._getSelection().setBaseAndExtent(H,1,H,H.innerText.length);}S=false;}else{G=this._getSelectedElement();if(this._isElement(G,"li")&&this._isElement(G.parentNode,Y)||(this.browser.ie&&this._isElement(this._getRange().parentElement,"li"))||(this.browser.ie&&this._isElement(G,"ul"))||(this.browser.ie&&this._isElement(G,"ol"))){if(this.browser.ie){if((this.browser.ie&&this._isElement(G,"ul"))||(this.browser.ie&&this._isElement(G,"ol"))){G=G.getElementsByTagName("li")[0];}R="";var I=G.parentNode.getElementsByTagName("li");for(var U=0;U<I.length;U++){R+=I[U].innerHTML+"<br>";}var X=this._getDoc().createElement("span");X.innerHTML=R;G.parentNode.parentNode.replaceChild(X,G.parentNode);}else{this.nodeChange();this._getDoc().execCommand(T,"",G.parentNode);this.nodeChange();}S=false;}if(this.browser.opera){var Q=this;window.setTimeout(function(){var Z=Q._getDoc().getElementsByTagName("li");for(var a=0;a<Z.length;a++){if(Z[a].innerHTML.toLowerCase()=="<br>"){Z[a].parentNode.parentNode.removeChild(Z[a].parentNode);}}},30);}if(this.browser.ie&&S){var K="";if(this._getRange().html){K="<li>"+this._getRange().html+"</li>";}else{var L=this._getRange().text.split("\n");if(L.length>1){K="";for(var P=0;P<L.length;P++){K+="<li>"+L[P]+"</li>";}}else{var O=this._getRange().text;if(O===""){K='<li id="new_list_item">'+O+"</li>";}else{K="<li>"+O+"</li>";}}}this._getRange().pasteHTML("<"+Y+">"+K+"</"+Y+">");var E=this._getDoc().getElementById("new_list_item");if(E){var N=this._getDoc().body.createTextRange();N.moveToElementText(E);N.collapse(false);N.select();E.id="";}S=false;}}return S;},cmd_insertorderedlist:function(E){return[this.cmd_list("ol")];},cmd_insertunorderedlist:function(E){return[this.cmd_list("ul")];},cmd_fontname:function(H){var E=true,G=this._getSelectedElement();this.currentFont=H;if(G&&G.tagName&&!this._hasSelection()&&!this._isElement(G,"body")&&!this.get("insert")){YAHOO.util.Dom.setStyle(G,"font-family",H);E=false;}else{if(this.get("insert")&&!this._hasSelection()){var F=this._createInsertElement({fontFamily:H});E=false;}}return[E];},cmd_fontsize:function(G){var E=null;if(this.currentElement&&(this.currentElement.length>0)&&(!this._hasSelection())&&(!this.get("insert"))){YAHOO.util.Dom.setStyle(this.currentElement,"fontSize",G);}else{if(!this._isElement(this._getSelectedElement(),"body")){E=this._getSelectedElement();YAHOO.util.Dom.setStyle(E,"fontSize",G);if(this.get("insert")&
|
||
|
}else{R=this._getDoc().body;}}if(R){F=M(G,J);if(this._isElement(R,"body")||this._isElement(R,"html")){if(this._isElement(R,"html")){R=this._getDoc().body;}R.appendChild(F);}else{if(R.nextSibling){R.parentNode.insertBefore(F,R.nextSibling);}else{R.parentNode.appendChild(F);}}this.currentElement[this.currentElement.length]=F;this.currentEvent=null;if(this.browser.webkit){this._getSelection().setBaseAndExtent(F,0,F,0);if(this.browser.webkit3){this._getSelection().collapseToStart();}else{this._getSelection().collapse(true);}}}}else{this._setEditorStyle(true);this._getDoc().execCommand("fontname",false,"yui-tmp");var E=[],P,V=["font","span","i","b","u"];if(!this._isElement(this._getSelectedElement(),"body")){V[V.length]=this._getDoc().getElementsByTagName(this._getSelectedElement().tagName);V[V.length]=this._getDoc().getElementsByTagName(this._getSelectedElement().parentNode.tagName);}for(var K=0;K<V.length;K++){var I=this._getDoc().getElementsByTagName(V[K]);for(var U=0;U<I.length;U++){E[E.length]=I[U];}}for(var S=0;S<E.length;S++){if((YAHOO.util.Dom.getStyle(E[S],"font-family")=="yui-tmp")||(E[S].face&&(E[S].face=="yui-tmp"))){F=M(G,J);F.innerHTML=E[S].innerHTML;if(this._isElement(E[S],"ol")||(this._isElement(E[S],"ul"))){var N=E[S].getElementsByTagName("li")[0];E[S].style.fontFamily="inherit";N.style.fontFamily="inherit";F.innerHTML=N.innerHTML;N.innerHTML="";N.appendChild(F);this.currentElement[this.currentElement.length]=F;}else{if(this._isElement(E[S],"li")){E[S].innerHTML="";E[S].appendChild(F);E[S].style.fontFamily="inherit";this.currentElement[this.currentElement.length]=F;}else{if(E[S].parentNode){E[S].parentNode.replaceChild(F,E[S]);this.currentElement[this.currentElement.length]=F;this.currentEvent=null;if(this.browser.webkit){this._getSelection().setBaseAndExtent(F,0,F,0);if(this.browser.webkit3){this._getSelection().collapseToStart();}else{this._getSelection().collapse(true);}}if(this.browser.ie&&J&&J.fontSize){this._getSelection().empty();}if(this.browser.gecko){this._getSelection().collapseToStart();}}}}}}var T=this.currentElement.length;for(var O=0;O<T;O++){if((O+1)!=T){if(this.currentElement[O]&&this.currentElement[O].nextSibling){if(this._isElement(this.currentElement[O],"br")){this.currentElement[this.currentElement.length]=this.currentElement[O].nextSibling;}}}}}},saveHTML:function(){var F=this.cleanHTML();if(this._textarea){this.get("element").value=F;}else{this.get("element").innerHTML=F;}if(this.get("saveEl")!==this.get("element")){var E=this.get("saveEl");if(D.isString(E)){E=C.get(E);}if(E){if(E.tagName.toLowerCase()==="textarea"){E.value=F;}else{E.innerHTML=F;}}}return F;},setEditorHTML:function(F){var E=this._cleanIncomingHTML(F);this._getDoc().body.innerHTML=E;this.nodeChange();},getEditorHTML:function(){var E=this._getDoc().body;if(E===null){return null;}return this._getDoc().body.innerHTML;},show:function(){if(this.browser.gecko){this._setDesignMode("on");this._focusWindow();}if(this.browser.webkit){var E=this;window.setTimeout(function(){E._setInitialContent.call(E);},10);}if(this.currentWindow){this.closeWindow();}this.get("iframe").setStyle("position","static");this.get("iframe").setStyle("left","");},hide:function(){if(this.currentWindow){this.closeWindow();}if(this._fixNodesTimer){clearTimeout(this._fixNodesTimer);this._fixNodesTimer=null;}if(this._nodeChangeTimer){clearTimeout(this._nodeChangeTimer);this._nodeChangeTimer=null;}this._lastNodeChange=0;this.get("iframe").setStyle("position","absolute");this.get("iframe").setStyle("left","-9999px");},_cleanIncomingHTML:function(E){E=E.replace(/<strong([^>]*)>/gi,"<b$1>");E=E.replace(/<\/strong>/gi,"</b>");E=E.replace(/<embed([^>]*)>/gi,"<YUI_EMBED$1>");E=E.replace(/<\/embed>/gi,"</YUI_EMBED>");E=E.replace(/<em([^>]*)>/gi,"<i$1>");E=E.replace(/<\/em>/gi,"</i>");E=E.replace(/<YUI_EMBED([^>]*)>/gi,"<embed$1>");E=E.replace(/<\/YUI_EMBED>/gi,"</embed>");if(this.get("plainText")){E=E.replace(/\n/g,"<br>").replace(/\r/g,"<br>");E=E.replace(/ /gi," ");E=E.replace(/\t/gi," ");}E=E.replace(/<script([^>]*)>/gi,"<bad>");
|
||
|
G=G.replace(/\/b>/gi,"/span>");G=G.replace(/<i/gi,'<span style="font-style: italic;"');G=G.replace(/\/i>/gi,"/span>");}G=G.replace(/ /gi," ");}else{G=G.replace(/<u/gi,"<u");G=G.replace(/\/u>/gi,"/u>");}G=G.replace(/<ol([^>]*)>/gi,"<ol$1>");G=G.replace(/\/ol>/gi,"/ol>");G=G.replace(/<li/gi,"<li");G=G.replace(/\/li>/gi,"/li>");G=this.filter_safari(G);G=this.filter_internals(G);G=this.filter_all_rgb(G);G=this.post_filter_linebreaks(G,F);if(F=="xhtml"){G=G.replace(/<YUI_IMG([^>]*)>/g,"<img $1 />");G=G.replace(/<YUI_INPUT([^>]*)>/g,"<input $1 />");}else{G=G.replace(/<YUI_IMG([^>]*)>/g,"<img $1>");G=G.replace(/<YUI_INPUT([^>]*)>/g,"<input $1>");}G=G.replace(/<YUI_UL([^>]*)>/g,"<ul$1>");G=G.replace(/<\/YUI_UL>/g,"</ul>");G=this.filter_invalid_lists(G);G=G.replace(/<YUI_BQ([^>]*)>/g,"<blockquote$1>");G=G.replace(/<\/YUI_BQ>/g,"</blockquote>");G=G.replace(/<YUI_EMBED([^>]*)>/g,"<embed$1>");G=G.replace(/<\/YUI_EMBED>/g,"</embed>");G=G.replace(" & ","YUI_AMP");G=G.replace("&","&");G=G.replace("YUI_AMP","&");G=YAHOO.lang.trim(G);if(this.get("removeLineBreaks")){G=G.replace(/\n/g,"").replace(/\r/g,"");G=G.replace(/ /gi," ");}if(G.substring(0,6).toLowerCase()=="<span>"){G=G.substring(6);if(G.substring(G.length-7,G.length).toLowerCase()=="</span>"){G=G.substring(0,G.length-7);}}for(var E in this.invalidHTML){if(YAHOO.lang.hasOwnProperty(this.invalidHTML,E)){if(D.isObject(E)&&E.keepContents){G=G.replace(new RegExp("<"+E+"([^>]*)>(.*?)</"+E+">","gi"),"$1");}else{G=G.replace(new RegExp("<"+E+"([^>]*)>(.*?)</"+E+">","gi"),"");}}}this.fireEvent("cleanHTML",{type:"cleanHTML",target:this,html:G});return G;},filter_invalid_lists:function(E){E=E.replace(/<\/li>\n/gi,"</li>");E=E.replace(/<\/li><ol>/gi,"</li><li><ol>");E=E.replace(/<\/ol>/gi,"</ol></li>");E=E.replace(/<\/ol><\/li>\n/gi,"</ol>\n");E=E.replace(/<\/li><ul>/gi,"</li><li><ul>");E=E.replace(/<\/ul>/gi,"</ul></li>");E=E.replace(/<\/ul><\/li>\n?/gi,"</ul>\n");E=E.replace(/<\/li>/gi,"</li>\n");E=E.replace(/<\/ol>/gi,"</ol>\n");E=E.replace(/<ol>/gi,"<ol>\n");E=E.replace(/<ul>/gi,"<ul>\n");return E;},filter_safari:function(E){if(this.browser.webkit){E=E.replace(/<span class="Apple-tab-span" style="white-space:pre">([^>])<\/span>/gi," ");E=E.replace(/Apple-style-span/gi,"");E=E.replace(/style="line-height: normal;"/gi,"");E=E.replace(/<li><\/li>/gi,"");E=E.replace(/<li> <\/li>/gi,"");E=E.replace(/<li> <\/li>/gi,"");if(this.get("ptags")){E=E.replace(/<div([^>]*)>/g,"<p$1>");E=E.replace(/<\/div>/gi,"</p>");}else{E=E.replace(/<div>/gi,"");E=E.replace(/<\/div>/gi,"<br>");}}return E;},filter_internals:function(E){E=E.replace(/\r/g,"");E=E.replace(/<\/?(body|head|html)[^>]*>/gi,"");E=E.replace(/<YUI_BR><\/li>/gi,"</li>");E=E.replace(/yui-tag-span/gi,"");E=E.replace(/yui-tag/gi,"");E=E.replace(/yui-non/gi,"");E=E.replace(/yui-img/gi,"");E=E.replace(/ tag="span"/gi,"");E=E.replace(/ class=""/gi,"");E=E.replace(/ style=""/gi,"");E=E.replace(/ class=" "/gi,"");E=E.replace(/ class=" "/gi,"");E=E.replace(/ target=""/gi,"");E=E.replace(/ title=""/gi,"");if(this.browser.ie){E=E.replace(/ class= /gi,"");E=E.replace(/ class= >/gi,"");E=E.replace(/_height="([^>])"/gi,"");E=E.replace(/_width="([^>])"/gi,"");}return E;},filter_all_rgb:function(I){var H=new RegExp("rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)","gi");var E=I.match(H);if(D.isArray(E)){for(var G=0;G<E.length;G++){var F=this.filter_rgb(E[G]);I=I.replace(E[G].toString(),F);}}return I;},filter_rgb:function(G){if(G.toLowerCase().indexOf("rgb")!=-1){var J=new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)","gi");var F=G.replace(J,"$1,$2,$3,$4,$5").split(",");if(F.length==5){var I=parseInt(F[1],10).toString(16);var H=parseInt(F[2],10).toString(16);var E=parseInt(F[3],10).toString(16);I=I.length==1?"0"+I:I;H=H.length==1?"0"+H:H;E=E.length==1?"0"+E:E;G="#"+I+H+E;}}return G;},pre_filter_linebreaks:function(F,E){if(this.browser.webkit){F=F.replace(/<br class="khtml-block-placeholder">/gi,"<YUI_BR>");F=F.replace(/<br class="webkit-block-placeholder">/gi,"<YUI_BR>
|
||
|
}};})();YAHOO.register("simpleeditor",YAHOO.widget.SimpleEditor,{version:"2.6.0",build:"1321"});
|