|
|
@ -1,11 +1,10 @@
|
|
|
|
/*!
|
|
|
|
/**!
|
|
|
|
* hotkeys-js v3.8.7
|
|
|
|
* hotkeys-js v3.8.8
|
|
|
|
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
|
|
|
|
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (c) 2022 kenny wong <wowohoo@qq.com>
|
|
|
|
* Copyright (c) 2022 kenny wong <wowohoo@qq.com>
|
|
|
|
* http://jaywcjlove.github.io/hotkeys
|
|
|
|
* http://jaywcjlove.github.io/hotkeys
|
|
|
|
*
|
|
|
|
* Licensed under the MIT license
|
|
|
|
* Licensed under the MIT license.
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
var isff = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().indexOf('firefox') > 0 : false; // 绑定事件
|
|
|
|
var isff = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().indexOf('firefox') > 0 : false; // 绑定事件
|
|
|
@ -155,6 +154,8 @@ for (var k = 1; k < 20; k++) {
|
|
|
|
|
|
|
|
|
|
|
|
var _downKeys = []; // 记录摁下的绑定键
|
|
|
|
var _downKeys = []; // 记录摁下的绑定键
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var winListendFocus = false; // window是否已经监听了focus事件
|
|
|
|
|
|
|
|
|
|
|
|
var _scope = 'all'; // 默认热键范围
|
|
|
|
var _scope = 'all'; // 默认热键范围
|
|
|
|
|
|
|
|
|
|
|
|
var elementHasBindEvent = []; // 已绑定事件的节点记录
|
|
|
|
var elementHasBindEvent = []; // 已绑定事件的节点记录
|
|
|
@ -524,9 +525,14 @@ function hotkeys(key, option, method) {
|
|
|
|
addEvent(element, 'keydown', function (e) {
|
|
|
|
addEvent(element, 'keydown', function (e) {
|
|
|
|
dispatch(e);
|
|
|
|
dispatch(e);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
addEvent(window, 'focus', function () {
|
|
|
|
|
|
|
|
_downKeys = [];
|
|
|
|
if (!winListendFocus) {
|
|
|
|
});
|
|
|
|
winListendFocus = true;
|
|
|
|
|
|
|
|
addEvent(window, 'focus', function () {
|
|
|
|
|
|
|
|
_downKeys = [];
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
addEvent(element, 'keyup', function (e) {
|
|
|
|
addEvent(element, 'keyup', function (e) {
|
|
|
|
dispatch(e);
|
|
|
|
dispatch(e);
|
|
|
|
clearModifier(e);
|
|
|
|
clearModifier(e);
|
|
|
|