diff --git a/webedit/Editor.html b/webedit/Editor.html index 49a2076..22fd97b 100644 --- a/webedit/Editor.html +++ b/webedit/Editor.html @@ -2,107 +2,29 @@ // 웹에디터 필드명 if($edit_name == "") $edit_name = "contents"; if($edit_width == "") $edit_width="100%"; -if($edit_height == "") $edit_height="400"; -if($edit_skin == "") $edit_skin=""; -if($edit_lang == "") $edit_lang="en-US"; +if($edit_height == "") $edit_height="300"; ?> - - -
- - - - - - - + + + + - \ No newline at end of file +var = new cheditor(); // 에디터 개체를 생성합니다. +.config.editorHeight = 'px'; // 에디터 세로폭입니다. +.config.editorWidth = ''; // 에디터 가로폭입니다. +.inputForm = ''; // textarea의 ID 이름입니다. +.run(); // 에디터를 실행합니다. + \ No newline at end of file diff --git a/webedit/cheditor.js b/webedit/cheditor.js new file mode 100644 index 0000000..74785e4 --- /dev/null +++ b/webedit/cheditor.js @@ -0,0 +1,7815 @@ +// ================================================================ +// CHEditor 5.1.4 +// ---------------------------------------------------------------- +// Homepage: http://www.chcode.com +// EMail: support@chcode.com +// Copyright (c) 1997-2015 CHSOFT +// ================================================================ +var GB = { + colors:["#000000","#313131","#434343","#535353","#666666","#999999","#a0a0a0","#b5b5b5","#c0c0c0","#dcdcdc","#eeeeee","#ffffff", + "#ff0000","#ff8000","#ffff00","#80ff00","#00ff00","#00ff99","#00ffff","#0080ff","#0000ff","#7f00ff","#ff00ff","#ff007f", + "#ffcccc","#ffe5cc","#ffffcc","#e5ffcc","#ccffcc","#ccffe5","#ccffff","#cce5ff","#ccccff","#e5ccff","#ffccff","#ffcce5", + "#ff9999","#ffcc99","#ffff99","#ccff99","#99ff99","#99ffcc","#99ffff","#99ccff","#9999ff","#cc99ff","#ff99ff","#ff99cc", + "#ff6666","#ffb266","#ffff66","#b2ff66","#66ff66","#66ffb2","#66ffff","#66b2ff","#6666ff","#b266ff","#ff66ff","#ff66b2", + "#ff3333","#ff9933","#ffff33","#99ff33","#33ff33","#33ff99","#33ffff","#3399ff","#3333ff","#9933ff","#ff33ff","#ff3399", + "#cc0000","#cc6600","#cccc00","#66cc00","#00cc00","#00cc66","#00cccc","#0066cc","#0000cc","#6600cc","#cc00cc","#cc0066", + "#990000","#994c00","#999900","#4c9900","#009900","#00994c","#009999","#004c99","#000099","#4c0099","#990099","#99004c", + "#660000","#663300","#666600","#336600","#006600","#006633","#006666","#003366","#000066","#330066","#660066","#660033"], + offElements : { + img:1, hr:1, table:1, embed:1, object:1, input:1, form:1, select:1, textarea:1, button:1, fieldset:1 + }, + emptyElements : { + area:1, base:1, basefont:1, col:1, frame:1, hr:1, img:1, br:1, input:1, isindex:1, link:1, meta:1, + param:1, source:1, track:1, wbr:1, keygen:1, menuitem:1 + }, + textFormatting : { + addr:1, acronym:1, b:1, bdo:1, big:1, cite:1, code:1, del:1, dfn:1, em:1, font:1, i:1, ins:1, kbd:1, q:1, + samp:1, small:1, span:1, strike:1, strong:1, sub:1, sup:1, tt:1, u:1, 'var':1 + }, + newLineBefore : '|div|p|blockquote|table|tbody|tr|td|th|title|head|body|script|comment|li|meta|h1|h2|h3|h4|h5|h6|hr|ul|ol|link|', + lineHeightBlock : '|address|blockquote|dd|div|dl|h1|h2|h3|h4|h5|h6|li|p|pre|td|th|code|section|aside|article|figcaption|', + doctype : '', + popupWindow : { + ImageUpload : {tmpl : 'image.html', width : 700, posv: 420, title : '내 PC 사진 넣기'}, + ImageUrl : {tmpl : 'image_url.html', width : 350, posv: 380, title : '웹 사진 넣기'}, + Embed : {tmpl : 'media.html', width : 430, posv: 380, title : '미디어'}, + Table : {tmpl : 'table.html', width : 430, posv: 390, title : '표 만들기'}, + ModifyTable : {tmpl : 'table_modify.html', width : 430, posv: 390, title : '표 고치기'}, + Layout : {tmpl : 'layout.html', width : 430, posv: 420, title : '레이아웃'}, + Link : {tmpl : 'link.html', width : 350, posv: 200, title : '하이퍼링크'}, + EmotionIcon : {tmpl : 'icon.html', width : 300, posv: 200, title : '표정 아이콘'}, + Symbol : {tmpl : 'symbol.html', width : 450, posv: 300, title : '특수 문자'}, + GoogleMap : {tmpl : 'google_map.html', width : 538, posv: 450, title : '구글 지도'}, + ColorPicker : {tmpl : 'color_picker.html', width : 420, posv: 200, title : '색상 선택'}, + FlashMovie : {tmpl : 'flash.html', width : 584, posv: 474, title : '플래쉬 동영상'} + }, + fontName : { + 'kr' : ['맑은 고딕', '돋움', '굴림', '바탕', '궁서'], + 'en' : ['Arial', 'Comic Sans MS', 'Courier New', 'Georgia', 'Lucida Sans Unicode', 'Tahoma', 'Times New Roman', 'Verdana'] + }, + fontStyle : { + 'FontSize':'font-size', 'FontName':'font-family', 'ForeColor':'color', 'BackColor':'background-color' + }, + textAlign : { + 'JustifyLeft':'', 'JustifyCenter':'center','JustifyRight':'right','JustifyFull':'justify' + }, + listStyle : { + 'ordered' : { + 'decimal':'숫자', 'lower-alpha':'영문 소문자', 'upper-alpha':'영문 대문자', 'lower-roman':'로마 소문자', 'upper-roman':'로마 대문자' + }, + 'unOrdered' : {'desc':'동그라미', 'circle':'빈 원', 'square':'사각형'} + }, + fontSize : { + 'pt' : [7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36], + 'px' : [9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72] + }, + formatBlock : { + 'P' : 'Normal (P)', + 'H1' : 'Heading 1', + 'H2' : 'Heading 2', + 'H3' : 'Heading 3', + 'H4' : 'Heading 4', + 'H5' : 'Heading 5', + 'H6' : 'Heading 6', + 'ADDRESS' : 'Address', + 'DIV' : 'DIV', + 'PRE' : 'Preformatted (PRE)' + }, + lineHeight : { + '한 줄 간격': 1, '1.15': 1.15, '1.5': 1.5, '1.7': 1.7, '1.8': 1.8, '두 줄 간격': 2 + }, + textBlock : [ + ['1px #dedfdf solid','#f7f7f7'], + ['1px #aee8e8 solid','#bfffff'], + ['1px #d3bceb solid','#e6ccff'], + ['1px #e8e88b solid','#ffff99'], + ['1px #c3e89e solid','#d6ffad'], + ['1px #e8c8b7 solid','#ffdcc9'], + ['1px #666666 dashed','#ffffff'], + ['1px #d4d4d4 solid','#ffffff'], + ['1px #cccccc inset','#f7f7f7'] + ], + node : { + element: 1, attribute: 2, text: 3, cdata_section: 4, entity_reference: 5, entity: 6, + processing_instruction: 7, comment: 8, document: 9, document_type: 10, document_fragment: 11, + notation: 12 + }, + + selection : { none: 1, text: 2, element: 3 }, + readyState : { 0: 'uninitialized', 1: 'loading', 2: 'loaded', 3: 'interactive', 4: 'complete' }, + + prettify : null, + dragWindow : null, + readyEditor: 0, + browser : {} +}; + +function isUndefined (obj) { + return obj === void(0); // obj === undefined; +} + +function detechBrowser () { + function detect(ua) { + function getFirstMatch(regex) { + var match = ua.match(regex); + return (match && match.length > 1 && match[1]) || ''; + } + var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase() + ,likeAndroid = /like android/i.test(ua) + ,android = !likeAndroid && /android/i.test(ua) + ,versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i) + ,tablet = /tablet/i.test(ua) + ,mobile = !tablet && /[^\-]mobi/i.test(ua) + ,result; + + if (/opera|opr/i.test(ua)) { + result = { + name: 'Opera', opera: true , + version: versionIdentifier || getFirstMatch(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i) + }; + } + else if (/windows phone/i.test(ua)) { + result = { + name: 'Windows Phone', windowsphone: true, msie: true, + version: getFirstMatch(/iemobile\/(\d+(\.\d+)?)/i) + }; + } + else if (/msie|trident/i.test(ua)) { + result = { + name: 'Internet Explorer', msie: true, version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i) + }; + } + else if (/edge/i.test(ua)) { + result = { + name: 'edge', edge: true, version: getFirstMatch(/(?:edge)\/(\d+(\.\d+)?)/i) + }; + } + else if (/chrome|crios|crmo/i.test(ua)) { + result = { + name: 'Chrome', chrome: true, version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i) + }; + } + else if (iosdevice) { + result = { + name: iosdevice === 'iphone' ? 'iPhone' : iosdevice === 'ipad' ? 'iPad' : 'iPod' + }; + if (versionIdentifier) { result.version = versionIdentifier; } + } + else if (/firefox|iceweasel/i.test(ua)) { + result = { + name: 'Firefox', firefox: true, + version: getFirstMatch(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i) + }; + if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) { result.firefoxos = true; } + } + else if (/silk/i.test(ua)) { + result = { + name: 'Amazon Silk', silk: true, version : getFirstMatch(/silk\/(\d+(\.\d+)?)/i) + }; + } + else if (android) { + result = { name: 'Android', version: versionIdentifier }; + } + else if (/phantom/i.test(ua)) { + result = { + name: 'PhantomJS', phantom: true, version: getFirstMatch(/phantomjs\/(\d+(\.\d+)?)/i) + }; + } + else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) { + result = { + name: 'BlackBerry', blackberry: true, + version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i) + }; + } + else if (/(web|hpw)os/i.test(ua)) { + result = { + name: 'WebOS' , webos: true , + version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i) + }; + if (/touchpad\//i.test(ua)) { result.touchpad = true; } + } + else if (/safari/i.test(ua)) { + result = { + name: 'Safari', safari: true, version: versionIdentifier + }; + } + else { + result = {}; + } + + if (/(apple)?webkit/i.test(ua)) { + result.name = result.name || "Webkit"; + result.webkit = true; + if (!result.version && versionIdentifier) { result.version = versionIdentifier; } + } + else if (!result.opera && /gecko\//i.test(ua)) { + result.gecko = true; + result.version = result.version || getFirstMatch(/gecko\/(\d+(\.\d+)?)/i); + result.name = result.name || "Gecko"; + } + if (android || result.silk) { result.android = true; } + else if (iosdevice) { + result[iosdevice] = true; + result.ios = true; + } + + var osVersion = ''; + if (iosdevice) { + osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i); + osVersion = osVersion.replace(/[_\s]/g, '.'); + } + else if (android) { osVersion = getFirstMatch(/android[ \/\-](\d+(\.\d+)*)/i); } + else if (result.windowsphone) { osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i); } + else if (result.webos) { osVersion = getFirstMatch(/(?:web|hpw)os\/(\d+(\.\d+)*)/i); } + else if (result.blackberry) { osVersion = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i); } + + if (osVersion) { result.osversion = osVersion; } + + var osMajorVersion = osVersion.split('.')[0]; + if (tablet || iosdevice === 'ipad' || + (android && (osMajorVersion === 3 || (osMajorVersion === 4 && !mobile))) || + result.silk) + { + result.tablet = true; + } + else if (mobile || iosdevice === 'iphone' || iosdevice === 'ipod' || android || + result.blackberry || result.webos) + { + result.mobile = true; + } + + if ((result.msie && result.version >= 10) || + (result.chrome && result.version >= 20) || + (result.firefox && result.version >= 20.0) || + (result.safari && result.version >= 6) || + (result.opera && result.version >= 10.0) || + (result.ios && result.osversion && result.osversion.split(".")[0] >= 6) || + (result.blackberry && result.version >= 10.1)) + { + result.a = true; + } + else if ((result.msie && result.version < 10) || + (result.chrome && result.version < 20) || + (result.firefox && result.version < 20.0) || + (result.safari && result.version < 6) || + (result.opera && result.version < 10.0) || + (result.ios && result.osversion && result.osversion.split(".")[0] < 6)) + { + result.c = true; + } + else { + result.x = true; + } + + if (result.msie) { + if (result.version > 10) { + result.msie_a = true; + } + else if (result.version > 8) { + result.msie_b = true; + } + else { + result.msie_c = true; + } + } + return result; + } + return detect(!isUndefined(navigator) ? navigator.userAgent : null); +} + +function URI (uri) { + this.scheme = null; + this.authority = null; + this.path = ''; + this.query = null; + this.fragment = null; + + this.parseUri = function (uri) { + var m = uri.match(/^(([A-Za-z][0-9A-Za-z+.\-]*)(:))?((\/\/)([^\/?#]*))?([^?#]*)((\?)([^#]*))?((#)(.*))?/); + this.scheme = m[3] ? m[2] : null; + this.authority = m[5] ? m[6] : null; + this.path = m[7]; + this.query = m[9] ? m[10] : null; + this.fragment = m[12]? m[13] : null; + return this; + }; + + this.azToString = function () { + var result = ''; + if (this.scheme !== null) { result = result + this.scheme + ':'; } + if (this.authority !== null) { result = result +'//'+ this.authority; } + if (this.path !== null) { result = result + this.path; } + if (this.query !== null) { result = result + '?'+ this.query; } + if (this.fragment !== null) { result = result + '#'+ this.fragment; } + return result; + }; + + this.toAbsolute = function (location) { + var baseUri = new URI(location); + var URIAbs = this; + var target = new URI(); + + function removeDotSegments (path) { + var result = '', rm; + while (path) { + if (path.substr(0,3) === '../' || path.substr(0,2) === './') { + path = path.replace(/^\.+/,'').substr(1); + } + else if (path.substr(0,3) === '/./' || path === '/.') { + path = '/'+path.substr(3); + } + else if (path.substr(0,4) === '/../' || path === '/..') { + path = '/'+path.substr(4); + result = result.replace(/\/?[^\/]*$/, ''); + } + else if (path === '.' || path === '..') { + path = ''; + } + else { + rm = path.match(/^\/?[^\/]*/)[0]; + path = path.substr(rm.length); + result = result + rm; + } + } + return result; + } + + if (baseUri.scheme === null) { return false; } + if (URIAbs.scheme !== null && URIAbs.scheme.toLowerCase() === baseUri.scheme.toLowerCase()) { + URIAbs.scheme = null; + } + + if (URIAbs.scheme !== null) { + target.scheme = URIAbs.scheme; + target.authority = URIAbs.authority; + target.path = removeDotSegments(URIAbs.path); + target.query = URIAbs.query; + } + else { + if (URIAbs.authority !== null) { + target.authority = URIAbs.authority; + target.path = removeDotSegments(URIAbs.path); + target.query = URIAbs.query; + } + else { + if (URIAbs.path === '') { + target.path = baseUri.path; + target.query = URIAbs.query || baseUri.query; + } + else { + if (URIAbs.path.substr(0,1) === '/') { + target.path = removeDotSegments(URIAbs.path); + } + else { + if (baseUri.authority !== null && baseUri.path === '') { + target.path = '/' + URIAbs.path; + } + else { + target.path = baseUri.path.replace(/[^\/]+$/,'') + URIAbs.path; + } + target.path = removeDotSegments(target.path); + } + target.query = URIAbs.query; + } + target.authority = baseUri.authority; + } + target.scheme = baseUri.scheme; + } + target.fragment = URIAbs.fragment; + return target; + }; + if (uri) { + this.parseUri(uri); + } +} + +function setConfig () { + var config = { + editorWidth : '100%', + editorHeight : '300px', + editorFontSize : '12px', + editorFontName : '맑은 고딕, 굴림, Malgun Gothic, gulim', + editorFontColor : '#000', + editorBgColor : '#fff', + imgCaptionText : 'margin: 5px 0px; color: #333', + lineHeight : 1.6, + editAreaMargin : '5px 10px', + tabIndex : 0, + editorPath : null, + fullHTMLSource : false, + linkTarget : '_blank', + showTagPath : false, + colorToHex : true, + imgMaxWidth : 1180, + imgUploadNumber : 12, + imgUploadSortName : false, + imgSetAttrWidth : 1, // -1 = (width=100%, height=auto), 0 = 설정 안함, 1 = 원래대로 + imgSetAttrAlt : true, + makeThumbnail : false, + imgDefaultAlign : "left", // [left, center, right] + thumbnailWidth : 120, + thumbnailHeight : 90, + imgBlockMargin : '5px 0px', + includeHostname : true, + paragraphCss : false, // true =

, false =

+ xhtmlLang : 'utf-8', + xhtmlEncoding : 'utf-8', + docTitle : '내 문서', + template : 'template.xml', + fontSizeValue : 'px', // [pt, px] + + // 버튼 사용 유무 + useSource : true, + usePreview : true, + usePrint : true, + useNewDocument : true, + useUndo : true, + useRedo : true, + useCopy : true, + useCut : true, + usePaste : true, + usePasteFromWord: true, + useSelectAll : true, + useStrikethrough: true, + useUnderline : true, + useItalic : true, + useSuperscript : false, + useSubscript : false, + useJustifyLeft : true, + useJustifyCenter: true, + useJustifyRight : true, + useJustifyFull : true, + useBold : true, + useOrderedList : true, + useUnOrderedList: true, + useOutdent : true, + useIndent : true, + useFontName : true, + useFormatBlock : true, + useFontSize : true, + useLineHeight : true, + useBackColor : true, + useForeColor : true, + useRemoveFormat : true, + useClearTag : true, + useSymbol : true, + useLink : true, + useUnLink : true, + useFlash : true, + useMedia : false, + useImage : true, + useImageUrl : false, + useSmileyIcon : true, + useHR : true, + useTable : true, + useModifyTable : true, + useMap : true, + useTextBlock : true, + useFullScreen : true, + usePageBreak : false, + allowedScript : true, + allowedOnEvent : false + }; + + if (config.editorPath === null) { + var base = location.href, editorUri, locationAbs; + var e = document.getElementsByTagName('base'), i; + for (i=0; i'+this.config.docTitle+''+ + ''; + + if (typeof contents === 'string') { + html += this.trimSpace(contents); + } + + html += ''; + doc.write(html); + doc.close(); +}, + +getWindowHandle : function (iframeObj) { + var iframeWin; + if (iframeObj.contentWindow) { + iframeWin = iframeObj.contentWindow; + } + else { + throw '현재 브라우저에서 에디터를 실행할 수 없습니다.'; + } + return iframeWin; +}, + +resetDoc : function () { + try { + if (this.undefined(this.cheditor.editArea)) { + return false; + } + this.editArea = this.getWindowHandle(this.cheditor.editArea); + this.doc = GB.browser.msie ? this.editArea.document : this.cheditor.editArea.contentDocument; + this.resetData(); + return true; + } catch (e) { + alert(e.toString()); + return false; + } +}, + +resetEditArea : function () { + this.openDoc(this.doc, this.cheditor.textarea.value); + this.setDesignMode(true); + + var oSheet = this.doc.styleSheets[0]; + var bodyCss = 'font-size:' + this.config.editorFontSize + + ';font-family:' + this.config.editorFontName + + ';color:' + this.config.editorFontColor + + ';margin:' + this.config.editAreaMargin + + ';line-height:' + this.config.lineHeight + + ';background-color:' + this.config.editorBgColor; + var tableCss = 'font-size:' + this.config.editorFontSize + ';line-height:' + this.config.lineHeight; + if (!this.W3CRange) { + oSheet.addRule('body', bodyCss); + oSheet.addRule('table', tableCss); + } + else { + oSheet.insertRule('body {'+ bodyCss + '}', 0); + oSheet.insertRule('table {'+ tableCss + '}', 1); + } + + this.doc.body.setAttribute("spellcheck", "false"); + this.doc.body.setAttribute("hidefocus", ""); + this.cheditor['bogusSpacerName'] = "ch_bogus_spacer"; + this.cheditor['bogusParaName'] = "ch_bogus_para"; + + var self = this; + this.addEvent(self.doc.body, "paste", function(event) { self.handlePaste(event); }); + try { + if (!GB.browser.msie) { + this.doc.execCommand('defaultParagraphSeparator', false, 'p'); + } + } catch(ignore) {} + + this.initDefaultParagraphSeparator(); +}, + +initDefaultParagraphSeparator : function () { + if (this.doc.body.firstChild && this.doc.body.firstChild.nodeName.toLowerCase() === 'br') { + this.doc.body.removeChild(this.doc.body.firstChild); + } + if (this.W3CRange && !this.doc.body.hasChildNodes()) { + var p = this.doc.createElement('p'); + this.doc.body.appendChild(p); + if (!GB.browser.msie && !GB.browser.edge) { + var br = this.doc.createElement('br'); + br.className = this.cheditor.bogusSpacerName; + p.appendChild(br); + this.placeCaretAt(p, false); + } + else { + this.placeCaretAt(p, false); + } + } +}, + +handlePaste : function (ev) { + if (this.cheditor.mode === "preview" || + (this.cheditor.paste !== 'text' && this.cheditor.mode === 'rich')) + { + return; + } + + this.stopEvent(ev); + var clip = (ev.originalEvent || ev).clipboardData; + var text = this.trimSpace((this.undefined(clip) || clip === null) ? window.clipboardData.getData("Text") : + clip.getData('text/plain')); + + if (text !== '') { + text = text.replace(/\r/g, ""); + if (this.cheditor.mode === "code") { + var div = this.doc.createElement('div'); + text = this.htmlEncode(text); + text = text.replace(/\s{2,}/gm, '\n'); + text = text.replace(/[\u200b\ufeff\xa0\u3000]+/g, ''); + + if (GB.browser.msie && GB.browser.version < 9) { + text = text.replace(/\n/g, "
"); + text = text.replace(/\t/g, "__CHEDITOR_TAB_SPACE__"); + text = text.replace(/\s/gm, " "); + } + div.innerHTML = text; + div.id = "clipboardData"; + this.insertHTML(div); + GB.prettify.initHighlightingOnLoad(['html', 'javascript', 'css'], this, true); + return; + } + + text = this.htmlEncode(text); + var lines = text.split('\n'); + var i, len = lines.length; + text = '

'; + for (i=0; i'; + } + text += '

'; + this.insertHTML(text); + } +}, + +editAreaFocus : function () { + this.editArea.focus(); + this.doc.body.focus(); +}, + +resizeGetY : function (ev) { + return GB.browser.msie ? + window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop : + ev.clientY + window.pageYOffset; +}, + +resizeStart : function (ev) { + var self = this; + self.currentRS.elNode = self.cheditor.editArea; + self.currentRS.cursorStartY = self.resizeGetY(ev); + self.currentRS.elStartTop = parseInt(self.currentRS.elNode.style.height, 10); + + if (isNaN(self.currentRS.elStartTop)) { + self.currentRS.elStartTop = 0; + } + + ev = ev || window.event; + + self.resizeEditor.stopFunc = function(event) { self.resizeStop(event); }; + self.resizeEditor.moveFunc = function(event) { self.resizeMove(event); }; + + if (GB.browser.msie) { + self.setDesignMode(false); + } + + self.currentRS.elNode.style.visibility = 'hidden'; + self.addEvent(document, "mousemove", self.resizeEditor.moveFunc); + self.addEvent(document, "mouseup", self.resizeEditor.stopFunc); + self.stopEvent(ev); +}, + +resizeMove : function (ev) { + var Y = this.resizeGetY(ev); + var H = this.currentRS.elStartTop + Y - this.currentRS.cursorStartY; + if (H < 1) { + this.resizeStop(ev); + H = 1; + } + this.config.editorHeight = this.currentRS.elNode.style.height = H + 'px'; + this.stopEvent(ev); +}, + +resizeStop : function (ev) { + this.removeEvent(document, "mouseup", this.resizeEditor.stopFunc); + this.removeEvent(document, "mousemove", this.resizeEditor.moveFunc); + this.stopEvent(ev); + this.currentRS.elNode.style.visibility = 'visible'; + if (GB.browser.msie) { + this.setDesignMode(true); + } + this.editAreaFocus(); +}, + +switchEditorMode : function (changeMode) { + this.editAreaFocus(); + var i, className; + if (this.cheditor.mode === changeMode) { return; } + + for (i in this.cheditor.modetab) { + if (this.cheditor.modetab.hasOwnProperty(i)) { + className = this.cheditor.modetab[i].className; + className = className.replace(/\-off$/,''); + if (i !== changeMode) { + this.cheditor.modetab[i].className = className + '-off'; + } + else { + this.cheditor.modetab[i].className = className; + } + } + } + + switch (changeMode) { + case 'rich' : + this.richMode(); + this.showTagSelector(true); + break; + case 'code' : + this.editMode(); + this.showTagSelector(false); + break; + case 'preview' : + this.previewMode(); + this.showTagSelector(false); + break; + default : break; + } + this.cheditor.mode = changeMode; +}, + +initTemplate : function () { + var self = this; + var httpRequest = null; + + function showError(msg) { + alert(self.templateFile + ' 파일 로딩 중 오류가 발생하였습니다.\n원인: ' + msg); + throw ''; + } + + function templateReady() { + if ( httpRequest.readyState === 4) { + if (httpRequest.status === 200) { + try { + self.xmlDoc = httpRequest.responseXML || httpRequest; + self.loadTemplate(self.xmlDoc); + if (self.W3CRange) { + var event = document.createEvent("Event"); + event.initEvent(self.cheditor.id, true, true); + document.dispatchEvent(event); + } + else { + document.documentElement.loadEvent = self.cheditor.id; + } + } catch (e) { + showError(e.toString()); + } + } + else { + showError("XMLHttpRequest. Status " + httpRequest.status); + } + } + } + + if (window.XMLHttpRequest) { + httpRequest = new XMLHttpRequest(); + if (httpRequest.overrideMimeType) { + httpRequest.overrideMimeType('text/xml'); + } + httpRequest.onreadystatechange = templateReady; + try { + httpRequest.open("GET", self.templatePath, true); + } + catch(e) { + showError(e + '참고: 에디터를 웹 서버에서 실행하여 주십시오.'); + } + httpRequest.send(); + } + else if (window.ActiveXObject) { + httpRequest = new window.ActiveXObject("Microsoft.XMLDOM"); + httpRequest.async = true; + httpRequest.onreadystatechange = templateReady; + httpRequest.load(self.templatePath); + } + else { + showError("현재 브라우저에서 "+self.templateFile+" 파일을 사용할 수 없습니다."); + } +}, + +getCDATASection : function (node) { + if (node.hasChildNodes()) { + var elem = node.firstChild; + while (elem && elem.nodeType !== GB.node.cdata_section) { + elem = elem.nextSibling; + } + + if (elem && elem.nodeType === GB.node.cdata_section) { + var data = elem.data; + data = data.replace(/\n/g, ''); + data = data.replace(/(\s+?)<([^>]*)>/g, "<$2>"); + data = this.trimSpace(data); + return data; + } + } + return null; +}, + +setToolbarBgPosition : function (elem, attr) { + elem.style.backgroundPosition = attr; +}, + +getToolbarBgPosition : function (elem) { + var pos; + switch (elem.className) { + case 'cheditor-tb-bg' : pos = 3; break; + case 'cheditor-tb-bg-last' : pos = 6; break; + case 'cheditor-tb-bg-single' : pos = 9; break; + case 'cheditor-tb-bg30-first' : pos = 12; break; + case 'cheditor-tb-bg30' : pos = 15; break; + case 'cheditor-tb-bg30-last' : pos = 18; break; + case 'cheditor-tb-bg55' : pos = 21; break; + case 'cheditor-tb-bg40' : pos = 24; break; + case 'cheditor-tb-bg44' : pos = 27; break; + case 'cheditor-tb-bgcombo' : pos = 30; break; + case 'cheditor-tb-bgcombo-last' : pos = 33; break; + default : pos = 0; + } + return pos; +}, + +toolbarMouseOverUp : function (elem) { + if (elem.checked) { + return; + } + + this.setToolbarBgPosition(elem.button, "0 " + (~(((elem.pos + 1) * elem.height)) + 1) + 'px'); + if ((elem.name === "combobox" && elem.prev && elem.prev.checked) || + (elem.name === "combo" && elem.next && elem.next.checked)) { + return; + } + + var pos, obj; + if (elem.type === "combobox") { + if (elem.prev.checked) { return; } + obj = elem.prev; + pos = "0px " + (~(((obj.pos + 1) * obj.height)) + 1) + 'px'; + this.setToolbarBgPosition(obj.button, pos); + } + else if (elem.type === "combo") { + if (elem.prev && !elem.prev.checked && !elem.prev.active) { + obj = elem.prev; + pos = (~(obj.width) + 1) + "px " + (~(obj.pos * obj.height) + 1) + 'px'; + this.setToolbarBgPosition(obj.button, pos); + } + + if (elem.next) { + if (elem.next.checked) { + return; + } + obj = elem.next; + pos = (~(obj.width) + 1) + "px " + (~(((obj.pos + 1) * obj.height)) + 1) + 'px'; + this.setToolbarBgPosition(obj.button, pos); + } + } + else { + if (!elem.prev || (elem.prev && elem.prev.checked)) { + return; + } + obj = elem.prev; + if (obj.className === 'cheditor-tb-bg-first') { + pos = (~(obj.width)+1) + "px 0"; + } + else { + pos = (~(obj.width) + 1) + "px " + (~(obj.pos * obj.height) + 1) + 'px'; + } + this.setToolbarBgPosition(obj.button, pos); + } +}, + +toolbarMouseDownOut : function (elem, mousedown) { + if (elem.next && elem.next.checked && !mousedown) { + this.setToolbarBgPosition(elem.button, (~(elem.width*2) + 1) + "px " + + (~(elem.pos * elem.height) + 1) + 'px'); + } + + if (elem.prev) { + if (elem.prev.active || (elem.prev.type === "combo" && elem.checked)) { + return; + } + if (elem.prev.checked) { + this.setToolbarBgPosition(elem.prev.button, "0 " + + (~((elem.prev.pos + 2) * elem.prev.height) + 1) + 'px'); + return; + } + + if (mousedown) { + this.setToolbarBgPosition(elem.prev.button, (~(elem.prev.width*2) + 1) + "px " + + (~(elem.prev.pos * elem.prev.height) + 1) + 'px'); + } + else { + this.setToolbarBgPosition(elem.prev.button, + "0 " + (~(elem.prev.pos * elem.prev.height) + 1) + 'px'); + } + } +}, + +toolbarButtonChecked : function (elem) { + this.setToolbarBgPosition(elem.button, "0 " + (~((elem.pos + 2) * elem.height) + 1) + 'px'); + if (elem.prev && elem.prev.type === "combo") { + if (elem.prev.checked || elem.checked) { + return; + } + this.setToolbarBgPosition(elem.prev.button, (~(elem.prev.width*2) + 1) + "px " + + (~(elem.prev.pos * elem.prev.height) + 1) + 'px'); + } + + if (elem.prev && !elem.prev.checked) { + if (elem.checked) { + this.setToolbarBgPosition(elem.prev.button, (~(elem.prev.width*2) + 1) + "px " + + (~(elem.prev.pos * elem.prev.height) + 1) + 'px'); + } + else { + this.setToolbarBgPosition(elem.prev.button, "0 " + (~(elem.prev.pos * elem.prev.height) + 1) + 'px'); + } + } +}, + +toolbarButtonUnchecked : function (elem) { + if (elem.type === "combobox" && !elem.checked) { + if (elem.prev.checked) { + this.setToolbarBgPosition(elem.button, + (~(elem.width) + 1) + "px " + (~(((elem.pos + 1) * elem.height)) + 1) + 'px'); + return; + } + this.setToolbarBgPosition(elem.prev.button, "0 " + (~(elem.prev.pos * elem.prev.height) + 1) + 'px'); + } + this.setToolbarBgPosition(elem.button, "0 " + (~(elem.pos * elem.height) + 1) + 'px'); + if (elem.prev && elem.prev.name === "BackColor") { + this.setToolbarBgPosition(elem.prev.button, "0 " + (~(elem.prev.pos * elem.prev.height) + 1) + 'px'); + } +}, + +makeToolbarGrayscale : function (image) { + var canvas = this.doc.createElement("canvas"); + var context = canvas.getContext("2d"); + var filter = function(pixels) { + var d = pixels.data, i, r, g, b; + + for (i = 0; i < d.length; i += 4) { + r = d[i]; + g = d[i + 1]; + b = d[i + 2]; + d[i] = d[i + 1] = d[i + 2] = (r+g+b)/3; + } + return pixels; + }; + + var imgWidth = image.width; + var imgHeight = image.height; + + canvas.width = imgWidth; + canvas.height =imgHeight; + context.drawImage(image, 0, 0); + + var imageData = context.getImageData(0,0, imgWidth, imgHeight); + filter(imageData); + context.putImageData(imageData, 0, 0); + + return canvas.toDataURL(); +}, + +toolbarSetBackgroundImage : function (elem, disable) { + var css = elem.firstChild.className; + css = css.replace(/-disable$/i, ""); + + if (disable) { + if (this.cheditor.toolbarGrayscale && elem.firstChild.style.backgroundImage) { + elem.firstChild.style.backgroundImage = 'url('+this.cheditor.toolbarGrayscale+')'; + } + css = css + "-disable"; + elem.style.cursor = 'default'; + } + else { + if (this.cheditor.toolbarGrayscale && elem.firstChild.style.backgroundImage) { + elem.firstChild.style.backgroundImage = 'url('+this.toolbar.icon+')'; + } + elem.style.cursor = 'pointer'; + } + + elem.firstChild.className = css; +}, + +toolbarDisable : function (elem, disable) { + if (disable) { + this.toolbarSetBackgroundImage(elem.button, true); + this.toolbarButtonUnchecked(elem); + this.toolbarMouseDownOut(elem); + this.toolbar[elem.name]['disabled'] = true; + return true; + } + + this.toolbarSetBackgroundImage(elem.button, false); + this.toolbar[elem.name]['disabled'] = false; + return false; +}, + +colorConvert : function (color, which, opacity) { + if (!which) { + which = "rgba"; + } + color = color.replace(/^\s*#|\s*$/g, ""); + if (color.length === 3) { + color = color.replace( /(.)/g, "$1$1" ); + } + + color = color.toLowerCase(); + which = which.toLowerCase(); + + var colorDefs = [{ + re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/, + process: function (bits) { + return [ + parseInt(bits[1], 10), + parseInt(bits[2], 10), + parseInt(bits[3], 10), + 1 + ]; + } + }, + { + re : /^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d+(?:\.\d+)?|\.\d+)\s*\)/, + process: function (bits) { + return [ + parseInt(bits[1], 10), + parseInt(bits[2], 10), + parseInt(bits[3], 10), + parseFloat(bits[4]) + ]; + } + }, + { + re: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, + process: function (bits) { + return [ + parseInt(bits[1], 16), + parseInt(bits[2], 16), + parseInt(bits[3], 16), + 1 + ]; + } + }, + { + re: /^([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/, + process: function (bits) { + return [ + parseInt(bits[1] * 2, 16), + parseInt(bits[2] * 2, 16), + parseInt(bits[3] * 2, 16), + 1 + ]; + } + } + ]; + var r, g, b, a, i, re, processor, bits, channels, min, rData; + r = g = b = a = rData = null; + + for (i = 0; i < colorDefs.length; i++) { + re = colorDefs[i].re; + processor = colorDefs[i].process; + bits = re.exec(color); + if (bits) { + channels = processor(bits); + r = channels[0]; + g = channels[1]; + b = channels[2]; + a = channels[3]; + } + } + + r = (r < 0 || isNaN(r)) ? 0 : ((r > 255) ? 255 : r); + g = (g < 0 || isNaN(g)) ? 0 : ((g > 255) ? 255 : g); + b = (b < 0 || isNaN(b)) ? 0 : ((b > 255) ? 255 : b); + a = (a < 0 || isNaN(a)) ? 0 : ((a > 1) ? 1 : a); + + function hex(x) { + return ("0" + parseInt(x, 10).toString(16)).slice(-2); + } + + switch (which) { + case "rgba": + if (opacity) { + a = (255 - (min = Math.min(r, g, b))) / 255; + r = ((r - min) / a).toFixed(0); + g = ((g - min) / a).toFixed(0); + b = ((b - min) / a).toFixed(0); + a = a.toFixed(4); + } + rData = "rgba(" + r + "," + g + "," + b + "," + a + ")"; + break; + case "rgb": + rData = "rgb(" + r + "," + g + "," + b + ")"; + break; + case "hex": + rData = "#" + hex(r) + hex(g) + hex(b); + break; + } + return rData; +}, + +toolbarUpdate : function () { + var toolbar = this.toolbar; + var range = this.getRange(); + var selectionType = GB.selection.text; + var pNode, ancestors = [], ancestorsLen = 0; + var bRangeText = true; + + if (this.W3CRange) { + try { + pNode = this.getW3CRangeElement(range); + if (pNode.nodeType === GB.node.element) { + selectionType = !(range.toString()) ? GB.selection.element : GB.selection.text; + } + else if (pNode.nodeType === GB.node.text) { + selectionType = GB.selection.text; + pNode = pNode.parentNode; + } + else { + selectionType = GB.selection.none; + pNode = pNode.parentNode; + } + } catch (e) { + pNode = this.doc; + } + + bRangeText = !range.toString(); + if (bRangeText && !range.collapsed) { + bRangeText = !GB.offElements[pNode.tagName.toLowerCase()]; + } + } + else { + selectionType = this.getSelectionType(range); + if (selectionType === GB.selection.text || selectionType === GB.selection.none) + { + pNode = range.parentElement(); + bRangeText = range.text === ''; + } + else if (selectionType === GB.selection.element) { + pNode = range.item(0); + bRangeText = !GB.offElements[pNode.tagName.toLowerCase()]; + } + else { + pNode = this.doc; + } + } + + var isControl = false, isTable = false, i, j, btn, cmd, autoOff, isDisable, + el, wrapper, fontAttr, oldName, span, newAttr, defaultAttr, state, css; + + if (selectionType === GB.selection.element) { + isControl = this.W3CRange ? GB.offElements[pNode.nodeName.toLowerCase()] : true; + } + else { + var node = pNode; + while (node && node.nodeType === GB.node.element && node.nodeName !== 'BODY') { + ancestors.push(node); + if (node.nodeName === 'TD' || node.nodeName === 'TH') { + isTable = true; + } + node = node.parentNode; + } + ancestorsLen = ancestors.length; + } + + var isNoOff = { 'Link':1 }; + + if (!isTable && selectionType === GB.selection.element && + (pNode.nodeName === 'TABLE' || pNode.nodeName === 'TD' || pNode.nodeName === 'TH')) + { + isTable = true; + } + + var alignment = { "JustifyCenter" : "center", "JustifyRight" : "right", "JustifyFull" : "justify" }; + + for (i in toolbar) { + if (!(toolbar.hasOwnProperty(i))) { + continue; + } + + btn = toolbar[i]; + if (!btn.cmd) { + continue; + } + + cmd = btn.cmd; + + autoOff = false; + if (isControl && selectionType === GB.selection.element) { + if (btn.group !== 'Alignment') { + autoOff = !(pNode.nodeName === 'IMG' && isNoOff[cmd]); + } + } + + if (btn.name === 'ModifyTable') { + autoOff = !isTable; + } + + isDisable = this.toolbarDisable(btn, autoOff); + + if (btn.name === 'ForeColor' || btn.name === 'BackColor') { + btn.button.lastChild.style.display = isDisable ? 'none' : 'block'; + } + if (btn.autocheck === null) { + continue; + } + + switch (cmd) { + case 'Copy' : + case 'Cut' : + this.toolbarDisable(btn, bRangeText); + break; + case 'UnLink' : + try { this.toolbarDisable(btn, !this.doc.queryCommandEnabled(cmd)); } + catch(ignore) {} + break; + case 'FormatBlock' : + wrapper = btn.button.firstChild; + oldName = wrapper.firstChild; + el = false; + span = document.createElement('span'); + for (j=0; j < ancestorsLen; j++) { + if (GB.formatBlock[ancestors[j].nodeName]) { + span.appendChild(document.createTextNode(ancestors[j].nodeName)); + wrapper.replaceChild(span, oldName); + el = true; + break; + } + } + + if (!el) { + span.appendChild(document.createTextNode('스타일')); + wrapper.replaceChild(span, oldName); + } + this.unselectionElement(span); + break; + case 'ForeColor' : + case 'BackColor' : + if (cmd === 'BackColor' && !GB.browser.msie) { + cmd = 'HiliteColor'; + } + try { + fontAttr = this.doc.queryCommandValue(cmd); + if (fontAttr && !/^[rgb|#]/.test(fontAttr)) { + fontAttr = (((fontAttr & 0x0000ff) << 16) | (fontAttr & 0x00ff00) | ((fontAttr & 0xff0000) >>> 16)).toString(16); + fontAttr = "#000000".slice(0, 7-fontAttr.length) + fontAttr; + } + else { + fontAttr = (cmd === 'ForeColor') ? this.config.editorFontColor : this.config.editorBgColor; + } + btn.button.lastChild.style.backgroundColor = fontAttr; + } catch (ignore) {} + break; + case 'FontName' : + case 'FontSize' : + try { + fontAttr = this.doc.queryCommandValue(cmd); + wrapper = btn.button.firstChild; + span = this.doc.createElement('span'); + if (cmd === 'FontSize') { + try { + fontAttr = pNode.style.fontSize; + if (!fontAttr) { + for (i=0; i 9) { + var image = new Image(); + image.onload = function() { + self.cheditor.toolbarGrayscale = self.makeToolbarGrayscale(this); + self.toolbarUpdate(); + }; + image.src = self.toolbar.icon; + image.style.width = "750px"; image.style.height = "16px"; + } + else { + self.cheditor.toolbarGrayscale = null; + self.toolbarUpdate(); + } + self.setImageEvent(true); + } + + if (this.W3CRange) { + this.addEvent(document, this.cheditor.id, showEditor); + } + else { + document.documentElement.loadEvent = 0; + document.documentElement.attachEvent("onpropertychange", function(event) { + if (event.propertyName === "loadEvent") { + showEditor(); + } + }); + } + + try { this.initTemplate(); } + catch(ignore) {} +}, + +fullScreenMode : function () { + var self = this; + self.editAreaFocus(); + self.boxHideAll(); + + var container = self.cheditor.container; + self.cheditor.editArea.style.visibility = 'hidden'; + + if (!self.setFullScreenMode) { + var windowSize; + container.className = 'cheditor-container-fullscreen'; + + if (GB.browser.msie && GB.browser.version < 7) { + self.cheditor.fullScreenFlag = document.createElement('span'); + self.cheditor.fullScreenFlag.style.display = 'none'; + container.parentNode.insertBefore(self.cheditor.fullScreenFlag, container); + document.body.insertBefore(container, document.body.firstChild); + } + + var child = container.firstChild, except = 0; + while (child) { + if (child.className !== "cheditor-editarea-wrapper" && + child.className !== 'cheditor-popup-window' && + child.className !== '') + { + except += child.offsetHeight; + } + child = child.nextSibling; + } + + var containerReSize = function () { + windowSize = self.getWindowSize(); + container.style.width = windowSize.width + 'px'; + self.cheditor.editArea.style.height = (windowSize.height - except - 6) + 'px'; + }; + + window.onresize = containerReSize; + containerReSize(); + + self.cheditor.resizeBar.onmousedown = null; + self.cheditor.resizeBar.className = "cheditor-resizebar-off"; + } + else { + window.onresize = null; + container.removeAttribute('style'); + container.className = 'cheditor-container'; + container.style.width = self.config.editorWidth; + + var editorHeight = parseInt(self.config.editorHeight, 10); + + if (self.cheditor.mode !== 'rich') { + var tbHeight = self.cheditor.toolbarWrapper.offsetHeight; + if (tbHeight < 1) { + tbHeight = parseInt(self.cheditor.toolbarWrapper.style.height, 10) + + parseInt(self.cheditor.toolbarWrapper.style.padding, 10); + } + editorHeight += tbHeight; + } + + self.cheditor.editArea.style.height = editorHeight + 'px'; + self.cheditor.resizeBar.onmousedown = function(event) { self.resizeStart(event); }; + self.cheditor.resizeBar.className = "cheditor-resizebar"; + + if (GB.browser.msie && GB.browser.version < 7) { + self.cheditor.fullScreenFlag.parentNode.replaceChild(container, self.cheditor.fullScreenFlag); + } + } + + self.cheditor.editArea.style.visibility = 'visible'; + self.setFullScreenMode = !(self.setFullScreenMode); + self.editAreaFocus(); +}, + +showPulldown : function (cmd, btn) { + + switch (cmd) { + case 'FontName' : + this.showFontTypeMenu(btn); + break; + case 'FontSize' : + this.showFontSizeMenu(btn); + break; + case 'FormatBlock' : + this.showFormatBlockMenu(btn); + break; + case 'ForeColor' : + case 'BackColor' : + this.showColorMenu(btn); + break; + case 'TextBlock' : + this.showTextBlockMenu(btn); + break; + case 'LineHeight' : + this.showLineHeightMenu(btn); + break; + case 'OrderedList' : + case 'UnOrderedList' : + this.showOrderedListMenu(btn); + break; + default : break; + } +}, + +setPulldownClassName : function (labels, pNode) { + var i; + for (i=0; i < labels.length; i++) { + if (labels[i].getAttribute('name') === pNode.firstChild.firstChild.firstChild.nodeValue) { + labels[i].parentNode.style.backgroundImage = 'url('+this.config.editorPath+'icons/checked.png)'; + labels[i].parentNode.style.backgroundPosition = '0 center'; + labels[i].parentNode.style.backgroundRepeat = 'no-repeat'; + } + else { + labels[i].parentNode.style.backgroundImage = ''; + } + labels[i].parentNode.className = 'cheditor-pulldown-mouseout'; + } +}, + +showOrderedListMenu : function (pNode) { + var self = this; + var menu = pNode.getAttribute('name'); + var elem = self.pulldown[menu]; + if (!elem) { + var i, div, label; + var cmd = (menu === "UnOrderedListCombo") ? "InsertUnOrderedList" : "InsertOrderedList"; + var outputHtml = document.createElement('div'); + var cmdPopup = function() { self.doCmdPopup(cmd, this.id, self.toolbar[menu].prev.checked); }; + var mouseOver = function() { self.pulldownMouseOver(this); }; + var mouseOut = function() { self.pulldownMouseOut(this); }; + var list = (cmd === "InsertUnOrderedList") ? GB.listStyle.unOrdered : GB.listStyle.ordered; + var li, ol; + for (i in list) { + if (list.hasOwnProperty(i)) { + div = document.createElement('div'); + label = document.createElement('label'); + div.id = i; + div.onclick = cmdPopup; + div.onmouseover = mouseOver; + div.onmouseout = mouseOut; + self.pulldownMouseOut(div); + + label.style.fontFamily = "verdana"; + label.style.textAlign = "center"; + label.style.width = "15px"; + label.setAttribute('name', i); + + ol = document.createElement('ul'); + li = document.createElement('li'); + ol.style.width = '90px'; + ol.style.padding = "0 15px"; + ol.style.margin = "0px"; + try { ol.style.listStyleType = i; } + catch(ignore) {} + ol.style.cursor = 'default'; + ol.style.textAlign = 'left'; + li.appendChild(document.createTextNode(list[i])); + ol.appendChild(li); + label.appendChild(ol); + div.appendChild(label); + outputHtml.appendChild(div); + } + } + self.createWindow(110, outputHtml); + self.createPulldownFrame(outputHtml, menu); + elem = self.pulldown[menu]; + } + + self.windowPos(pNode, menu); + self.displayWindow(pNode, menu); +}, + +showColorMenu : function (pNode) { + var menu = pNode.getAttribute('name'); + var elem = this.pulldown[menu]; + + if (!elem) { + var outputHtml = this.setColorTable(menu); + this.createWindow(220, outputHtml); + this.createPulldownFrame(outputHtml, menu); + elem = this.pulldown[menu]; + elem.firstChild.className = 'cheditor-pulldown-color-container'; + } + + var selectedColor = this.colorConvert(pNode.lastChild.style.backgroundColor, "hex"); + this.toolbar[menu].colorNode.selectedValue.style.backgroundColor = selectedColor; + this.toolbar[menu].colorNode.colorPicker.hidePicker(); + this.toolbar[menu].colorNode.colorPicker.fromString(selectedColor); + this.toolbar[menu].colorNode.showPicker = false; + + var nodes = elem.getElementsByTagName('span'); + var i, len = nodes.length, node; + for (i=0; i < len; i++) { + node = nodes[i]; + node.style.backgroundImage = ''; + if (node.id && node.id.toLowerCase() === selectedColor.toLowerCase()) { + node.style.backgroundImage = "url('"+this.config.iconPath + "/color_picker_tick.png')"; + node.style.backgroundRepeat = "no-repeat"; + node.style.backgroundPosition = "center center"; + + } + } + this.toolbar[menu].colorNode.selectedValue.style.backgroundImage = "url('"+this.config.iconPath + "/color_picker_tick.png')"; + this.toolbar[menu].colorNode.selectedValue.style.backgroundRepeat = "no-repeat"; + this.toolbar[menu].colorNode.selectedValue.style.backgroundPosition = "center center"; + this.windowPos(pNode, menu); + this.displayWindow(pNode, menu); +}, + +showFontTypeMenu : function (pNode) { + var self = this; + var menu = pNode.getAttribute('name'); + var elem = self.pulldown[menu]; + + if (!elem) { + var fonts = null, type, i, div, label; + var outputHtml = self.doc.createElement('div'); + var cmdPopup = function() { self.doCmdPopup(menu, this.id);}; + var mouseOver = function() { self.pulldownMouseOver(this); }; + var mouseOut = function() { self.pulldownMouseOut(this); }; + + for (type in GB.fontName) { + if (GB.fontName.hasOwnProperty(type)) { + fonts = GB.fontName[type]; + for (i=0; i < fonts.length; i++) { + div = self.doc.createElement('div'); + label = self.doc.createElement('label'); + div.id = fonts[i]; + div.onclick = cmdPopup; + div.onmouseover = mouseOver; + div.onmouseout = mouseOut; + label.style.fontFamily = fonts[i];//(type !== 'kr') ? fonts[i] : this.config.editorFontName; + label.appendChild(self.doc.createTextNode(fonts[i])); + label.setAttribute('name', fonts[i]); + div.appendChild(label); + outputHtml.appendChild(div); + } + } + } + + self.createWindow(155, outputHtml); + self.createPulldownFrame(outputHtml, menu); + elem = self.pulldown[menu]; + } + self.setPulldownClassName(elem.firstChild.getElementsByTagName('LABEL'), pNode); + self.windowPos(pNode, menu); + self.displayWindow(pNode, menu); +}, + +showFormatBlockMenu : function (pNode) { + var self = this; + var menu = pNode.getAttribute('name'); + var elem = self.pulldown[menu]; + + if (!elem) { + var para, label, fontSize, div; + var outputHtml = document.createElement('div'); + var cmdPopup = function() { self.doCmdPopup("FormatBlock", '<' + this.id + '>'); }; + var mouseOver = function() { self.pulldownMouseOver(this); }; + var mouseOut = function() { self.pulldownMouseOut(this); }; + for (para in GB.formatBlock) { + if (GB.formatBlock.hasOwnProperty(para)) { + div = document.createElement('div'); + div.id = para; + div.onclick = cmdPopup; + div.onmouseover = mouseOver; + div.onmouseout = mouseOut; + + label = document.createElement('label'); + if (para.match(/H[123456]/)) { + fontSize = {'H1':'2em','H2':'1.5em','H3':'1.17em','H4':'1em','H5':'0.83em','H6':'0.75em'}; + label.style.fontWeight = 'bold'; + label.style.fontSize = fontSize[para]; + label.style.lineHeight = 1.4; + } + else if (para === 'ADDRESS') { + label.style.fontStyle = 'italic'; + } + + label.appendChild(document.createTextNode(GB.formatBlock[para])); + div.appendChild(label); + + label.setAttribute('name', GB.formatBlock[para]); + outputHtml.appendChild(div); + } + } + self.createWindow(150, outputHtml); + self.createPulldownFrame(outputHtml, menu); + elem = self.pulldown[menu]; + } + self.setPulldownClassName(elem.firstChild.getElementsByTagName('LABEL'), pNode); + self.windowPos(pNode, menu); + self.displayWindow(pNode, menu); +}, + +showFontSizeMenu : function (pNode) { + var self = this; + var menu = pNode.getAttribute('name'); + var elem = self.pulldown[menu]; + + if (!elem) { + var size, div, label, text, i; + var value = GB.fontSize[this.config.fontSizeValue]; + var len = value.length; + var outputHtml = document.createElement('div'); + var cmdPopup = function() { self.doCmdPopup(menu, this.id); }; + var mouseOver = function() { self.pulldownMouseOver(this); }; + var mouseOut = function() { self.pulldownMouseOut(this); }; + + for (i=0; i < len; i++) { + size = value[i]; + div = document.createElement('div'); + label = document.createElement('label'); + text = size > 48 ? '가' : (size > 28 ? '가나다' : '가나다라'); + size = size + this.config.fontSizeValue; + div.id = size; + div.onclick = cmdPopup; + div.onmouseover = mouseOver; + div.onmouseout = mouseOut; + div.style.fontSize = size; + + label.style.fontFamily = this.config.editorFontName; + label.setAttribute('name', size); + label.appendChild(document.createTextNode(text+'('+size+')')); + div.appendChild(label); + outputHtml.appendChild(div); + } + self.createWindow(350, outputHtml); + outputHtml.style.height = '300px'; + outputHtml.style.overflow = 'auto'; + self.createPulldownFrame(outputHtml, menu); + elem = self.pulldown[menu]; + } + self.setPulldownClassName(elem.firstChild.getElementsByTagName('LABEL'), pNode); + self.windowPos(pNode, menu); + self.displayWindow(pNode, menu); +}, + +showLineHeightMenu : function (pNode) { + var self = this; + var menu = pNode.getAttribute('name'); + var elem = self.pulldown[menu]; + + if (!elem) { + var i, div, label, text; + var outputHtml = document.createElement('div'); + var cmdPopup = function() { self.doCmdPopup("LineHeight", this.id); }; + var mouseOver = function() { self.pulldownMouseOver(this); }; + var mouseOut = function() { self.pulldownMouseOut(this); }; + for (i in GB.lineHeight) { + if (!(GB.lineHeight.hasOwnProperty(i))) { + continue; + } + if (!GB.lineHeight[i]) { + break; + } + div = document.createElement('div'); + label = document.createElement('label'); + text = i; + + div.id = GB.lineHeight[i]; + div.onclick = cmdPopup; + div.onmouseover = mouseOver; + div.onmouseout = mouseOut; + + label.style.fontFamily = this.config.editorFontName; + label.setAttribute('name', GB.lineHeight[i]); + label.appendChild(document.createTextNode(text)); + div.appendChild(label); + outputHtml.appendChild(div); + } + self.createWindow(100, outputHtml); + self.createPulldownFrame(outputHtml, menu); + elem = self.pulldown[menu]; + } + self.setPulldownClassName(elem.firstChild.getElementsByTagName('LABEL'), pNode); + self.windowPos(pNode, menu); + self.displayWindow(pNode, menu); +}, + +showTextBlockMenu : function (pNode) { + var self = this; + var menu = pNode.getAttribute('name'); + var elem = self.pulldown[menu]; + + if (!elem) { + var i, wrapper, div, label; + var outputHtml = document.createElement('div'); + var cmdPopup = function() { self.boxStyle(this); }; + var mouseOver = function() { this.className = 'cheditor-pulldown-textblock-over'; }; + var mouseOut = function() { this.className = 'cheditor-pulldown-textblock-out'; }; + var quote = GB.textBlock; + + for (i=0; i < quote.length; i++) { + wrapper = document.createElement('div'); + div = document.createElement('div'); + div.onclick = cmdPopup; + wrapper.onmouseover = mouseOver; + wrapper.onmouseout = mouseOut; + wrapper.className = 'cheditor-pulldown-textblock-out'; + div.id = i; + div.style.border = quote[i][0]; + div.style.backgroundColor = quote[i][1]; + div.style.fontFamily = self.config.editorFontName; + + label = document.createElement('label'); + label.appendChild(document.createTextNode('가나다라 ABC')); + div.appendChild(label); + wrapper.appendChild(div); + outputHtml.appendChild(wrapper); + + } + self.createWindow(160, outputHtml); + self.createPulldownFrame(outputHtml, menu); + elem = self.pulldown[menu]; + elem.firstChild.className = 'cheditor-pulldown-textblock-container'; + } + self.windowPos(pNode, menu); + self.displayWindow(pNode, menu); +}, + +createPulldownFrame : function (contents, id) { + var div = document.createElement('div'); + div.className = 'cheditor-pulldown-frame'; + div.appendChild(contents); + this.pulldown[id] = div; + this.cheditor.container.firstChild.appendChild(div); +}, + +setDefaultCss : function (ar) { + if (arguments.length < 1) { + ar = {cssName: 'ui.css', doc: this.doc}; + //if (GB.browser.msie || GB.browser.opera) { + ar = {cssName: 'editarea.css', doc: this.doc}; + //} + } + + var cssFile = this.config.cssPath + ar.cssName, + head = ar.doc.getElementsByTagName('head')[0], found = false; + + if (this.undefined(head)) { + return; + } + + if (head.hasChildNodes()) { + var child = head.childNodes, i, href; + for (i = 0; i < child.length; i++) { + if (child[i].nodeName.toLowerCase() === 'link') { + href = child[i].getAttribute('href'); + if (href && href === cssFile) { + found = true; + break; + } + } + } + } + + if (!found) { + var css = head.appendChild(ar.doc.createElement('link')); + css.setAttribute('type', 'text/css'); + css.setAttribute('rel', 'stylesheet'); + css.setAttribute('media', 'all'); + css.setAttribute('href', this.config.cssPath + ar.cssName); + } +}, + +setEditorEvent : function () { + var self = this; + var keyDown = function(event) { + if (self.cheditor.mode === "preview") { + self.stopEvent(event); + return; + } + self.doOnKeyDown(event); + }; + self.addEvent(self.doc, "keydown", keyDown); + + var keyPress = function(event) { + if (self.cheditor.mode === "preview") { + self.stopEvent(event); + return; + } + self.doOnKeyPress(event); + }; + self.addEvent(self.doc, "keypress", keyPress); + + var keyUp = function(event) { + if (self.cheditor.mode === "preview") { + self.stopEvent(event); + return; + } + self.doOnKeyUp(event); + }; + self.addEvent(self.doc, "keyup", keyUp); + + var editorEvent = function(event) { + if (self.cheditor.mode === "rich") { + self.doEditorEvent(); + return; + } + if (self.cheditor.mode === "preview") { + self.stopEvent(event); + } + }; + self.addEvent(self.doc, "mouseup", editorEvent); + + var hideBox = function(event) { + if (self.cheditor.mode === "rich") { + self.boxHideAll(); + return; + } + if (self.cheditor.mode === "preview") { + self.stopEvent(event); + } + }; + self.addEvent(self.doc, "mousedown", hideBox); + + /*self.addEvent(self.doc, "mousemove", function(event) { + var target = event.srcElement || event.target; + var nodeName = target.nodeName; + var elem = document.getElementById('targetNode'); + elem.innerHTML = target.nodeName; + + });*/ +}, + +addEvent : function (evTarget, evType, evHandler) { + if (evTarget.addEventListener) { + evTarget.addEventListener(evType, evHandler, false); + } + else { + evTarget.attachEvent("on"+evType, evHandler); + } +}, + +removeEvent : function (elem, ev, func) { + if (elem.removeEventListener) { + elem.removeEventListener(ev, func, false); + } + else { + elem.detachEvent("on" + ev, func); + } +}, + +stopEvent : function (ev) { + if (ev && ev.preventDefault) { + ev.preventDefault(); + ev.stopPropagation(); + } + else { + ev = ev || window.event; + ev.cancelBubble = true; + ev.returnValue = false; + } +}, + +toolbarButtonOut : function (elemButton, nTop) { + elemButton.style.top = -nTop + 'px'; +}, + +toolbarButtonOver : function (elemButton) { + var nTop = elemButton.style.top.substring(0, elemButton.style.top.length - 2); + elemButton.style.top = nTop - 22 + 'px'; +}, + +getElement : function (elem, tag) { + if (!elem || !tag) { + return null; + } + + while (elem && elem.nodeName.toLowerCase() !== tag.toLowerCase()) { + if (elem.nodeName.toLowerCase() === 'body') { break; } + elem = elem.parentNode; + } + return elem; +}, + +hyperLink: function (href, target, title) { + this.editArea.focus(); + var self = this, links = null, i; + + var createLinks = function() { + var range = null, selectedLinks = [], linkRange, selection = null; + var container = null, k; + + range = self.restoreRange(); + self.backupRange(range); + linkRange = self.createRange(); + + if (self.W3CRange) { + self.doc.execCommand("CreateLink", false, href); + selection = self.getSelection(); + for (i=0; i < selection.rangeCount; ++i) { + range = selection.getRangeAt(i); + container = range.commonAncestorContainer; + + if (self.getSelectionType(range) === GB.selection.text) { + container = container.parentNode; + } + + if (container.nodeName.toLowerCase() === 'a') { + selectedLinks.push(container); + } + else { + links = container.getElementsByTagName('a'); + for (k=0; k < links.length; ++k) { + linkRange.selectNodeContents(links[k]); + if (linkRange.compareBoundaryPoints(range.END_TO_START, range) < 1 && + linkRange.compareBoundaryPoints(range.START_TO_END, range) > -1) + { + selectedLinks.push(links[k]); + } + } + } + } + linkRange.detach(); + } + else { + range = self.doc.selection.createRange(); + range.execCommand("UnLink", false); + range.execCommand("CreateLink", false, href); + + switch (self.getSelectionType(range)) { + case GB.selection.text : + container = range.parentElement(); + break; + case GB.selection.element : + container = range.item(0).parentNode; + break; + default : return null; + } + + if (container.nodeName.toLowerCase() === 'a') { + selectedLinks.push(container); + } + else { + links = container.getElementsByTagName('a'); + for (i=0; i < links.length; ++i) { + linkRange.moveToElementText(links[i]); + if (linkRange.compareEndPoints("StartToEnd", range) > -1 && + linkRange.compareEndPoints("EndToStart", range) < 1) + { + selectedLinks.push(links[i]); + } + } + } + + } + return selectedLinks; + }; + + links = createLinks(); + if (links) { + for (i=0; i < links.length; ++i) { + if (target) { + links[i].setAttribute("target", target); + } + if (title) { + links[i].setAttribute("title", title); + } + } + } +}, + +getOffsetBox : function (el) { + var box = el.getBoundingClientRect(); + var doc = this.doc.documentElement; + var body = this.doc.body; + var scrollTop = doc.scrollTop || body.scrollTop; + var scrollLeft = doc.scrollLeft || body.scrollLeft; + var clientTop = doc.clientTop || body.clientTop || 0; + var clientLeft = doc.clientLeft || body.clientLeft || 0; + var top = box.top + scrollTop - clientTop; + var left = box.left + scrollLeft - clientLeft; + + return { top: Math.round(top), left: Math.round(left) }; +}, + +makeSpacerElement : function () { + var elem; + var para = this.doc.createElement('p'); + if (GB.browser.msie && GB.browser.version < 11) { + elem = this.doc.createComment(this.cheditor.bogusSpacerName); + } + else { + elem = this.doc.createElement('br'); + elem.className = this.cheditor.bogusSpacerName; + } + para.appendChild(elem); + return para; +}, + +boxStyle: function (el) { + this.editAreaFocus(); + var range = this.range || this.getRange(); + var blockQuote = this.doc.createElement("blockquote"); + var elem; + var para = null; + + blockQuote.style.border = GB.textBlock[el.id][0]; + blockQuote.style.backgroundColor = GB.textBlock[el.id][1]; + blockQuote.style.padding = "5px 10px"; + + if (!this.W3CRange) { + var ctx = range.htmlText; + blockQuote.innerHTML = ctx || ' '; + range.select(); + this.insertHTML(blockQuote); + var textRange = this.getRange(); + elem = range.parentElement(); + textRange.moveToElementText(elem); + textRange.collapse(false); + textRange.select(); + } + else { + try { + var frag = range.extractContents(); + if (!frag.firstChild) { + para = this.makeSpacerElement(); + blockQuote.appendChild(para); + } + else { + blockQuote.appendChild(frag); + } + range.insertNode(blockQuote); + var pNode = blockQuote.parentNode; + while (pNode && pNode.nodeName !== 'BODY') { + if (pNode.nodeName === 'P' || pNode.nodeName === 'DIV') { + pNode.parentNode.insertBefore(blockQuote, pNode.nextSibling); + break; + } + pNode = pNode.parentNode; + } + this.placeCaretAt(para || blockQuote, false); + } catch(ignore) {} + } + this.boxHideAll(); +}, + +insertFlash: function (elem) { + this.editArea.focus(); + this.backupRange(this.restoreRange()); + + if (typeof elem === 'string') { + var embed = null; + var div = this.doc.createElement('div'); + elem = this.trimSpace(elem); + + var pos = elem.toLowerCase().indexOf("embed"); + if (pos !== -1) { + var str = elem.substr(pos); + pos = str.indexOf(">"); + div.innerHTML = "<" + str.substr(0, pos) + ">"; + embed = div.firstChild; + } + else { + div.innerHTML = elem; + var object = div.getElementsByTagName('OBJECT')[0]; + if (object && object.hasChildNodes()) { + var child = object.firstChild; + var movieHeight, movieWidth, i; + movieWidth = (isNaN(object.width) !== true) ? object.width : 320; + movieHeight = (isNaN(object.height)!== true) ? object.height: 240; + var params = []; + + do { + if ((child.nodeName === 'PARAM') && (!this.undefined(child.name) && !this.undefined(child.value))) + { + params.push({key: (child.name === 'movie') ? 'src' : child.name, val: child.value}); + } + child = child.nextSibling; + } + while (child); + + if (params.length > 0) { + embed = this.doc.createElement('embed'); + embed.setAttribute("width", movieWidth); + embed.setAttribute("height", movieHeight); + for (i=0; i 0 && span.previousSibling) { + parent.insertBefore(span, span.previousSibling); + cursor.moveToElementText(span); + } + + result.container = span.nextSibling || span.previousSibling; + if (result.container === null) { + result.container = span.parentNode; + } + parent.removeChild(span); + } + var start = {}, end = {}; + convert(start, true); convert(end, false); + return { startContainer: start.container, endContainer: end.container }; +}, + +doInsertImage : function (images, paragraph, useSpacer) { + this.editAreaFocus(); + var range = this.restoreRange(); + this.backupRange(range); + + var i, j = 0, attr, image, lastNode = null, spacer, len = images.length; + var fragment = this.doc.createDocumentFragment(); + range = this.getRange(); + var pNode = this.W3CRange ? range.commonAncestorContainer : range.parentElement(); + + for (i in images) { + if (!images.hasOwnProperty(i) || this.undefined(images[i])) { + continue; + } + attr = images[i]; + image = this.doc.createElement('img'); + image.setAttribute('src', attr.fileUrl); + + if (this.config.imgSetAttrWidth === 1) { + image.style.width = attr.width; + image.style.height = attr.height; + } + else if (this.config.imgSetAttrWidth === -1) { + image.style.width = "100%"; + image.style.height = "auto"; + } + + if (this.config.imgSetAttrAlt) { + image.setAttribute('alt', attr.alt || attr.origName); + } + else { + image.removeAttribute('alt'); + } + + if (paragraph) { + lastNode = fragment.appendChild(this.doc.createElement('p')); + if (attr.align !== 'left') { lastNode.style.textAlign = attr.align; } + lastNode.appendChild(image); + if (useSpacer) { + spacer = this.doc.createElement('p'); + spacer.appendChild(this.doc.createTextNode('\u00a0')); + fragment.appendChild(spacer); + } + } + else { + lastNode = fragment.appendChild(image); + j++; + if (useSpacer && j < len) { + fragment.appendChild(this.doc.createTextNode('\u00a0')); + } + } + this.images.push(attr); + } + + if (lastNode) { + var div; + if (paragraph) { + if (pNode.nodeName.toLowerCase() === 'p' || pNode.nodeName.toLowerCase() === 'div') { + pNode.parentNode.insertBefore(fragment, pNode.nextSibling); + this.removeBogusSpacer(pNode, true); + } + else { + this.removeBogusSpacer(pNode, false); + if (!this.W3CRange) { + div = this.doc.createElement('div'); + div.appendChild(fragment); + range.pasteHTML(div.innerHTML); + } + else { + range.insertNode(fragment); + } + } + this.placeCaretAt(lastNode, false); + } + else { + if (!this.W3CRange) { + div = this.doc.createElement('div'); + div.appendChild(fragment); + range.pasteHTML(div.innerHTML); + } + else { + range.deleteContents(); + range.insertNode(fragment); + range = range.cloneRange(); + range.setStartAfter(lastNode); + var selection = this.getSelection(); + selection.removeAllRanges(); + selection.addRange(range); + } + } + this.setImageEvent(true); + } +}, + +showTagSelector : function (on) { + if (this.config.showTagPath !== true) { return; } + this.cheditor.tagPath.style.display = on ? 'block' : 'none'; +}, + +richMode : function () { + this.range = null; + this.cheditor.editArea.style.visibility = 'hidden'; + this.setDesignMode(false); + this.cheditor.toolbarWrapper.style.display = ''; + + var content = (this.cheditor.mode === 'preview') ? + this.getContents(this.config.fullHTMLSource) : + this.makeHtmlContent(); + this.putContents(this.convertContentsSpacer(content)); + this.cheditor.toolbarWrapper.className = "cheditor-tb-wrapper"; + this.setDesignMode(true); + this.setImageEvent(true); + this.cheditor.editArea.style.visibility = 'visible'; + + if (this.doc.body.hasChildNodes()) { + var cursor = this.getRange(), selection, node; + if (this.W3CRange) { + selection = this.getSelection(); + node = cursor.commonAncestorContainer; + cursor.selectNode(node); + cursor.collapse(false); + selection.removeAllRanges(); + selection.addRange(cursor); + } + else { + node = this.doc.body.firstChild; + if (node.nodeType === GB.node.text) { + node = node.parentNode; + } + cursor.moveToElementText(node); + cursor.collapse(false); + cursor.select(); + } + } + this.editAreaFocus(); + if (this.doc.body.lastChild) { + this.placeCaretAt(this.doc.body.lastChild, false); + } + else { + this.initDefaultParagraphSeparator(); + } + this.toolbarUpdate(); +}, + +editMode : function () { + this.range = null; + this.cheditor.editArea.style.visibility = 'hidden'; + this.setDesignMode(false); + var content = this.getContents(this.config.fullHTMLSource); + + if (content !== '') { + if (this.W3CRange) { + this.doc.body.textContent = content; + } + else { + this.doc.body.innerText = content; + } + GB.prettify.initHighlightingOnLoad(['html', 'javascript', 'css'], this); + } + + this.cheditor.toolbarWrapper.className = "cheditor-tb-wrapper-code"; + this.cheditor.editArea.style.visibility = 'visible'; + this.cheditor.editBlock.style.display = 'none'; + + this.setDesignMode(true); + this.editAreaFocus(); +}, + +makeHtmlContent : function () { + return this.doc.body.textContent || this.doc.body.innerText; +}, + +resetStatusBar : function () { + if (this.config.showTagPath) { + this.cheditor.tagPath.innerHTML = '<html> <body> '; + } +}, + +previewMode : function () { + var content; + if (this.cheditor.mode === 'rich') { + content = this.getContents(this.config.fullHTMLSource); + } + else { + content = this.makeHtmlContent(); + } + this.putContents(content); + this.cheditor.editArea.style.visibility = 'hidden'; + this.cheditor.editBlock.style.display = 'none'; + this.cheditor.toolbarWrapper.className = "cheditor-tb-wrapper-preview"; + this.cheditor.editArea.style.visibility = 'visible'; + this.setImageEvent(false); + this.setDesignMode(false); + + if (GB.browser.msie_b) { + var oSheet = this.doc.styleSheets[0]; + oSheet.insertRule('p:after{content:"\u200b"}', oSheet.rules.length); + } +}, + +convertContentsSpacer : function (content) { + var self = this; + content = content.replace(/[\r\n]/g, ''); + content = content.replace(/<([^>\/]+)>( |\s+)<\/([^>]+)>/gm, + function(all, open, space, close) { + var start = self.trimSpace(open.split(' ')[0]); + var rdata = null; + if (GB.lineHeightBlock.indexOf('|' + start + '|') !== -1) { + rdata = '<' + open + '>'; + if (!(GB.browser.msie_b)) { + rdata += '
'; + } + rdata += ''; + } + return rdata || all; + } + ); + return content; +}, + +putContents : function (content) { + if (this.config.fullHTMLSource) { + content = content.substr(content.search(/') + 1); + content = '' + content; + this.doc.open(); + this.doc.write("" + content + ""); + this.doc.close(); + } + else { + content = "remove_this" + content; + this.doc.body.innerHTML = content; + this.doc.body.removeChild(this.doc.body.firstChild); + } +}, + +getImages : function () { + var img = this.doc.body.getElementsByTagName('img'); + var imgNumber = this.images.length; + var imgArr = [], i, imgid, j; + + for (i=0; i 0 ? imgArr : null; +}, + +getElementDefaultDisplay : function (elem) { + return (window.getComputedStyle ? window.getComputedStyle(elem, null) : elem.currentStyle).display; +}, + +checkBogusSpacer : function (node, para) { + var child, self = this; + + function checkBogus(elem) { + var pNode = elem.parentNode; + if (elem.className === self.cheditor.bogusSpacerName || + (elem.nodeType === GB.node.comment && elem.nodeValue === self.cheditor.bogusSpacerName)) + { + pNode.removeChild(elem); + if (pNode.hasChildNodes()) { + return; + } + if (pNode === para) { + pNode.appendChild(self.doc.createTextNode('\u00a0')); + return; + } + + while (pNode && (pNode !== para)) { + if (GB.textFormatting[pNode.nodeName.toLowerCase()]) { + pNode.className = 'REMOVE_EMPTY_TAG'; + pNode.parentNode.appendChild(self.doc.createTextNode('\u00a0')); + } + pNode = pNode.parentNode; + } + } + } + + child = node.firstChild; + + if (para.className === this.cheditor.bogusParaName) { + if (para.hasChildNodes()) { + if (child.nodeType === GB.node.element && child.nodeName.toLowerCase() === 'br') { + child.className = self.cheditor.bogusSpacerName; + } + para.removeAttribute('class'); + } + } + + while (child) { + this.checkBogusSpacer(child, para); + child = child.nextSibling; + } + + if (node.nodeType !== GB.node.text && node !== para) { + if (node.className === this.cheditor.bogusParaName) { + node.removeAttribute('class'); + child = node.firstChild; + if (child) { + if (child.nodeType === GB.node.element && child.nodeName.toLowerCase() === 'br') { + child.className = self.cheditor.bogusSpacerName; + node = child; + } + } + else { + node.className = 'REMOVE_EMPTY_TAG'; + } + } + checkBogus(node); + } +}, + +xhtmlParse : function (node, lang, needNewLine) { + var xhtmlText = '', innerText, tagName, child, parts, cssText, reMake=[], ct, kv, rs, i, j; + var children = node.childNodes; + var childrenLength = children.length; + var doNewLine = needNewLine ? true : false; + var attr, attrLen, attrValue, attrName, validAttr, attrLang = false, attrXmlLang = false, attrXmlns = false; + var reComment = new RegExp(); + var reHyphen = new RegExp(); + var reParsedValue = this.makeRandomString(); + var embedParams, embedAlignCode, mediaAlign = ''; + reComment.compile("^$"); + reHyphen.compile("-$"); + + for (i=0; i < childrenLength; i++) { + child = children[i]; + if (!child) { + continue; + } + if (GB.browser.msie && GB.browser.version < 9) { + if (child.getAttribute && child.getAttribute("re_parsed_attr")) { + continue; + } + if (child.setAttribute) { + child.setAttribute("re_parsed_attr", reParsedValue); + } + } + + if (child.parentNode && node.tagName.toLowerCase() !== child.parentNode.tagName.toLowerCase()) { + continue; + } + + switch (child.nodeType) { + case GB.node.element : + tagName = child.nodeName.toLowerCase(); + if (/^\W/.test(tagName) || tagName === '' || (tagName === 'meta' && child.name.toLowerCase() === 'generator')) { + break; + } + + if (GB.browser.msie) { + if (tagName === 'embed') { + embedParams = /align=("[^"]*"|'[^']*'|[^"'\s]*)(\s|>)/i; + embedAlignCode = child.outerHTML.match(embedParams); + if (embedAlignCode) { + //alignCode = embedAlignCode[1]; + mediaAlign = embedAlignCode.replace(/("|')/g, ""); + } + } + if (tagName === 'object' && !child.hasChildNodes()) { + xhtmlText += this.replaceObjectCode(child.outerHTML); + continue; + } + } + + if (tagName === '!') { + parts = reComment.exec(child.text); + if (parts) { + innerText = parts[1]; + innerText = innerText.replace(/--/g, "__"); + if (reHyphen.exec(innerText)) { + innerText += " "; + } + innerText = ""; + } + break; + } + + if (tagName === 'img' && !child.getAttributeNode('alt') && this.config.imgSetAttrAlt) { + child.setAttribute("alt", ""); + } + + if (tagName === 'script' && this.config.allowedScript !== true) { + continue; + } + + if (child.className === 'REMOVE_EMPTY_TAG') { + continue; + } + + if (tagName === 'p' && this.config.paragraphCss) { + child.style.margin = '0px'; + } + + if (GB.lineHeightBlock.indexOf('|' + tagName + '|') !== -1) { + if (child.hasChildNodes()) { + this.checkBogusSpacer(child, child); + } + else { + if (child.className === this.cheditor.bogusParaName) { + child.removeAttribute("class"); + } + child.appendChild(this.doc.createTextNode('\u00a0')); + } + } + + if (GB.newLineBefore.indexOf('|' + tagName + '|') !== -1) { + if ((this.doc.body.firstChild !== child && doNewLine) || (xhtmlText !== '')) { + if (!/\n$/.test(xhtmlText)) { + xhtmlText += "\n"; + } + } + else { + doNewLine = true; + } + } + + xhtmlText += '<' + tagName; + attr = child.attributes; + attrLen = attr.length; + validAttr = attrLang = attrXmlLang = attrXmlns = false; + attrValue = ''; + + for (j=0; j < attrLen; j++) { + attrName = attr[j].nodeName.toLowerCase(); + if (attrName === 're_parsed_attr') { + continue; + } + if (attr[j].specified === false && attrName !== 'selected' && attrName !== "style" && attrName !== "value" && + attrName !== "shape" && attrName !== "coords" && /^on/.test(attrName) !== -1) + { + continue; + } + if ((attrName === "shape" || attrName === "coords") && tagName !== "area") { + continue; + } + if (tagName === "img" && attrName === "complete") { + continue; + } + if ((attrName === "selected" && !child.selected) || (attrName === "style" && child.style.cssText === '')) { + continue; + } + if (attrName === "_moz_dirty" || attrName === "_moz_resizing" || attrName === "_moz-userdefined" || attrName === "_moz_editor_bogus_node" || + (tagName === "br" && attrName === "type" && attr[j].nodeValue === "_moz")) + { + continue; + } + + validAttr = true; + switch (attrName) { + case "style" : + cssText = child.style.cssText.split(';'); + for (ct=0; ct < cssText.length; ct++) { + kv = cssText[ct].split(/:/g); + if (this.trimSpace(kv[0]) !== '' && this.trimSpace(kv[1]) !== '') { + rs = kv.shift().toLowerCase(); + rs += ':' + kv.join(':'); + reMake.push(rs); + } + } + attrValue = reMake.join(';'); + reMake = []; + break; + case "class" : + attrValue = child.className; + break; + case "noshade" : + case "checked" : + case "selected" : + case "nowrap" : + case "disabled" : + attrValue = attrName; + break; + case "name" : + attrValue = child.name || child.getAttribute("name"); + break; + case "for" : + attrValue = child.htmlFor; + break; + default : + try { + if (/^on/.test(attrName)) { + if (this.config.allowedOnEvent) { + attrValue = attr[j].nodeValue; + } + else { + validAttr = false; + } + } + else { + attrValue = child.getAttribute(attrName, 2); + } + } catch (e) { + validAttr = false; + } + } + + if (tagName === "embed") { + switch (attrName) { + case "align": + attrValue = (mediaAlign !== '') ? mediaAlign : eval("child." + attrName); + break; + default: + attrValue = attr[j].nodeValue; + break; + } + } + + if (attrName === 'lang' && tagName === 'html') { + attrLang = true; + attrValue = lang; + } + + if (attrName === 'xml:lang') { + attrXmlLang = true; + attrValue = lang; + } + + if (attrName === 'xmlns') { + attrXmlns = true; + } + + if (tagName === 'object' && attrName === 'src' && GB.browser.msie) { + attrValue = this.fixObjectSrc(child.outerHTML); + } + + if (validAttr) { + if (!(tagName === 'li' && attrName === 'value')) { + xhtmlText += ' ' + attrName + "="; + xhtmlText += (/"/.test(attrValue)) ? "'" + this.fixAttribute(attrValue) + "'" : '"' + attrValue + '"'; + } + } + } + + if (tagName === 'html') { + if (!attrLang) { + xhtmlText += ' lang="' + lang + '"'; + } + if (!attrXmlLang) { + xhtmlText += ' xml:lang="' + lang + '"'; + } + if (!attrXmlns) { + xhtmlText += ' xmlns="http://www.w3.org/1999/xhtml"'; + } + } + + if (!GB.emptyElements[tagName] || child.hasChildNodes()) { + xhtmlText += '>'; + innerText = ''; + if (tagName === "style" || tagName === "title" || tagName === "script") { + innerText += (tagName === "script") ? child.text : child.innerHTML; + innerText = '\n'+this.trimSpace(innerText)+'\n'; + } + else { + innerText += this.xhtmlParse(child, lang, doNewLine); + } + + if (innerText) { xhtmlText += innerText; } + //if (doNewLine) { xhtmlText += '\n'; } + xhtmlText += ''; + } + else { + xhtmlText += ' />'; + //if (tagName === 'br') { xhtmlText += '\n'; } + } + break; + case GB.node.text : + xhtmlText += this.htmlEncode(child.nodeValue); + break; + case GB.node.comment : + xhtmlText += ""; + break; + default: break; + } + } + return xhtmlText; +}, + +htmlEncode : function (text) { + //text = text.replace(/\n{2,}$/g, "\n"); + //text = text.replace(/&/g, "&"); + text = text.replace(//g, ">"); + text = text.replace(/\u00a0/g, " "); + //text = text.replace(/\x22/g, """); + return text; +}, + +fixAttribute : function (text) { + return this.htmlEncode(text); +}, + +fixObjectSrc : function (text) { + var obj = text.match(/]+)>/i); + if (obj) { + var value = obj[1].match(/src="([^"]+)"/i); + if (!value) { + value = obj[1].match(/src='([^']+)'/i); + if (!value) { + value = obj[1].match(/src=([^ ]+)/i); + } + } + if (value) { + return value[1]; + } + } + return ''; +}, + +replaceObjectCode : function (text) { + var tmpTxt = String(text); + tmpTxt = tmpTxt.replace(/ style=/gi, ' style='); + tmpTxt = tmpTxt.replace(/ codeBase=/gi, ' codebase='); + tmpTxt = tmpTxt.replace(/ height=/gi, ' height='); + tmpTxt = tmpTxt.replace(/ width=/gi, ' width='); + tmpTxt = tmpTxt.replace(/ align=/gi, ' align='); + tmpTxt = tmpTxt.replace(/ classid=/gi, ' classid='); + tmpTxt = tmpTxt.replace(/ src=/gi, ' src='); + tmpTxt = tmpTxt.replace(/ name=/gi, ' name='); + tmpTxt = tmpTxt.replace(/ value=/gi, ' value='); + tmpTxt = tmpTxt.replace(/ quality=/gi, ' quality='); + tmpTxt = tmpTxt.replace(/ type=/gi, ' type='); + tmpTxt = tmpTxt.replace(/ pluginspage=/gi, ' pluginspage='); + tmpTxt = tmpTxt.replace(//gi, ''); + tmpTxt = tmpTxt.replace(//gi, ''); + tmpTxt = tmpTxt.replace(//gi, ''); + return tmpTxt; +}, + +needsClosingTag : function (el) { + var closingTags = " head script style div span tr td tbody table em strong font a title "; + return (closingTags.indexOf(" " + el.tagName.toLowerCase() + " ") !== -1); +}, + +stripBaseURL : function (url) { + var baseURL = this.config.baseURL; + baseURL = baseURL.replace(/[^\/]+$/, ''); + + var baseRe = new RegExp(baseURL); + url = url.replace(baseRe, ""); + + baseURL = baseURL.replace(/^(https?:\/\/[^\/]+)(.*)$/, '$1'); + baseRe = new RegExp(baseURL); + + return url.replace(baseRe, ""); +}, + +checkDocLinks : function () { + var links = this.doc.links; + var len = links.length; + var host = location.host; + var i, href; + this.cheditor.links = []; + + for (i=0; i < len; i++) { + if (!this.config.includeHostname) { + href = links[i].href; + if (href.indexOf(host) !== -1) { + links[i].setAttribute('href', href.substring(href.indexOf(host) + host.length)); + } + } + + if (this.config.linkTarget !== '' && this.config.linkTarget !== null) { + if (!(links[i].getAttribute('target'))) { + links[i].setAttribute('target', this.config.linkTarget); + } + } + + if (GB.browser.msie) { + this.cheditor.links.push(links[i]); + } + } +}, + +checkDocImages : function () { + var img = this.doc.images; + var len = img.length; + var host = location.host; + var i, imgsrc; + + for (i=0; i < len; i++) { + if (!this.config.includeHostname) { + imgsrc = img[i].src; + if (imgsrc) { + if (imgsrc.indexOf(host) !== -1) { + img[i].src = imgsrc.substring(imgsrc.indexOf(host) + host.length); + } + } + } + if (img[i].style.width) { + img[i].removeAttribute('width'); + } + if (img[i].style.height) { + img[i].removeAttribute('height'); + } + } +}, + +createTempDocument : function (contents) { + var doc = GB.browser.msie ? this.cheditor.htmlEditable.contentWindow.document : + this.cheditor.htmlEditable.contentDocument; + contents = contents.replace(/[\n\r]+/g, ''); + doc.open(); + doc.write(contents); + doc.close(); + return doc; +}, + +getContents : function (fullSource) { + this.checkDocLinks(); + this.checkDocImages(); + + var mydoc = ''; + var tmpDoc = this.createTempDocument(this.doc.documentElement.outerHTML); + + if (GB.browser.msie) { + this.doc.body.removeAttribute('contentEditable'); + } + + if (fullSource) { + mydoc = GB.doctype + '\n'; + mydoc += this.xhtmlParse(tmpDoc.documentElement, this.config.xhtmlLang); + } + else { + mydoc = this.xhtmlParse(tmpDoc.body, this.config.xhtmlLang); + } + mydoc = this.trimSpace(mydoc); + + if (GB.browser.msie || GB.browser.opera) { + if (this.config.ieEnterMode === 'div') { + mydoc = mydoc.replace(/<(\/?)p([^>]+)?>/gmi, + function (a, b, c) { + if (/^\S/.test(c)) { return a; } + return '<' + b + 'div' + c + '>'; + }); + } + } + + var self = this; + if (this.config.colorToHex) { + mydoc = mydoc.replace(/([color|background\-color]\s?[:=]).?(rgba?)\(\s*(\d+)\s*,\s*(\d+),\s*(\d+)\)/ig, + function (a, b, c, d, e, f) { + return b + ' ' + self.colorConvert(c+'('+d+','+e+','+f+')', "hex"); + }); + } + else { + mydoc = mydoc.replace(/([color|background\-color]\s?[:=])(.?)#([a-fA-F0-9]+)/ig, + function (a, b, c, d) { + return b + c + self.colorConvert(d, "rgb"); + }); + } + + return mydoc; +}, + +returnContents : function (mydoc) { + this.setDesignMode(true); + this.cheditor.textarea.value = mydoc; + return mydoc; +}, + +makeAmpTag : function (str) { return str.replace(/</g, '&lt;').replace(/>/g, '&gt;'); }, +removeAmpTag: function (str) { return str.replace (/&lt;/g, '<').replace(/&gt;/g,'>'); }, + +getOutputContents : function (fullSource) { + this.resetViewHTML(); + return this.removeAmpTag(this.getContents(fullSource)); +}, + +outputHTML : function () { + return this.returnContents(this.getOutputContents(true)); +}, + +outputBodyHTML : function () { + return this.returnContents(this.getOutputContents(false)); +}, + +outputBodyText : function () { + return this.returnContents(this.getBodyText()); +}, + +getBodyText : function () { + this.resetViewHTML(); + var rdata = String(GB.browser.msie ? this.doc.body.innerText : this.doc.body.textContent); + return this.trimSpace(rdata); +}, + +returnFalse : function () { + this.editAreaFocus(); + var img = this.doc.images, i; + for (i=0; i 128) { + mbytes++; + } + } + return (len-mbytes) + (mbytes*2); +}, + +resetViewHTML : function () { + if (this.cheditor.mode === 'code') { + this.switchEditorMode('rich'); + } +}, + +contentsLengthAll : function () { + return this.strLength(this.outputHTML()); +}, + +contentsLength : function () { + var content = String(this.trimSpace(this.outputBodyHTML())); + if (!content || content === "") { return 0; } + return this.strLength(content); +}, + +inputLength : function () { + var content = this.getBodyText(); + if (content === '') { return 0; } + return this.strLength(content); +}, + +displayWindow : function (pNode, id) { + this.editAreaFocus(); + this.backupRange(this.getRange()); + this.boxHideAll(id); + var pullDown = this.pulldown[id]; + pullDown.style.visibility = "visible"; + pullDown.style.zIndex = 10002; + pullDown.focus(); +}, + +pulldownMouseOver : function (el) { + if (el.className === 'cheditor-pulldown-selected') { return; } + el.className = "cheditor-pulldown-mouseover"; +}, +pulldownMouseOut : function (el) { + if (el.className === 'cheditor-pulldown-selected') { return; } + el.className = "cheditor-pulldown-mouseout"; +}, + +windowPos : function (pNode, id) { + var L = pNode.offsetLeft; + var boxEl = this.pulldown[id]; + if (this.toolbar[id].type === "combobox") { + L -= parseInt(this.toolbar[this.toolbar[id].node].width, 10); + } + if (this.toolbar[id].prev && !this.toolbar[id].next) { + L -= 1; + } + boxEl.style.left = L + 'px'; + boxEl.style.top = pNode.offsetTop + parseInt(pNode.style.height, 10) + 'px'; +}, + +boxHideAll : function (showId) { + var menu, elem, ishide; + for (menu in this.pulldown) { + if (this.pulldown.hasOwnProperty(menu)) { + elem = this.pulldown[menu]; + if (elem) { + elem.style.visibility = 'hidden'; + ishide = this.undefined(showId) ? true : (menu !== showId); + if (ishide && this.toolbar[menu].checked) { + this.toolbar[menu].checked = false; + this.toolbarButtonUnchecked(this.toolbar[menu]); + } + } + } + } +}, + +createWindow : function (width, div) { + div.className = 'cheditor-pulldown-container'; + div.style.width = width+'px'; +}, + +setColorTable : function (menu) { + var self = this; + var pulldown = document.createElement('div'); + var len = GB.colors.length, i, cell, color=0; + var container = document.createElement('div'); + var selected = document.createElement('input'); + selected.setAttribute("type", "text"); + selected.setAttribute("maxlength", '7'); + selected.className = 'cheditor-pulldown-color-selected'; + + var selectedValue = document.createElement('input'); + selectedValue.setAttribute("type", "text"); + selectedValue.onfocus = function() { selected.focus(); }; + selectedValue.style.cursor = 'default'; + selectedValue.className = 'cheditor-pulldown-color-selected'; + selected.style.marginLeft = "-1px"; + selected.style.borderLeft = "none"; + selected.spellcheck = false; + var cellWrapper = document.createElement('div'); + cellWrapper.style.margin = "2px"; + cellWrapper.style.position = 'relative'; + container.style.position = 'relative'; + var br = document.createElement('div'); + br.style.clear = 'both'; br.style.height = '0px'; + + var colorPicker = new colorDropper.color(selected, {"iconDir": this.config.iconPath}); + var mouseOver = function() { + colorPicker.fromString(this.id); + this.parentNode.className = 'cheditor-pulldown-color-cell-over'; + }; + var mouseOut = function() { + this.parentNode.className = 'cheditor-pulldown-color-cell'; + }; + var cellCmd = function() { self.doCmdPopup(menu, this.id); }; + var cellBorder; + + for (i=0; i < len; i++) { + if (i % 13 === 0) { + cellWrapper.appendChild(br.cloneNode(true)); + if (i === 26) { + cellWrapper.lastChild.style.height = "4px"; + } + len++; + continue; + } + cellBorder = document.createElement('span'); + cellBorder.className = 'cheditor-pulldown-color-cell'; + cell = document.createElement('span'); + cell.id = GB.colors[color]; + cell.style.backgroundColor = GB.colors[color++]; + cell.onmouseover = mouseOver; + cell.onmouseout = mouseOut; + cell.onclick = cellCmd; + cell.appendChild(document.createTextNode('\u00a0')); + cellBorder.appendChild(cell); + cellWrapper.appendChild(cellBorder); + } + cellWrapper.appendChild(br); + cellWrapper.appendChild(selectedValue); + cellWrapper.appendChild(selected); + + var reset = document.createElement('span'); + reset.appendChild(document.createTextNode('\u00a0')); + reset.className = "cheditor-pulldown-color-reset"; + reset.onclick = function() { colorPicker.fromString(self.colorConvert(selectedValue.style.backgroundColor, "hex")); }; + cellWrapper.appendChild(reset); + + var showTooltip = '더 많은 색 보기'; var hideTooltip = '감추기'; + var pickerSwitch = document.createElement('span'); + pickerSwitch.appendChild(document.createTextNode('\u00a0')); + pickerSwitch.className = "cheditor-pulldown-color-show-picker"; + pickerSwitch.setAttribute('title', showTooltip); + pickerSwitch.onclick = function() { + if (self.toolbar[menu].colorNode.showPicker) { + colorPicker.hidePicker(); + self.toolbar[menu].colorNode.showPicker = false; + pickerSwitch.setAttribute('title', showTooltip); + } + else { + colorPicker.showPicker(); + self.toolbar[menu].colorNode.showPicker = true; + pickerSwitch.setAttribute('title', hideTooltip); + } + }; + cellWrapper.appendChild(pickerSwitch); + + var button = document.createElement('img'); + button.className = "cheditor-pulldown-color-submit"; + button.src = this.config.iconPath + 'button/input_color.gif'; + button.onclick = function() { self.doCmdPopup(menu, selected.value); }; + cellWrapper.appendChild(button); + container.appendChild(cellWrapper); + + self.toolbar[menu].colorNode.selectedValue = selectedValue; + self.toolbar[menu].colorNode.colorPicker = colorPicker; + + pulldown.appendChild(container); + return pulldown; +}, + +onKeyPressToolbarUpdate : function () { + var self = this; + if (self.tempTimer) { clearTimeout(self.tempTimer); } + self.tempTimer = setTimeout(function() { + self.toolbarUpdate(); + self.tempTimer = null; + }, 100); + if (self.config.showTagPath) { self.doEditorEvent(); } +}, + +doOnKeyDown : function (event) { + var keyCode = event.keyCode; + if (keyCode !== 8 && (keyCode < 33 || keyCode > 40)) { return; } + if (this.cheditor.mode === "rich") { + this.onKeyPressToolbarUpdate(); + } +}, + +doOnKeyUp : function (event) { + var keyCode = event.keyCode; + if (keyCode && keyCode === 13) { + var rNode, nNode, child, br, node, comment, range, storedRange, currentNode, storedNode, self = this; + + if (this.cheditor.mode !== "rich" || (GB.browser.msie && GB.browser.version < 7)) { + return; + } + + comment = this.doc.createComment(this.cheditor.bogusSpacerName); + if (GB.browser.msie && GB.browser.version < 9) { + node = this.storedSelections[0]; + while (node.firstChild) { node = node.firstChild; } + if (node.nodeType === GB.node.element) { + try { node.appendChild(comment); } + catch(ignore) {} + } + return; + } + + range = this.getRange(); + storedRange = this.storedSelections[0]; + currentNode = range.commonAncestorContainer; + storedNode = storedRange.commonAncestorContainer; + br = this.doc.createElement('br'); + br.className = this.cheditor.bogusSpacerName; + + var prevNodeCheck = function() { + if (storedRange.startOffset < 1) { + node = storedNode; + while (node) { + if (node.previousSibling) { + node = node.previousSibling; + break; + } + node = node.parentNode; + } + + if (node.nodeType === GB.node.element) { + while (node.firstChild) { node = node.firstChild; } + } + + if (node.nodeType === GB.node.element && node.nodeName.toLowerCase() === 'br') { + node.className = self.cheditor.bogusSpacerName; + } + else { + node.appendChild(br); + } + } + }; + + if (GB.browser.msie || GB.browser.edge) { + if (!currentNode.hasChildNodes()) { + currentNode.className = this.cheditor.bogusParaName; + } + if (storedNode.nodeType === GB.node.element) { + rNode = storedNode.childNodes[storedRange.startOffset]; + if (!rNode) { return; } + child = rNode; + + while (child.firstChild) { child = child.firstChild; } + if (child.nodeType !== GB.node.element) { return; } + + child.appendChild(GB.browser.version < 11 ? comment : br); + nNode = this.doc.createElement(rNode.nodeName); + + if (rNode.firstChild) { + nNode.appendChild(rNode.firstChild.cloneNode(true)); + } + storedRange.insertNode(nNode); + rNode.parentNode.removeChild(rNode); + } + return; + } + + if (currentNode.lastChild && currentNode.lastChild.nodeName.toLowerCase() === 'br') { + currentNode.lastChild.className = this.cheditor.bogusSpacerName; + } + else { + prevNodeCheck(); + } + } +}, + +doOnKeyPress : function (event) { + var keyCode = event.keyCode; + if (keyCode && keyCode === 13) { + if (this.cheditor.mode !== "rich" || (GB.browser.msie && GB.browser.version < 7)) { + return; + } + var range = this.getRange(); + if (GB.browser.msie && GB.browser.version < 9) { + this.storedSelections[0] = range.parentElement(); + } + else { + this.backupRange(range); + } + + if (GB.browser.msie && this.config.ieEnterMode === 'br' && !this.editArea.event.shiftKey) + { + var added = false; + if (GB.browser.version > 8) { + var br = this.doc.createElement("br"); + range.insertNode(br); + range.setStartAfter(br); + range.setEndAfter(br); + added = true; + } + else { + range.pasteHTML("
"); + range.select(); + range.moveEnd("character", 1); + range.moveStart("character", 1); + range.collapse(false); + added = true; + } + if (added) { + this.stopEvent(event); + } + } + } + + if (this.cheditor.mode === "rich") { + this.onKeyPressToolbarUpdate(); + } +}, + +setWinPosition : function (oWin, popupAttr, windowSize) { + oWin.style.width = popupAttr.width + 'px'; + oWin.style.left = Math.round(((this.cheditor.editArea.clientWidth - popupAttr.width) / 2) + windowSize.offsetLeft) + 'px'; + oWin.style.top = Math.round(windowSize.offsetTop) + 'px'; +}, + +getWindowSize : function () { + var docMode = document.compatMode === 'CSS1Compat'; + var docBody = document.body; + var docElem = document.documentElement; + + var rData = { + width : docMode ? docElem.clientWidth : docBody.clientWidth, + height : docMode ? docElem.clientHeight : docBody.clientHeight, + scrollHeight : docMode ? docElem.scrollHeight : docBody.scrollHeight, + scrollWidth : docMode ? docElem.scrollWidth : docBody.scrollWidth + }; + + if (this.undefined(window.pageXOffset)) { + var factor = 1; + if (docBody.getBoundingClientRect) { + var rect = docBody.getBoundingClientRect (); + var physicalW = rect.right - rect.left; + var logicalW = document.body.offsetWidth; + factor = Math.round ((physicalW / logicalW) * 100) / 100; + } + rData.scrollY = Math.round(docElem.scrollTop / factor); + rData.scrollX = Math.round(docElem.scrollLeft / factor); + } + else { + rData.scrollY = window.pageYOffset; + rData.scrollX = window.pageXOffset; + } + + var editAreaRect = this.cheditor.editArea.getBoundingClientRect(); + rData.clientTop = docElem.clientTop || docBody.clientTop || 0; + rData.clientLeft = docElem.clientLeft || docBody.clientLeft || 0; + rData.offsetTop = editAreaRect.top + rData.scrollY - rData.clientTop; + rData.offsetLeft = editAreaRect.left + rData.scrollX - rData.clientLeft; + return rData; +}, + +popupWinLoad : function (popupAttr) { + var self = this; + var windowSize = self.getWindowSize(); + + if (self.cheditor.popupTitle.hasChildNodes()) { + self.cheditor.popupTitle.removeChild(self.cheditor.popupTitle.firstChild); + } + + self.cheditor.popupTitle.appendChild(document.createTextNode(popupAttr['title'])); + self.cheditor.popupElem.style.zIndex = 1002; + self.setWinPosition(self.cheditor.popupElem, popupAttr, windowSize); + + var iframe = document.createElement("iframe"); + iframe.setAttribute('frameBorder', "0"); + iframe.setAttribute('height', "0"); + iframe.setAttribute('width', String(popupAttr['width'] - 22)); + iframe.setAttribute('name', popupAttr['tmpl']); + iframe.setAttribute('src', self.config.popupPath + popupAttr['tmpl']); + iframe.style.visibility = 'hidden'; + iframe.id = popupAttr['tmpl']; + + if (self.cheditor.popupFrameWrapper.hasChildNodes()) { + self.cheditor.popupFrameWrapper.removeChild(self.cheditor.popupFrameWrapper.firstChild); + } + + self.cheditor.popupFrameWrapper.appendChild(iframe); + + var popWinResizeHeight = function () { + iframe.style.visibility = 'visible'; + iframe.contentWindow.focus(); + iframe.contentWindow.init.call(self, iframe, popupAttr['argv'] || null); + var popupWinTop = Math.round((self.cheditor.editArea.clientHeight - self.cheditor.popupElem.clientHeight) / 2); + self.cheditor.popupElem.style.top = Math.round(parseInt(self.cheditor.popupElem.style.top, 10) + popupWinTop) + 'px'; + self.cheditor.popupElem.style.visibility = 'visible'; + }; + + if (GB.browser.msie && GB.browser.version < 11) { + var done = false; + iframe.onreadystatechange = function() { + if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) { + done = true; + popWinResizeHeight(); + } + }; + } + else { + iframe.onload = popWinResizeHeight; + } + + self.cheditor.popupElem.style.visibility = 'hidden'; + self.cheditor.popupElem.style.display = 'block'; + self.cheditor.modalBackground.style.zIndex = self.modalElementZIndex; + + if (GB.browser.msie && GB.browser.version < 10) { + var modalResize = function() { + self.cheditor.modalBackground.style.height = (windowSize.scrollHeight > windowSize.height) ? + windowSize.scrollHeight : windowSize.height + 'px'; + + if (window.scrollWidth > window.width) { + self.cheditor.modalBackground.style.width = windowSize.width + (windowSize.scrollWidth - windowSize.width) + 'px'; + } + else { + self.cheditor.modalBackground.style.width = windowSize.width + 'px'; + } + + self.cheditor.modalBackground.style.left = windowSize.scrollX + 'px'; + }; + + window.onresize = function() { + windowSize = self.getWindowSize(); + modalResize(); + }; + + modalResize(); + self.cheditor.modalBackground.style.filter = 'alpha(opacity=50)'; + } + else { + self.cheditor.modalBackground.style.opacity = 0.5; + } + + var body = document.getElementsByTagName('body')[0]; + body.insertBefore(self.cheditor.modalBackground, body.firstChild); + self.cheditor.modalBackground.style.display = 'block'; + body.insertBefore(self.cheditor.popupElem, body.firstChild); + GB.dragWindow.init(self.cheditor.dragHandle, self.cheditor.popupElem); +}, + +popupWinCancel : function () { + this.restoreRange(); + this.popupWinClose(); +}, + +popupWinClose : function () { + if (!this.cheditor.popupElem) { + return; + } + this.cheditor.popupElem.style.display = 'none'; + this.cheditor.popupElem.style.zIndex = -1; + this.cheditor.popupFrameWrapper.src = ""; + + if (this.cheditor.popupFrameWrapper.hasChildNodes()) { + this.cheditor.popupFrameWrapper.removeChild(this.cheditor.popupFrameWrapper.firstChild); + } + + this.cheditor.modalBackground.style.display = 'none'; + this.cheditor.modalBackground.style.zIndex = -1; + + if (this.modalReSize !== null) { + if (GB.browser.opera) { + window.removeEventListener("resize", this.modaReSize, false); + } + this.modalReSize = null; + } + + this.editAreaFocus(); +}, + +clearStoredSelections : function () { + this.storedSelections.splice(0, this.storedSelections.length); +}, + +restoreRange : function () { + var range = null, selection = null; + if (this.storedSelections[0]) { + if (this.W3CRange) { + selection = this.getSelection(); + selection.removeAllRanges(); + selection.addRange(this.storedSelections[0]); + range = selection.getRangeAt(0); + } + else { + range = this.getRange(); + if (this.storedSelections[0]) { + if (typeof this.storedSelections[0] === "string") { + range.moveToBookmark(this.storedSelections[0]); + } + else { + range = this.storedSelections[0]; + } + } + range.select(); + } + } + return range; +}, + +backupRange: function (range) { + var selection = null; + if (this.W3CRange) { + selection = this.getSelection(); + if (selection.rangeCount > 0) { + selection.removeAllRanges(); + selection.addRange(range); + this.storedSelections[0] = selection.getRangeAt(0); + } + } + else { + try { + switch (this.getSelectionType(range)) { + case GB.selection.none: + case GB.selection.text: + this.storedSelections[0] = range.getBookmark(); + break; + case GB.selection.element: + this.storedSelections[0] = range; + break; + default: + this.storedSelections[0] = null; + } + } catch (ignore) {} + } +}, + +getSelection : function () { + return this.W3CRange ? this.editArea.getSelection() : this.doc.selection; +}, + +getRange : function () { + var selection = this.getSelection(); + var range = null; + + if (this.W3CRange) { + if (selection.getRangeAt) { + range = (selection.rangeCount > 0) ? selection.getRangeAt(0) : this.doc.createRange(); + } + else { + range = this.doc.createRange(); + range.setStart(selection.anchorNode, selection.anchorOffset); + range.setEnd(selection.focusNode, selection.focusOffset); + } + } + else { + range = selection.createRange ? selection.createRange() : this.doc.createRange(); + if (!range) { + range = this.doc.body.createTextRange(); + } + } + this.range = range; + return range; +}, + +createRange : function () { + return this.W3CRange ? this.doc.createRange() : this.doc.body.createTextRange(); +}, + +getW3CRangeElement : function (range) { + if (!this.W3CRange) { return null; } // IE < 9 + + var rootNode = range.commonAncestorContainer; + var startContainer = range.startContainer; + var endContainer = range.endContainer; + var startOffset = range.startOffset; + var endOffset = range.endOffset; + var node = startContainer; + var len = rootNode.childNodes.length, i; + + if (GB.browser.msie) { + if (!range.collapsed && rootNode.nodeType === GB.node.element) { + if (rootNode === endContainer) { + node = rootNode.childNodes[endOffset-1]; + } + else if (rootNode === startContainer) { + node = rootNode.childNodes[startOffset]; + } + else { + for (i=0; i]*)>/g, + function(a, b, c) { + var el = c.toLowerCase().split(/ /)[0]; + if (el !== 'p' && el !== 'div' && el !== 'br') { + return ''; + } + return '<'+b+el+'>'; + }); + } + this.editAreaFocus(); + this.toolbarUpdate(); + return; + } + + if (cmd === 'Print') { + this.editArea.print(); + return; + } + + if (cmd === 'PageBreak') { + this.printPageBreak(); + this.editAreaFocus(); + return; + } + + if (this.W3CRange || this.getSelectionType(range) === GB.selection.none) { + range = this.doc; + } + + if (!GB.browser.msie && (cmd === 'Cut' || cmd === 'Copy' || cmd === 'Paste')) { + try { + range.execCommand(cmd, false, opt); + } catch (e) { + var keyboard = ''; + var command = ''; + switch (cmd) { + case 'Cut' : keyboard = 'x'; command = '자르기'; break; + case 'Copy' : keyboard = 'c'; command = '복사'; break; + case 'Paste': keyboard = 'v'; command = '붙이기'; break; + } + + alert('사용하고 계신 브라우저에서는 \'' + command + '\' 명령을 사용하실 수 없습니다. \n' + + '키보드 단축키를 이용하여 주세요. (윈도 사용자: Ctrl + ' + keyboard + ', Mac 사용자: Apple + ' + keyboard + ')'); + } + + this.editAreaFocus(); + return; + } + + try { + var pNode, node, self = this; + if (cmd === 'PasteFromWord') { + var cleanPaste = function() { + self.editArea.focus(); + var tmpDoc = self.cheditor.tmpdoc; + tmpDoc.execCommand("SelectAll"); + tmpDoc.execCommand("Paste"); + return self.cleanFromWord(tmpDoc); + }; + + if (this.undefined(this.cheditor.tmpdoc)) { + var tmpframe = this.doc.createElement('iframe'); + tmpframe.setAttribute('contentEditable', "true"); + tmpframe.style.visibility = 'hidden'; + tmpframe.style.height = tmpframe.style.width = '0px'; + tmpframe.setAttribute('frameBorder', "0"); + this.cheditor.editWrapper.appendChild(tmpframe); + + var tmpdoc = tmpframe.contentWindow.document; + tmpdoc.designMode = 'On'; + tmpdoc.open(); + tmpdoc.close(); + this.cheditor.tmpdoc = tmpdoc; + } + + if (this.W3CRange) { + var html = cleanPaste(); + range = this.restoreRange(); + this.insertNodeAtSelection(html); + } + else { + range = this.getRange(); + range.pasteHTML(cleanPaste()); + range.select(); + } + } + else if (cmd === 'Paste') { + this.cheditor.paste = 'text'; + range.execCommand(cmd); + this.cheditor.paste = 'html'; + } + else if (cmd === 'InsertHorizontalRule') { + var hr = this.doc.createElement('hr'), emptyPara; + hr.style.height = '1px'; + hr.style.backgroundColor = "#999"; + hr.style.border = "0"; + + if (!GB.browser.msie) { + range.execCommand("InsertParagraph", false); + range = this.getRange(); + node = range.commonAncestorContainer; + pNode = node; + while (pNode && pNode.nodeName.toLowerCase() !== 'p') { + pNode = pNode.parentNode; + } + if (pNode.nodeName.toLowerCase() === 'p') { + emptyPara = this.makeSpacerElement(); + if (node.nodeType === GB.node.text) { + node = node.parentNode; + } + if (!node.firstChild || node.firstChild.nodeName.toLowerCase() === 'br') { + pNode.parentNode.replaceChild(hr, pNode); + if (!(hr.nextSibling)) { + hr.parentNode.insertBefore(emptyPara, hr.nextSibling); + this.placeCaretAt(emptyPara, false); + } + } + else { + pNode.parentNode.insertBefore(hr, pNode); + } + } + } + else { + var id = this.makeRandomString(); + range.execCommand("InsertParagraph", false, id); + emptyPara = this.doc.getElementById(id); + emptyPara.parentNode.replaceChild(hr, emptyPara); + emptyPara = this.makeSpacerElement(); + if (!(hr.previousSibling)) { + hr.parentNode.insertBefore(emptyPara, hr); + } + if (!(hr.nextSibling)) { + hr.parentNode.insertBefore(emptyPara.cloneNode(true), hr.nextSibling); + } + if (hr.nextSibling.nodeType === GB.node.element) { + this.placeCaretAt(hr.nextSibling, false); + } + } + } + else { + switch (cmd) { + case 'JustifyLeft' : + case 'JustifyCenter' : + case 'JustifyRight' : + case 'JustifyFull' : + range.execCommand(cmd, false, opt); + range = this.getRange(); + pNode = this.W3CRange ? range.commonAncestorContainer : range.parentElement(); + + if (!GB.browser.c && pNode.nodeType === GB.node.element && + pNode.nodeName.toLowerCase() === 'body') + { + pNode = pNode.childNodes[range.startOffset]; + } + + if (pNode.nodeType === GB.node.text) { + pNode = pNode.parentNode; + } + + var css, i, found = false; + while (pNode && pNode.nodeName.toLowerCase() !== 'body') { + if (pNode.getAttribute('align')) { + pNode.removeAttribute('align'); + found = true; + } + else { + css = this.getCssValue(pNode); + if (css) { + for (i=0; i]*>/g, ""); doc = doc.replace(/<\/?o:p[^>]*>/g, ""); + doc = doc.replace(/<\/?v:[^>]*>/g, ""); doc = doc.replace(/<\/?o:[^>]*>/g, ""); doc = doc.replace(/<\/?st1:[^>]*>/g, ""); + doc = doc.replace(//g, ""); doc = doc.replace(//g, ""); + doc = doc.replace(/<\\?\?xml[^>]*>/g, ""); doc = doc.replace(/<\/?o:p[^>]*>/g, ""); doc = doc.replace(/<\/?v:[^>]*>/g, ""); + doc = doc.replace(/<\/?o:[^>]*>/g, ""); doc = doc.replace(/<\/?st1:[^>]*>/g, ""); doc = doc.replace(/lang=.?[^" >]*/ig, ""); + doc = doc.replace(/type=.?[^" >]*/g, ""); doc = doc.replace(/href='#[^"]*'/g, ""); doc = doc.replace(/href="#[^"]*"/g, ""); + doc = doc.replace(/name=.?[^" >]*/g, ""); doc = doc.replace(/ clear="all"/g, ""); doc = doc.replace(/id="[^"]*"/g, ""); + doc = doc.replace(/title="[^"]*"/g, ""); doc = doc.replace(/\n/g, ""); doc = doc.replace(/\r/g, ""); + doc = doc.replace(/mso\-[^">;]*/g, ""); doc = doc.replace(/]*/ig, "]*<\/span>/ig, ""); + return doc; +}, + +printPageBreak : function () { + var hr = document.createElement('hr'); + hr.style.pageBreakAfter = 'always'; + hr.style.border = '1px #999 dotted'; + this.insertHTML(hr); + var div = this.doc.createElement("div"); + div.appendChild(this.doc.createTextNode("\u00a0")); + this.insertHTML(div); +}, + +doCmdPaste : function (html) { + this.editAreaFocus(); + if (!this.W3CRange) { + if (this.range.item) { + var rng = this.doc.body.createTextRange(); + if (rng) { + rng.moveToElementText(this.range.item(0)); + rng.select(); + this.range.item(0).outerHTML = html; + } + this.toolbarUpdate(); + } + else { + this.range.pasteHTML(html); + this.range.select(); + } + } + else { + this.insertNodeAtSelection(html); + } +}, + +getPreviousLeaf : function (node) { + while (!node.previousSibling) { + node = node.parentNode; + if (!node) { + return node; + } + } + var leaf = node.previousSibling; + while (leaf.lastChild) { + leaf = leaf.lastChild; + } + return leaf; +}, + +getNextLeaf : function (node, breakNode) { + while (!node.nextSibling) { + node = node.parentNode; + if ((breakNode && breakNode === node) || !node) { + return node; + } + } + var leaf = node.nextSibling; + while (leaf.firstChild) { + leaf = leaf.firstChild; + } + return leaf; +}, + +isTextVisible : function (text) { + var i, found = false, len = text.length; + for (i=0; i < len; i++) { + if (text.charAt(i) !== ' ' && text.charAt(i) !== '\t' && text.charAt(i) !== '\r' && text.charAt(i) !== '\n') { + found = true; + break; + } + } + return found; +}, + +getCssValue : function (elem) { + var i, k, style = [], len = 0, css; + css = elem.getAttribute('style'); + if (!css) { + return null; + } + if (typeof css === 'object') { + css = css.cssText; + } + + css = css.replace(/;$/, '').split(';'); + len = css.length; + + for (i=0; i 0) { + while (child.lastChild) { + child = child.lastChild; + } + if (child === endNode) { + compare = 0; + } + } + + if (compare < 1 && elem.nodeName.toLowerCase() === spantag) { + self.makeFontCss(cmd, opt, elem); + } + + var children = elem.childNodes; + var idx, count = children.length; + for (idx=0; idx < count; idx++) { + if (compare < 1) { + if (children[idx].nodeName.toLowerCase() === spantag) { + self.makeFontCss(cmd, '', children[idx]); + } + } + finish(children[idx]); + } + + css = self.getCssValue(elem); + if (css) { + len = css.length; + for (j=0; j < css.length; j++) { + cColor = checkColorConvert(css[j].name, css[j].value); + if (cColor) { + css[j].value = cColor; + } + if (textCssAttrMatch(elem.parentNode, css[j].name, css[j].value)) { + self.makeFontCss(css[j].name, '', elem); + + } + } + if (!self.getCssValue(elem)) { + node = elem.firstChild; + while (node) { + elem.parentNode.insertBefore(node, elem); + node = elem.firstChild; + } + isRemove.push(elem); + } + } + }; + + var commonAncestor = null; + if (startNode.parentNode === endNode.parentNode) { + commonAncestor = startNode.parentNode; + if (commonAncestor.firstChild === startNode && commonAncestor.lastChild === endNode && + commonAncestor.nodeName.toLowerCase() === spantag) + { + this.makeFontCss(cmd, opt, commonAncestor); + pNode = commonAncestor.parentNode; + while (pNode && pNode.nodeName.toLowerCase() === "span") { + if (pNode.firstChild !== commonAncestor || pNode.lastChild !== commonAncestor) { + break; + } + + css = this.getCssValue(commonAncestor); + len = css.length; + + for (i=0; i 0) ? ctb.rows : ctb.getElementsByTagName("TR"); + for (i=0; i < rows.length; i++) { + tm[i] = []; + } + for (i=0; i < rows.length; i++) { + jr = 0; + for (j=0; j < rows[i].cells.length; j++) { + while (!(self.undefined(tm[i][jr]))) { + jr++; + } + for (jh=jr; jh < jr + (rows[i].cells[j].colSpan || 1); jh++) { + for (jv=i; jv < i + (rows[i].cells[j].rowSpan || 1); jv++) { + tm[jv][jh] = (jv === i) ? rows[i].cells[j].cellIndex : -1; + } + } + } + } + return tm; + }; + + var insertColumn = function() { + tm = getCellMatrix(); + rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName("TR"); + + + if (ctr.rowIndex >= 0) { + rowIndex = ctr.rowIndex; + } + else { + for(i=0; i < rows.length; i++) { + if (rows[i] === ctr) { + rowIndex = i; + break; + } + } + } + + for (j=0; j < tm[rowIndex].length; j++) { + if (tm[rowIndex][j] === ctd.cellIndex) { + realIndex = j; + break; + } + } + + for (i=0; i < rows.length; i++) { + if (tm[i][realIndex] !== -1) { + if (rows[i].cells[tm[i][realIndex]].colSpan > 1) { + rows[i].cells[tm[i][realIndex]].colSpan++; + } + else { + newc = rows[i].insertCell(tm[i][realIndex]+1); + nc = rows[i].cells[tm[i][realIndex]].cloneNode(false); + nc.innerHTML = ' '; + rows[i].replaceChild(nc, newc); + } + } + } + }; + + var insertRow = function(idx) { + newr = ctb.insertRow(ctr.rowIndex + 1); + for (i=0; i < ctr.cells.length; i++) { + if (ctr.cells[i].rowSpan > 1) { + ctr.cells[i].rowSpan++; + } + else { + newc = ctr.cells[i].cloneNode(false); + newc.innerHTML = ' '; + newr.appendChild(newc); + } + } + + for (i=0; i < ctr.rowIndex; i++) { + if (ctb.rows && ctb.rows.length > 0) { + tempr = ctb.rows[i]; + } + else { + tempr = ctb.getElementsByTagName("tr")[i]; + } + for (j=0; j < tempr.cells.length; j++) { + if (tempr.cells[j].rowSpan > (ctr.rowIndex - i)) { + tempr.cells[j].rowSpan++; + } + } + } + }; + + var deleteColumn = function () { + tm = getCellMatrix(ctb); + rows = (ctb.rows && ctb.rows.length>0) ? ctb.rows : ctb.getElementsByTagName("TR"); + rowIndex = 0; realIndex = 0; + + if (ctr.rowIndex >= 0) { + rowIndex = ctr.rowIndex; + } + else { + for(i=0; i < rows.length; i++) { + if (rows[i] === ctr) { + rowIndex = i; + break; + } + } + } + + if (tm[0].length <= 1) { + ctb.parentNode.removeChild(ctb); + } + else { + for (j=0; j < tm[rowIndex].length; j++) { + if (tm[rowIndex][j] === ctd.cellIndex) { + realIndex = j; + break; + } + } + + for (i=0; i < rows.length; i++) { + if (tm[i][realIndex] !== -1) { + if (rows[i].cells[tm[i][realIndex]].colSpan > 1) { + rows[i].cells[tm[i][realIndex]].colSpan--; + } + else { + rows[i].deleteCell(tm[i][realIndex]); + } + } + } + } + }; + + var deleteRow = function () { + tm = getCellMatrix(ctb); + rows = (ctb.rows && ctb.rows.length>0) ? ctb.rows : ctb.getElementsByTagName("TR"); + rowIndex = 0; + + if (ctr.rowIndex >= 0) { + rowIndex = ctr.rowIndex; + } + else { + for(i=0; i < rows.length; i++) { + if (rows[i] === ctr) { + rowIndex = i; + break; + } + } + } + + if (rows.length <= 1) { + ctb.parentNode.removeChild(ctb); + } + else { + for (i=0; i < rowIndex; i++) { + tempr = rows[i]; + for (j=0; j < tempr.cells.length; j++) { + if (tempr.cells[j].rowSpan > (rowIndex - i)) { + tempr.cells[j].rowSpan--; + } + } + } + + var curCI = -1, prevCI, ni, nrCI, cs, nj; + for (i=0; i < tm[rowIndex].length; i++) { + prevCI = curCI; + curCI = tm[rowIndex][i]; + + if (curCI !== -1 && curCI !== prevCI && ctr.cells[curCI].rowSpan>1 && (rowIndex+1) < rows.length) { + ni = i; + nrCI = tm[rowIndex+1][ni]; + while (nrCI === -1) { + ni++; + nrCI = (ni < rows[rowIndex+1].cells.length) ? tm[rowIndex+1][ni] : rows[rowIndex+1].cells.length; + } + + newc = rows[rowIndex+1].insertCell(nrCI); + rows[rowIndex].cells[curCI].rowSpan--; + nc = rows[rowIndex].cells[curCI].cloneNode(false); + rows[rowIndex+1].replaceChild(nc, newc); + + cs = (ctr.cells[curCI].colSpan>1) ? ctr.cells[curCI].colSpan : 1; + nj = 0; + + for (j=i; j < (i+cs); j++) { + tm[rowIndex+1][j] = nrCI; + nj = j; + } + for (j=nj; j < tm[rowIndex+1].length; j++) { + if (tm[rowIndex+1][j] !== -1) { + tm[rowIndex+1][j]++; + } + } + } + } + + if (ctb.rows && ctb.rows.length > 0) { + ctb.deleteRow(rowIndex); + } + else { + ctb.removeChild(rows[rowIndex]); + } + } + }; + + var mergeCellRight = function () { + tm = getCellMatrix(ctb); + rows = (ctb.rows && ctb.rows.length>0) ? ctb.rows : ctb.getElementsByTagName("TR"); + rowIndex = 0; realIndex = 0; + + if (ctr.rowIndex >= 0) { + rowIndex = ctr.rowIndex; + } + else { + for(i=0; i < rows.length; i++) { + if (rows[i] === ctr) { + rowIndex = i; + break; + } + } + } + + for (j=0; j < tm[rowIndex].length; j++) { + if (tm[rowIndex][j] === ctd.cellIndex) { + realIndex = j; + break; + } + } + + if (ctd.cellIndex + 1 < ctr.cells.length) { + var ccrs = ctd.rowSpan || 1; + var cccs = ctd.colSpan || 1; + var ncrs = ctr.cells[ctd.cellIndex+1].rowSpan || 1; + var nccs = ctr.cells[ctd.cellIndex+1].colSpan || 1; + j = realIndex; + + while (tm[rowIndex][j] === ctd.cellIndex) { + j++; + } + + if (tm[rowIndex][j] === ctd.cellIndex + 1) { + if (ccrs === ncrs) { + if (rows.length > 1) { ctd.colSpan = cccs + nccs; } + var html = self.trimSpace(ctr.cells[ctd.cellIndex + 1].innerHTML); + html = html.replace(/^ /, ''); + ctd.innerHTML += html; + ctr.deleteCell(ctd.cellIndex + 1); + } + } + } + }; + + var mergeCellDown = function () { + tm = getCellMatrix(ctb); + rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName("TR"); + rowIndex = 0; + var crealIndex = 0; + + if (ctr.rowIndex >=0 ) { + rowIndex = ctr.rowIndex; + } + else { + for(i=0; i < rows.length; i++) { + if (rows[i] === ctr) { + rowIndex = i; + break; + } + } + } + + for (i=0; i < tm[rowIndex].length; i++) { + if (tm[rowIndex][i] === ctd.cellIndex) { + crealIndex = i; + break; + } + } + + var ccrs = ctd.rowSpan || 1; + var cccs = ctd.colSpan || 1; + + if (rowIndex + ccrs < rows.length) { + var ncellIndex = tm[rowIndex + ccrs][crealIndex]; + if (ncellIndex !== -1 && + (crealIndex === 0 || (crealIndex > 0 && + (tm[rowIndex + ccrs][crealIndex-1] !== tm[rowIndex + ccrs][crealIndex])))) + { + + var ncrs = rows[rowIndex + ccrs].cells[ncellIndex].rowSpan || 1; + var nccs = rows[rowIndex + ccrs].cells[ncellIndex].colSpan || 1; + + if (cccs === nccs) { + var html = self.trimSpace(rows[rowIndex + ccrs].cells[ncellIndex].innerHTML); + html = html.replace(/^ /, ''); + ctd.innerHTML += html; + rows[rowIndex + ccrs].deleteCell(ncellIndex); + ctd.rowSpan = ccrs + ncrs; + } + } + } + }; + + var splitCellVertical = function () { + var ri; + tm = getCellMatrix(); + rowIndex = 0; realIndex = 0; + + rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName("TR"); + + if (ctr.rowIndex >= 0) { + rowIndex = ctr.rowIndex; + } + else { + for(ri = 0; ri < rows.length; ri++) { + if (rows[ri] === ctr) { + rowIndex = ri; + break; + } + } + } + + for (j=0; j < tm[rowIndex].length; j++) { + if (tm[rowIndex][j] === ctd.cellIndex) { + realIndex = j; + break; + } + } + + if (ctd.colSpan > 1) { + newc = rows[rowIndex].insertCell(ctd.cellIndex + 1); + ctd.colSpan--; + nc = ctd.cloneNode(false); + nc.innerHTML = ' '; + rows[rowIndex].replaceChild(nc, newc); + ctd.colSpan = 1; + ctd.removeAttribute('colSpan'); + } + else { + newc = rows[rowIndex].insertCell(ctd.cellIndex + 1); + nc = ctd.cloneNode(false); + nc.innerHTML = ' '; + rows[rowIndex].replaceChild(nc, newc); + var cs; + for (i=0; i < tm.length; i++) { + if (i !== rowIndex && tm[i][realIndex] !== -1) { + cs = (rows[i].cells[tm[i][realIndex]].colSpan > 1) ? rows[i].cells[tm[i][realIndex]].colSpan : 1; + rows[i].cells[tm[i][realIndex]].colSpan = cs + 1; + } + } + } + }; + + var splitCellHorizontal = function () { + tm = getCellMatrix(); + rowIndex = 0; realIndex = 0; + rows = (ctb.rows && ctb.rows.length > 0) ? ctb.rows : ctb.getElementsByTagName("TR"); + + if (ctr.rowIndex >= 0) { + rowIndex = ctr.rowIndex; + } + else { + for(i=0; i < rows.length; i++) { + if (rows[i] === ctr) { + rowIndex = i; + break; + } + } + } + + for (j=0; j < tm[rowIndex].length; j++) { + if (tm[rowIndex][j] === ctd.cellIndex) { + realIndex = j; + break; + } + } + + if (ctd.rowSpan > 1) { + i = realIndex; + var ni; + + while (tm[rowIndex + 1][i] === -1) { + i++; + } + + ni = (i === tm[rowIndex + 1].length) ? rows[rowIndex + 1].cells.length : tm[rowIndex + 1][i]; + + newc = rows[rowIndex + 1].insertCell(ni); + ctd.rowSpan--; + + nc = ctd.cloneNode(false); + nc.innerHTML = ' '; + rows[rowIndex + 1].replaceChild(nc, newc); + ctd.rowSpan = 1; + } + else { + if (ctb.rows && ctb.rows.length > 0) { + ctb.insertRow(rowIndex+1); + } + else { + if (rowIndex<(rows.length - 1)) { + ctb.insertBefore(document.createElement("TR"), rows[rowIndex + 1]); + } + else { + ctb.appendChild(document.createElement("TR")); + } + } + + var rs; + for (i=0; i < ctr.cells.length; i++) { + if (i !== ctd.cellIndex) { + rs = ctr.cells[i].rowSpan > 1 ? ctr.cells[i].rowSpan : 1; + ctr.cells[i].rowSpan = rs + 1; + } + } + + for (i=0; i < rowIndex; i++) { + tempr = rows[i]; + for (j=0; j < tempr.cells.length; j++) { + if (tempr.cells[j].rowSpan > (rowIndex - i)) { + tempr.cells[j].rowSpan++; + } + } + } + + newc = rows[rowIndex+1].insertCell(0); + nc = ctd.cloneNode(false); + nc.innerHTML = ' '; + rows[rowIndex+1].replaceChild(nc, newc); + } + }; + + var tblReflash = function() { self.editAreaFocus(); self.doEditorEvent(); }; + var funcs = { + 'add_cols_after' : { 'icon' : 'table_insert_column.png', 'title' : '열 삽입', + 'func' : function() { insertColumn(ctd.cellIndex); tblReflash(); }}, + 'add_rows_after': { 'icon' : 'table_insert_row.png', 'title' : '행 삽입', + 'func' : function() { insertRow(ctr.rowIndex); tblReflash(); }}, + 'remove_cols': { 'icon' : 'table_delete_column.png', 'title' : '열 삭제', + 'func' : function() { deleteColumn(ctd.cellIndex); tblReflash(); }}, + 'remove_rows': { 'icon' : 'table_delete_row.png', 'title' : '행 삭제', + 'func' : function() { deleteRow(); tblReflash(); }}, + 'sp1' : { 'icon' : 'dot.gif' }, + 'merge_cell_right': { 'icon' : 'table_join_row.png', 'title' : '오른쪽 셀과 병합', + 'func' : function() { mergeCellRight(); tblReflash(); }}, + 'merge_cell_down': { 'icon' : 'table_join_column.png', 'title' : '아래 셀과 병합', + 'func' : function() { mergeCellDown(); tblReflash(); }}, + 'split_cell_v': { 'icon' : 'table_split_row.png', 'title' : '셀 열로 나누기', + 'func' : function() { splitCellVertical(); tblReflash(); }}, + 'split_cell_h': { 'icon' : 'table_split_column.png', 'title' : '셀 행으로 나누기', + 'func' : function() { splitCellHorizontal(); tblReflash(); }} + }; + + self.cheditor.editBlock.innerHTML = ''; + var div = document.createElement('div'), span, icon; + div.style.padding = '6px'; + + for (i in funcs) { + span = document.createElement('span'); + icon = document.createElement('img'); + icon.src = self.config.iconPath + funcs[i].icon; + if (i === 'sp1' || i === 'sp2') { + icon.className = 'edit-table-ico'; + } + else { + icon.setAttribute('title', funcs[i].title); + icon.className = 'edit-table-ico'; + icon.setAttribute('alt', ''); + icon.onclick = funcs[i].func; + } + div.appendChild(span.appendChild(icon)); + } + + /*var deleteTable = function() { + ctb.parentNode.removeChild(ctb); + self.doEditorEvent(); + };*/ + + var deleteSubmit = new Image(); + deleteSubmit.src = this.config.iconPath + 'delete_table.png'; + deleteSubmit.style.marginLeft = "22px"; + deleteSubmit.className = 'edit-table-ico'; + deleteSubmit.setAttribute('title', '테이블 삭제'); + deleteSubmit.onclick = function() { + ctb.parentNode.removeChild(ctb); + self.doEditorEvent(); + }; + + div.appendChild(deleteSubmit); + + var attrFuncs = { + 'setWidth' : { + 'txt': '가로폭', + 'id' : 'fm_cell_width', + 'marginRight' : '10px', + 'value' : ctd.getAttribute('width') + }, + 'setHeight' : { + 'txt': '세로폭', + 'id' : 'fm_cell_height', + 'marginRight' : '10px', + 'value' : ctd.getAttribute('height') + }, + 'setBgcolor' : { + 'txt': '배경색', + 'id' : 'fm_cell_bgcolor', + 'marginRight' : '2px', + 'value' : ctd.getAttribute('bgcolor') + } + }; + + var spliter = document.createElement('div'), txt, input; + spliter.style.padding = '10px 0px 0px 0px'; + spliter.style.marginTop = '5px'; + spliter.style.borderTop = '1px solid #ccc'; + spliter.style.textAlign = 'center'; + + for (i in attrFuncs) { + txt = document.createTextNode(attrFuncs[i].txt + ' '); + spliter.appendChild(txt); + input = document.createElement('input'); + input.style.marginRight = attrFuncs[i].marginRight; + input.setAttribute('type', 'text'); + input.setAttribute('name', i); + input.setAttribute('id', attrFuncs[i].id); + input.setAttribute('size', 7); + input.setAttribute('value', attrFuncs[i].value || ''); + spliter.appendChild(input); + } + + var colorPicker = new Image(); + colorPicker.src = this.config.iconPath + 'button/color_picker.gif'; + colorPicker.className = 'color-picker'; + colorPicker.onclick = function() { + GB.popupWindow.ColorPicker.argv = { func : + function(color) { + ctd.setAttribute('bgColor', color); + document.getElementById('fm_cell_bgcolor').value = color; + }, + selectedCell : ctd + }; + self.windowOpen('ColorPicker'); + }; + spliter.appendChild(colorPicker); + + var editSubmit = new Image(); + editSubmit.src = this.config.iconPath + 'button/edit_cell.gif'; + editSubmit.className = 'input-submit'; + editSubmit.style.verticalAlign = 'top'; + editSubmit.onclick = function() { + var width = self.trimSpace(document.getElementById('fm_cell_width').value), + height = self.trimSpace(document.getElementById('fm_cell_height').value), + bgcolor = self.trimSpace(document.getElementById('fm_cell_bgcolor').value); + if (width) { + ctd.setAttribute('width', width); + } + if (height) { + ctd.setAttribute('height', height); + } + if (bgcolor) { + ctd.setAttribute('bgcolor', bgcolor); + } + /* + ctd.setAttribute('width', self.$('fm_cell_width').value); + ctd.setAttribute('height', self.$('fm_cell_height').value); + ctd.setAttribute('bgcolor', self.$('fm_cell_bgcolor').value); + */ + }; + + spliter.appendChild(editSubmit); + div.appendChild(spliter); + self.cheditor.editBlock.appendChild(div); +}, + +doEditorEvent : function () { + var self = this; + var modifyBlock = self.cheditor.editBlock; + var oEditor = self.editArea; + var cmd = null, el, pNode, ancestors = []; + var rng = self.getRange(); + var nodeType = self.getSelectionType(rng); + + if (!self.W3CRange) { + switch (nodeType) { + case GB.selection.none : + case GB.selection.text : + pNode = rng.parentElement(); + break; + case GB.selection.element : + pNode = rng.item(0); + break; + default : + pNode = oEditor.document.body; + } + } + else { + try { + pNode = rng.commonAncestorContainer; + if (!rng.collapsed && + rng.startContainer === rng.endContainer && + rng.startOffset - rng.endOffset < 2 && + rng.startContainer.hasChildNodes()) + { + pNode = rng.startContainer.childNodes[rng.startOffset]; + } + + while (pNode.nodeType === GB.node.text) { + pNode = pNode.parentNode; + } + } catch (e) { pNode= null; } + } + + while (pNode && (pNode.nodeType === GB.node.element) && (pNode.tagName.toLowerCase() !== 'body')) { + ancestors.push(pNode); + if (pNode.tagName.toLowerCase() === 'img') { + cmd = 'img'; + break; + } + if (pNode.tagName.toLowerCase() === 'td' || pNode.tagName.toLowerCase() === 'th') { + cmd = 'cell'; + break; + } + pNode = pNode.parentNode; + } + + if (!cmd) { + modifyBlock.style.display = "none"; + modifyBlock.innerHTML = ''; + } + else { + if (cmd === "cell") { + modifyBlock.style.display = "block"; + self.modifyCell(pNode); + } + } + + if (self.config.showTagPath) { + var statusBar = self.cheditor.tagPath; + statusBar.innerHTML = ''; + statusBar.appendChild(document.createTextNode(' ')); + el = ancestors.pop(); + var alink, span, tag; + + var alinkClick = function () { + self.$('removeSelected').style.display = 'inline'; self.tagSelector(this.el); + }; + + while (el) { + statusBar.appendChild(document.createTextNode('<')); + tag = el.tagName.toLowerCase(); + + if (nodeType === GB.selection.text) { + alink = document.createElement("a"); + alink.el = el; + alink.href = "javascript:void%200"; + alink.className = 'cheditor-tag-path-elem'; + alink.title = el.style.cssText; + alink.onclick = alinkClick; + alink.appendChild(document.createTextNode(tag)); + statusBar.appendChild(alink); + } + else { + statusBar.appendChild(self.doc.createTextNode(tag)); + } + + statusBar.appendChild(document.createTextNode('> ')); + el = ancestors.pop(); + } + + var remove = document.createElement("a"); + remove.href = "javascript:void%200"; + remove.id = "removeSelected"; + remove.style.display = 'none'; + remove.className = 'cheditor-tag-path-elem'; + remove.style.color = '#cc3300'; + remove.appendChild(document.createTextNode('remove')); + remove.onclick = function () { + oEditor.document.execCommand("RemoveFormat", false, null); + remove.style.display = 'none'; + oEditor.focus(); + self.doEditorEvent(); + }; + + span = document.createElement('span'); + span.style.marginTop = '2px'; + span.appendChild(remove); + self.cheditor.tagPath.appendChild(span); + } + + var interval = 30; + if (GB.browser.msie && rng.text !== '' && nodeType !== GB.selection.element) { + interval = 10; + } + self.tempTimer = setTimeout(function() { + self.toolbarUpdate(); + self.tempTimer = null; + }, interval); +}, + +tagSelector : function (node) { + this.editAreaFocus(); + var rng; + + if (GB.browser.msie) { + rng = this.doc.body.createTextRange(); + if (rng) { + rng.moveToElementText(node); + rng.select(); + } + } + else { + var sel = this.editArea.getSelection(); + if (this.undefined(sel)) { + return; + } + try { + rng = sel.getRangeAt(0); + } catch(e) { return; } + + rng.selectNodeContents(node); + sel.removeAllRanges(); + sel.addRange(rng); + } +}, + +getBrowser : function () { return GB.browser; }, +$ : function (id) { return this.doc.getElementById(id); } +}; + +var DragWindow = { + obj : null, + init : function (o, oRoot, minX, maxX, minY, maxY) { + o.style.curser = 'default'; + o.onmousedown = DragWindow.start; + o.onmouseover = function () { this.style.cursor = 'move'; }; + o.hmode = true ; + o.vmode = true ; + o.root = (oRoot && oRoot !== null) ? oRoot : o; + o.transId = oRoot.id + '_Trans'; + + if (o.hmode && isNaN(parseInt(o.root.style.left,10))) {o.root.style.left = "0px";} + if (o.vmode && isNaN(parseInt(o.root.style.top,10))) {o.root.style.top = "0px";} + if (!o.hmode && isNaN(parseInt(o.root.style.right,10))) {o.root.style.right = "0px";} + if (!o.vmode && isNaN(parseInt(o.root.style.bottom,10))) {o.root.style.bottom = "0px";} + + o.minX = minX !== undefined ? minX : null; + o.minY = minY !== undefined ? minY : null; + o.maxX = maxX !== undefined ? maxX : null; + o.maxY = maxY !== undefined ? maxY : null; + + o.root.onDragStart = new Function(); + o.root.onDragEnd = new Function(); + o.root.onDrag = new Function(); + }, + + start : function (e) { + var o = DragWindow.obj = this; + e = DragWindow.fixE(e); + var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom, 10); + var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right, 10); + o.root.onDragStart(x, y); + + o.lastMouseX = e.clientX; + o.lastMouseY = e.clientY; + + document.onmousemove = DragWindow.drag; + document.onmouseup = DragWindow.end; + + if (o.root.lastChild.id === o.transId) { return false; } + + var dragTransBg = document.createElement('div'); + dragTransBg.className = 'cheditor-dragWindowTransparent'; + + if (GB.browser.msie && GB.browser.version < 10) { dragTransBg.style.filter = 'alpha(opacity=0)'; } + else { dragTransBg.style.opacity = 0; } + dragTransBg.id = o.transId; + dragTransBg.style.width = o.root.lastChild.firstChild.style.width; + dragTransBg.style.height = o.root.lastChild.firstChild.style.height; + o.root.appendChild(dragTransBg); + + return false; + }, + + drag : function (e) { + e = DragWindow.fixE(e); + var o = DragWindow.obj; + var ey = e.clientY; + var ex = e.clientX; + var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom,10); + var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right,10); + var nx, ny; + + nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1)); + ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1)); + + DragWindow.obj.root.style.left = nx + "px"; + DragWindow.obj.root.style.top = ny + "px"; + DragWindow.obj.lastMouseX = ex; + DragWindow.obj.lastMouseY = ey; + DragWindow.obj.root.onDrag(nx, ny); + + return false; + }, + + end : function () { + document.onmousemove = null; + document.onmouseup = null; + DragWindow.obj.root.onDragEnd(parseInt(DragWindow.obj.root.style[DragWindow.obj.hmode ? "left" : "right"],10), + parseInt(DragWindow.obj.root.style[DragWindow.obj.vmode ? "top" : "bottom"],10)); + + if (DragWindow.obj.root.lastChild.id === DragWindow.obj.transId) { + DragWindow.obj.root.removeChild(DragWindow.obj.root.lastChild); + } + DragWindow.obj = null; + }, + + fixE : function (e) { + if (e === undefined) { e = window.event; } + if (e.layerX === undefined) { e.layerX = e.offsetX; } + if (e.layerY === undefined) { e.layerY = e.offsetY; } + return e; + } +}; +GB.dragWindow = DragWindow; +// -------------------------------------------------------------------------- +// W3C DOM Range +// + +// -------------------------------------------------------------------------- +// Table +// + +// -------------------------------------------------------------------------- +// prettify; +// +GB.prettify = new function() { + var LANGUAGES = {}; + var selected_languages = {}; + var doc = null, paste = null; + + function escape(value) { return value.replace(/&/gm, '&').replace(//gm, '>'); } + function blockText(block, ignoreNewLines) { + var result = '', i, chunk; + for (i = 0; i < block.childNodes.length; i++) { + if (block.childNodes[i].nodeType === GB.node.text) { + chunk = block.childNodes[i].nodeValue; + if (ignoreNewLines) { + chunk = chunk.replace(/\n/g, ''); + } + result += chunk; + } + else if (block.childNodes[i].nodeName === 'BR') { + result += '\n'; + } + else { + result += blockText(block.childNodes[i]); + } + } + + result = result.replace(/\r/g, '\n'); + return result; + } + + function blockLanguage(block) { + var classes = block.className.split(/\s+/), i, class_; + classes = classes.concat(block.parentNode.className.split(/\s+/)); + for (i = 0; i < classes.length; i++) { + class_ = classes[i].replace(/^language-/, ''); + if (LANGUAGES[class_] || class_ === 'no-prettify') { + return class_; + } + } + } + + function nodeStream(node) { + var result = []; + (function _nodeStream(node, offset) { + var i; + for (i = 0; i < node.childNodes.length; i++) { + if (node.childNodes[i].nodeType === GB.node.text) { + offset += node.childNodes[i].nodeValue.length; + } + else if (node.childNodes[i].nodeName === 'BR') { + offset += 1; + } + else { + result.push({ + event: 'start', + offset: offset, + node: node.childNodes[i] + }); + offset = _nodeStream(node.childNodes[i], offset); + result.push({ + event: 'stop', + offset: offset, + node: node.childNodes[i] + }); + } + } + return offset; + })(node, 0); + return result; + } + + function mergeStreams(stream1, stream2, value) { + var processed = 0; + var result = ''; + var nodeStack = []; + var i, current, node; + + function selectStream() { + if (stream1.length && stream2.length) { + if (stream1[0].offset !== stream2[0].offset) { + return (stream1[0].offset < stream2[0].offset) ? stream1 : stream2; + } + return (stream1[0].event === 'start' && stream2[0].event === 'stop') ? stream2 : stream1; + } + return stream1.length ? stream1 : stream2; + } + + function open(node) { + result = '<' + node.nodeName.toLowerCase(); + var attribute; + for (i = 0; i < node.attributes.length; i++) { + attribute = node.attributes[i]; + result += ' ' + attribute.nodeName.toLowerCase(); + if (attribute.nodeValue !== undefined) { + result += '="' + escape(attribute.nodeValue) + '"'; + } + } + return result + '>'; + } + + function close(node) { return ''; } + + while (stream1.length || stream2.length) { + current = selectStream().splice(0, 1)[0]; + result += escape(value.substr(processed, current.offset - processed)); + processed = current.offset; + if ( current.event === 'start') { + result += open(current.node); + nodeStack.push(current.node); + } + else if (current.event === 'stop') { + i = nodeStack.length; + do { + i--; + node = nodeStack[i]; + result += close(node); + } while (node !== current.node); + + nodeStack.splice(i, 1); + while (i < nodeStack.length) { + result += open(nodeStack[i]); + i++; + } + } + } + + result += value.substr(processed); + return result; + } + + function langRe(language, value, global) { + var mode = 'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : ''); + return new RegExp(value, mode); + } + + function highlight(language_name, value) { + var language = LANGUAGES[language_name]; + var modes = [language.defaultMode]; + var relevance = 0; + var keyword_count = 0; + var result = ''; + + function subMode(lexem, mode) { + var i; + for (i = 0; i < mode.sub_modes.length; i++) { + if (mode.sub_modes[i].beginRe.test(lexem)) { + return mode.sub_modes[i]; + } + } + return null; + } + + function endOfMode(mode_index, lexem) { + if (modes[mode_index].end && modes[mode_index].endRe.test(lexem)) { + return 1; + } + if (modes[mode_index].endsWithParent) { + var level = endOfMode(mode_index - 1, lexem); + return level ? level + 1 : 0; + } + return 0; + } + + function isIllegal(lexem, mode) { + return mode.illegalRe && mode.illegalRe.test(lexem); + } + + function compileTerminators(mode, language) { + var terminators = [], i; + + for (i = 0; i < mode.sub_modes.length; i++) { + terminators.push(mode.sub_modes[i].begin); + } + + var index = modes.length - 1; + do { + if (modes[index].end) { + terminators.push(modes[index].end); + } + index--; + } while (modes[index + 1].endsWithParent); + + if (mode.illegal) { + terminators.push(mode.illegal); + } + + return langRe(language, '(' + terminators.join('|') + ')', true); + } + + function eatModeChunk(value, index) { + var mode = modes[modes.length - 1]; + if (!mode.terminators) { + mode.terminators = compileTerminators(mode, language); + } + mode.terminators.lastIndex = index; + var match = mode.terminators.exec(value); + if (match) { + return [value.substr(index, match.index - index), match[0], false]; + } + return [value.substr(index), '', true]; + } + + function keywordMatch(mode, match) { + var match_str = language.case_insensitive ? match[0].toLowerCase() : match[0]; + var className, val; + for (className in mode.keywordGroups) { + if (!mode.keywordGroups.hasOwnProperty(className)) { + continue; + } + val = mode.keywordGroups[className].hasOwnProperty(match_str); + if (val) { + return [className, val]; + } + } + return false; + } + + function processKeywords(buffer, mode) { + if (!mode.keywords || !mode.lexems) { + return escape(buffer); + } + if (!mode.lexemsRe) { + var lexems_re = '(' + mode.lexems.join('|') + ')'; + mode.lexemsRe = langRe(language, lexems_re, true); + } + + result = ''; + var last_index = 0, match, keyword_match; + mode.lexemsRe.lastIndex = 0; + match = mode.lexemsRe.exec(buffer); + while (match) { + result += escape(buffer.substr(last_index, match.index - last_index)); + keyword_match = keywordMatch(mode, match); + if (keyword_match) { + keyword_count += keyword_match[1]; + result += '' + escape(match[0]) + ''; + } + else { + result += escape(match[0]); + } + last_index = mode.lexemsRe.lastIndex; + match = mode.lexemsRe.exec(buffer); + } + result += escape(buffer.substr(last_index, buffer.length - last_index)); + return result; + } + + function processBuffer(buffer, mode) { + if (mode.subLanguage && selected_languages[mode.subLanguage]) { + result = highlight(mode.subLanguage, buffer); + keyword_count += result.keyword_count; + relevance += result.relevance; + return result.value; + } + return processKeywords(buffer, mode); + } + + function startNewMode(mode, lexem) { + var markup = mode.noMarkup ? '' : ''; + if (mode.returnBegin) { + result += markup; + mode.buffer = ''; + } + else if (mode.excludeBegin) { + result += escape(lexem) + markup; + mode.buffer = ''; + } + else { + result += markup; + mode.buffer = lexem; + } + modes[modes.length] = mode; + } + + function processModeInfo(buffer, lexem, end) { + var current_mode = modes[modes.length - 1]; + if (end) { + result += processBuffer(current_mode.buffer + buffer, current_mode); + return false; + } + + var new_mode = subMode(lexem, current_mode); + if (new_mode) { + result += processBuffer(current_mode.buffer + buffer, current_mode); + startNewMode(new_mode, lexem); + relevance += new_mode.relevance; + return new_mode.returnBegin; + } + + var end_level = endOfMode(modes.length - 1, lexem); + if (end_level) { + var markup = current_mode.noMarkup?'':''; + if (current_mode.returnEnd) { + result += processBuffer(current_mode.buffer + buffer, current_mode) + markup; + } + else if (current_mode.excludeEnd) { + result += processBuffer(current_mode.buffer + buffer, current_mode) + markup + escape(lexem); + } + else { + result += processBuffer(current_mode.buffer + buffer + lexem, current_mode) + markup; + } + + while (end_level > 1) { + markup = modes[modes.length - 2].noMarkup?'':''; + result += markup; + end_level--; + modes.length--; + } + + var last_ended_mode = modes[modes.length - 1], i; + modes.length--; + modes[modes.length - 1].buffer = ''; + if (last_ended_mode.starts) { + for (i = 0; i < language.modes.length; i++) { + if (language.modes[i].className === last_ended_mode.starts) { + startNewMode(language.modes[i], ''); + break; + } + } + } + return current_mode.returnEnd; + } + if (isIllegal(lexem, current_mode)) { + throw 'Illegal'; + } + } + + try { + var index = 0, mode_info, return_lexem; + language.defaultMode.buffer = ''; + do { + mode_info = eatModeChunk(value, index); + return_lexem = processModeInfo(mode_info[0], mode_info[1], mode_info[2]); + index += mode_info[0].length; + if (!return_lexem) { + index += mode_info[1].length; + } + } while (!mode_info[2]); + + if(modes.length > 1) { throw 'Illegal'; } + return { + language: language_name, + relevance: relevance, + keyword_count: keyword_count, + value: result }; + } catch (e) { + if (e === 'Illegal') { + return { + language: null, + relevance: 0, + keyword_count: 0, + value: escape(value) }; + } + throw e; + } + } + + function compileModes() { + var modes, lang, len; + + function compileMode(mode, language) { + if (mode.compiled) { return; } + if (mode.begin) { mode.beginRe = langRe(language, '^' + mode.begin); } + if (mode.end) { mode.endRe = langRe(language, '^' + mode.end); } + if (mode.illegal) { mode.illegalRe = langRe(language, '^(?:' + mode.illegal + ')'); } + if (mode.relevance === undefined) { mode.relevance = 1; } + if (!mode.displayClassName) { mode.displayClassName = mode.className; } + if (!mode.className) { mode.noMarkup = true; } + + var key, i, j; + for (key in mode.keywords) { + if (!mode.keywords.hasOwnProperty(key)) { + continue; + } + if (mode.keywords[key] instanceof Object) { + mode.keywordGroups = mode.keywords; + } + else { + mode.keywordGroups = {'keyword': mode.keywords}; + } + } + + mode.sub_modes = []; + if (mode.contains) { + for (i = 0; i < mode.contains.length; i++) { + if (mode.contains[i] instanceof Object) { + mode.sub_modes.push(mode.contains[i]); + } + else { + for (j = 0; j < language.modes.length; j++) { + if (language.modes[j].className === mode.contains[i]) { + mode.sub_modes.push(language.modes[j]); + } + } + } + } + } + mode.compiled = true; + for (i = 0; i < mode.sub_modes.length; i++) { + compileMode(mode.sub_modes[i], language); + } + } + + for (lang in LANGUAGES) { + if (!LANGUAGES.hasOwnProperty(lang)) { + continue; + } + modes = [LANGUAGES[lang].defaultMode].concat(LANGUAGES[lang].modes); + for (len = 0; len < modes.length; len++) { + compileMode(modes[len], LANGUAGES[lang]); + } + } + } + + function initialize() { + if (initialize.called) { return; } + initialize.called = true; + compileModes(); + } + + function highlightBlock(block, tabReplace, useBR) { + initialize(); + var text = blockText(block, false), result, className; + + var language = blockLanguage(block); + + if (language === 'no-prettify') { return; } + if (language) { + result = highlight(language, text); + } + else { + result = {language: '', keyword_count: 0, relevance: 0, value: escape(text)}; + var second_best = result, key, current; + for (key in selected_languages) { + if (!selected_languages.hasOwnProperty(key)) { + continue; + } + current = highlight(key, text); + if (current.keyword_count + current.relevance > second_best.keyword_count + second_best.relevance) { + second_best = current; + } + if (current.keyword_count + current.relevance > result.keyword_count + result.relevance) { + second_best = result; + result = current; + } + } + } + + var class_name = block.className; + if (!class_name.match(result.language)) { + class_name = class_name ? (class_name + ' ' + result.language) : result.language; + } + var original = nodeStream(block); + if (original.length) { + var pre = doc.createElement('code'); + pre.innerHTML = result.value; + result.value = mergeStreams(original, nodeStream(pre), text); + } + + result.value = result.value.replace(/__CHEDITOR_TAB_SPACE__/g, '    '); // IE < 9 + + if (tabReplace) { + result.value = result.value.replace(/^((<[^>]+>|\t)+)/gm, function(match, p1, offset, s) { + return p1.replace(/\t/g, tabReplace); }); + } + else { + result.value = result.value.replace(/\t/g, "\t"); + } + + if (useBR) { + result.value = result.value.replace(/\n/g, "
\n"); + } + + block.className = class_name; + block.dataset = {}; + block.dataset.result = { + language: result.language, + kw: result.keyword_count, + re: result.relevance + }; + + if (result) { + className = block.className; + if (!className.match(language)) { + className += ' ' + language; + } + result.value = result.value.replace(/^(\s{2,})/gm, "$1"); + + if (paste) { + var wrapper = doc.getElementById("clipboardData"); + var code = doc.createElement("code"); + code.className = className; + code.innerHTML = result.value; + wrapper.parentNode.replaceChild(code, wrapper); + } + else { + doc.body.innerHTML = '' + result.value + ''; + } + } + } + + function initHighlighting(lang) { + initialize(); + var i, text; + for (i=0; i', relevance: 10 }; + var DOCTYPE = { className: 'doctype', begin: '', relevance: 10 }; + var COMMENT = { className: 'comment', begin: '' }; + var TAG = { className: 'tag', begin: '', contains: ['title', 'tag_internal'] }; + var TITLE = { className: 'title', begin: XML_IDENT_RE, end: this.IMMEDIATE_RE }; + var TAG_INTERNAL = { className: 'tag_internal', begin: this.IMMEDIATE_RE, endsWithParent: true, noMarkup: true, contains: ['attribute', 'value_container'], relevance: 0 }; + var ATTR = { className: 'attribute', begin: XML_IDENT_RE, end: this.IMMEDIATE_RE, relevance: 0 }; + var VALUE_CONTAINER_QUOT = { className: 'value_container', begin: '="', returnBegin: true, end: '"', noMarkup: true, + contains: [{ className: 'value', begin: '"', endsWithParent: true}] }; + var VALUE_CONTAINER_APOS = {className: 'value_container', begin: '=\'', returnBegin: true, end: '\'', noMarkup: true, + contains: [{className: 'value', begin: '\'', endsWithParent: true}] }; + + this.LANGUAGES.xml = { defaultMode: { contains: ['pi', 'doctype', 'comment', 'cdata', 'tag'] }, + case_insensitive: true, modes: [ { className: 'cdata', begin: '<\\!\\[CDATA\\[', end: '\\]\\]>', relevance: 10 }, + PI, DOCTYPE, COMMENT, TAG, this.inherit(TITLE, {relevance: 1.75}), TAG_INTERNAL, ATTR, VALUE_CONTAINER_QUOT, VALUE_CONTAINER_APOS ] }; + + var HTML_TAGS = { 'code': 1, 'kbd': 1, 'font': 1, 'noscript': 1, 'style': 1, 'img': 1, 'title': 1, 'menu': 1, 'tt': 1, 'tr': 1, 'param': 1, 'li': 1, 'tfoot': 1, + 'th': 1, 'input': 1, 'td': 1, 'dl': 1, 'blockquote': 1, 'fieldset': 1, 'big': 1, 'dd': 1, 'abbr': 1, 'optgroup': 1, 'dt': 1, 'button': 1, + 'isindex': 1, 'p': 1, 'small': 1, 'div': 1, 'dir': 1, 'em': 1, 'frame': 1, 'meta': 1, 'sub': 1, 'bdo': 1, 'label': 1, 'acronym': 1, 'sup': 1, 'body': 1, + 'basefont': 1, 'base': 1, 'br': 1, 'address': 1, 'strong': 1, 'legend': 1, 'ol': 1, 'script': 1, 'caption': 1, 's': 1, 'col': 1, 'h2': 1, 'h3': 1, + 'h1': 1, 'h6': 1, 'h4': 1, 'h5': 1, 'table': 1, 'select': 1, 'noframes': 1, 'span': 1, 'area': 1, 'dfn': 1, 'strike': 1, 'cite': 1, 'thead': 1, + 'head': 1, 'option': 1, 'form': 1, 'hr': 1, 'var': 1, 'link': 1, 'b': 1, 'colgroup': 1, 'ul': 1, 'applet': 1, 'del': 1, 'iframe': 1, 'pre': 1, + 'frameset': 1, 'ins': 1, 'tbody': 1, 'html': 1, 'samp': 1, 'map': 1, 'object': 1, 'a': 1, 'xmlns': 1, 'center': 1, 'textarea': 1, 'i': 1, 'q': 1, + 'u': 1, 'section': 1, 'nav': 1, 'article': 1, 'aside': 1, 'hgroup': 1, 'header': 1, 'footer': 1, 'figure': 1, 'figurecaption': 1, 'time': 1, + 'mark': 1, 'wbr': 1, 'embed': 1, 'video': 1, 'audio': 1, 'source': 1, 'canvas': 1, 'datalist': 1, 'keygen': 1, 'output': 1, 'progress': 1, + 'meter': 1, 'details': 1, 'summary': 1, 'command': 1 }; + + this.LANGUAGES.html = { defaultMode: { contains: ['comment', 'pi', 'doctype', 'vbscript', 'tag'] }, + case_insensitive: true, + modes: [ + { className: 'tag', begin: '', lexems: [this.IDENT_RE], keywords: {'style': 1}, contains: ['tag_internal'], starts: 'css' }, + { className: 'tag', begin: '', lexems: [this.IDENT_RE], keywords: {'script': 1}, contains: ['tag_internal'], starts: 'javascript' }, + { className: 'css', end: '', returnEnd: true, subLanguage: 'css' }, + { className: 'javascript', end: '', returnEnd: true, subLanguage: 'javascript' }, + { className: 'vbscript', begin: '<%', end: '%>', subLanguage: 'vbscript' }, + COMMENT, PI, DOCTYPE, this.inherit(TAG), this.inherit(TITLE, { lexems: [this.IDENT_RE], keywords: HTML_TAGS }), + this.inherit(TAG_INTERNAL), ATTR, VALUE_CONTAINER_QUOT, VALUE_CONTAINER_APOS, + { className: 'value_container', begin: '=', end: this.IMMEDIATE_RE, + contains: [{className: 'unquoted_value', displayClassName: 'value', begin: '[^\\s/>]+', end: this.IMMEDIATE_RE }] }] }; + + this.LANGUAGES.javascript = { defaultMode: { lexems: [this.UNDERSCORE_IDENT_RE], contains: ['string', 'comment', 'number', 'regexp_container', 'function'], + keywords: { 'keyword': {'in': 1, 'if': 1, 'for': 1, 'while': 1, 'finally': 1, 'var': 1, 'new': 1, 'function': 1, 'do': 1, 'return': 1, 'void': 1, + 'else': 1, 'break': 1, 'catch': 1, 'instanceof': 1, 'with': 1, 'throw': 1, 'case': 1, 'default': 1, 'try': 1, 'this': 1, 'switch': 1, + 'continue': 1, 'typeof': 1, 'delete': 1}, 'literal': {'true': 1, 'false': 1, 'null': 1} }}, + modes: [ this.C_LINE_COMMENT_MODE, this.C_BLOCK_COMMENT_MODE, this.C_NUMBER_MODE, this.APOS_STRING_MODE, this.QUOTE_STRING_MODE, this.BACKSLASH_ESCAPE, + { className: 'regexp_container', begin: '(' + this.RE_STARTERS_RE + '|case|return|throw)\\s*', end: this.IMMEDIATE_RE, noMarkup: true, + lexems: [this.IDENT_RE], keywords: {'return': 1, 'throw': 1, 'case': 1}, + contains: [ 'comment', { className: 'regexp', begin: '/.*?[^\\\\/]/[gim]*', end: this.IMMEDIATE_RE } ], relevance: 0 }, + { className: 'function', begin: '\\bfunction\\b', end: '{', lexems: [this.UNDERSCORE_IDENT_RE], keywords: {'function': 1}, + contains: [{ className: 'title', begin: '[A-Za-z$_][0-9A-Za-z$_]*', end: this.IMMEDIATE_RE }, + { className: 'params', begin: '\\(', end: '\\)', contains: ['string', 'comment'] }] }] + }; + + this.LANGUAGES.css = { defaultMode: { contains: ['at_rule', 'id', 'class', 'attr_selector', 'pseudo', 'rules', 'comment'], keywords: this.HTML_TAGS, + lexems: [this.IDENT_RE], illegal: '=' }, case_insensitive: true, + modes: [ + { className: 'at_rule', begin: '@', end: '[{;]', excludeEnd: true, lexems: [this.IDENT_RE], keywords: {'import': 1, 'page': 1, 'media': 1, 'charset': 1, 'font-face': 1}, + contains: ['function', 'string', 'number', 'pseudo'] }, + { className: 'id', begin: '\\#[A-Za-z0-9_-]+', end: this.IMMEDIATE_RE }, + { className: 'class', begin: '\\.[A-Za-z0-9_-]+', end: this.IMMEDIATE_RE, relevance: 0 }, + { className: 'attr_selector', begin: '\\[', end: '\\]', illegal: '$' }, + { className: 'pseudo', begin: ':(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\"\\\']+', end: this.IMMEDIATE_RE }, + { className: 'rules', begin: '{', end: '}', + contains: [{className: 'rule', begin: '[A-Z\\_\\.\\-]+\\s*:', end: ';', endsWithParent: true, lexems: ['[A-Za-z-]+'], + keywords: {'play-during': 1, 'counter-reset': 1, 'counter-increment': 1, 'min-height': 1, 'quotes': 1, 'border-top': 1, 'pitch': 1, 'font': 1, + 'pause': 1, 'list-style-image': 1, 'border-width': 1, 'cue': 1, 'outline-width': 1, 'border-left': 1, 'elevation': 1, 'richness': 1, + 'speech-rate': 1, 'border-bottom': 1, 'border-spacing': 1, 'background': 1, 'list-style-type': 1, 'text-align': 1, 'page-break-inside': 1, + 'orphans': 1, 'page-break-before': 1, 'text-transform': 1, 'line-height': 1, 'padding-left': 1, 'font-size': 1, 'right': 1, 'word-spacing': 1, + 'padding-top': 1, 'outline-style': 1, 'bottom': 1, 'content': 1, 'border-right-style': 1, 'padding-right': 1, 'border-left-style': 1, + 'voice-family': 1, 'background-color': 1, 'border-bottom-color': 1, 'outline-color': 1, 'unicode-bidi': 1, 'max-width': 1, 'font-family': 1, + 'caption-side': 1, 'border-right-width': 1, 'pause-before': 1, 'border-top-style': 1, 'color': 1, 'border-collapse': 1, 'border-bottom-width': 1, + 'float': 1, 'height': 1, 'max-height': 1, 'margin-right': 1, 'border-top-width': 1, 'speak': 1, 'speak-header': 1, 'top': 1, 'cue-before': 1, + 'min-width': 1, 'width': 1, 'font-variant': 1, 'border-top-color': 1, 'background-position': 1, 'empty-cells': 1, 'direction': 1, 'border-right': 1, + 'visibility': 1, 'padding': 1, 'border-style': 1, 'background-attachment': 1, 'overflow': 1, 'border-bottom-style': 1, 'cursor': 1, 'margin': 1, + 'display': 1, 'border-left-width': 1, 'letter-spacing': 1, 'vertical-align': 1, 'clip': 1, 'border-color': 1, 'list-style': 1, 'padding-bottom': 1, + 'pause-after': 1, 'speak-numeral': 1, 'margin-left': 1, 'widows': 1, 'border': 1, 'font-style': 1, 'border-left-color': 1, 'pitch-range': 1, + 'background-repeat': 1, 'table-layout': 1, 'margin-bottom': 1, 'speak-punctuation': 1, 'font-weight': 1, 'border-right-color': 1, 'page-break-after': 1, + 'position': 1, 'white-space': 1, 'text-indent': 1, 'background-image': 1, 'volume': 1, 'stress': 1, 'outline': 1, 'clear': 1, 'z-index': 1, + 'text-decoration': 1, 'margin-top': 1, 'azimuth': 1, 'cue-after': 1, 'left': 1, 'list-style-position': 1}, + contains: [{ className: 'value', begin: this.IMMEDIATE_RE, endsWithParent: true, excludeEnd: true, contains: ['function', 'number', 'hexcolor', 'string', 'important', 'comment'] }] + }, 'comment'], + illegal: '[^\\s]' }, + this.C_BLOCK_COMMENT_MODE, { className: 'number', begin: this.NUMBER_RE, end: this.IMMEDIATE_RE }, + { className: 'hexcolor', begin: '\\#[0-9A-F]+', end: this.IMMEDIATE_RE }, + { className: 'function', begin: this.IDENT_RE + '\\(', end: '\\)', + contains: [ + { className: 'params', begin: this.IMMEDIATE_RE, endsWithParent: true, excludeEnd: true, contains: ['number', 'string'] }]}, + { className: 'important', begin: '!important', end: this.IMMEDIATE_RE }, this.APOS_STRING_MODE, this.QUOTE_STRING_MODE, this.BACKSLASH_ESCAPE ]}; +}(); + +// -------------------------------------------------------------------------- +// Color Picker +// +var colorDropper = { images : { pad : [ 181, 101 ], sld : [ 16, 101 ], cross : [ 15, 15 ], arrow : [ 7, 11 ] }, + fetchElement : function (mixed) { return typeof mixed === 'string' ? document.getElementById(mixed) : mixed; }, + + addEvent : function(el, evnt, func) { + if (el.addEventListener) { + el.addEventListener(evnt, func, false); + } + else if (el.attachEvent) { + el.attachEvent('on'+evnt, func); + } + }, + + fireEvent : function (el, evnt) { + if (!el) { + return; + } + var ev; + if (document.createEvent) { + ev = document.createEvent('HTMLEvents'); + ev.initEvent(evnt, true, true); + el.dispatchEvent(ev); + } + else if (document.createEventObject) { + ev = document.createEventObject(); + el.fireEvent('on'+evnt, ev); + } + else if (el['on'+evnt]) { + el['on'+evnt](); + } + }, + + getElementPos : function (e) { + var e1 = e, e2 = e, x = 0, y = 0; + if (e1.offsetParent) { + do { + x += e1.offsetLeft; + y += e1.offsetTop; + e1 = e1.offsetParent; + } while(e1); + } + + while (e2 && e2.nodeName.toLowerCase() !== 'body') { + x -= e2.scrollLeft; + y -= e2.scrollTop; + e2 = e2.parentNode; + } + return [x, y]; + }, + + getElementSize : function (e) { + return [e.offsetWidth, e.offsetHeight]; + }, + + getRelMousePos : function (e) { + var x = 0, y = 0; + if (!e) { e = window.event; } + if (typeof e.offsetX === 'number') { + x = e.offsetX; + y = e.offsetY; + } + else if (typeof e.layerX === 'number') { + x = e.layerX; + y = e.layerY; + } + return { x: x, y: y }; + }, + + color : function (target, prop) { + this.required = true; + this.adjust = true; + this.hash = true; + this.caps = false; + this.valueElement = target; + this.styleElement = target; + this.onImmediateChange = null; + this.hsv = [0, 0, 1]; + this.rgb = [1, 1, 1]; + this.minH = 0; + this.maxH = 6; + this.minS = 0; + this.maxS = 1; + this.minV = 0; + this.maxV = 1; + + this.pickerOnfocus = true; + this.pickerMode = 'HSV'; + this.pickerFace = 3; + this.pickerFaceColor = '#fff'; + this.pickerInset = 1; + this.pickerInsetColor = '#999'; + this.pickerZIndex = 10003; + + var p; + var self = this; + + var modeID = this.pickerMode.toLowerCase() === 'hvs' ? 1 : 0; + var abortBlur = false; + var valueElement = colorDropper.fetchElement(this.valueElement), styleElement = colorDropper.fetchElement(this.styleElement); + var holdPad = false, holdSld = false, touchOffset = {}; + var leaveValue = 1<<0, leaveStyle = 1<<1, leavePad = 1<<2, leaveSld = 1<<3; + + colorDropper.addEvent(target, 'blur', function() { + if (!abortBlur) { + window.setTimeout(function(){ abortBlur || blurTarget(); abortBlur = false; }, 0); + } + else { + abortBlur = false; + } + }); + + + for(p in prop) { + if (prop.hasOwnProperty(p)) { + this[p] = prop[p]; + } + } + + this.hidePicker = function() { + if (isPickerOwner()) { + removePicker(); + } + }; + + this.showPicker = function() { + if (!isPickerOwner()) { + drawPicker(); + } + }; + + this.importColor = function() { + if (!valueElement) { + this.exportColor(); + } + else { + if (!this.adjust) { + if (!this.fromString(valueElement.value, leaveValue)) { + styleElement.style.backgroundImage = styleElement.jscStyle.backgroundImage; + styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor; + styleElement.style.color = styleElement.jscStyle.color; + this.exportColor(leaveValue | leaveStyle); + } + } + else if (!this.required && /^\s*$/.test(valueElement.value)) { + valueElement.value = ''; + styleElement.style.backgroundImage = styleElement.jscStyle.backgroundImage; + styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor; + styleElement.style.color = styleElement.jscStyle.color; + this.exportColor(leaveValue | leaveStyle); + + } + else if(this.fromString(valueElement.value)) { + } + else { + this.exportColor(); + } + } + }; + + this.exportColor = function (flags) { + if (!(flags & leaveValue) && valueElement) { + var value = this.toString(); + if (this.caps) { value = value.toUpperCase(); } + if (this.hash) { value = '#'+value; } + valueElement.value = value; + } + if (!(flags & leaveStyle) && styleElement) { + styleElement.style.backgroundImage = "none"; + styleElement.style.backgroundColor = '#'+this.toString(); + styleElement.style.color = 0.213 * this.rgb[0] + 0.715 * this.rgb[1] + 0.072 * this.rgb[2] < 0.5 ? '#FFF' : '#000'; + } + if (!(flags & leavePad) && isPickerOwner()) { + redrawPad(); + } + if (!(flags & leaveSld) && isPickerOwner()) { + redrawSld(); + } + }; + + this.fromHSV = function (h, s, v, flags) { + if (h) { h = Math.max(0.0, this.minH, Math.min(6.0, this.maxH, h)); } + if (s) { s = Math.max(0.0, this.minS, Math.min(1.0, this.maxS, s)); } + if (v) { v = Math.max(0.0, this.minV, Math.min(1.0, this.maxV, v)); } + + this.rgb = this.HSV_RGB( + h === null ? this.hsv[0] : (this.hsv[0] = h), + s === null ? this.hsv[1] : (this.hsv[1] = s), + v === null ? this.hsv[2] : (this.hsv[2] = v) + ); + this.exportColor(flags); + }; + + + this.fromRGB = function (r, g, b, flags) { + if (r) { r = Math.max(0.0, Math.min(1.0, r)); } + if (g) { g = Math.max(0.0, Math.min(1.0, g)); } + if (b) { b = Math.max(0.0, Math.min(1.0, b)); } + + var hsv = this.RGB_HSV( + r === null ? this.rgb[0] : r, + g === null ? this.rgb[1] : g, + b === null ? this.rgb[2] : b + ); + if(hsv[0] !== null) { + this.hsv[0] = Math.max(0.0, this.minH, Math.min(6.0, this.maxH, hsv[0])); + } + if(hsv[2] !== 0) { + this.hsv[1] = hsv[1] === null ? null : Math.max(0.0, this.minS, Math.min(1.0, this.maxS, hsv[1])); + } + this.hsv[2] = hsv[2] === null ? null : Math.max(0.0, this.minV, Math.min(1.0, this.maxV, hsv[2])); + + var rgb = this.HSV_RGB(this.hsv[0], this.hsv[1], this.hsv[2]); + this.rgb[0] = rgb[0]; + this.rgb[1] = rgb[1]; + this.rgb[2] = rgb[2]; + + this.exportColor(flags); + }; + + this.fromString = function (hex, flags) { + var m = hex.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i); + if (!m) { + return false; + } + if (m[1].length === 6) { + this.fromRGB( + parseInt(m[1].substr(0,2),16) / 255, + parseInt(m[1].substr(2,2),16) / 255, + parseInt(m[1].substr(4,2),16) / 255, + flags + ); + } + else { + this.fromRGB( + parseInt(m[1].charAt(0)+m[1].charAt(0),16) / 255, + parseInt(m[1].charAt(1)+m[1].charAt(1),16) / 255, + parseInt(m[1].charAt(2)+m[1].charAt(2),16) / 255, + flags + ); + } + return true; + }; + + this.toString = function() { + return ( + (0x100 | Math.round(255*this.rgb[0])).toString(16).substr(1) + + (0x100 | Math.round(255*this.rgb[1])).toString(16).substr(1) + + (0x100 | Math.round(255*this.rgb[2])).toString(16).substr(1) + ); + }; + + this.RGB_HSV = function(r, g, b) { + var n = Math.min(Math.min(r, g), b); + var v = Math.max(Math.max(r, g), b); + var m = v - n; + if (m === 0) { return [ null, 0, v ]; } + var h = r === n ? 3 + (b - g) / m : (g === n ? 5 + (r - b)/ m : 1 + (g - r) / m); + return [ h === 6 ? 0 : h, m / v, v ]; + }; + + this.HSV_RGB = function(h, s, v) { + if (h === null) { return [ v, v, v ]; } + var i = Math.floor(h); + var f = i % 2 ? h-i : 1-(h-i); + var m = v * (1 - s); + var n = v * (1 - s*f); + switch(i) { + case 6: + case 0: return [v,n,m]; + case 1: return [n,v,m]; + case 2: return [m,v,n]; + case 3: return [m,n,v]; + case 4: return [n,m,v]; + case 5: return [v,m,n]; + } + }; + + function removePicker() { + delete colorDropper.picker.owner; + colorDropper.picker.boxB.parentNode.removeChild(colorDropper.picker.boxB); + } + + function drawPicker () { + var i = 0, seg, segSize; + if (!colorDropper.picker) { + colorDropper.picker = { + box : document.createElement('div'), + boxB : document.createElement('div'), + pad : document.createElement('div'), + padB : document.createElement('div'), + padM : document.createElement('div'), + sld : document.createElement('div'), + sldB : document.createElement('div'), + sldM : document.createElement('div') + }; + for (i=0, segSize=2; i < colorDropper.images.sld[1]; i += segSize) { + seg = document.createElement('div'); + seg.style.height = segSize+'px'; + seg.style.fontSize = '1px'; + seg.style.lineHeight = '0px'; + colorDropper.picker.sld.appendChild(seg); + } + colorDropper.picker.sldB.appendChild(colorDropper.picker.sld); + colorDropper.picker.box.appendChild(colorDropper.picker.sldB); + colorDropper.picker.box.appendChild(colorDropper.picker.sldM); + colorDropper.picker.padB.appendChild(colorDropper.picker.pad); + colorDropper.picker.box.appendChild(colorDropper.picker.padB); + colorDropper.picker.box.appendChild(colorDropper.picker.padM); + colorDropper.picker.boxB.appendChild(colorDropper.picker.box); + } + + p = colorDropper.picker; + p.box.onmouseup = p.box.onmouseout = function() { target.focus(); }; + p.box.onmousedown = function() { abortBlur=true; }; + p.box.onmousemove = function(e) { + if (holdPad || holdSld) { + holdPad && setPad(e); + holdSld && setSld(e); + if (document.selection) { + document.selection.empty(); + } + else if (window.getSelection) { + window.getSelection().removeAllRanges(); + } + dispatchImmediateChange(); + } + }; + + if ('ontouchstart' in window) { + var handle_touchmove = function(e) { + var event={ 'offsetX': e.touches[0].pageX-touchOffset.X, 'offsetY': e.touches[0].pageY-touchOffset.Y + }; + if (holdPad || holdSld) { + holdPad && setPad(event); + holdSld && setSld(event); + dispatchImmediateChange(); + } + e.stopPropagation(); + e.preventDefault(); + }; + p.box.removeEventListener('touchmove', handle_touchmove, false); + p.box.addEventListener('touchmove', handle_touchmove, false); + } + p.padM.onmouseup = p.padM.onmouseout = function() { + if (holdPad) { holdPad=false; colorDropper.fireEvent(valueElement,'change'); } + }; + p.padM.onmousedown = function(e) { + switch(modeID) { + case 0: + if (self.hsv[2] === 0) { + self.fromHSV(null, null, 1.0); + } + break; + case 1: + if (self.hsv[1] === 0) { + self.fromHSV(null, 1.0, null); + } + break; + } + holdSld = false; + holdPad = true; + setPad(e); + dispatchImmediateChange(); + }; + + if ('ontouchstart' in window) { + p.padM.addEventListener('touchstart', function(e) { + touchOffset = { 'X': getOffsetParent(e.target).Left, 'Y': getOffsetParent(e.target).Top }; + this.onmousedown({ 'offsetX':e.touches[0].pageX-touchOffset.X, 'offsetY':e.touches[0].pageY-touchOffset.Y }); + }); + } + p.sldM.onmouseup = p.sldM.onmouseout = function() { + if (holdSld) { holdSld = false; colorDropper.fireEvent(valueElement,'change'); } + }; + p.sldM.onmousedown = function(e) { + holdPad = false; + holdSld = true; + setSld(e); + dispatchImmediateChange(); + }; + if ('ontouchstart' in window) { + p.sldM.addEventListener('touchstart', function(e) { + touchOffset = { 'X': getOffsetParent(e.target).Left, 'Y': getOffsetParent(e.target).Top }; + this.onmousedown({ 'offsetX':e.touches[0].pageX-touchOffset.X, 'offsetY':e.touches[0].pageY-touchOffset.Y }); + }); + } + + var dims = getPickerDims(self); + p.box.style.width = dims[0] + 'px'; + p.box.style.height = dims[1] + 'px'; + + p.boxB.style.position = 'relative'; + p.boxB.style.clear = 'both'; + p.boxB.style.border = 'none'; + p.boxB.style.background = self.pickerFaceColor; + + p.pad.style.width = colorDropper.images.pad[0]+'px'; + p.pad.style.height = colorDropper.images.pad[1]+'px'; + + p.padB.style.position = 'absolute'; + p.padB.style.left = self.pickerFace+'px'; + p.padB.style.top = self.pickerFace+'px'; + p.padB.style.border = self.pickerInset+'px solid'; + p.padB.style.borderColor = self.pickerInsetColor; + + p.padM.style.position = 'absolute'; + p.padM.style.left = '0'; + p.padM.style.top = '0'; + p.padM.style.width = self.pickerFace + 2*self.pickerInset + colorDropper.images.pad[0] + colorDropper.images.arrow[0] + 'px'; + p.padM.style.height = p.box.style.height; + p.padM.style.cursor = 'crosshair'; + + p.sld.style.overflow = 'hidden'; + p.sld.style.width = "13px"; + p.sld.style.height = colorDropper.images.sld[1]+'px'; + + p.sldB.style.position = 'absolute'; + p.sldB.style.right = self.pickerFace+'px'; + p.sldB.style.top = self.pickerFace+'px'; + p.sldB.style.border = self.pickerInset+'px solid'; + p.sldB.style.borderColor = self.pickerInsetColor; + + p.sldM.style.position = 'absolute'; + p.sldM.style.right = '0'; + p.sldM.style.top = '0'; + p.sldM.style.width = 14 + colorDropper.images.arrow[0] + self.pickerFace + 2*self.pickerInset + 'px'; + p.sldM.style.height = p.box.style.height; + + try { + p.sldM.style.cursor = 'pointer'; + } catch(e) { + p.sldM.style.cursor = 'hand'; + } + + var padImg = modeID ? 'color_picker_hv.png' : 'color_picker_hs.png'; + p.padM.style.backgroundImage = "url('"+self.iconDir+"/color_picker_cross.gif')"; + p.padM.style.backgroundRepeat = "no-repeat"; + p.sldM.style.backgroundImage = "url('"+self.iconDir+"/color_picker_arrow.gif')"; + p.sldM.style.backgroundRepeat = "no-repeat"; + p.pad.style.backgroundImage = "url('"+self.iconDir+"/"+padImg+"')"; + p.pad.style.backgroundRepeat = "no-repeat"; + p.pad.style.backgroundPosition = "0 0"; + redrawPad(); + redrawSld(); + colorDropper.picker.owner = self; + target.parentNode.parentNode.appendChild(p.boxB); + } + + function getPickerDims(o) { + var dims = [ + 2*o.pickerInset + 2*o.pickerFace + colorDropper.images.pad[0] + + 2*o.pickerInset + 2*colorDropper.images.arrow[0] + colorDropper.images.sld[0], + 2*o.pickerInset + 2*o.pickerFace + colorDropper.images.pad[1] + ]; + return dims; + } + + function redrawPad() { + var yComponent; + switch(modeID) { + case 0: yComponent = 1; break; + case 1: yComponent = 2; break; + } + var x = Math.round((self.hsv[0]/6) * (colorDropper.images.pad[0]-1)); + var y = Math.round((1-self.hsv[yComponent]) * (colorDropper.images.pad[1]-1)); + colorDropper.picker.padM.style.backgroundPosition = + (self.pickerFace+self.pickerInset+x - Math.floor(colorDropper.images.cross[0]/2)) + 'px ' + + (self.pickerFace+self.pickerInset+y - Math.floor(colorDropper.images.cross[1]/2)) + 'px'; + + var seg = colorDropper.picker.sld.childNodes; + var i=0, rgb, s, c; + switch(modeID) { + case 0: + rgb = self.HSV_RGB(self.hsv[0], self.hsv[1], 1); + if (window.File && window.FileReader) { + colorDropper.picker.sld.style.background = "linear-gradient(rgb("+ + (rgb[0]*(1-i/seg.length)*100)+"%,"+ + (rgb[1]*(1-i/seg.length)*100)+"%,"+ + (rgb[2]*(1-i/seg.length)*100)+"%), black)"; + } + else { + for (i=0; i#grayscale"); + filter: alpha(opacity=40) gray; + -webkit-filter: grayscale(100%); + -moz-filter: grayscale(100%); + -ms-filter: grayscale(100%); + -o-filter: grayscale(100%); + opacity: 0.4; +} +.cheditor-tb-text { + padding: 0px; + margin: 0px; + color: #333; + height: 20px; + line-height: 20px; +} +.cheditor-tb-text-disable { + padding: 0px; + margin: 0px; + height: 20px; + line-height: 20px; + color: #333; + overflow: hidden; + filter: grayscale(100%); + filter: url("data:image/svg+xml;utf8,#grayscale"); + filter: alpha(opacity=40) gray; + -webkit-filter: grayscale(1); + -moz-filter: grayscale(100%); + -ms-filter: grayscale(100%); + -o-filter: grayscale(100%); + opacity: 0.4; +} +.cheditor-tb-text span, .cheditor-tb-text-disable span { + font-family: "Malgun Gothic", "Apple SD Gothic Neo", gulim, tahoma, helvetica; + margin: 0px 0px 0px 1px; + padding: 0px; + width: 41px; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + display: block; + font-size: 12px; +} +.cheditor-tb-icon23 { + height: 22px; + width: 23px; + margin-left: 3px; + overflow: hidden; +} +.cheditor-tb-icon23-disable { + height: 22px; + width: 23px; + margin-left: 3px; + overflow: hidden; + filter: grayscale(100%); + filter: url("data:image/svg+xml;utf8,#grayscale"); + filter: alpha(opacity=40) gray; + -webkit-filter: grayscale(1); + -moz-filter: grayscale(100%); + -ms-filter: grayscale(100%); + -o-filter: grayscale(100%); + opacity: 0.4; +} +.cheditor-tb-icon36 { + height: 22px; + width: 36px; + overflow: hidden; +} +.cheditor-tb-icon36-disable { + height: 22px; + width: 36px; + overflow: hidden; + filter: grayscale(100%); + filter: url("data:image/svg+xml;utf8,#grayscale"); + filter: alpha(opacity=40) gray; + -webkit-filter: grayscale(1); + -moz-filter: grayscale(100%); + -ms-filter: grayscale(100%); + -o-filter: grayscale(100%); + opacity: 0.4; +} +.cheditor-tb-combo { + height: 22px; + width: 10px; + overflow: hidden; +} +.cheditor-tb-combo-disable { + height: 22px; + width: 10px; + overflow: hidden; + filter: grayscale(100%); + filter: url("data:image/svg+xml;utf8,#grayscale"); + filter: alpha(opacity=40) gray; + -webkit-filter: grayscale(100%); + -moz-filter: grayscale(100%); + -ms-filter: grayscale(100%); + -o-filter: grayscale(100%); + opacity: 0.4; +} +.cheditor-tb-bg55 { + float: left; + overflow: hidden; + background: transparent url(../icons/toolbar-background.png) no-repeat left -483px; + position: relative; +} +.cheditor-tb-bg40 { + float: left; + overflow: hidden; + background: transparent url(../icons/toolbar-background.png) no-repeat left -552px; + position: relative; +} +.cheditor-tb-bg44 { + float: left; + overflow: hidden; + background: transparent url(../icons/toolbar-background.png) no-repeat left -621px; + position: relative; +} +.cheditor-tb-bg30-first { + float: left; + overflow: hidden; + background: transparent url(../icons/toolbar-background.png) no-repeat left -276px; + position: relative; +} +.cheditor-tb-bg30 { + float: left; + overflow: hidden; + background: transparent url(../icons/toolbar-background.png) no-repeat left -345px; + position: relative; +} +.cheditor-tb-bg30-last { + float: left; + overflow: hidden; + background: transparent url(../icons/toolbar-background.png) no-repeat left -414px; + position: relative; +} +.cheditor-tb-bgcombo { + float: left; + overflow: hidden; + background: transparent url(../icons/toolbar-background.png) no-repeat left -690px; + position: relative; +} +.cheditor-tb-bgcombo-first { + float: left; + overflow: hidden; + background: transparent url(../icons/toolbar-background.png) no-repeat left top; + position: relative; +} +.cheditor-tb-bgcombo-last { + float: left; + overflow: hidden; + background: url(../icons/toolbar-background.png) no-repeat left -759px; + position: relative; +} +.cheditor-tb-bg { + float: left; + overflow: hidden; + background: transparent url(../icons/toolbar-background.png) no-repeat left -69px; + position: relative; +} +.cheditor-tb-bg-first { + float: left; + overflow: hidden; + background: transparent url(../icons/toolbar-background.png) no-repeat left top; + position: relative; +} +.cheditor-tb-bg-last { + float: left; + overflow: hidden; + background: transparent url(../icons/toolbar-background.png) no-repeat left -138px; + position: relative; +} +.cheditor-tb-bg-single { + float: left; + overflow: hidden; + background: transparent url(../icons/toolbar-background.png) no-repeat left -207px; + position: relative; +} +.cheditor-tb-color-btn { + width: 16px; + height: 3px; + overflow: hidden; + position: absolute; + top: 16px; + left: 3px; +} +.cheditor-tb-button-spacer { + overflow: hidden; + width: 4px; + height: 4px; + float: left; +} +.cheditor-tb-split { + overflow: hidden; + height: 2px; + width: 3px; + clear: both; +} \ No newline at end of file diff --git a/webedit/editor.lib.php b/webedit/editor.lib.php new file mode 100644 index 0000000..ea812ad --- /dev/null +++ b/webedit/editor.lib.php @@ -0,0 +1,62 @@ +"; + } + $html .= "\n"; + $html .= "웹에디터 시작"; + $html .= "\n"; + $html .= "\n웹 에디터 끝"; + $html .= "\n"; + } else { + $html .= "\n"; + } + return $html; +} + + +// textarea 로 값을 넘긴다. javascript 반드시 필요 +function get_editor_js($id, $is_dhtml_editor=true) +{ + if ($is_dhtml_editor) { + return "document.getElementById('tx_{$id}').value = ed_{$id}.outputBodyHTML();\n"; + } else { + return "var {$id}_editor = document.getElementById('{$id}');\n"; + } +} + + +// textarea 의 값이 비어 있는지 검사 +function chk_editor_js($id, $is_dhtml_editor=true) +{ + if ($is_dhtml_editor) { + return "if (document.getElementById('tx_{$id}') && jQuery.inArray(ed_{$id}.outputBodyHTML().toLowerCase().replace(/^\s*|\s*$/g, ''), [' ','

 

','


','

','

','
','']) != -1) { alert(\"내용을 입력해 주십시오.\"); ed_{$id}.returnFalse(); return false; }\n"; + } else { + return "if (!{$id}_editor.value) { alert(\"내용을 입력해 주십시오.\"); {$id}_editor.focus(); return false; }\n"; + } +} +?> \ No newline at end of file diff --git a/webedit/example/modify.html b/webedit/example/modify.html new file mode 100644 index 0000000..43e95ed --- /dev/null +++ b/webedit/example/modify.html @@ -0,0 +1,78 @@ + + + +CHEditor + + + + + +
+

CHEditor Demo

+ + +
+ + + + + + +

+ + + +
+ +

+ + Copyright ⓒ 1997-2014 by CHCODE. All right reserved. + +

+
+ + \ No newline at end of file diff --git a/webedit/example/multi.html b/webedit/example/multi.html new file mode 100644 index 0000000..8467118 --- /dev/null +++ b/webedit/example/multi.html @@ -0,0 +1,70 @@ + + + +CHEditor + + + + + +
+

CHEditor Demo

+ + +
+ + + + + + +

+ + + + +

+ + +
+ +

+ + Copyright ⓒ 1997-2014 by CHCODE. All right reserved. + +

+
+ + diff --git a/webedit/example/newpost.html b/webedit/example/newpost.html new file mode 100644 index 0000000..1f4eb44 --- /dev/null +++ b/webedit/example/newpost.html @@ -0,0 +1,77 @@ + + + +CHEditor 5 + + + + + +
+

CHEditor Demo

+ + +
+ + + + + +

+ + + +
+ +

+ + Copyright ⓒ 1997-2014 by CHCODE. All right reserved. + +

+
+ + \ No newline at end of file diff --git a/webedit/icons/add_col_after.png b/webedit/icons/add_col_after.png new file mode 100644 index 0000000..8a39314 Binary files /dev/null and b/webedit/icons/add_col_after.png differ diff --git a/webedit/icons/add_col_before.png b/webedit/icons/add_col_before.png new file mode 100644 index 0000000..d8f3a56 Binary files /dev/null and b/webedit/icons/add_col_before.png differ diff --git a/webedit/icons/add_cols_after.png b/webedit/icons/add_cols_after.png new file mode 100644 index 0000000..d177a04 Binary files /dev/null and b/webedit/icons/add_cols_after.png differ diff --git a/webedit/icons/add_cols_before.png b/webedit/icons/add_cols_before.png new file mode 100644 index 0000000..b03cbda Binary files /dev/null and b/webedit/icons/add_cols_before.png differ diff --git a/webedit/icons/add_row_after.png b/webedit/icons/add_row_after.png new file mode 100644 index 0000000..80c4490 Binary files /dev/null and b/webedit/icons/add_row_after.png differ diff --git a/webedit/icons/add_row_before.png b/webedit/icons/add_row_before.png new file mode 100644 index 0000000..9cff358 Binary files /dev/null and b/webedit/icons/add_row_before.png differ diff --git a/webedit/icons/add_rows_after.png b/webedit/icons/add_rows_after.png new file mode 100644 index 0000000..579a2db Binary files /dev/null and b/webedit/icons/add_rows_after.png differ diff --git a/webedit/icons/add_rows_before.png b/webedit/icons/add_rows_before.png new file mode 100644 index 0000000..45d46b4 Binary files /dev/null and b/webedit/icons/add_rows_before.png differ diff --git a/webedit/icons/button/cancel.gif b/webedit/icons/button/cancel.gif new file mode 100644 index 0000000..434323b Binary files /dev/null and b/webedit/icons/button/cancel.gif differ diff --git a/webedit/icons/button/color_picker.gif b/webedit/icons/button/color_picker.gif new file mode 100644 index 0000000..16826bf Binary files /dev/null and b/webedit/icons/button/color_picker.gif differ diff --git a/webedit/icons/button/color_picker.png b/webedit/icons/button/color_picker.png new file mode 100644 index 0000000..3b8cf1d Binary files /dev/null and b/webedit/icons/button/color_picker.png differ diff --git a/webedit/icons/button/color_picker_disable.png b/webedit/icons/button/color_picker_disable.png new file mode 100644 index 0000000..34d8a22 Binary files /dev/null and b/webedit/icons/button/color_picker_disable.png differ diff --git a/webedit/icons/button/delete.gif b/webedit/icons/button/delete.gif new file mode 100644 index 0000000..5a03749 Binary files /dev/null and b/webedit/icons/button/delete.gif differ diff --git a/webedit/icons/button/delete_cross.gif b/webedit/icons/button/delete_cross.gif new file mode 100644 index 0000000..449d63a Binary files /dev/null and b/webedit/icons/button/delete_cross.gif differ diff --git a/webedit/icons/button/edit_cell.gif b/webedit/icons/button/edit_cell.gif new file mode 100644 index 0000000..6022fc4 Binary files /dev/null and b/webedit/icons/button/edit_cell.gif differ diff --git a/webedit/icons/button/edit_image.gif b/webedit/icons/button/edit_image.gif new file mode 100644 index 0000000..7bf05a0 Binary files /dev/null and b/webedit/icons/button/edit_image.gif differ diff --git a/webedit/icons/button/imageUpload/cancel.gif b/webedit/icons/button/imageUpload/cancel.gif new file mode 100644 index 0000000..3fe023d Binary files /dev/null and b/webedit/icons/button/imageUpload/cancel.gif differ diff --git a/webedit/icons/button/imageUpload/submit.gif b/webedit/icons/button/imageUpload/submit.gif new file mode 100644 index 0000000..e42241f Binary files /dev/null and b/webedit/icons/button/imageUpload/submit.gif differ diff --git a/webedit/icons/button/input.gif b/webedit/icons/button/input.gif new file mode 100644 index 0000000..ef9316e Binary files /dev/null and b/webedit/icons/button/input.gif differ diff --git a/webedit/icons/button/input_color.gif b/webedit/icons/button/input_color.gif new file mode 100644 index 0000000..3f71880 Binary files /dev/null and b/webedit/icons/button/input_color.gif differ diff --git a/webedit/icons/button/map_address.gif b/webedit/icons/button/map_address.gif new file mode 100644 index 0000000..18feee9 Binary files /dev/null and b/webedit/icons/button/map_address.gif differ diff --git a/webedit/icons/button/paste.gif b/webedit/icons/button/paste.gif new file mode 100644 index 0000000..debe850 Binary files /dev/null and b/webedit/icons/button/paste.gif differ diff --git a/webedit/icons/button/play.gif b/webedit/icons/button/play.gif new file mode 100644 index 0000000..d7da138 Binary files /dev/null and b/webedit/icons/button/play.gif differ diff --git a/webedit/icons/button/preview.gif b/webedit/icons/button/preview.gif new file mode 100644 index 0000000..9ec331f Binary files /dev/null and b/webedit/icons/button/preview.gif differ diff --git a/webedit/icons/button/process.gif b/webedit/icons/button/process.gif new file mode 100644 index 0000000..8c33eb2 Binary files /dev/null and b/webedit/icons/button/process.gif differ diff --git a/webedit/icons/button/reset.gif b/webedit/icons/button/reset.gif new file mode 100644 index 0000000..9cce769 Binary files /dev/null and b/webedit/icons/button/reset.gif differ diff --git a/webedit/icons/button/submit.gif b/webedit/icons/button/submit.gif new file mode 100644 index 0000000..3e5af8d Binary files /dev/null and b/webedit/icons/button/submit.gif differ diff --git a/webedit/icons/button/upload.gif b/webedit/icons/button/upload.gif new file mode 100644 index 0000000..1accaba Binary files /dev/null and b/webedit/icons/button/upload.gif differ diff --git a/webedit/icons/checked.png b/webedit/icons/checked.png new file mode 100644 index 0000000..029325e Binary files /dev/null and b/webedit/icons/checked.png differ diff --git a/webedit/icons/color_picker.png b/webedit/icons/color_picker.png new file mode 100644 index 0000000..3ed7f55 Binary files /dev/null and b/webedit/icons/color_picker.png differ diff --git a/webedit/icons/color_picker_arrow.gif b/webedit/icons/color_picker_arrow.gif new file mode 100644 index 0000000..246478a Binary files /dev/null and b/webedit/icons/color_picker_arrow.gif differ diff --git a/webedit/icons/color_picker_cross.gif b/webedit/icons/color_picker_cross.gif new file mode 100644 index 0000000..089b6d1 Binary files /dev/null and b/webedit/icons/color_picker_cross.gif differ diff --git a/webedit/icons/color_picker_hs.png b/webedit/icons/color_picker_hs.png new file mode 100644 index 0000000..3d94486 Binary files /dev/null and b/webedit/icons/color_picker_hs.png differ diff --git a/webedit/icons/color_picker_hv.png b/webedit/icons/color_picker_hv.png new file mode 100644 index 0000000..1c5e01f Binary files /dev/null and b/webedit/icons/color_picker_hv.png differ diff --git a/webedit/icons/color_picker_reset.png b/webedit/icons/color_picker_reset.png new file mode 100644 index 0000000..ba719a7 Binary files /dev/null and b/webedit/icons/color_picker_reset.png differ diff --git a/webedit/icons/color_picker_tick.png b/webedit/icons/color_picker_tick.png new file mode 100644 index 0000000..a48d9da Binary files /dev/null and b/webedit/icons/color_picker_tick.png differ diff --git a/webedit/icons/delete_element.png b/webedit/icons/delete_element.png new file mode 100644 index 0000000..80e1db2 Binary files /dev/null and b/webedit/icons/delete_element.png differ diff --git a/webedit/icons/delete_table.png b/webedit/icons/delete_table.png new file mode 100644 index 0000000..87805c9 Binary files /dev/null and b/webedit/icons/delete_table.png differ diff --git a/webedit/icons/dot.gif b/webedit/icons/dot.gif new file mode 100644 index 0000000..1d11fa9 Binary files /dev/null and b/webedit/icons/dot.gif differ diff --git a/webedit/icons/edit_mode_code_a.png b/webedit/icons/edit_mode_code_a.png new file mode 100644 index 0000000..31f00d9 Binary files /dev/null and b/webedit/icons/edit_mode_code_a.png differ diff --git a/webedit/icons/edit_mode_code_b.png b/webedit/icons/edit_mode_code_b.png new file mode 100644 index 0000000..2ced606 Binary files /dev/null and b/webedit/icons/edit_mode_code_b.png differ diff --git a/webedit/icons/edit_mode_rich_a.png b/webedit/icons/edit_mode_rich_a.png new file mode 100644 index 0000000..497b4e8 Binary files /dev/null and b/webedit/icons/edit_mode_rich_a.png differ diff --git a/webedit/icons/edit_mode_rich_b.png b/webedit/icons/edit_mode_rich_b.png new file mode 100644 index 0000000..732f825 Binary files /dev/null and b/webedit/icons/edit_mode_rich_b.png differ diff --git a/webedit/icons/edit_mode_view_a.png b/webedit/icons/edit_mode_view_a.png new file mode 100644 index 0000000..e14add2 Binary files /dev/null and b/webedit/icons/edit_mode_view_a.png differ diff --git a/webedit/icons/edit_mode_view_b.png b/webedit/icons/edit_mode_view_b.png new file mode 100644 index 0000000..29fe907 Binary files /dev/null and b/webedit/icons/edit_mode_view_b.png differ diff --git a/webedit/icons/em/1.gif b/webedit/icons/em/1.gif new file mode 100644 index 0000000..192f26f Binary files /dev/null and b/webedit/icons/em/1.gif differ diff --git a/webedit/icons/em/10.gif b/webedit/icons/em/10.gif new file mode 100644 index 0000000..67dabd5 Binary files /dev/null and b/webedit/icons/em/10.gif differ diff --git a/webedit/icons/em/11.gif b/webedit/icons/em/11.gif new file mode 100644 index 0000000..aab89b1 Binary files /dev/null and b/webedit/icons/em/11.gif differ diff --git a/webedit/icons/em/12.gif b/webedit/icons/em/12.gif new file mode 100644 index 0000000..dcc1c8f Binary files /dev/null and b/webedit/icons/em/12.gif differ diff --git a/webedit/icons/em/13.gif b/webedit/icons/em/13.gif new file mode 100644 index 0000000..221e0f2 Binary files /dev/null and b/webedit/icons/em/13.gif differ diff --git a/webedit/icons/em/14.gif b/webedit/icons/em/14.gif new file mode 100644 index 0000000..c2184a3 Binary files /dev/null and b/webedit/icons/em/14.gif differ diff --git a/webedit/icons/em/15.gif b/webedit/icons/em/15.gif new file mode 100644 index 0000000..adb78d1 Binary files /dev/null and b/webedit/icons/em/15.gif differ diff --git a/webedit/icons/em/16.gif b/webedit/icons/em/16.gif new file mode 100644 index 0000000..164bcce Binary files /dev/null and b/webedit/icons/em/16.gif differ diff --git a/webedit/icons/em/17.gif b/webedit/icons/em/17.gif new file mode 100644 index 0000000..79382ce Binary files /dev/null and b/webedit/icons/em/17.gif differ diff --git a/webedit/icons/em/18.gif b/webedit/icons/em/18.gif new file mode 100644 index 0000000..ff0eb96 Binary files /dev/null and b/webedit/icons/em/18.gif differ diff --git a/webedit/icons/em/19.gif b/webedit/icons/em/19.gif new file mode 100644 index 0000000..1097e00 Binary files /dev/null and b/webedit/icons/em/19.gif differ diff --git a/webedit/icons/em/2.gif b/webedit/icons/em/2.gif new file mode 100644 index 0000000..9c83e50 Binary files /dev/null and b/webedit/icons/em/2.gif differ diff --git a/webedit/icons/em/20.gif b/webedit/icons/em/20.gif new file mode 100644 index 0000000..e55ec30 Binary files /dev/null and b/webedit/icons/em/20.gif differ diff --git a/webedit/icons/em/21.gif b/webedit/icons/em/21.gif new file mode 100644 index 0000000..0186a11 Binary files /dev/null and b/webedit/icons/em/21.gif differ diff --git a/webedit/icons/em/22.gif b/webedit/icons/em/22.gif new file mode 100644 index 0000000..c46dec6 Binary files /dev/null and b/webedit/icons/em/22.gif differ diff --git a/webedit/icons/em/23.gif b/webedit/icons/em/23.gif new file mode 100644 index 0000000..aacda1a Binary files /dev/null and b/webedit/icons/em/23.gif differ diff --git a/webedit/icons/em/24.gif b/webedit/icons/em/24.gif new file mode 100644 index 0000000..3afc898 Binary files /dev/null and b/webedit/icons/em/24.gif differ diff --git a/webedit/icons/em/25.gif b/webedit/icons/em/25.gif new file mode 100644 index 0000000..0e26fe0 Binary files /dev/null and b/webedit/icons/em/25.gif differ diff --git a/webedit/icons/em/26.gif b/webedit/icons/em/26.gif new file mode 100644 index 0000000..4dfcdab Binary files /dev/null and b/webedit/icons/em/26.gif differ diff --git a/webedit/icons/em/27.gif b/webedit/icons/em/27.gif new file mode 100644 index 0000000..8aae5c5 Binary files /dev/null and b/webedit/icons/em/27.gif differ diff --git a/webedit/icons/em/28.gif b/webedit/icons/em/28.gif new file mode 100644 index 0000000..c3aee86 Binary files /dev/null and b/webedit/icons/em/28.gif differ diff --git a/webedit/icons/em/29.gif b/webedit/icons/em/29.gif new file mode 100644 index 0000000..39cc0c2 Binary files /dev/null and b/webedit/icons/em/29.gif differ diff --git a/webedit/icons/em/3.gif b/webedit/icons/em/3.gif new file mode 100644 index 0000000..b68cfb1 Binary files /dev/null and b/webedit/icons/em/3.gif differ diff --git a/webedit/icons/em/30.gif b/webedit/icons/em/30.gif new file mode 100644 index 0000000..51054ed Binary files /dev/null and b/webedit/icons/em/30.gif differ diff --git a/webedit/icons/em/31.gif b/webedit/icons/em/31.gif new file mode 100644 index 0000000..51e9ab3 Binary files /dev/null and b/webedit/icons/em/31.gif differ diff --git a/webedit/icons/em/32.gif b/webedit/icons/em/32.gif new file mode 100644 index 0000000..3d084cc Binary files /dev/null and b/webedit/icons/em/32.gif differ diff --git a/webedit/icons/em/33.gif b/webedit/icons/em/33.gif new file mode 100644 index 0000000..465a867 Binary files /dev/null and b/webedit/icons/em/33.gif differ diff --git a/webedit/icons/em/34.gif b/webedit/icons/em/34.gif new file mode 100644 index 0000000..b7c2bb6 Binary files /dev/null and b/webedit/icons/em/34.gif differ diff --git a/webedit/icons/em/35.gif b/webedit/icons/em/35.gif new file mode 100644 index 0000000..9e00633 Binary files /dev/null and b/webedit/icons/em/35.gif differ diff --git a/webedit/icons/em/36.gif b/webedit/icons/em/36.gif new file mode 100644 index 0000000..7794542 Binary files /dev/null and b/webedit/icons/em/36.gif differ diff --git a/webedit/icons/em/37.gif b/webedit/icons/em/37.gif new file mode 100644 index 0000000..e216917 Binary files /dev/null and b/webedit/icons/em/37.gif differ diff --git a/webedit/icons/em/38.gif b/webedit/icons/em/38.gif new file mode 100644 index 0000000..76a9e13 Binary files /dev/null and b/webedit/icons/em/38.gif differ diff --git a/webedit/icons/em/39.gif b/webedit/icons/em/39.gif new file mode 100644 index 0000000..f3fd4e7 Binary files /dev/null and b/webedit/icons/em/39.gif differ diff --git a/webedit/icons/em/4.gif b/webedit/icons/em/4.gif new file mode 100644 index 0000000..99851b3 Binary files /dev/null and b/webedit/icons/em/4.gif differ diff --git a/webedit/icons/em/40.gif b/webedit/icons/em/40.gif new file mode 100644 index 0000000..40f2ac1 Binary files /dev/null and b/webedit/icons/em/40.gif differ diff --git a/webedit/icons/em/41.gif b/webedit/icons/em/41.gif new file mode 100644 index 0000000..5af0bb1 Binary files /dev/null and b/webedit/icons/em/41.gif differ diff --git a/webedit/icons/em/42.gif b/webedit/icons/em/42.gif new file mode 100644 index 0000000..e5dfb8d Binary files /dev/null and b/webedit/icons/em/42.gif differ diff --git a/webedit/icons/em/43.gif b/webedit/icons/em/43.gif new file mode 100644 index 0000000..c54a84c Binary files /dev/null and b/webedit/icons/em/43.gif differ diff --git a/webedit/icons/em/44.gif b/webedit/icons/em/44.gif new file mode 100644 index 0000000..ca4abf9 Binary files /dev/null and b/webedit/icons/em/44.gif differ diff --git a/webedit/icons/em/45.gif b/webedit/icons/em/45.gif new file mode 100644 index 0000000..9efbf47 Binary files /dev/null and b/webedit/icons/em/45.gif differ diff --git a/webedit/icons/em/46.gif b/webedit/icons/em/46.gif new file mode 100644 index 0000000..687b4f4 Binary files /dev/null and b/webedit/icons/em/46.gif differ diff --git a/webedit/icons/em/47.gif b/webedit/icons/em/47.gif new file mode 100644 index 0000000..8fc0b35 Binary files /dev/null and b/webedit/icons/em/47.gif differ diff --git a/webedit/icons/em/48.gif b/webedit/icons/em/48.gif new file mode 100644 index 0000000..7467a5a Binary files /dev/null and b/webedit/icons/em/48.gif differ diff --git a/webedit/icons/em/49.gif b/webedit/icons/em/49.gif new file mode 100644 index 0000000..3baf57d Binary files /dev/null and b/webedit/icons/em/49.gif differ diff --git a/webedit/icons/em/5.gif b/webedit/icons/em/5.gif new file mode 100644 index 0000000..50e0967 Binary files /dev/null and b/webedit/icons/em/5.gif differ diff --git a/webedit/icons/em/50.gif b/webedit/icons/em/50.gif new file mode 100644 index 0000000..f9e49d6 Binary files /dev/null and b/webedit/icons/em/50.gif differ diff --git a/webedit/icons/em/51.gif b/webedit/icons/em/51.gif new file mode 100644 index 0000000..2bcbccd Binary files /dev/null and b/webedit/icons/em/51.gif differ diff --git a/webedit/icons/em/52.gif b/webedit/icons/em/52.gif new file mode 100644 index 0000000..72e7ecd Binary files /dev/null and b/webedit/icons/em/52.gif differ diff --git a/webedit/icons/em/53.gif b/webedit/icons/em/53.gif new file mode 100644 index 0000000..91f1e96 Binary files /dev/null and b/webedit/icons/em/53.gif differ diff --git a/webedit/icons/em/54.gif b/webedit/icons/em/54.gif new file mode 100644 index 0000000..3b0b8d3 Binary files /dev/null and b/webedit/icons/em/54.gif differ diff --git a/webedit/icons/em/55.gif b/webedit/icons/em/55.gif new file mode 100644 index 0000000..28679aa Binary files /dev/null and b/webedit/icons/em/55.gif differ diff --git a/webedit/icons/em/56.gif b/webedit/icons/em/56.gif new file mode 100644 index 0000000..9d46e29 Binary files /dev/null and b/webedit/icons/em/56.gif differ diff --git a/webedit/icons/em/57.gif b/webedit/icons/em/57.gif new file mode 100644 index 0000000..94540e8 Binary files /dev/null and b/webedit/icons/em/57.gif differ diff --git a/webedit/icons/em/58.gif b/webedit/icons/em/58.gif new file mode 100644 index 0000000..4f7cefd Binary files /dev/null and b/webedit/icons/em/58.gif differ diff --git a/webedit/icons/em/59.gif b/webedit/icons/em/59.gif new file mode 100644 index 0000000..6324cf1 Binary files /dev/null and b/webedit/icons/em/59.gif differ diff --git a/webedit/icons/em/6.gif b/webedit/icons/em/6.gif new file mode 100644 index 0000000..e39f4cf Binary files /dev/null and b/webedit/icons/em/6.gif differ diff --git a/webedit/icons/em/60.gif b/webedit/icons/em/60.gif new file mode 100644 index 0000000..83f4010 Binary files /dev/null and b/webedit/icons/em/60.gif differ diff --git a/webedit/icons/em/61.gif b/webedit/icons/em/61.gif new file mode 100644 index 0000000..5c297e3 Binary files /dev/null and b/webedit/icons/em/61.gif differ diff --git a/webedit/icons/em/62.gif b/webedit/icons/em/62.gif new file mode 100644 index 0000000..71c0c89 Binary files /dev/null and b/webedit/icons/em/62.gif differ diff --git a/webedit/icons/em/63.gif b/webedit/icons/em/63.gif new file mode 100644 index 0000000..a66a51b Binary files /dev/null and b/webedit/icons/em/63.gif differ diff --git a/webedit/icons/em/64.gif b/webedit/icons/em/64.gif new file mode 100644 index 0000000..e5cb6ca Binary files /dev/null and b/webedit/icons/em/64.gif differ diff --git a/webedit/icons/em/65.gif b/webedit/icons/em/65.gif new file mode 100644 index 0000000..027f28e Binary files /dev/null and b/webedit/icons/em/65.gif differ diff --git a/webedit/icons/em/66.gif b/webedit/icons/em/66.gif new file mode 100644 index 0000000..faca980 Binary files /dev/null and b/webedit/icons/em/66.gif differ diff --git a/webedit/icons/em/67.gif b/webedit/icons/em/67.gif new file mode 100644 index 0000000..42bd453 Binary files /dev/null and b/webedit/icons/em/67.gif differ diff --git a/webedit/icons/em/68.gif b/webedit/icons/em/68.gif new file mode 100644 index 0000000..2143451 Binary files /dev/null and b/webedit/icons/em/68.gif differ diff --git a/webedit/icons/em/69.gif b/webedit/icons/em/69.gif new file mode 100644 index 0000000..0f9a4de Binary files /dev/null and b/webedit/icons/em/69.gif differ diff --git a/webedit/icons/em/7.gif b/webedit/icons/em/7.gif new file mode 100644 index 0000000..330fc95 Binary files /dev/null and b/webedit/icons/em/7.gif differ diff --git a/webedit/icons/em/70.gif b/webedit/icons/em/70.gif new file mode 100644 index 0000000..c107a14 Binary files /dev/null and b/webedit/icons/em/70.gif differ diff --git a/webedit/icons/em/71.gif b/webedit/icons/em/71.gif new file mode 100644 index 0000000..62618d6 Binary files /dev/null and b/webedit/icons/em/71.gif differ diff --git a/webedit/icons/em/72.gif b/webedit/icons/em/72.gif new file mode 100644 index 0000000..6764e32 Binary files /dev/null and b/webedit/icons/em/72.gif differ diff --git a/webedit/icons/em/73.gif b/webedit/icons/em/73.gif new file mode 100644 index 0000000..29ecc58 Binary files /dev/null and b/webedit/icons/em/73.gif differ diff --git a/webedit/icons/em/74.gif b/webedit/icons/em/74.gif new file mode 100644 index 0000000..18d684e Binary files /dev/null and b/webedit/icons/em/74.gif differ diff --git a/webedit/icons/em/75.gif b/webedit/icons/em/75.gif new file mode 100644 index 0000000..18a7b92 Binary files /dev/null and b/webedit/icons/em/75.gif differ diff --git a/webedit/icons/em/76.gif b/webedit/icons/em/76.gif new file mode 100644 index 0000000..ebdb2c9 Binary files /dev/null and b/webedit/icons/em/76.gif differ diff --git a/webedit/icons/em/77.gif b/webedit/icons/em/77.gif new file mode 100644 index 0000000..0a996d5 Binary files /dev/null and b/webedit/icons/em/77.gif differ diff --git a/webedit/icons/em/78.gif b/webedit/icons/em/78.gif new file mode 100644 index 0000000..972a21d Binary files /dev/null and b/webedit/icons/em/78.gif differ diff --git a/webedit/icons/em/79.gif b/webedit/icons/em/79.gif new file mode 100644 index 0000000..3fa89d8 Binary files /dev/null and b/webedit/icons/em/79.gif differ diff --git a/webedit/icons/em/8.gif b/webedit/icons/em/8.gif new file mode 100644 index 0000000..b573e9b Binary files /dev/null and b/webedit/icons/em/8.gif differ diff --git a/webedit/icons/em/80.gif b/webedit/icons/em/80.gif new file mode 100644 index 0000000..84e3ca4 Binary files /dev/null and b/webedit/icons/em/80.gif differ diff --git a/webedit/icons/em/9.gif b/webedit/icons/em/9.gif new file mode 100644 index 0000000..1521dd4 Binary files /dev/null and b/webedit/icons/em/9.gif differ diff --git a/webedit/icons/fullscreen.png b/webedit/icons/fullscreen.png new file mode 100644 index 0000000..4111243 Binary files /dev/null and b/webedit/icons/fullscreen.png differ diff --git a/webedit/icons/fullscreen_actual.png b/webedit/icons/fullscreen_actual.png new file mode 100644 index 0000000..60de27e Binary files /dev/null and b/webedit/icons/fullscreen_actual.png differ diff --git a/webedit/icons/imageUpload/add.gif b/webedit/icons/imageUpload/add.gif new file mode 100644 index 0000000..5db2a66 Binary files /dev/null and b/webedit/icons/imageUpload/add.gif differ diff --git a/webedit/icons/imageUpload/add_image_button.gif b/webedit/icons/imageUpload/add_image_button.gif new file mode 100644 index 0000000..8533618 Binary files /dev/null and b/webedit/icons/imageUpload/add_image_button.gif differ diff --git a/webedit/icons/imageUpload/cross-small.png b/webedit/icons/imageUpload/cross-small.png new file mode 100644 index 0000000..2de4c12 Binary files /dev/null and b/webedit/icons/imageUpload/cross-small.png differ diff --git a/webedit/icons/imageUpload/delete.png b/webedit/icons/imageUpload/delete.png new file mode 100644 index 0000000..8f11cfc Binary files /dev/null and b/webedit/icons/imageUpload/delete.png differ diff --git a/webedit/icons/imageUpload/dot.gif b/webedit/icons/imageUpload/dot.gif new file mode 100644 index 0000000..1d11fa9 Binary files /dev/null and b/webedit/icons/imageUpload/dot.gif differ diff --git a/webedit/icons/imageUpload/loader.gif b/webedit/icons/imageUpload/loader.gif new file mode 100644 index 0000000..d42f72c Binary files /dev/null and b/webedit/icons/imageUpload/loader.gif differ diff --git a/webedit/icons/imageUpload/marker_bottom.gif b/webedit/icons/imageUpload/marker_bottom.gif new file mode 100644 index 0000000..daa101c Binary files /dev/null and b/webedit/icons/imageUpload/marker_bottom.gif differ diff --git a/webedit/icons/imageUpload/marker_middle.gif b/webedit/icons/imageUpload/marker_middle.gif new file mode 100644 index 0000000..a854393 Binary files /dev/null and b/webedit/icons/imageUpload/marker_middle.gif differ diff --git a/webedit/icons/imageUpload/marker_top.gif b/webedit/icons/imageUpload/marker_top.gif new file mode 100644 index 0000000..daa101c Binary files /dev/null and b/webedit/icons/imageUpload/marker_top.gif differ diff --git a/webedit/icons/imageUpload/mouse_drag_img.gif b/webedit/icons/imageUpload/mouse_drag_img.gif new file mode 100644 index 0000000..4cd7fe1 Binary files /dev/null and b/webedit/icons/imageUpload/mouse_drag_img.gif differ diff --git a/webedit/icons/imageUpload/remove_all.gif b/webedit/icons/imageUpload/remove_all.gif new file mode 100644 index 0000000..fcda632 Binary files /dev/null and b/webedit/icons/imageUpload/remove_all.gif differ diff --git a/webedit/icons/image_align_center.png b/webedit/icons/image_align_center.png new file mode 100644 index 0000000..d2ee3ba Binary files /dev/null and b/webedit/icons/image_align_center.png differ diff --git a/webedit/icons/image_align_left.png b/webedit/icons/image_align_left.png new file mode 100644 index 0000000..7195ef7 Binary files /dev/null and b/webedit/icons/image_align_left.png differ diff --git a/webedit/icons/image_align_left_wt.png b/webedit/icons/image_align_left_wt.png new file mode 100644 index 0000000..7cc2f5a Binary files /dev/null and b/webedit/icons/image_align_left_wt.png differ diff --git a/webedit/icons/image_align_right.png b/webedit/icons/image_align_right.png new file mode 100644 index 0000000..2705dcb Binary files /dev/null and b/webedit/icons/image_align_right.png differ diff --git a/webedit/icons/image_align_right_wt.png b/webedit/icons/image_align_right_wt.png new file mode 100644 index 0000000..16b0cf6 Binary files /dev/null and b/webedit/icons/image_align_right_wt.png differ diff --git a/webedit/icons/image_resize.png b/webedit/icons/image_resize.png new file mode 100644 index 0000000..a1eb719 Binary files /dev/null and b/webedit/icons/image_resize.png differ diff --git a/webedit/icons/image_wrap_text.png b/webedit/icons/image_wrap_text.png new file mode 100644 index 0000000..7cc2f5a Binary files /dev/null and b/webedit/icons/image_wrap_text.png differ diff --git a/webedit/icons/magnifier-zoom.png b/webedit/icons/magnifier-zoom.png new file mode 100644 index 0000000..77e0305 Binary files /dev/null and b/webedit/icons/magnifier-zoom.png differ diff --git a/webedit/icons/readonlymode.png b/webedit/icons/readonlymode.png new file mode 100644 index 0000000..f1c5c24 Binary files /dev/null and b/webedit/icons/readonlymode.png differ diff --git a/webedit/icons/remove_col.png b/webedit/icons/remove_col.png new file mode 100644 index 0000000..2193ade Binary files /dev/null and b/webedit/icons/remove_col.png differ diff --git a/webedit/icons/remove_cols.png b/webedit/icons/remove_cols.png new file mode 100644 index 0000000..fdbfcd9 Binary files /dev/null and b/webedit/icons/remove_cols.png differ diff --git a/webedit/icons/remove_row.png b/webedit/icons/remove_row.png new file mode 100644 index 0000000..8a82c6b Binary files /dev/null and b/webedit/icons/remove_row.png differ diff --git a/webedit/icons/remove_rows.png b/webedit/icons/remove_rows.png new file mode 100644 index 0000000..e2d9588 Binary files /dev/null and b/webedit/icons/remove_rows.png differ diff --git a/webedit/icons/splitter.gif b/webedit/icons/splitter.gif new file mode 100644 index 0000000..660bb40 Binary files /dev/null and b/webedit/icons/splitter.gif differ diff --git a/webedit/icons/statusbar_bgline.gif b/webedit/icons/statusbar_bgline.gif new file mode 100644 index 0000000..850fdec Binary files /dev/null and b/webedit/icons/statusbar_bgline.gif differ diff --git a/webedit/icons/table_delete_cell.png b/webedit/icons/table_delete_cell.png new file mode 100644 index 0000000..38dfcec Binary files /dev/null and b/webedit/icons/table_delete_cell.png differ diff --git a/webedit/icons/table_delete_column.png b/webedit/icons/table_delete_column.png new file mode 100644 index 0000000..ea515ca Binary files /dev/null and b/webedit/icons/table_delete_column.png differ diff --git a/webedit/icons/table_delete_row.png b/webedit/icons/table_delete_row.png new file mode 100644 index 0000000..cb4083c Binary files /dev/null and b/webedit/icons/table_delete_row.png differ diff --git a/webedit/icons/table_insert_cell.png b/webedit/icons/table_insert_cell.png new file mode 100644 index 0000000..bc70ca0 Binary files /dev/null and b/webedit/icons/table_insert_cell.png differ diff --git a/webedit/icons/table_insert_column.png b/webedit/icons/table_insert_column.png new file mode 100644 index 0000000..a2f7f5a Binary files /dev/null and b/webedit/icons/table_insert_column.png differ diff --git a/webedit/icons/table_insert_row.png b/webedit/icons/table_insert_row.png new file mode 100644 index 0000000..dda90a3 Binary files /dev/null and b/webedit/icons/table_insert_row.png differ diff --git a/webedit/icons/table_join.png b/webedit/icons/table_join.png new file mode 100644 index 0000000..a5c0f9d Binary files /dev/null and b/webedit/icons/table_join.png differ diff --git a/webedit/icons/table_join_column.png b/webedit/icons/table_join_column.png new file mode 100644 index 0000000..830afd9 Binary files /dev/null and b/webedit/icons/table_join_column.png differ diff --git a/webedit/icons/table_join_row.png b/webedit/icons/table_join_row.png new file mode 100644 index 0000000..c77e75c Binary files /dev/null and b/webedit/icons/table_join_row.png differ diff --git a/webedit/icons/table_split_column.png b/webedit/icons/table_split_column.png new file mode 100644 index 0000000..f7dc6c1 Binary files /dev/null and b/webedit/icons/table_split_column.png differ diff --git a/webedit/icons/table_split_row.png b/webedit/icons/table_split_row.png new file mode 100644 index 0000000..55b822e Binary files /dev/null and b/webedit/icons/table_split_row.png differ diff --git a/webedit/icons/title_bar_bg.gif b/webedit/icons/title_bar_bg.gif new file mode 100644 index 0000000..13e7866 Binary files /dev/null and b/webedit/icons/title_bar_bg.gif differ diff --git a/webedit/icons/title_bar_bg2.gif b/webedit/icons/title_bar_bg2.gif new file mode 100644 index 0000000..86617c6 Binary files /dev/null and b/webedit/icons/title_bar_bg2.gif differ diff --git a/webedit/icons/toolbar-background.png b/webedit/icons/toolbar-background.png new file mode 100644 index 0000000..22de622 Binary files /dev/null and b/webedit/icons/toolbar-background.png differ diff --git a/webedit/icons/toolbar-disable.png b/webedit/icons/toolbar-disable.png new file mode 100644 index 0000000..c7ef225 Binary files /dev/null and b/webedit/icons/toolbar-disable.png differ diff --git a/webedit/icons/toolbar-wrapper-bg.png b/webedit/icons/toolbar-wrapper-bg.png new file mode 100644 index 0000000..f3c1f75 Binary files /dev/null and b/webedit/icons/toolbar-wrapper-bg.png differ diff --git a/webedit/icons/toolbar.png b/webedit/icons/toolbar.png new file mode 100644 index 0000000..6c81e88 Binary files /dev/null and b/webedit/icons/toolbar.png differ diff --git a/webedit/icons/viewmode_code.png b/webedit/icons/viewmode_code.png new file mode 100644 index 0000000..b046f16 Binary files /dev/null and b/webedit/icons/viewmode_code.png differ diff --git a/webedit/icons/viewmode_preview.png b/webedit/icons/viewmode_preview.png new file mode 100644 index 0000000..bd6df17 Binary files /dev/null and b/webedit/icons/viewmode_preview.png differ diff --git a/webedit/imageUpload/config.php b/webedit/imageUpload/config.php new file mode 100644 index 0000000..07ba886 --- /dev/null +++ b/webedit/imageUpload/config.php @@ -0,0 +1,31 @@ + \ No newline at end of file diff --git a/webedit/imageUpload/delete.php b/webedit/imageUpload/delete.php new file mode 100644 index 0000000..0da4093 --- /dev/null +++ b/webedit/imageUpload/delete.php @@ -0,0 +1,20 @@ + \ No newline at end of file diff --git a/webedit/imageUpload/upload.php b/webedit/imageUpload/upload.php new file mode 100644 index 0000000..eaeefa1 --- /dev/null +++ b/webedit/imageUpload/upload.php @@ -0,0 +1,66 @@ + \ No newline at end of file diff --git a/webedit/imageUpload/upload_flash.php b/webedit/imageUpload/upload_flash.php new file mode 100644 index 0000000..ec26b04 --- /dev/null +++ b/webedit/imageUpload/upload_flash.php @@ -0,0 +1,47 @@ + \ No newline at end of file diff --git a/webedit/popup/color_picker.html b/webedit/popup/color_picker.html new file mode 100644 index 0000000..dc972df --- /dev/null +++ b/webedit/popup/color_picker.html @@ -0,0 +1,19 @@ + + + +CHEditor + + + + + + + +
+
현재 셀 색상:
+
+ +
+
+ + \ No newline at end of file diff --git a/webedit/popup/flash.html b/webedit/popup/flash.html new file mode 100644 index 0000000..f7fc1d0 --- /dev/null +++ b/webedit/popup/flash.html @@ -0,0 +1,23 @@ + + + +CHEditor + + + + + + + +
+
+ <동영상 소스 코드> iframe 또는 object 태그를 입력하세요. +
+ +
+
+
+
+
+ + \ No newline at end of file diff --git a/webedit/popup/flash/ImagePreview.swf b/webedit/popup/flash/ImagePreview.swf new file mode 100644 index 0000000..87e4f75 Binary files /dev/null and b/webedit/popup/flash/ImagePreview.swf differ diff --git a/webedit/popup/flash/chximage.swf b/webedit/popup/flash/chximage.swf new file mode 100644 index 0000000..f4e11c2 Binary files /dev/null and b/webedit/popup/flash/chximage.swf differ diff --git a/webedit/popup/google_map.html b/webedit/popup/google_map.html new file mode 100644 index 0000000..8b285fc --- /dev/null +++ b/webedit/popup/google_map.html @@ -0,0 +1,24 @@ + + + + CHEditor + + + + + + + + +
+ 찾을 주소: + + +
찾으실 도로명 주소, 지번 또는 건물명을 입력하세요.
+
+
+
+
+
+ + diff --git a/webedit/popup/icon.html b/webedit/popup/icon.html new file mode 100644 index 0000000..4d964e2 --- /dev/null +++ b/webedit/popup/icon.html @@ -0,0 +1,16 @@ + + + + CHEditor + + + + + + + +
+
+
+ + \ No newline at end of file diff --git a/webedit/popup/image.html b/webedit/popup/image.html new file mode 100644 index 0000000..66a1021 --- /dev/null +++ b/webedit/popup/image.html @@ -0,0 +1,76 @@ + + + + CHEditor + + + + + + + + +
+
+ + + + + +
+ + +
+  (사진을 드래그하여 순서를 바꿀 수 있습니다.) + 0장 / 최대 장 사진 +
+
+
+
+
사진 정보
+
+
가로: 0
+
세로: 0
+
이름: 없음
+
+
+
+
정렬
+
+ + + + + + +
+
+ +
+
+ +
+
+ +
+
+ 한줄에 한 장씩 넣기 +
+
+ 사진 여백 넣기 +
+
+ (전체 사진에 적용됨) +
+
+
+
+
+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/webedit/popup/image.html5.html b/webedit/popup/image.html5.html new file mode 100644 index 0000000..b66a48b --- /dev/null +++ b/webedit/popup/image.html5.html @@ -0,0 +1,73 @@ + + + + CHEditor + + + + + + + +
+
+
+ + + image button + (사진을 점선 안으로 끌어 놓을 수 있습니다.) + 0장 / 최대 장 사진 +
+
+
+
+
사진 정보
+
+
가로: 0
+
세로: 0
+
이름: 없음
+
+
+
+
정렬
+
+ + + + + + +
+
+ +
+
+ +
+
+ +
+
+ 한줄에 한 장씩 넣기 +
+
+ 사진 여백 넣기 +
+
+ (전체 사진에 적용됨) +
+
+
+
+
+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/webedit/popup/image_url.html b/webedit/popup/image_url.html new file mode 100644 index 0000000..7dc3f60 --- /dev/null +++ b/webedit/popup/image_url.html @@ -0,0 +1,34 @@ + + + + CHEditor + + + + + + + + +
+
0 X 0
+
+
사진 URL +
+ +
+
+
+
레이아웃 +
+
+ + + +
+
+
+
+
+ + diff --git a/webedit/popup/js/AC_OETags.js b/webedit/popup/js/AC_OETags.js new file mode 100644 index 0000000..ab06d49 --- /dev/null +++ b/webedit/popup/js/AC_OETags.js @@ -0,0 +1,247 @@ +// Flash Player Version Detection - Rev 1.5 +// Detect Client Browser type +// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved. +// Modified: chna@chcode.com + +var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; +var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; +var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; + +function errMaxFileSize (MaxFileSize) { + alert("선택하신 파일 크기가 너무 큽니다. 최대 전송 크기는 "+MaxFileSize+" MB 입니다."); +} + +function ControlVersion() +{ + var version = 0; + var axo; +// var e; + try { + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); + version = axo.GetVariable("$version"); + } catch (e) {} + + if (!version) + { + try { + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); + version = "WIN 6,0,21,0"; + axo.AllowScriptAccess = "always"; + version = axo.GetVariable("$version"); + + } catch (e) {} + } + + if (!version) + { + try { + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); + version = axo.GetVariable("$version"); + } catch (e) {} + } + + if (!version) + { + try { + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); + version = "WIN 3,0,18,0"; + } catch (e) {} + } + + if (!version) + { + try { + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); + version = "WIN 2,0,0,11"; + } catch (e) { + version = -1; + } + } + + return version; +} + +function GetSwfVer(){ + var flashVer = -1; + if (navigator.plugins != null && navigator.plugins.length > 0) { + if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { + var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; + var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; + var descArray = flashDescription.split(" "); + var tempArrayMajor = descArray[2].split("."); + var versionMajor = tempArrayMajor[0]; + var versionMinor = tempArrayMajor[1]; + if ( descArray[3] != "" ) { + tempArrayMinor = descArray[3].split("r"); + } else { + tempArrayMinor = descArray[4].split("r"); + } + var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0; + flashVer = versionMajor + "." + versionMinor + "." + versionRevision; + } + } + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4; + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3; + else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2; + else if ( isIE && isWin && !isOpera ) { + flashVer = ControlVersion(); + } + return flashVer; +} + +function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) +{ + versionStr = GetSwfVer(); + if (versionStr == -1 ) { + return false; + } else if (versionStr != 0) { + if(isIE && isWin && !isOpera) { + tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"] + tempString = tempArray[1]; // "2,0,0,11" + versionArray = tempString.split(","); // ['2', '0', '0', '11'] + } else { + versionArray = versionStr.split("."); + } + var versionMajor = versionArray[0]; + var versionMinor = versionArray[1]; + var versionRevision = versionArray[2]; + + if (versionMajor > parseFloat(reqMajorVer)) { + return true; + } + else if (versionMajor == parseFloat(reqMajorVer)) { + if (versionMinor > parseFloat(reqMinorVer)) + return true; + else if (versionMinor == parseFloat(reqMinorVer)) { + if (versionRevision >= parseFloat(reqRevision)) + return true; + } + } + return false; + } +} + +function AC_AddExtension(src, ext) +{ + if (src.indexOf('?') != -1) + return src.replace(/\?/, ext+'?'); + else + return src + ext; +} + +function AC_Generateobj(objAttrs, params, embedAttrs) +{ + var str = ''; + if (isIE && isWin && !isOpera) + { + str += ''; + breakpoint = false; + } + str += ''; + } else { + str += '"); + div.innerHTML = "<" + str.substr(0, pos) + ">"; + embed = div.firstChild; + } + else { + div.innerHTML = elem; + var object = div.getElementsByTagName('OBJECT')[0]; + if (object && object.hasChildNodes()) { + var child = object.firstChild; + var movieHeight, movieWidth, i; + movieWidth = (isNaN(object.width) != true) ? object.width : 320; + movieHeight = (isNaN(object.height)!= true) ? object.height: 240; + var params = []; + + do { + if ((child.nodeName === 'PARAM') && (typeof child.name !== 'undefined') && (typeof child.value !== 'undefined')) + { + params.push({key: (child.name == 'movie') ? 'src' : child.name, val: child.value}); + } + child = child.nextSibling; + } + while (child); + + if (params.length > 0) { + embed = document.createElement('embed'); + embed.setAttribute("width", movieWidth); + embed.setAttribute("height", movieHeight); + + for (i=0; i 40 && (i % 10) === 0) { + br = document.createElement('br'); + block.appendChild(br); + } + + img = new Image(); + img.src = path + (i+1) + ".gif"; + img.style.width = '16px'; + img.style.height = '16px'; + img.style.margin = '5px 4px'; + img.style.verticalAlign = 'middle'; + img.setAttribute('alt', 'Emotion Icon'); + img.setAttribute('border', "0"); + img.className = 'handCursor'; + img.onclick = insertIcon; + block.appendChild(img); + } +} + +function init(dialog) { + oEditor = this; + oEditor.dialog = dialog; + var button = [ { alt : "", img : 'cancel.gif', cmd : popupClose } ]; + var dlg = new Dialog(oEditor); + showContents(); + dlg.showButton(button); + dlg.setDialogHeight(); +} diff --git a/webedit/popup/js/image.html5.js b/webedit/popup/js/image.html5.js new file mode 100644 index 0000000..6b2a4e1 --- /dev/null +++ b/webedit/popup/js/image.html5.js @@ -0,0 +1,972 @@ +// ================================================================ +// CHEditor 5 +// ---------------------------------------------------------------- +// Homepage: http://www.chcode.com +// Copyright (c) 1997-2015 CHSOFT +// ================================================================ +var UploadScript = ""; +var DeleteScript = ""; + +var activeImage = false; +var readyToMove = false; +var moveTimer = -1; +var dragDropDiv; +var insertionMarker; +var hideTimer = null; + +var offsetX_marker = -3; +var offsetY_marker = -3; + +var geckoOffsetX_marker = -3; +var geckoOffsetY_marker = -1; + +var destinationObject = false; + +var divXPositions = []; +var divYPositions = []; +var divWidth = []; +var divHeight = []; + +var tmpLeft = 0; +var tmpTop = 0; + +var eventDiff_x = 0; +var eventDiff_y = 0; + +var modifyImages = []; +var uploadMaxNumber = 12; +var imageCompleted = 0; +var imageCompletedList = []; +var UploadImagePath = ""; +var ShowThumbnailSize = { width: 120, height: 90 }; +var oEditor = null; +var button; + +var imageResizeWidth = 0; +var makeThumbnail = true; +var makeThumbnailWidth = 120; +var makeThumbnailHeight = 90; +var browser = null; + +function createInsertionMaker() { + var wrapper = document.getElementById('insertionMarker'); + var topIco = new Image(); + topIco.src = UploadImagePath + '/marker_top.gif'; + topIco.style.width = '6px'; + topIco.style.height = '1px'; + wrapper.appendChild(topIco); + + var middleIco = new Image(); + middleIco.src = UploadImagePath + '/marker_middle.gif'; + middleIco.style.height = '96px'; + middleIco.style.width = '6px'; + wrapper.appendChild(middleIco); + + var bottomIco = new Image(); + bottomIco.src = UploadImagePath + '/marker_bottom.gif'; + bottomIco.style.width = '6px'; + bottomIco.style.height = '1px'; + wrapper.appendChild(bottomIco); +} + +function popupClose() { +// ---------------------------------------------------------------------------------- + oEditor.popupWinCancel(); +} + +function showContents() { + var spacer = function(id) { + var clear = document.createElement('div'); + clear.style.height = '0px'; + clear.style.width = '0px'; + clear.className = 'clear'; + clear.id = 'spacer' + id; + + return clear; + }; + + var spacerNo = 1, i, imgBox, theImg, lastSpacer; + for (i=0; i 0 && ((i % 4) === 0)) { + document.getElementById('imageListWrapper').appendChild(spacer(spacerNo++)); + } + + imgBox = document.createElement('div'); + imgBox.id = 'imgBox' + i; + imgBox.className = 'imageBox'; + theImg = document.createElement('div'); + theImg.id = 'img_' + i; + theImg.className = 'imageBox_theImage'; + imgBox.appendChild(theImg); + + document.getElementById('imageListWrapper').appendChild(imgBox); + if (i === (uploadMaxNumber-1)) { + lastSpacer = spacer(spacerNo); + lastSpacer.style.height = "7px"; + document.getElementById('imageListWrapper').appendChild(lastSpacer); + } + } + + document.getElementById('imageListWrapper').style.padding = '5px 7px 0px 5px'; + document.getElementById('imageInfoBox').style.height = '298px'; + document.getElementById('imageInfoBox').style.width = '130px'; +} + +function setImageCount() { + imageCompleted++; + document.getElementById('imageCount').innerHTML = imageCompleted; +} + +function getImageCount() { + return imageCompleted; +} + +function allowedMaxImage() { + return uploadMaxNumber - getImageCount(); +} + +function getUploadedCount() { + return document.getElementById('imageListWrapper').getElementsByTagName('img').length; +} + +function uploadedImageCount() { + imageCompleted = getUploadedCount(); + document.getElementById('imageCount').innerHTML = imageCompleted; +} + +function uploadError(msg) { + alert(msg); +} + +function getTopPos(inputObj) { +// ---------------------------------------------------------------------------------- + var returnValue = inputObj.offsetTop; + + inputObj = inputObj.offsetParent; + while (inputObj) { + if (inputObj.tagName.toLowerCase() !== 'html') { + returnValue += (inputObj.offsetTop - inputObj.scrollTop); + if (browser.msie) { + returnValue += inputObj.clientTop; + } + } + inputObj = inputObj.offsetParent; + } + return returnValue; +} + +function getLeftPos(inputObj) { +// ---------------------------------------------------------------------------------- + var returnValue = inputObj.offsetLeft; + + inputObj = inputObj.offsetParent; + while (inputObj) { + if (inputObj.id !== 'imageListWrapper') { + returnValue += inputObj.offsetLeft; + } + inputObj = inputObj.offsetParent; + } + return returnValue; +} + +function getDivCoordinates() { +// ---------------------------------------------------------------------------------- + var imgBox = document.getElementById('imageListWrapper').getElementsByTagName('DIV'); + var i; + for (i=0; i < imgBox.length; i++) { + if ((imgBox[i].className === 'imageBox' || imgBox[i].className === 'imageBoxHighlighted') && imgBox[i].id) + { + divXPositions[imgBox[i].id] = getLeftPos(imgBox[i]); + divYPositions[imgBox[i].id] = getTopPos(imgBox[i]); + divWidth[imgBox[i].id] = imgBox[i].offsetWidth; + divHeight[imgBox[i].id] = imgBox[i].offsetHeight; + } + } +} + +function reOrder() { +// ---------------------------------------------------------------------------------- + var wrapper = document.getElementById('imageListWrapper'); + var imgBox = wrapper.getElementsByTagName('div'); + var imgNum = 0, i, spacer, breakline = []; + + for (i=0; i < imgBox.length; i++) { + if (imgBox[i].id.indexOf('imgBox') === -1) { + continue; + } + + imgBox[i].className = 'imageBox'; + imgBox[i].firstChild.className = 'imageBox_theImage'; + + if (imgNum > 0 && (imgNum % 4) === 0) { + breakline.push(imgBox[i].id); + } + + imgNum++; + } + + for (i=0; i ShowThumbnailSize.width || imgSize.height > ShowThumbnailSize.height) { + if (imgSize.width > imgSize.height) { + resizeW = (imgSize.width > ShowThumbnailSize.width) ? ShowThumbnailSize.width : imgSize.width; + resizeH = Math.round((imgSize.height * resizeW) / imgSize.width); + } + else { + resizeH = (imgSize.height > ShowThumbnailSize.height) ? ShowThumbnailSize.height : imgSize.height; + resizeW = Math.round((imgSize.width * resizeH) / imgSize.height); + } + + if (resizeH > ShowThumbnailSize.height) { + resizeH = (imgSize.height > ShowThumbnailSize.height) ? ShowThumbnailSize.height : imgSize.height; + resizeW = Math.round((imgSize.width * resizeH) / imgSize.height); + } + + } + else { + resizeW = imgSize.width; + resizeH = imgSize.height; + } + + img.style.width = resizeW - 2+ 'px'; + img.style.height = resizeH - 2+ 'px'; + img.style.margin = "1px"; + + if (resizeW < ShowThumbnailSize.width) { + M = ShowThumbnailSize.width - resizeW; + img.style.marginLeft = Math.round(M/2) + 'px'; + } + + if (resizeH < ShowThumbnailSize.height) { + M = ShowThumbnailSize.height - resizeH; + img.style.marginTop = Math.round(M/2) + 'px'; + } + + var elem = document.getElementById(boxId); + elem.style.backgroundImage = "url('"+UploadImagePath+"/dot.gif')"; + oEditor.addEvent(elem, 'mouseover', showDelete); + elem.onmouseout = function() { + this.className = 'imageBox_theImage'; + setImageInfo(0); + hideDelete(); + }; + + setImageCount(); +} + +function showUploadWindow() { +// ---------------------------------------------------------------------------------- + var uploadWindow = document.getElementById("uploadWindow"); + var uploadWindowWidth = 700; + var winWidth; + + if (!(oEditor.undefined(window.innerWidth))) { + winWidth = window.innerWidth; + } + else if (document.documentElement && (!(oEditor.undefined(document.documentElement.clientWidth))) && + document.documentElement.clientWidth !== 0) + { + winWidth = document.documentElement.clientWidth; + } + else if (document.body && (!(oEditor.undefined(document.body.clientWidth)))) { + winWidth = document.body.clientWidth; + } + else { + alert('현재 브라우저를 지원하지 않습니다.'); + return; + } + + var left = winWidth / 2 - (uploadWindowWidth / 2) + 'px'; + + uploadWindow.style.left = left; + uploadWindow.style.display = "block"; + uploadWindow.style.width = uploadWindowWidth + 'px'; + + if (modifyImages.length > 0) { + var el = document.getElementById('imageListWrapper').getElementsByTagName('DIV'); + var i, j, imgBox, img; + for (i=0; i < modifyImages.length; i++) { + if (i > 7) { + break; + } + + for (j=0; j < el.length; j++) { + imgBox = el[j]; + if (imgBox.className !== 'imageBox_theImage') { + continue; + } + + if (imgBox.firstChild && (imgBox.firstChild.src === modifyImages[i])) { + break; + } + + if (imgBox.firstChild === null) { + img = new Image(); + img.src = modifyImages[i]; + img.border = 0; + img.alt = ''; + img.style.width = '120px'; + img.style.height = '90px'; + imgBox.appendChild(img); + break; + } + } + } + } +} + +function removeImages() { + var images = [], i, j, theImage, img, remove; + document.body.appendChild(document.getElementById('removeImageButton')); + + for (i=0; i < uploadMaxNumber; i++) { + theImage = document.getElementById('img_'+i); + if (theImage.hasChildNodes() && theImage.firstChild.tagName.toLowerCase() === 'img') { + images.push(theImage); + } + } + + for (i=0; i= 0 && moveTimer < 10) { + moveTimer++; + setTimeout('startMoveTimer()', 8); + } + + if (moveTimer === 5) { + getDivCoordinates(); + var subElements = dragDropDiv.getElementsByTagName('div'); + if (subElements.length > 0) { + dragDropDiv.removeChild(subElements[0]); + } + + dragDropDiv.style.display = 'block'; + var newDiv = activeImage.cloneNode(true); + newDiv.className = 'imageBox'; + newDiv.style.opacity = 0.5; + + newDiv.id = ''; + newDiv.style.padding = '2px'; + dragDropDiv.appendChild(newDiv); + + dragDropDiv.style.top = tmpTop + 'px'; + dragDropDiv.style.left = tmpLeft + 'px'; + } + + return false; +} + +function selectImage(e) { +// ---------------------------------------------------------------------------------- + if (browser.msie) { + e = event; + } + + var el = this.parentNode.firstChild.firstChild; + if (!el) { + return; + } + + var obj = this.parentNode; + hideDelete(); + if (activeImage) { + activeImage.className = 'imageBox'; + } + + obj.className = 'imageBoxHighlighted'; + activeImage = obj; + readyToMove = true; + moveTimer = 0; + + tmpLeft = e.clientX + Math.max(document.body.scrollLeft,document.documentElement.scrollLeft); + tmpTop = e.clientY + Math.max(document.body.scrollTop,document.documentElement.scrollTop); + + startMoveTimer(); + return false; +} + +function dragDropEnd() { +// ---------------------------------------------------------------------------------- + readyToMove = false; + moveTimer = -1; + dragDropDiv.style.display = 'none'; + insertionMarker.style.display = 'none'; + + if (destinationObject && destinationObject !== activeImage) { + var parentObj = destinationObject.parentNode; + var chkObj = destinationObject.previousSibling; + var turn = false; + + if (chkObj === null) { + chkObj = document.getElementById('imageListWrapper').firstChild; + turn = true; + } + + if (chkObj.id.indexOf('spacer') !== -1) { + chkObj = chkObj.previousSibling; + } + + if (chkObj.firstChild.firstChild === null) { + reOrder(); + return; + } + + if (chkObj && chkObj.id !== null) { + while (chkObj) { + if (chkObj.firstChild.firstChild !== null) { + break; + } + chkObj = chkObj.previousSibling; + } + destinationObject = turn ? chkObj : chkObj.nextSibling; + } + + parentObj.insertBefore(activeImage, destinationObject); + reOrder(); + + activeImage.className = 'imageBox'; + activeImage = false; + destinationObject = false; + getDivCoordinates(); + return false; + } + return true; +} + +function dragDropMove(e) { +// ---------------------------------------------------------------------------------- + if (moveTimer === -1) { + return; + } + + if (browser.msie) { + e = window.event; + } + + var leftPos = e.clientX + document.documentElement.scrollLeft - eventDiff_x; + var topPos = e.clientY + document.documentElement.scrollTop - eventDiff_y; + dragDropDiv.style.top = topPos + 'px'; + dragDropDiv.style.left = leftPos + 'px'; + + leftPos = leftPos + eventDiff_x; + topPos = topPos + eventDiff_y; + + if (e.button !== 1 && browser.msie) { + dragDropEnd(); + } + + var elementFound = false, prop, offsetX, offsetY; + + for (prop in divXPositions) { + if (divXPositions[prop].className === 'clear') { + continue; + } + + if (divXPositions[prop] < leftPos && + (divXPositions[prop] + divWidth[prop] * 0.7) > leftPos && + divYPositions[prop] < topPos && + (divYPositions[prop] + divWidth[prop]) > topPos) + { + if (browser.msie) { + offsetX = offsetX_marker; + offsetY = offsetY_marker; + } + else { + offsetX = geckoOffsetX_marker; + offsetY = geckoOffsetY_marker; + } + + insertionMarker.style.top = divYPositions[prop] + offsetY + 'px'; + insertionMarker.style.left = divXPositions[prop] + offsetX + 'px'; + insertionMarker.style.display = 'block'; + destinationObject = document.getElementById(prop); + elementFound = true; + break; + } + } + + if (!elementFound) { + insertionMarker.style.display = 'none'; + destinationObject = false; + } + + return false; +} + +function saveImageOrder() { +// ---------------------------------------------------------------------------------- + var rData = []; + var objects = document.getElementById('imageListWrapper').getElementsByTagName('DIV'); + var i; + for (i=0; i < objects.length; i++) { + if (objects[i].className === 'imageBox' || + objects[i].className === 'imageBoxHighlighted') + { + rData.push(objects[i].id); + } + } + + return rData; +} + +function initGallery() { +// ---------------------------------------------------------------------------------- + var imgBox = document.getElementById('imageListWrapper').getElementsByTagName('DIV'); + var i; + for (i=0; i < imgBox.length; i++) { + if (imgBox[i].className === 'imageBox_theImage') { + imgBox[i].onmousedown = selectImage; + } + } + + document.body.onselectstart = cancelEvent; + document.body.ondragstart = cancelEvent; + document.body.onmouseup = dragDropEnd; + document.body.onmousemove = dragDropMove; + + dragDropDiv = document.getElementById('dragDropContent'); + insertionMarker = document.getElementById('insertionMarker'); + getDivCoordinates(); +} + +function doSubmit() { +// ---------------------------------------------------------------------------------- + var el = document.getElementById('imageListWrapper').getElementsByTagName('DIV'); + var imageArray = []; + var num = 0; + var fm_elem = document.getElementById('fm_alignment'); + var fm_align = fm_elem.alignment; + var img_align = 'top', i, imgBox; + var imgParagraph = fm_elem.para.checked; + var useSpacer = fm_elem.use_spacer.checked; + + for (i=0; i < fm_align.length; i++) { + if (fm_align[i].checked) { + img_align = fm_align[i].value; + break; + } + } + + for (i=0; i < el.length; i++) { + imgBox = el[i]; + if (imgBox.className !== 'imageBox_theImage') { + continue; + } + + if (imgBox.firstChild !== null) { + imageArray[num] = imageCompletedList[imgBox.id]; + + if (img_align === 'break' ) { + imageArray[num]['alt'] = "break"; + } + else { + imageArray[num]['alt'] = ""; + imageArray[num]['align'] = img_align; + } + + num++; + } + } + + if (imageArray.length > 0) { + oEditor.doInsertImage(imageArray, imgParagraph, useSpacer); + } + oEditor.popupWinClose(); +} + +var selectedFilesNum = 0; +var uploadedFiles = []; + +function getDateTime() { + var date = new Date(); + var year = date.getFullYear(); + var month = date.getMonth() + 1; + var day = date.getDate(); + var hours = date.getHours(); + var minutes = date.getMinutes(); + var seconds = date.getSeconds(); + return String(10000 * year + 100 * month + day + + ('0'+hours).slice(-2) + ('0'+minutes).slice(-2) + ('0'+seconds).slice(-2)); +} + +function makeFilename() { + var chars = "abcdefghiklmnopqrstuvwxyz"; + var len = 8; + var clen = chars.length; + var rData = '', i, rnum; + for (i=0; i 0 && origImage.width > imageResizeWidth) { + width = imageResizeWidth; + height = (imageResizeWidth / origImage.width) * origImage.height; + + canvas.width = width; + canvas.height = height; + canvas.getContext("2d").drawImage(origImage, 0, 0, width, height); + + var bitmapData = canvas.toDataURL(readerEvent.target.filetype); + data.append('filehtml5', bitmapData.replace(/^(.*)base64,/, '')); + } + else { + data.append('file', readerEvent.target.file); + } + + var fileFormat = readerEvent.target.filename.substring(readerEvent.target.filename.lastIndexOf('.')); + data.append('origname', readerEvent.target.filename); + data.append('randomname', makeFilename() + fileFormat.toLowerCase()); + + var el = document.getElementById('imageListWrapper').getElementsByTagName('div'); + var imgBox = null, imgInfo; + + xhr.onreadystatechange = function(xhrEvent) { + if (this.readyState === 4 && this.status === 200) { + var jsonText = decodeURI(oEditor.trimSpace(this.responseText)); + jsonText = jsonText.replace(/\+/g, ' ').replace(/\\/g, '\\\\'); + var jsonData = JSON.parse(jsonText); + var img = new Image(), i; + + img.onload = function() { + for (i=0; i < el.length; i++) { + imgBox = el[i]; + + if (imgBox.className !== 'imageBox_theImage') { + continue; + } + + if (!imgBox.firstChild || imgBox.firstChild.tagName.toLowerCase() !== 'img') { + imgInfo = { "width": this.width, + "height": this.height, + "fileName": jsonData.fileName, + "fileUrl": jsonData.fileUrl, + "origName": readerEvent.target.filename, + "filePath": jsonData.filePath, + "fileSize": jsonData.fileSize }; + + imageCompletedList[imgBox.id] = imgInfo; + imgComplete(this, imgInfo, imgBox.id); + imgBox.appendChild(img); + break; + } + } + + if (selectedFilesNum < uploadedFiles.length) { + doUpload(); + } + else { + uploadedFiles = []; + selectedFilesNum = 0; + } + }; + img.src = decodeURIComponent(jsonData.fileUrl); + } + }; + + selectedFilesNum++; + xhr.send(data); + }; + + origImage.src = readerEvent.target.result; + }; + + reader.file = file; + reader.filename = file.name; + reader.filetype = file.type; + reader.readAsDataURL(file); +} + +function fileSelect(selected) { + var files = selected.files; + var file, i, num = files.length; + + for (i=0; i < num; i++) { + file = files[i]; + if (!file.type.match('image.*')) { + fileFilterError(file.name); + continue; + } + + uploadedFiles.push(file); + } + + if (num < 1 || uploadedFiles.length < 1) { + return; + } + + startUpload(num); + doUpload(); + + var inputFile = document.getElementById('inputImageUpload'); + var theForm = document.createElement('form'); + var fileSelectButton = document.getElementById('fileSelectButton'); + theForm.appendChild(inputFile); + theForm.reset(); + fileSelectButton.parentNode.insertBefore(inputFile, fileSelectButton); + fileSelectButton.style.marginLeft = '-1px'; +} + +function fileSelectDrop(ev) { + oEditor.stopEvent(ev); + this.className = "imageListWrapperHtml5"; + + var files = ev.dataTransfer.files; + var file, i, num = files.length; + + for (i=0; i < num; i++) { + file = files[i]; + if (!file.type.match('image.*')) { + fileFilterError(file.name); + continue; + } + uploadedFiles.push(file); + } + + if (uploadedFiles.length < 1) { + return; + } + + startUpload(num); + doUpload(); +} + +function dragOver(ev) { + oEditor.stopEvent(ev); + this.className = "dragOver"; +} + +function dragOut(ev) { + oEditor.stopEvent(ev); + this.className = "imageListWrapperHtml5"; +} + +function init(dialog) { + oEditor = this; + oEditor.dialog = dialog; + var dlg = new Dialog(oEditor); + browser = oEditor.getBrowser(); + + UploadImagePath = oEditor.config.iconPath + 'imageUpload'; + uploadMaxNumber = oEditor.config.imgUploadNumber; + UploadScript = oEditor.config.editorPath + 'imageUpload/upload.php'; + DeleteScript = oEditor.config.editorPath + 'imageUpload/delete.php'; + + imageResizeWidth = oEditor.config.imgMaxWidth; + makeThumbnail = oEditor.config.makeThumbnail; + makeThumbnailWidth = oEditor.config.thumbnailWidth; + makeThumbnailHeight = oEditor.config.thumbnailHeight; + + document.getElementById("maxImageNum").appendChild(document.createTextNode(uploadMaxNumber)); + + button = [ { alt : "", img : 'submit.gif', cmd : doSubmit, hspace : 2 }, + { alt : "", img : 'cancel.gif', cmd : closeWindow, hspace : 2 } ]; + + dlg.setDialogHeight(370); + dlg.showButton(button); + showContents(); + initGallery(); + showUploadWindow(); + createInsertionMaker(); + + var dropTarget = document.getElementById("imageListWrapper"); + oEditor.addEvent(dropTarget, 'dragover', dragOver); + oEditor.addEvent(dropTarget, 'dragleave', dragOut); + oEditor.addEvent(dropTarget, 'drop', fileSelectDrop); + + var align = document.getElementById('fm_alignment'); + var i; + for (i=0; i 0 && ((i % 4) === 0)) { + document.getElementById('imageListWrapper').appendChild(spacer(spacerNo++)); + } + + imgBox = document.createElement('div'); + imgBox.id = 'imgBox' + i; + imgBox.className = 'imageBox'; + theImg = document.createElement('div'); + theImg.id = 'img_' + i; + theImg.className = 'imageBox_theImage'; + imgBox.appendChild(theImg); + + document.getElementById('imageListWrapper').appendChild(imgBox); + if (i === (uploadMaxNumber-1)) { + lastSpacer = spacer(spacerNo); + lastSpacer.style.height = "7px"; + document.getElementById('imageListWrapper').appendChild(lastSpacer); + } + } + + if (browser.msie && browser.ver < 7) { + document.getElementById('imageListWrapper').style.padding = '5px 2px 5px 2px'; + document.getElementById('imageInfoBox').style.height = '302px'; + document.getElementById('imageInfoBox').style.width = '124px'; + } + else { + document.getElementById('imageListWrapper').style.padding = '5px 7px 0px 5px'; + document.getElementById('imageInfoBox').style.height = '298px'; + document.getElementById('imageInfoBox').style.width = '130px'; + } +} + +function openFiles() { +// ---------------------------------------------------------------------------------- + var elem = browser.msie ? document.getElementById(AppID) : document[AppID]; + elem.AddFiles(); +} + +function setImageCount() { + imageCompleted++; + document.getElementById('imageCount').innerHTML = imageCompleted; +} + +function getImageCount() { + return imageCompleted; +} + +function allowedMaxImage() { + return uploadMaxNumber - getImageCount(); +} + +function getUploadedCount() { + return document.getElementById('imageListWrapper').getElementsByTagName('img').length; +} + +function uploadedImageCount() { + imageCompleted = getUploadedCount(); + document.getElementById('imageCount').innerHTML = imageCompleted; +} + +function uploadError(msg) { + alert(msg); +} + +function imageDelete(filePath) { + var chximage = document.getElementById(AppID); + chximage.ImageDelete(encodeURI(filePath)); +} + +function getTopPos(inputObj) { +// ---------------------------------------------------------------------------------- + var returnValue = inputObj.offsetTop; + + inputObj = inputObj.offsetParent; + while (inputObj) { + if (inputObj.tagName.toLowerCase() !== 'html') { + returnValue += (inputObj.offsetTop - inputObj.scrollTop); + if (browser.msie) { + returnValue += inputObj.clientTop; + } + } + inputObj = inputObj.offsetParent; + } + return returnValue; +} + +function getLeftPos(inputObj) { +// ---------------------------------------------------------------------------------- + var returnValue = inputObj.offsetLeft; + + inputObj = inputObj.offsetParent; + while (inputObj) { + if (inputObj.id !== 'imageListWrapper') { + returnValue += inputObj.offsetLeft; + if (browser.msie) { + returnValue += inputObj.clientLeft; + } + } + inputObj = inputObj.offsetParent; + } + return returnValue; +} + +function getDivCoordinates() { +// ---------------------------------------------------------------------------------- + var imgBox = document.getElementById('imageListWrapper').getElementsByTagName('DIV'); + var i; + for (i=0; i < imgBox.length; i++) { + if ((imgBox[i].className === 'imageBox' || imgBox[i].className === 'imageBoxHighlighted') && imgBox[i].id) + { + divXPositions[imgBox[i].id] = getLeftPos(imgBox[i]); + divYPositions[imgBox[i].id] = getTopPos(imgBox[i]); + divWidth[imgBox[i].id] = imgBox[i].offsetWidth; + divHeight[imgBox[i].id] = imgBox[i].offsetHeight; + } + } +} + +function reOrder() { +// ---------------------------------------------------------------------------------- + var wrapper = document.getElementById('imageListWrapper'); + var imgBox = wrapper.getElementsByTagName('div'); + var imgNum = 0, i, spacer, breakline = []; + + for (i=0; i < imgBox.length; i++) { + if (imgBox[i].id.indexOf('imgBox') === -1) { + continue; + } + + imgBox[i].className = 'imageBox'; + imgBox[i].firstChild.className = 'imageBox_theImage'; + + if (imgNum > 0 && (imgNum % 4) === 0) { + breakline.push(imgBox[i].id); + } + + imgNum++; + } + + for (i=0; i ShowThumbnailSize.width || imgSize.height > ShowThumbnailSize.height) { + if (imgSize.width > imgSize.height) { + resizeW = (imgSize.width > ShowThumbnailSize.width) ? ShowThumbnailSize.width : imgSize.width; + resizeH = Math.round((imgSize.height * resizeW) / imgSize.width); + } + else { + resizeH = (imgSize.height > ShowThumbnailSize.height) ? ShowThumbnailSize.height : imgSize.height; + resizeW = Math.round((imgSize.width * resizeH) / imgSize.height); + } + + if (resizeH > ShowThumbnailSize.height) { + resizeH = (imgSize.height > ShowThumbnailSize.height) ? ShowThumbnailSize.height : imgSize.height; + resizeW = Math.round((imgSize.width * resizeH) / imgSize.height); + } + + } + else { + resizeW = imgSize.width; + resizeH = imgSize.height; + } + + img.style.width = resizeW - 2+ 'px'; + img.style.height = resizeH - 2+ 'px'; + img.style.margin = "1px"; + + if (resizeW < ShowThumbnailSize.width) { + M = ShowThumbnailSize.width - resizeW; + img.style.marginLeft = Math.round(M/2) + 'px'; + } + + if (resizeH < ShowThumbnailSize.height) { + M = ShowThumbnailSize.height - resizeH; + img.style.marginTop = Math.round(M/2) + 'px'; + } + + var elem = document.getElementById(boxId); + elem.style.backgroundImage = "url('"+UploadImagePath+"/dot.gif')"; + elem.onmouseover = showDelete; + elem.onmouseout = function() { + this.className = 'imageBox_theImage'; + setImageInfo(0); + hideDelete(); + }; + + setImageCount(); +} + +function uploadComplete(image) { +// ---------------------------------------------------------------------------------- + image.filePath = decodeURI(image.filePath); + image.origName = decodeURI(image.origName); + + var el = document.getElementById('imageListWrapper').getElementsByTagName('div'); + var imgBox = null, tmpImg, i, imgInfo; + var imgOnLoad = function() { + imgInfo = { "width": image.width, "height": image.height, "fileSize": image.fileSize, + "fileUrl": image.fileUrl, "fileName": image.fileName, "filePath": image.filePath, "origName": image.origName }; + + imageCompletedList[imgBox.id] = imgInfo; + imgComplete(this, imgInfo, imgBox.id); + }; + + for (i=0; i < el.length; i++) { + imgBox = el[i]; + if (imgBox.className !== 'imageBox_theImage') { + continue; + } + + if (!imgBox.firstChild || imgBox.firstChild.tagName.toLowerCase() !== 'img') { + tmpImg = new Image(); + tmpImg.style.width = "0px"; + tmpImg.style.height = "0px"; + tmpImg.setAttribute("alt", image.origName); + tmpImg.onload = imgOnLoad; + tmpImg.src = image.fileUrl; + imgBox.appendChild(tmpImg); + break; + } + } +} + +function showUploadWindow() { +// ---------------------------------------------------------------------------------- + var uploadWindow = document.getElementById("uploadWindow"); + var uploadWindowWidth = 700; + var winWidth; + + if (typeof window.innerWidth !== 'undefined') { + winWidth = window.innerWidth; + } + else if (document.documentElement && typeof document.documentElement.clientWidth !== 'undefined' + && document.documentElement.clientWidth !== 0 ) + { + winWidth = document.documentElement.clientWidth; + } + else if (document.body && typeof document.body.clientWidth !== 'undefined') { + winWidth = document.body.clientWidth; + } + else { + alert('현재 브라우저를 지원하지 않습니다.'); + return; + } + + var left = winWidth / 2 - (uploadWindowWidth / 2) + 'px'; + + uploadWindow.style.left = left; + uploadWindow.style.display = "block"; + uploadWindow.style.width = uploadWindowWidth + 'px'; + + if (modifyImages.length > 0) { + var el = document.getElementById('imageListWrapper').getElementsByTagName('DIV'); + var i, j, imgBox, img; + for (i=0; i < modifyImages.length; i++) { + if (i > 7) { + break; + } + + for (j=0; j < el.length; j++) { + imgBox = el[j]; + if (imgBox.className !== 'imageBox_theImage') { + continue; + } + + if (imgBox.firstChild && (imgBox.firstChild.src == modifyImages[i])) { + break; + } + + if (imgBox.firstChild === null) { + img = new Image(); + img.src = modifyImages[i]; + img.border = 0; + img.alt = ''; + img.style.width = '120px'; + img.style.height = '90px'; + imgBox.appendChild(img); + break; + } + } + } + } +} + +function removeImages() { + var images = [], i, j, theImage, img, remove; + document.body.appendChild(document.getElementById('removeImageButton')); + + for (i=0; i < uploadMaxNumber; i++) { + theImage = document.getElementById('img_'+i); + if (theImage.hasChildNodes() && theImage.firstChild.tagName.toLowerCase() === 'img') { + images.push(theImage); + } + } + + for (i=0; i= 0 && moveTimer < 10) { + moveTimer++; + setTimeout('startMoveTimer()', 8); + } + + if (moveTimer === 5) { + getDivCoordinates(); + var subElements = dragDropDiv.getElementsByTagName('div'); + if (subElements.length > 0) { + dragDropDiv.removeChild(subElements[0]); + } + + dragDropDiv.style.display = 'block'; + var newDiv = activeImage.cloneNode(true); + newDiv.className = 'imageBox'; + if (browser.msie && browser.ver < 9) { + newDiv.style.filter = 'alpha(opacity=50)'; + } + else { + newDiv.style.opacity = 0.5; + } + + newDiv.id = ''; + newDiv.style.padding = '2px'; + dragDropDiv.appendChild(newDiv); + + dragDropDiv.style.top = tmpTop + 'px'; + dragDropDiv.style.left = tmpLeft + 'px'; + } + + return false; +} + +function selectImage(e) { +// ---------------------------------------------------------------------------------- + if (browser.msie) { + e = event; + } + + var el = this.parentNode.firstChild.firstChild; + if (!el) { + return; + } + + var obj = this.parentNode; + hideDelete(); + + if (activeImage) { + activeImage.className = 'imageBox'; + } + + obj.className = 'imageBoxHighlighted'; + activeImage = obj; + readyToMove = true; + moveTimer = 0; + + tmpLeft = e.clientX + Math.max(document.body.scrollLeft,document.documentElement.scrollLeft); + tmpTop = e.clientY + Math.max(document.body.scrollTop,document.documentElement.scrollTop); + + startMoveTimer(); + return false; +} + +function dragDropEnd() { +// ---------------------------------------------------------------------------------- + readyToMove = false; + moveTimer = -1; + dragDropDiv.style.display = 'none'; + insertionMarker.style.display = 'none'; + + if (destinationObject && destinationObject !== activeImage) { + var parentObj = destinationObject.parentNode; + var chkObj = destinationObject.previousSibling; + var turn = false; + + if (chkObj === null) { + chkObj = document.getElementById('imageListWrapper').firstChild; + turn = true; + } + + if (chkObj.id.indexOf('spacer') !== -1) { + chkObj = chkObj.previousSibling; + } + + if (chkObj.firstChild.firstChild === null) { + reOrder(); + return; + } + + if (chkObj && chkObj.id !== null) { + while (chkObj) { + if (chkObj.firstChild.firstChild != null) { + break; + } + chkObj = chkObj.previousSibling; + } + destinationObject = turn ? chkObj : chkObj.nextSibling; + } + + parentObj.insertBefore(activeImage, destinationObject); + reOrder(); + + activeImage.className = 'imageBox'; + activeImage = false; + destinationObject = false; + getDivCoordinates(); + return false; + } + return true; +} + +function dragDropMove(e) { +// ---------------------------------------------------------------------------------- + if (moveTimer === -1) { + return; + } + + if (browser.msie) { + e = window.event; + } + + var leftPos = e.clientX + document.documentElement.scrollLeft - eventDiff_x; + var topPos = e.clientY + document.documentElement.scrollTop - eventDiff_y; + dragDropDiv.style.top = topPos + 'px'; + dragDropDiv.style.left = leftPos + 'px'; + + leftPos = leftPos + eventDiff_x; + topPos = topPos + eventDiff_y; + + if (e.button !== 1 && browser.msie) { + dragDropEnd(); + } + + var elementFound = false, prop, offsetX, offsetY; + + for (prop in divXPositions) { + if (divXPositions[prop].className === 'clear') { + continue; + } + + if (divXPositions[prop] < leftPos && + (divXPositions[prop] + divWidth[prop] * 0.7) > leftPos && + divYPositions[prop] < topPos && + (divYPositions[prop] + divWidth[prop]) > topPos) + { + if (browser.msie) { + offsetX = offsetX_marker; + offsetY = offsetY_marker; + } + else { + offsetX = geckoOffsetX_marker; + offsetY = geckoOffsetY_marker; + } + + insertionMarker.style.top = divYPositions[prop] + offsetY + 'px'; + insertionMarker.style.left = divXPositions[prop] + offsetX + 'px'; + insertionMarker.style.display = 'block'; + destinationObject = document.getElementById(prop); + elementFound = true; + break; + } + } + + if (!elementFound) { + insertionMarker.style.display = 'none'; + destinationObject = false; + } + + return false; +} + +function saveImageOrder() { +// ---------------------------------------------------------------------------------- + var rData = []; + var objects = document.getElementById('imageListWrapper').getElementsByTagName('DIV'); + var i; + for (i=0; i < objects.length; i++) { + if (objects[i].className === 'imageBox' || + objects[i].className === 'imageBoxHighlighted') + { + rData.push(objects[i].id); + } + } + + return rData; +} + +function initGallery() { +// ---------------------------------------------------------------------------------- + var imgBox = document.getElementById('imageListWrapper').getElementsByTagName('DIV'); + var i; + for (i=0; i < imgBox.length; i++) { + if (imgBox[i].className == 'imageBox_theImage') { + imgBox[i].onmousedown = selectImage; + } + } + + document.body.onselectstart = cancelEvent; + document.body.ondragstart = cancelEvent; + document.body.onmouseup = dragDropEnd; + document.body.onmousemove = dragDropMove; + + dragDropDiv = document.getElementById('dragDropContent'); + insertionMarker = document.getElementById('insertionMarker'); + getDivCoordinates(); +} + +function doSubmit() { +// ---------------------------------------------------------------------------------- + var el = document.getElementById('imageListWrapper').getElementsByTagName('DIV'); + var imageArray = []; + var num = 0; + var fm_elem = document.getElementById('fm_alignment'); + var fm_align = fm_elem.alignment; + var img_align = 'top', i, imgBox; + var imgParagraph = fm_elem.para.checked; + var useSpacer = fm_elem.use_spacer.checked; + + for (i=0; i < fm_align.length; i++) { + if (fm_align[i].checked) { + img_align = fm_align[i].value; + break; + } + } + + for (i=0; i < el.length; i++) { + imgBox = el[i]; + if (imgBox.className !== 'imageBox_theImage') { + continue; + } + + if (imgBox.firstChild !== null) { + imageArray[num] = imageCompletedList[imgBox.id]; + + if (img_align === 'break' ) { + imageArray[num]['alt'] = "break"; + } + else { + imageArray[num]['alt'] = ""; + imageArray[num]['align'] = img_align; + } + + num++; + } + } + + if (imageArray.length > 0) { + oEditor.doInsertImage(imageArray, imgParagraph, useSpacer); + } + + swfobject.removeSWF(AppID); + oEditor.popupWinClose(); +} + +function initEvent() { + var swfVersionStr = "11.1.0"; + var xiSwfUrlStr = "http://get.adobe.com/kr/flashplayer/"; + var flashvars = { + "UploadScript": UploadScript, + "DeleteScript": DeleteScript, + "UploadButton": UploadButton, + "MakeThumbnail": makeThumbnail, + "ThumbnailWidth": makeThumbnailWidth, + "ThumbnailHeight": makeThumbnailHeight, + "ImageResizeWidth": imageResizeWidth, + "loadPolicyFile": true, + "SortOnName": sortOnName }; + var params = { + "quality": "high", + "bgcolor": "#ffffff", + "allowscriptaccess": "Always", + "allowfullscreen": "false", + //"allowNetworking": "all", + "wmode": "transparent" }; + var attributes = { "id": AppID, "name": AppID, "align": "middle" }; + swfobject.embedSWF(AppSRC, "oFlashButton", "93", "22", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes); +} + +function init(dialog) { + oEditor = this; + oEditor.dialog = dialog; + var dlg = new Dialog(oEditor); + browser = oEditor.getBrowser(); + + UploadImagePath = oEditor.config.iconPath + 'imageUpload'; + UploadButton = '../icons/imageUpload/add.gif'; + AppSRC = oEditor.config.popupPath + 'flash/chximage.swf'; + uploadMaxNumber = oEditor.config.imgUploadNumber; + UploadScript = oEditor.config.editorPath + 'imageUpload/upload_flash.php'; + DeleteScript = oEditor.config.editorPath + 'imageUpload/delete.php'; + + imageResizeWidth = oEditor.config.imgMaxWidth; + makeThumbnail = oEditor.config.makeThumbnail; + sortOnName = oEditor.config.imgUploadSortName; + makeThumbnailWidth = oEditor.config.thumbnailWidth; + makeThumbnailHeight = oEditor.config.thumbnailHeight; + + document.getElementById("maxImageNum").appendChild(document.createTextNode(uploadMaxNumber)); + + button = [ { alt : "", img : 'submit.gif', cmd : doSubmit, hspace : 2 }, + { alt : "", img : 'cancel.gif', cmd : closeWindow, hspace : 2 } ]; + + dlg.setDialogHeight(370); + dlg.showButton(button); + showContents(); + initGallery(); + showUploadWindow(); + initEvent(); + createInsertionMaker(); + + var align = document.getElementById('fm_alignment'); + var i; + for (i=0; i= 3 check for Flash plugin in plugin array + var flashVer = -1; + + if (navigator.plugins != null && navigator.plugins.length > 0) { + if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { + var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; + var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; + var descArray = flashDescription.split(" "); + var tempArrayMajor = descArray[2].split("."); + var versionMajor = tempArrayMajor[0]; + var versionMinor = tempArrayMajor[1]; + var versionRevision = descArray[3]; + if (versionRevision == "") { + versionRevision = descArray[4]; + } + if (versionRevision[0] == "d") { + versionRevision = versionRevision.substring(1); + } else if (versionRevision[0] == "r") { + versionRevision = versionRevision.substring(1); + if (versionRevision.indexOf("d") > 0) { + versionRevision = versionRevision.substring(0, versionRevision.indexOf("d")); + } + } else if (versionRevision[0] == "b") { + versionRevision = versionRevision.substring(1); + } + flashVer = versionMajor + "." + versionMinor + "." + versionRevision; + } + } + // MSN/WebTV 2.6 supports Flash 4 + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4; + // WebTV 2.5 supports Flash 3 + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3; + // older WebTV supports Flash 2 + else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2; + else if ( isIE && isWin && !isOpera ) { + flashVer = ControlVersion(); + } + return flashVer; +} + +// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available +function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) +{ + versionStr = GetSwfVer(); + if (versionStr == -1 ) { + return false; + } else if (versionStr != 0) { + if(isIE && isWin && !isOpera) { + // Given "WIN 2,0,0,11" + tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"] + tempString = tempArray[1]; // "2,0,0,11" + versionArray = tempString.split(","); // ['2', '0', '0', '11'] + } else { + versionArray = versionStr.split("."); + } + var versionMajor = versionArray[0]; + var versionMinor = versionArray[1]; + var versionRevision = versionArray[2]; + + // is the major.revision >= requested major.revision AND the minor version >= requested minor + if (versionMajor > parseFloat(reqMajorVer)) { + return true; + } else if (versionMajor == parseFloat(reqMajorVer)) { + if (versionMinor > parseFloat(reqMinorVer)) + return true; + else if (versionMinor == parseFloat(reqMinorVer)) { + if (versionRevision >= parseFloat(reqRevision)) + return true; + } + } + return false; + } +} + +function AC_AddExtension(src, ext) +{ + if (src.indexOf('?') != -1) + return src.replace(/\?/, ext+'?'); + else + return src + ext; +} + +function AC_Generateobj(objAttrs, params, embedAttrs) +{ + if (isIE && isWin && !isOpera) + { + var str = ' '; + str += ''; + document.getElementById("oFlash").innerHTML = str; + } + else { + var oFlash = document.getElementById("oFlash"); + var embed = document.createElement('embed'); + for (var i in embedAttrs) { + embed.setAttribute(i, embedAttrs[i]); + } + oFlash.appendChild(embed); + } +} + +function CHXImageRUN(){ + var ret = + AC_GetArgs + ( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" + , "application/x-shockwave-flash" + ); + AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs); +} + +function AC_GetArgs(args, ext, srcParamName, classid, mimeType){ + var ret = new Object(); + ret.embedAttrs = new Object(); + ret.params = new Object(); + ret.objAttrs = new Object(); + for (var i=0; i < args.length; i=i+2){ + var currArg = args[i].toLowerCase(); + + switch (currArg){ + case "classid": + break; + case "pluginspage": + ret.embedAttrs[args[i]] = args[i+1]; + break; + case "src": + case "movie": + args[i+1] = AC_AddExtension(args[i+1], ext); + ret.embedAttrs["src"] = args[i+1]; + ret.params[srcParamName] = args[i+1]; + break; + case "onafterupdate": + case "onbeforeupdate": + case "onblur": + case "oncellchange": + case "onclick": + case "ondblClick": + case "ondrag": + case "ondragend": + case "ondragenter": + case "ondragleave": + case "ondragover": + case "ondrop": + case "onfinish": + case "onfocus": + case "onhelp": + case "onmousedown": + case "onmouseup": + case "onmouseover": + case "onmousemove": + case "onmouseout": + case "onkeypress": + case "onkeydown": + case "onkeyup": + case "onload": + case "onlosecapture": + case "onpropertychange": + case "onreadystatechange": + case "onrowsdelete": + case "onrowenter": + case "onrowexit": + case "onrowsinserted": + case "onstart": + case "onscroll": + case "onbeforeeditfocus": + case "onactivate": + case "onbeforedeactivate": + case "ondeactivate": + case "type": + case "codebase": + ret.objAttrs[args[i]] = args[i+1]; + break; + case "id": + case "width": + case "height": + case "align": + case "vspace": + case "hspace": + case "class": + case "title": + case "accesskey": + case "name": + case "tabindex": + ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1]; + break; + default: + ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1]; + } + } + ret.objAttrs["classid"] = classid; + if (mimeType) ret.embedAttrs["type"] = mimeType; + return ret; +} + + diff --git a/webedit/popup/js/image_url.js b/webedit/popup/js/image_url.js new file mode 100644 index 0000000..5d76782 --- /dev/null +++ b/webedit/popup/js/image_url.js @@ -0,0 +1,244 @@ +// ================================================================ +// CHEditor 5 +// ---------------------------------------------------------------- +// Homepage: http://www.chcode.com +// Copyright (c) 1997-2015 CHSOFT +// ================================================================ +var AppWidth = "250"; +var AppHeight = "175"; +var AppID = "cheditorPreview"; +var oEditor = null; +var button = [ { alt : "", img : 'submit.gif', cmd : doSubmit }, + { alt : "", img : 'cancel.gif', cmd : popupClose } ]; +var newImage = null; + +function CHEditorImagePreview () { +// ---------------------------------------------------------------------------------- +// callBack function + + document.getElementById(AppID).CHEditorImagePreview("1", "1"); +} + +function CHXUploadRUN(src) { +// ---------------------------------------------------------------------------------- +// Preview +// + chxupload_RUN("src", src, + "width", AppWidth, + "height", AppHeight, + "align", "middle", + "id", AppID, + "classid", AppID, + "quality", "high", + "bgcolor", "#ebe9ed", + "name", AppID, + "wmode", "transparent", + "allowScriptAccess","Always", + "type", "application/x-shockwave-flash", + "pluginspage", "http://www.adobe.com/go/getflashplayer"); +} + +function getFilename (file) { + while (file.indexOf("/") != -1) { + file = file.slice(file.indexOf("/") + 1); + } + return file; +} + +function popupClose() +{ + oEditor.popupWinCancel(); +} + +function chkImgFormat (url) +{ + var imageName = getFilename(url); + var allowSubmit = false; + var extArray = [".gif", ".jpg", ".jpeg", ".png"]; + + extArray.join(" "); + if (imageName === "") { + return false; + } + + var ext = imageName.slice(imageName.lastIndexOf(".")).toLowerCase(); + var i; + + for (i = 0; i < extArray.length; i++) { + if (extArray[i] == ext) { + allowSubmit = true; + break; + } + } + + if (!allowSubmit) { + alert("사진은 GIF, JPG, PNG 형식만 넣을 수 있습니다."); + return false; + } + + return imageName; +} + +function previewImage (source) { + if (navigator.appName.indexOf("microsoft") != -1) { + window[AppID].CHEditorImagePreview(source, 0, 0); + } + else { + document[AppID].CHEditorImagePreview(source, 0, 0); + } +} + +function checkImageComplete (img) { + if (img.complete != true) { + setTimeout("checkImageComplete(document.getElementById('"+img.id+"'))", 250); + } + else { + document.getElementById('imageSize').innerHTML = ''; + + newImage = new Image(); + newImage.style.width = img.width + 'px'; + newImage.style.height = img.height + 'px'; + newImage.setAttribute("src", img.src); + newImage.setAttribute("alt", getFilename(img.src)); + } +} + +function doPreview () { + var imgurl = document.getElementById('fm_imageUrl').value; + var fileName = chkImgFormat(imgurl); + if (!fileName) { + return; + } + + var img = new Image(); + img.src = imgurl; + img.id = fileName; + + document.getElementById('tmpImage').appendChild(img); + checkImageComplete(img); + previewImage(img.src); +} + +function getElementById(id) { + var el = null; + try { + el = document.getElementById(id); + } + catch (ignore) {} + return el; +} + +function removeObjectInIE(id) { + var obj = getElementById(id); + if (obj) { + var i; + for (i in obj) { + if (typeof obj[i] == "function") { + obj[i] = null; + } + } + obj.parentNode.removeChild(obj); + } +} + +function removeSWF(id) { + var obj = getElementById(id); + if (obj && obj.nodeName == "OBJECT") { + if (oEditor.getBrowser().msie) { + obj.style.display = "none"; + (function(){ + if (obj.readyState == 4) { + removeObjectInIE(id); + } + })(); + } + else { + obj.parentNode.removeChild(obj); + } + } +} + +function doSubmit () +{ + if (newImage == null) { + alert("미리 보기 버튼을 클릭하여 이미지를 확인해 주십시오."); + return; + } + + if (navigator.userAgent.toLowerCase().indexOf("msie") != -1) { + document.getElementById(AppID).style.display = 'none'; + } + + var fm_align = document.getElementById('fm_align').alignment; + var align = 'center'; + var i; + + for (i=0; i 0) { + datum = ""; + } + else { + datum = protocol[0]; + datum = protocol[0].replace(/^\/\/\//, "//"); + } + } + + document.getElementById("fm_link_value").value = selectedItemValue + datum; + document.getElementById("fm_link_value").focus(); +} + +function returnSelected() +{ + var text; + var target = ''; + var title = ''; + + if (document.getElementById("fm_link_value").value != "") { + text = document.getElementById("fm_link_value").value; + } + else { + alert("링크 URL을 입력하여 주십시오."); + return false; + } + + if (document.getElementById("fm_target").value != "") { + target = document.getElementById("fm_target").value; + } + + if (document.getElementById("fm_title").value != "") { + title = document.getElementById("fm_title").value; + } + + oEditor.hyperLink(text, target, title); + oEditor.popupWinClose(); +} + +function getSelected() { + var rng = oEditor.range; + var link = null; + + if (window.getSelection) { + link = oEditor.getElement(rng.startContainer, "A"); + } + else { + link = rng.parentElement ? oEditor.getElement(rng.parentElement(), "A") : oEditor.getElement(rng.item(0), "A"); + } + + if (link == null || link.nodeName.toLowerCase() != 'a') { + return; + } + + var protocol = link.href.split(":"); + + if (protocol[0]) { + var protocolSel = document.getElementById("fm_protocol"); + var i, oldTarget, targetSel, j; + for (i=0; i"; + var obj = document.getElementById("play"); + obj.innerHTML = mediaobj; +} + +function doSubmit() +{ + var file = document.getElementById("fm_linkurl"); + var media = ""; + oEditor.insertHtmlPopup(media); + oEditor.popupWinClose(); +} + +function popupClose() { + oEditor.popupWinCancel(); +} \ No newline at end of file diff --git a/webedit/popup/js/swfobject.js b/webedit/popup/js/swfobject.js new file mode 100644 index 0000000..716b97f --- /dev/null +++ b/webedit/popup/js/swfobject.js @@ -0,0 +1,779 @@ +/*! SWFObject v2.2 + is released under the MIT License +*/ + +var swfobject = function() { + + var UNDEF = "undefined", + OBJECT = "object", + SHOCKWAVE_FLASH = "Shockwave Flash", + SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash", + FLASH_MIME_TYPE = "application/x-shockwave-flash", + EXPRESS_INSTALL_ID = "SWFObjectExprInst", + ON_READY_STATE_CHANGE = "onreadystatechange", + + win = window, + doc = document, + nav = navigator, + + plugin = false, + domLoadFnArr = [main], + regObjArr = [], + objIdArr = [], + listenersArr = [], + storedAltContent, + storedAltContentId, + storedCallbackFn, + storedCallbackObj, + isDomLoaded = false, + isExpressInstallActive = false, + dynamicStylesheet, + dynamicStylesheetMedia, + autoHideShow = true, + + /* Centralized function for browser feature detection + - User agent string detection is only used when no good alternative is possible + - Is executed directly for optimal performance + */ + ua = function() { + var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF, + u = nav.userAgent.toLowerCase(), + p = nav.platform.toLowerCase(), + windows = p ? /win/.test(p) : /win/.test(u), + mac = p ? /mac/.test(p) : /mac/.test(u), + webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit + ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html + playerVersion = [0,0,0], + d = null; + if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) { + d = nav.plugins[SHOCKWAVE_FLASH].description; + if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+ + plugin = true; + ie = false; // cascaded feature detection for Internet Explorer + d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); + playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10); + playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10); + playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0; + } + } + else if (typeof win.ActiveXObject != UNDEF) { + try { + var a = new ActiveXObject(SHOCKWAVE_FLASH_AX); + if (a) { // a will return null when ActiveX is disabled + d = a.GetVariable("$version"); + if (d) { + ie = true; // cascaded feature detection for Internet Explorer + d = d.split(" ")[1].split(","); + playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; + } + } + } + catch(e) {} + } + return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac }; + }(), + + /* Cross-browser onDomLoad + - Will fire an event as soon as the DOM of a web page is loaded + - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/ + - Regular onload serves as fallback + */ + onDomLoad = function() { + if (!ua.w3) { return; } + if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically + callDomLoadFunctions(); + } + if (!isDomLoaded) { + if (typeof doc.addEventListener != UNDEF) { + doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false); + } + if (ua.ie && ua.win) { + doc.attachEvent(ON_READY_STATE_CHANGE, function() { + if (doc.readyState == "complete") { + doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee); + callDomLoadFunctions(); + } + }); + if (win == top) { // if not inside an iframe + (function(){ + if (isDomLoaded) { return; } + try { + doc.documentElement.doScroll("left"); + } + catch(e) { + setTimeout(arguments.callee, 0); + return; + } + callDomLoadFunctions(); + })(); + } + } + if (ua.wk) { + (function(){ + if (isDomLoaded) { return; } + if (!/loaded|complete/.test(doc.readyState)) { + setTimeout(arguments.callee, 0); + return; + } + callDomLoadFunctions(); + })(); + } + addLoadEvent(callDomLoadFunctions); + } + }(); + + function callDomLoadFunctions() { + if (isDomLoaded) { return; } + try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early + var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span")); + t.parentNode.removeChild(t); + } + catch (e) { return; } + isDomLoaded = true; + var dl = domLoadFnArr.length; + for (var i = 0; i < dl; i++) { + domLoadFnArr[i](); + } + } + + function addDomLoadEvent(fn) { + if (isDomLoaded) { + fn(); + } + else { + domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+ + } + } + + /* Cross-browser onload + - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/ + - Will fire an event as soon as a web page including all of its assets are loaded + */ + function addLoadEvent(fn) { + if (typeof win.addEventListener != UNDEF) { + win.addEventListener("load", fn, false); + } + else if (typeof doc.addEventListener != UNDEF) { + doc.addEventListener("load", fn, false); + } + else if (typeof win.attachEvent != UNDEF) { + addListener(win, "onload", fn); + } + else if (typeof win.onload == "function") { + var fnOld = win.onload; + win.onload = function() { + fnOld(); + fn(); + }; + } + else { + win.onload = fn; + } + } + + /* Main function + - Will preferably execute onDomLoad, otherwise onload (as a fallback) + */ + function main() { + if (plugin) { + testPlayerVersion(); + } + else { + matchVersions(); + } + } + + /* Detect the Flash Player version for non-Internet Explorer browsers + - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description: + a. Both release and build numbers can be detected + b. Avoid wrong descriptions by corrupt installers provided by Adobe + c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports + - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available + */ + function testPlayerVersion() { + var b = doc.getElementsByTagName("body")[0]; + var o = createElement(OBJECT); + o.setAttribute("type", FLASH_MIME_TYPE); + var t = b.appendChild(o); + if (t) { + var counter = 0; + (function(){ + if (typeof t.GetVariable != UNDEF) { + var d = t.GetVariable("$version"); + if (d) { + d = d.split(" ")[1].split(","); + ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; + } + } + else if (counter < 10) { + counter++; + setTimeout(arguments.callee, 10); + return; + } + b.removeChild(o); + t = null; + matchVersions(); + })(); + } + else { + matchVersions(); + } + } + + /* Perform Flash Player and SWF version matching; static publishing only + */ + function matchVersions() { + var rl = regObjArr.length; + if (rl > 0) { + for (var i = 0; i < rl; i++) { // for each registered object element + var id = regObjArr[i].id; + var cb = regObjArr[i].callbackFn; + var cbObj = {success:false, id:id}; + if (ua.pv[0] > 0) { + var obj = getElementById(id); + if (obj) { + if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match! + setVisibility(id, true); + if (cb) { + cbObj.success = true; + cbObj.ref = getObjectById(id); + cb(cbObj); + } + } + else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported + var att = {}; + att.data = regObjArr[i].expressInstall; + att.width = obj.getAttribute("width") || "0"; + att.height = obj.getAttribute("height") || "0"; + if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); } + if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); } + // parse HTML object param element's name-value pairs + var par = {}; + var p = obj.getElementsByTagName("param"); + var pl = p.length; + for (var j = 0; j < pl; j++) { + if (p[j].getAttribute("name").toLowerCase() != "movie") { + par[p[j].getAttribute("name")] = p[j].getAttribute("value"); + } + } + showExpressInstall(att, par, id, cb); + } + else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF + displayAltContent(obj); + if (cb) { cb(cbObj); } + } + } + } + else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content) + setVisibility(id, true); + if (cb) { + var o = getObjectById(id); // test whether there is an HTML object element or not + if (o && typeof o.SetVariable != UNDEF) { + cbObj.success = true; + cbObj.ref = o; + } + cb(cbObj); + } + } + } + } + } + + function getObjectById(objectIdStr) { + var r = null; + var o = getElementById(objectIdStr); + if (o && o.nodeName == "OBJECT") { + if (typeof o.SetVariable != UNDEF) { + r = o; + } + else { + var n = o.getElementsByTagName(OBJECT)[0]; + if (n) { + r = n; + } + } + } + return r; + } + + /* Requirements for Adobe Express Install + - only one instance can be active at a time + - fp 6.0.65 or higher + - Win/Mac OS only + - no Webkit engines older than version 312 + */ + function canExpressInstall() { + return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312); + } + + /* Show the Adobe Express Install dialog + - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75 + */ + function showExpressInstall(att, par, replaceElemIdStr, callbackFn) { + isExpressInstallActive = true; + storedCallbackFn = callbackFn || null; + storedCallbackObj = {success:false, id:replaceElemIdStr}; + var obj = getElementById(replaceElemIdStr); + if (obj) { + if (obj.nodeName == "OBJECT") { // static publishing + storedAltContent = abstractAltContent(obj); + storedAltContentId = null; + } + else { // dynamic publishing + storedAltContent = obj; + storedAltContentId = replaceElemIdStr; + } + att.id = EXPRESS_INSTALL_ID; + if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; } + if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; } + doc.title = doc.title.slice(0, 47) + " - Flash Player Installation"; + var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn", + fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title; + if (typeof par.flashvars != UNDEF) { + par.flashvars += "&" + fv; + } + else { + par.flashvars = fv; + } + // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, + // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work + if (ua.ie && ua.win && obj.readyState != 4) { + var newObj = createElement("div"); + replaceElemIdStr += "SWFObjectNew"; + newObj.setAttribute("id", replaceElemIdStr); + obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf + obj.style.display = "none"; + (function(){ + if (obj.readyState == 4) { + obj.parentNode.removeChild(obj); + } + else { + setTimeout(arguments.callee, 10); + } + })(); + } + createSWF(att, par, replaceElemIdStr); + } + } + + /* Functions to abstract and display alternative content + */ + function displayAltContent(obj) { + if (ua.ie && ua.win && obj.readyState != 4) { + // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, + // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work + var el = createElement("div"); + obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content + el.parentNode.replaceChild(abstractAltContent(obj), el); + obj.style.display = "none"; + (function(){ + if (obj.readyState == 4) { + obj.parentNode.removeChild(obj); + } + else { + setTimeout(arguments.callee, 10); + } + })(); + } + else { + obj.parentNode.replaceChild(abstractAltContent(obj), obj); + } + } + + function abstractAltContent(obj) { + var ac = createElement("div"); + if (ua.win && ua.ie) { + ac.innerHTML = obj.innerHTML; + } + else { + var nestedObj = obj.getElementsByTagName(OBJECT)[0]; + if (nestedObj) { + var c = nestedObj.childNodes; + if (c) { + var cl = c.length; + for (var i = 0; i < cl; i++) { + if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) { + ac.appendChild(c[i].cloneNode(true)); + } + } + } + } + } + return ac; + } + + /* Cross-browser dynamic SWF creation + */ + function createSWF(attObj, parObj, id) { + var r, el = getElementById(id); + if (ua.wk && ua.wk < 312) { return r; } + if (el) { + if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content + attObj.id = id; + } + if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML + var att = ""; + for (var i in attObj) { + if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries + if (i.toLowerCase() == "data") { + parObj.movie = attObj[i]; + } + else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword + att += ' class="' + attObj[i] + '"'; + } + else if (i.toLowerCase() != "classid") { + att += ' ' + i + '="' + attObj[i] + '"'; + } + } + } + var par = ""; + for (var j in parObj) { + if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries + par += ''; + } + } + el.outerHTML = '' + par + ''; + objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only) + r = getElementById(attObj.id); + } + else { // well-behaving browsers + var o = createElement(OBJECT); + o.setAttribute("type", FLASH_MIME_TYPE); + for (var m in attObj) { + if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries + if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword + o.setAttribute("class", attObj[m]); + } + else if (m.toLowerCase() != "classid") { // filter out IE specific attribute + o.setAttribute(m, attObj[m]); + } + } + } + for (var n in parObj) { + if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element + createObjParam(o, n, parObj[n]); + } + } + el.parentNode.replaceChild(o, el); + r = o; + } + } + return r; + } + + function createObjParam(el, pName, pValue) { + var p = createElement("param"); + p.setAttribute("name", pName); + p.setAttribute("value", pValue); + el.appendChild(p); + } + + /* Cross-browser SWF removal + - Especially needed to safely and completely remove a SWF in Internet Explorer + */ + function removeSWF(id) { + var obj = getElementById(id); + if (obj && obj.nodeName == "OBJECT") { + if (ua.ie && ua.win) { + obj.style.display = "none"; + (function(){ + if (obj.readyState == 4) { + removeObjectInIE(id); + } + else { + setTimeout(arguments.callee, 10); + } + })(); + } + else { + obj.parentNode.removeChild(obj); + } + } + } + + function removeObjectInIE(id) { + var obj = getElementById(id); + if (obj) { + for (var i in obj) { + if (typeof obj[i] == "function") { + obj[i] = null; + } + } + obj.parentNode.removeChild(obj); + } + } + + /* Functions to optimize JavaScript compression + */ + function getElementById(id) { + var el = null; + try { + el = doc.getElementById(id); + } + catch (e) {} + return el; + } + + function createElement(el) { + return doc.createElement(el); + } + + /* Updated attachEvent function for Internet Explorer + - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks + */ + function addListener(target, eventType, fn) { + target.attachEvent(eventType, fn); + listenersArr[listenersArr.length] = [target, eventType, fn]; + } + + /* Flash Player and SWF content version matching + */ + function hasPlayerVersion(rv) { + var pv = ua.pv, v = rv.split("."); + v[0] = parseInt(v[0], 10); + v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0" + v[2] = parseInt(v[2], 10) || 0; + return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false; + } + + /* Cross-browser dynamic CSS creation + - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php + */ + function createCSS(sel, decl, media, newStyle) { + if (ua.ie && ua.mac) { return; } + var h = doc.getElementsByTagName("head")[0]; + if (!h) { return; } // to also support badly authored HTML pages that lack a head element + var m = (media && typeof media == "string") ? media : "screen"; + if (newStyle) { + dynamicStylesheet = null; + dynamicStylesheetMedia = null; + } + if (!dynamicStylesheet || dynamicStylesheetMedia != m) { + // create dynamic stylesheet + get a global reference to it + var s = createElement("style"); + s.setAttribute("type", "text/css"); + s.setAttribute("media", m); + dynamicStylesheet = h.appendChild(s); + if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) { + dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1]; + } + dynamicStylesheetMedia = m; + } + // add style rule + if (ua.ie && ua.win) { + if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) { + dynamicStylesheet.addRule(sel, decl); + } + } + else { + if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) { + dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}")); + } + } + } + + function setVisibility(id, isVisible) { + if (!autoHideShow) { return; } + var v = isVisible ? "visible" : "hidden"; + if (isDomLoaded && getElementById(id)) { + getElementById(id).style.visibility = v; + } + else { + createCSS("#" + id, "visibility:" + v); + } + } + + /* Filter to avoid XSS attacks + */ + function urlEncodeIfNecessary(s) { + var regex = /[\\\"<>\.;]/; + var hasBadChars = regex.exec(s) != null; + return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s; + } + + /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only) + */ + var cleanup = function() { + if (ua.ie && ua.win) { + window.attachEvent("onunload", function() { + // remove listeners to avoid memory leaks + var ll = listenersArr.length; + for (var i = 0; i < ll; i++) { + listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]); + } + // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect + var il = objIdArr.length; + for (var j = 0; j < il; j++) { + removeSWF(objIdArr[j]); + } + // cleanup library's main closures to avoid memory leaks + for (var k in ua) { + ua[k] = null; + } + ua = null; + for (var l in swfobject) { + swfobject[l] = null; + } + swfobject = null; + }); + } + }(); + + return { + /* Public API + - Reference: http://code.google.com/p/swfobject/wiki/documentation + */ + registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) { + if (ua.w3 && objectIdStr && swfVersionStr) { + var regObj = {}; + regObj.id = objectIdStr; + regObj.swfVersion = swfVersionStr; + regObj.expressInstall = xiSwfUrlStr; + regObj.callbackFn = callbackFn; + regObjArr[regObjArr.length] = regObj; + setVisibility(objectIdStr, false); + } + else if (callbackFn) { + callbackFn({success:false, id:objectIdStr}); + } + }, + + getObjectById: function(objectIdStr) { + if (ua.w3) { + return getObjectById(objectIdStr); + } + }, + + embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) { + var callbackObj = {success:false, id:replaceElemIdStr}; + if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) { + setVisibility(replaceElemIdStr, false); + addDomLoadEvent(function() { + widthStr += ""; // auto-convert to string + heightStr += ""; + var att = {}; + if (attObj && typeof attObj === OBJECT) { + for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs + att[i] = attObj[i]; + } + } + att.data = swfUrlStr; + att.width = widthStr; + att.height = heightStr; + var par = {}; + if (parObj && typeof parObj === OBJECT) { + for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs + par[j] = parObj[j]; + } + } + if (flashvarsObj && typeof flashvarsObj === OBJECT) { + for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs + if (typeof par.flashvars != UNDEF) { + par.flashvars += "&" + k + "=" + flashvarsObj[k]; + } + else { + par.flashvars = k + "=" + flashvarsObj[k]; + } + } + } + if (hasPlayerVersion(swfVersionStr)) { // create SWF + var obj = createSWF(att, par, replaceElemIdStr); + if (att.id == replaceElemIdStr) { + setVisibility(replaceElemIdStr, true); + } + callbackObj.success = true; + callbackObj.ref = obj; + } + else if (xiSwfUrlStr) { // show Adobe Express Install + if (confirm("Adobe Flash Player "+swfVersionStr+" 이상 버전이 필요합니다.\nCHEditor는 자동으로 Flash Player를 설치하지 않습니다.\n" + + "Adobe Flash Player 다운로드 웹사이트를 방문하시겠습니까?")) { + window.open(xiSwfUrlStr); + } + return; + } + else { // show alternative content + setVisibility(replaceElemIdStr, true); + } + if (callbackFn) { callbackFn(callbackObj); } + }); + } + else if (callbackFn) { callbackFn(callbackObj); } + }, + + switchOffAutoHideShow: function() { + autoHideShow = false; + }, + + ua: ua, + + getFlashPlayerVersion: function() { + return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] }; + }, + + hasFlashPlayerVersion: hasPlayerVersion, + + createSWF: function(attObj, parObj, replaceElemIdStr) { + if (ua.w3) { + return createSWF(attObj, parObj, replaceElemIdStr); + } + else { + return undefined; + } + }, + + showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) { + if (ua.w3 && canExpressInstall()) { + showExpressInstall(att, par, replaceElemIdStr, callbackFn); + } + }, + + removeSWF: function(objElemIdStr) { + if (ua.w3) { + removeSWF(objElemIdStr); + } + }, + + createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) { + if (ua.w3) { + createCSS(selStr, declStr, mediaStr, newStyleBoolean); + } + }, + + addDomLoadEvent: addDomLoadEvent, + + addLoadEvent: addLoadEvent, + + getQueryParamValue: function(param) { + var q = doc.location.search || doc.location.hash; + if (q) { + if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark + if (param == null) { + return urlEncodeIfNecessary(q); + } + var pairs = q.split("&"); + for (var i = 0; i < pairs.length; i++) { + if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { + return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1))); + } + } + } + return ""; + }, + + // For internal usage only + expressInstallCallback: function() { + if (isExpressInstallActive) { + var obj = getElementById(EXPRESS_INSTALL_ID); + if (obj && storedAltContent) { + obj.parentNode.replaceChild(storedAltContent, obj); + if (storedAltContentId) { + setVisibility(storedAltContentId, true); + if (ua.ie && ua.win) { storedAltContent.style.display = "block"; } + } + if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); } + } + isExpressInstallActive = false; + } + } + }; +}(); diff --git a/webedit/popup/js/symbol.js b/webedit/popup/js/symbol.js new file mode 100644 index 0000000..2059b62 --- /dev/null +++ b/webedit/popup/js/symbol.js @@ -0,0 +1,167 @@ +// ================================================================ +// CHEditor 5 +// ---------------------------------------------------------------- +// Homepage: http://www.chcode.com +// Copyright (c) 1997-2015 CHSOFT +// ================================================================ +var c = null; +var curView = null; +var S1 = '" ( ) [ ] { } ‘ ’ “ ” 〔 〕 〈 〉 《 》 「 」 『 』 【 】 § ※ ☆ ★ ○ ● ■ △ ▲ ▽ ▼ → 〓 ◁ ◀ ▷ ▶ ♤ ♣ ⊙ ◈ ▣ ◐ ◑ ▧ ▦ ▩ ♨ ☏ ☎ ‡ ㉿ ↕ ↗ ↙ ↖ ↘ ㈜ № ㏇ ™ ㏂ + - < = > ± × ÷ ≠ ≤ ≥ ∞ ∴ ♂ ♀ ∠ ⊥ ⌒ ∂ ∇ ≡ ≒ ≪ ≫ √ ∽ ∝ ∵ ∫ ∬ ∈ ∋ ⊆ ⊇ ⊂ ⊃ ∮ ∪ ∩ ∑ ∏ ∧ ∨ ¬ ⇒ ⇔ ∀ ∃'; +var S2 = '─ │ ┌ ┐ ┘ └ ├ ┬ ┤ ┴ ┼ ━ ┃ ┏ ┓ ┛ ┗ ┣ ┳ ┫ ┻ ╋ ┠ ┯ ┨ ┷ ┿ ┝ ┰ ┥ ┸ ╂ ┒ ┑ ┚ ┙ ┖ ┕ ┎ ┍ ┞ ┟ ┡ ┢ ┦ ┧ ┩ ┪ ┭ ┮ ┱ ┲ ┵ ┶ ┹ ┺ ┽ ┾ ╀ ╁ ╃ ╄ ╅ ╆ ╇ ╈ ╉ ╊'; +var S3 = '½ ⅓ ⅔ ¼ ¾ ⅛ ⅜ ⅝ ⅞ ¹ ² ³ ⁴ ⁿ ₁ ₂ ₃ ₄ 0 1 2 3 4 5 6 7 8 9 ⅰ ⅱ ⅲ ⅳ ⅴ ⅵ ⅶ ⅷ ⅸ ⅹ Ⅰ Ⅱ Ⅲ Ⅳ Ⅴ Ⅵ Ⅶ Ⅷ Ⅸ Ⅹ $ % ₩ ° ′ ″ ℃ Å ¢ £ ¥ ¤ ℉ ‰ ㎕ ㎖ ㎗ ℓ ㎘ ㏄ ㎣ ㎤ ㎥ ㎦ ㎙ ㎚ ㎛ ㎜ ㎝ ㎞ ㎟ ㎠ ㎡ ㎢ ㏊ ㎍ ㎎ ㎏ ㏏ ㎈ ㎉ ㏈ ㎧ ㎨ ㎰ ㎱ ㎲ ㎳ ㎴ ㎵ ㎶ ㎷ ㎸ ㎹ ㎀ ㎁ ㎂ ㎃ ㎄ ㎺ ㎻ ㎼ ㎽ ㎾ ㎿ ㎐ ㎑ ㎒ ㎓ ㎔ Ω ㏀ ㏁ ㎊ ㎋ ㎌ ㏖ ㏅ ㎭ ㎮ ㎯ ㏛ ㎩ ㎪ ㎫ ㎬ ㏝ ㏐ ㏓ ㏉ ㏜ ㏆'; +var S4 = 'ㅥ ㅦ ㅧ ㅨ ㅩ ㅪ ㅫ ㅬ ㅭ ㅮ ㅰ ㅯ ㅱ ㅲ ㅳ ㅴ ㅵ ㅶ ㅷ ㅸ ㅹ ㅺ ㅻ ㅼ ㅽ ㅾ ㅿ ㆀ ㆁ ㆂ ㆃ ㆄ ㆅ ㆆ ㆇ ㆈ ㆉ ㆊ ㆋ ㆌ ㆍ ㆎ'; +var S5 = '㉠ ㉡ ㉢ ㉣ ㉤ ㉥ ㉦ ㉧ ㉨ ㉩ ㉪ ㉫ ㉬ ㉭ ㉮ ㉯ ㉰ ㉱ ㉲ ㉳ ㉴ ㉶ ㉶ ㉷ ㉸ ㉹ ㉺ ㉻ ㈀ ㈁ ㈂ ㈃ ㈄ ㈅ ㈆ ㈇ ㈈ ㈉ ㈊ ㈋ ㈌ ㈍ ㈎ ㈏ ㈐ ㈑ ㈒ ㈓ ㈔ ㈕ ㈖ ㈗ ㈘ ㈙ ㈚ ㈛ ⓐ ⓑ ⓒ ⓓ ⓔ ⓕ ⓖ ⓗ ⓘ ⓙ ⓚ ⓛ ⓜ ⓝ ⓞ ⓟ ⓠ ⓡ ⓢ ⓣ ⓤ ⓥ ⓦ ⓧ ⓨ ⓩ ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⒜ ⒝ ⒞ ⒟ ⒠ ⒡ ⒢ ⒣ ⒤ ⒥ ⒦ ⒧ ⒨ ⒩ ⒪ ⒫ ⒬ ⒭ ⒮ ⒯ ⒰ ⒱ ⒲ ⒳ ⒴ ⒵ ⑴ ⑵ ⑶ ⑷ ⑸ ⑹ ⑺ ⑻ ⑼ ⑽ ⑾ ⑿ ⒀ ⒁ ⒂'; +var japan1 = 'ぁ か さ た ど び ぽ ょ ゑ あ が ざ だ な ぴ ま よ を ぃ き し ち に ふ み ら ん い ぎ じ ぢ ぬ ぶ む り ぅ く す っ ね ぷ め る う ぐ ず つ の へ も れ ぇ け せ づ は べ ゃ ろ え げ ぜ て ば ぺ や ゎ ぉ こ そ で ぱ ほ ゅ わ お ご ぞ と ひ ぼ ゆ ゐ'; +var japan2 = 'ァ カ サ タ ド ビ ポ ョ ヱ ア ガ ザ ダ ナ ピ マ ヨ ヲ ィ キ シ チ ニ フ ミ ラ ン イ ギ ジ ヂ ヌ ブ ム リ ヴ ゥ ク ス ッ ネ プ メ ル ヵ ウ グ ズ ツ ノ ヘ モ レ ヶ ェ ケ セ ヅ ハ ベ ャ ロ エ ゲ ゼ テ バ ペ ヤ ヮ ォ コ ソ デ パ ホ ュ ワ オ ゴ ゾ ト ヒ ボ ユ ヰ'; + +c = S1.split(' '); +var button = [ { alt : "", img : 'input.gif', cmd : inputChar }, + { alt : "", img : 'cancel.gif', cmd : popupClose } ]; + +var oEditor = null; + +function init(dialog) { + oEditor = this; + oEditor.dialog = dialog; + + var dlg = new Dialog(oEditor); + dlg.showButton(button); + + setupEvent(); + dlg.setDialogHeight(); +} + +function hover(obj, val) { + obj.style.backgroundColor = val ? "#5579aa" : "#fff"; + obj.style.color = val ? "#fff" : "#000"; +} + +function showTable() { + var k = 0; + var len = c.length; + var w = 9; + var h = 20; + var span, i, j, tr, td; + + var table = document.createElement('table'); + table.border = 0; + table.cellSpacing = 1; + table.cellPadding = 0; + table.align = 'center'; + + var getChar = function() { + document.getElementById('fm_input').value = document.getElementById('fm_input').value + c[this.id]; + }; + var mouseOver = function() { + hover(this, true); + }; + var mouseOut = function() { + hover(this, false); + }; + for (i=0; i < w; i++) { + tr = table.insertRow(i); + for (j = 0; j < h; j++) { + td = tr.insertCell(j); + td.className = 'schar'; + + if ( len < k+1) { + td.appendChild(document.createTextNode('\u00a0')); + } + else { + td.style.cursor = 'pointer'; + td.id = k; + td.onclick = getChar; + td.onmouseover = mouseOver; + td.onmouseout = mouseOut; + span = document.createElement("span"); + span.style.fontSize = "13px"; + span.appendChild(document.createTextNode(c[k])); + td.appendChild(span); + } + k++; + } + } + + var output = document.getElementById('output'); + if (output.hasChildNodes()) { + for (i=0; i 0) { + cell = createHeadCell('col'); + } + else { + cell = document.createElement('td'); + } + } + else if (header === 'row' && j === 0) { + cell = createHeadCell('row'); + } + else { + cell = document.createElement('td'); + } + + if (border) { + cell.style.borderStyle = 'solid'; + cell.style.borderWidth = table.style.borderWidth; + cell.style.borderColor = table.style.borderColor; + } + cell.setAttribute("width", cellWidth); + cell.appendChild(document.createTextNode('\u00a0')); + row.appendChild(cell); + } + } + + if (oHead.hasChildNodes()) { + table.appendChild(oHead); + } + + table.appendChild(oBody); + + if (summaryValue !== '') { + table.setAttribute('summary', summaryValue); + } + if (width) { + table.style.width = width; + } + if (height) { + table.style.height = height; + } + if (align) { + table.setAttribute("align", align); + } + if (bgcolor) { + table.setAttribute("bgcolor", bgcolor); + } + + table.setAttribute("cellpadding", cellpd); + table.setAttribute("cellspacing", cellsp); + + if (captionValue !== '') { + var hideCaption, tableCaption; + tableCaption = table.createCaption(); + tableCaption.appendChild(document.createTextNode(captionValue)); + + hideCaption = document.getElementById('hideCaption'); + if (hideCaption.checked === true) { + tableCaption.style.visibility = 'hidden'; + tableCaption.style.overFlow = 'hidden'; + tableCaption.style.lineHeight = '0px'; + tableCaption.style.position = 'absolute'; + tableCaption.style.display = 'none'; + } + } + + table.id = oEditor.makeRandomString(); + oEditor.insertHtmlPopup(table.cloneNode(true)); + var newTable = oEditor.$(table.id); +// var br = document.createElement('br'); +// newTable.parentNode.insertBefore(br, newTable); +// newTable.parentNode.insertBefore(newTable, br); + newTable.removeAttribute('id'); + + if (cssclass) { + newTable.className = cssclass; + } + if (cssid) { + newTable.id = cssid; + } + + var focusCell = newTable.getElementsByTagName('th')[0]; + if (oEditor.undefined(focusCell)) { + focusCell = newTable.getElementsByTagName('td')[0]; + } + + if (oEditor.getBrowser().msie) { + var cursor = oEditor.doc.body.createTextRange(); + cursor.moveToElementText(focusCell); + cursor.collapse(false); + cursor.select(); + oEditor.backupRange(oEditor.getRange()); + } + else { + var selection = oEditor.getSelection(); + var range = oEditor.getRange(); + range.selectNodeContents(focusCell); + range.collapse(false); + selection.removeAllRanges(); + selection.addRange(range); + } + + oEditor.popupWinClose(); +} + +function init(dialog) { + oEditor = this; + oEditor.dialog = dialog; + + var button = [ { alt : "", img : 'submit.gif', cmd : doSubmit }, + { alt : "", img : 'cancel.gif', cmd : popupClose } ]; + + var dlg = new Dialog(oEditor); + dlg.showButton(button); + dlg.setDialogHeight(); +} diff --git a/webedit/popup/js/table_modify.js b/webedit/popup/js/table_modify.js new file mode 100644 index 0000000..db1c07b --- /dev/null +++ b/webedit/popup/js/table_modify.js @@ -0,0 +1,640 @@ +// ================================================================ +// CHEditor 5 +// ---------------------------------------------------------------- +// Homepage: http://www.chcode.com +// Copyright (c) 1997-2015 CHSOFT +// ================================================================ +var oEditor = null; +var button = [ { alt : "", img : 'submit.gif', cmd : doSubmit }, + { alt : "", img : 'cancel.gif', cmd : popupClose } ]; + +var colour = ["ffffcc","ffcc66","ff9900","ffcc99","ff6633","ffcccc","cc9999","ff6699","ff99cc","ff66cc","ffccff","cc99cc","cc66ff","cc99ff","9966cc","ccccff","9999cc","3333ff","6699ff","0066ff","99ccff","66ccff","99cccc","ccffff","99ffcc","66cc99","66ff99","99ff99","ccffcc","33ff33","66ff00","ccff99","99ff00","ccff66","cccc66","ffffff", + "ffff99","ffcc00","ff9933","ff9966","cc3300","ff9999","cc6666","ff3366","ff3399","ff00cc","ff99ff","cc66cc","cc33ff","9933cc","9966ff","9999ff","6666ff","3300ff","3366ff","0066cc","3399ff","33ccff","66cccc","99ffff","66ffcc","33cc99","33ff99","66ff66","99cc99","00ff33","66ff33","99ff66","99ff33","ccff00","cccc33","cccccc", + "ffff66","ffcc33","cc9966","ff6600","ff3300","ff6666","cc3333","ff0066","ff0099","ff33cc","ff66ff","cc00cc","cc00ff","9933ff","6600cc","6633ff","6666cc","3300cc","0000ff","3366cc","0099ff","00ccff","339999","66ffff","33ffcc","00cc99","00ff99","33ff66","66cc66","00ff00","33ff00","66cc00","99cc66","ccff33","999966","999999", + "ffff33","cc9900","cc6600","cc6633","ff0000","ff3333","993333","cc3366","cc0066","cc6699","ff33ff","cc33cc","9900cc","9900ff","6633cc","6600ff","666699","3333cc","0000cc","0033ff","6699cc","3399cc","669999","33ffff","00ffcc","339966","33cc66","00ff66","669966","00cc00","33cc00","66cc33","99cc00","cccc99","999933","666666", + "ffff00","cc9933","996633","993300","cc0000","ff0033","990033","996666","993366","cc0099","ff00ff","990099","996699","660099","663399","330099","333399","000099","0033cc","003399","336699","0099cc","006666","00ffff","33cccc","009966","00cc66","339933","336633","33cc33","339900","669933","99cc33","666633","999900","333333", + "cccc00","996600","663300","660000","990000","cc0033","330000","663333","660033","990066","cc3399","993399","660066","663366","330033","330066","333366","000066","000033","003366","006699","003333","336666","00cccc","009999","006633","009933","006600","003300","00cc33","009900","336600","669900","333300","666600","000000"]; + +var none = '없음'; +var modifyTable; +var beforeHeaderType; +var whichColor = null; + +function popupClose() { + oEditor.popupWinCancel(); +} + +function isError() { + alert('표 정보를 얻을 수 없습니다. 수정하실 표을 다시 한 번 선택해 주십시오.'); + popupClose(); +} + +function init(dialog) { + oEditor = this; + oEditor.dialog = dialog; + + var dlg = new Dialog(oEditor); + dlg.showButton(button); + dlg.setDialogHeight(); + + var rng = oEditor.range, pNode; + + if (oEditor.W3CRange) { + pNode = rng.commonAncestorContainer; + if (!rng.collapsed && + rng.startContainer === rng.endContainer && + rng.startOffset - rng.endOffset < 2 && + rng.startContainer.hasChildNodes()) + { + pNode = rng.startContainer.childNodes[rng.startOffset]; + } + + while (pNode.nodeType === 3) { + pNode = pNode.parentNode; + } + + if (pNode.nodeName !== 'TD' && pNode.nodeName !== 'TH' && pNode.nodeName !== 'CAPTION' && pNode.nodeName !== 'TABLE') + { + isError(); + return; + } + } + else { + if (rng.item) { + pNode = rng.item(0); + if (pNode.nodeName.toLowerCase() !== 'table') { + isError(); + return; + } + } + else { + pNode = rng.parentElement(); + } + } + + while (pNode && pNode.nodeName.toLowerCase() !== 'table') { + pNode = pNode.parentNode; + } + + if (pNode.nodeName.toLowerCase() !== 'table') { + isError(); + return; + } + + modifyTable = pNode; + var border, el_size, fm_size, el_type, fm_type, cellpd, cellsp, bgcolor, idbgcolor, + bordercolor, idbordercolor, captionValue, summaryValue, caption, captionInput, summary; + + border = modifyTable.getAttribute('border'); + if (!border || isNaN(border)) { + border = parseInt(modifyTable.style.borderWidth, 10); + if (!border) { + border = 0; + } + } + document.getElementById("bordersize").value = border; + + if (modifyTable.className !== '') { + document.getElementById('cssClass').value = modifyTable.className; + } + if (modifyTable.id !== '') { + document.getElementById('cssId').value = modifyTable.id; + } + + el_size = modifyTable.getAttribute('width'); + if (!el_size) { + el_size = modifyTable.style.width; + } + + fm_size = document.getElementById("width"); + el_type = 'px'; + fm_type = document.getElementById("widthtype"); + + if (el_size) { + el_type = (/%$/.test(el_size)) ? '%' : 'px'; + el_size = parseInt(el_size, 10); + if (isNaN(el_size)) { + el_size = ''; + } + } + else { + el_size = ''; + } + + fm_size.value = el_size; + fm_type.value = el_type; + + el_size = modifyTable.getAttribute('height'); + if (!el_size) { + el_size = modifyTable.style.height; + } + fm_size = document.getElementById("height"); + el_type = 'px'; + fm_type = document.getElementById("heighttype"); + + if (el_size) { + el_type = (/\%$/.test(el_size)) ? '%' : 'px'; + el_size = parseInt(el_size, 10); + if (isNaN(el_size)) { + el_size = ''; + } + } + else { + el_size = ''; + } + + fm_size.value = el_size; + fm_type.value = el_type; + + fm_type = modifyTable.getAttribute('align'); + if (!fm_type) { + fm_type = 'none'; + } + document.getElementById("talign").value = fm_type; + + cellpd = modifyTable.getAttribute('cellpadding'); + if (isNaN(cellpd)) { + cellpd = 0; + } + document.getElementById("cellpd").value = cellpd || 0; + + cellsp = modifyTable.getAttribute('cellspacing'); + if (isNaN(cellsp)) { + cellsp = 0; + } + document.getElementById("cellsp").value = cellsp || 0; + + bgcolor = modifyTable.getAttribute('bgcolor'); + idbgcolor = document.getElementById("idbgcolor"); + if (bgcolor) { + if (/rgb/.test(bgcolor)) { + bgcolor = oEditor.colorConvert(bgcolor, 'hex'); + } + idbgcolor.value = bgcolor.toLowerCase(); + idbgcolor.style.backgroundColor = idbgcolor.value; + } + else { + idbgcolor.value = none; + } + + bordercolor = modifyTable.getAttribute('bordercolor'); + if (!bordercolor) { + bordercolor = modifyTable.style.borderColor; + if (bordercolor) { + bordercolor = oEditor.colorConvert(bordercolor, 'hex'); + } + else { + bordercolor = null; + } + } + + idbordercolor = document.getElementById("idbordercolor"); + if (bordercolor) { + if (/rgb/.test(bordercolor)) { + bordercolor = oEditor.colorConvert(bordercolor, 'hex'); + } + idbordercolor.value = bordercolor.toLowerCase(); + idbordercolor.style.backgroundColor = idbordercolor.value; + } + else { + idbordercolor.value = none; + } + + caption = modifyTable.getElementsByTagName('caption')[0]; + if (caption) { + captionValue = oEditor.trimSpace(caption.innerHTML); + if (captionValue !== '') { + captionInput = document.getElementById('tableCaption'); + captionInput.value = captionValue; + + if (caption.style.visibility === 'hidden') { + document.getElementById('hideCaption').checked = 'checked'; + } + } + } + + summaryValue = modifyTable.getAttribute('summary'); + if (summaryValue) { + summaryValue = oEditor.trimSpace(summaryValue); + if (summaryValue !== '') { + summary = document.getElementById('tableSummary'); + summary.value = summaryValue; + } + } + + var tableHeader, rows, i, j, cells, headCol, headRow, rowLength, rowCellLength, cellLength, header, headTagName; + headCol = headRow = null; + headTagName = 'th'; + + tableHeader = document.getElementById('tableHeader'); + rows = (modifyTable.rows && modifyTable.rows.length > 0) ? modifyTable.rows : modifyTable.getElementsByTagName('tr'); + rowLength = rows.length; + + document.getElementById('numrows').appendChild(document.createTextNode(rowLength)); + + if (rowLength > 0) { + cells = rows[0].cells; + cellLength = cells.length; + if (cellLength > 0) { + for (j=0; j < cellLength; j++) { + if (cells[j].tagName.toLowerCase() === headTagName) { + headCol = 'col'; + } + else { + headCol = null; + break; + } + } + } + + rowCellLength = 0; + for (i=0; i < rowLength; i++) { + headRow = (rows[i].cells[0] && rows[i].cells[0].tagName.toLowerCase() === headTagName) ? 'row' : null; + if (rowCellLength < rows[i].cells.length) { + rowCellLength = rows[i].cells.length; + } + } + + if (headRow && headCol && cellLength === 1) { + headCol = null; + } + document.getElementById('numcols').appendChild(document.createTextNode(rowCellLength)); + } + + header = (headCol && headRow) ? 'all' : headCol || headRow || 'none'; + tableHeader.value = beforeHeaderType = header; +} + +function getColor() +{ + var color = this.bgColor; + var input = document.getElementById("id"+whichColor); + input.style.backgroundColor = input.value = color; +} + +function drawColor() { + var table, tr, td, insideTable, k = 0, i, j, tr2, td2; + + table = document.createElement('table'); + table.cellPadding = 0; + table.cellSpacing = 0; + table.border = 0; + table.align = 'center'; + tr = table.insertRow(0); + td = tr.insertCell(0); + td.style.backgroundColor = '#fff'; + + insideTable = document.createElement('table'); + insideTable.border = 0; + insideTable.cellSpacing = 1; + insideTable.cellPadding = 0; + insideTable.align = 'center'; + + var onMouseOver = function() { this.className = 'colorCellMouseOver'; }; + var onMouseOut = function() { this.className = 'colorCellMouseOut'; }; + + for (i = 0; i < 6; i++) { + tr2 = insideTable.insertRow(i); + for (j = 0; j < 36; j++) { + td2 = tr2.insertCell(j); + td2.setAttribute('bgColor', '#' + colour[k]); + td2.className = 'colorCellMouseOut'; + td2.onclick = getColor; + td2.appendChild(document.createTextNode('\u00a0')); + td2.onmouseover = onMouseOver; + td2.onmouseout = onMouseOut; + k++; + } + } + + td.appendChild(insideTable); + document.getElementById('colorWrapper').appendChild(table); +} + +function setColor(which) { + whichColor = which; +} + +function doSubmit() +{ + var width, widthType, widthValue, cellWidth, i, j, row, rows, cell; + width = document.getElementById("width"); + widthType = document.getElementById("widthtype").value; + if (width) { + widthValue = parseInt(oEditor.trimSpace(width.value), 10); + if (isNaN(widthValue)) { + cellWidth = widthValue = null; + } + else { + modifyTable.removeAttribute('width'); + modifyTable.style.width = widthValue + widthType; + rows = modifyTable.rows; + if (rows.length > 0) { + for (i=0; i < rows.length; i++) { + row = rows[i]; + for (j=0; j < row.cells.length; j++) { + cellWidth = parseInt(widthValue/row.cells.length, 10) + widthType; + cell = row.cells[j]; + cell.setAttribute("width", cellWidth); + } + } + } + } + } + + var height, heightValue; + height = document.getElementById("height"); + if (height) { + heightValue = parseInt(oEditor.trimSpace(height.value), 10); + if (isNaN(heightValue)) { + heightValue = null; + } + else { + heightValue += document.getElementById("heighttype").value; + modifyTable.removeAttribute('height'); + modifyTable.style.height = heightValue; + } + } + + var cellpadding, cellpaddingValue; + cellpadding = document.getElementById("cellpd"); + if (cellpadding) { + cellpaddingValue = oEditor.trimSpace(cellpadding.value); + if (!cellpaddingValue || isNaN(cellpaddingValue)) { + cellpaddingValue = 0; + } + else { + cellpaddingValue = parseInt(cellpaddingValue, 10); + } + modifyTable.setAttribute('cellpadding', cellpaddingValue); + } + + var cellspacing, cellspacingValue; + cellspacing = document.getElementById("cellsp"); + if (cellspacing) { + cellspacingValue = oEditor.trimSpace(cellspacing.value); + if (!cellspacingValue || isNaN(cellspacingValue)) { + cellspacingValue = 0; + } + else { + cellspacingValue = parseInt(cellspacingValue, 10); + } + modifyTable.setAttribute('cellspacing', cellspacingValue); + } + + var bgcolor, bgcolorValue; + bgcolor = document.getElementById("idbgcolor"); + if (bgcolor) { + bgcolorValue = oEditor.trimSpace(bgcolor.value); + if (bgcolorValue !== '' && bgcolorValue !== none) { + modifyTable.removeAttribute('bgcolor'); + modifyTable.bgColor = bgcolorValue; + } + } + + var align, alignValue; + align = document.getElementById("talign"); + if (align) { + alignValue = align.value; + if (alignValue !== 'none') { + modifyTable.removeAttribute('align'); + modifyTable.setAttribute('align', alignValue); + } + } + + var cssclass, cssclassValue, cssid, cssidValue; + cssclass = document.getElementById('cssClass'); + cssclassValue = oEditor.trimSpace(cssclass.value); + if (cssclassValue !== '') { + modifyTable.className = cssclassValue; + } + else { + modifyTable.removeAttribute('class'); + } + + cssid = document.getElementById('cssId'); + cssidValue = oEditor.trimSpace(cssid.value); + if (cssidValue !== '') { + modifyTable.id = cssidValue; + } + else { + modifyTable.removeAttribute('id'); + } + + var caption = document.getElementById('tableCaption'); + var captionValue = oEditor.trimSpace(caption.value); + var summary = document.getElementById('tableSummary'); + var summaryValue = oEditor.trimSpace(summary.value); + var oCaption; + + if (summaryValue !== '') { + modifyTable.setAttribute('summary', summaryValue); + } + if (captionValue !== '') { + var hideCaption, tableCaption; + tableCaption = modifyTable.createCaption(); + tableCaption.innerHTML = captionValue; + + hideCaption = document.getElementById('hideCaption'); + if (hideCaption.checked === true) { + tableCaption.style.visibility = 'hidden'; + tableCaption.style.overFlow = 'hidden'; + tableCaption.style.lineHeight = '0px'; + tableCaption.style.position = 'absolute'; + tableCaption.style.display = 'none'; + } + else { + tableCaption.removeAttribute('style'); + } + } + else { + oCaption = modifyTable.getElementsByTagName('caption')[0]; + if (oCaption) { + modifyTable.removeChild(oCaption); + } + } + + var copyAttribute = function(target, source) { + var attr, attrValue, nodeName; + attr = source.attributes; + for (i=0; i= 0; j--) { + row.deleteCell(j); + } + + for (j=0; j < newCells.length; j++) { + row.appendChild(newCells[j]); + } + + if (newTagName === 'th') { + oHead = modifyTable.getElementsByTagName('thead')[0]; + if (!oHead) { + oHead = document.createElement('thead'); + modifyTable.insertBefore(oHead, modifyTable.firstChild); + oHead.appendChild(row); + } + } + else if (row.parentNode.nodeName.toLowerCase() === 'thead') { + oHead = row.parentNode; + if (rows[1]) { + rows[1].parentNode.insertBefore(row, rows[1]); + } + else { + modifyTable.insertBefore(row, oHead); + } + modifyTable.removeChild(oHead); + } + }; + + var replaceRow = function (rows, newTagName) { + var len, newCell, sourceCell; + len = rows.length; + for (i=0; i < len; i++) { + row = rows[i]; + sourceCell = row.cells[0]; + newCell = document.createElement(newTagName); + + if (newTagName === 'th') { + newCell.setAttribute('scope', 'row'); + } + else { + sourceCell.removeAttribute('scope'); + } + + row.insertBefore(newCell, sourceCell); + copyAttribute(newCell, sourceCell); + copyChildNodes(newCell, sourceCell); + row.deleteCell(1); + } + }; + + var border, borderValue; + if (beforeHeaderType !== tableHeader) { + rows = (modifyTable.rows && modifyTable.rows.length > 0) ? + modifyTable.rows : + modifyTable.getElementsByTagName('tr'); + + if (tableHeader === 'col') { + replaceRow(rows, 'td'); + replaceCol(rows, 'th'); + } + else if (tableHeader === 'row') { + replaceCol(rows, 'td'); + replaceRow(rows, 'th'); + } + else if (tableHeader === 'all') { + replaceCol(rows, 'th'); + replaceRow(rows, 'th'); + } + else if (tableHeader === 'none') { + replaceCol(rows, 'td'); + replaceRow(rows, 'td'); + } + + oCaption = modifyTable.getElementsByTagName('caption')[0]; + if (oCaption && oCaption !== modifyTable.firstChild) { + modifyTable.insertBefore(oCaption, modifyTable.firstChild); + } + } + + + border = document.getElementById("bordersize"); + if (border) { + borderValue = oEditor.trimSpace(border.value); + if (isNaN(borderValue) === false) { + var borderColor, borderColorValue; + borderValue = parseInt(borderValue, 10); + rows = (modifyTable.rows && modifyTable.rows.length > 0) ? + modifyTable.rows : + modifyTable.getElementsByTagName('tr'); + + if (borderValue) { + borderColor = document.getElementById("idbordercolor"); + if (borderColor) { + borderColorValue = oEditor.trimSpace(borderColor.value); + } + if (!borderColorValue || borderColorValue === none) { + borderColorValue = '#000000'; + } + + borderColorValue = oEditor.colorConvert(borderColorValue, 'rgb'); + + modifyTable.style.border = borderValue + 'px solid ' + borderColorValue; + modifyTable.style.borderCollapse = "collapse"; + modifyTable.removeAttribute('border'); + + for (i=0; i < rows.length; i++) { + row = rows[i]; + for (j=0; j < row.cells.length; j++) { + cell = row.cells[j]; + cell.style.border = borderValue + 'px solid ' + borderColorValue; + } + } + } + else if (borderValue === 0) { + modifyTable.removeAttribute('border'); + modifyTable.style.border = ''; + modifyTable.style.borderCollapse = ''; + for (i=0; i < rows.length; i++) { + row = rows[i]; + for (j=0; j < row.cells.length; j++) { + cell = row.cells[j]; + cell.style.border = ''; + } + } + } + } + } + + oEditor.editArea.focus(); + oEditor.backupRange(oEditor.restoreRange()); + oEditor.clearStoredSelections(); + oEditor.popupWinClose(); +} \ No newline at end of file diff --git a/webedit/popup/link.html b/webedit/popup/link.html new file mode 100644 index 0000000..5d31a5d --- /dev/null +++ b/webedit/popup/link.html @@ -0,0 +1,71 @@ + + + +CHEditor + + + + + + + +
+ +
+ + + + +
+ + + + + + + + + + + + + + + +
유형: + + + 타겟: + + +
URL: + + +
타이틀: + + +
+
+
+
+
+
+ + diff --git a/webedit/popup/media.html b/webedit/popup/media.html new file mode 100644 index 0000000..1cd6934 --- /dev/null +++ b/webedit/popup/media.html @@ -0,0 +1,41 @@ + + + + CHEditor + + + + + + + +
+
미디어 재생 + + + + +
+
+
+
+
+
미디어 파일 URL + + + + + + + +
+ URL 입력: +
+ +
+
+
+
+
+ + diff --git a/webedit/popup/symbol.html b/webedit/popup/symbol.html new file mode 100644 index 0000000..9db85c2 --- /dev/null +++ b/webedit/popup/symbol.html @@ -0,0 +1,27 @@ + + + + CHEditor + + + + + + + + | + | + | + | + | + +
+ +
+
+ 선택한 문자: +
+
+
+ + diff --git a/webedit/popup/table.html b/webedit/popup/table.html new file mode 100644 index 0000000..e96ced3 --- /dev/null +++ b/webedit/popup/table.html @@ -0,0 +1,179 @@ + + + + CHEditor + + + + + + + +
표 속성 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
줄 수: + + 칸 수: + +

너비: + + + + 높이: + + + +
셀 안 여백: + + 셀 간격: + +
테두리 굵기: +  픽셀 + 정렬: + +

표 제목: + + 표 제목 숨김: +
표 요약: + + 표 헤더: + +

CSS class: + + CSS id: + +
+
+
+
+
색 지정 +
+ + + + + + + +
테두리 색: + +
+ +
+
 
+
표 배경색: + +
+ +
+
 
+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/webedit/popup/table_modify.html b/webedit/popup/table_modify.html new file mode 100644 index 0000000..8df7eee --- /dev/null +++ b/webedit/popup/table_modify.html @@ -0,0 +1,181 @@ + + + + CHEditor + + + + + + + +
표 속성 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
줄 수: + + 칸 수: + +

너비: + + + + 높이: + + + +
셀 안 여백: + + 셀 간격: + +
테두리 굵기: + + 정렬: + +

표 제목: + + 표 제목 숨김: + +
표 요약: + + 표 헤더: + +

CSS class: + + CSS id: + +
+
+
+
+
색 지정 +
+ + + + + + + +
테두리 색: + +
+ +
+
 
+
표 배경색: + +
+ +
+
 
+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/webedit/template.dtd b/webedit/template.dtd new file mode 100644 index 0000000..212845e --- /dev/null +++ b/webedit/template.dtd @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/webedit/template.xml b/webedit/template.xml new file mode 100644 index 0000000..916259c --- /dev/null +++ b/webedit/template.xml @@ -0,0 +1,385 @@ + + + + \ No newline at end of file diff --git a/webedit/utils/crossdomain.xml b/webedit/utils/crossdomain.xml new file mode 100644 index 0000000..937dc72 --- /dev/null +++ b/webedit/utils/crossdomain.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/webedit_org/Editor.html b/webedit_org/Editor.html new file mode 100644 index 0000000..49a2076 --- /dev/null +++ b/webedit_org/Editor.html @@ -0,0 +1,108 @@ + + + +
+ + + + + + + + + + + \ No newline at end of file diff --git a/webedit/SmartEditor2.html b/webedit_org/SmartEditor2.html similarity index 100% rename from webedit/SmartEditor2.html rename to webedit_org/SmartEditor2.html diff --git a/webedit/SmartEditor2Skin.html b/webedit_org/SmartEditor2Skin.html similarity index 100% rename from webedit/SmartEditor2Skin.html rename to webedit_org/SmartEditor2Skin.html diff --git a/webedit/SmartEditor2Skin_en_US.html b/webedit_org/SmartEditor2Skin_en_US.html similarity index 100% rename from webedit/SmartEditor2Skin_en_US.html rename to webedit_org/SmartEditor2Skin_en_US.html diff --git a/webedit/SmartEditor2Skin_ja_JP.html b/webedit_org/SmartEditor2Skin_ja_JP.html similarity index 100% rename from webedit/SmartEditor2Skin_ja_JP.html rename to webedit_org/SmartEditor2Skin_ja_JP.html diff --git a/webedit/SmartEditor2Skin_ko_KR.html b/webedit_org/SmartEditor2Skin_ko_KR.html similarity index 100% rename from webedit/SmartEditor2Skin_ko_KR.html rename to webedit_org/SmartEditor2Skin_ko_KR.html diff --git a/webedit/SmartEditor2Skin_zh_CN.html b/webedit_org/SmartEditor2Skin_zh_CN.html similarity index 100% rename from webedit/SmartEditor2Skin_zh_CN.html rename to webedit_org/SmartEditor2Skin_zh_CN.html diff --git a/webedit/SmartEditor2Skin_zh_TW.html b/webedit_org/SmartEditor2Skin_zh_TW.html similarity index 100% rename from webedit/SmartEditor2Skin_zh_TW.html rename to webedit_org/SmartEditor2Skin_zh_TW.html diff --git a/webedit/SmartEditor2noframe.html b/webedit_org/SmartEditor2noframe.html similarity index 100% rename from webedit/SmartEditor2noframe.html rename to webedit_org/SmartEditor2noframe.html diff --git a/webedit/autosave.editor.js b/webedit_org/autosave.editor.js similarity index 100% rename from webedit/autosave.editor.js rename to webedit_org/autosave.editor.js diff --git a/webedit/config.js b/webedit_org/config.js similarity index 100% rename from webedit/config.js rename to webedit_org/config.js diff --git a/webedit/css/en_US/smart_editor2.css b/webedit_org/css/en_US/smart_editor2.css similarity index 100% rename from webedit/css/en_US/smart_editor2.css rename to webedit_org/css/en_US/smart_editor2.css diff --git a/webedit/css/en_US/smart_editor2_in.css b/webedit_org/css/en_US/smart_editor2_in.css similarity index 100% rename from webedit/css/en_US/smart_editor2_in.css rename to webedit_org/css/en_US/smart_editor2_in.css diff --git a/webedit/css/en_US/smart_editor2_items.css b/webedit_org/css/en_US/smart_editor2_items.css similarity index 100% rename from webedit/css/en_US/smart_editor2_items.css rename to webedit_org/css/en_US/smart_editor2_items.css diff --git a/webedit/css/en_US/smart_editor2_out.css b/webedit_org/css/en_US/smart_editor2_out.css similarity index 100% rename from webedit/css/en_US/smart_editor2_out.css rename to webedit_org/css/en_US/smart_editor2_out.css diff --git a/webedit/css/ja_JP/smart_editor2.css b/webedit_org/css/ja_JP/smart_editor2.css similarity index 100% rename from webedit/css/ja_JP/smart_editor2.css rename to webedit_org/css/ja_JP/smart_editor2.css diff --git a/webedit/css/ja_JP/smart_editor2_in.css b/webedit_org/css/ja_JP/smart_editor2_in.css similarity index 100% rename from webedit/css/ja_JP/smart_editor2_in.css rename to webedit_org/css/ja_JP/smart_editor2_in.css diff --git a/webedit/css/ja_JP/smart_editor2_items.css b/webedit_org/css/ja_JP/smart_editor2_items.css similarity index 100% rename from webedit/css/ja_JP/smart_editor2_items.css rename to webedit_org/css/ja_JP/smart_editor2_items.css diff --git a/webedit/css/ja_JP/smart_editor2_out.css b/webedit_org/css/ja_JP/smart_editor2_out.css similarity index 100% rename from webedit/css/ja_JP/smart_editor2_out.css rename to webedit_org/css/ja_JP/smart_editor2_out.css diff --git a/webedit/css/ko_KR/smart_editor2.css b/webedit_org/css/ko_KR/smart_editor2.css similarity index 100% rename from webedit/css/ko_KR/smart_editor2.css rename to webedit_org/css/ko_KR/smart_editor2.css diff --git a/webedit/css/ko_KR/smart_editor2_in.css b/webedit_org/css/ko_KR/smart_editor2_in.css similarity index 100% rename from webedit/css/ko_KR/smart_editor2_in.css rename to webedit_org/css/ko_KR/smart_editor2_in.css diff --git a/webedit/css/ko_KR/smart_editor2_items.css b/webedit_org/css/ko_KR/smart_editor2_items.css similarity index 100% rename from webedit/css/ko_KR/smart_editor2_items.css rename to webedit_org/css/ko_KR/smart_editor2_items.css diff --git a/webedit/css/ko_KR/smart_editor2_out.css b/webedit_org/css/ko_KR/smart_editor2_out.css similarity index 100% rename from webedit/css/ko_KR/smart_editor2_out.css rename to webedit_org/css/ko_KR/smart_editor2_out.css diff --git a/webedit/css/zh_CN/smart_editor2.css b/webedit_org/css/zh_CN/smart_editor2.css similarity index 100% rename from webedit/css/zh_CN/smart_editor2.css rename to webedit_org/css/zh_CN/smart_editor2.css diff --git a/webedit/css/zh_CN/smart_editor2_in.css b/webedit_org/css/zh_CN/smart_editor2_in.css similarity index 100% rename from webedit/css/zh_CN/smart_editor2_in.css rename to webedit_org/css/zh_CN/smart_editor2_in.css diff --git a/webedit/css/zh_CN/smart_editor2_items.css b/webedit_org/css/zh_CN/smart_editor2_items.css similarity index 100% rename from webedit/css/zh_CN/smart_editor2_items.css rename to webedit_org/css/zh_CN/smart_editor2_items.css diff --git a/webedit/css/zh_CN/smart_editor2_out.css b/webedit_org/css/zh_CN/smart_editor2_out.css similarity index 100% rename from webedit/css/zh_CN/smart_editor2_out.css rename to webedit_org/css/zh_CN/smart_editor2_out.css diff --git a/webedit/css/zh_TW/smart_editor2.css b/webedit_org/css/zh_TW/smart_editor2.css similarity index 100% rename from webedit/css/zh_TW/smart_editor2.css rename to webedit_org/css/zh_TW/smart_editor2.css diff --git a/webedit/css/zh_TW/smart_editor2_in.css b/webedit_org/css/zh_TW/smart_editor2_in.css similarity index 100% rename from webedit/css/zh_TW/smart_editor2_in.css rename to webedit_org/css/zh_TW/smart_editor2_in.css diff --git a/webedit/css/zh_TW/smart_editor2_items.css b/webedit_org/css/zh_TW/smart_editor2_items.css similarity index 100% rename from webedit/css/zh_TW/smart_editor2_items.css rename to webedit_org/css/zh_TW/smart_editor2_items.css diff --git a/webedit/css/zh_TW/smart_editor2_out.css b/webedit_org/css/zh_TW/smart_editor2_out.css similarity index 100% rename from webedit/css/zh_TW/smart_editor2_out.css rename to webedit_org/css/zh_TW/smart_editor2_out.css diff --git a/webedit/img/bg_b1.png b/webedit_org/img/bg_b1.png similarity index 100% rename from webedit/img/bg_b1.png rename to webedit_org/img/bg_b1.png diff --git a/webedit/img/bg_button.gif b/webedit_org/img/bg_button.gif similarity index 100% rename from webedit/img/bg_button.gif rename to webedit_org/img/bg_button.gif diff --git a/webedit/img/bg_button_left.gif b/webedit_org/img/bg_button_left.gif similarity index 100% rename from webedit/img/bg_button_left.gif rename to webedit_org/img/bg_button_left.gif diff --git a/webedit/img/bg_button_right.gif b/webedit_org/img/bg_button_right.gif similarity index 100% rename from webedit/img/bg_button_right.gif rename to webedit_org/img/bg_button_right.gif diff --git a/webedit/img/bg_find_h3.gif b/webedit_org/img/bg_find_h3.gif similarity index 100% rename from webedit/img/bg_find_h3.gif rename to webedit_org/img/bg_find_h3.gif diff --git a/webedit/img/bg_help.gif b/webedit_org/img/bg_help.gif similarity index 100% rename from webedit/img/bg_help.gif rename to webedit_org/img/bg_help.gif diff --git a/webedit/img/bg_line1.gif b/webedit_org/img/bg_line1.gif similarity index 100% rename from webedit/img/bg_line1.gif rename to webedit_org/img/bg_line1.gif diff --git a/webedit/img/bg_quote2.gif b/webedit_org/img/bg_quote2.gif similarity index 100% rename from webedit/img/bg_quote2.gif rename to webedit_org/img/bg_quote2.gif diff --git a/webedit/img/bg_set.gif b/webedit_org/img/bg_set.gif similarity index 100% rename from webedit/img/bg_set.gif rename to webedit_org/img/bg_set.gif diff --git a/webedit/img/bg_spell.gif b/webedit_org/img/bg_spell.gif similarity index 100% rename from webedit/img/bg_spell.gif rename to webedit_org/img/bg_spell.gif diff --git a/webedit/img/bg_text_tool.gif b/webedit_org/img/bg_text_tool.gif similarity index 100% rename from webedit/img/bg_text_tool.gif rename to webedit_org/img/bg_text_tool.gif diff --git a/webedit/img/bx_set_110302.gif b/webedit_org/img/bx_set_110302.gif similarity index 100% rename from webedit/img/bx_set_110302.gif rename to webedit_org/img/bx_set_110302.gif diff --git a/webedit/img/en_US/btn_set.png b/webedit_org/img/en_US/btn_set.png similarity index 100% rename from webedit/img/en_US/btn_set.png rename to webedit_org/img/en_US/btn_set.png diff --git a/webedit/img/en_US/text_tool_set.png b/webedit_org/img/en_US/text_tool_set.png similarity index 100% rename from webedit/img/en_US/text_tool_set.png rename to webedit_org/img/en_US/text_tool_set.png diff --git a/webedit/img/ico_extend.png b/webedit_org/img/ico_extend.png similarity index 100% rename from webedit/img/ico_extend.png rename to webedit_org/img/ico_extend.png diff --git a/webedit/img/icon_set.gif b/webedit_org/img/icon_set.gif similarity index 100% rename from webedit/img/icon_set.gif rename to webedit_org/img/icon_set.gif diff --git a/webedit/img/ja_JP/btn_set.png b/webedit_org/img/ja_JP/btn_set.png similarity index 100% rename from webedit/img/ja_JP/btn_set.png rename to webedit_org/img/ja_JP/btn_set.png diff --git a/webedit/img/ja_JP/text_tool_set.png b/webedit_org/img/ja_JP/text_tool_set.png similarity index 100% rename from webedit/img/ja_JP/text_tool_set.png rename to webedit_org/img/ja_JP/text_tool_set.png diff --git a/webedit/img/ko_KR/btn_set.png b/webedit_org/img/ko_KR/btn_set.png similarity index 100% rename from webedit/img/ko_KR/btn_set.png rename to webedit_org/img/ko_KR/btn_set.png diff --git a/webedit/img/ko_KR/text_tool_set.png b/webedit_org/img/ko_KR/text_tool_set.png similarity index 100% rename from webedit/img/ko_KR/text_tool_set.png rename to webedit_org/img/ko_KR/text_tool_set.png diff --git a/webedit/img/photoQuickPopup/bg_drag_image.png b/webedit_org/img/photoQuickPopup/bg_drag_image.png similarity index 100% rename from webedit/img/photoQuickPopup/bg_drag_image.png rename to webedit_org/img/photoQuickPopup/bg_drag_image.png diff --git a/webedit/img/photoQuickPopup/btn_cancel.png b/webedit_org/img/photoQuickPopup/btn_cancel.png similarity index 100% rename from webedit/img/photoQuickPopup/btn_cancel.png rename to webedit_org/img/photoQuickPopup/btn_cancel.png diff --git a/webedit/img/photoQuickPopup/btn_confirm.png b/webedit_org/img/photoQuickPopup/btn_confirm.png similarity index 100% rename from webedit/img/photoQuickPopup/btn_confirm.png rename to webedit_org/img/photoQuickPopup/btn_confirm.png diff --git a/webedit/img/photoQuickPopup/btn_confirm2.png b/webedit_org/img/photoQuickPopup/btn_confirm2.png similarity index 100% rename from webedit/img/photoQuickPopup/btn_confirm2.png rename to webedit_org/img/photoQuickPopup/btn_confirm2.png diff --git a/webedit/img/photoQuickPopup/btn_del.png b/webedit_org/img/photoQuickPopup/btn_del.png similarity index 100% rename from webedit/img/photoQuickPopup/btn_del.png rename to webedit_org/img/photoQuickPopup/btn_del.png diff --git a/webedit/img/photoQuickPopup/btn_find.png b/webedit_org/img/photoQuickPopup/btn_find.png similarity index 100% rename from webedit/img/photoQuickPopup/btn_find.png rename to webedit_org/img/photoQuickPopup/btn_find.png diff --git a/webedit/img/zh_CN/btn_set.png b/webedit_org/img/zh_CN/btn_set.png similarity index 100% rename from webedit/img/zh_CN/btn_set.png rename to webedit_org/img/zh_CN/btn_set.png diff --git a/webedit/img/zh_CN/text_tool_set.png b/webedit_org/img/zh_CN/text_tool_set.png similarity index 100% rename from webedit/img/zh_CN/text_tool_set.png rename to webedit_org/img/zh_CN/text_tool_set.png diff --git a/webedit/img/zh_TW/btn_set.png b/webedit_org/img/zh_TW/btn_set.png similarity index 100% rename from webedit/img/zh_TW/btn_set.png rename to webedit_org/img/zh_TW/btn_set.png diff --git a/webedit/img/zh_TW/text_tool_set.png b/webedit_org/img/zh_TW/text_tool_set.png similarity index 100% rename from webedit/img/zh_TW/text_tool_set.png rename to webedit_org/img/zh_TW/text_tool_set.png diff --git a/webedit/js/lib/jindo2.all.js b/webedit_org/js/lib/jindo2.all.js similarity index 100% rename from webedit/js/lib/jindo2.all.js rename to webedit_org/js/lib/jindo2.all.js diff --git a/webedit/js/lib/jindo_component.js b/webedit_org/js/lib/jindo_component.js similarity index 100% rename from webedit/js/lib/jindo_component.js rename to webedit_org/js/lib/jindo_component.js diff --git a/webedit/js/service/HuskyEZCreator.js b/webedit_org/js/service/HuskyEZCreator.js similarity index 100% rename from webedit/js/service/HuskyEZCreator.js rename to webedit_org/js/service/HuskyEZCreator.js diff --git a/webedit/js/service/SE2BasicCreator.js b/webedit_org/js/service/SE2BasicCreator.js similarity index 100% rename from webedit/js/service/SE2BasicCreator.js rename to webedit_org/js/service/SE2BasicCreator.js diff --git a/webedit/js/service/SE2M_Configuration.js b/webedit_org/js/service/SE2M_Configuration.js similarity index 100% rename from webedit/js/service/SE2M_Configuration.js rename to webedit_org/js/service/SE2M_Configuration.js diff --git a/webedit/js/service/hp_SE_OuterIFrameControl.js b/webedit_org/js/service/hp_SE_OuterIFrameControl.js similarity index 100% rename from webedit/js/service/hp_SE_OuterIFrameControl.js rename to webedit_org/js/service/hp_SE_OuterIFrameControl.js diff --git a/webedit/js/service/hp_SE_ToolbarToggler.js b/webedit_org/js/service/hp_SE_ToolbarToggler.js similarity index 100% rename from webedit/js/service/hp_SE_ToolbarToggler.js rename to webedit_org/js/service/hp_SE_ToolbarToggler.js diff --git a/webedit/js/service/husky_SE2B_Lang_en_US.js b/webedit_org/js/service/husky_SE2B_Lang_en_US.js similarity index 100% rename from webedit/js/service/husky_SE2B_Lang_en_US.js rename to webedit_org/js/service/husky_SE2B_Lang_en_US.js diff --git a/webedit/js/service/husky_SE2B_Lang_ja_JP.js b/webedit_org/js/service/husky_SE2B_Lang_ja_JP.js similarity index 100% rename from webedit/js/service/husky_SE2B_Lang_ja_JP.js rename to webedit_org/js/service/husky_SE2B_Lang_ja_JP.js diff --git a/webedit/js/service/husky_SE2B_Lang_ko_KR.js b/webedit_org/js/service/husky_SE2B_Lang_ko_KR.js similarity index 100% rename from webedit/js/service/husky_SE2B_Lang_ko_KR.js rename to webedit_org/js/service/husky_SE2B_Lang_ko_KR.js diff --git a/webedit/js/service/husky_SE2B_Lang_zh_CN.js b/webedit_org/js/service/husky_SE2B_Lang_zh_CN.js similarity index 100% rename from webedit/js/service/husky_SE2B_Lang_zh_CN.js rename to webedit_org/js/service/husky_SE2B_Lang_zh_CN.js diff --git a/webedit/js/service/husky_SE2B_Lang_zh_TW.js b/webedit_org/js/service/husky_SE2B_Lang_zh_TW.js similarity index 100% rename from webedit/js/service/husky_SE2B_Lang_zh_TW.js rename to webedit_org/js/service/husky_SE2B_Lang_zh_TW.js diff --git a/webedit/js/smarteditor2.js b/webedit_org/js/smarteditor2.js similarity index 100% rename from webedit/js/smarteditor2.js rename to webedit_org/js/smarteditor2.js diff --git a/webedit/js/smarteditor2.min.js b/webedit_org/js/smarteditor2.min.js similarity index 100% rename from webedit/js/smarteditor2.min.js rename to webedit_org/js/smarteditor2.min.js diff --git a/webedit/photo_uploader/plugin/hp_SE2M_AttachQuickPhoto.js b/webedit_org/photo_uploader/plugin/hp_SE2M_AttachQuickPhoto.js similarity index 100% rename from webedit/photo_uploader/plugin/hp_SE2M_AttachQuickPhoto.js rename to webedit_org/photo_uploader/plugin/hp_SE2M_AttachQuickPhoto.js diff --git a/webedit/photo_uploader/popup/css/jquery.fileupload-noscript.css b/webedit_org/photo_uploader/popup/css/jquery.fileupload-noscript.css similarity index 100% rename from webedit/photo_uploader/popup/css/jquery.fileupload-noscript.css rename to webedit_org/photo_uploader/popup/css/jquery.fileupload-noscript.css diff --git a/webedit/photo_uploader/popup/css/jquery.fileupload-ui-noscript.css b/webedit_org/photo_uploader/popup/css/jquery.fileupload-ui-noscript.css similarity index 100% rename from webedit/photo_uploader/popup/css/jquery.fileupload-ui-noscript.css rename to webedit_org/photo_uploader/popup/css/jquery.fileupload-ui-noscript.css diff --git a/webedit/photo_uploader/popup/css/jquery.fileupload-ui.css b/webedit_org/photo_uploader/popup/css/jquery.fileupload-ui.css similarity index 100% rename from webedit/photo_uploader/popup/css/jquery.fileupload-ui.css rename to webedit_org/photo_uploader/popup/css/jquery.fileupload-ui.css diff --git a/webedit/photo_uploader/popup/css/jquery.fileupload.css b/webedit_org/photo_uploader/popup/css/jquery.fileupload.css similarity index 100% rename from webedit/photo_uploader/popup/css/jquery.fileupload.css rename to webedit_org/photo_uploader/popup/css/jquery.fileupload.css diff --git a/webedit/photo_uploader/popup/css/style.css b/webedit_org/photo_uploader/popup/css/style.css similarity index 100% rename from webedit/photo_uploader/popup/css/style.css rename to webedit_org/photo_uploader/popup/css/style.css diff --git a/webedit/photo_uploader/popup/img/delete.png b/webedit_org/photo_uploader/popup/img/delete.png similarity index 100% rename from webedit/photo_uploader/popup/img/delete.png rename to webedit_org/photo_uploader/popup/img/delete.png diff --git a/webedit/photo_uploader/popup/img/loading.gif b/webedit_org/photo_uploader/popup/img/loading.gif similarity index 100% rename from webedit/photo_uploader/popup/img/loading.gif rename to webedit_org/photo_uploader/popup/img/loading.gif diff --git a/webedit/photo_uploader/popup/img/progressbar.gif b/webedit_org/photo_uploader/popup/img/progressbar.gif similarity index 100% rename from webedit/photo_uploader/popup/img/progressbar.gif rename to webedit_org/photo_uploader/popup/img/progressbar.gif diff --git a/webedit/photo_uploader/popup/img/system_delete.png b/webedit_org/photo_uploader/popup/img/system_delete.png similarity index 100% rename from webedit/photo_uploader/popup/img/system_delete.png rename to webedit_org/photo_uploader/popup/img/system_delete.png diff --git a/webedit/photo_uploader/popup/index.html b/webedit_org/photo_uploader/popup/index.html similarity index 100% rename from webedit/photo_uploader/popup/index.html rename to webedit_org/photo_uploader/popup/index.html diff --git a/webedit/photo_uploader/popup/js/basic.js b/webedit_org/photo_uploader/popup/js/basic.js similarity index 100% rename from webedit/photo_uploader/popup/js/basic.js rename to webedit_org/photo_uploader/popup/js/basic.js diff --git a/webedit/photo_uploader/popup/js/jquery-1.8.3.min.js b/webedit_org/photo_uploader/popup/js/jquery-1.8.3.min.js similarity index 100% rename from webedit/photo_uploader/popup/js/jquery-1.8.3.min.js rename to webedit_org/photo_uploader/popup/js/jquery-1.8.3.min.js diff --git a/webedit/photo_uploader/popup/js/jquery-ui.min.js b/webedit_org/photo_uploader/popup/js/jquery-ui.min.js similarity index 100% rename from webedit/photo_uploader/popup/js/jquery-ui.min.js rename to webedit_org/photo_uploader/popup/js/jquery-ui.min.js diff --git a/webedit/photo_uploader/popup/js/jquery.fileupload-process.js b/webedit_org/photo_uploader/popup/js/jquery.fileupload-process.js similarity index 100% rename from webedit/photo_uploader/popup/js/jquery.fileupload-process.js rename to webedit_org/photo_uploader/popup/js/jquery.fileupload-process.js diff --git a/webedit/photo_uploader/popup/js/jquery.fileupload-ui.js b/webedit_org/photo_uploader/popup/js/jquery.fileupload-ui.js similarity index 100% rename from webedit/photo_uploader/popup/js/jquery.fileupload-ui.js rename to webedit_org/photo_uploader/popup/js/jquery.fileupload-ui.js diff --git a/webedit/photo_uploader/popup/js/jquery.fileupload.js b/webedit_org/photo_uploader/popup/js/jquery.fileupload.js similarity index 100% rename from webedit/photo_uploader/popup/js/jquery.fileupload.js rename to webedit_org/photo_uploader/popup/js/jquery.fileupload.js diff --git a/webedit/photo_uploader/popup/js/jquery.iframe-transport.js b/webedit_org/photo_uploader/popup/js/jquery.iframe-transport.js similarity index 100% rename from webedit/photo_uploader/popup/js/jquery.iframe-transport.js rename to webedit_org/photo_uploader/popup/js/jquery.iframe-transport.js diff --git a/webedit/photo_uploader/popup/js/jquery.ui.widget.js b/webedit_org/photo_uploader/popup/js/jquery.ui.widget.js similarity index 100% rename from webedit/photo_uploader/popup/js/jquery.ui.widget.js rename to webedit_org/photo_uploader/popup/js/jquery.ui.widget.js diff --git a/webedit/photo_uploader/popup/php/JSON.php b/webedit_org/photo_uploader/popup/php/JSON.php similarity index 100% rename from webedit/photo_uploader/popup/php/JSON.php rename to webedit_org/photo_uploader/popup/php/JSON.php diff --git a/webedit/photo_uploader/popup/php/UploadHandler.php b/webedit_org/photo_uploader/popup/php/UploadHandler.php similarity index 100% rename from webedit/photo_uploader/popup/php/UploadHandler.php rename to webedit_org/photo_uploader/popup/php/UploadHandler.php diff --git a/webedit/photo_uploader/popup/php/index.php b/webedit_org/photo_uploader/popup/php/index.php similarity index 100% rename from webedit/photo_uploader/popup/php/index.php rename to webedit_org/photo_uploader/popup/php/index.php diff --git a/webedit/photo_uploader/popup/swfupload/XPButtonUploadText_61x22.png b/webedit_org/photo_uploader/popup/swfupload/XPButtonUploadText_61x22.png similarity index 100% rename from webedit/photo_uploader/popup/swfupload/XPButtonUploadText_61x22.png rename to webedit_org/photo_uploader/popup/swfupload/XPButtonUploadText_61x22.png diff --git a/webedit/photo_uploader/popup/swfupload/fileprogress.js b/webedit_org/photo_uploader/popup/swfupload/fileprogress.js similarity index 100% rename from webedit/photo_uploader/popup/swfupload/fileprogress.js rename to webedit_org/photo_uploader/popup/swfupload/fileprogress.js diff --git a/webedit/photo_uploader/popup/swfupload/handlers.js b/webedit_org/photo_uploader/popup/swfupload/handlers.js similarity index 100% rename from webedit/photo_uploader/popup/swfupload/handlers.js rename to webedit_org/photo_uploader/popup/swfupload/handlers.js diff --git a/webedit/photo_uploader/popup/swfupload/jquery.swfupload.js b/webedit_org/photo_uploader/popup/swfupload/jquery.swfupload.js similarity index 100% rename from webedit/photo_uploader/popup/swfupload/jquery.swfupload.js rename to webedit_org/photo_uploader/popup/swfupload/jquery.swfupload.js diff --git a/webedit/photo_uploader/popup/swfupload/swfupload.js b/webedit_org/photo_uploader/popup/swfupload/swfupload.js similarity index 100% rename from webedit/photo_uploader/popup/swfupload/swfupload.js rename to webedit_org/photo_uploader/popup/swfupload/swfupload.js diff --git a/webedit/photo_uploader/popup/swfupload/swfupload.queue.js b/webedit_org/photo_uploader/popup/swfupload/swfupload.queue.js similarity index 100% rename from webedit/photo_uploader/popup/swfupload/swfupload.queue.js rename to webedit_org/photo_uploader/popup/swfupload/swfupload.queue.js diff --git a/webedit/photo_uploader/popup/swfupload/swfupload.swf b/webedit_org/photo_uploader/popup/swfupload/swfupload.swf similarity index 100% rename from webedit/photo_uploader/popup/swfupload/swfupload.swf rename to webedit_org/photo_uploader/popup/swfupload/swfupload.swf diff --git a/webedit/sample.php b/webedit_org/sample.php similarity index 100% rename from webedit/sample.php rename to webedit_org/sample.php diff --git a/webedit/shortcut.html b/webedit_org/shortcut.html similarity index 100% rename from webedit/shortcut.html rename to webedit_org/shortcut.html diff --git a/webedit/smart_editor2_inputarea.html b/webedit_org/smart_editor2_inputarea.html similarity index 100% rename from webedit/smart_editor2_inputarea.html rename to webedit_org/smart_editor2_inputarea.html diff --git a/webedit/smart_editor2_inputarea_ie8.html b/webedit_org/smart_editor2_inputarea_ie8.html similarity index 100% rename from webedit/smart_editor2_inputarea_ie8.html rename to webedit_org/smart_editor2_inputarea_ie8.html