Difference between revisions of "Widget:DCTList"

From LINKS Community Center
Jump to: navigation, search
Line 1: Line 1:
<noinclude>Current version of the DCT List.<br><span style="color: red; font-weight: bold;">Not ready for production!</span></noinclude>
+
<noinclude>Current version of the DCT List.<br><span style="color: red; font-weight: bold;">Not ready for
 +
        production!</span></noinclude>
 
<includeonly>
 
<includeonly>
 
     <link href="/resources/assets/tabulator.min.css" rel="stylesheet">
 
     <link href="/resources/assets/tabulator.min.css" rel="stylesheet">
Line 656: Line 657:
 
                 tabulator.setData(dcts);
 
                 tabulator.setData(dcts);
 
                 table = tabulator;
 
                 table = tabulator;
 
                // Set up the table if parameter was passed.
 
                const params = new URLSearchParams(window.location.search);
 
                const encoded = params.get('do');
 
 
                if (encoded) {
 
                    const actions = JSON.parse(decodeURIComponent(atob(encoded)));
 
 
                    const filter = actions.filter;
 
                    if (filter) {
 
                        // Functions filter
 
                        const functions = filter.functions;
 
                        if (functions) {
 
                            Object.keys(functions).forEach(subfun => {
 
                                document.getElementById('subfunc-filter-' + escapeAttr(subfun)).checked = !!functions[subfun];
 
                            });
 
                            document.getElementById('functions-filter').dispatchEvent(new Event('change'));
 
                            document.getElementById('functions-filter').closest('.filter-wrapper').classList.toggle('open');
 
                        }
 
 
                        // Further filters
 
                        // ...
 
 
                        applyFilters();
 
                        toggleFilter();
 
                    }
 
 
                    // Further actions (e.g. open filter panel, etc.)
 
                    // ...
 
                }
 
 
             });
 
             });
  
Line 847: Line 818:
 
             ) { filterPane.classList.remove('open'); }
 
             ) { filterPane.classList.remove('open'); }
 
         }, { passive: true });
 
         }, { passive: true });
 +
 +
        window.addEventListener('load', function () {
 +
            // Set up the table if parameter was passed.
 +
            const params = new URLSearchParams(window.location.search);
 +
            const encoded = params.get('do');
 +
 +
            if (encoded) {
 +
                const actions = JSON.parse(decodeURIComponent(atob(encoded)));
 +
 +
                const filter = actions.filter;
 +
                if (filter) {
 +
                    // Functions filter
 +
                    const functions = filter.functions;
 +
                    if (functions) {
 +
                        Object.keys(functions).forEach(subfun => {
 +
                            document.getElementById('subfunc-filter-' + escapeAttr(subfun)).checked = !!functions[subfun];
 +
                        });
 +
                        document.getElementById('functions-filter').dispatchEvent(new Event('change'));
 +
                        document.getElementById('functions-filter').closest('.filter-wrapper').classList.toggle('open');
 +
                    }
 +
 +
                    // Further filters
 +
                    // ...
 +
 +
                    applyFilters();
 +
                    toggleFilter();
 +
                }
 +
 +
                // Further actions (e.g. open filter panel, etc.)
 +
                // ...
 +
            }
 +
        });
 
     </script>
 
     </script>
  

Revision as of 13:42, 5 June 2023

Current version of the DCT List.
Not ready for

       production!