Notion Sidebar Tamer Userscript

Disable the hover sidebar in Notion. The sidebar in Notion is a great way to navigate between pages, but it can be distracting when you're working between windows. This Chrome extension disables the appearing on hover of the sidebar.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Notion Sidebar Tamer Userscript
// @namespace    http://tampermonkey.net/
// @version      0.2
// @license MIT
// @description  Disable the hover sidebar in Notion. The sidebar in Notion is a great way to navigate between pages, but it can be distracting when you're working between windows. This Chrome extension disables the appearing on hover of the sidebar.
// @author       YourLocalCatGirl
// @match        https://www.notion.so/*
// @grant        none
// ==/UserScript==

const sidebarInitObserver = new MutationObserver((mutationsList, observer) => {
  const targetElement = document.querySelector(".notion-sidebar");
  if (targetElement) {
    observer.disconnect();
    const expandedObserver = new MutationObserver(expandedObserverCallback);
    expandedObserver.observe(targetElement, {
      subtree: true,
      childList: true,
      attributes: false,
    });
  }
});
let previousExpanded = null;
function expandedObserverCallback(mutationsList, observer) {
  const targetElement = document.querySelector(".notion-sidebar");
  const sidebarData = JSON.parse(
    localStorage.getItem("LRU:KeyValueStore2:sidebar")
  );
  const expanded = sidebarData["value"]["expanded"];
  if (expanded !== previousExpanded) {
    targetElement.style.display = expanded ? "block" : "none";
  }
}
sidebarInitObserver.observe(document.body, { subtree: true, childList: true });