2019-03-06 19:08:48 +11:00
|
|
|
|
//DM(Conv) TL
|
2019-05-19 17:39:30 +10:00
|
|
|
|
function dm(acct_id, tlid, type, delc, voice) {
|
|
|
|
|
var domain = localStorage.getItem("domain_" + acct_id);
|
|
|
|
|
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
|
|
|
|
var start = "https://" + domain + "/api/v1/conversations";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
fetch(start, {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
method: "GET",
|
2019-03-06 19:08:48 +11:00
|
|
|
|
headers: {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
"content-type": "application/json",
|
|
|
|
|
Authorization: "Bearer " + at
|
2019-10-31 02:30:26 +11:00
|
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
|
})
|
|
|
|
|
.then(function(response) {
|
|
|
|
|
if (!response.ok) {
|
|
|
|
|
response.text().then(function(text) {
|
|
|
|
|
setLog(response.url, response.status, text);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return response.json();
|
|
|
|
|
})
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
todo(error);
|
|
|
|
|
setLog(start, "JSON", error);
|
|
|
|
|
console.error(error);
|
|
|
|
|
})
|
|
|
|
|
.then(function(json) {
|
|
|
|
|
var templete = '<div id="convList' + tlid + '">' + dmListParse(json, type, acct_id, tlid, "", mute) + "</div>";
|
|
|
|
|
localStorage.setItem("lastobj_" + tlid, json[0].id);
|
|
|
|
|
$("#timeline_" + tlid).html(templete);
|
|
|
|
|
additional(acct_id, tlid);
|
|
|
|
|
jQuery("time.timeago").timeago();
|
|
|
|
|
todc();
|
|
|
|
|
//reload(type, '', acct_id, tlid, data, mute, delc,voice);
|
|
|
|
|
$(window).scrollTop(0);
|
|
|
|
|
});
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
function dmmore(tlid) {
|
2019-03-16 21:06:03 +11:00
|
|
|
|
var multi = localStorage.getItem("column");
|
|
|
|
|
var obj = JSON.parse(multi);
|
|
|
|
|
var acct_id = obj[tlid].domain;
|
|
|
|
|
var domain = localStorage.getItem("domain_" + acct_id);
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var sid = $("#timeline_" + tlid + " .cvo")
|
|
|
|
|
.last()
|
|
|
|
|
.attr("unique-id");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var start = "https://" + domain + "/api/v1/conversations?max_id=" + sid;
|
|
|
|
|
var type = "dm";
|
2019-03-16 21:06:03 +11:00
|
|
|
|
fetch(start, {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
method: "GET",
|
2019-03-16 21:06:03 +11:00
|
|
|
|
headers: {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
"content-type": "application/json",
|
|
|
|
|
Authorization: "Bearer " + at
|
2019-10-31 02:30:26 +11:00
|
|
|
|
}
|
2019-03-16 21:06:03 +11:00
|
|
|
|
})
|
2019-11-04 03:10:06 +11:00
|
|
|
|
.then(function(response) {
|
|
|
|
|
if (!response.ok) {
|
|
|
|
|
response.text().then(function(text) {
|
|
|
|
|
setLog(response.url, response.status, text);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return response.json();
|
|
|
|
|
})
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
todo(error);
|
|
|
|
|
setLog(start, "JSON", error);
|
|
|
|
|
console.error(error);
|
|
|
|
|
})
|
|
|
|
|
.then(function(json) {
|
|
|
|
|
var templete = '<div id="convList' + tlid + '">' + dmListParse(json, type, acct_id, tlid, "", mute) + "</div>";
|
|
|
|
|
$("#timeline_" + tlid).append(templete);
|
|
|
|
|
additional(acct_id, tlid);
|
|
|
|
|
jQuery("time.timeago").timeago();
|
|
|
|
|
moreloading = false;
|
|
|
|
|
});
|
2019-03-16 21:06:03 +11:00
|
|
|
|
}
|
2019-03-06 19:08:48 +11:00
|
|
|
|
//DMオブジェクトパーサー(トゥート)
|
2019-03-16 21:06:03 +11:00
|
|
|
|
function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var templete = "";
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (obj[0]) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
localStorage.setItem("lastunix_" + tlid, date(obj[0].created_at, "unix"));
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var actb = localStorage.getItem("action_btns");
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var actb = "re,rt,fav,qt,del,pin,red";
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (actb) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var actb = actb.split(",");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var disp = {};
|
|
|
|
|
for (var k = 0; k < actb.length; k++) {
|
|
|
|
|
if (k < 4) {
|
|
|
|
|
var tp = "type-a";
|
|
|
|
|
} else {
|
|
|
|
|
var tp = "type-b";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
disp[actb[k]] = tp;
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var datetype = localStorage.getItem("datetype");
|
|
|
|
|
var nsfwtype = localStorage.getItem("nsfw");
|
|
|
|
|
var sent = localStorage.getItem("sentence");
|
|
|
|
|
var ltr = localStorage.getItem("letters");
|
|
|
|
|
var gif = localStorage.getItem("gif");
|
|
|
|
|
var imh = localStorage.getItem("img-height");
|
|
|
|
|
//独自ロケール
|
|
|
|
|
var locale = localStorage.getItem("locale");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (locale == "yes") {
|
|
|
|
|
var locale = false;
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//ネイティブ通知
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var native = localStorage.getItem("nativenotf");
|
|
|
|
|
if (!native) {
|
|
|
|
|
native = "yes";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//クライアント強調
|
|
|
|
|
var emp = localStorage.getItem("client_emp");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (emp) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var emp = JSON.parse(emp);
|
|
|
|
|
}
|
|
|
|
|
//クライアントミュート
|
|
|
|
|
var mute = localStorage.getItem("client_mute");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (mute) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var mute = JSON.parse(mute);
|
|
|
|
|
}
|
|
|
|
|
//ユーザー強調
|
|
|
|
|
var useremp = localStorage.getItem("user_emp");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (useremp) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var useremp = JSON.parse(useremp);
|
|
|
|
|
}
|
|
|
|
|
//ワード強調
|
|
|
|
|
var wordemp = localStorage.getItem("word_emp");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (wordemp) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var wordemp = JSON.parse(wordemp);
|
|
|
|
|
}
|
|
|
|
|
//ワードミュート
|
|
|
|
|
var wordmute = localStorage.getItem("word_mute");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (wordmute) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var wordmute = JSON.parse(wordmute);
|
|
|
|
|
wordmute = wordmute.concat(mutefilter);
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
wordmute = mutefilter;
|
|
|
|
|
}
|
|
|
|
|
//Ticker
|
|
|
|
|
var tickerck = localStorage.getItem("ticker_ok");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (tickerck) {
|
|
|
|
|
var ticker = true;
|
|
|
|
|
} else {
|
|
|
|
|
var ticker = false;
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//Cards
|
|
|
|
|
var card = localStorage.getItem("card_" + tlid);
|
2019-05-19 17:39:30 +10:00
|
|
|
|
|
2019-03-06 19:08:48 +11:00
|
|
|
|
if (!sent) {
|
|
|
|
|
var sent = 500;
|
|
|
|
|
}
|
|
|
|
|
if (!ltr) {
|
|
|
|
|
var ltr = 500;
|
|
|
|
|
}
|
|
|
|
|
if (!nsfwtype || nsfwtype == "yes") {
|
|
|
|
|
var nsfw = "ok";
|
|
|
|
|
} else {
|
|
|
|
|
var nsfw;
|
|
|
|
|
}
|
|
|
|
|
var cwtype = localStorage.getItem("cw");
|
|
|
|
|
if (!cwtype || cwtype == "yes") {
|
|
|
|
|
var cw = "ok";
|
|
|
|
|
} else {
|
|
|
|
|
var cw;
|
|
|
|
|
}
|
|
|
|
|
if (!datetype) {
|
|
|
|
|
datetype = "absolute";
|
|
|
|
|
}
|
|
|
|
|
if (!gif) {
|
|
|
|
|
var gif = "yes";
|
|
|
|
|
}
|
|
|
|
|
if (!imh) {
|
|
|
|
|
var imh = "200";
|
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!emp) {
|
|
|
|
|
var emp = [];
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!mute) {
|
|
|
|
|
var mute = [];
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!useremp) {
|
|
|
|
|
var useremp = [];
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!wordemp) {
|
|
|
|
|
var wordemp = [];
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!wordmute) {
|
|
|
|
|
var wordmute = [];
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//via通知
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var viashow = localStorage.getItem("viashow");
|
|
|
|
|
if (!viashow) {
|
|
|
|
|
viashow = "via-hide";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (viashow == "hide") {
|
|
|
|
|
viashow = "via-hide";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//認証なしTL
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (mix == "noauth") {
|
|
|
|
|
var noauth = "hide";
|
|
|
|
|
var antinoauth = "";
|
|
|
|
|
} else {
|
|
|
|
|
var noauth = "";
|
|
|
|
|
var antinoauth = "hide";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//マウスオーバーのみ
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var mouseover = localStorage.getItem("mouseover");
|
|
|
|
|
if (!mouseover) {
|
|
|
|
|
mouseover = "";
|
|
|
|
|
} else if (mouseover == "yes" || mouseover == "click") {
|
|
|
|
|
mouseover = "hide";
|
|
|
|
|
} else if (mouseover == "no") {
|
|
|
|
|
mouseover = "";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
var local = [];
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var times = [];
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(obj).forEach(function(key) {
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var conv_id = obj[key].id;
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var toot = obj[key].last_status;
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var dis_name = escapeHTML(toot.account.display_name);
|
|
|
|
|
if (toot.account.emojis) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var actemojick = toot.account.emojis[0];
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
|
|
|
|
var actemojick = false;
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//絵文字があれば
|
|
|
|
|
if (actemojick) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(toot.account.emojis).forEach(function(key5) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var emoji = toot.account.emojis[key5];
|
|
|
|
|
var shortcode = emoji.shortcode;
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">';
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var regExp = new RegExp(":" + shortcode + ":", "g");
|
|
|
|
|
dis_name = dis_name.replace(regExp, emoji_url);
|
|
|
|
|
});
|
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var noticeavatar = "";
|
|
|
|
|
var if_notf = "";
|
|
|
|
|
var uniqueid = toot.id;
|
|
|
|
|
var notice = "";
|
|
|
|
|
var boostback = "";
|
|
|
|
|
//ユーザー強調
|
|
|
|
|
if (toot.account.username != toot.account.acct) {
|
|
|
|
|
var fullname = toot.account.acct;
|
|
|
|
|
} else {
|
|
|
|
|
var domain = localStorage.getItem("domain_" + acct_id);
|
|
|
|
|
var fullname = toot.account.acct + "@" + domain;
|
|
|
|
|
}
|
|
|
|
|
if (useremp) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(useremp).forEach(function(key10) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var user = useremp[key10];
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (user == fullname) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
boostback = "emphasized";
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var id = toot.id;
|
|
|
|
|
var home = "";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
if (toot.account.locked) {
|
2019-04-13 13:41:58 +10:00
|
|
|
|
var locked = ' <i class="fas fa-lock red-text"></i>';
|
2019-03-06 19:08:48 +11:00
|
|
|
|
} else {
|
|
|
|
|
var locked = "";
|
|
|
|
|
}
|
|
|
|
|
if (!toot.application) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var via = "";
|
2019-05-19 17:39:30 +10:00
|
|
|
|
viashow = "hide";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
} else {
|
2019-04-23 00:16:57 +10:00
|
|
|
|
var via = escapeHTML(toot.application.name);
|
2019-03-06 19:08:48 +11:00
|
|
|
|
//強調チェック
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(emp).forEach(function(key6) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var cli = emp[key6];
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (cli == via) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
boostback = "emphasized";
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//ミュートチェック
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(mute).forEach(function(key7) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var cli = mute[key7];
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (cli == via) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
boostback = "hide";
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (mix == "pinned") {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
boostback = "emphasized";
|
|
|
|
|
}
|
|
|
|
|
if (toot.spoiler_text && cw) {
|
|
|
|
|
var content = toot.content;
|
|
|
|
|
var spoil = escapeHTML(toot.spoiler_text);
|
|
|
|
|
var spoiler = "cw cw_hide_" + toot.id;
|
|
|
|
|
var api_spoil = "gray";
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id + '\')" class="nex parsed">' + lang.lang_parse_cwshow + "</a><br>";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
} else {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var ct1 = toot.content.split("</p>").length + toot.content.split("<br />").length - 2;
|
|
|
|
|
var ct2 = toot.content.split("</p>").length + toot.content.split("<br>").length - 2;
|
|
|
|
|
if (ct1 > ct2) {
|
|
|
|
|
var ct = ct1;
|
|
|
|
|
} else {
|
|
|
|
|
var ct = ct2;
|
|
|
|
|
}
|
2019-03-06 19:08:48 +11:00
|
|
|
|
if ((sent < ct && $.mb_strlen($.strip_tags(toot.content)) > 5) || ($.strip_tags(toot.content).length > ltr && $.mb_strlen($.strip_tags(toot.content)) > 5)) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var content = '<span class="gray">' + lang.lang_parse_fulltext + "</span><br>" + toot.content;
|
|
|
|
|
var spoil = '<span class="cw-long-' + toot.id + '">' + $.mb_substr($.strip_tags(toot.content), 0, 100) + '</span><span class="gray">' + lang.lang_parse_autofold + "</span>";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var spoiler = "cw cw_hide_" + toot.id;
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id + '\')" class="nex parsed">' + lang.lang_parse_more + "</a><br>";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
} else {
|
|
|
|
|
var content = toot.content;
|
|
|
|
|
var spoil = escapeHTML(toot.spoiler_text);
|
|
|
|
|
var spoiler = "";
|
|
|
|
|
var spoiler_show = "";
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var urls = $.strip_tags(content)
|
|
|
|
|
.replace(/\n/g, " ")
|
|
|
|
|
.match(/https?:\/\/([-a-zA-Z0-9@.]+)\/?(?!.*((media|tags)|mentions)).*([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)?/);
|
2019-03-06 19:08:48 +11:00
|
|
|
|
if (urls) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var analyze = "<a onclick=\"additionalIndv('" + tlid + "'," + acct_id + ",'" + id + '\')" class="add-show pointer">' + lang.lang_parse_url + "</a><br>";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
} else {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var analyze = "";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
var viewer = "";
|
|
|
|
|
var hasmedia = "";
|
|
|
|
|
var youtube = "";
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (toot.emojis) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var emojick = toot.emojis[0];
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
|
|
|
|
var emojick = false;
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//絵文字があれば
|
|
|
|
|
if (emojick) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(toot.emojis).forEach(function(key5) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var emoji = toot.emojis[key5];
|
|
|
|
|
var shortcode = emoji.shortcode;
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">';
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var regExp = new RegExp(":" + shortcode + ":", "g");
|
|
|
|
|
content = content.replace(regExp, emoji_url);
|
|
|
|
|
spoil = spoil.replace(regExp, emoji_url);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//ニコフレ絵文字
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (toot.profile_emojis) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var nicoemojick = toot.profile_emojis[0];
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
|
|
|
|
var nicoemojick = false;
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//絵文字があれば
|
|
|
|
|
if (nicoemojick) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(toot.profile_emojis).forEach(function(keynico) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var emoji = toot.profile_emojis[keynico];
|
|
|
|
|
var shortcode = emoji.shortcode;
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">';
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var regExp = new RegExp(":" + shortcode + ":", "g");
|
|
|
|
|
content = content.replace(regExp, emoji_url);
|
|
|
|
|
spoil = spoil.replace(regExp, emoji_url);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//デフォ絵文字
|
2019-05-19 17:39:30 +10:00
|
|
|
|
content = twemoji.parse(content);
|
|
|
|
|
if (dis_name) {
|
|
|
|
|
dis_name = twemoji.parse(dis_name);
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (spoil) {
|
|
|
|
|
spoil = twemoji.parse(spoil);
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
var mediack = toot.media_attachments[0];
|
|
|
|
|
//メディアがあれば
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var media_ids = "";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
if (mediack) {
|
|
|
|
|
hasmedia = "hasmedia";
|
|
|
|
|
var cwdt = 100 / toot.media_attachments.length;
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(toot.media_attachments).forEach(function(key2) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var media = toot.media_attachments[key2];
|
|
|
|
|
var purl = media.preview_url;
|
2019-05-19 17:39:30 +10:00
|
|
|
|
media_ids = media_ids + media.id + ",";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var url = media.url;
|
|
|
|
|
if (toot.sensitive && nsfw) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var sense = "sensitive";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
} else {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var sense = "";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
|
viewer = viewer + "<a onclick=\"imgv('" + id + "','" + key2 + "','" + acct_id + '\')" id="' + id + "-image-" + key2 + '" data-url="' + url + '" data-type="' + media.type + '" class="img-parsed"><img src="' + purl + '" class="' + sense + ' toot-img pointer" style="width:' + cwdt + "%; height:" + imh + 'px;"></a></span>';
|
2019-03-06 19:08:48 +11:00
|
|
|
|
});
|
2019-05-19 17:39:30 +10:00
|
|
|
|
media_ids = media_ids.slice(0, -1);
|
2019-03-06 19:08:48 +11:00
|
|
|
|
} else {
|
|
|
|
|
viewer = "";
|
|
|
|
|
hasmedia = "nomedia";
|
|
|
|
|
}
|
|
|
|
|
var menck = toot.mentions[0];
|
|
|
|
|
var mentions = "";
|
|
|
|
|
//メンションであれば
|
|
|
|
|
if (menck) {
|
|
|
|
|
mentions = "";
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(toot.mentions).forEach(function(key3) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var mention = toot.mentions[key3];
|
2019-11-04 03:10:06 +11:00
|
|
|
|
mentions = mentions + "<a onclick=\"udg('" + mention.id + "'," + acct_id + ')" class="pointer">@' + mention.acct + "</a> ";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
});
|
2019-11-04 03:10:06 +11:00
|
|
|
|
mentions = '<div style="float:right">' + mentions + "</div>";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
var tagck = toot.tags[0];
|
|
|
|
|
var tags = "";
|
|
|
|
|
//タグであれば
|
|
|
|
|
if (tagck) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(toot.tags).forEach(function(key4) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var tag = toot.tags[key4];
|
2019-11-04 03:10:06 +11:00
|
|
|
|
tags = tags + '<span class="hide" data-tag="' + tag.name + '">#' + tag.name + ":<a onclick=\"tl('tag','" + tag.name + "'," + acct_id + ',\'add\')" class="pointer" title="' + lang.lang_parse_tagTL.replace("{{tag}}", "#" + tag.name) + '">TL</a> <a onclick="brInsert(\'#' + tag.name + '\')" class="pointer" title="' + lang.lang_parse_tagtoot.replace("{{tag}}", "#" + tag.name) + '">Toot</a> ' + "<a onclick=\"tagPin('" + tag.name + '\')" class="pointer" title="' + lang.lang_parse_tagpin.replace("{{tag}}", "#" + tag.name) + '">Pin</a></span> ';
|
2019-03-06 19:08:48 +11:00
|
|
|
|
});
|
2019-11-04 03:10:06 +11:00
|
|
|
|
tags = '<div style="float:right">' + tags + "</div>";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//アニメ再生
|
|
|
|
|
if (gif == "yes") {
|
|
|
|
|
var avatar = toot.account.avatar;
|
|
|
|
|
} else {
|
|
|
|
|
var avatar = toot.account.avatar_static;
|
|
|
|
|
}
|
|
|
|
|
//ワードミュート
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (wordmute) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(wordmute).forEach(function(key8) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var worde = wordmute[key8];
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (worde) {
|
|
|
|
|
if (worde.tag) {
|
|
|
|
|
var word = worde.tag;
|
|
|
|
|
} else {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var word = worde;
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var regExp = new RegExp(word, "g");
|
|
|
|
|
if ($.strip_tags(content).match(regExp)) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
boostback = "hide by_filter";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//ワード強調
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (wordemp) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(wordemp).forEach(function(key9) {
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var word = wordemp[key9];
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (word) {
|
|
|
|
|
var word = word.tag;
|
|
|
|
|
var regExp = new RegExp(word, "g");
|
|
|
|
|
content = content.replace(regExp, '<span class="emp">' + escapeHTML(word) + "</span>");
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//日本語じゃない
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (toot.language != "ja") {
|
|
|
|
|
var trans = '<div class="action pin"><a onclick="trans(\'' + toot.language + '\')" class="waves-effect waves-dark btn-flat" style="padding:0" title="' + lang.lang_parse_trans + '"><i class="material-icons">g_translate</i></a></div>';
|
|
|
|
|
} else {
|
|
|
|
|
var trans = "";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-03-16 21:06:03 +11:00
|
|
|
|
if (toot.favourited) {
|
|
|
|
|
var if_fav = " yellow-text";
|
|
|
|
|
var fav_app = "faved";
|
|
|
|
|
} else {
|
|
|
|
|
var if_fav = "";
|
|
|
|
|
var fav_app = "";
|
|
|
|
|
}
|
2019-03-06 19:08:48 +11:00
|
|
|
|
//Cards
|
|
|
|
|
if (!card && toot.card) {
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var cards = toot.card;
|
|
|
|
|
if (cards.provider_name == "Twitter") {
|
|
|
|
|
if (cards.image) {
|
|
|
|
|
var twiImg = '<br><img src="' + cards.image + '">';
|
|
|
|
|
} else {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var twiImg = "";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
|
analyze = '<blockquote class="twitter-tweet"><b>' + escapeHTML(cards.author_name) + "</b><br>" + escapeHTML(cards.description) + twiImg + "</blockquote>";
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
|
|
|
|
if (cards.title) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
analyze = '<span class="gray">URL' + lang.lang_cards_check + ":<br>Title:" + escapeHTML(cards.title) + "<br>" + escapeHTML(cards.description) + "</span>";
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
|
|
|
|
if (cards.html) {
|
|
|
|
|
analyze = cards.html + '<i class="material-icons" onclick="pip(' + id + ')" title="' + lang.lang_cards_pip + '">picture_in_picture_alt</i>';
|
|
|
|
|
}
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//Ticker
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var tickerdom = "";
|
|
|
|
|
if (ticker) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var tickerdata = localStorage.getItem("ticker");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (tickerdata) {
|
|
|
|
|
var tickerdata = JSON.parse(tickerdata);
|
|
|
|
|
|
|
|
|
|
var thisdomain = toot.account.acct.split("@");
|
|
|
|
|
if (thisdomain.length > 1) {
|
|
|
|
|
thisdomain = thisdomain[1];
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
for (var i = 0; i < tickerdata.length; i++) {
|
|
|
|
|
var value = tickerdata[i];
|
|
|
|
|
if (value.domain == thisdomain) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var tickerdom = '<div style="background:linear-gradient(to left,transparent, ' + value.bg + " 96%) !important; color:" + value.text + ';width:100%; height:0.9rem; font-size:0.8rem;"><img src="' + value.image + '" style="height:100%;"><span style="position:relative; top:-0.2rem;"> ' + escapeHTML(value.name) + "</span></div>";
|
2019-05-19 17:39:30 +10:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
|
templete = templete + '<div id="pub_' + toot.id + '" class="cvo ' + boostback + " " + fav_app + " " + hasmedia + '" toot-id="' + id + '" unique-id="' + uniqueid + '" data-medias="' + media_ids + ' " unixtime="' + date(obj[key].created_at, "unix") + '" ' + if_notf + ' onclick="dmStatus()">' + '<div class="area-notice"><span class="gray sharesta">' + notice + home + "</span></div>" + '<div class="area-icon"><a onclick="udg(\'' + toot.account.id + "'," + acct_id + ');" user="' + toot.account.acct + '" class="udg">' + '<img src="' + avatar + '" width="40" class="prof-img" user="' + toot.account.acct + '"></a>' + noticeavatar + "</div>" + '<div class="area-display_name"><div class="flex-name"><span class="user">' + dis_name + '</span><span class="sml gray" style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis; cursor:text;"> @' + toot.account.acct + locked + "</span></div>" + '<div class="flex-time"><span class="cbadge cbadge-hover pointer waves-effect" onclick="tootUriCopy(\'' + toot.url + '\');" title="' + date(toot.created_at, "absolute") + "(" + lang.lang_parse_clickcopyurl + ')"><i class="far fa-clock-o"></i>' + date(toot.created_at, datetype) + "</span>" + "</div></div>" + '<div class="area-toot">' + tickerdom + '<span class="' + api_spoil + " cw_text_" + toot.id + '"><span class="cw_text">' + spoil + "</span>" + spoiler_show + '</span><span class="toot ' + spoiler + '">' + content + "</span>" + "" + viewer + "" + "<br><a onclick=\"details('" + toot.id + "'," + acct_id + ",'" + tlid + "','dm')\" class=\"pointer waves-effect\">" + lang.lang_parse_thread + "</a></div>" + '<div class="area-vis"></div>' + "</div></div>";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
});
|
|
|
|
|
return templete;
|
2019-03-16 21:06:03 +11:00
|
|
|
|
}
|