From 6923b4307acade2ba1aa6b0532e0f4a43ba06695 Mon Sep 17 00:00:00 2001 From: GODrums Date: Thu, 19 Dec 2024 03:00:10 +0100 Subject: [PATCH] update variable names --- src/lib/page_scripts/trade_offers.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/page_scripts/trade_offers.ts b/src/lib/page_scripts/trade_offers.ts index c390828..93c4d2b 100644 --- a/src/lib/page_scripts/trade_offers.ts +++ b/src/lib/page_scripts/trade_offers.ts @@ -22,10 +22,10 @@ async function fetchTradeOffers(steam_id: string, isSentPage: boolean) { const g_steamTrades = JSON.parse(localStorage.getItem('g_steamTrades') || '{}') as FetchSteamTradesResponse; let refetchRequired = true; if (g_steamTrades.sent || g_steamTrades.received) { - const latestTradeId = Number.parseInt(g_steamTrades[isSentPage ? 'sent' : 'received']?.[0].tradeofferid); - const latestTradeIDFromPage = Number.parseInt(document.querySelector('.tradeoffer')?.id.split('_')[1] ?? '0'); + const latestTradeOfferID = Number.parseInt(g_steamTrades[isSentPage ? 'sent' : 'received']?.[0].tradeofferid); + const latestTradeOfferIDFromPage = Number.parseInt(document.querySelector('.tradeoffer')?.id.split('_')[1] ?? '0'); - refetchRequired = Number.isNaN(latestTradeId) || latestTradeId !== latestTradeIDFromPage; + refetchRequired = Number.isNaN(latestTradeOfferID) || latestTradeOfferID !== latestTradeOfferIDFromPage; } if (!refetchRequired) { @@ -59,10 +59,10 @@ async function annotateTradeOfferItemElements() { const tradeOfferID = tradeOffer.id.split('_')[1]; const tradeItemElements = tradeOffer.querySelectorAll('.trade_item'); - const trade = isSentPage + const tradeOfferAPI = isSentPage ? steamTrades.sent.find((t) => t.tradeofferid === tradeOfferID) : steamTrades.received.find((t) => t.tradeofferid === tradeOfferID); - if (!trade) { + if (!tradeOfferAPI) { continue; } @@ -85,13 +85,13 @@ async function annotateTradeOfferItemElements() { } let isOwnItem = true; - let apiItem = trade?.items_to_give?.find((a) => a.classid === classId && a.instanceid === instanceId); + let apiItem = tradeOfferAPI?.items_to_give?.find((a) => a.classid === classId && a.instanceid === instanceId); if (!apiItem) { isOwnItem = false; - apiItem = trade?.items_to_receive?.find((a) => a.classid === classId && a.instanceid === instanceId); + apiItem = tradeOfferAPI?.items_to_receive?.find((a) => a.classid === classId && a.instanceid === instanceId); } - const ownerId = isOwnItem ? steam_id : convertToSteamID64(trade.accountid_other); + const ownerId = isOwnItem ? steam_id : convertToSteamID64(tradeOfferAPI.accountid_other); if (ownerId) { tradeItemElement.setAttribute('data-csfloat-owner-steamid', ownerId);