2018-01-28 23:22:43 +11:00
|
|
|
|
//オブジェクトパーサー(トゥート)
|
2021-01-09 23:07:59 +11:00
|
|
|
|
function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
|
2021-06-19 20:16:08 +10:00
|
|
|
|
var splitter = new GraphemeSplitter()
|
|
|
|
|
var templete = ''
|
|
|
|
|
if (obj[0]) {
|
|
|
|
|
if (tlid === 1) {}
|
|
|
|
|
localStorage.setItem('lastunix_' + tlid, date(obj[0].created_at, 'unix'))
|
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
|
2021-06-19 20:16:08 +10:00
|
|
|
|
var actb = 're,rt,fav,qt,bkm'
|
|
|
|
|
if (actb) {
|
|
|
|
|
var actb = actb.split(',')
|
|
|
|
|
var disp = {}
|
|
|
|
|
for (var k = 0; k < actb.length; k++) {
|
|
|
|
|
if (k < 5) {
|
|
|
|
|
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 {
|
|
|
|
|
if (qt == 'apiQuote') {
|
|
|
|
|
if (localStorage.getItem('quote_' + acct_id)) {
|
|
|
|
|
var qtClass = ''
|
|
|
|
|
} else {
|
|
|
|
|
var qtClass = 'hide'
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var qtClass = ''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var bkm = localStorage.getItem('bookmark')
|
|
|
|
|
if (bkm == 'no' || !bkm) {
|
|
|
|
|
var bkmClass = 'hide'
|
|
|
|
|
} else {
|
|
|
|
|
var bkmClass = ''
|
|
|
|
|
}
|
|
|
|
|
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 == 'yes') {
|
|
|
|
|
var ticker = true
|
|
|
|
|
} else if (!ticker || ticker == 'no') {
|
|
|
|
|
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)
|
2019-05-19 17:39:30 +10:00
|
|
|
|
|
2021-06-19 20:16:08 +10:00
|
|
|
|
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 viashowVal = localStorage.getItem('viashow')
|
|
|
|
|
if (viashowVal == 'yes') {
|
|
|
|
|
var viashowSet = true
|
|
|
|
|
} else {
|
|
|
|
|
var viashowSet = false
|
|
|
|
|
}
|
|
|
|
|
var viashow = ''
|
|
|
|
|
//認証なし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'
|
|
|
|
|
}
|
2019-03-16 21:06:03 +11:00
|
|
|
|
|
2021-06-19 20:16:08 +10:00
|
|
|
|
//マウスオーバーのみ
|
|
|
|
|
var mouseover = localStorage.getItem('mouseover')
|
|
|
|
|
if (!mouseover) {
|
|
|
|
|
mouseover = ''
|
|
|
|
|
} else if (mouseover == 'yes' || mouseover == 'click') {
|
|
|
|
|
mouseover = 'hide-actions'
|
|
|
|
|
} else if (mouseover == 'no') {
|
|
|
|
|
mouseover = ''
|
|
|
|
|
}
|
|
|
|
|
//リプカウント
|
|
|
|
|
var replyct_view = localStorage.getItem('replyct')
|
|
|
|
|
if (!replyct_view) {
|
|
|
|
|
replyct_view = 'hidden'
|
|
|
|
|
}
|
|
|
|
|
var local = []
|
|
|
|
|
var times = []
|
|
|
|
|
let content
|
|
|
|
|
for (let key in obj) {
|
|
|
|
|
var domain = localStorage.getItem('domain_' + acct_id)
|
|
|
|
|
var toot = obj[key]
|
|
|
|
|
if (type == 'dm') {
|
|
|
|
|
var dmid = toot.id
|
|
|
|
|
toot = toot.last_status
|
|
|
|
|
}
|
|
|
|
|
if (toot.account.display_name) {
|
|
|
|
|
var dis_name = escapeHTML(toot.account.display_name)
|
|
|
|
|
} else {
|
|
|
|
|
var dis_name = toot.account.acct
|
|
|
|
|
}
|
2019-10-12 02:18:43 +11:00
|
|
|
|
|
2021-06-19 20:16:08 +10:00
|
|
|
|
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
|
|
|
|
|
if (gif == 'yes') {
|
|
|
|
|
var emoSource = emoji.url
|
|
|
|
|
} else {
|
|
|
|
|
var emoSource = emoji.static_url
|
|
|
|
|
}
|
|
|
|
|
var emoji_url = `
|
2019-12-14 12:29:59 +11:00
|
|
|
|
<img draggable="false" src="${emoSource}" class="emoji-img" data-emoji="${shortcode}"
|
2020-09-17 22:42:04 +10:00
|
|
|
|
alt=" :${shortcode}: " title="${shortcode}" onclick="this.classList.toggle('bigemoji');" loading="lazy">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
`
|
2021-06-19 20:16:08 +10:00
|
|
|
|
var regExp = new RegExp(':' + shortcode + ':', 'g')
|
|
|
|
|
dis_name = dis_name.replace(regExp, emoji_url)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
var noticeavatar = ''
|
|
|
|
|
if (mix == 'notf') {
|
|
|
|
|
if (!toot.status) {
|
|
|
|
|
toot.status = statusModel(toot.created_at)
|
|
|
|
|
}
|
|
|
|
|
if (gif == 'yes') {
|
|
|
|
|
noticeavatar = toot.account.avatar
|
|
|
|
|
} else {
|
|
|
|
|
noticeavatar = toot.account.avatar_static
|
|
|
|
|
}
|
|
|
|
|
noticeavatar = `<a onclick="udg('${toot.account.id}','${acct_id}');" user="${toot.account.acct}" class="udg">
|
2020-09-17 22:42:04 +10:00
|
|
|
|
<img draggable="false" src="${noticeavatar}" width="20" class="notf-icon prof-img" user="${toot.account.acct}" alt="" loading="lazy">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
</a>`
|
2021-06-19 20:16:08 +10:00
|
|
|
|
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 = `<span onclick="notfFilter('${toot.account.id}','${tlid}');" class=" pointer big-text ${notfFilHide}"><i class="fas fa-filter"
|
2020-04-22 00:56:04 +10:00
|
|
|
|
title="${lang.lang_parse_notffilter}">
|
|
|
|
|
</i><span class="voice">${lang.lang_parse_notffilter}</span></span>
|
2020-11-28 07:57:11 +11:00
|
|
|
|
<span class="cbadge cbadge-hover" title="${date(toot.created_at, 'absolute')}(${lang.lang_parse_notftime
|
2020-08-02 14:16:31 +10:00
|
|
|
|
})" aria-hidden="true"><i class="far fa-clock"></i>
|
2019-11-09 00:52:54 +11:00
|
|
|
|
${date(toot.created_at, datetype)}
|
|
|
|
|
</span>
|
2020-04-22 00:56:04 +10:00
|
|
|
|
<span class="voice">${date(toot.created_at, 'absolute')}(${lang.lang_parse_notftime})</span>
|
2019-11-09 00:52:54 +11:00
|
|
|
|
<i class="big-text fas ${icon}"></i>
|
2021-04-18 05:28:10 +10:00
|
|
|
|
<a onclick="udg('${toot.account.id}','${acct_id}')" class="pointer grey-text notf-udg-text">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
${dis_name}(@${toot.account.acct})
|
|
|
|
|
</a>`
|
2021-06-19 20:16:08 +10:00
|
|
|
|
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')
|
|
|
|
|
$(`.boxIn[data-acct=${acct_id}] .notice-box`).addClass('has-notf')
|
|
|
|
|
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')
|
|
|
|
|
$(`.boxIn[data-acct=${acct_id}] .notice-box`).addClass('has-notf')
|
|
|
|
|
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')
|
|
|
|
|
$(`.boxIn[data-acct=${acct_id}] .notice-box`).addClass('has-notf')
|
|
|
|
|
var sound = localStorage.getItem('favSound')
|
|
|
|
|
if (sound == 'default') {
|
|
|
|
|
var file = '../../source/notif.wav'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
var n = new Notification('TheDesk:' + domain, options)
|
|
|
|
|
}
|
|
|
|
|
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 + '" data-notf="' + toot.id + '"'
|
|
|
|
|
var toot = toot.status
|
|
|
|
|
var uniqueid = toot.id
|
|
|
|
|
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
|
|
|
|
|
if (gif == 'yes') {
|
|
|
|
|
var emoSource = emoji.url
|
|
|
|
|
} else {
|
|
|
|
|
var emoSource = emoji.static_url
|
|
|
|
|
}
|
|
|
|
|
var emoji_url = `
|
2019-12-14 12:29:59 +11:00
|
|
|
|
<img draggable="false" src="${emoSource}" class="emoji-img" data-emoji="${shortcode}"
|
2020-09-17 22:42:04 +10:00
|
|
|
|
alt=" :${shortcode}: " title="${shortcode}" onclick="this.classList.toggle('bigemoji');" loading="lazy">
|
2019-12-14 12:29:59 +11:00
|
|
|
|
`
|
2021-06-19 20:16:08 +10:00
|
|
|
|
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 = `<a onclick="udg('${toot.account.id}','${acct_id}');" user="${toot.account.acct}" class="udg" aria-hidden="true">
|
2020-06-10 13:09:17 +10:00
|
|
|
|
<img draggable="false" src="${noticeavatar}" width="20" class="notf-icon prof-img"
|
2020-09-17 22:42:04 +10:00
|
|
|
|
user="${toot.account.acct}" onerror="this.src=\'../../img/loading.svg\'" loading="lazy">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
</a>`
|
2021-06-19 20:16:08 +10:00
|
|
|
|
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 =
|
|
|
|
|
'<i class="big-text fas ' +
|
|
|
|
|
rticon +
|
|
|
|
|
'"></i>' +
|
|
|
|
|
dis_name +
|
|
|
|
|
'(@' +
|
|
|
|
|
toot.account.acct +
|
|
|
|
|
')<br>'
|
|
|
|
|
var boostback = 'shared'
|
|
|
|
|
var uniqueid = toot.id
|
|
|
|
|
var toot = toot.reblog
|
|
|
|
|
var dis_name = escapeHTML(toot.account.display_name)
|
|
|
|
|
if (!dis_name) {
|
|
|
|
|
dis_name = toot.account.acct
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
if (gif == 'yes') {
|
|
|
|
|
var emoSource = emoji.url
|
|
|
|
|
} else {
|
|
|
|
|
var emoSource = emoji.static_url
|
|
|
|
|
}
|
|
|
|
|
var emoji_url = `
|
2019-12-14 12:29:59 +11:00
|
|
|
|
<img draggable="false" src="${emoSource}" class="emoji-img" data-emoji="${shortcode}"
|
2020-09-17 22:42:04 +10:00
|
|
|
|
alt=" :${shortcode}: " title="${shortcode}" onclick="this.classList.toggle('bigemoji');" loading="lazy">
|
2019-12-14 12:29:59 +11:00
|
|
|
|
`
|
2021-06-19 20:16:08 +10:00
|
|
|
|
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'
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (toot.content == '') {
|
|
|
|
|
content = ' '
|
|
|
|
|
} else {
|
|
|
|
|
content = toot.content
|
|
|
|
|
}
|
|
|
|
|
if (content) {
|
|
|
|
|
var id = toot.id
|
|
|
|
|
if (mix == 'home') {
|
|
|
|
|
var home = ''
|
|
|
|
|
var divider = '<div class="divider"></div>'
|
|
|
|
|
} else {
|
|
|
|
|
var home = ''
|
|
|
|
|
var divider = '<div class="divider"></div>'
|
|
|
|
|
}
|
|
|
|
|
if (toot.account.locked) {
|
|
|
|
|
var locked = ' <i class="fas fa-lock red-text"></i>'
|
|
|
|
|
} else {
|
|
|
|
|
var locked = ''
|
|
|
|
|
}
|
|
|
|
|
if (!toot.application) {
|
|
|
|
|
var via = ''
|
|
|
|
|
viashow = 'hide'
|
|
|
|
|
} else {
|
|
|
|
|
if (viashowSet) {
|
|
|
|
|
viashow = ''
|
|
|
|
|
} else {
|
|
|
|
|
viashow = 'hide'
|
|
|
|
|
}
|
|
|
|
|
var via = escapeHTML(toot.application.name)
|
|
|
|
|
if (empCli) {
|
|
|
|
|
//強調チェック
|
|
|
|
|
Object.keys(empCli).forEach(function(key6) {
|
|
|
|
|
var empCliList = empCli[key6]
|
|
|
|
|
if (empCliList == via) {
|
|
|
|
|
boostback = 'emphasized'
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if (muteCli) {
|
|
|
|
|
//ミュートチェック
|
|
|
|
|
Object.keys(muteCli).forEach(function(key7) {
|
|
|
|
|
var muteCliList = muteCli[key7]
|
|
|
|
|
if (muteCliList == via) {
|
|
|
|
|
boostback = 'hide'
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (mix == 'pinned') {
|
|
|
|
|
boostback = 'emphasized'
|
|
|
|
|
}
|
|
|
|
|
if (toot.spoiler_text && cw) {
|
|
|
|
|
var spoil = escapeHTML(toot.spoiler_text)
|
|
|
|
|
var spoiler = 'cw cw_hide'
|
|
|
|
|
var api_spoil = 'gray'
|
|
|
|
|
var spoiler_show = `<a href="#" onclick="cw_show(this)" class="nex parsed cw_btn">${lang.lang_parse_cwshow}<span class="voice">${lang.lang_parse_cwshow_acc}</span></a><br>`
|
|
|
|
|
} else {
|
|
|
|
|
if (content) {
|
|
|
|
|
var ct1 = content.split('</p>').length + content.split('<br />').length - 2
|
|
|
|
|
var ct2 = content.split('</p>').length + content.split('<br>').length - 2
|
|
|
|
|
} else {
|
|
|
|
|
var ct1 = 100
|
|
|
|
|
var ct2 = 100
|
|
|
|
|
}
|
|
|
|
|
if (ct1 > ct2) {
|
|
|
|
|
var ct = ct1
|
|
|
|
|
} else {
|
|
|
|
|
var ct = ct2
|
|
|
|
|
}
|
2019-11-11 03:20:51 +11:00
|
|
|
|
|
2021-06-19 20:16:08 +10:00
|
|
|
|
if (
|
|
|
|
|
(sent < ct && $.mb_strlen($.strip_tags(content)) > 5) ||
|
|
|
|
|
($.mb_strlen($.strip_tags(content)) > ltr && $.mb_strlen($.strip_tags(content)) > 5)
|
|
|
|
|
) {
|
|
|
|
|
content = `<span class="gray">${lang.lang_parse_fulltext}</span><br>` + content
|
|
|
|
|
var spoil = `<span class="cw_long">${$.mb_substr(
|
2019-11-09 00:52:54 +11:00
|
|
|
|
$.strip_tags(content),
|
|
|
|
|
0,
|
|
|
|
|
100
|
|
|
|
|
)}</span>
|
|
|
|
|
<span class="gray">${lang.lang_parse_autofold}</span>`
|
2021-06-19 20:16:08 +10:00
|
|
|
|
var spoiler = 'cw cw_hide'
|
|
|
|
|
var spoiler_show = `<a href="#" onclick="cw_show(this)" class="nex parsed cw_btn">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
${lang.lang_parse_more}
|
|
|
|
|
</a><br>`
|
2021-06-19 20:16:08 +10:00
|
|
|
|
} else {
|
|
|
|
|
var spoil = escapeHTML(toot.spoiler_text)
|
|
|
|
|
var spoiler = ''
|
|
|
|
|
var spoiler_show = ''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var urls = $.strip_tags(content)
|
|
|
|
|
.replace(/\n/g, ' ')
|
|
|
|
|
.match(
|
|
|
|
|
/https?:\/\/([^+_]+)\/?(?!.*((media|tags)|mentions)).*([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)?/
|
|
|
|
|
)
|
|
|
|
|
urlsck = content.match(/(https?):\/\/([^<>]*?)\/([^"]*)/g)
|
|
|
|
|
content = content.replace(/href="([^"]+)"/g, `href="$1" data-acct="${acct_id}"`)
|
|
|
|
|
if (urlsck) {
|
|
|
|
|
for (var urlct = 0; urlct < urlsck.length; urlct++) {
|
|
|
|
|
var urlindv = urlsck[urlct]
|
|
|
|
|
urlCont = urlindv.match(/(https?):\/\/([^a-zA-Z0-9.-]*?)\.(.+?)\/([^"]*)/)
|
|
|
|
|
if (urlCont) {
|
|
|
|
|
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}"`)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (urls) {
|
|
|
|
|
var analyze = `<a onclick="additionalIndv('${tlid}','${acct_id}','${id}')" class="add-show pointer" aria-hidden="true">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
${lang.lang_parse_url}
|
|
|
|
|
</a><br>`
|
2021-06-19 20:16:08 +10:00
|
|
|
|
} else {
|
|
|
|
|
var analyze = ''
|
|
|
|
|
}
|
|
|
|
|
var viewer = ''
|
|
|
|
|
var hasmedia = ''
|
|
|
|
|
var youtube = ''
|
|
|
|
|
//Poll
|
|
|
|
|
var poll = ''
|
|
|
|
|
if (toot.poll) {
|
|
|
|
|
var poll = pollParse(toot.poll, acct_id, false)
|
|
|
|
|
}
|
2019-08-31 01:09:37 +10:00
|
|
|
|
|
2021-06-19 20:16:08 +10:00
|
|
|
|
var mediack = toot.media_attachments[0]
|
|
|
|
|
//メディアがあれば
|
|
|
|
|
var media_ids = ''
|
|
|
|
|
if (mediack) {
|
|
|
|
|
hasmedia = 'hasmedia'
|
|
|
|
|
var cwdt = 100 / toot.media_attachments.length
|
|
|
|
|
Object.keys(toot.media_attachments).forEach(function(key2) {
|
|
|
|
|
var media = toot.media_attachments[key2]
|
|
|
|
|
var purl = media.preview_url
|
|
|
|
|
media_ids = media_ids + media.id + ','
|
|
|
|
|
var url = media.url
|
|
|
|
|
var remote_url = media.remote_url
|
|
|
|
|
var nsfwmes = ''
|
|
|
|
|
if (toot.sensitive && nsfw) {
|
|
|
|
|
var sense = 'sensitive'
|
|
|
|
|
var blur = media.blurhash
|
|
|
|
|
nsfwmes = '<div class="nsfw-media">' + lang.lang_parse_nsfw + '</div>'
|
|
|
|
|
if (blur) {
|
|
|
|
|
purl = parseBlur(blur)
|
|
|
|
|
var sense = ''
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var sense = ''
|
|
|
|
|
var blur = null
|
|
|
|
|
}
|
|
|
|
|
if (media.pleroma && media.pleroma.mime_type.indexOf('video') !== -1) {
|
|
|
|
|
viewer =
|
|
|
|
|
viewer +
|
2021-12-03 02:14:15 +11:00
|
|
|
|
`<a onclick="imgv('${id}','${key2}','${acct_id}')" id="${id}-image-${key2}"
|
2019-11-09 00:52:54 +11:00
|
|
|
|
data-url="${url}" data-type="video" class="img-parsed">
|
2020-04-22 00:56:04 +10:00
|
|
|
|
<video src="${purl}" class="${sense} toot-img pointer" style="max-width:100%;" loop="true" alt="attached media">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
</a></span>`
|
2021-06-19 20:16:08 +10:00
|
|
|
|
} else {
|
|
|
|
|
if (media.type == 'unknown') {
|
|
|
|
|
var mty = media.remote_url.match(/.+(\..+)$/)[1]
|
|
|
|
|
viewer =
|
|
|
|
|
viewer +
|
|
|
|
|
`<a href="${media.url ? media.url : media.remote_url}" title="${media.url ? media.url : media.remote_url}">[${lang.lang_parse_unknown}(${mty})]</a>${media.url ? `<a href="${media.remote_url}"><i class="material-icons sublink" title="${media.remote_url}">open_in_new</i></a>` : ''} `
|
2019-11-09 00:52:54 +11:00
|
|
|
|
} else if (media.type == 'audio') {
|
|
|
|
|
viewer =
|
|
|
|
|
viewer +
|
|
|
|
|
'<audio src="' +
|
|
|
|
|
url +
|
2020-04-22 00:56:04 +10:00
|
|
|
|
'" class="pointer" style="width:100%;" controls alt="attached media"></span>'
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
2019-10-12 02:18:43 +11:00
|
|
|
|
if (media.description) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var desc = media.description
|
2019-10-12 02:18:43 +11:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var desc = ''
|
|
|
|
|
}
|
|
|
|
|
console.log('https://' + domain + '/storage/no-preview.png')
|
|
|
|
|
if (media.preview_url == 'https://' + domain + '/storage/no-preview.png') {
|
|
|
|
|
purl = url
|
|
|
|
|
nsfwmes = '<div class="nsfw-media">Unavailable preview</div>'
|
2019-10-12 02:18:43 +11:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
viewer =
|
|
|
|
|
viewer +
|
|
|
|
|
`<a onclick="imgv('${id}','${key2}','${acct_id}')"
|
2019-11-09 01:46:12 +11:00
|
|
|
|
id="${id}-image-${key2}" data-url="${url}" data-original="${remote_url}" data-type="${media.type}"
|
2019-11-09 00:52:54 +11:00
|
|
|
|
class="img-parsed img-link" style="width:calc(${cwdt}% - 1px); height:${imh};">
|
|
|
|
|
<img draggable="false" src="${purl}" class="${sense} toot-img pointer"
|
2020-09-17 22:42:04 +10:00
|
|
|
|
onerror="this.src=\'../../img/loading.svg\'" title="${escapeHTML(desc)}" alt="${escapeHTML(desc)}" loading="lazy">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
${nsfwmes}
|
|
|
|
|
</a>`
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
})
|
|
|
|
|
media_ids = media_ids.slice(0, -1)
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
viewer = ''
|
|
|
|
|
hasmedia = 'nomedia'
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var menck = toot.mentions[0]
|
|
|
|
|
var mentions = ''
|
2019-09-08 10:39:26 +10:00
|
|
|
|
//メンションであれば
|
|
|
|
|
if (menck) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
mentions = ''
|
|
|
|
|
var to_mention = []
|
2020-08-02 14:16:31 +10:00
|
|
|
|
Object.keys(toot.mentions).forEach(function (key3) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var mention = toot.mentions[key3]
|
2019-09-08 10:39:26 +10:00
|
|
|
|
//自分は除外
|
|
|
|
|
//自インスタンスかどうかを確認し、IDの一致
|
2019-11-09 00:52:54 +11:00
|
|
|
|
if (
|
|
|
|
|
mention.acct == mention.username &&
|
|
|
|
|
mention.id == localStorage.getItem('user-id_' + acct_id)
|
|
|
|
|
) {
|
2019-09-08 10:39:26 +10:00
|
|
|
|
//自分
|
|
|
|
|
} else {
|
|
|
|
|
//そのトゥの人NG
|
|
|
|
|
if (toot.account.acct != mention.acct) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
mentions =
|
|
|
|
|
mentions +
|
2020-04-22 00:56:04 +10:00
|
|
|
|
`<a onclick="udg('${mention.id}',' ${acct_id}')" class="pointer" aria-hidden="true">@${mention.acct}</a> `
|
2019-11-09 00:52:54 +11:00
|
|
|
|
to_mention.push(mention.acct)
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
2019-03-13 02:51:07 +11:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
})
|
|
|
|
|
to_mention.push(toot.account.acct)
|
|
|
|
|
mentions = '<div style="float:right">' + mentions + '</div>'
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var to_mention = [toot.account.acct]
|
2019-11-14 03:42:09 +11:00
|
|
|
|
}
|
|
|
|
|
//メンションじゃなくてもlang_parse_thread
|
|
|
|
|
if (toot.in_reply_to_id) {
|
|
|
|
|
mentions = `<div style="float:right">
|
|
|
|
|
<a onclick="details('${toot.id}','${acct_id}','${tlid}')" class="pointer waves-effect">
|
|
|
|
|
${lang.lang_parse_thread}
|
|
|
|
|
</a></div>`
|
2019-08-21 22:51:36 +10:00
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
//リプ数
|
|
|
|
|
if (toot.replies_count || toot.replies_count === 0) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var replyct = toot.replies_count
|
|
|
|
|
if (replyct_view == 'hidden' && replyct > 1) {
|
|
|
|
|
replyct = '1+'
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var replyct = ''
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
//公開範囲を取得
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var vis = ''
|
|
|
|
|
var visen = toot.visibility
|
|
|
|
|
if (visen == 'public') {
|
2020-04-22 00:56:04 +10:00
|
|
|
|
var vis = `<span onclick="staCopy('${id}')"><i class="text-darken-3 material-icons gray sml vis-data pointer"
|
|
|
|
|
title="${lang.lang_parse_public}(${lang.lang_parse_clickcopy})" data-vis="public" aria-hidden="true">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
public
|
2020-04-22 00:56:04 +10:00
|
|
|
|
</i><span class="voice">${lang.lang_parse_public} ${lang.lang_toot}(${lang.lang_parse_clickcopy})</span></span>`
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var can_rt = ''
|
|
|
|
|
} else if (visen == 'unlisted') {
|
2020-04-22 00:56:04 +10:00
|
|
|
|
var vis = `<span onclick="staCopy('${id}')"><i class="text-darken-3 material-icons blue-text sml vis-data pointer"
|
|
|
|
|
title="${lang.lang_parse_unlisted}(${lang.lang_parse_clickcopy})" data-vis="public" aria-hidden="true">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
lock_open
|
2020-04-22 00:56:04 +10:00
|
|
|
|
</i><span class="voice">${lang.lang_parse_unlisted} ${lang.lang_toot}(${lang.lang_parse_clickcopy})</span></span>`
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var can_rt = ''
|
|
|
|
|
} else if (visen == 'private') {
|
2020-04-22 00:56:04 +10:00
|
|
|
|
var vis = `<span onclick="staCopy('${id}')"><i class="text-darken-3 material-icons orange-text sml vis-data pointer"
|
|
|
|
|
title="${lang.lang_parse_private}(${lang.lang_parse_clickcopy})" data-vis="public" aria-hidden="true">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
lock
|
2020-04-22 00:56:04 +10:00
|
|
|
|
</i><span class="voice">${lang.lang_parse_private} ${lang.lang_toot}(${lang.lang_parse_clickcopy})</span></span>`
|
2019-10-12 02:18:43 +11:00
|
|
|
|
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var can_rt = 'unvisible'
|
|
|
|
|
} else if (visen == 'direct') {
|
2020-04-22 00:56:04 +10:00
|
|
|
|
var vis = `<span onclick="staCopy('${id}')"><i class="text-darken-3 material-icons red-text sml vis-data pointer"
|
|
|
|
|
title="${lang.lang_parse_direct}(${lang.lang_parse_clickcopy})" data-vis="public" aria-hidden="true">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
mail
|
2020-04-22 00:56:04 +10:00
|
|
|
|
</i><span class="voice">${lang.lang_parse_direct} ${lang.lang_toot}(${lang.lang_parse_clickcopy})</span></span>`
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var can_rt = 'unvisible'
|
|
|
|
|
}
|
|
|
|
|
if (toot.account.acct == localStorage.getItem('user_' + acct_id)) {
|
|
|
|
|
var if_mine = ''
|
2019-11-16 05:42:23 +11:00
|
|
|
|
var mine_via = ''
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var can_rt = ''
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var if_mine = 'hide'
|
|
|
|
|
var mine_via = ''
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
if (toot.favourited) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var if_fav = ' yellow-text'
|
|
|
|
|
var fav_app = 'faved'
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var if_fav = ''
|
|
|
|
|
var fav_app = ''
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
if (toot.reblogged) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var if_rt = 'light-blue-text'
|
|
|
|
|
var rt_app = 'rted'
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var if_rt = ''
|
|
|
|
|
var rt_app = ''
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
if (toot.pinned) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var if_pin = 'blue-text'
|
|
|
|
|
var pin_app = 'pinnedToot'
|
2019-11-16 05:42:23 +11:00
|
|
|
|
var pinStr = lang.lang_parse_unpin
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var if_pin = ''
|
|
|
|
|
var pin_app = ''
|
2019-11-16 05:42:23 +11:00
|
|
|
|
var pinStr = lang.lang_parse_pin
|
|
|
|
|
}
|
|
|
|
|
if (toot.bookmarked) {
|
|
|
|
|
var if_bkm = 'red-text'
|
|
|
|
|
var bkm_app = 'bkmed'
|
|
|
|
|
var bkmStr = lang.lang_parse_unbookmark
|
|
|
|
|
} else {
|
|
|
|
|
var if_bkm = ''
|
|
|
|
|
var bkm_app = ''
|
|
|
|
|
var bkmStr = lang.lang_parse_bookmark
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
//アニメ再生
|
2019-11-09 00:52:54 +11:00
|
|
|
|
if (gif == 'yes') {
|
|
|
|
|
var avatar = toot.account.avatar
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var avatar = toot.account.avatar_static
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
//ワードミュート
|
|
|
|
|
if (wordmuteList) {
|
2020-08-02 14:16:31 +10:00
|
|
|
|
Object.keys(wordmuteList).forEach(function (key8) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var worde = wordmuteList[key8]
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (worde) {
|
|
|
|
|
if (worde.tag) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var wordList = worde.tag
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var wordList = worde
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var regExp = new RegExp(wordList.replace(/[.*+?^=!:${}()|[\]\/\\]/g, '\\$&'), 'g')
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if ($.strip_tags(content).match(regExp)) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
boostback = 'hide by_filter'
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
2018-07-17 01:39:06 +10:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
})
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
//ワード強調
|
|
|
|
|
if (wordempList) {
|
2020-08-02 14:16:31 +10:00
|
|
|
|
Object.keys(wordempList).forEach(function (key9) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var wordList = wordempList[key9]
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (wordList) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
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-11-09 00:52:54 +11:00
|
|
|
|
})
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
if (toot.emojis) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var emojick = toot.emojis[0]
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var emojick = false
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
//絵文字があれば
|
|
|
|
|
if (emojick) {
|
2020-08-02 14:16:31 +10:00
|
|
|
|
Object.keys(toot.emojis).forEach(function (key5) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var emoji = toot.emojis[key5]
|
|
|
|
|
var shortcode = emoji.shortcode
|
2019-12-14 12:29:59 +11:00
|
|
|
|
if (gif == 'yes') {
|
|
|
|
|
var emoSource = emoji.url
|
|
|
|
|
} else {
|
|
|
|
|
var emoSource = emoji.static_url
|
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var emoji_url = `
|
2019-12-14 12:29:59 +11:00
|
|
|
|
<img draggable="false" src="${emoSource}" class="emoji-img" data-emoji="${shortcode}"
|
2020-09-17 22:42:04 +10:00
|
|
|
|
alt=" :${shortcode}: " title="${shortcode}" onclick="this.classList.toggle('bigemoji');" loading="lazy">
|
2019-12-14 12:29:59 +11:00
|
|
|
|
`
|
2019-11-09 00:52:54 +11: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)
|
|
|
|
|
})
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
//ニコフレ絵文字
|
|
|
|
|
if (toot.profile_emojis) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var nicoemojick = toot.profile_emojis[0]
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var nicoemojick = false
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
//絵文字があれば(nico)
|
|
|
|
|
if (nicoemojick) {
|
2020-08-02 14:16:31 +10:00
|
|
|
|
Object.keys(toot.profile_emojis).forEach(function (keynico) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var emoji = toot.profile_emojis[keynico]
|
|
|
|
|
var shortcode = emoji.shortcode
|
|
|
|
|
var emoji_url = `<img draggable="false" src="${emoji.url}" class="emoji-img" data-emoji="${shortcode}" alt=" :${shortcode}: "
|
2020-09-17 22:42:04 +10:00
|
|
|
|
title="${shortcode}" onclick="this.classList.toggle(\'bigemoji\');" loading="lazy">`
|
2019-11-09 00:52:54 +11: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)
|
|
|
|
|
})
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
//デフォ絵文字
|
2019-11-09 00:52:54 +11:00
|
|
|
|
content = twemoji.parse(content)
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (dis_name) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
dis_name = twemoji.parse(dis_name)
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
if (spoil) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
spoil = twemoji.parse(spoil)
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
if (noticetext) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
noticetext = twemoji.parse(noticetext)
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (notice) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
notice = twemoji.parse(notice)
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (poll) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
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) {
|
2020-09-07 17:36:25 +10:00
|
|
|
|
var trans = `<li onclick="trans('${toot.language}','${lang.language}', $(this))"
|
2021-04-18 05:28:10 +10:00
|
|
|
|
style="padding:0; padding-top: 5px;">
|
2020-04-22 00:56:04 +10:00
|
|
|
|
<i class="material-icons" aria-hidden="true">g_translate</i>${lang.lang_parse_trans}
|
2020-09-07 17:36:25 +10:00
|
|
|
|
</li>`
|
2019-09-08 10:39:26 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var trans = ''
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
//Cards
|
|
|
|
|
if (!card && toot.card) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var cards = toot.card
|
2019-11-14 04:42:06 +11:00
|
|
|
|
analyze = cardHtml(cards, acct_id, id)
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
//Ticker
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var tickerdom = ''
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (ticker) {
|
2020-08-02 14:16:31 +10:00
|
|
|
|
var tickerdata = localStorage.getItem('sticker')
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (tickerdata) {
|
2020-08-02 14:16:31 +10:00
|
|
|
|
var tickerdataRaw = JSON.parse(tickerdata)
|
|
|
|
|
var tickerdata = tickerdataRaw.data
|
2019-05-19 17:39:30 +10:00
|
|
|
|
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var thisdomain = toot.account.acct.split('@')
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (thisdomain.length > 1) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
thisdomain = thisdomain[1]
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
|
|
|
|
for (var i = 0; i < tickerdata.length; i++) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var value = tickerdata[i]
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (value.domain == thisdomain) {
|
2020-08-02 14:16:31 +10:00
|
|
|
|
var bgColor = value.bgColor
|
|
|
|
|
var fontColor = value.fontColor
|
|
|
|
|
if (!value.bgColor || !value.fontColor) {
|
|
|
|
|
if (value.type == 'mastodon') {
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (!value.bgColor) bgColor = tickerdataRaw.default.mastodon.bgColor
|
|
|
|
|
if (!value.fontColor) fontColor = tickerdataRaw.default.mastodon.fontColor
|
2020-08-02 14:16:31 +10:00
|
|
|
|
} else if (value.type == 'pleroma') {
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (!value.bgColor) bgColor = tickerdataRaw.default.pleroma.bgColor
|
|
|
|
|
if (!value.fontColor) fontColor = tickerdataRaw.default.pleroma.fontColor
|
2020-08-02 14:16:31 +10:00
|
|
|
|
} else if (value.type == 'misskey') {
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (!value.bgColor) bgColor = tickerdataRaw.default.misskey.bgColor
|
|
|
|
|
if (!value.fontColor) fontColor = tickerdataRaw.default.misskey.fontColor
|
2020-08-02 14:16:31 +10:00
|
|
|
|
} else if (value.type == 'misskeylegacy') {
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (!value.bgColor) bgColor = tickerdataRaw.default.misskeylegacy.bgColor
|
|
|
|
|
if (!value.fontColor) fontColor = tickerdataRaw.default.misskeylegacy.fontColor
|
2020-08-02 14:16:31 +10:00
|
|
|
|
} else if (value.type == 'pixelfed') {
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (!value.bgColor) bgColor = tickerdataRaw.default.pixelfed.bgColor
|
|
|
|
|
if (!value.fontColor) fontColor = tickerdataRaw.default.pixelfed.fontColor
|
2020-08-02 14:16:31 +10:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var bgColor = value.bgColor
|
|
|
|
|
var fontColor = value.fontColor
|
|
|
|
|
}
|
|
|
|
|
bgColorCSS = ''
|
|
|
|
|
for (let j = 0; j < bgColor.length; j++) {
|
|
|
|
|
const bg = bgColor[j]
|
|
|
|
|
bgColorCSS = bgColorCSS + bg + ','
|
|
|
|
|
}
|
|
|
|
|
bgColorCSS = `linear-gradient(90deg, ${bgColorCSS} transparent)`
|
2020-11-28 07:57:11 +11:00
|
|
|
|
var tickerdom = `<div aria-hidden="true" style="user-select:none;cursor:default;background:${bgColorCSS} !important; color:${fontColor
|
2020-08-02 14:16:31 +10:00
|
|
|
|
};width:100%; height:0.9rem; font-size:0.8rem;" class="tickers">
|
2020-11-28 07:57:11 +11:00
|
|
|
|
<img draggable="false" src="${value.favicon
|
2020-09-17 22:42:04 +10:00
|
|
|
|
}" style="height:100%;" onerror="this.src=\'../../img/loading.svg\'" loading="lazy">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
<span style="position:relative; top:-0.2rem;">${escapeHTML(value.name)}</span>
|
|
|
|
|
</div>`
|
|
|
|
|
break
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-09-08 10:39:26 +10:00
|
|
|
|
//Quote
|
|
|
|
|
if (toot.quote) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var quoteUser = toot.quote.account.display_name
|
2019-09-08 10:39:26 +10:00
|
|
|
|
if (!quoteUser) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
quoteUser = toot.quote.account.acct
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
2020-08-02 14:16:31 +10:00
|
|
|
|
if (!toot.quote.quote_muted) {
|
2020-06-13 02:46:26 +10:00
|
|
|
|
poll =
|
2020-08-02 14:16:31 +10:00
|
|
|
|
poll +
|
|
|
|
|
`<div class="quote-renote">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
<div class="renote-icon">
|
2020-11-28 07:57:11 +11:00
|
|
|
|
<a onclick="udg('${toot.quote.account.id}','${acct_id}');" user="${toot.quote.account.acct
|
2020-08-02 14:16:31 +10:00
|
|
|
|
}" class="udg">
|
2020-09-17 22:42:04 +10:00
|
|
|
|
<img draggable="false" src="${toot.quote.account.avatar}" loading="lazy">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="renote-user">
|
|
|
|
|
${escapeHTML(quoteUser)}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="renote-text">
|
|
|
|
|
${toot.quote.content}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="renote-details">
|
2020-11-28 07:57:11 +11:00
|
|
|
|
<a onclick="details('${toot.quote.id
|
2020-08-02 14:16:31 +10:00
|
|
|
|
}','${acct_id}','${tlid}','normal')" class="waves-effect waves-dark btn-flat details" style="padding:0">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
<i class="text-darken-3 material-icons">more_vert</i>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>`
|
2020-06-13 02:46:26 +10:00
|
|
|
|
} else {
|
|
|
|
|
poll =
|
2020-08-02 14:16:31 +10:00
|
|
|
|
poll +
|
|
|
|
|
`<span class="gray sml">${lang.lang_parse_hidden}</span>`
|
2020-06-13 02:46:26 +10:00
|
|
|
|
}
|
2020-08-02 14:16:31 +10:00
|
|
|
|
|
2019-09-08 10:39:26 +10:00
|
|
|
|
}
|
2019-11-16 05:42:23 +11:00
|
|
|
|
//menuは何個?
|
2019-11-16 06:58:37 +11:00
|
|
|
|
var menuct = 2
|
2019-11-16 05:42:23 +11:00
|
|
|
|
if (viashow != 'hide') {
|
|
|
|
|
menuct++
|
|
|
|
|
}
|
|
|
|
|
if (if_mine != 'hide') {
|
|
|
|
|
menuct = menuct + 3
|
|
|
|
|
}
|
|
|
|
|
if (noauth == 'hide') {
|
|
|
|
|
menuct = 0
|
|
|
|
|
}
|
|
|
|
|
if (trans != '') {
|
|
|
|
|
menuct++
|
|
|
|
|
}
|
2020-11-28 07:57:11 +11:00
|
|
|
|
//このトゥート内のアクションを完了させるために、適当にIDを振る
|
2021-07-11 13:27:41 +10:00
|
|
|
|
var rand = makeCID()
|
2020-11-28 07:57:11 +11:00
|
|
|
|
//プラグイン機構
|
2021-01-09 17:47:20 +11:00
|
|
|
|
var pluginBOT = plugins.buttonOnToot
|
2020-11-28 07:57:11 +11:00
|
|
|
|
var pluginHtml = ''
|
2021-01-09 17:47:20 +11:00
|
|
|
|
for (let target of pluginBOT) {
|
2021-04-02 12:56:01 +11:00
|
|
|
|
const meta = getMeta(target.content).data
|
2020-11-28 07:57:11 +11:00
|
|
|
|
pluginHtml = pluginHtml + `<li><a onclick="execPlugin('${target.id}','buttonOnToot',{id: '${uniqueid}', acct_id: '${acct_id}'});">${escapeHTML(meta.name)}</a></li>`
|
|
|
|
|
}
|
2021-01-09 23:07:59 +11:00
|
|
|
|
|
2019-11-09 00:52:54 +11:00
|
|
|
|
templete =
|
|
|
|
|
templete +
|
|
|
|
|
`<div
|
|
|
|
|
id="pub_${toot.id}"
|
2019-11-16 05:42:23 +11:00
|
|
|
|
class="cvo ${mouseover} ${boostback} ${fav_app} ${rt_app} ${pin_app} ${bkm_app} ${hasmedia} ${animecss}"
|
2019-11-09 00:52:54 +11:00
|
|
|
|
toot-id="${id}" unique-id="${uniqueid}" data-medias="${media_ids}" unixtime="${date(
|
|
|
|
|
obj[key].created_at,
|
|
|
|
|
'unix'
|
|
|
|
|
)}"
|
|
|
|
|
${if_notf}
|
2020-11-28 07:57:11 +11:00
|
|
|
|
onmouseover="mov('${uniqueid}','${tlid}','mv', '${rand}', this)"
|
|
|
|
|
onclick="mov('${uniqueid}','${tlid}','cl', '${rand}', this)"
|
2019-11-09 00:52:54 +11:00
|
|
|
|
onmouseout="resetmv('mv')"
|
|
|
|
|
>
|
2019-11-16 05:42:23 +11:00
|
|
|
|
<div class="area-notice grid"><span class="gray sharesta">${notice}${home}</span></div>
|
|
|
|
|
<div class="area-icon grid">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
<a onclick="udg('${toot.account.id}','${acct_id}');" user="${toot.account.acct}" class="udg">
|
|
|
|
|
<img draggable="false" src="${avatar}" width="40" class="prof-img"
|
2020-09-17 22:42:04 +10:00
|
|
|
|
user="${toot.account.acct}" onerror="this.src='../../img/loading.svg'" alt="" loading="lazy" />
|
2019-11-09 00:52:54 +11:00
|
|
|
|
</a>
|
|
|
|
|
${noticeavatar}
|
|
|
|
|
</div>
|
2019-11-16 05:42:23 +11:00
|
|
|
|
<div class="area-display_name grid">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
<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})">
|
2020-04-22 00:56:04 +10:00
|
|
|
|
<i class="far fa-clock"></i><span class="voice">posted at </span>${date(toot.created_at, datetype)}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-11-16 05:42:23 +11:00
|
|
|
|
<div class="area-toot grid">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
${tickerdom}
|
|
|
|
|
<span class="${api_spoil} cw_text_${toot.id}">
|
|
|
|
|
<span class="cw_text">${spoil}</span>
|
|
|
|
|
${spoiler_show}
|
|
|
|
|
</span>
|
|
|
|
|
<div class="toot ${spoiler}">${content}</div>
|
|
|
|
|
${poll}${viewer}
|
|
|
|
|
</div>
|
2019-11-16 05:42:23 +11:00
|
|
|
|
<div class="area-additional grid">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
<span class="additional">${analyze}</span>
|
2021-04-18 17:14:41 +10:00
|
|
|
|
${mentions}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
</div>
|
2019-11-16 05:42:23 +11:00
|
|
|
|
<div class="area-vis grid">${vis}</div>
|
|
|
|
|
<div class="area-actions grid">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
<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}">
|
2022-09-28 18:27:41 +10:00
|
|
|
|
<a onclick="re('${toot.id}','${to_mention}','${acct_id}','${visen}','${escapeHTML(toot.spoiler_text).replaceAll('\n','')}')"
|
2019-11-09 00:52:54 +11:00
|
|
|
|
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>
|
2020-04-22 00:56:04 +10:00
|
|
|
|
<span class="voice">${lang.lang_parse_replyto} </span>
|
2019-11-09 00:52:54 +11:00
|
|
|
|
<span class="rep_ct">${replyct}</span>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="action ${can_rt} ${disp['rt']} ${noauth}">
|
2020-11-28 07:57:11 +11:00
|
|
|
|
<a onclick="rt('${toot.id
|
2020-08-02 14:16:31 +10:00
|
|
|
|
}','${acct_id}','${tlid}')" class="waves-effect waves-dark btn-flat actct bt-btn"
|
2019-11-09 00:52:54 +11:00
|
|
|
|
style="padding:0" title="${lang.lang_parse_bt}">
|
2019-12-15 01:41:35 +11:00
|
|
|
|
<i class="fas fa-retweet ${if_rt} rt_${toot.id}"></i>
|
2020-04-22 00:56:04 +10:00
|
|
|
|
<span class="voice">${lang.lang_parse_bt} </span>
|
2019-11-09 00:52:54 +11:00
|
|
|
|
<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>
|
2020-04-22 00:56:04 +10:00
|
|
|
|
<span class="voice">${lang.lang_parse_quote} </span>
|
2019-11-09 00:52:54 +11:00
|
|
|
|
</a>
|
|
|
|
|
</div>
|
2019-11-16 05:42:23 +11:00
|
|
|
|
<div class="action ${disp['bkm']} ${noauth} ${bkmClass}">
|
|
|
|
|
<a onclick="bkm('${toot.id}','${acct_id}','${tlid}')"
|
|
|
|
|
class="waves-effect waves-dark btn-flat actct bkm-btn" style="padding:0"
|
|
|
|
|
title="${lang.lang_parse_bookmark}">
|
|
|
|
|
<i class="fas text-darken-3 fa-bookmark bkm_${toot.id} ${if_bkm}"></i>
|
2020-04-22 00:56:04 +10:00
|
|
|
|
<span class="voice">${lang.lang_parse_bookmark} </span>
|
2019-11-16 05:42:23 +11:00
|
|
|
|
</a>
|
|
|
|
|
</div>
|
2019-11-09 00:52:54 +11:00
|
|
|
|
<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}</span>
|
2020-04-22 00:56:04 +10:00
|
|
|
|
<span class="voice">${lang.lang_parse_fav} </span>
|
2019-11-09 00:52:54 +11:00
|
|
|
|
</a>
|
|
|
|
|
</div>
|
2019-11-16 05:42:23 +11:00
|
|
|
|
</div>
|
|
|
|
|
<div class="area-side">
|
|
|
|
|
<div class="action ${noauth}">
|
2020-11-28 07:57:11 +11:00
|
|
|
|
<a onclick="toggleAction(this)" data-target="dropdown_${rand}"
|
|
|
|
|
class="ctxMenu waves-effect waves-dark btn-flat" style="padding:0" id="trigger_${rand}">
|
2020-04-22 00:56:04 +10:00
|
|
|
|
<i class="text-darken-3 material-icons act-icon" aria-hidden="true">expand_more</i>
|
|
|
|
|
<span class="voice">Other actions</span>
|
2019-11-09 00:52:54 +11:00
|
|
|
|
</a>
|
|
|
|
|
</div>
|
2019-11-16 05:42:23 +11:00
|
|
|
|
<div class="action ${noauth}">
|
|
|
|
|
<a onclick="details('${toot.id}','${acct_id}','${tlid}','normal')"
|
2019-11-16 15:40:35 +11:00
|
|
|
|
class="waves-effect waves-dark btn-flat details ${dmHide}" style="padding:0"
|
|
|
|
|
title="${lang.lang_parse_detail}">
|
2020-04-22 00:56:04 +10:00
|
|
|
|
<i class="text-darken-3 material-icons" aria-hidden="true">menu_open</i></a>
|
|
|
|
|
<span class="voice">${lang.lang_parse_detail}</span>
|
2019-11-09 00:52:54 +11:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2020-11-28 07:57:11 +11:00
|
|
|
|
<ul class="dropdown-content contextMenu" id="dropdown_${rand}">
|
2020-09-09 21:46:52 +10:00
|
|
|
|
<li class="${viashow} via-dropdown" onclick="client('${$.strip_tags(via)}')" title="${lang.lang_parse_clientop}">
|
|
|
|
|
via ${escapeHTML(via)}</a>
|
2020-09-07 17:36:25 +10:00
|
|
|
|
</li>
|
2019-11-16 05:42:23 +11:00
|
|
|
|
<div>
|
2020-09-07 17:36:25 +10:00
|
|
|
|
<li onclick="bkm('${uniqueid}','${acct_id}','${tlid}')"
|
2021-04-18 05:28:10 +10:00
|
|
|
|
class="bkm-btn bkmStr_${uniqueid}" style="padding:0; padding-top: 5px;">
|
2020-09-07 17:36:25 +10:00
|
|
|
|
<i class="fas text-darken-3 fa-bookmark bkm_${toot.id} ${if_bkm}"></i>${bkmStr}
|
|
|
|
|
</li>
|
|
|
|
|
<li class="${if_mine}" onclick="del('${uniqueid}','${acct_id}')"
|
2021-04-18 05:28:10 +10:00
|
|
|
|
style="padding:0; padding-top: 5px;">
|
2019-11-16 05:42:23 +11:00
|
|
|
|
<i class="fas fa-trash"></i>${lang.lang_parse_del}
|
2020-09-07 17:36:25 +10:00
|
|
|
|
</li>
|
2021-04-18 05:28:10 +10:00
|
|
|
|
<li class="${if_mine}" onclick="pin('${uniqueid}','${acct_id}')" style="padding:0; padding-top: 5px;" class="pinStr_${uniqueid}">
|
2020-09-07 17:36:25 +10:00
|
|
|
|
<i class="fas fa-map-pin pin_${uniqueid} ${if_pin}"></i>${pinStr}
|
|
|
|
|
</li>
|
|
|
|
|
<li class="${if_mine}" onclick="redraft('${uniqueid}','${acct_id}')"
|
2021-04-18 05:28:10 +10:00
|
|
|
|
style="padding:0; padding-top: 5px;">
|
2020-04-22 00:56:04 +10:00
|
|
|
|
<i class="material-icons" aria-hidden="true">redo</i>${lang.lang_parse_redraft}
|
2020-09-07 17:36:25 +10:00
|
|
|
|
</li>
|
2019-11-16 05:42:23 +11:00
|
|
|
|
${trans}
|
2020-09-07 17:36:25 +10:00
|
|
|
|
<li onclick="postMessage(['openUrl', '${toot.url}'], '*')"
|
2021-04-18 05:28:10 +10:00
|
|
|
|
style="padding:0; padding-top: 5px;">
|
2020-09-07 17:36:25 +10:00
|
|
|
|
<i class="fas text-darken-3 fa-globe"></i>${lang.lang_parse_link}
|
|
|
|
|
</li>
|
2020-11-28 07:57:11 +11:00
|
|
|
|
${pluginHtml}
|
2020-09-07 17:36:25 +10:00
|
|
|
|
</ul>
|
2019-11-09 00:52:54 +11:00
|
|
|
|
</div>
|
|
|
|
|
`
|
2019-02-27 03:51:37 +11:00
|
|
|
|
}
|
2021-01-09 23:07:59 +11:00
|
|
|
|
}
|
|
|
|
|
if (onlyContent) return content
|
2019-11-09 00:52:54 +11:00
|
|
|
|
if (mix == 'mix') {
|
|
|
|
|
return [templete, local, times]
|
2018-01-28 23:22:43 +11:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
return templete
|
2018-01-28 23:22:43 +11:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//オブジェクトパーサー(ユーザーデータ)
|
2018-02-26 02:32:10 +11:00
|
|
|
|
function userparse(obj, auth, acct_id, tlid, popup) {
|
2018-03-27 13:39:35 +11:00
|
|
|
|
//独自ロケール
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var locale = localStorage.getItem('locale')
|
|
|
|
|
if (locale == 'yes') {
|
|
|
|
|
var locale = false
|
2018-03-27 13:39:35 +11:00
|
|
|
|
}
|
2019-12-14 12:29:59 +11:00
|
|
|
|
var gif = localStorage.getItem('gif')
|
|
|
|
|
if (!gif) {
|
|
|
|
|
gif = 'yes'
|
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var templete = ''
|
|
|
|
|
var datetype = localStorage.getItem('datetype')
|
2020-08-02 14:16:31 +10:00
|
|
|
|
Object.keys(obj).forEach(function (key) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var toot = obj[key]
|
2019-07-26 00:55:25 +10:00
|
|
|
|
if (toot) {
|
|
|
|
|
if (!toot.username) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var raw = toot
|
|
|
|
|
toot = toot.account
|
|
|
|
|
var notf = true
|
2019-07-26 00:55:25 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var notf = false
|
2018-09-10 03:06:00 +10:00
|
|
|
|
}
|
2019-09-01 01:02:34 +10:00
|
|
|
|
//Instance Actorって…
|
2019-11-09 00:52:54 +11:00
|
|
|
|
if (toot.username.indexOf('.') < 0) {
|
2019-09-01 01:02:34 +10:00
|
|
|
|
if (toot.locked) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var locked = ' <i class="fas fa-lock red-text"></i>'
|
2019-09-01 01:02:34 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var locked = ''
|
2019-07-26 00:55:25 +10:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
if (auth == 'request') {
|
2020-04-22 00:56:04 +10:00
|
|
|
|
var authhtml = `<i class="material-icons gray pointer" onclick="request('${toot.id}','authorize','${acct_id}')" title="Accept" aria-hidden="true">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
person_add
|
2020-04-22 00:56:04 +10:00
|
|
|
|
</i>
|
|
|
|
|
<i class="material-icons gray pointer" onclick="request('${toot.id}','reject','${acct_id}')" title="Reject" aria-hidden="true">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
person_add_disabled
|
|
|
|
|
</i>`
|
2019-09-01 01:02:34 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var authhtml = ''
|
2019-09-01 01:02:34 +10:00
|
|
|
|
}
|
2019-12-12 02:06:12 +11:00
|
|
|
|
if (auth == 'follow') {
|
|
|
|
|
var ftxt = lang.lang_parse_followed
|
|
|
|
|
if (!locale && localStorage.getItem('followlocale_' + acct_id)) {
|
|
|
|
|
ftxt = localStorage.getItem('followlocale_' + acct_id)
|
|
|
|
|
}
|
|
|
|
|
} else if (auth == 'moved') {
|
|
|
|
|
var ftxt = lang.lang_parse_moved
|
2019-12-17 03:11:12 +11:00
|
|
|
|
} else if (auth == 'request') {
|
|
|
|
|
var ftxt = lang.lang_parse_request
|
2019-12-14 12:29:59 +11:00
|
|
|
|
}
|
2019-09-01 01:02:34 +10:00
|
|
|
|
if (popup > 0 || popup == -1 || notf) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var notftext = ftxt + '<br>'
|
2019-09-01 01:02:34 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var notftext = ''
|
2019-09-01 01:02:34 +10:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var memory = localStorage.getItem('notice-mem')
|
2019-09-01 01:02:34 +10:00
|
|
|
|
if (popup >= 0 && obj.length < 5 && notftext != memory) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
M.toast({ html: escapeHTML(toot.display_name) + ':' + ftxt, displayLength: popup * 1000 })
|
|
|
|
|
$('.notf-icon_' + tlid).addClass('red-text')
|
|
|
|
|
localStorage.setItem('notice-mem', notftext)
|
|
|
|
|
notftext = ''
|
|
|
|
|
var native = localStorage.getItem('nativenotf')
|
2019-09-01 01:02:34 +10:00
|
|
|
|
if (!native) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
native = 'yes'
|
2019-09-01 01:02:34 +10:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
if (native == 'yes') {
|
|
|
|
|
var os = localStorage.getItem('platform')
|
2019-09-01 01:02:34 +10:00
|
|
|
|
var options = {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
body: toot.display_name + '(' + toot.acct + ')' + ftxt,
|
2019-09-01 01:02:34 +10:00
|
|
|
|
icon: toot.avatar
|
2019-11-09 00:52:54 +11:00
|
|
|
|
}
|
|
|
|
|
var domain = localStorage.getItem('domain_' + acct_id)
|
|
|
|
|
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) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var dis_name = escapeHTML(toot.display_name)
|
2019-09-01 01:02:34 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var dis_name = toot.username
|
2019-09-01 01:02:34 +10:00
|
|
|
|
}
|
|
|
|
|
//ネイティブ通知
|
2019-05-19 17:39:30 +10:00
|
|
|
|
|
2019-09-01 01:02:34 +10:00
|
|
|
|
if (toot.emojis) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var actemojick = toot.emojis[0]
|
2019-09-01 01:02:34 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var actemojick = false
|
2019-09-01 01:02:34 +10:00
|
|
|
|
}
|
|
|
|
|
//絵文字があれば
|
|
|
|
|
if (actemojick) {
|
2020-08-02 14:16:31 +10:00
|
|
|
|
Object.keys(toot.emojis).forEach(function (key5) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var emoji = toot.emojis[key5]
|
|
|
|
|
var shortcode = emoji.shortcode
|
2019-12-14 12:29:59 +11:00
|
|
|
|
if (gif == 'yes') {
|
|
|
|
|
var emoSource = emoji.url
|
|
|
|
|
} else {
|
|
|
|
|
var emoSource = emoji.static_url
|
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var emoji_url = `
|
2019-12-14 12:29:59 +11:00
|
|
|
|
<img draggable="false" src="${emoSource}" class="emoji-img" data-emoji="${shortcode}"
|
2020-09-17 22:42:04 +10:00
|
|
|
|
alt=" :${shortcode}: " title="${shortcode}" onclick="this.classList.toggle('bigemoji');" loading="lazy">
|
2019-12-14 12:29:59 +11:00
|
|
|
|
`
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var regExp = new RegExp(':' + shortcode + ':', 'g')
|
|
|
|
|
dis_name = dis_name.replace(regExp, emoji_url)
|
|
|
|
|
})
|
2019-09-01 01:02:34 +10:00
|
|
|
|
}
|
|
|
|
|
if (dis_name) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
dis_name = twemoji.parse(dis_name)
|
2019-09-01 01:02:34 +10:00
|
|
|
|
}
|
|
|
|
|
if (toot.avatar) {
|
2019-12-14 12:29:59 +11:00
|
|
|
|
if (gif == 'yes') {
|
|
|
|
|
var avatar = toot.avatar
|
|
|
|
|
} else {
|
|
|
|
|
var avatar = toot.avatar_static
|
|
|
|
|
}
|
2019-09-01 01:02:34 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var avatar = '../../img/missing.svg'
|
2019-09-01 01:02:34 +10:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
if (tlid == 'dir' && acct_id == 'noauth') {
|
2019-11-16 05:42:23 +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-11-16 05:42:23 +11:00
|
|
|
|
var udg = `<a onclick="udg('${toot.id}','${acct_id}');" user="${toot.acct}" class="udg">`
|
2019-09-01 01:02:34 +10:00
|
|
|
|
}
|
2020-08-05 13:38:51 +10:00
|
|
|
|
var latest = date(toot.last_status_at, 'relative', true)
|
2019-09-01 01:02:34 +10:00
|
|
|
|
if (toot.last_status_at) {
|
2020-05-23 14:54:51 +10:00
|
|
|
|
var latesthtml = `<div class="cbadge" style="width:100px;">Last <span class="voice">toot</span>: ${latest}</div>`
|
2019-09-01 01:02:34 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var latesthtml = ''
|
2019-09-01 01:02:34 +10:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
templete =
|
|
|
|
|
templete +
|
2020-05-23 14:54:51 +10:00
|
|
|
|
`<div class="cusr" style="padding-top:5px;" user-id="${toot.id}">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
<div class="area-notice">${notftext}</div>
|
|
|
|
|
<div class="area-icon">
|
|
|
|
|
${udg}
|
|
|
|
|
<img
|
|
|
|
|
draggable="false"
|
|
|
|
|
src="${avatar}"
|
2020-05-23 14:54:51 +10:00
|
|
|
|
width="40"
|
2019-11-09 00:52:54 +11:00
|
|
|
|
class="prof-img"
|
|
|
|
|
user="${toot.acct}"
|
|
|
|
|
onerror="this.src='../../img/loading.svg'"
|
2020-04-22 00:56:04 +10:00
|
|
|
|
alt=""
|
2020-09-17 22:42:04 +10:00
|
|
|
|
loading="lazy"
|
2019-11-09 00:52:54 +11:00
|
|
|
|
/>
|
|
|
|
|
</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;"
|
|
|
|
|
>
|
2021-05-20 16:16:58 +10:00
|
|
|
|
@${toot.acct}${locked}</span>
|
2019-11-09 00:52:54 +11:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-12-17 03:11:12 +11:00
|
|
|
|
<div class="area-status">
|
2020-05-23 14:54:51 +10:00
|
|
|
|
<div class="cbadge" style="width:100px;">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
${lang.lang_status_follow}:${toot.following_count}
|
|
|
|
|
</div>
|
2020-05-23 14:54:51 +10:00
|
|
|
|
<div class="cbadge" style="width:100px;">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
${lang.lang_status_followers}:${toot.followers_count}
|
|
|
|
|
</div>
|
2019-12-17 03:11:12 +11:00
|
|
|
|
${latesthtml}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="area-actions" style="justify-content: flex-end;">
|
|
|
|
|
${authhtml}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
`
|
2019-08-30 02:46:04 +10:00
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
})
|
|
|
|
|
return templete
|
2018-01-28 23:22:43 +11:00
|
|
|
|
}
|
2018-03-11 01:22:59 +11:00
|
|
|
|
//クライアントダイアログ
|
|
|
|
|
function client(name) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
if (name != 'Unknown') {
|
2019-05-19 17:39:30 +10:00
|
|
|
|
//聞く
|
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-11-09 00:52:54 +11:00
|
|
|
|
type: 'info',
|
2019-06-26 01:33:20 +10:00
|
|
|
|
showCancelButton: true,
|
|
|
|
|
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-11-09 00:52:54 +11:00
|
|
|
|
if (result.dismiss == 'cancel') {
|
2019-06-26 01:33:20 +10:00
|
|
|
|
//Emp
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var cli = localStorage.getItem('client_emp')
|
|
|
|
|
var obj = JSON.parse(cli)
|
2019-06-26 01:33:20 +10:00
|
|
|
|
if (!obj) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var obj = []
|
|
|
|
|
obj.push(name)
|
|
|
|
|
M.toast({ html: escapeHTML(name) + lang.lang_status_emphas, displayLength: 2000 })
|
2019-06-26 01:33:20 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var can
|
2020-08-02 14:16:31 +10:00
|
|
|
|
Object.keys(obj).forEach(function (key) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var cliT = obj[key]
|
2019-06-26 01:33:20 +10:00
|
|
|
|
if (cliT != name && !can) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
can = false
|
2019-06-26 01:33:20 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
can = true
|
|
|
|
|
obj.splice(key, 1)
|
|
|
|
|
M.toast({ html: escapeHTML(name) + lang.lang_status_unemphas, displayLength: 2000 })
|
2019-06-26 01:33:20 +10:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
})
|
2019-06-26 01:33:20 +10:00
|
|
|
|
if (!can) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
obj.push(name)
|
|
|
|
|
M.toast({ html: escapeHTML(name) + lang.lang_status_emphas, displayLength: 2000 })
|
2019-06-26 01:33:20 +10:00
|
|
|
|
} else {
|
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var json = JSON.stringify(obj)
|
|
|
|
|
localStorage.setItem('client_emp', json)
|
|
|
|
|
parseColumn()
|
2019-06-26 01:33:20 +10:00
|
|
|
|
}
|
|
|
|
|
} else if (result.value) {
|
|
|
|
|
//Mute
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var cli = localStorage.getItem('client_mute')
|
|
|
|
|
var obj = JSON.parse(cli)
|
2019-06-26 01:33:20 +10:00
|
|
|
|
if (!obj) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
obj = []
|
2019-06-26 01:33:20 +10:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
obj.push(name)
|
|
|
|
|
var json = JSON.stringify(obj)
|
|
|
|
|
localStorage.setItem('client_mute', json)
|
|
|
|
|
M.toast({ html: escapeHTML(name) + lang.lang_parse_mute, displayLength: 2000 })
|
|
|
|
|
parseColumn()
|
2019-06-26 01:33:20 +10:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
})
|
2019-05-19 17:39:30 +10:00
|
|
|
|
}
|
2019-09-30 03:23:25 +10:00
|
|
|
|
}
|
|
|
|
|
//Poll Parser
|
2019-12-14 12:29:59 +11:00
|
|
|
|
function pollParse(poll, acct_id, emojis) {
|
2022-06-26 19:05:20 +10:00
|
|
|
|
var rand = makeCID()
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var datetype = localStorage.getItem('datetype')
|
2019-11-26 03:26:17 +11:00
|
|
|
|
var anime = localStorage.getItem('animation')
|
|
|
|
|
if (anime == 'yes' || !anime) {
|
|
|
|
|
var lpAnime = 'lpAnime'
|
|
|
|
|
} else {
|
|
|
|
|
var lpAnime = ''
|
|
|
|
|
}
|
2019-12-14 12:29:59 +11:00
|
|
|
|
var gif = localStorage.getItem('gif')
|
|
|
|
|
if (!gif) {
|
|
|
|
|
gif = 'yes'
|
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var choices = poll.options
|
2019-09-30 03:23:25 +10:00
|
|
|
|
if (poll.own_votes) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var minechoice = poll.own_votes
|
2019-09-30 03:23:25 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var minechoice = []
|
2019-09-30 03:23:25 +10:00
|
|
|
|
}
|
2020-02-11 04:15:54 +11:00
|
|
|
|
var refresh = `<a onclick="voteMastodonrefresh('${acct_id}','${poll.id}','${rand}')" class="pointer">
|
2019-11-26 03:02:15 +11:00
|
|
|
|
${lang.lang_manager_refresh}
|
|
|
|
|
</a>`
|
2020-03-01 14:47:07 +11:00
|
|
|
|
if (poll.voted && minechoice.length) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var myvote = lang.lang_parse_voted
|
2019-11-26 03:26:17 +11:00
|
|
|
|
if (poll.expired) myvote = myvote + '/' + lang.lang_parse_endedvote
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var result_hide = ''
|
2020-03-01 14:47:07 +11:00
|
|
|
|
} else if (poll.voted && !minechoice.length) {
|
2019-11-27 01:20:03 +11:00
|
|
|
|
var myvote = lang.lang_parse_myvote
|
|
|
|
|
if (poll.expired) myvote = myvote + '/' + lang.lang_parse_endedvote
|
|
|
|
|
var result_hide = ''
|
2019-09-30 03:23:25 +10:00
|
|
|
|
} else if (poll.expired) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var myvote = lang.lang_parse_endedvote
|
|
|
|
|
var result_hide = ''
|
2019-09-30 03:23:25 +10:00
|
|
|
|
} else {
|
2020-02-11 04:15:54 +11:00
|
|
|
|
var myvote = `<a onclick="voteMastodon('${acct_id}','${poll.id}','${rand}')" 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-11-09 00:52:54 +11:00
|
|
|
|
myvote =
|
|
|
|
|
myvote +
|
2020-02-11 04:15:54 +11:00
|
|
|
|
`<a onclick="showResult('${acct_id}','${poll.id}','${rand}')" class="pointer">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
${lang.lang_parse_unvoted}
|
2019-11-26 03:02:15 +11:00
|
|
|
|
</a> `
|
2019-09-30 03:23:25 +10:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var result_hide = 'hide'
|
2019-09-30 03:23:25 +10:00
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var ended = date(poll.expires_at, datetype)
|
|
|
|
|
var pollHtml = ''
|
2019-12-14 12:29:59 +11:00
|
|
|
|
if (choices[0].votes_count === 0 || choices[0].votes_count > 0) {
|
2019-11-26 03:26:17 +11:00
|
|
|
|
var max = _.maxBy(choices, 'votes_count').votes_count
|
|
|
|
|
} else {
|
|
|
|
|
var max = 0
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-02 14:16:31 +10:00
|
|
|
|
Object.keys(choices).forEach(function (keyc) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var choice = choices[keyc]
|
|
|
|
|
var voteit = ''
|
2019-09-30 03:23:25 +10:00
|
|
|
|
for (var i = 0; i < minechoice.length; i++) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var me = minechoice[i]
|
2019-09-30 03:23:25 +10:00
|
|
|
|
if (me == keyc) {
|
2019-12-14 12:29:59 +11:00
|
|
|
|
var voteit =
|
|
|
|
|
'<span class="ownMark"><img class="emoji" draggable="false" src="https://twemoji.maxcdn.com/v/12.1.4/72x72/2705.png"></span>'
|
2019-11-09 00:52:54 +11:00
|
|
|
|
break
|
2019-09-30 03:23:25 +10:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!poll.voted && !poll.expired) {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var votesel =
|
2020-02-11 04:15:54 +11:00
|
|
|
|
`voteSelMastodon('${acct_id}','${poll.id}',${keyc},${poll.multiple}, this)`
|
2019-11-27 01:20:03 +11:00
|
|
|
|
var voteclass = 'pointer'
|
2019-09-30 03:23:25 +10:00
|
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
|
var votesel = ''
|
|
|
|
|
var voteclass = ''
|
2019-09-30 03:23:25 +10:00
|
|
|
|
}
|
2019-11-26 03:26:17 +11:00
|
|
|
|
var per = Math.ceil((choice.votes_count / poll.votes_count) * 100)
|
2019-12-14 12:29:59 +11:00
|
|
|
|
if (!per) per = 0
|
2019-11-26 03:26:17 +11:00
|
|
|
|
if (max == choice.votes_count) {
|
2019-11-26 03:02:15 +11:00
|
|
|
|
var addPoll = 'maxVoter'
|
|
|
|
|
} else {
|
|
|
|
|
var addPoll = ''
|
|
|
|
|
}
|
2019-11-26 03:26:17 +11:00
|
|
|
|
var openData = ''
|
|
|
|
|
if (choice.votes_count !== null) {
|
2020-02-11 04:15:54 +11:00
|
|
|
|
openData = `<span style="float: right">${voteit}${choice.votes_count}<span class="sml">(${per}%)</span></span>`
|
2019-11-26 03:26:17 +11:00
|
|
|
|
} else {
|
2020-02-11 04:15:54 +11:00
|
|
|
|
openData = `<span style="float: right">${voteit}?<span class="sml">(-%)</span></span>`
|
2019-11-26 03:26:17 +11:00
|
|
|
|
}
|
2019-12-14 12:29:59 +11:00
|
|
|
|
var choiceText = escapeHTML(choice.title)
|
|
|
|
|
if (emojis) {
|
|
|
|
|
//絵文字があれば
|
2020-08-02 14:16:31 +10:00
|
|
|
|
Object.keys(emojis).forEach(function (key5) {
|
2019-12-14 12:29:59 +11:00
|
|
|
|
var emoji = emojis[key5]
|
|
|
|
|
var shortcode = emoji.shortcode
|
|
|
|
|
if (gif == 'yes') {
|
|
|
|
|
var emoSource = emoji.url
|
|
|
|
|
} else {
|
|
|
|
|
var emoSource = emoji.static_url
|
|
|
|
|
}
|
|
|
|
|
var emoji_url = `
|
|
|
|
|
<img draggable="false" src="${emoSource}" class="emoji-img" data-emoji="${shortcode}"
|
2020-09-17 22:42:04 +10:00
|
|
|
|
alt=" :${shortcode}: " title="${shortcode}" onclick="this.classList.toggle('bigemoji');" loading="lazy">
|
2019-12-14 12:29:59 +11:00
|
|
|
|
`
|
|
|
|
|
var regExp = new RegExp(':' + shortcode + ':', 'g')
|
|
|
|
|
choiceText = choiceText.replace(regExp, emoji_url)
|
|
|
|
|
})
|
|
|
|
|
choiceText = twemoji.parse(choiceText)
|
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
pollHtml =
|
|
|
|
|
pollHtml +
|
|
|
|
|
`<div class="${voteclass} vote vote_${acct_id}_${poll.id}_${keyc}" onclick="${votesel}">
|
2019-11-27 01:20:03 +11:00
|
|
|
|
<span class="vote_${acct_id}_${poll.id}_result leadPoll ${result_hide} ${addPoll} ${lpAnime}" style="width: ${per}%"></span>
|
2020-02-11 04:15:54 +11:00
|
|
|
|
<span class="onPoll">${choiceText}</span>
|
2019-11-26 03:02:15 +11:00
|
|
|
|
<span class="vote_${acct_id}_${poll.id}_result ${result_hide} onPoll">
|
2019-11-26 03:26:17 +11:00
|
|
|
|
${openData}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
</span>
|
|
|
|
|
</div>`
|
|
|
|
|
})
|
2019-11-26 03:02:15 +11:00
|
|
|
|
if (poll.expired) {
|
|
|
|
|
refresh = ''
|
|
|
|
|
}
|
2020-02-11 04:15:54 +11:00
|
|
|
|
pollHtml = `<div class="vote_${acct_id}_${poll.id}" id="vote${rand}">
|
2019-11-09 00:52:54 +11:00
|
|
|
|
${pollHtml}${myvote}
|
2019-11-26 03:02:15 +11:00
|
|
|
|
${refresh}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
<span class="cbadge cbadge-hover" title="${date(poll.expires_at, 'absolute')}">
|
|
|
|
|
<i class="far fa-calendar-times"></i>
|
|
|
|
|
${ended}
|
2019-11-26 03:02:15 +11:00
|
|
|
|
</span>${poll.voters_count} ${lang.lang_parse_people}
|
2019-11-09 00:52:54 +11:00
|
|
|
|
</div>`
|
|
|
|
|
return pollHtml
|
2019-10-12 02:18:43 +11:00
|
|
|
|
}
|
2020-09-02 14:24:59 +10:00
|
|
|
|
|
|
|
|
|
//MastodonBaseStreaming
|
|
|
|
|
var mastodonBaseWs = {}
|
|
|
|
|
var mastodonBaseWsStatus = {}
|
|
|
|
|
function mastodonBaseStreaming(acct_id) {
|
2020-09-23 02:35:28 +10:00
|
|
|
|
console.log('start to connect mastodonBaseStreaming of ' + acct_id)
|
2020-09-09 00:34:42 +10:00
|
|
|
|
notfCommon(acct_id, 0, null, 'no')
|
2020-09-02 14:24:59 +10:00
|
|
|
|
const domain = localStorage.getItem(`domain_${acct_id}`)
|
2020-09-09 21:46:52 +10:00
|
|
|
|
if (mastodonBaseWsStatus[domain]) return
|
2020-09-03 12:21:20 +10:00
|
|
|
|
mastodonBaseWsStatus[domain] = 'undetected'
|
2020-09-02 14:24:59 +10:00
|
|
|
|
const at = localStorage.getItem(`acct_${acct_id}_at`)
|
2020-09-09 18:15:19 +10:00
|
|
|
|
let wss = 'wss://' + domain
|
|
|
|
|
if (localStorage.getItem('streaming_' + acct_id)) {
|
2021-04-01 19:06:56 +11:00
|
|
|
|
wss = localStorage.getItem('streaming_' + acct_id).replace('https://', 'wss://')
|
2020-09-09 18:15:19 +10:00
|
|
|
|
}
|
|
|
|
|
const start = `${wss}/api/v1/streaming/?access_token=${at}`
|
2020-09-02 14:24:59 +10:00
|
|
|
|
mastodonBaseWs[domain] = new WebSocket(start)
|
|
|
|
|
mastodonBaseWs[domain].onopen = function () {
|
2020-09-06 23:57:20 +10:00
|
|
|
|
mastodonBaseWsStatus[domain] = 'connecting'
|
2020-09-06 22:38:15 +10:00
|
|
|
|
setTimeout(function () {
|
|
|
|
|
mastodonBaseWsStatus[domain] = 'available'
|
2020-09-06 23:57:20 +10:00
|
|
|
|
}, 3000)
|
2020-11-28 07:57:11 +11:00
|
|
|
|
mastodonBaseWs[domain].send(JSON.stringify({ type: 'subscribe', stream: 'user' }))
|
2020-09-03 12:21:20 +10:00
|
|
|
|
$('.notice_icon_acct_' + acct_id).removeClass('red-text')
|
2020-09-02 14:24:59 +10:00
|
|
|
|
}
|
2020-09-03 12:21:20 +10:00
|
|
|
|
mastodonBaseWs[domain].onmessage = function (mess) {
|
2021-05-20 16:16:58 +10:00
|
|
|
|
$(`div[data-acct=${acct_id}] .landing`).hide()
|
2020-09-02 14:24:59 +10:00
|
|
|
|
const typeA = JSON.parse(mess.data).event
|
|
|
|
|
if (typeA == 'delete') {
|
|
|
|
|
$(`[unique-id=${JSON.parse(mess.data).payload}]`).hide()
|
|
|
|
|
$(`[unique-id=${JSON.parse(mess.data).payload}]`).remove()
|
|
|
|
|
} else if (typeA == 'update' || typeA == 'conversation') {
|
2020-09-03 12:21:20 +10:00
|
|
|
|
//markers show中はダメ
|
|
|
|
|
const tl = JSON.parse(mess.data).stream
|
|
|
|
|
const obj = JSON.parse(JSON.parse(mess.data).payload)
|
|
|
|
|
const tls = getTlMeta(tl[0], tl, acct_id, obj)
|
|
|
|
|
insertTl(obj, tls)
|
|
|
|
|
} else if (typeA == 'filters_changed') {
|
|
|
|
|
filterUpdate(acct_id)
|
|
|
|
|
} else if (~typeA.indexOf('announcement')) {
|
|
|
|
|
announ(acct_id, tlid)
|
2020-09-05 00:43:04 +10:00
|
|
|
|
} else if (typeA == 'notification') {
|
|
|
|
|
const obj = JSON.parse(JSON.parse(mess.data).payload)
|
2020-09-03 12:21:20 +10:00
|
|
|
|
let template = ''
|
|
|
|
|
localStorage.setItem('lastnotf_' + acct_id, obj.id)
|
2020-09-05 00:43:04 +10:00
|
|
|
|
let popup = localStorage.getItem('popup')
|
|
|
|
|
if (!popup) {
|
|
|
|
|
popup = 0
|
|
|
|
|
}
|
2020-09-03 12:21:20 +10:00
|
|
|
|
if (obj.type != 'follow' && obj.type != 'follow_request') {
|
|
|
|
|
template = parse([obj], 'notf', acct_id, 'notf', popup)
|
|
|
|
|
} else if (obj.type == 'follow_request') {
|
|
|
|
|
template = userparse([obj.account], 'request', acct_id, 'notf', -1)
|
|
|
|
|
} else {
|
|
|
|
|
template = userparse([obj], obj.type, acct_id, 'notf', popup)
|
|
|
|
|
}
|
|
|
|
|
if (!$('div[data-notfIndv=' + acct_id + '_' + obj.id + ']').length) {
|
|
|
|
|
$('div[data-notf=' + acct_id + ']').prepend(template)
|
|
|
|
|
$('div[data-const=notf_' + acct_id + ']').prepend(template)
|
2020-09-02 14:24:59 +10:00
|
|
|
|
}
|
2020-09-03 12:21:20 +10:00
|
|
|
|
jQuery('time.timeago').timeago()
|
|
|
|
|
} else {
|
|
|
|
|
console.error('unknown type ' + typeA)
|
2020-09-02 14:24:59 +10:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mastodonBaseWs[domain].onerror = function (error) {
|
2020-09-09 00:34:42 +10:00
|
|
|
|
notfCommon(acct_id, 0, null, 'only') //fallback
|
2020-09-03 12:21:20 +10:00
|
|
|
|
console.error("Error closing " + domain)
|
2020-09-02 14:24:59 +10:00
|
|
|
|
console.error(error)
|
2020-09-09 21:46:52 +10:00
|
|
|
|
if (mastodonBaseWsStatus[domain] == 'available') {
|
2020-09-23 02:35:28 +10:00
|
|
|
|
/*M.toast({
|
2020-09-09 21:46:52 +10:00
|
|
|
|
html:
|
|
|
|
|
`${lang.lang_parse_disconnected}<button class="btn-flat toast-action" onclick="location.reload()">${lang.lang_layout_reconnect}</button>`,
|
|
|
|
|
completeCallback: function () {
|
2020-09-23 02:35:28 +10:00
|
|
|
|
parseColumn()
|
|
|
|
|
|
2020-09-09 21:46:52 +10:00
|
|
|
|
},
|
|
|
|
|
displayLength: 3000
|
2020-09-23 02:35:28 +10:00
|
|
|
|
})*/
|
|
|
|
|
parseColumn()
|
2020-09-09 21:46:52 +10:00
|
|
|
|
}
|
2020-09-06 23:57:20 +10:00
|
|
|
|
mastodonBaseWsStatus[domain] = 'cannotuse'
|
2020-09-06 22:38:15 +10:00
|
|
|
|
setTimeout(function () {
|
|
|
|
|
mastodonBaseWsStatus[domain] = 'cannotuse'
|
2020-09-06 23:57:20 +10:00
|
|
|
|
}, 3000)
|
2020-09-02 14:24:59 +10:00
|
|
|
|
mastodonBaseWs[domain] = false
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
mastodonBaseWs[domain].onclose = function () {
|
2020-09-09 00:34:42 +10:00
|
|
|
|
notfCommon(acct_id, 0, null, 'only') //fallback
|
2020-09-03 12:21:20 +10:00
|
|
|
|
console.warn("Closing " + domain)
|
2020-09-09 21:46:52 +10:00
|
|
|
|
if (mastodonBaseWsStatus[domain] == 'available') {
|
2020-09-23 02:35:28 +10:00
|
|
|
|
/*M.toast({
|
2020-09-09 21:46:52 +10:00
|
|
|
|
html:
|
|
|
|
|
`${lang.lang_parse_disconnected}<button class="btn-flat toast-action" onclick="location.reload()">${lang.lang_layout_reconnect}</button>`,
|
|
|
|
|
completeCallback: function () {
|
2020-09-23 02:35:28 +10:00
|
|
|
|
parseColumn()
|
|
|
|
|
|
2020-09-09 21:46:52 +10:00
|
|
|
|
},
|
|
|
|
|
displayLength: 3000
|
2020-09-23 02:35:28 +10:00
|
|
|
|
})*/
|
|
|
|
|
parseColumn()
|
2020-09-09 21:46:52 +10:00
|
|
|
|
}
|
2020-09-02 14:24:59 +10:00
|
|
|
|
mastodonBaseWs[domain] = false
|
|
|
|
|
mastodonBaseWsStatus[domain] = 'cannotuse'
|
2020-09-06 23:57:20 +10:00
|
|
|
|
setTimeout(function () {
|
|
|
|
|
mastodonBaseWsStatus[domain] = 'cannotuse'
|
|
|
|
|
}, 3000)
|
2020-09-02 14:24:59 +10:00
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function insertTl(obj, tls) {
|
|
|
|
|
for (const timeline of tls) {
|
2020-09-03 12:21:20 +10:00
|
|
|
|
const { id, voice, type, acct_id } = timeline
|
|
|
|
|
const mute = getFilterTypeByAcct(acct_id, type)
|
|
|
|
|
if ($(`#unread_${id} .material-icons`).hasClass('teal-text')) continue
|
|
|
|
|
if (!$(`#timeline_${id} [toot-id=${obj.id}]`).length) {
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (voice) {
|
|
|
|
|
say(obj.content)
|
|
|
|
|
}
|
2020-09-03 12:21:20 +10:00
|
|
|
|
const template = parse([obj], type, acct_id, id, '', mute, type)
|
|
|
|
|
console.log($(`#timeline_box_${id}_box .tl-box`).scrollTop(), `timeline_box_${id}_box .tl-box`)
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (
|
2020-09-03 12:21:20 +10:00
|
|
|
|
$(`#timeline_box_${id}_box .tl-box`).scrollTop() === 0
|
2020-09-02 14:24:59 +10:00
|
|
|
|
) {
|
2020-09-03 12:21:20 +10:00
|
|
|
|
$(`#timeline_${id}`).prepend(template)
|
2020-09-02 14:24:59 +10:00
|
|
|
|
} else {
|
2020-09-03 12:21:20 +10:00
|
|
|
|
let pool = localStorage.getItem('pool_' + id)
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (pool) {
|
|
|
|
|
pool = template + pool
|
|
|
|
|
} else {
|
|
|
|
|
pool = template
|
|
|
|
|
}
|
2020-09-03 12:21:20 +10:00
|
|
|
|
localStorage.setItem('pool_' + id, pool)
|
2020-09-02 14:24:59 +10:00
|
|
|
|
}
|
|
|
|
|
scrollck()
|
2020-09-03 12:21:20 +10:00
|
|
|
|
additional(acct_id, id)
|
2020-09-02 14:24:59 +10:00
|
|
|
|
jQuery('time.timeago').timeago()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-03 12:21:20 +10:00
|
|
|
|
function getTlMeta(type, data, num, status) {
|
2020-09-02 14:24:59 +10:00
|
|
|
|
const acct_id = num.toString()
|
|
|
|
|
const columns = localStorage.getItem('column')
|
|
|
|
|
const obj = JSON.parse(columns)
|
|
|
|
|
let ret = []
|
2020-09-26 22:04:21 +10:00
|
|
|
|
let i = -1
|
2020-09-02 14:24:59 +10:00
|
|
|
|
switch (type) {
|
|
|
|
|
case 'user':
|
|
|
|
|
for (const tl of obj) {
|
2020-09-26 22:04:21 +10:00
|
|
|
|
i++
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (tl.domain != acct_id) continue
|
|
|
|
|
if (tl.type == 'mix' || tl.type == 'home') {
|
|
|
|
|
let voice = false
|
|
|
|
|
if (localStorage.getItem('voice_' + i)) voice = true
|
|
|
|
|
ret.push({
|
|
|
|
|
id: i,
|
2020-09-03 12:21:20 +10:00
|
|
|
|
voice: voice,
|
|
|
|
|
type: tl.type,
|
|
|
|
|
acct_id: tl.domain
|
2020-09-02 14:24:59 +10:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
case 'public:local':
|
|
|
|
|
for (const tl of obj) {
|
2020-09-26 22:04:21 +10:00
|
|
|
|
i++
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (tl.domain != acct_id) continue
|
|
|
|
|
if (tl.type == 'mix' || tl.type == 'local') {
|
|
|
|
|
let voice = false
|
|
|
|
|
if (localStorage.getItem('voice_' + i)) voice = true
|
|
|
|
|
ret.push({
|
|
|
|
|
id: i,
|
2020-09-03 12:21:20 +10:00
|
|
|
|
voice: voice,
|
|
|
|
|
type: tl.type,
|
|
|
|
|
acct_id: tl.domain
|
2020-09-02 14:24:59 +10:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
case 'public:local:media':
|
|
|
|
|
for (const tl of obj) {
|
2020-09-26 22:04:21 +10:00
|
|
|
|
i++
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (tl.domain != acct_id) continue
|
|
|
|
|
if (tl.type == 'local-media') {
|
|
|
|
|
let voice = false
|
|
|
|
|
if (localStorage.getItem('voice_' + i)) voice = true
|
|
|
|
|
ret.push({
|
|
|
|
|
id: i,
|
2020-09-03 12:21:20 +10:00
|
|
|
|
voice: voice,
|
|
|
|
|
type: tl.type,
|
|
|
|
|
acct_id: tl.domain
|
2020-09-02 14:24:59 +10:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'public':
|
|
|
|
|
for (const tl of obj) {
|
2020-09-26 22:04:21 +10:00
|
|
|
|
i++
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (tl.domain != acct_id) continue
|
|
|
|
|
if (tl.type == 'pub') {
|
2020-09-26 22:04:21 +10:00
|
|
|
|
console.log(i, tl)
|
2020-09-02 14:24:59 +10:00
|
|
|
|
let voice = false
|
|
|
|
|
if (localStorage.getItem('voice_' + i)) voice = true
|
|
|
|
|
ret.push({
|
|
|
|
|
id: i,
|
2020-09-03 12:21:20 +10:00
|
|
|
|
voice: voice,
|
|
|
|
|
type: tl.type,
|
|
|
|
|
acct_id: tl.domain
|
2020-09-02 14:24:59 +10:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'public:media':
|
|
|
|
|
for (const tl of obj) {
|
2020-09-26 22:04:21 +10:00
|
|
|
|
i++
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (tl.domain != acct_id) continue
|
|
|
|
|
if (tl.type == 'pub-media') {
|
|
|
|
|
let voice = false
|
|
|
|
|
if (localStorage.getItem('voice_' + i)) voice = true
|
|
|
|
|
ret.push({
|
|
|
|
|
id: i,
|
2020-09-03 12:21:20 +10:00
|
|
|
|
voice: voice,
|
|
|
|
|
type: tl.type,
|
|
|
|
|
acct_id: tl.domain
|
2020-09-02 14:24:59 +10:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'list':
|
|
|
|
|
for (const tl of obj) {
|
2020-09-26 22:04:21 +10:00
|
|
|
|
i++
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (tl.domain != acct_id) continue
|
|
|
|
|
if (tl.type == 'list' && tl.data == data[1]) {
|
|
|
|
|
let voice = false
|
|
|
|
|
if (localStorage.getItem('voice_' + i)) voice = true
|
|
|
|
|
ret.push({
|
|
|
|
|
id: i,
|
2020-09-03 12:21:20 +10:00
|
|
|
|
voice: voice,
|
|
|
|
|
type: tl.type,
|
|
|
|
|
acct_id: tl.domain
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'direct':
|
|
|
|
|
for (const tl of obj) {
|
2020-09-26 22:04:21 +10:00
|
|
|
|
i++
|
2020-09-03 12:21:20 +10:00
|
|
|
|
if (tl.domain != acct_id) continue
|
|
|
|
|
if (tl.type == 'dm') {
|
|
|
|
|
let voice = false
|
|
|
|
|
if (localStorage.getItem('voice_' + i)) voice = true
|
|
|
|
|
ret.push({
|
|
|
|
|
id: i,
|
|
|
|
|
voice: voice,
|
|
|
|
|
type: tl.type,
|
|
|
|
|
acct_id: tl.domain
|
2020-09-02 14:24:59 +10:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'hashtag':
|
|
|
|
|
for (const tl of obj) {
|
2020-09-26 22:04:21 +10:00
|
|
|
|
i++
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (tl.domain != acct_id) continue
|
|
|
|
|
const columnDataRaw = tl.data
|
|
|
|
|
let columnData
|
|
|
|
|
if (!columnDataRaw.name) {
|
|
|
|
|
columnData = { name: columnDataRaw }
|
|
|
|
|
} else {
|
|
|
|
|
columnData = columnDataRaw
|
|
|
|
|
}
|
|
|
|
|
if (tl.type == 'tag') {
|
|
|
|
|
let voice = false
|
|
|
|
|
let can = false
|
|
|
|
|
if (columnData.name == data[1]) can = true
|
2020-09-03 12:21:20 +10:00
|
|
|
|
//any
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (columnData.any.split(',').includes(data[1])) can = true
|
2020-09-03 12:21:20 +10:00
|
|
|
|
//all
|
|
|
|
|
const { tags } = status
|
|
|
|
|
if (columnData.all) can = true
|
|
|
|
|
for (const { name } of tags) {
|
|
|
|
|
if (!columnData.all.split(',').includes(name)) {
|
|
|
|
|
can = false
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//none
|
|
|
|
|
if (columnData.none) can = true
|
|
|
|
|
for (const { name } of tags) {
|
|
|
|
|
if (columnData.none.split(',').includes(name)) {
|
|
|
|
|
can = false
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-02 14:24:59 +10:00
|
|
|
|
if (localStorage.getItem('voice_' + i)) voice = true
|
|
|
|
|
ret.push({
|
|
|
|
|
id: i,
|
2020-09-03 12:21:20 +10:00
|
|
|
|
voice: voice,
|
|
|
|
|
type: tl.type,
|
|
|
|
|
acct_id: tl.domain
|
2020-09-02 14:24:59 +10:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2020-09-03 12:21:20 +10:00
|
|
|
|
console.error(`Cannot catch`);
|
2020-09-02 14:24:59 +10:00
|
|
|
|
}
|
|
|
|
|
return ret
|
|
|
|
|
}
|