parent
516287ac8f
commit
d1a4647830
@ -1,3 +1,3 @@
|
||||
/*! hotkeys-js v2.0.8 | MIT (c) 2018 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 e(e){return p[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)}function n(e){h=e||"all"}function t(){return h||"all"}function o(e,n,t){e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent&&e.attachEvent("on"+n,function(){t(window.event)})}function r(e){var n,o=e.keyCode||e.which||e.charCode,r=m["*"];if(-1===y.indexOf(o)&&y.push(o),93!==o&&224!==o||(o=91),o in w){w[o]=!0;for(var f in g)g[f]===o&&(c[f]=!0);if(!r)return}for(var a in w)w[a]=e[v[a]];if(c.filter.call(this,e)){if(n=t(),r)for(l=0;l<r.length;l++)r[l].scope===n&&i(e,r[l],n);if(o in m)for(var l=0;l<m[o].length;l++)i(e,m[o][l],n)}}function i(e,n,t){var o;if(n.scope===t||"all"===n.scope){o=n.mods.length>0;for(var r in w)(!w[r]&&n.mods.indexOf(+r)>-1||w[r]&&-1===n.mods.indexOf(+r))&&(o=!1);(0!==n.mods.length||w[16]||w[18]||w[17]||w[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 f(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 a(e){for(var n=e.slice(0,e.length-1),t=0;t<n.length;t++)n[t]=g[n[t].toLowerCase()];return n}function l(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 d(e){var n=e.keyCode||e.which||e.charCode,t=y.indexOf(n);if(t>=0&&y.splice(t,1),93!==n&&224!==n||(n=91),n in w){w[n]=!1;for(var o in g)g[o]===n&&(c[o]=!1)}}function c(n,t,o){var r=l(n),i=[],f=0;for(void 0===o&&(o=t,t="all");f<r.length;f++)i=[],(n=r[f].split("+")).length>1&&(i=a(n)),(n="*"===(n=n[n.length-1])?"*":e(n))in m||(m[n]=[]),m[n].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 s,u="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>0,p={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,"-":u?173:189,"=":u?61:187,";":u?59:186,"'":222,"[":219,"]":221,"\\":220},h="all",g={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":u?224:91,cmd:u?224:91,command:u?224:91},y=[],v={16:"shiftKey",18:"altKey",17:"ctrlKey"},w={16:!1,18:!1,17:!1},m={},x=1;x<20;x++)p["f"+x]=111+x;v[u?224:91]="metaKey",w[u?224:91]=!1,"undefined"!=typeof document&&(o(document,"keydown",function(e){r(e)}),o(document,"keyup",function(e){d(e)})),s={setScope:n,getScope:t,deleteScope:function(e,o){var r,i,f;e||(e=t());for(r in m)for(i=m[r],f=0;f<i.length;)i[f].scope===e?i.splice(f,1):f++;t()===e&&n(o||"all")},getPressedKeyCodes:function(){return y.slice(0)},isPressed:function(n){return"string"==typeof n&&(n=e(n)),-1!==y.indexOf(n)},filter:function(e){var n=(e.target||e.srcElement).tagName;return!("INPUT"===n||"SELECT"===n||"TEXTAREA"===n)},unbind:function(n,o){for(var r,i,d=l(n),c=[],s=0;s<d.length;s++){if((r=d[s].split("+")).length>1&&(c=a(r)),n=r[r.length-1],n="*"===n?"*":e(n),o||(o=t()),!m[n])return;for(var u=0;u<m[n].length;u++)(i=m[n][u]).scope===o&&f(i.mods,c)&&(m[n][u]={})}}};for(var k in s)c[k]=s[k];if("undefined"!=typeof window){var O=window.hotkeys;c.noConflict=function(e){return e&&window.hotkeys===c&&(window.hotkeys=O),c},window.hotkeys=c}return window.hotkeys=c,c});
|
||||
!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(){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 e,n="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>0,t={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,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,"⇪":20,capslock:20,",":188,".":190,"/":191,"`":192,"-":n?173:189,"=":n?61:187,";":n?59:186,"'":222,"[":219,"]":221,"\\":220},o="all",r={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":n?224:91,cmd:n?224:91,command:n?224:91},i=[],f={16:"shiftKey",18:"altKey",17:"ctrlKey"},a={16:!1,18:!1,17:!1},l={},d=1;d<20;d++)t["f"+d]=111+d;function s(e){return t[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)}function c(e){o=e||"all"}function u(){return o||"all"}function p(e,n,t){e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent&&e.attachEvent("on"+n,function(){t(window.event)})}function h(e,n,t){var o;if(n.scope===t||"all"===n.scope){for(var r in o=n.mods.length>0,a)(!a[r]&&n.mods.indexOf(+r)>-1||a[r]&&-1===n.mods.indexOf(+r))&&(o=!1);(0!==n.mods.length||a[16]||a[18]||a[17]||a[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 g(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 y(e){for(var n=e.slice(0,e.length-1),t=0;t<n.length;t++)n[t]=r[n[t].toLowerCase()];return n}function v(e){var n,t;for(e||(e=""),t=(n=(e=e.replace(/\s/g,"")).split(",")).lastIndexOf("");t>=0;)n[t-1]+=",",n.splice(t,1),t=n.lastIndexOf("");return n}function w(e,n,t){var o=v(e),r=[],i=0;for(void 0===t&&(t=n,n="all");i<o.length;i++)r=[],(e=o[i].split("+")).length>1&&(r=y(e)),(e="*"===(e=e[e.length-1])?"*":s(e))in l||(l[e]=[]),l[e].push({shortcut:o[i],scope:n,method:t,key:o[i],mods:r})}for(var m in f[n?224:91]="metaKey",a[n?224:91]=!1,"undefined"!=typeof document&&(p(document,"keydown",function(e){!function(e){var n,t=e.keyCode||e.which||e.charCode,o=l["*"];if(-1===i.indexOf(t)&&i.push(t),93!==t&&224!==t||(t=91),t in a){for(var d in a[t]=!0,r)r[d]===t&&(w[d]=!0);if(!o)return}for(var s in a)a[s]=e[f[s]];if(w.filter.call(this,e)){if(n=u(),o)for(c=0;c<o.length;c++)o[c].scope===n&&h(e,o[c],n);if(t in l)for(var c=0;c<l[t].length;c++)h(e,l[t][c],n)}}(e)}),p(document,"keyup",function(e){!function(e){var n=e.keyCode||e.which||e.charCode,t=i.indexOf(n);t>=0&&i.splice(t,1);93!==n&&224!==n||(n=91);if(n in a)for(var o in a[n]=!1,r)r[o]===n&&(w[o]=!1)}(e)})),e={setScope:c,getScope:u,deleteScope:function(e,n){var t,o,r;for(t in e||(e=u()),l)for(o=l[t],r=0;r<o.length;)o[r].scope===e?o.splice(r,1):r++;u()===e&&c(n||"all")},getPressedKeyCodes:function(){return i.slice(0)},isPressed:function(e){return"string"==typeof e&&(e=s(e)),-1!==i.indexOf(e)},filter:function(e){var n=(e.target||e.srcElement).tagName;return!("INPUT"===n||"SELECT"===n||"TEXTAREA"===n)},unbind:function(e,n){for(var t,o,r=v(e),i=[],f=0;f<r.length;f++){if((t=r[f].split("+")).length>1&&(i=y(t)),e="*"===(e=t[t.length-1])?"*":s(e),n||(n=u()),!l[e])return;for(var a=0;a<l[e].length;a++)(o=l[e][a]).scope===n&&g(o.mods,i)&&(l[e][a]={})}}})w[m]=e[m];if("undefined"!=typeof window){var x=window.hotkeys;w.noConflict=function(e){return e&&window.hotkeys===w&&(window.hotkeys=x),w},window.hotkeys=w}return window.hotkeys=w,w});
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue