From afecd177c5759d89cfc762231275972513c37c7e Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Wed, 18 Dec 2019 20:03:52 -0500 Subject: [PATCH] Make soul vore type a dropdown box. Fix incorrect defaults and loading for selects --- features.js | 23 ++++++++++++----------- game.js | 4 ++++ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/features.js b/features.js index 83fb236..1dd9df3 100644 --- a/features.js +++ b/features.js @@ -1679,26 +1679,27 @@ options = [ "type": "checkbox", "buttons": ["digest_soul"] }, - { - "type": "radio", + { + "name":"Soul vore type", + "type": "select", "id": "soulVoreType", "default": "body", "choices": [ { - "name": "Released", - "value": "release" + "name": "Released", + "value": "release", }, { - "name": "Trapped", - "value": "body" + "name": "Trapped", + "value": "body", }, { - "name": "Digested", - "value": "oblivion" - } - ] - } + "name": "Digested", + "value": "oblivion", + }, + ] + }, ] }, { diff --git a/game.js b/game.js index 45e363c..da2cee2 100644 --- a/game.js +++ b/game.js @@ -5613,6 +5613,7 @@ function render_select_option(li, option) { label.innerText = option.name; let select = document.createElement("select"); + select.setAttribute("id", option.id); select.setAttribute("name", option.id); option.choices.forEach(function(choice) { @@ -5620,6 +5621,9 @@ function render_select_option(li, option) { sub_option.innerText = choice.name; sub_option.setAttribute("value", choice.value); + if (option.default == choice.value) { + sub_option.defaultSelected = true; + } select.appendChild(sub_option); });