Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
entities.media.forEach((e) => {
text = text.replace(e.url, '');
});
}
// remove any quote links
if (entities && data.quoted_status) {
entities.urls.forEach((u) => {
if (u.expanded_url.indexOf('/status/') > -1) {
text = text.replace(u.url, '');
}
});
}
// replace + style links and mentions
text = twitterText.autoLinkWithJSON(text, (entities || {}), { usernameIncludeSymbol: true });
text = text.replace(/href=/g, 'style="text-decoration: none;color:#6CCCF9;" href=');
// replace + style emoji
text = twemoji.parse(text);
text = text.replace(/
}
// remove any quote links
if (entities && data.quoted_status) {
entities.urls.forEach(item => {
if (item.expanded_url.indexOf('/status/') > -1) {
text = text.replace(item.url, '');
}
});
}
// replace line break
text = text.replace(/\r?\n/, '<br>');
// replace + style links and mentions
text = twitterText.autoLinkWithJSON(text, (entities || {}), {'usernameIncludeSymbol': true});
text = text.replace(/href=/g, 'style="text-decoration: none;color:#1da1f2;" href=');
// replace + style emoji
text = twemoji.parse(text);
text = text.replace(/
entities.media.forEach( e => {
text = text.replace(e.url, '')
})
}
// remove any quote links
if (entities && data.quoted_status) {
entities.urls.forEach( u => {
if (u.expanded_url.indexOf('/status/') > -1) {
text = text.replace(u.url, '')
}
})
}
// replace + style links and mentions
text = twitterText.autoLinkWithJSON(text, (entities || {}), {'usernameIncludeSymbol': true})
text = text.replace(/href=/g, 'style="text-decoration: none;color:#6CCCF9;" href=')
// replace + style emoji
text = twemoji.parse(text)
text = text.replace(/
ngOnChanges(changes: any) {
if (changes.text && changes.text.currentValue && this.tweetContent && changes.text.currentValue !== changes.text.previousValue) {
this.text = this.entities
? autoLinkWithJSON(this.text, this.entities || {}, this.options)
: autoLink(this.text, this.options);
this.tweetContent.nativeElement.innerHTML = this.text;
const links = this.tweetContent.nativeElement.querySelectorAll('a');
[].forEach.call(links, a => {
if (a.classList.contains('username')) {
a.onclick = e => this.goToProfile(e, a.innerText);
} else if (a.classList.contains('hashtag')) {
a.onclick = e => this.goToSearch(e, a.innerText);
} else {
a.onclick = e => this.openLink(e, a.getAttribute('href'));
}
});
}
}