aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2026-05-01 14:38:22 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2026-05-01 14:38:22 +0200
commit96eb6fe00126f0946a7fa952c267ffc8ddb03fe8 (patch)
treeca2d27166c0aefeb6ca31d91d8401bc04ddaf316
parenta9b65defc975675c6146b80f6b7b54d22fda82ad (diff)
downloadunterricht-96eb6fe00126f0946a7fa952c267ffc8ddb03fe8.tar.gz
unterricht-96eb6fe00126f0946a7fa952c267ffc8ddb03fe8.zip
generalize loading of Online-IDE logins
Find the Online-IDE Logins from the course index.
-rw-r--r--Info/9/3/Planet/modellierung/landung/online-ide.md54
1 files changed, 38 insertions, 16 deletions
diff --git a/Info/9/3/Planet/modellierung/landung/online-ide.md b/Info/9/3/Planet/modellierung/landung/online-ide.md
index e94e77fa..f98c74cf 100644
--- a/Info/9/3/Planet/modellierung/landung/online-ide.md
+++ b/Info/9/3/Planet/modellierung/landung/online-ide.md
@@ -14,28 +14,48 @@ include-after: |
console.error('Error fetching JSON:', error);
}
}
+
+ const findInMenu = (selector, keywords) => {
+ // Sucht in allen Links der Seite nach den Modulen
+ const links = Array.from(document.querySelectorAll(`a[href*="${selector}"]`));
+ const match = links.find(a => keywords.some(k => a.innerText.toLowerCase().includes(k.toLowerCase())));
+ return match ? match.href : (links.length > 0 ? links[0].href : null);
+ };
// Get the user's firstname via the moodle generico filter
const firstname = "{firstname}";
const lastname = "{lastname}";
-
- const resource = 90441121;
- // Moodle some insists in wrapping urls in <a> tags breaking the JS code.
- // We use a base64 encoding for the url: https://lernplattform.bycs.de/mod/resource/view.php?id=
- const resourceUrl = "aHR0cHM6Ly9sZXJucGxhdHRmb3JtLmJ5Y3MuZGUvbW9kL3Jlc291cmNlL3ZpZXcucGhwP2lkPQo=";
- const url = window.atob(resourceUrl) + resource;
-
- fetchJson(url).then((logins) => {
- if (logins) {
- for (const user of logins) {
- if (!(user.Name.includes("{firstname}") && user.Name.includes("{lastname}")))
- continue;
-
- let loginDiv = document.querySelector(".oide-login");
- loginDiv.innerHTML = `Benutzername: ${user.Benutzername}<br>Passwort: ${user.Passwort}`;
+ let loginsUrl = null;
+
+ function fetchLogin() {
+ fetchJson(loginsUrl).then((logins) => {
+ if (logins) {
+ for (const user of logins) {
+ if (!(user.Name.includes("{firstname}") && user.Name.includes("{lastname}")))
+ continue;
+
+ let loginDiv = document.querySelector(".oide-login");
+ loginDiv.innerHTML = `Benutzername: ${user.Benutzername}<br>Passwort: ${user.Passwort}`;
+ }
}
+ });
+ }
+
+ const sleep = ms => new Promise(r => setTimeout(r, ms));
+ async function updateLogin() {
+ for(let i = 0; i < 10; i++) {
+ loginsUrl = findInMenu("/mod/resource/", ["Online-IDE Logins"]);
+ if (loginsUrl) {
+ fetchLogin();
+ break;
+ }
+ await sleep(500);
}
- });
+ }
+
+ window.addEventListener('load', function() {
+ updateLogin();
+ })
</script>
---
@@ -50,6 +70,8 @@ Rufe die Seite auf und melde dich an.
Die YASA hat dir einen Zugang für die Online-IDE angelegt.
::::{.oide-login}
+Benutzername: UNBEKANNT
+Passwort: BITTE_FRAG_NACH
::::
Bitte ändere dein Passwort per Klick auf die kleine Figur neben deinem Namen im <span style="border: solid 1px #00B2FF">Controls-Fenster</span> und notiere dir deine Login-Informationen!