17 lines
349 KiB
JavaScript
17 lines
349 KiB
JavaScript
|
|
/**
|
|||
|
|
* SmartEditor2 NAVER_Library:SE2.8.2.O12056
|
|||
|
|
* Copyright NAVER Corp. Licensed under LGPL v2
|
|||
|
|
* See license text at http://dev.naver.com/projects/smarteditor/wiki/LICENSE
|
|||
|
|
*/
|
|||
|
|
function fontProperty(e,t,i,n,o){this.fontId=e,this.fontName=t,this.defaultSize=i,this.fontURL=n,this.fontCSSURL=o,this.displayName=t,this.isLoaded=!0,this.fontFamily=this.fontId,""!=this.fontCSSURL?(this.displayName+=""+i,this.fontFamily+="_"+i,this.isLoaded=!1,this.loadCSS=function(e){this.isLoaded||(this._importCSS(e),this.isLoaded=!0)},this.loadCSSToMenu=function(){this._importCSS(document)},this._importCSS=function(e){var t=e.styleSheets.length,i=e.styleSheets[t-1];(0===t||30==i.imports.length)&&(e.createStyleSheet?i=e.createStyleSheet():(i=e.createElement("style"),e.documentElement.firstChild.appendChild(i),i=i.sheet)),i.addImport(this.fontCSSURL)}):(this.loadCSS=function(){},this.loadCSSToMenu=function(){}),this.toStruct=function(){return{fontId:this.fontId,fontName:this.fontName,defaultSize:this.defaultSize,fontURL:this.fontURL,fontCSSURL:this.fontCSSURL}}}function Shortcut(e,t){var e=e.replace(/\s+/g,""),i=Shortcut.Store,n=Shortcut.Action;if("undefined"==typeof t&&e.constructor==String)return i.set("document",e,document),n.init(i.get("document"),e);if(t.constructor==String&&e.constructor==String)return i.set(t,e,jindo.$(t)),n.init(i.get(t),e);if(t.constructor!=String&&e.constructor==String){var o="nonID"+(new Date).getTime();return o=Shortcut.Store.searchId(o,t),i.set(o,e,t),n.init(i.get(o),e)}alert(t+"는 반드시 string이거나 없어야 됩니다.")}"undefined"==typeof window.nhn&&(window.nhn={}),nhn.husky||(nhn.husky={}),function(){var e=/^\$(LOCAL|BEFORE|ON|AFTER)_/,t=/^\$(BEFORE|ON|AFTER)_MSG_APP_READY$/,i=[],n={};nhn.husky.HuskyCore=jindo.$Class({name:"HuskyCore",aCallerStack:null,bMobile:jindo.$Agent().navigator().mobile||jindo.$Agent().navigator().msafari,$init:function(e){this.htOptions=e||{},i.push(this),this.htOptions.oDebugger&&(nhn.husky.HuskyCore.getCore=function(){return i},this.htOptions.oDebugger.setApp(this)),this.messageQueue=[],this.oMessageMap={},this.oDisabledMessage={},this.oLazyMessage={},this.aPlugins=[],this.appStatus=nhn.husky.APP_STATUS.NOT_READY,this.aCallerStack=[],this._fnWaitForPluginReady=jindo.$Fn(this._waitForPluginReady,this).bind(),this.registerPlugin(this)},setDebugger:function(e){this.htOptions.oDebugger=e,e.setApp(this)},exec:function(e,t,i){return this.appStatus==nhn.husky.APP_STATUS.NOT_READY?(this.messageQueue[this.messageQueue.length]={msg:e,args:t,event:i},!0):(this.exec=this._exec,void this.exec(e,t,i))},delayedExec:function(e,t,i,n){var o=jindo.$Fn(this.exec,this).bind(e,t,n);setTimeout(o,i)},_exec:function(e,t,i){return(this._exec=this.htOptions.oDebugger?this._execWithDebugger:this._execWithoutDebugger).call(this,e,t,i)},_execWithDebugger:function(e,t,i){this.htOptions.oDebugger.log_MessageStart(e,t);var n=this._doExec(e,t,i);return this.htOptions.oDebugger.log_MessageEnd(e,t),n},_execWithoutDebugger:function(e,t,i){return this._doExec(e,t,i)},_doExec:function(e,t,i){var n=!1;if(this.oLazyMessage[e]){var o=this.oLazyMessage[e];return this._loadLazyFiles(e,t,i,o.aFilenames,0),!1}if(!this.oDisabledMessage[e]){var s=[];if(t&&t.length)for(var r=t.length,a=0;r>a;a++)s[a]=t[a];i&&(s[s.length]=i),n=this._execMsgStep("BEFORE",e,s),n&&(n=this._execMsgStep("ON",e,s)),n&&(n=this._execMsgStep("AFTER",e,s))}return n},registerPlugin:function(t){if(!t)throw"An error occured in registerPlugin(): invalid plug-in";if(t.nIdx=this.aPlugins.length,t.oApp=this,this.aPlugins[t.nIdx]=t,t.status!=nhn.husky.PLUGIN_STATUS.NOT_READY&&(t.status=nhn.husky.PLUGIN_STATUS.READY),this.appStatus!=nhn.husky.APP_STATUS.NOT_READY)for(var i in t)e.test(i)&&this.addToMessageMap(i,t);return this.exec("MSG_PLUGIN_REGISTERED",[t]),t.nIdx},disableMessage:function(e,t){this.oDisabledMessage[e]=t},registerBrowserEvent:function(e,t,i,n,o){n=n||[];var s=o?jindo.$Fn(this.delayedExec,this).bind(i,n,o):jindo.$Fn(this.exec,this).bind(i,n);return jindo.$Fn(s,this).attach(e,t)},run:function(e){this.htRunOptions=e||{},this._changeAppStatus(nhn.husky.APP_STATUS.WAITING_FOR_PLUGINS_READY);for(var t=this.messageQueue.length,i=0;t>i;i++){var n=this.messageQueue[i];this.exec(n.msg,n.args,n.event)}this._fnWaitForPlugin
|
|||
|
|
this._splitTextEndNodesOfTheRange();var i,n,o=this.getStartNode(),s=this.getEndNode(),r=this._getNodesInRange(),a=[],l=0,h=r.length,d=jindo.$A(r).filter(function(e){return!e.firstChild||t&&"LI"==e.tagName}),c=this.commonAncestorContainer;if(t)for(;c;){if("LI"==c.tagName){this._isFullyContained(c,d)&&(a[l++]=c);break}c=c.parentNode}for(var p=0;h>p;p++)if(i=r[p])if(t&&"LI"==i.tagName&&this._isFullyContained(i,d))a[l++]=i;else if(3==i.nodeType&&""!=i.nodeValue&&!i.nodeValue.match(/^(\r|\n)+$/)){var _=nhn.DOMFix.parentNode(i);if("SPAN"==_.tagName){if(this._isFullyContained(_,d,i)){a[l++]=_;continue}}else{var E=this._findParentSingleSpan(_);if(E){a[l++]=E;continue}}n=this._document.createElement("SPAN"),_.insertBefore(n,i),n.appendChild(i),a[l++]=n,e&&n.setAttribute(e,"true")}return this.setStartBefore(o),this.setEndAfter(s),a},_findParentSingleSpan:function(e){if(!e)return null;for(var t,i,n=0,o=0,s=e.childNodes;i=s[n];n++)if(t=i.nodeValue,!this._rxCursorHolder.test(t)&&(o++,o>1))return null;return"SPAN"===e.nodeName?e:this._findParentSingleSpan(e.parentNode)},_isFullyContained:function(e,t,i){var n,o,s=this._getVeryFirstRealChild(e);return n=i&&s==i?1:t.indexOf(s),-1!=n&&(s=this._getVeryLastRealChild(e),o=i&&s==i?1:t.indexOf(s)),-1!=n&&-1!=o},_getVeryFirstChild:function(e){return e.firstChild?this._getVeryFirstChild(e.firstChild):e},_getVeryLastChild:function(e){return e.lastChild?this._getVeryLastChild(e.lastChild):e},_getFirstRealChild:function(e){for(var t=e.firstChild;t&&3==t.nodeType&&""==t.nodeValue;)t=t.nextSibling;return t},_getLastRealChild:function(e){for(var t=e.lastChild;t&&3==t.nodeType&&""==t.nodeValue;)t=t.previousSibling;return t},_getVeryFirstRealChild:function(e){var t=this._getFirstRealChild(e);return t?this._getVeryFirstRealChild(t):e},_getVeryLastRealChild:function(e){var t=this._getLastRealChild(e);return t?this._getVeryLastChild(t):e},_getLineStartInfo:function(e){function t(e){if(e&&!n){if(a.test(e.tagName))return s=e,n=o,void(r=!0);o=e,i(e.previousSibling),n||t(nhn.DOMFix.parentNode(e))}}function i(e){if(e&&!n){if(a.test(e.tagName))return s=e,n=o,void(r=!1);if(e.firstChild&&"TABLE"!=e.tagName)for(var t=e.lastChild;t&&!n;)i(t),t=t.previousSibling;else o=e;n||i(e.previousSibling)}}var n=null,o=e,s=e,r=!1,a=this.rxLineBreaker;return a.test(e.tagName)?n=e:t(e),{oNode:n,oLineBreaker:s,bParentBreak:r}},_getLineEndInfo:function(e){function t(e){if(e&&!n){if(a.test(e.tagName))return s=e,n=o,void(r=!0);o=e,i(e.nextSibling),n||t(nhn.DOMFix.parentNode(e))}}function i(e){if(e&&!n){if(a.test(e.tagName))return s=e,n=o,void(r=!1);if(e.firstChild&&"TABLE"!=e.tagName)for(var t=e.firstChild;t&&!n;)i(t),t=t.nextSibling;else o=e;n||i(e.nextSibling)}}var n=null,o=e,s=e,r=!1,a=this.rxLineBreaker;return a.test(e.tagName)?n=e:t(e),{oNode:n,oLineBreaker:s,bParentBreak:r}},getLineInfo:function(e){var e=e||!1,t=this.getStartNode(),i=this.getEndNode();t||(t=this.getNodeAroundRange(!e,!0)),i||(i=this.getNodeAroundRange(!e,!0));var n=this._getLineStartInfo(t),o=n.oNode,s=this._getLineEndInfo(i),r=s.oNode;if(t!=o||i!=r){var a=this._compareEndPoint(nhn.DOMFix.parentNode(o),this._getPosIdx(o),this.endContainer,this.endOffset),l=this._compareEndPoint(nhn.DOMFix.parentNode(r),this._getPosIdx(r)+1,this.startContainer,this.startOffset);0>=a&&l>=0||(t=this.getNodeAroundRange(!1,!0),i=this.getNodeAroundRange(!1,!0),n=this._getLineStartInfo(t),s=this._getLineEndInfo(i))}return{oStart:n,oEnd:s}},_findSingleChild:function(e){if(!e)return null;for(var t,i,n=null,o=0,s=0,r=e.childNodes;i=r[o];o++)if(t=i.nodeValue,!this._rxCursorHolder.test(t)&&(n=i,s++,s>1))return null;return n},_hasCursorHolderOnly:function(e){return e&&1===e.nodeType?this._rxCursorHolder.test(e.innerHTML)?!0:this._hasCursorHolderOnly(this._findSingleChild(e)):!1}}).extend(nhn.W3CDOMRange),nhn.BrowserSelection=function(e){this.init=function(e){this._window=e||window,this._document=this._window.document},this.init(e),this._document.createRange?nhn.BrowserSelectionImpl_FF.apply(this):nhn.BrowserSelectionImpl_IE.apply(this),this.selectRange=function(e){this.selectNone(),this.a
|
|||
|
|
this.sBlankPageURL="smart_editor2_inputarea.html",this.sBlankPageURL_EmulateIE7="smart_editor2_inputarea_ie8.html",this.aAddtionalEmulateIE7=[],this.htOptions=nhn.husky.SE2M_Configuration.SE_EditingAreaManager,this.htOptions&&(this.sBlankPageURL=this.htOptions.sBlankPageURL||this.sBlankPageURL,this.sBlankPageURL_EmulateIE7=this.htOptions.sBlankPageURL_EmulateIE7||this.sBlankPageURL_EmulateIE7,this.aAddtionalEmulateIE7=this.htOptions.aAddtionalEmulateIE7||this.aAddtionalEmulateIE7),this.aAddtionalEmulateIE7.push(8),this.sIFrameSrc=this.sBlankPageURL,t.ie&&jindo.$A(this.aAddtionalEmulateIE7).has(t.nativeVersion)&&(this.sIFrameSrc=this.sBlankPageURL_EmulateIE7);var i=this.sIFrameSrc,e=this.iframe,n=jindo.$Fn(this.initIframe,this).bind(),o=jindo.$Fn(function(){this.iframe.src=i},this).bind();!t.ie||t.version>=9&&document.addEventListener?(e.addEventListener("load",n,!1),e.addEventListener("error",o,!1)):(e.attachEvent("onload",n),e.attachEvent("onerror",o)),e.src=i,this.elEditingArea=e},$BEFORE_MSG_APP_READY:function(){this.oEditingArea=this.iframe.contentWindow.document,this.oApp.exec("REGISTER_EDITING_AREA",[this]),this.oApp.exec("ADD_APP_PROPERTY",["getWYSIWYGWindow",jindo.$Fn(this.getWindow,this).bind()]),this.oApp.exec("ADD_APP_PROPERTY",["getWYSIWYGDocument",jindo.$Fn(this.getDocument,this).bind()]),this.oApp.exec("ADD_APP_PROPERTY",["isWYSIWYGEnabled",jindo.$Fn(this.isWYSIWYGEnabled,this).bind()]),this.oApp.exec("ADD_APP_PROPERTY",["getRawHTMLContents",jindo.$Fn(this.getRawHTMLContents,this).bind()]),this.oApp.exec("ADD_APP_PROPERTY",["setRawHTMLContents",jindo.$Fn(this.setRawHTMLContents,this).bind()]),this.isWYSIWYGEnabled()&&this.oApp.exec("ENABLE_WYSIWYG_RULER"),this.oApp.registerBrowserEvent(this.getDocument().body,"paste","EVENT_EDITING_AREA_PASTE")},$ON_MSG_APP_READY:function(){this.oApp.hasOwnProperty("saveSnapShot")||(this.$ON_EVENT_EDITING_AREA_MOUSEUP=function(){},this._recordUndo=function(){}),this._bIERangeReset=!0,this.oApp.oNavigator.ie?(jindo.$Fn(function(e){var t=this.iframe.contentWindow.document.selection;t&&"control"===t.type.toLowerCase()&&8===e.key().keyCode&&(this.oApp.exec("EXECCOMMAND",["delete",!1,!1]),e.stop()),this._bIERangeReset=!1},this).attach(this.iframe.contentWindow.document,"keydown"),jindo.$Fn(function(e){this._oIERange=null,this._bIERangeReset=!0},this).attach(this.iframe.contentWindow.document.body,"mousedown"),this.getDocument().createRange||jindo.$Fn(this._onIEBeforeDeactivate,this).attach(this.iframe.contentWindow.document.body,"beforedeactivate"),jindo.$Fn(function(e){this._bIERangeReset=!1},this).attach(this.iframe.contentWindow.document.body,"mouseup")):this.oApp.oNavigator.bGPadBrowser&&(this.$ON_EVENT_TOOLBAR_TOUCHSTART=function(){this._oIERange=this.oApp.getSelection().cloneRange()}),this.fnSetBodyHeight=jindo.$Fn(this._setBodyHeight,this).bind(),this.fnCheckBodyChange=jindo.$Fn(this._checkBodyChange,this).bind(),this.fnSetBodyHeight(),this._setScrollbarWidth()},_setScrollbarWidth:function(){var e=this.getDocument(),t=e.createElement("div");t.style.width="100px",t.style.height="100px",t.style.overflow="scroll",t.style.position="absolute",t.style.top="-9999px",e.body.appendChild(t),this.nScrollbarWidth=t.offsetWidth-t.clientWidth,e.body.removeChild(t)},$AFTER_EVENT_EDITING_AREA_KEYUP:function(e){if(this.bAutoResize){var t=e.key();t.keyCode>=33&&t.keyCode<=40||t.alt||t.ctrl||16===t.keyCode||this._setAutoResize()}},$AFTER_PASTE_HTML:function(){this.bAutoResize&&this._setAutoResize()},startAutoResize:function(){this.oApp.exec("STOP_CHECKING_BODY_HEIGHT"),this.bAutoResize=!0;var e=this.oApp.oNavigator;e.ie&&e.version<9?jindo.$Element(this.getDocument().body).css({overflow:"visible"}):jindo.$Element(this.getDocument().body).css({overflowX:"visible",overflowY:"hidden"}),this._setAutoResize(),this.nCheckBodyInterval=setInterval(this.fnCheckBodyChange,500),this.oApp.exec("START_FLOAT_TOOLBAR")},stopAutoResize:function(){this.bAutoResize=!1,clearInterval(this.nCheckBodyInterval),this.oApp.exec("STOP_FLOAT_TOOLBAR"),jindo.$Element(this.getDocument().body).css({overflow:"visible",ov
|
|||
|
|
},_convertHeadSpace:function(e){var t;if(e&&(t=e.nextSibling)&&3===t.nodeType){for(var i,n=t.nodeValue,o="",s=0;(i=n[s])&&" "===i;s++)o+=" ";s>0&&(t.nodeValue=o+n.substring(s))}},_wrapBlock:function(e,t){var i,n,o,s=this.oApp.getSelection(),r=s.placeStringBookmark(),a=s.getLineInfo(),l=a.oStart,h=a.oEnd;if((!l.bParentBreak||s.rxBlockContainer.test(l.oLineBreaker.tagName))&&(e.stop(),s.deleteContents(),l.oNode.parentNode&&11!==l.oNode.parentNode.nodeType)){i=this.oApp.getWYSIWYGDocument().createElement(this.sLineBreaker),s.moveToBookmark(r),s.setStartBefore(l.oNode),this._addBlankText(s),s.surroundContents(i),s.collapseToEnd(),n=this.oApp.getWYSIWYGDocument().createElement(this.sLineBreaker);var d=this._getBlockEndNode(l.oNode,h.oNode);return d===l.oNode&&(d=h.oNode),s.setEndAfter(d),this._addBlankText(s),s.surroundContents(n),s.moveToStringBookmark(r,!0),s.collapseToEnd(),s.removeStringBookmark(r),s.select(),null!==n.lastChild&&"BR"==n.lastChild.tagName&&n.removeChild(n.lastChild),o=this._addCursorHolder(n),n.nextSibling&&"BR"==n.nextSibling.tagName&&n.parentNode.removeChild(n.nextSibling),s.selectNodeContents(o),s.collapseToStart(),s.select(),this.oApp.exec("CHECK_STYLE_CHANGE"),r=s.placeStringBookmark(),void setTimeout(jindo.$Fn(function(e){var t=s.getStringBookmark(e);t&&(s.moveToStringBookmark(e),s.select(),s.removeStringBookmark(e))},this).bind(r),0)}var c=s.getStringBookmark(r,!0);if(this.htBrowser.firefox)c&&c.nextSibling&&"IFRAME"==c.nextSibling.tagName?setTimeout(jindo.$Fn(function(e){var t=s.getStringBookmark(e);t&&(s.moveToStringBookmark(e),s.select(),s.removeStringBookmark(e))},this).bind(r),0):setTimeout(jindo.$Fn(function(e){var t=s.getStringBookmark(e,!0);t&&(this._convertHeadSpace(t),s.removeStringBookmark(e))},this).bind(r),0);else if(this.htBrowser.ie){var p=c.parentNode,_=!1,E=!1;if(!c||!p)return void s.removeStringBookmark(r);if(s.removeStringBookmark(r),_="U"===p.tagName||null!==nhn.husky.SE2M_Utils.findAncestorByTagName("U",p),E="S"===p.tagName||"STRIKE"===p.tagName||null!==nhn.husky.SE2M_Utils.findAncestorByTagName("S",p)&&null!==nhn.husky.SE2M_Utils.findAncestorByTagName("STRIKE",p),_||E)return void setTimeout(jindo.$Fn(this._addTextDecorationTag,this).bind(_,E),0);setTimeout(jindo.$Fn(this._addExtraCursorHolder,this).bind(p),0)}else this._convertHeadSpace(c),s.removeStringBookmark(r)},_addExtraCursorHolder:function(e){var t,i,n;if(e=this._getStyleOnlyNode(e),e&&"SPAN"===e.tagName){for(t=e.lastChild;t;)i=t.previousSibling,3===t.nodeType?(nhn.husky.SE2M_Utils.isBlankTextNode(t)&&t.parentNode.removeChild(t),t=i):t=i;n=e.innerHTML,""===n.replace("","").replace("\ufeff","")&&(e.innerHTML="")}var o,s=this.oApp.getSelection();s.collapsed&&(s.fixCommonAncestorContainer(),o=s.commonAncestorContainer,o&&(o=s._getVeryFirstRealChild(o),3===o.nodeType&&(o=o.parentNode),o&&"SPAN"===o.tagName&&(n=o.innerHTML,""===n.replace("","").replace("\ufeff","")&&(o.innerHTML=""),s.selectNodeContents(o),s.collapseToStart(),s.select())))},_addSpace:function(e){var t,i,n,o,s,r;if(e){if(3===e.nodeType)return e.parentNode;if("P"!==e.tagName)return e;if(s=jindo.$Element(e).child(function(e){return 1===e.$value().nodeType&&"IMG"===e.$value().tagName},1),s.length>0){for(r=s[s.length-1].$value(),i=r.nextSibling;i;)n=i.nextSibling,3!==i.nodeType||" "!==i.nodeValue&&i.nodeValue!==unescape("%u00A0")&&""!==i.nodeValue||e.removeChild(i),i=n;return e}for(i=e.firstChild,n=i,o=!1;i;)n=i.nextSibling,3===i.nodeType&&(i.nodeValue===unescape("%uFEFF")&&e.removeChild(i),o||" "!==i.nodeValue&&i.nodeValue!==unescape("%u00A0")&&""!==i.nodeValue||(o=!0)),i=n;return o||(t=this.tmpTextNode.cloneNode(),e.appendChild(t)),e}},_addTextDecorationTag:function(e,t){var i,n,o=this.oApp.getSelection();if(o.collapsed){for(i=o.startContainer;i;){if(3===i.nodeType){i=nhn.DOMFix.parentNode(i);break}if(!i.childNodes||0===i.childNodes.length)break;i=i.firstChild}i&&"U"!==i.tagName&&"S"!==i.tagName&&"STRIKE"!==i.tagName&&(e&&(n=o._document.createElement("U"),i.appendChild(n),i=n),t&&(n=o._document.createElement("STRIKE"),i.appendChild(
|
|||
|
|
e.parentNode.insertBefore(a,e),void a.appendChild(e))}r=parseInt(e.style.marginLeft,10),r||(r=0),r+=this.nIndentSpacing,e.style.marginLeft=r+"px"},_outdentMargin:function(e){for(var t,i,n,o,s,r,a=e;a;){if(a.tagName&&"LI"===a.tagName){e=a;break}a=a.parentNode}if("LI"!==e.tagName)r=parseInt(e.style.marginLeft,10),r||(r=0),r-=this.nIndentSpacing,0>r&&(r=0),e.style.marginLeft=r+"px";else{if(t=e.parentNode,i=e.parentNode,e.previousSibling&&e.previousSibling.tagName&&e.previousSibling.tagName.match(/LI|UL|OL/))if(e.nextSibling&&e.nextSibling.tagName&&e.nextSibling.tagName.match(/LI|UL|OL/)){for(n=t.cloneNode(!1);e.nextSibling;)n.insertBefore(e.nextSibling,null);t.parentNode.insertBefore(n,t.nextSibling),i=n}else i=t.nextSibling;if(t.parentNode.insertBefore(e,i),t.innerHTML.match(/LI/i)||t.parentNode.removeChild(t),!e.parentNode.tagName.match(/OL|UL/)){for(o=e.parentNode,i=e,s=this.oApp.getWYSIWYGDocument(),o=s.createElement("P"),i=null,e.parentNode.insertBefore(o,e);e.firstChild;)o.insertBefore(e.firstChild,i);e.parentNode.removeChild(e)}}},_insertBlankLine:function(){var e=this.oApp.getSelection(),t=e.commonAncestorContainer;for(this.elP1=null,this.elP2=null;t;){if("BLOCKQUOTE"==t.tagName){this.elP1=jindo.$("<p> </p>",this.oApp.getWYSIWYGDocument()),t.parentNode.insertBefore(this.elP1,t),this.elP2=jindo.$("<p> </p>",this.oApp.getWYSIWYGDocument()),t.parentNode.insertBefore(this.elP2,t.nextSibling);break}t=t.parentNode}if(!this.elP1&&!this.elP2){t=e.commonAncestorContainer,t=1!==t.nodeType?t.parentNode:t;var i=t.previousSibling,n=t.nextSibling;i&&"BLOCKQUOTE"===i.tagName&&(this.elP1=jindo.$("<p> </p>",this.oApp.getWYSIWYGDocument()),i.parentNode.insertBefore(this.elP1,i.nextSibling)),n&&"BLOCKQUOTE"===n.tagName&&(this.elP1=jindo.$("<p> </p>",this.oApp.getWYSIWYGDocument()),n.parentNode.insertBefore(this.elP1,n))}},_fixCorruptedBlockQuote:function(e){var t,i,n,o,s,r,a,l,h,d=this.oApp.getWYSIWYGDocument().getElementsByTagName(e);for(s=0,r=d.length;r>s;s++)if(d[s].firstChild&&d[s].firstChild.tagName==e){t=d[s];break}if(t){for(i=t.parentNode,a=this._getPosIdx(t),l=this.oApp.getWYSIWYGDocument().createElement("DIV"),l.innerHTML=t.outerHTML.replace("<"+e,"<BLOCKQUOTE"),t.parentNode.insertBefore(l.firstChild,t),t.parentNode.removeChild(t),n=i.childNodes[a],o=n.getElementsByTagName(e),s=0,r=o.length;r>s;s++)o[s].childNodes.length<1&&o[s].parentNode.removeChild(o[s]);h=this.oApp.getEmptySelection(),h.selectNodeContents(n),h.collapseToEnd(),h.select()}},_removeBlockQuote:function(){for(var e,t,i,n="Apple-style-span",o=this.oApp.getSelection(),s=o.commonAncestorContainer,r=s;s;)"LI"===s.tagName?(i=s,s="display: inline !important; "===s.style.cssText?s.parentNode:null):"SPAN"===s.tagName&&s.className===n?(e=s,s=i?null:s.parentNode):s=s.parentNode;for(i&&e&&(s=e.parentNode,s.replaceChild(r,e),o.selectNodeContents(s),o.collapseToEnd(),o.select());s;)if("BLOCKQUOTE"===s.tagName){t=s.getElementsByClassName(n);for(var a=0;e=t[a];a++)e.parentNode.removeChild(e);s=null}else s=s.parentNode},_getPosIdx:function(e){for(var t=0,i=e.previousSibling;i;i=i.previousSibling)t++;return t},_countClickCr:function(e){e.match(this.rxClickCr)&&this.oApp.exec("MSG_NOTIFY_CLICKCR",[e.replace(/^insert/i,"")])},_extendBlock:function(){var e=this.oApp.getSelection(),t=e.startContainer,i=e.endContainer,n=[],o=[],s=e.cloneRange();if(t===i&&1===t.nodeType&&"P"===t.tagName&&(n=jindo.$A(t.childNodes).filter(function(e,t,i){return 1===e.nodeType&&"IMG"===e.tagName}).$value(),o=jindo.$A(e.getNodes()).filter(function(e,t,i){return 1===e.nodeType&&"IMG"===e.tagName}).$value(),!(n.length<=o.length)))return e.selectNode(t),e.select(),s}}),nhn.husky.SE_WYSIWYGStyler=jindo.$Class({name:"SE_WYSIWYGStyler",_sCursorHolder:"\ufeff",$init:function(){var e=jindo.$Agent().navigator();e.ie&&e.version>8&&(this._sCursorHolder="",this.$ON_REGISTER_CONVERTERS=function(){var e=/\u2060/g;this.oApp.exec("ADD_CONVERTER",["WYSIWYG_TO_IR",jindo.$Fn(function(t){return t.replace(e,"\ufeff")},this).bind()])})},$PRECONDITION:function(e,t){return"WYSIWYG"==this.oApp.getEditing
|
|||
|
|
i=this.htOptions.htMainFont,n=this.htOptions.aFontInUse,this.htBrowser.ie&&t)for(o=0;o<t.length;o++)this.addFont(t[o].id,t[o].name,t[o].size,t[o].url,t[o].cssUrl);for(o=0;o<e.length;o++)this.addFont(e[o][0],e[o][1],0,"","",1);if(i&&i.id&&this.setMainFont(i.id,i.name,i.size,i.url,i.cssUrl),this.htBrowser.ie&&n)for(o=0;o<n.length;o++)this.addFontInUse(n[o].id,n[o].name,n[o].size,n[o].url,n[o].cssUrl)}if(this.htOptions&&this.htOptions.aDefaultFontList&&0!==this.htOptions.aDefaultFontList.length||(this.addFont("돋움,Dotum","돋움",0,"","",1,null,!0),this.addFont("돋움체,DotumChe,AppleGothic","돋움체",0,"","",1,null,!0),this.addFont("굴림,Gulim","굴림",0,"","",1,null,!0),this.addFont("굴림체,GulimChe","굴림체",0,"","",1,null,!0),this.addFont("바탕,Batang,AppleMyungjo","바탕",0,"","",1,null,!0),this.addFont("바탕체,BatangChe","바탕체",0,"","",1,null,!0),this.addFont("궁서,Gungsuh,GungSeo","궁서",0,"","",1,null,!0),this.addFont("Arial","Arial",0,"","",1,"abcd",!0),this.addFont("Tahoma","Tahoma",0,"","",1,"abcd",!0),this.addFont("Times New Roman","Times New Roman",0,"","",1,"abcd",!0),this.addFont("Verdana","Verdana",0,"","",1,"abcd",!0),this.addFont("Courier New","Courier New",0,"","",1,"abcd",!0)),this.aAdditionalFontList&&this.aAdditionalFontList.length>0)for(o=0,nLen=this.aAdditionalFontList.length;o<nLen;o++)this.addFont(this.aAdditionalFontList[o][0],this.aAdditionalFontList[o][1],0,"","",1)},$ON_MSG_APP_READY:function(){this.bDoNotRecordUndo=!1,this.oApp.exec("ADD_APP_PROPERTY",["addFont",jindo.$Fn(this.addFont,this).bind()]),this.oApp.exec("ADD_APP_PROPERTY",["addFontInUse",jindo.$Fn(this.addFontInUse,this).bind()]),this.oApp.exec("ADD_APP_PROPERTY",["setMainFont",jindo.$Fn(this.setMainFont,this).bind()]),this.oApp.exec("ADD_APP_PROPERTY",["setDefaultFont",jindo.$Fn(this.setDefaultFont,this).bind()]),this.oApp.exec("REGISTER_UI_EVENT",["fontName","click","SE2M_TOGGLE_FONTNAME_LAYER"])},$AFTER_MSG_APP_READY:function(){this._initFontName(),this._attachIEEvent()},_assignHTMLElements:function(e){this.oDropdownLayer=jindo.$$.getSingle("DIV.husky_se_fontName_layer",e),this.elFontNameLabel=jindo.$$.getSingle("SPAN.husky_se2m_current_fontName",e),this.elFontNameList=jindo.$$.getSingle("UL",this.oDropdownLayer),this.elInnerLayer=this.elFontNameList.parentNode,this.aelFontInMarkup=jindo.$$("LI",this.oDropdownLayer),this.elFontItemTemplate=this.aelFontInMarkup.shift(),this.aLIFontNames=jindo.$A(jindo.$$("LI",this.oDropdownLayer)).filter(function(e,t,i){return null!==e.firstChild})._array,this.sDefaultText=this.elFontNameLabel.innerHTML},_initFontName:function(){this._addFontInMarkup(),this.addAllFonts();var e;this.oApp.getCurrentStyle&&(e=this.oApp.getCurrentStyle())&&this.$ON_MSG_STYLE_CHANGED("fontFamily",e.fontFamily),this.oApp.registerBrowserEvent(this.oDropdownLayer,"mouseover","EVENT_FONTNAME_LAYER_MOUSEOVER",[]),this.oApp.registerBrowserEvent(this.oDropdownLayer,"click","EVENT_FONTNAME_LAYER_CLICKED",[])},_checkFontLI:function(e,t){if(!e)return!1;var i=IsInstalledFont(t);return e.style.display=i?"block":"none",i},_addFontInMarkup:function(){for(var e,t,i,n,o=0;e=this.aelFontInMarkup[o];o++)e.firstChild?(t=this._getFontFamilyFromLI(e).replace(this._rxQuote,"").replace(this._rxComma,","),n|=this._checkFontLI(e,t)):e.className.indexOf(this.FONT_SEPARATOR)>-1?(i&&(i.style.display=n?"block":"none"),i=e,n=!1):e.style.display="none";i&&(i.style.display=n?"block":"none")},_attachIEEvent:function(){if(this.htBrowser.ie){if(this.htBrowser.nativeVersion<9)return this._wfOnPasteWYSIWYGBody=jindo.$Fn(this._onPasteWYSIWYGBody,this),void this._wfOnPasteWYSIWYGBody.attach(this.oApp.getWYSIWYGDocument().body,"paste");if(document.documentMode<9)return this._wfOnFocusWYSIWYGBody=jindo.$Fn(this._onFocusWYSIWYGBody,this),void this._wfOnFocusWYSIWYGBody.attach(this.oApp.getWYSIWYGDocument().body,"focus");this.welEditingAreaCover=jindo.$Element('<DIV style="width:100%; height:100%; position:absolute; top:0px; left:0px; z-index:1000;"></DIV>'),this.oApp.welEditingAreaContainer.prepend(this.welEditingAreaCover),jind
|
|||
|
|
border:"",borderLeft:"",borderBottom:""}),jindo.$Element(n).attr({border:0,cellpadding:1}),o=jindo.$$("tbody>tr>td",n),jindo.$A(o).forEach(function(e,t,i){jindo.$Element(e).css({border:"",borderTop:"",borderRight:""})})},dbToIrDOM:function(e){var t=[],i=jindo.$$("table[class=__se_tbl]",e,{oneTimeOffCache:!0});if(jindo.$A(i).forEach(function(e,i,n){jindo.$Element(e).attr("attr_no_border_tbl")&&t.push(e)},this),!(t.length<1))for(var n,o=[],s=0,r=t.length;r>s;s++)n=t[s],jindo.$Element(n).css({border:"1px dashed #c7c7c7",borderLeft:0,borderBottom:0}),jindo.$Element(n).attr({border:1,cellpadding:0}),o=jindo.$$("tbody>tr>td",n),jindo.$A(o).forEach(function(e,t,i){jindo.$Element(e).css({border:"1px dashed #c7c7c7",borderTop:0,borderRight:0})})}}),nhn.husky.SE2M_TableBlockStyler=jindo.$Class({name:"SE2M_TableBlockStyler",nSelectedTD:0,htSelectedTD:{},aTdRange:[],$init:function(){},$LOCAL_BEFORE_ALL:function(){return"WYSIWYG"==this.oApp.getEditingMode()},$ON_MSG_APP_READY:function(){this.oDocument=this.oApp.getWYSIWYGDocument()},$ON_EVENT_EDITING_AREA_MOUSEUP:function(e){"WYSIWYG"==this.oApp.getEditingMode()&&this.setTdBlock()},$ON_IS_SELECTED_TD_BLOCK:function(e,t){return this.nSelectedTD>0?(t[e]=!0,t[e]):(t[e]=!1,t[e])},$ON_GET_SELECTED_TD_BLOCK:function(e,t){t[e]=this.htSelectedTD.aTdCells},setTdBlock:function(){this.oApp.exec("GET_SELECTED_CELLS",["aTdCells",this.htSelectedTD]);var e=this.htSelectedTD.aTdCells;e&&(this.nSelectedTD=e.length)},$ON_DELETE_BLOCK_CONTENTS:function(){var e,t,i,n=this;this.setTdBlock();for(var o=0;o<this.nSelectedTD;o++)jindo.$Element(this.htSelectedTD.aTdCells[o]).child(function(o){e=jindo.$Element(o._element.parentNode),e.remove(o),t=n.oDocument.createElement("P"),i=jindo.$Agent().navigator().firefox?n.oDocument.createElement("BR"):n.oDocument.createTextNode(" "),t.appendChild(i),e.append(t)},1)}}),nhn.husky.SE2M_StyleRemover=jindo.$Class({name:"SE2M_StyleRemover",$ON_MSG_APP_READY:function(){this.oApp.exec("REGISTER_UI_EVENT",["styleRemover","click","CHOOSE_REMOVE_STYLE",[]])},$LOCAL_BEFORE_FIRST:function(){this.oHuskyRange=this.oApp.getEmptySelection(),this._document=this.oHuskyRange._document},$ON_CHOOSE_REMOVE_STYLE:function(e){var t=!1,i={};this.oApp.exec("IS_SELECTED_TD_BLOCK",["bIsSelectedTd",i]),t=i.bIsSelectedTd,this.oApp.exec("RECORD_UNDO_BEFORE_ACTION",["REMOVE STYLE",{bMustBlockElement:!0}]),t?this.oApp.exec("REMOVE_STYLE_IN_BLOCK",[]):this.oApp.exec("REMOVE_STYLE",[]),this.oApp.exec("RECORD_UNDO_AFTER_ACTION",["REMOVE STYLE",{bMustBlockElement:!0}]),this.oApp.exec("MSG_NOTIFY_CLICKCR",["noeffect"])},$ON_REMOVE_STYLE_IN_BLOCK:function(e){var t={};this.oSelection=this.oApp.getSelection(),this.oApp.exec("GET_SELECTED_TD_BLOCK",["aTdCells",t]);for(var i=t.aTdCells,n=0;n<i.length;n++)this.oSelection.selectNodeContents(i[n]),this.oSelection.select(),this.oApp.exec("REMOVE_STYLE",[])},$ON_REMOVE_STYLE:function(e){if(e&&e.commonAncestorContainer||(e=this.oApp.getSelection()),!e.collapsed){e.expandBothEnds();var t=e.placeStringBookmark(),i=e.getNodes(!0);this._removeStyle(i),e.moveToBookmark(t);for(var i=e.getNodes(!0),n=0;n<i.length;n++){var o=i[n];o.style&&"BR"!=o.tagName&&"TD"!=o.tagName&&"TR"!=o.tagName&&"TBODY"!=o.tagName&&"TABLE"!=o.tagName&&(o.removeAttribute("align"),o.removeAttribute("style"),"inline"!=jindo.$Element(o).css("display")||"IMG"==o.tagName||"IFRAME"==o.tagName||o.firstChild&&!e._isBlankTextNode(o.firstChild)||o.parentNode.removeChild(o))}e.moveToBookmark(t),"TBODY"===e.commonAncestorContainer.tagName&&(e=this.oApp.getSelection()),e.select();for(var s=this._document.getElementById(e.HUSKY_BOOMARK_START_ID_PREFIX+t);s;){for(oParent=nhn.DOMFix.parentNode(s),oParent.removeChild(s);oParent&&(!oParent.firstChild||!oParent.firstChild.nextSibling&&e._isBlankTextNode(oParent.firstChild));){var r=oParent.parentNode;oParent.parentNode.removeChild(oParent),oParent=r}s=this._document.getElementById(e.HUSKY_BOOMARK_START_ID_PREFIX+t)}for(var s=this._document.getElementById(e.HUSKY_BOOMARK_END_ID_PREFIX+t);s;){for(oParent=nhn.DOMFix.parentNode(s),oParent.removeChild(s);oParent&&(!oPar
|
|||
|
|
2===o.length&&"SHW-"===o[0]&&"Safari"===o[1]?i.bGalaxyBrowser=!0:e.indexOf("LG-V500")>-1&&e.indexOf("Version/4.0")>-1&&(i.bGPadBrowser=!0),"undefined"==typeof n.ios&&(n.ios=e.indexOf("iPad")>-1||e.indexOf("iPhone")>-1,n.ios&&(o=e.match(/(iPhone )?OS ([\d|_]+)/),null!=o&&void 0!=o[2]&&(n.version=String(o[2]).split("_").join("."))))}(),nhn.husky.SE2M_UtilPlugin=jindo.$Class({name:"SE2M_UtilPlugin",$BEFORE_MSG_APP_READY:function(){this.oApp.exec("ADD_APP_PROPERTY",["oAgent",jindo.$Agent()]),this.oApp.exec("ADD_APP_PROPERTY",["oNavigator",jindo.$Agent().navigator()]),this.oApp.exec("ADD_APP_PROPERTY",["oUtils",this])},$ON_REGISTER_HOTKEY:function(e,t,i,n){this.oApp.exec("ADD_HOTKEY",[e,t,i,n||this.oApp.getWYSIWYGDocument()])},$ON_SE2_ATTACH_HOVER_EVENTS:function(e){this.oApp.exec("ATTACH_HOVER_EVENTS",[e,{fnElmToSrc:this._elm2Src,fnElmToTarget:this._elm2Target}])},_elm2Src:function(e){return"LI"==e.tagName&&e.firstChild&&"BUTTON"==e.firstChild.tagName?e.firstChild:e},_elm2Target:function(e){return"BUTTON"==e.tagName&&"LI"==e.parentNode.tagName?e.parentNode:e},getScrollXY:function(){var e,t,i=this.oApp.getWYSIWYGWindow();return"undefined"==typeof i.scrollX?(e=i.document.documentElement.scrollLeft,t=i.document.documentElement.scrollTop):(e=i.scrollX,t=i.scrollY),{x:e,y:t}}}),nhn.husky.SE2M_Utils={sURLPattern:"(http|https|ftp|mailto):(?:\\/\\/)?((:?\\w|-)+(:?\\.(:?\\w|-)+)+)([^ <>]+)?",getCustomCSS:function(e,t,i){var n=[];if("undefined"==typeof e||"undefined"==typeof t||!e||!t)return n;var o=e.match(t);return o&&o[0]&&o[1]&&(i?n=o[1].split(i):n[0]=o[1]),n},toStringSamePropertiesOfArray:function(e,t,i){if(e instanceof Array){for(var n=[],o=0;o<e.length;o++)n.push(e[o][t]);return n.join(",").replace(/,/g,i)}return"undefined"==typeof e[t]?"":"string"==typeof e[t]?e[t]:void 0},makeArray:function(e){if(null===e||"undefined"==typeof e)return[];if(e instanceof Array)return e;var t=[];return t.push(e),t},ellipsis:function(e,t,i,n){i=i||"...","undefined"==typeof n&&(n=1);var o=jindo.$Element(e),s=jindo.$Element(t),r=o.html(),a=r.length,l=s.height(),h=0;o.html("A");var d=s.height();if(d*(n+.5)>l)return o.html(r);for(l=d;d*(n+.5)>l;)h+=Math.max(Math.ceil((a-h)/2),1),o.html(r.substring(0,h)+i),l=s.height();for(;l>d*(n+.5);)h--,o.html(r.substring(0,h)+i),l=s.height()},ellipsisByPixel:function(e,t,i,n){t=t||"...";var o=jindo.$Element(e),s=o.width();if(!(i>s)){var r=o.html(),a=r.length,l=0;if("undefined"==typeof n){var h=o.html("A").width();for(s=h;i>s;)l+=Math.max(Math.ceil((a-l)/2),1),o.html(r.substring(0,l)+t),s=o.width();n=function(){return!0}}for(l=o.html().length-t.length;s>i&&n();)l--,o.html(r.substring(0,l)+t),s=o.width()}},ellipsisElementsToDesinatedWidth:function(e,t,i,n){jindo.$A(e).forEach(function(e,o){e||jindo.$A.Continue(),nhn.husky.SE2M_Utils.ellipsisByPixel(e,t,i[o],n)})},paddingZero:function(e,t){for(var i=e.toString();i.length<t;)i="0"+i;return i},cutStringToByte:function(e,t,i){if(null===e||0===e.length)return e;e=e.replace(/ +/g," "),i||""==i||(i="...");for(var n=t,o=0,s=e.length,r=0;s>r;r++){if(o+=this.getCharByte(e.charAt(r)),o==n)return r==s-1?e:e.substring(0,r)+i;if(o>n)return e.substring(0,r)+i}return e},getCharByte:function(e){if(null===e||e.length<1)return 0;var t=0,i=escape(e);return 1==i.length?t++:-1!=i.indexOf("%u")?t+=2:-1!=i.indexOf("%")&&(t+=i.length/3),t},getFilteredHashTable:function(e,t){if(!(t instanceof Array))return arguments.callee.call(this,e,[t]);var i=jindo.$A(t);return jindo.$H(e).filter(function(e,t){return i.has(t)&&e?!0:!1}).$value()},isBlankNode:function(e){var t=this.isBlankTextNode,i=function(e){return e?t(e)?!0:"BR"==e.tagName?!0:" "==e.innerHTML||""==e.innerHTML?!0:!1:!0},n=function(e){if("IMG"==e.tagName||"IFRAME"==e.tagName)return!1;if(i(e))return!0;if("P"==e.tagName){for(var n=e.childNodes.length-1;n>=0;n--){var o=e.childNodes[n];t(o)&&o.parentNode.removeChild(o)}if(1==e.childNodes.length){if("IMG"==e.firstChild.tagName||"IFRAME"==e.firstChild.tagName)return!1;if(i(e.firstChild))return!0}}return!1};if(n(e))return!0;for(var o=0,s=e.childNodes.length;s>o;o++){var r=e.childNodes[o]
|
|||
|
|
return"%u"+e}).split(" "),this.charSet[5]=unescape("3041 3042 3043 3044 3045 3046 3047 3048 3049 304A 304B 304C 304D 304E 304F 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 305A 305B 305C 305D 305E 305F 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 306A 306B 306C 306D 306E 306F 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 307A 307B 307C 307D 307E 307F 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 308A 308B 308C 308D 308E 308F 3090 3091 3092 3093 30A1 30A2 30A3 30A4 30A5 30A6 30A7 30A8 30A9 30AA 30AB 30AC 30AD 30AE 30AF 30B0 30B1 30B2 30B3 30B4 30B5 30B6 30B7 30B8 30B9 30BA 30BB 30BC 30BD 30BE 30BF 30C0 30C1 30C2 30C3 30C4 30C5 30C6 30C7 30C8 30C9 30CA 30CB 30CC 30CD 30CE 30CF 30D0 30D1 30D2 30D3 30D4 30D5 30D6 30D7 30D8 30D9 30DA 30DB 30DC 30DD 30DE 30DF 30E0 30E1 30E2 30E3 30E4 30E5 30E6 30E7 30E8 30E9 30EA 30EB 30EC 30ED 30EE 30EF 30F0 30F1 30F2 30F3 30F4 30F5 30F6").replace(/(\S{4})/g,function(e){return"%u"+e}).split(" ");var t=jindo.$Fn(this.oApp.exec,this.oApp).bind("INSERT_SCHARACTERS",[this.oTextField.value]);jindo.$Fn(t,this).attach(this.oInsertButton,"click"),this.oApp.exec("SET_SCHARACTER_LIST",[this.charSet]);for(var i=0;i<this.aLabel.length;i++){var n=jindo.$Fn(this.oApp.exec,this.oApp).bind("CHANGE_SCHARACTER_SET",[i]);jindo.$Fn(n,this).attach(this.aLabel[i].firstChild,"mousedown")}for(var i=0;i<this.aCloseButton.length;i++)this.oApp.registerBrowserEvent(this.aCloseButton[i],"click","HIDE_ACTIVE_LAYER",[]);this.oApp.registerBrowserEvent(this.elDropdownLayer,"click","EVENT_SCHARACTER_CLICKED",[]),this.oApp.registerBrowserEvent(this.oTextField,"keydown","EVENT_SCHARACTER_KEYDOWN")},$ON_EVENT_SCHARACTER_KEYDOWN:function(e){e.key().enter&&(this.oApp.exec("INSERT_SCHARACTERS"),e.stop())},$ON_TOGGLE_SCHARACTER_LAYER:function(){this.oTextField.value="",this.oSelection=this.oApp.getSelection(),this.oApp.exec("TOGGLE_TOOLBAR_ACTIVE_LAYER",[this.elDropdownLayer,null,"MSG_SCHARACTER_LAYER_SHOWN",[],"MSG_SCHARACTER_LAYER_HIDDEN",[""]]),this.oApp.exec("MSG_NOTIFY_CLICKCR",["symbol"])},$ON_MSG_SCHARACTER_LAYER_SHOWN:function(){this.oTextField.focus(),this.oApp.exec("SELECT_UI",["sCharacter"])},$ON_MSG_SCHARACTER_LAYER_HIDDEN:function(){this.oApp.exec("DESELECT_UI",["sCharacter"])},$ON_EVENT_SCHARACTER_CLICKED:function(e){var t=nhn.husky.SE2M_Utils.findAncestorByTagName("BUTTON",e.element);if(t&&"BUTTON"==t.tagName&&"LI"==t.parentNode.tagName){var i=t.firstChild.innerHTML;i.length>1||(this.oApp.exec("SELECT_SCHARACTER",[i]),e.stop())}},$ON_SELECT_SCHARACTER:function(e){if(this.oTextField.value+=e,this.oTextField.createTextRange){var t=this.oTextField.createTextRange();t.collapse(!1),t.select()}else this.oTextField.selectionEnd&&(this.oTextField.selectionEnd=this.oTextField.value.length,this.oTextField.focus())},$ON_INSERT_SCHARACTERS:function(){this.oApp.exec("RECORD_UNDO_BEFORE_ACTION",["INSERT SCHARACTER"]),this.oApp.exec("PASTE_HTML",[this.oTextField.value]),this.oApp.exec("FOCUS"),this.oApp.exec("RECORD_UNDO_AFTER_ACTION",["INSERT SCHARACTER"]),this.oApp.exec("HIDE_ACTIVE_LAYER",[])},$ON_CHANGE_SCHARACTER_SET:function(e){for(var t=0;t<this.aSCharList.length;t++)if(jindo.$Element(this.aLabel[t]).hasClass("active")){if(t==e)return;jindo.$Element(this.aLabel[t]).removeClass("active")}this._drawSCharList(e),jindo.$Element(this.aLabel[e]).addClass("active")},$ON_SET_SCHARACTER_LIST:function(e){this.charSet=e,this.bSCharSetDrawn=new Array(this.charSet.length),this._drawSCharList(0)},_drawSCharList:function(e){if(!this.bSCharSetDrawn[e]){this.bSCharSetDrawn[e]=!0;var t=this.charSet[e].length,i=new Array(t);this.aSCharList[e].innerHTML="";for(var n,o,s=0;t>s;s++)i[s]=jindo.$("<LI>"),this.bIE?(n=jindo.$("<BUTTON>"),n.setAttribute("type","button")):(n=jindo.$("<BUTTON>"),n.type="button"),o=jindo.$("<SPAN>"),o.innerHTML=unescape(this.charSet[e][s]),n.appendChild(o),i[s].appendChild(n),i[s].onmouseover=function(){this.className="hover"},i[s].onmouseout=function(){this.className=""},this.aSCharList[e].appendChild(i[s])}}}),nhn.husky.HuskyCore.addLoadedFile("hp_SE2M_TableCreator$Lazy.js"),nhn.husky.HuskyCore.mixin(
|
|||
|
|
"undefined"!=typeof this.elPanelBGPaletteHolder&&(this.elPanelBGPaletteHolder.parentNode.style.display="none"),"undefined"!=typeof this.elPanelBGIMGPaletteHolder&&(this.elPanelBGIMGPaletteHolder.parentNode.style.display="none")},$ON_SETUP_TABLE_QE_MODE:function(e){var t=!0;"number"==typeof e&&(this.nQEMode=e),this.aSelectedCells.length<2&&(t=!1),this.oApp.exec("TABLE_QE_DIM",[this.QE_DIM_MERGE_BTN,t]);for(var i=this.aSelectedCells[0].getAttribute(this.TMP_BGC_ATTR)||"rgb(255,255,255)",n=!0,o=1,s=this.aSelectedCells.length;s>o;o++)if(this.aSelectedCells[o]&&i!=this.aSelectedCells[o].getAttribute(this.TMP_BGC_ATTR)){n=!1;break}n?this.elBtnBGPalette.style.backgroundColor=i:this.elBtnBGPalette.style.backgroundColor="#FFFFFF";var r,a=this.aSelectedCells[0].getAttribute(this.TMP_BGIMG_ATTR)||"",l=!0,h=0,d=jindo.$Element(this.elBtnBGIMGPalette);if(a){var c=a.match(/\_[0-9]*/);r=c?c[0]:"_0",h=r.substring(1,r.length);for(var o=1,s=this.aSelectedCells.length;s>o;o++)if(a!=this.aSelectedCells[o].getAttribute(this.TMP_BGIMG_ATTR)){l=!1;break}}for(var p=d.className().split(/\s/),_=0,s=p.length;s>_;_++)p[_].indexOf("cellimg")>0&&d.removeClass(p[_]);if(l&&h>0?d.addClass("se2_cellimg"+h):d.addClass("se2_cellimg0"),0===this.nQEMode){this.elPanelTableTemplateArea.style.display="block",this.elPanelReviewBGArea.style.display="none",jindo.$Element(this.elPanelTableBGArea).className("se2_qe2");var E=this.parseIntOr0(this.elSelectionStartTable.getAttribute(this.ATTR_TBL_TEMPLATE));E||(this.elInputRadioBGColor.checked="true",E=1),this.elPanelQETemplatePreview.className="se2_t_style"+E,this.elPanelBGImg.style.position=""}else if(1==this.nQEMode){this.elPanelTableTemplateArea.style.display="none",this.elPanelReviewBGArea.style.display="block";var E=this.parseIntOr0(this.elSelectionStartTable.getAttribute(this.ATTR_REVIEW_TEMPLATE));this.elPanelBGImg.style.position="relative"}else this.elPanelTableTemplateArea.style.display="none",this.elPanelReviewBGArea.style.display="none";this.oApp.exec("DRAW_QE_RADIO_OPTION",[0])},$ON_DRAW_QE_RADIO_OPTION:function(e){0!==e&&2!=e&&this.oApp.exec("HIDE_TABLE_QE_BGC_PALETTE",[]),0!==e&&3!=e&&this.oApp.exec("HIDE_TABLE_QE_IMG_PALETTE",[]),0!==e&&4!=e&&this.oApp.exec("TABLE_QE_HIDE_TEMPLATE",[]),0===this.nQEMode?(this.elInputRadioBGImg.checked&&(this.elInputRadioBGColor.checked="true"),this.elInputRadioBGColor.checked?this.oApp.exec("TABLE_QE_DIM",[this.QE_DIM_TABLE_TEMPLATE,!1]):this.oApp.exec("TABLE_QE_DIM",[this.QE_DIM_BG_COLOR,!1])):(this.elInputRadioTemplate.checked&&(this.elInputRadioBGColor.checked="true"),this.elInputRadioBGColor.checked?this.oApp.exec("TABLE_QE_DIM",[this.QE_DIM_REVIEW_BG_IMG,!1]):this.oApp.exec("TABLE_QE_DIM",[this.QE_DIM_BG_COLOR,!1]))},$ON_TABLE_QE_DIM:function(e,t){var i,n="se2_qdim";i=1==e?this.elPanelDim1:this.elPanelDim2,t&&(e=0),i.className=n+e},$ON_TE_SELECT_TABLE:function(e){this.elSelectionStartTable=e,this.htMap=this._getCellMapping(this.elSelectionStartTable)},$ON_TE_SELECT_CELLS:function(e,t){this._selectCells(e,t)},$ON_TE_MERGE_CELLS:function(){if(0!==this.aSelectedCells.length&&1!=this.aSelectedCells.length){this._removeClassFromSelection();var e,t,i;t=this.aSelectedCells[0];var n,o,s=(nhn.husky.SE2M_Utils.findAncestorByTagName("TABLE",t),this.aSelectedCells[0]);for(n=parseInt(s.style.height||s.getAttribute("height"),10),o=parseInt(s.style.width||s.getAttribute("width"),10),e=this.htSelectionSPos.x+1;e<this.htSelectionEPos.x+1;e++)curTD=this.htMap[e][this.htSelectionSPos.y],curTD!=s&&(s=curTD,o+=parseInt(curTD.style.width||curTD.getAttribute("width"),10));for(s=this.aSelectedCells[0],e=this.htSelectionSPos.y+1;e<this.htSelectionEPos.y+1;e++)curTD=this.htMap[this.htSelectionSPos.x][e],curTD!=s&&(s=curTD,n+=parseInt(curTD.style.height||curTD.getAttribute("height"),10));for(o&&(t.style.width=o+"px"),n&&(t.style.height=n+"px"),t.setAttribute("colSpan",this.htSelectionEPos.x-this.htSelectionSPos.x+1),t.setAttribute("rowSpan",this.htSelectionEPos.y-this.htSelectionSPos.y+1),e=1;e<this.aSelectedCells.length;e++)if(i=this.aSelectedCells[e],i.parentNode){nhn.husky.SE2M_Utils.isBla
|
|||
|
|
for(var e,t,i=0;i<this.aSelectedCells.length;i++)t=this.aSelectedCells[i],t&&(e=jindo.$Element(t),e.removeClass(this.CELL_SELECTION_CLASS),e.removeClass("undraggable"),t.getAttribute(this.TMP_BGC_ATTR)&&(t.style.backgroundColor=t.getAttribute(this.TMP_BGC_ATTR),t.removeAttribute(this.TMP_BGC_ATTR)),t.getAttribute(this.TMP_BGIMG_ATTR)&&(e.css("backgroundImage",t.getAttribute(this.TMP_BGIMG_ATTR)),t.removeAttribute(this.TMP_BGIMG_ATTR)))},_expandAndSelect:function(e,t){var i,n,o,s;if(e.y>0)for(i=e.x;i<=t.x;i++)if(o=this.htMap[i][e.y],this.htMap[i][e.y-1]==o){for(s=e.y-2;s>=0&&this.htMap[i][s]==o;)s--;return e.y=s+1,void this._expandAndSelect(e,t)}if(e.x>0)for(n=e.y;n<=t.y;n++)if(o=this.htMap[e.x][n],this.htMap[e.x-1][n]==o){for(s=e.x-2;s>=0&&this.htMap[s][n]==o;)s--;return e.x=s+1,void this._expandAndSelect(e,t)}if(t.y<this.htMap[0].length-1)for(i=e.x;i<=t.x;i++)if(o=this.htMap[i][t.y],this.htMap[i][t.y+1]==o){for(s=t.y+2;s<this.htMap[0].length&&this.htMap[i][s]==o;)s++;return t.y=s-1,void this._expandAndSelect(e,t)}if(t.x<this.htMap.length-1)for(n=e.y;n<=t.y;n++)if(o=this.htMap[t.x][n],this.htMap[t.x+1][n]==o){for(s=t.x+2;s<this.htMap.length&&this.htMap[s][n]==o;)s++;return t.x=s-1,void this._expandAndSelect(e,t)}},_getSelectedCells:function(e,t){this._expandAndSelect(e,t);var i=e.x,n=e.y,o=t.x,s=t.y;this.htSelectionSPos=e,this.htSelectionEPos=t;for(var r=[],a=n;s>=a;a++)for(var l=i;o>=l;l++)jindo.$A(r).has(this.htMap[l][a])||(r[r.length]=this.htMap[l][a]);return r},_setEndPos:function(e){var t,i;t=parseInt(e.elCell.getAttribute("colSpan"),10)||1,i=parseInt(e.elCell.getAttribute("rowSpan"),10)||1,e.ex=e.x+t-1,e.ey=e.y+i-1},_getBasisCellPosition:function(e){var t=0,i=0;for(t=0;t<this.htMap.length;t++)for(i=0;i<this.htMap[t].length;i++)if(this.htMap[t][i]==e)return{x:t,y:i,elCell:e};return{x:0,y:0,elCell:e}},_applyTableTemplate:function(e,t){e&&(this._clearAllTableStyles(e),this._doApplyTableTemplate(e,nhn.husky.SE2M_TableTemplate[t],!1),e.setAttribute(this.ATTR_TBL_TEMPLATE,t))},_clearAllTableStyles:function(e){e.removeAttribute("border"),e.removeAttribute("cellPadding"),e.removeAttribute("cellSpacing"),e.style.padding="",e.style.border="",e.style.backgroundColor="",e.style.color="";for(var t=jindo.$$(">TBODY>TR>TD",e,{oneTimeOffCache:!0}),i=0,n=t.length;n>i;i++)t[i].style.padding="",t[i].style.border="",t[i].style.backgroundColor="",t[i].style.color="";for(var o=jindo.$$(">TBODY>TR>TH",e,{oneTimeOffCache:!0}),i=0,n=o.length;n>i;i++)o[i].style.padding="",o[i].style.border="",o[i].style.backgroundColor="",o[i].style.color=""},_hideTableTemplate:function(e){e.getAttribute(this.ATTR_TBL_TEMPLATE)&&this._doApplyTableTemplate(e,nhn.husky.SE2M_TableTemplate[this.parseIntOr0(e.getAttribute(this.ATTR_TBL_TEMPLATE))],!0)},_showTableTemplate:function(e){e.getAttribute(this.ATTR_TBL_TEMPLATE)&&this._doApplyTableTemplate(e,nhn.husky.SE2M_TableTemplate[this.parseIntOr0(e.getAttribute(this.ATTR_TBL_TEMPLATE))],!1)},_doApplyTableTemplate:function(e,t,i){var n,o=t.htTableProperty,s=t.htTableStyle,r=t.ht1stRowStyle,a=t.ht1stColumnStyle,l=t.aRowStyle;o&&this._copyAttributesTo(e,o,i),s&&this._copyStylesTo(e,s,i);var h=jindo.$$(">TBODY>TR",e,{oneTimeOffCache:!0}),d=0;if(r)for(var d=1,c=0,p=h[0].childNodes.length;p>c;c++)n=h[0].childNodes[c],n.tagName&&n.tagName.match(/^TD|TH$/)&&this._copyStylesTo(n,r,i);var _,E;if(a)for(var u=r?1:0,g=u,f=h.length;f>g;)E=h[g].firstChild,_=1,E&&E.tagName.match(/^TD|TH$/)&&(_=parseInt(E.getAttribute("rowSpan"),10)||1,this._copyStylesTo(E,a,i)),g+=_;if(l)for(var A=l.length,g=d,f=h.length;f>g;g++)for(var c=0,p=h[g].childNodes.length;p>c;c++){var n=h[g].childNodes[c];n.tagName&&n.tagName.match(/^TD|TH$/)&&this._copyStylesTo(n,l[(g+d)%A],i)}},_copyAttributesTo:function(e,t,i){var n;for(var o in t)t.hasOwnProperty(o)&&(i?e[o]&&(n=document.createElement(e.tagName),n[o]=t[o],n[o]==e[o]&&e.removeAttribute(o)):(n=document.createElement(e.tagName),n.style[o]="",e[o]&&e.style[o]!=n.style[o]||e.setAttribute(o,t[o])))},_copyStylesTo:function(e,t,i){var n;for(var o in t)t.hasOwnProperty(o)&&(i?e.style[o]&&(n=document.create
|
|||
|
|
border:"0",cellPadding:"0",cellSpacing:"1"},htTableStyle:{backgroundColor:"#a6bcd1"},aRowStyle:[{padding:"3px 4px 2px",backgroundColor:"#fafbfc",color:"#3d76ab"},{padding:"3px 4px 2px",backgroundColor:"#e6ecf2",color:"#3d76ab"}]},{htTableProperty:{border:"0",cellPadding:"0",cellSpacing:"0"},ht1stRowStyle:{padding:"3px 4px 2px",borderTop:"1px solid #466997",borderBottom:"1px solid #466997",backgroundColor:"#6284ab",color:"#ffffff",textAlign:"left",fontWeight:"normal"},aRowStyle:[{padding:"3px 4px 2px",borderBottom:"1px solid #ebebeb",backgroundColor:"#ffffff",color:"#3d76ab"},{padding:"3px 4px 2px",borderBottom:"1px solid #ebebeb",backgroundColor:"#f6f8fa",color:"#3d76ab"}]},{htTableProperty:{border:"0",cellPadding:"0",cellSpacing:"1"},htTableStyle:{backgroundColor:"#a6bcd1"},ht1stRowStyle:{padding:"3px 4px 2px",backgroundColor:"#6284ab",color:"#ffffff",textAlign:"left",fontWeight:"normal"},ht1stColumnStyle:{padding:"3px 4px 2px",backgroundColor:"#f6f8fa",color:"#3d76ab",textAlign:"left",fontWeight:"normal"},aRowStyle:[{padding:"3px 4px 2px",backgroundColor:"#ffffff",color:"#3d76ab"}]},{htTableProperty:{border:"0",cellPadding:"0",cellSpacing:"1"},htTableStyle:{backgroundColor:"#a6bcd1"},ht1stColumnStyle:{padding:"3px 4px 2px",backgroundColor:"#6284ab",color:"#ffffff",textAlign:"left",fontWeight:"normal"},aRowStyle:[{padding:"3px 4px 2px",backgroundColor:"#ffffff",color:"#3d76ab"}]}],nhn.husky.HuskyCore.addLoadedFile("N_DraggableLayer.js"),nhn.DraggableLayer=jindo.$Class({$init:function(e,t){this.elLayer=e,this.setOptions(t),this.elHandle=this.oOptions.elHandle,e.style.display="block",e.style.position="absolute",e.style.zIndex="9999",this.aBasePosition=this.getBaseOffset(e);var i=this.toInt(jindo.$Element(e).offset().top)-this.aBasePosition.top,n=this.toInt(jindo.$Element(e).offset().left)-this.aBasePosition.left,o=this._correctXY({x:n,y:i});e.style.top=o.y+"px",e.style.left=o.x+"px",this.$FnMouseDown=jindo.$Fn(jindo.$Fn(this._mousedown,this).bind(e),this),this.$FnMouseMove=jindo.$Fn(jindo.$Fn(this._mousemove,this).bind(e),this),this.$FnMouseUp=jindo.$Fn(jindo.$Fn(this._mouseup,this).bind(e),this),this.$FnMouseDown.attach(this.elHandle,"mousedown"),this.elHandle.ondragstart=new Function("return false"),this.elHandle.onselectstart=new Function("return false")},_mousedown:function(e,t){"INPUT"!=t.element.tagName&&(this.oOptions.fnOnDragStart(),this.MouseOffsetY=t.pos().clientY-this.toInt(e.style.top)-this.aBasePosition.top,this.MouseOffsetX=t.pos().clientX-this.toInt(e.style.left)-this.aBasePosition.left,this.$FnMouseMove.attach(e.ownerDocument,"mousemove"),this.$FnMouseUp.attach(e.ownerDocument,"mouseup"),this.elHandle.style.cursor="move")},_mousemove:function(e,t){var i=t.pos().clientY-this.MouseOffsetY-this.aBasePosition.top,n=t.pos().clientX-this.MouseOffsetX-this.aBasePosition.left,o=this._correctXY({x:n,y:i});e.style.top=o.y+"px",e.style.left=o.x+"px"},_mouseup:function(e,t){this.oOptions.fnOnDragEnd(),this.$FnMouseMove.detach(e.ownerDocument,"mousemove"),this.$FnMouseUp.detach(e.ownerDocument,"mouseup"),this.elHandle.style.cursor=""},_correctXY:function(e){var t=e.x,i=e.y;return i<this.oOptions.nMinY&&(i=this.oOptions.nMinY),i>this.oOptions.nMaxY&&(i=this.oOptions.nMaxY),t<this.oOptions.nMinX&&(t=this.oOptions.nMinX),t>this.oOptions.nMaxX&&(t=this.oOptions.nMaxX),{x:t,y:i}},toInt:function(e){var t=parseInt(e);return t||0},findNonStatic:function(e){return e?"BODY"==e.tagName?e:jindo.$Element(e).css("position").match(/absolute|relative/i)?e:this.findNonStatic(e.offsetParent):null},getBaseOffset:function(e){var t=this.findNonStatic(e.offsetParent)||e.ownerDocument.body,i=jindo.$Element(t).offset();return{top:i.top,left:i.left}},setOptions:function(e){this.oOptions=e||{},this.oOptions.bModal=this.oOptions.bModal||!1,this.oOptions.elHandle=this.oOptions.elHandle||this.elLayer,this.oOptions.nMinX=this.oOptions.nMinX||-999999,this.oOptions.nMinY=this.oOptions.nMinY||-999999,this.oOptions.nMaxX=this.oOptions.nMaxX||999999,this.oOptions.nMaxY=this.oOptions.nMaxY||999999,this.oOptions.fnOnDragStart=this.oOptions.fnOnDragStart|
|