| |
1 /* |
| |
2 * Copyright 2025 Mike Becker. All rights reserved. |
| |
3 * |
| |
4 * Redistribution and use in source and binary forms, with or without |
| |
5 * modification, are permitted provided that the following conditions are met: |
| |
6 * |
| |
7 * 1. Redistributions of source code must retain the above copyright |
| |
8 * notice, this list of conditions and the following disclaimer. |
| |
9 * |
| |
10 * 2. Redistributions in binary form must reproduce the above copyright |
| |
11 * notice, this list of conditions and the following disclaimer in the |
| |
12 * documentation and/or other materials provided with the distribution. |
| |
13 * |
| |
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| |
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| |
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| |
17 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| |
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| |
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| |
20 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| |
21 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| |
22 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| |
24 */ |
| |
25 |
| |
26 function closeWhatsNew(showMore) { |
| |
27 if (showMore) { |
| |
28 window.open(baseHref + 'about', '_blank'); |
| |
29 } |
| |
30 document.getElementById('whats-new').style.display = 'none'; |
| |
31 document.getElementById('page-area').classList.remove('blurred'); |
| |
32 } |
| |
33 |
| |
34 function applyShowAllProjects() { |
| |
35 const toggle = document.getElementById('show-all-projects'); |
| |
36 if (!toggle) return; // this page does not show the navmenu |
| |
37 const checked = toggle.checked; |
| |
38 document.querySelectorAll('#sideMenu .menuEntry[data-hidden]').forEach((elem) => { |
| |
39 elem.style.display = checked ? 'initial' : 'none'; |
| |
40 }) |
| |
41 } |
| |
42 |
| |
43 function toggleShowAllProjects() { |
| |
44 const toggle = document.getElementById('show-all-projects'); |
| |
45 |
| |
46 const req = new XMLHttpRequest(); |
| |
47 req.open('POST', baseHref+'projects/settings'); |
| |
48 req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); |
| |
49 req.send('show_all_projects=' + (toggle.checked ? 'true' : 'false')); |
| |
50 applyShowAllProjects(); |
| |
51 } |
| |
52 |
| |
53 window.addEventListener('load', () => { |
| |
54 applyShowAllProjects(); |
| |
55 }); |