Skip to content
This repository was archived by the owner on Aug 14, 2021. It is now read-only.

Commit 78c7f1e

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents cd6dcc8 + 30e9f72 commit 78c7f1e

File tree

4 files changed

+14
-29
lines changed

4 files changed

+14
-29
lines changed

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module.exports = function (grunt) {
4646
connect: {
4747
demo: {
4848
options: {
49-
hostname: "*", // make accessible from everywhere
49+
hostname: "*", // make accessible from everywhere
5050
port: 8080,
5151
base: "./",
5252
keepalive: true

demo/index.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@
2424
font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif";
2525
font-size: .8em;
2626
/* Prevent tablets from selecting text on taphold, etc:
27-
Note:
27+
Note:
2828
If only the potential menu trigger elements should be protected, simply
2929
use the 'preventSelect: true' option.
3030
But we disable it more globally for table pcs, because the whole line
31-
or paragraph will still be selected otherwise.
32-
31+
or paragraph will still be selected otherwise.
3332
*/
3433
-webkit-user-select: none;
3534
-khtml-user-select: none;
@@ -96,7 +95,7 @@
9695
beforeOpen: function(event, ui) {
9796
var $menu = ui.menu,
9897
$target = $(event.relatedTarget);
99-
console.log("beforeOpen", this, event, ui, "" + CLIPBOARD);
98+
// console.log("beforeOpen", this, event, ui, "" + CLIPBOARD);
10099
$(document)
101100
// .contextmenu("replaceMenu", [{title: "aaa"}, {title: "bbb"}])
102101
// .contextmenu("setEntry", "cut", {title: "Cuty", uiIcon: "ui-icon-heart", disabled: true})

jquery.ui-contextmenu.js

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,8 @@
1111
/*
1212
* TODO:
1313
* - change namespace to 'moogle'
14-
* - use _on / _off
15-
* - move version to prototype
16-
* - generally take more advantage off http://api.jqueryui.com/jQuery.widget/
17-
* - open() programatically at a given positon
1814
*/
1915
(function ($) {
20-
// function getMenuFromEvent(event){
21-
// var menu = $(event.target).closest(":ui-menu"),
22-
// $menu = $(menu);
23-
// return $menu.data("ui-menu") || $menu.data("menu");
24-
// }
2516
var supportSelectstart = "onselectstart" in document.createElement("div");
2617

2718
/** Return command without leading '#' (default to ""). */
@@ -55,18 +46,18 @@
5546
var eventNames, targetId,
5647
opts = this.options;
5748

58-
console.log(this.element)
59-
49+
// console.log(this.element)
50+
6051
this.$headStyle = null;
6152
this.orgMenu = null;
6253
this.currentTarget = null;
6354
this.ns = "." + this.widgetName;
64-
55+
6556
if(opts.preventSelect){
6657
// Create a global style for all potential menu targets
67-
// If the contextmenu was bound to `document`, we apply the
68-
// selector relative to the <body> tag instead
69-
targetId = ($(this.element).is(document) ? $("body") : this.element).uniqueId().attr("id");
58+
// If the contextmenu was bound to `document`, we apply the
59+
// selector relative to the <body> tag instead
60+
targetId = ($(this.element).is(document) ? $("body") : this.element).uniqueId().attr("id");
7061
this.$headStyle = $("<style class='ui-contextmenu-style'>")
7162
.prop("type", "text/css")
7263
.html("#" + targetId + " " + opts.delegate + " { " +
@@ -210,9 +201,6 @@
210201
_getMenu: function(){
211202
// this.options.menu may be a string, jQuery or a function returning that.
212203
var $menu = this.options.menu;
213-
// if( $.isFunction($menu) ){
214-
// $menu = $menu();
215-
// }
216204
return (typeof $menu === "string") ? $($menu) : $menu;
217205
},
218206
/** Open context menu on a specific target (must match options.delegate) */
@@ -233,7 +221,6 @@
233221
},
234222
/** Redefine the whole menu. */
235223
replaceMenu: function(data){
236-
// return this.element.contextmenu("option", "menu", menu);
237224
var opts = this.options,
238225
$menu = this._getMenu();
239226

@@ -270,8 +257,7 @@
270257
.first()
271258
.replaceWith(titleOrData);
272259
}else{
273-
$parent = $entry.closest("li");
274-
$parent.empty();
260+
$parent = $entry.closest("li").empty();
275261
$.ui.contextmenu.createEntryMarkup(titleOrData, $parent);
276262
}
277263
},
@@ -301,7 +287,7 @@ $.extend($.ui.contextmenu, {
301287
$a.append($("<span class='ui-icon'>").addClass(entry.uiIcon));
302288
}
303289
if(entry.disabled){
304-
$a.addClass("ui-state-disabled");
290+
$parentLi.addClass("ui-state-disabled");
305291
}
306292
}
307293
return $a;

jquery.ui-contextmenu.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)