Archipelago/WebHostLib/templates
Remy Jette 77e3f9fbef
WebHost: Fix NamedRange values clamping to the range (#3613)
If a NamedRange has a `special_range_names` entry outside the
`range_start` and `range_end`, the HTML5 range input will clamp the
submitted value to the closest value in the range.

These means that, for example, Pokemon RB's "HM Compatibility" option's
"Vanilla (-1)" option would instead get posted as "0" rather than "-1".

This change updates NamedRange to behave like TextChoice, where the
select element has a `name` attribute matching the option, and there is
an additional element to be able to provide an option other than the
select element's choices.

This uses a different suffix of `-range` rather than `-custom` that
TextChoice uses. The reason is we need some way to decide whether to use
the custom value or the select value, and that method needs to work
without JavaScript. For TextChoice this is easy, if the custom field is
empty use the select element. For NamedRange this is more difficult as
the browser will always submit *something*. My choice was to only use
the value from the range if the select box is set to "custom". Since
this only happens with JS as "custom' is hidden, I made the range hidden
under no-JS. If it's preferred, I could make the select box hidden
instead. Let me know.

This PR also makes the `js-required` class set `display: none` with
`!important` as otherwise the class wouldn't work on any rule that
had `display: flex` with more specificity than a single class.
2024-07-29 20:13:44 -04:00
..
header
playerOptions WebHost: Fix NamedRange values clamping to the range (#3613) 2024-07-29 20:13:44 -04:00
weightedOptions
404.html
autotablepage.html
check.html
checkResult.html
faq.html
gameInfo.html
generate.html
genericTracker.html
glossary.html
hostGame.html
hostRoom.html
islandFooter.html
landing.html
macros.html
multispheretracker.html
multitracker.html
multitrackerHintTable.html
multitrackerNavigation.html
multitracker__ALinkToThePast.html
multitracker__Factorio.html
pageWrapper.html
seedError.html
siteMap.html
startPlaying.html
stats.html
supportedGames.html
tablepage.html
templates.html
tracker__ALinkToThePast.html
tracker__ChecksFinder.html
tracker__Minecraft.html
tracker__OcarinaOfTime.html
tracker__Starcraft2.html
tracker__SuperMetroid.html
tracker__Timespinner.html
tutorial.html
tutorialLanding.html
userContent.html
viewSeed.html
waitSeed.html