Update layout.js
This commit is contained in:
@@ -18,15 +18,31 @@ import { i18n } from '../../core/i18n.js';
|
|||||||
* Toggles the visibility of plot buttons based on settings.
|
* Toggles the visibility of plot buttons based on settings.
|
||||||
*/
|
*/
|
||||||
export function togglePlotButtons() {
|
export function togglePlotButtons() {
|
||||||
if (extensionSettings.enablePlotButtons && extensionSettings.enabled) {
|
if (!extensionSettings.enabled) {
|
||||||
$('#rpg-plot-buttons').show();
|
$('#rpg-plot-buttons').hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Show/hide encounter button based on encounter settings
|
// Show/hide plot progression buttons based on enablePlotButtons setting
|
||||||
if (extensionSettings.encounterSettings?.enabled) {
|
if (extensionSettings.enablePlotButtons) {
|
||||||
$('#rpg-encounter-button').show();
|
$('#rpg-plot-random').show();
|
||||||
} else {
|
$('#rpg-plot-natural').show();
|
||||||
$('#rpg-encounter-button').hide();
|
} else {
|
||||||
}
|
$('#rpg-plot-random').hide();
|
||||||
|
$('#rpg-plot-natural').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show/hide encounter button independently based on encounter settings
|
||||||
|
if (extensionSettings.encounterSettings?.enabled) {
|
||||||
|
$('#rpg-encounter-button').show();
|
||||||
|
} else {
|
||||||
|
$('#rpg-encounter-button').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show the container if at least one button is visible
|
||||||
|
const shouldShowContainer = extensionSettings.enablePlotButtons || extensionSettings.encounterSettings?.enabled;
|
||||||
|
if (shouldShowContainer) {
|
||||||
|
$('#rpg-plot-buttons').show();
|
||||||
} else {
|
} else {
|
||||||
$('#rpg-plot-buttons').hide();
|
$('#rpg-plot-buttons').hide();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user