···
50
+
<a id="date" target="_blank"></a>
···
params[key] = value.replace(/\+/g, ' ')
59
-
const url = params['url'] || ''
59
+
const url = params['url']?.replace('x.com', 'twitter.com') || ''
const datetime = (params['datetime'] || 0)
const tweet = (params['tweet'] ? params['tweet'] : 'Loading tweet...')
const authorName = (params['author_name'] ? params['author_name'] : '')
63
-
let authorUsername = (params['author_username'] ? params['author_username'] : '')
const align = params['align']
const linkColor = params['link_color']
const theme = params['theme']
67
-
let formattedDate = 'Unknown date'
const conversation = params['conversation']
67
+
const cards = params['cards']
68
+
const lang = params['lang']
70
-
const m = url.match(/^(?:https?:)?\/\/(?:www\.)?(?:twitter|x)\.com\/([^/]+)\//)
70
+
let authorUsername = (params['author_username'] ? params['author_username'] : '')
71
+
let formattedDate = 'Unknown date'
73
+
const m = url.match(/^(?:https?:)?\/\/(?:www\.)?twitter\.com\/([^/]+)\//)
if (m && !authorUsername) {
···
t.setAttribute('data-conversation', conversation)
101
+
t.setAttribute('data-cards', cards)
104
+
t.setAttribute('data-lang', lang)
document.getElementById('author_name').innerText = authorName