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) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var domain = localStorage.getItem("domain_" + acct_id)
|
|
|
|
|
var at = localStorage.getItem("acct_" + acct_id + "_at")
|
|
|
|
|
var start = "https://" + domain + "/api/v1/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) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
setLog(response.url, response.status, text)
|
|
|
|
|
})
|
2019-11-04 03:10:06 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
return response.json()
|
2019-11-04 03:10:06 +11:00
|
|
|
|
})
|
|
|
|
|
.catch(function(error) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
todo(error)
|
|
|
|
|
setLog(start, "JSON", error)
|
|
|
|
|
console.error(error)
|
2019-11-04 03:10:06 +11:00
|
|
|
|
})
|
|
|
|
|
.then(function(json) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
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()
|
2019-11-04 03:10:06 +11:00
|
|
|
|
//reload(type, '', acct_id, tlid, data, mute, delc,voice);
|
2020-08-02 17:08:07 +10:00
|
|
|
|
$(window).scrollTop(0)
|
|
|
|
|
})
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
function dmmore(tlid) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var multi = localStorage.getItem("column")
|
|
|
|
|
var obj = JSON.parse(multi)
|
|
|
|
|
var acct_id = obj[tlid].domain
|
|
|
|
|
var domain = localStorage.getItem("domain_" + acct_id)
|
|
|
|
|
var at = localStorage.getItem("acct_" + acct_id + "_at")
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var sid = $("#timeline_" + tlid + " .cvo")
|
|
|
|
|
.last()
|
2020-08-02 17:08:07 +10:00
|
|
|
|
.attr("unique-id")
|
|
|
|
|
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) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
setLog(response.url, response.status, text)
|
|
|
|
|
})
|
2019-11-04 03:10:06 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
return response.json()
|
2019-11-04 03:10:06 +11:00
|
|
|
|
})
|
|
|
|
|
.catch(function(error) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
todo(error)
|
|
|
|
|
setLog(start, "JSON", error)
|
|
|
|
|
console.error(error)
|
2019-11-04 03:10:06 +11:00
|
|
|
|
})
|
|
|
|
|
.then(function(json) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
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) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var templete = ""
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (obj[0]) {
|
2020-08-02 17:08:07 +10: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
|
|
|
|
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var actb = localStorage.getItem("action_btns")
|
|
|
|
|
var actb = "re,rt,fav,qt,del,pin,red"
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (actb) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var actb = actb.split(",")
|
|
|
|
|
var disp = {}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
for (var k = 0; k < actb.length; k++) {
|
|
|
|
|
if (k < 4) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var tp = "type-a"
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var tp = "type-b"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
disp[actb[k]] = tp
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-02 17:08:07 +10: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")
|
2019-03-06 19:08:48 +11:00
|
|
|
|
//独自ロケール
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var locale = localStorage.getItem("locale")
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (locale == "yes") {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var locale = false
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//ネイティブ通知
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var native = localStorage.getItem("nativenotf")
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!native) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
native = "yes"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//クライアント強調
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var emp = localStorage.getItem("client_emp")
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (emp) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var emp = JSON.parse(emp)
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//クライアントミュート
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var mute = localStorage.getItem("client_mute")
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (mute) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var mute = JSON.parse(mute)
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//ユーザー強調
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var useremp = localStorage.getItem("user_emp")
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (useremp) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var useremp = JSON.parse(useremp)
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//ワード強調
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var wordemp = localStorage.getItem("word_emp")
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (wordemp) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var wordemp = JSON.parse(wordemp)
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//ワードミュート
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var wordmute = localStorage.getItem("word_mute")
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (wordmute) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var wordmute = JSON.parse(wordmute)
|
|
|
|
|
wordmute = wordmute.concat(mutefilter)
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
wordmute = mutefilter
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//Ticker
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var tickerck = localStorage.getItem("ticker_ok")
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (tickerck) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var ticker = true
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var ticker = false
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//Cards
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var card = localStorage.getItem("card_" + tlid)
|
2019-05-19 17:39:30 +10:00
|
|
|
|
|
2019-03-06 19:08:48 +11:00
|
|
|
|
if (!sent) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var sent = 500
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
if (!ltr) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var ltr = 500
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
if (!nsfwtype || nsfwtype == "yes") {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var nsfw = "ok"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var nsfw
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var cwtype = localStorage.getItem("cw")
|
2019-03-06 19:08:48 +11:00
|
|
|
|
if (!cwtype || cwtype == "yes") {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var cw = "ok"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var cw
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
if (!datetype) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
datetype = "absolute"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
if (!gif) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var gif = "yes"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
if (!imh) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var imh = "200"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!emp) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var emp = []
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!mute) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var mute = []
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!useremp) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var useremp = []
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!wordemp) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var wordemp = []
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!wordmute) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var wordmute = []
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//via通知
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var viashow = localStorage.getItem("viashow")
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!viashow) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
viashow = "via-hide"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (viashow == "hide") {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
viashow = "via-hide"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//認証なしTL
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (mix == "noauth") {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var noauth = "hide"
|
|
|
|
|
var antinoauth = ""
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var noauth = ""
|
|
|
|
|
var antinoauth = "hide"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//マウスオーバーのみ
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var mouseover = localStorage.getItem("mouseover")
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (!mouseover) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
mouseover = ""
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else if (mouseover == "yes" || mouseover == "click") {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
mouseover = "hide"
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else if (mouseover == "no") {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
mouseover = ""
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var local = []
|
|
|
|
|
var times = []
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(obj).forEach(function(key) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var conv_id = obj[key].id
|
|
|
|
|
var toot = obj[key].last_status
|
|
|
|
|
var dis_name = escapeHTML(toot.account.display_name)
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (toot.account.emojis) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var actemojick = toot.account.emojis[0]
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
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) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var emoji = toot.account.emojis[key5]
|
|
|
|
|
var shortcode = emoji.shortcode
|
|
|
|
|
var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">'
|
|
|
|
|
var regExp = new RegExp(":" + shortcode + ":", "g")
|
|
|
|
|
dis_name = dis_name.replace(regExp, emoji_url)
|
|
|
|
|
})
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var noticeavatar = ""
|
|
|
|
|
var if_notf = ""
|
|
|
|
|
var uniqueid = toot.id
|
|
|
|
|
var notice = ""
|
|
|
|
|
var boostback = ""
|
2019-05-19 17:39:30 +10:00
|
|
|
|
//ユーザー強調
|
|
|
|
|
if (toot.account.username != toot.account.acct) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var fullname = toot.account.acct
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var domain = localStorage.getItem("domain_" + acct_id)
|
|
|
|
|
var fullname = toot.account.acct + "@" + domain
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
|
|
|
|
if (useremp) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(useremp).forEach(function(key10) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var user = useremp[key10]
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (user == fullname) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
boostback = "emphasized"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
})
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var id = toot.id
|
|
|
|
|
var home = ""
|
2019-03-06 19:08:48 +11:00
|
|
|
|
if (toot.account.locked) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var locked = ' <i class="fas fa-lock red-text"></i>'
|
2019-03-06 19:08:48 +11:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var locked = ""
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
if (!toot.application) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var via = ""
|
|
|
|
|
viashow = "hide"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +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) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var cli = emp[key6]
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (cli == via) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
boostback = "emphasized"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
})
|
2019-03-06 19:08:48 +11:00
|
|
|
|
//ミュートチェック
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(mute).forEach(function(key7) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var cli = mute[key7]
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (cli == via) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
boostback = "hide"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
})
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (mix == "pinned") {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
boostback = "emphasized"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
if (toot.spoiler_text && cw) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var content = toot.content
|
|
|
|
|
var spoil = escapeHTML(toot.spoiler_text)
|
|
|
|
|
var spoiler = "cw cw_hide_" + toot.id
|
|
|
|
|
var api_spoil = "gray"
|
|
|
|
|
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 {
|
2020-08-02 17:08:07 +10: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
|
2019-11-04 03:10:06 +11:00
|
|
|
|
if (ct1 > ct2) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var ct = ct1
|
2019-11-04 03:10:06 +11:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var ct = ct2
|
2019-11-04 03:10:06 +11:00
|
|
|
|
}
|
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)) {
|
2020-08-02 17:08:07 +10: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>"
|
|
|
|
|
var spoiler = "cw cw_hide_" + toot.id
|
|
|
|
|
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 {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var content = toot.content
|
|
|
|
|
var spoil = escapeHTML(toot.spoiler_text)
|
|
|
|
|
var spoiler = ""
|
|
|
|
|
var spoiler_show = ""
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
|
var urls = $.strip_tags(content)
|
|
|
|
|
.replace(/\n/g, " ")
|
2020-08-02 17:08:07 +10:00
|
|
|
|
.match(/https?:\/\/([-a-zA-Z0-9@.]+)\/?(?!.*((media|tags)|mentions)).*([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)?/)
|
2019-03-06 19:08:48 +11:00
|
|
|
|
if (urls) {
|
2020-08-02 17:08:07 +10: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 {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var analyze = ""
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var viewer = ""
|
|
|
|
|
var hasmedia = ""
|
|
|
|
|
var youtube = ""
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (toot.emojis) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var emojick = toot.emojis[0]
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
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) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var emoji = toot.emojis[key5]
|
|
|
|
|
var shortcode = emoji.shortcode
|
|
|
|
|
var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">'
|
|
|
|
|
var regExp = new RegExp(":" + shortcode + ":", "g")
|
|
|
|
|
content = content.replace(regExp, emoji_url)
|
|
|
|
|
spoil = spoil.replace(regExp, emoji_url)
|
|
|
|
|
})
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//ニコフレ絵文字
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (toot.profile_emojis) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var nicoemojick = toot.profile_emojis[0]
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
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) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var emoji = toot.profile_emojis[keynico]
|
|
|
|
|
var shortcode = emoji.shortcode
|
|
|
|
|
var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">'
|
|
|
|
|
var regExp = new RegExp(":" + shortcode + ":", "g")
|
|
|
|
|
content = content.replace(regExp, emoji_url)
|
|
|
|
|
spoil = spoil.replace(regExp, emoji_url)
|
|
|
|
|
})
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//デフォ絵文字
|
2020-08-02 17:08:07 +10:00
|
|
|
|
content = twemoji.parse(content)
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (dis_name) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
dis_name = twemoji.parse(dis_name)
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (spoil) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
spoil = twemoji.parse(spoil)
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var mediack = toot.media_attachments[0]
|
2019-03-06 19:08:48 +11:00
|
|
|
|
//メディアがあれば
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var media_ids = ""
|
2019-03-06 19:08:48 +11:00
|
|
|
|
if (mediack) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
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) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var media = toot.media_attachments[key2]
|
|
|
|
|
var purl = media.preview_url
|
|
|
|
|
media_ids = media_ids + media.id + ","
|
|
|
|
|
var url = media.url
|
2019-03-06 19:08:48 +11:00
|
|
|
|
if (toot.sensitive && nsfw) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var sense = "sensitive"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var sense = ""
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10: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>'
|
|
|
|
|
})
|
|
|
|
|
media_ids = media_ids.slice(0, -1)
|
2019-03-06 19:08:48 +11:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
viewer = ""
|
|
|
|
|
hasmedia = "nomedia"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var menck = toot.mentions[0]
|
|
|
|
|
var mentions = ""
|
2019-03-06 19:08:48 +11:00
|
|
|
|
//メンションであれば
|
|
|
|
|
if (menck) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
mentions = ""
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(toot.mentions).forEach(function(key3) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var mention = toot.mentions[key3]
|
|
|
|
|
mentions = mentions + "<a onclick=\"udg('" + mention.id + "'," + acct_id + ')" class="pointer">@' + mention.acct + "</a> "
|
|
|
|
|
})
|
|
|
|
|
mentions = '<div style="float:right">' + mentions + "</div>"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var tagck = toot.tags[0]
|
|
|
|
|
var tags = ""
|
2019-03-06 19:08:48 +11:00
|
|
|
|
//タグであれば
|
|
|
|
|
if (tagck) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(toot.tags).forEach(function(key4) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var tag = toot.tags[key4]
|
|
|
|
|
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> '
|
|
|
|
|
})
|
|
|
|
|
tags = '<div style="float:right">' + tags + "</div>"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//アニメ再生
|
|
|
|
|
if (gif == "yes") {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var avatar = toot.account.avatar
|
2019-03-06 19:08:48 +11:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var avatar = toot.account.avatar_static
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//ワードミュート
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (wordmute) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(wordmute).forEach(function(key8) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var worde = wordmute[key8]
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (worde) {
|
|
|
|
|
if (worde.tag) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var word = worde.tag
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var word = worde
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var regExp = new RegExp(word, "g")
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if ($.strip_tags(content).match(regExp)) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
boostback = "hide by_filter"
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
})
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//ワード強調
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (wordemp) {
|
2019-11-04 03:10:06 +11:00
|
|
|
|
Object.keys(wordemp).forEach(function(key9) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var word = wordemp[key9]
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (word) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
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
|
|
|
|
}
|
2020-08-02 17:08:07 +10:00
|
|
|
|
})
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//日本語じゃない
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (toot.language != "ja") {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
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>'
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var trans = ""
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2019-03-16 21:06:03 +11:00
|
|
|
|
if (toot.favourited) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var if_fav = " yellow-text"
|
|
|
|
|
var fav_app = "faved"
|
2019-03-16 21:06:03 +11:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var if_fav = ""
|
|
|
|
|
var fav_app = ""
|
2019-03-16 21:06:03 +11:00
|
|
|
|
}
|
2019-03-06 19:08:48 +11:00
|
|
|
|
//Cards
|
|
|
|
|
if (!card && toot.card) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var cards = toot.card
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (cards.provider_name == "Twitter") {
|
|
|
|
|
if (cards.image) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var twiImg = '<br><img src="' + cards.image + '">'
|
2019-05-19 17:39:30 +10:00
|
|
|
|
} else {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var twiImg = ""
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10: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) {
|
2020-08-02 17:08:07 +10: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) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
analyze = cards.html + '<i class="material-icons" onclick="pip(' + id + ')" title="' + lang.lang_cards_pip + '">picture_in_picture_alt</i>'
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
|
|
|
|
//Ticker
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var tickerdom = ""
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (ticker) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var tickerdata = localStorage.getItem("ticker")
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (tickerdata) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var tickerdata = JSON.parse(tickerdata)
|
2019-05-19 17:39:30 +10:00
|
|
|
|
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var thisdomain = toot.account.acct.split("@")
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (thisdomain.length > 1) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
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++) {
|
2020-08-02 17:08:07 +10:00
|
|
|
|
var value = tickerdata[i]
|
2019-05-19 17:39:30 +10:00
|
|
|
|
if (value.domain == thisdomain) {
|
2020-08-02 17:08:07 +10: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>"
|
|
|
|
|
break
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-03-06 19:08:48 +11:00
|
|
|
|
}
|
2020-08-02 17:08:07 +10: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>"
|
|
|
|
|
})
|
|
|
|
|
return templete
|
2019-03-16 21:06:03 +11:00
|
|
|
|
}
|