From c3f7ddff745d849e03200ddf49b696dd6f3eb462 Mon Sep 17 00:00:00 2001 From: clonejo Date: Fri, 9 Feb 2024 00:35:12 +0100 Subject: [PATCH 01/31] contrib: bulk_location_update.py --- contrib/bulk_location_update.py | 59 +++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 contrib/bulk_location_update.py diff --git a/contrib/bulk_location_update.py b/contrib/bulk_location_update.py new file mode 100755 index 0000000..fd2752c --- /dev/null +++ b/contrib/bulk_location_update.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 + +from datetime import date + +import requests + +BASE = "https://in.ccc.ac" + + +session = requests.Session() +# session.auth = (":)", ":)") + +res = session.get(f"{BASE}/api/items") +res.raise_for_status() +items = res.json() + +is_in = input("is in (eg. R7): ") +print(items[is_in]) + + +def format_last_updated(item) -> str: + last_updated = item["last_updated"] + if last_updated is None: + return "" + return date.fromtimestamp(item["last_updated"]).isoformat()[:-3] + + +print(f"Items that should be in {is_in}:") +print( + "\n".join( + ( + f"{item['id']:<5} last_updated={format_last_updated(item)}" + for item in items.values() + if item["is_in"] == is_in + ) + ) +) + +while True: + try: + item_id = input(f"item that is in {is_in}: ") + except KeyboardInterrupt: + break + if item_id == "": + break + + if item_id not in items: + item_id = "K" + str(int(item_id)) + if item_id not in items: + print(f"{item_id} and K{item_id} do not exist.") + continue + item = items[item_id] + + print(f'location of {item_id}: {item["is_in"]} ->', end="") + item["is_in"] = is_in + print(f' {item["is_in"]}') + + res = session.put(f"{BASE}/api/items/{item_id}", json=item) + res.raise_for_status() From 111a0f6e452d667ddc6b4220b9693a6e6e5f9d10 Mon Sep 17 00:00:00 2001 From: snoopy Date: Tue, 30 Apr 2024 01:56:38 +0200 Subject: [PATCH 02/31] Changes map and update coordinate grid to c4 map --- static/80x80.svg | 442 ++++++++++++++++++++++++++++++++++++++++++++++- static/form.js | 8 +- static/shared.js | 18 +- static/style.css | 6 +- 4 files changed, 457 insertions(+), 17 deletions(-) diff --git a/static/80x80.svg b/static/80x80.svg index d0124e9..831049d 100644 --- a/static/80x80.svg +++ b/static/80x80.svg @@ -1 +1,441 @@ -/home/me/stuff/cccac/clubraum/plan_0.5.sh3dCreator: FreeHEP Graphics2D Driver Producer: com.eteks.sweethome3d.swing.PlanComponent$SVGSupport$1 Revision: 12753 Source: me Date: Monday, June 6, 2022 11:58:58 PM CEST \ No newline at end of file + + + + diff --git a/static/form.js b/static/form.js index b69f358..16ebf7e 100644 --- a/static/form.js +++ b/static/form.js @@ -136,14 +136,14 @@ function del() { let clicks = {x: [], y: []}; function mapClick(e) { - let x = Math.floor(31 / e.target.width * e.layerX); - let y = Math.floor(10 / e.target.height * e.layerY); + let x = Math.floor(37 / e.target.width * e.layerX); + let y = Math.floor(18 / e.target.height * e.layerY); let humanPos = (x, y) => { - return `${String.fromCharCode(65 + 8 - y)}${x}`; + return `${String.fromCharCode(65 + 16 - y)}${x}`; }; - if (x > 0 && x < 31 && y > 0 && y < 9) { + if (x > 0 && x < 37 && y > 0 && y < 18) { if (clicks.x.length > 1) { clicks.x = [x]; clicks.y = [y]; diff --git a/static/shared.js b/static/shared.js index 7a51e29..6d01e23 100644 --- a/static/shared.js +++ b/static/shared.js @@ -1,12 +1,12 @@ function renderMap(xx, yy) { - if (xx[0] > 0 && xx[0] < 31 && yy[0] > 0 && yy[0] < 9 && - xx[1] > 0 && xx[1] < 31 && yy[1] > 0 && yy[1] < 9 && + if (xx[0] > 0 && xx[0] < 37 && yy[0] > 0 && yy[0] < 18 && + xx[1] > 0 && xx[1] < 37 && yy[1] > 0 && yy[1] < 18 && xx[1] >= xx[0] && yy[1] >= yy[0]) { let grid = document.getElementById('mapgrid'); - grid.style.top = `${yy[0]*10}%`; - grid.style.left = `${100/31*xx[0]}%`; - grid.style.height = `${(yy[1] - yy[0] + 1) * 10}%`; - grid.style.width = `${100/31*(xx[1] - xx[0] + 1)}%`; + grid.style.top = `${yy[0]*100/18}%`; + grid.style.left = `${100/37*xx[0]}%`; + grid.style.height = `${(yy[1] - yy[0] + 1) * 100/18}%`; + grid.style.width = `${100/37*(xx[1] - xx[0] + 1)}%`; } else { alert(`invalid coordinates x=${xx} y=${yy}`); } @@ -26,8 +26,8 @@ function coordsToMap(coords_bl, coords_tr) { let bl_x = parseInt(coords_bl.slice(1)); let tr_x = parseInt(coords_tr.slice(1)); - bl_y = 8 - (bl_y.charCodeAt(0) - 65); - tr_y = 8 - (tr_y.charCodeAt(0) - 65); + bl_y = 16 - (bl_y.charCodeAt(0) - 65); + tr_y = 16 - (tr_y.charCodeAt(0) - 65); renderMap([bl_x, tr_x], [tr_y, bl_y]); -} \ No newline at end of file +} diff --git a/static/style.css b/static/style.css index be8a9bd..3b538ec 100644 --- a/static/style.css +++ b/static/style.css @@ -172,9 +172,9 @@ textarea { position: relative; border: 1px solid black; background: #fff; - max-width: 800px; + max-width: 1480px; max-height: 50vh; - aspect-ratio: 31 / 10; + aspect-ratio: 37 / 18; margin: 0 auto; } @@ -238,4 +238,4 @@ form #map { max-width: 100%; text-align: center; margin: auto; -} \ No newline at end of file +} From 277b2aec575014869ec686adac64df1d4743708d Mon Sep 17 00:00:00 2001 From: snoopy Date: Tue, 30 Apr 2024 02:05:36 +0200 Subject: [PATCH 03/31] Add Dockerfile build action --- .forgejo/workflows/deployment.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .forgejo/workflows/deployment.yaml diff --git a/.forgejo/workflows/deployment.yaml b/.forgejo/workflows/deployment.yaml new file mode 100644 index 0000000..391e59c --- /dev/null +++ b/.forgejo/workflows/deployment.yaml @@ -0,0 +1,24 @@ +name: deployment +on: + push: + branches: + - 'main' + +jobs: + deployment: + runs-on: docker + container: + image: node:bookworm + steps: + - uses: actions/checkout@v4 + - name: Build inventory + uses: https://codeberg.org/umglurf/kaniko-action@main + with: + cache: true + cache_repo: git.koeln.ccc.de/${{ github.repository }}/cache + push: 'true' + context: /workspace/snoopy/in-c4/ + credentials: | + git.koeln.ccc.de=snoopy:${{ secrets.REGISTRY_WRITE }} + destinations: | + git.koeln.ccc.de/${{ github.repository }}/in-c4:latest From 0bc3cac6f527b0eff8fb32c2e62f41497e2f459a Mon Sep 17 00:00:00 2001 From: snoopy Date: Tue, 30 Apr 2024 02:14:18 +0200 Subject: [PATCH 04/31] Puts database into a subfolder --- database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database.py b/database.py index 44a3006..7759e10 100644 --- a/database.py +++ b/database.py @@ -2,7 +2,7 @@ from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker -SQLALCHEMY_DATABASE_URL = "sqlite:///./inventory.sqlite3" +SQLALCHEMY_DATABASE_URL = "sqlite:///./data/inventory.sqlite3" engine = create_engine( SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}, echo=True From 6cdeb1a3da867631528c7088d38c4455614d8d60 Mon Sep 17 00:00:00 2001 From: Shy Date: Tue, 30 Apr 2024 16:27:00 +0200 Subject: [PATCH 05/31] Updated map und grid --- static/80x80.svg | 97 ++++++++++++++++++++---------------------------- static/form.js | 4 +- static/shared.js | 8 ++-- static/style.css | 6 +-- 4 files changed, 50 insertions(+), 65 deletions(-) diff --git a/static/80x80.svg b/static/80x80.svg index 831049d..cdaaaf1 100644 --- a/static/80x80.svg +++ b/static/80x80.svg @@ -2,9 +2,9 @@ diff --git a/static/form.js b/static/form.js index 16ebf7e..a82d2a5 100644 --- a/static/form.js +++ b/static/form.js @@ -136,14 +136,14 @@ function del() { let clicks = {x: [], y: []}; function mapClick(e) { - let x = Math.floor(37 / e.target.width * e.layerX); + let x = Math.floor(36 / e.target.width * e.layerX); let y = Math.floor(18 / e.target.height * e.layerY); let humanPos = (x, y) => { return `${String.fromCharCode(65 + 16 - y)}${x}`; }; - if (x > 0 && x < 37 && y > 0 && y < 18) { + if (x > 0 && x < 36 && y > 0 && y < 18) { if (clicks.x.length > 1) { clicks.x = [x]; clicks.y = [y]; diff --git a/static/shared.js b/static/shared.js index 6d01e23..c2b9c35 100644 --- a/static/shared.js +++ b/static/shared.js @@ -1,12 +1,12 @@ function renderMap(xx, yy) { - if (xx[0] > 0 && xx[0] < 37 && yy[0] > 0 && yy[0] < 18 && - xx[1] > 0 && xx[1] < 37 && yy[1] > 0 && yy[1] < 18 && + if (xx[0] > 0 && xx[0] < 36 && yy[0] > 0 && yy[0] < 18 && + xx[1] > 0 && xx[1] < 36 && yy[1] > 0 && yy[1] < 18 && xx[1] >= xx[0] && yy[1] >= yy[0]) { let grid = document.getElementById('mapgrid'); grid.style.top = `${yy[0]*100/18}%`; - grid.style.left = `${100/37*xx[0]}%`; + grid.style.left = `${100/36*xx[0]}%`; grid.style.height = `${(yy[1] - yy[0] + 1) * 100/18}%`; - grid.style.width = `${100/37*(xx[1] - xx[0] + 1)}%`; + grid.style.width = `${100/36*(xx[1] - xx[0] + 1)}%`; } else { alert(`invalid coordinates x=${xx} y=${yy}`); } diff --git a/static/style.css b/static/style.css index 3b538ec..d055b22 100644 --- a/static/style.css +++ b/static/style.css @@ -171,10 +171,10 @@ textarea { #map { position: relative; border: 1px solid black; - background: #fff; - max-width: 1480px; + background: #4d4d4d; + max-width: 1440px; max-height: 50vh; - aspect-ratio: 37 / 18; + aspect-ratio: 2 / 1; margin: 0 auto; } From f91b83d3caf78aa7704f63e279b05ba9cd24cb54 Mon Sep 17 00:00:00 2001 From: Shy Date: Tue, 30 Apr 2024 18:18:11 +0200 Subject: [PATCH 06/31] C4 inspired stylesheet --- static/c4.css | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 static/c4.css diff --git a/static/c4.css b/static/c4.css new file mode 100644 index 0000000..a74dc49 --- /dev/null +++ b/static/c4.css @@ -0,0 +1,60 @@ +body { + color: #f0f0f0; + background-color: #333; +} + +h1, h1 a { + color: #fcbb06; /* C4 Yellow */ +} + +.result { + background-color: #202020; + border-color: #4d4d4d; +} + +.result:focus { + background-color: #202020; + border-color: #fcbb06; + outline-color: #fcbb06; +} + +.result a { + color: #fcbb06; +} + +.note { + background-color: #333; + font-size: smaller; +} + +.btn.green { + color: #020; + background-color: #6f3; +} + +.btn.green:hover ,.btn.green:focus { + background-color: #3f0; +} + +.btn.red { + color: #200; + background-color: #f36; +} + +.btn.red:hover, .btn.red:focus { + background-color: #f03; +} + +@keyframes blinker { + 0% { opacity: 1; } + 40% { opacity: 1; } + 90% { opacity: 0; } + 100% { opacity: 1; } +} + +#mapgrid { + outline: 2px solid #fcbb06; + background: #fcbb0680; + animation: blinker 1s infinite; +} + From 2aae5dd4413e8ad40022f0de99b0a2318dc2693d Mon Sep 17 00:00:00 2001 From: Shy Date: Tue, 30 Apr 2024 18:18:56 +0200 Subject: [PATCH 07/31] Include C4 style sheet --- static/form.html | 1 + static/index.html | 1 + 2 files changed, 2 insertions(+) diff --git a/static/form.html b/static/form.html index d894279..8447427 100644 --- a/static/form.html +++ b/static/form.html @@ -3,6 +3,7 @@ in? + diff --git a/static/index.html b/static/index.html index 585514b..472846b 100644 --- a/static/index.html +++ b/static/index.html @@ -3,6 +3,7 @@ in? + From c25188611e456e214502df8f1d4fa2acf2e2f1e5 Mon Sep 17 00:00:00 2001 From: snoopy Date: Tue, 30 Apr 2024 20:18:37 +0200 Subject: [PATCH 08/31] Adds actions workflow for pull-requests --- .../workflows/deployment-pull-request.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .forgejo/workflows/deployment-pull-request.yaml diff --git a/.forgejo/workflows/deployment-pull-request.yaml b/.forgejo/workflows/deployment-pull-request.yaml new file mode 100644 index 0000000..bef68b9 --- /dev/null +++ b/.forgejo/workflows/deployment-pull-request.yaml @@ -0,0 +1,22 @@ +name: deployment-on-pull-request +on: + pull_request: + pull_request_target: + types: + - opened + - reopened + - synchronize + +jobs: + deployment: + runs-on: docker + container: + image: node:bookworm + steps: + - uses: actions/checkout@v4 + - name: Build inventory + uses: https://codeberg.org/umglurf/kaniko-action@main + with: + cache: false + push: 'false' + context: /workspace/snoopy/in-c4/ From b41f74bf7b8dac41e3900e78677c21a80d06b2e3 Mon Sep 17 00:00:00 2001 From: snoopy Date: Tue, 30 Apr 2024 20:19:15 +0200 Subject: [PATCH 09/31] Fix gitignore Goal is to not have the contents of /data/ inside the git workflow --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 53c9ebf..03899e1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -/inventory.sqlite3 +/data/* *.pyc From b6a0d226741876458cc5839967bf9552916657d0 Mon Sep 17 00:00:00 2001 From: snoopy Date: Tue, 30 Apr 2024 21:22:07 +0200 Subject: [PATCH 10/31] Change button names --- static/c4.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/c4.css b/static/c4.css index a74dc49..3293b31 100644 --- a/static/c4.css +++ b/static/c4.css @@ -27,12 +27,12 @@ h1, h1 a { font-size: smaller; } -.btn.green { +.btn.primary { color: #020; background-color: #6f3; } -.btn.green:hover ,.btn.green:focus { +.btn.primary:hover ,.btn.primary:focus { background-color: #3f0; } From 299a2f5914bab2dd6118659720e972906d05e370 Mon Sep 17 00:00:00 2001 From: Shy Date: Tue, 30 Apr 2024 21:45:01 +0200 Subject: [PATCH 11/31] Modified button colors --- static/c4.css | 16 +++++++++++++--- static/index.html | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/static/c4.css b/static/c4.css index 3293b31..7e9d5e0 100644 --- a/static/c4.css +++ b/static/c4.css @@ -28,17 +28,27 @@ h1, h1 a { } .btn.primary { - color: #020; - background-color: #6f3; + color: #220; + background-color: #fcbb06; } .btn.primary:hover ,.btn.primary:focus { + background-color: #ffcc33; +} + +.btn.grn { + color: #020; + background-color: #9f6; +} + +.btn.grn:hover ,.btn.primary:focus { background-color: #3f0; } + .btn.red { color: #200; - background-color: #f36; + background-color: #f48; } .btn.red:hover, .btn.red:focus { diff --git a/static/index.html b/static/index.html index 472846b..c656402 100644 --- a/static/index.html +++ b/static/index.html @@ -38,7 +38,7 @@ - + + + From a6e363220a1573257c284a30837064d6c1f3f370 Mon Sep 17 00:00:00 2001 From: snoopy Date: Wed, 1 May 2024 00:04:37 +0200 Subject: [PATCH 12/31] Fixes wrong active button color and use primary color --- static/c4.css | 4 ++-- static/form.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/static/c4.css b/static/c4.css index 7e9d5e0..c05e5b0 100644 --- a/static/c4.css +++ b/static/c4.css @@ -32,7 +32,7 @@ h1, h1 a { background-color: #fcbb06; } -.btn.primary:hover ,.btn.primary:focus { +.btn.primary:hover,.btn.primary:focus { background-color: #ffcc33; } @@ -41,7 +41,7 @@ h1, h1 a { background-color: #9f6; } -.btn.grn:hover ,.btn.primary:focus { +.btn.grn:hover ,.btn.grn:focus { background-color: #3f0; } diff --git a/static/form.html b/static/form.html index 8447427..c01f0f4 100644 --- a/static/form.html +++ b/static/form.html @@ -50,6 +50,6 @@ - + From 9935c0562b974e3d9f489342dfbacbed27c8d998 Mon Sep 17 00:00:00 2001 From: snoopy Date: Wed, 1 May 2024 01:08:43 +0200 Subject: [PATCH 13/31] Changes colors slightly --- static/80x80.svg | 2 +- static/c4.css | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/static/80x80.svg b/static/80x80.svg index cdaaaf1..2478ce7 100644 --- a/static/80x80.svg +++ b/static/80x80.svg @@ -421,6 +421,6 @@ aria-label="Keller" /> diff --git a/static/c4.css b/static/c4.css index c05e5b0..504bf3a 100644 --- a/static/c4.css +++ b/static/c4.css @@ -4,7 +4,7 @@ body { } h1, h1 a { - color: #fcbb06; /* C4 Yellow */ + color: #dfaa37; /* C4 Yellow */ } .result { @@ -14,12 +14,12 @@ h1, h1 a { .result:focus { background-color: #202020; - border-color: #fcbb06; - outline-color: #fcbb06; + border-color: #dfaa37; + outline-color: #dfaa37; } .result a { - color: #fcbb06; + color: #dfaa37; } .note { @@ -27,13 +27,17 @@ h1, h1 a { font-size: smaller; } +.btn { + box-shadow: 0 3px 6px -1px rgba(0,0,0,0.3); +} + .btn.primary { color: #220; - background-color: #fcbb06; + background-color: #dfaa37; } .btn.primary:hover,.btn.primary:focus { - background-color: #ffcc33; + background-color: #f5c251; } .btn.grn { @@ -48,11 +52,11 @@ h1, h1 a { .btn.red { color: #200; - background-color: #f48; + background-color: #ec6d5f; } .btn.red:hover, .btn.red:focus { - background-color: #f03; + background-color: #ff7667; } @keyframes blinker { @@ -63,8 +67,8 @@ h1, h1 a { } #mapgrid { - outline: 2px solid #fcbb06; - background: #fcbb0680; + outline: 2px solid #dfaa37; + background: #dfaa3780; animation: blinker 1s infinite; } From 5b5728f7e2f7ffb2c57ae2585ee2d934f3755522 Mon Sep 17 00:00:00 2001 From: Shy Date: Wed, 1 May 2024 17:17:35 +0200 Subject: [PATCH 14/31] Add drop shadow to map --- static/c4.css | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/static/c4.css b/static/c4.css index 504bf3a..7805a9b 100644 --- a/static/c4.css +++ b/static/c4.css @@ -7,6 +7,15 @@ h1, h1 a { color: #dfaa37; /* C4 Yellow */ } +#map { + border: 1px solid #202020; + background: #4d4d4d; + max-width: 1440px; + max-height: 50vh; + aspect-ratio: 2 / 1; + box-shadow: 0px 6px 12px #000c; +} + .result { background-color: #202020; border-color: #4d4d4d; @@ -49,7 +58,6 @@ h1, h1 a { background-color: #3f0; } - .btn.red { color: #200; background-color: #ec6d5f; From 9f95e704b9b95e59f335f082e9ee54160baa2f85 Mon Sep 17 00:00:00 2001 From: Shy Date: Sat, 4 May 2024 18:28:09 +0200 Subject: [PATCH 15/31] Added buttons for known types. --- static/c4.css | 15 +++++++++++++++ static/form.js | 18 ++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/static/c4.css b/static/c4.css index 7805a9b..c0ca189 100644 --- a/static/c4.css +++ b/static/c4.css @@ -36,6 +36,21 @@ h1, h1 a { font-size: smaller; } +#knowntypes button { + color: #220; + background-color: #dfaa37; + border: 1px solid #220; + border-radius: 4px; + padding: 0.2em 0.4em; + margin: 0.2em; + font-weight: bolder; + cursor: pointer; +} + +#knowntypes button:hover, #knowntypes button:focus { + background-color: #f5c251; +} + .btn { box-shadow: 0 3px 6px -1px rgba(0,0,0,0.3); } diff --git a/static/form.js b/static/form.js index a82d2a5..d5ab745 100644 --- a/static/form.js +++ b/static/form.js @@ -65,8 +65,22 @@ function knownTypes() { map[i.type] = true; } } - let types = Object.keys(map).sort().join(', ') - document.getElementById('knowntypes').textContent = `Known types: ${types}.`; + + // Get location in document. + let known_types = document.getElementById('knowntypes'); + known_types.textContent = `Known types: `; + + // Create a button for every known type. + for (let label of Object.keys(map).sort()) { + btn = document.createElement('button'); + btn.setAttribute('type', 'button'); + btn.textContent = label; + btn.addEventListener('click', function() { + document.getElementById('type').value = label; + }); + + known_types.appendChild(btn); + } } function save() { From c9cda14f38631eb717593c0ceab9234fb005394c Mon Sep 17 00:00:00 2001 From: Shy Date: Mon, 6 May 2024 14:42:21 +0200 Subject: [PATCH 16/31] Fix indentation and use const where preferable --- static/form.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/static/form.js b/static/form.js index d5ab745..d1affc1 100644 --- a/static/form.js +++ b/static/form.js @@ -67,19 +67,19 @@ function knownTypes() { } // Get location in document. - let known_types = document.getElementById('knowntypes'); + const known_types = document.getElementById('knowntypes'); known_types.textContent = `Known types: `; // Create a button for every known type. for (let label of Object.keys(map).sort()) { - btn = document.createElement('button'); - btn.setAttribute('type', 'button'); - btn.textContent = label; - btn.addEventListener('click', function() { - document.getElementById('type').value = label; - }); + btn = document.createElement('button'); + btn.setAttribute('type', 'button'); + btn.textContent = label; + btn.addEventListener('click', function() { + document.getElementById('type').value = label; + }); - known_types.appendChild(btn); + known_types.appendChild(btn); } } From 1b3de458faf97db780b92de14efbf395a7c35a4e Mon Sep 17 00:00:00 2001 From: Shy Date: Mon, 6 May 2024 17:26:31 +0200 Subject: [PATCH 17/31] Fixed colors for #mapnote --- static/c4.css | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/static/c4.css b/static/c4.css index 7805a9b..cb49d2d 100644 --- a/static/c4.css +++ b/static/c4.css @@ -8,12 +8,18 @@ h1, h1 a { } #map { - border: 1px solid #202020; - background: #4d4d4d; - max-width: 1440px; - max-height: 50vh; - aspect-ratio: 2 / 1; - box-shadow: 0px 6px 12px #000c; + border: 1px solid #202020; + background: #4d4d4d; + max-width: 1440px; + max-height: 50vh; + aspect-ratio: 2 / 1; + box-shadow: 0px 6px 12px #000c; +} + +#mapnote { + background: #202020; + border: 1px solid #000; + border-top: none; } .result { From 065fa5adbff32c4b6706f277fa175346261f8ede Mon Sep 17 00:00:00 2001 From: Shy Date: Mon, 6 May 2024 18:43:03 +0200 Subject: [PATCH 18/31] More beautiful #mapnote --- static/c4.css | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/static/c4.css b/static/c4.css index cb49d2d..962e63e 100644 --- a/static/c4.css +++ b/static/c4.css @@ -9,7 +9,7 @@ h1, h1 a { #map { border: 1px solid #202020; - background: #4d4d4d; + background-color: #4d4d4d; max-width: 1440px; max-height: 50vh; aspect-ratio: 2 / 1; @@ -17,9 +17,17 @@ h1, h1 a { } #mapnote { - background: #202020; - border: 1px solid #000; - border-top: none; + background-color: #ccc; + color: #333; + border-color: #202020; + padding: 0.25em 0.5em; + position: relative; + top: -1px; + box-shadow: 0px 6px 12px #000c; +} + +#mapnote:empty { + display: none; } .result { From f8ecf20b750b2fec4d72bf49ea48b3728025c826 Mon Sep 17 00:00:00 2001 From: Shy Date: Tue, 7 May 2024 18:38:00 +0200 Subject: [PATCH 19/31] Yellow outline around search input --- static/c4.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/c4.css b/static/c4.css index 962e63e..b80be1d 100644 --- a/static/c4.css +++ b/static/c4.css @@ -7,6 +7,10 @@ h1, h1 a { color: #dfaa37; /* C4 Yellow */ } +#search:focus { + outline: 2px solid #dfaa37; +} + #map { border: 1px solid #202020; background-color: #4d4d4d; From 7236d859ebf415143d561e58a017a54514ce04ea Mon Sep 17 00:00:00 2001 From: Shy Date: Tue, 7 May 2024 19:13:45 +0200 Subject: [PATCH 20/31] Enhance visibility of marker --- static/c4.css | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/static/c4.css b/static/c4.css index b80be1d..c5a403f 100644 --- a/static/c4.css +++ b/static/c4.css @@ -93,8 +93,9 @@ h1, h1 a { } #mapgrid { - outline: 2px solid #dfaa37; - background: #dfaa3780; + outline: 2px solid #333; + background-color: #dfaa37; + border-radius: 4px; animation: blinker 1s infinite; } From d98342bd02124b7f0f24e6b17c77e17b7c8ee86b Mon Sep 17 00:00:00 2001 From: Shy Date: Mon, 6 May 2024 17:26:31 +0200 Subject: [PATCH 21/31] Fixed colors for #mapnote --- static/c4.css | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/static/c4.css b/static/c4.css index c0ca189..d54dce4 100644 --- a/static/c4.css +++ b/static/c4.css @@ -8,12 +8,18 @@ h1, h1 a { } #map { - border: 1px solid #202020; - background: #4d4d4d; - max-width: 1440px; - max-height: 50vh; - aspect-ratio: 2 / 1; - box-shadow: 0px 6px 12px #000c; + border: 1px solid #202020; + background: #4d4d4d; + max-width: 1440px; + max-height: 50vh; + aspect-ratio: 2 / 1; + box-shadow: 0px 6px 12px #000c; +} + +#mapnote { + background: #202020; + border: 1px solid #000; + border-top: none; } .result { From 0c1a280a190157de33dd56ad417c4a1dc155cf6f Mon Sep 17 00:00:00 2001 From: Shy Date: Mon, 6 May 2024 18:43:03 +0200 Subject: [PATCH 22/31] More beautiful #mapnote --- static/c4.css | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/static/c4.css b/static/c4.css index d54dce4..0a62228 100644 --- a/static/c4.css +++ b/static/c4.css @@ -9,7 +9,7 @@ h1, h1 a { #map { border: 1px solid #202020; - background: #4d4d4d; + background-color: #4d4d4d; max-width: 1440px; max-height: 50vh; aspect-ratio: 2 / 1; @@ -17,9 +17,17 @@ h1, h1 a { } #mapnote { - background: #202020; - border: 1px solid #000; - border-top: none; + background-color: #ccc; + color: #333; + border-color: #202020; + padding: 0.25em 0.5em; + position: relative; + top: -1px; + box-shadow: 0px 6px 12px #000c; +} + +#mapnote:empty { + display: none; } .result { From bf182251ec3fca5a2854fd1a967644b5bb51f366 Mon Sep 17 00:00:00 2001 From: Shy Date: Tue, 7 May 2024 18:38:00 +0200 Subject: [PATCH 23/31] Yellow outline around search input --- static/c4.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/c4.css b/static/c4.css index 0a62228..224b6ae 100644 --- a/static/c4.css +++ b/static/c4.css @@ -7,6 +7,10 @@ h1, h1 a { color: #dfaa37; /* C4 Yellow */ } +#search:focus { + outline: 2px solid #dfaa37; +} + #map { border: 1px solid #202020; background-color: #4d4d4d; From 15d914fae3ad85cab91c4033662359ecba949603 Mon Sep 17 00:00:00 2001 From: Shy Date: Tue, 7 May 2024 19:13:45 +0200 Subject: [PATCH 24/31] Enhance visibility of marker --- static/c4.css | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/static/c4.css b/static/c4.css index 224b6ae..baa870b 100644 --- a/static/c4.css +++ b/static/c4.css @@ -108,8 +108,9 @@ h1, h1 a { } #mapgrid { - outline: 2px solid #dfaa37; - background: #dfaa3780; + outline: 2px solid #333; + background-color: #dfaa37; + border-radius: 4px; animation: blinker 1s infinite; } From 62699c90eb3ffaaedc0b6d15b4584a212a8640f4 Mon Sep 17 00:00:00 2001 From: Shy Date: Thu, 9 May 2024 03:02:42 +0200 Subject: [PATCH 25/31] Limit marker roundness on small screens --- static/c4.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/c4.css b/static/c4.css index baa870b..b9a0d3a 100644 --- a/static/c4.css +++ b/static/c4.css @@ -110,7 +110,7 @@ h1, h1 a { #mapgrid { outline: 2px solid #333; background-color: #dfaa37; - border-radius: 4px; + border-radius: min(4px, 25%); animation: blinker 1s infinite; } From 0fa4e48ff515d6d576f2f50d5ad51b22b089a001 Mon Sep 17 00:00:00 2001 From: Shy Date: Fri, 10 May 2024 14:40:36 +0200 Subject: [PATCH 26/31] Change misleading file name --- static/form.html | 2 +- static/index.html | 2 +- static/{80x80.svg => map.svg} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename static/{80x80.svg => map.svg} (100%) diff --git a/static/form.html b/static/form.html index c01f0f4..44d5c16 100644 --- a/static/form.html +++ b/static/form.html @@ -22,7 +22,7 @@ Coordinates (click on map)
- +
diff --git a/static/index.html b/static/index.html index c656402..b1d8ceb 100644 --- a/static/index.html +++ b/static/index.html @@ -17,7 +17,7 @@
- +

