Fix: follow on cross-acct
This commit is contained in:
parent
9977c009e0
commit
25d24ddef0
|
@ -18,7 +18,9 @@ function fav(id, acct_id, remote) {
|
|||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
if(this.status!==200){ setLog(start, this.status, json); }
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, json);
|
||||
}
|
||||
if (json.reblog) {
|
||||
json = json.reblog;
|
||||
}
|
||||
|
@ -76,7 +78,9 @@ function rt(id, acct_id, remote, vis) {
|
|||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
if(this.status!==200){ setLog(start, this.status, json); }
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, json);
|
||||
}
|
||||
if (json.reblog) {
|
||||
json = json.reblog;
|
||||
}
|
||||
|
@ -113,13 +117,13 @@ function boostWith(vis) {
|
|||
}
|
||||
|
||||
//フォロー
|
||||
function follow(acct_id, remote) {
|
||||
async function follow(acct_id, resolve) {
|
||||
if (!acct_id && acct_id != "selector") {
|
||||
var acct_id = $("#his-data").attr("use-acct");
|
||||
} else if (acct_id == "selector") {
|
||||
var acct_id = $("#user-acct-sel").val();
|
||||
}
|
||||
if (!remote && $("#his-data").hasClass("following")) {
|
||||
if (!resolve && $("#his-data").hasClass("following")) {
|
||||
var flag = "unfollow";
|
||||
var flagm = "delete";
|
||||
} else {
|
||||
|
@ -127,17 +131,18 @@ function follow(acct_id, remote) {
|
|||
var flagm = "create";
|
||||
}
|
||||
var id = $("#his-data").attr("user-id");
|
||||
if (!remote) {
|
||||
var remote = $("#his-data").attr("remote");
|
||||
if (resolve == "selector") {
|
||||
var fullacct = $("#his-acct").attr("fullname");
|
||||
var id = await acctResolve(acct_id, fullacct);
|
||||
console.log(id);
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var user = $("#his-acct").text();
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var start = "https://" + domain + "/api/following/" + flagm;
|
||||
var ent = { i: at, userId: id };
|
||||
} else if (remote == "true" && flag == "follow") {
|
||||
} else if (flag == "follow") {
|
||||
var ent = {};
|
||||
}
|
||||
var httpreq = new XMLHttpRequest();
|
||||
|
@ -149,7 +154,9 @@ function follow(acct_id, remote) {
|
|||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
if(this.status!==200){ setLog(start, this.status, json); }
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, json);
|
||||
}
|
||||
console.log(["Success: folllow", json]);
|
||||
if ($("#his-data").hasClass("following")) {
|
||||
$("#his-data").removeClass("following");
|
||||
|
@ -161,6 +168,29 @@ function follow(acct_id, remote) {
|
|||
}
|
||||
};
|
||||
}
|
||||
async function acctResolve(acct_id, user) {
|
||||
console.log("Get user data of " + user);
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
return false;
|
||||
}
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v2/search?resolve=true&q=" + user;
|
||||
let promise = await fetch(start, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
});
|
||||
var idJson = await promise.json();
|
||||
if (idJson.accounts[0]) {
|
||||
var id = idJson.accounts[0].id;
|
||||
} else {
|
||||
M.toast({ html: lang.lang_fatalerroroccured, displayLength: 2000 });
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
//ブロック
|
||||
function block(acct_id) {
|
||||
|
@ -197,7 +227,9 @@ function block(acct_id) {
|
|||
httpreq.send();
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
if(this.status!==200){ setLog(start, this.status, this.response); }
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response);
|
||||
}
|
||||
if ($("#his-data").hasClass("blocking")) {
|
||||
$("#his-data").removeClass("blocking");
|
||||
$("#his-block-btn-text").text(lang.lang_status_block);
|
||||
|
@ -255,7 +287,9 @@ function muteDo(acct_id) {
|
|||
httpreq.send(rq);
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
if(this.status!==200){ setLog(start, this.status, this.response); }
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response);
|
||||
}
|
||||
if ($("#his-data").hasClass("muting")) {
|
||||
$("#his-data").removeClass("muting");
|
||||
$("#his-mute-btn-text").text(lang.lang_status_mute);
|
||||
|
@ -293,7 +327,9 @@ function del(id, acct_id) {
|
|||
}
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
if(this.status!==200){ setLog(start, this.status, this.response); }
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -325,9 +361,7 @@ function redraft(id, acct_id) {
|
|||
if (i < ct) {
|
||||
var url = $(elem).attr("src");
|
||||
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();
|
||||
|
@ -368,7 +402,9 @@ function pin(id, acct_id) {
|
|||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
if(this.status!==200){ setLog(start, this.status, this.response); }
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response);
|
||||
}
|
||||
console.log(["Success: pinned", json]);
|
||||
if ($("[toot-id=" + id + "]").hasClass("pined")) {
|
||||
$("[toot-id=" + id + "]").removeClass("pined");
|
||||
|
@ -385,8 +421,7 @@ function pin(id, acct_id) {
|
|||
function request(id, flag, acct_id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
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();
|
||||
httpreq.open("POST", start, true);
|
||||
httpreq.setRequestHeader("Content-Type", "application/json");
|
||||
|
@ -396,7 +431,9 @@ function request(id, flag, acct_id) {
|
|||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
if(this.status!==200){ setLog(start, this.status, this.response); }
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response);
|
||||
}
|
||||
console.log(["Success: request", "type:" + flag, json]);
|
||||
showReq();
|
||||
}
|
||||
|
@ -420,7 +457,9 @@ function domainblock(add, flag, acct_id) {
|
|||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
if(this.status!==200){ setLog(start, this.status, this.response); }
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response);
|
||||
}
|
||||
console.log(["Success: domain block", json]);
|
||||
showDom();
|
||||
}
|
||||
|
@ -477,7 +516,9 @@ function pinUser() {
|
|||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
if(this.status!==200){ setLog(start, this.status, this.response); }
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response);
|
||||
}
|
||||
if ($("#his-end-btn").hasClass("endorsed")) {
|
||||
$("#his-end-btn").removeClass("endorsed");
|
||||
$("#his-end-btn").text(lang.lang_status_endorse);
|
||||
|
@ -518,6 +559,7 @@ function staEx(mode) {
|
|||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
})
|
||||
.then(function(json) {
|
||||
|
|
|
@ -2,60 +2,67 @@
|
|||
//タイムライン
|
||||
function utl(user, more, 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 at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (user == "--now") {
|
||||
var user = $('#his-data').attr("user-id");
|
||||
var user = $("#his-data").attr("user-id");
|
||||
}
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
if (more) {
|
||||
var sid = $("#his-tl .cvo").last().attr("toot-id");
|
||||
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;
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + user + "/statuses" + plus;
|
||||
var i = {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
}
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
};
|
||||
} else {
|
||||
var req = { i: at }
|
||||
var req = { i: at };
|
||||
if (more) {
|
||||
var sid = $("#his-tl .cvo").last().attr("toot-id");
|
||||
var sid = $("#his-tl .cvo")
|
||||
.last()
|
||||
.attr("toot-id");
|
||||
req.maxId = sid;
|
||||
}
|
||||
req.userId = user;
|
||||
var start = "https://" + domain + "/api/users/notes"
|
||||
var start = "https://" + domain + "/api/users/notes";
|
||||
var i = {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
"content-type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(req)
|
||||
};
|
||||
}
|
||||
}
|
||||
fetch(start, i).then(function (response) {
|
||||
fetch(start, i)
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
})
|
||||
.then(function(json) {
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var templete = misskeyParse(json, '', acct_id, 'user');
|
||||
var templete = misskeyParse(json, "", acct_id, "user");
|
||||
} else {
|
||||
var templete = parse(json, '', acct_id, 'user');
|
||||
var templete = parse(json, "", acct_id, "user");
|
||||
}
|
||||
if (!json[0]) {
|
||||
templete = lang.lang_details_nodata + "<br>";
|
||||
|
@ -64,7 +71,7 @@ function utl(user, more, acct_id) {
|
|||
$("#his-tl-contents").append(templete);
|
||||
} else {
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
pinutl(templete, user, acct_id)
|
||||
pinutl(templete, user, acct_id);
|
||||
} else {
|
||||
$("#his-tl-contents").html(templete);
|
||||
}
|
||||
|
@ -75,34 +82,37 @@ function utl(user, more, acct_id) {
|
|||
//ピン留めTL
|
||||
function pinutl(before, user, 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 at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (user == "--now") {
|
||||
var user = $('#his-data').attr("user-id");
|
||||
var user = $("#his-data").attr("user-id");
|
||||
}
|
||||
var plus = "?pinned=1";
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + user + "/statuses" +
|
||||
plus
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + user + "/statuses" + plus;
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
var templete = parse(json, 'pinned', acct_id, 'user');
|
||||
})
|
||||
.then(function(json) {
|
||||
var templete = parse(json, "pinned", acct_id, "user");
|
||||
if (!json[0]) {
|
||||
templete = "";
|
||||
}
|
||||
|
@ -114,60 +124,67 @@ function pinutl(before, user, acct_id) {
|
|||
//フォローリスト
|
||||
function flw(user, more, 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 at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (user == "--now") {
|
||||
var user = $('#his-data').attr("user-id");
|
||||
var user = $("#his-data").attr("user-id");
|
||||
}
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var req = { i: at }
|
||||
var req = { i: at };
|
||||
if (more) {
|
||||
var sid = $("#his-follow-list .cvo").last().attr("user-id");
|
||||
var sid = $("#his-follow-list .cvo")
|
||||
.last()
|
||||
.attr("user-id");
|
||||
req.maxId = sid;
|
||||
}
|
||||
req.userId = user;
|
||||
var start = "https://" + domain + "/api/users/following"
|
||||
var start = "https://" + domain + "/api/users/following";
|
||||
var i = {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
"content-type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(req)
|
||||
}
|
||||
};
|
||||
} else {
|
||||
if (more) {
|
||||
var sid = $("#his-follow-list .cvo").last().attr("user-id");
|
||||
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
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + user + "/following" + plus;
|
||||
var i = {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
fetch(start, i).then(function (response) {
|
||||
fetch(start, i)
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
})
|
||||
.then(function(json) {
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var templete = misskeyUserparse(json, '', acct_id);
|
||||
var templete = misskeyUserparse(json, "", acct_id);
|
||||
} else {
|
||||
var templete = userparse(json, '', acct_id);
|
||||
var templete = userparse(json, "", acct_id);
|
||||
}
|
||||
if (templete == "") {
|
||||
templete = lang.lang_details_nodata + "<br>";
|
||||
|
@ -178,67 +195,73 @@ function flw(user, more, acct_id) {
|
|||
$("#his-follow-list-contents").html(templete);
|
||||
}
|
||||
jQuery("time.timeago").timeago();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//フォロワーリスト
|
||||
function fer(user, more, 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 at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (user == "--now") {
|
||||
var user = $('#his-data').attr("user-id");
|
||||
var user = $("#his-data").attr("user-id");
|
||||
}
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var req = { i: at }
|
||||
var req = { i: at };
|
||||
if (more) {
|
||||
var sid = $("#his-follower-list .cvo").last().attr("user-id");
|
||||
var sid = $("#his-follower-list .cvo")
|
||||
.last()
|
||||
.attr("user-id");
|
||||
req.maxId = sid;
|
||||
}
|
||||
req.userId = user;
|
||||
var start = "https://" + domain + "/api/users/followers"
|
||||
var start = "https://" + domain + "/api/users/followers";
|
||||
var i = {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
"content-type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(req)
|
||||
}
|
||||
};
|
||||
} else {
|
||||
if (more) {
|
||||
var sid = $("#his-follower-list .cvo").last().attr("user-id");
|
||||
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
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + user + "/followers" + plus;
|
||||
var i = {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
fetch(start, i).then(function (response) {
|
||||
fetch(start, i)
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
})
|
||||
.then(function(json) {
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var templete = misskeyUserparse(json, '', acct_id);
|
||||
var templete = misskeyUserparse(json, "", acct_id);
|
||||
} else {
|
||||
var templete = userparse(json, '', acct_id);
|
||||
var templete = userparse(json, "", acct_id);
|
||||
}
|
||||
if (templete == "") {
|
||||
templete = lang.lang_details_nodata + "<br>";
|
||||
|
@ -256,56 +279,64 @@ function fer(user, more, acct_id) {
|
|||
//お気に入り一覧
|
||||
function showFav(more, 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 at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
if (more) {
|
||||
var sid = $("#his-fav-list .cvo").last().attr("toot-id");
|
||||
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
|
||||
var start = "https://" + domain + "/api/v1/favourites" + plus;
|
||||
var i = {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
}
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
};
|
||||
} else {
|
||||
var req = { i: at }
|
||||
var req = { i: at };
|
||||
if (more) {
|
||||
var sid = $("#his-fav-list .cvo").last().attr("toot-id");
|
||||
var sid = $("#his-fav-list .cvo")
|
||||
.last()
|
||||
.attr("toot-id");
|
||||
req.maxId = sid;
|
||||
}
|
||||
var start = "https://" + domain + "/api/i/favorites"
|
||||
var start = "https://" + domain + "/api/i/favorites";
|
||||
var i = {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
"content-type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(req)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fetch(start, i).then(function (response) {
|
||||
fetch(start, i)
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
})
|
||||
.then(function(json) {
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
var templete = parse(json, '', acct_id, 'user');
|
||||
var templete = parse(json, "", acct_id, "user");
|
||||
} else {
|
||||
var templete = misskeyParse(json, '', acct_id, 'user');
|
||||
var templete = misskeyParse(json, "", acct_id, "user");
|
||||
}
|
||||
if (!json[0]) {
|
||||
templete = lang.lang_details_nodata + "<br>";
|
||||
|
@ -322,69 +353,76 @@ function showFav(more, acct_id) {
|
|||
//ミュートリスト
|
||||
function showMut(more, 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 at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var req = { i: at }
|
||||
var req = { i: at };
|
||||
if (more) {
|
||||
var sid = $("#his-muting-list .cvo").last().attr("user-id");
|
||||
var sid = $("#his-muting-list .cvo")
|
||||
.last()
|
||||
.attr("user-id");
|
||||
req.maxId = sid;
|
||||
}
|
||||
var start = "https://" + domain + "/api/mute/list"
|
||||
var start = "https://" + domain + "/api/mute/list";
|
||||
var i = {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
"content-type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(req)
|
||||
}
|
||||
};
|
||||
} else {
|
||||
if (more) {
|
||||
var sid = $("#his-muting-list .cvo").last().attr("user-id");
|
||||
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
|
||||
var start = "https://" + domain + "/api/v1/mutes" + plus;
|
||||
var i = {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
}
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fetch(start, i).then(function (response) {
|
||||
fetch(start, i)
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
})
|
||||
.then(function(json) {
|
||||
if (!json[0]) {
|
||||
templete = lang.lang_details_nodata + "<br>";
|
||||
}
|
||||
var templete = userparse(json, '', acct_id);
|
||||
var templete = userparse(json, "", acct_id);
|
||||
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 acct_id = $("#his-data").attr("use-acct");
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
|
@ -393,33 +431,39 @@ function showBlo(more, acct_id) {
|
|||
}
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (more) {
|
||||
var sid = $("#his-blocking-list .cvo").last().attr("user-id");
|
||||
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
|
||||
var start = "https://" + domain + "/api/v1/blocks" + plus;
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
})
|
||||
.then(function(json) {
|
||||
if (!json[0]) {
|
||||
templete = lang.lang_details_nodata + "<br>";
|
||||
}
|
||||
var templete = userparse(json, '', acct_id);
|
||||
var templete = userparse(json, "", acct_id);
|
||||
if (more) {
|
||||
$("#his-blocking-list-contents").append(templete);
|
||||
} else {
|
||||
|
@ -431,54 +475,60 @@ function showBlo(more, acct_id) {
|
|||
|
||||
//フォロリクリスト
|
||||
function showReq(more, 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 at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var req = { i: at }
|
||||
var req = { i: at };
|
||||
if (more) {
|
||||
var sid = $("#his-request-list .cvo").last().attr("user-id");
|
||||
var sid = $("#his-request-list .cvo")
|
||||
.last()
|
||||
.attr("user-id");
|
||||
req.maxId = sid;
|
||||
}
|
||||
var start = "https://" + domain + "/following/requests/list"
|
||||
var start = "https://" + domain + "/following/requests/list";
|
||||
var i = {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
"content-type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(req)
|
||||
}
|
||||
};
|
||||
} else {
|
||||
if (more) {
|
||||
var sid = $("#his-request-list .cvo").last().attr("user-id");
|
||||
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
|
||||
var start = "https://" + domain + "/api/v1/follow_requests" + plus;
|
||||
var i = {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
fetch(start, i).then(function (response) {
|
||||
fetch(start, i)
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
|
||||
})
|
||||
.then(function(json) {
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
var templete = userparse(json, "request", acct_id);
|
||||
} else {
|
||||
|
@ -500,7 +550,7 @@ function showReq(more, acct_id) {
|
|||
//ドメインブロックリスト
|
||||
function showDom(more, 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);
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
|
@ -509,54 +559,56 @@ function showDom(more, acct_id) {
|
|||
}
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (more) {
|
||||
var sid = $("#his-domain-list .cvo").last().attr("user-id");
|
||||
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
|
||||
var start = "https://" + domain + "/api/v1/domain_blocks" + plus;
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
//body: JSON.stringify({})
|
||||
}).then(function (response) {
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
})
|
||||
.then(function(json) {
|
||||
var templete = "";
|
||||
if (!json[0]) {
|
||||
templete = lang.lang_details_nodata + "<br>";
|
||||
}
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var domain = json[key];
|
||||
templete = templete + domain +
|
||||
'<i class="material-icons gray pointer" onclick="domainblock(\'' +
|
||||
domain + '\',\'DELETE\')">cancel</i>' +
|
||||
'<div class="divider"></div>';
|
||||
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);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//フォローレコメンデーションリスト
|
||||
function showFrl(more, 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);
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
|
@ -565,34 +617,39 @@ function showFrl(more, acct_id) {
|
|||
}
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (more) {
|
||||
var sid = $("#his-follow-recom-list .cvo").last().attr("user-id");
|
||||
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
|
||||
var start = "https://" + domain + "/api/v1/suggestions" + plus;
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
$("#his-follow-recom-contents").html(lang.lang_details_nodata + "(" + lang.lang_hisdata_frcreq + ")<br>");
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
})
|
||||
.then(function(json) {
|
||||
if (!json[0]) {
|
||||
console.warn("No suggestions(recommend) data");
|
||||
templete = lang.lang_details_nodata + "(" + lang.lang_hisdata_frcwarn + ")<br>";
|
||||
} else {
|
||||
var templete = userparse(json, '', acct_id);
|
||||
var templete = userparse(json, "", acct_id);
|
||||
}
|
||||
|
||||
if (more) {
|
||||
|
@ -607,103 +664,99 @@ function showFrl(more, acct_id) {
|
|||
function udAdd(acct_id, id, start) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var proof = "https://" + domain + "/api/v1/accounts/" + id + "/identity_proofs"
|
||||
var proof = "https://" + domain + "/api/v1/accounts/" + id + "/identity_proofs";
|
||||
fetch(proof, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
//body: JSON.stringify({})
|
||||
}).then(function (response) {
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
})
|
||||
.then(function(json) {
|
||||
var fields = json;
|
||||
for (var i = 0; i < fields.length; i++) {
|
||||
var html = '<a href="' + fields[i].proof_url + '" target="_blank" class="cbadge teal waves-effect" style="max-width:200px;" title="' + lang.lang_hisdata_key.replace("{{set}}", escapeHTML(fields[i].provider)) + '"><i class="fas fa-key" aria-hidden="true"></i>' + escapeHTML(fields[i].provider) + ':' + escapeHTML(fields[i].provider_username) + '</a>';
|
||||
$("#his-proof-prof").append(html)
|
||||
var html = '<a href="' + fields[i].proof_url + '" target="_blank" class="cbadge teal waves-effect" style="max-width:200px;" title="' + lang.lang_hisdata_key.replace("{{set}}", escapeHTML(fields[i].provider)) + '"><i class="fas fa-key" aria-hidden="true"></i>' + escapeHTML(fields[i].provider) + ":" + escapeHTML(fields[i].provider_username) + "</a>";
|
||||
$("#his-proof-prof").append(html);
|
||||
}
|
||||
});
|
||||
fetch("https://notestock.osa-p.net/api/v1/isstock.json?id=" + start.replace("@", "users/"), {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Accept': 'application/json'
|
||||
},
|
||||
}).then(function (response) {
|
||||
Accept: "application/json"
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
})
|
||||
.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>';
|
||||
$("#his-proof-prof").append(html)
|
||||
$("#his-proof-prof").append(html);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
//ユーザーマッチングリスト
|
||||
function showMat() {
|
||||
|
||||
$("#his-matching-list-contents").html(lang.lang_hisdata_taketime);
|
||||
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];
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
"content-type": "application/json"
|
||||
}
|
||||
//body: JSON.stringify({})
|
||||
}).then(function (response) {
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
})
|
||||
.then(function(json) {
|
||||
var templete = "";
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var user = json[key];
|
||||
if (user.avatar) {
|
||||
var avatar = user.avatar
|
||||
var avatar = user.avatar;
|
||||
} else {
|
||||
var avatar = "../../img/loading.svg"
|
||||
var avatar = "../../img/loading.svg";
|
||||
}
|
||||
templete = templete +
|
||||
'<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>' +
|
||||
'<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>';
|
||||
templete = templete + '<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>' + '<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>";
|
||||
});
|
||||
$("#his-matching-list").css("height", $("#his-float-data").height() - $("#his-basic-prof").height() - $("#his-des").height() - $("#his-plus-action").height() + "px");
|
||||
$("#his-matching-list-contents").html(templete);
|
||||
|
|
|
@ -6,12 +6,12 @@ if (location.search) {
|
|||
var mode = m[1];
|
||||
var codex = m[2];
|
||||
if (mode == "user") {
|
||||
udgEx(codex, 'main');
|
||||
udgEx(codex, "main");
|
||||
}
|
||||
}
|
||||
function udgEx(user, acct_id) {
|
||||
if (user == "selector") {
|
||||
user = $("#his-acct").attr('fullname');
|
||||
user = $("#his-acct").attr("fullname");
|
||||
}
|
||||
if (acct_id == "selector") {
|
||||
acct_id = $("#user-acct-sel").val();
|
||||
|
@ -21,31 +21,37 @@ function udgEx(user, acct_id) {
|
|||
}
|
||||
console.log("Get user data of " + user);
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") { return false; }
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v2/search?resolve=true&q=" + user
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
return false;
|
||||
}
|
||||
}).then(function (response) {
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v2/search?resolve=true&q=" + user;
|
||||
fetch(start, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json.accounts[0]) {
|
||||
var id = json.accounts[0].id;
|
||||
udg(id, acct_id);
|
||||
} else {
|
||||
postMessage(["openUrl", user], "*")
|
||||
postMessage(["openUrl", user], "*");
|
||||
}
|
||||
});
|
||||
return true;
|
||||
|
@ -58,56 +64,60 @@ function udg(user, acct_id) {
|
|||
todo("User Data Loading...");
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
misskeyUdg(user, acct_id)
|
||||
misskeyUdg(user, acct_id);
|
||||
return;
|
||||
}
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + user;
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
})
|
||||
.then(function(json) {
|
||||
//一つ前のユーザーデータ
|
||||
if (!localStorage.getItem("history")) {
|
||||
$("#his-history-btn").prop("disabled", true);
|
||||
} else {
|
||||
$("#his-history-btn").prop("disabled", false);
|
||||
$('#his-data').attr("history", localStorage.getItem("history"));
|
||||
$("#his-data").attr("history", localStorage.getItem("history"));
|
||||
}
|
||||
//moved設定時
|
||||
if (json.moved) {
|
||||
M.toast({
|
||||
html: lang.lang_showontl_movetxt + '<button class="btn-flat toast-action" onclick="udg(\'' +
|
||||
json.moved.id + '\',\'' + acct_id + '\')">' + lang.lang_showontl_movebtn + '</button>', displayLength: 4000
|
||||
})
|
||||
html: lang.lang_showontl_movetxt + '<button class="btn-flat toast-action" onclick="udg(\'' + json.moved.id + "','" + acct_id + "')\">" + lang.lang_showontl_movebtn + "</button>",
|
||||
displayLength: 4000
|
||||
});
|
||||
}
|
||||
$('#his-data').modal('open');
|
||||
$('#his-data').attr("user-id", user);
|
||||
$('#his-data').attr("use-acct", acct_id);
|
||||
$("#his-data").modal("open");
|
||||
$("#his-data").attr("user-id", user);
|
||||
$("#his-data").attr("use-acct", acct_id);
|
||||
if (json.username != json.acct) {
|
||||
//Remote
|
||||
$('#his-data').attr("remote", "true");
|
||||
$("#his-data").attr("remote", "true");
|
||||
var fullname = json.acct;
|
||||
} else {
|
||||
$('#his-data').attr("remote", "false");
|
||||
$("#his-data").attr("remote", "false");
|
||||
var fullname = json.acct + "@" + domain;
|
||||
}
|
||||
utl(json.id, '', acct_id);
|
||||
flw(json.id, '', acct_id);
|
||||
fer(json.id, '', acct_id);
|
||||
utl(json.id, "", acct_id);
|
||||
flw(json.id, "", acct_id);
|
||||
fer(json.id, "", acct_id);
|
||||
var dis_name = escapeHTML(json.display_name);
|
||||
dis_name = twemoji.parse(dis_name);
|
||||
|
||||
|
@ -122,8 +132,7 @@ function udg(user, acct_id) {
|
|||
Object.keys(json.emojis).forEach(function(key5) {
|
||||
var emoji = json.emojis[key5];
|
||||
var shortcode = emoji.shortcode;
|
||||
var emoji_url = '<img src="' + emoji.url +
|
||||
'" class="emoji-img" data-emoji="' + shortcode + '" draggable="false">';
|
||||
var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" draggable="false">';
|
||||
var regExp = new RegExp(":" + shortcode + ":", "g");
|
||||
dis_name = dis_name.replace(regExp, emoji_url);
|
||||
note = note.replace(regExp, emoji_url);
|
||||
|
@ -138,7 +147,7 @@ function udg(user, acct_id) {
|
|||
$("#his-acct").text(json.acct);
|
||||
$("#his-acct").attr("fullname", fullname);
|
||||
$("#his-prof").attr("src", json.avatar);
|
||||
$('#his-data').css('background-image', 'url(' + json.header + ')');
|
||||
$("#his-data").css("background-image", "url(" + json.header + ")");
|
||||
$("#his-sta").text(json.statuses_count);
|
||||
$("#his-follow").text(json.following_count);
|
||||
var flerc = json.followers_count;
|
||||
|
@ -149,23 +158,23 @@ function udg(user, acct_id) {
|
|||
$("#his-since").text(crat(json.created_at));
|
||||
$("#his-openin").attr("data-href", json.url);
|
||||
if (json.fields) {
|
||||
var table =""
|
||||
var table = "";
|
||||
if (json.fields.length > 0) {
|
||||
$("#his-des").css("max-height", "250px");
|
||||
table = '<table id="his-field">'
|
||||
table = '<table id="his-field">';
|
||||
for (var i = 0; i < json.fields.length; i++) {
|
||||
var fname = json.fields[i].name;
|
||||
var fval = json.fields[i].value;
|
||||
if (json.fields[i].verified_at) {
|
||||
var when = lang.lang_showontl_verified + ":" + crat(json.fields[i].verified_at);
|
||||
var color = "rgba(121,189,154,.25);"
|
||||
var color = "rgba(121,189,154,.25);";
|
||||
} else {
|
||||
var when = "";
|
||||
var color = "inherit"
|
||||
var color = "inherit";
|
||||
}
|
||||
table = table + '<tr><td class="his-field-title">' + escapeHTML(fname) + '</td><td class="his-field-content" title="' + when + '" style="background-color:' + color + '">' + fval + '</td></tr>';
|
||||
table = table + '<tr><td class="his-field-title">' + escapeHTML(fname) + '</td><td class="his-field-content" title="' + when + '" style="background-color:' + color + '">' + fval + "</td></tr>";
|
||||
}
|
||||
table = table + '</table>'
|
||||
table = table + "</table>";
|
||||
$("#his-des").html(twemoji.parse(note));
|
||||
} else {
|
||||
$("#his-des").css("max-height", "400px");
|
||||
|
@ -179,26 +188,38 @@ function udg(user, acct_id) {
|
|||
$("#his-bot").html(lang.lang_showontl_botacct);
|
||||
}
|
||||
$("#his-des").attr("data-acct", acct_id);
|
||||
$('#his-data').css('background-size', 'cover');
|
||||
$("#his-float-timeline").css("height", $("#his-data-show").height() + "px")
|
||||
$("#his-data").css("background-size", "cover");
|
||||
$("#his-float-timeline").css("height", $("#his-data-show").height() + "px");
|
||||
localStorage.setItem("history", user);
|
||||
//自分の時
|
||||
if (json.acct == localStorage.getItem("user_" + acct_id)) {
|
||||
showFav('', acct_id);
|
||||
showBlo('', acct_id);
|
||||
showMut('', acct_id);
|
||||
showDom('', acct_id);
|
||||
showReq('', acct_id);
|
||||
showFrl('', acct_id);
|
||||
showFav("", acct_id);
|
||||
showBlo("", acct_id);
|
||||
showMut("", acct_id);
|
||||
showDom("", acct_id);
|
||||
showReq("", acct_id);
|
||||
showFrl("", acct_id);
|
||||
$("#his-name-val").val(json.display_name);
|
||||
if (json.fields.length > 0) {
|
||||
if (json.fields[0]) { $("#his-f1-name").val(json.fields[0].name); $("#his-f1-val").val($.strip_tags(json.fields[0].value)); }
|
||||
if (json.fields[1]) { $("#his-f2-name").val(json.fields[1].name); $("#his-f2-val").val($.strip_tags(json.fields[1].value)); }
|
||||
if (json.fields[2]) { $("#his-f3-name").val(json.fields[2].name); $("#his-f3-val").val($.strip_tags(json.fields[2].value)); }
|
||||
if (json.fields[3]) { $("#his-f4-name").val(json.fields[3].name); $("#his-f4-val").val($.strip_tags(json.fields[3].value)); }
|
||||
if (json.fields[0]) {
|
||||
$("#his-f1-name").val(json.fields[0].name);
|
||||
$("#his-f1-val").val($.strip_tags(json.fields[0].value));
|
||||
}
|
||||
if (json.fields[1]) {
|
||||
$("#his-f2-name").val(json.fields[1].name);
|
||||
$("#his-f2-val").val($.strip_tags(json.fields[1].value));
|
||||
}
|
||||
if (json.fields[2]) {
|
||||
$("#his-f3-name").val(json.fields[2].name);
|
||||
$("#his-f3-val").val($.strip_tags(json.fields[2].value));
|
||||
}
|
||||
if (json.fields[3]) {
|
||||
$("#his-f4-name").val(json.fields[3].name);
|
||||
$("#his-f4-val").val($.strip_tags(json.fields[3].value));
|
||||
}
|
||||
}
|
||||
var des = json.note;
|
||||
des = des.replace(/<br \/>/g, "\n")
|
||||
des = des.replace(/<br \/>/g, "\n");
|
||||
des = $.strip_tags(des);
|
||||
$("#his-des-val").val(des);
|
||||
$("#his-follow-btn").hide();
|
||||
|
@ -230,63 +251,67 @@ function misskeyUdg(user, acct_id) {
|
|||
todo("User Data Loading...");
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
udg(user, acct_id)
|
||||
udg(user, acct_id);
|
||||
return;
|
||||
}
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/users/show";
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
"content-type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
i: at,
|
||||
userId: user
|
||||
})
|
||||
}).then(function (response) {
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
})
|
||||
.then(function(json) {
|
||||
//一つ前のユーザーデータ
|
||||
if (!localStorage.getItem("history")) {
|
||||
$("#his-history-btn").prop("disabled", true);
|
||||
} else {
|
||||
$("#his-history-btn").prop("disabled", false);
|
||||
$('#his-data').attr("history", localStorage.getItem("history"));
|
||||
$("#his-data").attr("history", localStorage.getItem("history"));
|
||||
}
|
||||
$('#his-data').modal('open');
|
||||
$('#his-data').attr("user-id", user);
|
||||
$('#his-data').attr("use-acct", acct_id);
|
||||
$("#his-data").modal("open");
|
||||
$("#his-data").attr("user-id", user);
|
||||
$("#his-data").attr("use-acct", acct_id);
|
||||
if (json.host) {
|
||||
//Remote
|
||||
$('#his-data').attr("remote", "false");
|
||||
$("#his-data").attr("remote", "false");
|
||||
var fullname = json.username + "@" + json.host;
|
||||
} else {
|
||||
$('#his-data').attr("remote", "false");
|
||||
$("#his-data").attr("remote", "false");
|
||||
var fullname = json.acct + "@" + domain;
|
||||
}
|
||||
utl(json.id, '', acct_id);
|
||||
flw(json.id, '', acct_id);
|
||||
fer(json.id, '', acct_id);
|
||||
utl(json.id, "", acct_id);
|
||||
flw(json.id, "", acct_id);
|
||||
fer(json.id, "", acct_id);
|
||||
if (json.name) {
|
||||
var dis_name = escapeHTML(json.name);
|
||||
dis_name = twemoji.parse(dis_name);
|
||||
} else {
|
||||
var dis_name = json.name
|
||||
var dis_name = json.name;
|
||||
}
|
||||
$("#his-name").html(dis_name);
|
||||
$("#his-acct").text(json.username);
|
||||
$("#his-acct").attr("fullname", fullname);
|
||||
$("#his-prof").attr("src", json.avatarUrl);
|
||||
$('#his-data').css('background-image', 'url(' + json.bannerUrl + ')');
|
||||
$("#his-data").css("background-image", "url(" + json.bannerUrl + ")");
|
||||
$("#his-sta").text(json.notesCount);
|
||||
$("#his-follow").text(json.followingCount);
|
||||
$("#his-follower").text(json.followersCount);
|
||||
|
@ -296,17 +321,17 @@ function misskeyUdg(user, acct_id) {
|
|||
if (json.isCat) {
|
||||
$("#his-bot").html("Cat" + twemoji.parse("😺"));
|
||||
}
|
||||
$('#his-data').css('background-size', 'cover');
|
||||
$("#his-data").css("background-size", "cover");
|
||||
localStorage.setItem("history", user);
|
||||
//自分の時
|
||||
if (json.username == localStorage.getItem("user_" + acct_id) && !json.host) {
|
||||
//showFav('', acct_id);
|
||||
//showMut('', acct_id);
|
||||
//showReq('', acct_id);
|
||||
showFrl('', acct_id);
|
||||
showFrl("", acct_id);
|
||||
$("#his-name-val").val(json.name);
|
||||
var des = json.note;
|
||||
des = nl2br(des)
|
||||
des = nl2br(des);
|
||||
des = $.strip_tags(des);
|
||||
$("#his-des-val").val(des);
|
||||
$("#his-follow-btn").hide();
|
||||
|
@ -348,15 +373,15 @@ function misskeyUdg(user, acct_id) {
|
|||
}
|
||||
//一つ前のユーザーデータ表示
|
||||
function historyShow() {
|
||||
var acct_id = $('#his-data').attr("use-acct");
|
||||
var user = $('#his-data').attr("history");
|
||||
udg(user, acct_id, "true")
|
||||
var acct_id = $("#his-data").attr("use-acct");
|
||||
var user = $("#his-data").attr("history");
|
||||
udg(user, acct_id, "true");
|
||||
}
|
||||
//選択アカウントのプロフ
|
||||
function profShow() {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var user = localStorage.getItem("user-id_" + acct_id);
|
||||
udg(user, acct_id)
|
||||
udg(user, acct_id);
|
||||
hide();
|
||||
}
|
||||
|
||||
|
@ -366,22 +391,26 @@ function relations(user, acct_id) {
|
|||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/accounts/relationships?id=" + user;
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
})
|
||||
.then(function(json) {
|
||||
var json = json[0];
|
||||
if (json.following) {
|
||||
//自分がフォローしている
|
||||
|
@ -422,53 +451,52 @@ function relations(user, acct_id) {
|
|||
//Endorsed
|
||||
if (json.endorsed) {
|
||||
$("#his-end-btn").addClass("endorsed");
|
||||
$("#his-end-btn-text").text(lang.lang_status_unendorse)
|
||||
$("#his-end-btn-text").text(lang.lang_status_unendorse);
|
||||
} else {
|
||||
$("#his-end-btn").removeClass("endorsed");
|
||||
$("#his-end-btn-text").text(lang.lang_status_endorse)
|
||||
$("#his-end-btn-text").text(lang.lang_status_endorse);
|
||||
}
|
||||
//Blocked
|
||||
if (json.blocked_by) {
|
||||
$("#my-data-nav .btn").addClass("disabled")
|
||||
$("#my-data-nav .btn").addClass("disabled");
|
||||
$(".his-var-content").hide();
|
||||
$("#his-float-blocked").show()
|
||||
$("#his-follow-btn").hide()
|
||||
$("#his-float-blocked").show();
|
||||
$("#his-follow-btn").hide();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
function profbrws() {
|
||||
var url = $("#his-openin").attr("data-href")
|
||||
postMessage(["openUrl", url], "*")
|
||||
var url = $("#his-openin").attr("data-href");
|
||||
postMessage(["openUrl", url], "*");
|
||||
}
|
||||
function setMain() {
|
||||
var acct_id = $("#his-data").attr("use-acct")
|
||||
var acct_id = $("#his-data").attr("use-acct");
|
||||
localStorage.setItem("main", acct_id);
|
||||
multiSelector(true)
|
||||
M.toast({ html: lang.lang_manager_mainAcct, displayLength: 3000 })
|
||||
multiSelector(true);
|
||||
M.toast({ html: lang.lang_manager_mainAcct, displayLength: 3000 });
|
||||
}
|
||||
//オールリセット
|
||||
function hisclose() {
|
||||
$('#his-data').modal('close');
|
||||
$("#his-data").modal("close");
|
||||
reset();
|
||||
$('#his-data').attr("history", "");
|
||||
$("#his-data").attr("history", "");
|
||||
localStorage.removeItem("history");
|
||||
}
|
||||
function reset() {
|
||||
$(".his-var-content:eq(0)").show();
|
||||
$(".his-var-content:gt(0)").hide();
|
||||
$("#my-data-nav .btn").removeClass("disabled")
|
||||
$("#my-data-nav .btn").removeClass("disabled");
|
||||
$(".active-back").removeClass("active-back");
|
||||
$(".column-first").addClass("active-back");
|
||||
$("#his-name").text("Loading");
|
||||
$("#his-acct").text("");
|
||||
$("#his-prof").attr("src", "../../img/loading.svg");
|
||||
$('#his-data').css('background-image', 'url(../../img/loading.svg)');
|
||||
$("#his-data").css("background-image", "url(../../img/loading.svg)");
|
||||
$("#his-sta").text("");
|
||||
$("#his-follow").text("");
|
||||
$("#his-follower").text("");
|
||||
$("#his-des").html("");
|
||||
$('#his-data').css('background-size', 'cover');
|
||||
$("#his-data").css("background-size", "cover");
|
||||
$("#his-since").text("");
|
||||
$("#his-data").removeClass("following");
|
||||
$("#his-data").removeClass("muting");
|
||||
|
@ -493,21 +521,25 @@ function reset() {
|
|||
$(".cont-series").html("");
|
||||
$("#domainblock").val("");
|
||||
$("#his-lists-a").html(lang.lang_showontl_listwarn);
|
||||
$("#his-lists-b").html('');
|
||||
$("#his-lists-b").html("");
|
||||
$("#his-name-val").val("");
|
||||
$("#his-des-val").val("");
|
||||
$("#his-f1-name").val(""); $("#his-f1-val").val("");
|
||||
$("#his-f2-name").val(""); $("#his-f2-val").val("");
|
||||
$("#his-f3-name").val(""); $("#his-f3-val").val("");
|
||||
$("#his-f4-name").val(""); $("#his-f4-val").val("");
|
||||
$("#his-f1-name").val("");
|
||||
$("#his-f1-val").val("");
|
||||
$("#his-f2-name").val("");
|
||||
$("#his-f2-val").val("");
|
||||
$("#his-f3-name").val("");
|
||||
$("#his-f3-val").val("");
|
||||
$("#his-f4-name").val("");
|
||||
$("#his-f4-val").val("");
|
||||
$("#his-endorse").html("");
|
||||
$("#his-openin").attr("data-href", "");
|
||||
$("#his-float-timeline").show();
|
||||
$("#his-float-blocked").hide();
|
||||
$("#his-main-acct").show();
|
||||
$("#his-proof-prof").html("")
|
||||
$("#his-proof-prof").html("");
|
||||
}
|
||||
$('#my-data-nav .anc-link').on('click', function () {
|
||||
$("#my-data-nav .anc-link").on("click", function() {
|
||||
var target = $(this).attr("go");
|
||||
if (target) {
|
||||
$("#my-data-nav .anc-link").removeClass("active-back");
|
||||
|
@ -515,5 +547,4 @@ $('#my-data-nav .anc-link').on('click', function () {
|
|||
$(target).show();
|
||||
$(".his-var-content:not(" + target + ")").hide();
|
||||
}
|
||||
|
||||
});
|
|
@ -593,7 +593,7 @@
|
|||
@@useOtherAcct1@@@@revoverJP@@@@follow@@(@@warnUseOtherAcct@@)<br>
|
||||
<div style="max-width:500px;"><select id="user-acct-sel" class="acct-sel"></select></div>
|
||||
@@revoverJPde@@
|
||||
<a href="#!" class="waves-effect btn" onclick="follow('selector','true')">@@follow@@</a><br>
|
||||
<a href="#!" class="waves-effect btn" onclick="follow('selector','selector')">@@follow@@</a><br>
|
||||
@@or@@<br>
|
||||
<a href="#!" class="waves-effect btn"
|
||||
onclick="udgEx('selector', 'selector')">@@openProf@@</a><br>
|
||||
|
|
Loading…
Reference in New Issue
Block a user