function mouseDown(e){ if(event.button == 2){ // alert("ÆíÁý±â¿¡¼­´Â ¸¶¿ì½ºÀÇ ¿ÞÂÊ ¹öÆ°¸¸ »ç¿ëµË´Ï´Ù."); // return false; } } /**** Ư¼ö¹®ÀÚ »ðÀÔ ****/ function InsertSpecialCharacter() { var retString = window.showModalDialog("/newpopko/editer/frmSpChPanel.asp", "" ,"dialogHeight: 520px; dialogWidth: 350px; edge: Raised; center: Yes; scroll: No; help: No; resizable: No; status: No;"); window.frames['psk_Editer'].focus(); var selection = window.frames['psk_Editer'].document.selection.createRange(); if (retString != null) selection.pasteHTML(retString); } /**** ÆíÁý±â⠱⺻¼ÂÆà S ****/ function psk_stylesheet(StyleFile){ this['psk_Editer'].document.designMode = "On"; if(this['psk_Editer'].document.readyState == "complete"){ this['psk_Editer'].document.createStyleSheet(StyleFile); } } /**** ÆíÁý±â⠱⺻¼ÂÆà E ****/ /**** ÆíÁý±ââ ¸ðµå Àüȯ S ****/ function psk_edit_mode(){ var mode; if(document.all.HTML.checked == true) mode = "HTML"; else mode = "EDITOR"; if(mode == "EDITOR"){ iText = this['psk_Editer'].document.body.innerText; this['psk_Editer'].document.body.innerHTML = iText; } else if(mode == "HTML"){ iHTML = this['psk_Editer'].document.body.innerHTML; this['psk_Editer'].document.body.innerText = iHTML; } } /**** ÆíÁý±ââ ¸ðµå Àüȯ E ****/ /**** À̹ÌÁö ³Ö±â ****/ function psk_image_up(id){ if(document.all.HTML.checked == true){ alert("HTMLÆíÁý ÇØÁ¦ÈÄ »ç¿ëÇϼ¼¿ä. "); return false; } // insert image // window.frames['psk_Editer'].focus(); var gValues = showModalDialog('../board/editer/img_library.php', 'image', 'dialogWidth:440px; dialogHeight:160px; status:no ; center: Yes; scroll: No;'); if(gValues != null){ if(gValues.Type == 'Geturl') imgSrc = gValues.Src; else if(gValues.Type == 'Upload') { UpImages[UpImages.length] = gValues.Src; imgSrc = gValues.Src; } this['psk_Editer'].document.execCommand('insertimage', false, imgSrc); } } function html_check(){ if(document.all.HTML.checked == true){ alert("HTMLÆíÁý ÇØÁ¦ÈÄ »ç¿ëÇϼ¼¿ä. "); return false; } } /**** ÀϹÝÀûÀÎ HTML ÅÂ±× S ****/ function psk_click(type, sender){ if(document.all.HTML.checked == true){ alert("HTMLÆíÁý ÇØÁ¦ÈÄ »ç¿ëÇϼ¼¿ä. "); return false; } psk_Editer.focus(); if(type == 'link'){ // Hyperlink // this['psk_Editer'].document.execCommand('createlink'); Editer = eval(window.frames['psk_Editer'].document.body); Atag = Editer.getElementsByTagName("A"); if(Atag){ for(i=0; i 1) { str.cells(i).rowSpan++; } else { var newcell = str.cells(i).cloneNode(); newrow.appendChild(newcell); } } for (i=0; i (str.rowIndex - i)) { temprow.cells(j).rowSpan++; } } } } this['psk_Editer'].focus(); } // insert tr // function psk_Get(getObject) { if (window.frames['psk_Editer'].document.selection.type == "Control") { return(null); } else { this['psk_Editer'].focus(); var tSelect = window.frames["psk_Editer"].document.selection.createRange(); //var tSelect = psk_Editer.document.selection.createRange(); //alert(tSelect.tagName); tSelect = tSelect.parentElement(); if(getObject == 'TR') { while ((tSelect.tagName != 'TR') && (tSelect.tagName != 'TABLE') && (tSelect.tagName != 'BODY')) { tSelect = tSelect.parentElement; } } else if(getObject == 'TABLE') { while ((tSelect.tagName != 'TABLE') && (tSelect.tagName != 'BODY')) { tSelect = tSelect.parentElement; } } else if(getObject == 'TD') { while ((tSelect.tagName != 'TD') && (tSelect.tagName != 'TH') && (tSelect.tagName != 'TABLE') && (tSelect.tagName != 'BODY')) { tSelect = tSelect.parentElement; } } if (tSelect.tagName == getObject) { return(tSelect); } else { return(null); } } } // insert td // function psk_table_col_insert(editor, sender) { var stable = psk_Get('TABLE'); var str = psk_Get('TR'); var std = psk_Get('TD'); if (stable && std && str) { // get "real" cell position and form cell matrix var tm = SPAW_formCellMatrix(stable); for (j=0; j 1) { stable.rows(i).cells(tm[i][realIndex]).colSpan++; } else { var newc = stable.rows(i).insertCell(tm[i][realIndex]+1); var nc = stable.rows(i).cells(tm[i][realIndex]).cloneNode(); newc.replaceNode(nc); } } } } this['psk_Editer'].focus(); } // insert td // function psk_table_row_delete(editor, sender) { // var ct = SPAW_getTable(editor); // current table // var cr = SPAW_getTR(editor); // current row // var cd = SPAW_getTD(editor); // current cell var stable = psk_Get('TABLE'); var str = psk_Get('TR'); var std = psk_Get('TD'); if (stable && str && std) { if (stable.rows.length<=1) { // ¼±ÅÃÇÑ Ç¥°¡ ÇÑÁÙÀÏ°æ¿ì Ç¥ »èÁ¦ // stable.removeNode(true); } else { // get "real" cell position and form cell matrix var tm = SPAW_formCellMatrix(stable); // decrease rowspan for cells that were spanning through current row for (i=0; i (str.rowIndex - i)) { temprrow.cells(j).rowSpan--; } } } curCI = -1; // check for current row cells spanning more than 1 row for (i=0; i1 && (cr.rowIndex+1)1)?str.cells(curCI).colSpan:1; for (j=i; j<(i+cs);j++) { tm[str.rowIndex+1][j] = nrCI; nj = j; } for (j=nj; j1) { ct.rows(i).cells(tm[i][realIndex]).colSpan--; } else { ct.rows(i).deleteCell(tm[i][realIndex]); } } } } } this['psk_Editer'].focus(); } // delete td // function SPAW_formCellMatrix(ct) { var tm = new Array(); for (i=0; i1) { // split only current cell // find where to insert a cell in the next row i = realIndex; while (tm[cr.rowIndex+1][i] == -1){ i++; } if (i == tm[cr.rowIndex+1].length) { ni = ct.rows(cr.rowIndex+1).cells.length; } else { ni = tm[cr.rowIndex+1][i]; } var newc = ct.rows(cr.rowIndex+1).insertCell(ni); cd.rowSpan--; var nc = cd.cloneNode(); newc.replaceNode(nc); cd.rowSpan = 1; } else { // add new row and make all other cells to span one row more ct.insertRow(cr.rowIndex+1); for (i=0; i1?cr.cells(i).rowSpan:1; cr.cells(i).rowSpan = rs+1; } } for (i=0; i (cr.rowIndex - i)) { tempr.cells(j).rowSpan++; } } } // clone current cell to new row var newc = ct.rows(cr.rowIndex+1).insertCell(0); var nc = cd.cloneNode(); newc.replaceNode(nc); } } this['psk_Editer'].focus(); } // divide tr // // divide td // function psk_table_col_divide(editor, sender) { var ct = psk_Get("TABLE"); var cr = psk_Get("TR"); var cd = psk_Get("TD"); if (cd && cr && ct) { // get "real" cell position and form cell matrix var tm = SPAW_formCellMatrix(ct); for (j=0; j1) { // split only current cell var newc = ct.rows(cr.rowIndex).insertCell(cd.cellIndex+1); cd.colSpan--; var nc = cd.cloneNode(); newc.replaceNode(nc); cd.colSpan = 1; } else { // clone current cell var newc = ct.rows(cr.rowIndex).insertCell(cd.cellIndex+1); var nc = cd.cloneNode(); newc.replaceNode(nc); for (i=0; i1?ct.rows(i).cells(tm[i][realIndex]).colSpan:1; ct.rows(i).cells(tm[i][realIndex]).colSpan = cs+1; } } } } this['psk_Editer'].focus(); } // divide td // // merge td // function psk_table_cols_merge(editor, sender) { var ct = psk_Get("TABLE"); var cr = psk_Get("TR"); var cd = psk_Get("TD"); if (cd && cr && ct) { // get "real" cell position and form cell matrix var tm = SPAW_formCellMatrix(ct); for (j=0; j0 && (tm[cr.rowIndex+ccrs][crealIndex-1]!=tm[cr.rowIndex+ccrs][crealIndex])))) { ncrs = ct.rows(cr.rowIndex+ccrs).cells(ncellIndex).rowSpan?ct.rows(cr.rowIndex+ccrs).cells(ncellIndex).rowSpan:1; nccs = ct.rows(cr.rowIndex+ccrs).cells(ncellIndex).colSpan?ct.rows(cr.rowIndex+ccrs).cells(ncellIndex).colSpan:1; // proceed only if current and next cell colspans are equal if (cccs == nccs) { // increase rowspan of current cell and append content of the next cell to current cd.innerHTML += ct.rows(cr.rowIndex+ccrs).cells(ncellIndex).innerHTML; ct.rows(cr.rowIndex+ccrs).deleteCell(ncellIndex); cd.rowSpan = ccrs+ncrs; } } } } this['psk_Editer'].focus(); } // merge tr // /* function SPAW_getParentTag(editor) { var trange = this[editor+'_rEdit'].document.selection.createRange(); if (window.frames[editor+'_rEdit'].document.selection.type != "Control") { return (trange.parentElement()); } else { return (trange(0)); } } // trim functions function SPAW_ltrim(txt) { var spacers = " \t\r\n"; while (spacers.indexOf(txt.charAt(0)) != -1) { txt = txt.substr(1); } return(txt); } function SPAW_rtrim(txt) { var spacers = " \t\r\n"; while (spacers.indexOf(txt.charAt(txt.length-1)) != -1) { txt = txt.substr(0,txt.length-1); } return(txt); } function SPAW_trim(txt) { return(SPAW_ltrim(SPAW_rtrim(txt))); } // is selected text a full tags inner html? function SPAW_isFoolTag(editor, el) { var trange = this[editor+'_rEdit'].document.selection.createRange(); var ttext; if (trange != null) ttext = SPAW_trim(trange.htmlText); if (ttext != SPAW_trim(el.innerHtml)) return false; else return true; } // switch to wysiwyg mode // switch to html mode function SPAW_getFieldByEditor(editor, field) { var thefield; // get field by editor name if no field passed if (field == null || field == "") { var flds = document.getElementsByName(editor); thefield = flds[0].id; } else { thefield=field; } return thefield; } function SPAW_getHtmlValue(editor, thefield) { var htmlvalue; if(document.all['SPAW_'+editor+'_editor_mode'].value == 'design') { // wysiwyg htmlvalue = this[editor+'_rEdit'].document.body.innerHTML; } else { // code htmlvalue = document.all[thefield].value; } return htmlvalue; } function SPAW_updateField(editor, field) { var thefield = SPAW_getFieldByEditor(editor, field); var htmlvalue = SPAW_getHtmlValue(editor, thefield); if (document.all[thefield].value != htmlvalue) { // something changed document.all[thefield].value = htmlvalue; } } function SPAW_confirm(editor,block,message) { return showModalDialog('/spaw/spaw/dialogs/confirm.php?lang=' + document.all['SPAW_'+editor+'_lang'].value + '&theme=' + document.all['SPAW_'+editor+'_theme'].value + '&block=' + block + '&message=' + message, null, 'dialogHeight:100px; dialogWidth:300px; resizable:no; status:no'); } // toggle borders worker function function SPAW_toggle_borders(editor, root, toggle) { // get toggle mode (on/off) var toggle_mode = toggle; if (toggle == null) { var tgl_borders = document.getElementById("SPAW_"+editor+"_borders"); if (tgl_borders != null) { toggle_mode = tgl_borders.value; } else { toggle_mode = "on" } } var tbls = new Array(); if (root.tagName == "TABLE") { tbls[0] = root; } else { // get all tables starting from root tbls = root.getElementsByTagName("TABLE"); } var tbln = 0; if (tbls != null) tbln = tbls.length; for (ti = 0; ti