From 5a59dbdec97aac98b1484e531047fb72342b6ce9 Mon Sep 17 00:00:00 2001 From: Misode Date: Fri, 21 Jun 2019 17:11:26 +0200 Subject: [PATCH] Use radio field for weather properties --- index.html | 18 ++++++++++++------ view.js | 21 ++------------------- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/index.html b/index.html index 0df520ef..5e22a1be 100644 --- a/index.html +++ b/index.html @@ -610,15 +610,21 @@
-
- - +
+ Raining +
+
+ +
-
- - +
+ Thundering +
+
+ +
diff --git a/view.js b/view.js index b4e720b1..ee95b4e8 100644 --- a/view.js +++ b/view.js @@ -571,26 +571,9 @@ function generateCondition(condition, i) { if (condition.condition === 'minecraft:weather_check') { $condition.find('.condition-raining').removeClass('d-none'); - let raining = false; - if (condition.raining) { - raining = true; - } else { - delete condition.raining; - } - let id = 'rainingCheckbox' + Math.floor(1000000*Math.random()); - $condition.find('.condition-raining label').attr('for', id); - $condition.find('.condition-raining input').prop('checked', raining).attr('id', id); - $condition.find('.condition-thundering').removeClass('d-none'); - let thundering = false; - if (condition.thundering) { - thundering = true; - } else { - delete condition.thundering; - } - let id2 = 'thunderingCheckbox' + Math.floor(1000000*Math.random()); - $condition.find('.condition-thundering label').attr('for', id2); - $condition.find('.condition-thundering input').prop('checked', thundering).attr('id', id2); + generateRadio($condition.find('.condition-raining'), condition.raining); + generateRadio($condition.find('.condition-thundering'), condition.thundering); } else { delete condition.raining; delete condition.thundering;