Last active
July 15, 2024 03:50
-
-
Save julenwang/5263ad866d76640cd85cdaf6f218de65 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name New Userscript | |
// @namespace http://tampermonkey.net/ | |
// @version 2024-07-14 | |
// @description try to take over the world! | |
// @author You | |
// @match https://www.notion.so/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=notion.so | |
// @grant GM.addStyle | |
// ==/UserScript== | |
(function () { | |
"use strict"; | |
// Your code here... | |
console.log("hello world"); | |
console.log(document.querySelector("#notion-app")); | |
const app = document.querySelector("#notion-app"); | |
// mutation on #notion-app | |
const mutationObsApp = new MutationObserver((mutations) => { | |
// when add .notion-app-inner | |
const mutation = mutations[0]; | |
const fisrtAddNode = Array.from(mutation.addedNodes).at(0); | |
if (fisrtAddNode?.classList.contains("notion-app-inner")) { | |
console.log( | |
fisrtAddNode, | |
fisrtAddNode.querySelector(".notion-overlay-container"), | |
"fk1" | |
); | |
const overlay = fisrtAddNode.querySelector(".notion-overlay-container"); | |
const mutationObsOverlay = new MutationObserver((overlayMutations) => { | |
const mutation = overlayMutations[0]; | |
const fisrtAddNode = Array.from(mutation.addedNodes).at(0); | |
if ( | |
fisrtAddNode?.querySelector( | |
`div[style="width: 56px; height: 166px;"]` | |
) | |
) { | |
console.log(fisrtAddNode, "ffff"); | |
fisrtAddNode.classList.add('cts-right-fixed-dir'); | |
fisrtAddNode.addEventListener("mouseout", (e) => e.stopPropagation()); | |
} | |
}); | |
mutationObsOverlay.observe(overlay, { childList: true }); | |
} | |
}); | |
mutationObsApp.observe(app, { childList: true }); | |
GM.addStyle( | |
'.cts-right-fixed-dir {pointer-events: none !important}' | |
); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment