2018-01-28 23:22:43 +11:00
|
|
|
|
//オブジェクトパーサー(トゥート)
|
2019-03-16 21:06:03 +11:00
|
|
|
|
function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var templete = "";
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (obj[0]) {
|
|
|
|
|
if (tlid === 1) {
|
2018-08-17 03:21:40 +10:00
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
localStorage.setItem("lastunix_" + tlid, date(obj[0].created_at, "unix"));
|
2018-08-17 03:21:40 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var actb = "re,rt,fav,qt,del,pin,red";
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (actb) {
|
2019-10-12 02:18:43 +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";
|
2018-05-02 14:14:03 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
disp[actb[k]] = tp;
|
2018-05-02 14:14:03 +10:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-03-13 02:51:07 +11:00
|
|
|
|
var qt = localStorage.getItem("quote");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (qt == "nothing" || !qt) {
|
|
|
|
|
var qtClass = "hide";
|
|
|
|
|
} else {
|
2019-09-08 02:33:01 +10:00
|
|
|
|
if (qt == "apiQuote") {
|
|
|
|
|
if (localStorage.getItem("quote_" + acct_id)) {
|
|
|
|
|
var qtClass = "";
|
|
|
|
|
} else {
|
|
|
|
|
var qtClass = "hide";
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var qtClass = "";
|
|
|
|
|
}
|
2019-03-13 02:51:07 +11:00
|
|
|
|
}
|
2018-01-28 23:22:43 +11:00
|
|
|
|
var datetype = localStorage.getItem("datetype");
|
|
|
|
|
var nsfwtype = localStorage.getItem("nsfw");
|
|
|
|
|
var sent = localStorage.getItem("sentence");
|
2018-02-24 03:02:44 +11:00
|
|
|
|
var ltr = localStorage.getItem("letters");
|
2018-02-18 18:29:06 +11:00
|
|
|
|
var gif = localStorage.getItem("gif");
|
2018-03-11 01:22:59 +11:00
|
|
|
|
var imh = localStorage.getItem("img-height");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!imh) {
|
|
|
|
|
imh = 200;
|
2019-04-11 02:52:01 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (imh == "full") {
|
|
|
|
|
imh = "auto";
|
|
|
|
|
} else {
|
|
|
|
|
imh = imh + "px";
|
2019-03-22 01:38:15 +11:00
|
|
|
|
}
|
2018-03-27 13:39:35 +11:00
|
|
|
|
//独自ロケール
|
|
|
|
|
var locale = localStorage.getItem("locale");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (locale == "yes") {
|
|
|
|
|
var locale = false;
|
2018-03-27 13:39:35 +11:00
|
|
|
|
}
|
2018-03-31 13:39:06 +11:00
|
|
|
|
//ネイティブ通知
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var native = localStorage.getItem("nativenotf");
|
|
|
|
|
if (!native) {
|
|
|
|
|
native = "yes";
|
2018-03-31 13:39:06 +11:00
|
|
|
|
}
|
2018-03-11 01:22:59 +11:00
|
|
|
|
//クライアント強調
|
2019-06-22 00:17:56 +10:00
|
|
|
|
var empCli = localStorage.getItem("client_emp");
|
|
|
|
|
if (empCli) {
|
|
|
|
|
var empCli = JSON.parse(empCli);
|
2018-03-11 01:22:59 +11:00
|
|
|
|
}
|
|
|
|
|
//クライアントミュート
|
2019-06-22 00:17:56 +10:00
|
|
|
|
var muteCli = localStorage.getItem("client_mute");
|
|
|
|
|
if (muteCli) {
|
|
|
|
|
var muteCli = JSON.parse(muteCli);
|
2018-03-11 01:22:59 +11:00
|
|
|
|
}
|
|
|
|
|
//ユーザー強調
|
|
|
|
|
var useremp = localStorage.getItem("user_emp");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (useremp) {
|
2018-03-11 01:22:59 +11:00
|
|
|
|
var useremp = JSON.parse(useremp);
|
|
|
|
|
}
|
|
|
|
|
//ワード強調
|
2019-06-22 00:17:56 +10:00
|
|
|
|
var wordempList = localStorage.getItem("word_emp");
|
|
|
|
|
if (wordempList) {
|
|
|
|
|
var wordempList = JSON.parse(wordempList);
|
2018-03-11 01:22:59 +11:00
|
|
|
|
}
|
|
|
|
|
//ワードミュート
|
2019-06-22 00:17:56 +10:00
|
|
|
|
var wordmuteList = localStorage.getItem("word_mute");
|
|
|
|
|
if (wordmuteList) {
|
|
|
|
|
var wordmuteList = JSON.parse(wordmuteList);
|
|
|
|
|
if (wordmuteList) {
|
|
|
|
|
wordmuteList = wordmuteList.concat(mutefilter);
|
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
2019-06-22 00:17:56 +10:00
|
|
|
|
wordmuteList = mutefilter;
|
2018-03-11 01:22:59 +11:00
|
|
|
|
}
|
2018-12-09 05:46:01 +11:00
|
|
|
|
//Ticker
|
|
|
|
|
var tickerck = localStorage.getItem("ticker_ok");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (tickerck) {
|
|
|
|
|
var ticker = true;
|
|
|
|
|
} else {
|
|
|
|
|
var ticker = false;
|
2018-12-09 05:46:01 +11:00
|
|
|
|
}
|
2019-03-06 19:08:48 +11:00
|
|
|
|
//Animation
|
|
|
|
|
var anime = localStorage.getItem("animation");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (anime == "yes" || !anime) {
|
|
|
|
|
var animecss = "cvo-anime";
|
|
|
|
|
} else {
|
|
|
|
|
var animecss = "";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2018-12-09 05:46:01 +11:00
|
|
|
|
//Cards
|
|
|
|
|
var card = localStorage.getItem("card_" + tlid);
|
2019-05-19 17:39:30 +10:00
|
|
|
|
|
2018-01-28 23:22:43 +11:00
|
|
|
|
if (!sent) {
|
2019-03-08 05:19:26 +11:00
|
|
|
|
sent = 500;
|
2018-01-28 23:22:43 +11:00
|
|
|
|
}
|
2018-02-26 00:37:04 +11:00
|
|
|
|
if (!ltr) {
|
|
|
|
|
var ltr = 500;
|
|
|
|
|
}
|
2018-01-28 23:22:43 +11:00
|
|
|
|
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";
|
|
|
|
|
}
|
2018-02-24 03:02:44 +11:00
|
|
|
|
if (!gif) {
|
|
|
|
|
var gif = "yes";
|
2018-02-18 18:29:06 +11:00
|
|
|
|
}
|
2018-03-11 01:22:59 +11:00
|
|
|
|
if (!imh) {
|
|
|
|
|
var imh = "200";
|
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!emp) {
|
|
|
|
|
var emp = [];
|
2018-03-11 01:22:59 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!mute) {
|
|
|
|
|
var mute = [];
|
2018-03-11 01:22:59 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!useremp) {
|
|
|
|
|
var useremp = [];
|
2018-03-11 01:22:59 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!wordemp) {
|
|
|
|
|
var wordemp = [];
|
2018-03-11 01:22:59 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!wordmute) {
|
|
|
|
|
var wordmute = [];
|
2018-03-11 01:22:59 +11:00
|
|
|
|
}
|
2018-05-02 14:14:03 +10:00
|
|
|
|
//via通知
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var viashow = localStorage.getItem("viashow");
|
|
|
|
|
if (!viashow) {
|
|
|
|
|
viashow = "via-hide";
|
2018-07-22 23:03:46 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (viashow == "hide") {
|
|
|
|
|
viashow = "via-hide";
|
2018-05-02 14:14:03 +10:00
|
|
|
|
}
|
2018-03-27 13:39:35 +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";
|
2018-03-27 13:39:35 +11:00
|
|
|
|
}
|
2019-03-16 21:06:03 +11:00
|
|
|
|
//DMTL
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (type == "dm") {
|
|
|
|
|
var dmHide = "hide";
|
|
|
|
|
var antidmHide = "";
|
|
|
|
|
} else {
|
|
|
|
|
var dmHide = "";
|
|
|
|
|
var antidmHide = "hide";
|
2019-03-16 21:06:03 +11:00
|
|
|
|
}
|
|
|
|
|
|
2018-05-02 14:14:03 +10: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 = "";
|
2018-05-02 14:14:03 +10:00
|
|
|
|
}
|
2018-09-06 02:47:27 +10:00
|
|
|
|
//リプカウント
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var replyct_view = localStorage.getItem("replyct");
|
|
|
|
|
if (!replyct_view) {
|
|
|
|
|
replyct_view = "hidden";
|
2018-09-06 02:47:27 +10:00
|
|
|
|
}
|
2018-01-28 23:22:43 +11:00
|
|
|
|
var local = [];
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var times = [];
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(obj).forEach(function(key) {
|
2018-01-28 23:22:43 +11:00
|
|
|
|
var toot = obj[key];
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (type == "dm") {
|
|
|
|
|
var dmid = toot.id;
|
|
|
|
|
toot = toot.last_status;
|
2019-03-16 21:06:03 +11:00
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
if (toot.account.display_name) {
|
2019-10-10 01:00:25 +11:00
|
|
|
|
var dis_name = escapeHTML(toot.account.display_name);
|
2019-10-12 02:18:43 +11:00
|
|
|
|
} else {
|
2019-10-10 01:00:25 +11:00
|
|
|
|
var dis_name = toot.account.acct;
|
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (toot.account.emojis) {
|
2018-05-10 01:33:08 +10:00
|
|
|
|
var actemojick = toot.account.emojis[0];
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
|
|
|
|
var actemojick = false;
|
2018-05-10 01:33:08 +10:00
|
|
|
|
}
|
|
|
|
|
//絵文字があれば
|
|
|
|
|
if (actemojick) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(toot.account.emojis).forEach(function(key5) {
|
2018-05-10 01:33:08 +10:00
|
|
|
|
var emoji = toot.account.emojis[key5];
|
|
|
|
|
var shortcode = emoji.shortcode;
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var emoji_url = '<img draggable="false" src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': " title="' + shortcode + '" onclick="this.classList.toggle(\'bigemoji\');">';
|
2018-05-10 01:33:08 +10: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 = "";
|
2018-03-20 15:55:25 +11:00
|
|
|
|
if (mix == "notf") {
|
2018-08-21 04:26:14 +10:00
|
|
|
|
if (gif == "yes") {
|
|
|
|
|
noticeavatar = toot.account.avatar;
|
|
|
|
|
} else {
|
|
|
|
|
noticeavatar = toot.account.avatar_static;
|
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
noticeavatar = "<a onclick=\"udg('" + toot.account.id + "'," + acct_id + ');" user="' + toot.account.acct + '" class="udg">' + '<img draggable="false" src="' + noticeavatar + '" width="20" class="notf-icon prof-img" user="' + toot.account.acct + '"></a>';
|
2018-02-26 00:37:04 +11:00
|
|
|
|
if (toot.type == "mention") {
|
2019-01-26 14:24:26 +11:00
|
|
|
|
var what = lang.lang_parse_mentioned;
|
2018-05-26 02:37:35 +10:00
|
|
|
|
var icon = "fa-share teal-text";
|
2019-05-19 17:39:30 +10:00
|
|
|
|
noticeavatar = "";
|
2018-02-26 00:37:04 +11:00
|
|
|
|
} else if (toot.type == "reblog") {
|
2019-01-26 14:24:26 +11:00
|
|
|
|
var what = lang.lang_parse_bted;
|
2018-05-26 02:37:35 +10:00
|
|
|
|
var icon = "fa-retweet light-blue-text";
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!locale && localStorage.getItem("bt_" + acct_id)) {
|
2018-08-07 01:14:55 +10:00
|
|
|
|
what = localStorage.getItem("bt_" + acct_id);
|
2018-03-27 13:39:35 +11:00
|
|
|
|
}
|
2018-02-26 00:37:04 +11:00
|
|
|
|
} else if (toot.type == "favourite") {
|
2019-01-26 14:24:26 +11:00
|
|
|
|
var what = lang.lang_parse_faved;
|
2018-05-26 02:37:35 +10:00
|
|
|
|
var icon = "fa-star yellow-text";
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!locale && localStorage.getItem("fav_" + acct_id)) {
|
2018-08-07 01:14:55 +10:00
|
|
|
|
what = localStorage.getItem("fav_" + acct_id);
|
2018-03-27 13:39:35 +11:00
|
|
|
|
}
|
2019-04-03 01:42:25 +11:00
|
|
|
|
} else if (toot.type == "poll") {
|
|
|
|
|
var what = lang.lang_parse_polled;
|
|
|
|
|
var icon = "fa-tasks purple-text";
|
2018-02-26 00:37:04 +11:00
|
|
|
|
}
|
2019-06-04 23:41:04 +10:00
|
|
|
|
if (tlid == "notf") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var notfFilHide = "hide";
|
2019-06-04 23:41:04 +10:00
|
|
|
|
} else {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var notfFilHide = "";
|
2019-06-04 23:41:04 +10:00
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var noticetext = '<i class="fas fa-filter pointer big-text ' + notfFilHide + '" onclick="notfFilter(\'' + toot.account.id + "','" + tlid + '\');" title="' + lang.lang_parse_notffilter + '"></i><span class="cbadge cbadge-hover"title="' + date(toot.created_at, "absolute") + "(" + lang.lang_parse_notftime + ')"><i class="far fa-clock"></i>' + date(toot.created_at, datetype) + '</span><i class="big-text fas ' + icon + '"></i><a onclick="udg(\'' + toot.account.id + "','" + acct_id + '\')" class="pointer grey-text">' + dis_name + "(@" + toot.account.acct + ")</a>";
|
2018-02-26 00:37:04 +11:00
|
|
|
|
var notice = noticetext;
|
|
|
|
|
var memory = localStorage.getItem("notice-mem");
|
|
|
|
|
if (popup >= 0 && obj.length < 5 && noticetext != memory) {
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (localStorage.getItem("hasNotfC_" + acct_id) != "true") {
|
2018-08-17 03:21:40 +10:00
|
|
|
|
if (toot.type == "mention") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var replyct = localStorage.getItem("notf-reply_" + acct_id);
|
|
|
|
|
$(".notf-reply_" + acct_id).text(replyct * 1 - -1);
|
|
|
|
|
localStorage.setItem("notf-reply_" + acct_id, replyct * 1 - -1);
|
|
|
|
|
$(".notf-reply_" + acct_id).removeClass("hide");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var sound = localStorage.getItem("replySound");
|
|
|
|
|
if (sound == "default") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var file = "../../source/notif3.wav";
|
2019-04-21 00:40:12 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else if (toot.type == "reblog") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var btct = localStorage.getItem("notf-bt_" + acct_id);
|
|
|
|
|
$(".notf-bt_" + acct_id).text(btct * 1 - -1);
|
|
|
|
|
localStorage.setItem("notf-bt_" + acct_id, btct * 1 - -1);
|
|
|
|
|
$(".notf-bt_" + acct_id).removeClass("hide");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var sound = localStorage.getItem("btSound");
|
|
|
|
|
if (sound == "default") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var file = "../../source/notif2.wav";
|
2019-04-21 00:40:12 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else if (toot.type == "favourite") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var favct = localStorage.getItem("notf-fav_" + acct_id);
|
|
|
|
|
$(".notf-fav_" + acct_id).text(favct * 1 - -1);
|
|
|
|
|
localStorage.setItem("notf-fav_" + acct_id, favct * 1 - -1);
|
|
|
|
|
$(".notf-fav_" + acct_id).removeClass("hide");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var sound = localStorage.getItem("favSound");
|
|
|
|
|
if (sound == "default") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var file = "../../source/notif.wav";
|
2019-04-21 00:40:12 +10:00
|
|
|
|
}
|
2018-08-17 03:21:40 +10:00
|
|
|
|
}
|
2018-07-28 07:25:12 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
|
2018-03-14 05:31:31 +11:00
|
|
|
|
var domain = localStorage.getItem("domain_" + acct_id);
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (popup > 0) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
M.toast({ html: "[" + domain + "]" + escapeHTML(toot.account.display_name) + what, displayLength: popup * 1000 });
|
2018-03-20 15:55:25 +11:00
|
|
|
|
}
|
2019-04-15 01:45:04 +10:00
|
|
|
|
//通知音
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (sound == "c1") {
|
|
|
|
|
var file = localStorage.getItem("custom1");
|
|
|
|
|
} else if (sound == "c2") {
|
|
|
|
|
var file = localStorage.getItem("custom2");
|
|
|
|
|
} else if (sound == "c3") {
|
|
|
|
|
var file = localStorage.getItem("custom3");
|
|
|
|
|
} else if (sound == "c4") {
|
|
|
|
|
var file = localStorage.getItem("custom4");
|
2019-04-15 01:45:04 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (file) {
|
2019-04-15 01:45:04 +10:00
|
|
|
|
request = new XMLHttpRequest();
|
2019-05-19 17:39:30 +10:00
|
|
|
|
request.open("GET", file, true);
|
|
|
|
|
request.responseType = "arraybuffer";
|
|
|
|
|
request.onload = playSound;
|
|
|
|
|
request.send();
|
2019-04-15 01:45:04 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (native == "yes") {
|
2019-06-15 02:25:51 +10:00
|
|
|
|
var os = localStorage.getItem("platform");
|
2018-05-26 05:00:04 +10:00
|
|
|
|
var options = {
|
2019-05-19 17:39:30 +10:00
|
|
|
|
body: toot.account.display_name + "(" + toot.account.acct + ")" + what + "\n\n" + $.strip_tags(toot.status.content),
|
2018-05-26 05:00:04 +10:00
|
|
|
|
icon: toot.account.avatar
|
2019-05-19 17:39:30 +10:00
|
|
|
|
};
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var n = new Notification("TheDesk:" + domain, options);
|
2018-05-26 05:00:04 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (localStorage.getItem("hasNotfC_" + acct_id) != "true") {
|
2018-08-17 03:21:40 +10:00
|
|
|
|
$(".notf-icon_" + acct_id).addClass("red-text");
|
|
|
|
|
}
|
2018-02-26 00:37:04 +11:00
|
|
|
|
localStorage.setItem("notice-mem", noticetext);
|
|
|
|
|
noticetext = "";
|
|
|
|
|
}
|
2019-09-07 02:46:50 +10:00
|
|
|
|
var if_notf = 'data-notfIndv="' + acct_id + "_" + toot.id + '" data-notf="' + toot.id + '"';
|
2018-03-11 01:22:59 +11:00
|
|
|
|
var toot = toot.status;
|
2019-10-12 00:04:14 +11:00
|
|
|
|
var uniqueid = toot.id;
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var dis_name = escapeHTML(toot.account.display_name);
|
|
|
|
|
if (toot.account.emojis) {
|
2018-05-10 01:33:08 +10:00
|
|
|
|
var actemojick = toot.account.emojis[0];
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
|
|
|
|
var actemojick = false;
|
2018-05-10 01:33:08 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
//絵文字があれば
|
|
|
|
|
if (actemojick) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(toot.account.emojis).forEach(function(key5) {
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var emoji = toot.account.emojis[key5];
|
|
|
|
|
var shortcode = emoji.shortcode;
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var emoji_url = '<img draggable="false" src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': " title="' + shortcode + '" onclick="this.classList.toggle(\'bigemoji\');">';
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var regExp = new RegExp(":" + shortcode + ":", "g");
|
|
|
|
|
dis_name = dis_name.replace(regExp, emoji_url);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var if_notf = "";
|
2018-02-26 00:37:04 +11:00
|
|
|
|
if (toot.reblog) {
|
2018-08-21 04:26:14 +10:00
|
|
|
|
if (gif == "yes") {
|
|
|
|
|
noticeavatar = toot.account.avatar;
|
|
|
|
|
} else {
|
|
|
|
|
noticeavatar = toot.account.avatar_static;
|
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
noticeavatar = "<a onclick=\"udg('" + toot.account.id + "'," + acct_id + ');" user="' + toot.account.acct + '" class="notf-icon udg">' + '<img draggable="false" src="' + noticeavatar + '" width="20" class="prof-img" user="' + toot.account.acct + '" onerror="this.src=\'../../img/loading.svg\'"></a>';
|
2019-01-26 14:24:26 +11:00
|
|
|
|
var rebtxt = lang.lang_parse_btedsimple;
|
2018-05-26 02:37:35 +10:00
|
|
|
|
var rticon = "fa-retweet light-blue-text";
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (localStorage.getItem("domain_" + acct_id) == "imastodon.net" && !locale) {
|
2018-03-27 13:39:35 +11:00
|
|
|
|
rebtxt = ":「わかるわ」";
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else if (localStorage.getItem("domain_" + acct_id) == "mstdn.osaka" && !locale) {
|
2018-03-27 13:39:35 +11:00
|
|
|
|
rebtxt = "がしばいた";
|
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var notice = '<i class="big-text fas ' + rticon + '"></i>' + dis_name + "(@" + toot.account.acct + ")<br>";
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var boostback = "shared";
|
|
|
|
|
var uniqueid = toot.id;
|
2018-02-26 00:37:04 +11:00
|
|
|
|
var toot = toot.reblog;
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var dis_name = escapeHTML(toot.account.display_name);
|
2019-08-31 01:09:37 +10:00
|
|
|
|
if (!dis_name) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
dis_name = toot.account.acct;
|
2019-08-21 01:02:29 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (toot.account.emojis) {
|
2018-05-10 02:01:06 +10:00
|
|
|
|
var actemojick = toot.account.emojis[0];
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
|
|
|
|
var actemojick = false;
|
|
|
|
|
}
|
|
|
|
|
//絵文字があれば
|
|
|
|
|
if (actemojick) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(toot.account.emojis).forEach(function(key5) {
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var emoji = toot.account.emojis[key5];
|
|
|
|
|
var shortcode = emoji.shortcode;
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var emoji_url = '<img draggable="false" src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': " title="' + shortcode + '" onclick="this.classList.toggle(\'bigemoji\');">';
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var regExp = new RegExp(":" + shortcode + ":", "g");
|
|
|
|
|
dis_name = dis_name.replace(regExp, emoji_url);
|
|
|
|
|
});
|
2018-05-10 02:01:06 +10:00
|
|
|
|
}
|
2018-02-26 00:37:04 +11:00
|
|
|
|
} else {
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var uniqueid = toot.id;
|
2018-02-26 00:37:04 +11:00
|
|
|
|
var notice = "";
|
2019-03-06 19:08:48 +11:00
|
|
|
|
var boostback = "unshared";
|
2018-03-11 01:22:59 +11:00
|
|
|
|
//ユーザー強調
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (toot.account.username != toot.account.acct) {
|
|
|
|
|
var fullname = toot.account.acct;
|
|
|
|
|
} else {
|
2018-03-11 01:22:59 +11:00
|
|
|
|
var domain = localStorage.getItem("domain_" + acct_id);
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var fullname = toot.account.acct + "@" + domain;
|
2018-03-11 01:22:59 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (useremp) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(useremp).forEach(function(key10) {
|
2019-05-19 17:39:30 +10:00
|
|
|
|
var user = useremp[key10];
|
|
|
|
|
if (user == fullname) {
|
|
|
|
|
boostback = "emphasized";
|
|
|
|
|
}
|
2018-03-11 01:22:59 +11:00
|
|
|
|
});
|
|
|
|
|
}
|
2018-02-26 00:37:04 +11:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-09-14 03:18:33 +10:00
|
|
|
|
if (toot.content == "") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var content = " ";
|
2019-09-14 03:18:33 +10:00
|
|
|
|
} else {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var content = toot.content;
|
2019-09-14 03:18:33 +10:00
|
|
|
|
}
|
|
|
|
|
if (content) {
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var id = toot.id;
|
|
|
|
|
if (mix == "home") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var home = "";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var divider = '<div class="divider"></div>';
|
|
|
|
|
} else {
|
|
|
|
|
var home = "";
|
|
|
|
|
var divider = '<div class="divider"></div>';
|
2019-06-23 11:57:56 +10:00
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (toot.account.locked) {
|
|
|
|
|
var locked = ' <i class="fas fa-lock red-text"></i>';
|
|
|
|
|
} else {
|
|
|
|
|
var locked = "";
|
2019-06-23 11:57:56 +10:00
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (!toot.application) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var via = "";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
viashow = "hide";
|
2018-01-28 23:22:43 +11:00
|
|
|
|
} else {
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var via = escapeHTML(toot.application.name);
|
|
|
|
|
if (empCli) {
|
|
|
|
|
//強調チェック
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(empCli).forEach(function(key6) {
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var empCliList = empCli[key6];
|
|
|
|
|
if (empCliList == via) {
|
|
|
|
|
boostback = "emphasized";
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (muteCli) {
|
|
|
|
|
//ミュートチェック
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(muteCli).forEach(function(key7) {
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var muteCliList = muteCli[key7];
|
|
|
|
|
if (muteCliList == via) {
|
|
|
|
|
boostback = "hide";
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (mix == "pinned") {
|
|
|
|
|
boostback = "emphasized";
|
|
|
|
|
}
|
|
|
|
|
if (toot.spoiler_text && cw) {
|
2018-03-15 06:42:48 +11:00
|
|
|
|
var spoil = escapeHTML(toot.spoiler_text);
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var spoiler = "cw cw_hide_" + toot.id;
|
|
|
|
|
var api_spoil = "gray";
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id + '\')" class="nex parsed cw_btn">' + lang.lang_parse_cwshow + "</a><br>";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
2019-09-14 03:18:33 +10:00
|
|
|
|
if (content) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var ct1 = content.split("</p>").length + content.split("<br />").length - 2;
|
|
|
|
|
var ct2 = content.split("</p>").length + content.split("<br>").length - 2;
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
|
|
|
|
var ct1 = 100;
|
|
|
|
|
var ct2 = 100;
|
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
if (ct1 > ct2) {
|
|
|
|
|
var ct = ct1;
|
|
|
|
|
} else {
|
|
|
|
|
var ct = ct2;
|
|
|
|
|
}
|
2019-09-14 03:18:33 +10:00
|
|
|
|
if ((sent < ct && $.mb_strlen($.strip_tags(content)) > 5) || ($.strip_tags(content).length > ltr && $.mb_strlen($.strip_tags(content)) > 5)) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var content = '<span class="gray">' + lang.lang_parse_fulltext + "</span><br>" + content;
|
|
|
|
|
var spoil = '<span class="cw-long-' + toot.id + '">' + $.mb_substr($.strip_tags(content), 0, 100) + '</span><span class="gray">' + lang.lang_parse_autofold + "</span>";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var spoiler = "cw cw_hide_" + toot.id;
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id + '\')" class="nex parsed cw_btn">' + lang.lang_parse_more + "</a><br>";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
|
|
|
|
var spoil = escapeHTML(toot.spoiler_text);
|
|
|
|
|
var spoiler = "";
|
|
|
|
|
var spoiler_show = "";
|
2019-07-15 01:56:19 +10:00
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var urls = $.strip_tags(content)
|
|
|
|
|
.replace(/\n/g, " ")
|
|
|
|
|
.match(/https?:\/\/([^+_]+)\/?(?!.*((media|tags)|mentions)).*([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)?/);
|
|
|
|
|
urlsck = content.match(/(https?):\/\/([^<>]*?)\/([^"]*)/g);
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (urlsck) {
|
|
|
|
|
for (var urlct = 0; urlct < urlsck.length; urlct++) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var urlindv = urlsck[urlct];
|
|
|
|
|
urlCont = urlindv.match(/(https?):\/\/([^a-zA-Z0-9.-]*?)\.(.+?)\/([^"]*)/);
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (urlCont) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
urlindv = urlindv.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&");
|
|
|
|
|
var encoded = encodeURI(urlCont[4]);
|
|
|
|
|
var punycoded = "xn--" + punycode.encode(urlCont[2]);
|
|
|
|
|
var eUrl = urlCont[1] + "://" + punycoded + "." + urlCont[3] + "/" + encoded;
|
|
|
|
|
var regExp = new RegExp('href="' + urlindv + '"', "g");
|
|
|
|
|
content = content.replace(regExp, 'href="' + eUrl + '"');
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-07-15 01:56:19 +10:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (urls) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var analyze = "<a onclick=\"additionalIndv('" + tlid + "'," + acct_id + ",'" + id + '\')" class="add-show pointer">' + lang.lang_parse_url + "</a><br>";
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var analyze = "";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
var viewer = "";
|
|
|
|
|
var hasmedia = "";
|
|
|
|
|
var youtube = "";
|
|
|
|
|
//Poll
|
|
|
|
|
var poll = "";
|
|
|
|
|
if (toot.poll) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var poll = pollParse(toot.poll, acct_id);
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
2019-08-31 01:09:37 +10:00
|
|
|
|
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var mediack = toot.media_attachments[0];
|
|
|
|
|
//メディアがあれば
|
|
|
|
|
var media_ids = "";
|
|
|
|
|
if (mediack) {
|
|
|
|
|
hasmedia = "hasmedia";
|
|
|
|
|
var cwdt = 100 / toot.media_attachments.length;
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(toot.media_attachments).forEach(function(key2) {
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var media = toot.media_attachments[key2];
|
|
|
|
|
var purl = media.preview_url;
|
|
|
|
|
media_ids = media_ids + media.id + ",";
|
|
|
|
|
var url = media.url;
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var nsfwmes = "";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (toot.sensitive && nsfw) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var sense = "sensitive";
|
|
|
|
|
var blur = media.blurhash;
|
|
|
|
|
nsfwmes = '<div class="nsfw-media">' + lang.lang_parse_nsfw + "</div>";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (blur) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
purl = parseBlur(blur);
|
|
|
|
|
var sense = "";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var sense = "";
|
|
|
|
|
var blur = null;
|
2019-05-07 01:42:06 +10:00
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (media.pleroma && media.pleroma.mime_type.indexOf("video") !== -1) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
viewer = viewer + "<a onclick=\"imgv('" + id + "','" + key2 + "'," + acct_id + ')" id="' + id + "-image-" + key2 + '" data-url="' + url + '" data-type="video" class="img-parsed"><video src="' + purl + '" class="' + sense + ' toot-img pointer" style="max-width:100%;" loop="true"></a></span>';
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
|
|
|
|
if (media.type == "unknown") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var mty = media.remote_url.match(/.+(\..+)$/)[1];
|
|
|
|
|
viewer = viewer + '<a href="' + media.remote_url + '" title="' + media.remote_url + '">[' + lang.lang_parse_unknown + "( " + mty + " )]</a> ";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else if (media.type == "audio") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
viewer = viewer + '<audio src="' + url + '" class="pointer" style="width:100%;" controls></span>';
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
if (media.description) {
|
|
|
|
|
var desc = media.description;
|
|
|
|
|
} else {
|
|
|
|
|
var desc = "";
|
|
|
|
|
}
|
|
|
|
|
viewer = viewer + "<a onclick=\"imgv('" + id + "','" + key2 + "','" + acct_id + '\')" id="' + id + "-image-" + key2 + '" data-url="' + url + '" data-type="' + media.type + '" class="img-parsed img-link" style="width:calc(' + cwdt + "% - 1px); height:" + imh + ';"><img draggable="false" src="' + purl + '" class="' + sense + ' toot-img pointer" onerror="this.src=\'../../img/loading.svg\'" title="' + desc + '">' + nsfwmes + "</a>";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
});
|
|
|
|
|
media_ids = media_ids.slice(0, -1);
|
|
|
|
|
} else {
|
|
|
|
|
viewer = "";
|
|
|
|
|
hasmedia = "nomedia";
|
|
|
|
|
}
|
|
|
|
|
var menck = toot.mentions[0];
|
|
|
|
|
var mentions = "";
|
|
|
|
|
//メンションであれば
|
|
|
|
|
if (menck) {
|
|
|
|
|
mentions = "";
|
|
|
|
|
var to_mention = [];
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(toot.mentions).forEach(function(key3) {
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var mention = toot.mentions[key3];
|
|
|
|
|
//自分は除外
|
|
|
|
|
//自インスタンスかどうかを確認し、IDの一致
|
|
|
|
|
if (mention.acct == mention.username && mention.id == localStorage.getItem("user-id_" + acct_id)) {
|
|
|
|
|
//自分
|
|
|
|
|
} else {
|
|
|
|
|
//そのトゥの人NG
|
|
|
|
|
if (toot.account.acct != mention.acct) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
mentions = mentions + "<a onclick=\"udg('" + mention.id + "'," + acct_id + ')" class="pointer">@' + mention.acct + "</a> ";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
to_mention.push(mention.acct);
|
|
|
|
|
}
|
2019-03-13 02:51:07 +11:00
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
});
|
|
|
|
|
to_mention.push(toot.account.acct);
|
2019-10-12 02:18:43 +11:00
|
|
|
|
mentions = '<div style="float:right">' + mentions + "</div>";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
|
|
|
|
var to_mention = [toot.account.acct];
|
|
|
|
|
//メンションじゃなくてもlang_parse_thread
|
|
|
|
|
if (toot.in_reply_to_id) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
mentions = '<div style="float:right"><a onclick="details(\'' + toot.id + "'," + acct_id + ",'" + tlid + '\')" class="pointer waves-effect">' + lang.lang_parse_thread + "</a></div>";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
2019-08-21 22:51:36 +10:00
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var tagck = toot.tags[0];
|
|
|
|
|
var tags = "";
|
|
|
|
|
//タグであれば
|
|
|
|
|
if (tagck) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(toot.tags).forEach(function(key4) {
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var tag = toot.tags[key4];
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var featured = " <a onclick=\"tagFeature('" + tag.name + "'," + acct_id + ')" class="pointer" title="add it to Featured tags">Feature</a> ';
|
|
|
|
|
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>' + featured + "</span> ";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
});
|
2019-10-12 02:18:43 +11:00
|
|
|
|
tags = '<div style="float:right">' + tags + "</div>";
|
2018-09-06 02:47:27 +10:00
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
//リプ数
|
|
|
|
|
if (toot.replies_count || toot.replies_count === 0) {
|
|
|
|
|
var replyct = toot.replies_count;
|
|
|
|
|
if (replyct_view == "hidden" && replyct > 1) {
|
|
|
|
|
replyct = "1+";
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var replyct = "";
|
|
|
|
|
}
|
|
|
|
|
//公開範囲を取得
|
|
|
|
|
var vis = "";
|
|
|
|
|
var visen = toot.visibility;
|
|
|
|
|
if (visen == "public") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var vis = '<i class="text-darken-3 material-icons gray sml vis-data pointer" title="' + lang.lang_parse_public + "(" + lang.lang_parse_clickcopy + ')" data-vis="public" onclick="staCopy(\'' + id + "')\">public</i>";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var can_rt = "";
|
|
|
|
|
} else if (visen == "unlisted") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var vis = '<i class="text-darken-3 material-icons blue-text vis-data pointer" title="' + lang.lang_parse_unlisted + "(" + lang.lang_parse_clickcopy + ')" data-vis="unlisted" onclick="staCopy(\'' + id + "')\">lock_open</i>";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var can_rt = "";
|
|
|
|
|
} else if (visen == "private") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var vis = '<i class="text-darken-3 material-icons orange-text vis-data pointer" title="' + lang.lang_parse_private + "(" + lang.lang_parse_clickcopy + ')" data-vis="private" onclick="staCopy(\'' + id + "')\">lock</i>";
|
|
|
|
|
|
|
|
|
|
var can_rt = "unvisible";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else if (visen == "direct") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var vis = '<i class="text-darken-3 material-icons red-text vis-data pointer" title="' + lang.lang_parse_direct + "(" + lang.lang_parse_clickcopy + ')" data-vis="direct" onclick="staCopy(\'' + id + "')\">mail</i>";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var can_rt = "unvisible";
|
|
|
|
|
}
|
|
|
|
|
if (toot.account.acct == localStorage.getItem("user_" + acct_id)) {
|
|
|
|
|
var if_mine = "";
|
|
|
|
|
var mine_via = "type-b";
|
2019-10-05 03:23:47 +10:00
|
|
|
|
var can_rt = "";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
|
|
|
|
var if_mine = "hide";
|
|
|
|
|
var mine_via = "";
|
|
|
|
|
}
|
|
|
|
|
if (toot.favourited) {
|
|
|
|
|
var if_fav = " yellow-text";
|
|
|
|
|
var fav_app = "faved";
|
|
|
|
|
} else {
|
|
|
|
|
var if_fav = "";
|
|
|
|
|
var fav_app = "";
|
|
|
|
|
}
|
|
|
|
|
if (toot.reblogged) {
|
|
|
|
|
var if_rt = "light-blue-text";
|
|
|
|
|
var rt_app = "rted";
|
|
|
|
|
} else {
|
|
|
|
|
var if_rt = "";
|
|
|
|
|
var rt_app = "";
|
|
|
|
|
}
|
|
|
|
|
if (toot.pinned) {
|
|
|
|
|
var if_pin = "blue-text";
|
|
|
|
|
var pin_app = "pinnedToot";
|
|
|
|
|
} else {
|
|
|
|
|
var if_pin = "";
|
|
|
|
|
var pin_app = "";
|
|
|
|
|
}
|
|
|
|
|
//アニメ再生
|
|
|
|
|
if (gif == "yes") {
|
|
|
|
|
var avatar = toot.account.avatar;
|
|
|
|
|
} else {
|
|
|
|
|
var avatar = toot.account.avatar_static;
|
|
|
|
|
}
|
|
|
|
|
//ワードミュート
|
|
|
|
|
if (wordmuteList) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(wordmuteList).forEach(function(key8) {
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var worde = wordmuteList[key8];
|
|
|
|
|
if (worde) {
|
|
|
|
|
if (worde.tag) {
|
|
|
|
|
var wordList = worde.tag;
|
|
|
|
|
} else {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var wordList = worde;
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
var regExp = new RegExp(wordList.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
|
|
|
|
|
if ($.strip_tags(content).match(regExp)) {
|
|
|
|
|
boostback = "hide by_filter";
|
|
|
|
|
}
|
2018-07-17 01:39:06 +10:00
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//ワード強調
|
|
|
|
|
if (wordempList) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(wordempList).forEach(function(key9) {
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var wordList = wordempList[key9];
|
|
|
|
|
if (wordList) {
|
|
|
|
|
var wordList = wordList.tag;
|
|
|
|
|
var regExp = new RegExp(wordList.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
|
|
|
|
|
content = content.replace(regExp, '<span class="emp">' + wordList + "</span>");
|
2018-03-11 01:22:59 +11:00
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (toot.emojis) {
|
|
|
|
|
var emojick = toot.emojis[0];
|
|
|
|
|
} else {
|
|
|
|
|
var emojick = false;
|
|
|
|
|
}
|
|
|
|
|
//絵文字があれば
|
|
|
|
|
if (emojick) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(toot.emojis).forEach(function(key5) {
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var emoji = toot.emojis[key5];
|
|
|
|
|
var shortcode = emoji.shortcode;
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var emoji_url = '<img draggable="false" src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': " title="' + shortcode + '" onclick="this.classList.toggle(\'bigemoji\');">';
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var regExp = new RegExp(":" + shortcode + ":", "g");
|
|
|
|
|
content = content.replace(regExp, emoji_url);
|
|
|
|
|
spoil = spoil.replace(regExp, emoji_url);
|
|
|
|
|
poll = poll.replace(regExp, emoji_url);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//ニコフレ絵文字
|
|
|
|
|
if (toot.profile_emojis) {
|
|
|
|
|
var nicoemojick = toot.profile_emojis[0];
|
|
|
|
|
} else {
|
|
|
|
|
var nicoemojick = false;
|
|
|
|
|
}
|
|
|
|
|
//絵文字があれば(nico)
|
|
|
|
|
if (nicoemojick) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(toot.profile_emojis).forEach(function(keynico) {
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var emoji = toot.profile_emojis[keynico];
|
|
|
|
|
var shortcode = emoji.shortcode;
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var emoji_url = '<img draggable="false" src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': " title="' + shortcode + '" onclick="this.classList.toggle(\'bigemoji\');">';
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var regExp = new RegExp(":" + shortcode + ":", "g");
|
|
|
|
|
content = content.replace(regExp, emoji_url);
|
|
|
|
|
spoil = spoil.replace(regExp, emoji_url);
|
|
|
|
|
poll = poll.replace(regExp, emoji_url);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//デフォ絵文字
|
|
|
|
|
content = twemoji.parse(content);
|
|
|
|
|
if (dis_name) {
|
|
|
|
|
dis_name = twemoji.parse(dis_name);
|
|
|
|
|
}
|
|
|
|
|
if (spoil) {
|
|
|
|
|
spoil = twemoji.parse(spoil);
|
|
|
|
|
}
|
|
|
|
|
if (noticetext) {
|
|
|
|
|
noticetext = twemoji.parse(noticetext);
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (notice) {
|
|
|
|
|
notice = twemoji.parse(notice);
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (poll) {
|
|
|
|
|
poll = twemoji.parse(poll);
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
//日本語じゃない
|
|
|
|
|
if (toot.language != lang.language && toot.language) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var trans = '<div class="action pin"><a onclick="trans(\'' + toot.language + "','" + lang.language + '\')" class="waves-effect waves-dark btn-flat actct" style="padding:0" title="' + lang.lang_parse_trans + '"><i class="material-icons">g_translate</i></a></div>';
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
|
|
|
|
var trans = "";
|
|
|
|
|
}
|
|
|
|
|
//Cards
|
|
|
|
|
if (!card && toot.card) {
|
|
|
|
|
var cards = toot.card;
|
|
|
|
|
if (cards.provider_name == "Twitter") {
|
|
|
|
|
if (cards.image) {
|
|
|
|
|
var twiImg = '<br><img draggable="false" src="' + cards.image + '">';
|
|
|
|
|
} else {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var twiImg = "";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
analyze = '<blockquote class="twitter-tweet"><b>' + escapeHTML(cards.author_name) + "</b><br>" + escapeHTML(cards.description) + twiImg + "</blockquote>";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
if (cards.title) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
analyze = '<span class="gray">URL' + lang.lang_cards_check + ":<br>Title:" + escapeHTML(cards.title) + "<br>" + escapeHTML(cards.description) + "</span>";
|
2019-09-08 10:39:26 +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>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//Ticker
|
|
|
|
|
var tickerdom = "";
|
|
|
|
|
if (ticker) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var tickerdata = localStorage.getItem("ticker");
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (tickerdata) {
|
|
|
|
|
var tickerdata = JSON.parse(tickerdata);
|
2019-05-19 17:39:30 +10:00
|
|
|
|
|
2019-09-08 10:39:26 +10:00
|
|
|
|
var thisdomain = toot.account.acct.split("@");
|
|
|
|
|
if (thisdomain.length > 1) {
|
|
|
|
|
thisdomain = thisdomain[1];
|
|
|
|
|
}
|
|
|
|
|
for (var i = 0; i < tickerdata.length; i++) {
|
|
|
|
|
var value = tickerdata[i];
|
|
|
|
|
if (value.domain == thisdomain) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var tickerdom = '<div style="user-select:none;cursor:default;background:linear-gradient(90deg, ' + value.bg + ", transparent 96%) !important; color:" + value.text + ';width:100%; height:0.9rem; font-size:0.8rem;"><img draggable="false" src="' + value.image + '" style="height:100%;" onerror="this.src=\'../../img/loading.svg\'"><span style="position:relative; top:-0.2rem;"> ' + escapeHTML(value.name) + "</span></div>";
|
2019-09-08 10:39:26 +10:00
|
|
|
|
break;
|
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
//Quote
|
|
|
|
|
if (toot.quote) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var quoteUser = toot.quote.account.display_name;
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (!quoteUser) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
quoteUser = toot.quote.account.acct;
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
poll = poll + '<div class="quote-renote"><div class="renote-icon"><a onclick="udg(\'' + toot.quote.account.id + "'," + acct_id + ');" user="' + toot.quote.account.acct + '" class="udg"><img draggable="false" src="' + toot.quote.account.avatar + '"></a>' + '</div><div class="renote-user">' + escapeHTML(quoteUser) + '</div><div class="renote-text">' + toot.quote.content + '</div><div class="renote-details"><a onclick="details(\'' + toot.quote.id + "'," + acct_id + ",'" + tlid + '\',\'normal\')" class="waves-effect waves-dark btn-flat details" style="padding:0"><i class="text-darken-3 material-icons">more_vert</i></a></div></div>';
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
templete = templete + '<div id="pub_' + toot.id + '" class="cvo ' + boostback + " " + fav_app + " " + rt_app + " " + pin_app + " " + hasmedia + " " + animecss + '" toot-id="' + id + '" unique-id="' + uniqueid + '" data-medias="' + media_ids + ' " unixtime="' + date(obj[key].created_at, "unix") + '" ' + if_notf + " onmouseover=\"mov('" + toot.id + "','" + tlid + "','mv')\" onclick=\"mov('" + toot.id + "','" + tlid + "','cl')\" onmouseout=\"resetmv('mv')\">" + '<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 draggable="false" src="' + avatar + '" width="40" class="prof-img" user="' + toot.account.acct + '" onerror="this.src=\'../../img/loading.svg\'"></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"></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>" + poll + "" + viewer + "" + '</div><div class="area-additional"><span class="additional">' + analyze + "</span>" + "" + mentions + tags + "</div>" + '<div class="area-vis">' + vis + "</div>" + '<div class="area-actions ' + mouseover + '">' + '<div class="action ' + antinoauth + '"><a onclick="detEx(\'' + toot.url + '\',\'main\')" class="waves-effect waves-dark details" style="padding:0">' + lang.lang_parse_det + "</a></div>" + '<div class="action ' + antidmHide + '"><a onclick="details(\'' + toot.id + "'," + acct_id + ",'" + tlid + '\',\'normal\')" class="waves-effect waves-dark details" style="padding:0">' + lang.lang_parse_thread + "</a></div>" + '<div class="action ' + disp["re"] + " " + noauth + '"><a onclick="re(\'' + toot.id + "','" + to_mention + "'," + acct_id + ",'" + visen + '\')" class="waves-effect waves-dark btn-flat actct rep-btn" data-men="' + to_mention + '" data-visen="' + visen + '" style="padding:0" title="' + lang.lang_parse_replyto + '"><i class="fas fa-share"></i><span class="rep_ct">' + replyct + "</a></span></a></div>" + '<div class="action ' + can_rt + " " + disp["rt"] + " " + noauth + '"><a onclick="rt(\'' + uniqueid + "'," + acct_id + ",'" + tlid + '\')" class="waves-effect waves-dark btn-flat actct bt-btn" style="padding:0" title="' + lang.lang_parse_bt + '"><i class="fas fa-retweet ' + if_rt + " rt_" + uniqueid + '"></i><span class="rt_ct">' + toot.reblogs_count + "</span></a></div>" + '<div class="action ' + can_rt + " " + disp["qt"] + " " + noauth + " " + qtClass + '"><a onclick="qt(\'' + toot.id + "'," + acct_id + ",'" + toot.account.acct + "','" + toot.url + '\')" class="waves-effect waves-dark btn-flat actct" style="padding:0" title="' + lang.lang_parse_quote + '"><i class="text-darken-3 fas fa-quote-right"></i></a></div>' + '<div class="action ' + disp["fav"] + " " + noauth + '"><a onclick="fav(\'' + uniqueid + "'," + acct_id + ",'" + tlid + '\')" class="waves-effect waves-dark btn-flat actct fav-btn" style="padding:0" title="' + lang.lang_parse_fav + '"><i class="fas text-darken-3 fa-star' + if_fav + " fav_" + uniqueid + '"></i><span class="fav_ct">' + toot.favourites_count + "</a></span></div>" + '<div class="' + if_mine + " action " + disp["del"] + " " + noauth + '"><a onclick="del(\'' + toot.id + "'," + acct_id + ')" class="waves-effect waves-dark btn-flat actct" style="padding:0" title="' + lang.lang_parse_del + '"><i class="fas fa-trash"></i></a>
|
2019-02-27 03:51:37 +11:00
|
|
|
|
}
|
2018-01-28 23:22:43 +11:00
|
|
|
|
});
|
|
|
|
|
if (mix == "mix") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
return [templete, local, times];
|
2018-01-28 23:22:43 +11:00
|
|
|
|
} else {
|
|
|
|
|
return templete;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//オブジェクトパーサー(ユーザーデータ)
|
2018-02-26 02:32:10 +11:00
|
|
|
|
function userparse(obj, auth, acct_id, tlid, popup) {
|
2018-03-27 13:39:35 +11:00
|
|
|
|
//独自ロケール
|
|
|
|
|
var locale = localStorage.getItem("locale");
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (locale == "yes") {
|
|
|
|
|
var locale = false;
|
2018-03-27 13:39:35 +11:00
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var templete = "";
|
2018-02-24 03:02:44 +11:00
|
|
|
|
var datetype = localStorage.getItem("datetype");
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(obj).forEach(function(key) {
|
2018-01-28 23:22:43 +11:00
|
|
|
|
var toot = obj[key];
|
2019-07-26 00:55:25 +10:00
|
|
|
|
if (toot) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
console.log(["Parsing", toot]);
|
2019-07-26 00:55:25 +10:00
|
|
|
|
if (!toot.username) {
|
|
|
|
|
var raw = toot;
|
|
|
|
|
toot = toot.account;
|
|
|
|
|
var notf = true;
|
|
|
|
|
} else {
|
|
|
|
|
var notf = false;
|
2018-09-10 03:06:00 +10:00
|
|
|
|
}
|
2019-09-01 01:02:34 +10:00
|
|
|
|
//Instance Actorって…
|
|
|
|
|
if (toot.username.indexOf(".") < 0) {
|
|
|
|
|
if (toot.locked) {
|
|
|
|
|
var locked = ' <i class="fas fa-lock red-text"></i>';
|
|
|
|
|
} else {
|
|
|
|
|
var locked = "";
|
2019-07-26 00:55:25 +10:00
|
|
|
|
}
|
2019-09-01 01:02:34 +10:00
|
|
|
|
if (auth == "request") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var authhtml = '<i class="material-icons gray pointer" onclick="request(\'' + toot.id + "','authorize'," + acct_id + ')" title="Accept">person_add</i> <i class="material-icons gray pointer" onclick="request(\'' + toot.id + "','reject'," + acct_id + ')" title="Reject">person_add_disabled</i>';
|
2019-09-01 01:02:34 +10:00
|
|
|
|
} else {
|
|
|
|
|
var authhtml = "";
|
|
|
|
|
}
|
|
|
|
|
var ftxt = lang.lang_parse_followed;
|
|
|
|
|
if (!locale && localStorage.getItem("followlocale_" + acct_id)) {
|
|
|
|
|
ftxt = localStorage.getItem("followlocale_" + acct_id);
|
|
|
|
|
}
|
|
|
|
|
if (popup > 0 || popup == -1 || notf) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var notftext = ftxt + "<br>";
|
2019-09-01 01:02:34 +10:00
|
|
|
|
} else {
|
|
|
|
|
var notftext = "";
|
|
|
|
|
}
|
|
|
|
|
var memory = localStorage.getItem("notice-mem");
|
|
|
|
|
if (popup >= 0 && obj.length < 5 && notftext != memory) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
M.toast({ html: escapeHTML(toot.display_name) + ":" + ftxt, displayLength: popup * 1000 });
|
2019-09-01 01:02:34 +10:00
|
|
|
|
$(".notf-icon_" + tlid).addClass("red-text");
|
|
|
|
|
localStorage.setItem("notice-mem", notftext);
|
|
|
|
|
notftext = "";
|
|
|
|
|
var native = localStorage.getItem("nativenotf");
|
|
|
|
|
if (!native) {
|
|
|
|
|
native = "yes";
|
|
|
|
|
}
|
|
|
|
|
if (native == "yes") {
|
|
|
|
|
var os = localStorage.getItem("platform");
|
|
|
|
|
var options = {
|
|
|
|
|
body: toot.display_name + "(" + toot.acct + ")" + ftxt,
|
|
|
|
|
icon: toot.avatar
|
|
|
|
|
};
|
|
|
|
|
var domain = localStorage.getItem("domain_" + acct_id);
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var n = new Notification("TheDesk:" + domain, options);
|
2019-07-26 00:55:25 +10:00
|
|
|
|
}
|
2018-09-10 03:06:00 +10:00
|
|
|
|
}
|
2019-09-01 01:02:34 +10:00
|
|
|
|
if (toot.display_name) {
|
|
|
|
|
var dis_name = escapeHTML(toot.display_name);
|
|
|
|
|
} else {
|
|
|
|
|
var dis_name = toot.username;
|
|
|
|
|
}
|
|
|
|
|
//ネイティブ通知
|
2019-05-19 17:39:30 +10:00
|
|
|
|
|
2019-09-01 01:02:34 +10:00
|
|
|
|
if (toot.emojis) {
|
|
|
|
|
var actemojick = toot.emojis[0];
|
|
|
|
|
} else {
|
|
|
|
|
var actemojick = false;
|
|
|
|
|
}
|
|
|
|
|
//絵文字があれば
|
|
|
|
|
if (actemojick) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(toot.emojis).forEach(function(key5) {
|
2019-09-01 01:02:34 +10:00
|
|
|
|
var emoji = toot.emojis[key5];
|
|
|
|
|
var shortcode = emoji.shortcode;
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var emoji_url = '<img draggable="false" src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': " title="' + shortcode + '" onclick="this.classList.toggle(\'bigemoji\');">';
|
2019-09-01 01:02:34 +10:00
|
|
|
|
var regExp = new RegExp(":" + shortcode + ":", "g");
|
|
|
|
|
dis_name = dis_name.replace(regExp, emoji_url);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (dis_name) {
|
|
|
|
|
dis_name = twemoji.parse(dis_name);
|
|
|
|
|
}
|
|
|
|
|
if (toot.avatar) {
|
|
|
|
|
var avatar = toot.avatar;
|
|
|
|
|
} else {
|
|
|
|
|
var avatar = "../../img/missing.svg";
|
|
|
|
|
}
|
|
|
|
|
if (tlid == "dir" && acct_id == "noauth") {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var udg = "<a onclick=\"udgEx('" + toot.url + "','main');\" user=\"" + toot.acct + '" class="udg">';
|
2019-09-01 01:02:34 +10:00
|
|
|
|
} else {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var udg = "<a onclick=\"udg('" + toot.id + "'," + acct_id + ');" user="' + toot.acct + '" class="udg">';
|
2019-09-01 01:02:34 +10:00
|
|
|
|
}
|
|
|
|
|
var latest = date(toot.last_status_at, "relative");
|
|
|
|
|
if (toot.last_status_at) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var latesthtml = '<div class="cbadge" style="width:100px;">Last: ' + latest + "</div>";
|
2019-09-01 01:02:34 +10:00
|
|
|
|
} else {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var latesthtml = "";
|
2019-09-01 01:02:34 +10:00
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
templete = templete + '<div class="cvo" style="padding-top:5px;" user-id="' + toot.id + '"><div class="area-notice">' + notftext + '</div><div class="area-icon">' + udg + '<img draggable="false" src="' + avatar + '" width="40" class="prof-img" user="' + toot.acct + '" onerror="this.src=\'../../img/loading.svg\'"></a></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;user-select:auto; cursor:text;"> @' + toot.acct + locked + "</span>" + "</div>" + "</div>" + '<div class="area-toot acct-note">' + toot.note.replace(/<br\s?\/?>.+/g, '<span class="gray">...</span>') + "</div>" + '<div style="justify-content:space-around;top:5px" class="area-actions"> <div class="cbadge" style="width:100px;">' + lang.lang_status_follow + ":" + toot.following_count + '</div><div class="cbadge" style="width:100px;">' + lang.lang_status_followers + ":" + toot.followers_count + "</div>" + latesthtml + authhtml + "</div>" + "</div>";
|
2019-08-30 02:46:04 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
2018-01-28 23:22:43 +11:00
|
|
|
|
});
|
|
|
|
|
return templete;
|
|
|
|
|
}
|
2018-03-11 01:22:59 +11:00
|
|
|
|
//クライアントダイアログ
|
|
|
|
|
function client(name) {
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (name != "Unknown") {
|
|
|
|
|
//聞く
|
2019-06-26 01:33:20 +10:00
|
|
|
|
Swal.fire({
|
2019-05-19 17:39:30 +10:00
|
|
|
|
title: lang.lang_parse_clientop,
|
2019-06-26 01:33:20 +10:00
|
|
|
|
text: name + lang.lang_parse_clienttxt,
|
2019-10-12 02:18:43 +11:00
|
|
|
|
type: "info",
|
2019-06-26 01:33:20 +10:00
|
|
|
|
showCancelButton: true,
|
2019-10-12 02:18:43 +11:00
|
|
|
|
confirmButtonColor: "#3085d6",
|
|
|
|
|
cancelButtonColor: "#3085d6",
|
2019-06-26 01:33:20 +10:00
|
|
|
|
confirmButtonText: lang.lang_parse_clientmute,
|
|
|
|
|
cancelButtonText: lang.lang_parse_clientemp,
|
|
|
|
|
showCloseButton: true,
|
2019-10-12 02:18:43 +11:00
|
|
|
|
focusConfirm: false
|
|
|
|
|
}).then(result => {
|
2019-06-26 01:33:20 +10:00
|
|
|
|
if (result.dismiss == "cancel") {
|
|
|
|
|
//Emp
|
|
|
|
|
var cli = localStorage.getItem("client_emp");
|
|
|
|
|
var obj = JSON.parse(cli);
|
|
|
|
|
if (!obj) {
|
|
|
|
|
var obj = [];
|
|
|
|
|
obj.push(name);
|
2019-10-12 02:18:43 +11:00
|
|
|
|
M.toast({ html: escapeHTML(name) + lang.lang_status_emphas, displayLength: 2000 });
|
2019-06-26 01:33:20 +10:00
|
|
|
|
} else {
|
|
|
|
|
var can;
|
2019-10-12 02:18:43 +11:00
|
|
|
|
Object.keys(obj).forEach(function(key) {
|
2019-06-26 01:33:20 +10:00
|
|
|
|
var cliT = obj[key];
|
|
|
|
|
if (cliT != name && !can) {
|
|
|
|
|
can = false;
|
|
|
|
|
} else {
|
|
|
|
|
can = true;
|
|
|
|
|
obj.splice(key, 1);
|
2019-10-12 02:18:43 +11:00
|
|
|
|
M.toast({ html: escapeHTML(name) + lang.lang_status_unemphas, displayLength: 2000 });
|
2019-06-26 01:33:20 +10:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (!can) {
|
|
|
|
|
obj.push(name);
|
2019-10-12 02:18:43 +11:00
|
|
|
|
M.toast({ html: escapeHTML(name) + lang.lang_status_emphas, displayLength: 2000 });
|
2019-06-26 01:33:20 +10:00
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
var json = JSON.stringify(obj);
|
|
|
|
|
localStorage.setItem("client_emp", json);
|
2019-10-12 02:18:43 +11:00
|
|
|
|
parseColumn();
|
2019-06-26 01:33:20 +10:00
|
|
|
|
}
|
|
|
|
|
} else if (result.value) {
|
|
|
|
|
//Mute
|
|
|
|
|
var cli = localStorage.getItem("client_mute");
|
|
|
|
|
var obj = JSON.parse(cli);
|
|
|
|
|
if (!obj) {
|
|
|
|
|
obj = [];
|
|
|
|
|
}
|
|
|
|
|
obj.push(name);
|
|
|
|
|
var json = JSON.stringify(obj);
|
|
|
|
|
localStorage.setItem("client_mute", json);
|
2019-10-12 02:18:43 +11:00
|
|
|
|
M.toast({ html: escapeHTML(name) + lang.lang_parse_mute, displayLength: 2000 });
|
|
|
|
|
parseColumn();
|
2019-06-26 01:33:20 +10:00
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
});
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
2019-09-30 03:23:25 +10:00
|
|
|
|
}
|
|
|
|
|
//Poll Parser
|
|
|
|
|
function pollParse(poll, acct_id) {
|
|
|
|
|
var datetype = localStorage.getItem("datetype");
|
|
|
|
|
var choices = poll.options;
|
|
|
|
|
if (poll.own_votes) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var minechoice = poll.own_votes;
|
2019-09-30 03:23:25 +10:00
|
|
|
|
} else {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var minechoice = [];
|
2019-09-30 03:23:25 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (poll.voted) {
|
|
|
|
|
var myvote = lang.lang_parse_voted;
|
|
|
|
|
var result_hide = "";
|
|
|
|
|
} else if (poll.expired) {
|
|
|
|
|
var myvote = lang.lang_parse_endedvote;
|
|
|
|
|
var result_hide = "";
|
|
|
|
|
} else {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var myvote = "<a onclick=\"voteMastodon('" + acct_id + "','" + poll.id + '\')" class="votebtn">' + lang.lang_parse_vote + "</a><br>";
|
2019-09-30 03:23:25 +10:00
|
|
|
|
if (choices[0].votes_count === 0 || choices[0].votes_count > 0) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
myvote = myvote + "<a onclick=\"showResult('" + acct_id + "','" + poll.id + '\')" class="pointer">' + lang.lang_parse_unvoted + "</a>";
|
2019-09-30 03:23:25 +10:00
|
|
|
|
}
|
|
|
|
|
var result_hide = "hide";
|
|
|
|
|
}
|
|
|
|
|
var ended = date(poll.expires_at, datetype);
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var pollHtml = "";
|
|
|
|
|
Object.keys(choices).forEach(function(keyc) {
|
2019-09-30 03:23:25 +10:00
|
|
|
|
var choice = choices[keyc];
|
|
|
|
|
var voteit = "";
|
|
|
|
|
for (var i = 0; i < minechoice.length; i++) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var me = minechoice[i];
|
2019-09-30 03:23:25 +10:00
|
|
|
|
if (me == keyc) {
|
|
|
|
|
var voteit = "✅";
|
2019-10-12 02:18:43 +11:00
|
|
|
|
break;
|
2019-09-30 03:23:25 +10:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!poll.voted && !poll.expired) {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
var votesel = "voteSelMastodon('" + acct_id + "','" + poll.id + "'," + keyc + "," + poll.multiple + ")";
|
2019-09-30 03:23:25 +10:00
|
|
|
|
var voteclass = "pointer waves-effect waves-light";
|
|
|
|
|
} else {
|
|
|
|
|
var votesel = "";
|
|
|
|
|
var voteclass = "";
|
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
pollHtml = pollHtml + '<div class="' + voteclass + " vote vote_" + acct_id + "_" + poll.id + "_" + keyc + '" onclick="' + votesel + '">' + escapeHTML(choice.title) + '<span class="vote_' + acct_id + "_" + poll.id + "_result " + result_hide + '">(' + choice.votes_count + ")</span>" + voteit + "</div>";
|
2019-09-30 03:23:25 +10:00
|
|
|
|
});
|
2019-10-12 02:18:43 +11:00
|
|
|
|
pollHtml = '<div class="vote_' + acct_id + "_" + poll.id + '">' + pollHtml + myvote + "<a onclick=\"voteMastodonrefresh('" + acct_id + "','" + poll.id + '\')" class="pointer">' + lang.lang_manager_refresh + '</a><span class="cbadge cbadge-hover" title="' + date(poll.expires_at, "absolute") + '"><i class="far fa-calendar-times"></i>' + ended + "</span></div>";
|
|
|
|
|
return pollHtml;
|
|
|
|
|
}
|