Add twitcasting

This commit is contained in:
cutls 2019-11-14 02:48:49 +09:00
parent 2fa1299391
commit 224d762bc6
3 changed files with 23 additions and 22 deletions

View File

@ -240,23 +240,11 @@ function cardHtml(json, acct_id, id) {
"youtube.com",
"youtu.be",
"m.youtube.com",
"nicovideo.jp"
"nicovideo.jp",
"twitcasting.tv"
]
var isHad = _.includes(ok, domain);
if (json.provider_name == 'Twitter') {
var url = json.author_url
var status = json.url.match(/^https:\/\/twitter.com\/[_a-zA-Z0-9-]+\/status\/([0-9]+)/);
if(status){
if(status.length > 0){
status = status[1]
}
}
url = url + '/status/' + status
analyze = `
<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>
`
} else if (json.provider_name == 'pixiv') {
if (json.provider_name == 'pixiv') {
if (json.image) {
var pxvImg = `
<br><img src="${json.image}" style="max-width:100%"
@ -285,7 +273,8 @@ function cardHtml(json, acct_id, id) {
${escapeHTML(json.description)}
</span>`
}
if (json.html) {
if (json.html || json.provider_name == 'Twitter') {
if(isHad) {
var prved = `<img class="emoji" draggable="false" alt="✅"
src="https://twemoji.maxcdn.com/v/12.1.3/72x72/2705.png">`
@ -294,11 +283,9 @@ function cardHtml(json, acct_id, id) {
var prved = ''
var title = ''
}
analyze =
analyze +
`<a onclick="cardHtmlShow('${acct_id}','${id}')" class="add-show pointer" title="${title}">
analyze =`<a onclick="cardHtmlShow('${acct_id}','${id}')" class="add-show pointer" title="${title}">
${lang.lang_parse_html}(${domain})${prved}
</a><br>`
</a>${analyze}<br>`
}
}
return analyze
@ -346,6 +333,20 @@ function cardHtmlShow(acct_id, id) {
${lang.lang_cards_pip}
">picture_in_picture_alt</i>`
}
if (json.provider_name == 'Twitter') {
var url = json.author_url
var status = json.url.match(/^https:\/\/twitter.com\/[_a-zA-Z0-9-]+\/status\/([0-9]+)/);
if(status){
if(status.length > 0){
status = status[1]
}
}
url = url + '/status/' + status
analyze = `
<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>
`
}
$('[toot-id=' + id + '] .additional').html(analyze)
})
}

View File

@ -86,7 +86,7 @@
"lang_usetxtbox_reply": "Reply Mode. Ctrl+Shift+C to clear.",
"lang_cards_check": " check",
"lang_cards_pip": "PiP mode",
"lang_cards_link": "Trusted embed HTML by TheDesk(Twitter, Pixiv, nicovideo, YouTube, Spotify)",
"lang_cards_link": "Trusted embed HTML by TheDesk(Twitter, nicovideo, YouTube, Spotify, twitcasing)",
"lang_details_nodata": "No data",
"lang_details_filtered": "Filtered toot",
"lang_details_embed": "Embed HTML is cliped.",

View File

@ -86,7 +86,7 @@
"lang_usetxtbox_reply": "返信モードです。クリアするときはCtrl+Shift+Cを押してください。",
"lang_cards_check": "チェック",
"lang_cards_pip": "ながら観モード",
"lang_cards_link": "TheDeskが認証した埋め込みHTMLです(Twitter, Pixiv, nicovideo, YouTube, Spotify)",
"lang_cards_link": "TheDeskが認証した埋め込みHTMLです(Twitter, nicovideo, YouTube, Spotify, twitcasting)",
"lang_details_nodata": "データなし",
"lang_details_filtered": "フィルターされました。",
"lang_details_embed": "埋め込みHTMLがコピーされました。",