diff options
| -rw-r--r-- | main.js | 22 | 
1 files changed, 18 insertions, 4 deletions
@@ -750,7 +750,7 @@ const LAYERS = Object.seal({          }),      },      kommunyta: { -      legend: null, +      legend: { zoomLevel: 3, type: 'linestring' },        style: [2, 2, 3, 3, 4, 4, 6, 6, 8, 8, 10, 10].map(function(width) {            return new Style({              zIndex: 0, @@ -3278,7 +3278,17 @@ const layerHierarchy = [    {      text: 'Administrativa gränser',      type: 'switch', -    layer: ['adm.lansyta', 'adm.kommunyta'], +    collapse_children: true, +    children: [ +      { +        text: 'Länsgränser', +        layer: 'adm.lansyta', +      }, +      { +        text: 'Kommungränser', +        layer: 'adm.kommunyta', +      }, +    ],    },  ]; @@ -3544,7 +3554,7 @@ const infoMetadataAccordions = [];    let layerId = 0;    const addAccordionGroup = function(parentNode, children) {      const ul = document.createElement('ul'); -    parentNode.appendChild(ul); +    parentNode?.appendChild?.(ul);      ul.classList.add('list-group', 'list-group-flush');      children.forEach(function(child) { @@ -3625,7 +3635,7 @@ const infoMetadataAccordions = [];      const text0 = document.createTextNode(x.text);      label0.appendChild(text0); -    if (x.children == null || x.children.length === 0) { +    if (x.children == null || x.children.length === 0 || x.collapse_children) {        span0.removeAttribute('data-bs-toggle');        span0.removeAttribute('data-bs-target');        item.replaceChildren(span0); @@ -3633,6 +3643,10 @@ const infoMetadataAccordions = [];          span0.classList.add('form-switch');          input0.setAttribute('role', 'switch');        } +      if (x.children != null && x.children.length > 0) { +        /* create inputs for the hash param logic but don't add them to the panel */ +        addAccordionGroup(null, x.children); +      }      } else {        const body = document.createElement('div');        collapse.appendChild(body);  | 
