thedesk/app/js/emoji/default-emoji.js

67 lines
2.0 KiB
JavaScript
Raw Normal View History

2018-03-13 04:41:38 +11:00
var defaultemoji={
activity:activity,
flag:flag,
food:food,
nature:nature,
object:object,
people:people,
place:place,
symbol:symbol
};
var defaultemojiname={
activity:"活動",
flag:"国旗",
food:"食べ物",
nature:"自然",
object:"もの",
people:"ひと",
place:"場所",
symbol:"記号"
};
function defaultEmoji(target){
var html=defaultemoji[target];
$("#emoji-list").html(html);
$("#now-emoji").text(defaultemojiname[target]+"の絵文字");
$(".emoji-control").addClass("hide");
}
function customEmoji(){
$(".emoji-control").removeClass("hide");
emojiList('home')
2018-03-14 05:31:31 +11:00
}
function defEmoji(target){
var start = "./js/emoji/emoji-map.json";
var xmlHttpRequest = new XMLHttpRequest();
xmlHttpRequest.onreadystatechange = function()
{
if( this.readyState == 4 && this.status == 200 ) {
if( this.response){
var json=this.response;
var emojis=json.emojis;
for (i = 0; i < emojis.length; i++) {
var emoji = emojis[i];
if (emoji.shortname==target) {
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.emoji + after;
}else{
2018-03-15 06:42:48 +11:00
newt = emoji.emoji+now;
2018-03-14 05:31:31 +11:00
}
2018-03-14 17:52:55 +11:00
console.log(emoji.emoji);
2018-03-14 05:31:31 +11:00
$("#textarea").val(newt);
//emoji();
$("#textarea").focus();
break;
}
}
}
}
}
xmlHttpRequest.open( 'GET', start, true );
xmlHttpRequest.responseType = 'json';
xmlHttpRequest.send( null );
2018-03-13 04:41:38 +11:00
}