Skip to content

Commit

Permalink
3.11.7
Browse files Browse the repository at this point in the history
  • Loading branch information
QkeleQ10 committed Jun 21, 2024
1 parent c80f207 commit 0ac499c
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 24 deletions.
2 changes: 1 addition & 1 deletion manifest-firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"manifest_version": 3,
"name": "__MSG_appName__",
"description": "__MSG_appDesc__",
"version": "3.11.6",
"version": "3.11.7",
"default_locale": "nl",
"icons": {
"16": "icons/[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"manifest_version": 3,
"name": "__MSG_appName__",
"description": "__MSG_appDesc__",
"version": "3.11.6",
"version": "3.11.7",
"default_locale": "nl",
"icons": {
"16": "icons/[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let apiUserId,
apiUserTokenDate

const settingsToClear = [
'auto-theme', 'theme-fixed', 'theme-day', 'theme-night', 'openedPopup', 'updates', 'beta', 'magister-shortcuts', 'magister-shortcuts-today', 'magister-sw-grid', 'magister-sw-sort', 'magister-sw-period', 'magister-sw-display', 'magister-ag-large', 'magister-subjects', 'magister-appbar-hidePicture', 'appbar-hide-actions', 'magister-appbar-zermelo', 'magister-appbar-zermelo-url', 'magister-css-border-radius', 'magister-css-dark-invert', 'magister-css-experimental', 'magister-css-hue', 'magister-css-luminance', 'magister-css-saturation', 'magister-css-theme', 'magister-op-oldgrey', 'magister-periods', 'periods', 'magister-shortcut-keys', 'magister-shortcut-keys-master', 'magister-shortcut-keys-today', 'magister-subjects', 'magister-sw-thisWeek', 'magister-vd-overhaul', 'magister-vd-enabled', 'magister-vd-subjects', 'magister-vd-grade', 'magister-vd-agendaHeight', 'magister-vd-deblue', 'magister-vd-gradewidget', 'magisterLogin-password', 'magisterLogin-method', 'magister-gamification-beta', 'gamification-enabled', 'magister-cf-calculator', 'magister-cf-statistics', 'magister-cf-backup', 'magister-cf-failred', 'notes-enabled', 'notes', 'st-notes', 'vd-enabled', 'vd-schedule-days', 'vd-schedule-extra-day', 'vd-schedule-zoom', 'vd-subjects-display', 'start-stats', 'teacher-names', 'version', 'disable-css', 'hotkeys-today', 'start-widgets', 'dark-image', 'light-image', 'subjects', 'hidden-studyguides', 'color', 'start-schedule-days'
'auto-theme', 'theme-fixed', 'theme-day', 'theme-night', 'openedPopup', 'updates', 'beta', 'magister-shortcuts', 'magister-shortcuts-today', 'magister-sw-grid', 'magister-sw-sort', 'magister-sw-period', 'magister-sw-display', 'magister-ag-large', 'magister-subjects', 'magister-appbar-hidePicture', 'appbar-hide-actions', 'magister-appbar-zermelo', 'magister-appbar-zermelo-url', 'magister-css-border-radius', 'magister-css-dark-invert', 'magister-css-experimental', 'magister-css-hue', 'magister-css-luminance', 'magister-css-saturation', 'magister-css-theme', 'magister-op-oldgrey', 'magister-periods', 'periods', 'magister-shortcut-keys', 'magister-shortcut-keys-master', 'magister-shortcut-keys-today', 'magister-subjects', 'magister-sw-thisWeek', 'magister-vd-overhaul', 'magister-vd-enabled', 'magister-vd-subjects', 'magister-vd-grade', 'magister-vd-agendaHeight', 'magister-vd-deblue', 'magister-vd-gradewidget', 'magisterLogin-password', 'magisterLogin-method', 'magister-gamification-beta', 'gamification-enabled', 'magister-cf-calculator', 'magister-cf-statistics', 'magister-cf-backup', 'magister-cf-failred', 'notes-enabled', 'notes', 'st-notes', 'vd-enabled', 'vd-schedule-days', 'vd-schedule-extra-day', 'vd-schedule-zoom', 'vd-subjects-display', 'start-stats', 'teacher-names', 'version', 'disable-css', 'hotkeys-today', 'start-widgets', 'dark-image', 'light-image', 'subjects', 'hidden-studyguides', 'color', 'start-schedule-days', 'v', 'special'
]

startListenCredentials()
Expand Down
16 changes: 9 additions & 7 deletions src/magister/scripts/gamification.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ async function commenceWrapped(isFinalYearStudent) {

wrappedDialog.showModal()

if (wrappedPage === 0) {
wrappedDialog.scrollLeft = 0
}

lastAccessYear = now.getFullYear()
saveToStorage('wrapped-accessed', lastAccessYear, 'local')

Expand All @@ -96,8 +100,6 @@ async function constructWrapped(lastYearOnly) {
}

for (let i = 0; i < years.length; i++) {
const year = years[i]

const newElement = await constructWrappedForYear(i)
yearsWrapper.append(newElement)
}
Expand Down Expand Up @@ -320,14 +322,14 @@ async function constructWrapped(lastYearOnly) {

if (kwtLessons.length > 0) {
const card3 = element('div', null, null, { class: 'st-wrapped-card', style: 'grid-row: span 4;', 'data-icon': '' })
element('span', null, card3, { class: 'st-w-text', innerText: `Je volgde ${kwtLessonsSignedUp.length} keuzeblokken.` })
element('span', null, card3, { class: 'st-w-text', innerText: `Je volgde ${kwtLessonsSignedUp?.length} keuzeblokken.` })
let kwtSubjectHashmap = {}
kwtLessonsSignedUp.map(event => event.Omschrijving).forEach(description => {
kwtLessonsSignedUp?.map(event => event.Omschrijving)?.forEach(description => {
kwtSubjectHashmap[description] ??= 0
kwtSubjectHashmap[description]++
})
const mostCommonKwtSubject = (Object.entries(kwtSubjectHashmap).sort((a, b) => b[1] - a[1])?.[0])
element('span', null, card3, { class: 'st-w-text-small', innerText: `Daarvan koos je ${mostCommonKwtSubject[1]}× voor ${mostCommonKwtSubject[0]}.` })
}) || []
const mostCommonKwtSubject = (Object.entries(kwtSubjectHashmap)?.sort((a, b) => b[1] - a[1])?.[0])
if (mostCommonKwtSubject) element('span', null, card3, { class: 'st-w-text-small', innerText: `Daarvan koos je ${mostCommonKwtSubject?.[1]}× voor ${mostCommonKwtSubject?.[0]}.` })
if (kwtLessons.some(event => event.Omschrijving.includes('amablok') || event.Omschrijving.includes('ama_'))) {
element('span', null, card3, { class: 'st-w-text-small', innerText: `Je volgde ${kwtLessonsSignedUp.filter(event => event.Omschrijving.includes('ama_')).length} van de ${kwtLessons.filter(event => event.Omschrijving.includes('amablok') || event.Omschrijving.includes('ama_')).length} Amadeusblokken.` })
card3.style.gridRow = 'span 5'
Expand Down
2 changes: 1 addition & 1 deletion src/magister/scripts/grades.js
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ async function gradeStatistics() {
let yearsText = [...includedYears]
.sort((idA, idB) => new Date(years.find(y => y.id === idA).begin) - new Date(years.find(y => y.id === idB).begin))
.map(id => years.find(y => y.id === id).studie.code).join(', ')
if (includedYears.size === 1 && includedYears.has(years.at(-1).id)) yearsText = `Dit leerjaar (${years.at(0)?.studie?.code})`
if (includedYears.size === 1 && includedYears.has(years.at(-1).id)) yearsText = `Dit leerjaar (${years.at(-1)?.studie?.code})`
if (includedYears.size === years.length) yearsText = `Alle ${years.length} leerjaren (${years.at(-1)?.studie?.code} t/m ${years.at(0)?.studie?.code})`

let subjectsText = includedSubjects.join(', ')
Expand Down
11 changes: 10 additions & 1 deletion src/magister/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ chrome.runtime.sendMessage({ action: 'popstateDetected' }) // Revive the service
// Run when the extension and page are loaded
main()
async function main() {
if((await getFromStorage('sampleApiData', 'session')) === 'true') MagisterApi.useSampleData = true
if ((await getFromStorage('sampleApiData', 'session')) === 'true') MagisterApi.useSampleData = true

const todayDate = new Date(new Date().setHours(0, 0, 0, 0))

Expand Down Expand Up @@ -75,6 +75,15 @@ async function main() {
if (Math.random() < 0.008) /* 0,8% */ setTimeout(() => document.querySelector('.logo-expanded').setAttribute('src', 'https://raw.githubusercontent.com/QkeleQ10/http-resources/main/study-tools/logo_mogister.svg'), 2000)
if (Math.random() < 0.010) /* 1,0% */ notify('snackbar', "Bedankt voor het gebruiken van Study Tools 💚")
if (Math.random() < 0.0002) /* 0,02% */ notify('snackbar', "Dit is zeldzaam. En niemand zal je geloven. Groetjes, Quinten")
if (Math.random() < 0.004) setTimeout(() => {
const amogus = element('img', 'st-amogus', document.body, {
src: 'https://static.wikia.nocookie.net/fnaf-tower-defense/images/7/77/Among-us-red-png-01.png', style: `position: absolute; bottom: 0; left: 20px; height: 32px; animation: 1000ms peekInLeft;`
})
amogus.addEventListener('click', () => {
var audio = new Audio('https://www.myinstants.com/media/sounds/among-us-roundstart.mp3')
audio.play()
})
}, 2000)

// Birthday party mode!
const accountInfo = await MagisterApi.accountInfo(),
Expand Down
6 changes: 4 additions & 2 deletions src/magister/scripts/today.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,9 @@ async function today() {

const events = await MagisterApi.events()

const eventsTeachers = events.flatMap(item => item.Docenten).filter((value, index, self) =>
if(!events) return

const eventsTeachers = events?.flatMap(item => item.Docenten).filter((value, index, self) =>
index === self.findIndex((t) => (
t.Docentcode === value.Docentcode
))
Expand Down Expand Up @@ -1161,7 +1163,7 @@ async function today() {
.catch(() => { return reject() })
}

const todaysEvents = events.filter(item => new Date(item.Start).isToday() && item.Omschrijving != 'amablok_bb')
const todaysEvents = events?.filter(item => new Date(item.Start).isToday() && item.Omschrijving != 'amablok_bb') || []
if (!todaysEvents?.length > 0) return
const progressWrapper = element('div', 'st-start-widget-digital-clock-wrapper', widgetElement)

Expand Down
15 changes: 6 additions & 9 deletions src/magister/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@
inherits: true;
}

:root {
--st-linear-gradient-study-tools: linear-gradient(300deg, hsl(209, 40%, 29%), hsl(209, 36%, 30%));
}

body,
div.loading-overlay {
background: var(--st-background-primary) !important
}

.st-overlay[open] {
width: 100%;
height: 100%;
Expand Down Expand Up @@ -1435,6 +1426,12 @@ a.st-keyboard-hint.clicked {
}
}

@keyframes peekInLeft {
from {
left: -100%;
}
}

@keyframes shrinkOut {
to {
opacity: 0;
Expand Down
2 changes: 1 addition & 1 deletion src/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let userId,
userTokenDate

const settingsToClear = [
'auto-theme', 'theme-fixed', 'theme-day', 'theme-night', 'openedPopup', 'updates', 'beta', 'magister-shortcuts', 'magister-shortcuts-today', 'magister-sw-grid', 'magister-sw-sort', 'magister-sw-period', 'magister-sw-display', 'magister-ag-large', 'magister-subjects', 'magister-appbar-hidePicture', 'appbar-hide-actions', 'magister-appbar-zermelo', 'magister-appbar-zermelo-url', 'magister-css-border-radius', 'magister-css-dark-invert', 'magister-css-experimental', 'magister-css-hue', 'magister-css-luminance', 'magister-css-saturation', 'magister-css-theme', 'magister-op-oldgrey', 'magister-periods', 'periods', 'magister-shortcut-keys', 'magister-shortcut-keys-master', 'magister-shortcut-keys-today', 'magister-subjects', 'magister-sw-thisWeek', 'magister-vd-overhaul', 'magister-vd-enabled', 'magister-vd-subjects', 'magister-vd-grade', 'magister-vd-agendaHeight', 'magister-vd-deblue', 'magister-vd-gradewidget', 'magisterLogin-password', 'magisterLogin-method', 'magister-gamification-beta', 'gamification-enabled', 'magister-cf-calculator', 'magister-cf-statistics', 'magister-cf-backup', 'magister-cf-failred', 'notes-enabled', 'notes', 'st-notes', 'vd-enabled', 'vd-schedule-days', 'vd-schedule-extra-day', 'vd-schedule-zoom', 'vd-subjects-display', 'start-stats', 'teacher-names', 'version', 'disable-css', 'hotkeys-today', 'start-widgets', 'dark-image', 'light-image', 'subjects', 'hidden-studyguides', 'color', 'start-schedule-days'
'auto-theme', 'theme-fixed', 'theme-day', 'theme-night', 'openedPopup', 'updates', 'beta', 'magister-shortcuts', 'magister-shortcuts-today', 'magister-sw-grid', 'magister-sw-sort', 'magister-sw-period', 'magister-sw-display', 'magister-ag-large', 'magister-subjects', 'magister-appbar-hidePicture', 'appbar-hide-actions', 'magister-appbar-zermelo', 'magister-appbar-zermelo-url', 'magister-css-border-radius', 'magister-css-dark-invert', 'magister-css-experimental', 'magister-css-hue', 'magister-css-luminance', 'magister-css-saturation', 'magister-css-theme', 'magister-op-oldgrey', 'magister-periods', 'periods', 'magister-shortcut-keys', 'magister-shortcut-keys-master', 'magister-shortcut-keys-today', 'magister-subjects', 'magister-sw-thisWeek', 'magister-vd-overhaul', 'magister-vd-enabled', 'magister-vd-subjects', 'magister-vd-grade', 'magister-vd-agendaHeight', 'magister-vd-deblue', 'magister-vd-gradewidget', 'magisterLogin-password', 'magisterLogin-method', 'magister-gamification-beta', 'gamification-enabled', 'magister-cf-calculator', 'magister-cf-statistics', 'magister-cf-backup', 'magister-cf-failred', 'notes-enabled', 'notes', 'st-notes', 'vd-enabled', 'vd-schedule-days', 'vd-schedule-extra-day', 'vd-schedule-zoom', 'vd-subjects-display', 'start-stats', 'teacher-names', 'version', 'disable-css', 'hotkeys-today', 'start-widgets', 'dark-image', 'light-image', 'subjects', 'hidden-studyguides', 'color', 'start-schedule-days', 'v', 'special'
]

startListenCredentials()
Expand Down

0 comments on commit 0ac499c

Please sign in to comment.