From 108093fda987dadf64f78f2c57f964f49713de5e Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Tue, 30 Jul 2019 17:41:18 +0800 Subject: [PATCH] Updates --- index.html | 2 +- website.9a427855.js => website.88a1f824.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) rename website.9a427855.js => website.88a1f824.js (99%) diff --git a/index.html b/index.html index 9e158f9..59c9473 100644 --- a/index.html +++ b/index.html @@ -1,2 +1,2 @@ -hotkeys.js - A robust Javascript library for capturing keyboard input.
+hotkeys.js - A robust Javascript library for capturing keyboard input.
\ No newline at end of file diff --git a/website.9a427855.js b/website.88a1f824.js similarity index 99% rename from website.9a427855.js rename to website.88a1f824.js index 4adcb9a..cd26622 100644 --- a/website.9a427855.js +++ b/website.88a1f824.js @@ -635,11 +635,11 @@ module.exports={shields:"_shields_e4c42"}; },{"react":"1n8/","./GithubShields.less":"1nZi"}],"rzuK":[function(require,module,exports) { module.exports={version:"_version_044f0",keyCodeInfo:"_keyCodeInfo_044f0",header:"_header_044f0",title:"_title_044f0",lang:"_lang_044f0",info:"_info_044f0",github:"_github_044f0"}; },{}],"OviO":[function(require,module,exports) { -module.exports = "# Hotkeys\n\n\n\n[![](https://img.shields.io/github/issues/jaywcjlove/hotkeys.svg)](https://github.com/jaywcjlove/hotkeys/issues) [![](https://img.shields.io/github/forks/jaywcjlove/hotkeys.svg)](https://github.com/jaywcjlove/hotkeys/network) [![](https://img.shields.io/github/stars/jaywcjlove/hotkeys.svg)](https://github.com/jaywcjlove/hotkeys/stargazers) [![](https://img.shields.io/github/release/jaywcjlove/hotkeys.svg)](https://github.com/jaywcjlove/hotkeys/releases) ![](http://jaywcjlove.github.io/sb/status/no-dependencies.svg) [![Build Status](https://www.travis-ci.org/jaywcjlove/hotkeys.svg?branch=master)](https://www.travis-ci.org/jaywcjlove/hotkeys) [![Coverage Status](https://coveralls.io/repos/github/jaywcjlove/hotkeys/badge.svg?branch=master)](https://coveralls.io/github/jaywcjlove/hotkeys?branch=master) [![jaywcjlove/sb](https://jaywcjlove.github.io/sb/lang/chinese.svg)](./README-zh.md)\n\nHotKeys.js is an input capture library with some very special features, it is easy to pick up and use, has a reasonable footprint (~3kb) (gzipped: 1.73kb), and has no dependencies. It should not interfere with any JavaScript libraries or frameworks. Official document [demo preview](http://jaywcjlove.github.io/hotkeys). [More examples](https://github.com/jaywcjlove/hotkeys/issues?q=label%3ADemo+).\n\n```shell\n╭┈┈╮ ╭┈┈╮ ╭┈┈╮\n┆ ├┈┈..┈┈┈┈┈.┆ └┈╮┆ ├┈┈..┈┈┈┈┈..┈┈.┈┈..┈┈┈┈┈.\n┆ ┆┆ □ ┆┆ ┈┤┆ < ┆ -__┘┆ ┆ ┆┆__ ┈┈┤\n╰┈┈┴┈┈╯╰┈┈┈┈┈╯╰┈┈┈┈╯╰┈┈┴┈┈╯╰┈┈┈┈┈╯╰┈┈┈ ┆╰┈┈┈┈┈╯\n ╰┈┈┈┈┈╯\n```\n\n## Usage\n\nYou will need `Node.js` installed on your system.\n\n```shell\n$ npm install hotkeys-js --save\n```\n\n```js\nimport hotkeys from 'hotkeys-js';\n\nhotkeys('f5', function(event, handler){\n // Prevent the default refresh event under WINDOWS system\n event.preventDefault() \n alert('you pressed F5!') \n});\n```\n\nOr manually download and link **hotkeys.js** in your HTML, It can also be downloaded via [UNPKG](https://unpkg.com/hotkeys-js/dist/):\n\n```html\n\n\n```\n\n### Used in React\n\n[react-hotkeys](https://github.com/jaywcjlove/react-hotkeys) is the React component that listen to keydown and keyup keyboard events, defining and dispatching keyboard shortcuts.\n\n```shell\n$ npm install react-hot-keys --save\n```\n\nDetailed use method please see its documentation [react-hotkeys](https://github.com/jaywcjlove/react-hotkeys).\n\n```jsx\nimport React, { Component } from 'react';\nimport Hotkeys from 'react-hot-keys';\n\nexport default class HotkeysDemo extends Component {\n constructor(props) {\n super(props);\n this.state = {\n output: 'Hello, I am a component that listens to keydown and keyup of a',\n }\n }\n onKeyUp(keyNm, e, handle) {\n this.setState({output: keyNm})\n }\n onKeyDown(keyName, e, handle) {\n this.setState({output: keyNm})\n }\n render() {\n return (\n \n
{this.state.output}
\n
\n )\n }\n}\n```\n\n## Browser Support\n\nHotkeys.js has been tested and should work in.\n\n```shell\nInternet Explorer 6+\nSafari\nFirefox\nChrome\n```\n\n## Supported Keys\n\nHotKeys understands the following modifiers: `⇧`, `shift`, `option`, `⌥`, `alt`, `ctrl`, `control`, `command`, and `⌘`.\n\nThe following special keys can be used for shortcuts: backspace, tab, clear, enter, return, esc, escape, space, up, down, left, right, home, end, pageup, pagedown, del, delete and f1 through f19.\n\n`⌘` Command() \n`⌃` Control \n`⌥` Option(alt) \n`⇧` Shift \n`⇪` Caps Lock(Capital) \n~~`fn` Does not support fn~~ \n`↩︎` return/Enter space \n\n## Defining Shortcuts\n\nOne global method is exposed, key which defines shortcuts when called directly.\n\n```\nhotkeys([keys:], [option:[string|object|function]], [callback:])\n```\n\n\n```js\nhotkeys('f5', function(event, handler) {\n // Prevent the default refresh event under WINDOWS system\n event.preventDefault();\n alert('you pressed F5!');\n});\n\n// Returning false stops the event and prevents default browser events\n// Mac OS system defines `command + r` as a refresh shortcut\nhotkeys('ctrl+r, command+r', function() {\n alert('stopped reload!');\n return false;\n});\n\n\nhotkeys('a', function(event,handler){\n //event.srcElement: input \n //event.target: input\n if(event.target === \"input\"){\n alert('you pressed a!')\n }\n alert('you pressed a!') \n});\n\nhotkeys('ctrl+a,ctrl+b,r,f', function(event,handler) {\n switch(handler.key){\n case \"ctrl+a\":alert('you pressed ctrl+a!');break;\n case \"ctrl+b\":alert('you pressed ctrl+b!');break;\n case \"r\":alert('you pressed r!');break;\n case \"f\":alert('you pressed f!');break;\n }\n});\n\nhotkeys('ctrl+a+s', function(event,handler) {\n if(handler.key === 'ctrl+a+s') {\n alert('you pressed ctrl+a+s!');\n }\n});\n\nhotkeys('*','wcj', function(e){\n console.log('do something',e);\n});\n```\n\n#### option \n\n- `scope`\n- `element`\n- `keyup`\n- `keydown`\n\n```js\nhotkeys('o, enter', {\n scope: 'wcj',\n element: document.getElementById('warpper'),\n}, function(){ \n console.log('do something else');\n});\n```\n\n## API REFERENCE\n\nAsterisk \"*\"\n\nModifier key judgments\n\n```js\nhotkeys('*', function(e){\n if(hotkeys.shift) console.log('shift is pressed!');\n if(hotkeys.ctrl) console.log('ctrl is pressed!');\n if(hotkeys.alt) console.log('alt is pressed!');\n if(hotkeys.option) console.log('option is pressed!');\n if(hotkeys.control) console.log('control is pressed!');\n if(hotkeys.cmd) console.log('cmd is pressed!');\n if(hotkeys.command) console.log('command is pressed!');\n});\n```\n\n### setScope\n\nUse the `hotkeys.setScope` method to set scope.\n\n```js\n// define shortcuts with a scope\nhotkeys('ctrl+o, ctrl+alt+enter', 'issues', function(){\n console.log('do something');\n});\nhotkeys('o, enter', 'files', function(){ \n console.log('do something else');\n});\n\n// set the scope (only 'all' and 'issues' shortcuts will be honored)\nhotkeys.setScope('issues'); // default scope is 'all'\n```\n\n### getScope\n\nUse the `hotkeys.getScope` method to get scope.\n\n```js\nhotkeys.getScope();\n```\n\n### deleteScope\n\nUse the `hotkeys.deleteScope` method to delete set scope.\n\n```js\nhotkeys.deleteScope('issues');\n```\n\n### unbind\n\nSimilar to defining shortcuts, they can be unbound using `hotkeys.unbind`.\n\n```js\n// unbind 'a' handler\nhotkeys.unbind('a');\n\n// unbind a hotkeys only for a single scope\n// when no scope is specified it defaults to the current scope (hotkeys.getScope())\nhotkeys.unbind('o, enter', 'issues');\nhotkeys.unbind('o, enter', 'files');\n```\n\nUnbind events through functions.\n\n```js\nfunction example(){}\nhotkeys('a', example);\nhotkeys.unbind('a', example);\n\nhotkeys('a', 'issues', example);\nhotkeys.unbind('a', 'issues', example);\n```\n\n### isPressed\n\nOther key queries. For example, `hotkeys.isPressed(77)` is true if the `M` key is currently pressed.\n\n```js\nhotkeys('a', function(){\n console.log(hotkeys.isPressed(\"a\")); //=> true\n console.log(hotkeys.isPressed(\"A\")); //=> true\n console.log(hotkeys.isPressed(65)); //=> true\n});\n```\n\n## keyup\n\n**key down** and **key up** both perform callback events.\n\n```js\nhotkeys('ctrl+a,alt+a+s', { keyup: true }, (evn, handler) => {\n if(evn.type === 'keydown') {\n console.log('keydown:', evn.type, handler, handler.key);\n }\n if(evn.type === 'keyup') {\n console.log('keyup:', evn.type, handler, handler.key);\n }\n});\n```\n\n### getPressedKeyCodes\n\nreturns an array of key codes currently pressed.\n\n```js\nhotkeys('command+ctrl+shift+a,f', function(){\n console.log(hotkeys.getPressedKeyCodes()); //=> [17, 65] or [70]\n})\n```\n\n### filter\n\n`INPUT` `SELECT` `TEXTAREA` default does not handle.\n`Hotkeys.filter` to return to the `true` shortcut keys set to play a role, `false` shortcut keys set up failure.\n\n```js\nhotkeys.filter = function(event){\n return true;\n}\n//How to add the filter to edit labels.
\n//\"contentEditable\" Older browsers that do not support drops\nhotkeys.filter = function(event) {\n var tagName = (event.target || event.srcElement).tagName;\n return !(tagName.isContentEditable || tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA');\n}\n\nhotkeys.filter = function(event){\n var tagName = (event.target || event.srcElement).tagName;\n hotkeys.setScope(/^(INPUT|TEXTAREA|SELECT)$/.test(tagName) ? 'input' : 'other');\n return true;\n}\n```\n\n### noConflict\n\nRelinquish HotKeys’s control of the `hotkeys` variable.\n\n```js\nvar k = hotkeys.noConflict();\nk('a', function() {\n console.log(\"do something\")\n});\n\nhotkeys()\n// -->Uncaught TypeError: hotkeys is not a function(anonymous function) \n// @ VM2170:2InjectedScript._evaluateOn \n// @ VM2165:883InjectedScript._evaluateAndWrap \n// @ VM2165:816InjectedScript.evaluate @ VM2165:682\n```\n \n## Development\n\nTo develop, Install dependencies, Get the code:\n\n```shell\n$ git https://github.com/jaywcjlove/hotkeys.git\n$ cd hotkeys # Into the directory\n$ npm install # or yarn install\n```\n\nTo develop, run the self-reloading build:\n\n```shell\n$ npm run watch\n```\n\nRun Document Website Environment.\n\n```shell\n$ npm run doc:dev\n```\n\nTo contribute, please fork Hotkeys.js, add your patch and tests for it (in the `test/` folder) and submit a pull request.\n\n```shell\n$ npm run test\n$ npm run test:watch # Development model\n```\n\n## License\n\n[MIT © Kenny Wong](./LICENSE)\n" +module.exports = "# Hotkeys\n\n\n\n[![](https://img.shields.io/github/issues/jaywcjlove/hotkeys.svg)](https://github.com/jaywcjlove/hotkeys/issues) [![](https://img.shields.io/github/forks/jaywcjlove/hotkeys.svg)](https://github.com/jaywcjlove/hotkeys/network) [![](https://img.shields.io/github/stars/jaywcjlove/hotkeys.svg)](https://github.com/jaywcjlove/hotkeys/stargazers) [![](https://img.shields.io/github/release/jaywcjlove/hotkeys.svg)](https://github.com/jaywcjlove/hotkeys/releases) ![](http://jaywcjlove.github.io/sb/status/no-dependencies.svg) [![Build Status](https://www.travis-ci.org/jaywcjlove/hotkeys.svg?branch=master)](https://www.travis-ci.org/jaywcjlove/hotkeys) [![Coverage Status](https://coveralls.io/repos/github/jaywcjlove/hotkeys/badge.svg?branch=master)](https://coveralls.io/github/jaywcjlove/hotkeys?branch=master) [![jaywcjlove/sb](https://jaywcjlove.github.io/sb/lang/chinese.svg)](./README-zh.md)\n\nHotKeys.js is an input capture library with some very special features, it is easy to pick up and use, has a reasonable footprint (~3kb) (gzipped: 1.73kb), and has no dependencies. It should not interfere with any JavaScript libraries or frameworks. Official document [demo preview](http://jaywcjlove.github.io/hotkeys). [More examples](https://github.com/jaywcjlove/hotkeys/issues?q=label%3ADemo+).\n\n```shell\n╭┈┈╮ ╭┈┈╮ ╭┈┈╮\n┆ ├┈┈..┈┈┈┈┈.┆ └┈╮┆ ├┈┈..┈┈┈┈┈..┈┈.┈┈..┈┈┈┈┈.\n┆ ┆┆ □ ┆┆ ┈┤┆ < ┆ -__┘┆ ┆ ┆┆__ ┈┈┤\n╰┈┈┴┈┈╯╰┈┈┈┈┈╯╰┈┈┈┈╯╰┈┈┴┈┈╯╰┈┈┈┈┈╯╰┈┈┈ ┆╰┈┈┈┈┈╯\n ╰┈┈┈┈┈╯\n```\n\n## Usage\n\nYou will need `Node.js` installed on your system.\n\n```shell\n$ npm install hotkeys-js --save\n```\n\n```js\nimport hotkeys from 'hotkeys-js';\n\nhotkeys('f5', function(event, handler){\n // Prevent the default refresh event under WINDOWS system\n event.preventDefault() \n alert('you pressed F5!') \n});\n```\n\nOr manually download and link **hotkeys.js** in your HTML, It can also be downloaded via [UNPKG](https://unpkg.com/hotkeys-js/dist/):\n\n```html\n\n\n```\n\n### Used in React\n\n[react-hotkeys](https://github.com/jaywcjlove/react-hotkeys) is the React component that listen to keydown and keyup keyboard events, defining and dispatching keyboard shortcuts.\n\n```shell\n$ npm install react-hot-keys --save\n```\n\nDetailed use method please see its documentation [react-hotkeys](https://github.com/jaywcjlove/react-hotkeys).\n\n## Browser Support\n\nHotkeys.js has been tested and should work in.\n\n```shell\nInternet Explorer 6+\nSafari\nFirefox\nChrome\n```\n\n## Supported Keys\n\nHotKeys understands the following modifiers: `⇧`, `shift`, `option`, `⌥`, `alt`, `ctrl`, `control`, `command`, and `⌘`.\n\nThe following special keys can be used for shortcuts: backspace, tab, clear, enter, return, esc, escape, space, up, down, left, right, home, end, pageup, pagedown, del, delete and f1 through f19.\n\n`⌘` Command() \n`⌃` Control \n`⌥` Option(alt) \n`⇧` Shift \n`⇪` Caps Lock(Capital) \n~~`fn` Does not support fn~~ \n`↩︎` return/Enter space \n\n## Defining Shortcuts\n\nOne global method is exposed, key which defines shortcuts when called directly.\n\n```\nhotkeys([keys:], [option:[string|object|function]], [callback:])\n```\n\n\n```js\nhotkeys('f5', function(event, handler) {\n // Prevent the default refresh event under WINDOWS system\n event.preventDefault();\n alert('you pressed F5!');\n});\n\n// Returning false stops the event and prevents default browser events\n// Mac OS system defines `command + r` as a refresh shortcut\nhotkeys('ctrl+r, command+r', function() {\n alert('stopped reload!');\n return false;\n});\n\n\nhotkeys('a', function(event,handler){\n //event.srcElement: input \n //event.target: input\n if(event.target === \"input\"){\n alert('you pressed a!')\n }\n alert('you pressed a!') \n});\n\nhotkeys('ctrl+a,ctrl+b,r,f', function(event,handler) {\n switch(handler.key){\n case \"ctrl+a\":alert('you pressed ctrl+a!');break;\n case \"ctrl+b\":alert('you pressed ctrl+b!');break;\n case \"r\":alert('you pressed r!');break;\n case \"f\":alert('you pressed f!');break;\n }\n});\n\nhotkeys('ctrl+a+s', function(event,handler) {\n if(handler.key === 'ctrl+a+s') {\n alert('you pressed ctrl+a+s!');\n }\n});\n\nhotkeys('*','wcj', function(e){\n console.log('do something',e);\n});\n```\n\n#### option \n\n- `scope`\n- `element`\n- `keyup`\n- `keydown`\n\n```js\nhotkeys('o, enter', {\n scope: 'wcj',\n element: document.getElementById('warpper'),\n}, function(){ \n console.log('do something else');\n});\n```\n\n## API REFERENCE\n\nAsterisk \"*\"\n\nModifier key judgments\n\n```js\nhotkeys('*', function(e){\n if(hotkeys.shift) console.log('shift is pressed!');\n if(hotkeys.ctrl) console.log('ctrl is pressed!');\n if(hotkeys.alt) console.log('alt is pressed!');\n if(hotkeys.option) console.log('option is pressed!');\n if(hotkeys.control) console.log('control is pressed!');\n if(hotkeys.cmd) console.log('cmd is pressed!');\n if(hotkeys.command) console.log('command is pressed!');\n});\n```\n\n### setScope\n\nUse the `hotkeys.setScope` method to set scope.\n\n```js\n// define shortcuts with a scope\nhotkeys('ctrl+o, ctrl+alt+enter', 'issues', function(){\n console.log('do something');\n});\nhotkeys('o, enter', 'files', function(){ \n console.log('do something else');\n});\n\n// set the scope (only 'all' and 'issues' shortcuts will be honored)\nhotkeys.setScope('issues'); // default scope is 'all'\n```\n\n### getScope\n\nUse the `hotkeys.getScope` method to get scope.\n\n```js\nhotkeys.getScope();\n```\n\n### deleteScope\n\nUse the `hotkeys.deleteScope` method to delete set scope.\n\n```js\nhotkeys.deleteScope('issues');\n```\n\n### unbind\n\nSimilar to defining shortcuts, they can be unbound using `hotkeys.unbind`.\n\n```js\n// unbind 'a' handler\nhotkeys.unbind('a');\n\n// unbind a hotkeys only for a single scope\n// when no scope is specified it defaults to the current scope (hotkeys.getScope())\nhotkeys.unbind('o, enter', 'issues');\nhotkeys.unbind('o, enter', 'files');\n```\n\nUnbind events through functions.\n\n```js\nfunction example(){}\nhotkeys('a', example);\nhotkeys.unbind('a', example);\n\nhotkeys('a', 'issues', example);\nhotkeys.unbind('a', 'issues', example);\n```\n\n### isPressed\n\nOther key queries. For example, `hotkeys.isPressed(77)` is true if the `M` key is currently pressed.\n\n```js\nhotkeys('a', function(){\n console.log(hotkeys.isPressed(\"a\")); //=> true\n console.log(hotkeys.isPressed(\"A\")); //=> true\n console.log(hotkeys.isPressed(65)); //=> true\n});\n```\n\n## keyup\n\n**key down** and **key up** both perform callback events.\n\n```js\nhotkeys('ctrl+a,alt+a+s', { keyup: true }, (evn, handler) => {\n if(evn.type === 'keydown') {\n console.log('keydown:', evn.type, handler, handler.key);\n }\n if(evn.type === 'keyup') {\n console.log('keyup:', evn.type, handler, handler.key);\n }\n});\n```\n\n### getPressedKeyCodes\n\nreturns an array of key codes currently pressed.\n\n```js\nhotkeys('command+ctrl+shift+a,f', function(){\n console.log(hotkeys.getPressedKeyCodes()); //=> [17, 65] or [70]\n})\n```\n\n### filter\n\n`INPUT` `SELECT` `TEXTAREA` default does not handle.\n`Hotkeys.filter` to return to the `true` shortcut keys set to play a role, `false` shortcut keys set up failure.\n\n```js\nhotkeys.filter = function(event){\n return true;\n}\n//How to add the filter to edit labels.
\n//\"contentEditable\" Older browsers that do not support drops\nhotkeys.filter = function(event) {\n var tagName = (event.target || event.srcElement).tagName;\n return !(tagName.isContentEditable || tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA');\n}\n\nhotkeys.filter = function(event){\n var tagName = (event.target || event.srcElement).tagName;\n hotkeys.setScope(/^(INPUT|TEXTAREA|SELECT)$/.test(tagName) ? 'input' : 'other');\n return true;\n}\n```\n\n### noConflict\n\nRelinquish HotKeys’s control of the `hotkeys` variable.\n\n```js\nvar k = hotkeys.noConflict();\nk('a', function() {\n console.log(\"do something\")\n});\n\nhotkeys()\n// -->Uncaught TypeError: hotkeys is not a function(anonymous function) \n// @ VM2170:2InjectedScript._evaluateOn \n// @ VM2165:883InjectedScript._evaluateAndWrap \n// @ VM2165:816InjectedScript.evaluate @ VM2165:682\n```\n \n## Development\n\nTo develop, Install dependencies, Get the code:\n\n```shell\n$ git https://github.com/jaywcjlove/hotkeys.git\n$ cd hotkeys # Into the directory\n$ npm install # or yarn install\n```\n\nTo develop, run the self-reloading build:\n\n```shell\n$ npm run watch\n```\n\nRun Document Website Environment.\n\n```shell\n$ npm run doc:dev\n```\n\nTo contribute, please fork Hotkeys.js, add your patch and tests for it (in the `test/` folder) and submit a pull request.\n\n```shell\n$ npm run test\n$ npm run test:watch # Development model\n```\n\n## License\n\n[MIT © Kenny Wong](./LICENSE)\n" },{}],"yNIz":[function(require,module,exports) { -"use strict";var e="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function t(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on".concat(t),function(){n(window.event)})}function n(e,t){for(var n=t.slice(0,t.length-1),o=0;o=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}function r(e,t){for(var n=e.length>=t.length?e:t,o=e.length>=t.length?t:e,r=!0,i=0;i=0&&p.splice(n,1),e.key&&"meta"===e.key.toLowerCase()&&p.splice(0,p.length),93!==t&&224!==t||(t=91),t in l)for(var o in l[t]=!1,a)a[o]===t&&(j[o]=!1)}function b(e,t,i){var c,l,s=o(e),p=[];"function"==typeof t&&(i=t,t="all");for(var u=0;u1?n(a,c):[],e="*"===(e=c[c.length-1])?"*":h(e),t||(t=v()),!f[e])return;for(var d=0;d0,l)Object.prototype.hasOwnProperty.call(l,r)&&(!l[r]&&t.mods.indexOf(+r)>-1||l[r]&&-1===t.mods.indexOf(+r))&&(o=!1);(0!==t.mods.length||l[16]||l[18]||l[17]||l[91])&&!o&&"*"!==t.shortcut||!1===t.method(e,t)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function x(e){var t=f["*"],n=e.keyCode||e.which||e.charCode;if(j.filter.call(this,e)){if(-1===p.indexOf(n)&&229!==n&&p.push(n),93!==n&&224!==n||(n=91),n in l){for(var o in l[n]=!0,a)a[o]===n&&(j[o]=!0);if(!t)return}for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(l[r]=e[c[r]]);var i=v();if(t)for(var s=0;s-1}function j(e,r,i){var c=o(e),l=[],s="all",u=document,y=0,v=!1,g=!0;for(void 0===i&&"function"==typeof r&&(i=r),"[object Object]"===Object.prototype.toString.call(r)&&(r.scope&&(s=r.scope),r.element&&(u=r.element),r.keyup&&(v=r.keyup),r.keydown&&(g=r.keydown)),"string"==typeof r&&(s=r);y1&&(l=n(a,e)),(e="*"===(e=e[e.length-1])?"*":h(e))in f||(f[e]=[]),f[e].push({keyup:v,keydown:g,scope:s,mods:l,shortcut:c[y],method:i,key:c[y]});void 0!==u&&!E(u)&&window&&(d.push(u),t(u,"keydown",function(e){x(e)}),t(window,"focus",function(){p=[]}),t(u,"keyup",function(e){x(e),O(e)}))}var P={setScope:y,getScope:v,deleteScope:m,getPressedKeyCodes:g,isPressed:k,filter:w,unbind:b};for(var L in P)Object.prototype.hasOwnProperty.call(P,L)&&(j[L]=P[L]);if("undefined"!=typeof window){var A=window.hotkeys;j.noConflict=function(e){return e&&window.hotkeys===j&&(window.hotkeys=A),j},window.hotkeys=j}module.exports=j; +"use strict";var e="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function t(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on".concat(t),function(){n(window.event)})}function n(e,t){for(var n=t.slice(0,t.length-1),o=0;o=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}function r(e,t){for(var n=e.length>=t.length?e:t,o=e.length>=t.length?t:e,r=!0,i=0;i=0&&p.splice(n,1),e.key&&"meta"===e.key.toLowerCase()&&p.splice(0,p.length),93!==t&&224!==t||(t=91),t in l)for(var o in l[t]=!1,a)a[o]===t&&(j[o]=!1)}function b(e,t,i){var c,l,s=o(e),p=[];"function"==typeof t&&(i=t,t="all");for(var d=0;d1?n(a,c):[],e="*"===(e=c[c.length-1])?"*":h(e),t||(t=v()),!f[e])return;for(var u=0;u0,l)Object.prototype.hasOwnProperty.call(l,r)&&(!l[r]&&t.mods.indexOf(+r)>-1||l[r]&&-1===t.mods.indexOf(+r))&&(o=!1);(0!==t.mods.length||l[16]||l[18]||l[17]||l[91])&&!o&&"*"!==t.shortcut||!1===t.method(e,t)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function x(e){var t=f["*"],n=e.keyCode||e.which||e.charCode;if(j.filter.call(this,e)){if(-1===p.indexOf(n)&&229!==n&&p.push(n),93!==n&&224!==n||(n=91),n in l){for(var o in l[n]=!0,a)a[o]===n&&(j[o]=!0);if(!t)return}for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(l[r]=e[c[r]]);var i=v();if(t)for(var s=0;s-1}function j(e,r,i){var c=o(e),l=[],s="all",d=document,y=0,v=!1,g=!0;for(void 0===i&&"function"==typeof r&&(i=r),"[object Object]"===Object.prototype.toString.call(r)&&(r.scope&&(s=r.scope),r.element&&(d=r.element),r.keyup&&(v=r.keyup),void 0!==r.keydown&&(g=r.keydown)),"string"==typeof r&&(s=r);y1&&(l=n(a,e)),(e="*"===(e=e[e.length-1])?"*":h(e))in f||(f[e]=[]),f[e].push({keyup:v,keydown:g,scope:s,mods:l,shortcut:c[y],method:i,key:c[y]});void 0!==d&&!E(d)&&window&&(u.push(d),t(d,"keydown",function(e){x(e)}),t(window,"focus",function(){p=[]}),t(d,"keyup",function(e){x(e),O(e)}))}var P={setScope:y,getScope:v,deleteScope:m,getPressedKeyCodes:g,isPressed:k,filter:w,unbind:b};for(var L in P)Object.prototype.hasOwnProperty.call(P,L)&&(j[L]=P[L]);if("undefined"!=typeof window){var A=window.hotkeys;j.noConflict=function(e){return e&&window.hotkeys===j&&(window.hotkeys=A),j},window.hotkeys=j}module.exports=j; },{}],"EHrm":[function(require,module,exports) { -module.exports={name:"hotkeys-js",description:"A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.",version:"3.6.12",main:"index.js",types:"index.d.ts",module:"dist/hotkeys.esm.js",scripts:{lint:"eslint --ext .js src website",deploy:"node scripts/build.js && npm run doc:build && gh-pages -d doc",build:"node scripts/build.js && npm run doc:build",watch:"node scripts/watch.js",pretest:"npm run build",test:"jest --coverage","test:watch":"jest --watch",doc:"npm run doc:dev","doc:dev":"NODE_ENV=development parcel website/index.html --out-dir doc --no-cache","doc:build":"rimraf doc && NODE_ENV=production parcel build website/index.html --out-dir doc --public-url ./ --no-cache --no-source-maps"},files:["index.d.ts","dist","doc"],husky:{hooks:{"pre-commit":"npm run lint"}},keywords:["hotkey","hotkeys","hotkeys-js","hotkeysjs","key","keys","keyboard","shortcuts","keypress"],author:"kenny wong ",license:"MIT",homepage:"http://jaywcjlove.github.io/hotkeys",repository:{type:"git",url:"https://github.com/jaywcjlove/hotkeys.git"},jest:{testURL:"http://localhost/"},dependencies:{},devDependencies:{"@babel/core":"^7.4.4","@babel/plugin-external-helpers":"^7.2.0","@babel/plugin-transform-runtime":"^7.4.4","@babel/preset-env":"^7.4.4","@babel/preset-react":"^7.0.0",autoprefixer:"^8.6.1","babel-eslint":"^8.2.3",bannerjs:"^1.0.5",classnames:"^2.2.5","colors-cli":"^1.0.13",eslint:"^4.19.1","eslint-config-airbnb":"^16.1.0","eslint-plugin-import":"^2.12.0","eslint-plugin-jsx-a11y":"^6.0.3","eslint-plugin-react":"^7.9.1","gh-pages":"^1.2.0","highlight.js":"^9.12.0",husky:"^1.0.0-rc.8",jest:"^24.7.1",less:"^3.0.4","parcel-bundler":"^1.12.3","parcel-plugin-markdown-string":"^1.3.5","postcss-modules":"^1.1.0",puppeteer:"^1.14.0",react:"^16.7.0","react-dom":"^16.7.0","react-markdown":"^3.3.2",rimraf:"^2.6.3",rollup:"^1.11.0","rollup-plugin-babel":"^4.3.2","rollup-plugin-commonjs":"^9.3.4","rollup-plugin-node-resolve":"^4.2.3","uglify-js":"^3.4.0",zlib:"^1.0.5"}}; +module.exports={name:"hotkeys-js",description:"A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.",version:"3.6.13",main:"index.js",types:"index.d.ts",module:"dist/hotkeys.esm.js",scripts:{lint:"eslint --ext .js src website",deploy:"node scripts/build.js && npm run doc:build && gh-pages -d doc",build:"node scripts/build.js && npm run doc:build",watch:"node scripts/watch.js",pretest:"npm run build",test:"jest --coverage","test:watch":"jest --watch",doc:"npm run doc:dev","doc:dev":"NODE_ENV=development parcel website/index.html --out-dir doc --no-cache","doc:build":"rimraf doc && NODE_ENV=production parcel build website/index.html --out-dir doc --public-url ./ --no-cache --no-source-maps"},files:["index.d.ts","dist","doc"],husky:{hooks:{"pre-commit":"npm run lint"}},keywords:["hotkey","hotkeys","hotkeys-js","hotkeysjs","key","keys","keyboard","shortcuts","keypress"],author:"kenny wong ",license:"MIT",homepage:"http://jaywcjlove.github.io/hotkeys",repository:{type:"git",url:"https://github.com/jaywcjlove/hotkeys.git"},jest:{testURL:"http://localhost/"},dependencies:{},devDependencies:{"@babel/core":"^7.4.4","@babel/plugin-external-helpers":"^7.2.0","@babel/plugin-transform-runtime":"^7.4.4","@babel/preset-env":"^7.4.4","@babel/preset-react":"^7.0.0",autoprefixer:"^8.6.1","babel-eslint":"^8.2.3",bannerjs:"^1.0.5",classnames:"^2.2.5","colors-cli":"^1.0.13",eslint:"^4.19.1","eslint-config-airbnb":"^16.1.0","eslint-plugin-import":"^2.12.0","eslint-plugin-jsx-a11y":"^6.0.3","eslint-plugin-react":"^7.9.1","gh-pages":"^1.2.0","highlight.js":"^9.12.0",husky:"^1.0.0-rc.8",jest:"^24.8.0",less:"^3.0.4","parcel-bundler":"^1.12.3","parcel-plugin-markdown-string":"^1.3.5","postcss-modules":"^1.1.0",puppeteer:"^1.14.0",react:"^16.7.0","react-dom":"^16.7.0","react-markdown":"^3.3.2",rimraf:"^2.6.3",rollup:"^1.11.0","rollup-plugin-babel":"^4.3.2","rollup-plugin-commonjs":"^9.3.4","rollup-plugin-node-resolve":"^4.2.3","uglify-js":"^3.4.0",zlib:"^1.0.5"}}; },{}],"lY9v":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=v(require("@babel/runtime/helpers/classCallCheck")),t=v(require("@babel/runtime/helpers/createClass")),o=v(require("@babel/runtime/helpers/possibleConstructorReturn")),a=v(require("@babel/runtime/helpers/getPrototypeOf")),n=v(require("@babel/runtime/helpers/assertThisInitialized")),r=v(require("@babel/runtime/helpers/inherits")),l=m(require("react")),s=v(require("./components/GithubCorner")),u=v(require("./components/KeyBoard")),i=v(require("./components/Footer")),c=v(require("./components/Markdown")),d=v(require("./components/GithubShields")),h=v(require("./styles/index.less")),f=v(require("../README.md")),y=v(require("../dist/hotkeys.common")),p=v(require("../package.json"));function m(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,o):{};a.get||a.set?Object.defineProperty(t,o,a):t[o]=e[o]}return t.default=e,t}function v(e){return e&&e.__esModule?e:{default:e}}var k=function(m){function v(){var t;return(0,e.default)(this,v),(t=(0,o.default)(this,(0,a.default)(v).call(this))).state={keyCode:[],keyStr:[]},t.onKeyUpEvent=t.onKeyUpEvent.bind((0,n.default)(t)),t}return(0,r.default)(v,m),(0,t.default)(v,[{key:"componentDidMount",value:function(){var e=this;function t(e,t){return-1===e.indexOf(t)&&e.push(t),e}function o(e,t){return-1===e.indexOf(t)&&e.push(t),e}return document.addEventListener("keyup",this.onKeyUpEvent),(0,y.default)("*",function(a){a.preventDefault();var n=[],r=[];y.default.shift&&(t(n,16),o(r,"shift")),y.default.ctrl&&(t(n,17),o(r,"ctrl")),y.default.alt&&(t(n,18),o(r,"alt")),y.default.control&&(t(n,17),o(r,"control")),y.default.command&&(t(n,91),o(r,"command")),r.push(a.keyCode),-1===n.indexOf(a.keyCode)&&n.push(a.keyCode),e.setState({keyCode:n,keyStr:r})}),!1}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keyup",this.onKeyUpEvent)}},{key:"onKeyUpEvent",value:function(){this.setState({keyCode:[],keyStr:[]})}},{key:"onKeyBoardMouseDown",value:function(e){e.keycode>-1&&this.setState({keyStr:[e.keycode]})}},{key:"onKeyBoardMouseUp",value:function(){this.setState({keyStr:[]})}},{key:"openVersionWebsite",value:function(e){e.target&&e.target.value&&(window.location.href=e.target.value)}},{key:"render",value:function(){var e=this.state.keyStr,t=f.default;return t&&(t=f.default.replace(/([\s\S]*)/,"")),l.default.createElement("div",null,l.default.createElement("select",{className:h.default.version,onChange:this.openVersionWebsite.bind(this)},l.default.createElement("option",{value:"https://jaywcjlove.github.io/hotkeys"},"v",p.default.version),l.default.createElement("option",{value:"https://unpkg.com/hotkeys-js@3.4.3/doc/index.html"},"v3.4.3"),l.default.createElement("option",{value:"https://unpkg.com/hotkeys-js@3.4.2/doc/index.html"},"v3.4.2"),l.default.createElement("option",{value:"https://unpkg.com/hotkeys-js@2.0.10/doc/index.html"},"v2.0.10")),e.length>-1&&l.default.createElement("div",{className:h.default.keyCodeInfo},e.map(function(e){return l.default.createElement("span",{key:"".concat(e)},e)})),l.default.createElement(s.default,{url:"https://github.com/jaywcjlove/hotkeys"}),l.default.createElement("div",{className:h.default.header},l.default.createElement("div",{className:h.default.title},"HotKeys.js"),l.default.createElement("div",{className:h.default.github},l.default.createElement("a",{href:"https://www.npmjs.com/package/hotkeys-js"},l.default.createElement("button",null,"On NPM")),l.default.createElement("a",{href:"https://github.com/jaywcjlove/hotkeys/"},l.default.createElement("button",null,"Fork on Github")),l.default.createElement("a",{href:"https://github.com/jaywcjlove/hotkeys/"},l.default.createElement("button",null,"Doc on Github"))),l.default.createElement("div",{className:h.default.info},"A robust Javascript library for capturing keyboard input and key combinations entered. It has no dependencies. Try to press your keyboard, The following button will highlight.")),l.default.createElement(u.default,{onMouseDown:this.onKeyBoardMouseDown.bind(this),onMouseUp:this.onKeyBoardMouseUp.bind(this),keyCode:this.state.keyCode}),l.default.createElement(c.default,{source:t}),l.default.createElement(d.default,{source:[{href:"https://github.com/jaywcjlove/hotkeys/stargazers",img:"https://img.shields.io/github/stars/jaywcjlove/hotkeys.svg?style=social"},{href:"https://github.com/jaywcjlove/hotkeys/network",img:"https://img.shields.io/github/forks/jaywcjlove/hotkeys.svg?style=social"},{href:"https://github.com/jaywcjlove/hotkeys/watchers",img:"https://img.shields.io/github/watchers/jaywcjlove/hotkeys.svg?style=social&label=Watch"},{href:"https://github.com/jaywcjlove/followers",img:"https://img.shields.io/github/followers/jaywcjlove.svg?style=social"}]}),l.default.createElement(i.default,{name:"Kenny Wong",href:"http://jaywcjlove.github.io",year:"2015-present"}))}}]),v}(l.Component);exports.default=k; },{"@babel/runtime/helpers/classCallCheck":"0fcM","@babel/runtime/helpers/createClass":"P8NW","@babel/runtime/helpers/possibleConstructorReturn":"0421","@babel/runtime/helpers/getPrototypeOf":"UJE0","@babel/runtime/helpers/assertThisInitialized":"E7HD","@babel/runtime/helpers/inherits":"d4H2","react":"1n8/","./components/GithubCorner":"q0X/","./components/KeyBoard":"Y40V","./components/Footer":"9f+Z","./components/Markdown":"sza+","./components/GithubShields":"n1B7","./styles/index.less":"rzuK","../README.md":"OviO","../dist/hotkeys.common":"yNIz","../package.json":"EHrm"}],"f9Gk":[function(require,module,exports) {