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 => {
|
$(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,10 +44,14 @@ $(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) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
postMessage(['openUrl', url], '*')
|
postMessage(['openUrl', url], '*')
|
||||||
|
@ -54,7 +59,7 @@ $(document).on('click', 'a', e => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(pwa) {
|
if (pwa) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//hrefがhttp/httpsならブラウザで
|
//hrefがhttp/httpsならブラウザで
|
||||||
|
@ -112,7 +117,7 @@ function playSound() {
|
||||||
}
|
}
|
||||||
context = new AudioContext()
|
context = new AudioContext()
|
||||||
context.createBufferSource().start(0)
|
context.createBufferSource().start(0)
|
||||||
context.decodeAudioData(request.response, function(buf) {
|
context.decodeAudioData(request.response, function (buf) {
|
||||||
//console.log("Playing:" , source)
|
//console.log("Playing:" , source)
|
||||||
source.buffer = buf
|
source.buffer = buf
|
||||||
source.loop = false
|
source.loop = false
|
||||||
|
@ -134,7 +139,7 @@ function playSound() {
|
||||||
function nano() {
|
function nano() {
|
||||||
postMessage(['nano', null], '*')
|
postMessage(['nano', null], '*')
|
||||||
}
|
}
|
||||||
onmessage = function(e) {
|
onmessage = function (e) {
|
||||||
if (e.data[0] == 'details') {
|
if (e.data[0] == 'details') {
|
||||||
details(e.data[1][0], e.data[1][1])
|
details(e.data[1][0], e.data[1][1])
|
||||||
} else if (e.data[0] == 'udg') {
|
} else if (e.data[0] == 'udg') {
|
||||||
|
@ -144,9 +149,8 @@ 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') {
|
||||||
parseColumn(e.data[1])
|
parseColumn(e.data[1])
|
||||||
|
@ -197,7 +201,7 @@ onmessage = function(e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* PWA */
|
/* PWA */
|
||||||
if(pwa) {
|
if (pwa) {
|
||||||
function postMessage(e) {
|
function postMessage(e) {
|
||||||
if (e[0] == 'openUrl') {
|
if (e[0] == 'openUrl') {
|
||||||
urls = e[1].match(/https?:\/\/(.+)/)
|
urls = e[1].match(/https?:\/\/(.+)/)
|
||||||
|
@ -206,12 +210,12 @@ if(pwa) {
|
||||||
title: 'Open URL',
|
title: 'Open URL',
|
||||||
icon: 'info',
|
icon: 'info',
|
||||||
html:
|
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,
|
showCloseButton: false,
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
focusConfirm: false,
|
focusConfirm: false,
|
||||||
confirmButtonText: 'Close'
|
confirmButtonText: 'Close'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,10 +224,10 @@ if(pwa) {
|
||||||
$('html').addClass(localStorage.getItem('scroll') ? localStorage.getItem('scroll') : '')
|
$('html').addClass(localStorage.getItem('scroll') ? localStorage.getItem('scroll') : '')
|
||||||
const connection = function (event) {
|
const connection = function (event) {
|
||||||
console.log(navigator.onLine, 'network state')
|
console.log(navigator.onLine, 'network state')
|
||||||
if(!navigator.onLine) {
|
if (!navigator.onLine) {
|
||||||
$('#re-online').addClass('hide')
|
$('#re-online').addClass('hide')
|
||||||
$('#offline').removeClass('hide')
|
$('#offline').removeClass('hide')
|
||||||
} else if(!$('#offline').hasClass('hide')) {
|
} else if (!$('#offline').hasClass('hide')) {
|
||||||
$('#offline').addClass('hide')
|
$('#offline').addClass('hide')
|
||||||
$('#re-online').removeClass('hide')
|
$('#re-online').removeClass('hide')
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,7 +195,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
|
||||||
var local = []
|
var local = []
|
||||||
var times = []
|
var times = []
|
||||||
let content
|
let content
|
||||||
for(let key in obj){
|
for (let key in obj) {
|
||||||
var domain = localStorage.getItem('domain_' + acct_id)
|
var domain = localStorage.getItem('domain_' + acct_id)
|
||||||
var toot = obj[key]
|
var toot = obj[key]
|
||||||
if (type == 'dm') {
|
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;\/?:\@&=+\$,%#]+)?/
|
/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}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user