(Experimental) Replace htmlarea with XINHA. Thanks to abdussamad!

This commit is contained in:
Garvin Hicking
2008-09-09 07:52:18 +00:00
parent 7dce38ddbe
commit 7a852ecdc7
903 changed files with 50035 additions and 10204 deletions
+187
View File
@@ -0,0 +1,187 @@
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/modules/GetHtml/DOMwalk.js */
function GetHtmlImplementation(_1){
this.editor=_1;
}
GetHtmlImplementation._pluginInfo={name:"GetHtmlImplementation DOMwalk",origin:"Xinha Core",version:"$LastChangedRevision:961 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),developer:"The Xinha Core Developer Team",developer_url:"$HeadURL:http://svn.xinha.webfactional.com/trunk/modules/GetHtml/DOMwalk.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),sponsor:"",sponsor_url:"",license:"htmlArea"};
Xinha.getHTML=function(_2,_3,_4){
return Xinha.getHTMLWrapper(_2,_3,_4);
};
Xinha.emptyAttributes=" checked disabled ismap readonly nowrap compact declare selected defer multiple noresize noshade ";
Xinha.getHTMLWrapper=function(_5,_6,_7,_8){
var _9="";
if(!_8){
_8="";
}
switch(_5.nodeType){
case 10:
case 6:
case 12:
break;
case 2:
break;
case 4:
_9+=(Xinha.is_ie?("\n"+_8):"")+"<![CDATA["+_5.data+"]]>";
break;
case 5:
_9+="&"+_5.nodeValue+";";
break;
case 7:
_9+=(Xinha.is_ie?("\n"+_8):"")+"<"+"?"+_5.target+" "+_5.data+" ?>";
break;
case 1:
case 11:
case 9:
var _a;
var i;
var _c=(_5.nodeType==1)?_5.tagName.toLowerCase():"";
if((_c=="script"||_c=="noscript")&&_7.config.stripScripts){
break;
}
if(_6){
_6=!(_7.config.htmlRemoveTags&&_7.config.htmlRemoveTags.test(_c));
}
if(Xinha.is_ie&&_c=="head"){
if(_6){
_9+=(Xinha.is_ie?("\n"+_8):"")+"<head>";
}
var _d=RegExp.multiline;
RegExp.multiline=true;
var _e=_5.innerHTML.replace(Xinha.RE_tagName,function(_f,p1,p2){
return p1+p2.toLowerCase();
}).replace(/\s*=\s*(([^'"][^>\s]*)([>\s])|"([^"]+)"|'([^']+)')/g,"=\"$2$4$5\"$3").replace(/<(link|meta)((\s*\S*="[^"]*")*)>/g,"<$1$2 />");
RegExp.multiline=_d;
_9+=_e+"\n";
if(_6){
_9+=(Xinha.is_ie?("\n"+_8):"")+"</head>";
}
break;
}else{
if(_6){
_a=(!(_5.hasChildNodes()||Xinha.needsClosingTag(_5)));
_9+=((Xinha.isBlockElement(_5))?("\n"+_8):"")+"<"+_5.tagName.toLowerCase();
var _12=_5.attributes;
for(i=0;i<_12.length;++i){
var a=_12.item(i);
if(typeof a.nodeValue=="object"){
continue;
}
if(_5.tagName.toLowerCase()=="input"&&_5.type.toLowerCase()=="checkbox"&&a.nodeName.toLowerCase()=="value"&&a.nodeValue.toLowerCase()=="on"){
continue;
}
if(!a.specified&&!(_5.tagName.toLowerCase().match(/input|option/)&&a.nodeName=="value")&&!(_5.tagName.toLowerCase().match(/area/)&&a.nodeName.match(/shape|coords/i))){
continue;
}
var _14=a.nodeName.toLowerCase();
if(/_moz_editor_bogus_node/.test(_14)||(_14=="class"&&a.nodeValue=="webkit-block-placeholder")){
_9="";
break;
}
if(/(_moz)|(contenteditable)|(_msh)/.test(_14)){
continue;
}
var _15;
if(Xinha.emptyAttributes.indexOf(" "+_14+" ")!=-1){
_15=_14;
}else{
if(_14!="style"){
if(typeof _5[a.nodeName]!="undefined"&&_14!="href"&&_14!="src"&&!(/^on/.test(_14))){
_15=_5[a.nodeName];
}else{
_15=a.nodeValue;
if(_14=="class"){
_15=_15.replace(/Apple-style-span/,"");
if(!_15){
continue;
}
}
if(Xinha.is_ie&&(_14=="href"||_14=="src")){
_15=_7.stripBaseURL(_15);
}
if(_7.config.only7BitPrintablesInURLs&&(_14=="href"||_14=="src")){
_15=_15.replace(/([^!-~]+)/g,function(_16){
return escape(_16);
});
}
}
}else{
if(!Xinha.is_ie){
_15=_5.style.cssText.replace(/rgb\(.*?\)/ig,function(rgb){
return Xinha._colorToRgb(rgb);
});
}
}
}
if(/^(_moz)?$/.test(_15)){
continue;
}
_9+=" "+_14+"=\""+Xinha.htmlEncode(_15)+"\"";
}
if(Xinha.is_ie&&_5.style.cssText){
_9+=" style=\""+_5.style.cssText.toLowerCase()+"\"";
}
if(Xinha.is_ie&&_5.tagName.toLowerCase()=="option"&&_5.selected){
_9+=" selected=\"selected\"";
}
if(_9!==""){
if(_a&&_c=="p"){
_9+=">&nbsp;</p>";
}else{
if(_a){
_9+=" />";
}else{
_9+=">";
}
}
}
}
}
var _18=false;
if(_c=="script"||_c=="noscript"){
if(!_7.config.stripScripts){
if(Xinha.is_ie){
var _19="\n"+_5.innerHTML.replace(/^[\n\r]*/,"").replace(/\s+$/,"")+"\n"+_8;
}else{
var _19=(_5.hasChildNodes())?_5.firstChild.nodeValue:"";
}
_9+=_19+"</"+_c+">"+((Xinha.is_ie)?"\n":"");
}
}else{
if(_c=="pre"){
_9+=((Xinha.is_ie)?"\n":"")+_5.innerHTML.replace(/<br>/g,"\n")+"</"+_c+">";
}else{
for(i=_5.firstChild;i;i=i.nextSibling){
if(!_18&&i.nodeType==1&&Xinha.isBlockElement(i)){
_18=true;
}
_9+=Xinha.getHTMLWrapper(i,true,_7,_8+" ");
}
if(_6&&!_a){
_9+=(((Xinha.isBlockElement(_5)&&_18)||_c=="head"||_c=="html")?("\n"+_8):"")+"</"+_5.tagName.toLowerCase()+">";
}
}
}
break;
case 3:
if(/^script|noscript|style$/i.test(_5.parentNode.tagName)){
_9=_5.data;
}else{
if(_5.data.trim()==""){
if(_5.data){
_9=" ";
}else{
_9="";
}
}else{
_9=Xinha.htmlEncode(_5.data);
}
}
break;
case 8:
_9="<!--"+_5.data+"-->";
break;
}
return _9;
};
@@ -0,0 +1,151 @@
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/modules/GetHtml/TransformInnerHTML.js */
function GetHtmlImplementation(_1){
this.editor=_1;
}
GetHtmlImplementation._pluginInfo={name:"GetHtmlImplementation TransformInnerHTML",version:"1.0",developer:"Nelson Bright",developer_url:"http://www.brightworkweb.com/",sponsor:"",sponsor_url:"",license:"htmlArea"};
Xinha.RegExpCache=[/<\s*\/?([^\s\/>]+)[\s*\/>]/gi,/(\s+)_moz[^=>]*=[^\s>]*/gi,/\s*=\s*(([^'"][^>\s]*)([>\s])|"([^"]+)"|'([^']+)')/g,/\/>/g,/<(br|hr|img|input|link|meta|param|embed|area)((\s*\S*="[^"]*")*)>/g,/(<\w+\s+(\w*="[^"]*"\s+)*)(checked|compact|declare|defer|disabled|ismap|multiple|no(href|resize|shade|wrap)|readonly|selected)([\s>])/gi,/(="[^']*)'([^'"]*")/,/&(?=(?!(#[0-9]{2,5};|[a-zA-Z0-9]{2,6};|#x[0-9a-fA-F]{2,4};))[^<]*>)/g,/<\s+/g,/\s+(\/)?>/g,/\s{2,}/g,/\s+([^=\s]+)((="[^"]+")|([\s>]))/g,/\s+contenteditable(=[^>\s\/]*)?/gi,/((href|src)=")([^\s]*)"/g,/<\/?(div|p|h[1-6]|table|tr|td|th|ul|ol|li|blockquote|object|br|hr|img|embed|param|pre|script|html|head|body|meta|link|title|area|input|form|textarea|select|option)[^>]*>/g,/<\/(div|p|h[1-6]|table|tr|ul|ol|blockquote|object|html|head|body|script|form|select)( [^>]*)?>/g,/<(div|p|h[1-6]|table|tr|ul|ol|blockquote|object|html|head|body|script|form|select)( [^>]*)?>/g,/<(td|th|li|option|br|hr|embed|param|pre|meta|link|title|area|input|textarea)[^>]*>/g,/(^|<\/(pre|script)>)(\s|[^\s])*?(<(pre|script)[^>]*>|$)/g,/(<pre[^>]*>)([\s\S])*?(<\/pre>)/g,/(^|<!--[\s\S]*?-->)([\s\S]*?)(?=<!--[\s\S]*?-->|$)/g,/\S*=""/g,/<!--[\s\S]*?-->|<\?[\s\S]*?\?>|<\/?\w[^>]*>/g,/(^|<\/script>)[\s\S]*?(<script[^>]*>|$)/g];
if(typeof RegExp.prototype.compile=="function"){
for(var i=0;i<Xinha.RegExpCache.length;i++){
Xinha.RegExpCache[i]=new RegExp().compile(Xinha.RegExpCache[i]);
}
}
Xinha.prototype.cleanHTML=function(_2){
var c=Xinha.RegExpCache;
_2=_2.replace(c[0],function(_4){
return _4.toLowerCase();
}).replace(c[1]," ").replace(c[12]," ").replace(c[2],"=\"$2$4$5\"$3").replace(c[21]," ").replace(c[11],function(_5,p1,p2){
return " "+p1.toLowerCase()+p2;
}).replace(c[3],">").replace(c[9],"$1>").replace(c[5],"$1$3=\"$3\"$5").replace(c[4],"<$1$2 />").replace(c[6],"$1$2").replace(c[7],"&amp;").replace(c[8],"<").replace(c[10]," ");
if(Xinha.is_ie&&c[13].test(_2)){
_2=_2.replace(c[13],"$1"+this.stripBaseURL(RegExp.$3)+"\"");
}
if(this.config.only7BitPrintablesInURLs){
if(Xinha.is_ie){
c[13].test(_2);
}
if(c[13].test(_2)){
try{
_2=_2.replace(c[13],"$1"+decodeURIComponent(RegExp.$3).replace(/([^!-~]+)/g,function(_8){
return escape(_8);
})+"\"");
}
catch(e){
_2=_2.replace(c[13],"$1"+RegExp.$3.replace(/([^!-~]+)/g,function(_9){
return escape(_9);
})+"\"");
}
}
}
return _2;
};
Xinha.indent=function(s,_b){
Xinha.__nindent=0;
Xinha.__sindent="";
Xinha.__sindentChar=(typeof _b=="undefined")?" ":_b;
var c=Xinha.RegExpCache;
if(Xinha.is_gecko){
s=s.replace(c[19],function(_d){
return _d.replace(/<br \/>/g,"\n");
});
}
s=s.replace(c[18],function(_e){
_e=_e.replace(c[20],function(st,$1,$2){
string=$2.replace(/[\n\r]/gi," ").replace(/\s+/gi," ").replace(c[14],function(str){
if(str.match(c[16])){
var s="\n"+Xinha.__sindent+str;
Xinha.__sindent+=Xinha.__sindentChar;
++Xinha.__nindent;
return s;
}else{
if(str.match(c[15])){
--Xinha.__nindent;
Xinha.__sindent="";
for(var i=Xinha.__nindent;i>0;--i){
Xinha.__sindent+=Xinha.__sindentChar;
}
return "\n"+Xinha.__sindent+str;
}else{
if(str.match(c[17])){
return "\n"+Xinha.__sindent+str;
}
}
}
return str;
});
return $1+string;
});
return _e;
});
s=s.replace(/^\s*/,"").replace(/ +\n/g,"\n").replace(/[\r\n]+(\s+)<\/script>/g,"\n$1</script>");
return s;
};
Xinha.getHTML=function(_15,_16,_17){
var _18="";
var c=Xinha.RegExpCache;
if(_15.nodeType==11){
var div=document.createElement("div");
var _1b=_15.insertBefore(div,_15.firstChild);
for(j=_1b.nextSibling;j;j=j.nextSibling){
_1b.appendChild(j.cloneNode(true));
}
_18+=_1b.innerHTML.replace(c[23],function(_1c){
_1c=_1c.replace(c[22],function(tag){
if(/^<[!\?]/.test(tag)){
return tag;
}else{
return _17.cleanHTML(tag);
}
});
return _1c;
});
}else{
var _1e=(_15.nodeType==1)?_15.tagName.toLowerCase():"";
if(_16){
_18+="<"+_1e;
var _1f=_15.attributes;
for(i=0;i<_1f.length;++i){
var a=_1f.item(i);
if(!a.specified){
continue;
}
var _21=a.nodeName.toLowerCase();
var _22=a.nodeValue;
_18+=" "+_21+"=\""+_22+"\"";
}
_18+=">";
}
if(_1e=="html"){
innerhtml=_17._doc.documentElement.innerHTML;
}else{
innerhtml=_15.innerHTML;
}
_18+=innerhtml.replace(c[23],function(_23){
_23=_23.replace(c[22],function(tag){
if(/^<[!\?]/.test(tag)){
return tag;
}else{
if(!(_17.config.htmlRemoveTags&&_17.config.htmlRemoveTags.test(tag.replace(/<([^\s>\/]+)/,"$1")))){
return _17.cleanHTML(tag);
}else{
return "";
}
}
});
return _23;
});
if(Xinha.is_ie){
_18=_18.replace(/<li( [^>]*)?>/g,"</li><li$1>").replace(/(<(ul|ol)[^>]*>)[\s\n]*<\/li>/g,"$1").replace(/<\/li>([\s\n]*<\/li>)+/g,"</li>");
}
if(Xinha.is_gecko){
_18=_18.replace(/<br \/>\n$/,"");
}
if(_16){
_18+="</"+_1e+">";
}
_18=Xinha.indent(_18);
}
return _18;
};
+18
View File
@@ -0,0 +1,18 @@
// I18N constants
//
// LANG: "pt_br", ENCODING: UTF-8
// Portuguese Brazilian Translation
//
// Author: Marcio Barbosa, <marcio@mpg.com.br>
// MSN: tomarshall@msn.com - ICQ: 69419933
// Site: http://www.mpg.com.br
//
// Last revision: 06 september 2007
// Please don´t remove this information
// If you modify any source, please insert a comment with your name and e-mail
//
// Distributed under the same terms as HTMLArea itself.
// This notice MUST stay intact for use (see license.txt).
{
"Your Document is not well formed. Check JavaScript console for details.": "Seu documento não está formatado corretamente. Verifique os detalhes no console do Javascript."
}