@@ -38,17 +38,16 @@ const preview = {
38
38
const copyButton = document . querySelector ( ".copy-button" ) ;
39
39
copyButton . disabled = Boolean ( document . querySelector ( "#user:invalid" ) || ! document . querySelector ( "#user" ) . value ) ;
40
40
// disable clear button if no added advanced options
41
- const clearButton = document . querySelector ( "#clear_button " ) ;
41
+ const clearButton = document . querySelector ( "#clear-button " ) ;
42
42
clearButton . disabled = ! document . querySelectorAll ( ".minus" ) . length ;
43
43
} ,
44
44
45
45
/**
46
46
* Add a property in the advanced section
47
47
* @param {string } property - the name of the property, selected element is used if not provided
48
48
* @param {string } value - the value to set the property to
49
- * @returns {false } false to prevent the default action
50
49
*/
51
- addProperty ( property , value = "#DD2727FF " ) {
50
+ addProperty ( property , value = "#EB5454FF " ) {
52
51
const selectElement = document . querySelector ( "#properties" ) ;
53
52
// if no property passed, get the currently selected property
54
53
const propertyName = property || selectElement . value ;
@@ -101,13 +100,11 @@ const preview = {
101
100
// update and exit
102
101
this . update ( ) ;
103
102
}
104
- return false ;
105
103
} ,
106
104
107
105
/**
108
106
* Remove a property from the advanced section
109
107
* @param {string } property - the name of the property to remove
110
- * @returns {false } false to prevent the default action
111
108
*/
112
109
removeProperty ( property ) {
113
110
const parent = document . querySelector ( ".advanced .parameters" ) ;
@@ -120,7 +117,6 @@ const preview = {
120
117
option . disabled = false ;
121
118
// update and exit
122
119
this . update ( ) ;
123
- return false ;
124
120
} ,
125
121
126
122
/**
@@ -138,7 +134,7 @@ const preview = {
138
134
} ,
139
135
140
136
/**
141
- * Create a key-value mapping of ids to values from all elements in a Node list
137
+ * Create a key-value mapping of names to values from all elements in a Node list
142
138
* @param {NodeList } elements - the elements to get the values from
143
139
* @returns {Object } the key-value mapping
144
140
*/
@@ -154,7 +150,7 @@ const preview = {
154
150
value = value . replace ( / [ F f ] { 2 } $ / , "" ) ;
155
151
}
156
152
}
157
- obj [ next . id ] = value ;
153
+ obj [ next . name ] = value ;
158
154
return obj ;
159
155
} , { } ) ;
160
156
} ,
@@ -177,7 +173,7 @@ const preview = {
177
173
. join ( "\n" ) ;
178
174
const output = `[\n${ mappings } \n]` ;
179
175
// set the textarea value to the output
180
- const textarea = document . getElementById ( "exportedPhp " ) ;
176
+ const textarea = document . getElementById ( "exported-php " ) ;
181
177
textarea . value = output ;
182
178
textarea . hidden = false ;
183
179
} ,
@@ -190,7 +186,7 @@ const preview = {
190
186
checkColor ( color , input ) {
191
187
if ( color . length === 9 && color . slice ( - 2 ) === "FF" ) {
192
188
// if color has hex alpha value -> remove it
193
- document . getElementById ( input ) . value = color . slice ( 0 , - 2 ) ;
189
+ document . querySelector ( `[name=" ${ input } "]` ) . value = color . slice ( 0 , - 2 ) ;
194
190
}
195
191
} ,
196
192
@@ -251,7 +247,7 @@ window.addEventListener(
251
247
} ) ;
252
248
// set input boxes to match URL parameters
253
249
new URLSearchParams ( window . ___location . search ) . forEach ( ( val , key ) => {
254
- const paramInput = document . querySelector ( `# ${ key } ` ) ;
250
+ const paramInput = document . querySelector ( `[name=" ${ key } "] ` ) ;
255
251
if ( paramInput ) {
256
252
// set parameter value
257
253
paramInput . value = val ;
0 commit comments