Difference between revisions of "Widget:DCTList"

From LINKS Community Center
Jump to: navigation, search
(364 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>Development verstion of the DCT Homepage.<br><span style="color: red; font-weight: bold;">Not ready for production!</span></noinclude>
+
<noinclude>DCT list widget.<br><span style="color: red; font-weight: bold;">Currently in use &ndash; do not modify!</span></noinclude>
<includeonly><style>
+
<includeonly>
         #hp-wrapper {
+
    <link href="/resources/assets/tabulator/dist/css/tabulator.min.css" rel="stylesheet">
            --hp-border: 1px solid rgba(0, 0, 0, .5);
+
    <script type="text/javascript" src="/resources/assets/tabulator/dist/js/tabulator.min.js"></script>
 +
 
 +
    <style>
 +
         #dct-list-wrapper {
 
             font-family: 'Open Sans';
 
             font-family: 'Open Sans';
 +
            margin-top: 4em;
 
         }
 
         }
         #hp-wrapper h1, #hp-wrapper h2, #hp-wrapper h3 {
+
 
 +
         #dct-list-wrapper h1,
 +
        #dct-list-wrapper h2,
 +
        #dct-list-wrapper h3,
 +
        #dct-list-wrapper h4 {
 
             font-family: 'Raleway';
 
             font-family: 'Raleway';
 
             font-weight: 300;
 
             font-weight: 300;
 
             letter-spacing: .06em;
 
             letter-spacing: .06em;
 
         }
 
         }
         #hp-heading {
+
 
             padding: 1em;
+
        #dct-list-wrapper h1,
 +
        #dct-filters h2 {
 +
            display: flex;
 +
            align-items: center;
 +
        }
 +
 
 +
         #dct-intro {
 +
             font-size: larger;
 
             margin-bottom: 4em;
 
             margin-bottom: 4em;
            background:
 
                linear-gradient(125deg, #FFFFFF 0%, #222222 100%),
 
                linear-gradient(200deg, #d5dde3 0%, #d5dde3 50%, #acbac8 calc(50% + 1px), #acbac8 60%, #5d758c calc(60% + 1px), #5d758c 75%, #415262 calc(75% + 1px), #415262 100%),
 
                linear-gradient(113deg, #d5dde3 0%, #d5dde3 40%, #acbac8 calc(40% + 1px), #acbac8 50%, #5d758c calc(50% + 1px), #5d758c 70%, #415262 calc(70% + 1px), #415262 100%);
 
            /* background:
 
                linear-gradient(125deg, #FFFFFF 0%, #000000 100%),
 
                linear-gradient(200deg, #D0F2F2 0%, #D0F2F2 50%, #34B8B8 calc(50% + 1px), #34B8B8 60%, #166EA9 calc(60% + 1px), #166EA9 75%, #125887 calc(75% + 1px), #125887 100%),
 
                linear-gradient(113deg, #D0F2F2 0%, #D0F2F2 40%, #34B8B8 calc(40% + 1px), #34B8B8 50%, #166EA9 calc(50% + 1px), #166EA9 70%, #125887 calc(70% + 1px), #125887 100%); */
 
            background-blend-mode: overlay, overlay, normal;
 
            clip-path: inset(0 100% 100% 0);
 
            transition: all 500ms ease-in-out;
 
 
         }
 
         }
         .loaded #hp-heading { clip-path: inset(0); }
+
 
         #hp-heading h1 { font-size: 3.4em; margin-bottom: .5em; color: var(--links-grey); }
+
         #dct-list-wrapper h1 {
         #hp-heading h1 span {
+
            color: var(--links-blue);
 +
        }
 +
 
 +
         #dct-list-wrapper h1 svg {
 +
            height: 2.5em;
 +
            width: 2.5em;
 +
            fill: var(--links-blue);
 +
            margin-right: .5em;
 +
        }
 +
 
 +
        #filter-bar {
 +
            position: relative;
 +
            margin: 1em 0 2em 0;
 +
        }
 +
 
 +
        #dct-filters {
 +
            position: absolute;
 +
            top: 0;
 +
            right: 0;
 +
            z-index: 100;
 +
            padding: 2em;
 +
            width: 45vw;
 +
            background: #fff;
 +
            border: 1px solid var(--links-blue);
 +
            clip-path: inset(0 0 100% 100%);
 +
            box-shadow: -10px 10px 10px 5px rgb(0 0 0 / 10%);
 +
            transition: all 400ms ease-in-out;
 +
        }
 +
 
 +
        #dct-filters.open {
 +
            clip-path: inset(0 0 -50px -50px);
 +
        }
 +
 
 +
         #close-filter-button {
 
             display: block;
 
             display: block;
             white-space: nowrap;
+
             cursor: pointer;
             opacity: 0;
+
            font-size: 2.5em;
             transform: translateX(-1em);
+
            line-height: .7em;
             transition: all 500ms ease-in-out;
+
             margin-top: -.2em;
 +
             font-weight: 100;
 +
            color: var(--links-blue);
 +
        }
 +
 
 +
        #dct-filters h2 svg {
 +
             height: 1.5em;
 +
            width: 1.5em;
 +
            margin-right: .5em;
 +
            margin-left: -.2em;
 
         }
 
         }
         .loaded #hp-heading h1 span { opacity: .95; transform: translateX(0);}
+
 
        #hp-heading h1 span:nth-child(1) { font-weight: 800; letter-spacing: .06em; transition-delay: 300ms; }
+
         .large-button {
        #hp-heading h1 span:nth-child(2) { font-weight: 500; transition-delay: 400ms; }
+
            border: 1px solid var(--links-blue);
        #hp-heading h1 span:nth-child(3) { font-weight: 100; transition-delay: 500ms; }
+
            font-size: 1.5em;
        #hp-heading .hp-lead { font-size: 1.4em; font-weight: 300; margin-bottom: 2em; opacity: 0; transition: all 500ms ease-in-out 1000ms; }
+
            font-family: 'Open Sans';
        .loaded #hp-heading .hp-lead { opacity: .95; }
+
            font-weight: 100;
        .hp-button-wrapper { text-align: center; }
+
            margin-bottom: 2em;
        .hp-large-button {
+
            padding: 0.3em 0.8em;
 +
            color: var(--links-blue);
 +
            background: transparent;
 +
            font-variant: small-caps;
 
             display: inline-block;
 
             display: inline-block;
             font-weight: 600;
+
             transition: all 200ms ease-in-out;
             font-size: 1.3em;
+
        }
             padding: .5em;
+
 
             border: var(--hp-border);
+
        .large-button:hover {
             opacity: 0;
+
            background-color: var(--links-blue);
             transition: all 500ms ease-in-out 1300ms;
+
            color: #fff;
             text-decoration: none;
+
        }
 +
 
 +
        #dct-list-wrapper h2 {
 +
             margin-bottom: 1em;
 +
        }
 +
 
 +
        .filter-button-wrapper {
 +
            margin-bottom: 1em;
 +
        }
 +
 
 +
        .filter-wrapper button {
 +
             border: 0 none;
 +
             color: var(--links-blue);
 +
             background-color: transparent;
 +
             font-variant: small-caps;
 +
            font-size: 1.2em;
 +
             text-decoration: underline;
 +
            padding: 0;
 +
        }
 +
 
 +
        .filter-wrapper .filter-toggle {
 
             cursor: pointer;
 
             cursor: pointer;
 
         }
 
         }
         .hp-large-button:hover { text-decoration: none; }
+
 
         .loaded .hp-large-button { opacity: 1; }
+
         .filter-wrapper .filter-container {
         .hp-search { margin-bottom: 4em; }
+
            display: none;
         .hp-areas { margin-bottom: 8em; }
+
        }
        .hp-areas *, #hp-collections * { transition: all 400ms ease-in-out; }
+
 
         .hp-areas h2 { text-align: center; margin-bottom: 1.5em; }
+
         .filter-wrapper.open .filter-container {
         .hp-area { display: flex; flex-direction: column; align-items: center; margin-bottom: 2em; text-decoration: none; cursor: pointer; }
+
            display: block;
         .hp-area h3 { text-align: center; }
+
        }
         .hp-area:hover { text-decoration: none; }
+
 
         .hp-area:hover h3 { font-weight: 700 !important; }
+
         .filter-wrapper.open .plus.icon::after {
         .hp-area-icon { flex: 1 0; margin-right: 1em; user-select: none; }
+
            transform: rotate(0);
         .hp-area-icon svg { width: 100px; height: 100px; }
+
        }
         .hp-area-text { flex: 1 1 75%; }
+
 
         .hp-area-text p { font-size: 1.2em; margin: 0 0 0 .1em; }
