//オブジェクトパーサー(トゥート)
function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
var templete = '';
if (obj[0]) {
if (tlid === 1) {
}
localStorage.setItem("lastunix_" + tlid, date(obj[0].created_at, 'unix'));
}
var actb = 're,rt,fav,qt,del,pin,red';
if (actb) {
var actb = actb.split(',');
var disp = {};
for (var k = 0; k < actb.length; k++) {
if (k < 4) {
var tp = "type-a";
} else {
var tp = "type-b";
}
disp[actb[k]] = tp;
}
}
var qt = localStorage.getItem("quote");
if (qt == "nothing" || !qt) {
var qtClass = "hide";
} else {
var qtClass = "";
}
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");
if (!imh) {
imh = 200;
}
if (imh == "full") {
imh = "auto";
} else {
imh = imh + "px";
}
//独自ロケール
var locale = localStorage.getItem("locale");
if (locale == "yes") {
var locale = false;
}
//ネイティブ通知
var native = localStorage.getItem("nativenotf");
if (!native) {
native = "yes";
}
//クライアント強調
var empCli = localStorage.getItem("client_emp");
if (empCli) {
var empCli = JSON.parse(empCli);
}
//クライアントミュート
var muteCli = localStorage.getItem("client_mute");
if (muteCli) {
var muteCli = JSON.parse(muteCli);
}
//ユーザー強調
var useremp = localStorage.getItem("user_emp");
if (useremp) {
var useremp = JSON.parse(useremp);
}
//ワード強調
var wordempList = localStorage.getItem("word_emp");
if (wordempList) {
var wordempList = JSON.parse(wordempList);
}
//ワードミュート
var wordmuteList = localStorage.getItem("word_mute");
if (wordmuteList) {
var wordmuteList = JSON.parse(wordmuteList);
if (wordmuteList) {
wordmuteList = wordmuteList.concat(mutefilter);
}
} else {
wordmuteList = mutefilter;
}
//Ticker
var tickerck = localStorage.getItem("ticker_ok");
if (tickerck) {
var ticker = true;
} else {
var ticker = false;
}
//Animation
var anime = localStorage.getItem("animation");
if (anime == "yes" || !anime) {
var animecss = "cvo-anime";
} else {
var animecss = "";
}
//Cards
var card = localStorage.getItem("card_" + tlid);
if (!sent) {
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";
}
if (!emp) {
var emp = [];
}
if (!mute) {
var mute = [];
}
if (!useremp) {
var useremp = [];
}
if (!wordemp) {
var wordemp = [];
}
if (!wordmute) {
var wordmute = [];
}
//via通知
var viashow = localStorage.getItem("viashow");
if (!viashow) {
viashow = "via-hide";
}
if (viashow == "hide") {
viashow = "via-hide";
}
//認証なしTL
if (mix == "noauth") {
var noauth = "hide";
var antinoauth = "";
} else {
var noauth = "";
var antinoauth = "hide";
}
//DMTL
if (type == "dm") {
var dmHide = "hide";
var antidmHide = "";
} else {
var dmHide = "";
var antidmHide = "hide";
}
//マウスオーバーのみ
var mouseover = localStorage.getItem("mouseover");
if (!mouseover) {
mouseover = "";
} else if (mouseover == "yes" || mouseover == "click") {
mouseover = "hide";
} else if (mouseover == "no") {
mouseover = "";
}
//リプカウント
var replyct_view = localStorage.getItem("replyct");
if (!replyct_view) {
replyct_view = "hidden";
}
var local = [];
var times = [];
Object.keys(obj).forEach(function (key) {
var toot = obj[key];
if (type == "dm") {
var dmid = toot.id;
toot = toot.last_status;
}
var dis_name = escapeHTML(toot.account.display_name);
if (toot.account.emojis) {
var actemojick = toot.account.emojis[0];
} else {
var actemojick = false;
}
//絵文字があれば
if (actemojick) {
Object.keys(toot.account.emojis).forEach(function (key5) {
var emoji = toot.account.emojis[key5];
var shortcode = emoji.shortcode;
var emoji_url = '';
var regExp = new RegExp(":" + shortcode + ":", "g");
dis_name = dis_name.replace(regExp, emoji_url);
});
}
var noticeavatar = "";
if (mix == "notf") {
if (gif == "yes") {
noticeavatar = toot.account.avatar;
} else {
noticeavatar = toot.account.avatar_static;
}
noticeavatar = '' +
'';
if (toot.type == "mention") {
var what = lang.lang_parse_mentioned;
var icon = "fa-share teal-text";
noticeavatar = "";
} else if (toot.type == "reblog") {
var what = lang.lang_parse_bted;
var icon = "fa-retweet light-blue-text";
if (!locale && localStorage.getItem("bt_" + acct_id)) {
what = localStorage.getItem("bt_" + acct_id);
}
} else if (toot.type == "favourite") {
var what = lang.lang_parse_faved;
var icon = "fa-star yellow-text";
if (!locale && localStorage.getItem("fav_" + acct_id)) {
what = localStorage.getItem("fav_" + acct_id);
}
} else if (toot.type == "poll") {
var what = lang.lang_parse_polled;
var icon = "fa-tasks purple-text";
}
if (tlid == "notf") {
var notfFilHide = "hide"
} else {
var notfFilHide = ""
}
var noticetext = '' + date(toot.created_at,
datetype) +
'' + dis_name +
"(@" + toot.account.acct +
")";
var notice = noticetext;
var memory = localStorage.getItem("notice-mem");
if (popup >= 0 && obj.length < 5 && noticetext != memory) {
if (localStorage.getItem("hasNotfC_" + acct_id) != "true") {
if (toot.type == "mention") {
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")
var sound = localStorage.getItem("replySound");
if (sound == "default") {
var file = "../../source/notif3.wav"
}
} else if (toot.type == "reblog") {
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")
var sound = localStorage.getItem("btSound");
if (sound == "default") {
var file = "../../source/notif2.wav"
}
} else if (toot.type == "favourite") {
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")
var sound = localStorage.getItem("favSound");
if (sound == "default") {
var file = "../../source/notif.wav"
}
}
}
var domain = localStorage.getItem("domain_" + acct_id);
if (popup > 0) {
M.toast({ html: "[" + domain + "]" + escapeHTML(toot.account.display_name) + what, displayLength: popup * 1000 })
}
//通知音
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");
}
if (file) {
request = new XMLHttpRequest();
request.open("GET", file, true);
request.responseType = "arraybuffer";
request.onload = playSound;
request.send();
}
if (native == "yes") {
var os = localStorage.getItem("platform");
var options = {
body: toot.account.display_name + "(" + toot.account.acct + ")" + what + "\n\n" + $.strip_tags(toot.status.content),
icon: toot.account.avatar
};
if (os == "darwin") {
var n = new Notification('TheDesk:' + domain, options);
} else {
var nativeNotfOpt = [
'TheDesk:' + domain,
toot.account.display_name + "(" + toot.account.acct + ")" + what + "\n\n" + $.strip_tags(toot.status.content),
toot.account.avatar,
"toot",
acct_id,
toot.status.id
]
postMessage(["nativeNotf", nativeNotfOpt], "*")
}
}
if (localStorage.getItem("hasNotfC_" + acct_id) != "true") {
$(".notf-icon_" + acct_id).addClass("red-text");
}
localStorage.setItem("notice-mem", noticetext);
noticetext = "";
}
var if_notf = 'data-notfIndv="' + acct_id + "_" + toot.id + '"';
var toot = toot.status;
var dis_name = escapeHTML(toot.account.display_name);
if (toot.account.emojis) {
var actemojick = toot.account.emojis[0];
} else {
var actemojick = false;
}
//絵文字があれば
if (actemojick) {
Object.keys(toot.account.emojis).forEach(function (key5) {
var emoji = toot.account.emojis[key5];
var shortcode = emoji.shortcode;
var emoji_url = '';
var regExp = new RegExp(":" + shortcode + ":", "g");
dis_name = dis_name.replace(regExp, emoji_url);
});
}
} else {
var if_notf = "";
if (toot.reblog) {
if (gif == "yes") {
noticeavatar = toot.account.avatar;
} else {
noticeavatar = toot.account.avatar_static;
}
noticeavatar = '' +
'';
var rebtxt = lang.lang_parse_btedsimple;
var rticon = "fa-retweet light-blue-text";
if (localStorage.getItem("domain_" + acct_id) == "imastodon.net" && !locale) {
rebtxt = ":「わかるわ」";
} else if (localStorage.getItem("domain_" + acct_id) == "mstdn.osaka" && !locale) {
rebtxt = "がしばいた";
}
var notice = '' + dis_name + "(@" + toot.account.acct +
")
";
var boostback = "shared";
var uniqueid = toot.id;
var toot = toot.reblog;
var dis_name = escapeHTML(toot.account.display_name);
if (toot.account.emojis) {
var actemojick = toot.account.emojis[0];
} else {
var uniqueid = toot.id;
var actemojick = false;
}
//絵文字があれば
if (actemojick) {
Object.keys(toot.account.emojis).forEach(function (key5) {
var emoji = toot.account.emojis[key5];
var shortcode = emoji.shortcode;
var emoji_url = '';
var regExp = new RegExp(":" + shortcode + ":", "g");
dis_name = dis_name.replace(regExp, emoji_url);
});
}
} else {
var uniqueid = toot.id;
var notice = "";
var boostback = "unshared";
//ユーザー強調
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) {
Object.keys(useremp).forEach(function (key10) {
var user = useremp[key10];
if (user == fullname) {
boostback = "emphasized";
}
});
}
}
}
var id = toot.id;
if (mix == "home") {
var home = ""
var divider = '
' + escapeHTML(cards.author_name) + ''; } if (cards.title) { analyze = "URL" + lang.lang_cards_check + ":
' + escapeHTML(cards.description) + twiImg + '