hotkeys-js
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -1,3 +0,3 @@ | ||
/*! hotkeys-js v2.0.2 | MIT (c) 2017 kenny wang <wowohoo@qq.com> | https://github.com/jaywcjlove/hotkeys.git */ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).hotkeys=e()}}(function(){function n(e){return h[e.toUpperCase()]||e.toUpperCase().charCodeAt(0)}function t(e){g=e||"all"}function o(){return g||"all"}function r(e,n,t){e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent&&e.attachEvent("on"+n,function(){t(window.event)})}function i(e){var n,t=e.keyCode||e.which||e.charCode,r=x["*"];if(-1===y.indexOf(t)&&y.push(t),93!==t&&224!==t||(t=91),t in m){m[t]=!0;for(var i in v)v[i]===t&&(d[i]=!0);if(!r)return}for(var a in m)m[a]=e[w[a]];if(d.filter.call(this,e)){if(n=o(),r)for(l=0;l<r.length;l++)r[l].scope===n&&f(e,r[l],n);if(t in x)for(var l=0;l<x[t].length;l++)f(e,x[t][l],n)}}function f(e,n,t){var o;if(n.scope===t||"all"===n.scope){o=n.mods.length>0;for(var r in m)(!m[r]&&n.mods.indexOf(+r)>-1||m[r]&&-1===n.mods.indexOf(+r))&&(o=!1);(0!==n.mods.length||m[16]||m[18]||m[17]||m[91])&&!o&&"*"!==n.shortcut||!1===n.method(e,n)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function a(e,n){for(var t=e.length>=n.length?e:n,o=e.length>=n.length?n:e,r=0;r<t.length;r++)if(-1===o.indexOf(t[r]))return!1;return!0}function l(e){for(var n=e.slice(0,e.length-1),t=0;t<n.length;t++)n[t]=v[n[t].toLowerCase()];return n}function c(e){e||(e="");var n,t;for(t=(n=(e=e.replace(/\s/g,"")).split(",")).lastIndexOf("");t>=0;)n[t-1]+=",",n.splice(t,1),t=n.lastIndexOf("");return n}function s(n){var t=n.keyCode||e.which||e.charCode,o=y.indexOf(t);if(o>=0&&y.splice(o,1),93!==t&&224!==t||(t=91),t in m){m[t]=!1;for(var r in v)v[r]===t&&(d[r]=!1)}}function d(e,t,o){var r=c(e),i=[],f=0;for(void 0===o&&(o=t,t="all");f<r.length;f++)i=[],(e=r[f].split("+")).length>1&&(i=l(e)),(e="*"===(e=e[e.length-1])?"*":n(e))in x||(x[e]=[]),x[e].push({shortcut:r[f],scope:t,method:o,key:r[f],mods:i})}Array.prototype.indexOf||(Array.prototype.indexOf=function(e){for(var n=0;n<this.length;n++)if(this[n]===e)return n;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(e){for(var n=this.length-1;n>=0;n--)if(this[n]===e)return n;return-1});for(var u,p=navigator.userAgent.toLowerCase().indexOf("firefox")>0,h={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,home:36,end:35,pageup:33,pagedown:34,"⇪":20,capslock:20,",":188,".":190,"/":191,"`":192,"-":p?173:189,"=":p?61:187,";":p?59:186,"'":222,"[":219,"]":221,"\\":220},g="all",v={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":p?224:91,cmd:p?224:91,command:p?224:91},y=[],w={16:"shiftKey",18:"altKey",17:"ctrlKey"},m={16:!1,18:!1,17:!1},x={},O=1;O<20;O++)h["f"+O]=111+O;w[p?224:91]="metaKey",m[p?224:91]=!1,r(document,"keydown",function(e){i(e)}),r(document,"keyup",function(e){s(e)}),u={setScope:t,getScope:o,deleteScope:function(e,n){var r,i,f;e||(e=o());for(r in x)for(i=x[r],f=0;f<i.length;)i[f].scope===e?i.splice(f,1):f++;o()===e&&t(n||"all")},getPressedKeyCodes:function(){return y.slice(0)},isPressed:function(e){return"string"==typeof e&&(e=n(e)),-1!==y.indexOf(e)},filter:function(e){var n=(e.target||e.srcElement).tagName;return!("INPUT"===n||"SELECT"===n||"TEXTAREA"===n)},unbind:function(e,t){for(var r,i,f=c(e),s=[],d=0;d<f.length;d++){if((r=f[d].split("+")).length>1&&(s=l(r)),e=r[r.length-1],e="*"===e?"*":n(e),t||(t=o()),!x[e])return;for(var u=0;u<x[e].length;u++)(i=x[e][u]).scope===t&&a(i.mods,s)&&(x[e][u]={})}}};for(var k in u)d[k]=u[k];var C=window.hotkeys;return d.noConflict=function(e){return e&&window.hotkeys===d&&(window.hotkeys=C),d},window.hotkeys=d,d}); | ||
/*! hotkeys-js v2.0.4 | MIT (c) 2017 kenny wang <wowohoo@qq.com> | https://github.com/jaywcjlove/hotkeys.git */ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).hotkeys=e()}}(function(){function n(e){return h[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)}function t(e){g=e||"all"}function o(){return g||"all"}function r(e,n,t){e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent&&e.attachEvent("on"+n,function(){t(window.event)})}function i(e){var n,t=e.keyCode||e.which||e.charCode,r=x["*"];if(-1===y.indexOf(t)&&y.push(t),93!==t&&224!==t||(t=91),t in m){m[t]=!0;for(var i in v)v[i]===t&&(d[i]=!0);if(!r)return}for(var a in m)m[a]=e[w[a]];if(d.filter.call(this,e)){if(n=o(),r)for(l=0;l<r.length;l++)r[l].scope===n&&f(e,r[l],n);if(t in x)for(var l=0;l<x[t].length;l++)f(e,x[t][l],n)}}function f(e,n,t){var o;if(n.scope===t||"all"===n.scope){o=n.mods.length>0;for(var r in m)(!m[r]&&n.mods.indexOf(+r)>-1||m[r]&&-1===n.mods.indexOf(+r))&&(o=!1);(0!==n.mods.length||m[16]||m[18]||m[17]||m[91])&&!o&&"*"!==n.shortcut||!1===n.method(e,n)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function a(e,n){for(var t=e.length>=n.length?e:n,o=e.length>=n.length?n:e,r=0;r<t.length;r++)if(-1===o.indexOf(t[r]))return!1;return!0}function l(e){for(var n=e.slice(0,e.length-1),t=0;t<n.length;t++)n[t]=v[n[t].toLowerCase()];return n}function c(e){e||(e="");var n,t;for(t=(n=(e=e.replace(/\s/g,"")).split(",")).lastIndexOf("");t>=0;)n[t-1]+=",",n.splice(t,1),t=n.lastIndexOf("");return n}function s(n){var t=n.keyCode||e.which||e.charCode,o=y.indexOf(t);if(o>=0&&y.splice(o,1),93!==t&&224!==t||(t=91),t in m){m[t]=!1;for(var r in v)v[r]===t&&(d[r]=!1)}}function d(e,t,o){var r=c(e),i=[],f=0;for(void 0===o&&(o=t,t="all");f<r.length;f++)i=[],(e=r[f].split("+")).length>1&&(i=l(e)),(e="*"===(e=e[e.length-1])?"*":n(e))in x||(x[e]=[]),x[e].push({shortcut:r[f],scope:t,method:o,key:r[f],mods:i})}Array.prototype.indexOf||(Array.prototype.indexOf=function(e){for(var n=0;n<this.length;n++)if(this[n]===e)return n;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(e){for(var n=this.length-1;n>=0;n--)if(this[n]===e)return n;return-1});for(var u,p=navigator.userAgent.toLowerCase().indexOf("firefox")>0,h={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,home:36,end:35,pageup:33,pagedown:34,"⇪":20,capslock:20,",":188,".":190,"/":191,"`":192,"-":p?173:189,"=":p?61:187,";":p?59:186,"'":222,"[":219,"]":221,"\\":220},g="all",v={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":p?224:91,cmd:p?224:91,command:p?224:91},y=[],w={16:"shiftKey",18:"altKey",17:"ctrlKey"},m={16:!1,18:!1,17:!1},x={},O=1;O<20;O++)h["f"+O]=111+O;w[p?224:91]="metaKey",m[p?224:91]=!1,r(document,"keydown",function(e){i(e)}),r(document,"keyup",function(e){s(e)}),u={setScope:t,getScope:o,deleteScope:function(e,n){var r,i,f;e||(e=o());for(r in x)for(i=x[r],f=0;f<i.length;)i[f].scope===e?i.splice(f,1):f++;o()===e&&t(n||"all")},getPressedKeyCodes:function(){return y.slice(0)},isPressed:function(e){return"string"==typeof e&&(e=n(e)),-1!==y.indexOf(e)},filter:function(e){var n=(e.target||e.srcElement).tagName;return!("INPUT"===n||"SELECT"===n||"TEXTAREA"===n)},unbind:function(e,t){for(var r,i,f=c(e),s=[],d=0;d<f.length;d++){if((r=f[d].split("+")).length>1&&(s=l(r)),e=r[r.length-1],e="*"===e?"*":n(e),t||(t=o()),!x[e])return;for(var u=0;u<x[e].length;u++)(i=x[e][u]).scope===t&&a(i.mods,s)&&(x[e][u]={})}}};for(var k in u)d[k]=u[k];var C=window.hotkeys;return d.noConflict=function(e){return e&&window.hotkeys===d&&(window.hotkeys=C),d},window.hotkeys=d,d}); | ||
{ | ||
"name": "hotkeys-js", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.", | ||
@@ -5,0 +5,0 @@ "author": "kenny wang <wowohoo@qq.com>", |
@@ -147,10 +147,10 @@ # 设置快捷键 | ||
`⌘` Command() | ||
`⌃` Control | ||
`⌥` Option(alt) | ||
`⇧` Shift | ||
`⇪` Caps Lock(大写) | ||
~~`fn` 功能键就是fn(不支持)~~ | ||
`↩︎` return/enter | ||
`space` 空格键 | ||
`⌘` Command() | ||
`⌃` Control | ||
`⌥` Option(alt) | ||
`⇧` Shift | ||
`⇪` Caps Lock(大写) | ||
~~`fn` 功能键就是fn(不支持)~~ | ||
`↩︎` return/enter | ||
`space` 空格键 | ||
@@ -213,4 +213,4 @@ ## 修饰键判断 | ||
`hotkeys.unbind("ctrl+o, ctrl+alt+enter")` 解除绑定两组快捷键 | ||
`hotkeys.unbind("ctrl+o","files")` 解除绑定名字叫files钟的一组快捷键 | ||
`hotkeys.unbind("ctrl+o, ctrl+alt+enter")` 解除绑定两组快捷键 | ||
`hotkeys.unbind("ctrl+o","files")` 解除绑定名字叫files钟的一组快捷键 | ||
@@ -217,0 +217,0 @@ ## 键判断 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12923
3
16