You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.5 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-Element'>/**
  19. </span> * @class Ext.Element
  20. */
  21. Ext.Element.addMethods({
  22. <span id='Ext-Element-method-addKeyListener'> /**
  23. </span> * Convenience method for constructing a KeyMap
  24. * @param {Number/Array/Object/String} key Either a string with the keys to listen for, the numeric key code, array of key codes or an object with the following options:
  25. * &lt;code&gt;{key: (number or array), shift: (true/false), ctrl: (true/false), alt: (true/false)}&lt;/code&gt;
  26. * @param {Function} fn The function to call
  27. * @param {Object} scope (optional) The scope (&lt;code&gt;this&lt;/code&gt; reference) in which the specified function is executed. Defaults to this Element.
  28. * @return {Ext.KeyMap} The KeyMap created
  29. */
  30. addKeyListener : function(key, fn, scope){
  31. var config;
  32. if(typeof key != 'object' || Ext.isArray(key)){
  33. config = {
  34. key: key,
  35. fn: fn,
  36. scope: scope
  37. };
  38. }else{
  39. config = {
  40. key : key.key,
  41. shift : key.shift,
  42. ctrl : key.ctrl,
  43. alt : key.alt,
  44. fn: fn,
  45. scope: scope
  46. };
  47. }
  48. return new Ext.KeyMap(this, config);
  49. },
  50. <span id='Ext-Element-method-addKeyMap'> /**
  51. </span> * Creates a KeyMap for this element
  52. * @param {Object} config The KeyMap config. See {@link Ext.KeyMap} for more details
  53. * @return {Ext.KeyMap} The KeyMap created
  54. */
  55. addKeyMap : function(config){
  56. return new Ext.KeyMap(this, config);
  57. }
  58. });
  59. //Import the newly-added Ext.Element functions into CompositeElementLite. We call this here because
  60. //Element.keys.js is the last extra Ext.Element include in the ext-all.js build
  61. Ext.CompositeElementLite.importElementMethods();</pre>
  62. </body>
  63. </html>