diff --git a/static/80x80.svg b/static/map.svg similarity index 100% rename from static/80x80.svg rename to static/map.svg From 060560d8a24e074df18b104379ff1ab87db302d5 Mon Sep 17 00:00:00 2001 From: Shy Date: Fri, 10 May 2024 14:50:22 +0200 Subject: [PATCH 27/31] Refined corridor --- static/map.svg | 937 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 662 insertions(+), 275 deletions(-) diff --git a/static/map.svg b/static/map.svg index 2478ce7..66e3ac3 100644 --- a/static/map.svg +++ b/static/map.svg @@ -7,17 +7,58 @@ viewBox="0 0 381.00001 190.50001" version="1.1" id="svg1" + inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)" + sodipodi:docname="chaoslabor.svg" xml:space="preserve" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" - xmlns:svg="http://www.w3.org/2000/svg">ABCDEFGHIJKLMNOP12345678910111213141516171819202122232425262728293031323334PlenarsaalKücheWohnzimmerWC++WCBällebadServer-raumFnordcenterKeller From e5e61fb9c4f0f045ac0eaf3fa20793e44d9d81f1 Mon Sep 17 00:00:00 2001 From: Shy Date: Fri, 10 May 2024 14:40:36 +0200 Subject: [PATCH 28/31] Change misleading file name --- static/form.html | 2 +- static/index.html | 2 +- static/{80x80.svg => map.svg} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename static/{80x80.svg => map.svg} (100%) diff --git a/static/form.html b/static/form.html index c01f0f4..44d5c16 100644 --- a/static/form.html +++ b/static/form.html @@ -22,7 +22,7 @@ Coordinates (click on map)
- +
diff --git a/static/index.html b/static/index.html index c656402..b1d8ceb 100644 --- a/static/index.html +++ b/static/index.html @@ -17,7 +17,7 @@
- +

