0

我想对 key.js 文件进行一些修改,以便能够处理除“shift”、“alt”、“ctrl”或“meta”之外的修饰符,即类似“down:50+alt+49”(altkey +onekey+towkey) 也应该有效。

[url]http://yuilibrary.com/yui/docs/event/key.html[/url]

如何更改此文件并确保在我调用时使用修改后的文件

YUI().use("event-key", function(Y) { Y.on('key', function() {console.log('test'); }, '#my-input-element', '向下:50+alt+49');

提前致谢。KD

4

2 回答 2

1

您是否考虑过为特定的击键组合创建合成事件,而不是覆盖核心 YUI JS(更新 YUI 时可能会导致麻烦)?

此处的示例/文档:

于 2012-12-04T16:22:28.700 回答
0

The easiest way is to load your modified file through a tag right after loading yui-min.js and before calling YUI().use. When your file is loaded, if it has the same name as the original in the YUI.add() wrapper, the loader will know the requirement for 'event-key' is fulfilled and it will not load the version from the Yahoo sites. It will, however, fill in the dependencies it needs.

于 2012-12-03T16:00:18.293 回答