@@ -38,17 +38,16 @@ const preview = {
3838 const copyButton = document . querySelector ( ".copy-button" ) ;
3939 copyButton . disabled = Boolean ( document . querySelector ( "#user:invalid" ) || ! document . querySelector ( "#user" ) . value ) ;
4040 // disable clear button if no added advanced options
41- const clearButton = document . querySelector ( "#clear_button " ) ;
41+ const clearButton = document . querySelector ( "#clear-button " ) ;
4242 clearButton . disabled = ! document . querySelectorAll ( ".minus" ) . length ;
4343 } ,
4444
4545 /**
4646 * Add a property in the advanced section
4747 * @param {string } property - the name of the property, selected element is used if not provided
4848 * @param {string } value - the value to set the property to
49- * @returns {false } false to prevent the default action
5049 */
51- addProperty ( property , value = "#DD2727FF " ) {
50+ addProperty ( property , value = "#EB5454FF " ) {
5251 const selectElement = document . querySelector ( "#properties" ) ;
5352 // if no property passed, get the currently selected property
5453 const propertyName = property || selectElement . value ;
@@ -101,13 +100,11 @@ const preview = {
101100 // update and exit
102101 this . update ( ) ;
103102 }
104- return false ;
105103 } ,
106104
107105 /**
108106 * Remove a property from the advanced section
109107 * @param {string } property - the name of the property to remove
110- * @returns {false } false to prevent the default action
111108 */
112109 removeProperty ( property ) {
113110 const parent = document . querySelector ( ".advanced .parameters" ) ;
@@ -120,7 +117,6 @@ const preview = {
120117 option . disabled = false ;
121118 // update and exit
122119 this . update ( ) ;
123- return false ;
124120 } ,
125121
126122 /**
@@ -138,7 +134,7 @@ const preview = {
138134 } ,
139135
140136 /**
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
142138 * @param {NodeList } elements - the elements to get the values from
143139 * @returns {Object } the key-value mapping
144140 */
@@ -154,7 +150,7 @@ const preview = {
154150 value = value . replace ( / [ F f ] { 2 } $ / , "" ) ;
155151 }
156152 }
157- obj [ next . id ] = value ;
153+ obj [ next . name ] = value ;
158154 return obj ;
159155 } , { } ) ;
160156 } ,
@@ -177,7 +173,7 @@ const preview = {
177173 . join ( "\n" ) ;
178174 const output = `[\n${ mappings } \n]` ;
179175 // set the textarea value to the output
180- const textarea = document . getElementById ( "exportedPhp " ) ;
176+ const textarea = document . getElementById ( "exported-php " ) ;
181177 textarea . value = output ;
182178 textarea . hidden = false ;
183179 } ,
@@ -190,7 +186,7 @@ const preview = {
190186 checkColor ( color , input ) {
191187 if ( color . length === 9 && color . slice ( - 2 ) === "FF" ) {
192188 // 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 ) ;
194190 }
195191 } ,
196192
@@ -251,7 +247,7 @@ window.addEventListener(
251247 } ) ;
252248 // set input boxes to match URL parameters
253249 new URLSearchParams ( window . location . search ) . forEach ( ( val , key ) => {
254- const paramInput = document . querySelector ( `# ${ key } ` ) ;
250+ const paramInput = document . querySelector ( `[name=" ${ key } "] ` ) ;
255251 if ( paramInput ) {
256252 // set parameter value
257253 paramInput . value = val ;
0 commit comments