diff --git a/.editorconfig b/.editorconfig index fe6e86c..a9d53aa 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,7 +5,7 @@ root = true ; Unix-style newlines with a newline ending every file [*] -; end_of_line = lf +end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true @@ -16,11 +16,11 @@ indent_size = 4 ; Tab indentation (no size specified) [*.js] -; indent_style = tab -indent_style = space -indent_size = 4 +indent_style = tab +;indent_style = space +;indent_size = 4 ; Indentation override for all JS under lib directory -[lib/**.js] -indent_style = space -indent_size = 2 +;[lib/**.js] +;indent_style = space +;indent_size = 2 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bdb0cab --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..5c9953a --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,30 @@ +name: Mark stale issues and pull requests + +on: + schedule: + - cron: "0 0 * * *" + +jobs: + stale: + + runs-on: ubuntu-latest + + steps: + - uses: actions/stale@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: | + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. + Thank you for your contributions. + stale-pr-message: | + This pull request has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. + Thank you for your contributions. + stale-issue-label: 'stale' + exempt-issue-label: 'pinned' + stale-pr-label: 'stale' + exempt-pr-label: 'pinned' + days-before-stale: 90 + days-before-close: 14 + operations-per-run: 5 diff --git a/.gitignore b/.gitignore index f0844a2..242a85d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ /.settings /node_modules -/test/issue-* +/test/triage/ .DS_Store npm-debug.log .sizecache.json diff --git a/.travis.yml b/.travis.yml index 3f05c45..a238abe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: node_js node_js: - - 0.10 + # - 0.10 + - "8" sudo: false before_script: - npm install -g grunt-cli diff --git a/CHANGELOG.md b/CHANGELOG.md index 4667234..f1655ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1,67 @@ -# 1.13.0-0 / Unreleased - * +# 1.19.0 / Unreleased + - [FEATURE] Add `appendTo` option. + +# 1.18.1 / 2017-08-28 + +* [BUGFIX] Fix deprecation warnings when menu with `title` callback is opened + +# 1.18.0 / 2017-08-26 + +* [CHANGE] Refactored entry update methods + - `setEntry(cmd, data)`: + Clarify that this method resets all attributes *not* passed in + `data` are reset to defaults.
+ Also, passing a plain title string as `data` is deprecated: use `setTitle()` instead. + - Add method `updateEntry(cmd, data)`.
+ Example: `updateEntry("info", {title: "Show info...", enable: false})`
+ Unlike `setEntry()`, this method only updates menu attibutes that are + passed in `data`, leaving other attributes intact. + - Add methods `getEntry()`, `getEntryWrapper()`, `setIcon`, `setTitle` + (in addition to the existing `enableEntry` and `showEntry`). + +# 1.17.0 / 2017-04-17 + +* [FEATURE] #59 Allow callbacks for `disabled`, `title`, and `tooltip` options +* [FEATURE] #116 `autoFocus` skips leading disabled entries. +* [FEATURE] #118 New option `closeOnWindowBlur` +* Use `.on()` / `.off()` syntax +* Add check for missing `.delegate` option +* Set @VERSION in minified script + +# 1.16.0 / 2017-03-30 + +* [FEATURE] #114: Pass `extraData` argument to `select` and other events. + The same ui.extraData instance is passed to all events of a open-select-close + sequence, so it can also be used to pass data between events. + +# 1.15.0 / 2017-03-18 + +* [FEATURE] #113: Pass `ui` argument to `open` event. + +# 1.14.0 / 2017-01-30 + +* #108: Update AMD dependency to be compatible with the jQuery 1.12 layout: + "jquery-ui/ui/widgets/menu" + NOTE: this is not backwards compatible with jQuery 1.11 and before: + http://jqueryui.com/upgrade-guide/1.12/#official-package-on-npm + +# 1.13.1 / 2017-01-27 + +* [BUGFIX] #109 Fix `setEntry(title)` for titles containing icons +* [BUGFIX] #110 Fix `setEntry({...})` for jQuery UI 1.12 # 1.13.0 / 2016-08-21 - * [FEATURE] Test with jQuery 3 - * [FEATURE] #104 Allow to pass mouse click events to `open()` - * Update grunt to 1.0 - * Upate QUnit to 1.23 and refactor tests to use `assert` +* [FEATURE] Test with jQuery 3 +* [FEATURE] #104 Allow to pass mouse click events to `open()` +* Update grunt to 1.0 +* Upate QUnit to 1.23 and refactor tests to use `assert` # 1.12.0 / 2016-05-18 - * [FEATURE] Support jQuery UI 1.12 (wrap menu items in separate `
` tags) - * [FEATURE] #100 new menu option `isHeader` for category headers. - * Add jQuery UI 1.12 sample with new 'Base' theme +* [FEATURE] Support jQuery UI 1.12 (wrap menu items in separate `
` tags) +* [FEATURE] #100 new menu option `isHeader` for category headers. +* Add jQuery UI 1.12 sample with new 'Base' theme # 1.11.0 / 2015-09-10 @@ -70,10 +119,13 @@ # 1.3.0 / 2014-03-09 * [FEATURE] New optional parameter open(..., extraData). -* [FEATURE] New option `autoTrigger: true` can be set to `false` to prevent opening menus on browser's `contextmenu` event - (if you want to use the `open()` method instead). -* [FEATURE] New option `preventContextMenuForPopup`to prevent opening the browser's system context menu on menu entries. -* [CHANGE] `setEntry()` and `replaceMenu()` now allow to define titles with HTML markup. +* [FEATURE] New option `autoTrigger: true` can be set to `false` to prevent + opening menus on browser's `contextmenu` event (if you want to use the `open()` + method instead). +* [FEATURE] New option `preventContextMenuForPopup`to prevent opening the browser's + system context menu on menu entries. +* [CHANGE] `setEntry()` and `replaceMenu()` now allow to define titles with HTML + markup. # 1.2.4 / 2013-12-25 @@ -84,7 +136,8 @@ # 1.2.3 / 2013-10-19 * [CHANGE] Detection of separators compliant with UI Menu 1.10 -* [BUGFIX] Fixed setEntry for entries that don't have icons and handle missing `cmd` option. +* [BUGFIX] Fixed setEntry for entries that don't have icons and handle missing + `cmd` option. # 1.2.2 / 2013-07-28 @@ -123,3 +176,7 @@ * [FEATURE] Support `taphold` events. * [FEATURE] Show / hide effects configurable. * [BUGFIX] Fixed markup for disabled entries. + +# 0.2.0 / 2013-05-10 + +* First release. diff --git a/Gruntfile.coffee b/Gruntfile.coffee index f1b79c1..bb281e4 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -1,8 +1,8 @@ -#jshint node: true, camelcase: false +#jshint node: true, camelcase: false "use strict" module.exports = (grunt) -> grunt.initConfig - pkg: + pkg: grunt.file.readJSON("package.json") connect: @@ -32,7 +32,9 @@ module.exports = (grunt) -> upload: # FTP upload the demo files (requires https://github.com/mar10/pyftpsync) - cmd: "pyftpsync --progress upload . ftp://www.wwwendt.de/tech/demo/jquery-contextmenu --delete-unmatched --omit dist,node_modules,.*,_* -x" + stdin: true # Allow interactive console + cmd: "pyftpsync upload . ftp://www.wwwendt.de/tech/demo/jquery-contextmenu --delete-unmatched --exclude dist,node_modules,.*,_*" + # cmd: "pyftpsync --progress upload . ftp://www.wwwendt.de/tech/demo/jquery-contextmenu --delete-unmatched --omit dist,node_modules,.*,_*" jscs: src: ["jquery.ui-contextmenu.js", "test/tests.js"] @@ -46,113 +48,77 @@ module.exports = (grunt) -> jshintrc: ".jshintrc" qunit: - all: ["test/index.html", "test/index-jquery-ui-1-10.html"] - - # replace: # grunt-text-replace - # production: - # src: ["build/**/*.js"] - # overwrite : true - # replacements: [ { - # from : /@DATE/g - # to : "<%= grunt.template.today('yyyy-mm-dd\"T\"HH:MM') %>" - # },{ - # from : /buildType:\s*\"[a-zA-Z]+\"/g - # to : "buildType: \"production\"" - # },{ - # from : /debugLevel:\s*[0-9]/g - # to : "debugLevel: 1" - # } ] - # release: - # src: ["dist/**/*.js"] - # overwrite : true - # replacements: [ { - # from : /@VERSION/g - # to : "<%= pkg.version %>" - # } ] + all: [ + "test/test-jquery-3-ui-1.12.html", + "test/test-jquery-1.12-ui-1.12.html", + "test/test-jquery-1.11-ui-1.11.html", + "test/test-jquery-1.9-ui-1.10.html", + ] "saucelabs-qunit": - ui_10: + options: + build: process.env.TRAVIS_JOB_ID + throttled: 5 + # statusCheckAttempts: 180 + recordVideo: false + videoUploadOnPass: false + + ui_12: options: + testname: "jquery.ui-contextmenu qunit tests (jQuery UI 12)" urls: [ - # "http://localhost:9999/test/index.html", - "http://localhost:9999/test/test-jquery-1.9-ui-1.10.html" + "http://localhost:9999/test/test-jquery-3-ui-1.12.html" ] - build: process.env.TRAVIS_JOB_ID - throttled: 5 browsers: [ { browserName: "chrome", platform: "Windows 8.1" } { browserName: "firefox", platform: "Windows 8.1" } { browserName: "firefox", platform: "Linux" } - { browserName: "internet explorer", version: "6", platform: "Windows XP" } - { browserName: "internet explorer", version: "7", platform: "Windows XP" } - { browserName: "internet explorer", version: "8", platform: "Windows 7" } + # jQuery UI 12+ stopped support for IE <= 10 { browserName: "internet explorer", version: "11", platform: "Windows 8.1" } { browserName: "microsoftedge", platform: "Windows 10" } + # { browserName: "safari", version: "6", platform: "OS X 10.8" } + # { browserName: "safari", version: "7", platform: "OS X 10.9" } + # { browserName: "safari", version: "8", platform: "OS X 10.10" } { browserName: "safari", version: "9", platform: "OS X 10.11" } + { browserName: "safari", version: "10", platform: "OS X 10.12" } + { browserName: "safari", version: "11", platform: "OS X 10.12" } ] - testname: "jquery.ui-contextmenu qunit tests (jQuery UI 10)" - # statusCheckAttempts: 180 - recordVideo: false - videoUploadOnPass: false - ui_12: + ui_11: # UI Menu 11+ dropped support for IE7 options: + testname: "jquery.ui-contextmenu qunit tests (jQuery UI 11+)" urls: [ - "http://localhost:9999/test/test-jquery-3-ui-1.12.html" + "http://localhost:9999/test/test-jquery-1.11-ui-1.11.html" ] - build: process.env.TRAVIS_JOB_ID - throttled: 5 browsers: [ { browserName: "chrome", platform: "Windows 8.1" } - { browserName: "firefox", platform: "Windows 8.1" } { browserName: "firefox", platform: "Linux" } + # jQuery UI 11+ stopped support for IE <= 7 + # { browserName: "internet explorer", version: "8", platform: "Windows 7" } + { browserName: "internet explorer", version: "9", platform: "Windows 7" } + { browserName: "internet explorer", version: "10", platform: "Windows 8" } { browserName: "internet explorer", version: "11", platform: "Windows 8.1" } { browserName: "microsoftedge", platform: "Windows 10" } - { browserName: "safari", version: "9", platform: "OS X 10.11" } + { browserName: "safari", version: "10", platform: "OS X 10.12" } ] - testname: "jquery.ui-contextmenu qunit tests (jQuery UI 12)" - # statusCheckAttempts: 180 - recordVideo: false - videoUploadOnPass: false - ui: # UI Menu 11+ dropped support for IE7 + ui_10: options: + testname: "jquery.ui-contextmenu qunit tests (jQuery UI 10)" urls: [ - "http://localhost:9999/test/test-jquery-1.11-ui-1.11.html" - # "http://localhost:9999/test/index.html", - # "http://localhost:9999/test/index-jquery-ui-1-10.html" + "http://localhost:9999/test/test-jquery-1.9-ui-1.10.html" ] - - # username: process.env.SAUCE_USERNAME, - # key: process.env.SAUCE_ACCESS_KEY, - build: process.env.TRAVIS_JOB_ID - throttled: 5 browsers: [ { browserName: "chrome", platform: "Windows 8.1" } - { browserName: "firefox", platform: "Windows 8.1" } - # { browserName: "firefox", platform: "Windows XP" } { browserName: "firefox", platform: "Linux" } - # jQuery UI 11+ stopped support for IE 7 - # { browserName: "internet explorer", version: "6", platform: "Windows XP" } - # { browserName: "internet explorer", version: "7", platform: "Windows XP" } - { browserName: "internet explorer", version: "8", platform: "Windows 7" } - { browserName: "internet explorer", version: "9", platform: "Windows 7" } - { browserName: "internet explorer", version: "10", platform: "Windows 8" } { browserName: "internet explorer", version: "11", platform: "Windows 8.1" } { browserName: "microsoftedge", platform: "Windows 10" } - { browserName: "safari", version: "6", platform: "OS X 10.8" } - { browserName: "safari", version: "7", platform: "OS X 10.9" } - { browserName: "safari", version: "8", platform: "OS X 10.10" } - { browserName: "safari", version: "9", platform: "OS X 10.11" } + { browserName: "safari", version: "10", platform: "OS X 10.12" } ] - testname: "jquery.ui-contextmenu qunit tests (jQuery UI 11+)" - # statusCheckAttempts: 180 - recordVideo: false - videoUploadOnPass: false uglify: options: - banner: "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " + "<%= grunt.template.today('yyyy-mm-dd') %> | " + "<%= pkg.homepage ? ' ' + pkg.homepage + ' | ' : '' %>" + " Copyright (c) <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>;" + " Licensed <%= _.map(pkg.licenses, 'type').join(', ') %> */\n" + banner: "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " + "<%= grunt.template.today('yyyy-mm-dd') %> | " + "<%= pkg.homepage ? ' ' + pkg.homepage + ' | ' : '' %>" + " Copyright (c) 2013 -<%= grunt.template.today('yyyy') %> <%= pkg.author.name %>;" + " Licensed <%= _.map(pkg.licenses, 'type').join(', ') %> */\n" report: "gzip" build: @@ -180,10 +146,15 @@ module.exports = (grunt) -> # The following tools are run in order: check: { branch: ['master'], canPush: true, clean: true, cmpVersion: 'gte' } run_test: { tasks: ['test'] } - bump: {} # 'bump' also uses the increment mode `yabs:release:MODE` + bump: {} # 'bump' uses the increment mode `yabs:release:MODE` by default run_build: { tasks: ['build'] } + replace_build: + files: ['jquery.ui-contextmenu.min.js'] + patterns: [ + { match: /@VERSION/g, replacement: '{%= version %}'} + ] commit: {} - check_after_build: { clean: true } # Fails if new files found + check_after_build: { clean: true } # Fails if new files are found tag: {} push: { tags: true, useFollowTags: true } githubRelease: @@ -192,17 +163,17 @@ module.exports = (grunt) -> npmPublish: {} bump_develop: { inc: 'prepatch' } commit_develop: { message: 'Bump prerelease ({%= version %}) [ci skip]' } - push_develop: {} + push_develop: {} # another push (append a suffix for a uniqu ename) # Load "grunt*" dependencies for key of grunt.file.readJSON("package.json").devDependencies grunt.loadNpmTasks key if key isnt "grunt" and key.indexOf("grunt") is 0 - + grunt.registerTask "server", ["connect:demo"] grunt.registerTask "dev", ["connect:dev", "watch:dev"] grunt.registerTask "test", ["jshint", "jscs", "qunit"] - grunt.registerTask "sauce", ["connect:sauce", "saucelabs-qunit:ui","saucelabs-qunit:ui_10", "saucelabs-qunit:ui_12"] + grunt.registerTask "sauce", ["connect:sauce", "saucelabs-qunit:ui_12", "saucelabs-qunit:ui_11", "saucelabs-qunit:ui_10"] if parseInt(process.env.TRAVIS_PULL_REQUEST, 10) > 0 # saucelab keys do not work on forks # http://support.saucelabs.com/entries/25614798 @@ -211,7 +182,7 @@ module.exports = (grunt) -> grunt.registerTask "travis", ["test", "sauce"] grunt.registerTask "default", ["test"] grunt.registerTask "ci", ["test"] # Called by 'npm test' - + # "sauce", grunt.registerTask "build", ["exec:tabfix", "test", "uglify"] grunt.registerTask "upload", ["build", "exec:upload"] diff --git a/LICENSE.txt b/LICENSE.txt index 1fe179f..ff1e001 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright 2013-2016 Martin Wendt and others (see commiter list on GitHub) +Copyright 2013-2018 Martin Wendt and others (see commiter list on GitHub) https://github.com/mar10/jquery-ui-contextmenu Permission is hereby granted, free of charge, to any person obtaining diff --git a/README.md b/README.md index e614ce6..bcbb8d6 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,13 @@ -# jquery.ui-contextmenu [![GitHub version](https://badge.fury.io/gh/mar10%2Fjquery-ui-contextmenu.svg)](https://github.com/mar10/jquery-ui-contextmenu/releases/latest) [![Build Status](https://travis-ci.org/mar10/jquery-ui-contextmenu.png?branch=master)](https://travis-ci.org/mar10/jquery-ui-contextmenu) [![Selenium Test Status](https://saucelabs.com/buildstatus/sauce-contextmenu)](https://saucelabs.com/u/sauce-contextmenu) +# jquery.ui-contextmenu +[![GitHub version](https://badge.fury.io/gh/mar10%2Fjquery-ui-contextmenu.svg)](https://github.com/mar10/jquery-ui-contextmenu/releases/latest) +[![Build Status](https://travis-ci.org/mar10/jquery-ui-contextmenu.svg?branch=master)](https://travis-ci.org/mar10/jquery-ui-contextmenu) +[![Selenium Test Status](https://saucelabs.com/buildstatus/sauce-contextmenu)](https://saucelabs.com/u/sauce-contextmenu) +[![npm](https://img.shields.io/npm/dm/ui-contextmenu.svg)](https://www.npmjs.com/package/ui-contextmenu) +[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/ui-contextmenu/badge)](https://www.jsdelivr.com/package/npm/ui-contextmenu), > A jQuery plugin that provides a context menu (based on the standard [jQueryUI menu] widget). - * Define menus from `