programmer2514 / BetterDiscord-CollapsibleUI

A feature-rich BetterDiscord plugin that reworks the Discord UI to be significantly more modular
MIT License
66 stars 9 forks source link

Use dynamic classes instead of hard-coded ones #144

Open Yentis opened 1 week ago

Yentis commented 1 week ago

These reroll and need to be updated constantly, see https://github.com/KingGamingYT/discord-no-mosaic/issues/1#issuecomment-2452923132 for more info

programmer2514 commented 1 week ago

I will work on switching over to dynamic classes in the next release. Unfortunately some class names are very similar, apart from the random junk at the end - do you have any suggestions for how to handle two elements whose class name is just panel_xxxxx, for instance?

Yentis commented 1 week ago

If you press ctrl + shift + f in the devtools you can search discord's js files, from there you can paste the exact class name you're looking for. Discord_taA40PhjUB

Once there you'll be able to find the module that contains the class. Discord_AbAx0Dr7Di

Once you know the module you're looking for you can create a filter query that will find the module. For my example I can use any keys from the object that this module returns: BdApi.Webpack.getModule(BdApi.Webpack.Filters.byKeys('visualMediaItemContainer', 'twoByOneGrid'))

In your case you just want to give it as many keys as necessary to only return the module you're looking for. Discord_mTau8C7LLK