Difference between revisions of "Widget:DCTList"

From LINKS Community Center
Jump to: navigation, search
Line 427: Line 427:
 
             const filterState = {};
 
             const filterState = {};
  
             const functionFilterBlocks = document.querySelectorAll('#functions-filter .func-filter-block');
+
             if (
            const funcOpts = new Map();
+
                // Don't pass the filter on if everything is selected.
            functionFilterBlocks.forEach(block => {
+
                document.querySelectorAll('#functions-filter input[type="checkbox"]').length !==
                const cat = block.querySelector('input.func-cat');
+
                document.querySelectorAll('#functions-filter input[type="checkbox"]:checked').length
                if (cat.checked) {
+
            ) {
                    funcOpts.set(
+
                const functionFilterBlocks = document.querySelectorAll('#functions-filter .func-filter-block');
                        cat.value,
+
                const funcOpts = new Map();
                        Array.from(block.querySelectorAll('.subfunc-filter-block input[type="checkbox"]:checked'))
+
                functionFilterBlocks.forEach(block => {
                            .map(box => box.value)
+
                    const cat = block.querySelector('input.func-cat');
                    );
+
                    if (cat.checked) {
                }
+
                        funcOpts.set(
            });
+
                            cat.value,
            console.log(funcOpts)
+
                            Array.from(block.querySelectorAll('.subfunc-filter-block input[type="checkbox"]:checked'))
 +
                                .map(box => box.value)
 +
                        );
 +
                    }
 +
                });
 +
                console.log(funcOpts)
 +
            }
  
            // If everything is selected, disable functions filter.
 
 
             const functionOptions = Array.from(document.querySelectorAll('#functions-filter input[type="checkbox"]'));
 
             const functionOptions = Array.from(document.querySelectorAll('#functions-filter input[type="checkbox"]'));
 
             const selectedFunctions = functionOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value);
 
             const selectedFunctions = functionOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value);

Revision as of 17:35, 18 November 2022

Development verstion of the DCT List.
Not ready for production!