Last active
September 1, 2020 06:06
-
-
Save sj26/06856f09522171e995577fe7c2e6efea to your computer and use it in GitHub Desktop.
Some more hotkeys for Basecamp keyboard warriors
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 basecamp-more-hotkeys | |
// @description Some more hotkeys for Basecamp keyboard warriors | |
// @author Samuel Cochran <sj26@sj26.com> | |
// @license MIT | |
// @version 1.2 | |
// @match https://3.basecamp.com/* | |
// @homepage https://gist.github.com/sj26/06856f09522171e995577fe7c2e6efea | |
// @updateURL https://gist.github.com/sj26/06856f09522171e995577fe7c2e6efea/raw/a4013f6171d2ce42522fb142c3b7968ce5f033e6/basecamp-more-hotkeys.user.js | |
// ==/UserScript== | |
Object.assign(BC.keyCodes, {"c": 67}) | |
BC.handleEvent("keydown", { | |
"with": (event) => { | |
const target = event.target || event.srcElement | |
// Ignore keydown in content editables | |
if (target.isContentEditable) | |
return; | |
// Ignore keydown in form fields | |
const { tagName } = target | |
if ((tagName === "INPUT" || tagName === "TEXTAREA" || tagName === "SELECT") && !target.readOnly) | |
return; | |
// From project page, press "c" to jump to campfire | |
// i.e. Command+J, type project name, press enter, press c | |
if (event.keyCode === BC.keyCodes.c && !event.ctrlKey && !event.metaKey && !event.shiftKey && !event.altKey) { | |
const node = document.querySelector("#main-content .project-dock .card.card--chat .card__link"); | |
if (node) { | |
event.preventDefault() | |
node.click() | |
} | |
} | |
} | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment