// SPDX-FileCopyrightText: 2021 Johannes Loher // // SPDX-License-Identifier: MIT import { packageName } from '../config'; import { DarknessDependentVisionConfig } from '../darkness-dependent-vision-config'; export default function registerForGetTokenConfigHeaderButtonsHook() { Hooks.on('getTokenConfigHeaderButtons', onGetTokenConfigHeaderButtons); } /** * @param {TokenConfig} tokenConfig * @param {ApplicationHeaderButton[]} buttons */ function onGetTokenConfigHeaderButtons(tokenConfig, buttons) { if (!game.settings.get(packageName, 'configurationViaHeaderButton')) { return; } buttons.unshift({ label: 'DarknessDependentVision.TokenConfigHeaderButtonLabel', class: 'configure-darkness-dependent-vision', icon: 'fas fa-eye', onclick: async () => { return new DarknessDependentVisionConfig(tokenConfig.object).render(true); }, }); }