From bb60f28b63660a6df164276da2f9b74e7fc89ec4 Mon Sep 17 00:00:00 2001 From: cutls Date: Thu, 1 Apr 2021 16:54:34 +0900 Subject: [PATCH] width setting --- app/js/ui/settings.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/app/js/ui/settings.js b/app/js/ui/settings.js index bb2ad757..fc79695a 100644 --- a/app/js/ui/settings.js +++ b/app/js/ui/settings.js @@ -4,13 +4,18 @@ var envView = new Vue({ data: { config: envConstruction }, methods: { complete: function (i, val) { - var ls = envView.config[i].storage - M.toast({ html: 'Complete', displayLength: 3000 }) - if (!val) { - var id = envView.config[i].id - var val = $('#' + id).val() + var ls = envView.config[i] + if (!ls.data) { + ls = [ls] + } else { + ls = ls.data + } + for (var j = 0; j < ls.length; j++) { + M.toast({ html: 'Complete', displayLength: 3000 }) + var id = ls[j].id + var val = $('#' + id).val() + localStorage.setItem(ls[j].storage, val) } - localStorage.setItem(ls, val) if (ls == 'ha') { hardwareAcceleration(val) } @@ -105,8 +110,15 @@ function load() { var max = envView.config.length for (var i = 0; i < max; i++) { var ls = envView.config[i].storage - if (localStorage.getItem(ls)) { - envView.config[i].setValue = localStorage.getItem(ls) + if (ls) { + if (localStorage.getItem(ls)) { + envView.config[i].setValue = localStorage.getItem(ls) + } + } else { + ls = envView.config[i].data + for (var j = 0; j < ls.length; j++) { + envView.config[i].data[j].setValue = localStorage.getItem(ls[j].storage) + } } } var max = tlView.config.length