diff --git a/imgs/xp-bar-bg.png b/imgs/xp-bar-bg.png new file mode 100644 index 0000000..ae66ea5 Binary files /dev/null and b/imgs/xp-bar-bg.png differ diff --git a/imgs/xp-bar-fg.png b/imgs/xp-bar-fg.png new file mode 100644 index 0000000..338ff0f Binary files /dev/null and b/imgs/xp-bar-fg.png differ diff --git a/lib/basic.css b/lib/basic.css index df60261..5a779c1 100644 --- a/lib/basic.css +++ b/lib/basic.css @@ -65,6 +65,20 @@ button { font-weight: normal; } +.mc-xp-bar { + width: 100%; + height: 20px; + background-image: url("../imgs/xp-bar-bg.png"); + background-size: 100% 20px; +} +.mc-xp-bar > div { + width: 100%; + height: 20px; + background-image: url("../imgs/xp-bar-fg.png"); + background-size: 100% 20px; + clip-path: inset(0 100% 0 0); +} + /* ----------- overlay ----------- */ overlay { diff --git a/lib/basic.js b/lib/basic.js index 5ab917e..838ea2e 100644 --- a/lib/basic.js +++ b/lib/basic.js @@ -507,14 +507,21 @@ Rolle: function _showProfile(user) { let elm = getId("profile_overlay"); - const hasProfilAbility = user.enabled_abilities.includes("profile_pic"); + const features = user.enabled_abilities ??= []; + const hasProfilAbility = features.includes("profile_pic"); const avatarInp = elm.querySelector(".avatar-inp"); + const profilePic = elm.querySelector(".profile-pic"); if (hasProfilAbility) { - elm.querySelector(".profile-pic").style.setProperty("background-image", `url('${user.avatar}')`); + profilePic.style.setProperty("background-image", `url('${user.avatar}')`); elm.querySelector("input").setAttribute("value", user.avatar); avatarInp.style.display = "unset"; } else { + if (features.includes("pink_mode")) { + profilePic.style.setProperty("background-image", `url("https://static.turtle-coding-gbr.de/gmci/rosa_profil.png")`); + } else { + profilePic.style.setProperty("background-image", `url("https://static.turtle-coding-gbr.de/gmci/standart_profil.png")`); + } avatarInp.style.display = "none"; } elm.querySelector("u").innerText = getUserDisplayName(user); @@ -594,4 +601,13 @@ async function levelUpXP(couchDB, user = userData, xp = 1) { await updateUserData(couchDB, user); return resLevelUp; +} + +function setXPBarPercent(percent) { + percent = 100 - percent; + const elms = document.querySelectorAll(".mc-xp-bar"); + for (var elm of elms) { + const div = elm.querySelector("div"); + div.style.setProperty('clip-path', `inset(0 ${percent}% 0 0)`); + } } \ No newline at end of file diff --git a/prof/auswertung.html b/prof/auswertung.html index 1c13a5b..2919fbd 100644 --- a/prof/auswertung.html +++ b/prof/auswertung.html @@ -87,6 +87,9 @@ button.navigation:hover { background-color: var(--accent_color_bg_o); border-radius: var(--border-radius); } +#umfrage_list { + width: 100%; +} #umfrage_list > div { padding: 10px; border: 2px solid var(--accent_color_bg); diff --git a/student/kursAnzeige.html b/student/kursAnzeige.html index a700279..d71ea24 100644 --- a/student/kursAnzeige.html +++ b/student/kursAnzeige.html @@ -11,6 +11,7 @@ + Kurs Anzeige diff --git a/student/uebersicht.html b/student/uebersicht.html index 0526651..4bcb5db 100644 --- a/student/uebersicht.html +++ b/student/uebersicht.html @@ -1,364 +1,324 @@ - - - - - - - - - - Übersicht + + + + + + + + +Übersicht -
-
- Meine Kurse -
-
+ - const couchDB = new CouchDB(); - setUserData(couchDB).then((val) => { - setCourseView(); - setLevelProgress(userData.xp); - setLevel(userData.level); - }); +
+
Meine Kurse
+
+
+ +
+
+
- async function startSurvey() { - const code = getOverlay("survey").getElementsByTagName("INPUT")[0].value.trim(); - console.log(code); - var course = await couchDB.get("course:" + code); - if (course != undefined) { - const users = await couchDB.get("users"); - users[userData.name].courses ??= []; - if (!users[userData.name].courses.includes(code)) { - users[userData.name].courses.push(code); - } - await couchDB.set("users", users); - location.href = "./umfrage.html?user=" + userData.name + ",course=" + code; - } else { - alert("Umfrage nicht gefunden!"); - } - } +
- async function setCourseView() { - const courseList = document.getElementById("courses-list"); - courseList.innerHTML = ""; +
+
+
+
Level 5
+
+
+
+
+
+ + +
+
- for (const courseId of userData.courses) { - const course = await couchDB.get("course:" + courseId); + + +
+ +
+ +
+
- const card = document.createElement("div"); - card.className = "course-card"; - card.addEventListener("click", (e) => { - if (e.target.closest("button")) return; - location.href = "./kursAnzeige.html?user=" + userData.name + ",course=" + courseId; - }); + +
+ +
+ +
+
- const surveyUrl = - card.innerHTML = ` -
${course.title}
+ +function newCourse() { + showOverlay("add-course"); +} - +function addCourseToList(courseName) { + const coursesList = document.getElementById("courses-list"); + const courseDiv = document.createElement("div"); + courseDiv.className = "course-item"; + courseDiv.innerHTML = ` + ${courseName} + + `; + coursesList.appendChild(courseDiv); +} + - \ No newline at end of file + + diff --git a/student/uebersicht_overlay.js b/student/uebersicht_overlay.js index 6b101f8..87d12bf 100644 --- a/student/uebersicht_overlay.js +++ b/student/uebersicht_overlay.js @@ -133,6 +133,8 @@ border-radius: var(--border-radius); span.innerHTML = `
${answers}
`; + span.style.justifyContent = "top"; + span.style.setProperty("justify-content", "start"); } }