@@ -146,42 +146,44 @@ $(() => {
146146 } ;
147147
148148 const toggleCustomRepositoryData = ( id , name , description , uri ) => {
149- const dispdiv = $ ( '<div/>' ) . addClass ( 'col-md-12' ) . appendTo ( 'div.customized_repositories' ) ;
150- if ( id !== '' ) {
151- dispdiv . attr ( 'id' , id ) ;
152- }
153- const divsr = $ ( '<div/>' ) . addClass ( 'col-md-12 modal-search-result' ) . appendTo ( dispdiv ) ;
154- const divlabel = $ ( '<div/>' ) . addClass ( 'modal-search-result-label' ) . text ( name ) . appendTo ( divsr ) ;
155- if ( id === '' ) {
156- const sid = $ ( 'input.custom_repository_seq' ) . length + 1000000 ;
157- $ ( '<input/>' ) . attr ( 'type' , 'hidden' )
158- . attr ( 'name' , `template[customized_repositories_attributes[${ sid } ][name]]` )
159- . addClass ( 'custom_repository_seq' )
160- . val ( name )
161- . appendTo ( divsr ) ;
162- $ ( '<input/>' ) . attr ( 'type' , 'hidden' )
163- . attr ( 'name' , `template[customized_repositories_attributes[${ sid } ][description]]` )
164- . val ( description )
165- . appendTo ( divsr ) ;
166- $ ( '<input/>' ) . attr ( 'type' , 'hidden' )
167- . attr ( 'name' , `template[customized_repositories_attributes[${ sid } ][uri]]` )
168- . val ( uri )
169- . appendTo ( divsr ) ;
170- } else {
171- $ ( `#customized_repositories_id_${ id } ` ) . appendTo ( divsr ) ;
172- $ ( `#customized_repositories_name_${ id } ` ) . appendTo ( divsr ) ;
173- $ ( `#customized_repositories_description_${ id } ` ) . appendTo ( divsr ) ;
174- $ ( `#customized_repositories_uri_${ id } ` ) . appendTo ( divsr ) ;
175- }
149+ if ( name . length > 0 && description . length > 0 && uri . length > 0 ) {
150+ const dispdiv = $ ( '<div/>' ) . addClass ( 'col-md-12' ) . appendTo ( 'div.customized_repositories' ) ;
151+ if ( id !== '' ) {
152+ dispdiv . attr ( 'id' , id ) ;
153+ }
154+ const divsr = $ ( '<div/>' ) . addClass ( 'col-md-12 modal-search-result' ) . appendTo ( dispdiv ) ;
155+ const divlabel = $ ( '<div/>' ) . addClass ( 'modal-search-result-label' ) . text ( name ) . appendTo ( divsr ) ;
156+ if ( id === '' ) {
157+ const sid = $ ( 'input.custom_repository_seq' ) . length + 1000000 ;
158+ $ ( '<input/>' ) . attr ( 'type' , 'hidden' )
159+ . attr ( 'name' , `template[customized_repositories_attributes[${ sid } ][name]]` )
160+ . addClass ( 'custom_repository_seq' )
161+ . val ( name )
162+ . appendTo ( divsr ) ;
163+ $ ( '<input/>' ) . attr ( 'type' , 'hidden' )
164+ . attr ( 'name' , `template[customized_repositories_attributes[${ sid } ][description]]` )
165+ . val ( description )
166+ . appendTo ( divsr ) ;
167+ $ ( '<input/>' ) . attr ( 'type' , 'hidden' )
168+ . attr ( 'name' , `template[customized_repositories_attributes[${ sid } ][uri]]` )
169+ . val ( uri )
170+ . appendTo ( divsr ) ;
171+ } else {
172+ $ ( `#customized_repositories_id_${ id } ` ) . appendTo ( divsr ) ;
173+ $ ( `#customized_repositories_name_${ id } ` ) . appendTo ( divsr ) ;
174+ $ ( `#customized_repositories_description_${ id } ` ) . appendTo ( divsr ) ;
175+ $ ( `#customized_repositories_uri_${ id } ` ) . appendTo ( divsr ) ;
176+ }
176177
177- $ ( '<button type="button"/>' ) . addClass ( 'modal-search-result-unselector' )
178- . attr ( 'title' , `Click to remove ${ name } ` )
179- . text ( getConstant ( 'PREFS_REMOVE' ) )
180- . appendTo ( divlabel ) ;
181- $ ( '<p/>' ) . text ( description ) . appendTo ( divsr ) ;
182- const p = $ ( '<p/>' ) . appendTo ( divsr ) ;
183- $ ( '<a/>' ) . attr ( 'href' , uri ) . text ( uri ) . appendTo ( p ) ;
184- return divsr ;
178+ $ ( '<button type="button"/>' ) . addClass ( 'modal-search-result-unselector' )
179+ . attr ( 'title' , `Click to remove ${ name } ` )
180+ . text ( getConstant ( 'PREFS_REMOVE' ) )
181+ . appendTo ( divlabel ) ;
182+ $ ( '<p/>' ) . text ( description ) . appendTo ( divsr ) ;
183+ const p = $ ( '<p/>' ) . appendTo ( divsr ) ;
184+ $ ( '<a/>' ) . attr ( 'href' , uri ) . text ( uri ) . appendTo ( p ) ;
185+ return divsr ;
186+ }
185187 }
186188
187189 // -----------------------------------------------------------------
0 commit comments