@@ -41,15 +41,21 @@ function populateFormFromURL() {
4141 const features = hashParams . get ( "features" ) . split ( "," ) ;
4242 setTimeout ( ( ) => {
4343 features . forEach ( feature => {
44- const tagContainer = document . getElementById ( 'tag-container ' ) ;
45- const tagInput = document . getElementById ( 'tag -input' ) ;
44+ const tagContainer = document . getElementById ( 'hwcaps-tags ' ) ;
45+ const tagInput = document . getElementById ( 'hwcaps -input' ) ;
4646
4747 const tagElement = document . createElement ( 'span' ) ;
4848 tagElement . classList . add ( 'tag' ) ;
4949 tagElement . textContent = feature ;
5050 tagElement . onclick = ( ) => {
51- const selectedTags = [ ...document . querySelectorAll ( '.tag' ) ] . map ( tag => tag . textContent ) ;
52- selectedTags . splice ( selectedTags . indexOf ( feature ) , 1 ) ;
51+ tagElement . remove ( ) ;
52+ filterBoards ( ) ;
53+ } ;
54+ tagContainer . insertBefore ( tagElement , tagInput ) ;
55+ } ) ;
56+ filterBoards ( ) ;
57+ } , 0 ) ;
58+ }
5359 tagElement . remove ( ) ;
5460 filterBoards ( ) ;
5561 } ;
@@ -83,8 +89,8 @@ function updateURL() {
8389 } ) ;
8490
8591 // Add supported features to URL
86- const selectedTags = [ ...document . querySelectorAll ( '.tag' ) ] . map ( tag => tag . textContent ) ;
87- selectedTags . length ? hashParams . set ( "features" , selectedTags . join ( "," ) ) : hashParams . delete ( "features" ) ;
92+ const selectedHWTags = [ ...document . querySelectorAll ( '#hwcaps-tags .tag' ) ] . map ( tag => tag . textContent ) ;
93+ selectedHWTags . length ? hashParams . set ( "features" , selectedHWTags . join ( "," ) ) : hashParams . delete ( "features" ) ;
8894
8995 window . history . replaceState ( { } , "" , `#${ hashParams . toString ( ) } ` ) ;
9096}
@@ -126,8 +132,8 @@ function fillSocSocSelect(families, series = undefined, selectOnFill = false) {
126132function setupHWCapabilitiesField ( ) {
127133 let selectedTags = [ ] ;
128134
129- const tagContainer = document . getElementById ( 'tag-container ' ) ;
130- const tagInput = document . getElementById ( 'tag -input' ) ;
135+ const tagContainer = document . getElementById ( 'hwcaps-tags ' ) ;
136+ const tagInput = document . getElementById ( 'hwcaps -input' ) ;
131137 const datalist = document . getElementById ( 'tag-list' ) ;
132138
133139 const tagCounts = Array . from ( document . querySelectorAll ( '.board-card' ) ) . reduce ( ( acc , board ) => {
@@ -272,8 +278,8 @@ function resetForm() {
272278 document . getElementById ( "show-shields" ) . checked = true ;
273279
274280 // Clear supported features
275- document . querySelectorAll ( '.tag' ) . forEach ( tag => tag . remove ( ) ) ;
276- document . getElementById ( 'tag -input' ) . value = '' ;
281+ document . querySelectorAll ( '#hwcaps-tags .tag' ) . forEach ( tag => tag . remove ( ) ) ;
282+ document . getElementById ( 'hwcaps -input' ) . value = '' ;
277283
278284 filterBoards ( ) ;
279285}
@@ -297,10 +303,11 @@ function filterBoards() {
297303 const showBoards = document . getElementById ( "show-boards" ) . checked ;
298304 const showShields = document . getElementById ( "show-shields" ) . checked ;
299305
300- const selectedTags = [ ...document . querySelectorAll ( '.tag' ) ] . map ( tag => tag . textContent ) ;
306+ // Get selected hardware capability tags
307+ const selectedHWTags = [ ...document . querySelectorAll ( '#hwcaps-tags .tag' ) ] . map ( tag => tag . textContent ) ;
301308
302309 const resetFiltersBtn = document . getElementById ( "reset-filters" ) ;
303- if ( nameInput || archSelect || vendorSelect || socSocSelect . selectedOptions . length || selectedTags . length || ! showBoards || ! showShields ) {
310+ if ( nameInput || archSelect || vendorSelect || socSocSelect . selectedOptions . length || selectedHWTags . length || ! showBoards || ! showShields ) {
304311 resetFiltersBtn . classList . remove ( "btn-disabled" ) ;
305312 } else {
306313 resetFiltersBtn . classList . add ( "btn-disabled" ) ;
@@ -328,7 +335,7 @@ function filterBoards() {
328335 ! ( archSelect && ! boardArchs . includes ( archSelect ) ) &&
329336 ! ( vendorSelect && boardVendor !== vendorSelect ) &&
330337 ( selectedSocs . length === 0 || selectedSocs . some ( ( soc ) => boardSocs . includes ( soc ) ) ) &&
331- ( selectedTags . length === 0 || selectedTags . every ( ( tag ) => boardSupportedFeatures . includes ( tag ) ) ) ;
338+ ( selectedHWTags . length === 0 || selectedHWTags . every ( ( tag ) => boardSupportedFeatures . includes ( tag ) ) ) ;
332339 }
333340
334341 board . classList . toggle ( "hidden" , ! matches ) ;
0 commit comments