audrey06100 commited on
Commit
4896b2e
·
1 Parent(s): 6a07f0a
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -68,7 +68,7 @@ observe_js = """
68
  target.style.setProperty("--indication-dot-size", `${newWidth*0.025}px`);
69
  target.style.setProperty("--indication-text-size", `${newWidth*0.035}px`);
70
 
71
- all_elem = target.querySelectorAll(":scope > label");
72
  Array.from(all_elem).forEach(item => {
73
  item.querySelector(":scope > input").style.width = `${newWidth*0.025}px`;
74
  item.querySelector(":scope > input").style.height = `${newWidth*0.025}px`;
@@ -85,6 +85,7 @@ init_js = """
85
  stage1_info = JSON.parse(JSON.stringify(stage1_info));
86
  channel_info = JSON.parse(JSON.stringify(channel_info));
87
 
 
88
  if(stage1_info.state == "step2-selecting"){
89
  selector = "#radio-group > div:nth-of-type(2)";
90
  attribute = "value";
@@ -107,7 +108,8 @@ init_js = """
107
  `;
108
 
109
  // move the radios/checkboxes
110
- all_elem = div.querySelectorAll(":scope > label");
 
111
  Array.from(all_elem).forEach(item => {
112
  name = item.querySelector(":scope > input").getAttribute(attribute);
113
  left = channel_info.inputDict[name].css_position[0];
@@ -131,7 +133,7 @@ init_js = """
131
  name = stage1_info.emptyTemplate[0];
132
  left = channel_info.templateDict[name].css_position[0];
133
  bottom = channel_info.templateDict[name].css_position[1];
134
- dot_rule = `
135
  ${selector}::before {
136
  content: "";
137
  position: absolute;
@@ -147,7 +149,7 @@ init_js = """
147
  left = left.toString()+"%";
148
  bottom = parseFloat(bottom.slice(0, -1));
149
  bottom = bottom.toString()+"%";
150
- txt_rule = `
151
  ${selector}::after {
152
  content: "${name}";
153
  position: absolute;
@@ -177,6 +179,8 @@ update_js = """
177
  stage1_info = JSON.parse(JSON.stringify(stage1_info));
178
  channel_info = JSON.parse(JSON.stringify(channel_info));
179
 
 
 
180
  if(stage1_info.state == "step2-selecting"){
181
  selector = "#radio-group > div:nth-of-type(2)";
182
  cnt = stage1_info.step2.count
@@ -199,7 +203,7 @@ update_js = """
199
  name = stage1_info.emptyTemplate[cnt-1];
200
  left = channel_info.templateDict[name].css_position[0];
201
  bottom = channel_info.templateDict[name].css_position[1];
202
- let dot_rule = `
203
  ${selector}::before {
204
  content: "";
205
  position: absolute;
@@ -215,7 +219,7 @@ update_js = """
215
  left = left.toString()+"%";
216
  bottom = parseFloat(bottom.slice(0, -1));
217
  bottom = bottom.toString()+"%";
218
- let txt_rule = `
219
  ${selector}::after {
220
  content: "${name}";
221
  position: absolute;
 
68
  target.style.setProperty("--indication-dot-size", `${newWidth*0.025}px`);
69
  target.style.setProperty("--indication-text-size", `${newWidth*0.035}px`);
70
 
71
+ let all_elem = target.querySelectorAll(":scope > label");
72
  Array.from(all_elem).forEach(item => {
73
  item.querySelector(":scope > input").style.width = `${newWidth*0.025}px`;
74
  item.querySelector(":scope > input").style.height = `${newWidth*0.025}px`;
 
85
  stage1_info = JSON.parse(JSON.stringify(stage1_info));
86
  channel_info = JSON.parse(JSON.stringify(channel_info));
87
 
88
+ let selector, attribute;
89
  if(stage1_info.state == "step2-selecting"){
90
  selector = "#radio-group > div:nth-of-type(2)";
91
  attribute = "value";
 
108
  `;
109
 
110
  // move the radios/checkboxes
111
+ let name, left, bottom;
112
+ let all_elem = div.querySelectorAll(":scope > label");
113
  Array.from(all_elem).forEach(item => {
114
  name = item.querySelector(":scope > input").getAttribute(attribute);
115
  left = channel_info.inputDict[name].css_position[0];
 
133
  name = stage1_info.emptyTemplate[0];
134
  left = channel_info.templateDict[name].css_position[0];
135
  bottom = channel_info.templateDict[name].css_position[1];
136
+ const dot_rule = `
137
  ${selector}::before {
138
  content: "";
139
  position: absolute;
 
149
  left = left.toString()+"%";
150
  bottom = parseFloat(bottom.slice(0, -1));
151
  bottom = bottom.toString()+"%";
152
+ const txt_rule = `
153
  ${selector}::after {
154
  content: "${name}";
155
  position: absolute;
 
179
  stage1_info = JSON.parse(JSON.stringify(stage1_info));
180
  channel_info = JSON.parse(JSON.stringify(channel_info));
181
 
182
+ let selector;
183
+ let cnt, name, left, bottom;
184
  if(stage1_info.state == "step2-selecting"){
185
  selector = "#radio-group > div:nth-of-type(2)";
186
  cnt = stage1_info.step2.count
 
203
  name = stage1_info.emptyTemplate[cnt-1];
204
  left = channel_info.templateDict[name].css_position[0];
205
  bottom = channel_info.templateDict[name].css_position[1];
206
+ const dot_rule = `
207
  ${selector}::before {
208
  content: "";
209
  position: absolute;
 
219
  left = left.toString()+"%";
220
  bottom = parseFloat(bottom.slice(0, -1));
221
  bottom = bottom.toString()+"%";
222
+ const txt_rule = `
223
  ${selector}::after {
224
  content: "${name}";
225
  position: absolute;