diff --git a/src/html/options.html b/src/html/options.html index 1b73e5ba8..6252103b1 100644 --- a/src/html/options.html +++ b/src/html/options.html @@ -120,6 +120,7 @@

Highlight

+
@@ -135,6 +136,7 @@

Tag

+
diff --git a/src/js/Background/Modules/SteamStoreApi.js b/src/js/Background/Modules/SteamStoreApi.js index f1d7da65e..9fa123b19 100644 --- a/src/js/Background/Modules/SteamStoreApi.js +++ b/src/js/Background/Modules/SteamStoreApi.js @@ -152,8 +152,19 @@ class SteamStoreApi extends Api { const store = await SteamStoreApi.getEndpoint("dynamicstore/userdata", {}, null, {"cache": "no-cache"}); const {rgOwnedApps, rgOwnedPackages, rgIgnoredApps, rgWishlist} = store; + const ignored = []; + const ignoredOwnedElsewhere = []; + Object.entries(rgIgnoredApps).forEach(([appid, value]) => { + if (value === 0) { + ignored.push(Number(appid)); + } else if (value === 2) { + ignoredOwnedElsewhere.push(Number(appid)); + } + }); + const dynamicStore = { - "ignored": Object.keys(rgIgnoredApps).map(key => Number(key)), + ignored, + ignoredOwnedElsewhere, "ownedApps": rgOwnedApps, "ownedPackages": rgOwnedPackages, "wishlisted": rgWishlist, diff --git a/src/js/Content/Features/Common/FHighlightsTags.js b/src/js/Content/Features/Common/FHighlightsTags.js index 5403573dc..61ec607a7 100644 --- a/src/js/Content/Features/Common/FHighlightsTags.js +++ b/src/js/Content/Features/Common/FHighlightsTags.js @@ -20,7 +20,7 @@ export default class FHighlightsTags extends Feature { title.dataset.dsAppid = appid; - return FHighlightsTags.highlightAndTag([title], false); + return FHighlightsTags.highlightAndTag([title]); } /** @@ -29,17 +29,17 @@ export default class FHighlightsTags extends Feature { * * @param {NodeList|Array} nodes - The nodes that should get highlighted * (defaults to all known nodes that are highlightable and taggable) - * @param {boolean} hasDsInfo - Whether or not the supplied nodes contain dynamic store info (defaults to true) * @param {Object} options - Option overrides that should be applied * @returns {Promise} - Resolved once the highlighting and tagging completed for the nodes */ - static async highlightAndTag(nodes, hasDsInfo = true, options = {}) { + static async highlightAndTag(nodes, options = {}) { if (typeof FHighlightsTags._options === "undefined") { FHighlightsTags._options = { "owned": SyncedStorage.get("highlight_owned") || SyncedStorage.get("tag_owned"), "wishlisted": SyncedStorage.get("highlight_wishlist") || SyncedStorage.get("tag_wishlist"), "ignored": SyncedStorage.get("highlight_notinterested") || SyncedStorage.get("tag_notinterested"), + "ignoredOwned": SyncedStorage.get("highlight_notinterested_owned") || SyncedStorage.get("tag_notinterested_owned"), "collected": SyncedStorage.get("highlight_collection") || SyncedStorage.get("tag_collection"), "waitlisted": SyncedStorage.get("highlight_waitlist") || SyncedStorage.get("tag_waitlist"), "gift": SyncedStorage.get("highlight_inv_gift") || SyncedStorage.get("tag_inv_gift"), @@ -85,22 +85,6 @@ export default class FHighlightsTags extends Feature { } else { console.warn("FHighlightsTags: Couldn't find storeId for node %o", node); } - - if (hasDsInfo) { - try { - if (opts.owned && node.querySelector(".ds_owned_flag") !== null) { - this.highlightOwned(node); - } - if (opts.wishlisted && node.querySelector(".ds_wishlist_flag") !== null) { - this.highlightWishlist(node); - } - if (opts.ignored && node.querySelector(".ds_ignored_flag") !== null) { - this.highlightIgnored(node); - } - } catch (err) { - console.error("Failed to highlight / tag node", err); - } - } } const storeIds = Array.from(storeIdsMap.keys()); @@ -108,7 +92,7 @@ export default class FHighlightsTags extends Feature { const trimmedStoreIds = storeIds.map(id => GameId.trimStoreId(id)); - const includeDsInfo = !hasDsInfo && (opts.owned || opts.wishlisted || opts.ignored); + const includeDsInfo = opts.owned || opts.wishlisted || opts.ignored || opts.ignoredOwned; const [dsStatus, itadStatus, invStatus] = await Promise.all([ includeDsInfo ? DynamicStore.getAppStatus(storeIds) : Promise.resolve(), @@ -137,6 +121,9 @@ export default class FHighlightsTags extends Feature { if (opts.ignored && dsStatus[storeId].ignored) { operations.push(this.highlightIgnored); } + if (opts.ignoredOwned && dsStatus[storeId].ignoredOwned) { + operations.push(this.highlightIgnoredOwnedElsewhere); + } } /* @@ -345,6 +332,10 @@ export default class FHighlightsTags extends Feature { this._highlightItem(node, "notinterested"); } + static highlightIgnoredOwnedElsewhere(node) { + this._highlightItem(node, "notinterested_owned"); + } + static highlightCollection(node) { this._highlightItem(node, "collection"); } @@ -362,6 +353,7 @@ FHighlightsTags._tagCssLoaded = false; * The later it appears in the array, the higher its precedence */ FHighlightsTags._types = [ + "notinterested_owned", "notinterested", "waitlist", "wishlist", diff --git a/src/js/Content/Features/Community/ProfileActivity/FHighlightFriendsActivity.js b/src/js/Content/Features/Community/ProfileActivity/FHighlightFriendsActivity.js index 59990c1bb..b68cfc10e 100644 --- a/src/js/Content/Features/Community/ProfileActivity/FHighlightFriendsActivity.js +++ b/src/js/Content/Features/Community/ProfileActivity/FHighlightFriendsActivity.js @@ -23,6 +23,6 @@ export default class FHighlightFriendsActivity extends CallbackFeature { // https://github.com/IsThereAnyDeal/AugmentedSteam/pull/470#pullrequestreview-284928257 && (link.childElementCount !== 1 || !link.closest(".vote_header"))); - FHighlightsTags.highlightAndTag(nodes, false); + FHighlightsTags.highlightAndTag(nodes); } } diff --git a/src/js/Content/Features/Store/App/FSteamPeek.js b/src/js/Content/Features/Store/App/FSteamPeek.js index 12df45e15..c652e9853 100644 --- a/src/js/Content/Features/Store/App/FSteamPeek.js +++ b/src/js/Content/Features/Store/App/FSteamPeek.js @@ -76,7 +76,7 @@ export default class FSteamPeek extends Feature { window.SteamFacade.dynamicStoreDecorateItems("#recommended_block_content > a.es_sp_similar"); }); - this.context.decorateStoreCapsules(content.querySelectorAll("a.es_sp_similar"), true); + this.context.decorateStoreCapsules(content.querySelectorAll("a.es_sp_similar")); HTML.beforeBegin(lastChild, ` diff --git a/src/js/Content/Features/Store/Common/CStoreBase.js b/src/js/Content/Features/Store/Common/CStoreBase.js index d9ab8dbfa..70a7e71d0 100644 --- a/src/js/Content/Features/Store/Common/CStoreBase.js +++ b/src/js/Content/Features/Store/Common/CStoreBase.js @@ -97,8 +97,8 @@ export class CStoreBase extends CBase { } } - decorateStoreCapsules(nodes, hasDsInfo) { - FHighlightsTags.highlightAndTag(nodes, hasDsInfo); + decorateStoreCapsules(nodes) { + FHighlightsTags.highlightAndTag(nodes); FEarlyAccess.show(nodes); } } diff --git a/src/js/Content/Features/Store/Storefront/CStoreFront.js b/src/js/Content/Features/Store/Storefront/CStoreFront.js index 60f359b33..a52b9a8b5 100644 --- a/src/js/Content/Features/Store/Storefront/CStoreFront.js +++ b/src/js/Content/Features/Store/Storefront/CStoreFront.js @@ -54,7 +54,7 @@ export class CStoreFront extends CStoreBase { // This section goes through multiple rendering steps before apps show up, so don't disconnect immediately if (nodes.length !== 0) { - this.decorateStoreCapsules(nodes, false); // This section doesn't have dsinfo for some reason + this.decorateStoreCapsules(nodes); observer.disconnect(); } } diff --git a/src/js/Content/Features/Store/Wishlist/FWishlistHighlights.js b/src/js/Content/Features/Store/Wishlist/FWishlistHighlights.js index c24ae3e5a..4508a599a 100644 --- a/src/js/Content/Features/Store/Wishlist/FWishlistHighlights.js +++ b/src/js/Content/Features/Store/Wishlist/FWishlistHighlights.js @@ -16,6 +16,6 @@ export default class FWishlistHighlights extends CallbackFeature { options.waitlisted = false; } - return FHighlightsTags.highlightAndTag(nodes, false, options); + return FHighlightsTags.highlightAndTag(nodes, options); } } diff --git a/src/js/Content/Modules/Data/DynamicStore.js b/src/js/Content/Modules/Data/DynamicStore.js index 23104ca1d..ae8410ec3 100644 --- a/src/js/Content/Modules/Data/DynamicStore.js +++ b/src/js/Content/Modules/Data/DynamicStore.js @@ -52,6 +52,7 @@ class DynamicStore { const trimmedId = trimmedIds[i]; acc[id] = { "ignored": dsStatus[trimmedId].includes("ignored"), + "ignoredOwned": dsStatus[trimmedId].includes("ignoredOwnedElsewhere"), "wishlisted": dsStatus[trimmedId].includes("wishlisted"), }; if (id.startsWith("app/")) { diff --git a/src/js/Core/Storage/SyncedStorage.ts b/src/js/Core/Storage/SyncedStorage.ts index 64f86d1d6..bb9dd5ebd 100644 --- a/src/js/Core/Storage/SyncedStorage.ts +++ b/src/js/Core/Storage/SyncedStorage.ts @@ -56,6 +56,7 @@ const DEFAULTS = { "highlight_inv_gift_color": "#800040", "highlight_inv_guestpass_color": "#513c73", "highlight_notinterested_color": "#4f4f4f", + "highlight_notinterested_owned_color": "#4f4f4f", "highlight_collection_color": "#856d0e", "highlight_waitlist_color": "#4c7521", @@ -65,6 +66,7 @@ const DEFAULTS = { "tag_inv_gift_color": "#b10059", "tag_inv_guestpass_color": "#65449a", "tag_notinterested_color": "#4f4f4f", + "tag_notinterested_owned_color": "#4f4f4f", "tag_collection_color": "#856d0e", "tag_waitlist_color": "#4c7521", @@ -74,6 +76,7 @@ const DEFAULTS = { "highlight_inv_gift": false, "highlight_inv_guestpass": false, "highlight_notinterested": false, + "highlight_notinterested_owned": false, "highlight_excludef2p": false, "highlight_collection": true, "highlight_waitlist": true, @@ -84,6 +87,7 @@ const DEFAULTS = { "tag_inv_gift": false, "tag_inv_guestpass": false, "tag_notinterested": true, + "tag_notinterested_owned": true, "tag_collection": false, "tag_waitlist": false, "tag_short": false, diff --git a/src/js/Options/Modules/Data/OptionsSetup.js b/src/js/Options/Modules/Data/OptionsSetup.js index ff9652518..669f4c7c4 100644 --- a/src/js/Options/Modules/Data/OptionsSetup.js +++ b/src/js/Options/Modules/Data/OptionsSetup.js @@ -52,6 +52,7 @@ export default { "highlight_inv_gift": "options.gift", "highlight_inv_guestpass": "options.guest", "highlight_notinterested": "notinterested", + "highlight_notinterested_owned": "notinterested_owned", "highlight_collection": "options.collection", "highlight_waitlist": "options.waitlist", "highlight_excludef2p": "options.excludef2p", @@ -63,6 +64,7 @@ export default { "tag_inv_gift": "options.gift", "tag_inv_guestpass": "options.guest", "tag_notinterested": "notinterested", + "tag_notinterested_owned": "notinterested_owned", "tag_collection": "options.collection", "tag_waitlist": "options.waitlist", "tag_short": "tag_short", diff --git a/src/js/Options/options.js b/src/js/Options/options.js index d5458da05..3b4285837 100644 --- a/src/js/Options/options.js +++ b/src/js/Options/options.js @@ -327,6 +327,7 @@ const Options = (() => { "highlight_inv_gift", "highlight_inv_guestpass", "highlight_notinterested", + "highlight_notinterested_owned", "highlight_waitlist", "highlight_collection", "tag_owned", @@ -335,6 +336,7 @@ const Options = (() => { "tag_inv_gift", "tag_inv_guestpass", "tag_notinterested", + "tag_notinterested_owned", "tag_collection", "tag_waitlist", "spamcommentregex", diff --git a/src/localization/en.json b/src/localization/en.json index 11da5ae65..af062ea27 100644 --- a/src/localization/en.json +++ b/src/localization/en.json @@ -158,6 +158,7 @@ "view": "View", "game_name": "Game Name", "notinterested": "Items you ignored", + "notinterested_owned": "Items you ignored as owned elsewhere", "search_filters": { "reviews_score": { "between": "Between __lower__% and __upper__% review score", @@ -534,6 +535,7 @@ "inv_guestpass": "Guestpass", "owned": "Owned", "notinterested": "Ignored", + "notinterested_owned": "Ignored (owned elsewhere)", "collection": "Collected", "waitlist": "Waitlisted" },