sarahciston commited on
Commit
96b4bd1
·
verified ·
1 Parent(s): 22a8a4d

try moving fields function down

Browse files
Files changed (1) hide show
  1. sketch.js +16 -19
sketch.js CHANGED
@@ -160,25 +160,6 @@ new p5(function (p5){
160
  addField()
161
  }
162
 
163
- function addField(){
164
- let f = p5.createInput("")
165
- f.class("blank")
166
- f.parent("#fieldsDiv")
167
-
168
- // f.changed()
169
- // f.input(blanksArray.push(f))
170
- blanksArray.add(f)
171
- // blanksArray.push(f)
172
- console.log("made field")
173
-
174
- // Cap the number of fields, avoids token limit in prompt
175
- let blanks = document.querySelectorAll(".blank")
176
- if (blanks.length > 5){
177
- console.log(blanks.length)
178
- addButton.style('visibility','hidden')
179
- }
180
- }
181
-
182
  function makeButtons(){
183
  // press to run model
184
  const submitButton = p5.createButton("SUBMIT")
@@ -221,6 +202,22 @@ new p5(function (p5){
221
  // await outText.html(outs, false) // false replaces text instead of appends
222
  }
223
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  });
225
 
226
 
 
160
  addField()
161
  }
162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  function makeButtons(){
164
  // press to run model
165
  const submitButton = p5.createButton("SUBMIT")
 
202
  // await outText.html(outs, false) // false replaces text instead of appends
203
  }
204
 
205
+ function addField(){
206
+ let f = p5.createInput("")
207
+ f.class("blank")
208
+ f.parent("#fieldsDiv")
209
+
210
+ blanksArray.push(f)
211
+ console.log("made variable field")
212
+
213
+ // Cap the number of fields, avoids token limit in prompt
214
+ let blanks = document.querySelectorAll(".blank")
215
+ if (blanks.length > 5){
216
+ console.log(blanks.length)
217
+ addButton.style('visibility','hidden')
218
+ }
219
+ }
220
+
221
  });
222
 
223