2018-01-28 23:22:43 +11:00
|
|
|
//ユーザーデータ表示
|
2020-08-02 17:08:07 +10:00
|
|
|
localStorage.removeItem("history")
|
2018-02-18 16:43:11 +11:00
|
|
|
//コード受信
|
2019-05-19 17:39:30 +10:00
|
|
|
if (location.search) {
|
2020-08-02 17:08:07 +10:00
|
|
|
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/)
|
|
|
|
var mode = m[1]
|
|
|
|
var codex = m[2]
|
2019-05-19 17:39:30 +10:00
|
|
|
if (mode == "user") {
|
2020-08-02 17:08:07 +10:00
|
|
|
udgEx(codex, "main")
|
2018-02-18 16:43:11 +11:00
|
|
|
}
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function udgEx(user, acct_id) {
|
|
|
|
if (user == "selector") {
|
2020-08-02 17:08:07 +10:00
|
|
|
user = $("#his-acct").attr("fullname")
|
2018-03-31 13:39:06 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
if (acct_id == "selector") {
|
2020-08-02 17:08:07 +10:00
|
|
|
acct_id = $("#user-acct-sel").val()
|
2018-03-31 13:39:06 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
if (acct_id == "main") {
|
2020-08-02 17:08:07 +10:00
|
|
|
acct_id = localStorage.getItem("main")
|
2018-05-20 16:17:10 +10:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
console.log("Get user data of " + user)
|
|
|
|
var domain = localStorage.getItem("domain_" + acct_id)
|
2019-11-04 03:09:02 +11:00
|
|
|
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
2020-08-02 17:08:07 +10:00
|
|
|
return false
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
var at = localStorage.getItem("acct_" + acct_id + "_at")
|
|
|
|
var start = "https://" + domain + "/api/v2/search?resolve=true&q=" + encodeURIComponent(user)
|
2018-03-21 16:36:02 +11:00
|
|
|
fetch(start, {
|
2019-11-04 03:09:02 +11:00
|
|
|
method: "GET",
|
2018-03-21 16:36:02 +11:00
|
|
|
headers: {
|
2019-11-04 03:09:02 +11:00
|
|
|
"content-type": "application/json",
|
|
|
|
Authorization: "Bearer " + at
|
2018-09-06 02:47:27 +10:00
|
|
|
}
|
2019-11-04 03:09:02 +11:00
|
|
|
})
|
2021-04-18 05:28:10 +10:00
|
|
|
.then(function (response) {
|
2019-11-04 03:09:02 +11:00
|
|
|
if (!response.ok) {
|
2021-04-18 05:28:10 +10:00
|
|
|
response.text().then(function (text) {
|
2020-08-02 17:08:07 +10:00
|
|
|
setLog(response.url, response.status, text)
|
|
|
|
})
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
return response.json()
|
2019-11-04 03:09:02 +11:00
|
|
|
})
|
2021-04-18 05:28:10 +10:00
|
|
|
.catch(function (error) {
|
2020-08-02 17:08:07 +10:00
|
|
|
todo(error)
|
|
|
|
setLog(start, "JSON", error)
|
|
|
|
console.error(error)
|
2019-11-04 03:09:02 +11:00
|
|
|
})
|
2021-04-18 05:28:10 +10:00
|
|
|
.then(function (json) {
|
2019-11-04 03:09:02 +11:00
|
|
|
if (json.accounts[0]) {
|
2020-08-02 17:08:07 +10:00
|
|
|
var id = json.accounts[0].id
|
|
|
|
udg(id, acct_id)
|
2019-11-04 03:09:02 +11:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
postMessage(["openUrl", user], "*")
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
})
|
|
|
|
return true
|
2018-03-21 16:36:02 +11:00
|
|
|
}
|
2018-01-28 23:22:43 +11:00
|
|
|
function udg(user, acct_id) {
|
2020-08-02 17:08:07 +10:00
|
|
|
reset()
|
2018-01-28 23:22:43 +11:00
|
|
|
if (!user) {
|
2020-08-02 17:08:07 +10:00
|
|
|
user = localStorage.getItem("user-id_" + acct_id)
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
todo("User Data Loading...")
|
|
|
|
var domain = localStorage.getItem("domain_" + acct_id)
|
2019-05-19 17:39:30 +10:00
|
|
|
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
2020-08-02 17:08:07 +10:00
|
|
|
misskeyUdg(user, acct_id)
|
|
|
|
return
|
2018-07-30 21:03:49 +10:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
var at = localStorage.getItem("acct_" + acct_id + "_at")
|
|
|
|
var start = "https://" + domain + "/api/v1/accounts/" + user
|
2018-01-28 23:22:43 +11:00
|
|
|
fetch(start, {
|
2019-11-04 03:09:02 +11:00
|
|
|
method: "GET",
|
2018-01-28 23:22:43 +11:00
|
|
|
headers: {
|
2019-11-04 03:09:02 +11:00
|
|
|
"content-type": "application/json",
|
|
|
|
Authorization: "Bearer " + at
|
2019-05-19 17:39:30 +10:00
|
|
|
}
|
2019-11-04 03:09:02 +11:00
|
|
|
})
|
2021-04-18 05:28:10 +10:00
|
|
|
.then(function (response) {
|
2019-11-04 03:09:02 +11:00
|
|
|
if (!response.ok) {
|
2021-04-18 05:28:10 +10:00
|
|
|
response.text().then(function (text) {
|
2020-08-02 17:08:07 +10:00
|
|
|
setLog(response.url, response.status, text)
|
|
|
|
})
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
return response.json()
|
2019-11-04 03:09:02 +11:00
|
|
|
})
|
2021-04-18 05:28:10 +10:00
|
|
|
.catch(function (error) {
|
2020-08-02 17:08:07 +10:00
|
|
|
todo(error)
|
|
|
|
setLog(start, "JSON", error)
|
|
|
|
console.error(error)
|
2019-11-04 03:09:02 +11:00
|
|
|
})
|
2021-04-18 05:28:10 +10:00
|
|
|
.then(function (json) {
|
2019-11-04 03:09:02 +11:00
|
|
|
//一つ前のユーザーデータ
|
|
|
|
if (!localStorage.getItem("history")) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-history-btn").prop("disabled", true)
|
2019-11-04 03:09:02 +11:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-history-btn").prop("disabled", false)
|
|
|
|
$("#his-data").attr("history", localStorage.getItem("history"))
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
//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
|
2020-08-02 17:08:07 +10:00
|
|
|
})
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-data").modal("open")
|
|
|
|
$("#his-data").attr("user-id", user)
|
|
|
|
$("#his-data").attr("use-acct", acct_id)
|
2019-11-04 03:09:02 +11:00
|
|
|
if (json.username != json.acct) {
|
|
|
|
//Remote
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-data").attr("remote", "true")
|
|
|
|
var fullname = json.acct
|
2019-11-04 03:09:02 +11:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-data").attr("remote", "false")
|
|
|
|
var fullname = json.acct + "@" + domain
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
utlShow(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)
|
2019-04-14 02:42:18 +10:00
|
|
|
|
2020-08-02 17:08:07 +10:00
|
|
|
var note = json.note
|
2019-11-04 03:09:02 +11:00
|
|
|
if (json.emojis) {
|
2020-08-02 17:08:07 +10:00
|
|
|
var actemojick = json.emojis[0]
|
2019-11-04 03:09:02 +11:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
var actemojick = false
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
//絵文字があれば
|
|
|
|
if (actemojick) {
|
2021-04-18 05:28:10 +10:00
|
|
|
Object.keys(json.emojis).forEach(function (key5) {
|
2020-08-02 17:08:07 +10:00
|
|
|
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 regExp = new RegExp(":" + shortcode + ":", "g")
|
|
|
|
dis_name = dis_name.replace(regExp, emoji_url)
|
|
|
|
note = note.replace(regExp, emoji_url)
|
|
|
|
})
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
//noteの解析
|
|
|
|
//var tags = '<a onclick="tl(\'tag\',\'$1\',' + acct_id +',\'add\')" class="pointer parsed">#$1</a>';
|
|
|
|
//var mens = '<a onclick="udgEx(\'$1\',' + acct_id +')" class="pointer parsed">@$1</a>';
|
|
|
|
//note=note.replace(/#(\S+)/gi, tags)
|
|
|
|
//note=note.replace(/\s@([a-zA-Z_0-9@.-]+)/gi, mens)
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-name").html(dis_name)
|
|
|
|
$("#his-acct").text(json.acct)
|
|
|
|
$("#his-acct").attr("fullname", fullname)
|
|
|
|
$("#his-prof").attr("src", json.avatar)
|
2021-04-18 05:28:10 +10:00
|
|
|
$("#util-add").removeClass("hide")
|
|
|
|
const title = $('.column-first').html()
|
|
|
|
$("#my-data-nav .anc-link").removeClass("active-back")
|
|
|
|
$('.column-first').addClass("active-back")
|
|
|
|
$('#his-data-title').html(title)
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#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
|
2019-11-04 03:09:02 +11:00
|
|
|
if (flerc < 0) {
|
2020-08-02 17:08:07 +10:00
|
|
|
flerc = "-"
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-follower").text(flerc)
|
|
|
|
$("#his-since").text(crat(json.created_at))
|
|
|
|
$("#his-openin").attr("data-href", json.url)
|
2019-11-04 03:09:02 +11:00
|
|
|
if (json.fields) {
|
2020-08-02 17:08:07 +10:00
|
|
|
var table = ""
|
2019-11-04 03:09:02 +11:00
|
|
|
if (json.fields.length > 0) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-des").css("max-height", "250px")
|
|
|
|
table = '<table id="his-field">'
|
2019-11-04 03:09:02 +11:00
|
|
|
for (var i = 0; i < json.fields.length; i++) {
|
2020-08-02 17:08:07 +10:00
|
|
|
var fname = json.fields[i].name
|
|
|
|
var fval = json.fields[i].value
|
2019-11-04 03:09:02 +11:00
|
|
|
if (json.fields[i].verified_at) {
|
2020-08-02 17:08:07 +10:00
|
|
|
var when = lang.lang_showontl_verified + ":" + crat(json.fields[i].verified_at)
|
|
|
|
var color = "rgba(121,189,154,.25);"
|
2019-11-04 03:09:02 +11:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
var when = ""
|
|
|
|
var color = "inherit"
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
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>"
|
2018-05-02 14:14:03 +10:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
table = table + "</table>"
|
|
|
|
$("#his-des").html(twemoji.parse(note))
|
2019-11-04 03:09:02 +11:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-des").css("max-height", "400px")
|
2018-04-17 03:10:35 +10:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-table").html(twemoji.parse(table))
|
2018-02-25 18:21:13 +11:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-des").css("max-height", "400px")
|
2018-02-25 18:21:13 +11:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-des").html(twemoji.parse(note))
|
2019-11-04 03:09:02 +11:00
|
|
|
if (json.bot) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-bot").html(lang.lang_showontl_botacct)
|
2021-04-18 05:28:10 +10:00
|
|
|
$("#his-bot").removeClass("hide")
|
2019-05-19 17:39:30 +10:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-des").attr("data-acct", acct_id)
|
|
|
|
$("#his-data").css("background-size", "cover")
|
|
|
|
$("#his-float-timeline").css("height", $("#his-data-show").height() + "px")
|
|
|
|
localStorage.setItem("history", user)
|
2019-11-04 03:09:02 +11:00
|
|
|
//自分の時
|
|
|
|
if (json.acct == localStorage.getItem("user_" + acct_id)) {
|
2020-08-02 17:08:07 +10:00
|
|
|
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)
|
2019-11-04 03:09:02 +11:00
|
|
|
if (json.fields.length > 0) {
|
|
|
|
if (json.fields[0]) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-f1-name").val(json.fields[0].name)
|
|
|
|
$("#his-f1-val").val($.strip_tags(json.fields[0].value))
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
if (json.fields[1]) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-f2-name").val(json.fields[1].name)
|
|
|
|
$("#his-f2-val").val($.strip_tags(json.fields[1].value))
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
if (json.fields[2]) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-f3-name").val(json.fields[2].name)
|
|
|
|
$("#his-f3-val").val($.strip_tags(json.fields[2].value))
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
if (json.fields[3]) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-f4-name").val(json.fields[3].name)
|
|
|
|
$("#his-f4-val").val($.strip_tags(json.fields[3].value))
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
var des = json.note
|
|
|
|
des = des.replace(/<br \/>/g, "\n")
|
|
|
|
des = $.strip_tags(des)
|
|
|
|
$("#his-des-val").val(des)
|
|
|
|
$("#his-follow-btn").hide()
|
|
|
|
$("#his-block-btn").hide()
|
|
|
|
$("#his-mute-btn").hide()
|
|
|
|
$("#his-notf-btn").hide()
|
|
|
|
$("#his-domain-btn").hide()
|
|
|
|
$("#his-emp-btn").hide()
|
|
|
|
$(".only-my-data").show()
|
|
|
|
$(".only-his-data").hide()
|
2019-11-04 03:09:02 +11:00
|
|
|
if (localStorage.getItem("main") == acct_id) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-main-acct").hide()
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
relations(user, acct_id)
|
|
|
|
$(".only-my-data").hide()
|
|
|
|
$(".only-his-data").show()
|
2019-07-07 00:16:41 +10:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
todc()
|
2021-04-18 05:28:10 +10:00
|
|
|
if (json.locked) {
|
2020-06-12 23:13:06 +10:00
|
|
|
$('#his-data').addClass('locked')
|
|
|
|
} else {
|
|
|
|
$('#his-data').removeClass('locked')
|
|
|
|
}
|
2019-11-04 03:09:02 +11:00
|
|
|
//外部データ取得(死かもしれないので)
|
2020-08-02 17:08:07 +10:00
|
|
|
udAdd(acct_id, user, json.url)
|
|
|
|
})
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
2018-07-30 21:03:49 +10:00
|
|
|
function misskeyUdg(user, acct_id) {
|
2020-08-02 17:08:07 +10:00
|
|
|
reset()
|
2018-07-30 21:03:49 +10:00
|
|
|
if (!user) {
|
2020-08-02 17:08:07 +10:00
|
|
|
user = localStorage.getItem("user-id_" + acct_id)
|
2018-07-30 21:03:49 +10:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
todo("User Data Loading...")
|
|
|
|
var domain = localStorage.getItem("domain_" + acct_id)
|
2019-05-19 17:39:30 +10:00
|
|
|
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
2020-08-02 17:08:07 +10:00
|
|
|
udg(user, acct_id)
|
|
|
|
return
|
2018-07-30 21:03:49 +10:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
var at = localStorage.getItem("acct_" + acct_id + "_at")
|
|
|
|
var start = "https://" + domain + "/api/users/show"
|
2018-07-30 21:03:49 +10:00
|
|
|
fetch(start, {
|
2019-11-04 03:09:02 +11:00
|
|
|
method: "POST",
|
2018-07-30 21:03:49 +10:00
|
|
|
headers: {
|
2019-11-04 03:09:02 +11:00
|
|
|
"content-type": "application/json"
|
2018-07-30 21:03:49 +10:00
|
|
|
},
|
|
|
|
body: JSON.stringify({
|
2019-05-19 17:39:30 +10:00
|
|
|
i: at,
|
|
|
|
userId: user
|
2018-07-30 21:03:49 +10:00
|
|
|
})
|
2019-11-04 03:09:02 +11:00
|
|
|
})
|
2021-04-18 05:28:10 +10:00
|
|
|
.then(function (response) {
|
2019-11-04 03:09:02 +11:00
|
|
|
if (!response.ok) {
|
2021-04-18 05:28:10 +10:00
|
|
|
response.text().then(function (text) {
|
2020-08-02 17:08:07 +10:00
|
|
|
setLog(response.url, response.status, text)
|
|
|
|
})
|
2019-07-07 00:16:41 +10:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
return response.json()
|
2019-11-04 03:09:02 +11:00
|
|
|
})
|
2021-04-18 05:28:10 +10:00
|
|
|
.catch(function (error) {
|
2020-08-02 17:08:07 +10:00
|
|
|
todo(error)
|
|
|
|
setLog(start, "JSON", error)
|
|
|
|
console.error(error)
|
2019-11-04 03:09:02 +11:00
|
|
|
})
|
2021-04-18 05:28:10 +10:00
|
|
|
.then(function (json) {
|
2019-11-04 03:09:02 +11:00
|
|
|
//一つ前のユーザーデータ
|
|
|
|
if (!localStorage.getItem("history")) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-history-btn").prop("disabled", true)
|
2019-05-19 17:39:30 +10:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-history-btn").prop("disabled", false)
|
|
|
|
$("#his-data").attr("history", localStorage.getItem("history"))
|
2018-07-30 21:03:49 +10:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-data").modal("open")
|
|
|
|
$("#his-data").attr("user-id", user)
|
|
|
|
$("#his-data").attr("use-acct", acct_id)
|
2019-11-04 03:09:02 +11:00
|
|
|
if (json.host) {
|
|
|
|
//Remote
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-data").attr("remote", "false")
|
|
|
|
var fullname = json.username + "@" + json.host
|
2019-11-04 03:09:02 +11:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-data").attr("remote", "false")
|
|
|
|
var fullname = json.acct + "@" + domain
|
2018-07-30 21:03:49 +10:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
utlShow(json.id, "", acct_id)
|
|
|
|
flw(json.id, "", acct_id)
|
|
|
|
fer(json.id, "", acct_id)
|
2019-11-04 03:09:02 +11:00
|
|
|
if (json.name) {
|
2020-08-02 17:08:07 +10:00
|
|
|
var dis_name = escapeHTML(json.name)
|
|
|
|
dis_name = twemoji.parse(dis_name)
|
2018-07-30 21:03:49 +10:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
var dis_name = json.name
|
2018-07-30 21:03:49 +10:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#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-sta").text(json.notesCount)
|
|
|
|
$("#his-follow").text(json.followingCount)
|
|
|
|
$("#his-follower").text(json.followersCount)
|
|
|
|
$("#his-since").text(crat(json.createdAt))
|
|
|
|
var note = escapeHTML(json.description)
|
|
|
|
$("#his-des").html(twemoji.parse(note))
|
2019-11-04 03:09:02 +11:00
|
|
|
if (json.isCat) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-bot").html("Cat" + twemoji.parse("😺"))
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-data").css("background-size", "cover")
|
|
|
|
localStorage.setItem("history", user)
|
2019-11-04 03:09:02 +11:00
|
|
|
//自分の時
|
|
|
|
if (json.username == localStorage.getItem("user_" + acct_id) && !json.host) {
|
|
|
|
//showFav('', acct_id);
|
|
|
|
//showMut('', acct_id);
|
|
|
|
//showReq('', acct_id);
|
2020-08-02 17:08:07 +10:00
|
|
|
showFrl("", acct_id)
|
|
|
|
$("#his-name-val").val(json.name)
|
|
|
|
var des = json.note
|
|
|
|
des = nl2br(des)
|
|
|
|
des = $.strip_tags(des)
|
|
|
|
$("#his-des-val").val(des)
|
|
|
|
$("#his-follow-btn").hide()
|
|
|
|
$("#his-block-btn").hide()
|
|
|
|
$("#his-mute-btn").hide()
|
|
|
|
$("#his-notf-btn").hide()
|
|
|
|
$("#his-domain-btn").hide()
|
|
|
|
$("#his-emp-btn").hide()
|
|
|
|
$(".only-my-data").show()
|
|
|
|
$(".only-his-data").hide()
|
2019-11-04 03:09:02 +11:00
|
|
|
if (localStorage.getItem("main") == acct_id) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-main-acct").hide()
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (json.isFollowing) {
|
|
|
|
//自分がフォローしている
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-data").addClass("following")
|
|
|
|
$("#his-follow-btn-text").text(lang.lang_status_unfollow)
|
|
|
|
hisList(user, acct_id)
|
2019-11-04 03:09:02 +11:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-follow-btn-text").text(lang.lang_status_follow)
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
if (json.isFollowed) {
|
|
|
|
//フォローされてる
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-relation").text(lang.lang_showontl_followed)
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-block-btn").hide()
|
2019-11-04 03:09:02 +11:00
|
|
|
if (json.isMuted) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-data").addClass("muting")
|
|
|
|
$("#his-mute-btn-text").text(lang.lang_status_unmute)
|
2019-11-04 03:09:02 +11:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-mute-btn-text").text(lang.lang_status_mute)
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
$(".only-my-data").hide()
|
|
|
|
$(".only-his-data").show()
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
todc()
|
|
|
|
})
|
2018-07-30 21:03:49 +10:00
|
|
|
}
|
2018-02-05 01:56:31 +11:00
|
|
|
//一つ前のユーザーデータ表示
|
2019-05-19 17:39:30 +10:00
|
|
|
function historyShow() {
|
2020-08-02 17:08:07 +10:00
|
|
|
var acct_id = $("#his-data").attr("use-acct")
|
|
|
|
var user = $("#his-data").attr("history")
|
|
|
|
udg(user, acct_id, "true")
|
2018-02-05 01:56:31 +11:00
|
|
|
}
|
2018-02-17 00:08:43 +11:00
|
|
|
//選択アカウントのプロフ
|
2019-05-19 17:39:30 +10:00
|
|
|
function profShow() {
|
2020-08-02 17:08:07 +10:00
|
|
|
var acct_id = $("#post-acct-sel").val()
|
|
|
|
var user = localStorage.getItem("user-id_" + acct_id)
|
|
|
|
udg(user, acct_id)
|
|
|
|
hide()
|
2018-02-17 00:08:43 +11:00
|
|
|
}
|
2018-01-28 23:22:43 +11:00
|
|
|
|
|
|
|
//FF関係取得
|
|
|
|
function relations(user, acct_id) {
|
2020-08-02 17:08:07 +10:00
|
|
|
var domain = localStorage.getItem("domain_" + acct_id)
|
|
|
|
var at = localStorage.getItem("acct_" + acct_id + "_at")
|
|
|
|
var start = "https://" + domain + "/api/v1/accounts/relationships?id=" + user
|
2018-01-28 23:22:43 +11:00
|
|
|
fetch(start, {
|
2019-11-04 03:09:02 +11:00
|
|
|
method: "GET",
|
2018-01-28 23:22:43 +11:00
|
|
|
headers: {
|
2019-11-04 03:09:02 +11:00
|
|
|
"content-type": "application/json",
|
|
|
|
Authorization: "Bearer " + at
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
2019-11-04 03:09:02 +11:00
|
|
|
})
|
2021-04-18 05:28:10 +10:00
|
|
|
.then(function (response) {
|
2019-11-04 03:09:02 +11:00
|
|
|
if (!response.ok) {
|
2021-04-18 05:28:10 +10:00
|
|
|
response.text().then(function (text) {
|
2020-08-02 17:08:07 +10:00
|
|
|
setLog(response.url, response.status, text)
|
|
|
|
})
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
return response.json()
|
2019-11-04 03:09:02 +11:00
|
|
|
})
|
2021-04-18 05:28:10 +10:00
|
|
|
.catch(function (error) {
|
2020-08-02 17:08:07 +10:00
|
|
|
todo(error)
|
|
|
|
setLog(start, "JSON", error)
|
|
|
|
console.error(error)
|
2019-11-04 03:09:02 +11:00
|
|
|
})
|
2021-04-18 05:28:10 +10:00
|
|
|
.then(function (json) {
|
2020-08-02 17:08:07 +10:00
|
|
|
var json = json[0]
|
2021-04-18 05:28:10 +10:00
|
|
|
if (json.requested) {
|
2020-06-12 23:13:06 +10:00
|
|
|
//フォロリク中
|
|
|
|
$('#his-data').addClass('following')
|
|
|
|
$("#his-follow-btn-text").text(lang.lang_status_requesting)
|
|
|
|
}
|
2019-11-04 03:09:02 +11:00
|
|
|
if (json.following) {
|
|
|
|
//自分がフォローしている
|
2020-06-12 23:13:06 +10:00
|
|
|
$("#his-data").addClass("following")
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-follow-btn-text").text(lang.lang_status_unfollow)
|
|
|
|
hisList(user, acct_id)
|
2019-11-04 03:09:02 +11:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-follow-btn-text").text(lang.lang_status_follow)
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
if (json.followed_by) {
|
|
|
|
//フォローされてる
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-relation").text(lang.lang_showontl_followed)
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
if (json.blocking) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-data").addClass("blocking")
|
|
|
|
$("#his-block-btn-text").text(lang.lang_status_unblock)
|
2019-11-04 03:09:02 +11:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-block-btn-text").text(lang.lang_status_block)
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
if (json.muting) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-data").addClass("muting")
|
|
|
|
$("#his-mute-btn-text").text(lang.lang_status_unmute)
|
2019-11-04 03:09:02 +11:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-mute-btn-text").text(lang.lang_status_mute)
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
if (json.muting_notifications) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-data").addClass("mutingNotf")
|
|
|
|
$("#his-notf-btn-text").text(lang.lang_showontl_notf + lang.lang_status_unmute)
|
2019-11-04 03:09:02 +11:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-notf-btn-text").text(lang.lang_showontl_notf + lang.lang_status_mute)
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
if (json.domain_blocking) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-data").addClass("blockingDom")
|
|
|
|
$("#his-domain-btn-text").text(lang.lang_showontl_domain + lang.lang_status_unblock)
|
2019-11-04 03:09:02 +11:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-domain-btn-text").text(lang.lang_showontl_domain + lang.lang_status_block)
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
//Endorsed
|
|
|
|
if (json.endorsed) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-end-btn").addClass("endorsed")
|
|
|
|
$("#his-end-btn-text").text(lang.lang_status_unendorse)
|
2019-11-04 03:09:02 +11:00
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-end-btn").removeClass("endorsed")
|
|
|
|
$("#his-end-btn-text").text(lang.lang_status_endorse)
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
|
|
|
//Blocked
|
|
|
|
if (json.blocked_by) {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#my-data-nav .btn").addClass("disabled")
|
|
|
|
$(".his-var-content").hide()
|
|
|
|
$("#his-float-blocked").show()
|
|
|
|
$("#his-follow-btn").hide()
|
2019-11-04 03:09:02 +11:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
})
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function profbrws() {
|
2020-08-02 17:08:07 +10:00
|
|
|
var url = $("#his-openin").attr("data-href")
|
|
|
|
postMessage(["openUrl", url], "*")
|
2018-09-05 01:04:56 +10:00
|
|
|
}
|
2019-07-07 00:16:41 +10:00
|
|
|
function setMain() {
|
2020-08-02 17:08:07 +10:00
|
|
|
var acct_id = $("#his-data").attr("use-acct")
|
|
|
|
localStorage.setItem("main", acct_id)
|
|
|
|
multiSelector(true)
|
|
|
|
M.toast({ html: lang.lang_manager_mainAcct, displayLength: 3000 })
|
2019-07-07 00:16:41 +10:00
|
|
|
}
|
2018-01-28 23:22:43 +11:00
|
|
|
//オールリセット
|
|
|
|
function hisclose() {
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-data").modal("close")
|
|
|
|
reset()
|
|
|
|
$("#his-data").attr("history", "")
|
|
|
|
localStorage.removeItem("history")
|
2018-02-25 18:21:13 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function reset() {
|
2020-08-02 17:08:07 +10:00
|
|
|
$(".his-var-content:eq(0)").show()
|
|
|
|
$(".his-var-content:gt(0)").hide()
|
|
|
|
$("#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-sta").text("")
|
|
|
|
$("#his-follow").text("")
|
|
|
|
$("#his-follower").text("")
|
|
|
|
$("#his-des").html("")
|
|
|
|
$("#his-data").css("background-size", "cover")
|
|
|
|
$("#his-since").text("")
|
|
|
|
$("#his-data").removeClass("following")
|
|
|
|
$("#his-data").removeClass("muting")
|
|
|
|
$("#his-data").removeClass("blocking")
|
|
|
|
$("#his-data").removeClass("mutingNotf")
|
|
|
|
$("#his-data").removeClass("blockingDom")
|
|
|
|
$("#his-end-btn").removeClass("endorsed")
|
|
|
|
$("#his-des").css("max-height", "250px")
|
|
|
|
$("#his-bot").html("")
|
2021-04-18 05:28:10 +10:00
|
|
|
$("#his-bot").addClass("hide")
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#his-follow-btn").show()
|
|
|
|
$("#his-block-btn").show()
|
|
|
|
$("#his-mute-btn").show()
|
|
|
|
$("#his-notf-btn").show()
|
|
|
|
$("#his-domain-btn").show()
|
|
|
|
$("#his-emp-btn").show()
|
|
|
|
$("#his-follow-btn-text").text(lang.lang_status_follow)
|
|
|
|
$("#his-mute-btn-text").text(lang.lang_status_mute)
|
|
|
|
$("#his-block-btn-text").text(lang.lang_status_block)
|
|
|
|
$("#his-notf-btn").text(lang.lang_showontl_notf + lang.lang_status_mute)
|
|
|
|
$("#his-domain-btn").text(lang.lang_showontl_domain + lang.lang_status_block)
|
|
|
|
$("#his-relation").text("")
|
|
|
|
$(".cont-series").html("")
|
|
|
|
$("#domainblock").val("")
|
|
|
|
$("#his-lists-a").html(lang.lang_showontl_listwarn)
|
|
|
|
$("#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-endorse").html("")
|
|
|
|
$("#his-openin").attr("data-href", "")
|
|
|
|
$("#his-float-timeline").show()
|
|
|
|
$("#his-float-blocked").hide()
|
|
|
|
$("#his-main-acct").show()
|
|
|
|
$("#his-proof-prof").html("")
|
2020-06-12 23:13:06 +10:00
|
|
|
$('#his-data').removeClass('locked')
|
|
|
|
$('#his-data').removeClass('requesting')
|
2018-03-14 05:31:31 +11:00
|
|
|
}
|
2021-04-18 05:28:10 +10:00
|
|
|
$("#my-data-nav .anc-link").on("click", function () {
|
2020-08-02 17:08:07 +10:00
|
|
|
var target = $(this).attr("go")
|
2019-08-24 22:19:52 +10:00
|
|
|
if (target) {
|
2021-04-18 05:28:10 +10:00
|
|
|
let title = $(this).html()
|
|
|
|
if (target === '#his-tl') $("#util-add").removeClass("hide")
|
|
|
|
if (target != '#his-tl') $("#util-add").addClass("hide")
|
|
|
|
$('#his-data-title').html(title)
|
2020-08-02 17:08:07 +10:00
|
|
|
$("#my-data-nav .anc-link").removeClass("active-back")
|
|
|
|
$(this).addClass("active-back")
|
|
|
|
$(target).show()
|
|
|
|
$(".his-var-content:not(" + target + ")").hide()
|
2019-08-24 02:09:56 +10:00
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
})
|