From efaa3cf827b66dd19838d465c4bf6ef913ad6c3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roth?= Date: Sun, 6 Jul 2014 18:12:07 +0200 Subject: [PATCH 1/4] provide userData to menu item functions --- contextMenu.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/contextMenu.js b/contextMenu.js index 8111748..7c0d89a 100644 --- a/contextMenu.js +++ b/contextMenu.js @@ -642,7 +642,17 @@ list.addClass('iw-mDisable'); } - list.bind('click', fun); + click = function () { + fun = this.fun.bind(this.userData); + fun( ); + } + + priv = { + userData: option.userData, + fun: fun + } + + list.bind('click', click.bind( priv )); //to create sub menu menuList.append(list); From 5498305f17f28332952d4907ff23e6c897b8aa04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roth?= Date: Sun, 6 Jul 2014 18:12:46 +0200 Subject: [PATCH 2/4] close menu on menu item click --- contextMenu.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contextMenu.js b/contextMenu.js index 7c0d89a..0c722f4 100644 --- a/contextMenu.js +++ b/contextMenu.js @@ -643,11 +643,14 @@ } click = function () { + close = methods.close.bind(this.data); + close( ); fun = this.fun.bind(this.userData); fun( ); } priv = { + data: trgr, userData: option.userData, fun: fun } From 16f83fa6e9e105fa901982bec75e98598e159414 Mon Sep 17 00:00:00 2001 From: Zoran Pavlovic Date: Fri, 2 Jan 2015 19:42:18 +0200 Subject: [PATCH 3/4] Minor sentence fixes --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b590f8d..38348b3 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,10 @@ contextMenu.js

contextMenu.js is a plugin to create windows like context menu with keyboard interaction, different type of inputs ,trigger events and much more.
Why contextMenu.js ?:

    -
  • Use as simple popup or as a context menu. With some twick can be used for multi purpose.
  • +
  • Use as simple popup or as a context menu. With some tweaking, it can be used for multiple purposes.
  • Adjust position and size to fit in viewport.
  • Keyboard interaction.
  • -
  • Support different type of inputs (structure object, UL list)  .
  • +
  • Support for different types of inputs (structure object, UL list)  .
  • Trigger Context menu with right-click, left-click,hover or any other mouse events.
  • Css outside of javascript so you can edit the look of menu.
  • Enable/disable options.
  • From a31d5fb643eea5073edbc24629577decf6ff12e1 Mon Sep 17 00:00:00 2001 From: Zoran Pavlovic Date: Fri, 2 Jan 2015 22:41:38 +0200 Subject: [PATCH 4/4] Typo in code example. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 38348b3..4df188b 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ Inside callback this refers to trigger element. Popup method is default when selector type is selector string , jquery object, DOM object. Menu method is default when selector type is structure object. Context menu accept three parameters.

    -
    $('.trigger).contextMenu(method,selector,options)
    +
    $('.trigger').contextMenu(method,selector,options)
    1. method tells what operation to trigger . By default it is popup if selector is string type (selector notation) and menu if selector is structure object.
    2. selector can be document object , jQuery object ,selector string or structure object.
    3. option, there are different options to change the behaviour of context menu. This parameter is optional where all options contain some default value.