__MSG_mobile__
diff --git a/layouts/settings/script.js b/layouts/settings/script.js
index c069d0f5..79514823 100644
--- a/layouts/settings/script.js
+++ b/layouts/settings/script.js
@@ -319,6 +319,7 @@ setTimeout(async () => {
let showExactValues = document.getElementById('show-exact-values');
let localizeDigit = document.getElementById('localize-digit');
let hideTimelineTypes = document.getElementById('hide-timeline-types');
+ let hideOriginalLanguages = document.getElementById('hide-original-languages');
let autotranslationMode = document.getElementById('autotranslation-mode');
let autotranslateLanguages = document.getElementById('autotranslate-languages');
let autotranslateLanguageList = document.getElementById('autotranslate-language-list');
@@ -980,6 +981,12 @@ setTimeout(async () => {
autotranslateLanguages.appendChild(div);
}
+ hideOriginalLanguages.addEventListener('change', () => {
+ chrome.storage.sync.set({
+ hideOriginalLanguages: hideOriginalLanguages.checked
+ }, () => { });
+ });
+
// Set values
if(vars.linkColor) {
linkColor.value = vars.linkColor;
@@ -1049,6 +1056,7 @@ setTimeout(async () => {
pinBookmarksOnNavbar.checked = !!vars.pinBookmarksOnNavbar;
pinListsOnNavbar.checked = !!vars.pinListsOnNavbar;
useOldDefaultProfileImage.checked = !!vars.useOldDefaultProfileImage;
+ hideOriginalLanguages.checked = !!vars.hideOriginalLanguages;
uncensorAdultContentAutomatically.checked = !!vars.uncensorAdultContentAutomatically;
uncensorGraphicViolenceAutomatically.checked = !!vars.uncensorGraphicViolenceAutomatically;
uncensorSensitiveContentAutomatically.checked = !!vars.uncensorSensitiveContentAutomatically;
diff --git a/scripts/config.js b/scripts/config.js
index a7a561f5..411361ff 100644
--- a/scripts/config.js
+++ b/scripts/config.js
@@ -30,7 +30,7 @@ async function loadVars() {
'uncensorGraphicViolenceAutomatically', 'uncensorAdultContentAutomatically', 'uncensorSensitiveContentAutomatically', 'useOldStyleReply',
'enableAd', 'acknowledgedCssAccess', 'disableProfileCustomizations', 'openNotifsAsModal', 'enableIframeNavigation',
'acknowledgedCustomizationButton', 'modernUI', 'showExactValues', 'hideTimelineTypes', 'autotranslateLanguages',
- 'autotranslationMode', 'muteVideos', 'dontPauseVideos', 'showUserPreviewsOnMobile', 'systemDarkMode', 'localizeDigit',
+ 'autotranslationMode', 'hideOriginalLanguages', 'muteVideos', 'dontPauseVideos', 'showUserPreviewsOnMobile', 'systemDarkMode', 'localizeDigit',
'disableRetweetHotkey', 'disableLikeHotkey', 'disableFindHotkey', 'extensionCompatibilityMode', 'disableDataSaver', 'disableAcceptType',
'showUserFollowerCountsInLists', 'showQuoteCount', 'hideUnfollowersPage', 'transitionProfileBanner', 'customDownloadTemplate',
'showBoringIndicators'
@@ -210,6 +210,12 @@ async function loadVars() {
disableAcceptType: false
}, () => {});
}
+ if(typeof(data.hideOriginalLanguages) !== 'boolean') {
+ data.hideOriginalLanguages = false;
+ chrome.storage.sync.set({
+ hideOriginalLanguages: false
+ }, () => {});
+ }
if(typeof(data.autotranslateProfiles) !== 'object') {
data.autotranslateProfiles = [];
chrome.storage.sync.set({
diff --git a/scripts/helpers.js b/scripts/helpers.js
index 99e90dab..41a0d32b 100644
--- a/scripts/helpers.js
+++ b/scripts/helpers.js
@@ -2644,6 +2644,7 @@ async function appendTweet(t, timelineContainer, options = {}) {
let tt = t.full_text.replace(/^(@[a-zA-Z0-9_]{1,15}\s?)*/, "").replace(/\shttps:\/\/t.co\/[a-zA-Z0-9\-]{8,10}$/, "").trim();
if(translated.text.trim() === tt) return;
if(translated.text.trim() === tt.replace(/(hihi)|(hehe)/g, 'lol')) return; // lol
+ const { hideOriginalLanguages } = await chrome.storage.sync.get('hideOriginalLanguages');
let translatedMessage;
if(LOC.translated_from.message.includes("$LANGUAGE$")) {
translatedMessage = LOC.translated_from.message.replace("$LANGUAGE$", `[${translated.translated_lang}]`);
@@ -2653,6 +2654,10 @@ async function appendTweet(t, timelineContainer, options = {}) {
if(translated.text.length > 600) {
translated.text = translated.text.substring(0, 600) + '...';
}
+ if (hideOriginalLanguages) {
+ translatedMessage = '';
+ tweetBodyQuoteText.innerHTML = '';
+ }
tweetBodyQuoteText.innerHTML +=
`${translatedMessage}:`+
``;
@@ -2683,6 +2688,8 @@ async function appendTweet(t, timelineContainer, options = {}) {
let tt = t.full_text.replace(/^(@[a-zA-Z0-9_]{1,15}\s?)*/, "").replace(/\shttps:\/\/t.co\/[a-zA-Z0-9\-]{8,10}$/, "").trim();
if(translated.text.trim() === tt) return;
if(translated.text.trim() === tt.replace(/(hihi)|(hehe)/g, 'lol')) return; // lol
+ const { hideOriginalLanguages } = await chrome.storage.sync.get('hideOriginalLanguages');
+
let translatedMessage;
if(LOC.translated_from.message.includes("$LANGUAGE$")) {
translatedMessage = LOC.translated_from.message.replace("$LANGUAGE$", `[${translated.translated_lang}]`);
@@ -2696,10 +2703,18 @@ async function appendTweet(t, timelineContainer, options = {}) {
let translatedFrom = document.createElement('span');
translatedFrom.classList.add('translated-from');
translatedFrom.innerText = translatedMessage;
+
+
+
let translatedText = document.createElement('span');
translatedText.classList.add('tweet-translated-text');
translatedText.innerHTML = await renderTweetBodyHTML(translatedT);
- tweetBodyText.append(document.createElement('br'), translatedFrom, translatedText);
+ if (hideOriginalLanguages) {
+ tweetBodyText.innerHTML = '';
+ tweetBodyText.append(translatedText);
+ } else {
+ tweetBodyText.append(document.createElement('br'), translatedFrom, translatedText);
+ }
if(vars.enableTwemoji) twemoji.parse(tweetBodyText);
});
if(options.translate || vars.autotranslateProfiles.includes(t.user.id_str) || (typeof toAutotranslate !== 'undefined' && toAutotranslate) || (vars.autotranslateLanguages.includes(t.lang) && vars.autotranslationMode === 'whitelist') || (!vars.autotranslateLanguages.includes(t.lang) && vars.autotranslationMode === 'blacklist')) {
diff --git a/scripts/tweetviewer.js b/scripts/tweetviewer.js
index 67735f1a..a6e58bd7 100644
--- a/scripts/tweetviewer.js
+++ b/scripts/tweetviewer.js
@@ -1608,6 +1608,8 @@ class TweetViewer {
let tt = t.full_text.replace(/^(@[a-zA-Z0-9_]{1,15}\s?)*/, "").replace(/\shttps:\/\/t.co\/[a-zA-Z0-9\-]{8,10}$/, "").trim();
if(translated.text.trim() === tt) return;
if(translated.text.trim() === tt.replace(/(hihi)|(hehe)/g, 'lol')) return; // lol
+ const { hideOriginalLanguages } = await chrome.storage.sync.get('hideOriginalLanguages');
+
let translatedMessage;
if(LOC.translated_from.message.includes("$LANGUAGE$")) {
translatedMessage = LOC.translated_from.message.replace("$LANGUAGE$", `[${translated.translated_lang}]`);
@@ -1617,6 +1619,10 @@ class TweetViewer {
if(translated.text.length > 600) {
translated.text = translated.text.substring(0, 600) + '...';
}
+ if (hideOriginalLanguages) {
+ translatedMessage = '';
+ tweetBodyQuoteText.innerHTML = '';
+ }
tweetBodyQuoteText.innerHTML +=
`${translatedMessage}:`+
``;
@@ -1647,6 +1653,9 @@ class TweetViewer {
let tt = t.full_text.replace(/^(@[a-zA-Z0-9_]{1,15}\s?)*/, "").replace(/\shttps:\/\/t.co\/[a-zA-Z0-9\-]{8,10}$/, "").trim();
if(translated.text.trim() === tt) return;
if(translated.text.trim() === tt.replace(/(hihi)|(hehe)/g, 'lol')) return; // lol
+
+ const { hideOriginalLanguages } = await chrome.storage.sync.get('hideOriginalLanguages');
+
let translatedMessage;
if(LOC.translated_from.message.includes("$LANGUAGE$")) {
translatedMessage = LOC.translated_from.message.replace("$LANGUAGE$", `[${translated.translated_lang}]`);
@@ -1660,10 +1669,18 @@ class TweetViewer {
let translatedFrom = document.createElement('span');
translatedFrom.classList.add('translated-from');
translatedFrom.innerText = translatedMessage;
+
+
+
let translatedText = document.createElement('span');
translatedText.classList.add('tweet-translated-text');
translatedText.innerHTML = await renderTweetBodyHTML(translatedT);
- tweetBodyText.append(document.createElement('br'), translatedFrom, translatedText);
+ if (hideOriginalLanguages) {
+ tweetBodyText.innerHTML = '';
+ tweetBodyText.append(translatedText);
+ } else {
+ tweetBodyText.append(document.createElement('br'), translatedFrom, translatedText);
+ }
if(vars.enableTwemoji) twemoji.parse(tweetBodyText);
});
if(options.translate || vars.autotranslateProfiles.includes(t.user.id_str) || (typeof toAutotranslate !== 'undefined' && toAutotranslate) || (vars.autotranslateLanguages.includes(t.lang) && vars.autotranslationMode === 'whitelist') || (!vars.autotranslateLanguages.includes(t.lang) && vars.autotranslationMode === 'blacklist')) {