+
         .filter-content {
         .hp-area-arrow { display: none; }
+
            font-size: 1.2em;
         .hp-compass {
+
            margin-bottom: 2em;
             border-top: var(--hp-border);
+
            display: grid;
             border-bottom: var(--hp-border);
+
            grid-template-columns: repeat(auto-fit, minmax(14em, 1fr));
             padding: 2em 1em;
+
            align-items: start;
             display: flex;
+
        }
             justify-content: center;
+
 
 +
         .filter-content.loose {
 +
            gap: .5em .5em;
 +
        }
 +
 
 +
         .filter-group-header {
 +
            grid-column: 1/-1;
 +
            margin-bottom: -.5em;
 +
            margin-top: 1em;
 +
            font-family: 'Raleway';
 +
            font-weight: 200;
 +
            letter-spacing: .06em;
 +
        }
 +
 
 +
         .filter-group-start {
 +
            grid-column-start: 1;
 +
        }
 +
 
 +
         .filter-content input[type="checkbox"] {
 +
            margin-right: .5em;
 +
        }
 +
 
 +
         .filter-content img {
 +
            width: 2em;
 +
            height: 2em;
 +
            margin: 0 .5em 0 0;
 +
        }
 +
 
 +
        .subfunc-filter-block {
 +
            font-size: smaller;
 +
            padding-left: 1em;
 +
        }
 +
 
 +
         #dct-tabulator.tabulator {
 +
            border: 0 none;
 +
            background-color: transparent;
 +
            font-size: 1.2em;
 +
        }
 +
 
 +
         #dct-tabulator.tabulator .tabulator-header {
 +
            border-bottom: 4px double var(--links-blue);
 +
            background-color: transparent;
 +
        }
 +
 
 +
         #dct-tabulator.tabulator .tabulator-header .tabulator-col {
 +
            border-right: 0 none;
 +
            background: transparent;
 +
        }
 +
 
 +
         #dct-tabulator.tabulator .tabulator-header .tabulator-col-content {
 +
            padding: .5em 0;
 +
        }
 +
 
 +
        #dct-tabulator.tabulator .tabulator-header .tabulator-col-sorter {
 +
            right: 1em;
 +
        }
 +
 
 +
         #dct-tabulator.tabulator .tabulator-row {
 +
            background-color: transparent;
 +
        }
 +
 
 +
         #dct-tabulator.tabulator .tabulator-cell {
 +
            border-right: 0 none;
 +
             border-top: 1px solid var(--links-blue);
 +
             padding: .5em 0;
 +
        }
 +
 
 +
        .data-source-img,
 +
        .func-img {
 +
            width: 1.2rem;
 +
            height: 1.2rem;
 +
             margin-right: .4rem;
 +
             margin-bottom: .4rem;
 +
             filter: grayscale(1);
 +
        }
 +
 
 +
        .func-img {
 +
            width: 1.5rem;
 +
            height: 1.5rem;
 
         }
 
         }
        #hp-resources, #hp-networks { padding: 2em 1em; }
+
 
        #hp-resources { border-top: var(--hp-border); }
+
         #dct-tabulator img.unselected {
         #hp-resources .hp-area, #hp-networks .hp-area { margin-bottom: 0 !important; }
+
            opacity: .15;
        #hp-recent h3 { margin-bottom: 1em; }
 
        #forum-topics { padding: 2em 1em; }
 
        #hp-changes { border-top: var(--hp-border); padding: 2em 1em; }
 
        .blue * {
 
            color: var(--links-blue);
 
            border-color: var(--links-blue);
 
            fill: var(--links-blue);
 
 
         }
 
         }
         .orange * {
+
 
             color: var(--links-orange);
+
         .sources-collapse {
            border-color: var(--links-orange);
+
             display: inline-block;
            fill: var(--links-orange);
 
 
         }
 
         }
         .grey * {
+
 
             color: var(--links-grey);
+
         .sources-collapse-toggle {
             border-color: var(--links-grey);
+
             display: inline-block;
             fill: var(--links-grey);
+
            width: 2em;
 +
             height: 2em;
 +
        }
 +
 
 +
        #dct-tabulator .tabulator-row .tabulator-responsive-collapse {
 +
            padding: 0 .5em 2em 0;
 +
             border: 0 none;
 
         }
 
         }
         .cyan * {
+
 
             color: var(--links-cyan);
+
         #filter-summary {
            border-color: var(--links-cyan);
+
             margin-right: 1em;
            fill: var(--links-cyan);
 
 
         }
 
         }
  
        /* Quick fix for removed Compass. Delete when Compass is restored. */
+
         #filter-summary table tr td {
         #forum-topics { border-top: var(--hp-border); }
+
            vertical-align: top;
 +
        }
  
         @media screen and (min-width: 992px) {
+
         #filter-summary table tr td:first-of-type {
            #hp-heading { padding: 3em; margin-bottom: 8em; }
+
             padding-right: 10px;
            #hp-heading h1 { font-size: 5em; }
+
        }
            #hp-heading .hp-lead { max-width: 50%; font-size: 2em; }
 
            .hp-button-wrapper { text-align: left; }
 
            .hp-large-button { font-size: 1.6em; }
 
            #hp-main { width: 75%; margin: auto; }
 
            .hp-search { margin-bottom: 8em; }
 
            .hp-area { flex-direction: row; }
 
            .hp-area h3 { text-align: left; }
 
            .hp-areas h2 { margin-bottom: 2em; }
 
            .hp-area-icon svg { width: 130px; height: 130px; }
 
            .hp-area-arrow { display: block; flex: 1 0; font-size: 3em; margin-left: 1em; user-select: none; }
 
            .hp-area:hover .hp-area-arrow { transform: translateX(1em); }
 
            .hp-compass { padding: 5em; }
 
            #hp-collections { border-top: var(--hp-border); }
 
            #hp-resources { border-top: 0 none; }
 
             #forum-topics, #hp-resources { padding: 4em 1em 4em 0; border-right: var(--hp-border); }
 
            #hp-changes, #hp-networks { padding: 4em 0 4em 1em; border-top: 0 none; }
 
            .hp-compass .hp-area-text h2 { font-size: 3em; }
 
            .hp-compass .hp-area-text p { font-size: 1.8em; font-weight: 300 !important; }
 
            .hp-compass svg { width: 200px; height: 200px; }
 
  
            /* Quick fix for removed Compass. Delete when Compass is restored. */
+
        #dct-tabulator .tabulator-row .tabulator-responsive-collapse table {
             #hp-resources {border-right: 0 none; }
+
             font-size: smaller;
            #hp-changes { border-top: var(--hp-border); }
+
        }
 +
 
 +
        #filter-summary table tr td strong,
 +
        #dct-tabulator .tabulator-row .tabulator-responsive-collapse table tr td strong {
 +
            font-weight: 300;
 
         }
 
         }
 
     </style>
 
     </style>
  
 
     <script>
 
     <script>
         function search(event) {
+
         'use strict';
             event.preventDefault();
+
 
             const searchString = document.getElementById('hp-search-input').value;
+
        const FUNC_KEY = 'functions';
             window.location.assign('/index.php?search=' + encodeURIComponent(searchString) + '&title=Special%3ASearch&profile=default&fulltext=1');
+
        const DESC_KEY = 'description';
 +
 
 +
        /** @typedef {Map<string, { [DESC_KEY]: string, [FUNC_KEY]: string[] }>} FuncData */
 +
 
 +
        /** @type FuncData */
 +
        const functionsData = new Map();    // Data on functions and function categories
 +
 
 +
        /**
 +
        * @typedef {Object} DCT
 +
        * @property {string} name
 +
        * @property {string} url
 +
        * @property {string[]} dataSources
 +
        * @property {string[]} businessModel
 +
        * @property {FuncData} functions
 +
        * @property {string} usedByDmo
 +
        * @property {string} archived
 +
        * @property {string} hasUC
 +
        * @property {string} logo
 +
        */
 +
 
 +
        let table;  // Tabulator instance
 +
 
 +
        // This defines how sources are grouped in the filter.
 +
        // Any source not listed here will be added to the last group entitled "More platforms".
 +
        const sourcesLayout = [
 +
            {
 +
                title: 'General',
 +
                sources: ['Crowd', 'Web']
 +
            },
 +
            {
 +
                title: 'Platforms',
 +
                sources: ['Facebook', 'Twitter', 'Instagram', 'YouTube']
 +
            }
 +
        ];
 +
 
 +
        // This object defines the sort order of function categories and matches them to icons.
 +
        const fnImages = {
 +
            'Search and Monitor': '/index.php/Special:FilePath/File:Func_search.svg',
 +
            'Post and Schedule': '/index.php/Special:FilePath/File:Func_post.svg',
 +
            'Analysis': '/index.php/Special:FilePath/File:Func_analysis.svg',
 +
            'Metrics': '/index.php/Special:FilePath/File:Func_metrics.svg',
 +
            'Report': '/index.php/Special:FilePath/File:Func_report.svg',
 +
            'Collaboration': '/index.php/Special:FilePath/File:Func_collaboration.svg',
 +
            'Interoperability': '/index.php/Special:FilePath/File:Func_interoperability.svg',
 +
            'Meta': '/index.php/Special:FilePath/File:Func_meta.svg',
 +
        };
 +
 
 +
        // Helpers
 +
        const escapeAttr = text => text ? text.replace(/\W/g, '-') : text;
 +
        const getFilePath = title => title ? '/index.php/Special:FilePath/' + title : title;
 +
        const getQueryUrl = query => '/api.php?action=ask&format=json&query=' + encodeURIComponent(query);
 +
        const removePrefix = str => str.substring(str.indexOf(':') + 1);
 +
 
 +
        // Fetches platform / data source information.
 +
        async function getSources() {
 +
            const IMG_KEY = 'IMAGE';
 +
            const sourceResponse = await fetch(
 +
                getQueryUrl('[[Category:Social media platform]]|?' + IMG_KEY)
 +
            ).then(response => response.json());
 +
 
 +
            return Object.keys(sourceResponse.query.results).map(platform => {
 +
                const img = sourceResponse.query.results[platform].printouts[IMG_KEY][0];
 +
                return {
 +
                    name: platform,
 +
                    image: img ? getFilePath(img.fulltext) : undefined
 +
                };
 +
            });
 +
        }
 +
 
 +
        // Fetches DCTs and their functions.
 +
        async function getDcts() {
 +
            const functionsQuery = '[[Category:Function_category]]'
 +
                + '|?-Subproperty_of=' + FUNC_KEY
 +
                + '|?Has_description=' + DESC_KEY;
 +
            const functionsQueryResponse = await fetch(getQueryUrl(functionsQuery)).then(response => response.json());
 +
 
 +
            const sortOrder = Object.keys(fnImages);
 +
            Object.entries(functionsQueryResponse.query.results)
 +
                .map(([key, value]) => ([removePrefix(key), value]))
 +
                .sort(([keyA,], [keyB,]) => sortOrder.indexOf(keyA) - sortOrder.indexOf(keyB))
 +
                .forEach(([categoryName, results]) => {
 +
                    functionsData.set(
 +
                        categoryName,
 +
                        {
 +
                            [DESC_KEY]: results.printouts[DESC_KEY][0],
 +
                            [FUNC_KEY]: results.printouts[FUNC_KEY]
 +
                                .map(func => removePrefix(func.fulltext))
 +
                                .filter(func => func !== 'Content processing languages' && func !== 'Supported content types')
 +
                                .sort()
 +
                        }
 +
                    );
 +
                });
 +
 
 +
            const allFunctions = Array.from(functionsData.values(), entry => entry[FUNC_KEY]).flat();
 +
 
 +
            const DATASRC_PROP = 'Data Sources';
 +
            const IMG_PROP = 'Image';
 +
            const BUSINESS_PROP = 'Pricing';
 +
            const DMO_PROP = 'Used by Practitioners';
 +
            const UC_PROP = 'Use Cases available';
 +
            const ARCHIVED = 'Is Archived';
 +
            const dctQuery = '[[Category:Disaster Community Technology]]'
 +
                // + '[[Is Archived::No]]'
 +
                + '|limit=500'
 +
                + '|?' + ARCHIVED
 +
                + '|?' + IMG_PROP
 +
                + '|?' + DATASRC_PROP
 +
                + '|?' + BUSINESS_PROP
 +
                + '|?' + DMO_PROP
 +
                + '|?' + UC_PROP
 +
                + '|?' + allFunctions.join('|?');
 +
 
 +
            const dctResponse = await fetch(getQueryUrl(dctQuery)).then(response => response.json());
 +
 
 +
            const dctList = Object.keys(dctResponse.query.results).map(dctName => {
 +
                const dctResult = dctResponse.query.results[dctName];
 +
 
 +
                /** @type {DCT} */
 +
                const dct = {};
 +
                dct.name = dctName;
 +
                dct.url = dctResult.fullurl;
 +
                dct.dataSources = dctResult.printouts[DATASRC_PROP].map(source => source.fulltext).sort();
 +
                dct.businessModel = dctResult.printouts[BUSINESS_PROP].map(bModel => bModel.fulltext);
 +
                dct.logo = dctResult.printouts[IMG_PROP][0] ? getFilePath(dctResult.printouts[IMG_PROP][0].fulltext) : undefined;
 +
                dct.usedByDmo = dctResult.printouts[DMO_PROP][0] === 't' ? 'yes' : 'no';    // not quite, but we only care about yes
 +
                dct.hasUC = dctResult.printouts[UC_PROP][0] === 't' ? 'yes' : 'no';    // not quite, but we only care about yes
 +
                dct.archived = dctResult.printouts[ARCHIVED][0] === 't' ? 'yes' : 'no';    // not quite, but we only care about yes
 +
 
 +
                dct.functions = new Map();
 +
                functionsData.forEach((categoryData, funcCategory) => {
 +
                    const confirmedFunctions = categoryData[FUNC_KEY]
 +
                        .filter(func => dctResult.printouts[func][0] && dctResult.printouts[func][0].fulltext.toLowerCase() === 'yes');
 +
 
 +
                    if (confirmedFunctions.length > 0) {
 +
                        dct.functions.set(funcCategory, { [DESC_KEY]: categoryData[DESC_KEY], [FUNC_KEY]: confirmedFunctions });
 +
                    }
 +
                });
 +
 
 +
                return dct;
 +
            });
 +
 
 +
            return dctList;
 +
        }
 +
 
 +
        /**
 +
        * @param {DCT} dct
 +
        */
 +
        function dctFilter(dct, filterState) {
 +
            // If filtering property is empty, don't apply the filter (set the check to true).
 +
            // Passing an empty object (as with applyFilters(true)) should result in an unfiltered table.
 +
 
 +
            let functionsCheck = true;  // automatically pass functions check if the filter missing
 +
            if (filterState.functions) {
 +
                // If filterState has a category but subfunctions array is empty, we only care about the category.
 +
                const emptyCategories = [], nonemptyCategories = [];
 +
                Array.from(filterState.functions).forEach(([key, subs]) => {
 +
                    if (subs.length > 0) { nonemptyCategories.push(key); } else { emptyCategories.push(key); }
 +
                });
 +
 
 +
                // Empty categories should only be checked by their name
 +
                const checkEmpty = emptyCategories.every(cat => dct.functions.has(cat));
 +
 
 +
                // Nonempty categories should only be checked for presence of their subfunctions. Category itself is irrelevant.
 +
                const checkNonempty = nonemptyCategories.every(cat => {
 +
                    const selectedSubs = filterState.functions.get(cat);
 +
                    const dctSubs = dct.functions.get(cat);
 +
                    return dctSubs && dctSubs[FUNC_KEY] && selectedSubs.every(sub => dctSubs[FUNC_KEY].includes(sub));
 +
                });
 +
 
 +
                functionsCheck = checkEmpty && checkNonempty;
 +
                // TODO: Empty should no longer exist, once every category is fully listed in the filter.
 +
                // TODO: The filtering of functions therefore should be reduced to nonempty only.
 +
            }
 +
 
 +
            const sourcesCheck = filterState.dataSources
 +
                ? filterState.dataSources.every(source => dct.dataSources.includes(source))
 +
                : true;
 +
            const businessModelCheck = filterState.businessModel
 +
                ? dct.businessModel.some(bm => filterState.businessModel.includes(bm))
 +
                : true;
 +
            const dmUseCheck = filterState.usedByDmo
 +
                ? filterState.usedByDmo === dct.usedByDmo
 +
                : true;
 +
            const ucCheck = filterState.hasUC
 +
                ? filterState.hasUC === dct.hasUC
 +
                : true;
 +
            const archivedCheck = filterState.showArchived
 +
                ? true
 +
                : dct.archived !== 'yes';
 +
 
 +
            return sourcesCheck && functionsCheck && businessModelCheck && dmUseCheck && ucCheck && archivedCheck;
 +
        }
 +
 
 +
        function applyFilters(clear) {
 +
            if (!table) return; // prevent filtering before the table is ready
 +
 
 +
            // If clear=true, pass empty object to the filter to disable it.
 +
            if (clear) {
 +
                table.setFilter(dctFilter, {});
 +
                return;
 +
            }
 +
 
 +
             const filterState = {};
 +
 
 +
            if (document.querySelectorAll('#functions-filter input[type="checkbox"]:checked').length > 0) {
 +
                const functionFilterBlocks = document.querySelectorAll('#functions-filter .func-filter-block');
 +
                const funcOpts = new Map();
 +
                functionFilterBlocks.forEach(block => {
 +
                    const cat = block.querySelector('input.func-cat');
 +
                    if (cat.checked) {
 +
                        funcOpts.set(
 +
                            cat.value,
 +
                            Array.from(block.querySelectorAll('.subfunc-filter-block input[type="checkbox"]:checked'))
 +
                                .map(box => box.value)
 +
                        );
 +
                    }
 +
                });
 +
                filterState.functions = funcOpts;
 +
            }
 +
 
 +
             const selectedSources = Array.from(document.querySelectorAll('#data-source-filter input[type="checkbox"]:checked'))
 +
                .map(checkbox => checkbox.value);
 +
            if (selectedSources.length > 0) filterState.dataSources = selectedSources;
 +
 
 +
            const selectedBModels = Array.from(document.querySelectorAll('#business-model-filter input[type="checkbox"]:checked'))
 +
                .map(checkbox => checkbox.value);
 +
            if (selectedBModels.length > 0) filterState.businessModel = selectedBModels;
 +
 
 +
            if (document.getElementById('used-by-practitioners').checked) filterState.usedByDmo = 'yes';
 +
             if (document.getElementById('has-use-case').checked) filterState.hasUC = 'yes';
 +
            if (document.getElementById('show-archived').checked) filterState.showArchived = 'yes';
 +
 
 +
            table.setFilter(dctFilter, filterState);
 +
        }
 +
 
 +
        // Load data and build page.
 +
        Promise.all([getSources(), getDcts()]).then(data => {
 +
            const [dataSources, dcts] = data;
 +
 
 +
            // Set up functions filter
 +
            let funcFilterHtml = '';
 +
            Array.from(functionsData).forEach(([fnCat, fnInfo], index) => {
 +
                const identifier = 'func-filter-' + escapeAttr(fnCat);
 +
                funcFilterHtml +=
 +
                    `<div class="func-filter-block">
 +
                        <div>
 +
                            <input type="checkbox" id="${identifier}" value="${fnCat}" class="func-cat">
 +
                            <label for="${identifier}" title="${fnInfo[DESC_KEY]}"><img src="${fnImages[fnCat]}"> ${fnCat}</label>
 +
                        </div>`;
 +
 
 +
                // add subfunctions
 +
                funcFilterHtml += '<div class="subfunc-filter-block">';
 +
                for (const func of fnInfo.functions) {
 +
                    const subfuncId = 'subfunc-filter-' + escapeAttr(func);
 +
                    funcFilterHtml +=
 +
                        `<div>
 +
                            <input type="checkbox" id="${subfuncId}" value="${func}">
 +
                            <label for="${subfuncId}">${func}</label>
 +
                        </div>`;
 +
                }
 +
                funcFilterHtml += '</div>';
 +
 
 +
                funcFilterHtml += '</div>';
 +
            });
 +
            document.getElementById('functions-filter').innerHTML = funcFilterHtml;
 +
 
 +
            // Set up sources filter
 +
            const groupedSources = [];
 +
            const sourcesCopy = Array.from(dataSources);
 +
            for (const layoutGroup of sourcesLayout) {
 +
                const group = [];
 +
                for (const source of layoutGroup.sources) {
 +
                    let idx = sourcesCopy.findIndex(src => src.name === source);
 +
                    if (idx !== -1) { group.push(sourcesCopy.splice(idx, 1)[0]); }
 +
                }
 +
                if (group.length > 0) { groupedSources.push({ title: layoutGroup.title, sources: group }); }
 +
            }
 +
            groupedSources.push({ title: 'More platforms', sources: sourcesCopy });
 +
 
 +
            let dataSourceFilterHtml = '';
 +
            groupedSources.forEach(group => {
 +
                dataSourceFilterHtml += '<div class="filter-group-header">' + group.title + '</div>';
 +
                dataSourceFilterHtml += group.sources.reduce((acc, curr, idx) => {
 +
                    const identifier = escapeAttr(curr.name);
 +
                    return acc +
 +
                        '<div ' + (idx === 0 ? ' class="filter-group-start">' : '>') +
 +
                        '<input type="checkbox" id="filter-' + identifier + '" value="' + curr.name + '">' +
 +
                        '<label for="filter-' + identifier + '"><img src="' + curr.image + '"> ' + curr.name + '</label></div>'
 +
                }, '');
 +
            });
 +
            document.getElementById('data-source-filter').innerHTML = dataSourceFilterHtml;
 +
 
 +
            // TODO: Fetch from server?
 +
            const FREE_KEY = 'Free', FREE_PLAN_KEY = 'Free & Paid';
 +
            const pricing = [FREE_KEY, FREE_PLAN_KEY, 'Paid'];
 +
            let pricingFilterHtml = pricing.reduce((acc, curr) => {
 +
                const identifier = escapeAttr(curr);
 +
                return acc
 +
                    + '<div><input type="checkbox" id="bm-filter-' + identifier
 +
                    + '" value="' + curr + '">'
 +
                    + '<label for="bm-filter-' + identifier + '">' + curr
 +
                    + '</label></div>'
 +
            }, '');
 +
            document.getElementById('business-model-filter').innerHTML = pricingFilterHtml;
 +
 
 +
            // Set up table.
 +
            const tabulator = new Tabulator("#dct-tabulator", {
 +
                layout: 'fitColumns',
 +
                responsiveLayout: 'collapse',
 +
                columns: [
 +
                    {
 +
                        title: 'Name',
 +
                        field: 'name',
 +
                        minWidth: 300, // required for responsiveness when using fitColumns
 +
                        widthGrow: 2,
 +
                        formatter: function (cell) {
 +
                            /** @type {DCT} */
 +
                            const dct = cell.getData();
 +
                            let out = '<a href="' + dct.url + '" translate="no">' + dct.name + '</a><br>';
 +
                            if (dct.archived.toLowerCase() === 'yes') {
 +
                                out += '<small><span class="badge lcc-badge-grey">Archived</span></small> ';
 +
                            }
 +
                            if (dct.businessModel.includes(FREE_KEY)) {
 +
                                out += '<small><span class="badge lcc-badge-green">' + FREE_KEY + '</span></small> ';
 +
                            }
 +
                            if (dct.businessModel.includes(FREE_PLAN_KEY)) {
 +
                                out += '<small><span class="badge lcc-badge-green">' + FREE_PLAN_KEY + '</span></small> ';
 +
                            }
 +
                            if (dct.usedByDmo.toLowerCase() === 'yes') {
 +
                                out += '<small><span class="badge lcc-badge-red">Used by practitioners</span></small> ';
 +
                            }
 +
                            if (dct.hasUC.toLowerCase() === 'yes') {
 +
                                out += '<small><span class="badge lcc-badge-purple">Use case available</span></small> ';
 +
                            }
 +
 
 +
                            return out;
 +
                        }
 +
                    },
 +
                    {
 +
                        title: 'Functions',
 +
                        field: 'functions',
 +
                        minWidth: 200, // required for responsiveness when using fitColumns
 +
                        cssClass: 'functions-cell',
 +
                        formatter: function (cell) {
 +
                            return Array.from(cell.getValue().keys())
 +
                                .map(fn => `<img class="func-img"
 +
                                    src="${fnImages[fn]}"
 +
                                    data-value="${fn}"
 +
                                    alt="${fn}"
 +
                                    title="${fn}\n\n${functionsData.get(fn)[DESC_KEY]}">`
 +
                                )
 +
                                .join('');
 +
                        }
 +
                    },
 +
                    {
 +
                        title: 'Supported Platforms',
 +
                        field: 'dataSources',
 +
                        minWidth: 300, // required for responsiveness when using fitColumns
 +
                        cssClass: 'data-sources-cell',
 +
                        formatter: function (cell) {
 +
                            const val = cell.getValue();
 +
                            let out = '<div>';
 +
 
 +
                            groupedSources.forEach((group, gIndex) => {
 +
                                // if (gIndex === groupedSources.length - 1) { out += '<div class="sources-collapse">'; }
 +
                                out += group.sources.reduce((prev, curr) => {
 +
                                    const idx = val.findIndex(src => src === curr.name);
 +
                                    if (idx === -1) {
 +
                                        return prev;
 +
                                    } else {
 +
                                        return curr.image
 +
                                            ? prev + '<img class="data-source-img" data-value="' + curr.name
 +
                                            + '" src="' + curr.image
 +
                                            + '" alt="' + curr.name
 +
                                            + '" title="' + curr.name + '">'
 +
                                            : prev + ' ' + curr.name;
 +
                                    }
 +
                                }, '');
 +
                                if (gIndex === groupedSources.length - 1) {
 +
                                    // out += '<span class="sources-collapse-toggle"></span>';
 +
                                    // out += '</div>';
 +
                                }
 +
                            });
 +
                            return out + '</div>';
 +
                        }
 +
                    }
 +
                ]
 +
            });
 +
 
 +
            tabulator.on('tableBuilt', () => {
 +
                tabulator.setData(dcts);
 +
                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 => {
 +
                                const subfunEl = document.getElementById('subfunc-filter-' + escapeAttr(subfun));
 +
                                subfunEl.checked = !!functions[subfun];
 +
                                subfunEl.dispatchEvent(new Event('change', { bubbles: true }));
 +
                            });
 +
 
 +
                            document.getElementById('functions-filter').closest('.filter-wrapper').classList.toggle('open');
 +
                        }
 +
 
 +
                        // Further filters
 +
                        // ...
 +
 
 +
                        applyFilters();
 +
                        toggleFilter();
 +
                    }
 +
 
 +
                    // Further actions (e.g. open filter panel, etc.)
 +
                    // ...
 +
                }
 +
 
 +
                applyFilters();
 +
            });
 +
 
 +
            tabulator.on('dataFiltered', (filters, rows) => {
 +
                const summary = document.getElementById('filter-summary');
 +
                const filter = filters[0];
 +
 
 +
                // Set result counter
 +
                document.getElementById('result-count').textContent = rows.length;
 +
 
 +
                // Exit if filter object/type doesn't exist (happens after Tabulator's own filter reset).
 +
                if (!(filter && filter.type)) { summary.textContent = 'No filter. Showing all results.'; return; }
 +
 
 +
                // Update filter text.
 +
                if (
 +
                    !filter.type.functions &&
 +
                    !filter.type.dataSources &&
 +
                    !filter.type.businessModel &&
 +
                    !filter.type.usedByDmo &&
 +
                    !filter.type.hasUC
 +
                ) { summary.textContent = 'No filter. Showing all results.'; }
 +
                else {
 +
                    let summaryHtml = '<table>';
 +
                    if (filter.type.functions) {
 +
                        summaryHtml += '<tr><td><strong>Functions</strong></td><td>';
 +
                        if (filter.type.functions.size === 0) {
 +
                            summaryHtml += 'none';
 +
                        } else {
 +
                            for (const [cat, subs] of filter.type.functions) {
 +
                                summaryHtml += cat;
 +
                                summaryHtml += subs.length > 0 ? ' <small>(' + subs.join(', ') + ')</small>' : '';
 +
                                summaryHtml += ', ';
 +
                            }
 +
                            summaryHtml = summaryHtml.substring(0, summaryHtml.length - 2);
 +
                        }
 +
                        summaryHtml += '</td></tr>';
 +
                    }
 +
                    if (filter.type.dataSources) {
 +
                        summaryHtml += '<tr><td><strong>Platforms</strong></td><td>'
 +
                            + (filter.type.dataSources.length > 0 ? filter.type.dataSources.join(', ') : 'none')
 +
                            + '</td></tr>';
 +
                    }
 +
                    if (filter.type.businessModel) {
 +
                        summaryHtml += '<tr><td><strong>Pricing</strong></td><td>'
 +
                            + (filter.type.businessModel.length > 0 ? filter.type.businessModel.join(', ') : 'none')
 +
                            + '</td></tr>';
 +
                    }
 +
                    if (filter.type.usedByDmo) {
 +
                        summaryHtml += '<tr><td><strong>Used by practitioners</strong></td><td>Yes</td></tr>';
 +
                    }
 +
                    if (filter.type.hasUC) {
 +
                        summaryHtml += '<tr><td><strong>Use case available</strong></td><td>Yes</td></tr>';
 +
                    }
 +
                    summaryHtml += '</table>';
 +
                    summary.innerHTML = summaryHtml;
 +
                }
 +
 
 +
                const markImages = () => {
 +
                    const selectedSources = filter.type.dataSources;
 +
                    const selectedFunctions = filter.type.functions ? Array.from(filter.type.functions.keys()) : undefined;
 +
 
 +
                    // Mark data source images
 +
                    document.querySelectorAll('.data-sources-cell .data-source-img, .tabulator-responsive-collapse .data-source-img')
 +
                        .forEach(img => {
 +
                            if (!selectedSources || selectedSources.includes(img.dataset.value)) { img.classList.remove('unselected'); }
 +
                            else { img.classList.add('unselected'); }
 +
                        });
 +
 
 +
                    // Mark functions images
 +
                    document.querySelectorAll('.functions-cell .func-img').forEach(img => {
 +
                        if (!selectedFunctions || selectedFunctions.includes(img.dataset.value)) { img.classList.remove('unselected'); }
 +
                        else { img.classList.add('unselected'); }
 +
                    });
 +
 
 +
                    tabulator.off('renderComplete', markImages);
 +
                }
 +
                tabulator.on('renderComplete', markImages); // TODO: Prevent this from running if corresponding filters are not active.
 +
            });
 +
 
 +
            // Listen for changes in filter checkbox state.
 +
            document.getElementById('functions-filter').addEventListener('change', event => {
 +
                const filterBlock = event.target.closest('.func-filter-block');
 +
                const category = filterBlock.querySelector('input.func-cat');
 +
                const subfunctions = filterBlock.querySelectorAll('.subfunc-filter-block input[type="checkbox"]');
 +
 
 +
                if (event.target === category) {
 +
                    // Selecting/deselecting the category checks/unchecks all subfunctions.
 +
                    subfunctions.forEach(checkbox => checkbox.checked = category.checked);
 +
                } else {
 +
                    // If no subfunctions are selected, deactivate the category. Activate otherwise.
 +
                    const checkedSubs = Array.from(subfunctions).filter(sub => sub.checked).length;
 +
                    category.checked = checkedSubs > 0;
 +
                }
 +
 
 +
                applyFilters();
 +
            }, { passive: true });
 +
            document.getElementById('data-source-filter').addEventListener('change', event => {
 +
                applyFilters();
 +
            }, { passive: true });
 +
            document.getElementById('business-model-filter').addEventListener('change', event => {
 +
                applyFilters();
 +
            }, { passive: true });
 +
            document.getElementById('bool-filters').addEventListener('change', event => {
 +
                applyFilters();
 +
            }, { passive: true });
 +
 
 +
            // Listen for clicks on filter toggles
 +
            document.querySelectorAll('.filter-wrapper .filter-toggle').forEach(el => {
 +
                const wrapper = el.closest('.filter-wrapper');
 +
                el.addEventListener('click', event => void wrapper.classList.toggle('open'));
 +
            });
 +
 
 +
            // Fix bug where the table is truncated to zero height despite having visible rows.
 +
            tabulator.on('renderComplete', function () {
 +
                // TODO: Check the bugfix for a possible infinite event loop.
 +
                // This will help detect it, in case it happens.
 +
                // console.log('Table height bugfix: render complete.');
 +
 
 +
                try {
 +
                    const holderHeight = tabulator.rowManager.element.offsetHeight;
 +
                    const tableHeight = tabulator.rowManager.tableElement.offsetHeight;
 +
                    if (
 +
                        holderHeight < tableHeight ||                          // table is truncated vertically (including zero-height)
 +
                        holderHeight - tableHeight > window.screen.availHeight  // table is more than a screen longer than content
 +
                    ) {
 +
                        tabulator.redraw();
 +
                    }
 +
                } catch (ignore) { }
 +
            });
 +
            // End bugfix
 +
 
 +
        });
 +
 
 +
        function selectAll(context) {
 +
            document.querySelectorAll(context + ' input[type="checkbox"]').forEach(checkbox => checkbox.checked = true);
 +
            applyFilters();
 +
        }
 +
 
 +
        function deselectAll(context) {
 +
            document.querySelectorAll(context + ' input[type="checkbox"]').forEach(checkbox => checkbox.checked = false);
 +
            applyFilters();
 +
        }
 +
 
 +
        function clearFilters() {
 +
            document.querySelectorAll('#dct-filters input[type="checkbox').forEach(checkbox => checkbox.checked = checkbox.defaultChecked);
 +
            applyFilters(true);
 
         }
 
         }
    </script>
 
  
    <div id="hp-wrapper">
+
         function toggleFilter() {
         <div id="hp-heading">
+
             document.getElementById('dct-filters').classList.toggle('open');
            <h1>
+
         }
                <span>LINKS</span>
 
                <span>Community</span>
 
                <span>Center</span>
 
            </h1>
 
             <p class="hp-lead">Strengthening links between technologies and&nbsp;society for&nbsp;European disaster resilience.</p>
 
            <div class="hp-button-wrapper">
 
                <a class="hp-large-button" href="https://links.communitycenter.eu/index.php/Getting_started">Get Started</a>
 
            </div>
 
         </div>
 
  
         <div id="hp-main">
+
         // Close filter pane when clicked outside of it.
             <form class="hp-search" onsubmit="search(event)">
+
        document.body.addEventListener('click', event => {
                 <input id="hp-search-input" class="form-control form-control-lg" type="text" placeholder="Search" aria-label="Search">
+
             const filterPane = document.getElementById('dct-filters');
             </form>
+
            if (
 +
                filterPane.classList.contains('open') &&
 +
                !filterPane.contains(event.target) &&
 +
                 event.target !== document.querySelector('#filter-bar .large-button.open-filters')
 +
             ) { filterPane.classList.remove('open'); }
 +
        }, { passive: true });
 +
    </script>
  
            <div class="hp-areas">
+
    <!-- Icon definitons -->
                <h2>
+
    <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" overflow="hidden" style="display:none;">
                    Social Media and Crowdsourcing Libraries
+
        <defs>
                </h2>
+
            <symbol id="chevron-down" viewBox="0 0 96 96">
                <a class="hp-area blue" href="https://links.communitycenter.eu/index.php/List_of_Disaster_Community_Technologies">
+
                <clipPath id="chev">
                    <div class="hp-area-icon">
+
                    <path d="M592 312h96v96h-96z" />
                        <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" overflow="hidden" viewBox="0 0 96 96"><defs><clipPath id="a"><path d="M65 334h96v96H65z"/></clipPath></defs><g clip-path="url(#a)" transform="translate(-65 -334)"><path d="m142 395.981.004-35.993H84.001v36.01Zm-55.999-33.993h54.003L140 393.981l-53.999.017Z"/><path d="M81.001 358.987a2.002 2.002 0 0 1 2-2h60.003a2.002 2.002 0 0 1 2 2V400h2v-41.013a4.003 4.003 0 0 0-4-4H83.001a4.003 4.003 0 0 0-4 4V400h2ZM118.003 402.981v2h-10.001v-2H67v1.999a5.006 5.006 0 0 0 5 5.001h82.004a5.006 5.006 0 0 0 5.001-5.001v-1.999Zm36.001 5H72a3.004 3.004 0 0 1-3-3h37.002a1.934 1.934 0 0 0 2 2h10.001a1.934 1.934 0 0 0 2-2h37.002a3.005 3.005 0 0 1-3.001 3Z"/><path d="M113 365c-7.18 0-13 5.82-13 13s5.82 13 13 13 13-5.82 13-13c-.008-7.176-5.824-12.992-13-13Zm10.949 12h-3.518a14.167 14.167 0 0 0-4.176-9.508 11.023 11.023 0 0 1 7.694 9.508ZM112 368.226V377h-4.426c.254-3.771 1.929-7.06 4.426-8.774ZM112 379v8.775c-2.494-1.717-4.17-5.017-4.425-8.775Zm2 8.774V379h4.425c-.255 3.754-1.932 7.056-4.425 8.774ZM114 377v-8.773c2.492 1.718 4.17 5.019 4.425 8.773Zm-4.273-9.502a14.124 14.124 0 0 0-4.158 9.502h-3.518a11.02 11.02 0 0 1 7.676-9.502ZM102.051 379h3.518a14.157 14.157 0 0 0 4.173 9.507 11.022 11.022 0 0 1-7.691-9.507Zm14.205 9.508a14.168 14.168 0 0 0 4.175-9.508h3.518a11.023 11.023 0 0 1-7.693 9.508Z"/></g></svg>
+
                </clipPath>
                    </div>
+
                <g clip-path="url(#chev)" transform="translate(-592 -312)">
                    <div class="hp-area-text">
+
                    <path
                        <h3>Technologies</h3>
+
                        d="m640 370.586-25.293-25.293-1.414 1.414L640 373.414l26.707-26.707-1.414-1.414L640 370.586Z" />
                        <p>
+
                </g>
                            Software for&nbsp;interaction with, within or&nbsp;among communities in&nbsp;case of a&nbsp;disaster and for&nbsp;analysis of&nbsp;these interactions.​
+
            </symbol>
                        </p>
+
        </defs>
                    </div>
+
    </svg>
                    <div class="hp-area-arrow">&rarr;</div>
 
                </a>
 
  
                <a class="hp-area orange" href="https://links.communitycenter.eu/index.php/List_of_Guidelines">
+
    <div id="dct-list-wrapper">
                    <div class="hp-area-icon">
+
        <h1>
                        <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" overflow="hidden" viewBox="0 0 96 96"><defs><clipPath id="b"><path d="M65 455h96v96H65z"/></clipPath></defs><g clip-path="url(#b)" transform="translate(-65 -455)"><path d="M138 463H84v79.961h54a5.014 5.014 0 0 0 5.019-5V468a5.014 5.014 0 0 0-5.019-5Zm-52 2h6.261v75.961H86Zm55.019 72.963a3.012 3.012 0 0 1-3.019 3H94.261V465H138a3.013 3.013 0 0 1 3.019 3Z"/><path d="M104 489h28v2h-28ZM110 500h16v2h-16Z"/></g></svg>
+
            <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" overflow="hidden" viewBox="0 0 96 96">
                    </div>
+
                <defs>
                    <div class="hp-area-text">
+
                    <clipPath id="a">
                        <h3>Guidelines</h3>
+
                        <path d="M65 334h96v96H65z" />
                        <p>
+
                    </clipPath>
                            Expert guidelines for&nbsp;usage of&nbsp;social media and&nbsp;crowdsourcing in&nbsp;disasters.​
+
                </defs>
                        </p>
+
                <g clip-path="url(#a)" transform="translate(-65 -334)">
                    </div>
+
                    <path d="m142 395.981.004-35.993H84.001v36.01Zm-55.999-33.993h54.003L140 393.981l-53.999.017Z" />
                    <div class="hp-area-arrow">&rarr;</div>
+
                    <path
                </a>
+
                        d="M81.001 358.987a2.002 2.002 0 0 1 2-2h60.003a2.002 2.002 0 0 1 2 2V400h2v-41.013a4.003 4.003 0 0 0-4-4H83.001a4.003 4.003 0 0 0-4 4V400h2ZM118.003 402.981v2h-10.001v-2H67v1.999a5.006 5.006 0 0 0 5 5.001h82.004a5.006 5.006 0 0 0 5.001-5.001v-1.999Zm36.001 5H72a3.004 3.004 0 0 1-3-3h37.002a1.934 1.934 0 0 0 2 2h10.001a1.934 1.934 0 0 0 2-2h37.002a3.005 3.005 0 0 1-3.001 3Z" />
 +
                    <path
 +
                        d="M113 365c-7.18 0-13 5.82-13 13s5.82 13 13 13 13-5.82 13-13c-.008-7.176-5.824-12.992-13-13Zm10.949 12h-3.518a14.167 14.167 0 0 0-4.176-9.508 11.023 11.023 0 0 1 7.694 9.508ZM112 368.226V377h-4.426c.254-3.771 1.929-7.06 4.426-8.774ZM112 379v8.775c-2.494-1.717-4.17-5.017-4.425-8.775Zm2 8.774V379h4.425c-.255 3.754-1.932 7.056-4.425 8.774ZM114 377v-8.773c2.492 1.718 4.17 5.019 4.425 8.773Zm-4.273-9.502a14.124 14.124 0 0 0-4.158 9.502h-3.518a11.02 11.02 0 0 1 7.676-9.502ZM102.051 379h3.518a14.157 14.157 0 0 0 4.173 9.507 11.022 11.022 0 0 1-7.691-9.507Zm14.205 9.508a14.168 14.168 0 0 0 4.175-9.508h3.518a11.023 11.023 0 0 1-7.693 9.508Z" />
 +
                </g>
 +
            </svg>
 +
            <div>
 +
                <div>Technologies</div>
 +
                <div style="font-size:small; letter-spacing:.03em; margin-left: .6em;">Social Media and Crowdsourcing
 +
                    Library</div>
 
             </div>
 
             </div>
 +
        </h1>
 +
        <div id="dct-intro">
 +
            <p>The overall goal of the Social Media and Crowdsourcing (SMCS) Technologies Library is to face the growing
 +
                heterogeneous use of technologies in disasters and the overwhelming number of technologies on the
 +
                market. It
 +
                gathers and structures information about existing technologies to provide an up-to-date overview and
 +
                thus
 +
                support the selection of suitable technologies.
 +
            </p>
 +
            <p>
 +
                You can use the filters to identify relevant technologies according to your needs and then click on the
 +
                name of
 +
                the technology to get further information.
 +
            </p>
 
         </div>
 
         </div>
  
         <div id="hp-collections" class="container-fluid">
+
         <div id="filter-bar">
             <div class="row">
+
             <div style="display: flex; justify-content: space-between;">
                 <div id="hp-resources" class="col-12 col-lg-6">
+
                 <div style="flex: 1 1;">
                     <a class="hp-area grey" href="https://links.communitycenter.eu/index.php/Helpful_resources">
+
                     <h2 style="margin-bottom: 1rem;">Selected Filters</h2>
                        <div class="hp-area-icon">
+
                    <div id="filter-summary">No filter. Showing all results.</div>
                            <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" overflow="hidden" viewBox="0 0 96 96"><defs><clipPath id="res"><path d="M592 312h96v96h-96z"/></clipPath></defs><g clip-path="url(#res)" transform="translate(-592 -312)"><path d="m675 366-10-10h-24v-35a1 1 0 0 0-2 0v11h-24l-10 10 10 10h24v48h2v-24h24Zm-59.172-16-8-8 8-8H639v16ZM641 374v-16h23.172l8 8-8 8Z"/></g></svg>
 
                        </div>
 
                        <div class="hp-area-text">
 
                            <h3>Collection of Helpful Resources</h3>
 
                            <p>
 
                                Browse some interesting or&nbsp;relevant websites and&nbsp;apps.
 
                            </p>
 
                        </div>
 
                    </a>
 
 
                 </div>
 
                 </div>
                 <div id="hp-networks" class="col-12 col-lg-6">
+
                 <div>
                     <a class="hp-area grey" href="https://links.communitycenter.eu/index.php/Overview_of_Networks">
+
                     <button class="large-button open-filters" type="button" onclick="toggleFilter()">Open
                        <div class="hp-area-icon">
+
                         Filters</button>
                            <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" overflow="hidden" viewBox="0 0 96 96"><defs><clipPath id="net"><path d="M244 176h96v96h-96z"/></clipPath></defs><g clip-path="url(#net)" transform="translate(-244 -176)"><path d="M326.8 215c-.8 0-1.5.1-2.3.3l-2.2-6.7c6.1-3.2 8.5-10.7 5.3-16.8-3.2-6.1-10.7-8.5-16.8-5.3-3.3 1.7-5.7 4.9-6.5 8.5l-8.8-.8c-.1-4.6-3.8-8.2-8.4-8.1-4.6.1-8.2 3.8-8.1 8.4 0 1.7.6 3.3 1.5 4.7l-11 10.9c-5.2-4.5-13.1-4-17.6 1.2-4.5 5.2-4.1 13.1 1.1 17.6 2.3 2 5.2 3.1 8.2 3.1h.9l2.7 14.4c-4.4 1.3-6.8 5.9-5.5 10.3 1.3 4.4 5.9 6.8 10.3 5.5 4.4-1.3 6.8-5.9 5.5-10.3l-.6-1.5 8.9-4.5c4.9 6.7 14.3 8.1 20.9 3.2 5.1-3.8 7.3-10.3 5.5-16.4l9.7-5.3c2.3 3.9 7.3 5.3 11.3 3 3.9-2.3 5.3-7.3 3-11.3-1.4-2.5-4.1-4.1-7-4.1Zm-16.4-8.9c.3-3.3 3.3-5.8 6.6-5.5 2.9.3 5.2 2.6 5.5 5.5-3.6 2.5-8.4 2.5-12.1 0Zm3.3-10.3c0-1.5 1.2-2.8 2.8-2.8 1.6 0 2.8 1.2 2.8 2.8 0 1.5-1.2 2.8-2.8 2.8-1.5 0-2.8-1.3-2.8-2.8Zm2.8-8.8c5.8 0 10.5 4.7 10.5 10.5 0 2.6-1 5.1-2.7 7.1-.6-2.3-2.3-4.3-4.5-5.3 1.9-1.8 2-4.8.2-6.8-1.8-1.9-4.8-2-6.8-.2s-2 4.8-.2 6.8l.2.2c-2.2 1-3.9 2.9-4.5 5.3-3.9-4.3-3.6-10.9.7-14.8 2-1.8 4.5-2.8 7.1-2.8Zm-6.7 21.1-8.1 15.3c-7.1-3.3-15.4-.6-19.2 6.2l-9.7-5.3c1.8-4.3 1-9.2-1.9-12.8l11-11c3.4 3 8.6 2.6 11.6-.9.9-1 1.5-2.2 1.8-3.5l8.8.8v.6c-.1 4.3 2.1 8.3 5.7 10.6Zm-23.9-14.9c0-.8.6-1.4 1.4-1.4.8 0 1.4.6 1.4 1.4 0 .8-.6 1.4-1.4 1.4-.8-.1-1.4-.7-1.4-1.4Zm1.4 3.3c1.7 0 3.1 1.2 3.4 2.9-2.1 1.4-4.7 1.4-6.8 0 .2-1.6 1.6-2.8 3.4-2.9Zm0-8.5c3.4 0 6.2 2.8 6.3 6.2 0 1.3-.4 2.6-1.2 3.7-.5-1.1-1.3-2.1-2.4-2.7.5-.6.7-1.3.7-2.1 0-1.9-1.5-3.4-3.4-3.4s-3.4 1.5-3.4 3.4c0 .8.3 1.5.7 2.1-1.1.6-1.9 1.5-2.4 2.7-2-2.8-1.4-6.7 1.3-8.7 1.1-.8 2.4-1.2 3.8-1.2Zm-36.5 31.5c0-5.8 4.7-10.5 10.5-10.5s10.5 4.7 10.5 10.5c0 2.6-1 5.1-2.7 7.1-.6-2.3-2.3-4.3-4.5-5.3 1.9-1.8 2-4.8.2-6.8s-4.8-2-6.8-.2c-1.9 1.8-2 4.8-.2 6.8l.2.2c-2.2 1-3.9 2.9-4.5 5.3-1.8-2-2.7-4.5-2.7-7.1Zm7.7-1.7c0-1.5 1.2-2.8 2.8-2.8 1.6 0 2.8 1.2 2.8 2.8 0 1.5-1.2 2.8-2.8 2.8-1.6 0-2.8-1.3-2.8-2.8Zm-3.3 10.3c.3-3.3 3.3-5.8 6.6-5.5 2.9.3 5.2 2.6 5.5 5.5-3.6 2.5-8.5 2.5-12.1 0Zm8.6 31.4c.3-1.9 2-3.2 3.9-2.9 1.5.2 2.7 1.4 2.9 2.9-2 1.3-4.7 1.3-6.8 0Zm2.1-6.3c0-.8.6-1.4 1.4-1.4.8 0 1.4.6 1.4 1.4 0 .8-.6 1.4-1.4 1.4-.8-.1-1.4-.7-1.4-1.4Zm6.4 4.7c-.5-1.1-1.3-2.1-2.4-2.7.5-.6.7-1.3.7-2.1 0-1.9-1.5-3.4-3.4-3.4s-3.4 1.5-3.4 3.4c0 .8.3 1.5.7 2.1-1.1.6-1.9 1.5-2.4 2.7-2-2.8-1.4-6.7 1.4-8.7 2.8-2 6.7-1.4 8.7 1.4 1.7 2.1 1.7 5.1.1 7.3Zm1-9.2c-1.5-1.7-3.7-2.7-6-2.7h-.4l-2.7-14.4c3.2-.8 6-2.8 7.7-5.6l9.7 5.3c-1.7 4.2-1.4 8.9.7 12.8l-9 4.6Zm14.6-1.2c.3-4.2 4-7.3 8.2-7 3.7.3 6.7 3.3 7 7-4.5 3.3-10.7 3.3-15.2 0Zm4-12.6c0-2 1.6-3.6 3.6-3.6s3.6 1.6 3.6 3.6-1.6 3.6-3.6 3.6-3.6-1.6-3.6-3.6Zm13 11.1c-.7-3.1-2.9-5.6-5.8-6.8 2.4-2 2.7-5.5.7-7.9-2-2.4-5.5-2.7-7.9-.7-2.4 2-2.7 5.5-.7 7.9.2.3.5.5.7.7-2.9 1.2-5.1 3.7-5.8 6.8-5-5.2-4.8-13.4.4-18.4 5.2-5 13.4-4.8 18.4.4 4.8 5 4.8 13 0 18Zm4.2-15.2c-1.2-2.7-3.2-4.9-5.6-6.5l8.1-15.3c2.8 1.2 5.9 1.3 8.8.4l2.2 6.7c-3.3 1.9-4.9 5.8-3.8 9.4l-9.7 5.3Zm14.2-2.3c.3-1.9 2-3.2 3.9-2.9 1.5.2 2.7 1.4 2.9 2.9-2 1.3-4.7 1.3-6.8 0Zm2.1-6.3c0-.8.6-1.4 1.4-1.4.8 0 1.4.6 1.4 1.4 0 .8-.6 1.4-1.4 1.4-.8-.1-1.4-.7-1.4-1.4Zm6.4 4.7c-.5-1.1-1.3-2.1-2.4-2.7.5-.6.7-1.3.7-2.1 0-1.9-1.5-3.4-3.4-3.4s-3.4 1.5-3.4 3.4c0 .8.3 1.5.7 2.1-1.1.6-1.9 1.5-2.4 2.7-2-2.8-1.4-6.7 1.4-8.7 2.8-2 6.7-1.4 8.7 1.4 1.7 2.1 1.7 5.1.1 7.3Z"/></g></svg>
 
                         </div>
 
                        <div class="hp-area-text">
 
                            <h3>Collection of Networks</h3>
 
                            <p>
 
                                Communities and&nbsp;interest groups relevant for&nbsp;the context of&nbsp;social media in&nbsp;disaster management.​
 
                            </p>
 
                        </div>
 
                    </a>
 
 
                 </div>
 
                 </div>
 
             </div>
 
             </div>
        </div>
 
  
 +
            <div style="display: flex; justify-content: space-between; align-items: center; margin-top: 2.5rem;">
 +
                <h2 style="margin-bottom: 0;">Results: <span id="result-count"></span></h2>
 +
                <div><a href="/index.php/Form:Disaster_Community_Technology" style="color: var(--links-blue); font-size: 1.5em; font-variant:small-caps">Add new technology</a></div>
 +
            </div>
  
        <!--kie: comment out until it is available.-->
+
            <div id="dct-filters">
        <!-- <div class="hp-compass cyan">
+
                <h2 style="display: flex; justify-content: space-between;">
            <div class="d-flex align-items-center">
+
                    <div>
                <div class="hp-area-icon">
+
                        <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" overflow="hidden"
                    <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" overflow="hidden" viewBox="0 0 96 96"><defs><clipPath id="c"><path d="M199 603h96v96h-96z"/></clipPath></defs><g clip-path="url(#c)" transform="translate(-199 -603)"><path d="m277.516 645.583 2.136.654c-2.126-14.416-13.438-25.741-27.852-27.884l.691 2.143a31.072 31.072 0 0 1 25.025 25.087ZM214.36 646.146l2.14-.646a31.07 31.07 0 0 1 25.02-25l.655-2.139c-14.368 2.147-25.652 13.42-27.815 27.785ZM241.386 681.481a31.073 31.073 0 0 1-24.87-24.881l-2.151-.7a33.075 33.075 0 0 0 27.679 27.727ZM279.654 655.746l-2.141.691a31.072 31.072 0 0 1-25.032 25.068l-.691 2.143c14.424-2.14 25.744-13.475 27.864-27.902Z"/><path d="m274.8 647.888-15.134-4.924 4.837-9.38-9.431 4.806-4.872-15.208-2-6.2-1.2-3.9-1.3 4-1.9 6.2-4.784 15.134-9.416-4.832 4.82 9.429-15.12 4.776-6.3 1.9-4 1.3 4 1.3 6.1 2 15.248 4.8-4.848 9.405 9.386-4.947L243.7 678.8l1.9 6.2 1.3 4 1.3-4 2-6.2 4.9-15.3 9.4 4.9-4.828-9.351 15.028-4.859 6.2-2 4-1.3-3.9-1.1Zm-.714 4.4-15.341 4.954-2.01-3.893a9.925 9.925 0 0 1-.951 2.519l4.045 7.832-7.723-4.027a9.93 9.93 0 0 1-2.361 1.027l3.555 1.854-5 15.629-1.382 4.283-1.308-4.271-4.925-15.595 3.594-1.894a9.95 9.95 0 0 1-2.36-1.017l-7.73 4.074 4.051-7.863a9.91 9.91 0 0 1-.959-2.505l-2 3.885-15.557-4.89-4.194-1.375 4.37-1.315 15.441-4.877 1.967 3.847a9.938 9.938 0 0 1 .981-2.475l-4.088-8 8.016 4.113a9.958 9.958 0 0 1 2.523-.953l-3.92-2.013 4.894-15.474 1.27-4.148 1.316 4.072 4.966 15.518-4.011 2.044a9.922 9.922 0 0 1 2.53.955l8.1-4.125-4.147 8.043c.433.78.76 1.614.971 2.481l2.033-3.943 15.475 5.035 3.883 1.192Z"/><path d="M247 644.088a7 7 0 1 0 7 7 7.009 7.009 0 0 0-7-7Zm0 12a5 5 0 1 1 5-5 5.007 5.007 0 0 1-5 5.003Z"/></g></svg>
+
                            viewBox="0 0 96 96">
 +
                            <defs>
 +
                                <clipPath id="b">
 +
                                    <path d="M592 312h96v96h-96z" />
 +
                                </clipPath>
 +
                            </defs>
 +
                            <g clip-path="url(#b)" transform="translate(-592 -312)">
 +
                                <path
 +
                                    d="M636 356.012v38.011l8-8v-30.011L674 326h-68Zm6.588-1.412-.588.584v30.008l-4 4v-34.008l-.585-.586L610.828 328h58.348Z" />
 +
                            </g>
 +
                        </svg>
 +
                        <span>Filters</span>
 +
                    </div>
 +
                    <a onclick="toggleFilter()" id="close-filter-button">&times;</a>
 +
                </h2>
 +
                <div style="text-align: center;">
 +
                    <button class="large-button" type="button" onclick="clearFilters()">Clear Filters</button>
 
                 </div>
 
                 </div>
                 <div class="hp-area-text">
+
                 <div class="filter-wrapper">
                     <h2>Want to be guided?</h2>
+
                    <h4 class="filter-toggle">Functions <div class="plus icon"></div>
                    <p>
+
                     </h4>
                         Try the compass!
+
                    <div class="filter-container">
                     </p>
+
                        <div class="filter-button-wrapper">
 +
                            <button type="button" onclick="selectAll('#functions-filter')">Select all</button> |
 +
                            <button type="button" onclick="deselectAll('#functions-filter')">Clear all</button>
 +
                        </div>
 +
                         <div class="filter-content loose" id="functions-filter"></div>
 +
                     </div>
 
                 </div>
 
                 </div>
            </div>
+
                <div class="filter-wrapper">
        </div> -->
+
                    <h4 class="filter-toggle">Supported Platforms <div class="plus icon"></div>
 
+
                    </h4>
        <div id="hp-recent" class="container-fluid">
+
                    <div class="filter-container">
            <div class="row">
+
                        <div class="filter-button-wrapper">
                <div id="forum-topics" class="col-12 col-lg-6">
+
                            <button type="button" onclick="selectAll('#data-source-filter')">Select all</button> |
                     <h3 class="text-center">Latest Discussions</h3>
+
                            <button type="button" onclick="deselectAll('#data-source-filter')">Clear all</button>
                     <script src="https://forum.links.communitycenter.eu/javascripts/embed-topics.js"></script>
+
                        </div>
                     <d-topics-list discourse-url="https://forum.links.communitycenter.eu" per-page="5" order="latest" sort-ascending="false" template="complete"></d-topics-list>
+
                        <div class="filter-content loose" id="data-source-filter"></div>
 +
                     </div>
 +
                </div>
 +
                <div class="filter-wrapper">
 +
                     <h4 class="filter-toggle">Pricing <div class="plus icon"></div>
 +
                    </h4>
 +
                     <div class="filter-container">
 +
                        <div class="filter-button-wrapper">
 +
                            <button type="button" onclick="selectAll('#business-model-filter')">Select all</button> |
 +
                            <button type="button" onclick="deselectAll('#business-model-filter')">Clear all</button>
 +
                        </div>
 +
                        <div class="filter-content" id="business-model-filter"></div>
 +
                    </div>
 
                 </div>
 
                 </div>
                 <div id="hp-changes" class="col-12 col-lg-6">
+
                 <!-- <div class="filter-wrapper">
                    <h3 class="text-center">News and Activities</h3>
+
                    <h4 class="filter-toggle">Used by Practitioners <div class="plus icon"></div>
                     <div class="h-100">
+
                    </h4>
                         <div id="recent-changes"></div>
+
                    <div class="filter-container">
 +
                        <div class="filter-button-wrapper">
 +
                            <button type="button" onclick="selectAll('#dm-use-filter')">Select all</button> |
 +
                            <button type="button" onclick="deselectAll('#dm-use-filter')">Clear all</button>
 +
                        </div>
 +
                        <div class="filter-content" id="dm-use-filter"></div>
 +
                     </div>
 +
                </div> -->
 +
                <div id="bool-filters"
 +
                    style="border-top: 1px solid var(--links-blue); margin-top: 1em; padding-top: 1em;">
 +
                    <div>
 +
                        <input type="checkbox" id="used-by-practitioners" value="yes">
 +
                         <label for="used-by-practitioners">Used by practitioners</label>
 +
                    </div>
 +
                    <div>
 +
                        <input type="checkbox" id="has-use-case" value="yes">
 +
                        <label for="has-use-case">Use case available</label>
 +
                    </div>
 +
                    <div>
 +
                        <input type="checkbox" id="show-archived" value="yes">
 +
                        <label for="show-archived">Show archived</label>
 
                     </div>
 
                     </div>
 
                 </div>
 
                 </div>
 
             </div>
 
             </div>
         </div></div></includeonly>
+
         </div>
 +
        <div id="dct-tabulator"></div>
 +
    </div>
 +
</includeonly>

Revision as of 15:30, 19 December 2023

DCT list widget.
Currently in use – do not modify!