Skip to content

Instantly share code, notes, and snippets.

@whispy
Last active January 11, 2018 16:26
Show Gist options
  • Select an option

  • Save whispy/e620cdedfb03e84e02945b3a0d928f62 to your computer and use it in GitHub Desktop.

Select an option

Save whispy/e620cdedfb03e84e02945b3a0d928f62 to your computer and use it in GitHub Desktop.

Revisions

  1. whispy revised this gist Jan 11, 2018. 1 changed file with 9 additions and 7 deletions.
    16 changes: 9 additions & 7 deletions basecamp-keyboard-shortcuts.user.js
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,12 @@
    // ==UserScript==
    // @name Basecamp - Keyboard Shortcuts
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @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/*
    // @require https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.6.1/mousetrap.min.js
    // ==/UserScript==


    @@ -22,9 +21,12 @@ function bulletList() {
    }
    }


    window.onload = function() {
    Mousetrap.bind(['ctrl+shift+.', function(e) {
    console.log('pressed');
    });
    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
    }
    };
  2. whispy revised this gist Jan 11, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions basecamp-keyboard-shortcuts.user.js
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,8 @@
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @description This script adds some keyboard shortcuts to Basecamp.
    // @updateURL /
    // @downloadURL /
    // @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/*
    // @require https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.6.1/mousetrap.min.js
  3. whispy created this gist Jan 11, 2018.
    30 changes: 30 additions & 0 deletions basecamp-keyboard-shortcuts.user.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    // ==UserScript==
    // @name Basecamp - Keyboard Shortcuts
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @description This script adds some keyboard shortcuts to Basecamp.
    // @updateURL /
    // @downloadURL /
    // @author Dan Berkowitz
    // @match https://3.basecamp.com/*
    // @require https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.6.1/mousetrap.min.js
    // ==/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");
    }
    }


    window.onload = function() {
    Mousetrap.bind(['ctrl+shift+.', function(e) {
    console.log('pressed');
    });
    };