From f7b310970d87531ce918887a223e187946e086f6 Mon Sep 17 00:00:00 2001 From: taggon Date: Thu, 18 Nov 2010 10:04:57 +0000 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=EB=AA=A8=ED=8B=B0=EC=BD=98=20?= =?UTF-8?q?=ED=99=95=EC=9E=A5=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20:?= =?UTF-8?q?=20=EB=A0=88=EA=B1=B0=EC=8B=9C=20=ED=95=A8=EC=88=98=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0,=20=ED=99=95=EC=9E=A5=EC=84=B1=20=EC=84=A4=EA=B3=84?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7856 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- .../editor/components/emoticon/tpl/popup.js | 67 +++++++++++-------- 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/modules/editor/components/emoticon/tpl/popup.js b/modules/editor/components/emoticon/tpl/popup.js index e6008554c..156422d4f 100644 --- a/modules/editor/components/emoticon/tpl/popup.js +++ b/modules/editor/components/emoticon/tpl/popup.js @@ -1,39 +1,52 @@ -function insertEmoticon(obj) { - if(typeof(opener)=='undefined') return; +jQuery(function($){ - var url = obj.src.replace(request_uri,''); - var text = "\"emoticon\""; - - opener.editorFocus(opener.editorPrevSrl); +var is_popup = window._isPoped; - var iframe_obj = opener.editorGetIFrame(opener.editorPrevSrl) +/** + * @brief Get emoticon list by name + * @params String emoticon name + */ +function getEmoticons(emoName) { + var params = {component:'emoticon', emoticon:emoName, method:'getEmoticonList'}; + var resp_tags = 'error message emoticons'.split(' '); - opener.editorReplaceHTML(iframe_obj, text); - self.focus(); -} - -/* 선택된 이모티콘 목록을 가져옴 */ -function getEmoticons(emoticon) { - var params = new Array(); - params['component'] = "emoticon"; - params['emoticon'] = emoticon; - params['method'] = "getEmoticonList"; - - var response_tags = new Array('error','message','emoticons'); - exec_xml('editor', 'procEditorCall', params, completeGetEmoticons, response_tags); + exec_xml('editor', 'procEditorCall', params, completeGetEmoticons, resp_tags); } +/** + * @brief Load callback + */ function completeGetEmoticons(ret_obj) { var emoticons = ret_obj['emoticons'].split("\n"); + var html = []; - var zone = xGetElementById("popBody"); - var html = ""; for(var i=0;i'; + html[html.length] = ''; } - xInnerHtml(zone, html); - setFixedPopupSize(); - setTimeout(setFixedPopupSize,1000); + jQuery('#popBody').html(html).delegate('img.emoticon', 'click', insertEmoticon); + + if (_isPoped) { + setFixedPopupSize(); + setTimeout(setFixedPopupSize,1000); + } } -jQuery(window).load(function() { getEmoticons('msn'); }); +/** + * @brief Insert a selected emoticon into the document + * @params Event jQuery event + */ +function insertEmoticon(event) { + var url, html, iframe, win = is_popup?opener:window; + + if(!win) return; + + win.editorFocus(opener.editorPrevSrl); + win.editorRelKeys[opener.editorPrevSrl].pasteHTML(html); + + if (is_popup) self.focus(); +} + +// load default emoticon set +getEmoticons('msn'); + +});