Documentation

Keyboard shortcuts

Summary

Keyboard commands with syntactic sugar.

Status

API status:general
Included in AUI core?Yes. You do not need to explicitly require the web resource key.
Web resource key:com.atlassian.auiplugin:ajs
Experimental since:3.0

Examples

Type "z" then "e" to execute some simple JavaScript.

Code

JavaScript

AJS.whenIType("ze").execute(function () {alert("I have executed");});
AJS.whenIType("c").click("#create");
AJS.whenIType("gh").or("gd").goTo("http://example.com/");
AJS.whenIType("n").moveToNextItem(".selector"); 
AJS.whenIType("p").moveToPrevItem(".selector");

JavaScript methods

  • click
  • execute
  • followLink
  • fromJSON
  • goTo
  • moveToAndClick
  • moveToAndFocus
  • moveToNextItem
  • moveToPrevItem
  • or

fromJSON creates keyboard commands and their actions from json data. Format:

[
  {
       "keys":[["g", "d"]],
       "context":"global",
       "op":"followLink",
       "param":"#home_link"
   },
   {
       "keys":[["g", "i"]],
       "context":"global",
       "op":"followLink",
       "param":"#find_link"
   },
   {
       "keys":[["/"]],
       "context":"global",
       "op":"moveToAndFocus",
       "param":"#quickSearchInput"
   },
   {
       "keys":[["c"]],
       "context":"global",
       "op":"moveToAndClick",
       "param":"#create_link"
   }
]