Class: RetroMenu

RetroMenu

new RetroMenu(title, display_element, hook_element)

retroMenu.js, line 27
Creates a new RetroMenu instance.
This:
Name Type Default Description
title string optional Title to use for all dialogs.
display_element jQuery $("<div>") optional jQuery element to use for display. May be changed.
hook_element jQuery document.body optional jQuery element to apply all keyboard based hooks to.

Members

staticRetroMenu.confirm_falsestring

String used as False for confirm dialogs.
Default Value:
  • "Cancel"

staticRetroMenu.confirm_truestring

String used as True for confirm dialogs.
Default Value:
  • "OK"

staticRetroMenu.dblclick_timeoutnumber

Timeout after which a click is considered a double click in ms.
Default Value:
  • 250

staticRetroMenu.keyActionsstring

Actions that can occur.
Properties:
Name Type Default Description
UP string RetroMenu.up Move up in the menu.
DOWN string RetroMenu.down Move down in the menu.
TAB string RetroMenu.tab Tab forward
SHIFT_TAB string RetroMenu.tab_shift Tab backward.

staticRetroMenu.keyCodesnumber

KeyCodes used by RetroMenu.
Properties:
Name Type Default Description
UP number 38 "Arrow up" key
DOWN number 40 "Arrow down" key
W number 87 The W key
S number 83 The D key
TAB number 9 The TAB key

private_display_elementjQuery

Element used for display.

private_hook_elementjQuery

Element all key-based hooks are applied to.

private_titlestring

Title of this RetroMenu.

Methods

staticRetroMenu.alert_dialog(title, text, msg_div, next){RetroMenu}

retroMenu.js, line 318
Shows an alert dialog using a new RetroMenu Instance.
Name Type Description
title string Title to use for this dialog box.
text string Text to alert the user to.
msg_div jQuery optional Message element to also add.
next RetroMenu~alertCallback optional Callback when the user confirms the message. If omitted, alert does not close until manually closed.
Returns:
newly created RetroMenu

staticRetroMenu.confirm_dialog(title, text, options, msg_div, startIndex, next){RetroMenu}

retroMenu.js, line 725
Shows a confirm dialog using a new RetroMenu Instance.
Name Type Default Description
title string Title to use for this dialog box.
text string Text to alert the user to.
options Array.<string> Options to make the user select from.
msg_div jQuery optional Message element to also add.
startIndex string True optional Default to start with
next RetroMenu~confirmCallback optional Callback when the user confirms the message. If omitted, select does not close until manually closed.
Returns:
newly created RetroMenu

staticRetroMenu.example()

example.js, line 5
When called, registers all the example code on the demo page.

staticRetroMenu.prompt_dialog(title, text, def, hide_input, msg_div, next){RetroMenu}

retroMenu.js, line 456
Shows a prompt box using a new RetroMenu instance.
Name Type Default Description
title string Title of this RetroMenu instance.
text string Text to prompt the user for.
def string "" optional The default response to start with.
hide_input boolean False optional Should input be hidden (password prompt)
msg_div jQuery optional Message element to also add.
next RetroMenu~promptCallback optional Callback when the user confirms the message. If omitted, alert does not close until manually closed.
Returns:
newly created RetroMenu

staticRetroMenu.select_dialog(title, text, options, msg_div, startIndex, next){RetroMenu}

retroMenu.js, line 647
Shows a select dialog using a new RetroMenu Instance.
Name Type Default Description
title string Title to use for this dialog box.
text string Text to alert the user to.
options Array.<string> Options to make the user select from.
msg_div jQuery optional Message element to also add.
startIndex number 0 optional Index to start with.
next RetroMenu~selectCallback optional Callback when the user confirms the message. If omitted, select does not close until manually closed.
Returns:
newly created RetroMenu

alert(text, msg_div, next){RetroMenu}

retroMenu.js, line 241
Shows an alert box.
Name Type Description
text string Text to alert the user to.
msg_div jQuery optional Message element to also add.
next RetroMenu~alertCallback optional Callback when the user confirms the message. If omitted, alert does not close until manually closed.
Returns:
this for chaining

confirm(text, options, msg_div, startIndex, next){RetroMenu}

retroMenu.js, line 679
Shows a confirm box.
Name Type Default Description
text string Text to alert the user to.
options Array.<string> Options to make the user select from.
msg_div jQuery optional Message element to also add.
startIndex string True optional Default to start with
next RetroMenu~confirmCallback optional Callback when the user confirms the message. If omitted, select does not close until manually closed.
Returns:
this for chaining

destroy(){RetroMenu}

retroMenu.js, line 133
Returns the JSON-style source of this Vote.
Returns:
this for chaining

init(){RetroMenu}

retroMenu.js, line 96
Returns the JSON-style source of this Vote.
Returns:
this for chaining

prompt(text, def, hide_input, msg_div, next){RetroMenu}

retroMenu.js, line 345
Shows an prompt box.
Name Type Default Description
text string Text to prompt the user for.
def string "" optional The default response to start with.
hide_input boolean False optional Should input be hidden (password prompt)
msg_div jQuery optional Message element to also add.
next RetroMenu~promptCallback optional Callback when the user confirms the message. If omitted, alert does not close until manually closed.
Returns:
this for chaining

select(text, options, msg_div, startIndex, next){RetroMenu}

retroMenu.js, line 487
Shows a select box.
Name Type Default Description
text string Text to alert the user to.
options Array.<string> Options to make the user select from.
msg_div jQuery optional Message element to also add.
startIndex number 0 optional Index to start with.
next RetroMenu~selectCallback optional Callback when the user confirms the message. If omitted, select does not close until manually closed.
Returns:
this for chaining

start_hooks(){RetroMenu}

retroMenu.js, line 159
Enables key hooking for this menu.
Returns:
this for chaining

stop_hooks(){RetroMenu}

retroMenu.js, line 215
Stops key hooking for this menu.
Returns:
this for chaining

tab(reverse){RetroMenu}

retroMenu.js, line 754
Performs a tab key press.
Name Type Description
reverse Boolean Should it be a shift_tab?
Returns:
this for chaining

Type Definitions

alertCallback()

retroMenu.js, line 339
Callback for results form alert dialogs.
This:

confirmCallback(confirm)

retroMenu.js, line 746
Callback for results form select dialogs.
This:
Name Type Description
confirm boolean Did the user confirm?

promptCallback(result)

retroMenu.js, line 480
Callback for results for prompt dialogs.
This:
Name Type Description
result string The result the user enters in the prompt.

selectCallback(index, value)

retroMenu.js, line 670
Callback for results form select dialogs.
This:
Name Type Description
index number Index selected by the user.
value string Value selected by the user.