cannot fav and bt

This commit is contained in:
cutls 2019-10-11 23:50:25 +09:00
parent f74e2262dc
commit 1917531c54
3 changed files with 485 additions and 483 deletions

View File

@ -10,23 +10,25 @@ function fav(id, acct_id, remote) {
var at = localStorage.getItem("acct_" + acct_id + "_at"); var at = localStorage.getItem("acct_" + acct_id + "_at");
var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag; var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag;
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open("POST", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.setRequestHeader("Authorization", "Bearer " + at);
httpreq.responseType = "json"; httpreq.responseType = "json";
httpreq.send(); httpreq.send();
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) { if (httpreq.readyState === 4) {
var json = httpreq.response; var json = httpreq.response;
if (json.reblog) { if (json.reblog) {
json = json.reblog json = json.reblog;
} }
if (remote != "remote") { if (remote != "remote") {
//APIのふぁぼカウントがおかしい //APIのふぁぼカウントがおかしい
if ($("[toot-id=" + id + "] .fav_ct").text() == json.favourites_count) { if ($("[unique-id=" + id + "] .fav_ct").text() == json.favourites_count) {
if (flag == "unfavourite") { if (flag == "unfavourite") {
var fav = json.favourites_count - 1; var fav = json.favourites_count - 1;
if ( fav * 1 < 0){ fav = 0} if (fav * 1 < 0) {
fav = 0;
}
} else { } else {
var fav = json.favourites_count; var fav = json.favourites_count;
//var fav = json.favourites_count; //var fav = json.favourites_count;
@ -34,20 +36,20 @@ function fav(id, acct_id, remote) {
} else { } else {
var fav = json.favourites_count; var fav = json.favourites_count;
} }
$("[toot-id=" + id + "] .fav_ct").text(fav); $("[unique-id=" + id + "] .fav_ct").text(fav);
$("[toot-id=" + id + "] .rt_ct").text(json.reblogs_count); $("[unique-id=" + id + "] .rt_ct").text(json.reblogs_count);
if ($("[toot-id=" + id + "]").hasClass("faved")) { if ($("[unique-id=" + id + "]").hasClass("faved")) {
$("[toot-id=" + id + "]").removeClass("faved"); $("[unique-id=" + id + "]").removeClass("faved");
$(".fav_" + id).removeClass("yellow-text"); $(".fav_" + id).removeClass("yellow-text");
} else { } else {
$("[toot-id=" + id + "]").addClass("faved"); $("[unique-id=" + id + "]").addClass("faved");
$(".fav_" + id).addClass("yellow-text"); $(".fav_" + id).addClass("yellow-text");
} }
} else { } else {
M.toast({ html: lang.lang_status_favWarn, displayLength: 1000 }) M.toast({ html: lang.lang_status_favWarn, displayLength: 1000 });
}
} }
} }
};
} }
//ブースト //ブースト
@ -61,9 +63,9 @@ function rt(id, acct_id, remote, vis) {
var at = localStorage.getItem("acct_" + acct_id + "_at"); var at = localStorage.getItem("acct_" + acct_id + "_at");
var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag; var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag;
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open("POST", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.setRequestHeader("Authorization", "Bearer " + at);
httpreq.responseType = "json"; httpreq.responseType = "json";
if (vis) { if (vis) {
httpreq.send(JSON.stringify({ visibility: vis })); httpreq.send(JSON.stringify({ visibility: vis }));
@ -74,46 +76,44 @@ function rt(id, acct_id, remote, vis) {
if (httpreq.readyState === 4) { if (httpreq.readyState === 4) {
var json = httpreq.response; var json = httpreq.response;
if (json.reblog) { if (json.reblog) {
json = json.reblog json = json.reblog;
} }
console.log(["Success: boost", json]); console.log(["Success: boost", json]);
if (remote != "remote") { $("[unique-id=" + id + "] .fav_ct").text(json.favourites_count);
$("[toot-id=" + id + "] .fav_ct").text(json.favourites_count);
if (!json.reblog) { if (!json.reblog) {
if (flag == "unreblog") { if (flag == "unreblog") {
var rt = json.reblogs_count - 1; var rt = json.reblogs_count - 1;
if ( rt * 1 < 0){ rt = 0} if (rt * 1 < 0) {
rt = 0;
}
} else { } else {
var rt = json.reblogs_count; var rt = json.reblogs_count;
} }
$("[toot-id=" + id + "] .rt_ct").text(rt); $("[unique-id=" + id + "] .rt_ct").text(rt);
} else { } else {
$("[toot-id=" + id + "] .rt_ct").text(json.reblogs_count); $("[unique-id=" + id + "] .rt_ct").text(json.reblogs_count);
} }
if ($("[toot-id=" + id + "]").hasClass("rted")) { if ($("[unique-id=" + id + "]").hasClass("rted")) {
$("[toot-id=" + id + "]").removeClass("rted"); $("[unique-id=" + id + "]").removeClass("rted");
$(".rt_" + id).removeClass("light-blue-text"); $(".rt_" + id).removeClass("light-blue-text");
} else { } else {
$("[toot-id=" + id + "]").addClass("rted"); $("[unique-id=" + id + "]").addClass("rted");
$(".rt_" + id).addClass("light-blue-text"); $(".rt_" + id).addClass("light-blue-text");
} }
} else {
M.toast({ html: lang.lang_status_btWarn, displayLength: 1000 })
}
}
} }
};
} }
function boostWith(vis) { function boostWith(vis) {
var id = $("#tootmodal").attr("data-id"); var id = $("#tootmodal").attr("data-id");
var acct_id = $("#tootmodal").attr("data-acct"); var acct_id = $("#tootmodal").attr("data-acct");
rt(id, acct_id, false, vis) rt(id, acct_id, false, vis);
} }
//フォロー //フォロー
function follow(acct_id, remote) { function follow(acct_id, remote) {
if (!acct_id && acct_id != "selector") { if (!acct_id && acct_id != "selector") {
var acct_id = $('#his-data').attr("use-acct"); var acct_id = $("#his-data").attr("use-acct");
} else if (acct_id == "selector") { } else if (acct_id == "selector") {
var acct_id = $("#user-acct-sel").val(); var acct_id = $("#user-acct-sel").val();
} }
@ -134,14 +134,14 @@ function follow(acct_id, remote) {
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag; var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
if (localStorage.getItem("mode_" + domain) == "misskey") { if (localStorage.getItem("mode_" + domain) == "misskey") {
var start = "https://" + domain + "/api/following/" + flagm; var start = "https://" + domain + "/api/following/" + flagm;
var ent = { "i": at, "userId": id } var ent = { i: at, userId: id };
} else if (remote == "true" && flag == "follow") { } else if (remote == "true" && flag == "follow") {
var ent = {} var ent = {};
} }
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open("POST", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.setRequestHeader("Authorization", "Bearer " + at);
httpreq.responseType = "json"; httpreq.responseType = "json";
httpreq.send(JSON.stringify(ent)); httpreq.send(JSON.stringify(ent));
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
@ -156,40 +156,40 @@ function follow(acct_id, remote) {
$("#his-follow-btn").text(lang.lang_status_unfollow); $("#his-follow-btn").text(lang.lang_status_unfollow);
} }
} }
} };
} }
//ブロック //ブロック
function block(acct_id) { function block(acct_id) {
if ($("#his-data").hasClass("blocking")) { if ($("#his-data").hasClass("blocking")) {
var flag = "unblock"; var flag = "unblock";
var txt = lang.lang_status_unmute var txt = lang.lang_status_unmute;
} else { } else {
var flag = "block"; var flag = "block";
var txt = lang.lang_status_block var txt = lang.lang_status_block;
} }
Swal.fire({ Swal.fire({
title: txt, title: txt,
text: "", text: "",
type: 'warning', type: "warning",
showCancelButton: true, showCancelButton: true,
confirmButtonColor: '#3085d6', confirmButtonColor: "#3085d6",
cancelButtonColor: '#d33', cancelButtonColor: "#d33",
confirmButtonText: lang.lang_yesno, confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no cancelButtonText: lang.lang_no
}).then((result) => { }).then(result => {
if (result.value) { if (result.value) {
if (!acct_id) { if (!acct_id) {
var acct_id = $('#his-data').attr("use-acct"); var acct_id = $("#his-data").attr("use-acct");
} }
var id = $("#his-data").attr("user-id"); var id = $("#his-data").attr("user-id");
var domain = localStorage.getItem("domain_" + acct_id); var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_" + acct_id + "_at"); var at = localStorage.getItem("acct_" + acct_id + "_at");
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag; var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open("POST", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.setRequestHeader("Authorization", "Bearer " + at);
httpreq.responseType = "json"; httpreq.responseType = "json";
httpreq.send(); httpreq.send();
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
@ -202,10 +202,9 @@ function block(acct_id) {
$("#his-block-btn").text(lang.lang_status_unblock); $("#his-block-btn").text(lang.lang_status_unblock);
} }
} }
} };
} }
}); });
} }
//ミュート //ミュート
@ -213,41 +212,41 @@ function muteDo(acct_id) {
if ($("#his-data").hasClass("muting")) { if ($("#his-data").hasClass("muting")) {
var flag = "unmute"; var flag = "unmute";
var flagm = "delete"; var flagm = "delete";
var txt = lang.lang_status_unmute var txt = lang.lang_status_unmute;
} else { } else {
var flag = "mute"; var flag = "mute";
var flagm = "create"; var flagm = "create";
var txt = lang.lang_status_mute var txt = lang.lang_status_mute;
} }
Swal.fire({ Swal.fire({
title: txt, title: txt,
text: "", text: "",
type: 'warning', type: "warning",
showCancelButton: true, showCancelButton: true,
confirmButtonColor: '#3085d6', confirmButtonColor: "#3085d6",
cancelButtonColor: '#d33', cancelButtonColor: "#d33",
confirmButtonText: lang.lang_yesno, confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no cancelButtonText: lang.lang_no
}).then((result) => { }).then(result => {
if (result.value) { if (result.value) {
if (!acct_id) { if (!acct_id) {
var acct_id = $('#his-data').attr("use-acct"); var acct_id = $("#his-data").attr("use-acct");
} }
var id = $("#his-data").attr("user-id"); var id = $("#his-data").attr("user-id");
var domain = localStorage.getItem("domain_" + acct_id); var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_" + acct_id + "_at"); var at = localStorage.getItem("acct_" + acct_id + "_at");
if (localStorage.getItem("mode_" + domain) == "misskey") { if (localStorage.getItem("mode_" + domain) == "misskey") {
var start = "https://" + domain + "/api/mute/" + flagm; var start = "https://" + domain + "/api/mute/" + flagm;
var ent = { "i": at, "userId": id } var ent = { i: at, userId: id };
var rq = JSON.stringify(ent); var rq = JSON.stringify(ent);
} else { } else {
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag; var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
var rq = ""; var rq = "";
} }
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open("POST", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.setRequestHeader("Authorization", "Bearer " + at);
httpreq.responseType = "json"; httpreq.responseType = "json";
httpreq.send(rq); httpreq.send(rq);
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
@ -260,10 +259,9 @@ function muteDo(acct_id) {
$("#his-mute-btn").text(lang.lang_status_unmute); $("#his-mute-btn").text(lang.lang_status_unmute);
} }
} }
} };
} }
}); });
} }
//投稿削除 //投稿削除
@ -273,8 +271,8 @@ function del(id, acct_id) {
if (localStorage.getItem("mode_" + domain) == "misskey") { if (localStorage.getItem("mode_" + domain) == "misskey") {
var start = "https://" + domain + "/api/notes/delete"; var start = "https://" + domain + "/api/notes/delete";
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open("POST", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.responseType = "json"; httpreq.responseType = "json";
httpreq.send(JSON.stringify({ i: at, noteId: id })); httpreq.send(JSON.stringify({ i: at, noteId: id }));
$("[toot-id=" + id + "]").hide(); $("[toot-id=" + id + "]").hide();
@ -282,36 +280,36 @@ function del(id, acct_id) {
} else { } else {
var start = "https://" + domain + "/api/v1/statuses/" + id; var start = "https://" + domain + "/api/v1/statuses/" + id;
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('DELETE', start, true); httpreq.open("DELETE", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.setRequestHeader("Authorization", "Bearer " + at);
httpreq.responseType = "json"; httpreq.responseType = "json";
httpreq.send(); httpreq.send();
} }
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) { if (httpreq.readyState === 4) {
} }
} };
} }
//redraft //redraft
function redraft(id, acct_id) { function redraft(id, acct_id) {
Swal.fire({ Swal.fire({
title: lang.lang_status_redraftTitle, title: lang.lang_status_redraftTitle,
text: lang.lang_status_redraft, text: lang.lang_status_redraft,
type: 'warning', type: "warning",
showCancelButton: true, showCancelButton: true,
confirmButtonColor: '#3085d6', confirmButtonColor: "#3085d6",
cancelButtonColor: '#d33', cancelButtonColor: "#d33",
confirmButtonText: lang.lang_yesno, confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no cancelButtonText: lang.lang_no
}).then((result) => { }).then(result => {
if (result.value) { if (result.value) {
show(); show();
del(id, acct_id); del(id, acct_id);
$("#post-acct-sel").prop("disabled", true); $("#post-acct-sel").prop("disabled", true);
$("#post-acct-sel").val(acct_id); $("#post-acct-sel").val(acct_id);
$('select').formSelect(); $("select").formSelect();
mdCheck() mdCheck();
var medias = $("[toot-id=" + id + "]").attr("data-medias"); var medias = $("[toot-id=" + id + "]").attr("data-medias");
var vismode = $("[toot-id=" + id + "] .vis-data").attr("data-vis"); var vismode = $("[toot-id=" + id + "] .vis-data").attr("data-vis");
vis(vismode); vis(vismode);
@ -321,7 +319,9 @@ function redraft(id, acct_id) {
if (i < ct) { if (i < ct) {
var url = $(elem).attr("src"); var url = $(elem).attr("src");
console.log("Play back image data:" + url); console.log("Play back image data:" + url);
$('#preview').append('<img src="' + url + '" style="width:50px; max-height:100px;">'); $("#preview").append(
'<img src="' + url + '" style="width:50px; max-height:100px;">'
);
} }
}); });
var html = $("[toot-id=" + id + "] .toot").html(); var html = $("[toot-id=" + id + "] .toot").html();
@ -341,7 +341,7 @@ function redraft(id, acct_id) {
$("#cw-text").val(cwtxt); $("#cw-text").val(cwtxt);
} }
} }
}) });
} }
//ピン留め //ピン留め
function pin(id, acct_id) { function pin(id, acct_id) {
@ -354,9 +354,9 @@ function pin(id, acct_id) {
var at = localStorage.getItem("acct_" + acct_id + "_at"); var at = localStorage.getItem("acct_" + acct_id + "_at");
var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag; var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag;
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open("POST", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.setRequestHeader("Authorization", "Bearer " + at);
httpreq.responseType = "json"; httpreq.responseType = "json";
httpreq.send(); httpreq.send();
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
@ -371,18 +371,19 @@ function pin(id, acct_id) {
$(".pin_" + id).addClass("blue-text"); $(".pin_" + id).addClass("blue-text");
} }
} }
} };
} }
//フォロリク //フォロリク
function request(id, flag, acct_id) { function request(id, flag, acct_id) {
var domain = localStorage.getItem("domain_" + acct_id); var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_" + acct_id + "_at"); var at = localStorage.getItem("acct_" + acct_id + "_at");
var start = "https://" + domain + "/api/v1/follow_requests/" + id + "/" + flag; var start =
"https://" + domain + "/api/v1/follow_requests/" + id + "/" + flag;
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open("POST", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.setRequestHeader("Authorization", "Bearer " + at);
httpreq.responseType = "json"; httpreq.responseType = "json";
httpreq.send(); httpreq.send();
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
@ -391,21 +392,21 @@ function request(id, flag, acct_id) {
console.log(["Success: request", "type:" + flag, json]); console.log(["Success: request", "type:" + flag, json]);
showReq(); showReq();
} }
} };
} }
//ドメインブロック(未実装) //ドメインブロック(未実装)
function domainblock(add, flag, acct_id) { function domainblock(add, flag, acct_id) {
if (!acct_id) { if (!acct_id) {
var acct_id = $('#his-data').attr("use-acct"); var acct_id = $("#his-data").attr("use-acct");
} }
var domain = localStorage.getItem("domain_" + acct_id); var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_" + acct_id + "_at"); var at = localStorage.getItem("acct_" + acct_id + "_at");
var start = "https://" + domain + "/api/v1/domain_blocks" var start = "https://" + domain + "/api/v1/domain_blocks";
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open("POST", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.setRequestHeader("Authorization", "Bearer " + at);
httpreq.responseType = "json"; httpreq.responseType = "json";
httpreq.send(); httpreq.send();
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
@ -414,12 +415,12 @@ function domainblock(add, flag, acct_id) {
console.log(["Success: domain block", json]); console.log(["Success: domain block", json]);
showDom(); showDom();
} }
} };
} }
function addDomainblock() { function addDomainblock() {
var domain = $("#domainblock").val(); var domain = $("#domainblock").val();
domainblock(domain, 'POST'); domainblock(domain, "POST");
} }
//ユーザー強調 //ユーザー強調
function empUser() { function empUser() {
@ -429,7 +430,7 @@ function empUser() {
if (!obj) { if (!obj) {
var obj = []; var obj = [];
obj.push(id); obj.push(id);
M.toast({ html: id + lang.lang_status_emphas, displayLength: 4000 }) M.toast({ html: id + lang.lang_status_emphas, displayLength: 4000 });
} else { } else {
var can; var can;
Object.keys(obj).forEach(function(key) { Object.keys(obj).forEach(function(key) {
@ -439,7 +440,7 @@ function empUser() {
} else { } else {
can = true; can = true;
obj.splice(key, 1); obj.splice(key, 1);
M.toast({ html: id + lang.lang_status_unemphas, displayLength: 4000 }) M.toast({ html: id + lang.lang_status_unemphas, displayLength: 4000 });
} }
}); });
} }
@ -459,29 +460,28 @@ function pinUser() {
var at = localStorage.getItem("acct_" + acct_id + "_at"); var at = localStorage.getItem("acct_" + acct_id + "_at");
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag; var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open("POST", start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader("Content-Type", "application/json");
httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.setRequestHeader("Authorization", "Bearer " + at);
httpreq.responseType = "json"; httpreq.responseType = "json";
httpreq.send(); httpreq.send();
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) { if (httpreq.readyState === 4) {
var json = httpreq.response; var json = httpreq.response;
if ($("#his-end-btn").hasClass("endorsed")) { if ($("#his-end-btn").hasClass("endorsed")) {
$("#his-end-btn").removeClass("endorsed") $("#his-end-btn").removeClass("endorsed");
$("#his-end-btn").text(lang.lang_status_endorse) $("#his-end-btn").text(lang.lang_status_endorse);
} else { } else {
$("#his-end-btn").addClass("endorsed") $("#his-end-btn").addClass("endorsed");
$("#his-end-btn").text(lang.lang_status_unendorse) $("#his-end-btn").text(lang.lang_status_unendorse);
}
} }
} }
};
} }
//URLコピー //URLコピー
function tootUriCopy(url) { function tootUriCopy(url) {
execCopy(url); execCopy(url);
M.toast({ html: lang.lang_details_url, displayLength: 1500 }) M.toast({ html: lang.lang_details_url, displayLength: 1500 });
} }
//他のアカウントで… //他のアカウントで…
@ -490,26 +490,29 @@ function staEx(mode) {
var acct_id = $("#status-acct-sel").val(); var acct_id = $("#status-acct-sel").val();
var domain = localStorage.getItem("domain_" + acct_id); var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_" + acct_id + "_at"); var at = localStorage.getItem("acct_" + acct_id + "_at");
var start = "https://" + domain + "/api/v2/search?resolve=true&q=" + url var start = "https://" + domain + "/api/v2/search?resolve=true&q=" + url;
fetch(start, { fetch(start, {
method: 'GET', method: "GET",
headers: { headers: {
'content-type': 'application/json', "content-type": "application/json",
'Authorization': 'Bearer ' + at Authorization: "Bearer " + at
} }
}).then(function (response) { })
.then(function(response) {
return response.json(); return response.json();
}).catch(function (error) { })
.catch(function(error) {
todo(error); todo(error);
console.error(error); console.error(error);
}).then(function (json) { })
.then(function(json) {
var id = json.statuses[0].id; var id = json.statuses[0].id;
if (mode == "rt") { if (mode == "rt") {
rt(id, acct_id, 'remote') rt(id, acct_id, "remote");
} else if (mode == "fav") { } else if (mode == "fav") {
fav(id, acct_id, 'remote') fav(id, acct_id, "remote");
} else if (mode == "reply") { } else if (mode == "reply") {
reEx(id) reEx(id);
} }
}); });
return; return;
@ -525,13 +528,12 @@ function toggleAction(id, tlid, acct_id) {
if (!$(tlide + " [toot-id=" + id + "]").hasClass("ext-mode")) { if (!$(tlide + " [toot-id=" + id + "]").hasClass("ext-mode")) {
$(tlide + " [toot-id=" + id + "] .type-a").hide(); $(tlide + " [toot-id=" + id + "] .type-a").hide();
$(tlide + " [toot-id=" + id + "] .type-b").show(); $(tlide + " [toot-id=" + id + "] .type-b").show();
$(tlide + " [toot-id=" + id + "]").addClass("ext-mode") $(tlide + " [toot-id=" + id + "]").addClass("ext-mode");
$(tlide + " [toot-id=" + id + "] .act-icon").text("expand_less"); $(tlide + " [toot-id=" + id + "] .act-icon").text("expand_less");
} else { } else {
$(tlide + " [toot-id=" + id + "] .type-b").hide(); $(tlide + " [toot-id=" + id + "] .type-b").hide();
$(tlide + " [toot-id=" + id + "] .type-a").show(); $(tlide + " [toot-id=" + id + "] .type-a").show();
$(tlide + " [toot-id=" + id + "]").removeClass("ext-mode") $(tlide + " [toot-id=" + id + "]").removeClass("ext-mode");
$(tlide + " [toot-id=" + id + "] .act-icon").text("expand_more"); $(tlide + " [toot-id=" + id + "] .act-icon").text("expand_more");
} }
} }

