diff --git a/scripts/helpers.js b/scripts/helpers.js
index 38444c58..ac40f582 100644
--- a/scripts/helpers.js
+++ b/scripts/helpers.js
@@ -1615,7 +1615,7 @@ async function appendTweet(t, timelineContainer, options = {}) {
if(!options.mainTweet && typeof mainTweetLikers !== 'undefined' && !location.pathname.includes("retweets/with_comments") && !document.querySelector('.modal')) {
tweet.addEventListener('click', async e => {
- if(e.target.className && (e.target.classList.contains('tweet') || e.target.classList.contains('tweet-body') || e.target.classList.contains('tweet-reply-to') || e.target.className === 'tweet-interact' || e.target.className === 'tweet-media')) {
+ if (!e.target.closest(".tweet-button") && !e.target.closest(".tweet-edit-section") && !e.target.closest(".dropdown-menu") && !e.target.closest(".tweet-media-element") && !e.target.closest("a") && !e.target.closest("button")) {
document.getElementById('loading-box').hidden = false;
savePageData();
history.pushState({}, null, `https://twitter.com/${t.user.screen_name}/status/${t.id_str}`);
@@ -1641,18 +1641,10 @@ async function appendTweet(t, timelineContainer, options = {}) {
currentLocation = location.pathname;
}
});
- tweet.addEventListener('mousedown', e => {
- if(e.button === 1) {
- e.preventDefault();
- if(e.target.className && (e.target.classList.contains('tweet') || e.target.classList.contains('tweet-body') || e.target.classList.contains('tweet-reply-to') || e.target.className === 'tweet-interact' || e.target.className === 'tweet-media')) {
- openInNewTab(`https://twitter.com/${t.user.screen_name}/status/${t.id_str}`);
- }
- }
- });
} else {
if(!options.mainTweet) {
tweet.addEventListener('click', e => {
- if(e.target.className && (e.target.classList.contains('tweet') || e.target.classList.contains('tweet-body') || e.target.classList.contains('tweet-reply-to') || e.target.className === 'tweet-interact' || e.target.className === 'tweet-media')) {
+ if(!e.target.closest(".tweet-button") && !e.target.closest(".tweet-edit-section") && !e.target.closest(".dropdown-menu") && !e.target.closest(".tweet-media-element") && !e.target.closest("a") && !e.target.closest("button")) {
let tweetData = t;
if(tweetData.retweeted_status) tweetData = tweetData.retweeted_status;
tweet.classList.add('tweet-preload');
@@ -1663,16 +1655,17 @@ async function appendTweet(t, timelineContainer, options = {}) {
new TweetViewer(user, tweetData);
}
});
- tweet.addEventListener('mousedown', e => {
- if(e.button === 1) {
- e.preventDefault();
- if(e.target.className && (e.target.classList.contains('tweet') || e.target.classList.contains('tweet-body') || e.target.classList.contains('tweet-reply-to') || e.target.className === 'tweet-interact')) {
- openInNewTab(`https://twitter.com/${t.user.screen_name}/status/${t.id_str}`);
- }
- }
- });
}
}
+ tweet.addEventListener('mousedown', e => {
+ if(e.button === 1) {
+ // tweet-media-element is clickable, since it should open the tweet in a new tab.
+ if(!e.target.closest(".tweet-button") && !e.target.closest(".tweet-edit-section") && !e.target.closest(".dropdown-menu") && !e.target.closest("a") && !e.target.closest("button")) {
+ e.preventDefault();
+ openInNewTab(`https://twitter.com/${t.user.screen_name}/status/${t.id_str}`);
+ }
+ }
+ });
tweet.tabIndex = -1;
tweet.className = `tweet ${options.mainTweet ? 'tweet-main' : location.pathname.includes('/status/') ? 'tweet-replying' : ''}`.trim();
tweet.dataset.tweetId = t.id_str;
@@ -1847,7 +1840,7 @@ async function appendTweet(t, timelineContainer, options = {}) {
${!isMatchingLanguage && options.mainTweet ? /*html*/`
- ${LOC.view_translation.message}
+
` : ``}
${t.extended_entities && t.extended_entities.media ? /*html*/`