From 17cb302fca4fce7ab3210a7957b2c4974df00ed7 Mon Sep 17 00:00:00 2001 From: ocean <47253870+banocean@users.noreply.github.com> Date: Thu, 12 Jun 2025 17:00:19 +0200 Subject: [PATCH 1/2] add patch --- patches.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/patches.json b/patches.json index 31c158e..665d3c7 100644 --- a/patches.json +++ b/patches.json @@ -353,5 +353,14 @@ "css": ["patchesSettings/style.css"] }, "allowedHostsCss": ["uczen.eduvulcan.pl", "dziennik-uczen.vulcan.net.pl", "wiadomosci.eduvulcan.pl", "dziennik-wiadomosci.vulcan.net.pl"] + }, + { + "name": "Excuse all button", + "description": "Adds option to select all the attendance to excuse with one click", + "files": { + "js": ["excuseAll/index.js"], + "css": ["excuseAll/styles.css"] + }, + "allowedHostsCss": ["uczen.eduvulcan.pl", "dziennik-uczen.vulcan.net.pl"] } ] \ No newline at end of file From de15675ee2cff88a866db7c4974cae99868f0394 Mon Sep 17 00:00:00 2001 From: ocean <47253870+banocean@users.noreply.github.com> Date: Thu, 12 Jun 2025 17:00:27 +0200 Subject: [PATCH 2/2] implementation --- patches/excuseAll/index.js | 45 ++++++++++++++++++++++++++++++++++++ patches/excuseAll/styles.css | 11 +++++++++ 2 files changed, 56 insertions(+) create mode 100644 patches/excuseAll/index.js create mode 100644 patches/excuseAll/styles.css diff --git a/patches/excuseAll/index.js b/patches/excuseAll/index.js new file mode 100644 index 0000000..f237c19 --- /dev/null +++ b/patches/excuseAll/index.js @@ -0,0 +1,45 @@ +const run = () => { + const observer = new MutationObserver(() => { + const modalBody = document.querySelector(".modal__horizontal__group") + if (!modalBody || modalBody.querySelector(".excuse-all")) return + + const element = document.createElement("label"); + element.classList.add("excuse-all"); + element.innerHTML = ` + + + + + + + + + Usprawiedliw wszystko + ` + + element.querySelector("input").addEventListener("change", () => { + const isEnabled = element.querySelector("input").checked; + document.querySelectorAll("input[aria-label=\"Usprawiedliw\"]") + .forEach((i) => { + if(i.checked !== isEnabled) i.click() + }) + }) + + modalBody.insertBefore(element, modalBody.firstChild) + }) + + observer.observe(document.body, { + childList: true + }) +} + + +window.appendModule({ + onlyOnReloads: true, + run: run, + doesRunHere: () => window.location.href.includes("frekwencja") +}); \ No newline at end of file diff --git a/patches/excuseAll/styles.css b/patches/excuseAll/styles.css new file mode 100644 index 0000000..3ec36c0 --- /dev/null +++ b/patches/excuseAll/styles.css @@ -0,0 +1,11 @@ +.excuse-all:has(input:checked) .unchecked { + display: none; +} + +.excuse-all:has(input:not(:checked)) .checked { + display: none; +} + +.excuse-all .checked { + fill: rgb(225, 45, 57); +} \ No newline at end of file