Skip to content

Commit

Permalink
Merge branch 'jxn-30-main'
Browse files Browse the repository at this point in the history
  • Loading branch information
YorikHansen committed Apr 21, 2024
2 parents 68b49d4 + 0e16bf4 commit 2e9e7c6
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.28.1"
".": "1.28.2"
}
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## [1.28.1](https://github.com/YorikHansen/better-moodle/compare/1.28.0...1.28.1) (2024-04-21)

* **semesterzeiten:** allow to click through all available semesters [#112](https://github.com/jxn-30/better-moodle/issues/112) ([d233bff](https://github.com/YorikHansen/better-moodle/commit/d233bfff2a1d2e3e91843346e261c509dc4961f3))

### Bug Fixes

* **semesterzeiten:** fix visibility of progress bar of current semester ([3d0b089](https://github.com/jxn-30/better-moodle/commit/3d0b08908bfbcbb11a643ac6da4a3f54a4328af0))


## [1.28.0](https://github.com/YorikHansen/better-moodle/compare/1.27.3...1.28.0) (2024-04-20)

### Features
Expand All @@ -20,6 +29,7 @@
* **settings:** Add transparency to disabled slider settings ([#144](https://github.com/jxn-30/better-moodle/issues/144)) ([c4568ab](https://github.com/YorikHansen/better-moodle/commit/c4568ab97b62418d30727c9002048a2eb7c71f9d))
* **settings:** fix initial disabled state of settings being wrong when dependent of select ([70d4eb6](https://github.com/YorikHansen/better-moodle/commit/70d4eb62f5f9b954e58837dc0323a984e396e100))


## [1.27.2](https://github.com/YorikHansen/better-moodle/compare/1.27.1...1.27.2) (2024-04-19)

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "uzl-better-moodle",
"description": "Improves the new weird Moodle 4 UI on UzL-Moodle",
"version": "1.28.1",
"version": "1.28.2",
"packageManager": "[email protected]",
"type": "module",
"private": true,
Expand Down
53 changes: 46 additions & 7 deletions redesign.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @name 🎓️ CAU: better-moodle
// @namespace https://better-moodle.yorik.dev
// @ x-release-please-start-version
// @version 1.28.0
// @version 1.28.1
// @ x-release-please-end
// @author Jan (jxn_30), Yorik (YorikHansen)
// @description:de Verbessert dieses seltsame Design, das Moodle 4 mit sich bringt
Expand Down Expand Up @@ -3181,6 +3181,26 @@ ${Array.from(shownBars)
.join(',')} {
display: flex;
}
`);

const nowAdditionsClass = PREFIX('semesterzeiten-now-additions');
GM_addStyle(`
.${nowAdditionsClass}.progress-bar {
position: absolute;
height: 1rem;
pointer-events: none;
background-image: linear-gradient(45deg,rgba(255,255,255,.3) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.3) 50%,rgba(255,255,255,.3) 75%,transparent 75%,transparent);
border-right: 1px solid black;
}
${DARK_MODE_SELECTOR} .${nowAdditionsClass}.progress-bar {
border-color: white;
}

span.${nowAdditionsClass} {
position: absolute;
transform: translateX(-50%) translateY(-100%);
font-size: .703125rem;
}
`);

ready(() =>
Expand Down Expand Up @@ -3496,7 +3516,7 @@ ${Array.from(shownBars)
topBar.classList.add('d-flex', 'align-items-center');

const progressWrapper = document.createElement('div');
progressWrapper.classList.add('progress', 'w-100');
progressWrapper.classList.add('progress', 'w-100', 'position-relative');
progressWrapper.id = PREFIX('general-semesterzeiten-progress');

const infoLink = document.createElement('a');
Expand Down Expand Up @@ -3661,11 +3681,6 @@ ${Array.from(shownBars)

let title = '';

if (date >= now) {
// Why was there an isCurrentSemester check?
bar.style.setProperty('opacity', '0.25');
}

progressWrapper.append(bar);

// no bar => full height with transparency
Expand Down Expand Up @@ -3700,6 +3715,30 @@ ${Array.from(shownBars)
topBar.append(infoLink, progressWrapper);
semesterDiv.append(topBar, additionalTable);
cardContent.append(semesterDiv);

if (isCurrentSemester) {
const nowPercentage =
((now - semesterStart) / semesterDuration) * 100;
const nowBar = document.createElement('div');
nowBar.classList.add(
'progress-bar',
'bg-transparent',
'progress-bar-striped',
nowAdditionsClass
);
nowBar.style.setProperty('width', `${nowPercentage}%`);

const todaySpan = document.createElement('span');
todaySpan.classList.add(nowAdditionsClass);
todaySpan.textContent = dateToString(now);
todaySpan.style.setProperty(
'margin-left',
`calc(${nowPercentage}% + 16px + .5rem)`
);

progressWrapper.prepend(nowBar);
progressWrapper.before(todaySpan);
}
};

getSemesterzeiten().then(({ recurringHolidays, semesters }) => {
Expand Down

0 comments on commit 2e9e7c6

Please sign in to comment.