summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/shortcuts_network.js
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-07-22 17:01:57 +0300
committerFatih Acet <acetfatih@gmail.com>2016-07-22 17:07:29 +0300
commitbc3f33f92a16d3afdb8a472f60940e7c46a31564 (patch)
treec6e568504b7888591ad15586bb1ace99db8941ca /app/assets/javascripts/shortcuts_network.js
parent033e5423a2594e08a7ebcd2379bd2331f4c39032 (diff)
downloadgitlab-ce-jsify.tar.gz
JSify all the things!jsify
Diffstat (limited to 'app/assets/javascripts/shortcuts_network.js')
-rw-r--r--app/assets/javascripts/shortcuts_network.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/assets/javascripts/shortcuts_network.js b/app/assets/javascripts/shortcuts_network.js
new file mode 100644
index 00000000000..504f3adc706
--- /dev/null
+++ b/app/assets/javascripts/shortcuts_network.js
@@ -0,0 +1,23 @@
+
+/*= require shortcuts_navigation */
+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;
+
+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);