From a17de1e768b06ad0854772ef50e131e18020ebd8 Mon Sep 17 00:00:00 2001 From: Tom Date: Thu, 10 Dec 2020 15:56:39 +1100 Subject: [PATCH] revert accidental merge of still-wip "tweak: hide empty sidebar arrow" This reverts commit 5305c0b9b0c92d269c6c1933e349fcdbf97aa021. --- mods/tweaks/app.css | 14 ++------------ mods/tweaks/mod.js | 45 +-------------------------------------------- 2 files changed, 3 insertions(+), 56 deletions(-) diff --git a/mods/tweaks/app.css b/mods/tweaks/app.css index c570b3b..3f2ccfe 100644 --- a/mods/tweaks/app.css +++ b/mods/tweaks/app.css @@ -1,7 +1,6 @@ /* * tweaks * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 admiraldus (https://github.com/admiraldus) * under the MIT license */ @@ -35,15 +34,6 @@ display: none !important; } -[data-tweaks*='[hide_empty_sidebar_arrow]'] .tweaks-arrow { - opacity: 0 !important; - transition: opacity .2s ease !important; -} - -[data-tweaks*='[hide_empty_sidebar_arrow]'] .notion-sidebar [data-block-id]:hover .tweaks-arrow { - opacity: 1 !important; -} - [data-tweaks*='[thicker_bold]'] .notion-page-content span[style*='font-weight:600'] { @@ -66,9 +56,9 @@ [data-tweaks*='[scroll_db_toolbars]'] .notion-frame > .notion-scroller > [style*="overflow: visible;"], [data-tweaks*='[scroll_db_toolbars]'] .notion-page-content .notion-collection_view-block > :first-child { - overflow-x: auto !important; + overflow-x: auto !important; } [data-tweaks*='[scroll_db_toolbars]'] .notion-frame > .notion-scroller > [style*="overflow: visible;"]::-webkit-scrollbar, [data-tweaks*='[scroll_db_toolbars]'] .notion-page-content .notion-collection_view-block > :first-child::-webkit-scrollbar { - display: none; + display: none; } diff --git a/mods/tweaks/mod.js b/mods/tweaks/mod.js index c7618d5..daa5a67 100644 --- a/mods/tweaks/mod.js +++ b/mods/tweaks/mod.js @@ -1,7 +1,6 @@ /* * tweaks * (c) 2020 dragonwocky (https://dragonwocky.me/) - * (c) 2020 admiraldus (https://github.com/admiraldus) * under the MIT license */ @@ -13,7 +12,7 @@ module.exports = { tags: ['core', 'extension'], name: 'tweaks', desc: 'common style/layout changes.', - version: '0.2.0', + version: '0.1.0', author: 'dragonwocky', options: [ { @@ -67,14 +66,6 @@ module.exports = { type: 'toggle', value: false, }, - { - key: 'hide_empty_sidebar_arrow', - label: 'hide empty sidebar arrow', - desc: - 'if the page does not have any subpages, hide the left arrow of the page in the sidebar.', - type: 'toggle', - value: false, - }, { key: 'condensed_bullets', label: 'condense bullet points', @@ -123,40 +114,6 @@ module.exports = { }; window.addEventListener('resize', addResponsiveBreakpoint); addResponsiveBreakpoint(); - - const hideEmptyPageArrow = () => { - if (store().hide_empty_sidebar_arrow) { - if (document.querySelector('.notion-sidebar') !== null) { - const sidebar = document.querySelector('.notion-sidebar'); - const sidebarObserver = new MutationObserver(() => { - const text_values = ['No pages inside', '하위 페이지가 없습니다']; - const div_elems = sidebar.querySelectorAll('[data-block-id] div[style*="color"]'); - const empty_elems = Array.from(div_elems).filter( - (div) => text_values.some(text => div.textContent === text)); - - Array.from(empty_elems).forEach((empty) => { - empty.closest('[data-block-id]') - .querySelector('a > div > div > div > div[role="button"]:not(.notion-record-icon)') - .classList.add('tweaks-arrow'); - }); - - const tweak_arrows = document.querySelectorAll('.tweaks-arrow'); - - tweak_arrows.forEach((arrow) => { - if (arrow.closest('[data-block-id]').querySelector('[data-block-id]') !== null) { - arrow.classList.remove('tweaks-arrow'); - } - }); - }); - - sidebarObserver.observe(sidebar,{subtree: true, childList: true}); - document.body.dataset.tweaks += '[hide_empty_sidebar_arrow]'; - } else { - setTimeout(hideEmptyPageArrow, 500); - } - } - }; - hideEmptyPageArrow(); }); }, },