]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5862 Users should have a way to easily discover that shortcuts exist and unders...
authorStas Vilchik <vilchiks@gmail.com>
Wed, 4 Feb 2015 14:07:29 +0000 (15:07 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 5 Feb 2015 15:46:30 +0000 (16:46 +0100)
server/sonar-web/src/main/js/nav/app.js

index a9ac2f9e22d9072f67321595818a61da55093d80..36e52658a1d5e7cec864df30deb42b2867ace423 100644 (file)
@@ -57,6 +57,19 @@ define([
     });
   });
 
+  App.addInitializer(function () {
+    var that = this;
+    $(window).on('keypress', function (e) {
+      var tagName = e.target.tagName;
+      if (tagName !== 'INPUT' && tagName !== 'SELECT' && tagName !== 'TEXTAREA') {
+        var code = e.keyCode || e.which;
+        if (code === 63) {
+          that.navbarView.showShortcutsHelp();
+        }
+      }
+    });
+  });
+
   window.requestMessages().done(function () {
     App.start();
   });