diff --git a/_locales/en/messages.json b/_locales/en/messages.json index dcdb1da9..193e8a6c 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -575,5 +575,7 @@ "uploading": { "message": "Uploading" }, "finalization": { "message": "Finalization" }, "processing": { "message": "Processing" }, - "quotes": { "message": "Quotes" } + "quotes": { "message": "Quotes" }, + "share_tweet_in_dms": { "message": "Share tweet in DMs" }, + "share_tweet_to": { "message": "Share tweet to..." } } \ No newline at end of file diff --git a/_locales/ru/messages.json b/_locales/ru/messages.json index 09113391..e2bd489c 100644 --- a/_locales/ru/messages.json +++ b/_locales/ru/messages.json @@ -566,5 +566,7 @@ "uploading": { "message": "Загрузка" }, "finalization": { "message": "Завершение" }, "processing": { "message": "Обработка" }, - "quotes": { "message": "Цитаты" } + "quotes": { "message": "Цитаты" }, + "share_tweet_in_dms": { "message": "Поделиться твитом в сообщениях" }, + "share_tweet_to": { "message": "Поделиться твитом..." } } \ No newline at end of file diff --git a/_locales/uk/messages.json b/_locales/uk/messages.json index 98443765..321d2477 100644 --- a/_locales/uk/messages.json +++ b/_locales/uk/messages.json @@ -566,5 +566,7 @@ "uploading": { "message": "Завантаження" }, "finalization": { "message": "Завершення" }, "processing": { "message": "Обробка" }, - "quotes": { "message": "Цитати" } + "quotes": { "message": "Цитати" }, + "share_tweet_in_dms": { "message": "Поширити твіт повідомленням" }, + "share_tweet_to": { "message": "Поширити твіт..." } } \ No newline at end of file diff --git a/layouts/header/script.js b/layouts/header/script.js index 045f9bd2..9c95e11d 100644 --- a/layouts/header/script.js +++ b/layouts/header/script.js @@ -8,6 +8,7 @@ let notificationsOpened = false; let isDarkModeEnabled = typeof vars !== 'undefined' ? (vars.darkMode || (vars.timeMode && isDark())) : false; let activeTweet; let seenAlgoTweets = [], algoTweetsChanged = false; +let tweetUrlToShareInDMs = null; setInterval(() => { if(!algoTweetsChanged) return; algoTweetsChanged = false; @@ -1065,6 +1066,7 @@ let userDataFunction = async user => { if(messageUsers.length === 1) messageHeaderLink.href = `https://twitter.com/${messageUsers[0].screen_name}`; setTimeout(() => { modal.querySelector(".message-new-input").focus(); + if(tweetUrlToShareInDMs) modal.querySelector(".message-new-input").value = tweetUrlToShareInDMs; }); renderConversation(messageData, c.conversation_id); @@ -1153,6 +1155,7 @@ let userDataFunction = async user => { if(location.hash === '#dm') { location.hash = ""; } + tweetUrlToShareInDMs = null; }); modal.querySelector('.modal-close').hidden = true; const inboxList = modal.querySelector('.inbox-list'); @@ -1228,6 +1231,7 @@ let userDataFunction = async user => { messageHeaderLink.href = `https://twitter.com/${u.screen_name}`; setTimeout(() => { modal.querySelector(".message-new-input").focus(); + if(tweetUrlToShareInDMs) modal.querySelector(".message-new-input").value = tweetUrlToShareInDMs; }); renderConversation(messageData, `${user.id_str}-${u.id_str}`); @@ -2249,6 +2253,7 @@ let userDataFunction = async user => { messageHeaderLink.href = `https://twitter.com/${u.screen_name}`; setTimeout(() => { modal.querySelector(".message-new-input").focus(); + if(tweetUrlToShareInDMs) modal.querySelector(".message-new-input").value = tweetUrlToShareInDMs; }); renderConversation(messageData, convo_id); diff --git a/layouts/header/style.css b/layouts/header/style.css index feaa4875..1b678e35 100644 --- a/layouts/header/style.css +++ b/layouts/header/style.css @@ -1621,6 +1621,9 @@ span.tweet-body-text { .tweet-interact-more-menu-share:before { content: "\f185" } +.tweet-interact-more-menu-share-dms:before { + content: "\f157" +} .tweet-interact-more-menu-analytics:before { content: "\f200" diff --git a/scripts/helpers.js b/scripts/helpers.js index 983e1e93..d30c5e9e 100644 --- a/scripts/helpers.js +++ b/scripts/helpers.js @@ -1940,6 +1940,7 @@ async function appendTweet(t, timelineContainer, options = {}) {
${navigator.canShare ? ` ` : ''} + ${t.user.id_str === user.id_str ? /*html*/`