Namespace: NiftyAPI

NiftyAPI

Chainable automation API. All chains that affect a menu item should start with a .find('search string') call.

Example

NiftyAPI.find('file/save').arrow(); // locate File->Save menu item and add an arrow callout

Methods


arrow( [bool])

Set callout arrow for menu item. Equivalent to option-clicking a menu item.

Parameters:
Name Type Argument Default Description
bool boolean <optional>
true

Arrow on or off

Example
NiftyAPI.find('view/merge').arrow();
NiftyAPI.find('view/merge').arrow(false); // remove arrow

callout( [bool] [, recurse])

Add callout to menu item. Equivalent to double clicking a menu item.

Parameters:
Name Type Argument Default Description
bool boolean <optional>
true

Callout on or off (default: true)

recurse boolean <optional>
false

Call out parent items (default: false)

Example
NiftyAPI.find('file/open').callout();
NiftyAPI.find('file/open').callout(true, true); // add callout to item and parents
NiftyAPI.find('file/open').callout(false); // remove callout

clear()

Clear all clicks, callouts, and arrows

Example
NiftyAPI.clear();

config(options)

Set multiple display options via a configuration object

Parameters:
Name Type Description
options Object

object containing settings

Example
NiftyAPI.config({
  'arrowStyle': 'arrow',
  'bgImage': true,
  'darkMode': false,
  'wallpaper': 'default'
});

darkMode( [bool])

Turn Dark Mode on or off

Parameters:
Name Type Argument Default Description
bool boolean <optional>
true

Dark Mode on or off

Example
NiftyAPI.darkMode(); // turn dark mode on
NiftyAPI.darkMode(false); // turn dark mode off

expose( [bool])

Turn Expose on or off

Parameters:
Name Type Argument Default Description
bool boolean <optional>
true

Expose on or off

Example
NiftyAPI.expose(); // turn expose on
NiftyAPI.expose(false); // turn expose off

find(str)

Case insensitive string match for menu item search. Use / to separate heirarchical menu search items. This function can be chained for use with other functions.

Parameters:
Name Type Description
str string

The string to search for

Returns:

single jQuery element or null

Type
jQuery
Example
NiftyAPI.find('insert/toc/section');
NiftyAPI.find('insert/toc/section').arrow();

getConfig()

Show current configuration options

Returns:

The configuration.

Type
object

lock()

Lock menu item. Removes any existing locks. Equivalent to clicking a menu item.

Example
NiftyAPI.find('file/save').lock();

shoot( [title])

Take a screenshot of selected menu item. Currently experimental, only works in Chrome.

Background images work if they're remote (hosted, with proper CORS headers). Local images seem to taint the canvas, making it impossible to save with Chrome's security restrictions. Thus, background images are disabled during screenshot if using a file: protocol.

Parameters:
Name Type Argument Default Description
title string <optional>
null

The title for downloaded image, no extension

Example
NiftyAPI.find('edit/paste as').arrow().shoot('filename');

shortcut( [bool])

Set shortcut callout for menu item. Equivalent to option-clicking a shortcut on a menu item.

Parameters:
Name Type Argument Default Description
bool boolean <optional>
true

Shortcut callout on or off

Example
NiftyAPI.find('file/save').shortcut();
NiftyAPI.find('file/save').shortcut(false); // remove arrow