View File

@ -869,7 +869,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
'<div class="action ' + can_rt + ' ' + disp["rt"] + ' ' + noauth + '"><a onclick="rt(\'' + uniqueid + '\',' + acct_id + '<div class="action ' + can_rt + ' ' + disp["rt"] + ' ' + noauth + '"><a onclick="rt(\'' + uniqueid + '\',' + acct_id +
',\'' + tlid + ',\'' + tlid +
'\')" class="waves-effect waves-dark btn-flat actct bt-btn" style="padding:0" title="' + lang.lang_parse_bt + '"><i class="fas fa-retweet ' + '\')" class="waves-effect waves-dark btn-flat actct bt-btn" style="padding:0" title="' + lang.lang_parse_bt + '"><i class="fas fa-retweet ' +
if_rt + ' rt_' + toot.id + '"></i><span class="rt_ct">' + toot.reblogs_count + if_rt + ' rt_' + uniqueid + '"></i><span class="rt_ct">' + toot.reblogs_count +
'</span></a></div>' + '</span></a></div>' +
'<div class="action ' + can_rt + ' ' + disp["qt"] + ' ' + noauth + ' ' + qtClass + '"><a onclick="qt(\'' + toot.id + '\',' + acct_id + '<div class="action ' + can_rt + ' ' + disp["qt"] + ' ' + noauth + ' ' + qtClass + '"><a onclick="qt(\'' + toot.id + '\',' + acct_id +
',\'' + toot.account.acct + '\',\'' + toot.url + ',\'' + toot.account.acct + '\',\'' + toot.url +
@ -877,7 +877,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
'<div class="action ' + disp["fav"] + ' ' + noauth + '"><a onclick="fav(\'' + uniqueid + '\',' + acct_id + '<div class="action ' + disp["fav"] + ' ' + noauth + '"><a onclick="fav(\'' + uniqueid + '\',' + acct_id +
',\'' + tlid + ',\'' + tlid +
'\')" class="waves-effect waves-dark btn-flat actct fav-btn" style="padding:0" title="' + lang.lang_parse_fav + '"><i class="fas text-darken-3 fa-star' + '\')" class="waves-effect waves-dark btn-flat actct fav-btn" style="padding:0" title="' + lang.lang_parse_fav + '"><i class="fas text-darken-3 fa-star' +
if_fav + ' fav_' + toot.id + '"></i><span class="fav_ct">' + toot.favourites_count + if_fav + ' fav_' + uniqueid + '"></i><span class="fav_ct">' + toot.favourites_count +
'</a></span></div>' + '</a></span></div>' +
'<div class="' + if_mine + ' action ' + disp["del"] + ' ' + noauth + '"><a onclick="del(\'' + toot.id + '\',' + '<div class="' + if_mine + ' action ' + disp["del"] + ' ' + noauth + '"><a onclick="del(\'' + toot.id + '\',' +
acct_id + acct_id +

View File

@ -1,6 +1,6 @@
{ {
"name": "thedesk", "name": "thedesk",
"version": "18.11.1", "version": "18.11.2",
"description": "TheDesk is a Mastodon client for PC.", "description": "TheDesk is a Mastodon client for PC.",
"repository": "https://github.com/cutls/TheDesk", "repository": "https://github.com/cutls/TheDesk",
"main": "main.js", "main": "main.js",
@ -63,7 +63,7 @@
}, },
"optionalDependencies": { "optionalDependencies": {
"font-manager": "^0.3.0", "font-manager": "^0.3.0",
"itunes-nowplaying-mac": "cutls/itunes-nowplaying-mac" "itunes-nowplaying-mac": "0.3.1"
}, },
"devDependencies": { "devDependencies": {
"electron": "^6.0.12", "electron": "^6.0.12",