use jQuery path for _showControlWhen

This commit is contained in:
Vincent Vandemeulebrouck 2020-12-20 02:05:47 +01:00
parent 1bcfba1f68
commit a93b34d2ce
4 changed files with 8 additions and 8 deletions

View File

@ -234,7 +234,7 @@ export class RdDActorSheet extends ActorSheet {
activateListeners(html) {
super.activateListeners(html);
HtmlUtility._showControlWhen(".gm-only", game.user.isGM);
HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM);
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;

View File

@ -1,10 +1,10 @@
export class HtmlUtility{
static _showControlWhen(control, condition) {
if (condition) {
$(control).show();
control.show();
}
else {
$(control).hide();
control.hide();
}
}
}

View File

@ -387,7 +387,7 @@ export class RdDCalendrier extends Application {
activateListeners(html) {
super.activateListeners(html);
HtmlUtility._showControlWhen(".gm-only", game.user.isGM);
HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM);
this.updateDisplay();

View File

@ -118,15 +118,15 @@ export class RdDRoll extends Dialog {
dmgText = '(' + dmgText + ')';
}
HtmlUtility._showControlWhen(".diffMoral", rollData.selectedCarac == actor.data.data.carac.volonte);
HtmlUtility._showControlWhen(".etat-general", !dialog._isIgnoreEtatGeneral(rollData));
HtmlUtility._showControlWhen($(".diffMoral"), rollData.selectedCarac == actor.data.data.carac.volonte);
HtmlUtility._showControlWhen($(".etat-general"), !dialog._isIgnoreEtatGeneral(rollData));
// Sort management
if (rollData.selectedSort) {
rollData.bonus = RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.coord),
//console.log("Toggle show/hide", rollData.selectedSort);
HtmlUtility._showControlWhen("#div-sort-difficulte", RdDItemSort.isDifficulteVariable(rollData.selectedSort))
HtmlUtility._showControlWhen("#div-sort-ptreve", RdDItemSort.isCoutVariable(rollData.selectedSort))
HtmlUtility._showControlWhen($("#div-sort-difficulte"), RdDItemSort.isDifficulteVariable(rollData.selectedSort))
HtmlUtility._showControlWhen($("#div-sort-ptreve"), RdDItemSort.isCoutVariable(rollData.selectedSort))
}
// Mise à jour valeurs