function escapeHTMLtemp(str) {
if (!str) {
return ""
}
return str.replace(/&/g, '&')
.replace(//g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''')
}
$.strip_tagstemp = function(str, allowed) {
if (!str) {
return ""
}
allowed = (((allowed || '') + '').toLowerCase().match(/<[a-z][a-z0-9]*>/g) || [])
.join('')
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>?/gi,
commentsAndPhpTags = /|<\?(?:php)?[\s\S]*?\?>/gi
return str.replace(commentsAndPhpTags, '').replace(tags, function($0, $1) {
return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : ''
})
}
//オブジェクトパーサー(トゥート)
function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
var templete = ''
localStorage.setItem("lastunix_" + tlid, date(obj[0].createdAt, 'unix'))
var actb = localStorage.getItem("action_btns")
var actb = 're,rt,fav,qt,del,pin,red'
if (actb) {
var actb = actb.split(',')
var disp = {}
for (var k = 0; k < actb.length; k++) {
if (k < 4) {
var tp = "type-a"
} else {
var tp = "type-b"
}
disp[actb[k]] = tp
}
}
var datetype = localStorage.getItem("datetype")
var nsfwtype = localStorage.getItem("nsfw")
var sent = localStorage.getItem("sentence")
var ltr = localStorage.getItem("letters")
var gif = localStorage.getItem("gif")
var imh = localStorage.getItem("img-height")
//ネイティブ通知
var native = localStorage.getItem("nativenotf")
if (!native) {
native = "yes"
}
//クライアント強調
var empCli = localStorage.getItem("client_emp")
if (empCli) {
var empCli = JSON.parse(empCli)
} else {
var empCli = []
}
//クライアントミュート
var muteCli = localStorage.getItem("client_mute")
if (muteCli) {
var muteCli = JSON.parse(muteCli)
} else {
var muteCli = []
}
//ユーザー強調
var useremp = localStorage.getItem("user_emp")
if (useremp) {
var useremp = JSON.parse(useremp)
}
//ワード強調
var wordempList = localStorage.getItem("word_emp")
if (wordempList) {
var wordempList = JSON.parse(wordempList)
}
//ワードミュート
var wordmuteList = localStorage.getItem("word_mute")
if (wordmuteList) {
var wordmuteList = JSON.parse(wordmuteList)
if (wordmuteList) {
wordmuteList = wordmuteList.concat(mutefilter)
}
} else {
wordmuteList = mutefilter
}
//Ticker
var tickerck = localStorage.getItem("ticker_ok")
if (tickerck) {
var ticker = true
} else {
var ticker = false
}
if (!sent) {
var sent = 500
}
if (!ltr) {
var ltr = 500
}
if (!nsfwtype || nsfwtype == "yes") {
var nsfw = "ok"
} else {
var nsfw
}
var cwtype = localStorage.getItem("cw")
if (!cwtype || cwtype == "yes") {
var cw = "ok"
} else {
var cw
}
if (!datetype) {
datetype = "absolute"
}
if (!gif) {
var gif = "yes"
}
if (!imh) {
var imh = "200"
}
if (!emp) {
var emp = []
}
if (!mute) {
var mute = []
}
if (!useremp) {
var useremp = []
}
if (!wordemp) {
var wordemp = []
}
if (!wordmute) {
var wordmute = []
}
//via通知
var viashow = localStorage.getItem("viashow")
if (!viashow) {
viashow = "via-hide"
}
if (viashow == "hide") {
viashow = "via-hide"
}
//認証なしTL
if (mix == "noauth") {
var noauth = "hide"
var antinoauth = ""
} else {
var noauth = ""
var antinoauth = "hide"
}
//マウスオーバーのみ
var mouseover = localStorage.getItem("mouseover")
if (!mouseover) {
mouseover = ""
} else if (mouseover == "yes" || mouseover == "click") {
mouseover = "hide"
} else if (mouseover == "no") {
mouseover = ""
}
var local = []
var times = []
Object.keys(obj).forEach(function(key) {
var toot = obj[key]
var dis_name = toot.user.name
if (dis_name) {
dis_name = escapeHTMLtemp(dis_name)
} else {
disname = ""
}
//絵文字があれば
if (toot.user.emojis) {
Object.keys(toot.user.emojis).forEach(function(key5) {
var emoji = toot.user.emojis[key5]
var shortcode = emoji.name
var emoji_url = ''
var regExp = new RegExp(":" + shortcode + ":", "g")
dis_name = dis_name.replace(regExp, emoji_url)
})
}
if (mix == "notf") {
if (gif == "yes") {
noticeavatar = toot.user.avatarUrl
} else {
noticeavatar = toot.user.avatarUrl
}
noticeavatar = '' +
''
if (toot.type == "reply") {
var what = lang.lang_parse_mentioned
var icon = ''
noticeavatar = ""
} else if (toot.type == "renote") {
var what = lang.lang_misskeyparse_renoted
var icon = ''
} else if (toot.type == "quote") {
var what = lang.lang_misskeyparse_quoted
var icon = ''
} else if (toot.type == "reaction") {
var what = lang.lang_misskeyparse_reacted
var reactions = {
"like": "👍",
"love": "💓",
"laugh": "😁",
"hmm": "🤔",
"surprise": "😮",
"congrats": "🎉",
"amgry": "💢",
"confused": "😥",
"rip": "😇"
}
var icon = reactions[toot.reaction]
var emojisData = JSON.parse(localStorage.getItem("emoji_" + acct_id))
if (!icon) {
if (emojisData) {
var num = emojisData.length
var ehtml = ""
for (i = 0; i < num; i++) {
var emoji = emojisData[i]
if (":" + emoji.shortcode + ":" == toot.reaction) {
if (emoji) {
icon = ''
}
}
}
}
}
} else {
var icon = 'info'
}
var noticetext = '' + date(toot.createdAt,
datetype) +
'' + icon + '' + dis_name +
"(@" + toot.user.username +
")"
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 == "reply") {
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")
} else if (toot.type == "renote" || toot.type == "quote") {
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")
} else if (toot.type == "reaction") {
var favct = localStorage.getItem("notf-fav_" + acct_id)
$(".notf-fav_" + acct_id).text(favct * 1 - (-1))
localStorage.setItem("notf-fav_" + acct_id, favct * 1 - (-1))
$(".notf-fav_" + acct_id).removeClass("hide")
}
}
var domain = localStorage.getItem("domain_" + acct_id)
if (popup > 0) {
M.toast({ html: "[" + domain + "]" + escapeHTMLtemp(toot.user.name) + what, displayLength: popup * 1000 })
}
if (native == "yes") {
var os = localStorage.getItem("platform")
var options = {
body: toot.user.name + "(" + toot.user.username + ")" + what + "\n\n" + $.strip_tagstemp(toot.note.text),
icon: toot.user.avatarUrl
}
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 + '"'
var toot = toot.note
var dis_name = escapeHTML(toot.user.name)
} else {
var if_notf = ""
if (toot.renote) {
var rebtxt = lang.lang_parse_btedsimple
var rticon = "fa-retweet light-blue-text"
var notice = '' + dis_name + "(@" + toot.user.username +
")
"
var boostback = "shared"
var uniqueid = toot.id
if (!toot.text) {
var toot = toot.renote
}
var dis_name = escapeHTML(toot.user.name)
var uniqueid = toot.id
var actemojick = false
} else {
var uniqueid = toot.id
var notice = ""
var boostback = ""
//ユーザー強調
if (toot.user.host) {
var fullname = toot.user.username + "@" + toot.user.host
} else {
var domain = localStorage.getItem("domain_" + acct_id)
var fullname = toot.user.username + "@" + domain
}
if (useremp) {
Object.keys(useremp).forEach(function(key10) {
var user = useremp[key10]
if (user == fullname) {
boostback = "emphasized"
}
})
}
}
}
var id = toot.id
if (mix == "home") {
var home = ""
var divider = '
$1') content = content.replace(/`(.+)`/gi, '
$1
')
content = content.replace(/(http(s)?:\/\/[\x21-\x7e]+)/gi, '$1')
content = content.replace(/\(\(\((.+)\)\)\)/gi, '$1')
content = content.replace(/<motion>(.+)<\/motion>/gi, '$1')
content = content.replace(/\*\*\*([^*]+)\*\*\*/gi, '$1')
content = content.replace(/\*\*([^*]+)\*\*/gi, '$1')
content = content.replace(/^(.+)\s(検索|search)$/gmi, '