jakiestfu/Context.js — pull request #16 by suntzuII (2014-11-21 16:44:50+00:00)
Title: Add new features to original repository

New features from this pull request:
- Dropdown main menu to the left instead of the right when close to right edge of screen.
- Icon support via bootstrap glyphicons. Use { icon: 'glyphicon-XXXX' } to add a glyphicon to the menu item
- Added a reference to the element that was right clicked to the "action" callback as the second argument
- Menu reuse support through optional menu object structure. If menu is defined as:
```
context.attach('body', {
id : 'MENU_ID',
data: [
......
]
});
```
then there will be a single DOM menu inserted for all context attachments with the same id field. This allows you to generate a menu and reuse it for every element instead of creating a new menu for every element.
- Dynamic menu *item* creation through custom callbacks. Create a menu item like:
```
{
menu_item_src : fooBar // Can be a string for the function name or the function itself. Must be a globally scoped function.
}
```
This will cause the right click menu to call the function fooBar with a reference to the right clicked item every time the menu is created via a right click. The fooBar function can return a regular menu object which will be inserted into the menu dynamically