Skip to content
Snippets Groups Projects
Commit 5e7e37dc authored by Arkerthan's avatar Arkerthan
Browse files

add mousetrap record plugin from https://github.com/DmitryShashkov/mousetrap

parent ca36abf5
No related branches found
No related tags found
1 merge request!6912Custom hotkeys
!function(n){var t=[],e=null,r=[],i=!1,o=null,l=n.prototype.handleKey;function u(n){var t;for(t=0;t<r.length;++t)if(r[t]===n)return;r.push(n),1===n.length&&(i=!0)}function p(){t.push(r),i=!(r=[]),clearTimeout(o),o=setTimeout(h,1e3)}function h(){e&&(function(n){var t;for(t=0;t<n.length;++t)n[t].sort(function(n,t){return!(1<n.length&&1===t.length)&&(1===n.length&&1<t.length||t<n)?1:-1}),n[t]=n[t].join("+")}(t),e(t)),t=[],e=null,r=[]}n.prototype.record=function(n){var t=this;t.recording=!0,e=function(){t.recording=!1,n.apply(t,arguments)}},n.prototype.handleKey=function(){(function(n,t,e){var o;if(this.recording)if("keydown"===e.type){for(e.preventDefault(),1===n.length&&i&&p(),o=0;o<t.length;++o)u(t[o]);u(n)}else"keyup"===e.type&&0<r.length&&p();else l.apply(this,arguments)}).apply(this,arguments)},n.init()}(Mousetrap);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment