Plugin

AlwaysExpandRoles

Always expands the role list in profile popouts

Appearance Roles
index.ts
Download

Source

src/plugins/alwaysExpandRoles/index.ts
1import { migratePluginSettings } from "@api/Settings";
2import { Devs } from "@utils/constants";
3import definePlugin from "@utils/types";
4
5migratePluginSettings("AlwaysExpandRoles", "ShowAllRoles");
6export default definePlugin({
7 name: "AlwaysExpandRoles",
8 description: "Always expands the role list in profile popouts",
9 tags: ["Appearance", "Roles"],
10 authors: [Devs.surgedevs],
11 patches: [
12 {
13 find: "hasDeveloperContextMenu:",
14 replacement: [
15 {
16 match: /(?<=\?\i\.current\[\i\].{0,100}?)useState\(!1\)/,
17 replace: "useState(!0)"
18 },
19 {
20 // Fix not calculating non-expanded roles because the above patch makes the default "expanded",
21 // which makes the collapse button never show up and calculation never occur
22 match: /(?<=useLayoutEffect\(\(\)=>\{if\()\i/,
23 replace: "false"
24 }
25 ]
26 }
27 ]
28});
29