@@ -234,8 +234,7 @@ <h1 id="title">Mercury 2025</h1>
234
234
235
235
set value ( newValue ) {
236
236
this . element . value = newValue ;
237
- localStorage . setItem ( this . id , newValue ) ;
238
- this . updateOutlineColor ( ) ;
237
+ this . saveAndUpdateUI ( ) ;
239
238
}
240
239
241
240
get value ( ) {
@@ -275,10 +274,12 @@ <h1 id="title">Mercury 2025</h1>
275
274
}
276
275
277
276
addListener ( ) {
278
- this . element . addEventListener ( 'input' , ( ) => {
279
- localStorage . setItem ( this . id , this . value ) ;
280
- this . updateOutlineColor ( ) ;
281
- } ) ;
277
+ this . element . addEventListener ( 'input' , ( ) => this . saveAndUpdateUI ( this . value ) ) ;
278
+ }
279
+
280
+ saveAndUpdateUI ( newValue ) {
281
+ localStorage . setItem ( this . id , newValue ) ;
282
+ this . updateOutlineColor ( ) ;
282
283
}
283
284
284
285
updateOutlineColor ( ) {
@@ -311,7 +312,7 @@ <h1 id="title">Mercury 2025</h1>
311
312
static type = 'textBox' ;
312
313
313
314
isValid ( ) {
314
- return this . value . length < 150 ;
315
+ return this . value . length < 250 ;
315
316
}
316
317
317
318
clear ( ) {
@@ -322,7 +323,7 @@ <h1 id="title">Mercury 2025</h1>
322
323
const container = super . createElement ( ) ;
323
324
container . classList . add ( 'text_box_question' ) ;
324
325
const textarea = document . createElement ( 'textarea' ) ;
325
- textarea . maxLength = 150 ;
326
+ textarea . maxLength = 250 ;
326
327
container . appendChild ( textarea ) ;
327
328
this . element = textarea ;
328
329
this . addListener ( ) ;
@@ -345,9 +346,7 @@ <h1 id="title">Mercury 2025</h1>
345
346
this . _value = newValue ;
346
347
this . buttonMap . forEach ( btn => btn . classList . remove ( 'selected' ) ) ;
347
348
this . buttonMap . get ( newValue ) ?. classList . add ( 'selected' ) ;
348
-
349
- localStorage . setItem ( this . id , newValue ) ;
350
- this . updateOutlineColor ( ) ;
349
+ this . saveAndUpdateUI ( newValue ) ;
351
350
}
352
351
353
352
get value ( ) {
@@ -431,8 +430,7 @@ <h1 id="title">Mercury 2025</h1>
431
430
432
431
set value ( newValue ) {
433
432
this . element . textContent = String ( newValue ) ;
434
- localStorage . setItem ( this . id , newValue ) ;
435
- this . updateOutlineColor ( ) ;
433
+ this . saveAndUpdateUI ( newValue ) ;
436
434
}
437
435
438
436
get value ( ) {
0 commit comments