mirror of
https://framagit.org/tom79/fediplan.git
synced 2025-04-05 21:51:50 +02:00
custom emoji in picker
This commit is contained in:
parent
cc2fc34ec9
commit
493f1966d9
1 changed files with 43 additions and 19 deletions
|
@ -269,6 +269,11 @@ document = window.document || {};
|
||||||
emoji: ""
|
emoji: ""
|
||||||
},
|
},
|
||||||
|
|
||||||
|
custom_emoji: {
|
||||||
|
icon: "yum",
|
||||||
|
title: "Custom emoji",
|
||||||
|
emoji: "",
|
||||||
|
},
|
||||||
smileys_people: {
|
smileys_people: {
|
||||||
icon: "yum",
|
icon: "yum",
|
||||||
title: "Smileys & People",
|
title: "Smileys & People",
|
||||||
|
@ -968,7 +973,7 @@ document = window.document || {};
|
||||||
var mainBlock = div('category-block').attr({"data-tone": 0}).prependTo(emojisList);
|
var mainBlock = div('category-block').attr({"data-tone": 0}).prependTo(emojisList);
|
||||||
|
|
||||||
$.each(options.filters, function(filter, params) {
|
$.each(options.filters, function(filter, params) {
|
||||||
var skin = 0;
|
let skin = 0;
|
||||||
if (filter === 'recent' && !self.recentEmojis) {
|
if (filter === 'recent' && !self.recentEmojis) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -981,13 +986,13 @@ document = window.document || {};
|
||||||
.wrapInner(shortnameTo(params.icon, self.emojiTemplateAlt))
|
.wrapInner(shortnameTo(params.icon, self.emojiTemplateAlt))
|
||||||
.appendTo(filters);
|
.appendTo(filters);
|
||||||
} else if (options.tones) {
|
} else if (options.tones) {
|
||||||
skin = 5;
|
skin = 6;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
var category,
|
let category,
|
||||||
items = params.emoji.replace(/[\s,;]+/g, '|');
|
items = params.emoji.replace(/[\s,;]+/g, '|');
|
||||||
|
|
||||||
if (skin === 0) {
|
if (skin === 0) {
|
||||||
|
@ -1001,27 +1006,46 @@ document = window.document || {};
|
||||||
"data-tone": skin
|
"data-tone": skin
|
||||||
}).appendTo(emojisList);
|
}).appendTo(emojisList);
|
||||||
}
|
}
|
||||||
|
if( filter === "custom_emoji"){
|
||||||
|
let titleTab = params.title;
|
||||||
|
$.ajax({
|
||||||
|
url: "https://"+$('#data_api').attr('data-instance')+"/api/v1/custom_emojis",
|
||||||
|
context: document.body
|
||||||
|
}).done(function(customEmoji) {
|
||||||
|
for(var i = 0 ; i < customEmoji.length ; i++) {
|
||||||
|
var element = $('<i class="emojibtn" role="button" data-name=":'+customEmoji[i].shortcode+':" title="'+customEmoji[i].shortcode+'"><img class="emojioneemoji" src="'+customEmoji[i].url+'" data-src="'+customEmoji[i].url+'"/></i>)');
|
||||||
|
element.on('click', function () {
|
||||||
|
pasteHtmlAtCaret(shortnameTo($(this).attr('data-name'), self.emojiTemplate));
|
||||||
|
})
|
||||||
|
category.append(element);
|
||||||
|
}
|
||||||
|
|
||||||
if (skin > 0) {
|
$('<div class="emojionearea-category-title"/>').text(titleTab).prependTo(category);
|
||||||
category.hide();
|
});
|
||||||
items = items.split('|').join('_tone' + skin + '|') + '_tone' + skin;
|
}else {
|
||||||
|
|
||||||
|
if (skin > 0) {
|
||||||
|
category.hide();
|
||||||
|
items = items.split('|').join('_tone' + skin + '|') + '_tone' + skin;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filter === 'recent') {
|
||||||
|
items = getRecent();
|
||||||
|
}
|
||||||
|
|
||||||
|
items = shortnameTo(items,
|
||||||
|
self.sprite ?
|
||||||
|
'<i class="emojibtn" role="button" data-name="{name}" title="{friendlyName}"><i class="emojione-{uni}"></i></i>' :
|
||||||
|
'<i class="emojibtn" role="button" data-name="{name}" title="{friendlyName}"><img class="emojioneemoji lazy-emoji" data-src="{img}"/></i>',
|
||||||
|
true).split('|').join('');
|
||||||
|
category.html(items);
|
||||||
|
$('<div class="emojionearea-category-title"/>').text(params.title).prependTo(category);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter === 'recent') {
|
|
||||||
items = getRecent();
|
|
||||||
}
|
|
||||||
|
|
||||||
items = shortnameTo(items,
|
|
||||||
self.sprite ?
|
|
||||||
'<i class="emojibtn" role="button" data-name="{name}" title="{friendlyName}"><i class="emojione-{uni}"></i></i>' :
|
|
||||||
'<i class="emojibtn" role="button" data-name="{name}" title="{friendlyName}"><img class="emojioneemoji lazy-emoji" data-src="{img}"/></i>',
|
|
||||||
true).split('|').join('');
|
|
||||||
|
|
||||||
category.html(items);
|
|
||||||
$('<div class="emojionearea-category-title"/>').text(params.title).prependTo(category);
|
|
||||||
} while (--skin > 0);
|
} while (--skin > 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
options.filters = null;
|
options.filters = null;
|
||||||
if (!self.sprite) {
|
if (!self.sprite) {
|
||||||
self.lasyEmoji = emojisList.find(".lazy-emoji");
|
self.lasyEmoji = emojisList.find(".lazy-emoji");
|
||||||
|
|
Loading…
Add table
Reference in a new issue