(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
+624
View File
@@ -0,0 +1,624 @@
/* 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/ColorPicker/ColorPicker.js */
ColorPicker._pluginInfo={name:"colorPicker",version:"$LastChangedRevision:998 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),developer:"James Sleeman",developer_url:"http://www.gogo.co.nz/",c_owner:"Gogo Internet Services",license:"htmlArea",sponsor:"Gogo Internet Services",sponsor_url:"http://www.gogo.co.nz/"};
function ColorPicker(){
}
try{
if(window.opener&&window.opener.Xinha){
var openerColorPicker=window.opener.Xinha.colorPicker;
Xinha._addEvent(window,"unload",function(){
Xinha.colorPicker=openerColorPicker;
});
}
}
catch(e){
}
Xinha.colorPicker=function(_1){
if(Xinha.colorPicker.savedColors.length===0){
Xinha.colorPicker.loadColors();
}
this.is_ie_6=(Xinha.is_ie&&Xinha.ie_version<7);
var _2=this;
var _3=false;
var _4=false;
var _5=0;
var _6=0;
this.callback=_1.callback?_1.callback:function(_7){
alert("You picked "+_7);
};
this.websafe=_1.websafe?_1.websafe:false;
this.savecolors=_1.savecolors?_1.savecolors:20;
this.cellsize=parseInt(_1.cellsize?_1.cellsize:"10px",10);
this.side=_1.granularity?_1.granularity:18;
var _8=this.side+1;
var _9=this.side-1;
this.value=1;
this.saved_cells=null;
this.table=document.createElement("table");
this.table.className="dialog";
this.table.cellSpacing=this.table.cellPadding=0;
this.table.onmouseup=function(){
_3=false;
_4=false;
};
this.tbody=document.createElement("tbody");
this.table.appendChild(this.tbody);
this.table.style.border="1px solid WindowFrame";
this.table.style.zIndex="1050";
var tr=document.createElement("tr");
var td=document.createElement("td");
td.colSpan=this.side;
td.className="title";
td.style.fontFamily="small-caption,caption,sans-serif";
td.style.fontSize="x-small";
td.unselectable="on";
td.style.MozUserSelect="none";
td.style.cursor="default";
td.appendChild(document.createTextNode(Xinha._lc("Click a color...")));
td.style.borderBottom="1px solid WindowFrame";
tr.appendChild(td);
td=null;
var td=document.createElement("td");
td.className="title";
td.colSpan=2;
td.style.fontFamily="Tahoma,Verdana,sans-serif";
td.style.borderBottom="1px solid WindowFrame";
td.style.paddingRight="0";
tr.appendChild(td);
var _c=document.createElement("div");
_c.title=Xinha._lc("Close");
_c.className="buttonColor";
_c.style.height="11px";
_c.style.width="11px";
_c.style.cursor="pointer";
_c.onclick=function(){
_2.close();
};
_c.appendChild(document.createTextNode("\xd7"));
_c.align="center";
_c.style.verticalAlign="top";
_c.style.position="relative";
_c.style.cssFloat="right";
_c.style.styleFloat="right";
_c.style.padding="0";
_c.style.margin="2px";
_c.style.backgroundColor="transparent";
_c.style.fontSize="11px";
if(!Xinha.is_ie){
_c.style.lineHeight="9px";
}
_c.style.letterSpacing="0";
td.appendChild(_c);
this.tbody.appendChild(tr);
_c=tr=td=null;
this.constrain_cb=document.createElement("input");
this.constrain_cb.type="checkbox";
this.chosenColor=document.createElement("input");
this.chosenColor.type="text";
this.chosenColor.maxLength=7;
this.chosenColor.style.width="50px";
this.chosenColor.style.fontSize="11px";
this.chosenColor.onchange=function(){
if(/#[0-9a-f]{6,6}/i.test(this.value)){
_2.backSample.style.backgroundColor=this.value;
_2.foreSample.style.color=this.value;
}
};
this.backSample=document.createElement("div");
this.backSample.appendChild(document.createTextNode("\xa0"));
this.backSample.style.fontWeight="bold";
this.backSample.style.fontFamily="small-caption,caption,sans-serif";
this.backSample.fontSize="x-small";
this.foreSample=document.createElement("div");
this.foreSample.appendChild(document.createTextNode(Xinha._lc("Sample")));
this.foreSample.style.fontWeight="bold";
this.foreSample.style.fontFamily="small-caption,caption,sans-serif";
this.foreSample.fontSize="x-small";
function toHex(_d){
var h=_d.toString(16);
if(h.length<2){
h="0"+h;
}
return h;
}
function tupleToColor(_f){
return "#"+toHex(_f.red)+toHex(_f.green)+toHex(_f.blue);
}
function nearestPowerOf(num,_11){
return Math.round(Math.round(num/_11)*_11);
}
function doubleHexDec(dec){
return parseInt(dec.toString(16)+dec.toString(16),16);
}
function rgbToWebsafe(_13){
_13.red=doubleHexDec(nearestPowerOf(parseInt(toHex(_13.red).charAt(0),16),3));
_13.blue=doubleHexDec(nearestPowerOf(parseInt(toHex(_13.blue).charAt(0),16),3));
_13.green=doubleHexDec(nearestPowerOf(parseInt(toHex(_13.green).charAt(0),16),3));
return _13;
}
function hsvToRGB(h,s,v){
var _17;
if(s===0){
_17={red:v,green:v,blue:v};
}else{
h/=60;
var i=Math.floor(h);
var f=h-i;
var p=v*(1-s);
var q=v*(1-s*f);
var t=v*(1-s*(1-f));
switch(i){
case 0:
_17={red:v,green:t,blue:p};
break;
case 1:
_17={red:q,green:v,blue:p};
break;
case 2:
_17={red:p,green:v,blue:t};
break;
case 3:
_17={red:p,green:q,blue:v};
break;
case 4:
_17={red:t,green:p,blue:v};
break;
default:
_17={red:v,green:p,blue:q};
break;
}
}
_17.red=Math.ceil(_17.red*255);
_17.green=Math.ceil(_17.green*255);
_17.blue=Math.ceil(_17.blue*255);
return _17;
}
var _1d=this;
function closeOnBodyClick(ev){
ev=ev?ev:window.event;
el=ev.target?ev.target:ev.srcElement;
do{
if(el==_1d.table){
return;
}
}while(el=el.parentNode);
_1d.close();
}
this.open=function(_1f,_20,_21){
this.table.style.display="";
this.pick_color();
if(_21&&/#[0-9a-f]{6,6}/i.test(_21)){
this.chosenColor.value=_21;
this.backSample.style.backgroundColor=_21;
this.foreSample.style.color=_21;
}
Xinha._addEvent(document.body,"mousedown",closeOnBodyClick);
this.table.style.position="absolute";
var e=_20;
var top=0;
var _24=0;
do{
if(e.style.position=="fixed"){
this.table.style.position="fixed";
}
top+=e.offsetTop;
_24+=e.offsetLeft;
e=e.offsetParent;
}while(e);
var x,y;
if(/top/.test(_1f)||(top+this.table.offsetHeight>document.body.offsetHeight)){
if(top-this.table.offsetHeight>0){
this.table.style.top=(top-this.table.offsetHeight)+"px";
}else{
this.table.style.top=0;
}
}else{
this.table.style.top=(top+_20.offsetHeight)+"px";
}
if(/left/.test(_1f)||(_24+this.table.offsetWidth>document.body.offsetWidth)){
if(_24-(this.table.offsetWidth-_20.offsetWidth)>0){
this.table.style.left=(_24-(this.table.offsetWidth-_20.offsetWidth))+"px";
}else{
this.table.style.left=0;
}
}else{
this.table.style.left=_24+"px";
}
if(this.is_ie_6){
this.iframe.style.top=this.table.style.top;
this.iframe.style.left=this.table.style.left;
}
};
function pickCell(_26){
_2.chosenColor.value=_26.colorCode;
_2.backSample.style.backgroundColor=_26.colorCode;
_2.foreSample.style.color=_26.colorCode;
if((_26.hue>=195&&_26.saturation>0.5)||(_26.hue===0&&_26.saturation===0&&_26.value<0.5)||(_26.hue!==0&&_2.value<0.75)){
_26.style.borderColor="#fff";
}else{
_26.style.borderColor="#000";
}
_5=_26.thisrow;
_6=_26.thiscol;
}
function pickValue(_27){
if(_2.value<0.5){
_27.style.borderColor="#fff";
}else{
_27.style.borderColor="#000";
}
_9=_27.thisrow;
_8=_27.thiscol;
_2.chosenColor.value=_2.saved_cells[_5][_6].colorCode;
_2.backSample.style.backgroundColor=_2.saved_cells[_5][_6].colorCode;
_2.foreSample.style.color=_2.saved_cells[_5][_6].colorCode;
}
function unpickCell(row,col){
_2.saved_cells[row][col].style.borderColor=_2.saved_cells[row][col].colorCode;
}
this.pick_color=function(){
var _2a,cols;
var _2b=this;
var _2c=359/(this.side);
var _2d=1/(this.side-1);
var _2e=1/(this.side-1);
var _2f=this.constrain_cb.checked;
if(this.saved_cells===null){
this.saved_cells=[];
for(var row=0;row<this.side;row++){
var tr=document.createElement("tr");
this.saved_cells[row]=[];
for(var col=0;col<this.side;col++){
var td=document.createElement("td");
if(_2f){
td.colorCode=tupleToColor(rgbToWebsafe(hsvToRGB(_2c*row,_2d*col,this.value)));
}else{
td.colorCode=tupleToColor(hsvToRGB(_2c*row,_2d*col,this.value));
}
this.saved_cells[row][col]=td;
td.style.height=this.cellsize+"px";
td.style.width=this.cellsize-2+"px";
td.style.borderWidth="1px";
td.style.borderStyle="solid";
td.style.borderColor=td.colorCode;
td.style.backgroundColor=td.colorCode;
if(row==_5&&col==_6){
td.style.borderColor="#000";
this.chosenColor.value=td.colorCode;
this.backSample.style.backgroundColor=td.colorCode;
this.foreSample.style.color=td.colorCode;
}
td.hue=_2c*row;
td.saturation=_2d*col;
td.thisrow=row;
td.thiscol=col;
td.onmousedown=function(){
_3=true;
_2b.saved_cells[_5][_6].style.borderColor=_2b.saved_cells[_5][_6].colorCode;
pickCell(this);
};
td.onmouseover=function(){
if(_3){
pickCell(this);
}
};
td.onmouseout=function(){
if(_3){
this.style.borderColor=this.colorCode;
}
};
td.ondblclick=function(){
Xinha.colorPicker.remember(this.colorCode,_2b.savecolors);
_2b.callback(this.colorCode);
_2b.close();
};
td.appendChild(document.createTextNode(" "));
td.style.cursor="pointer";
tr.appendChild(td);
td=null;
}
var td=document.createElement("td");
td.appendChild(document.createTextNode(" "));
td.style.width=this.cellsize+"px";
tr.appendChild(td);
td=null;
var td=document.createElement("td");
this.saved_cells[row][col+1]=td;
td.appendChild(document.createTextNode(" "));
td.style.width=this.cellsize-2+"px";
td.style.height=this.cellsize+"px";
td.constrainedColorCode=tupleToColor(rgbToWebsafe(hsvToRGB(0,0,_2e*row)));
td.style.backgroundColor=td.colorCode=tupleToColor(hsvToRGB(0,0,_2e*row));
td.style.borderWidth="1px";
td.style.borderStyle="solid";
td.style.borderColor=td.colorCode;
if(row==_9){
td.style.borderColor="black";
}
td.hue=_2c*row;
td.saturation=_2d*col;
td.hsv_value=_2e*row;
td.thisrow=row;
td.thiscol=col+1;
td.onmousedown=function(){
_4=true;
_2b.saved_cells[_9][_8].style.borderColor=_2b.saved_cells[_9][_8].colorCode;
_2b.value=this.hsv_value;
_2b.pick_color();
pickValue(this);
};
td.onmouseover=function(){
if(_4){
_2b.value=this.hsv_value;
_2b.pick_color();
pickValue(this);
}
};
td.onmouseout=function(){
if(_4){
this.style.borderColor=this.colorCode;
}
};
td.style.cursor="pointer";
tr.appendChild(td);
td=null;
this.tbody.appendChild(tr);
tr=null;
}
var tr=document.createElement("tr");
this.saved_cells[row]=[];
for(var col=0;col<this.side;col++){
var td=document.createElement("td");
if(_2f){
td.colorCode=tupleToColor(rgbToWebsafe(hsvToRGB(0,0,_2e*(this.side-col-1))));
}else{
td.colorCode=tupleToColor(hsvToRGB(0,0,_2e*(this.side-col-1)));
}
this.saved_cells[row][col]=td;
td.style.height=this.cellsize+"px";
td.style.width=this.cellsize-2+"px";
td.style.borderWidth="1px";
td.style.borderStyle="solid";
td.style.borderColor=td.colorCode;
td.style.backgroundColor=td.colorCode;
td.hue=0;
td.saturation=0;
td.value=_2e*(this.side-col-1);
td.thisrow=row;
td.thiscol=col;
td.onmousedown=function(){
_3=true;
_2b.saved_cells[_5][_6].style.borderColor=_2b.saved_cells[_5][_6].colorCode;
pickCell(this);
};
td.onmouseover=function(){
if(_3){
pickCell(this);
}
};
td.onmouseout=function(){
if(_3){
this.style.borderColor=this.colorCode;
}
};
td.ondblclick=function(){
Xinha.colorPicker.remember(this.colorCode,_2b.savecolors);
_2b.callback(this.colorCode);
_2b.close();
};
td.appendChild(document.createTextNode(" "));
td.style.cursor="pointer";
tr.appendChild(td);
td=null;
}
this.tbody.appendChild(tr);
tr=null;
var tr=document.createElement("tr");
var td=document.createElement("td");
tr.appendChild(td);
td.colSpan=this.side+2;
td.style.padding="3px";
if(this.websafe){
var div=document.createElement("div");
var _35=document.createElement("label");
_35.appendChild(document.createTextNode(Xinha._lc("Web Safe: ")));
this.constrain_cb.onclick=function(){
_2b.pick_color();
};
_35.appendChild(this.constrain_cb);
_35.style.fontFamily="small-caption,caption,sans-serif";
_35.style.fontSize="x-small";
div.appendChild(_35);
td.appendChild(div);
div=null;
}
var div=document.createElement("div");
var _35=document.createElement("label");
_35.style.fontFamily="small-caption,caption,sans-serif";
_35.style.fontSize="x-small";
_35.appendChild(document.createTextNode(Xinha._lc("Color: ")));
_35.appendChild(this.chosenColor);
div.appendChild(_35);
var but=document.createElement("span");
but.className="buttonColor ";
but.style.fontSize="13px";
but.style.width="24px";
but.style.marginLeft="2px";
but.style.padding="0px 4px";
but.style.cursor="pointer";
but.onclick=function(){
Xinha.colorPicker.remember(_2b.chosenColor.value,_2b.savecolors);
_2b.callback(_2b.chosenColor.value);
_2b.close();
};
but.appendChild(document.createTextNode(Xinha._lc("OK")));
but.align="center";
div.appendChild(but);
td.appendChild(div);
var _37=document.createElement("table");
_37.style.width="100%";
var _38=document.createElement("tbody");
_37.appendChild(_38);
var _39=document.createElement("tr");
_38.appendChild(_39);
var _3a=document.createElement("td");
_39.appendChild(_3a);
_3a.appendChild(this.backSample);
_3a.style.width="50%";
var _3b=document.createElement("td");
_39.appendChild(_3b);
_3b.appendChild(this.foreSample);
_3b.style.width="50%";
td.appendChild(_37);
var _3c=document.createElement("div");
_3c.style.clear="both";
function createSavedColors(_3d){
var _3e=Xinha.is_ie;
var div=document.createElement("div");
div.style.width=_2b.cellsize+"px";
div.style.height=_2b.cellsize+"px";
div.style.margin="1px";
div.style.border="1px solid black";
div.style.cursor="pointer";
div.style.backgroundColor=_3d;
div.style[_3e?"styleFloat":"cssFloat"]="left";
div.ondblclick=function(){
_2b.callback(_3d);
_2b.close();
};
div.onclick=function(){
_2b.chosenColor.value=_3d;
_2b.backSample.style.backgroundColor=_3d;
_2b.foreSample.style.color=_3d;
};
_3c.appendChild(div);
}
for(var _40=0;_40<Xinha.colorPicker.savedColors.length;_40++){
createSavedColors(Xinha.colorPicker.savedColors[_40]);
}
td.appendChild(_3c);
this.tbody.appendChild(tr);
document.body.appendChild(this.table);
if(this.is_ie_6){
if(!this.iframe){
this.iframe=document.createElement("iframe");
this.iframe.frameBorder=0;
this.iframe.src="javascript:;";
this.iframe.style.position="absolute";
this.iframe.style.width=this.table.offsetWidth;
this.iframe.style.height=this.table.offsetHeight;
document.body.insertBefore(this.iframe,this.table);
}
this.iframe.style.display="";
}
}else{
for(var row=0;row<this.side;row++){
for(var col=0;col<this.side;col++){
if(_2f){
this.saved_cells[row][col].colorCode=tupleToColor(rgbToWebsafe(hsvToRGB(_2c*row,_2d*col,this.value)));
}else{
this.saved_cells[row][col].colorCode=tupleToColor(hsvToRGB(_2c*row,_2d*col,this.value));
}
this.saved_cells[row][col].style.backgroundColor=this.saved_cells[row][col].colorCode;
this.saved_cells[row][col].style.borderColor=this.saved_cells[row][col].colorCode;
}
}
var _41=this.saved_cells[_5][_6];
this.chosenColor.value=_41.colorCode;
this.backSample.style.backgroundColor=_41.colorCode;
this.foreSample.style.color=_41.colorCode;
if((_41.hue>=195&&_41.saturation>0.5)||(_41.hue===0&&_41.saturation===0&&_41.value<0.5)||(_41.hue!==0&&_2b.value<0.75)){
_41.style.borderColor="#fff";
}else{
_41.style.borderColor="#000";
}
}
};
this.close=function(){
Xinha._removeEvent(document.body,"mousedown",closeOnBodyClick);
this.table.style.display="none";
if(this.is_ie_6){
if(this.iframe){
this.iframe.style.display="none";
}
}
};
};
Xinha.colorPicker.savedColors=[];
Xinha.colorPicker.remember=function(_42,_43){
for(var i=Xinha.colorPicker.savedColors.length;i--;){
if(Xinha.colorPicker.savedColors[i]==_42){
return false;
}
}
Xinha.colorPicker.savedColors.splice(0,0,_42);
Xinha.colorPicker.savedColors=Xinha.colorPicker.savedColors.slice(0,_43);
var _45=new Date();
_45.setMonth(_45.getMonth()+1);
document.cookie="XinhaColorPicker="+escape(Xinha.colorPicker.savedColors.join("-"))+";expires="+_45.toGMTString();
return true;
};
Xinha.colorPicker.loadColors=function(){
var _46=document.cookie.indexOf("XinhaColorPicker");
if(_46!=-1){
var _47=(document.cookie.indexOf("=",_46)+1);
var end=document.cookie.indexOf(";",_46);
if(end==-1){
end=document.cookie.length;
}
Xinha.colorPicker.savedColors=unescape(document.cookie.substring(_47,end)).split("-");
}
};
Xinha.colorPicker.InputBinding=function(_49,_4a){
var doc=_49.ownerDocument;
var _4c=doc.createElement("span");
_4c.className="buttonColor";
var _4d=this.chooser=doc.createElement("span");
_4d.className="chooser";
if(_49.value){
_4d.style.backgroundColor=_49.value;
}
_4d.onmouseover=function(){
_4d.className="chooser buttonColor-hilite";
};
_4d.onmouseout=function(){
_4d.className="chooser";
};
_4d.appendChild(doc.createTextNode("\xa0"));
_4c.appendChild(_4d);
var _4e=doc.createElement("span");
_4e.className="nocolor";
_4e.onmouseover=function(){
_4e.className="nocolor buttonColor-hilite";
_4e.style.color="#f00";
};
_4e.onmouseout=function(){
_4e.className="nocolor";
_4e.style.color="#000";
};
_4e.onclick=function(){
_49.value="";
_4d.style.backgroundColor="";
};
_4e.appendChild(doc.createTextNode("\xd7"));
_4c.appendChild(_4e);
_49.parentNode.insertBefore(_4c,_49.nextSibling);
Xinha._addEvent(_49,"change",function(){
_4d.style.backgroundColor=this.value;
});
_4a=(_4a)?Xinha.cloneObject(_4a):{cellsize:"5px"};
_4a.callback=(_4a.callback)?_4a.callback:function(_4f){
_4d.style.backgroundColor=_4f;
_49.value=_4f;
};
_4d.onclick=function(){
var _50=new Xinha.colorPicker(_4a);
_50.open("",_4d,_49.value);
};
Xinha.freeLater(this,"chooser");
};
Xinha.colorPicker.InputBinding.prototype.setColor=function(_51){
this.chooser.style.backgroundColor=_51;
};
@@ -0,0 +1,22 @@
// 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).
{
"Click a color...": "Selecione uma côr...",
"Close": "Fechar",
"Color: ": "Côr:",
"Sample": "Exemplo",
"Web Safe: ": "Web Segura:"
}
+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).
{
"You need to select some text before creating a link": "Você precisa selecionar um texto antes de criar um link"
}
+136
View File
@@ -0,0 +1,136 @@
<html>
<head>
<title>Insert/Modify Link</title>
<script type="text/javascript" src="../../popups/popup.js"></script>
<link rel="stylesheet" type="text/css" href="../../popups/popup.css" />
<script type="text/javascript">
window.resizeTo(400, 200);
Xinha = window.opener.Xinha;
function i18n(str) {
return (Xinha._lc(str, 'Xinha'));
}
function onTargetChanged() {
var f = document.getElementById("f_other_target");
if (this.value == "_other") {
f.style.visibility = "visible";
f.select();
f.focus();
} else f.style.visibility = "hidden";
}
function Init() {
__dlg_translate('Xinha');
__dlg_init();
// Make sure the translated string appears in the drop down. (for gecko)
document.getElementById("f_target").selectedIndex = 1;
document.getElementById("f_target").selectedIndex = 0;
var param = window.dialogArguments;
var target_select = document.getElementById("f_target");
var use_target = true;
if (param) {
if ( typeof param["f_usetarget"] != "undefined" ) {
use_target = param["f_usetarget"];
}
if ( typeof param["f_href"] != "undefined" ) {
document.getElementById("f_href").value = param["f_href"];
document.getElementById("f_title").value = param["f_title"];
comboSelectValue(target_select, param["f_target"]);
if (target_select.value != param.f_target) {
var opt = document.createElement("option");
opt.value = param.f_target;
opt.innerHTML = opt.value;
target_select.appendChild(opt);
opt.selected = true;
}
}
}
if (! use_target) {
document.getElementById("f_target_label").style.visibility = "hidden";
document.getElementById("f_target").style.visibility = "hidden";
document.getElementById("f_other_target").style.visibility = "hidden";
}
var opt = document.createElement("option");
opt.value = "_other";
opt.innerHTML = i18n("Other");
target_select.appendChild(opt);
target_select.onchange = onTargetChanged;
document.getElementById("f_href").focus();
document.getElementById("f_href").select();
}
function onOK() {
var required = {
// f_href shouldn't be required or otherwise removing the link by entering an empty
// url isn't possible anymore.
// "f_href": i18n("You must enter the URL where this link points to")
};
for (var i in required) {
var el = document.getElementById(i);
if (!el.value) {
alert(required[i]);
el.focus();
return false;
}
}
// pass data back to the calling window
var fields = ["f_href", "f_title", "f_target" ];
var param = new Object();
for (var i in fields) {
var id = fields[i];
var el = document.getElementById(id);
param[id] = el.value;
}
if (param.f_target == "_other")
param.f_target = document.getElementById("f_other_target").value;
__dlg_close(param);
return false;
}
function onCancel() {
__dlg_close(null);
return false;
}
</script>
</head>
<body class="dialog" onload="Init()">
<div class="title">Insert/Modify Link</div>
<form>
<table border="0" style="width: 100%;">
<tr>
<td class="label">URL:</td>
<td><input type="text" id="f_href" style="width: 100%" /></td>
</tr>
<tr>
<td class="label">Title (tooltip):</td>
<td><input type="text" id="f_title" style="width: 100%" /></td>
</tr>
<tr>
<td class="label"><span id="f_target_label">Target:</span></td>
<td><select id="f_target">
<option value="">None (use implicit)</option>
<option value="_blank">New window (_blank)</option>
<option value="_self">Same frame (_self)</option>
<option value="_top">Top frame (_top)</option>
</select>
<input type="text" name="f_other_target" id="f_other_target" size="10" style="visibility: hidden" />
</td>
</tr>
</table>
<div id="buttons">
<button type="submit" name="ok" onclick="return onOK();">OK</button>
<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
</div>
</form>
</body>
</html>
+87
View File
@@ -0,0 +1,87 @@
/* 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/CreateLink/link.js */
CreateLink._pluginInfo={name:"CreateLink",origin:"Xinha Core",version:"$LastChangedRevision:990 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),developer:"The Xinha Core Developer Team",developer_url:"$HeadURL:http://svn.xinha.webfactional.com/trunk/modules/CreateLink/link.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),sponsor:"",sponsor_url:"",license:"htmlArea"};
function CreateLink(_1){
}
Xinha.prototype._createLink=function(_2){
var _3=this;
var _4=null;
if(typeof _2=="undefined"){
_2=this.getParentElement();
if(_2){
while(_2&&!/^a$/i.test(_2.tagName)){
_2=_2.parentNode;
}
}
}
if(!_2){
var _5=_3.getSelection();
var _6=_3.createRange(_5);
var _7=0;
if(Xinha.is_ie){
if(_5.type=="Control"){
_7=_6.length;
}else{
_7=_6.compareEndPoints("StartToEnd",_6);
}
}else{
_7=_6.compareBoundaryPoints(_6.START_TO_END,_6);
}
if(_7===0){
alert(Xinha._lc("You need to select some text before creating a link"));
return;
}
_4={f_href:"",f_title:"",f_target:"",f_usetarget:_3.config.makeLinkShowsTarget};
}else{
_4={f_href:Xinha.is_ie?_3.stripBaseURL(_2.href):_2.getAttribute("href"),f_title:_2.title,f_target:_2.target,f_usetarget:_3.config.makeLinkShowsTarget};
}
Dialog(_3.config.URIs.link,function(_8){
if(!_8){
return false;
}
var a=_2;
if(!a){
try{
var _a=Xinha.uniq("http://www.example.com/Link");
_3._doc.execCommand("createlink",false,_a);
var _b=_3._doc.getElementsByTagName("a");
for(var i=0;i<_b.length;i++){
var _d=_b[i];
if(_d.href==_a){
if(!a){
a=_d;
}
_d.href=_8.f_href;
if(_8.f_target){
_d.target=_8.f_target;
}
if(_8.f_title){
_d.title=_8.f_title;
}
}
}
}
catch(ex){
}
}else{
var _e=_8.f_href.trim();
_3.selectNodeContents(a);
if(_e===""){
_3._doc.execCommand("unlink",false,null);
_3.updateToolbar();
return false;
}else{
a.href=_e;
}
}
if(!(a&&a.tagName.toLowerCase()=="a")){
return false;
}
a.target=_8.f_target.trim();
a.title=_8.f_title.trim();
_3.selectNodeContents(a);
_3.updateToolbar();
},_4);
};
+75
View File
@@ -0,0 +1,75 @@
/* 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/Dialogs/dialog.js */
function Dialog(_1,_2,_3){
if(typeof _3=="undefined"){
_3=window;
}
if(typeof window.showModalDialog=="function"&&!Xinha.is_webkit){
Dialog._return=function(_4){
if(typeof _2=="function"){
_2(_4);
}
};
var r=window.showModalDialog(_1,_3,"dialogheight=300;dialogwidth=400;resizable=yes");
}else{
Dialog._geckoOpenModal(_1,_2,_3);
}
}
Dialog._parentEvent=function(ev){
setTimeout(function(){
if(Dialog._modal&&!Dialog._modal.closed){
Dialog._modal.focus();
}
},50);
try{
if(Dialog._modal&&!Dialog._modal.closed){
Xinha._stopEvent(ev);
}
}
catch(e){
}
};
Dialog._return=null;
Dialog._modal=null;
Dialog._arguments=null;
Dialog._selection=null;
Dialog._geckoOpenModal=function(_7,_8,_9){
var _a=window.open(_7,"hadialog","toolbar=no,menubar=no,personalbar=no,width=10,height=10,"+"scrollbars=no,resizable=yes,modal=yes,dependable=yes");
Dialog._modal=_a;
Dialog._arguments=_9;
function capwin(w){
Xinha._addEvent(w,"click",Dialog._parentEvent);
Xinha._addEvent(w,"mousedown",Dialog._parentEvent);
Xinha._addEvent(w,"focus",Dialog._parentEvent);
}
function relwin(w){
Xinha._removeEvent(w,"click",Dialog._parentEvent);
Xinha._removeEvent(w,"mousedown",Dialog._parentEvent);
Xinha._removeEvent(w,"focus",Dialog._parentEvent);
}
capwin(window);
for(var i=0;i<window.frames.length;i++){
try{
capwin(window.frames[i]);
}
catch(e){
}
}
Dialog._return=function(_e){
if(_e&&_8){
_8(_e);
}
relwin(window);
for(var i=0;i<window.frames.length;i++){
try{
relwin(window.frames[i]);
}
catch(e){
}
}
Dialog._modal=null;
};
Dialog._modal.focus();
};
+207
View File
@@ -0,0 +1,207 @@
/* 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/Dialogs/inline-dialog.js */
Xinha.Dialog=function(_1,_2,_3){
this.id={};
this.r_id={};
this.editor=_1;
this.document=document;
this.rootElem=document.createElement("div");
this.rootElem.className="dialog";
this.rootElem.style.position="absolute";
this.rootElem.style.display="none";
this.editor._framework.ed_cell.insertBefore(this.rootElem,this.editor._framework.ed_cell.firstChild);
this.rootElem.style.width=this.width=this.editor._framework.ed_cell.offsetWidth+"px";
this.rootElem.style.height=this.height=this.editor._framework.ed_cell.offsetHeight+"px";
var _4=this;
if(typeof _3=="function"){
this._lc=_3;
}else{
if(_3){
this._lc=function(_5){
return Xinha._lc(_5,_3);
};
}else{
this._lc=function(_6){
return _6;
};
}
}
_2=_2.replace(/\[([a-z0-9_]+)\]/ig,function(_7,id){
if(typeof _4.id[id]=="undefined"){
_4.id[id]=Xinha.uniq("Dialog");
_4.r_id[_4.id[id]]=id;
}
return _4.id[id];
}).replace(/<l10n>(.*?)<\/l10n>/ig,function(_9,_a){
return _4._lc(_a);
}).replace(/="_\((.*?)\)"/g,function(_b,_c){
return "=\""+_4._lc(_c)+"\"";
});
this.rootElem.innerHTML=_2;
this.editor.notifyOn("resize",function(e,_e){
_4.rootElem.style.width=_4.width=_4.editor._framework.ed_cell.offsetWidth+"px";
_4.rootElem.style.height=_4.height=_4.editor._framework.ed_cell.offsetHeight+"px";
_4.onresize();
});
};
Xinha.Dialog.prototype.onresize=function(){
return true;
};
Xinha.Dialog.prototype.show=function(_f){
if(Xinha.is_ie){
this._lastRange=this.editor._createRange(this.editor._getSelection());
}
if(typeof _f!="undefined"){
this.setValues(_f);
}
this._restoreTo=[this.editor._textArea.style.display,this.editor._iframe.style.visibility,this.editor.hidePanels()];
this.editor._textArea.style.display="none";
this.editor._iframe.style.visibility="hidden";
this.rootElem.style.display="";
};
Xinha.Dialog.prototype.hide=function(){
this.rootElem.style.display="none";
this.editor._textArea.style.display=this._restoreTo[0];
this.editor._iframe.style.visibility=this._restoreTo[1];
this.editor.showPanels(this._restoreTo[2]);
if(Xinha.is_ie){
this._lastRange.select();
}
this.editor.updateToolbar();
return this.getValues();
};
Xinha.Dialog.prototype.toggle=function(){
if(this.rootElem.style.display=="none"){
this.show();
}else{
this.hide();
}
};
Xinha.Dialog.prototype.setValues=function(_10){
for(var i in _10){
var _12=this.getElementsByName(i);
if(!_12){
continue;
}
for(var x=0;x<_12.length;x++){
var e=_12[x];
switch(e.tagName.toLowerCase()){
case "select":
for(var j=0;j<e.options.length;j++){
if(typeof _10[i]=="object"){
for(var k=0;k<_10[i].length;k++){
if(_10[i][k]==e.options[j].value){
e.options[j].selected=true;
}
}
}else{
if(_10[i]==e.options[j].value){
e.options[j].selected=true;
}
}
}
break;
case "textarea":
case "input":
switch(e.getAttribute("type")){
case "radio":
if(e.value==_10[i]){
e.checked=true;
}
break;
case "checkbox":
if(typeof _10[i]=="object"){
for(var j in _10[i]){
if(_10[i][j]==e.value){
e.checked=true;
}
}
}else{
if(_10[i]==e.value){
e.checked=true;
}
}
break;
default:
e.value=_10[i];
}
break;
default:
break;
}
}
}
};
Xinha.Dialog.prototype.getValues=function(){
var _17=[];
var _18=Xinha.collectionToArray(this.rootElem.getElementsByTagName("input")).append(Xinha.collectionToArray(this.rootElem.getElementsByTagName("textarea"))).append(Xinha.collectionToArray(this.rootElem.getElementsByTagName("select")));
for(var x=0;x<_18.length;x++){
var i=_18[x];
if(!(i.name&&this.r_id[i.name])){
continue;
}
if(typeof _17[this.r_id[i.name]]=="undefined"){
_17[this.r_id[i.name]]=null;
}
var v=_17[this.r_id[i.name]];
switch(i.tagName.toLowerCase()){
case "select":
if(i.multiple){
if(!v.push){
if(v!=null){
v=[v];
}else{
v=new Array();
}
}
for(var j=0;j<i.options.length;j++){
if(i.options[j].selected){
v.push(i.options[j].value);
}
}
}else{
if(i.selectedIndex>=0){
v=i.options[i.selectedIndex];
}
}
break;
case "textarea":
case "input":
default:
switch(i.type.toLowerCase()){
case "radio":
if(i.checked){
v=i.value;
break;
}
case "checkbox":
if(v==null){
if(this.getElementsByName(this.r_id[i.name]).length>1){
v=new Array();
}
}
if(i.checked){
if(v!=null&&typeof v=="object"&&v.push){
v.push(i.value);
}else{
v=i.value;
}
}
break;
default:
v=i.value;
break;
}
}
_17[this.r_id[i.name]]=v;
}
return _17;
};
Xinha.Dialog.prototype.getElementById=function(id){
return this.document.getElementById(this.id[id]?this.id[id]:id);
};
Xinha.Dialog.prototype.getElementsByName=function(_1e){
return this.document.getElementsByName(this.id[_1e]?this.id[_1e]:_1e);
};
+51
View File
@@ -0,0 +1,51 @@
/* 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/Dialogs/panel-dialog.js */
Xinha.PanelDialog=function(_1,_2,_3,_4){
this.id={};
this.r_id={};
this.editor=_1;
this.document=document;
this.rootElem=_1.addPanel(_2);
var _5=this;
if(typeof _4=="function"){
this._lc=_4;
}else{
if(_4){
this._lc=function(_6){
return Xinha._lc(_6,_4);
};
}else{
this._lc=function(_7){
return _7;
};
}
}
_3=_3.replace(/\[([a-z0-9_]+)\]/ig,function(_8,id){
if(typeof _5.id[id]=="undefined"){
_5.id[id]=Xinha.uniq("Dialog");
_5.r_id[_5.id[id]]=id;
}
return _5.id[id];
}).replace(/<l10n>(.*?)<\/l10n>/ig,function(_a,_b){
return _5._lc(_b);
}).replace(/="_\((.*?)\)"/g,function(_c,_d){
return "=\""+_5._lc(_d)+"\"";
});
this.rootElem.innerHTML=_3;
};
Xinha.PanelDialog.prototype.show=function(_e){
this.setValues(_e);
this.editor.showPanel(this.rootElem);
};
Xinha.PanelDialog.prototype.hide=function(){
this.editor.hidePanel(this.rootElem);
return this.getValues();
};
Xinha.PanelDialog.prototype.onresize=Xinha.Dialog.prototype.onresize;
Xinha.PanelDialog.prototype.toggle=Xinha.Dialog.prototype.toggle;
Xinha.PanelDialog.prototype.setValues=Xinha.Dialog.prototype.setValues;
Xinha.PanelDialog.prototype.getValues=Xinha.Dialog.prototype.getValues;
Xinha.PanelDialog.prototype.getElementById=Xinha.Dialog.prototype.getElementById;
Xinha.PanelDialog.prototype.getElementsByName=Xinha.Dialog.prototype.getElementsByName;
+123
View File
@@ -0,0 +1,123 @@
/* 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/Dialogs/popupwin.js */
function PopupWin(_1,_2,_3,_4){
this.editor=_1;
this.handler=_3;
var _5=window.open("","__ha_dialog","toolbar=no,menubar=no,personalbar=no,width=600,height=600,left=20,top=40,scrollbars=no,resizable=yes");
this.window=_5;
var _6=_5.document;
this.doc=_6;
var _7=this;
var _8=document.baseURI||document.URL;
if(_8&&_8.match(/(.*)\/([^\/]+)/)){
_8=RegExp.$1+"/";
}
if(typeof _editor_url!="undefined"&&!(/^\//.test(_editor_url))&&!(/http:\/\//.test(_editor_url))){
_8+=_editor_url;
}else{
_8=_editor_url;
}
if(!(/\/$/.test(_8))){
_8+="/";
}
this.baseURL=_8;
_6.open();
var _9="<html><head><title>"+_2+"</title>\n";
_9+="<style type=\"text/css\">@import url("+_editor_url+"Xinha.css);</style>\n";
if(_editor_skin!=""){
_9+="<style type=\"text/css\">@import url("+_editor_url+"skins/"+_editor_skin+"/skin.css);</style>\n";
}
_9+="</head>\n";
_9+="<body class=\"dialog popupwin\" id=\"--HA-body\"></body></html>";
_6.write(_9);
_6.close();
function init2(){
var _a=_6.body;
if(!_a){
setTimeout(init2,25);
return false;
}
_5.title=_2;
_6.documentElement.style.padding="0px";
_6.documentElement.style.margin="0px";
var _b=_6.createElement("div");
_b.className="content";
_7.content=_b;
_a.appendChild(_b);
_7.element=_a;
_4(_7);
_5.focus();
}
init2();
}
PopupWin.prototype.callHandler=function(){
var _c=["input","textarea","select"];
var _d={};
for(var ti=_c.length;--ti>=0;){
var _f=_c[ti];
var els=this.content.getElementsByTagName(_f);
for(var j=0;j<els.length;++j){
var el=els[j];
var val=el.value;
if(el.tagName.toLowerCase()=="input"){
if(el.type=="checkbox"){
val=el.checked;
}
}
_d[el.name]=val;
}
}
this.handler(this,_d);
return false;
};
PopupWin.prototype.close=function(){
this.window.close();
};
PopupWin.prototype.addButtons=function(){
var _14=this;
var div=this.doc.createElement("div");
this.content.appendChild(div);
div.id="buttons";
div.className="buttons";
for(var i=0;i<arguments.length;++i){
var btn=arguments[i];
var _18=this.doc.createElement("button");
div.appendChild(_18);
_18.innerHTML=Xinha._lc(btn,"Xinha");
switch(btn.toLowerCase()){
case "ok":
Xinha.addDom0Event(_18,"click",function(){
_14.callHandler();
_14.close();
return false;
});
break;
case "cancel":
Xinha.addDom0Event(_18,"click",function(){
_14.close();
return false;
});
break;
}
}
};
PopupWin.prototype.showAtElement=function(){
var _19=this;
setTimeout(function(){
var w=_19.content.offsetWidth+4;
var h=_19.content.offsetHeight+4;
var el=_19.content;
var s=el.style;
s.position="absolute";
s.left=parseInt((w-el.offsetWidth)/2,10)+"px";
s.top=parseInt((h-el.offsetHeight)/2,10)+"px";
if(Xinha.is_gecko){
_19.window.innerWidth=w;
_19.window.innerHeight=h;
}else{
_19.window.resizeTo(w+8,h+70);
}
},25);
};
+139
View File
@@ -0,0 +1,139 @@
/* 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/FullScreen/full-screen.js */
function FullScreen(_1,_2){
this.editor=_1;
_1._superclean_on=false;
cfg=_1.config;
cfg.registerButton("fullscreen",this._lc("Maximize/Minimize Editor"),[_editor_url+cfg.imgURL+"ed_buttons_main.gif",8,0],true,function(e,_4,_5){
e._fullScreen();
});
cfg.addToolbarElement("fullscreen","popupeditor",0);
}
FullScreen._pluginInfo={name:"FullScreen",version:"1.0",developer:"James Sleeman",developer_url:"http://www.gogo.co.nz/",c_owner:"Gogo Internet Services",license:"htmlArea",sponsor:"Gogo Internet Services",sponsor_url:"http://www.gogo.co.nz/"};
FullScreen.prototype._lc=function(_6){
return Xinha._lc(_6,{url:_editor_url+"modules/FullScreen/lang/",context:"FullScreen"});
};
Xinha.prototype._fullScreen=function(){
var e=this;
function sizeItUp(){
if(!e._isFullScreen||e._sizing){
return false;
}
e._sizing=true;
var _8=Xinha.viewportSize();
var h=_8.y-e.config.fullScreenMargins[0]-e.config.fullScreenMargins[2];
var w=_8.x-e.config.fullScreenMargins[1]-e.config.fullScreenMargins[3];
e.sizeEditor(w+"px",h+"px",true,true);
e._sizing=false;
if(e._toolbarObjects.fullscreen){
e._toolbarObjects.fullscreen.swapImage([_editor_url+cfg.imgURL+"ed_buttons_main.gif",9,0]);
}
}
function sizeItDown(){
if(e._isFullScreen||e._sizing){
return false;
}
e._sizing=true;
e.initSize();
e._sizing=false;
if(e._toolbarObjects.fullscreen){
e._toolbarObjects.fullscreen.swapImage([_editor_url+cfg.imgURL+"ed_buttons_main.gif",8,0]);
}
}
function resetScroll(){
if(e._isFullScreen){
window.scroll(0,0);
window.setTimeout(resetScroll,150);
}
}
if(typeof this._isFullScreen=="undefined"){
this._isFullScreen=false;
if(e.target!=e._iframe){
Xinha._addEvent(window,"resize",sizeItUp);
}
}
if(Xinha.is_gecko){
this.deactivateEditor();
}
if(this._isFullScreen){
this._htmlArea.style.position="";
if(!Xinha.is_ie){
this._htmlArea.style.border="";
}
try{
if(Xinha.is_ie&&document.compatMode=="CSS1Compat"){
var _b=document.getElementsByTagName("html");
}else{
var _b=document.getElementsByTagName("body");
}
_b[0].style.overflow="";
}
catch(e){
}
this._isFullScreen=false;
sizeItDown();
var _c=this._htmlArea;
while((_c=_c.parentNode)&&_c.style){
_c.style.position=_c._xinha_fullScreenOldPosition;
_c._xinha_fullScreenOldPosition=null;
}
if(Xinha.ie_version<7){
var _d=document.getElementsByTagName("select");
for(var i=0;i<_d.length;++i){
_d[i].style.visibility="visible";
}
}
window.scroll(this._unScroll.x,this._unScroll.y);
}else{
this._unScroll={x:(window.pageXOffset)?(window.pageXOffset):(document.documentElement)?document.documentElement.scrollLeft:document.body.scrollLeft,y:(window.pageYOffset)?(window.pageYOffset):(document.documentElement)?document.documentElement.scrollTop:document.body.scrollTop};
var _c=this._htmlArea;
while((_c=_c.parentNode)&&_c.style){
_c._xinha_fullScreenOldPosition=_c.style.position;
_c.style.position="static";
}
if(Xinha.ie_version<7){
var _d=document.getElementsByTagName("select");
var s,currentEditor;
for(var i=0;i<_d.length;++i){
s=_d[i];
currentEditor=false;
while(s=s.parentNode){
if(s==this._htmlArea){
currentEditor=true;
break;
}
}
if(!currentEditor&&_d[i].style.visibility!="hidden"){
_d[i].style.visibility="hidden";
}
}
}
window.scroll(0,0);
this._htmlArea.style.position="absolute";
this._htmlArea.style.zIndex=999;
this._htmlArea.style.left=e.config.fullScreenMargins[3]+"px";
this._htmlArea.style.top=e.config.fullScreenMargins[0]+"px";
if(!Xinha.is_ie&&!Xinha.is_webkit){
this._htmlArea.style.border="none";
}
this._isFullScreen=true;
resetScroll();
try{
if(Xinha.is_ie&&document.compatMode=="CSS1Compat"){
var _b=document.getElementsByTagName("html");
}else{
var _b=document.getElementsByTagName("body");
}
_b[0].style.overflow="hidden";
}
catch(e){
}
sizeItUp();
}
if(Xinha.is_gecko){
this.activateEditor();
}
this.focusEditor();
};
+6
View File
@@ -0,0 +1,6 @@
// I18N constants
// LANG: "de", ENCODING: UTF-8
// translated: Raimund Meyer xinha@ray-of-light.org
{
"Maximize/Minimize Editor": "Editor maximieren/verkleinern"
};
+5
View File
@@ -0,0 +1,5 @@
// I18N constants
// LANG: "fr", ENCODING: UTF-8
{
"Maximize/Minimize Editor": "Agrandir/Réduire l'éditeur"
};
+5
View File
@@ -0,0 +1,5 @@
// I18N constants
// LANG: "ja", ENCODING: UTF-8
{
"Maximize/Minimize Editor": "エディタの最大化/最小化"
};
+6
View File
@@ -0,0 +1,6 @@
// I18N constants
// LANG: "nb", ENCODING: UTF-8
// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com
{
"Maximize/Minimize Editor": "Maksimer/Minimer WYSIWYG vindu"
};
+6
View File
@@ -0,0 +1,6 @@
// I18N constants
// LANG: "pl", ENCODING: UTF-8
// translated: Krzysztof Kotowicz, koto1sa@o2.pl, http://www.eskot.krakow.pl/portfolio
{
"Maximize/Minimize Editor": "Maksymalizuj/minimalizuj edytor"
};
+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).
{
"Maximize/Minimize Editor": "Maximizar/Minimizar Editor"
};
+6
View File
@@ -0,0 +1,6 @@
// I18N constants
// LANG: "ru", ENCODING: UTF-8
// Author: Andrei Blagorazumov, a@fnr.ru
{
"Maximize/Minimize Editor": "Развернуть/Свернуть редактор"
};
+6
View File
@@ -0,0 +1,6 @@
// I18N constants
// LANG: "sv" (Swedish), ENCODING: UTF-8
// translated: Erik Dalén, <dalen@jpl.se>
{
"Maximize/Minimize Editor": "Maximera/Minimera WYSIWYG fönster"
};
+461
View File
@@ -0,0 +1,461 @@
/* 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/Gecko/Gecko.js */
Gecko._pluginInfo={name:"Gecko",origin:"Xinha Core",version:"$LastChangedRevision:998 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),developer:"The Xinha Core Developer Team",developer_url:"$HeadURL:http://svn.xinha.webfactional.com/trunk/modules/Gecko/Gecko.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),sponsor:"",sponsor_url:"",license:"htmlArea"};
function Gecko(_1){
this.editor=_1;
_1.Gecko=this;
}
Gecko.prototype.onKeyPress=function(ev){
var _3=this.editor;
var s=_3.getSelection();
if(_3.isShortCut(ev)){
switch(_3.getKey(ev).toLowerCase()){
case "z":
if(_3._unLink&&_3._unlinkOnUndo){
Xinha._stopEvent(ev);
_3._unLink();
_3.updateToolbar();
return true;
}
break;
case "a":
sel=_3.getSelection();
sel.removeAllRanges();
range=_3.createRange();
range.selectNodeContents(_3._doc.body);
sel.addRange(range);
Xinha._stopEvent(ev);
return true;
break;
case "v":
if(!_3.config.htmlareaPaste){
return true;
}
break;
}
}
switch(_3.getKey(ev)){
case " ":
var _5=function(_6,_7){
var _8=_6.nextSibling;
if(typeof _7=="string"){
_7=_3._doc.createElement(_7);
}
var a=_6.parentNode.insertBefore(_7,_8);
Xinha.removeFromParent(_6);
a.appendChild(_6);
_8.data=" "+_8.data;
s.collapse(_8,1);
_3._unLink=function(){
var t=a.firstChild;
a.removeChild(t);
a.parentNode.insertBefore(t,a);
Xinha.removeFromParent(a);
_3._unLink=null;
_3._unlinkOnUndo=false;
};
_3._unlinkOnUndo=true;
return a;
};
if(_3.config.convertUrlsToLinks&&s&&s.isCollapsed&&s.anchorNode.nodeType==3&&s.anchorNode.data.length>3&&s.anchorNode.data.indexOf(".")>=0){
var _b=s.anchorNode.data.substring(0,s.anchorOffset).search(/\S{4,}$/);
if(_b==-1){
break;
}
if(_3._getFirstAncestor(s,"a")){
break;
}
var _c=s.anchorNode.data.substring(0,s.anchorOffset).replace(/^.*?(\S*)$/,"$1");
var _d=_c.match(Xinha.RE_email);
if(_d){
var _e=s.anchorNode;
var _f=_e.splitText(s.anchorOffset);
var _10=_e.splitText(_b);
_5(_10,"a").href="mailto:"+_d[0];
break;
}
RE_date=/([0-9]+\.)+/;
RE_ip=/(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/;
var _11=_c.match(Xinha.RE_url);
if(_11){
if(RE_date.test(_c)){
break;
}
var _12=s.anchorNode;
var _13=_12.splitText(s.anchorOffset);
var _14=_12.splitText(_b);
_5(_14,"a").href=(_11[1]?_11[1]:"http://")+_11[2];
break;
}
}
break;
}
switch(ev.keyCode){
case 27:
if(_3._unLink){
_3._unLink();
Xinha._stopEvent(ev);
}
break;
break;
case 8:
case 46:
if(!ev.shiftKey&&this.handleBackspace()){
Xinha._stopEvent(ev);
}
default:
_3._unlinkOnUndo=false;
if(s.anchorNode&&s.anchorNode.nodeType==3){
var a=_3._getFirstAncestor(s,"a");
if(!a){
break;
}
if(!a._updateAnchTimeout){
if(s.anchorNode.data.match(Xinha.RE_email)&&a.href.match("mailto:"+s.anchorNode.data.trim())){
var _16=s.anchorNode;
var _17=function(){
a.href="mailto:"+_16.data.trim();
a._updateAnchTimeout=setTimeout(_17,250);
};
a._updateAnchTimeout=setTimeout(_17,1000);
break;
}
var m=s.anchorNode.data.match(Xinha.RE_url);
if(m&&a.href.match(new RegExp("http(s)?://"+Xinha.escapeStringForRegExp(s.anchorNode.data.trim())))){
var _19=s.anchorNode;
var _1a=function(){
m=_19.data.match(Xinha.RE_url);
if(m){
a.href=(m[1]?m[1]:"http://")+m[2];
}
a._updateAnchTimeout=setTimeout(_1a,250);
};
a._updateAnchTimeout=setTimeout(_1a,1000);
}
}
}
break;
}
return false;
};
Gecko.prototype.handleBackspace=function(){
var _1b=this.editor;
setTimeout(function(){
var sel=_1b.getSelection();
var _1d=_1b.createRange(sel);
var SC=_1d.startContainer;
var SO=_1d.startOffset;
var EC=_1d.endContainer;
var EO=_1d.endOffset;
var _22=SC.nextSibling;
if(SC.nodeType==3){
SC=SC.parentNode;
}
if(!(/\S/.test(SC.tagName))){
var p=document.createElement("p");
while(SC.firstChild){
p.appendChild(SC.firstChild);
}
SC.parentNode.insertBefore(p,SC);
Xinha.removeFromParent(SC);
var r=_1d.cloneRange();
r.setStartBefore(_22);
r.setEndAfter(_22);
r.extractContents();
sel.removeAllRanges();
sel.addRange(r);
}
},10);
};
Gecko.prototype.inwardHtml=function(_25){
_25=_25.replace(/<(\/?)strong(\s|>|\/)/ig,"<$1b$2");
_25=_25.replace(/<(\/?)em(\s|>|\/)/ig,"<$1i$2");
_25=_25.replace(/<(\/?)del(\s|>|\/)/ig,"<$1strike$2");
return _25;
};
Gecko.prototype.outwardHtml=function(_26){
_26=_26.replace(/<script[\s]*src[\s]*=[\s]*['"]chrome:\/\/.*?["']>[\s]*<\/script>/ig,"");
return _26;
};
Gecko.prototype.onExecCommand=function(_27,UI,_29){
try{
this.editor._doc.execCommand("useCSS",false,true);
this.editor._doc.execCommand("styleWithCSS",false,false);
}
catch(ex){
}
switch(_27){
case "paste":
alert(Xinha._lc("The Paste button does not work in Mozilla based web browsers (technical security reasons). Press CTRL-V on your keyboard to paste directly."));
return true;
break;
case "removeformat":
var _2a=this.editor;
var sel=_2a.getSelection();
var _2c=_2a.saveSelection(sel);
var _2d=_2a.createRange(sel);
var els=_2a._doc.body.getElementsByTagName("*");
var _2f=(_2d.startContainer.nodeType==1)?_2d.startContainer:_2d.startContainer.parentNode;
var i,el;
if(sel.isCollapsed){
_2d.selectNodeContents(_2a._doc.body);
}
for(i=0;i<els.length;i++){
el=els[i];
if(_2d.isPointInRange(el,0)||(els[i]==_2f&&_2d.startOffset==0)){
el.removeAttribute("style");
}
}
this.editor._doc.execCommand(_27,UI,_29);
_2a.restoreSelection(_2c);
return true;
break;
}
return false;
};
Gecko.prototype.onMouseDown=function(ev){
if(ev.target.tagName.toLowerCase()=="hr"){
var sel=this.editor.getSelection();
var _33=this.editor.createRange(sel);
_33.selectNode(ev.target);
}
};
Xinha.prototype.insertNodeAtSelection=function(_34){
if(_34.ownerDocument!=this._doc){
try{
_34=this._doc.adoptNode(_34);
}
catch(e){
}
}
var sel=this.getSelection();
var _36=this.createRange(sel);
sel.removeAllRanges();
_36.deleteContents();
var _37=_36.startContainer;
var pos=_36.startOffset;
var _39=_34;
switch(_37.nodeType){
case 3:
if(_34.nodeType==3){
_37.insertData(pos,_34.data);
_36=this.createRange();
_36.setEnd(_37,pos+_34.length);
_36.setStart(_37,pos+_34.length);
sel.addRange(_36);
}else{
_37=_37.splitText(pos);
if(_34.nodeType==11){
_39=_39.firstChild;
}
_37.parentNode.insertBefore(_34,_37);
this.selectNodeContents(_39);
this.updateToolbar();
}
break;
case 1:
if(_34.nodeType==11){
_39=_39.firstChild;
}
_37.insertBefore(_34,_37.childNodes[pos]);
this.selectNodeContents(_39);
this.updateToolbar();
break;
}
};
Xinha.prototype.getParentElement=function(sel){
if(typeof sel=="undefined"){
sel=this.getSelection();
}
var _3b=this.createRange(sel);
try{
var p=_3b.commonAncestorContainer;
if(!_3b.collapsed&&_3b.startContainer==_3b.endContainer&&_3b.startOffset-_3b.endOffset<=1&&_3b.startContainer.hasChildNodes()){
p=_3b.startContainer.childNodes[_3b.startOffset];
}
while(p.nodeType==3){
p=p.parentNode;
}
return p;
}
catch(ex){
return null;
}
};
Xinha.prototype.activeElement=function(sel){
if((sel===null)||this.selectionEmpty(sel)){
return null;
}
if(!sel.isCollapsed){
if(sel.anchorNode.childNodes.length>sel.anchorOffset&&sel.anchorNode.childNodes[sel.anchorOffset].nodeType==1){
return sel.anchorNode.childNodes[sel.anchorOffset];
}else{
if(sel.anchorNode.nodeType==1){
return sel.anchorNode;
}else{
return null;
}
}
}
return null;
};
Xinha.prototype.selectionEmpty=function(sel){
if(!sel){
return true;
}
if(typeof sel.isCollapsed!="undefined"){
return sel.isCollapsed;
}
return true;
};
Xinha.prototype.saveSelection=function(){
return this.createRange(this.getSelection()).cloneRange();
};
Xinha.prototype.restoreSelection=function(_3f){
var sel=this.getSelection();
sel.removeAllRanges();
sel.addRange(_3f);
};
Xinha.prototype.selectNodeContents=function(_41,pos){
this.focusEditor();
this.forceRedraw();
var _43;
var _44=typeof pos=="undefined"?true:false;
var sel=this.getSelection();
_43=this._doc.createRange();
if(!_41){
sel.removeAllRanges();
return;
}
if(_44&&_41.tagName&&_41.tagName.toLowerCase().match(/table|img|input|textarea|select/)){
_43.selectNode(_41);
}else{
_43.selectNodeContents(_41);
}
sel.removeAllRanges();
sel.addRange(_43);
};
Xinha.prototype.insertHTML=function(_46){
var sel=this.getSelection();
var _48=this.createRange(sel);
this.focusEditor();
var _49=this._doc.createDocumentFragment();
var div=this._doc.createElement("div");
div.innerHTML=_46;
while(div.firstChild){
_49.appendChild(div.firstChild);
}
var _4b=this.insertNodeAtSelection(_49);
};
Xinha.prototype.getSelectedHTML=function(){
var sel=this.getSelection();
if(sel.isCollapsed){
return "";
}
var _4d=this.createRange(sel);
return Xinha.getHTML(_4d.cloneContents(),false,this);
};
Xinha.prototype.getSelection=function(){
return this._iframe.contentWindow.getSelection();
};
Xinha.prototype.createRange=function(sel){
this.activateEditor();
if(typeof sel!="undefined"){
try{
return sel.getRangeAt(0);
}
catch(ex){
return this._doc.createRange();
}
}else{
return this._doc.createRange();
}
};
Xinha.prototype.isKeyEvent=function(_4f){
return _4f.type=="keypress";
};
Xinha.prototype.getKey=function(_50){
return String.fromCharCode(_50.charCode);
};
Xinha.getOuterHTML=function(_51){
return (new XMLSerializer()).serializeToString(_51);
};
Xinha.prototype.cc=String.fromCharCode(8286);
Xinha.prototype.setCC=function(_52){
var cc=this.cc;
try{
if(_52=="textarea"){
var ta=this._textArea;
var _55=ta.selectionStart;
var _56=ta.value.substring(0,_55);
var _57=ta.value.substring(_55,ta.value.length);
if(_57.match(/^[^<]*>/)){
var _58=_57.indexOf(">")+1;
ta.value=_56+_57.substring(0,_58)+cc+_57.substring(_58,_57.length);
}else{
ta.value=_56+cc+_57;
}
ta.value=ta.value.replace(new RegExp("(&[^"+cc+"]*?)("+cc+")([^"+cc+"]*?;)"),"$1$3$2");
ta.value=ta.value.replace(new RegExp("(<script[^>]*>[^"+cc+"]*?)("+cc+")([^"+cc+"]*?</script>)"),"$1$3$2");
ta.value=ta.value.replace(new RegExp("^([^"+cc+"]*)("+cc+")([^"+cc+"]*<body[^>]*>)(.*?)"),"$1$3$2$4");
}else{
var sel=this.getSelection();
sel.getRangeAt(0).insertNode(this._doc.createTextNode(cc));
}
}
catch(e){
}
};
Xinha.prototype.findCC=function(_5a){
if(_5a=="textarea"){
var ta=this._textArea;
var pos=ta.value.indexOf(this.cc);
if(pos==-1){
return;
}
var end=pos+this.cc.length;
var _5e=ta.value.substring(0,pos);
var _5f=ta.value.substring(end,ta.value.length);
ta.value=_5e;
ta.scrollTop=ta.scrollHeight;
var _60=ta.scrollTop;
ta.value+=_5f;
ta.setSelectionRange(pos,pos);
ta.focus();
ta.scrollTop=_60;
}else{
try{
var doc=this._doc;
doc.body.innerHTML=doc.body.innerHTML.replace(new RegExp(this.cc),"<span id=\"XinhaEditingPostion\"></span>");
var _62=doc.getElementById("XinhaEditingPostion");
this.selectNodeContents(_62);
_62.scrollIntoView(true);
_62.parentNode.removeChild(_62);
this._iframe.contentWindow.focus();
}
catch(e){
}
}
};
Xinha.prototype._standardToggleBorders=Xinha.prototype._toggleBorders;
Xinha.prototype._toggleBorders=function(){
var _63=this._standardToggleBorders();
var _64=this._doc.getElementsByTagName("TABLE");
for(var i=0;i<_64.length;i++){
_64[i].style.display="none";
_64[i].style.display="table";
}
return _63;
};
Xinha.getDoctype=function(doc){
var d="";
if(doc.doctype){
d+="<!DOCTYPE "+doc.doctype.name+" PUBLIC ";
d+=doc.doctype.publicId?"\""+doc.doctype.publicId+"\"":"";
d+=doc.doctype.systemId?" \""+doc.doctype.systemId+"\"":"";
d+=">";
}
return d;
};
+296
View File
@@ -0,0 +1,296 @@
/* 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/Gecko/paraHandlerBest.js */
EnterParagraphs._pluginInfo={name:"EnterParagraphs",version:"1.0",developer:"Adam Wright",developer_url:"http://www.hipikat.org/",sponsor:"The University of Western Australia",sponsor_url:"http://www.uwa.edu.au/",license:"htmlArea"};
EnterParagraphs.prototype._whiteSpace=/^\s*$/;
EnterParagraphs.prototype._pExclusions=/^(address|blockquote|body|dd|div|dl|dt|fieldset|form|h1|h2|h3|h4|h5|h6|hr|li|noscript|ol|p|pre|table|ul)$/i;
EnterParagraphs.prototype._pContainers=/^(body|del|div|fieldset|form|ins|map|noscript|object|td|th)$/i;
EnterParagraphs.prototype._pBreak=/^(address|pre|blockquote)$/i;
EnterParagraphs.prototype._permEmpty=/^(area|base|basefont|br|col|frame|hr|img|input|isindex|link|meta|param)$/i;
EnterParagraphs.prototype._elemSolid=/^(applet|br|button|hr|img|input|table)$/i;
EnterParagraphs.prototype._pifySibling=/^(address|blockquote|del|div|dl|fieldset|form|h1|h2|h3|h4|h5|h6|hr|ins|map|noscript|object|ol|p|pre|table|ul|)$/i;
EnterParagraphs.prototype._pifyForced=/^(ul|ol|dl|table)$/i;
EnterParagraphs.prototype._pifyParent=/^(dd|dt|li|td|th|tr)$/i;
function EnterParagraphs(_1){
this.editor=_1;
if(Xinha.is_gecko){
this.onKeyPress=this.__onKeyPress;
}
}
EnterParagraphs.prototype.name="EnterParagraphs";
EnterParagraphs.prototype.insertAdjacentElement=function(_2,_3,el){
if(_3=="BeforeBegin"){
_2.parentNode.insertBefore(el,_2);
}else{
if(_3=="AfterEnd"){
_2.nextSibling?_2.parentNode.insertBefore(el,_2.nextSibling):_2.parentNode.appendChild(el);
}else{
if(_3=="AfterBegin"&&_2.firstChild){
_2.insertBefore(el,_2.firstChild);
}else{
if(_3=="BeforeEnd"||_3=="AfterBegin"){
_2.appendChild(el);
}
}
}
}
};
EnterParagraphs.prototype.forEachNodeUnder=function(_5,_6,_7,_8){
var _9,end;
if(_5.nodeType==11&&_5.firstChild){
_9=_5.firstChild;
end=_5.lastChild;
}else{
_9=end=_5;
}
while(end.lastChild){
end=end.lastChild;
}
return this.forEachNode(_9,end,_6,_7,_8);
};
EnterParagraphs.prototype.forEachNode=function(_a,_b,_c,_d,_e){
var _f=function(_10,_11){
return (_11=="ltr"?_10.nextSibling:_10.previousSibling);
};
var _12=function(_13,_14){
return (_14=="ltr"?_13.firstChild:_13.lastChild);
};
var _15,lookup,fnReturnVal;
var _16=_e;
var _17=false;
while(_15!=_d=="ltr"?_b:_a){
if(!_15){
_15=_d=="ltr"?_a:_b;
}else{
if(_12(_15,_d)){
_15=_12(_15,_d);
}else{
if(_f(_15,_d)){
_15=_f(_15,_d);
}else{
lookup=_15;
while(!_f(lookup,_d)&&lookup!=(_d=="ltr"?_b:_a)){
lookup=lookup.parentNode;
}
_15=(_f(lookup,_d)?_f(lookup,_d):lookup);
}
}
}
_17=(_15==(_d=="ltr"?_b:_a));
switch(_c){
case "cullids":
fnReturnVal=this._fenCullIds(_15,_16);
break;
case "find_fill":
fnReturnVal=this._fenEmptySet(_15,_16,_c,_17);
break;
case "find_cursorpoint":
fnReturnVal=this._fenEmptySet(_15,_16,_c,_17);
break;
}
if(fnReturnVal[0]){
return fnReturnVal[1];
}
if(_17){
break;
}
if(fnReturnVal[1]){
_16=fnReturnVal[1];
}
}
return false;
};
EnterParagraphs.prototype._fenEmptySet=function(_18,_19,_1a,_1b){
if(!_19&&!_18.firstChild){
_19=_18;
}
if((_18.nodeType==1&&this._elemSolid.test(_18.nodeName))||(_18.nodeType==3&&!this._whiteSpace.test(_18.nodeValue))||(_18.nodeType!=1&&_18.nodeType!=3)){
switch(_1a){
case "find_fill":
return new Array(true,false);
break;
case "find_cursorpoint":
return new Array(true,_18);
break;
}
}
if(_1b){
return new Array(true,_19);
}
return new Array(false,_19);
};
EnterParagraphs.prototype._fenCullIds=function(_1c,_1d,_1e){
if(_1d.id){
_1e[_1d.id]?_1d.id="":_1e[_1d.id]=true;
}
return new Array(false,_1e);
};
EnterParagraphs.prototype.processSide=function(rng,_20){
var _21=function(_22,_23){
return (_23=="left"?_22.previousSibling:_22.nextSibling);
};
var _24=_20=="left"?rng.startContainer:rng.endContainer;
var _25=_20=="left"?rng.startOffset:rng.endOffset;
var _26,start=_24;
while(start.nodeType==1&&!this._permEmpty.test(start.nodeName)){
start=(_25?start.lastChild:start.firstChild);
}
while(_26=_26?(_21(_26,_20)?_21(_26,_20):_26.parentNode):start){
if(_21(_26,_20)){
if(this._pExclusions.test(_21(_26,_20).nodeName)){
return this.processRng(rng,_20,_26,_21(_26,_20),(_20=="left"?"AfterEnd":"BeforeBegin"),true,false);
}
}else{
if(this._pContainers.test(_26.parentNode.nodeName)){
return this.processRng(rng,_20,_26,_26.parentNode,(_20=="left"?"AfterBegin":"BeforeEnd"),true,false);
}else{
if(this._pExclusions.test(_26.parentNode.nodeName)){
if(this._pBreak.test(_26.parentNode.nodeName)){
return this.processRng(rng,_20,_26,_26.parentNode,(_20=="left"?"AfterBegin":"BeforeEnd"),false,(_20=="left"?true:false));
}else{
return this.processRng(rng,_20,(_26=_26.parentNode),(_21(_26,_20)?_21(_26,_20):_26.parentNode),(_21(_26,_20)?(_20=="left"?"AfterEnd":"BeforeBegin"):(_20=="left"?"AfterBegin":"BeforeEnd")),false,false);
}
}
}
}
}
};
EnterParagraphs.prototype.processRng=function(rng,_28,_29,_2a,_2b,_2c,_2d){
var _2e=_28=="left"?rng.startContainer:rng.endContainer;
var _2f=_28=="left"?rng.startOffset:rng.endOffset;
var _30=this.editor;
var _31=_30._doc.createRange();
_31.selectNode(_29);
if(_28=="left"){
_31.setEnd(_2e,_2f);
rng.setStart(_31.startContainer,_31.startOffset);
}else{
if(_28=="right"){
_31.setStart(_2e,_2f);
rng.setEnd(_31.endContainer,_31.endOffset);
}
}
var cnt=_31.cloneContents();
this.forEachNodeUnder(cnt,"cullids","ltr",this.takenIds,false,false);
var _33,pifyOffset,fill;
_33=_28=="left"?(_31.endContainer.nodeType==3?true:false):(_31.startContainer.nodeType==3?false:true);
pifyOffset=_33?_31.startOffset:_31.endOffset;
_33=_33?_31.startContainer:_31.endContainer;
if(this._pifyParent.test(_33.nodeName)&&_33.parentNode.childNodes.item(0)==_33){
while(!this._pifySibling.test(_33.nodeName)){
_33=_33.parentNode;
}
}
if(cnt.nodeType==11&&!cnt.firstChild){
if(_33.nodeName!="BODY"||(_33.nodeName=="BODY"&&pifyOffset!=0)){
cnt.appendChild(_30._doc.createElement(_33.nodeName));
}
}
fill=this.forEachNodeUnder(cnt,"find_fill","ltr",false);
if(fill&&this._pifySibling.test(_33.nodeName)&&((pifyOffset==0)||(pifyOffset==1&&this._pifyForced.test(_33.nodeName)))){
_29=_30._doc.createElement("p");
_29.innerHTML="&nbsp;";
if((_28=="left")&&_33.previousSibling){
return new Array(_33.previousSibling,"AfterEnd",_29);
}else{
if((_28=="right")&&_33.nextSibling){
return new Array(_33.nextSibling,"BeforeBegin",_29);
}else{
return new Array(_33.parentNode,(_28=="left"?"AfterBegin":"BeforeEnd"),_29);
}
}
}
if(fill){
if(fill.nodeType==3){
fill=_30._doc.createDocumentFragment();
}
if((fill.nodeType==1&&!this._elemSolid.test())||fill.nodeType==11){
var _34=_30._doc.createElement("p");
_34.innerHTML="&nbsp;";
fill.appendChild(_34);
}else{
var _34=_30._doc.createElement("p");
_34.innerHTML="&nbsp;";
fill.parentNode.insertBefore(parentNode,fill);
}
}
if(fill){
_29=fill;
}else{
_29=(_2c||(cnt.nodeType==11&&!cnt.firstChild))?_30._doc.createElement("p"):_30._doc.createDocumentFragment();
_29.appendChild(cnt);
}
if(_2d){
_29.appendChild(_30._doc.createElement("br"));
}
return new Array(_2a,_2b,_29);
};
EnterParagraphs.prototype.isNormalListItem=function(rng){
var _36,listNode;
_36=rng.startContainer;
if((typeof _36.nodeName!="undefined")&&(_36.nodeName.toLowerCase()=="li")){
listNode=_36;
}else{
if((typeof _36.parentNode!="undefined")&&(typeof _36.parentNode.nodeName!="undefined")&&(_36.parentNode.nodeName.toLowerCase()=="li")){
listNode=_36.parentNode;
}else{
return false;
}
}
if(!listNode.previousSibling){
if(rng.startOffset==0){
return false;
}
}
return true;
};
EnterParagraphs.prototype.__onKeyPress=function(ev){
if(ev.keyCode==13&&!ev.shiftKey&&this.editor._iframe.contentWindow.getSelection){
return this.handleEnter(ev);
}
};
EnterParagraphs.prototype.handleEnter=function(ev){
var _39;
var sel=this.editor.getSelection();
var rng=this.editor.createRange(sel);
if(this.isNormalListItem(rng)){
return true;
}
this.takenIds=new Object();
var _3c=this.processSide(rng,"left");
var _3d=this.processSide(rng,"right");
_39=_3d[2];
sel.removeAllRanges();
rng.deleteContents();
var _3e=this.forEachNodeUnder(_39,"find_cursorpoint","ltr",false,true);
if(!_3e){
alert("INTERNAL ERROR - could not find place to put cursor after ENTER");
}
if(_3c){
this.insertAdjacentElement(_3c[0],_3c[1],_3c[2]);
}
if(_3d&&_3d.nodeType!=1){
this.insertAdjacentElement(_3d[0],_3d[1],_3d[2]);
}
if((_3e)&&(this._permEmpty.test(_3e.nodeName))){
var _3f=0;
while(_3e.parentNode.childNodes.item(_3f)!=_3e){
_3f++;
}
sel.collapse(_3e.parentNode,_3f);
}else{
try{
sel.collapse(_3e,0);
if(_3e.nodeType==3){
_3e=_3e.parentNode;
}
this.editor.scrollToElement(_3e);
}
catch(e){
}
}
this.editor.updateToolbar();
Xinha._stopEvent(ev);
return true;
};
+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."
}
+173
View File
@@ -0,0 +1,173 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Insert Image</title>
<script type="text/javascript" src="../../popups/popup.js"></script>
<link rel="stylesheet" type="text/css" href="../../popups/popup.css" />
<script type="text/javascript">
Xinha = window.opener.Xinha;
function i18n(str) {
return (Xinha._lc(str, 'Xinha'));
}
function Init() {
__dlg_translate('Xinha');
__dlg_init(null,{width:410,height:400});
// Make sure the translated string appears in the drop down. (for gecko)
document.getElementById("f_align").selectedIndex = 1;
document.getElementById("f_align").selectedIndex = 5;
var param = window.dialogArguments;
if (param["f_base"]) {
document.getElementById("f_base").value = param["f_base"];
}
document.getElementById("f_url").value = param["f_url"] ? param["f_url"] : "";
document.getElementById("f_alt").value = param["f_alt"] ? param["f_alt"] : "";
document.getElementById("f_border").value = (typeof param["f_border"]!="undefined") ? param["f_border"] : "";
document.getElementById("f_align").value = param["f_align"] ? param["f_align"] : "";
document.getElementById("f_vert").value = (typeof param["f_vert"]!="undefined") ? param["f_vert"] : "";
document.getElementById("f_horiz").value = (typeof param["f_horiz"]!="undefined") ? param["f_horiz"] : "";
if (param["f_url"]) {
window.ipreview.location.replace(Xinha._resolveRelativeUrl(param.f_base, param.f_url));
}
document.getElementById("f_url").focus();
}
function onOK() {
var required = {
"f_url": i18n("You must enter the URL")
};
for (var i in required) {
var el = document.getElementById(i);
if (!el.value) {
alert(required[i]);
el.focus();
return false;
}
}
// pass data back to the calling window
var fields = ["f_url", "f_alt", "f_align", "f_border",
"f_horiz", "f_vert"];
var param = new Object();
for (var i in fields) {
var id = fields[i];
var el = document.getElementById(id);
param[id] = el.value;
}
__dlg_close(param);
return false;
}
function onCancel() {
__dlg_close(null);
return false;
}
function onPreview() {
var f_url = document.getElementById("f_url");
var url = f_url.value;
var base = document.getElementById("f_base").value;
if (!url) {
alert(i18n("You must enter the URL"));
f_url.focus();
return false;
}
window.ipreview.location.replace(Xinha._resolveRelativeUrl(base, url));
return false;
}
</script>
</head>
<body class="dialog" onload="Init()">
<div class="title">Insert Image</div>
<!--- new stuff --->
<form action="" method="get">
<input type="hidden" name="base" id="f_base"/>
<table border="0" width="100%" style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td style="width: 7em; text-align: right">Image URL:</td>
<td><input type="text" name="url" id="f_url" style="width:75%"
title="Enter the image URL here" />
<button name="preview" onclick="return onPreview();"
title="Preview the image in a new window">Preview</button>
</td>
</tr>
<tr>
<td style="width: 7em; text-align: right">Alternate text:</td>
<td><input type="text" name="alt" id="f_alt" style="width:100%"
title="For browsers that don't support images" /></td>
</tr>
</tbody>
</table>
<fieldset style="float: left; margin-left: 5px;">
<legend>Layout</legend>
<div class="space"></div>
<div class="fl">Alignment:</div>
<select size="1" name="align" id="f_align"
title="Positioning of this image">
<option value="" >Not set</option>
<option value="left" >Left</option>
<option value="right" >Right</option>
<option value="texttop" >Texttop</option>
<option value="absmiddle" >Absmiddle</option>
<option value="baseline" selected="selected" >Baseline</option>
<option value="absbottom" >Absbottom</option>
<option value="bottom" >Bottom</option>
<option value="middle" >Middle</option>
<option value="top" >Top</option>
</select>
<br />
<div class="fl">Border thickness:</div>
<input type="text" name="border" id="f_border" size="5"
title="Leave empty for no border" />
<div class="space"></div>
</fieldset>
<fieldset>
<legend>Spacing</legend>
<div class="space"></div>
<div class="fr">Horizontal:</div>
<input type="text" name="horiz" id="f_horiz" size="5"
title="Horizontal padding" />
<br />
<div class="fr">Vertical:</div>
<input type="text" name="vert" id="f_vert" size="5"
title="Vertical padding" />
<div class="space"></div>
</fieldset>
<div class="space" style="clear:all"></div>
<div>
Image Preview:<br />
<iframe name="ipreview" id="ipreview" frameborder="0" style="border : 1px solid gray;"
height="200" width="100%" src="../../popups/blank.html"></iframe>
</div>
<div id="buttons">
<button type="submit" name="ok" onclick="return onOK();">OK</button>
<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
</div>
</form>
</body>
</html>
@@ -0,0 +1,119 @@
/* 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/InsertImage/insert_image.js */
InsertImage._pluginInfo={name:"InsertImage",origin:"Xinha Core",version:"$LastChangedRevision:992 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),developer:"The Xinha Core Developer Team",developer_url:"$HeadURL:http://svn.xinha.webfactional.com/trunk/modules/InsertImage/insert_image.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),sponsor:"",sponsor_url:"",license:"htmlArea"};
function InsertImage(_1){
}
Xinha.prototype._insertImage=function(_2){
var _3=this;
var _4;
if(typeof _2=="undefined"){
_2=this.getParentElement();
if(_2&&_2.tagName.toLowerCase()!="img"){
_2=null;
}
}
var _5;
if(typeof _3.config.baseHref!="undefined"&&_3.config.baseHref!==null){
_5=_3.config.baseHref;
}else{
var _6=window.location.toString().split("/");
_6.pop();
_5=_6.join("/");
}
if(_2){
function getSpecifiedAttribute(_7,_8){
var a=_7.attributes;
for(var i=0;i<a.length;i++){
if(a[i].nodeName==_8&&a[i].specified){
return a[i].value;
}
}
return "";
}
_4={f_base:_5,f_url:this.stripBaseURL(_2.getAttribute("src",2)),f_alt:_2.alt,f_border:_2.border,f_align:_2.align,f_vert:getSpecifiedAttribute(_2,"vspace"),f_horiz:getSpecifiedAttribute(_2,"hspace"),f_width:_2.width,f_height:_2.height};
}else{
_4={f_base:_5,f_url:""};
}
Dialog(_3.config.URIs.insert_image,function(_b){
if(!_b){
return false;
}
var _c=_2;
if(!_c){
if(Xinha.is_ie){
var _d=_3.getSelection();
var _e=_3.createRange(_d);
_3._doc.execCommand("insertimage",false,_b.f_url);
_c=_e.parentElement();
if(_c.tagName.toLowerCase()!="img"){
_c=_c.previousSibling;
}
}else{
_c=document.createElement("img");
_c.src=_b.f_url;
_3.insertNodeAtSelection(_c);
if(!_c.tagName){
_c=_e.startContainer.firstChild;
}
}
}else{
_c.src=_b.f_url;
}
for(var _f in _b){
var _10=_b[_f];
switch(_f){
case "f_alt":
if(_10){
_c.alt=_10;
}else{
_c.removeAttribute("alt");
}
break;
case "f_border":
if(_10){
_c.border=parseInt(_10||"0");
}else{
_c.removeAttribute("border");
}
break;
case "f_align":
if(_10){
_c.align=_10;
}else{
_c.removeAttribute("align");
}
break;
case "f_vert":
if(_10!=""){
_c.vspace=parseInt(_10||"0");
}else{
_c.removeAttribute("vspace");
}
break;
case "f_horiz":
if(_10!=""){
_c.hspace=parseInt(_10||"0");
}else{
_c.removeAttribute("hspace");
}
break;
case "f_width":
if(_10){
_c.width=parseInt(_10||"0");
}else{
_c.removeAttribute("width");
}
break;
case "f_height":
if(_10){
_c.height=parseInt(_10||"0");
}else{
_c.removeAttribute("height");
}
break;
}
}
},_4);
};
+157
View File
@@ -0,0 +1,157 @@
<html>
<head>
<title>Insert Table</title>
<script type="text/javascript" src="../../popups/popup.js"></script>
<link rel="stylesheet" type="text/css" href="../../popups/popup.css" />
<script type="text/javascript">
window.resizeTo(425, 250);
Xinha = window.opener.Xinha;
function i18n(str) {
return (Xinha._lc(str, 'Xinha'));
}
function Init() {
Xinha = window.opener.Xinha; // load the Xinha plugin and lang file
__dlg_translate('Xinha');
__dlg_init(null, Xinha.is_ie ? null : {width:425,height:250});
// Make sure the translated string appears in the drop down. (for gecko)
document.getElementById("f_unit").selectedIndex = 1;
document.getElementById("f_unit").selectedIndex = 0;
document.getElementById("f_align").selectedIndex = 1;
document.getElementById("f_align").selectedIndex = 0;
document.getElementById("f_rows").focus();
}
function onOK() {
var required = {
"f_rows": i18n("You must enter a number of rows"),
"f_cols": i18n("You must enter a number of columns")
};
for (var i in required) {
var el = document.getElementById(i);
if (!el.value) {
alert(required[i]);
el.focus();
return false;
}
}
var fields = ["f_rows", "f_cols", "f_width", "f_unit", "f_fixed",
"f_align", "f_border", "f_spacing", "f_padding"];
var param = new Object();
for (var i in fields) {
var id = fields[i];
var el = document.getElementById(id);
param[id] = (el.type == "checkbox") ? el.checked : el.value;
}
__dlg_close(param);
return false;
}
function onCancel() {
__dlg_close(null);
return false;
}
</script>
</head>
<body class="dialog" onload="Init()">
<div class="title">Insert Table</div>
<form action="" method="get">
<table border="0" style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td style="width: 4em; text-align: right">Rows:</td>
<td><input type="text" name="rows" id="f_rows" size="5" title="Number of rows" value="2" /></td>
<td style="width: 4em; text-align: right">Width:</td>
<td><input type="text" name="width" id="f_width" size="5" title="Width of the table" value="100" /></td>
<td><select size="1" name="unit" id="f_unit" title="Width unit">
<option value="%" selected="selected" >Percent</option>
<option value="px" >Pixels</option>
<option value="em" >Em</option>
</select></td>
</tr>
<tr>
<td style="width: 4em; text-align: right">Cols:</td>
<td><input type="text" name="cols" id="f_cols" size="5" title="Number of columns" value="4" /></td>
<td style="text-align: right"><input type="checkbox" checked="checked" name="fixed" id="f_fixed" /></td>
<td colspan="2"><label for="f_fixed"
>Fixed width columns</label></td>
</tr>
</tbody>
</table>
<p />
<fieldset style="float: left; margin-left: 5px;">
<legend>Layout</legend>
<div class="space"></div>
<div class="fl">Alignment:</div>
<select size="1" name="align" id="f_align"
title="Positioning of this table">
<option value="" selected="selected" >Not set</option>
<option value="left" >Left</option>
<option value="right" >Right</option>
<option value="texttop" >Texttop</option>
<option value="absmiddle" >Absmiddle</option>
<option value="baseline" >Baseline</option>
<option value="absbottom" >Absbottom</option>
<option value="bottom" >Bottom</option>
<option value="middle" >Middle</option>
<option value="top" >Top</option>
</select>
<p />
<div class="fl">Border thickness:</div>
<input type="text" name="border" id="f_border" size="5" value="1"
title="Leave empty for no border" />
<!--
<p />
<div class="fl">Collapse borders:</div>
<input type="checkbox" name="collapse" id="f_collapse" />
-->
<div class="space"></div>
</fieldset>
<fieldset style="float:right; margin-right: 5px;">
<legend>Spacing</legend>
<div class="space"></div>
<div class="fr">Cell spacing:</div>
<input type="text" name="spacing" id="f_spacing" size="5" value="1"
title="Space between adjacent cells" />
<p />
<div class="fr">Cell padding:</div>
<input type="text" name="padding" id="f_padding" size="5" value="1"
title="Space between content and border in cell" />
<div class="space"></div>
</fieldset>
<div style="margin-top: 85px; border-top: 1px solid #999; padding: 2px; text-align: right;">
<button type="button" name="ok" onclick="return onOK();">OK</button>
<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
</div>
</form>
</body>
</html>
@@ -0,0 +1,66 @@
/* 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/InsertTable/insert_table.js */
InsertTable._pluginInfo={name:"InsertTable",origin:"Xinha Core",version:"$LastChangedRevision: 688 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),developer:"The Xinha Core Developer Team",developer_url:"$HeadURL: http://svn.xinha.python-hosting.com/trunk/modules/InsertTable/insert_table.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),sponsor:"",sponsor_url:"",license:"htmlArea"};
function InsertTable(_1){
}
Xinha.prototype._insertTable=function(){
var _2=this.getSelection();
var _3=this.createRange(_2);
var _4=this;
Dialog(_4.config.URIs.insert_table,function(_5){
if(!_5){
return false;
}
var _6=_4._doc;
var _7=_6.createElement("table");
for(var _8 in _5){
var _9=_5[_8];
if(!_9){
continue;
}
switch(_8){
case "f_width":
_7.style.width=_9+_5.f_unit;
break;
case "f_align":
_7.align=_9;
break;
case "f_border":
_7.border=parseInt(_9,10);
break;
case "f_spacing":
_7.cellSpacing=parseInt(_9,10);
break;
case "f_padding":
_7.cellPadding=parseInt(_9,10);
break;
}
}
var _a=0;
if(_5.f_fixed){
_a=Math.floor(100/parseInt(_5.f_cols,10));
}
var _b=_6.createElement("tbody");
_7.appendChild(_b);
for(var i=0;i<_5.f_rows;++i){
var tr=_6.createElement("tr");
_b.appendChild(tr);
for(var j=0;j<_5.f_cols;++j){
var td=_6.createElement("td");
if(_a){
td.style.width=_a+"%";
}
tr.appendChild(td);
td.appendChild(_6.createTextNode("\xa0"));
}
}
if(Xinha.is_ie){
_3.pasteHTML(_7.outerHTML);
}else{
_4.insertNodeAtSelection(_7);
}
return true;
},null);
};
@@ -0,0 +1,337 @@
/* 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/InternetExplorer/InternetExplorer.js */
InternetExplorer._pluginInfo={name:"Internet Explorer",origin:"Xinha Core",version:"$LastChangedRevision:980 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),developer:"The Xinha Core Developer Team",developer_url:"$HeadURL:http://svn.xinha.webfactional.com/trunk/modules/InternetExplorer/InternetExplorer.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),sponsor:"",sponsor_url:"",license:"htmlArea"};
function InternetExplorer(_1){
this.editor=_1;
_1.InternetExplorer=this;
}
InternetExplorer.prototype.onKeyPress=function(ev){
if(this.editor.isShortCut(ev)){
switch(this.editor.getKey(ev).toLowerCase()){
case "n":
this.editor.execCommand("formatblock",false,"<p>");
Xinha._stopEvent(ev);
return true;
break;
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
this.editor.execCommand("formatblock",false,"<h"+this.editor.getKey(ev).toLowerCase()+">");
Xinha._stopEvent(ev);
return true;
break;
}
}
switch(ev.keyCode){
case 8:
case 46:
if(this.handleBackspace()){
Xinha._stopEvent(ev);
return true;
}
break;
}
return false;
};
InternetExplorer.prototype.handleBackspace=function(){
var _3=this.editor;
var _4=_3.getSelection();
if(_4.type=="Control"){
var _5=_3.activeElement(_4);
Xinha.removeFromParent(_5);
return true;
}
var _6=_3.createRange(_4);
var r2=_6.duplicate();
r2.moveStart("character",-1);
var a=r2.parentElement();
if(a!=_6.parentElement()&&(/^a$/i.test(a.tagName))){
r2.collapse(true);
r2.moveEnd("character",1);
r2.pasteHTML("");
r2.select();
return true;
}
};
InternetExplorer.prototype.inwardHtml=function(_9){
_9=_9.replace(/<(\/?)del(\s|>|\/)/ig,"<$1strike$2");
_9=_9.replace(/(<script|<!--)/i,"&nbsp;$1");
return _9;
};
InternetExplorer.prototype.outwardHtml=function(_a){
_a=_a.replace(/&nbsp;(\s*)(<script|<!--)/i,"$1$2");
return _a;
};
InternetExplorer.prototype.onExecCommand=function(_b,UI,_d){
switch(_b){
case "saveas":
var _e=null;
var _f=this.editor;
var _10=document.createElement("iframe");
_10.src="about:blank";
_10.style.display="none";
document.body.appendChild(_10);
try{
if(_10.contentDocument){
_e=_10.contentDocument;
}else{
_e=_10.contentWindow.document;
}
}
catch(ex){
}
_e.open("text/html","replace");
var _11="";
if(_f.config.browserQuirksMode===false){
var _12="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
}else{
if(_f.config.browserQuirksMode===true){
var _12="";
}else{
var _12=Xinha.getDoctype(document);
}
}
if(!_f.config.fullPage){
_11+=_12+"\n";
_11+="<html>\n";
_11+="<head>\n";
_11+="<meta http-equiv=\"Content-Type\" content=\"text/html; charset="+_f.config.charSet+"\">\n";
if(typeof _f.config.baseHref!="undefined"&&_f.config.baseHref!==null){
_11+="<base href=\""+_f.config.baseHref+"\"/>\n";
}
if(typeof _f.config.pageStyleSheets!=="undefined"){
for(var i=0;i<_f.config.pageStyleSheets.length;i++){
if(_f.config.pageStyleSheets[i].length>0){
_11+="<link rel=\"stylesheet\" type=\"text/css\" href=\""+_f.config.pageStyleSheets[i]+"\">";
}
}
}
if(_f.config.pageStyle){
_11+="<style type=\"text/css\">\n"+_f.config.pageStyle+"\n</style>";
}
_11+="</head>\n";
_11+="<body>\n";
_11+=_f.getEditorContent();
_11+="</body>\n";
_11+="</html>";
}else{
_11=_f.getEditorContent();
if(_11.match(Xinha.RE_doctype)){
_f.setDoctype(RegExp.$1);
}
}
_e.write(_11);
_e.close();
_e.execCommand(_b,UI,_d);
document.body.removeChild(_10);
return true;
break;
case "removeformat":
var _f=this.editor;
var sel=_f.getSelection();
var _15=_f.saveSelection(sel);
var i,el,els;
function clean(el){
if(el.nodeType!=1){
return;
}
el.removeAttribute("style");
for(var j=0;j<el.childNodes.length;j++){
clean(el.childNodes[j]);
}
if((el.tagName.toLowerCase()=="span"&&!el.attributes.length)||el.tagName.toLowerCase()=="font"){
el.outerHTML=el.innerHTML;
}
}
if(_f.selectionEmpty(sel)){
els=_f._doc.body.childNodes;
for(i=0;i<els.length;i++){
el=els[i];
if(el.nodeType!=1){
continue;
}
if(el.tagName.toLowerCase()=="span"){
newNode=_f.convertNode(el,"div");
el.parentNode.replaceChild(newNode,el);
el=newNode;
}
clean(el);
}
}
_f._doc.execCommand(_b,UI,_d);
_f.restoreSelection(_15);
return true;
break;
}
return false;
};
Xinha.prototype.insertNodeAtSelection=function(_18){
this.insertHTML(_18.outerHTML);
};
Xinha.prototype.getParentElement=function(sel){
if(typeof sel=="undefined"){
sel=this.getSelection();
}
var _1a=this.createRange(sel);
switch(sel.type){
case "Text":
var _1b=_1a.parentElement();
while(true){
var _1c=_1a.duplicate();
_1c.moveToElementText(_1b);
if(_1c.inRange(_1a)){
break;
}
if((_1b.nodeType!=1)||(_1b.tagName.toLowerCase()=="body")){
break;
}
_1b=_1b.parentElement;
}
return _1b;
case "None":
return _1a.parentElement();
case "Control":
return _1a.item(0);
default:
return this._doc.body;
}
};
Xinha.prototype.activeElement=function(sel){
if((sel===null)||this.selectionEmpty(sel)){
return null;
}
if(sel.type.toLowerCase()=="control"){
return sel.createRange().item(0);
}else{
var _1e=sel.createRange();
var _1f=this.getParentElement(sel);
if(_1f.innerHTML==_1e.htmlText){
return _1f;
}
return null;
}
};
Xinha.prototype.selectionEmpty=function(sel){
if(!sel){
return true;
}
return this.createRange(sel).htmlText==="";
};
Xinha.prototype.saveSelection=function(){
return this.createRange(this.getSelection());
};
Xinha.prototype.restoreSelection=function(_21){
try{
_21.select();
}
catch(e){
}
};
Xinha.prototype.selectNodeContents=function(_22,pos){
this.focusEditor();
this.forceRedraw();
var _24;
var _25=typeof pos=="undefined"?true:false;
if(_25&&_22.tagName&&_22.tagName.toLowerCase().match(/table|img|input|select|textarea/)){
_24=this._doc.body.createControlRange();
_24.add(_22);
}else{
_24=this._doc.body.createTextRange();
_24.moveToElementText(_22);
}
_24.select();
};
Xinha.prototype.insertHTML=function(_26){
this.focusEditor();
var sel=this.getSelection();
var _28=this.createRange(sel);
_28.pasteHTML(_26);
};
Xinha.prototype.getSelectedHTML=function(){
var sel=this.getSelection();
if(this.selectionEmpty(sel)){
return "";
}
var _2a=this.createRange(sel);
if(_2a.htmlText){
return _2a.htmlText;
}else{
if(_2a.length>=1){
return _2a.item(0).outerHTML;
}
}
return "";
};
Xinha.prototype.getSelection=function(){
return this._doc.selection;
};
Xinha.prototype.createRange=function(sel){
if(!sel){
sel=this.getSelection();
}
return sel.createRange();
};
Xinha.prototype.isKeyEvent=function(_2c){
return _2c.type=="keydown";
};
Xinha.prototype.getKey=function(_2d){
return String.fromCharCode(_2d.keyCode);
};
Xinha.getOuterHTML=function(_2e){
return _2e.outerHTML;
};
Xinha.prototype.cc=String.fromCharCode(8201);
Xinha.prototype.setCC=function(_2f){
var cc=this.cc;
if(_2f=="textarea"){
var ta=this._textArea;
var pos=document.selection.createRange();
pos.collapse();
pos.text=cc;
var _33=ta.value.indexOf(cc);
var _34=ta.value.substring(0,_33);
var _35=ta.value.substring(_33+cc.length,ta.value.length);
if(_35.match(/^[^<]*>/)){
var _36=_35.indexOf(">")+1;
ta.value=_34+_35.substring(0,_36)+cc+_35.substring(_36,_35.length);
}else{
ta.value=_34+cc+_35;
}
ta.value=ta.value.replace(new RegExp("(&[^"+cc+"]*?)("+cc+")([^"+cc+"]*?;)"),"$1$3$2");
ta.value=ta.value.replace(new RegExp("(<script[^>]*>[^"+cc+"]*?)("+cc+")([^"+cc+"]*?</script>)"),"$1$3$2");
ta.value=ta.value.replace(new RegExp("^([^"+cc+"]*)("+cc+")([^"+cc+"]*<body[^>]*>)(.*?)"),"$1$3$2$4");
}else{
var sel=this.getSelection();
var r=sel.createRange();
if(sel.type=="Control"){
var _39=r.item(0);
_39.outerHTML+=cc;
}else{
r.collapse();
r.text=cc;
}
}
};
Xinha.prototype.findCC=function(_3a){
var _3b=(_3a=="textarea")?this._textArea:this._doc.body;
range=_3b.createTextRange();
if(range.findText(escape(this.cc))){
range.select();
range.text="";
}
if(range.findText(this.cc)){
range.select();
range.text="";
}
if(_3a=="textarea"){
this._textArea.focus();
}
};
Xinha.getDoctype=function(doc){
return (doc.compatMode=="CSS1Compat"&&Xinha.ie_version<8)?"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">":"";
};
+464
View File
@@ -0,0 +1,464 @@
/* 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/Opera/Opera.js */
Opera._pluginInfo={name:"Opera",origin:"Xinha Core",version:"$LastChangedRevision:970 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),developer:"The Xinha Core Developer Team",developer_url:"$HeadURL:http://svn.xinha.webfactional.com/trunk/modules/Opera/Opera.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),sponsor:"Gogo Internet Services Limited",sponsor_url:"http://www.gogo.co.nz/",license:"htmlArea"};
function Opera(_1){
this.editor=_1;
_1.Opera=this;
}
Opera.prototype.onKeyPress=function(ev){
var _3=this.editor;
var s=_3.getSelection();
if(_3.isShortCut(ev)){
switch(_3.getKey(ev).toLowerCase()){
case "z":
if(_3._unLink&&_3._unlinkOnUndo){
Xinha._stopEvent(ev);
_3._unLink();
_3.updateToolbar();
return true;
}
break;
case "a":
sel=_3.getSelection();
sel.removeAllRanges();
range=_3.createRange();
range.selectNodeContents(_3._doc.body);
sel.addRange(range);
Xinha._stopEvent(ev);
return true;
break;
case "v":
if(!_3.config.htmlareaPaste){
return true;
}
break;
}
}
switch(_3.getKey(ev)){
case " ":
var _5=function(_6,_7){
var _8=_6.nextSibling;
if(typeof _7=="string"){
_7=_3._doc.createElement(_7);
}
var a=_6.parentNode.insertBefore(_7,_8);
Xinha.removeFromParent(_6);
a.appendChild(_6);
_8.data=" "+_8.data;
s.collapse(_8,1);
_3._unLink=function(){
var t=a.firstChild;
a.removeChild(t);
a.parentNode.insertBefore(t,a);
Xinha.removeFromParent(a);
_3._unLink=null;
_3._unlinkOnUndo=false;
};
_3._unlinkOnUndo=true;
return a;
};
if(_3.config.convertUrlsToLinks&&s&&s.isCollapsed&&s.anchorNode.nodeType==3&&s.anchorNode.data.length>3&&s.anchorNode.data.indexOf(".")>=0){
var _b=s.anchorNode.data.substring(0,s.anchorOffset).search(/\S{4,}$/);
if(_b==-1){
break;
}
if(_3._getFirstAncestor(s,"a")){
break;
}
var _c=s.anchorNode.data.substring(0,s.anchorOffset).replace(/^.*?(\S*)$/,"$1");
var _d=_c.match(Xinha.RE_email);
if(_d){
var _e=s.anchorNode;
var _f=_e.splitText(s.anchorOffset);
var _10=_e.splitText(_b);
_5(_10,"a").href="mailto:"+_d[0];
break;
}
RE_date=/([0-9]+\.)+/;
RE_ip=/(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/;
var _11=_c.match(Xinha.RE_url);
if(_11){
if(RE_date.test(_c)){
break;
}
var _12=s.anchorNode;
var _13=_12.splitText(s.anchorOffset);
var _14=_12.splitText(_b);
_5(_14,"a").href=(_11[1]?_11[1]:"http://")+_11[2];
break;
}
}
break;
}
switch(ev.keyCode){
case 27:
if(_3._unLink){
_3._unLink();
Xinha._stopEvent(ev);
}
break;
break;
case 8:
case 46:
if(!ev.shiftKey&&this.handleBackspace()){
Xinha._stopEvent(ev);
}
default:
_3._unlinkOnUndo=false;
if(s.anchorNode&&s.anchorNode.nodeType==3){
var a=_3._getFirstAncestor(s,"a");
if(!a){
break;
}
if(!a._updateAnchTimeout){
if(s.anchorNode.data.match(Xinha.RE_email)&&a.href.match("mailto:"+s.anchorNode.data.trim())){
var _16=s.anchorNode;
var _17=function(){
a.href="mailto:"+_16.data.trim();
a._updateAnchTimeout=setTimeout(_17,250);
};
a._updateAnchTimeout=setTimeout(_17,1000);
break;
}
var m=s.anchorNode.data.match(Xinha.RE_url);
if(m&&a.href.match(new RegExp("http(s)?://"+Xinha.escapeStringForRegExp(s.anchorNode.data.trim())))){
var _19=s.anchorNode;
var _1a=function(){
m=_19.data.match(Xinha.RE_url);
if(m){
a.href=(m[1]?m[1]:"http://")+m[2];
}
a._updateAnchTimeout=setTimeout(_1a,250);
};
a._updateAnchTimeout=setTimeout(_1a,1000);
}
}
}
break;
}
return false;
};
Opera.prototype.handleBackspace=function(){
var _1b=this.editor;
setTimeout(function(){
var sel=_1b.getSelection();
var _1d=_1b.createRange(sel);
var SC=_1d.startContainer;
var SO=_1d.startOffset;
var EC=_1d.endContainer;
var EO=_1d.endOffset;
var _22=SC.nextSibling;
if(SC.nodeType==3){
SC=SC.parentNode;
}
if(!(/\S/.test(SC.tagName))){
var p=document.createElement("p");
while(SC.firstChild){
p.appendChild(SC.firstChild);
}
SC.parentNode.insertBefore(p,SC);
Xinha.removeFromParent(SC);
var r=_1d.cloneRange();
r.setStartBefore(_22);
r.setEndAfter(_22);
r.extractContents();
sel.removeAllRanges();
sel.addRange(r);
}
},10);
};
Opera.prototype.inwardHtml=function(_25){
_25=_25.replace(/<(\/?)del(\s|>|\/)/ig,"<$1strike$2");
return _25;
};
Opera.prototype.outwardHtml=function(_26){
return _26;
};
Opera.prototype.onExecCommand=function(_27,UI,_29){
switch(_27){
case "removeformat":
var _2a=this.editor;
var sel=_2a.getSelection();
var _2c=_2a.saveSelection(sel);
var _2d=_2a.createRange(sel);
var els=_2a._doc.body.getElementsByTagName("*");
var _2f=(_2d.startContainer.nodeType==1)?_2d.startContainer:_2d.startContainer.parentNode;
var i,el;
if(sel.isCollapsed){
_2d.selectNodeContents(_2a._doc.body);
}
for(i=0;i<els.length;i++){
el=els[i];
if(_2d.isPointInRange(el,0)||(els[i]==_2f&&_2d.startOffset==0)){
el.removeAttribute("style");
}
}
this.editor._doc.execCommand(_27,UI,_29);
_2a.restoreSelection(_2c);
return true;
break;
}
return false;
};
Opera.prototype.onMouseDown=function(ev){
};
Xinha.prototype.insertNodeAtSelection=function(_32){
if(_32.ownerDocument!=this._doc){
try{
_32=this._doc.adoptNode(_32);
}
catch(e){
}
}
this.focusEditor();
var sel=this.getSelection();
var _34=this.createRange(sel);
_34.deleteContents();
var _35=_34.startContainer;
var pos=_34.startOffset;
var _37=_32;
sel.removeAllRanges();
switch(_35.nodeType){
case 3:
if(_32.nodeType==3){
_35.insertData(pos,_32.data);
_34=this.createRange();
_34.setEnd(_35,pos+_32.length);
_34.setStart(_35,pos+_32.length);
sel.addRange(_34);
}else{
_35=_35.splitText(pos);
if(_32.nodeType==11){
_37=_37.firstChild;
}
_35.parentNode.insertBefore(_32,_35);
this.selectNodeContents(_37);
this.updateToolbar();
}
break;
case 1:
if(_32.nodeType==11){
_37=_37.firstChild;
}
_35.insertBefore(_32,_35.childNodes[pos]);
this.selectNodeContents(_37);
this.updateToolbar();
break;
}
};
Xinha.prototype.getParentElement=function(sel){
if(typeof sel=="undefined"){
sel=this.getSelection();
}
var _39=this.createRange(sel);
try{
var p=_39.commonAncestorContainer;
if(!_39.collapsed&&_39.startContainer==_39.endContainer&&_39.startOffset-_39.endOffset<=1&&_39.startContainer.hasChildNodes()){
p=_39.startContainer.childNodes[_39.startOffset];
}
while(p.nodeType==3){
p=p.parentNode;
}
return p;
}
catch(ex){
return null;
}
};
Xinha.prototype.activeElement=function(sel){
if((sel===null)||this.selectionEmpty(sel)){
return null;
}
if(!sel.isCollapsed){
if(sel.anchorNode.childNodes.length>sel.anchorOffset&&sel.anchorNode.childNodes[sel.anchorOffset].nodeType==1){
return sel.anchorNode.childNodes[sel.anchorOffset];
}else{
if(sel.anchorNode.nodeType==1){
return sel.anchorNode;
}else{
return null;
}
}
}
return null;
};
Xinha.prototype.selectionEmpty=function(sel){
if(!sel){
return true;
}
if(typeof sel.isCollapsed!="undefined"){
return sel.isCollapsed;
}
return true;
};
Xinha.prototype.saveSelection=function(){
return this.createRange(this.getSelection()).cloneRange();
};
Xinha.prototype.restoreSelection=function(_3d){
var sel=this.getSelection();
sel.removeAllRanges();
sel.addRange(_3d);
};
Xinha.prototype.selectNodeContents=function(_3f,pos){
this.focusEditor();
this.forceRedraw();
var _41;
var _42=typeof pos=="undefined"?true:false;
var sel=this.getSelection();
_41=this._doc.createRange();
if(_42&&_3f.tagName&&_3f.tagName.toLowerCase().match(/table|img|input|textarea|select/)){
_41.selectNode(_3f);
}else{
_41.selectNodeContents(_3f);
}
sel.removeAllRanges();
sel.addRange(_41);
};
Xinha.prototype.insertHTML=function(_44){
var sel=this.getSelection();
var _46=this.createRange(sel);
this.focusEditor();
var _47=this._doc.createDocumentFragment();
var div=this._doc.createElement("div");
div.innerHTML=_44;
while(div.firstChild){
_47.appendChild(div.firstChild);
}
var _49=this.insertNodeAtSelection(_47);
};
Xinha.prototype.getSelectedHTML=function(){
var sel=this.getSelection();
if(sel.isCollapsed){
return "";
}
var _4b=this.createRange(sel);
return Xinha.getHTML(_4b.cloneContents(),false,this);
};
Xinha.prototype.getSelection=function(){
var sel=this._iframe.contentWindow.getSelection();
if(sel&&sel.focusNode&&sel.focusNode.tagName&&sel.focusNode.tagName=="HTML"){
var bod=this._doc.getElementsByTagName("body")[0];
var rng=this.createRange();
rng.selectNodeContents(bod);
sel.removeAllRanges();
sel.addRange(rng);
sel.collapseToEnd();
}
return sel;
};
Xinha.prototype.createRange=function(sel){
this.activateEditor();
if(typeof sel!="undefined"){
try{
return sel.getRangeAt(0);
}
catch(ex){
return this._doc.createRange();
}
}else{
return this._doc.createRange();
}
};
Xinha.prototype.isKeyEvent=function(_50){
return _50.type=="keypress";
};
Xinha.prototype.getKey=function(_51){
return String.fromCharCode(_51.charCode);
};
Xinha.getOuterHTML=function(_52){
return (new XMLSerializer()).serializeToString(_52);
};
Xinha.prototype.setCC=function(_53){
var cc=String.fromCharCode(8286);
try{
if(_53=="textarea"){
var ta=this._textArea;
var _56=ta.selectionStart;
var _57=ta.value.substring(0,_56);
var _58=ta.value.substring(_56,ta.value.length);
if(_58.match(/^[^<]*>/)){
var _59=_58.indexOf(">")+1;
ta.value=_57+_58.substring(0,_59)+cc+_58.substring(_59,_58.length);
}else{
ta.value=_57+cc+_58;
}
ta.value=ta.value.replace(new RegExp("(&[^"+cc+"]*?)("+cc+")([^"+cc+"]*?;)"),"$1$3$2");
ta.value=ta.value.replace(new RegExp("(<script[^>]*>[^"+cc+"]*?)("+cc+")([^"+cc+"]*?</script>)"),"$1$3$2");
ta.value=ta.value.replace(new RegExp("^([^"+cc+"]*)("+cc+")([^"+cc+"]*<body[^>]*>)(.*?)"),"$1$3$2$4");
ta.value=ta.value.replace(cc,"<span id=\"XinhaOperaCaretMarker\">MARK</span>");
}else{
var sel=this.getSelection();
var _5b=this._doc.createElement("span");
_5b.id="XinhaOperaCaretMarker";
sel.getRangeAt(0).insertNode(_5b);
}
}
catch(e){
}
};
Xinha.prototype.findCC=function(_5c){
if(_5c=="textarea"){
var ta=this._textArea;
var pos=ta.value.search(/(<span\s+id="XinhaOperaCaretMarker"\s*\/?>((\s|(MARK))*<\/span>)?)/);
if(pos==-1){
return;
}
var cc=RegExp.$1;
var end=pos+cc.length;
var _61=ta.value.substring(0,pos);
var _62=ta.value.substring(end,ta.value.length);
ta.value=_61;
ta.scrollTop=ta.scrollHeight;
var _63=ta.scrollTop;
ta.value+=_62;
ta.setSelectionRange(pos,pos);
ta.focus();
ta.scrollTop=_63;
}else{
var _64=this._doc.getElementById("XinhaOperaCaretMarker");
if(_64){
this.focusEditor();
var rng=this.createRange();
rng.selectNode(_64);
var sel=this.getSelection();
sel.addRange(rng);
sel.collapseToStart();
this.scrollToElement(_64);
_64.parentNode.removeChild(_64);
return;
}
}
};
Xinha.getDoctype=function(doc){
var d="";
if(doc.doctype){
d+="<!DOCTYPE "+doc.doctype.name+" PUBLIC ";
d+=doc.doctype.publicId?"\""+doc.doctype.publicId+"\"":"";
d+=doc.doctype.systemId?" \""+doc.doctype.systemId+"\"":"";
d+=">";
}
return d;
};
Xinha.prototype._standardInitIframe=Xinha.prototype.initIframe;
Xinha.prototype.initIframe=function(){
if(!this._iframeLoadDone){
if(this._iframe.contentWindow&&this._iframe.contentWindow.xinhaReadyToRoll){
this._iframeLoadDone=true;
this._standardInitIframe();
}else{
var _69=this;
setTimeout(function(){
_69.initIframe();
},5);
}
}
};
Xinha._addEventOperaOrig=Xinha._addEvent;
Xinha._addEvent=function(el,_6b,_6c){
if(el.tagName&&el.tagName.toLowerCase()=="select"&&_6b=="change"){
return Xinha.addDom0Event(el,_6b,_6c);
}
return Xinha._addEventOperaOrig(el,_6b,_6c);
};
+478
View File
@@ -0,0 +1,478 @@
/* 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/WebKit/WebKit.js */
WebKit._pluginInfo={name:"WebKit",origin:"Xinha Core",version:"$LastChangedRevision:998 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),developer:"The Xinha Core Developer Team",developer_url:"$HeadURL:http://svn.xinha.webfactional.com/trunk/modules/WebKit/WebKit.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),sponsor:"",sponsor_url:"",license:"htmlArea"};
function WebKit(_1){
this.editor=_1;
_1.WebKit=this;
}
WebKit.prototype.onKeyPress=function(ev){
var _3=this.editor;
var s=_3.getSelection();
if(_3.isShortCut(ev)){
switch(_3.getKey(ev).toLowerCase()){
case "z":
if(_3._unLink&&_3._unlinkOnUndo){
Xinha._stopEvent(ev);
_3._unLink();
_3.updateToolbar();
return true;
}
break;
case "a":
break;
case "v":
if(!_3.config.htmlareaPaste){
return true;
}
break;
}
}
switch(_3.getKey(ev)){
case " ":
var _5=function(_6,_7){
var _8=_6.nextSibling;
if(typeof _7=="string"){
_7=_3._doc.createElement(_7);
}
var a=_6.parentNode.insertBefore(_7,_8);
Xinha.removeFromParent(_6);
a.appendChild(_6);
_8.data=" "+_8.data;
s.collapse(_8,1);
_3._unLink=function(){
var t=a.firstChild;
a.removeChild(t);
a.parentNode.insertBefore(t,a);
Xinha.removeFromParent(a);
_3._unLink=null;
_3._unlinkOnUndo=false;
};
_3._unlinkOnUndo=true;
return a;
};
if(_3.config.convertUrlsToLinks&&s&&s.isCollapsed&&s.anchorNode.nodeType==3&&s.anchorNode.data.length>3&&s.anchorNode.data.indexOf(".")>=0){
var _b=s.anchorNode.data.substring(0,s.anchorOffset).search(/\S{4,}$/);
if(_b==-1){
break;
}
if(_3._getFirstAncestor(s,"a")){
break;
}
var _c=s.anchorNode.data.substring(0,s.anchorOffset).replace(/^.*?(\S*)$/,"$1");
var _d=_c.match(Xinha.RE_email);
if(_d){
var _e=s.anchorNode;
var _f=_e.splitText(s.anchorOffset);
var _10=_e.splitText(_b);
_5(_10,"a").href="mailto:"+_d[0];
break;
}
RE_date=/([0-9]+\.)+/;
RE_ip=/(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/;
var _11=_c.match(Xinha.RE_url);
if(_11){
if(RE_date.test(_c)){
break;
}
var _12=s.anchorNode;
var _13=_12.splitText(s.anchorOffset);
var _14=_12.splitText(_b);
_5(_14,"a").href=(_11[1]?_11[1]:"http://")+_11[2];
break;
}
}
break;
}
switch(ev.keyCode){
case 13:
if(ev.shiftKey){
}
break;
case 27:
if(_3._unLink){
_3._unLink();
Xinha._stopEvent(ev);
}
break;
case 8:
case 46:
if(!ev.shiftKey&&this.handleBackspace()){
Xinha._stopEvent(ev);
}
break;
default:
_3._unlinkOnUndo=false;
if(s.anchorNode&&s.anchorNode.nodeType==3){
var a=_3._getFirstAncestor(s,"a");
if(!a){
break;
}
if(!a._updateAnchTimeout){
if(s.anchorNode.data.match(Xinha.RE_email)&&a.href.match("mailto:"+s.anchorNode.data.trim())){
var _16=s.anchorNode;
var _17=function(){
a.href="mailto:"+_16.data.trim();
a._updateAnchTimeout=setTimeout(_17,250);
};
a._updateAnchTimeout=setTimeout(_17,1000);
break;
}
var m=s.anchorNode.data.match(Xinha.RE_url);
if(m&&a.href.match(new RegExp("http(s)?://"+Xinha.escapeStringForRegExp(s.anchorNode.data.trim())))){
var _19=s.anchorNode;
var _1a=function(){
m=_19.data.match(Xinha.RE_url);
if(m){
a.href=(m[1]?m[1]:"http://")+m[2];
}
a._updateAnchTimeout=setTimeout(_1a,250);
};
a._updateAnchTimeout=setTimeout(_1a,1000);
}
}
}
break;
}
return false;
};
WebKit.prototype.handleBackspace=function(){
var _1b=this.editor;
setTimeout(function(){
var sel=_1b.getSelection();
var _1d=_1b.createRange(sel);
var SC=_1d.startContainer;
var SO=_1d.startOffset;
var EC=_1d.endContainer;
var EO=_1d.endOffset;
var _22=SC.nextSibling;
if(SC.nodeType==3){
SC=SC.parentNode;
}
if(!(/\S/.test(SC.tagName))){
var p=document.createElement("p");
while(SC.firstChild){
p.appendChild(SC.firstChild);
}
SC.parentNode.insertBefore(p,SC);
Xinha.removeFromParent(SC);
var r=_1d.cloneRange();
r.setStartBefore(_22);
r.setEndAfter(_22);
r.extractContents();
sel.removeAllRanges();
sel.addRange(r);
}
},10);
};
WebKit.prototype.inwardHtml=function(_25){
return _25;
};
WebKit.prototype.outwardHtml=function(_26){
return _26;
};
WebKit.prototype.onExecCommand=function(_27,UI,_29){
this.editor._doc.execCommand("styleWithCSS",false,false);
switch(_27){
case "paste":
alert(Xinha._lc("The Paste button does not work in the Safari browser for security reasons. Press CTRL-V on your keyboard to paste directly."));
return true;
break;
case "removeformat":
var _2a=this.editor;
var sel=_2a.getSelection();
var _2c=_2a.saveSelection(sel);
var _2d=_2a.createRange(sel);
var els=_2a._doc.getElementsByTagName("*");
els=Xinha.collectionToArray(els);
var _2f=(_2d.startContainer.nodeType==1)?_2d.startContainer:_2d.startContainer.parentNode;
var i,el,newNode,fragment,child,r2=_2a._doc.createRange();
function clean(el){
if(el.nodeType!=1){
return;
}
el.removeAttribute("style");
for(var j=0;j<el.childNodes.length;j++){
clean(el.childNodes[j]);
}
if((el.tagName.toLowerCase()=="span"&&!el.attributes.length)||el.tagName.toLowerCase()=="font"){
r2.selectNodeContents(el);
fragment=r2.extractContents();
while(fragment.firstChild){
child=fragment.removeChild(fragment.firstChild);
el.parentNode.insertBefore(child,el);
}
el.parentNode.removeChild(el);
}
}
if(sel.isCollapsed){
els=_2a._doc.body.childNodes;
for(i=0;i<els.length;i++){
el=els[i];
if(el.nodeType!=1){
continue;
}
if(el.tagName.toLowerCase()=="span"){
newNode=_2a.convertNode(el,"div");
el.parentNode.replaceChild(newNode,el);
el=newNode;
}
clean(el);
}
}else{
for(i=0;i<els.length;i++){
el=els[i];
if(_2d.isPointInRange(el,0)||(els[i]==_2f&&_2d.startOffset==0)){
clean(el);
}
}
}
r2.detach();
_2a.restoreSelection(_2c);
return true;
break;
}
return false;
};
WebKit.prototype.onMouseDown=function(ev){
if(ev.target.tagName.toLowerCase()=="hr"||ev.target.tagName.toLowerCase()=="img"){
this.editor.selectNodeContents(ev.target);
}
};
Xinha.prototype.insertNodeAtSelection=function(_34){
var sel=this.getSelection();
var _36=this.createRange(sel);
sel.removeAllRanges();
_36.deleteContents();
var _37=_36.startContainer;
var pos=_36.startOffset;
var _39=_34;
switch(_37.nodeType){
case 3:
if(_34.nodeType==3){
_37.insertData(pos,_34.data);
_36=this.createRange();
_36.setEnd(_37,pos+_34.length);
_36.setStart(_37,pos+_34.length);
sel.addRange(_36);
}else{
_37=_37.splitText(pos);
if(_34.nodeType==11){
_39=_39.firstChild;
}
_37.parentNode.insertBefore(_34,_37);
this.selectNodeContents(_39);
this.updateToolbar();
}
break;
case 1:
if(_34.nodeType==11){
_39=_39.firstChild;
}
_37.insertBefore(_34,_37.childNodes[pos]);
this.selectNodeContents(_39);
this.updateToolbar();
break;
}
};
Xinha.prototype.getParentElement=function(sel){
if(typeof sel=="undefined"){
sel=this.getSelection();
}
var _3b=this.createRange(sel);
try{
var p=_3b.commonAncestorContainer;
if(!_3b.collapsed&&_3b.startContainer==_3b.endContainer&&_3b.startOffset-_3b.endOffset<=1&&_3b.startContainer.hasChildNodes()){
p=_3b.startContainer.childNodes[_3b.startOffset];
}
while(p.nodeType==3){
p=p.parentNode;
}
return p;
}
catch(ex){
return null;
}
};
Xinha.prototype.activeElement=function(sel){
if((sel===null)||this.selectionEmpty(sel)){
return null;
}
if(!sel.isCollapsed){
if(sel.anchorNode.childNodes.length>sel.anchorOffset&&sel.anchorNode.childNodes[sel.anchorOffset].nodeType==1){
return sel.anchorNode.childNodes[sel.anchorOffset];
}else{
if(sel.anchorNode.nodeType==1){
return sel.anchorNode;
}else{
return null;
}
}
}
return null;
};
Xinha.prototype.selectionEmpty=function(sel){
if(!sel){
return true;
}
if(typeof sel.isCollapsed!="undefined"){
return sel.isCollapsed;
}
return true;
};
Xinha.prototype.saveSelection=function(){
return this.createRange(this.getSelection()).cloneRange();
};
Xinha.prototype.restoreSelection=function(_3f){
var sel=this.getSelection();
sel.removeAllRanges();
sel.addRange(_3f);
};
Xinha.prototype.selectNodeContents=function(_41,pos){
this.focusEditor();
this.forceRedraw();
var _43;
var _44=typeof pos=="undefined"?true:false;
var sel=this.getSelection();
_43=this._doc.createRange();
if(_44&&_41.tagName&&_41.tagName.toLowerCase().match(/table|img|input|textarea|select/)){
_43.selectNode(_41);
}else{
_43.selectNodeContents(_41);
}
sel.removeAllRanges();
sel.addRange(_43);
};
Xinha.prototype.insertHTML=function(_46){
var sel=this.getSelection();
var _48=this.createRange(sel);
this.focusEditor();
var _49=this._doc.createDocumentFragment();
var div=this._doc.createElement("div");
div.innerHTML=_46;
while(div.firstChild){
_49.appendChild(div.firstChild);
}
var _4b=this.insertNodeAtSelection(_49);
};
Xinha.prototype.getSelectedHTML=function(){
var sel=this.getSelection();
if(sel.isCollapsed){
return "";
}
var _4d=this.createRange(sel);
if(_4d){
return Xinha.getHTML(_4d.cloneContents(),false,this);
}else{
return "";
}
};
Xinha.prototype.getSelection=function(){
return this._iframe.contentWindow.getSelection();
};
Xinha.prototype.createRange=function(sel){
this.activateEditor();
if(typeof sel!="undefined"){
try{
return sel.getRangeAt(0);
}
catch(ex){
return this._doc.createRange();
}
}else{
return this._doc.createRange();
}
};
Xinha.prototype.isKeyEvent=function(_4f){
return _4f.type=="keypress";
};
Xinha.prototype.getKey=function(_50){
var key=String.fromCharCode(parseInt(_50.keyIdentifier.replace(/^U\+/,""),16));
if(_50.shiftKey){
return key;
}else{
return key.toLowerCase();
}
};
Xinha.getOuterHTML=function(_52){
return (new XMLSerializer()).serializeToString(_52);
};
Xinha.prototype.cc=String.fromCharCode(8286);
Xinha.prototype.setCC=function(_53){
var cc=this.cc;
try{
if(_53=="textarea"){
var ta=this._textArea;
var _56=ta.selectionStart;
var _57=ta.value.substring(0,_56);
var _58=ta.value.substring(_56,ta.value.length);
if(_58.match(/^[^<]*>/)){
var _59=_58.indexOf(">")+1;
ta.value=_57+_58.substring(0,_59)+cc+_58.substring(_59,_58.length);
}else{
ta.value=_57+cc+_58;
}
ta.value=ta.value.replace(new RegExp("(&[^"+cc+"]*?)("+cc+")([^"+cc+"]*?;)"),"$1$3$2");
ta.value=ta.value.replace(new RegExp("(<script[^>]*>[^"+cc+"]*?)("+cc+")([^"+cc+"]*?</script>)"),"$1$3$2");
ta.value=ta.value.replace(new RegExp("^([^"+cc+"]*)("+cc+")([^"+cc+"]*<body[^>]*>)(.*?)"),"$1$3$2$4");
}else{
var sel=this.getSelection();
sel.getRangeAt(0).insertNode(this._doc.createTextNode(cc));
}
}
catch(e){
}
};
Xinha.prototype.findCC=function(_5b){
if(_5b=="textarea"){
var ta=this._textArea;
var pos=ta.value.indexOf(this.cc);
if(pos==-1){
return;
}
var end=pos+this.cc.length;
var _5f=ta.value.substring(0,pos);
var _60=ta.value.substring(end,ta.value.length);
ta.value=_5f;
ta.scrollTop=ta.scrollHeight;
var _61=ta.scrollTop;
ta.value+=_60;
ta.setSelectionRange(pos,pos);
ta.focus();
ta.scrollTop=_61;
}else{
var _62=this;
try{
var doc=this._doc;
doc.body.innerHTML=doc.body.innerHTML.replace(new RegExp(this.cc),"<span id=\"XinhaEditingPostion\"></span>");
var _64=doc.getElementById("XinhaEditingPostion");
this.selectNodeContents(_64);
this.scrollToElement(_64);
_64.parentNode.removeChild(_64);
this._iframe.contentWindow.focus();
}
catch(e){
}
}
};
Xinha.prototype._standardToggleBorders=Xinha.prototype._toggleBorders;
Xinha.prototype._toggleBorders=function(){
var _65=this._standardToggleBorders();
var _66=this._doc.getElementsByTagName("TABLE");
for(var i=0;i<_66.length;i++){
_66[i].style.display="none";
_66[i].style.display="table";
}
return _65;
};
Xinha.getDoctype=function(doc){
var d="";
if(doc.doctype){
d+="<!DOCTYPE "+doc.doctype.name+" PUBLIC ";
d+=doc.doctype.publicId?"\""+doc.doctype.publicId+"\"":"";
d+=doc.doctype.systemId?" \""+doc.doctype.systemId+"\"":"";
d+=">";
}
return d;
};