Last active
January 11, 2018 16:26
-
-
Save whispy/e620cdedfb03e84e02945b3a0d928f62 to your computer and use it in GitHub Desktop.
basecamp-keyboard-shortcuts.user.js
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 - Keyboard Shortcuts | |
// @namespace http://tampermonkey.net/ | |
// @version 0.2 | |
// @description This script adds some keyboard shortcuts to Basecamp. | |
// @updateURL https://gist.github.com/whispy/e620cdedfb03e84e02945b3a0d928f62/raw/basecamp-keyboard-shortcuts.user.js | |
// @downloadURL https://gist.github.com/whispy/e620cdedfb03e84e02945b3a0d928f62/raw/basecamp-keyboard-shortcuts.user.js | |
// @author Dan Berkowitz | |
// @match https://3.basecamp.com/* | |
// ==/UserScript== | |
function bulletList() { | |
var trix = document.querySelector("trix-editor"); | |
var bulletedButton = document.querySelector('.trix-button--icon-bullet-list'); | |
if (bulletedButton.hasAttribute('data-trix-active')) { | |
trix.editor.deactivateAttribute("bullet"); | |
} | |
else { | |
trix.editor.activateAttribute("bullet"); | |
} | |
} | |
var map = {}; // Create empty map to be filled with keycodes on keydown | |
onkeydown = onkeyup = function(e){ | |
e = e || event; // to deal with IE | |
map[e.keyCode] = e.type == 'keydown'; | |
if(map[17] && map[16] && map[190]){ // If map contains keycodes for CTRL+SHIFT+. | |
//console.log(map); | |
bulletList(); // toggle bulleted list | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment