|
|
(241 intermediate revisions by 3 users not shown) |
Line 1: |
Line 1: |
| <noinclude>Development verstion of the DCT List.<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 – do not modify!</span></noinclude> |
| | |
| <includeonly> | | <includeonly> |
| <link href="/resources/assets/tabulator.min.css" rel="stylesheet"> | | <link href="/resources/assets/tabulator/dist/css/tabulator.min.css" rel="stylesheet"> |
| <script type="text/javascript" src="/resources/assets/tabulator.min.js"></script> | | <script type="text/javascript" src="/resources/assets/tabulator/dist/js/tabulator.min.js"></script> |
| | |
| <style>
| |
| #dct-list-wrapper {
| |
| font-family: 'Open Sans';
| |
| margin-top: 4em;
| |
| }
| |
| | |
| #dct-list-wrapper h1,
| |
| #dct-list-wrapper h2,
| |
| #dct-list-wrapper h3 {
| |
| font-family: 'Raleway';
| |
| font-weight: 300;
| |
| letter-spacing: .06em;
| |
| }
| |
| | |
| #dct-list-wrapper h1,
| |
| #dct-filters h2 {
| |
| display: flex;
| |
| align-items: center;
| |
| }
| |
| | |
| #dct-intro {
| |
| font-size: larger;
| |
| margin-bottom: 4em;
| |
| }
| |
| | |
| #dct-list-wrapper h1 {
| |
| 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;
| |
| cursor: pointer;
| |
| font-size: 2.5em;
| |
| line-height: .7em;
| |
| 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;
| |
| }
| |
| | |
| .large-button {
| |
| border: 1px solid var(--links-blue);
| |
| font-size: 1.5em;
| |
| font-family: 'Open Sans';
| |
| font-weight: 100;
| |
| margin-bottom: 2em;
| |
| padding: 0.3em 0.8em;
| |
| color: var(--links-blue);
| |
| background: transparent;
| |
| font-variant: small-caps;
| |
| display: inline-block;
| |
| transition: all 200ms ease-in-out;
| |
| }
| |
| | |
| .large-button:hover {
| |
| background-color: var(--links-blue);
| |
| color: #fff;
| |
| }
| |
| | |
| #dct-list-wrapper h2 {
| |
| margin-bottom: 1em;
| |
| }
| |
| | |
| .filter-button-wrapper {
| |
| margin: 1.5em 0 1em 0;
| |
| }
| |
| | |
| .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-content {
| |
| font-size: 1.2em;
| |
| margin-bottom: 4em;
| |
| display: grid;
| |
| grid-template-columns: repeat(auto-fit, minmax(14em, 1fr));
| |
| gap: 1em 1em;
| |
| align-items: end;
| |
| }
| |
| | |
| .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;
| |
| }
| |
| | |
| #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;
| |
| }
| |
| | |
| .bm-icon {
| |
| width: 1.5em;
| |
| height: 1.5em;
| |
| vertical-align: top;
| |
| margin-left: .25em;
| |
| fill: #c3192b;
| |
| }
| |
| | |
| .data-source-img,
| |
| .func-img {
| |
| width: 2em;
| |
| height: 2em;
| |
| margin-right: .4em;
| |
| margin-bottom: .4em;
| |
| }
| |
| | |
| #dct-tabulator img.unselected {
| |
| filter: grayscale(1);
| |
| opacity: .25;
| |
| }
| |
| | |
| .sources-collapse {
| |
| display: inline-block;
| |
| }
| |
| | |
| .sources-collapse-toggle {
| |
| display: inline-block;
| |
| width: 2em;
| |
| height: 2em;
| |
| }
| |
| | |
| #dct-tabulator .tabulator-row .tabulator-responsive-collapse {
| |
| padding: 0 .5em 2em 0;
| |
| border: 0 none;
| |
| }
| |
| | |
| #filter-summary { margin-right: 1em; }
| |
| | |
| #filter-summary table tr td:first-of-type { padding-right: 10px; vertical-align: top; }
| |
|
| |
| #dct-tabulator .tabulator-row .tabulator-responsive-collapse table {
| |
| font-size: smaller;
| |
| }
| |
| | |
| #filter-summary table tr td strong,
| |
| #dct-tabulator .tabulator-row .tabulator-responsive-collapse table tr td strong {
| |
| font-weight: 300;
| |
| }
| |
| </style>
| |
| | |
| <script>
| |
| 'use strict';
| |
| | |
| /**
| |
| * @typedef {Object} DCT
| |
| * @property {string} name
| |
| * @property {string} url
| |
| * @property {string[]} dataSources
| |
| * @property {string[]} businessModel
| |
| * @property {string[]} functions
| |
| * @property {string} usedByDmo
| |
| * @property {string} logo
| |
| */
| |
| | |
| let table;
| |
| | |
| // 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']
| |
| }
| |
| ];
| |
| | |
| // 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 FUNC_KEY = 'functions';
| |
| const DESC_KEY = 'description';
| |
| | |
| /** @type Map<string, { [DESC_KEY]: string, [FUNC_KEY]: string[] } */
| |
| const functionsData = new Map();
| |
| | |
| const functionsQuery = '[[Category:Function_category]]'
| |
| + '|?-Subproperty_of=' + FUNC_KEY
| |
| + '|?Has_description=' + DESC_KEY;
| |
| const functionsQueryResponse = await fetch(getQueryUrl(functionsQuery)).then(response => response.json());
| |
| | |
| Object.keys(functionsQueryResponse.query.results).forEach(key => {
| |
| const functionCategory = functionsQueryResponse.query.results[key];
| |
| functionsData.set(
| |
| removePrefix(functionCategory.fulltext),
| |
| {
| |
| [DESC_KEY]: functionCategory.printouts[DESC_KEY][0],
| |
| [FUNC_KEY]: functionCategory.printouts[FUNC_KEY].map(func => removePrefix(func.fulltext))
| |
| }
| |
| );
| |
| });
| |
| | |
| // TODO: Remove properties that are not relevant for the filter? (e.g. 'Supported content types')
| |
| const allFunctions = Array.from(functionsData.values(), entry => entry[FUNC_KEY]).flat();
| |
| | |
| const DATASRC_PROP = 'Data Sources';
| |
| const IMG_PROP = 'Image';
| |
| const BUSINESS_PROP = 'Business model';
| |
| const DMO_PROP = 'Used by DMO';
| |
| const dctQuery = '[[Category:Disaster Community Technology]]'
| |
| + '[[Is Archived::No]]'
| |
| + '|limit=500'
| |
| + '|?' + IMG_PROP
| |
| + '|?' + DATASRC_PROP
| |
| + '|?' + BUSINESS_PROP
| |
| + '|?' + DMO_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] ? dctResult.printouts[DMO_PROP][0].fulltext : 'Unknown';
| |
| | |
| dct.functions = [];
| |
| functionsData.forEach((value, key) => {
| |
| if (value[FUNC_KEY].some(
| |
| func => dctResult.printouts[func][0] && dctResult.printouts[func][0].fulltext.toLowerCase() === 'yes'
| |
| )) {
| |
| dct.functions.push(key);
| |
| }
| |
| });
| |
| | |
| return dct;
| |
| });
| |
| | |
| console.log(dctList)
| |
| | |
| return { dcts: dctList, funcData: functionsData };
| |
| }
| |
| | |
| /**
| |
| * @param {DCT} dct
| |
| * @param {Partial<DCT>} filterState
| |
| */
| |
| function dctFilter(dct, filterState) {
| |
| console.log(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.
| |
| const sourcesCheck = filterState.dataSources
| |
| ? dct.dataSources.some(source => filterState.dataSources.includes(source))
| |
| : true;
| |
| const functionsCheck = filterState.functions
| |
| ? dct.functions.some(func => filterState.functions.includes(func))
| |
| : true;
| |
| const businessModelCheck = filterState.businessModel
| |
| ? dct.businessModel.some(bm => filterState.businessModel.includes(bm))
| |
| : true;
| |
| const dmUseCheck = filterState.usedByDmo
| |
| ? filterState.usedByDmo.includes(dct.usedByDmo)
| |
| : true;
| |
| return sourcesCheck && functionsCheck && businessModelCheck && dmUseCheck;
| |
| }
| |
| | |
| function applyFilters(clear) {
| |
| if (!table) return;
| |
| | |
| // If clear=true, pass empty object to the filter to disable it.
| |
| if (clear) {
| |
| table.setFilter(dctFilter, {});
| |
| return;
| |
| }
| |
| | |
| /** @type {Partial<Omit<DCT, 'usedByDmo'> & { usedByDmo: string[]>}} */
| |
| const filterState = {};
| |
| | |
| const functionOptions = Array.from(document.querySelectorAll('#functions-filter input[type="checkbox"]'));
| |
| const selectedFunctions = functionOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value);
| |
| filterState.functions = selectedFunctions.length === functionOptions.length ? undefined : selectedFunctions;
| |
| | |
| const sourceOptions = Array.from(document.querySelectorAll('#data-source-filter input[type="checkbox"]'));
| |
| const selectedSources = sourceOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value);
| |
| filterState.dataSources = selectedSources.length === sourceOptions.length ? undefined : selectedSources;
| |
| | |
| const bmOptions = Array.from(document.querySelectorAll('#business-model-filter input[type="checkbox"]'));
| |
| const selectedBModels = bmOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value);
| |
| filterState.businessModel = selectedBModels.length === bmOptions.length ? undefined : selectedBModels;
| |
| | |
| const dmUseOptions = Array.from(document.querySelectorAll('#dm-use-filter input[type="checkbox"]'));
| |
| const selectedDmUseOptions = dmUseOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value);
| |
| filterState.usedByDmo = selectedDmUseOptions.length === dmUseOptions.length ? undefined : selectedDmUseOptions;
| |
| | |
| table.setFilter(dctFilter, filterState);
| |
| }
| |
|
| |
|
| // Load data and build page.
| | <!-- STYLES BEGIN --> |
| Promise.all([getSources(), getDcts()]).then(data => {
| | <link rel="stylesheet" href="https://assets.links.communitycenter.eu/v2/links/lib?q=dct_list.css"> |
| const dataSources = data[0];
| | <!-- STYLES END --> |
| const { dcts, funcData } = data[1];
| |
|
| |
|
| // The keys of this object must match function category names EXACTLY.
| | <!-- SCRIPT BEGIN --> |
| // This also defines the sort order of function categories.
| | <script type="text/javascript" src="https://assets.links.communitycenter.eu/v2/links/lib?q=dct_list.js"></script> |
| // TODO: Link images to categories directly.
| | <!-- SCRIPT END --> |
| 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',
| |
| };
| |
| | |
| // Set up filters.
| |
| const functionFilterHtml = Object.keys(fnImages).reduce((acc, funcName) => {
| |
| const identifier = escapeAttr(funcName);
| |
| return acc
| |
| + '<div><input type="checkbox" checked id="func-filter-' + identifier
| |
| + '" value="' + funcName + '">'
| |
| + '<label for="func-filter-' + identifier
| |
| + '"><img src="' + fnImages[funcName] + '"> ' + funcName + '</label></div>'
| |
| }, '');
| |
| document.getElementById('functions-filter').innerHTML = functionFilterHtml;
| |
| | |
| 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 + '" checked>' +
| |
| '<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 = 'Freeware', FREE_PLAN_KEY = 'Free plan available';
| |
| const bModels = [FREE_KEY, FREE_PLAN_KEY, 'Subscription', 'Other'];
| |
| let bModelFilterHtml = bModels.reduce((acc, curr) => {
| |
| const identifier = escapeAttr(curr);
| |
| return acc
| |
| + '<div><input type="checkbox" checked id="bm-filter-' + identifier
| |
| + '" value="' + curr + '">'
| |
| + '<label for="bm-filter-' + identifier + '">' + curr
| |
| + (curr === FREE_KEY ? '<svg class="bm-icon"><use href="#freeware-icon"/></svg>' : '')
| |
| + (curr === FREE_PLAN_KEY ? '<svg class="bm-icon"><use href="#free-plan-icon"/></svg>' : '')
| |
| + '</label></div>'
| |
| }, '');
| |
| document.getElementById('business-model-filter').innerHTML = bModelFilterHtml;
| |
| | |
| const dmUse = ['Yes', 'Yes with Use Case', 'Unknown'];
| |
| let dmUseFilterHtml = dmUse.reduce((acc, curr) => {
| |
| const identifier = escapeAttr(curr);
| |
| return acc
| |
| + '<div><input type="checkbox" checked id="dm-use-filter-' + identifier
| |
| + '" value="' + curr + '">'
| |
| + '<label for="dm-use-filter-' + identifier + '">' + curr + '</label></div>'
| |
| }, '');
| |
| document.getElementById('dm-use-filter').innerHTML = dmUseFilterHtml;
| |
| | |
| // 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
| |
| formatter: function (cell) {
| |
| /** @type {DCT} */
| |
| const dct = cell.getData();
| |
| let out = '<a href="' + dct.url + '">' + dct.name + '</a>';
| |
| if (dct.businessModel.includes('Freeware')) {
| |
| out += '<svg class="bm-icon" title="Freeware"><use href="#freeware-icon"/></svg>';
| |
| }
| |
| if (dct.businessModel.includes('Free plan available')) {
| |
| out += '<svg class="bm-icon" title="Free plan available"><use href="#free-plan-icon"/></svg>';
| |
| }
| |
| if (dct.usedByDmo.toLowerCase() === 'yes') {
| |
| out += '<br><small><span class="badge badge-info">Used by DMOs</span></small>';
| |
| }
| |
| if (dct.usedByDmo.toLowerCase() === 'yes with use case') {
| |
| out += '<br><small><span class="badge badge-info">Used by DMOs</span></small>';
| |
| out += ' <small><span class="badge badge-success">Use case</span></small>'
| |
| }
| |
| return out;
| |
| }
| |
| },
| |
| {
| |
| title: 'Functions',
| |
| field: 'functions',
| |
| minWidth: 300, // required for responsiveness when using fitColumns
| |
| cssClass: 'functions-cell',
| |
| formatter: function (cell) {
| |
| const order = Object.keys(fnImages);
| |
| const output = cell.getValue()
| |
| .sort((a, b) => order.indexOf(a) - order.indexOf(b))
| |
| .map(func => '<img class="func-img" src="' + fnImages[func] +
| |
| '" data-value="' + func +
| |
| '" alt="' + func +
| |
| '" title="' + func +
| |
| '">')
| |
| .join('');
| |
| return output;
| |
| }
| |
| },
| |
| {
| |
| 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 = '';
| |
| | |
| 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;
| |
| }
| |
| }
| |
| ]
| |
| });
| |
| | |
| tabulator.on('tableBuilt', () => {
| |
| tabulator.setData(dcts);
| |
| table = tabulator;
| |
| });
| |
| | |
| tabulator.on('dataFiltered', (filters, rows) => {
| |
| const summary = document.getElementById('filter-summary');
| |
| const filter = filters[0];
| |
|
| |
| // 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
| |
| ) { summary.textContent = 'No filter. Showing all results.'; }
| |
| else {
| |
| let summaryHtml = '<table>';
| |
| if (filter.type.functions) {
| |
| summaryHtml += '<tr><td><strong>Functions</strong></td><td>'
| |
| + (filter.type.functions.length > 0 ? filter.type.functions.join(', ') : 'none')
| |
| + '</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>Business model</strong></td><td>'
| |
| + (filter.type.businessModel.length > 0 ? filter.type.businessModel.join(', ') : 'none')
| |
| + '</td></tr>';
| |
| }
| |
| summaryHtml += '</table>';
| |
| summary.innerHTML = summaryHtml;
| |
| }
| |
| | |
| const markImages = () => {
| |
| const selectedSources = filter.type.dataSources;
| |
| const selectedFunctions = filter.type.functions;
| |
| | |
| // 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);
| |
| });
| |
| | |
| document.getElementById('data-source-filter').addEventListener('change', event => {
| |
| applyFilters();
| |
| }, { passive: true });
| |
| document.getElementById('functions-filter').addEventListener('change', event => {
| |
| applyFilters();
| |
| }, { passive: true });
| |
| document.getElementById('business-model-filter').addEventListener('change', event => {
| |
| applyFilters();
| |
| }, { passive: true });
| |
| document.getElementById('dm-use-filter').addEventListener('change', event => {
| |
| applyFilters();
| |
| }, { passive: true });
| |
| });
| |
| | |
| 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);
| |
| }
| |
| | |
| function toggleFilter() {
| |
| document.getElementById('dct-filters').classList.toggle('open');
| |
| }
| |
| | |
| // Close filter pane when clicked outside of it.
| |
| document.body.addEventListener('click', event => {
| |
| const filterPane = document.getElementById('dct-filters');
| |
| if (
| |
| filterPane.classList.contains('open') &&
| |
| !filterPane.contains(event.target) &&
| |
| event.target !== document.querySelector('#filter-bar .large-button')
| |
| ) { filterPane.classList.remove('open'); }
| |
| }, { passive: true });
| |
| </script>
| |
|
| |
|
| <!-- Icon definitons --> | | <!-- Icon definitons --> |
| <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" overflow="hidden" style="display:none;"> | | <!--<img src="https://assets.links.communitycenter.eu/v2/links/lib?q=unknown.svg">--> |
| <defs>
| |
| <symbol id="freeware-icon" viewBox="0 0 96 96">
| |
| <clipPath id="x">
| |
| <path d="M204 216h96v96h-96z" />
| |
| </clipPath>
| |
| <g clip-path="url(#x)" transform="translate(-204 -216)">
| |
| <path
| |
| d="M237 255c-2.2 0-4-1.8-4-4 0-1.4.8-2.7 1.9-3.4 0 .7.1 1.5.1 2.4 0 1.1.9 2 2 2s2-.9 2-2c0-.9 0-1.7-.1-2.5 1.2.7 2.1 2 2.1 3.5 0 2.2-1.8 4-4 4Zm49.2 17.2-28-28c-.8-.8-1.8-1.2-2.8-1.2h-17.2c-1.1-3.5-3.2-5.3-6.8-6-1.3-.2-2.4-.4-3.5-.6-5.7-.8-6.9-1-6.9-7.4 0-1.1-.9-2-2-2s-2 .9-2 2c0 9.4 3.7 10.4 10.3 11.4 1 .2 2.1.3 3.4.6 1.3.3 2.7.5 3.5 2.6-3 1.2-5.1 4.1-5.1 7.5v18.3c0 1.1.4 2.1 1.2 2.8l28 28c.7.8 1.7 1.1 2.7 1.1 1 0 2-.4 2.8-1.2l22.3-22.3c1.6-1.5 1.6-4.1.1-5.6Z" />
| |
| </g>
| |
| </symbol>
| |
| | |
| <symbol id="free-plan-icon" viewBox="0 0 96 96">
| |
| <clipPath id="y">
| |
| <path d="M592 312h96v96h-96z" />
| |
| </clipPath>
| |
| <g clip-path="url(#y)" transform="translate(-592 -312)">
| |
| <path
| |
| d="m674.6 368.212-28.334-28.326a3.99 3.99 0 0 0-2.833-1.214h-18.617c-.254 0-.5.015-.752.038a6.974 6.974 0 0 0-5.064-4.143l-6.764-1.352a4.992 4.992 0 0 1-4-4.359l-.515-4.633a1 1 0 1 0-1.988.221l.515 4.633a6.984 6.984 0 0 0 5.592 6.1l6.763 1.352a4.99 4.99 0 0 1 3.472 2.632 8.118 8.118 0 0 0-5.359 7.605v18.512a3.676 3.676 0 0 0 1.214 2.833l28.33 28.327a4.03 4.03 0 0 0 5.767 0l22.573-22.56a4.094 4.094 0 0 0 0-5.666Zm-1.414 4.251-22.567 22.56a2.032 2.032 0 0 1-2.939 0L619.35 366.7l-.05-.05-.05-.044a1.722 1.722 0 0 1-.531-1.328v-18.513a6.116 6.116 0 0 1 3.939-5.692l.492 2.457c-.322.173-.618.39-.88.645A4 4 0 1 0 625.1 343h-.015l-.465-2.324c.065 0 .129-.009.194-.009h18.619c.538.009 1.05.236 1.418.628l28.33 28.327a2.1 2.1 0 0 1 0 2.836Zm-47.691-27.421a2.017 2.017 0 1 1-1.906.667l.164.821a1 1 0 0 0 1.179.781.999.999 0 0 0 .784-1.177Z" />
| |
| </g>
| |
| </symbol>
| |
| </defs>
| |
| </svg>
| |
|
| |
|
| <div id="dct-list-wrapper"> | | <div id="dct-list-wrapper"> |
| <h1> | | <h1> |
| <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" overflow="hidden" viewBox="0 0 96 96"> | | <img src="https://assets.links.communitycenter.eu/v2/links/lib?q=1-dct_list.svg"> |
| <defs>
| | <div> |
| <clipPath id="a">
| | <div>Technologies</div> |
| <path d="M65 334h96v96H65z" />
| | <div style="font-size:small; letter-spacing:.03em; margin-left: .6em;">Social Media and Crowdsourcing Library</div> |
| </clipPath>
| | </div> |
| </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> | |
| <span>Technologies</span>
| |
| </h1> | | </h1> |
| <div id="dct-intro"> | | <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> |
|
| |
|
| <p>This page provides an overview of various Technologies related to Social Media and
| |
| Crowdsourcing. You can use the filters to identify
| |
| relevant technologies according to your needs and then click on the name of a tool to get
| |
| further information.</p>
| |
| </div>
| |
| <div id="filter-bar"> | | <div id="filter-bar"> |
| <div style="display: flex; justify-content: space-between;"> | | <div style="display: flex; justify-content: space-between;"> |
| <div style="flex: 1 1;"> | | <div style="flex: 1 1;"> |
| <h2 style="margin-bottom: 1rem;">Applied Filters</h2> | | <h2 style="margin-bottom: 1rem;">Selected Filters</h2> |
| <div id="filter-summary">No filter. Showing all results.</div> | | <div id="filter-summary">No filter. Showing all results.</div> |
| </div> | | </div> |
| <div style="flex: 0 0;"> | | <div> |
| <button class="large-button" type="button" onclick="toggleFilter()">Filters</button> | | <button class="large-button open-filters" type="button" onclick="toggleFilter()">Open Filters</button> |
| </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> |
| | |
| <div id="dct-filters"> | | <div id="dct-filters"> |
| | |
| <h2 style="display: flex; justify-content: space-between;"> | | <h2 style="display: flex; justify-content: space-between;"> |
| <div> | | <div> |
| <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" overflow="hidden" viewBox="0 0 96 96"> | | <img src="https://www.safetyinnovation.center/lcc/dct_list/img/filters.svg"> |
| <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> | | <span>Filters</span> |
| </div> | | </div> |
| <a onclick="toggleFilter()" id="close-filter-button">×</a> | | <a onclick="toggleFilter()" id="close-filter-button">×</a> |
| </h2> | | </h2> |
| | |
| <div style="text-align: center;"> | | <div style="text-align: center;"> |
| <button class="large-button" type="button" onclick="clearFilters()">Clear Filters</button> | | <button class="large-button" type="button" onclick="clearFilters()">Clear Filters</button> |
| </div> | | </div> |
| | |
| <div class="filter-wrapper"> | | <div class="filter-wrapper"> |
| <h3>Functions</h3> | | <h4 class="filter-toggle">Functions <div class="plus icon"></div> |
| <div class="filter-button-wrapper"> | | </h4> |
| <button type="button" onclick="selectAll('#functions-filter')">Select all</button> |
| | <div class="filter-container"> |
| <button type="button" onclick="deselectAll('#functions-filter')">Deselect all</button>
| | <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 class="filter-content" id="functions-filter"></div>
| |
| </div> | | </div> |
| | |
| <div class="filter-wrapper"> | | <div class="filter-wrapper"> |
| <h3>Supported Platforms</h3> | | <h4 class="filter-toggle">Supported Platforms <div class="plus icon"></div> |
| <div class="filter-button-wrapper"> | | </h4> |
| <button type="button" onclick="selectAll('#data-source-filter')">Select all</button> |
| | <div class="filter-container"> |
| <button type="button" onclick="deselectAll('#data-source-filter')">Deselect all</button>
| | <div class="filter-button-wrapper"> |
| | <button type="button" onclick="selectAll('#data-source-filter')">Select all</button> | |
| | <button type="button" onclick="deselectAll('#data-source-filter')">Clear all</button> |
| | </div> |
| | <div class="filter-content loose" id="data-source-filter"></div> |
| </div> | | </div> |
| <div class="filter-content" id="data-source-filter"></div>
| |
| </div> | | </div> |
| | |
| <div class="filter-wrapper"> | | <div class="filter-wrapper"> |
| <h3>Business Model</h3> | | <h4 class="filter-toggle">Pricing <div class="plus icon"></div> |
| <div class="filter-button-wrapper"> | | </h4> |
| <button type="button" onclick="selectAll('#business-model-filter')">Select all</button> |
| | <div class="filter-container"> |
| <button type="button" onclick="deselectAll('#business-model-filter')">Deselect all</button>
| | <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 class="filter-content" id="business-model-filter"></div>
| |
| </div> | | </div> |
| <div class="filter-wrapper"> | | |
| <h3>Use in DM</h3> | | <!-- <div class="filter-wrapper"> |
| <div class="filter-button-wrapper"> | | <h4 class="filter-toggle">Used by Practitioners <div class="plus icon"></div> |
| <button type="button" onclick="selectAll('#dm-use-filter')">Select all</button> |
| | </h4> |
| <button type="button" onclick="deselectAll('#dm-use-filter')">Deselect all</button>
| | <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 class="filter-content" id="dm-use-filter"></div>
| |
| </div> | | </div> |
| | |
| </div> | | </div> |
| </div> | | </div> |
| <div id="dct-tabulator"></div> | | <div id="dct-tabulator"></div> |
| </div> | | </div> |
| | |
| </includeonly> | | </includeonly> |