merge two if

This commit is contained in:
Vlyan
2025-02-22 16:05:37 +01:00
parent bae1480c89
commit f7eaa93cd4

View File

@@ -442,8 +442,7 @@ export default class HooksL5r5e {
});
// If gm add a extra button to easily filter the content to see the same stuff as a player
if(game.user.isGM) {
if(unavailableSourceForPlayers.length > 0) {
if (game.user.isGM && unavailableSourceForPlayers.length > 0) {
const buttonHTML = `<button type="button" class="gm" data-tooltip="${game.i18n.localize('l5r5e.multiselect.player_filter_tooltip')}">`
+ game.i18n.localize('l5r5e.multiselect.player_filter_label')
+ '</button>'
@@ -451,12 +450,12 @@ export default class HooksL5r5e {
const filterPlayerView = game.settings.get(CONFIG.l5r5e.namespace, "all-compendium-references")
.filter((item) => !unavailableSourceForPlayers.includes(item))
.filter((item) => sources_in_this_compendium.has(item));
$(buttonHTML).appendTo($(header).find("l5r5e-multi-select")).click(function() {
header.find("l5r5e-multi-select")[0].value = filterPlayerView;
});
}
}
}
// TODO find a better way
// This is ugly but if we hide the content too early then it won't be hidden for some reason.