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