Sat, 06 Jan 2024 20:32:56 +0100
Added tag v1.2.2 for changeset 238de141d189
universe@207 | 1 | /* |
universe@266 | 2 | * Copyright 2023 Mike Becker. All rights reserved. |
universe@207 | 3 | * |
universe@207 | 4 | * Redistribution and use in source and binary forms, with or without |
universe@207 | 5 | * modification, are permitted provided that the following conditions are met: |
universe@207 | 6 | * |
universe@207 | 7 | * 1. Redistributions of source code must retain the above copyright |
universe@207 | 8 | * notice, this list of conditions and the following disclaimer. |
universe@207 | 9 | * |
universe@207 | 10 | * 2. Redistributions in binary form must reproduce the above copyright |
universe@207 | 11 | * notice, this list of conditions and the following disclaimer in the |
universe@207 | 12 | * documentation and/or other materials provided with the distribution. |
universe@207 | 13 | * |
universe@207 | 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
universe@207 | 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
universe@207 | 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
universe@207 | 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
universe@207 | 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
universe@207 | 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
universe@207 | 20 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
universe@207 | 21 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
universe@207 | 22 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
universe@207 | 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
universe@207 | 24 | */ |
universe@207 | 25 | |
universe@207 | 26 | /** |
universe@266 | 27 | * Hides and shows the project details. |
universe@207 | 28 | * |
universe@266 | 29 | * Following elements are required on the page (element ID): |
universe@266 | 30 | * |
universe@266 | 31 | * - toggle-details-button |
universe@266 | 32 | * - project-details-header-reduced |
universe@266 | 33 | * - project-details-header |
universe@266 | 34 | * |
universe@207 | 35 | */ |
universe@266 | 36 | projectDetailsVisible = true |
universe@266 | 37 | function toggleProjectDetails() { |
universe@266 | 38 | const button = document.getElementById('toggle-details-button') |
universe@266 | 39 | const reduced = document.getElementById('project-details-header-reduced') |
universe@266 | 40 | const full = document.getElementById('project-details-header') |
universe@266 | 41 | |
universe@266 | 42 | const v = !window.projectDetailsVisible |
universe@266 | 43 | window.projectDetailsVisible = v |
universe@266 | 44 | |
universe@266 | 45 | if (v) { |
universe@266 | 46 | button.dataset.toggle = 'true' |
universe@266 | 47 | reduced.style.display = 'none' |
universe@266 | 48 | full.style.display = 'block' |
universe@266 | 49 | } else { |
universe@266 | 50 | delete button.dataset.toggle |
universe@266 | 51 | reduced.style.display = 'block' |
universe@266 | 52 | full.style.display = 'none' |
universe@266 | 53 | } |
universe@207 | 54 | } |
universe@268 | 55 | |
universe@268 | 56 | function toggleFilterDetails() { |
universe@268 | 57 | const filters = document.getElementById('more-filters') |
universe@268 | 58 | const toggle = document.getElementById('show-more-filters') |
universe@268 | 59 | if (toggle.checked) { |
universe@268 | 60 | filters.style.display = 'flex' |
universe@268 | 61 | } else { |
universe@268 | 62 | filters.style.display = 'none' |
universe@268 | 63 | } |
universe@268 | 64 | } |
universe@268 | 65 | |
universe@268 | 66 | function toggleDetails() { |
universe@268 | 67 | toggleProjectDetails() |
universe@268 | 68 | toggleFilterDetails() |
universe@268 | 69 | } |
universe@268 | 70 | |
universe@268 | 71 | window.addEventListener('load', function() { toggleDetails() }, false) |