');
}
}, () => {
@@ -1701,17 +1669,17 @@
let itemsString = '';
for (const itemName in itemsWithQty) {
- itemsString += '&items[]=' + encodeURIComponent(itemName) + '&qty[]=' + itemsWithQty[itemName];
+ itemsString += `&items[]=${encodeURIComponent(itemName)}&qty[]=${itemsWithQty[itemName]}`;
}
- const baseUrl = window.location.origin + '/market/multisell';
- const redirectUrl = baseUrl + '?appid=' + appid + '&contextid=' + contextid + itemsString;
+ const baseUrl = `${window.location.origin}/market/multisell`;
+ const redirectUrl = `${baseUrl}?appid=${appid}&contextid=${contextid}${itemsString}`;
- const dialog = unsafeWindow.ShowDialog('Steam Economy Enhancer', '
');
+ const dialog = unsafeWindow.ShowDialog('Steam Economy Enhancer', `
`);
dialog.OnDismiss(() => {
items.forEach((item) => {
const itemId = item.assetid || item.id;
- $('#' + item.appid + '_' + item.contextid + '_' + itemId).css('background', COLOR_PENDING);
+ $(`#${item.appid}_${item.contextid}_${itemId}`).css('background', COLOR_PENDING);
});
});
});
@@ -1742,9 +1710,9 @@
totalNumberOfQueuedItems += numberOfQueuedItems;
$('#inventory_items_spinner').remove();
- $('#inventory_sell_buttons').append('
' +
- spinnerBlock +
- '
Processing ' + numberOfQueuedItems + ' items
' +
+ $('#inventory_sell_buttons').append(`
${
+ spinnerBlock
+ }
Processing ${numberOfQueuedItems} items
` +
'
');
}
}
@@ -1797,7 +1765,7 @@
true,
(err, history, cachedHistory) => {
if (err) {
- logConsole('Failed to get price history for ' + itemName);
+ logConsole(`Failed to get price history for ${itemName}`);
if (err == ERROR_FAILED) {
failed += 1;
@@ -1809,7 +1777,7 @@
true,
(err, histogram, cachedListings) => {
if (err) {
- logConsole('Failed to get orders histogram for ' + itemName);
+ logConsole(`Failed to get orders histogram for ${itemName}`);
if (err == ERROR_FAILED) {
failed += 1;
@@ -1832,11 +1800,7 @@
);
- logConsole('Sell price: ' +
- sellPrice / 100.0 +
- ' (' +
- market.getPriceIncludingFees(sellPrice) / 100.0 +
- ')');
+ logConsole(`Sell price: ${sellPrice / 100.0} (${market.getPriceIncludingFees(sellPrice) / 100.0})`);
sellQueue.push({
item: item,
@@ -1851,7 +1815,7 @@
}
// Initialize the inventory UI.
- function initializeInventoryUI() {
+ function initializeInventoryUI() {
const isOwnInventory = unsafeWindow.g_ActiveUser.strSteamId == unsafeWindow.g_steamID;
let previousSelection = -1; // To store the index of the previous selection.
updateInventoryUI(isOwnInventory);
@@ -2031,11 +1995,11 @@
$('.sell_selected').show();
if (canSellSelectedItemsManually(items)) {
$('.sell_manual').show();
- $('.sell_manual > span').text('Sell ' + selectedItems + (selectedItems == 1 ? ' Item Manual' : ' Items Manual'));
+ $('.sell_manual > span').text(`Sell ${selectedItems}${selectedItems == 1 ? ' Item Manual' : ' Items Manual'}`);
} else {
$('.sell_manual').hide();
}
- $('.sell_selected > span').text('Sell ' + selectedItems + (selectedItems == 1 ? ' Item' : ' Items'));
+ $('.sell_selected > span').text(`Sell ${selectedItems}${selectedItems == 1 ? ' Item' : ' Items'}`);
}
});
}
@@ -2049,7 +2013,7 @@
} else {
$('.turn_into_gems').show();
$('.turn_into_gems > span').
- text('Turn ' + selectedItems + (selectedItems == 1 ? ' Item Into Gems' : ' Items Into Gems'));
+ text(`Turn ${selectedItems}${selectedItems == 1 ? ' Item Into Gems' : ' Items Into Gems'}`);
}
});
}
@@ -2063,7 +2027,7 @@
} else {
$('.unpack_booster_packs').show();
$('.unpack_booster_packs > span').
- text('Unpack ' + selectedItems + (selectedItems == 1 ? ' Booster Pack' : ' Booster Packs'));
+ text(`Unpack ${selectedItems}${selectedItems == 1 ? ' Booster Pack' : ' Booster Packs'}`);
}
});
}
@@ -2075,7 +2039,7 @@
}
function updateInventorySelection(selectedItem) {
- const item_info = $('#iteminfo' + unsafeWindow.iActiveSelectView);
+ const item_info = $(`#iteminfo${unsafeWindow.iActiveSelectView}`);
if (!item_info.length) {
return;
@@ -2089,7 +2053,7 @@
const item_info_id = item_info.attr('id');
// Move scrap to bottom, this is of little interest.
- const scrap = $('#' + item_info_id + '_scrap_content');
+ const scrap = $(`#${item_info_id}_scrap_content`);
scrap.next().insertBefore(scrap);
// Skip unmarketable items
@@ -2114,19 +2078,19 @@
}
};
- const ownerActions = $('#' + item_info_id + '_item_owner_actions');
+ const ownerActions = $(`#${item_info_id}_item_owner_actions`);
// Move market link to a button
- ownerActions.append('
View in Community Market');
- $('#' + item_info_id + '_item_market_actions > div:nth-child(1) > div:nth-child(1)').hide();
+ ownerActions.append(`
View in Community Market`);
+ $(`#${item_info_id}_item_market_actions > div:nth-child(1) > div:nth-child(1)`).hide();
// ownerActions is hidden on other games' inventories, we need to show it to have a "Market" button visible
ownerActions.show();
const isBoosterPack = selectedItem.name.toLowerCase().endsWith('booster pack');
if (isBoosterPack) {
- const tradingCardsUrl = '/market/search?q=&category_753_Game%5B%5D=tag_app_' + selectedItem.market_fee_app + '&category_753_item_class%5B%5D=tag_item_class_2&appid=753';
- ownerActions.append('
View trading cards in Community Market');
+ const tradingCardsUrl = `/market/search?q=&category_753_Game%5B%5D=tag_app_${selectedItem.market_fee_app}&category_753_item_class%5B%5D=tag_item_class_2&appid=753`;
+ ownerActions.append(`
View trading cards in Community Market`);
}
if (getSettingWithDefault(SETTING_QUICK_SELL_BUTTONS) != 1) {
@@ -2143,7 +2107,7 @@
false,
(err, histogram) => {
if (err) {
- logConsole('Failed to get orders histogram for ' + (selectedItem.name || selectedItem.description.name));
+ logConsole(`Failed to get orders histogram for ${selectedItem.name || selectedItem.description.name}`);
return;
}
@@ -2152,16 +2116,18 @@
return;
}
- const groupMain = $('
' +
- '
Sell
' +
- histogram.sell_order_table +
- '
' +
- '
Buy
' +
- histogram.buy_order_table +
- '
' +
- '
');
+ const groupMain = $(`
+
+
Sell
+ ${histogram.sell_order_table}
+
+
+
Buy
+ ${histogram.buy_order_table}
+
+
`);
- $('#' + item_info_id + '_item_market_actions > div').after(groupMain);
+ $(`#${item_info_id}_item_market_actions > div`).after(groupMain);
// Generate quick sell buttons.
let prices = [];
@@ -2182,30 +2148,25 @@
let buttons = ' ';
prices.forEach((e) => {
- buttons +=
- '
' +
- '' +
- '' +
- formatPrice(e) +
- '' +
- '' +
- '' +
- '';
+ buttons += `
+
+ ${formatPrice(e)}
+
+
+ `;
});
- $('#' + item_info_id + '_item_market_actions', item_info).append(buttons);
+ $(`#${item_info_id}_item_market_actions`, item_info).append(buttons);
- $('#' + item_info_id + '_item_market_actions', item_info).append('
');
+ $(`#${item_info_id}_item_market_actions`, item_info).append(`
`);
$('.quick_sell').on(
'click',
@@ -2225,7 +2186,7 @@
$('.quick_sell_custom').on(
'click',
() => {
- let price = $('#quick_sell_input', $('#' + item_info_id + '_item_market_actions', item_info)).val() * 100;
+ let price = $('#quick_sell_input', $(`#${item_info_id}_item_market_actions`, item_info)).val() * 100;
price = market.getPriceBeforeFees(price);
totalNumberOfQueuedItems++;
@@ -2244,7 +2205,7 @@
function updateInventoryUI(isOwnInventory) {
// Remove previous containers (e.g., when a user changes inventory).
$('#inventory_sell_buttons').remove();
- $('#price_options').remove();
+ $('#see_settings_modal').remove();
$('#inventory_reload_button').remove();
$('#see_settings').remove();
@@ -2256,21 +2217,27 @@
const showMiscOptions = appId == 753;
const TF2 = appId == 440;
- const sellButtons = $('
');
+ let buttonsHtml = `
+
Sell All Items
+
Sell All Duplicate Items
+
Sell Selected Items
+
Sell Manually
+ `;
+
+ if (showMiscOptions) {
+ buttonsHtml += `
+
Sell All Cards
+
+ `;
+ } else if (TF2) {
+ buttonsHtml += '
Sell All Crates';
+ }
+
+ const sellButtons = $(`
${buttonsHtml}
`);
const reloadButton =
$('
Reload Inventory');
@@ -2416,12 +2383,12 @@
if (currentPage == PAGE_INVENTORY || currentPage == PAGE_TRADEOFFER) {
// Gets the active inventory.
- function getActiveInventory() {
+ function getActiveInventory() {
return unsafeWindow.g_ActiveInventory;
}
// Sets the prices for the items.
- function setInventoryPrices(items) {
+ function setInventoryPrices(items) {
inventoryPriceQueue.kill();
items.forEach((item) => {
@@ -2486,7 +2453,7 @@
true,
(err, histogram, cachedListings) => {
if (err) {
- logConsole('Failed to get orders histogram for ' + itemName);
+ logConsole(`Failed to get orders histogram for ${itemName}`);
if (err == ERROR_FAILED) {
failed += 1;
@@ -2503,16 +2470,11 @@
? '∞'
: formatPrice(market.getPriceIncludingFees(sellPrice));
- const elementName = (currentPage == PAGE_TRADEOFFER ? '#item' : '#') +
- item.appid +
- '_' +
- item.contextid +
- '_' +
- item.id;
+ const elementName = `${(currentPage == PAGE_TRADEOFFER ? '#item' : '#')}${item.appid}_${item.contextid}_${item.id}`;
const element = $(elementName);
$('.inventory_item_price', element).remove();
- element.append('
' + itemPrice + '');
+ element.append(`
${itemPrice}`);
return callback(true, cachedListings);
}
@@ -2653,7 +2615,7 @@
true,
(errorPriceHistory, history, cachedHistory) => {
if (errorPriceHistory) {
- logConsole('Failed to get price history for ' + game_name);
+ logConsole(`Failed to get price history for ${game_name}`);
if (errorPriceHistory == ERROR_FAILED) {
failed += 1;
@@ -2665,7 +2627,7 @@
true,
(errorHistogram, histogram, cachedListings) => {
if (errorHistogram) {
- logConsole('Failed to get orders histogram for ' + game_name);
+ logConsole(`Failed to get orders histogram for ${game_name}`);
if (errorHistogram == ERROR_FAILED) {
failed += 1;
@@ -2684,14 +2646,14 @@
$(
'.market_table_value > span:nth-child(1) > span:nth-child(1) > span:nth-child(1)',
listingUI
- ).append(' ➤
' +
- highestBuyOrderPrice +
- '');
+ ).append(` ➤
${
+ highestBuyOrderPrice
+ }`);
logConsole('============================');
logConsole(JSON.stringify(listing));
- logConsole(game_name + ': ' + asset.name);
- logConsole('Current price: ' + price / 100.0);
+ logConsole(`${game_name}: ${asset.name}`);
+ logConsole(`Current price: ${price / 100.0}`);
// Calculate two prices here, one without the offset and one with the offset.
// The price without the offset is required to not relist the item constantly when you have the lowest price (i.e., with a negative offset).
@@ -2714,17 +2676,13 @@
const sellPriceWithoutOffsetWithFees = market.getPriceIncludingFees(sellPriceWithoutOffset);
- logConsole('Calculated price: ' +
- sellPriceWithoutOffsetWithFees / 100.0 +
- ' (' +
- sellPriceWithoutOffset / 100.0 +
- ')');
+ logConsole(`Calculated price: ${sellPriceWithoutOffsetWithFees / 100.0} (${sellPriceWithoutOffset / 100.0})`);
- listingUI.addClass('price_' + sellPriceWithOffset);
+ listingUI.addClass(`price_${sellPriceWithOffset}`);
$('.market_listing_my_price', listingUI).last().prop(
'title',
- 'The best price is ' + formatPrice(sellPriceWithoutOffsetWithFees) + '.'
+ `The best price is ${formatPrice(sellPriceWithoutOffsetWithFees)}.`
);
if (sellPriceWithoutOffsetWithFees < price) {
@@ -2807,7 +2765,7 @@
const decodedMarketHashName = decodeURIComponent(itemName.substring(marketHashNameIndex));
let newAssetId = -1;
- unsafeWindow.RequestFullInventory(market.inventoryUrl + item.appid + '/' + item.contextid + '/', {}, null, null, (transport) => {
+ unsafeWindow.RequestFullInventory(`${market.inventoryUrl + item.appid}/${item.contextid}/`, {}, null, null, (transport) => {
if (transport.responseJSON && transport.responseJSON.success) {
const inventory = transport.responseJSON.rgInventory;
@@ -2957,7 +2915,7 @@
const marketListingsItemsQueue = async.queue(
(listing, next) => {
$.get(
- window.location.origin + '/market/mylistings?count=100&start=' + listing,
+ `${window.location.origin}/market/mylistings?count=100&start=${listing}`,
(data) => {
if (!data || !data.success) {
increaseMarketProgress();
@@ -3036,10 +2994,10 @@
// Buy orders and listings confirmations are not grouped like the sell listings, add this so pagination works there as well.
if (!$(this).attr('id')) {
- $(this).attr('id', 'market-listing-' + e);
+ $(this).attr('id', `market-listing-${e}`);
- $(this).append('
');
- $('.market_listing_row', $(this)).appendTo($('#market-listing-container-' + e));
+ $(this).append(`
`);
+ $('.market_listing_row', $(this)).appendTo($(`#market-listing-container-${e}`));
} else {
$(this).children().last().addClass('market_listing_see');
}
@@ -3073,7 +3031,7 @@
}
}
- $('#my_market_selllistings_number').append('
, ' + formatPrice(totalPriceBuyer) + ' ➤ ' + formatPrice(totalPriceSeller) + '');
+ $('#my_market_selllistings_number').append(`
, ${formatPrice(totalPriceBuyer)} ➤ ${formatPrice(totalPriceSeller)}`);
}
@@ -3206,9 +3164,9 @@
$('.market_pagesize_options').hide();
// Show the spinner so the user knows that something is going on.
- $('.my_market_header').eq(0).append('
' +
- spinnerBlock +
- '
Loading market listings
' +
+ $('.my_market_header').eq(0).append(`
${
+ spinnerBlock
+ }
Loading market listings
` +
'
');
while (currentCount < totalCount) {
@@ -3294,7 +3252,7 @@
asc = false;
}
- $(this).text($(this).text().replace(' ' + arrow_down, '').replace(' ' + arrow_up, ''));
+ $(this).text($(this).text().replace(` ${arrow_down}`, '').replace(` ${arrow_up}`, ''));
});
let market_listing_selector;
@@ -3305,7 +3263,7 @@
} else if (isName) {
market_listing_selector = $('.market_listing_table_header', elem).children().eq(3);
}
- market_listing_selector.text(market_listing_selector.text() + ' ' + (asc ? arrow_up : arrow_down));
+ market_listing_selector.text(`${market_listing_selector.text()} ${asc ? arrow_up : arrow_down}`);
if (list.sort == null) {
return;
@@ -3384,12 +3342,12 @@
function getListingFromLists(listingid) {
// Sometimes listing ids are contained in multiple lists (?), use the last one available as this is the one we're most likely interested in.
for (let i = marketLists.length - 1; i >= 0; i--) {
- let values = marketLists[i].get('market_listing_item_name', 'mylisting_' + listingid + '_name');
+ let values = marketLists[i].get('market_listing_item_name', `mylisting_${listingid}_name`);
if (values != null && values.length > 0) {
return values[0];
}
- values = marketLists[i].get('market_listing_item_name', 'mbuyorder_' + listingid + '_name');
+ values = marketLists[i].get('market_listing_item_name', `mbuyorder_${listingid}_name`);
if (values != null && values.length > 0) {
return values[0];
}
@@ -3400,63 +3358,50 @@
function removeListingFromLists(listingid) {
for (let i = 0; i < marketLists.length; i++) {
- marketLists[i].remove('market_listing_item_name', 'mylisting_' + listingid + '_name');
- marketLists[i].remove('market_listing_item_name', 'mbuyorder_' + listingid + '_name');
+ marketLists[i].remove('market_listing_item_name', `mylisting_${listingid}_name`);
+ marketLists[i].remove('market_listing_item_name', `mbuyorder_${listingid}_name`);
}
}
// Initialize the market UI.
- function initializeMarketUI() {
+ function initializeMarketUI() {
$('.market_header_text').append('