From f93e9b8faf02899e563d85c157f8993f70c4ad0f Mon Sep 17 00:00:00 2001 From: Leonardo Cavaletti Date: Sun, 17 May 2020 19:17:26 +0100 Subject: [PATCH] Improved styling --- loconotion.css | 19 +++++++------------ loconotion.js | 2 +- loconotion.py | 8 ++++---- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/loconotion.css b/loconotion.css index bcc226f..ba4bd5f 100644 --- a/loconotion.css +++ b/loconotion.css @@ -30,24 +30,19 @@ div[role="button"]:not(.notion-record-icon):hover { padding-left: 0 !important; } - /* normalizes database views width */ - .notion-list-view, - .notion-gallery-view, - .notion-table-view, - .notion-board-view, - .notion-calendar-view { - padding-left: 0 !important; - padding-right: 0 !important; - } - /* add padding to banner, but not to image */ - .notion-scroller > div:first-child > div:last-child { + .notion-scroller > div:first-child > div:last-child:not(.notion-collection_view_page-block) { padding-right: 2em !important; padding-left: 2em !important; } /* add padding to content */ - .notion-scroller > div:nth-child(2) { + .notion-scroller > div:nth-child(2), + .notion-list-view, + .notion-gallery-view, + .notion-table-view, + .notion-board-view, + .notion-calendar-view { padding-right: 2em !important; padding-left: 2em !important; } diff --git a/loconotion.js b/loconotion.js index 3f8d38c..018879f 100644 --- a/loconotion.js +++ b/loconotion.js @@ -56,6 +56,6 @@ for (let i = 0; i < pendingIframes.length; i++) { const collectionSearchBoxes = document.getElementsByClassName("collectionSearch"); for (let i = 0; i < collectionSearchBoxes.length; i++) { - const collectionSearchBox = collectionSearchBoxes.item(i).parentElement(); + const collectionSearchBox = collectionSearchBoxes.item(i).parentElement; collectionSearchBox.style.display = "none"; } diff --git a/loconotion.py b/loconotion.py index c3e411f..f06c14b 100644 --- a/loconotion.py +++ b/loconotion.py @@ -311,12 +311,12 @@ class Parser(): fonts_selectors = { "site" : "div:not(.notion-code-block)", "navbar": ".notion-topbar div", - "title" : ".notion-page-block, .notion-collection_view_page-block", + "title" : ".notion-page-block > div, .notion-collection_view_page-block > div", "h1" : ".notion-header-block div", "h2" : ".notion-sub_header-block div", "h3" : ".notion-sub_sub_header-block div", "body" : ".notion-app-inner", - "code" : ".notion-code-block *" + "code" : ".notion-code-block *", } custom_fonts = self.get_page_config(url).get("fonts", {}) if (custom_fonts): @@ -335,12 +335,12 @@ class Parser(): for target, custom_font in custom_fonts.items(): if custom_font and not target == "site": log.debug(f"Setting {target} font-family to {custom_font}") - font_override_stylesheet.append(fonts_selectors[target] + " {font-family:" + custom_font + " !important}") + font_override_stylesheet.append(fonts_selectors[target] + " {font-family:" + custom_font + " !important} ") site_font = custom_fonts.get("site", None) # process global site font last to more granular settings can override it if (site_font): log.debug(f"Setting global site font-family to {site_font}"), - font_override_stylesheet.append(fonts_selectors["site"] + " {font-family:" + site_font + "}") + font_override_stylesheet.append(fonts_selectors["site"] + " {font-family:" + site_font + "} ") # finally append the font overrides stylesheets to the page soup.head.append(font_override_stylesheet)