From 800ab0d9b7a3cacf35181b111a787e5aa936ba2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20M=C3=BCller?= Date: Thu, 7 Oct 2021 10:04:32 +0200 Subject: [PATCH] V1 complete --- index.html | 34 +++++++++++++++++++++++++++++----- scripts.js | 44 +++++++++++++++++++++++++++++++++++++------- styles.css | 6 ++++++ 3 files changed, 72 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index c90d37f..fc6eba8 100644 --- a/index.html +++ b/index.html @@ -16,19 +16,43 @@ the middleware might not work as expected.


- + +
+



diff --git a/scripts.js b/scripts.js index 22de6a6..e5450b6 100644 --- a/scripts.js +++ b/scripts.js @@ -7,16 +7,46 @@ $(document).ready(function () { }); function generateLink() { - let link = 'abc'; - let providedRaPlaLink = $('#raplalink').val().toString(); + let selectedCourseFromPicker = $('#coursename').val().toString(); - console.log(providedRaPlaLink); + let raplaUser = ''; + let raplaFile = ''; - const urlParams = new URLSearchParams(providedRaPlaLink); + if (selectedCourseFromPicker === '-1') { + let providedRaPlaLink = $('#raplalink').val().toString(); + const url = new URL(providedRaPlaLink); + raplaUser = url.searchParams.get('user'); + raplaFile = url.searchParams.get('file'); + } else { + let courseInfo = courseLinks[selectedCourseFromPicker]; + raplaUser = courseInfo.user; + raplaFile = courseInfo.file; + } - console.log(urlParams.keys()); + let showBlockers = $('#hideBlockers').is(':checked') ? 0 : 1; + let selectedElectiveModule = $('#wahlmodul').val().toString(); + let selectedProfileModule = $('#profilmodul').val().toString(); - console.log(urlParams.get('b')); + let base_url = 'https://api.plutodev.de/rapla-middleware' - $('#full-link').text(link); + base_url += '?user=' + raplaUser; + base_url += '&file=' + raplaFile; + base_url += '&blockers=' + showBlockers; + base_url += '&wahl=' + selectedElectiveModule; + base_url += '&pflicht=' + selectedProfileModule; + + $('#full-link').text(base_url); +} + +let courseLinks = { + 'TINF19B1': {user: 'freudenmann', file: 'TINF19B1'}, + 'TINF19B2': {user: 'braun', file: 'TINF19B2'}, + 'TINF19B3': {user: 'vollmer', file: 'tinf19b3'}, + 'TINF19B4': {user: 'eisenbiegler', file: 'TINF19B4'}, + 'TINF19B5': {user: 'strand', file: 'TINF19B5'}, + 'TINF20B1': {user: 'freudenmann', file: 'TINF20B1'}, + 'TINF20B2': {user: 'braun', file: 'TINF20B2'}, + 'TINF20B3': {user: 'vollmer', file: 'tinf20b3'}, + 'TINF20B4': {user: 'eisenbiegler', file: 'TINF20B4'}, + 'TINF20B5': {user: 'strand', file: 'TINF20B5'} } diff --git a/styles.css b/styles.css index e69de29..56dca9c 100644 --- a/styles.css +++ b/styles.css @@ -0,0 +1,6 @@ +html, +body { + height: 100%; + background-color: #191718; + color: #E0E5E9; +}