0
votes

I want to make some modification to the key.js file to be able to handle modifiers other than "shift", "alt", "ctrl", or "meta i.e. something like this 'down:50+alt+49' (altkey+onekey+towkey)should also work.

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

How can i make changes to this file and make sure the modified file is used when i call

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

Thanks in advance. KD

2

2 Answers

1
votes

Instead of overwriting the core YUI JS (which can cause trouble down the road when updating YUI), have you considered creating a synthetic event for that specific keystroke combination?

Examples/Documentation here:

0
votes

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.