Skip to content

Commit

Permalink
fixes n stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
QkeleQ10 committed Jun 29, 2024
1 parent fbc1605 commit 5cc8a6d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/magister/scripts/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const MagisterApi = {
recent: async () => {

if (MagisterApi.useSampleData) {
return [{ omschrijving: "Voorbeeld", ingevoerdOp: new Date(now - 172800000), vak: { code: "netl", omschrijving: "Nederlandse taal" }, waarde: "6,9", weegfactor: 0 }, { omschrijving: "Baguette", ingevoerdOp: new Date(now - 691200000), vak: { code: "fatl", omschrijving: "Franse taal" }, waarde: "U", weegfactor: 0 }, { omschrijving: "Grade mockery", ingevoerdOp: new Date(now - 6891200000), vak: { code: "entl", omschrijving: "Engelse taal" }, waarde: "5,4", weegfactor: 0 }
return [{ omschrijving: "Voorbeeld", ingevoerdOp: new Date(now - 172800000), vak: { code: "netl", omschrijving: "Nederlandse taal" }, waarde: "6,9", weegfactor: 0, isVoldoende: true }, { omschrijving: "Baguette", ingevoerdOp: new Date(now - 691200000), vak: { code: "fatl", omschrijving: "Franse taal" }, waarde: "U", weegfactor: 0, isVoldoende: true }, { omschrijving: "Grade mockery", ingevoerdOp: new Date(now - 6891200000), vak: { code: "entl", omschrijving: "Engelse taal" }, waarde: "5,4", weegfactor: 0 }
]
}
return new Promise(async (resolve, reject) => {
Expand Down
57 changes: 41 additions & 16 deletions src/magister/scripts/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,36 @@ async function applyStyles(varsOnly, overrideTheme, overrideColor, dontUpdate) {
handleSpecialTheme('valentine')
}

createStyle(`.block h3,
createStyle(`
body .container {
display: grid;
grid-template:
"appbar menu view" auto
". . view" 1fr
/ auto auto 1fr;
}
.appbar-host {
grid-area: appbar;
height: 100vh;
max-height: 100vh;
}
mg-feedback-dialog {
position: absolute;
}
.menu-host {
grid-area: menu;
height: 100vh;
max-height: 100vh;
}
.view {
grid-area: view;
}
.block h3,
.view {
position: relative;
}
Expand Down Expand Up @@ -1024,11 +1053,11 @@ aside .tabs li a {
.menu-host .menu {
position: static !important;
padding-bottom: 0 !important;
display: grid;
grid-template:
"items" calc(100vh - 84px - 64px)
"footer" 64px
/ 1fr;
display: flex;
flex-direction: column;
justify-content: space-between;
height: 100%;
max-height: calc(100vh - 84px);
}
.menu-host .menu .menu-container {
Expand Down Expand Up @@ -1490,7 +1519,7 @@ table.table-grid-layout>tbody>tr.selected {
padding-right: 0 !important;
}
`, 'study-tools-start-overhaul')
}
} else { createStyle('', 'study-tools-start-overhaul') }

if (syncedStorage['sw-enabled']) {
createStyle(`
Expand All @@ -1515,7 +1544,7 @@ table.table-grid-layout>tbody>tr.selected {
.sidecolumn section.main {
padding-bottom: 0 !important
}`, 'study-tools-sw-grid')
}
} else { createStyle('', 'study-tools-sw-grid') }

if (syncedStorage['cs']) {
createStyle(`
Expand Down Expand Up @@ -1549,17 +1578,13 @@ ${insufArray.map(x => `.grade.grade.grade.grade[title^="${x.toLocaleString('nl-N
color: var(--st-accent-ok) !important;
font-weight: 700;
}`, 'study-tools-insuf-red')
} else {
createStyle('', 'study-tools-insuf-red')
}
} else { createStyle('', 'study-tools-insuf-red') }

if (syncedStorage['magister-picture'] === 'custom' && syncedStorage['magister-picture-source']?.length > 10) {
createStyle(`.menu-button figure img,.photo.photo-high img{content: url("${syncedStorage['magister-picture-source']}")}`, 'study-tools-pfp')
} else if (syncedStorage['magister-picture'] !== 'show') {
createStyle(`.menu-button figure img,.photo.photo-high img{display: none}`, 'study-tools-pfp')
} else {
createStyle('', 'study-tools-pfp')
}
} else { createStyle('', 'study-tools-pfp') }

if (syncedStorage['custom-css']) {
createStyle(syncedStorage['custom-css'], 'study-tools-custom-css')
Expand All @@ -1581,10 +1606,10 @@ ${insufArray.map(x => `.grade.grade.grade.grade[title^="${x.toLocaleString('nl-N
}

cssVarReferenceMatches.forEach(({ variable, property, selector }) => {
let interval = setInterval(update, 50)
let interval = setInterval(update, 25)
setTimeout(() => clearInterval(interval), 3000)
window.addEventListener('resize', update)
document.querySelector(selector.replace(/\_/gi, ' ')).addEventListener('click', update)
document.querySelector(selector.replace(/\_/gi, ' ')).addEventListener('mouseup', update)
function update() {
document.querySelector(':root').style.setProperty(variable, document.querySelector(selector.replace(/\_/gi, ' '))[property === 'width' ? 'offsetWidth' : 'offsetHeight'] + 'px')
}
Expand Down
8 changes: 6 additions & 2 deletions src/magister/scripts/today.js
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,7 @@ async function today() {
widgetTypeButton.classList.add('active')
widgetsList.innerText = ''
widgets.classList.remove('editing')
editWidgets(true)
editWidgets(widgetElement.id)
})
})
const widgetHideButton = element('button', `st-start-edit-${key}-hide`, editorActionRow, { class: 'st-button tertiary', 'data-icon': '', innerText: i18n('remove'), title: i18n('removeWidget') })
Expand All @@ -1395,7 +1395,7 @@ async function today() {
saveToStorage(option.key, newValue, 'local')
widgetsList.innerText = ''
widgets.classList.remove('editing')
editWidgets()
editWidgets(widgetElement.id)
})
break

Expand All @@ -1406,6 +1406,10 @@ async function today() {
})
}
})

if (keepSelection === widgetElement.id) {
widgetElement.classList.add('focused')
}
}
updateTemporalBindings()
}
Expand Down

0 comments on commit 5cc8a6d

Please sign in to comment.