@@ -26,12 +26,14 @@ class WebForms {
2626 this . webFormsData . add ( `ac${ inputPlace } ` , className ) ;
2727 }
2828
29- addStyle ( inputPlace , style ) {
30- this . webFormsData . add ( `as${ inputPlace } ` , style ) ;
31- }
32-
33- addStyle ( inputPlace , name , value ) {
34- this . webFormsData . add ( `as${ inputPlace } ` , `${ name } :${ value } ` ) ;
29+ addStyle ( inputPlace , styleOrName , value = null ) {
30+ if ( value === null ) {
31+ // Handle the two argument case (inputPlace, style)
32+ this . webFormsData . add ( `as${ inputPlace } ` , styleOrName ) ;
33+ } else {
34+ // Handle the three argument case (inputPlace, name, value)
35+ this . webFormsData . add ( `as${ inputPlace } ` , `${ styleOrName } :${ value } ` ) ;
36+ }
3537 }
3638
3739 addOptionTag ( inputPlace , text , value , selected = false ) {
@@ -76,59 +78,69 @@ class WebForms {
7678
7779 // Set methods
7880 setId ( inputPlace , id ) {
79- this . webFormsData . set ( `si${ inputPlace } ` , id ) ;
81+ this . webFormsData . add ( `si${ inputPlace } ` , id ) ;
8082 }
8183
8284 setName ( inputPlace , name ) {
83- this . webFormsData . set ( `sn${ inputPlace } ` , name ) ;
85+ this . webFormsData . add ( `sn${ inputPlace } ` , name ) ;
8486 }
8587
8688 setValue ( inputPlace , value ) {
87- this . webFormsData . set ( `sv${ inputPlace } ` , value ) ;
89+ this . webFormsData . add ( `sv${ inputPlace } ` , value ) ;
8890 }
8991
9092 setClass ( inputPlace , className ) {
91- this . webFormsData . set ( `sc${ inputPlace } ` , className ) ;
92- }
93-
94- setStyle ( inputPlace , style ) {
95- this . webFormsData . set ( `ss${ inputPlace } ` , style ) ;
93+ this . webFormsData . add ( `sc${ inputPlace } ` , className ) ;
9694 }
9795
98- setStyle ( inputPlace , name , value ) {
99- this . webFormsData . set ( `ss${ inputPlace } ` , `${ name } :${ value } ` ) ;
96+ setStyle ( inputPlace , styleOrName , value = null ) {
97+ if ( value === null ) {
98+ // Handle the two argument case (inputPlace, style)
99+ this . webFormsData . add ( `ss${ inputPlace } ` , styleOrName ) ;
100+ } else {
101+ // Handle the three argument case (inputPlace, name, value)
102+ this . webFormsData . add ( `ss${ inputPlace } ` , `${ styleOrName } :${ value } ` ) ;
103+ }
100104 }
101105
102106 setOptionTag ( inputPlace , text , value , selected = false ) {
103- this . webFormsData . set ( `so${ inputPlace } ` , `${ value } |${ text } ${ selected ? '|1' : '' } ` ) ;
107+ this . webFormsData . add ( `so${ inputPlace } ` , `${ value } |${ text } ${ selected ? '|1' : '' } ` ) ;
104108 }
105109
106110 setChecked ( inputPlace , checked = false ) {
107- this . webFormsData . set ( `sk${ inputPlace } ` , checked ? "1" : "0" ) ;
111+ this . webFormsData . add ( `sk${ inputPlace } ` , checked ? "1" : "0" ) ;
108112 }
109113
110114 setCheckBoxTagToList ( inputPlace , text , value , checked = false ) {
111- this . webFormsData . set ( `sk${ inputPlace } ` , `${ value } |${ text } ${ checked ? '|1' : '' } ` ) ;
115+ this . webFormsData . add ( `sk${ inputPlace } ` , `${ value } |${ text } ${ checked ? '|1' : '' } ` ) ;
112116 }
113117
114118 setTitle ( inputPlace , title ) {
115- this . webFormsData . set ( `sl${ inputPlace } ` , title ) ;
119+ this . webFormsData . add ( `sl${ inputPlace } ` , title ) ;
116120 }
117121
118122 setText ( inputPlace , text ) {
119- this . webFormsData . set ( `st${ inputPlace } ` , text . replace ( / \n / g, "$[ln];" ) ) ;
123+ this . webFormsData . add ( `st${ inputPlace } ` , text . replace ( / \n / g, "$[ln];" ) ) ;
120124 }
121125
122126 setAttribute ( inputPlace , attribute , value = "" ) {
123- this . webFormsData . set ( `sa${ inputPlace } ` , `${ attribute } ${ value ? `|${ value } ` : '' } ` ) ;
127+ this . webFormsData . add ( `sa${ inputPlace } ` , `${ attribute } ${ value ? `|${ value } ` : '' } ` ) ;
124128 }
125129
126130 setWidth ( inputPlace , width ) {
127- this . webFormsData . set ( `sw${ inputPlace } ` , width ) ;
131+ if ( typeof width === 'string' ) {
132+ this . webFormsData . add ( `sw${ inputPlace } ` , width ) ;
133+ } else {
134+ this . webFormsData . add ( `sw${ inputPlace } ` , `${ width } px` ) ;
135+ }
128136 }
129-
137+
130138 setHeight ( inputPlace , height ) {
131- this . webFormsData . set ( `sh${ inputPlace } ` , height ) ;
139+ if ( typeof height === 'string' ) {
140+ this . webFormsData . add ( `sh${ inputPlace } ` , height ) ;
141+ } else {
142+ this . webFormsData . add ( `sh${ inputPlace } ` , `${ height } px` ) ;
143+ }
132144 }
133145
134146 // Insert methods
@@ -148,12 +160,14 @@ class WebForms {
148160 this . webFormsData . add ( `ic${ inputPlace } ` , className ) ;
149161 }
150162
151- insertStyle ( inputPlace , style ) {
152- this . webFormsData . add ( `is${ inputPlace } ` , style ) ;
153- }
154-
155- insertStyle ( inputPlace , name , value ) {
156- this . webFormsData . add ( `is${ inputPlace } ` , `${ name } :${ value } ` ) ;
163+ insertStyle ( inputPlace , styleOrName , value = null ) {
164+ if ( value === null ) {
165+ // Handle the two argument case (inputPlace, style)
166+ this . webFormsData . add ( `is${ inputPlace } ` , styleOrName ) ;
167+ } else {
168+ // Handle the three argument case (inputPlace, name, value)
169+ this . webFormsData . add ( `is${ inputPlace } ` , `${ styleOrName } :${ value } ` ) ;
170+ }
157171 }
158172
159173 insertOptionTag ( inputPlace , text , value , selected = false ) {
@@ -253,6 +267,14 @@ class WebForms {
253267 setFontSize ( inputPlace , size ) {
254268 this . webFormsData . add ( `fs${ inputPlace } ` , `${ size } px` ) ;
255269 }
270+
271+ setFontSize ( inputPlace , size ) {
272+ if ( typeof size === 'string' ) {
273+ this . webFormsData . add ( `fs${ inputPlace } ` , size ) ;
274+ } else {
275+ this . webFormsData . add ( `fs${ inputPlace } ` , `${ size } px` ) ;
276+ }
277+ }
256278
257279 setFontBold ( inputPlace , bold ) {
258280 this . webFormsData . add ( `fb${ inputPlace } ` , bold ? "1" : "0" ) ;
@@ -334,13 +356,13 @@ class WebForms {
334356 this . webFormsData . add ( 'cs' , "1" ) ;
335357 }
336358
337- setCache ( second ) {
338- this . webFormsData . add ( 'cd' , String ( second ) ) ;
339- }
340-
341- setCache ( ) {
342- this . webFormsData . add ( 'cd' , "*" ) ;
343- }
359+ setCache ( second = '*' ) {
360+ if ( second === '*' ) {
361+ this . webFormsData . add ( 'cd' , "*" ) ;
362+ } else {
363+ this . webFormsData . add ( 'cd' , String ( second ) ) ;
364+ }
365+ }
344366
345367 // Increase and Decrease methods
346368 increaseMinLength ( inputPlace , value ) {
@@ -420,31 +442,31 @@ class WebForms {
420442 this . webFormsData . add ( `Eg${ inputPlace } ` , `${ htmlEvent } |${ path ? path : "#" } ` ) ;
421443 }
422444
423- setGetEvent ( inputPlace , htmlEvent , outputPlace , path = null ) {
445+ setGetEventInOutputPlace ( inputPlace , htmlEvent , outputPlace , path = null ) {
424446 this . webFormsData . add ( `Eg${ inputPlace } ` , `${ htmlEvent } |${ path ? path : "#" } |${ outputPlace } ` ) ;
425447 }
426448
427449 setGetEventInForm ( inputPlace , htmlEvent ) {
428450 this . webFormsData . add ( `Eg${ inputPlace } ` , htmlEvent ) ;
429451 }
430452
431- setGetEventInForm ( inputPlace , htmlEvent , outputPlace ) {
453+ setGetEventInFormInOutputPlace ( inputPlace , htmlEvent , outputPlace ) {
432454 this . webFormsData . add ( `Eg${ inputPlace } ` , `${ htmlEvent } |${ outputPlace } ` ) ;
433455 }
434456
435457 setGetEventListener ( inputPlace , htmlEventListener , path = null ) {
436458 this . webFormsData . add ( `EG${ inputPlace } ` , `${ htmlEventListener } |${ path ? path : "#" } ` ) ;
437459 }
438460
439- setGetEventListener ( inputPlace , htmlEventListener , outputPlace , path = null ) {
461+ setGetEventListenerInOutputPlace ( inputPlace , htmlEventListener , outputPlace , path = null ) {
440462 this . webFormsData . add ( `EG${ inputPlace } ` , `${ htmlEventListener } |${ path ? path : "#" } |${ outputPlace } ` ) ;
441463 }
442464
443465 setGetEventInFormListener ( inputPlace , htmlEventListener ) {
444466 this . webFormsData . add ( `EG${ inputPlace } ` , htmlEventListener ) ;
445467 }
446468
447- setGetEventInFormListener ( inputPlace , htmlEventListener , outputPlace ) {
469+ setGetEventInFormListenerInOutputPlace ( inputPlace , htmlEventListener , outputPlace ) {
448470 this . webFormsData . add ( `EG${ inputPlace } ` , `${ htmlEventListener } |${ outputPlace } ` ) ;
449471 }
450472
@@ -689,12 +711,13 @@ class InputPlace {
689711class OutputPlace extends InputPlace { }
690712
691713class Fetch {
692- static random ( maxValue ) {
693- return `@mr${ maxValue } ` ;
694- }
695-
714+
696715 static random ( minValue , maxValue ) {
697- return `@mr${ maxValue } ,${ minValue } ` ;
716+ if ( arguments . length === 1 ) {
717+ return `@mr${ minValue } ` ; // Is maxValue
718+ } else if ( arguments . length === 2 ) {
719+ return `@mr${ maxValue } ,${ minValue } ` ;
720+ }
698721 }
699722
700723 static dateYear = "@dy" ;
@@ -709,40 +732,40 @@ class Fetch {
709732 return `@co${ key } ` ;
710733 }
711734
712- static session ( key ) {
713- return `@cs${ key } ` ;
714- }
715-
716735 static session ( key , replaceValue ) {
717- return `@cs ${ key } , ${ replaceValue } ` ;
718- }
719-
720- static sessionAndRemove ( key ) {
721- return `@cl ${ key } ` ;
736+ if ( arguments . length === 1 ) {
737+ return `@cs ${ key } ` ;
738+ } else if ( arguments . length === 2 ) {
739+ return `@cs ${ key } , ${ replaceValue } ` ;
740+ }
722741 }
723742
724743 static sessionAndRemove ( key , replaceValue ) {
725- return `@cl${ key } ,${ replaceValue } ` ;
744+ if ( arguments . length === 1 ) {
745+ return `@cl${ key } ` ;
746+ } else if ( arguments . length === 2 ) {
747+ return `@cl${ key } ,${ replaceValue } ` ;
748+ }
726749 }
727750
728751 static saved ( key = "." ) {
729752 return `@cl${ key } ` ;
730753 }
731754
732- static cache ( key ) {
733- return `@cd${ key } ` ;
734- }
735-
736755 static cache ( key , replaceValue ) {
737- return `@cd ${ key } , ${ replaceValue } ` ;
738- }
739-
740- static cacheAndRemove ( key ) {
741- return `@ct ${ key } ` ;
756+ if ( arguments . length === 1 ) {
757+ return `@cd ${ key } ` ;
758+ } else if ( arguments . length === 2 ) {
759+ return `@cd ${ key } , ${ replaceValue } ` ;
760+ }
742761 }
743762
744763 static cacheAndRemove ( key , replaceValue ) {
745- return `@ct${ key } ,${ replaceValue } ` ;
764+ if ( arguments . length === 1 ) {
765+ return `@ct${ key } ` ;
766+ } else if ( arguments . length === 2 ) {
767+ return `@ct${ key } ,${ replaceValue } ` ;
768+ }
746769 }
747770
748771 static script ( scriptText ) {
@@ -970,9 +993,11 @@ class NameValueCollection {
970993 }
971994
972995 deleteByIndex ( index ) {
973- if ( index >= 0 && index < this . data . length ) {
996+ if ( index >= 0 ) {
974997 this . data . splice ( index , 1 ) ;
975- }
998+ } else {
999+ this . data . splice ( this . data . length + index ) ;
1000+ }
9761001 }
9771002
9781003 getValue ( name ) {
@@ -981,16 +1006,20 @@ class NameValueCollection {
9811006 }
9821007
9831008 getValueByIndex ( index ) {
984- if ( index >= 0 && index < this . data . length ) {
1009+ if ( index >= 0 ) {
9851010 return this . data [ index ] . value ;
986- }
1011+ } else {
1012+ return this . data [ this . data . length + index ] . value ;
1013+ }
9871014 return null ;
9881015 }
9891016
9901017 getNameByIndex ( index ) {
991- if ( index >= 0 && index < this . data . length ) {
1018+ if ( index >= 0 ) {
9921019 return this . data [ index ] . name ;
993- }
1020+ } else {
1021+ return this . data [ this . data . length + index ] . name ;
1022+ }
9941023 return null ;
9951024 }
9961025
@@ -999,22 +1028,30 @@ class NameValueCollection {
9991028 }
10001029
10011030 changeNameByIndex ( index , newName ) {
1002- if ( index >= 0 && index < this . data . length ) {
1031+ if ( index >= 0 ) {
10031032 this . data [ index ] . name = newName ;
1004- }
1033+ } else {
1034+ this . data [ this . data . length + index ] . name = newName ;
1035+ }
10051036 }
10061037
10071038 changeValueByIndex ( index , newValue ) {
1008- if ( index >= 0 && index < this . data . length ) {
1039+ if ( index >= 0 ) {
10091040 this . data [ index ] . value = newValue ;
1010- }
1041+ } else {
1042+ this . data [ this . data . length + index ] . value = newValue ;
1043+ }
10111044 }
10121045
10131046 changeNameValueByIndex ( index , newName , newValue ) {
1014- if ( index >= 0 && index < this . data . length ) {
1047+ if ( index >= 0 ) {
10151048 this . data [ index ] . name = newName ;
10161049 this . data [ index ] . value = newValue ;
1017- }
1050+ } else {
1051+ const adjustedIndex = this . data . length + index ;
1052+ this . data [ adjustedIndex ] . name = newName ;
1053+ this . data [ adjustedIndex ] . value = newValue ;
1054+ }
10181055 }
10191056
10201057 empty ( ) {
0 commit comments