rhymix/modules/editor/components/emoticon/tpl/popup.js
Min-Soo Kim a16670c6f6
기본 팝업창 스타일 수정. (#1075)
# 기본 팝업창 스타일 수정.

- 바뀐 관리자 페이지 스타일과 통일성 유지.
 - 임시 저장 글 불러오는 팝업 창 스타일 조정
- 팝업창 크기 계산 함수 조정
 - 폭을 먼저 확정한 다음 높이를 계산하도록 순서 조정
 - 위젯 수정 페이지 팝업 창 크기 계산 수정
 - 창 너비를 자유롭게 바꿀 수 있기 때문에, `.popup` 클래스를 가진 객체의 가로 폭을 자바스크립트가 강제로 변경하지 않도록 수정. (초기 가로 폭은 정확히 계산하여서 기존과 동일하게 맞춤)
- 라이믹스 문법에 맞춤
 - `jQuery` 를 `$` 로 쓸 수 있으므로 생략 가능한 구문 수정
2018-08-19 16:50:00 +09:00

50 lines
1.4 KiB
JavaScript

var is_popup = window._isPoped;
/**
* @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(' ');
exec_xml('editor', 'procEditorCall', params, completeGetEmoticons, resp_tags);
}
/**
* @brief Load callback
*/
function completeGetEmoticons(ret_obj) {
var emoticons = ret_obj.emoticons.item;
var html = [];
for(var i=0;i<emoticons.length;i++) {
html[html.length] = '<img src="./modules/editor/components/emoticon/tpl/images/'+emoticons[i].filename+'" width="' + parseInt(emoticons[i].width, 10) + '" height="' + parseInt(emoticons[i].height, 10) + '" onclick="insertEmoticon()" onload="setFixedPopupSize()" class="emoticon" />';
}
$('#emoticons').html(html.join(''));
}
/**
* @brief Insert a selected emoticon into the document
* @params Event jQuery event
*/
function insertEmoticon() {
var url, html, iframe, win = is_popup?opener:window;
if(!win) return;
html = '<img src="'+this.src+'" width="'+this.width+'" height="'+this.height+'" class="emoticon" />';
win.editorFocus(win.editorPrevSrl);
win.editorRelKeys[win.editorPrevSrl].pasteHTML(html);
if (is_popup) window.focus();
return false;
}
$(function(){
// load default emoticon set
getEmoticons('msn');
$('#selectEmoticonList').change(function(){ getEmoticons(this.value) });
});