From a0bc3e4a9fa24d92ebb8bdcf6b706233e01fa3d7 Mon Sep 17 00:00:00 2001 From: Dan C Date: Fri, 9 Dec 2016 22:32:20 +0200 Subject: [PATCH] FIX: Multiple spaces between Quick and Instant sell buttons A check was readded in order to fix this bug and another one where buttons with wrong prices would be shown for a few moments. The bug manifests when clicking multiple items in inventory before one or more had a chance to finish loading the pricing information. And when done loading the information is inserted without checking whether it belongs to the item currently selected. --- enhancedsteam.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/enhancedsteam.js b/enhancedsteam.js index c1d7d57e..52d2679b 100644 --- a/enhancedsteam.js +++ b/enhancedsteam.js @@ -5258,15 +5258,18 @@ function inventory_market_helper(response) { if (market.highest_buy_order) { $(thisItem).data("price-low", price_low); } - - $(thisItem).addClass("es-price-loaded"); - // Add "Quick Sell" button - if (price_high > price_low) { - $("#es_quicksell" + item).attr("price", price_high).html("" + localized_strings.quick_sell.replace("__amount__", formatCurrency(price_high, currency_number_to_type(wallet_currency))) + "").show().before("
"); - } - // Add "Instant Sell" button - if (market.highest_buy_order) { - $("#es_instantsell" + item).attr("price", price_low).html("" + localized_strings.instant_sell.replace("__amount__", formatCurrency(price_low, currency_number_to_type(wallet_currency))) + "").show().before("
"); + // Fixes multiple buttons + //console.log($(".item.activeInfo").is($(thisItem)), $(".item.activeInfo").prop("id"), $(thisItem).prop("id")); + if ($(".item.activeInfo").is($(thisItem))) { + $(thisItem).addClass("es-price-loaded"); + // Add "Quick Sell" button + if (price_high > price_low) { + $("#es_quicksell" + item).attr("price", price_high).html("" + localized_strings.quick_sell.replace("__amount__", formatCurrency(price_high, currency_number_to_type(wallet_currency))) + "").show().before("
"); + } + // Add "Instant Sell" button + if (market.highest_buy_order) { + $("#es_instantsell" + item).attr("price", price_low).html("" + localized_strings.instant_sell.replace("__amount__", formatCurrency(price_low, currency_number_to_type(wallet_currency))) + "").show().before("
"); + } } }).complete(function(){ $(thisItem).removeClass("es-loading");