added nitter redirection to openTweet()

This commit is contained in:
MarshDeer 2024-09-06 20:34:12 -04:00
parent ae1d2c2b74
commit 5bbf9cca6d

View File

@ -13,21 +13,21 @@ function detectOS() {
} }
function openTweet(tweetId){ function openTweet(tweetId){
var preference = localStorage.getItem("openLinksPreference"); if (localStorage.getItem("openLinksPreference") === "true") {
if (preference === "true"){
const os = detectOS(); const os = detectOS();
url = `twitter://status?id=${tweetId}` url = `twitter://status?id=${tweetId}`
if(os === 'android'){ if(os === 'android'){
window.location = url; window.location = url;
}else if (os === 'ios'){ }else if (os === 'ios'){
window.location.replace(url); window.location.replace(url);
} }
}else{ } else if (localStorage.getItem("frontendToggle") === "true" && localStorage.getItem("frontendUrl") !== null) {
window.location = `${frontendUrl}/i/status/${tweetId}`
} else {
window.location = `https://x.com/i/status/${tweetId}` window.location = `https://x.com/i/status/${tweetId}`
} }
setTimeout(() => { setTimeout(() => {
window.location = `https://x.com/i/status/${tweetId}` window.location = `https://x.com/i/status/${tweetId}`
}, 1000) }, 1000)
} }