var defaultemojiList=["activity","flag","food","nature","object","people","place","symbol"];
var defaultemoji={
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:"記号"
};
var lang_defaultemojis_text="{{cat}}の絵文字";
}else if(lang=="en"){
var defaultemojiname={
activity:"Activities",
flag:"Flags",
food:"Foods",
nature:"Nature",
object:"Tools",
people:"People",
place:"Places",
symbol:"Symbols"
};
var lang_defaultemojis_text="Emojis of {{cat}}";
}
function defaultEmoji(target){
var json=defaultemoji[target];
var emojis="";
Object.keys(json).forEach(function(key) {
var emoji = json[key];
emojis = emojis + '';
});
$("#emoji-list").html(emojis);
$("#now-emoji").text(lang_defaultemojis_text.replace("{{cat}}" ,defaultemojiname[target]));
$(".emoji-control").addClass("hide");
}
function customEmoji(){
$("#emoji-suggest").val("");
$(".emoji-control").removeClass("hide");
emojiList('home')
}
function defEmoji(target){
if(target=="thinking_face"){
target="thinking";
}
//var emoji=emojione.shortnameToUnicode(":"+target+":");
var emojiraw = emojisc.emojis.filter(function(item, index){
if (item.shortname == ':'+target+":") return true;
});
var emoji=emojiraw[0].emoji;
var now = $("#textarea").val();
var selin = localStorage.getItem("cursor");
var now = $("#textarea").val();
if(selin>0){
var before = now.substr(0, selin);
var after = now.substr(selin, now.length);
newt = before+ emoji + after;
}else{
newt = emoji+now;
}
console.log(emoji);
$("#textarea").val(newt);
$("#textarea").focus();
var selin = $("#textarea").prop('selectionStart');
if(!selin){
selin=0;
}
localStorage.setItem("cursor", selin);
}
function faicon(){
var json=faicons;
console.log(json);
var emojis="";
Object.keys(json).forEach(function(key) {
var emoji = json[key];
var eje = emoji.replace( /fa-/g , "" ) ;
emojis = emojis + '';
});
$("#emoji-list").html(emojis);
$("#now-emoji").text("faicon");
$(".emoji-control").addClass("hide");
}