diff --git a/static/80x80.svg b/static/map.svg similarity index 100% rename from static/80x80.svg rename to static/map.svg From 360164be7ab42b129eceefd8825b057d91c3124b Mon Sep 17 00:00:00 2001 From: Shy Date: Fri, 10 May 2024 14:50:22 +0200 Subject: [PATCH 29/31] Refined corridor --- static/map.svg | 937 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 662 insertions(+), 275 deletions(-) diff --git a/static/map.svg b/static/map.svg index 2478ce7..66e3ac3 100644 --- a/static/map.svg +++ b/static/map.svg @@ -7,17 +7,58 @@ viewBox="0 0 381.00001 190.50001" version="1.1" id="svg1" + inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)" + sodipodi:docname="chaoslabor.svg" xml:space="preserve" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" - xmlns:svg="http://www.w3.org/2000/svg">ABCDEFGHIJKLMNOP12345678910111213141516171819202122232425262728293031323334PlenarsaalKücheWohnzimmerWC++WCBällebadServer-raumFnordcenterKeller From c2334642fb9fce2cccc072d91d47e82ee626173e Mon Sep 17 00:00:00 2001 From: Shy Date: Thu, 16 May 2024 22:07:04 +0200 Subject: [PATCH 30/31] Added item counter. --- static/c4.css | 10 ++++++++-- static/index.html | 1 + static/index.js | 39 +++++++++++++++++++++++++++++++++++---- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/static/c4.css b/static/c4.css index b9a0d3a..abeae82 100644 --- a/static/c4.css +++ b/static/c4.css @@ -7,8 +7,9 @@ h1, h1 a { color: #dfaa37; /* C4 Yellow */ } -#search:focus { - outline: 2px solid #dfaa37; +#search.failed { + color: #200; + background-color: #ec6d5f; } #map { @@ -34,6 +35,11 @@ h1, h1 a { display: none; } +#itemcount { + display: inline-block; + margin-right: 1ch; +} + .result { background-color: #202020; border-color: #4d4d4d; diff --git a/static/index.html b/static/index.html index b1d8ceb..07dceb7 100644 --- a/static/index.html +++ b/static/index.html @@ -12,6 +12,7 @@
+

diff --git a/static/index.js b/static/index.js index 2d7b1aa..f7bb046 100644 --- a/static/index.js +++ b/static/index.js @@ -17,6 +17,7 @@ function renderItems() { const container = document.getElementById('results'); const template = document.getElementById('item'); const loading = document.getElementById('loading'); + let count = 0; for (const [id, item] of Object.entries(items)) { const clone = template.content.cloneNode(true); @@ -31,11 +32,14 @@ function renderItems() { clone.querySelector(".result").id = `item-${id}`; clone.querySelector("a").href = `form.html?id=${encodeURIComponent(id)}`; if (item.hidden) { - clone.querySelector(".result").classList.add('hidden') - }; + clone.querySelector(".result").classList.add('hidden'); + } else { + count++; + } container.appendChild(clone); - }; + } loading.remove(); + updateCounter(count); } function getLocString(items, item) { @@ -67,6 +71,7 @@ function search(e) { const searchAttrs = ['id', 'name', 'type', 'note', 'content']; const query = e.target.value; const regex = new RegExp(query, 'i') + let count = 0; for (const elem of document.getElementsByClassName('result')) { const item = items[elem.id.slice(5)]; @@ -85,10 +90,36 @@ function search(e) { if (found) { elem.classList.remove('filtered'); + count++; } else { elem.classList.add('filtered'); } } + + // Indicate failed search. + if (count) { + e.target.classList.remove('failed'); + } else { + e.target.classList.add('failed'); + } + + updateCounter(count); +} + +function updateCounter(count) { + const itemcount = document.getElementById('itemcount'); + + switch(count) { + case 0: + itemcount.textContent = 'No items found.'; + break; + case 1: + itemcount.textContent = '1 item found.'; + break; + default: + itemcount.textContent = `${count} items found.`; + break; + } } function showhidden(e){ @@ -118,4 +149,4 @@ function showItem(e) { function hideItem(e) { clearMap(); -} \ No newline at end of file +} From 45c1d0f9cc5cd039e7fcf3dc4a93c9bd0420d879 Mon Sep 17 00:00:00 2001 From: Shy Date: Thu, 16 May 2024 22:09:54 +0200 Subject: [PATCH 31/31] Converted text to path --- static/map.svg | 912 +++++++++++++++---------------------------------- 1 file changed, 266 insertions(+), 646 deletions(-) diff --git a/static/map.svg b/static/map.svg index 66e3ac3..4210fd9 100644 --- a/static/map.svg +++ b/static/map.svg @@ -7,58 +7,17 @@ viewBox="0 0 381.00001 190.50001" version="1.1" id="svg1" - inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)" - sodipodi:docname="chaoslabor.svg" xml:space="preserve" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" - xmlns:svg="http://www.w3.org/2000/svg">ABCDEFGHIJKLMNOP12345678910111213141516171819202122232425262728293031323334PlenarsaalKücheWohnzimmerWC++WCBällebadServer-raumFnordcenterKeller