Skip to content

Commit 87222dd

Browse files
committed
Improved build
1 parent a2ecb7c commit 87222dd

File tree

5 files changed

+72
-66
lines changed

5 files changed

+72
-66
lines changed

Gruntfile.js

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ module.exports = function (grunt) {
66

77
grunt.initConfig({
88
pkg: grunt.file.readJSON("package.json"),
9-
exec: {
10-
tabfix: {
11-
// Cleanup whitespace according to http://contribute.jquery.org/style-guide/js/
12-
// (requires https://github.com/mar10/tabfix)
13-
cmd: "tabfix -t -r -m*.js,*.css,*.html src demo test"
14-
},
15-
upload: {
16-
// FTP upload the demo files (requires https://github.com/mar10/pyftpsync)
17-
cmd: "pyftpsync upload . ftp://www.wwwendt.de/tech/demo/jquery-contextmenu --delete-unmatched --omit dist,node_modules,.*,_* -x"
18-
}
19-
},
9+
exec: {
10+
tabfix: {
11+
// Cleanup whitespace according to http://contribute.jquery.org/style-guide/js/
12+
// (requires https://github.com/mar10/tabfix)
13+
cmd: "tabfix -t -r -m *.js,*.css,*.html,*json,*.yaml -i node_modules ."
14+
},
15+
upload: {
16+
// FTP upload the demo files (requires https://github.com/mar10/pyftpsync)
17+
cmd: "pyftpsync --progress upload . ftp://www.wwwendt.de/tech/demo/jquery-contextmenu --delete-unmatched --omit dist,node_modules,.*,_* -x"
18+
}
19+
},
2020
qunit: {
2121
all: ["test/index.html"]
2222
},
@@ -32,28 +32,33 @@ module.exports = function (grunt) {
3232
uglify: {
3333
options: {
3434
// banner: "/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.license %> */\n"
35-
banner: "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " +
36-
"<%= grunt.template.today('yyyy-mm-dd') %> | " +
37-
"<%= pkg.homepage ? ' ' + pkg.homepage + ' | ' : '' %>" +
38-
" Copyright (c) <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>;" +
39-
" Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */\n"
35+
banner: "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " +
36+
"<%= grunt.template.today('yyyy-mm-dd') %> | " +
37+
"<%= pkg.homepage ? ' ' + pkg.homepage + ' | ' : '' %>" +
38+
" Copyright (c) <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>;" +
39+
" Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */\n"
4040
},
4141
build: {
4242
src: "jquery.contextmenu.js",
4343
// dest: "build/jquery.contextmenu-<%= pkg.version %>.min.js"
44-
dest: "jquery.contextmenu.min.js"
44+
dest: "jquery.contextmenu.min.js"
4545
}
4646
}
4747
});
4848

4949
grunt.loadNpmTasks("grunt-contrib-jshint");
5050
grunt.loadNpmTasks("grunt-contrib-uglify");
5151
grunt.loadNpmTasks("grunt-contrib-qunit");
52-
grunt.loadNpmTasks("grunt-exec");
52+
grunt.loadNpmTasks("grunt-exec");
5353

54-
grunt.registerTask("ci", ["jshint", "qunit"]);
55-
grunt.registerTask("default", ["jshint", "qunit", "uglify"]);
56-
grunt.registerTask("upload", [//"build",
57-
"exec:upload"]);
58-
grunt.registerTask("build", ["exec:tabfix", "default"]);
54+
// The 'ci' task is run on travis
55+
grunt.registerTask("ci", ["jshint",
56+
"qunit"]);
57+
grunt.registerTask("default", ["jshint",
58+
"qunit",
59+
"uglify"]);
60+
grunt.registerTask("build", ["exec:tabfix",
61+
"default"]);
62+
grunt.registerTask("upload", ["build",
63+
"exec:upload"]);
5964
};

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22

33
A jQuery plugin that provides a context menu (based on the standard [jQueryUI menu] widget).
44

5-
* themable
6-
* supports delegation (i.e. can be bound to elements that don't exist at the
7-
time the context menu is initialized)
8-
* exposes events from [jQueryUI menu]: `blur`, `create`, `focus`, `select`
5+
* Themable using [jQuery ThemeRoller](http://jqueryui.com/themeroller/).
6+
* Supports delegation (i.e. can be bound to elements that don't exist at the
7+
time the context menu is initialized).
8+
* Exposes events from [jQueryUI menu]: `blur`, `create`, `focus`, `select`.
99

1010

1111
## Status
12+
1213
Beta. Please report issues.
1314

1415

1516
## Demo
1617

17-
[Live demo page](http://mar10.github.com/jquery-contextmenu/demo/sample-widget.html)
18+
[Live demo page](http://wwwendt.de/tech/demo/jquery-contextmenu/demo/)
1819

1920

2021
## Example

demo/index.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@
1212
<style type="text/css">
1313
body{
1414
font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif";
15-
font-size: .8em;
15+
font-size: .8em;
1616
}
1717
.hasmenu{
18-
border: 1px solid #008;
19-
margin: 3px;
20-
padding: 2px;
21-
width: 30px;
18+
border: 1px solid #008;
19+
margin: 3px;
20+
padding: 2px;
21+
width: 30px;
2222
}
2323
.ui-widget{
24-
font-size: .8em;
24+
font-size: .8em;
2525
}
2626
.ui-menu {
2727
width: 120px;
2828
}
2929
/* Define a custom icon */
3030
.ui-icon.custom-icon-firefox {
31-
background-image: url(application_firefox.gif);
31+
background-image: url(application_firefox.gif);
3232
background-position: 0 0;
3333
}
3434
</style>
@@ -63,7 +63,7 @@
6363
// Trigger popup menu on the first target element
6464
$("#container").contextmenu("open", $(".hasmenu:first"));
6565
setTimeout(function(){
66-
$("#container").contextmenu("close");
66+
$("#container").contextmenu("close");
6767
}, 2000);
6868
});
6969
});

