Mention and tag links are not considered the acct data
This commit is contained in:
parent
78ea495969
commit
7d6d0b5628
@ -3,6 +3,7 @@
|
||||
$(document).on('click', 'a', e => {
|
||||
var $a = $(e.target)
|
||||
var url = $a.attr('href')
|
||||
var acct_id = $a.attr('data-acct')
|
||||
if (!url) {
|
||||
var url = $a.parent().attr('href')
|
||||
}
|
||||
@ -43,10 +44,14 @@ $(document).on('click', 'a', e => {
|
||||
if (ats[2]) {
|
||||
//Quesdon判定
|
||||
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
|
||||
} else {
|
||||
if(pwa) {
|
||||
if (pwa) {
|
||||
return true
|
||||
} else {
|
||||
postMessage(['openUrl', url], '*')
|
||||
@ -54,7 +59,7 @@ $(document).on('click', 'a', e => {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(pwa) {
|
||||
if (pwa) {
|
||||
return true
|
||||
}
|
||||
//hrefがhttp/httpsならブラウザで
|
||||
@ -112,7 +117,7 @@ function playSound() {
|
||||
}
|
||||
context = new AudioContext()
|
||||
context.createBufferSource().start(0)
|
||||
context.decodeAudioData(request.response, function(buf) {
|
||||
context.decodeAudioData(request.response, function (buf) {
|
||||
//console.log("Playing:" , source)
|
||||
source.buffer = buf
|
||||
source.loop = false
|
||||
@ -134,7 +139,7 @@ function playSound() {
|
||||
function nano() {
|
||||
postMessage(['nano', null], '*')
|
||||
}
|
||||
onmessage = function(e) {
|
||||
onmessage = function (e) {
|
||||
if (e.data[0] == 'details') {
|
||||
details(e.data[1][0], e.data[1][1])
|
||||
} else if (e.data[0] == 'udg') {
|
||||
@ -144,9 +149,8 @@ onmessage = function(e) {
|
||||
} else if (e.data[0] == 'post') {
|
||||
post('pass')
|
||||
} else if (e.data[0] == 'toastSaved') {
|
||||
var showTxt = `${lang.lang_img_DLDone}${
|
||||
e.data[1][0]
|
||||
}<button class="btn-flat toast-action" onclick="openFinder('${e.data[1][1]}')">Show</button>`
|
||||
var showTxt = `${lang.lang_img_DLDone}${e.data[1][0]
|
||||
}<button class="btn-flat toast-action" onclick="openFinder('${e.data[1][1]}')">Show</button>`
|
||||
M.toast({ html: showTxt, displayLength: 5000 })
|
||||
} else if (e.data[0] == 'parseColumn') {
|
||||
parseColumn(e.data[1])
|
||||
@ -197,7 +201,7 @@ onmessage = function(e) {
|
||||
}
|
||||
}
|
||||
/* PWA */
|
||||
if(pwa) {
|
||||
if (pwa) {
|
||||
function postMessage(e) {
|
||||
if (e[0] == 'openUrl') {
|
||||
urls = e[1].match(/https?:\/\/(.+)/)
|
||||
@ -206,12 +210,12 @@ if(pwa) {
|
||||
title: 'Open URL',
|
||||
icon: 'info',
|
||||
html:
|
||||
`If you are OK, click: <a href="${urls[0]}" target="_blank" class="btn waves-effect">Here</a>`,
|
||||
`If you are OK, click: <a href="${urls[0]}" target="_blank" class="btn waves-effect">Here</a>`,
|
||||
showCloseButton: false,
|
||||
showCancelButton: true,
|
||||
focusConfirm: false,
|
||||
confirmButtonText: 'Close'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -220,10 +224,10 @@ if(pwa) {
|
||||
$('html').addClass(localStorage.getItem('scroll') ? localStorage.getItem('scroll') : '')
|
||||
const connection = function (event) {
|
||||
console.log(navigator.onLine, 'network state')
|
||||
if(!navigator.onLine) {
|
||||
if (!navigator.onLine) {
|
||||
$('#re-online').addClass('hide')
|
||||
$('#offline').removeClass('hide')
|
||||
} else if(!$('#offline').hasClass('hide')) {
|
||||
} else if (!$('#offline').hasClass('hide')) {
|
||||
$('#offline').addClass('hide')
|
||||
$('#re-online').removeClass('hide')
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
|
||||
var local = []
|
||||
var times = []
|
||||
let content
|
||||
for(let key in obj){
|
||||
for (let key in obj) {
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var toot = obj[key]
|
||||
if (type == 'dm') {
|
||||
@ -560,6 +560,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
|
||||
/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]
|
||||
@ -569,12 +570,11 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
|
||||
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 + '"')
|
||||
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">
|
||||
${lang.lang_parse_url}
|
||||
|
Loading…
Reference in New Issue
Block a user