diff --git a/_locales/en/messages.json b/_locales/en/messages.json index b199923a..83400867 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -404,6 +404,8 @@ "block_sure_desc": { "message": "They will not be able to follow you or view your Tweets, and you will not see Tweets or notifications from @$SCREEN_NAME$.", "placeholders": { "screen_name": { "content": "CoolPerson2000" } } }, "blocked_by_user" : { "message": "@$SCREEN_NAME$ blocked you", "placeholders": { "screen_name": { "content": "CoolPerson2000" } } }, "why_you_cant_see_block_user": { "message": "You can't follow or see @$SCREEN_NAME$'s Tweets.", "placeholders": { "screen_name": { "content": "CoolPerson2000" } } }, + "nonexistent_user": { "message": "This account doesn't exist" }, + "nonexistent_user_desc": { "message": "Try searching for another." }, "you_blocked_user": { "message": "You blocked @$SCREEN_NAME$", "placeholders": { "screen_name": { "content": "CoolPerson2000" } } }, "do_you_want_see_blocked_user": { "message": "Are you sure you want to view these Tweets? Viewing Tweets won't unblock @$SCREEN_NAME$.", "placeholders": { "screen_name": { "content": "CoolPerson2000" } } }, "I_want_see_blocked_user": { "message": "Yes, view profile" }, diff --git a/layouts/header/script.js b/layouts/header/script.js index a00028f2..fbec18e1 100644 --- a/layouts/header/script.js +++ b/layouts/header/script.js @@ -3007,7 +3007,7 @@ setInterval(() => { userDataFunction(u); }); } - }, 1750); + }, 0); // fixes a bug where user info doesn't load on the profile page occasionally setTimeout(() => { let version = document.getElementById('oldtwitter-version'); let version2 = document.getElementById('oldtwitter-version-left'); diff --git a/layouts/profile/script.js b/layouts/profile/script.js index 322b823c..de4733ca 100644 --- a/layouts/profile/script.js +++ b/layouts/profile/script.js @@ -196,13 +196,17 @@ function updateUserData() { API.user.get(user_handle, false), API.account.verifyCredentials() ]).catch(e => { + if(String(e).includes("reading 'result'")) { + document.getElementById('loading-box').hidden = true; + document.getElementById('profile-name').innerText = `@${user_handle}`; + document.getElementById('timeline').innerHTML = html`

${LOC.nonexistent_user.message}

${LOC.nonexistent_user_desc.message.replaceAll("$SCREEN_NAME$",pageUser.screen_name)}

`; + document.getElementById('profile-avatar').src = 'moz-extension://9605be5b-b11d-4459-879e-2b65fd1d7bca/images/default_profile_images/default_profile_0_400x400.png'; + return; + } document.getElementById('loading-box').hidden = false; if(String(e).includes('User has been suspended.')) { return document.getElementById('loading-box-error').innerHTML = html`${LOC.user_was_suspended.message}
${LOC.go_homepage.message}`; } - if(String(e).includes("reading 'result'")) { - return document.getElementById('loading-box-error').innerHTML = html`${LOC.user_was_not_found.message}
${LOC.go_homepage.message}`; - } return document.getElementById('loading-box-error').innerHTML = html`${String(e)}.
${LOC.go_homepage.message}`; }); if(oldUser.reason) { @@ -214,10 +218,19 @@ function updateUserData() { } if(pageUserData.reason) { let e = pageUserData.reason; - document.getElementById('loading-box').hidden = false; if(String(e).includes("reading 'result'")) { - return document.getElementById('loading-box-error').innerHTML = html`${LOC.user_was_not_found.message}
${LOC.go_homepage.message}`; + document.getElementById('loading-box').hidden = true; + document.getElementById('profile-name').innerText = `@${user_handle}`; + document.getElementById('timeline').innerHTML = html`

${LOC.nonexistent_user.message}

${LOC.nonexistent_user_desc.message.replaceAll("$SCREEN_NAME$",pageUser.screen_name)}

`; + document.getElementById('trends').hidden = true; + document.getElementById('profile-nav-center-cell').style.display = 'none'; // ??? + document.getElementById('profile-banner-sticky').style.backgroundColor = 'var(--background-color)'; + document.getElementById('wtf').hidden = true; + document.getElementById('profile-nav').style.boxShadow = 'none'; + document.getElementById('profile-avatar').src = chrome.runtime.getURL(`images/default_profile_images/default_profile_0_normal.png`); + return; } + document.getElementById('loading-box').hidden = false; return document.getElementById('loading-box-error').innerHTML = html`${String(e)}.
${LOC.go_homepage.message}`; } followersYouFollowData = followersYouFollowData.value;