thedesk/app/js/userdata/his-data.js

649 lines
18 KiB
JavaScript
Raw Normal View History

2018-01-28 23:22:43 +11:00
//ユーザーデータ表示
//タイムライン
function utl(user, more, acct_id) {
if (!acct_id) {
var acct_id = $('#his-data').attr("use-acct");
}
var domain = localStorage.getItem("domain_" + acct_id);
2019-05-19 17:39:30 +10:00
var at = localStorage.getItem("acct_" + acct_id + "_at");
2018-01-28 23:22:43 +11:00
if (user == "--now") {
var user = $('#his-data').attr("user-id");
}
2019-05-19 17:39:30 +10:00
if (localStorage.getItem("mode_" + domain) != "misskey") {
2018-07-30 21:03:49 +10:00
if (more) {
var sid = $("#his-tl .cvo").last().attr("toot-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
}
var start = "https://" + domain + "/api/v1/accounts/" + user + "/statuses" +
plus;
2019-05-19 17:39:30 +10:00
var i = {
2018-07-30 21:03:49 +10:00
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
}
}
2019-05-19 17:39:30 +10:00
} else {
var req = { i: at }
2018-07-30 21:03:49 +10:00
if (more) {
var sid = $("#his-tl .cvo").last().attr("toot-id");
2019-05-19 17:39:30 +10:00
req.maxId = sid;
2018-07-30 21:03:49 +10:00
}
2019-05-19 17:39:30 +10:00
req.userId = user;
2018-07-30 21:03:49 +10:00
var start = "https://" + domain + "/api/users/notes"
2019-05-19 17:39:30 +10:00
var i = {
2018-07-30 21:03:49 +10:00
method: 'POST',
headers: {
'content-type': 'application/json',
},
2019-05-19 17:39:30 +10:00
body: JSON.stringify(req)
2018-07-30 21:03:49 +10:00
}
2018-01-28 23:22:43 +11:00
}
2019-05-19 17:39:30 +10:00
fetch(start, i).then(function (response) {
2018-01-28 23:22:43 +11:00
return response.json();
2019-05-19 17:39:30 +10:00
}).catch(function (error) {
2018-01-28 23:22:43 +11:00
todo(error);
console.error(error);
2019-05-19 17:39:30 +10:00
}).then(function (json) {
if (localStorage.getItem("mode_" + domain) == "misskey") {
2018-09-11 04:59:44 +10:00
var templete = misskeyParse(json, '', acct_id, 'user');
2019-05-19 17:39:30 +10:00
} else {
2018-09-11 04:59:44 +10:00
var templete = parse(json, '', acct_id, 'user');
2018-07-30 21:03:49 +10:00
}
2019-05-19 17:39:30 +10:00
if (!json[0]) {
templete = lang.lang_details_nodata + "<br>";
2018-03-31 13:39:06 +11:00
}
2018-01-28 23:22:43 +11:00
if (more) {
$("#his-tl-contents").append(templete);
} else {
2019-05-19 17:39:30 +10:00
if (localStorage.getItem("mode_" + domain) != "misskey") {
pinutl(templete, user, acct_id)
} else {
2018-07-30 21:03:49 +10:00
$("#his-tl-contents").html(templete);
}
2018-01-28 23:22:43 +11:00
}
jQuery("time.timeago").timeago();
});
}
2018-03-27 13:39:35 +11:00
//ピン留めTL
2019-05-19 17:39:30 +10:00
function pinutl(before, user, acct_id) {
2018-03-27 13:39:35 +11:00
if (!acct_id) {
var acct_id = $('#his-data').attr("use-acct");
}
var domain = localStorage.getItem("domain_" + acct_id);
2019-05-19 17:39:30 +10:00
var at = localStorage.getItem("acct_" + acct_id + "_at");
2018-03-27 13:39:35 +11:00
if (user == "--now") {
var user = $('#his-data').attr("user-id");
}
2019-05-19 17:39:30 +10:00
var plus = "?pinned=1";
2018-03-27 13:39:35 +11:00
var start = "https://" + domain + "/api/v1/accounts/" + user + "/statuses" +
plus
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
2019-05-19 17:39:30 +10:00
}).then(function (response) {
2018-03-27 13:39:35 +11:00
return response.json();
2019-05-19 17:39:30 +10:00
}).catch(function (error) {
2018-03-27 13:39:35 +11:00
todo(error);
console.error(error);
2019-05-19 17:39:30 +10:00
}).then(function (json) {
var templete = parse(json, 'pinned', acct_id, 'user');
if (!json[0]) {
templete = "";
2018-03-31 13:39:06 +11:00
}
2019-05-19 17:39:30 +10:00
$("#his-tl-contents").html(templete + before);
2018-03-27 13:39:35 +11:00
jQuery("time.timeago").timeago();
});
}
2018-01-28 23:22:43 +11:00
//フォローリスト
function flw(user, more, acct_id) {
if (!acct_id) {
var acct_id = $('#his-data').attr("use-acct");
}
var domain = localStorage.getItem("domain_" + acct_id);
2019-05-19 17:39:30 +10:00
var at = localStorage.getItem("acct_" + acct_id + "_at");
2018-01-28 23:22:43 +11:00
if (user == "--now") {
var user = $('#his-data').attr("user-id");
}
2019-05-19 17:39:30 +10:00
if (localStorage.getItem("mode_" + domain) == "misskey") {
var req = { i: at }
2018-07-30 21:03:49 +10:00
if (more) {
var sid = $("#his-follow-list .cvo").last().attr("user-id");
2019-05-19 17:39:30 +10:00
req.maxId = sid;
2018-07-30 21:03:49 +10:00
}
2019-05-19 17:39:30 +10:00
req.userId = user;
2018-07-30 21:03:49 +10:00
var start = "https://" + domain + "/api/users/following"
2019-05-19 17:39:30 +10:00
var i = {
2018-07-30 21:03:49 +10:00
method: 'POST',
headers: {
'content-type': 'application/json',
},
2019-05-19 17:39:30 +10:00
body: JSON.stringify(req)
2018-07-30 21:03:49 +10:00
}
2019-05-19 17:39:30 +10:00
} else {
2018-07-30 21:03:49 +10:00
if (more) {
var sid = $("#his-follow-list .cvo").last().attr("user-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
}
var start = "https://" + domain + "/api/v1/accounts/" + user + "/following" +
plus
2019-05-19 17:39:30 +10:00
var i = {
2018-07-30 21:03:49 +10:00
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
2018-07-30 21:03:49 +10:00
}
}
2018-01-28 23:22:43 +11:00
}
2019-05-19 17:39:30 +10:00
fetch(start, i).then(function (response) {
2018-01-28 23:22:43 +11:00
return response.json();
2019-05-19 17:39:30 +10:00
}).catch(function (error) {
2018-01-28 23:22:43 +11:00
todo(error);
console.error(error);
2019-05-19 17:39:30 +10:00
}).then(function (json) {
if (localStorage.getItem("mode_" + domain) == "misskey") {
var templete = misskeyUserparse(json, '', acct_id);
} else {
var templete = userparse(json, '', acct_id);
2018-07-30 21:03:49 +10:00
}
2019-05-19 17:39:30 +10:00
if (templete == "") {
templete = lang.lang_details_nodata + "<br>";
2018-03-31 13:39:06 +11:00
}
2018-01-28 23:22:43 +11:00
if (more) {
$("#his-follow-list-contents").append(templete);
} else {
$("#his-follow-list-contents").html(templete);
}
2019-08-31 01:10:24 +10:00
jQuery("time.timeago").timeago();
2018-01-28 23:22:43 +11:00
});
}
//フォロワーリスト
function fer(user, more, acct_id) {
if (!acct_id) {
var acct_id = $('#his-data').attr("use-acct");
}
var domain = localStorage.getItem("domain_" + acct_id);
2019-05-19 17:39:30 +10:00
var at = localStorage.getItem("acct_" + acct_id + "_at");
2018-01-28 23:22:43 +11:00
if (user == "--now") {
var user = $('#his-data').attr("user-id");
}
2019-05-19 17:39:30 +10:00
if (localStorage.getItem("mode_" + domain) == "misskey") {
var req = { i: at }
2018-07-30 21:03:49 +10:00
if (more) {
var sid = $("#his-follower-list .cvo").last().attr("user-id");
2019-05-19 17:39:30 +10:00
req.maxId = sid;
2018-07-30 21:03:49 +10:00
}
2019-05-19 17:39:30 +10:00
req.userId = user;
2018-07-30 21:03:49 +10:00
var start = "https://" + domain + "/api/users/followers"
2019-05-19 17:39:30 +10:00
var i = {
2018-07-30 21:03:49 +10:00
method: 'POST',
headers: {
'content-type': 'application/json',
},
2019-05-19 17:39:30 +10:00
body: JSON.stringify(req)
2018-07-30 21:03:49 +10:00
}
2019-05-19 17:39:30 +10:00
} else {
2018-07-30 21:03:49 +10:00
if (more) {
var sid = $("#his-follower-list .cvo").last().attr("user-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
}
var start = "https://" + domain + "/api/v1/accounts/" + user + "/followers" +
plus
2019-05-19 17:39:30 +10:00
var i = {
2018-07-30 21:03:49 +10:00
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
2018-07-30 21:03:49 +10:00
}
}
2018-01-28 23:22:43 +11:00
}
2019-05-19 17:39:30 +10:00
fetch(start, i).then(function (response) {
2018-01-28 23:22:43 +11:00
return response.json();
2019-05-19 17:39:30 +10:00
}).catch(function (error) {
2018-01-28 23:22:43 +11:00
todo(error);
console.error(error);
2019-05-19 17:39:30 +10:00
}).then(function (json) {
if (localStorage.getItem("mode_" + domain) == "misskey") {
var templete = misskeyUserparse(json, '', acct_id);
} else {
var templete = userparse(json, '', acct_id);
2018-07-30 21:03:49 +10:00
}
2019-05-19 17:39:30 +10:00
if (templete == "") {
templete = lang.lang_details_nodata + "<br>";
2018-03-31 13:39:06 +11:00
}
2018-01-28 23:22:43 +11:00
if (more) {
$("#his-follower-list-contents").append(templete);
} else {
$("#his-follower-list-contents").html(templete);
}
2019-08-31 01:10:24 +10:00
jQuery("time.timeago").timeago();
2018-01-28 23:22:43 +11:00
});
}
//以下自分のみ
//お気に入り一覧
function showFav(more, acct_id) {
if (!acct_id) {
var acct_id = $('#his-data').attr("use-acct");
}
var domain = localStorage.getItem("domain_" + acct_id);
2019-05-19 17:39:30 +10:00
var at = localStorage.getItem("acct_" + acct_id + "_at");
if (localStorage.getItem("mode_" + domain) != "misskey") {
2018-07-30 21:03:49 +10:00
if (more) {
var sid = $("#his-fav-list .cvo").last().attr("toot-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
}
var start = "https://" + domain + "/api/v1/favourites" + plus
2019-05-19 17:39:30 +10:00
var i = {
2018-07-30 21:03:49 +10:00
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
}
}
2019-05-19 17:39:30 +10:00
} else {
var req = { i: at }
2018-07-30 21:03:49 +10:00
if (more) {
var sid = $("#his-fav-list .cvo").last().attr("toot-id");
2019-05-19 17:39:30 +10:00
req.maxId = sid;
2018-07-30 21:03:49 +10:00
}
var start = "https://" + domain + "/api/i/favorites"
2019-05-19 17:39:30 +10:00
var i = {
2018-07-30 21:03:49 +10:00
method: 'POST',
headers: {
'content-type': 'application/json',
},
2019-05-19 17:39:30 +10:00
body: JSON.stringify(req)
}
2018-01-28 23:22:43 +11:00
}
2019-05-19 17:39:30 +10:00
fetch(start, i).then(function (response) {
2018-01-28 23:22:43 +11:00
return response.json();
2019-05-19 17:39:30 +10:00
}).catch(function (error) {
2018-01-28 23:22:43 +11:00
todo(error);
console.error(error);
2019-05-19 17:39:30 +10:00
}).then(function (json) {
if (localStorage.getItem("mode_" + domain) != "misskey") {
var templete = parse(json, '', acct_id, 'user');
} else {
var templete = misskeyParse(json, '', acct_id, 'user');
2018-07-30 21:03:49 +10:00
}
2019-05-19 17:39:30 +10:00
if (!json[0]) {
templete = lang.lang_details_nodata + "<br>";
2018-03-31 13:39:06 +11:00
}
2018-01-28 23:22:43 +11:00
if (more) {
$("#his-fav-list-contents").append(templete);
} else {
$("#his-fav-list-contents").html(templete);
}
jQuery("time.timeago").timeago();
});
}
//ミュートリスト
function showMut(more, acct_id) {
if (!acct_id) {
var acct_id = $('#his-data').attr("use-acct");
}
var domain = localStorage.getItem("domain_" + acct_id);
2019-05-19 17:39:30 +10:00
var at = localStorage.getItem("acct_" + acct_id + "_at");
if (localStorage.getItem("mode_" + domain) == "misskey") {
var req = { i: at }
2018-07-30 21:03:49 +10:00
if (more) {
var sid = $("#his-muting-list .cvo").last().attr("user-id");
2019-05-19 17:39:30 +10:00
req.maxId = sid;
2018-07-30 21:03:49 +10:00
}
var start = "https://" + domain + "/api/mute/list"
2019-05-19 17:39:30 +10:00
var i = {
2018-07-30 21:03:49 +10:00
method: 'POST',
headers: {
'content-type': 'application/json',
},
2019-05-19 17:39:30 +10:00
body: JSON.stringify(req)
2018-07-30 21:03:49 +10:00
}
2019-05-19 17:39:30 +10:00
} else {
2018-07-30 21:03:49 +10:00
if (more) {
var sid = $("#his-muting-list .cvo").last().attr("user-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
}
var start = "https://" + domain + "/api/v1/mutes" + plus
2019-05-19 17:39:30 +10:00
var i = {
2018-07-30 21:03:49 +10:00
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
2018-07-30 21:03:49 +10:00
}
}
2018-01-28 23:22:43 +11:00
}
2019-05-19 17:39:30 +10:00
fetch(start, i).then(function (response) {
2018-01-28 23:22:43 +11:00
return response.json();
2019-05-19 17:39:30 +10:00
}).catch(function (error) {
2018-01-28 23:22:43 +11:00
todo(error);
console.error(error);
2019-05-19 17:39:30 +10:00
}).then(function (json) {
if (!json[0]) {
templete = lang.lang_details_nodata + "<br>";
2018-03-31 13:39:06 +11:00
}
2019-05-19 17:39:30 +10:00
var templete = userparse(json, '', acct_id);
2018-01-28 23:22:43 +11:00
if (more) {
$("#his-muting-list-contents").append(templete);
} else {
$("#his-muting-list-contents").html(templete);
}
});
}
//ブロックリスト
function showBlo(more, acct_id) {
if (!acct_id) {
var acct_id = $('#his-data').attr("use-acct");
}
var domain = localStorage.getItem("domain_" + acct_id);
2019-05-19 17:39:30 +10:00
if (localStorage.getItem("mode_" + domain) == "misskey") {
$("#his-blocking-list-contents").html(lang.lang_hisdata_notonmisskey + "<br>");
2018-07-30 21:03:49 +10:00
return false;
}
2019-05-19 17:39:30 +10:00
var at = localStorage.getItem("acct_" + acct_id + "_at");
2018-01-28 23:22:43 +11:00
if (more) {
var sid = $("#his-blocking-list .cvo").last().attr("user-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
}
var start = "https://" + domain + "/api/v1/blocks" + plus
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
2019-05-19 17:39:30 +10:00
}).then(function (response) {
2018-01-28 23:22:43 +11:00
return response.json();
2019-05-19 17:39:30 +10:00
}).catch(function (error) {
2018-01-28 23:22:43 +11:00
todo(error);
console.error(error);
2019-05-19 17:39:30 +10:00
}).then(function (json) {
if (!json[0]) {
templete = lang.lang_details_nodata + "<br>";
2018-03-31 13:39:06 +11:00
}
2019-05-19 17:39:30 +10:00
var templete = userparse(json, '', acct_id);
2018-01-28 23:22:43 +11:00
if (more) {
$("#his-blocking-list-contents").append(templete);
} else {
$("#his-blocking-list-contents").html(templete);
}
2019-08-31 01:10:24 +10:00
jQuery("time.timeago").timeago();
2018-01-28 23:22:43 +11:00
});
}
//フォロリクリスト
function showReq(more, acct_id) {
2019-05-19 17:39:30 +10:00
2018-01-28 23:22:43 +11:00
if (!acct_id) {
var acct_id = $('#his-data').attr("use-acct");
}
var domain = localStorage.getItem("domain_" + acct_id);
2019-05-19 17:39:30 +10:00
var at = localStorage.getItem("acct_" + acct_id + "_at");
if (localStorage.getItem("mode_" + domain) == "misskey") {
var req = { i: at }
2018-07-30 21:03:49 +10:00
if (more) {
var sid = $("#his-request-list .cvo").last().attr("user-id");
2019-05-19 17:39:30 +10:00
req.maxId = sid;
2018-07-30 21:03:49 +10:00
}
var start = "https://" + domain + "/following/requests/list"
2019-05-19 17:39:30 +10:00
var i = {
2018-07-30 21:03:49 +10:00
method: 'POST',
headers: {
'content-type': 'application/json',
},
2019-05-19 17:39:30 +10:00
body: JSON.stringify(req)
2018-07-30 21:03:49 +10:00
}
2019-05-19 17:39:30 +10:00
} else {
2018-07-30 21:03:49 +10:00
if (more) {
var sid = $("#his-request-list .cvo").last().attr("user-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
}
var start = "https://" + domain + "/api/v1/follow_requests" + plus
2019-05-19 17:39:30 +10:00
var i = {
2018-07-30 21:03:49 +10:00
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
2018-07-30 21:03:49 +10:00
}
}
2018-01-28 23:22:43 +11:00
}
2019-05-19 17:39:30 +10:00
fetch(start, i).then(function (response) {
2018-01-28 23:22:43 +11:00
return response.json();
2019-05-19 17:39:30 +10:00
}).catch(function (error) {
2018-01-28 23:22:43 +11:00
todo(error);
console.error(error);
2019-05-19 17:39:30 +10:00
}).then(function (json) {
if (localStorage.getItem("mode_" + domain) != "misskey") {
var templete = userparse(json, "request", acct_id);
} else {
var templete = misskeyUserparse(json, true, acct_id);
2018-07-30 21:03:49 +10:00
}
2019-05-19 17:39:30 +10:00
if (!json[0]) {
templete = lang.lang_details_nodata + "<br>";
2018-03-31 13:39:06 +11:00
}
2018-01-28 23:22:43 +11:00
if (more) {
$("#his-request-list-contents").append(templete);
} else {
$("#his-request-list-contents").html(templete);
}
2019-08-31 01:10:24 +10:00
jQuery("time.timeago").timeago();
2018-01-28 23:22:43 +11:00
});
}
//ドメインブロックリスト
function showDom(more, acct_id) {
if (!acct_id) {
var acct_id = $('#his-data').attr("use-acct");
}
var domain = localStorage.getItem("domain_" + acct_id);
2019-05-19 17:39:30 +10:00
if (localStorage.getItem("mode_" + domain) == "misskey") {
$("#his-domain-list-contents").html(lang.lang_hisdata_notonmisskey + "<br>");
2018-07-30 21:03:49 +10:00
return false;
}
2019-05-19 17:39:30 +10:00
var at = localStorage.getItem("acct_" + acct_id + "_at");
2018-01-28 23:22:43 +11:00
if (more) {
var sid = $("#his-domain-list .cvo").last().attr("user-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
}
var start = "https://" + domain + "/api/v1/domain_blocks" + plus
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
//body: JSON.stringify({})
2019-05-19 17:39:30 +10:00
}).then(function (response) {
2018-01-28 23:22:43 +11:00
return response.json();
2019-05-19 17:39:30 +10:00
}).catch(function (error) {
2018-01-28 23:22:43 +11:00
todo(error);
console.error(error);
2019-05-19 17:39:30 +10:00
}).then(function (json) {
2018-01-28 23:22:43 +11:00
var templete = "";
2019-05-19 17:39:30 +10:00
if (!json[0]) {
templete = lang.lang_details_nodata + "<br>";
2018-03-31 13:39:06 +11:00
}
2019-05-19 17:39:30 +10:00
Object.keys(json).forEach(function (key) {
2018-01-28 23:22:43 +11:00
var domain = json[key];
templete = templete + domain +
'<i class="material-icons gray pointer" onclick="domainblock(\'' +
domain + '\',\'DELETE\')">cancel</i>' +
'<div class="divider"></div>';
});
if (more) {
$("#his-domain-list-contents").append(templete);
} else {
$("#his-domain-list-contents").html(templete);
}
});
}
2018-07-07 03:51:48 +10:00
//フォローレコメンデーションリスト
function showFrl(more, acct_id) {
if (!acct_id) {
var acct_id = $('#his-data').attr("use-acct");
}
var domain = localStorage.getItem("domain_" + acct_id);
2019-05-19 17:39:30 +10:00
if (localStorage.getItem("mode_" + domain) == "misskey") {
$("#his-follow-recom-contents").html(lang.lang_hisdata_notonmisskey + "<br>");
2018-07-30 21:03:49 +10:00
return false;
}
2019-05-19 17:39:30 +10:00
var at = localStorage.getItem("acct_" + acct_id + "_at");
2018-07-07 03:51:48 +10:00
if (more) {
var sid = $("#his-follow-recom-list .cvo").last().attr("user-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
}
var start = "https://" + domain + "/api/v1/suggestions" + plus
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
2019-05-19 17:39:30 +10:00
}).then(function (response) {
2018-07-07 03:51:48 +10:00
return response.json();
2019-05-19 17:39:30 +10:00
}).catch(function (error) {
$("#his-follow-recom-contents").html(lang.lang_details_nodata + "(" + lang.lang_hisdata_frcreq + ")<br>");
2018-07-07 03:51:48 +10:00
console.error(error);
2019-05-19 17:39:30 +10:00
}).then(function (json) {
if (!json[0]) {
2019-05-19 16:17:05 +10:00
console.warn("No suggestions(recommend) data");
2019-05-19 17:39:30 +10:00
templete = lang.lang_details_nodata + "(" + lang.lang_hisdata_frcwarn + ")<br>";
} else {
var templete = userparse(json, '', acct_id);
2018-07-07 03:51:48 +10:00
}
2019-05-19 17:39:30 +10:00
2018-07-07 03:51:48 +10:00
if (more) {
$("#his-follow-recom-contents").append(templete);
} else {
$("#his-follow-recom-contents").html(templete);
}
2019-08-31 01:10:24 +10:00
jQuery("time.timeago").timeago();
2018-07-07 03:51:48 +10:00
});
}
2019-04-13 13:41:58 +10:00
//Keybase
function udAdd(start) {
fetch(start, {
method: 'GET',
headers: {
'Accept': 'application/json'
},
//body: JSON.stringify({})
2019-05-19 17:39:30 +10:00
}).then(function (response) {
2019-04-13 13:41:58 +10:00
return response.json();
2019-05-19 17:39:30 +10:00
}).catch(function (error) {
2019-04-13 13:41:58 +10:00
todo(error);
console.error(error);
2019-05-19 17:39:30 +10:00
}).then(function (json) {
var fields = json.attachment;
for (var i = 0; i < fields.length; i++) {
if (fields[i].type == "IdentityProof") {
if (fields[i].signatureAlgorithm == "keybase") {
var html = '<a href="https://keybase.io/' + fields[i].name + '" target="_blank" class="cbadge teal waves-effect" style="max-width:200px;" title="' + lang.lang_hisdata_key.replace("{{set}}", escapeHTML(fields[i].signatureAlgorithm)) + '"><i class="fas fa-key" aria-hidden="true"></i>' + escapeHTML(fields[i].signatureAlgorithm) + ':' + escapeHTML(fields[i].name) + '</a>';
} else {
var html = '<span class="cbadge teal" style="max-width:200px;" title="' + lang.lang_hisdata_key.replace("{{set}}", escapeHTML(fields[i].signatureAlgorithm)) + '"><i class="fas fa-key" aria-hidden="true"></i>' + escapeHTML(fields[i].signatureAlgorithm) + ':' + escapeHTML(fields[i].name) + '</span>';
2019-04-13 13:41:58 +10:00
}
$("#his-proof-prof").append(html)
}
}
});
2019-05-19 17:39:30 +10:00
fetch("https://notestock.osa-p.net/api/v1/isstock.json?id=" + start.replace("@", "users/"), {
2019-05-06 02:28:00 +10:00
method: 'GET',
headers: {
'Accept': 'application/json'
},
2019-05-19 17:39:30 +10:00
}).then(function (response) {
2019-05-06 02:28:00 +10:00
return response.json();
2019-05-19 17:39:30 +10:00
}).catch(function (error) {
2019-05-06 02:28:00 +10:00
todo(error);
console.error(error);
2019-05-19 17:39:30 +10:00
}).then(function (json) {
if (json.user.public_view) {
var html = '<a href="' + json.user.url + '" target="_blank" class="cbadge purple waves-effect" style="max-width:200px;" title="Notestock">Notestock</a>';
2019-05-06 02:28:00 +10:00
$("#his-proof-prof").append(html)
}
});
2019-04-13 13:51:54 +10:00
2019-04-13 13:41:58 +10:00
}
2018-07-07 03:51:48 +10:00
2018-06-12 01:44:28 +10:00
//ユーザーマッチングリスト
function showMat() {
2019-05-19 17:39:30 +10:00
2019-01-26 14:24:26 +11:00
$("#his-matching-list-contents").html(lang.lang_hisdata_taketime);
2019-05-19 17:39:30 +10:00
var full = $("#his-acct").attr("fullname");
var acct_id = $("#his-data").attr("use-acct");
full = full.split("@");
var start = "https://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-filtered-api.cgi?" + full[1] + "+" + full[0];
2018-06-12 01:44:28 +10:00
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json'
},
//body: JSON.stringify({})
2019-05-19 17:39:30 +10:00
}).then(function (response) {
2018-06-12 01:44:28 +10:00
return response.json();
2019-05-19 17:39:30 +10:00
}).catch(function (error) {
2018-06-12 01:44:28 +10:00
todo(error);
console.error(error);
2019-05-19 17:39:30 +10:00
}).then(function (json) {
var templete = "";
Object.keys(json).forEach(function (key) {
2018-06-12 01:44:28 +10:00
var user = json[key];
if (user.avatar) {
var avatar = user.avatar
} else {
var avatar = "../../img/loading.svg"
}
2018-06-12 01:44:28 +10:00
templete = templete +
2019-05-19 17:39:30 +10:00
'<div class="" style="padding-top:5px;">' +
'<div style="padding:0; margin:0; width:400px; max-width:100%; display:flex; align-items:flex-end;">' +
'<div style="flex-basis:40px;"><a onclick="udgEx(\'' + user.user + '\',' +
acct_id + ');" user="' + user.user + '" class="udg">' +
'<img src="' + avatar + '" width="40" class="prof-img" user="' + user.user + '"></a></div>' +
2019-05-19 17:39:30 +10:00
'<div style="flex-grow:3; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;user-select:auto; cursor:text;"><big>' +
escapeHTML(user.screen_name) + '</big></div>' +
'<div class="sml gray" style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;user-select:auto; cursor:text;"> @' +
user.user + '@' + user.host + '</div>' +
'</div>' +
'<div class="divider"></div>' +
'</div>' +
'</div>';
2018-06-12 01:44:28 +10:00
});
2019-05-19 17:39:30 +10:00
$("#his-matching-list").css("height", $("#his-float-data").height() - $("#his-basic-prof").height() - $("#his-des").height() - $("#his-plus-action").height() + "px");
2018-06-12 01:44:28 +10:00
$("#his-matching-list-contents").html(templete);
});
}