diff --git a/tests/playground.html b/tests/playground.html index 8e63815ea..fb7859587 100644 --- a/tests/playground.html +++ b/tests/playground.html @@ -77,7 +77,7 @@ function start() { document.forms.options.elements.dir.selectedIndex = Number(rtl); var toolbox = getToolboxElement(); document.forms.options.elements.toolbox.selectedIndex = - Number(toolbox.getElementsByTagName('category').length == 0); + getToolboxFormIndex(toolbox.id); match = location.search.match(/side=([^&]+)/); var side = match ? match[1] : 'start'; document.forms.options.elements.side.value = side; @@ -137,7 +137,24 @@ function setBackgroundColor() { function getToolboxElement() { var match = location.search.match(/toolbox=([^&]+)/); - return document.getElementById('toolbox-' + (match ? match[1] : 'categories')); + // Default to the basic toolbox with categories and untyped variables, + // but override that if the toolbox type is set in the URL. + var toolboxSuffix = (match ? match[1] : 'categories'); + // The three possible values are: "simple", "categories", + // "categories-typed-variables". + return document.getElementById('toolbox-' + toolboxSuffix); +} + +function getToolboxFormIndex(id) { + if (id == 'toolbox-categories') { + return 0; + } else if (id == 'toolbox-categories-typed-variables') { + return 1; + } else if (id == 'toolbox-simple') { + return 2; + } + // Didn't recognize it. + return 0; } function toXml() { @@ -301,7 +318,8 @@ h1 {
+ + + + + + +