diff --git a/layouts/home/script.js b/layouts/home/script.js index f088bd41..79a1f4e5 100644 --- a/layouts/home/script.js +++ b/layouts/home/script.js @@ -195,7 +195,6 @@ async function updateTimeline(mode = 'rewrite') { if(vars.linkColorsInTL) { let tlUsers = tl.map(t => t.user.id_str).filter(u => !linkColors[u]); let linkData = await getLinkColors(tlUsers); - console.log(linkData) if(linkData) for(let i in linkData) { linkColors[linkData[i].id] = linkData[i].color; } @@ -297,7 +296,6 @@ async function renderTimeline(options = {}) { if(vars.linkColorsInTL) { let tlUsers = data.map(t => t.user.id_str).filter(u => !linkColors[u]); let linkData = await getLinkColors(tlUsers); - console.log(linkData) if(linkData) for(let i in linkData) { linkColors[linkData[i].id] = linkData[i].color; } @@ -398,7 +396,6 @@ setTimeout(async () => { if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight - 5000 && window.scrollY > 20) { if (loadingNewTweets || timeline.data.length === 0) return; document.getElementById('load-more').click(); - console.log("Loading more tweets..."); } }, { passive: true }); diff --git a/scripts/helpers.js b/scripts/helpers.js index d84f8fe6..c8959664 100644 --- a/scripts/helpers.js +++ b/scripts/helpers.js @@ -1089,21 +1089,20 @@ const getLinkColors = async ids => { new Promise(async (resolve, reject) => { // firstly, get "legacyLinkColors" from storage chrome.storage.local.get(["legacyLinkColors"], async data => { - console.log(data); let legacyLinkColors = data.legacyLinkColors || {}; // each id will either have a hex colour or -1 if the user doesn't have a custom link colour let hasColourIds = ids.filter(id => legacyLinkColors[id] && legacyLinkColors[id] !== -1); let noColourIds = ids.filter(id => legacyLinkColors[id] && legacyLinkColors[id] === -1); let fetched = []; let toFetch = ids.filter(id => !hasColourIds.includes(id) && !noColourIds.includes(id)); - console.log("Fetching uncached user colours:", toFetch); let users = []; - try { - users = await API.user.lookup(toFetch); - } catch { - console.warn("User colours didn't fetch (were there any?)") + if (toFetch.length > 0) { + try { + users = await API.user.lookup(toFetch); + } catch { + console.warn("Legacy user colours failed to fetch!") + } } - console.log(150, users); for(let user of users) { if(user.profile_link_color && user.profile_link_color !== "1DA1F2") { fetched.push({id: user.id_str, color: user.profile_link_color}); @@ -1117,7 +1116,6 @@ const getLinkColors = async ids => { fetched.push({id, color: legacyLinkColors[id]}); } chrome.storage.local.set({legacyLinkColors}, () => {}); - console.log("Fetched user colours:", fetched); resolve(fetched); }); })