From b398e41d718a050a7d89c43c0408e264496d7d6f Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Fri, 13 Apr 2018 18:36:47 -0400 Subject: [PATCH] Values are previewed now..albeit just copying the input value over for now --- game.js | 19 ++++++++++++++++++- stroll.html | 38 ++++++++++++++++++++++++++++++++++++++ style.css | 8 ++++++-- 3 files changed, 62 insertions(+), 3 deletions(-) diff --git a/game.js b/game.js index 899f147..32e5f05 100644 --- a/game.js +++ b/game.js @@ -3385,10 +3385,23 @@ function registerActions() { buttons.forEach( function(button) { let name = button.id; name = name.replace(/button-action-/,""); - button.addEventListener("click", function() { window[name]() }); + button.addEventListener("click", function() { window[name](); }); }); } +function updateAllPreviews() { + document.querySelectorAll(".preview").forEach(function(prev) { + let name = prev.id.replace("Preview",""); + updatePreview(name); + }); +} + +function updatePreview(name) { + let value = document.getElementById(name).value; + if (value == "") + value = document.getElementById(name).placeholder; + document.getElementById(name + "Preview").innerHTML = value; +} function debugLog() { console.log("Your character settings:"); console.log(JSON.stringify(generateSettings())); @@ -3410,6 +3423,10 @@ window.addEventListener('load', function(event) { } }()); + document.querySelectorAll("input[type='number']").forEach(function(x) { + x.addEventListener("input", function() { updatePreview(x.id); }); + }); + presets.sort(function(x,y) {return x.name.localeCompare(y.name); } ); let list = document.getElementById("character-presets"); diff --git a/stroll.html b/stroll.html index 65aae61..3e00209 100644 --- a/stroll.html +++ b/stroll.html @@ -264,26 +264,32 @@
  • +
  • +
  • +
  • +
  • +
  • +
  • @@ -411,6 +417,7 @@
  • +
  • @@ -496,10 +503,12 @@
  • +
  • +
  • @@ -508,22 +517,27 @@
  • +
  • +
  • +
  • +
  • +
  • @@ -539,6 +553,7 @@
  • +
  • @@ -549,14 +564,17 @@
  • +
  • +
  • +
  • @@ -575,6 +593,7 @@
  • +
  • @@ -594,10 +613,12 @@
  • +
  • +
  • @@ -606,18 +627,22 @@
  • +
  • +
  • +
  • +
  • @@ -633,10 +658,12 @@
  • +
  • +
  • @@ -656,14 +683,17 @@
  • +
  • +
  • +
  • @@ -711,10 +741,12 @@
  • +
  • +