jquery.contextmenu.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -208,18 +208,18 @@
208208
_setOption: function(key, value){
209209
$.Widget.prototype._setOption.apply(this, arguments);
210210
},
211-
/**
212-
* Open context menu on a specific target (must match options.delegate)
213-
*/
214-
open: function(target){
215-
var e = jQuery.Event("contextmenu", {target: target.get(0)});
216-
return this.element.trigger(e);
217-
},
218-
/**
219-
* Close context menu.
220-
*/
221-
close: function(){
222-
return this._closeMenu.call(this);
223-
}
211+
/**
212+
* Open context menu on a specific target (must match options.delegate)
213+
*/
214+
open: function(target){
215+
var e = jQuery.Event("contextmenu", {target: target.get(0)});
216+
return this.element.trigger(e);
217+
},
218+
/**
219+
* Close context menu.
220+
*/
221+
close: function(){
222+
return this._closeMenu.call(this);
223+
}
224224
});
225225
} (jQuery));

package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,35 @@
55
"version": "0.1.0",
66
"homepage": "https://github.com/mar10/contextmenu",
77
"author": {
8-
"name": "Martin Wendt",
9-
"url": "http://wwwendt.de/"
8+
"name": "Martin Wendt",
9+
"url": "http://wwwendt.de/"
1010
},
1111
"repository": {
12-
"type": "svn",
13-
"url": "https://github.com/mar10/contextmenu"
12+
"type": "svn",
13+
"url": "https://github.com/mar10/contextmenu"
1414
},
1515
"bugs": {
16-
"url": "https://github.com/mar10/contextmenu/issues"
16+
"url": "https://github.com/mar10/contextmenu/issues"
1717
},
1818
"licenses": [
19-
{
20-
"type": "MIT",
21-
"url": "https://github.com/mar10/jquery-contextmenu/blob/master/MIT-LICENSE.txt"
22-
}
19+
{
20+
"type": "MIT",
21+
"url": "https://github.com/mar10/jquery-contextmenu/blob/master/MIT-LICENSE.txt"
22+
}
2323
],
2424
"dependencies": {
25-
"jquery": "~1.8"
25+
"jquery": "~1.8"
2626
},
2727
"keywords": [],
2828
"devDependencies": {
29-
"grunt": "~0.4.1",
30-
"grunt-contrib-jshint": "~0.3.0",
31-
"grunt-contrib-uglify": "~0.2.0",
32-
"grunt-contrib-qunit": "~0.2.0",
33-
"grunt-contrib-concat": "~0.1.3",
34-
"grunt-exec": "~0.4.0"
29+
"grunt": "~0.4.1",
30+
"grunt-contrib-jshint": "~0.3.0",
31+
"grunt-contrib-uglify": "~0.2.0",
32+
"grunt-contrib-qunit": "~0.2.0",
33+
"grunt-contrib-concat": "~0.1.3",
34+
"grunt-exec": "~0.4.0"
3535
},
3636
"scripts": {
37-
"test": "grunt ci --verbose"
37+
"test": "grunt ci --verbose"
3838
}
3939
}

0 commit comments

Comments
 (0)