Mention and tag links are not considered the acct data

This commit is contained in:
cutls 2021-02-02 11:27:15 +09:00
parent 78ea495969
commit 7d6d0b5628
2 changed files with 21 additions and 17 deletions

View File

@ -3,6 +3,7 @@
$(document).on('click', 'a', e => { $(document).on('click', 'a', e => {
var $a = $(e.target) var $a = $(e.target)
var url = $a.attr('href') var url = $a.attr('href')
var acct_id = $a.attr('data-acct')
if (!url) { if (!url) {
var url = $a.parent().attr('href') var url = $a.parent().attr('href')
} }
@ -43,7 +44,11 @@ $(document).on('click', 'a', e => {
if (ats[2]) { if (ats[2]) {
//Quesdon判定 //Quesdon判定
if (!~ats[2].indexOf('@')) { if (!~ats[2].indexOf('@')) {
udgEx(url, 'main') var acct_id = $a.parent().attr('data-acct')
if (!acct_id) {
acct_id = localStorage.getItem("main")
}
udgEx(url, acct_id)
return false return false
} else { } else {
if (pwa) { if (pwa) {
@ -144,8 +149,7 @@ onmessage = function(e) {
} else if (e.data[0] == 'post') { } else if (e.data[0] == 'post') {
post('pass') post('pass')
} else if (e.data[0] == 'toastSaved') { } else if (e.data[0] == 'toastSaved') {
var showTxt = `${lang.lang_img_DLDone}${ var showTxt = `${lang.lang_img_DLDone}${e.data[1][0]
e.data[1][0]
}<button class="btn-flat toast-action" onclick="openFinder('${e.data[1][1]}')">Show</button>` }<button class="btn-flat toast-action" onclick="openFinder('${e.data[1][1]}')">Show</button>`
M.toast({ html: showTxt, displayLength: 5000 }) M.toast({ html: showTxt, displayLength: 5000 })
} else if (e.data[0] == 'parseColumn') { } else if (e.data[0] == 'parseColumn') {

View File

@ -560,6 +560,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
/https?:\/\/([^+_]+)\/?(?!.*((media|tags)|mentions)).*([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)?/ /https?:\/\/([^+_]+)\/?(?!.*((media|tags)|mentions)).*([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)?/
) )
urlsck = content.match(/(https?):\/\/([^<>]*?)\/([^"]*)/g) urlsck = content.match(/(https?):\/\/([^<>]*?)\/([^"]*)/g)
content = content.replace(/href="([^"]+)"/g, `href="$1" data-acct="${acct_id}"`)
if (urlsck) { if (urlsck) {
for (var urlct = 0; urlct < urlsck.length; urlct++) { for (var urlct = 0; urlct < urlsck.length; urlct++) {
var urlindv = urlsck[urlct] var urlindv = urlsck[urlct]
@ -569,12 +570,11 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
var encoded = encodeURI(urlCont[4]) var encoded = encodeURI(urlCont[4])
var punycoded = 'xn--' + punycode.encode(urlCont[2]) var punycoded = 'xn--' + punycode.encode(urlCont[2])
var eUrl = urlCont[1] + '://' + punycoded + '.' + urlCont[3] + '/' + encoded var eUrl = urlCont[1] + '://' + punycoded + '.' + urlCont[3] + '/' + encoded
var regExp = new RegExp('href="' + urlindv + '"', 'g') var regExp = new RegExp(`href="${urlindv}"`, 'g')
content = content.replace(regExp, 'href="' + eUrl + '"') content = content.replace(regExp, `href="${eUrl}"`)
} }
} }
} }
if (urls) { if (urls) {
var analyze = `<a onclick="additionalIndv('${tlid}','${acct_id}','${id}')" class="add-show pointer" aria-hidden="true"> var analyze = `<a onclick="additionalIndv('${tlid}','${acct_id}','${id}')" class="add-show pointer" aria-hidden="true">
${lang.lang_parse_url} ${lang.lang_parse_url}