diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b5fdd0..3ad2ca9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -279,4 +279,8 @@ ## [2.2.0] - 2023-12-25 ### Added - Halloween 2023 effects. -- Smissmas 2023 effects. \ No newline at end of file +- Smissmas 2023 effects. + +## [2.2.1] - 2024-05-26 +### Fixed +- A potential issue where items display the wrong item. \ No newline at end of file diff --git a/package.json b/package.json index 6db742c..69adea7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "steam-trade-offer-enhancer", - "version": "2.2.0", + "version": "2.2.1", "description": "Fork of [Steam Trade Offer Enhancer by scholtzm](https://github.com/scholtzm/steam-trade-offer-enhancer) with extra features and performance enhancements. This userscript has many features useful for Team Fortress 2 trading.", "main": "steam.trade.offer.enhancer.user.js", "dependencies": { diff --git a/src/js/steamcommunity.com.profiles.tradeoffers.js b/src/js/steamcommunity.com.profiles.tradeoffers.js index a3a3483..bef3cfe 100644 --- a/src/js/steamcommunity.com.profiles.tradeoffers.js +++ b/src/js/steamcommunity.com.profiles.tradeoffers.js @@ -79,18 +79,7 @@ function({ $, VERSION, WINDOW, addAttributesToHoverItems }) { Array.from(itemsList).forEach((itemsEl) => { const itemsArr = Array.from(itemsEl.getElementsByClassName('trade_item')); const getClassInfo = (itemEl) => { - const classinfo = itemEl.getAttribute('data-economy-item'); - // I believe item classes always remain static - const translateClass = { - 'classinfo/440/339892/11040578': 'classinfo/440/101785959/11040578', - 'classinfo/440/339892/11040559': 'classinfo/440/101785959/11040578', - 'classinfo/440/107348667/11040578': 'classinfo/440/101785959/11040578' - }; - - return ( - translateClass[classinfo] || - classinfo - ); + return itemEl.getAttribute('data-economy-item'); }; // has multiples of the same item const hasMultipleSameItems = Boolean(function() { diff --git a/src/meta.js b/src/meta.js index 631acac..cdd9466 100644 --- a/src/meta.js +++ b/src/meta.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Steam Trade Offer Enhancer // @description Browser script to enhance Steam trade offers. -// @version 2.2.0 +// @version 2.2.1 // @author Julia // @namespace http://steamcommunity.com/profiles/76561198080179568/ // @updateURL https://github.com/juliarose/steam-trade-offer-enhancer/raw/master/steam.trade.offer.enhancer.meta.js diff --git a/steam.trade.offer.enhancer.meta.js b/steam.trade.offer.enhancer.meta.js index f549009..6e39857 100755 --- a/steam.trade.offer.enhancer.meta.js +++ b/steam.trade.offer.enhancer.meta.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Steam Trade Offer Enhancer // @description Browser script to enhance Steam trade offers. -// @version 2.2.0 +// @version 2.2.1 // @author Julia // @namespace http://steamcommunity.com/profiles/76561198080179568/ // @updateURL https://github.com/juliarose/steam-trade-offer-enhancer/raw/master/steam.trade.offer.enhancer.meta.js diff --git a/steam.trade.offer.enhancer.user.js b/steam.trade.offer.enhancer.user.js index cbf1ed2..e7c2005 100644 --- a/steam.trade.offer.enhancer.user.js +++ b/steam.trade.offer.enhancer.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Steam Trade Offer Enhancer // @description Browser script to enhance Steam trade offers. -// @version 2.2.0 +// @version 2.2.1 // @author Julia // @namespace http://steamcommunity.com/profiles/76561198080179568/ // @updateURL https://github.com/juliarose/steam-trade-offer-enhancer/raw/master/steam.trade.offer.enhancer.meta.js @@ -1075,18 +1075,7 @@ Array.from(itemsList).forEach((itemsEl) => { const itemsArr = Array.from(itemsEl.getElementsByClassName('trade_item')); const getClassInfo = (itemEl) => { - const classinfo = itemEl.getAttribute('data-economy-item'); - // I believe item classes always remain static - const translateClass = { - 'classinfo/440/339892/11040578': 'classinfo/440/101785959/11040578', - 'classinfo/440/339892/11040559': 'classinfo/440/101785959/11040578', - 'classinfo/440/107348667/11040578': 'classinfo/440/101785959/11040578' - }; - - return ( - translateClass[classinfo] || - classinfo - ); + return itemEl.getAttribute('data-economy-item'); }; // has multiples of the same item const hasMultipleSameItems = Boolean(function() { @@ -2447,7 +2436,12 @@ // perform actions // add elements to page (function() { - const controlsHTML = ` + const $tradeBox = page.$tradeBoxContents; + // clearfix to add after inventories to fix height bug in firefox + const $clear = $('
'); + + // add summary and control HTML to the trade box + $tradeBox.append(`
Add multiple items:
@@ -2497,23 +2491,11 @@
- `; - const itemSummaryHTML = `
- `; - const $tradeBox = page.$tradeBoxContents; - // clearfix to add after inventories to fix height bug in firefox - const $clear = $('
'); - const html = [ - controlsHTML, - itemSummaryHTML - ].join('').replace(/\s{2,}/g, ' '); - - // add it - $tradeBox.append(html); + `); // add the clear after inventories $clear.insertAfter(page.$inventories); @@ -3096,7 +3078,7 @@ (function() { const DEPS = (function() { // current version number of script - const VERSION = '2.2.0'; + const VERSION = '2.2.1'; // our window object for accessing globals const WINDOW = unsafeWindow; // dependencies to provide to each page script @@ -3136,33 +3118,6 @@ return result; }, - /** - * Get difference between two arrays - * @param {Array} arr1 - First array - * @param {Array} arr2 - Second array - * @returns {Array} Array with values removed - */ - difference: function(arr1, arr2) { - return arr1.filter((a) => { - return arr2.indexOf(a) === -1; - }); - }, - /** - * Check if a variable is undefined, null, or an empty string ('') - * @param {*} value - Value to check - * @returns {Boolean} Is empty? - */ - isEmpty: function(value) { - return value === undefined || value === null || value === ''; - }, - /** - * Get unique values from array - * @param {Array} arr - Array of basic items (strings, numbers) - * @returns {Array} Array with unique values - */ - uniq: function(arr) { - return [...new Set(arr)]; - }, /** * Get a list of IDs from a comma-seperated string * @param {String} str - Comma-seperated string