Regretfully remove my trickery with a hidden <option> element inside

the game-type <select>, since IE turns out to ignore display:none on
options. Oh well.

Instead I now do a more transparent thing: when custom game params are
in use, there's a "Custom" option selected in the dropdown, and a
separate 'Re-customise' option which brings the config box back up.
When an ordinary preset is selected, the Custom option is missing, and
there's just a 'Customise'.

In the process I've tinkered a bit to arrange that the custom 'preset'
is always represented by a negative number rather than one past the
last real preset; that seems more consistent overall.

[originally from svn r9811]
This commit is contained in:
Simon Tatham
2013-04-05 15:49:29 +00:00
parent 2360b77812
commit 36f35f5db8
3 changed files with 60 additions and 53 deletions

View File

@ -83,13 +83,18 @@ var dlg_return_sval, dlg_return_ival;
// list of the <option> objects inside it. Used by js_add_preset(),
// js_get_selected_preset() and js_select_preset().
//
// gametypehiddencustom is a second copy of the 'Custom' dropdown
// element, set to display:none. This is used by a bodge in emcclib.js
// (see comment in js_add_preset) to arrange that if the Custom
// element is (apparently) already selected, we still find out if the
// user selects it again.
// gametypethiscustom is an option which indicates some custom game
// params you've already set up, and which will be auto-selected on
// return from the customisation dialog; gametypenewcustom is an
// option which you select to indicate that you want to bring up the
// customisation dialog and select a new configuration. Ideally I'd do
// this with just one option serving both purposes, but instead we
// have to do this a bit oddly because browsers don't send 'onchange'
// events for a select element if you reselect the same one - so if
// you've picked a custom setup and now want to change it, you need a
// way to specify that.
var gametypeselector = null, gametypeoptions = [];
var gametypehiddencustom = null;
var gametypethiscustom = null, gametypehiddencustom = null;
// The two anchors used to give permalinks to the current puzzle. Used
// by js_update_permalinks().