2019-11-25 00:26:19 +11:00
|
|
|
'use strict'
|
2019-11-25 02:03:33 +11:00
|
|
|
var defaultemojiList = ['activity', 'flag', 'food', 'nature', 'object', 'people', 'place', 'symbol']
|
2019-05-19 17:39:30 +10:00
|
|
|
var defaultemoji = {
|
2019-11-25 02:03:33 +11:00
|
|
|
activity: activity,
|
|
|
|
flag: flag,
|
|
|
|
food: food,
|
|
|
|
nature: nature,
|
|
|
|
object: object,
|
|
|
|
people: people,
|
|
|
|
place: place,
|
|
|
|
symbol: symbol
|
|
|
|
}
|
|
|
|
if (lang == 'ja') {
|
|
|
|
var defaultemojiname = {
|
|
|
|
activity: '活動',
|
|
|
|
flag: '国旗',
|
|
|
|
food: '食べ物',
|
|
|
|
nature: '自然',
|
|
|
|
object: 'もの',
|
|
|
|
people: 'ひと',
|
|
|
|
place: '場所',
|
|
|
|
symbol: '記号'
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
} else {
|
2019-11-25 02:03:33 +11:00
|
|
|
var defaultemojiname = {
|
|
|
|
activity: 'Activities',
|
|
|
|
flag: 'Flags',
|
|
|
|
food: 'Foods',
|
|
|
|
nature: 'Nature',
|
|
|
|
object: 'Tools',
|
|
|
|
people: 'People',
|
|
|
|
place: 'Places',
|
|
|
|
symbol: 'Symbols'
|
|
|
|
}
|
2018-07-29 17:37:54 +10:00
|
|
|
}
|
|
|
|
|
2019-05-19 17:39:30 +10:00
|
|
|
function defaultEmoji(target) {
|
2019-11-25 02:03:33 +11:00
|
|
|
var json = defaultemoji[target]
|
|
|
|
var emojis = ''
|
|
|
|
Object.keys(json).forEach(function(key) {
|
|
|
|
var emoji = json[key]
|
|
|
|
emojis =
|
|
|
|
emojis +
|
|
|
|
'<a onclick="defEmoji(\'' +
|
|
|
|
emoji['shortcode'] +
|
|
|
|
'\')" class="pointer"><span style="width: 20px; height: 20px; display: inline-block; background-image: url(\'../../img/sheet.png\'); background-size: 4900%; background-position: ' +
|
|
|
|
emoji['css'] +
|
|
|
|
';"></span></a>'
|
|
|
|
})
|
|
|
|
$('#emoji-list').html(emojis)
|
|
|
|
$('#now-emoji').text(lang.lang_defaultemojis_text.replace('{{cat}}', defaultemojiname[target]))
|
|
|
|
$('.emoji-control').addClass('hide')
|
2018-03-13 04:41:38 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function customEmoji() {
|
2019-11-25 02:03:33 +11:00
|
|
|
$('#emoji-suggest').val('')
|
|
|
|
$('.emoji-control').removeClass('hide')
|
|
|
|
emojiList('home')
|
2018-03-14 05:31:31 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function defEmoji(target) {
|
2019-11-25 02:03:33 +11:00
|
|
|
var selin = $('#textarea').prop('selectionStart')
|
|
|
|
if (!selin) {
|
|
|
|
selin = 0
|
|
|
|
}
|
|
|
|
var emojiraw = newpack.filter(function(item, index) {
|
|
|
|
if (item.short_name == target) return true
|
|
|
|
})
|
|
|
|
var hex = emojiraw[0].unified.split('-')
|
|
|
|
if (hex.length === 2) {
|
|
|
|
emoji = twemoji.convert.fromCodePoint(hex[0]) + twemoji.convert.fromCodePoint(hex[1])
|
|
|
|
} else {
|
|
|
|
emoji = twemoji.convert.fromCodePoint(hex[0])
|
|
|
|
}
|
|
|
|
var now = $('#textarea').val()
|
|
|
|
var before = now.substr(0, selin)
|
|
|
|
var after = now.substr(selin, now.length)
|
|
|
|
var newt = before + emoji + after
|
|
|
|
$('#textarea').val(newt)
|
|
|
|
$('#textarea').focus()
|
2018-03-31 13:39:06 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function faicon() {
|
2019-11-25 02:03:33 +11:00
|
|
|
var json = faicons
|
|
|
|
var emojis = ''
|
|
|
|
Object.keys(json).forEach(function(key) {
|
|
|
|
var emoji = json[key]
|
|
|
|
var eje = emoji.replace(/fa-/g, '')
|
|
|
|
emojis =
|
|
|
|
emojis +
|
|
|
|
'<a onclick="emojiInsert(\'[faicon]' +
|
|
|
|
eje +
|
|
|
|
'[/faicon]\')" class="pointer white-text" style="font-size:24px"><i class="fa ' +
|
|
|
|
emoji +
|
|
|
|
'"></i></a>'
|
|
|
|
})
|
|
|
|
$('#emoji-list').html(emojis)
|
|
|
|
$('#now-emoji').text('faicon')
|
|
|
|
$('.emoji-control').addClass('hide')
|
|
|
|
}
|