diff --git a/extension/changelog.json b/extension/changelog.json index 360822aa5..27a7f79e2 100644 --- a/extension/changelog.json +++ b/extension/changelog.json @@ -5,8 +5,14 @@ "date": false, "logs": { "features": [], - "fixes": [{ "message": "Fix CSP error for Points Value.", "contributor": "TheFoxMan" }], - "changes": [{ "message": "Load TT SVG logo before other files.", "contributor": "TheFoxMan" }], + "fixes": [ + { "message": "Fix CSP error for Points Value.", "contributor": "TheFoxMan" }, + { "message": "Fix Faction Member Filter for new activity icons.", "contributor": "TheFoxMan" } + ], + "changes": [ + { "message": "Load TT SVG logo before other files.", "contributor": "TheFoxMan" }, + { "message": "Optimize filter activity regexes.", "contributor": "TheFoxMan" } + ], "removed": [] } }, diff --git a/extension/scripts/features/faction-member-filter/ttFactionMemberFilter.js b/extension/scripts/features/faction-member-filter/ttFactionMemberFilter.js index bdb988242..0ffe98fc4 100644 --- a/extension/scripts/features/faction-member-filter/ttFactionMemberFilter.js +++ b/extension/scripts/features/faction-member-filter/ttFactionMemberFilter.js @@ -233,7 +233,7 @@ for (const li of document.findAll(".members-list .table-body > li")) { // Activity if (activity.length) { - const userActivity = li.find("[class*='userStatusWrap___']").id.match(FILTER_REGEXES.activity_v2)[1].toLowerCase().trim(); + const userActivity = li.find("[class*='userStatusWrap___'] svg").getAttribute("fill").match(FILTER_REGEXES.activity_v2_svg)[0]; if (!activity.some((x) => x.trim() === userActivity)) { hideRow(li); diff --git a/extension/scripts/features/jail-filter/ttJailFilter.js b/extension/scripts/features/jail-filter/ttJailFilter.js index 265150de3..89b1cf851 100644 --- a/extension/scripts/features/jail-filter/ttJailFilter.js +++ b/extension/scripts/features/jail-filter/ttJailFilter.js @@ -169,7 +169,7 @@ // Activity if ( activity.length && - !activity.some((x) => x.trim() === li.find("#iconTray li").getAttribute("title").match(FILTER_REGEXES.activity)[0].toLowerCase().trim()) + !activity.includes(li.find("#iconTray li").getAttribute("title").match(FILTER_REGEXES.activity)[0].toLowerCase().trim()) ) { hideRow(li); continue; diff --git a/extension/scripts/features/ranked-war-filter/ttRankedWarFilter.js b/extension/scripts/features/ranked-war-filter/ttRankedWarFilter.js index 1243f098c..ed7b2d68d 100644 --- a/extension/scripts/features/ranked-war-filter/ttRankedWarFilter.js +++ b/extension/scripts/features/ranked-war-filter/ttRankedWarFilter.js @@ -168,7 +168,7 @@ function filterRow(row, filters, individual) { if (filters.activity) { - const activity = row.find(".member.icons [class*='userStatusWrap___']").id.split("_")[1].split("-")[0].trim(); + const activity = row.find("[class*='userStatusWrap___'] svg").getAttribute("fill").match(FILTER_REGEXES.activity_v2_svg)[0]; if (filters.activity.length && !filters.activity.some((x) => x.trim() === activity)) { hide("activity"); return; diff --git a/extension/scripts/global/functions/filters.js b/extension/scripts/global/functions/filters.js index cfad0f484..36b824c85 100644 --- a/extension/scripts/global/functions/filters.js +++ b/extension/scripts/global/functions/filters.js @@ -29,8 +29,8 @@ const defaultFactionsItems = [ ]; const FILTER_REGEXES = { - activity: /(?<=).*(?=<\/b>)/g, - activity_v2: /\d+_([a-zA-Z]+)-user/, + activity: /Online|Idle|Offline/g, + activity_v2_svg: /online|idle|offline/, }; function createFilterSection(options) {