Fix: follow on cross-acct

This commit is contained in:
cutls 2019-11-04 01:09:02 +09:00
parent 9977c009e0
commit 25d24ddef0
4 changed files with 1424 additions and 1298 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -6,12 +6,12 @@ if (location.search) {
var mode = m[1]; var mode = m[1];
var codex = m[2]; var codex = m[2];
if (mode == "user") { if (mode == "user") {
udgEx(codex, 'main'); udgEx(codex, "main");
} }
} }
function udgEx(user, acct_id) { function udgEx(user, acct_id) {
if (user == "selector") { if (user == "selector") {
user = $("#his-acct").attr('fullname'); user = $("#his-acct").attr("fullname");
} }
if (acct_id == "selector") { if (acct_id == "selector") {
acct_id = $("#user-acct-sel").val(); acct_id = $("#user-acct-sel").val();
@ -21,33 +21,39 @@ function udgEx(user, acct_id) {
} }
console.log("Get user data of " + user); console.log("Get user data of " + user);
var domain = localStorage.getItem("domain_" + acct_id); var domain = localStorage.getItem("domain_" + acct_id);
if (localStorage.getItem("mode_" + domain) == "misskey") { return false; } if (localStorage.getItem("mode_" + domain) == "misskey") {
return false;
}
var at = localStorage.getItem("acct_" + acct_id + "_at"); var at = localStorage.getItem("acct_" + acct_id + "_at");
var start = "https://" + domain + "/api/v2/search?resolve=true&q=" + user var start = "https://" + domain + "/api/v2/search?resolve=true&q=" + user;
fetch(start, { fetch(start, {
method: 'GET', method: "GET",
headers: { headers: {
'content-type': 'application/json', "content-type": "application/json",
'Authorization': 'Bearer ' + at Authorization: "Bearer " + at
} }
}).then(function (response) { })
if (!response.ok) { .then(function(response) {
response.text().then(function(text) { if (!response.ok) {
setLog(response.url, response.status, text); response.text().then(function(text) {
}); setLog(response.url, response.status, text);
} });
return response.json(); }
}).catch(function (error) { return response.json();
todo(error); })
console.error(error); .catch(function(error) {
}).then(function (json) { todo(error);
if (json.accounts[0]) { setLog(start, "JSON", error);
var id = json.accounts[0].id; console.error(error);
udg(id, acct_id); })
} else { .then(function(json) {
postMessage(["openUrl", user], "*") if (json.accounts[0]) {
} var id = json.accounts[0].id;
}); udg(id, acct_id);
} else {
postMessage(["openUrl", user], "*");
}
});
return true; return true;
} }
function udg(user, acct_id) { function udg(user, acct_id) {
@ -58,169 +64,184 @@ function udg(user, acct_id) {
todo("User Data Loading..."); todo("User Data Loading...");
var domain = localStorage.getItem("domain_" + acct_id); var domain = localStorage.getItem("domain_" + acct_id);
if (localStorage.getItem("mode_" + domain) == "misskey") { if (localStorage.getItem("mode_" + domain) == "misskey") {
misskeyUdg(user, acct_id) misskeyUdg(user, acct_id);
return; return;
} }
var at = localStorage.getItem("acct_" + acct_id + "_at"); var at = localStorage.getItem("acct_" + acct_id + "_at");
var start = "https://" + domain + "/api/v1/accounts/" + user; var start = "https://" + domain + "/api/v1/accounts/" + user;
fetch(start, { fetch(start, {
method: 'GET', method: "GET",
headers: { headers: {
'content-type': 'application/json', "content-type": "application/json",
'Authorization': 'Bearer ' + at Authorization: "Bearer " + at
},
}).then(function (response) {
if (!response.ok) {
response.text().then(function(text) {
setLog(response.url, response.status, text);
});
} }
return response.json(); })
}).catch(function (error) { .then(function(response) {
todo(error); if (!response.ok) {
console.error(error); response.text().then(function(text) {
}).then(function (json) { setLog(response.url, response.status, text);
//一つ前のユーザーデータ });
if (!localStorage.getItem("history")) { }
$("#his-history-btn").prop("disabled", true); return response.json();
} else { })
$("#his-history-btn").prop("disabled", false); .catch(function(error) {
$('#his-data').attr("history", localStorage.getItem("history")); todo(error);
} setLog(start, "JSON", error);
//moved設定時 console.error(error);
if (json.moved) { })
M.toast({ .then(function(json) {
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 if (!localStorage.getItem("history")) {
}) $("#his-history-btn").prop("disabled", true);
} } else {
$('#his-data').modal('open'); $("#his-history-btn").prop("disabled", false);
$('#his-data').attr("user-id", user); $("#his-data").attr("history", localStorage.getItem("history"));
$('#his-data').attr("use-acct", acct_id); }
if (json.username != json.acct) { //moved設定時
//Remote if (json.moved) {
$('#his-data').attr("remote", "true"); M.toast({
var fullname = json.acct; html: lang.lang_showontl_movetxt + '<button class="btn-flat toast-action" onclick="udg(\'' + json.moved.id + "','" + acct_id + "')\">" + lang.lang_showontl_movebtn + "</button>",
} else { displayLength: 4000
$('#his-data').attr("remote", "false"); });
var fullname = json.acct + "@" + domain; }
} $("#his-data").modal("open");
utl(json.id, '', acct_id); $("#his-data").attr("user-id", user);
flw(json.id, '', acct_id); $("#his-data").attr("use-acct", acct_id);
fer(json.id, '', acct_id); if (json.username != json.acct) {
var dis_name = escapeHTML(json.display_name); //Remote
dis_name = twemoji.parse(dis_name); $("#his-data").attr("remote", "true");
var fullname = json.acct;
} else {
$("#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);
var dis_name = escapeHTML(json.display_name);
dis_name = twemoji.parse(dis_name);
var note = json.note; var note = json.note;
if (json.emojis) { if (json.emojis) {
var actemojick = json.emojis[0]; var actemojick = json.emojis[0];
} else { } else {
var actemojick = false; var actemojick = false;
} }
//絵文字があれば //絵文字があれば
if (actemojick) { if (actemojick) {
Object.keys(json.emojis).forEach(function (key5) { Object.keys(json.emojis).forEach(function(key5) {
var emoji = json.emojis[key5]; var emoji = json.emojis[key5];
var shortcode = emoji.shortcode; var shortcode = emoji.shortcode;
var emoji_url = '<img src="' + emoji.url + var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" draggable="false">';
'" class="emoji-img" data-emoji="' + shortcode + '" draggable="false">'; var regExp = new RegExp(":" + shortcode + ":", "g");
var regExp = new RegExp(":" + shortcode + ":", "g"); dis_name = dis_name.replace(regExp, emoji_url);
dis_name = dis_name.replace(regExp, emoji_url); note = note.replace(regExp, emoji_url);
note = note.replace(regExp, emoji_url); });
}); }
} //noteの解析
//noteの解析 //var tags = '<a onclick="tl(\'tag\',\'$1\',' + acct_id +',\'add\')" class="pointer parsed">#$1</a>';
//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>';
//var mens = '<a onclick="udgEx(\'$1\',' + acct_id +')" class="pointer parsed">@$1</a>'; //note=note.replace(/#(\S+)/gi, tags)
//note=note.replace(/#(\S+)/gi, tags) //note=note.replace(/\s@([a-zA-Z_0-9@.-]+)/gi, mens)
//note=note.replace(/\s@([a-zA-Z_0-9@.-]+)/gi, mens) $("#his-name").html(dis_name);
$("#his-name").html(dis_name); $("#his-acct").text(json.acct);
$("#his-acct").text(json.acct); $("#his-acct").attr("fullname", fullname);
$("#his-acct").attr("fullname", fullname); $("#his-prof").attr("src", json.avatar);
$("#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-sta").text(json.statuses_count); $("#his-follow").text(json.following_count);
$("#his-follow").text(json.following_count); var flerc = json.followers_count;
var flerc = json.followers_count; if (flerc < 0) {
if (flerc < 0) { flerc = "-";
flerc = "-"; }
} $("#his-follower").text(flerc);
$("#his-follower").text(flerc); $("#his-since").text(crat(json.created_at));
$("#his-since").text(crat(json.created_at)); $("#his-openin").attr("data-href", json.url);
$("#his-openin").attr("data-href", json.url); if (json.fields) {
if (json.fields) { var table = "";
var table ="" if (json.fields.length > 0) {
if (json.fields.length > 0) { $("#his-des").css("max-height", "250px");
$("#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++) {
for (var i = 0; i < json.fields.length; i++) { var fname = json.fields[i].name;
var fname = json.fields[i].name; var fval = json.fields[i].value;
var fval = json.fields[i].value; if (json.fields[i].verified_at) {
if (json.fields[i].verified_at) { var when = lang.lang_showontl_verified + ":" + crat(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 {
} else { var when = "";
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>";
$("#his-des").html(twemoji.parse(note));
} else {
$("#his-des").css("max-height", "400px");
} }
table = table + '</table>' $("#his-table").html(twemoji.parse(table));
$("#his-des").html(twemoji.parse(note));
} else { } else {
$("#his-des").css("max-height", "400px"); $("#his-des").css("max-height", "400px");
} }
$("#his-table").html(twemoji.parse(table)); $("#his-des").html(twemoji.parse(note));
}else { if (json.bot) {
$("#his-des").css("max-height", "400px"); $("#his-bot").html(lang.lang_showontl_botacct);
}
$("#his-des").html(twemoji.parse(note));
if (json.bot) {
$("#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")
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);
$("#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)); }
} }
var des = json.note; $("#his-des").attr("data-acct", acct_id);
des = des.replace(/<br \/>/g, "\n") $("#his-data").css("background-size", "cover");
des = $.strip_tags(des); $("#his-float-timeline").css("height", $("#his-data-show").height() + "px");
$("#his-des-val").val(des); localStorage.setItem("history", user);
$("#his-follow-btn").hide(); //自分の時
$("#his-block-btn").hide(); if (json.acct == localStorage.getItem("user_" + acct_id)) {
$("#his-mute-btn").hide(); showFav("", acct_id);
$("#his-notf-btn").hide(); showBlo("", acct_id);
$("#his-domain-btn").hide(); showMut("", acct_id);
$("#his-emp-btn").hide(); showDom("", acct_id);
$(".only-my-data").show(); showReq("", acct_id);
$(".only-his-data").hide(); showFrl("", acct_id);
if (localStorage.getItem("main") == acct_id) { $("#his-name-val").val(json.display_name);
$("#his-main-acct").hide(); 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));
}
}
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();
if (localStorage.getItem("main") == acct_id) {
$("#his-main-acct").hide();
}
} else {
relations(user, acct_id);
$(".only-my-data").hide();
$(".only-his-data").show();
} }
} else { todc();
relations(user, acct_id); //外部データ取得(死かもしれないので)
$(".only-my-data").hide(); udAdd(acct_id, user, json.url);
$(".only-his-data").show(); });
}
todc();
//外部データ取得(死かもしれないので)
udAdd(acct_id, user, json.url);
});
} }
function misskeyUdg(user, acct_id) { function misskeyUdg(user, acct_id) {
reset(); reset();
@ -230,133 +251,137 @@ function misskeyUdg(user, acct_id) {
todo("User Data Loading..."); todo("User Data Loading...");
var domain = localStorage.getItem("domain_" + acct_id); var domain = localStorage.getItem("domain_" + acct_id);
if (localStorage.getItem("mode_" + domain) != "misskey") { if (localStorage.getItem("mode_" + domain) != "misskey") {
udg(user, acct_id) udg(user, acct_id);
return; return;
} }
var at = localStorage.getItem("acct_" + acct_id + "_at"); var at = localStorage.getItem("acct_" + acct_id + "_at");
var start = "https://" + domain + "/api/users/show"; var start = "https://" + domain + "/api/users/show";
fetch(start, { fetch(start, {
method: 'POST', method: "POST",
headers: { headers: {
'content-type': 'application/json', "content-type": "application/json"
}, },
body: JSON.stringify({ body: JSON.stringify({
i: at, i: at,
userId: user userId: user
}) })
}).then(function (response) { })
if (!response.ok) { .then(function(response) {
response.text().then(function(text) { if (!response.ok) {
setLog(response.url, response.status, text); response.text().then(function(text) {
}); setLog(response.url, response.status, text);
} });
return response.json();
}).catch(function (error) {
todo(error);
console.error(error);
}).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').modal('open');
$('#his-data').attr("user-id", user);
$('#his-data').attr("use-acct", acct_id);
if (json.host) {
//Remote
$('#his-data').attr("remote", "false");
var fullname = json.username + "@" + json.host;
} else {
$('#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);
if (json.name) {
var dis_name = escapeHTML(json.name);
dis_name = twemoji.parse(dis_name);
} else {
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-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));
if (json.isCat) {
$("#his-bot").html("Cat" + twemoji.parse("😺"));
}
$('#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);
$("#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();
if (localStorage.getItem("main") == acct_id) {
$("#his-main-acct").hide();
} }
} else { return response.json();
if (json.isFollowing) { })
//自分がフォローしている .catch(function(error) {
$("#his-data").addClass("following"); todo(error);
$("#his-follow-btn-text").text(lang.lang_status_unfollow); setLog(start, "JSON", error);
hisList(user, acct_id); console.error(error);
})
.then(function(json) {
//一つ前のユーザーデータ
if (!localStorage.getItem("history")) {
$("#his-history-btn").prop("disabled", true);
} else { } else {
$("#his-follow-btn-text").text(lang.lang_status_follow); $("#his-history-btn").prop("disabled", false);
$("#his-data").attr("history", localStorage.getItem("history"));
} }
if (json.isFollowed) { $("#his-data").modal("open");
//フォローされてる $("#his-data").attr("user-id", user);
$("#his-relation").text(lang.lang_showontl_followed); $("#his-data").attr("use-acct", acct_id);
} if (json.host) {
$("#his-block-btn").hide(); //Remote
if (json.isMuted) { $("#his-data").attr("remote", "false");
$("#his-data").addClass("muting"); var fullname = json.username + "@" + json.host;
$("#his-mute-btn-text").text(lang.lang_status_unmute);
} else { } else {
$("#his-mute-btn-text").text(lang.lang_status_mute); $("#his-data").attr("remote", "false");
var fullname = json.acct + "@" + domain;
} }
$(".only-my-data").hide(); utl(json.id, "", acct_id);
$(".only-his-data").show(); flw(json.id, "", acct_id);
} fer(json.id, "", acct_id);
todc(); if (json.name) {
}); var dis_name = escapeHTML(json.name);
dis_name = twemoji.parse(dis_name);
} else {
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-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));
if (json.isCat) {
$("#his-bot").html("Cat" + twemoji.parse("😺"));
}
$("#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);
$("#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();
if (localStorage.getItem("main") == acct_id) {
$("#his-main-acct").hide();
}
} else {
if (json.isFollowing) {
//自分がフォローしている
$("#his-data").addClass("following");
$("#his-follow-btn-text").text(lang.lang_status_unfollow);
hisList(user, acct_id);
} else {
$("#his-follow-btn-text").text(lang.lang_status_follow);
}
if (json.isFollowed) {
//フォローされてる
$("#his-relation").text(lang.lang_showontl_followed);
}
$("#his-block-btn").hide();
if (json.isMuted) {
$("#his-data").addClass("muting");
$("#his-mute-btn-text").text(lang.lang_status_unmute);
} else {
$("#his-mute-btn-text").text(lang.lang_status_mute);
}
$(".only-my-data").hide();
$(".only-his-data").show();
}
todc();
});
} }
//一つ前のユーザーデータ表示 //一つ前のユーザーデータ表示
function historyShow() { function historyShow() {
var acct_id = $('#his-data').attr("use-acct"); var acct_id = $("#his-data").attr("use-acct");
var user = $('#his-data').attr("history"); var user = $("#his-data").attr("history");
udg(user, acct_id, "true") udg(user, acct_id, "true");
} }
//選択アカウントのプロフ //選択アカウントのプロフ
function profShow() { function profShow() {
var acct_id = $("#post-acct-sel").val(); var acct_id = $("#post-acct-sel").val();
var user = localStorage.getItem("user-id_" + acct_id); var user = localStorage.getItem("user-id_" + acct_id);
udg(user, acct_id) udg(user, acct_id);
hide(); hide();
} }
@ -366,109 +391,112 @@ function relations(user, acct_id) {
var at = localStorage.getItem("acct_" + acct_id + "_at"); var at = localStorage.getItem("acct_" + acct_id + "_at");
var start = "https://" + domain + "/api/v1/accounts/relationships?id=" + user; var start = "https://" + domain + "/api/v1/accounts/relationships?id=" + user;
fetch(start, { fetch(start, {
method: 'GET', method: "GET",
headers: { headers: {
'content-type': 'application/json', "content-type": "application/json",
'Authorization': 'Bearer ' + at Authorization: "Bearer " + at
},
}).then(function (response) {
if (!response.ok) {
response.text().then(function(text) {
setLog(response.url, response.status, text);
});
} }
return response.json(); })
}).catch(function (error) { .then(function(response) {
todo(error); if (!response.ok) {
console.error(error); response.text().then(function(text) {
}).then(function (json) { setLog(response.url, response.status, text);
var json = json[0]; });
if (json.following) { }
//自分がフォローしている return response.json();
$("#his-data").addClass("following"); })
$("#his-follow-btn-text").text(lang.lang_status_unfollow); .catch(function(error) {
hisList(user, acct_id); todo(error);
} else { setLog(start, "JSON", error);
$("#his-follow-btn-text").text(lang.lang_status_follow); console.error(error);
} })
if (json.followed_by) { .then(function(json) {
//フォローされてる var json = json[0];
$("#his-relation").text(lang.lang_showontl_followed); if (json.following) {
} //自分がフォローしている
if (json.blocking) { $("#his-data").addClass("following");
$("#his-data").addClass("blocking"); $("#his-follow-btn-text").text(lang.lang_status_unfollow);
$("#his-block-btn-text").text(lang.lang_status_unblock); hisList(user, acct_id);
} else { } else {
$("#his-block-btn-text").text(lang.lang_status_block); $("#his-follow-btn-text").text(lang.lang_status_follow);
} }
if (json.muting) { if (json.followed_by) {
$("#his-data").addClass("muting"); //フォローされてる
$("#his-mute-btn-text").text(lang.lang_status_unmute); $("#his-relation").text(lang.lang_showontl_followed);
} else { }
$("#his-mute-btn-text").text(lang.lang_status_mute); if (json.blocking) {
} $("#his-data").addClass("blocking");
if (json.muting_notifications) { $("#his-block-btn-text").text(lang.lang_status_unblock);
$("#his-data").addClass("mutingNotf"); } else {
$("#his-notf-btn-text").text(lang.lang_showontl_notf + lang.lang_status_unmute); $("#his-block-btn-text").text(lang.lang_status_block);
} else { }
$("#his-notf-btn-text").text(lang.lang_showontl_notf + lang.lang_status_mute); if (json.muting) {
} $("#his-data").addClass("muting");
if (json.domain_blocking) { $("#his-mute-btn-text").text(lang.lang_status_unmute);
$("#his-data").addClass("blockingDom"); } else {
$("#his-domain-btn-text").text(lang.lang_showontl_domain + lang.lang_status_unblock); $("#his-mute-btn-text").text(lang.lang_status_mute);
} else { }
$("#his-domain-btn-text").text(lang.lang_showontl_domain + lang.lang_status_block); if (json.muting_notifications) {
} $("#his-data").addClass("mutingNotf");
//Endorsed $("#his-notf-btn-text").text(lang.lang_showontl_notf + lang.lang_status_unmute);
if (json.endorsed) { } else {
$("#his-end-btn").addClass("endorsed"); $("#his-notf-btn-text").text(lang.lang_showontl_notf + lang.lang_status_mute);
$("#his-end-btn-text").text(lang.lang_status_unendorse) }
} else { if (json.domain_blocking) {
$("#his-end-btn").removeClass("endorsed"); $("#his-data").addClass("blockingDom");
$("#his-end-btn-text").text(lang.lang_status_endorse) $("#his-domain-btn-text").text(lang.lang_showontl_domain + lang.lang_status_unblock);
} } else {
//Blocked $("#his-domain-btn-text").text(lang.lang_showontl_domain + lang.lang_status_block);
if (json.blocked_by) { }
$("#my-data-nav .btn").addClass("disabled") //Endorsed
$(".his-var-content").hide(); if (json.endorsed) {
$("#his-float-blocked").show() $("#his-end-btn").addClass("endorsed");
$("#his-follow-btn").hide() $("#his-end-btn-text").text(lang.lang_status_unendorse);
} } else {
$("#his-end-btn").removeClass("endorsed");
}); $("#his-end-btn-text").text(lang.lang_status_endorse);
}
//Blocked
if (json.blocked_by) {
$("#my-data-nav .btn").addClass("disabled");
$(".his-var-content").hide();
$("#his-float-blocked").show();
$("#his-follow-btn").hide();
}
});
} }
function profbrws() { function profbrws() {
var url = $("#his-openin").attr("data-href") var url = $("#his-openin").attr("data-href");
postMessage(["openUrl", url], "*") postMessage(["openUrl", url], "*");
} }
function setMain() { function setMain() {
var acct_id = $("#his-data").attr("use-acct") var acct_id = $("#his-data").attr("use-acct");
localStorage.setItem("main", acct_id); localStorage.setItem("main", acct_id);
multiSelector(true) multiSelector(true);
M.toast({ html: lang.lang_manager_mainAcct, displayLength: 3000 }) M.toast({ html: lang.lang_manager_mainAcct, displayLength: 3000 });
} }
//オールリセット //オールリセット
function hisclose() { function hisclose() {
$('#his-data').modal('close'); $("#his-data").modal("close");
reset(); reset();
$('#his-data').attr("history", ""); $("#his-data").attr("history", "");
localStorage.removeItem("history"); localStorage.removeItem("history");
} }
function reset() { function reset() {
$(".his-var-content:eq(0)").show(); $(".his-var-content:eq(0)").show();
$(".his-var-content:gt(0)").hide(); $(".his-var-content:gt(0)").hide();
$("#my-data-nav .btn").removeClass("disabled") $("#my-data-nav .btn").removeClass("disabled");
$(".active-back").removeClass("active-back"); $(".active-back").removeClass("active-back");
$(".column-first").addClass("active-back"); $(".column-first").addClass("active-back");
$("#his-name").text("Loading"); $("#his-name").text("Loading");
$("#his-acct").text(""); $("#his-acct").text("");
$("#his-prof").attr("src", "../../img/loading.svg"); $("#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-sta").text("");
$("#his-follow").text(""); $("#his-follow").text("");
$("#his-follower").text(""); $("#his-follower").text("");
$("#his-des").html(""); $("#his-des").html("");
$('#his-data').css('background-size', 'cover'); $("#his-data").css("background-size", "cover");
$("#his-since").text(""); $("#his-since").text("");
$("#his-data").removeClass("following"); $("#his-data").removeClass("following");
$("#his-data").removeClass("muting"); $("#his-data").removeClass("muting");
@ -493,21 +521,25 @@ function reset() {
$(".cont-series").html(""); $(".cont-series").html("");
$("#domainblock").val(""); $("#domainblock").val("");
$("#his-lists-a").html(lang.lang_showontl_listwarn); $("#his-lists-a").html(lang.lang_showontl_listwarn);
$("#his-lists-b").html(''); $("#his-lists-b").html("");
$("#his-name-val").val(""); $("#his-name-val").val("");
$("#his-des-val").val(""); $("#his-des-val").val("");
$("#his-f1-name").val(""); $("#his-f1-val").val(""); $("#his-f1-name").val("");
$("#his-f2-name").val(""); $("#his-f2-val").val(""); $("#his-f1-val").val("");
$("#his-f3-name").val(""); $("#his-f3-val").val(""); $("#his-f2-name").val("");
$("#his-f4-name").val(""); $("#his-f4-val").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-endorse").html("");
$("#his-openin").attr("data-href", ""); $("#his-openin").attr("data-href", "");
$("#his-float-timeline").show(); $("#his-float-timeline").show();
$("#his-float-blocked").hide(); $("#his-float-blocked").hide();
$("#his-main-acct").show(); $("#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"); var target = $(this).attr("go");
if (target) { if (target) {
$("#my-data-nav .anc-link").removeClass("active-back"); $("#my-data-nav .anc-link").removeClass("active-back");
@ -515,5 +547,4 @@ $('#my-data-nav .anc-link').on('click', function () {
$(target).show(); $(target).show();
$(".his-var-content:not(" + target + ")").hide(); $(".his-var-content:not(" + target + ")").hide();
} }
}); });

View File

@ -593,7 +593,7 @@
@@useOtherAcct1@@@@revoverJP@@@@follow@@(@@warnUseOtherAcct@@)<br> @@useOtherAcct1@@@@revoverJP@@@@follow@@(@@warnUseOtherAcct@@)<br>
<div style="max-width:500px;"><select id="user-acct-sel" class="acct-sel"></select></div> <div style="max-width:500px;"><select id="user-acct-sel" class="acct-sel"></select></div>
@@revoverJPde@@ @@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> @@or@@<br>
<a href="#!" class="waves-effect btn" <a href="#!" class="waves-effect btn"
onclick="udgEx('selector', 'selector')">@@openProf@@</a><br> onclick="udgEx('selector', 'selector')">@@openProf@@</a><br>