mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
js: Hide type menu if there's only one preset and no configuration
It seems a bit silly to display it when there's only one option.
This commit is contained in:
5
emcc.c
5
emcc.c
@ -976,6 +976,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
struct preset_menu *menu = midend_get_presets(me, &npresets);
|
||||
char *env;
|
||||
bool may_configure = false;
|
||||
presets = snewn(npresets, game_params *);
|
||||
for (i = 0; i < npresets; i++)
|
||||
presets[i] = NULL;
|
||||
@ -990,9 +991,11 @@ int main(int argc, char **argv)
|
||||
|
||||
if (thegame.can_configure &&
|
||||
(!env || env[0] == 'y' || env[0] == 'Y'))
|
||||
may_configure = true;
|
||||
if (may_configure)
|
||||
js_add_preset(0, "Custom...", -1);
|
||||
|
||||
have_presets_dropdown = npresets > 0 || thegame.can_configure;
|
||||
have_presets_dropdown = npresets > 1 || may_configure;
|
||||
|
||||
if (have_presets_dropdown)
|
||||
/*
|
||||
|
@ -614,7 +614,7 @@ function initPuzzle() {
|
||||
// Key to open the menu on KaiOS.
|
||||
if ((event.key == "SoftRight" || event.key == "F10") &&
|
||||
!menuform.contains(document.activeElement)) {
|
||||
menuform.querySelector("li div").focus();
|
||||
menuform.querySelector("li div, li button").focus();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
Reference in New Issue
Block a user