From 2724f3d8596508ff3a6e399e8014f579102b3852 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Tue, 14 Dec 2021 21:11:47 +1100 Subject: [PATCH] detect tab icons when sidebar closed, weekly view support expanded cal rows --- repo/tabs/client.mjs | 2 +- repo/weekly-view/client.mjs | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/repo/tabs/client.mjs b/repo/tabs/client.mjs index 4e1537b..8f0960b 100644 --- a/repo/tabs/client.mjs +++ b/repo/tabs/client.mjs @@ -27,7 +27,7 @@ export default async function ({ web, electron }, db) { } const breadcrumbSelector = - '.notion-topbar > div > :nth-child(2) > .notion-focusable:last-child', + '.notion-topbar > div > [class="notranslate"] > .notion-focusable:last-child', imgIconSelector = `${breadcrumbSelector} .notion-record-icon img:not(.notion-emoji)`, emojiIconSelector = `${breadcrumbSelector} .notion-record-icon img.notion-emoji`, nativeIconSelector = `${breadcrumbSelector} .notion-record-icon [role="image"]`, diff --git a/repo/weekly-view/client.mjs b/repo/weekly-view/client.mjs index a93f80c..74a71c7 100644 --- a/repo/weekly-view/client.mjs +++ b/repo/weekly-view/client.mjs @@ -11,7 +11,7 @@ export default async function ({ web }, db) { calendarSelector = '.notion-calendar-view', viewSelector = '.notion-collection-view-select:not([data-weekly-view])', todaySelector = '.notion-calendar-view-day[style*="background"]', - weekSelector = '[style="position: relative; display: flex; height: 124px;"]', + weekSelector = '[style^="position: relative; display: flex; height: "]', toolbarBtnSelector = '.notion-calendar-view > :first-child > :first-child > :first-child > :nth-last-child(2)'; @@ -30,11 +30,14 @@ export default async function ({ web }, db) { } } else { const $weekContainer = $calendar.querySelector(weekSelector).parentElement; - $weekContainer.style.maxHeight = '124px'; for (const $week of $calendar.querySelectorAll(weekSelector)) { - if (!$week.querySelector(todaySelector)) { + if ($week.querySelector(todaySelector)) { + $weekContainer.style.maxHeight = $week.style.height; + break; + } else { $week.style.height = '0'; - } else break; + $week.style.opacity = '0'; + } } } });