From 5bba388ce2f1a210ad4bad125681e5308ee7cdc3 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Mon, 22 Jul 2024 21:23:11 +0300 Subject: [PATCH 1/2] Use multiline template literals for html/css --- .editorconfig | 9 + code.user.js | 407 +++++++++++++++++++++++----------------------- eslint.config.mjs | 3 +- 3 files changed, 218 insertions(+), 201 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..de1f522 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +# http://editorconfig.org + +root = true + +[*] +charset = utf-8 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/code.user.js b/code.user.js index b8ba39b..1b24a4f 100644 --- a/code.user.js +++ b/code.user.js @@ -1851,7 +1851,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); @@ -2152,14 +2152,16 @@ 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); @@ -2182,30 +2184,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('
' + - '' + - ' ' + - '' + - '➜ Sell' + - '' + - '' + - '' + - '
'); + $('#' + item_info_id + '_item_market_actions', item_info).append(`
+   + + + ➜ Sell + + + +
`); $('.quick_sell').on( 'click', @@ -2244,7 +2241,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 +2253,27 @@ const showMiscOptions = appId == 753; const TF2 = appId == 440; - const sellButtons = $('
' + - 'Sell All Items' + - 'Sell All Duplicate Items' + - '' + - '' + - (showMiscOptions - ? 'Sell All Cards' + - '' - : '') + - (TF2 ? 'Sell All Crates' : '') + - '
'); + let buttonsHtml = ` + Sell All Items + Sell All Duplicate Items + + + `; + + if (showMiscOptions) { + buttonsHtml += ` + Sell All Cards +
+ + Turn All Duplicate Items Into Gems + +
+ `; + } else if (TF2) { + buttonsHtml += 'Sell All Crates'; + } + + const sellButtons = $(`
${buttonsHtml}
`); const reloadButton = $('Reload Inventory'); @@ -2416,12 +2419,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) => { @@ -3406,57 +3409,44 @@ } // Initialize the market UI. - function initializeMarketUI() { + function initializeMarketUI() { $('.market_header_text').append('