Skip to content

Commit

Permalink
Added 'in a faction' filter (#781)
Browse files Browse the repository at this point in the history
Co-authored-by: Sashank <76554862+Sashank999@users.noreply.github.com>
  • Loading branch information
ThatAstronautGuy and Sashank999 authored Feb 17, 2024
1 parent 6c9ab7b commit a0416e4
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion extension/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "Beta",
"date": false,
"logs": {
"features": [],
"features": [{ "message": "Added 'in a faction' filter to hospital, jail, and travel pages.", "contributor": "ThtAstronautGuy"}],
"fixes": [{ "message": "Trade Item Values after Trade page redesign.", "contributor": "TheFoxMan" }],
"changes": [],
"removed": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@
hide("faction");
return;
}
} else if (filters.faction == "In a faction") {
if (!hasFaction) {
hide("faction");
return;
}
} else {
if (
!hasFaction || // No faction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,16 @@
? rowFaction.find(":scope > img").getAttribute("title").trim() || "N/A"
: rowFaction.textContent.trim();

if (faction && faction !== "No faction" && faction !== "Unknown faction") {
if (faction && faction !== "No faction" && faction !== "Unknown faction" && faction !== "In a faction") {
if (!hasFaction || factionName === "N/A" || factionName !== faction) {
hideRow(li);
continue;
}
} else if (faction == "In a faction") {
if (!hasFaction) {
hideRow(li);
continue;
}
} else if (faction === "No faction") {
if (hasFaction) {
hideRow(li);
Expand Down
7 changes: 6 additions & 1 deletion extension/scripts/features/jail-filter/ttJailFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,16 @@
? rowFaction.find(":scope > img").getAttribute("title").trim() || "N/A"
: rowFaction.textContent.trim();

if (faction && faction !== "No faction" && faction !== "Unknown faction") {
if (faction && faction !== "No faction" && faction !== "Unknown faction" && faction !== "In a faction") {
if (!hasFaction || factionName === "N/A" || factionName !== faction) {
hideRow(li);
continue;
}
} else if (faction == "In a faction") {
if (!hasFaction) {
hideRow(li);
continue;
}
} else if (faction === "No faction") {
if (hasFaction) {
hideRow(li);
Expand Down
4 changes: 4 additions & 0 deletions extension/scripts/global/functions/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ const defaultFactionsItems = [
value: "Unknown faction",
description: "Unknown faction",
},
{
value: "In a faction",
description: "In a faction",
},
...(hasAPIData() && !!userdata.faction.faction_id
? [
{
Expand Down
7 changes: 7 additions & 0 deletions extension/scripts/global/team.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ const TEAM = [
torn: 2890448,
color: "orange",
},
{
name: "ThtAstronautGuy",
title: "Developer",
core: false,
torn: 1977683,
color: "#841210",
}
];

const CONTRIBUTORS = TEAM.filter(({ title, color }) => title.includes("Developer") || color).reduce(
Expand Down

0 comments on commit a0416e4

Please sign in to comment.