upgraded yui to 2.2.2 and yui-ext to 1.0.1a
This commit is contained in:
parent
4d9af2c691
commit
547ced6500
1992 changed files with 645731 additions and 0 deletions
124
www/extras/yui-ext/docs/output/KeyNav.jss.html
Normal file
124
www/extras/yui-ext/docs/output/KeyNav.jss.html
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
<html><head><title>KeyNav.js</title><link rel="stylesheet" type="text/css" href="../resources/style.css" media="screen"/></head><body><h1>KeyNav.js</h1><pre class="highlighted"><code><i>/**
|
||||
* @class Ext.KeyNav
|
||||
* Provides a convenient wrapper <b>for</b> normalized keyboard navigation. KeyNav allows you to bind
|
||||
* navigation keys to <b>function</b> calls that will get called when the keys are pressed.
|
||||
* <br />Usage:
|
||||
<pre><code>
|
||||
<b>var</b> nav = <b>new</b> Ext.KeyNav("my-element", {
|
||||
"left" : <b>function</b>(e){
|
||||
<b>this</b>.moveLeft(e.ctrlKey);
|
||||
},
|
||||
"right" : <b>function</b>(e){
|
||||
<b>this</b>.moveRight(e.ctrlKey);
|
||||
},
|
||||
"enter" : <b>function</b>(e){
|
||||
<b>this</b>.save();
|
||||
},
|
||||
scope : <b>this</b>
|
||||
});
|
||||
</code></pre>
|
||||
* @constructor
|
||||
* @param {String/HTMLElement/Ext.Element} el The element to bind to
|
||||
* @param {Object} config The config
|
||||
*/</i>
|
||||
Ext.KeyNav = <b>function</b>(el, config){
|
||||
<b>this</b>.el = Ext.get(el);
|
||||
Ext.apply(<b>this</b>, config);
|
||||
<b>if</b>(!<b>this</b>.disabled){
|
||||
<b>this</b>.disabled = true;
|
||||
<b>this</b>.enable();
|
||||
}
|
||||
};
|
||||
|
||||
Ext.KeyNav.prototype = {
|
||||
disabled : false,
|
||||
defaultEventAction: "stopEvent",
|
||||
|
||||
prepareEvent : <b>function</b>(e){
|
||||
<b>var</b> k = e.getKey();
|
||||
<b>var</b> h = <b>this</b>.keyToHandler[k];
|
||||
<i>//<b>if</b>(h && <b>this</b>[h]){</i>
|
||||
<i>// e.stopPropagation();</i>
|
||||
<i>//}</i>
|
||||
<b>if</b>(Ext.isSafari && h && k >= 37 && k <= 40){
|
||||
e.stopEvent();
|
||||
}
|
||||
},
|
||||
|
||||
relay : <b>function</b>(e){
|
||||
<b>var</b> k = e.getKey();
|
||||
<b>var</b> h = <b>this</b>.keyToHandler[k];
|
||||
<b>if</b>(h && <b>this</b>[h]){
|
||||
<b>if</b>(this.doRelay(e, <b>this</b>[h], h) !== true){
|
||||
e[<b>this</b>.defaultEventAction]();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
doRelay : <b>function</b>(e, h, hname){
|
||||
<b>return</b> h.call(<b>this</b>.scope || <b>this</b>, e);
|
||||
},
|
||||
|
||||
<i>// possible handlers</i>
|
||||
enter : false,
|
||||
left : false,
|
||||
right : false,
|
||||
up : false,
|
||||
down : false,
|
||||
tab : false,
|
||||
esc : false,
|
||||
pageUp : false,
|
||||
pageDown : false,
|
||||
del : false,
|
||||
home : false,
|
||||
end : false,
|
||||
|
||||
<i>// quick lookup hash</i>
|
||||
keyToHandler : {
|
||||
37 : "left",
|
||||
39 : "right",
|
||||
38 : "up",
|
||||
40 : "down",
|
||||
33 : "pageUp",
|
||||
34 : "pageDown",
|
||||
46 : "del",
|
||||
36 : "home",
|
||||
35 : "end",
|
||||
13 : "enter",
|
||||
27 : "esc",
|
||||
9 : "tab"
|
||||
},
|
||||
|
||||
<i>/**
|
||||
* Enable <b>this</b> KeyNav
|
||||
*/</i>
|
||||
enable: <b>function</b>(){
|
||||
<b>if</b>(this.disabled){
|
||||
<i>// ie won't <b>do</b> special keys on keypress, no one <b>else</b> will repeat keys <b>with</b> keydown</i>
|
||||
<i>// the EventObject will normalize Safari automatically</i>
|
||||
<b>if</b>(Ext.isIE){
|
||||
<b>this</b>.el.on("keydown", <b>this</b>.relay, <b>this</b>);
|
||||
}<b>else</b>{
|
||||
<b>this</b>.el.on("keydown", <b>this</b>.prepareEvent, <b>this</b>);
|
||||
<b>this</b>.el.on("keypress", <b>this</b>.relay, <b>this</b>);
|
||||
}
|
||||
<b>this</b>.disabled = false;
|
||||
}
|
||||
},
|
||||
|
||||
<i>/**
|
||||
* Disable <b>this</b> KeyNav
|
||||
*/</i>
|
||||
disable: <b>function</b>(){
|
||||
<b>if</b>(!<b>this</b>.disabled){
|
||||
<b>if</b>(Ext.isIE){
|
||||
<b>this</b>.el.un("keydown", <b>this</b>.relay);
|
||||
}<b>else</b>{
|
||||
<b>this</b>.el.un("keydown", <b>this</b>.prepareEvent);
|
||||
<b>this</b>.el.un("keypress", <b>this</b>.relay);
|
||||
}
|
||||
<b>this</b>.disabled = true;
|
||||
}
|
||||
}
|
||||
};</code></pre><hr><div style="font-size:10px;text-align:center;color:gray;">Ext - Copyright © 2006-2007 Ext JS, LLC<br />All rights reserved.</div>
|
||||
</body></html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue