TheDesk Airi (ver.7)

This commit is contained in:
cutls
2018-03-20 13:55:25 +09:00
parent d689438b23
commit d6acb0bebc
24 changed files with 857 additions and 55 deletions

View File

@@ -14,6 +14,12 @@ function mdCheck(){
}else{
localStorage.removeItem("md");
}
var domain = localStorage.getItem("domain_" + acct_id);
if(domain=="mstdn.y-zu.org"){
//$("#private-button").text("限定公開(Yづドン!)");
}else{
//$("#private-button").text("非公開(Private)");
}
}
//BOXのトグルボタン
function mdToggle(){

View File

@@ -132,4 +132,43 @@ function brInsert(code) {
var now = $("#textarea").val();
$("#textarea").val(now + code);
$("#textarea").focus();
}
}
//入力時に絵文字をサジェスト
var etimer = null;
var einput = document.getElementById("emoji-suggest");
var prev_val = einput.value;
var oldSuggest;
var suggest;
einput.addEventListener("focus", function() {
$(".emoji-control").addClass("hide");
$("#suggest").html("");
window.clearInterval(etimer);
etimer = window.setInterval(function() {
var new_val = einput.value;
var html="";
if (prev_val != new_val && new_val.length > 3) {
var obj = JSON.parse(localStorage.getItem("emoji_" + acct_id));
var num = obj.length;
for (i = 0; i < num; i++) {
var emoji = obj[i];
if ( ~emoji.shortcode.indexOf(new_val)) {
//strにhogeを含む場合の処理
if (emoji) {
html = html + '<a onclick="emojiInsert(\':' + emoji.shortcode +
': \')" class="pointer"><img src="' + emoji.url + '" width="20"></a>';
}
}
}
$("#emoji-list").html(html+'<br><a onclick="customEmoji()" class="pointer waves-effect">リセット</a>');
};
oldSuggest = suggest;
prev_value = new_val;
}, 1000);
}, false);
einput.addEventListener("blur", function() {
window.clearInterval(etimer);
}, false);

View File

@@ -9,16 +9,30 @@ function post() {
var at = localStorage.getItem(domain + "_at");
var start = "https://" + domain + "/api/v1/statuses";
var reply = $("#reply").val();
var toot={
status: str
}
if(reply){
toot.in_reply_to_id=reply
}
var media = $("#media").val();
if(media){
toot.media_ids=media;
}
if ($("#nsfw").hasClass("nsfw-avail")) {
var nsfw = "true";
toot.sensitive=nsfw;
} else {
var nsfw = "false";
}
var vis = $("#vis").text();
if(vis!="public"){
toot.visibility=vis;
}
if ($("#cw").hasClass("cw-avail")) {
var spo = $("#cw-text").val();
cw();
toot.spoiler_text=spo;
} else {
var spo = "";
}
@@ -28,14 +42,7 @@ function post() {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
body: JSON.stringify({
status: str,
in_reply_to_id: reply,
media_ids: media.split(","),
sensitive: nsfw,
spoiler_text: spo,
visibility: vis
})
body: JSON.stringify(toot)
}).then(function(response) {
return response.json();
}).catch(function(error) {