diff options
author | Phil Hughes <me@iamphill.com> | 2017-10-10 12:10:11 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-10-13 13:38:09 +0300 |
commit | 299da4ca075160ea5778b10f2a93b87f65517a76 (patch) | |
tree | 18f2de9e0647f422480e2b31ce55b25bbbb314c2 /app/assets/javascripts/shortcuts_network.js | |
parent | 5843a43c16e007193f5e26522d1e7368a0bdb2d7 (diff) |
Remove shortcut JS classes from global namespace
Diffstat (limited to 'app/assets/javascripts/shortcuts_network.js')
-rw-r--r-- | app/assets/javascripts/shortcuts_network.js | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/app/assets/javascripts/shortcuts_network.js b/app/assets/javascripts/shortcuts_network.js index cc44082efa9..21823085ac4 100644 --- a/app/assets/javascripts/shortcuts_network.js +++ b/app/assets/javascripts/shortcuts_network.js @@ -1,28 +1,17 @@ -/* eslint-disable func-names, space-before-function-paren, max-len, no-var, one-var, no-restricted-syntax, vars-on-top, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, wrap-iife, max-len */ /* global Mousetrap */ -/* global ShortcutsNavigation */ +import ShortcutsNavigation from './shortcuts_navigation'; -import './shortcuts_navigation'; +export default class ShortcutsNetwork extends ShortcutsNavigation { + constructor(graph) { + super(); -(function() { - var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + Mousetrap.bind(['left', 'h'], graph.scrollLeft); + Mousetrap.bind(['right', 'l'], graph.scrollRight); + Mousetrap.bind(['up', 'k'], graph.scrollUp); + Mousetrap.bind(['down', 'j'], graph.scrollDown); + Mousetrap.bind(['shift+up', 'shift+k'], graph.scrollTop); + Mousetrap.bind(['shift+down', 'shift+j'], graph.scrollBottom); - this.ShortcutsNetwork = (function(superClass) { - extend(ShortcutsNetwork, superClass); - - function ShortcutsNetwork(graph) { - this.graph = graph; - ShortcutsNetwork.__super__.constructor.call(this); - Mousetrap.bind(['left', 'h'], this.graph.scrollLeft); - Mousetrap.bind(['right', 'l'], this.graph.scrollRight); - Mousetrap.bind(['up', 'k'], this.graph.scrollUp); - Mousetrap.bind(['down', 'j'], this.graph.scrollDown); - Mousetrap.bind(['shift+up', 'shift+k'], this.graph.scrollTop); - Mousetrap.bind(['shift+down', 'shift+j'], this.graph.scrollBottom); - this.enabledHelp.push('.hidden-shortcut.network'); - } - - return ShortcutsNetwork; - })(ShortcutsNavigation); -}).call(window); + this.enabledHelp.push('.hidden-shortcut.network'); + } +} |