From b5b0e3540d16d2b064aab63e298c72a1db3a445f Mon Sep 17 00:00:00 2001 From: GODrums Date: Thu, 5 Dec 2024 07:35:49 +0100 Subject: [PATCH 1/3] fix: steam market sticker container --- src/lib/components/market/helpers.ts | 14 +++++++++++++- src/lib/components/market/item_row_wrapper.ts | 12 ++++++++++-- src/lib/types/steam.d.ts | 13 ++++++++----- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/lib/components/market/helpers.ts b/src/lib/components/market/helpers.ts index bce048f..360731b 100644 --- a/src/lib/components/market/helpers.ts +++ b/src/lib/components/market/helpers.ts @@ -107,6 +107,12 @@ function generateKeychainInlineHTML(itemInfo: ItemInfo, asset: rgAsset): string[ export function inlineStickersAndKeychains(itemNameBlock: JQuery, itemInfo: ItemInfo, asset: rgAsset) { if (!itemNameBlock) return; + // Remove Steam's inspect button + itemNameBlock.parent().find('.market_listing_row_action')?.parent().remove(); + // Remove Steam's stickers and keychains + itemNameBlock.parent().find('.market_listing_row_details')?.remove(); + + if (itemNameBlock.find('.csfloat-stickers-container').length) { // Don't inline stickers if they're already inlined return; @@ -117,11 +123,16 @@ export function inlineStickersAndKeychains(itemNameBlock: JQuery, itemI return; } + const elementId = `listing_${itemInfo.m}_csfloat`; + itemNameBlock.prepend(` -
+
${blobs.reduce((acc, v) => acc + v, '')}
`); + + // Add Steam's item popover on-hover + CreateItemHoverFromContainer(g_rgAssets, elementId, asset.appid, asset.contextid, asset.id, asset.amount); } /** @@ -136,3 +147,4 @@ export function inlineEasyInspect(itemImgContainer: JQuery, inspectLink 🔍 `); } + diff --git a/src/lib/components/market/item_row_wrapper.ts b/src/lib/components/market/item_row_wrapper.ts index 12383a7..e062ba1 100644 --- a/src/lib/components/market/item_row_wrapper.ts +++ b/src/lib/components/market/item_row_wrapper.ts @@ -140,6 +140,15 @@ export class ItemRowWrapper extends FloatElement { // dialogs opening. MarketCheckHash(); } + + + // Make sure the parent containers can overflow + const parentContainer = $J(this).parent(); + if (parentContainer) { + parentContainer.css('overflow', 'visible'); + parentContainer.parent().css('overflow', 'visible'); + } + } render() { @@ -161,8 +170,7 @@ export class ItemRowWrapper extends FloatElement { return html`
${this.renderFloatBar()} - Float: ${this.itemInfo.floatvalue.toFixed(14)} ${renderClickableRank(this.itemInfo)} -
+ Float: ${this.itemInfo.floatvalue.toFixed(14)} ${renderClickableRank(this.itemInfo)} Paint Seed: ${formatSeed(this.itemInfo)}${fadePercentage !== undefined ? html`
diff --git a/src/lib/types/steam.d.ts b/src/lib/types/steam.d.ts index a4abd9e..10e8e58 100644 --- a/src/lib/types/steam.d.ts +++ b/src/lib/types/steam.d.ts @@ -219,16 +219,18 @@ export interface TradeInventory { success: boolean; } +export type SteamAssets = { + [appId in AppId]: { + [contextId in ContextId]: {[assetId: string]: rgAsset}; + }; +} + // Declares globals available in the Steam Page Context declare global { const $J: typeof $; const g_rgListingInfo: {[listingId: string]: ListingData}; const g_rgWalletInfo: WalletInfo | undefined; // Not populated when user is signed-out - const g_rgAssets: { - [appId in AppId]: { - [contextId in ContextId]: {[assetId: string]: rgAsset}; - }; - }; + const g_rgAssets: SteamAssets; const g_ActiveInventory: CInventory | undefined; // Only populated on Steam inventory pages const g_steamID: string; const g_oSearchResults: CAjaxPagingControls; @@ -250,6 +252,7 @@ declare global { const MoveItemToTrade: (el: HTMLElement) => void; // Only populated on create offer pages const g_rgCurrentTradeStatus: CurrentTradeStatus; const ShowItemInventory: (appID: AppId, contextID: ContextId, AssetID?: number) => void; + const CreateItemHoverFromContainer: (g_rgAssets: SteamAssets, elementId: string, appid: AppId, contextid: string, id: string, amount: number) => void; } export {}; From 92b1c2bec56bd233388bda2aa4e6b3af755f0b0d Mon Sep 17 00:00:00 2001 From: GODrums Date: Thu, 5 Dec 2024 08:02:56 +0100 Subject: [PATCH 2/3] chore: run format --- src/lib/components/market/helpers.ts | 2 -- src/lib/components/market/item_row_wrapper.ts | 6 +++--- src/lib/types/steam.d.ts | 11 +++++++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/lib/components/market/helpers.ts b/src/lib/components/market/helpers.ts index 360731b..8456532 100644 --- a/src/lib/components/market/helpers.ts +++ b/src/lib/components/market/helpers.ts @@ -111,7 +111,6 @@ export function inlineStickersAndKeychains(itemNameBlock: JQuery, itemI itemNameBlock.parent().find('.market_listing_row_action')?.parent().remove(); // Remove Steam's stickers and keychains itemNameBlock.parent().find('.market_listing_row_details')?.remove(); - if (itemNameBlock.find('.csfloat-stickers-container').length) { // Don't inline stickers if they're already inlined @@ -147,4 +146,3 @@ export function inlineEasyInspect(itemImgContainer: JQuery, inspectLink 🔍 `); } - diff --git a/src/lib/components/market/item_row_wrapper.ts b/src/lib/components/market/item_row_wrapper.ts index e062ba1..f42df8f 100644 --- a/src/lib/components/market/item_row_wrapper.ts +++ b/src/lib/components/market/item_row_wrapper.ts @@ -141,14 +141,12 @@ export class ItemRowWrapper extends FloatElement { MarketCheckHash(); } - // Make sure the parent containers can overflow const parentContainer = $J(this).parent(); if (parentContainer) { parentContainer.css('overflow', 'visible'); parentContainer.parent().css('overflow', 'visible'); } - } render() { @@ -170,7 +168,9 @@ export class ItemRowWrapper extends FloatElement { return html`
${this.renderFloatBar()} - Float: ${this.itemInfo.floatvalue.toFixed(14)} ${renderClickableRank(this.itemInfo)} + + Float: ${this.itemInfo.floatvalue.toFixed(14)} ${renderClickableRank(this.itemInfo)} + Paint Seed: ${formatSeed(this.itemInfo)}${fadePercentage !== undefined ? html`
diff --git a/src/lib/types/steam.d.ts b/src/lib/types/steam.d.ts index 10e8e58..10ab8bb 100644 --- a/src/lib/types/steam.d.ts +++ b/src/lib/types/steam.d.ts @@ -223,7 +223,7 @@ export type SteamAssets = { [appId in AppId]: { [contextId in ContextId]: {[assetId: string]: rgAsset}; }; -} +}; // Declares globals available in the Steam Page Context declare global { @@ -252,7 +252,14 @@ declare global { const MoveItemToTrade: (el: HTMLElement) => void; // Only populated on create offer pages const g_rgCurrentTradeStatus: CurrentTradeStatus; const ShowItemInventory: (appID: AppId, contextID: ContextId, AssetID?: number) => void; - const CreateItemHoverFromContainer: (g_rgAssets: SteamAssets, elementId: string, appid: AppId, contextid: string, id: string, amount: number) => void; + const CreateItemHoverFromContainer: ( + g_rgAssets: SteamAssets, + elementId: string, + appid: AppId, + contextid: string, + id: string, + amount: number + ) => void; } export {}; From 1073df51b10571aa4765f1b9e50c55c762934e7f Mon Sep 17 00:00:00 2001 From: GODrums Date: Thu, 5 Dec 2024 08:20:37 +0100 Subject: [PATCH 3/3] fix: keychain exit condition --- src/lib/components/market/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/market/helpers.ts b/src/lib/components/market/helpers.ts index 8456532..18e50fe 100644 --- a/src/lib/components/market/helpers.ts +++ b/src/lib/components/market/helpers.ts @@ -88,7 +88,7 @@ function generateStickerInlineHTML(itemInfo: ItemInfo, asset: rgAsset): string[] function generateKeychainInlineHTML(itemInfo: ItemInfo, asset: rgAsset): string[] { const description = getKeychainDescription(itemInfo, asset); - if (!description || description.type !== 'html' || !description.value.includes('sticker')) { + if (!description || description.type !== 'html' || description.value.includes('sticker')) { return []; }