diff --git a/app/js/platform/end.js b/app/js/platform/end.js index cfeaa353..01b7c3f6 100644 --- a/app/js/platform/end.js +++ b/app/js/platform/end.js @@ -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] - }` + var showTxt = `${lang.lang_img_DLDone}${e.data[1][0] + }` 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: Here`, + `If you are OK, click: Here`, 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') } diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js index f232576a..45ff8cf6 100644 --- a/app/js/tl/parse.js +++ b/app/js/tl/parse.js @@ -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 = `