Skip to content

Instantly share code, notes, and snippets.

@arel
Last active May 19, 2023 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arel/a42bae17a115dee84e054960891a17f1 to your computer and use it in GitHub Desktop.
Save arel/a42bae17a115dee84e054960891a17f1 to your computer and use it in GitHub Desktop.
Add back Ctrl-N support in Notion
// ==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