Skip to content

Commit

Permalink
Update jQuery contextMenu.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasrosdal committed Jul 24, 2016
1 parent 367bc0f commit f14228f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
6 changes: 3 additions & 3 deletions freeciv-web/src/main/webapp/css/jquery.contextMenu.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 19 additions & 14 deletions freeciv-web/src/main/webapp/javascript/libs/jquery.contextMenu.js
@@ -1,7 +1,7 @@
/*!
* jQuery contextMenu v2.2.0 - Plugin for simple contextMenu handling
* jQuery contextMenu v2.2.3 - Plugin for simple contextMenu handling
*
* Version: v2.2.0
* Version: v2.2.3
*
* Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF)
* Web: http://swisnl.github.io/jQuery-contextMenu/
Expand All @@ -12,7 +12,7 @@
* MIT License http://www.opensource.org/licenses/mit-license
* GPL v3 http://opensource.org/licenses/GPL-3.0
*
* Date: 2016-06-13T13:50:47.616Z
* Date: 2016-07-17T19:36:02.968Z
*/

(function (factory) {
Expand Down Expand Up @@ -335,9 +335,7 @@
}
if (showMenu) {
// show menu
var menuContainer = (e.data.appendTo === null ? $('body') : $(e.data.appendTo));
var srcElement = e.target || e.srcElement || e.originalTarget;
op.show.call($this, e.data, e.pageX, e.pageY);
op.show.call($this, e.data, e.pageX, e.pageY);
}
}
},
Expand Down Expand Up @@ -485,7 +483,9 @@
});
}

if (root != null && root.$menu != null) root.$menu.trigger('contextmenu:hide');
if (root != null && root.$menu != null) {
root.$menu.trigger('contextmenu:hide');
}
}, 50);
},
// key handled :hover
Expand Down Expand Up @@ -840,9 +840,9 @@
e.preventDefault();
e.stopImmediatePropagation();

if ($.isFunction(root.callbacks[key]) && Object.prototype.hasOwnProperty.call(root.callbacks, key)) {
if ($.isFunction(opt.callbacks[key]) && Object.prototype.hasOwnProperty.call(opt.callbacks, key)) {
// item-specific callback
callback = root.callbacks[key];
callback = opt.callbacks[key];
} else if ($.isFunction(root.callback)) {
// default callback
callback = root.callback;
Expand Down Expand Up @@ -1112,7 +1112,8 @@

// Make old school string seperator a real item so checks wont be
// akward later.
if (typeof item === 'string') {
// And normalize 'cm_separator' into 'cm_seperator'.
if (typeof item === 'string' || item.type === 'cm_separator') {
item = { type : 'cm_seperator' };
}

Expand Down Expand Up @@ -1146,7 +1147,9 @@
// register commands
$.each([opt, root], function (i, k) {
k.commands[key] = item;
if ($.isFunction(item.callback)) {
// Overwrite only if undefined or the item is appended to the root. This so it
// doesn't overwrite callbacks of root elements if the name is the same.
if ($.isFunction(item.callback) && (k.callbacks[key] === undefined || opt.type === undefined)) {
k.callbacks[key] = item.callback;
}
});
Expand Down Expand Up @@ -1236,7 +1239,9 @@
default:
$.each([opt, root], function (i, k) {
k.commands[key] = item;
if ($.isFunction(item.callback)) {
// Overwrite only if undefined or the item is appended to the root. This so it
// doesn't overwrite callbacks of root elements if the name is the same.
if ($.isFunction(item.callback) && (k.callbacks[key] === undefined || opt.type === undefined)) {
k.callbacks[key] = item.callback;
}
});
Expand Down Expand Up @@ -1516,7 +1521,7 @@
}

if (!initialized) {
var itemClick = o.itemClickEvent === 'click' ? 'click.contextMenu' : 'mouseup.contextMenu'
var itemClick = o.itemClickEvent === 'click' ? 'click.contextMenu' : 'mouseup.contextMenu';
var contextMenuItemObj = {
// 'mouseup.contextMenu': handle.itemClick,
// 'click.contextMenu': handle.itemClick,
Expand All @@ -1526,7 +1531,7 @@
'mouseenter.contextMenu': handle.itemMouseenter,
'mouseleave.contextMenu': handle.itemMouseleave
};
contextMenuItemObj[itemClick] = handle.itemClick
contextMenuItemObj[itemClick] = handle.itemClick;
// make sure item click is registered first
$document
.on({
Expand Down

0 comments on commit f14228f

Please sign in to comment.