|
|
@ -42,11 +42,14 @@ const StatusContent = React.createClass({ |
|
|
|
for (var i = 0; i < links.length; ++i) { |
|
|
|
for (var i = 0; i < links.length; ++i) { |
|
|
|
let link = links[i]; |
|
|
|
let link = links[i]; |
|
|
|
let mention = this.props.status.get('mentions').find(item => link.href === item.get('url')); |
|
|
|
let mention = this.props.status.get('mentions').find(item => link.href === item.get('url')); |
|
|
|
|
|
|
|
let media = this.props.status.get('media_attachments').find(item => link.href === item.get('text_url') || link.href === item.get('remote_url')); |
|
|
|
|
|
|
|
|
|
|
|
if (mention) { |
|
|
|
if (mention) { |
|
|
|
link.addEventListener('click', this.onMentionClick.bind(this, mention), false); |
|
|
|
link.addEventListener('click', this.onMentionClick.bind(this, mention), false); |
|
|
|
} else if (link.textContent[0] === '#' || (link.previousSibling && link.previousSibling.textContent && link.previousSibling.textContent[link.previousSibling.textContent.length - 1] === '#')) { |
|
|
|
} else if (link.textContent[0] === '#' || (link.previousSibling && link.previousSibling.textContent && link.previousSibling.textContent[link.previousSibling.textContent.length - 1] === '#')) { |
|
|
|
link.addEventListener('click', this.onHashtagClick.bind(this, link.text), false); |
|
|
|
link.addEventListener('click', this.onHashtagClick.bind(this, link.text), false); |
|
|
|
|
|
|
|
} else if (media) { |
|
|
|
|
|
|
|
link.innerHTML = '<i class="fa fa-fw fa-photo"></i>'; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
link.setAttribute('target', '_blank'); |
|
|
|
link.setAttribute('target', '_blank'); |
|
|
|
link.setAttribute('rel', 'noopener'); |
|
|
|
link.setAttribute('rel', 'noopener'); |
|
|
|