Last active
May 19, 2023 19:34
-
-
Save arel/a42bae17a115dee84e054960891a17f1 to your computer and use it in GitHub Desktop.
Add back Ctrl-N support in Notion
This file contains 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 0.1 | |
// @description Add back Ctrl-N support in Notion | |
// @author Arel Cordero | |
// @match https://gist.githubusercontent.com/arel/a42bae17a115dee84e054960891a17f1/raw/02ad5201674311f4e11c7d9602fcbb07309e1444/notion-ctrl-n.js | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=githubusercontent.com | |
// @grant none | |
// ==/UserScript== | |
(() => { | |
document.addEventListener('keydown', function(event) { | |
if (window.location.host === 'www.notion.so') { | |
// Check if the key pressed is 'N' and Ctrl key is also pressed | |
if (event.key === 'n' && event.ctrlKey) { | |
event.preventDefault(); | |
// Open new Notion page | |
[].slice.call(document.querySelectorAll("div[role=button]")) | |
.filter(a => a.textContent.match(/^\s*New page\s*$/))?.[0].click() | |
} | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment