#101 weekly calendar view even if not first on page

This commit is contained in:
dragonwocky 2020-09-25 17:56:39 +10:00
parent 21b3802e08
commit 677fd3cf10
Signed by: dragonwocky
GPG Key ID: C7A48B7846AA706D
2 changed files with 19 additions and 17 deletions

View File

@ -13,6 +13,7 @@
- bugfix: block indents are no longer overriden.
- bugfix: neutral does not force full width pages.
- bugfix: bypass preview extension works with the back/forward arrows.
- bugfix: check all views on a page for a weekly calendar.
### v0.9.0 (2020-09-20)

View File

@ -30,23 +30,24 @@ module.exports = {
subtree: true,
});
function process(list, observer) {
const collection_view = document.querySelector(
'.notion-collection-view-select'
);
if (!collection_view || collection_view.innerText != 'weekly')
return;
const days = collection_view.parentElement.parentElement.parentElement.parentElement.getElementsByClassName(
'notion-calendar-view-day'
),
today = [...days].find((day) => day.style.background),
height = today
? getComputedStyle(
today.parentElement.parentElement
).getPropertyValue('height')
: 0;
for (let day of days)
day.parentElement.parentElement.style.height = 0;
if (today) today.parentElement.parentElement.style.height = height;
document
.querySelectorAll('.notion-collection-view-select')
.forEach((collection_view) => {
if (collection_view.innerText != 'weekly') return;
const days = collection_view.parentElement.parentElement.parentElement.parentElement.getElementsByClassName(
'notion-calendar-view-day'
),
today = [...days].find((day) => day.style.background),
height = today
? getComputedStyle(
today.parentElement.parentElement
).getPropertyValue('height')
: 0;
for (let day of days)
day.parentElement.parentElement.style.height = 0;
if (today)
today.parentElement.parentElement.style.height = height;
});
}
}
});