mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-26 06:39:56 +09:00
# Fix emoticon component to contain information of icons - 이모티콘 컴포넌트의 이모티콘에 정보를 담을 수 있게 수정. - 라이선스 정보도 담을 수 있고, 제작자 정보도 담길 수 있음. - 정보를 담는 양식은 일반적인 skin.xml 형식을 그대로 따름. # 이모티콘 컴포넌트 키보드 접근성 개선 - 키보드로 이모티콘 선택, 입력이 가능해짐. # 사용권이 불분명한 msn 이모티콘 제거 - 기본 이모티콘이었던 msn 이모티콘의 사용권 문제가 불명확 했음. - 기본 이모티콘을 트위터가 배포하는 트위모지로 변경. # 이모티콘 SVG 지원 - 기본은 래스터 이미지. 같은 이름의 SVG 파일이 ./svg 디렉토리에 있으면 SVG를 지원하는 브라우저에서 반영됨.
84 lines
2.4 KiB
JavaScript
84 lines
2.4 KiB
JavaScript
var is_popup = null;
|
|
|
|
/**
|
|
* @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++) {
|
|
var $img, $div;
|
|
$img = $('<input type="image" class="emoticon" onclick="insertEmoticon(this);return false" />')
|
|
.width( parseInt(emoticons[i].width, 10))
|
|
.height(parseInt(emoticons[i].height, 10))
|
|
.attr({
|
|
'src': './modules/editor/components/emoticon/tpl/images/'+emoticons[i].filename,
|
|
'data-src': './modules/editor/components/emoticon/tpl/images/'+emoticons[i].filename,
|
|
'alt': emoticons[i].alt
|
|
});
|
|
if( emoticons[i].svg ) {
|
|
$img.attr({
|
|
'data-svg': './modules/editor/components/emoticon/tpl/images/'+emoticons[i].svg
|
|
});
|
|
if( typeof SVGRect !== "undefined" ) {
|
|
$img.attr({
|
|
'src': './modules/editor/components/emoticon/tpl/images/'+emoticons[i].svg
|
|
});
|
|
}
|
|
}
|
|
$div = $('<div>');
|
|
html[html.length] = $div.append($img).html();
|
|
$img = null;
|
|
$div = null;
|
|
}
|
|
$('#emoticons').html(html.join(''));
|
|
setFixedPopupSize();
|
|
}
|
|
|
|
/**
|
|
* @brief Insert a selected emoticon into the document
|
|
* @params Event jQuery event
|
|
*/
|
|
function insertEmoticon(obj) {
|
|
var $img, $div, html, iframe, win = is_popup?opener:window;
|
|
|
|
if(!win) return;
|
|
|
|
$img = $('<img>').addClass("emoticon").width($(obj).width()).height($(obj).height()).attr({'src': $(obj).attr('data-src'), 'alt': $(obj).attr('alt')});
|
|
//https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Adding_vector_graphics_to_the_Web#Troubleshooting_and_cross-browser_support
|
|
if($(obj).attr('data-svg')) {
|
|
$img.attr('srcset', $(obj).attr('data-svg'));
|
|
}
|
|
$div = $('<div>');
|
|
html = $div.append($img).html();
|
|
|
|
win.editorFocus(win.editorPrevSrl);
|
|
win.editorRelKeys[win.editorPrevSrl].pasteHTML(html);
|
|
|
|
if (is_popup) window.focus();
|
|
|
|
return false;
|
|
}
|
|
|
|
$(function(){
|
|
is_popup = window._isPoped;
|
|
// load default emoticon set
|
|
getEmoticons('Twemoji');
|
|
$('ul.rx_tab>li a').click(function(){
|
|
$list = $( this ).parent('li');
|
|
$list.siblings('.rx_active').removeClass('rx_active');
|
|
$list.addClass('rx_active');
|
|
});
|
|
|
|
});
|