Fix twitter link flied

This commit is contained in:
cutls 2019-11-16 22:55:49 +09:00
parent 00863d6917
commit 022565e176

View File

@ -337,17 +337,21 @@ function cardHtmlShow(acct_id, id) {
if (json.provider_name == 'Twitter') { if (json.provider_name == 'Twitter') {
var url = json.author_url var url = json.author_url
var status = json.url.match(/^https:\/\/twitter.com\/[_a-zA-Z0-9-]+\/status\/([0-9]+)/); var status = json.url.match(/^https:\/\/twitter.com\/[_a-zA-Z0-9-]+\/status\/([0-9]+)/);
var statusId = false
if(status){ if(status){
if(status.length > 0){ if(status.length > 0){
status = status[1] var statusId = status[1]
} }
} }
url = url + '/status/' + status console.log(statusId)
if(statusId){
url = json.url
analyze = ` analyze = `
<blockquote class="twitter-tweet" data-dnt="true"><strong>${json.author_name}</strong><br>${json.description}<a href="${url}">${json.url}</a></blockquote> <blockquote class="twitter-tweet" data-dnt="true"><strong>${json.author_name}</strong><br>${json.description}<a href="${url}">${json.url}</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
` `
} }
}
$('[toot-id=' + id + '] .additional').html(analyze) $('[toot-id=' + id + '] .additional').html(analyze)
}) })
} }