This commit is contained in:
2024-04-27 09:23:34 +02:00
commit 11e713ca6f
11884 changed files with 3263371 additions and 0 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0
build: 1549
*/
YUI.add("event-delegate",function(B){var I=B.Event,F=B.Lang,E={},A={mouseenter:"mouseover",mouseleave:"mouseout"},H=function(K){try{if(K&&3==K.nodeType){return K.parentNode;}}catch(J){}return K;},D=function(K,P,M){var Q=H((P.target||P.srcElement)),N=E[K],T,O,L,S,R;var J=function(X,U,V){var W;if(!X||X===V){W=false;}else{W=B.Selector.test(X,U)?X:J(X.parentNode,U,V);}return W;};for(T in N){if(N.hasOwnProperty(T)){O=N[T];S=N.fn;L=null;if(B.Selector.test(Q,T,M)){L=Q;}else{if(B.Selector.test(Q,((T.replace(/,/gi," *,"))+" *"),M)){L=J(Q,T,M);}}if(L){if(!R){R=new B.DOMEventFacade(P,M);R.container=R.currentTarget;}R.currentTarget=B.Node.get(L);B.publish(O,{contextFn:function(){return R.currentTarget;}});if(S){S(R,O);}else{B.fire(O,R);}}}}},G=function(M,L,K){var O={focus:I._attachFocus,blur:I._attachBlur},N=O[M],J=[M,function(P){D(L,(P||window.event),K);},K];if(N){return N(J,{capture:true,facade:false});}else{return I._attach(J,{facade:false});}},C=B.cached(function(J){return J.replace(/[|,:]/g,"~");});B.Env.evt.plugins.delegate={on:function(O,N,M,J,K){var L=B.Array(arguments,0,true);L.splice(3,1);L[0]=J;return B.delegate.apply(B,L);}};I.delegate=function(R,U,K,W){if(!W){return false;}var O=B.Array(arguments,0,true),M=K,N;if(F.isString(K)){M=B.Selector.query(K,null,true);if(!M){N=I.onAvailable(K,function(){N.handle=I.delegate.apply(I,O);},I,true,false);return N;}}M=B.Node.getDOMNode(M);var S=B.stamp(M),L="delegate:"+S+R+C(W),J=R+S,Q=E[J],T,V,P;if(!Q){Q={};if(A[R]){if(!I._fireMouseEnter){return false;}R=A[R];Q.fn=I._fireMouseEnter;}T=G(R,J,M);B.after(function(X){if(T.sub==X){delete E[J];B.detachAll(L);}},T.evt,"_delete");Q.handle=T;E[J]=Q;}P=Q.listeners;Q.listeners=P?(P+1):1;Q[W]=L;O[0]=L;O.splice(2,2);V=B.on.apply(B,O);B.after(function(){Q.listeners=(Q.listeners-1);if(Q.listeners===0){Q.handle.detach();}},V,"detach");return V;};B.delegate=I.delegate;},"3.0.0",{requires:["node-base"]});

View File

@@ -0,0 +1,365 @@
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0
build: 1549
*/
YUI.add('event-delegate', function(Y) {
/**
* Adds event delegation support to the library.
*
* @module event
* @submodule event-delegate
*/
var Event = Y.Event,
Lang = Y.Lang,
delegates = {},
specialTypes = {
mouseenter: "mouseover",
mouseleave: "mouseout"
},
resolveTextNode = function(n) {
try {
if (n && 3 == n.nodeType) {
return n.parentNode;
}
} catch(e) { }
return n;
},
delegateHandler = function(delegateKey, e, el) {
var target = resolveTextNode((e.target || e.srcElement)),
tests = delegates[delegateKey],
spec,
ename,
matched,
fn,
ev;
var getMatch = function(el, selector, container) {
var returnVal;
if (!el || el === container) {
returnVal = false;
}
else {
returnVal = Y.Selector.test(el, selector) ? el: getMatch(el.parentNode, selector, container);
}
return returnVal;
};
for (spec in tests) {
if (tests.hasOwnProperty(spec)) {
ename = tests[spec];
fn = tests.fn;
matched = null;
if (Y.Selector.test(target, spec, el)) {
matched = target;
}
else if (Y.Selector.test(target, ((spec.replace(/,/gi, " *,")) + " *"), el)) {
// The target is a descendant of an element matching
// the selector, so crawl up to find the ancestor that
// matches the selector
matched = getMatch(target, spec, el);
}
if (matched) {
if (!ev) {
ev = new Y.DOMEventFacade(e, el);
ev.container = ev.currentTarget;
}
ev.currentTarget = Y.Node.get(matched);
Y.publish(ename, {
contextFn: function() {
return ev.currentTarget;
}
});
if (fn) {
fn(ev, ename);
}
else {
Y.fire(ename, ev);
}
}
}
}
},
attach = function (type, key, element) {
var focusMethods = {
focus: Event._attachFocus,
blur: Event._attachBlur
},
attachFn = focusMethods[type],
args = [type,
function (e) {
delegateHandler(key, (e || window.event), element);
},
element];
if (attachFn) {
return attachFn(args, { capture: true, facade: false });
}
else {
return Event._attach(args, { facade: false });
}
},
sanitize = Y.cached(function(str) {
return str.replace(/[|,:]/g, '~');
});
/**
* Sets up event delegation on a container element. The delegated event
* will use a supplied selector to test if the target or one of the
* descendants of the target match it. The supplied callback function
* will only be executed if a match was encountered, and, in fact,
* will be executed for each element that matches if you supply an
* ambiguous selector.
*
* The event object for the delegated event is supplied to the callback
* function. It is modified slightly in order to support all properties
* that may be needed for event delegation. 'currentTarget' is set to
* the element that matched the delegation specifcation. 'container' is
* set to the element that the listener is bound to (this normally would
* be the 'currentTarget').
*
* @event delegate
* @param type {string} 'delegate'
* @param fn {function} the callback function to execute. This function
* will be provided the event object for the delegated event.
* @param el {string|node} the element that is the delegation container
* @param delegateType {string} the event type to delegate
* @param spec {string} a selector that must match the target of the
* event.
* @param context optional argument that specifies what 'this' refers to.
* @param args* 0..n additional arguments to pass on to the callback function.
* These arguments will be added after the event object.
* @return {EventHandle} the detach handle
* @for YUI
* @deprecated use Y.delegate
*/
Y.Env.evt.plugins.delegate = {
on: function(type, fn, el, delegateType, spec) {
var args = Y.Array(arguments, 0, true);
args.splice(3, 1);
args[0] = delegateType;
return Y.delegate.apply(Y, args);
}
};
/**
* Sets up event delegation on a container element. The delegated event
* will use a supplied selector to test if the target or one of the
* descendants of the target match it. The supplied callback function
* will only be executed if a match was encountered, and, in fact,
* will be executed for each element that matches if you supply an
* ambiguous selector.
*
* The event object for the delegated event is supplied to the callback
* function. It is modified slightly in order to support all properties
* that may be needed for event delegation. 'currentTarget' is set to
* the element that matched the delegation specifcation. 'container' is
* set to the element that the listener is bound to (this normally would
* be the 'currentTarget').
*
* @method delegate
* @param type {string} the event type to delegate
* @param fn {function} the callback function to execute. This function
* will be provided the event object for the delegated event.
* @param el {string|node} the element that is the delegation container
* @param spec {string} a selector that must match the target of the
* event.
* @param context optional argument that specifies what 'this' refers to.
* @param args* 0..n additional arguments to pass on to the callback function.
* These arguments will be added after the event object.
* @return {EventHandle} the detach handle
* @for YUI
*/
Event.delegate = function (type, fn, el, spec) {
if (!spec) {
return false;
}
var args = Y.Array(arguments, 0, true),
element = el, // HTML element serving as the delegation container
availHandle;
if (Lang.isString(el)) {
// Y.Selector.query returns an array of matches unless specified
// to return just the first match. Since the primary use case for
// event delegation is to use a single event handler on a container,
// Y.delegate doesn't currently support being able to bind a
// single listener to multiple containers.
element = Y.Selector.query(el, null, true);
if (!element) { // Not found, check using onAvailable
availHandle = Event.onAvailable(el, function() {
availHandle.handle = Event.delegate.apply(Event, args);
}, Event, true, false);
return availHandle;
}
}
element = Y.Node.getDOMNode(element);
var guid = Y.stamp(element),
// The Custom Event for the delegation spec
ename = 'delegate:' + guid + type + sanitize(spec),
// The key to the listener for the event type and container
delegateKey = type + guid,
delegate = delegates[delegateKey],
domEventHandle,
ceHandle,
listeners;
if (!delegate) {
delegate = {};
if (specialTypes[type]) {
if (!Event._fireMouseEnter) {
return false;
}
type = specialTypes[type];
delegate.fn = Event._fireMouseEnter;
}
// Create the DOM Event wrapper that will fire the Custom Event
domEventHandle = attach(type, delegateKey, element);
// Hook into the _delete method for the Custom Event wrapper of this
// DOM Event in order to clean up the 'delegates' map and unsubscribe
// the associated Custom Event listeners fired by this DOM event
// listener if/when the user calls "purgeElement" OR removes all
// listeners of the Custom Event.
Y.after(function (sub) {
if (domEventHandle.sub == sub) {
// Delete this event from the map of known delegates
delete delegates[delegateKey];
// Unsubscribe all listeners of the Custom Event fired
// by this DOM event.
Y.detachAll(ename);
}
}, domEventHandle.evt, "_delete");
delegate.handle = domEventHandle;
delegates[delegateKey] = delegate;
}
listeners = delegate.listeners;
delegate.listeners = listeners ? (listeners + 1) : 1;
delegate[spec] = ename;
args[0] = ename;
// Remove element, delegation spec
args.splice(2, 2);
// Subscribe to the Custom Event for the delegation spec
ceHandle = Y.on.apply(Y, args);
// Hook into the detach method of the handle in order to clean up the
// 'delegates' map and remove the associated DOM event handler
// responsible for firing this Custom Event if all listener for this
// event have been removed.
Y.after(function () {
delegate.listeners = (delegate.listeners - 1);
if (delegate.listeners === 0) {
delegate.handle.detach();
}
}, ceHandle, "detach");
return ceHandle;
};
Y.delegate = Event.delegate;
}, '3.0.0' ,{requires:['node-base']});

View File

@@ -0,0 +1,8 @@
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0
build: 1549
*/
YUI.add("event-focus",function(A){(function(){var I=A.UA,J=A.Event,E=A.Env.evt.plugins,C=I.ie,F=(I.opera||I.webkit),D={focus:(C?"focusin":(F?"DOMFocusIn":"focus")),blur:(C?"focusout":(F?"DOMFocusOut":"blur"))},G={capture:(I.gecko?true:false)},H=function(M,L){var K=A.Array(M,0,true);K[0]=D[K[0]];return J._attach(K,L);},B={on:function(){return H(arguments,G);}};J._attachFocus=H;J._attachBlur=H;E.focus=B;E.blur=B;})();},"3.0.0",{requires:["node-base"]});

View File

@@ -0,0 +1,90 @@
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0
build: 1549
*/
YUI.add('event-focus', function(Y) {
/**
* Adds focus and blur event listener support. These events normally
* do not bubble, so this adds support for that so these events
* can be used in event delegation scenarios.
*
* @module event
* @submodule event-focus
*/
(function() {
var UA = Y.UA,
Event = Y.Event,
plugins = Y.Env.evt.plugins,
ie = UA.ie,
bUseMutation = (UA.opera || UA.webkit),
eventNames = {
focus: (ie ? 'focusin' : (bUseMutation ? 'DOMFocusIn' : 'focus')),
blur: (ie ? 'focusout' : (bUseMutation ? 'DOMFocusOut' : 'blur'))
},
// Only need to use capture phase for Gecko since it doesn't support
// focusin, focusout, DOMFocusIn, or DOMFocusOut
CAPTURE_CONFIG = { capture: (UA.gecko ? true : false) },
attach = function (args, config) {
var a = Y.Array(args, 0, true);
a[0] = eventNames[a[0]];
return Event._attach(a, config);
},
eventAdapter = {
on: function () {
return attach(arguments, CAPTURE_CONFIG);
}
};
Event._attachFocus = attach;
Event._attachBlur = attach;
/**
* Adds a DOM focus listener. Uses the focusin event in IE,
* DOMFocusIn for Opera and Webkit, and the capture phase for Gecko so that
* the event propagates in a way that enables event delegation.
*
* @for YUI
* @event focus
* @param type {string} 'focus'
* @param fn {function} the callback function to execute
* @param o {string|HTMLElement|collection} the element(s) to bind
* @param context optional context object
* @param args 0..n additional arguments to provide to the listener.
* @return {EventHandle} the detach handle
*/
plugins.focus = eventAdapter;
/**
* Adds a DOM blur listener. Uses the focusout event in IE,
* DOMFocusOut for Opera and Webkit, and the capture phase for Gecko so that
* the event propagates in a way that enables event delegation.
*
* @for YUI
* @event blur
* @param type {string} 'blur'
* @param fn {function} the callback function to execute
* @param o {string|HTMLElement|collection} the element(s) to bind
* @param context optional context object
* @param args 0..n additional arguments to provide to the listener.
* @return {EventHandle} the detach handle
*/
plugins.blur = eventAdapter;
})();
}, '3.0.0' ,{requires:['node-base']});

View File

@@ -0,0 +1,8 @@
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0
build: 1549
*/
YUI.add("event-key",function(A){A.Env.evt.plugins.key={on:function(E,G,B,K,C){var I=A.Array(arguments,0,true),F,J,H,D;F=K&&K.split(":");if(!K||K.indexOf(":")==-1||!F[1]){I[0]="key"+((F&&F[0])||"press");return A.on.apply(A,I);}J=F[0];H=(F[1])?F[1].split(/,|\+/):null;D=(A.Lang.isString(B)?B:A.stamp(B))+K;D=D.replace(/,/g,"_");if(!A.getEvent(D)){A.on(E+J,function(P){var Q=false,M=false,N,L,O;for(N=0;N<H.length;N=N+1){L=H[N];O=parseInt(L,10);if(A.Lang.isNumber(O)){if(P.charCode===O){Q=true;}else{M=true;}}else{if(Q||!M){Q=(P[L+"Key"]);M=!Q;}}}if(Q){A.fire(D,P);}},B);}I.splice(2,2);I[0]=D;return A.on.apply(A,I);}};},"3.0.0",{requires:["node-base"]});

View File

@@ -0,0 +1,106 @@
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0
build: 1549
*/
YUI.add('event-key', function(Y) {
/**
* Functionality to listen for one or more specific key combinations.
* @module event
* @submodule event-key
*/
/**
* Add a key listener. The listener will only be notified if the
* keystroke detected meets the supplied specification. The
* spec consists of the key event type, followed by a colon,
* followed by zero or more comma separated key codes, followed
* by zero or more modifiers delimited by a plus sign. Ex:
* press:12,65+shift+ctrl
* @event key
* @for YUI
* @param type {string} 'key'
* @param fn {function} the function to execute
* @param id {string|HTMLElement|collection} the element(s) to bind
* @param spec {string} the keyCode and modifier specification
* @param o optional context object
* @param args 0..n additional arguments to provide to the listener.
* @return {Event.Handle} the detach handle
*/
Y.Env.evt.plugins.key = {
on: function(type, fn, id, spec, o) {
var a = Y.Array(arguments, 0, true), parsed, etype, criteria, ename;
parsed = spec && spec.split(':');
if (!spec || spec.indexOf(':') == -1 || !parsed[1]) {
a[0] = 'key' + ((parsed && parsed[0]) || 'press');
return Y.on.apply(Y, a);
}
// key event type: 'down', 'up', or 'press'
etype = parsed[0];
// list of key codes optionally followed by modifiers
criteria = (parsed[1]) ? parsed[1].split(/,|\+/) : null;
// the name of the custom event that will be created for the spec
ename = (Y.Lang.isString(id) ? id : Y.stamp(id)) + spec;
ename = ename.replace(/,/g, '_');
if (!Y.getEvent(ename)) {
// subscribe spec validator to the DOM event
Y.on(type + etype, function(e) {
var passed = false, failed = false, i, crit, critInt;
for (i=0; i<criteria.length; i=i+1) {
crit = criteria[i];
critInt = parseInt(crit, 10);
// pass this section if any supplied keyCode
// is found
if (Y.Lang.isNumber(critInt)) {
if (e.charCode === critInt) {
passed = true;
} else {
failed = true;
}
// only check modifier if no keyCode was specified
// or the keyCode check was successful. pass only
// if every modifier passes
} else if (passed || !failed) {
passed = (e[crit + 'Key']);
failed = !passed;
}
}
// fire spec custom event if spec if met
if (passed) {
Y.fire(ename, e);
}
}, id);
}
// subscribe supplied listener to custom event for spec validator
// remove element and spec.
a.splice(2, 2);
a[0] = ename;
return Y.on.apply(Y, a);
}
};
}, '3.0.0' ,{requires:['node-base']});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0
build: 1549
*/
YUI.add("event-mouseenter",function(F){var C=F.Event,E=F.Lang,B=F.Env.evt.plugins,D={},A={on:function(M,O,H){var L=F.Array(arguments,0,true),J=H,K;if(E.isString(H)){J=F.all(H);if(J.size()===0){K=C.onAvailable(H,function(){K.handle=F.on.apply(F,L);},C,true,false);return K;}}var R=(M==="mouseenter")?"mouseover":"mouseout",Q=M+":"+F.stamp(J)+R,I=D[Q],N,P,G;if(!I){N=F.on(R,F.rbind(C._fireMouseEnter,F,Q),J);F.after(function(S){if(N.sub==S){delete D[Q];F.detachAll(Q);}},N.evt,"_delete");I={};I.handle=N;D[Q]=I;}G=I.count;I.count=G?(G+1):1;L[0]=Q;L.splice(2,1);P=F.on.apply(F,L);F.after(function(){I.count=(I.count-1);if(I.count===0){I.handle.detach();}},P,"detach");return P;}};C._fireMouseEnter=function(J,H){var G=J.relatedTarget,I=J.currentTarget;if(I!==G&&!I.contains(G)){F.publish(H,{contextFn:function(){return I;}});F.fire(H,J);}};B.mouseenter=A;B.mouseleave=A;},"3.0.0",{requires:["node-base"]});

View File

@@ -0,0 +1,191 @@
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0
build: 1549
*/
YUI.add('event-mouseenter', function(Y) {
/**
* Adds support for mouseenter/mouseleave events
* @module event
* @submodule event-mouseenter
*/
var Event = Y.Event,
Lang = Y.Lang,
plugins = Y.Env.evt.plugins,
listeners = {},
eventConfig = {
on: function(type, fn, el) {
var args = Y.Array(arguments, 0, true),
element = el,
availHandle;
if (Lang.isString(el)) {
// Need to use Y.all because if el is a string it could be a
// selector that returns a NodeList
element = Y.all(el);
if (element.size() === 0) { // Not found, check using onAvailable
availHandle = Event.onAvailable(el, function() {
availHandle.handle = Y.on.apply(Y, args);
}, Event, true, false);
return availHandle;
}
}
var sDOMEvent = (type === "mouseenter") ? "mouseover" : "mouseout",
// The name of the custom event
sEventName = type + ":" + Y.stamp(element) + sDOMEvent,
listener = listeners[sEventName],
domEventHandle,
ceHandle,
nListeners;
// Bind an actual DOM event listener that will call the
// the custom event
if (!listener) {
domEventHandle = Y.on(sDOMEvent, Y.rbind(Event._fireMouseEnter, Y, sEventName), element);
// Hook into the _delete method for the Custom Event wrapper of this
// DOM Event in order to clean up the 'listeners' map and unsubscribe
// the associated Custom Event listeners fired by this DOM event
// listener if/when the user calls "purgeElement" OR removes all
// listeners of the Custom Event.
Y.after(function (sub) {
if (domEventHandle.sub == sub) {
// Delete this event from the map of known mouseenter
// and mouseleave listeners
delete listeners[sEventName];
// Unsubscribe all listeners of the Custom Event fired
// by this DOM event.
Y.detachAll(sEventName);
}
}, domEventHandle.evt, "_delete");
listener = {};
listener.handle = domEventHandle;
listeners[sEventName] = listener;
}
nListeners = listener.count;
listener.count = nListeners ? (nListeners + 1) : 1;
args[0] = sEventName;
// Remove the element from the args
args.splice(2, 1);
// Subscribe to the custom event
ceHandle = Y.on.apply(Y, args);
// Hook into the detach method of the handle in order to clean up the
// 'listeners' map and remove the associated DOM event handler
// responsible for firing this Custom Event if all listener for this
// event have been removed.
Y.after(function () {
listener.count = (listener.count - 1);
if (listener.count === 0) {
listener.handle.detach();
}
}, ceHandle, "detach");
return ceHandle;
}
};
Event._fireMouseEnter = function (e, eventName) {
var relatedTarget = e.relatedTarget,
currentTarget = e.currentTarget;
if (currentTarget !== relatedTarget &&
!currentTarget.contains(relatedTarget)) {
Y.publish(eventName, {
contextFn: function() {
return currentTarget;
}
});
Y.fire(eventName, e);
}
};
/**
* Sets up a "mouseenter" listener&#151;a listener that is called the first time
* the user's mouse enters the specified element(s).
*
* @event mouseenter
* @param type {string} "mouseenter"
* @param fn {function} The method the event invokes.
* @param el {string|node} The element(s) to assign the listener to.
* @param spec {string} Optional. String representing a selector that must
* match the target of the event in order for the listener to be called.
* @return {EventHandle} the detach handle
* @for YUI
*/
plugins.mouseenter = eventConfig;
/**
* Sets up a "mouseleave" listener&#151;a listener that is called the first time
* the user's mouse leaves the specified element(s).
*
* @event mouseleave
* @param type {string} "mouseleave"
* @param fn {function} The method the event invokes.
* @param el {string|node} The element(s) to assign the listener to.
* @param spec {string} Optional. String representing a selector that must
* match the target of the event in order for the listener to be called.
* @return {EventHandle} the detach handle
* @for YUI
*/
plugins.mouseleave = eventConfig;
}, '3.0.0' ,{requires:['node-base']});

View File

@@ -0,0 +1,8 @@
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0
build: 1549
*/
YUI.add("event-mousewheel",function(C){var B="DOMMouseScroll",A=function(E){var D=C.Array(E,0,true),F;if(C.UA.gecko){D[0]=B;F=C.config.win;}else{F=C.config.doc;}if(D.length<3){D[2]=F;}else{D.splice(2,0,F);}return D;};C.Env.evt.plugins.mousewheel={on:function(){return C.Event._attach(A(arguments));},detach:function(){return C.Event.detach.apply(C.Event,A(arguments));}};},"3.0.0",{requires:["node-base"]});

View File

@@ -0,0 +1,57 @@
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0
build: 1549
*/
YUI.add('event-mousewheel', function(Y) {
/**
* Adds mousewheel event support
* @module event
* @submodule event-mousewheel
*/
var DOM_MOUSE_SCROLL = 'DOMMouseScroll',
fixArgs = function(args) {
var a = Y.Array(args, 0, true), target;
if (Y.UA.gecko) {
a[0] = DOM_MOUSE_SCROLL;
target = Y.config.win;
} else {
target = Y.config.doc;
}
if (a.length < 3) {
a[2] = target;
} else {
a.splice(2, 0, target);
}
return a;
};
/**
* Mousewheel event. This listener is automatically attached to the
* correct target, so one should not be supplied. Mouse wheel
* direction and velocity is stored in the 'mouseDelta' field.
* @event mousewheel
* @param type {string} 'mousewheel'
* @param fn {function} the callback to execute
* @param context optional context object
* @param args 0..n additional arguments to provide to the listener.
* @return {EventHandle} the detach handle
* @for YUI
*/
Y.Env.evt.plugins.mousewheel = {
on: function() {
return Y.Event._attach(fixArgs(arguments));
},
detach: function() {
return Y.Event.detach.apply(Y.Event, fixArgs(arguments));
}
};
}, '3.0.0' ,{requires:['node-base']});

View File

@@ -0,0 +1,8 @@
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0
build: 1549
*/
YUI.add("event-resize",function(A){(function(){var C,B,E="window:resize",D=function(F){if(A.UA.gecko){A.fire(E,F);}else{if(B){B.cancel();}B=A.later(A.config.windowResizeDelay||40,A,function(){A.fire(E,F);});}};A.Env.evt.plugins.windowresize={on:function(H,G){if(!C){C=A.Event._attach(["resize",D]);}var F=A.Array(arguments,0,true);F[0]=E;return A.on.apply(A,F);}};})();},"3.0.0",{requires:["node-base"]});

View File

@@ -0,0 +1,71 @@
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0
build: 1549
*/
YUI.add('event-resize', function(Y) {
/**
* Adds a window resize event that has its behavior normalized to fire at the
* end of the resize rather than constantly during the resize.
* @module event
* @submodule event-resize
*/
(function() {
var detachHandle,
timerHandle,
CE_NAME = 'window:resize',
handler = function(e) {
if (Y.UA.gecko) {
Y.fire(CE_NAME, e);
} else {
if (timerHandle) {
timerHandle.cancel();
}
timerHandle = Y.later(Y.config.windowResizeDelay || 40, Y, function() {
Y.fire(CE_NAME, e);
});
}
};
/**
* Firefox fires the window resize event once when the resize action
* finishes, other browsers fire the event periodically during the
* resize. This code uses timeout logic to simulate the Firefox
* behavior in other browsers.
* @event windowresize
* @for YUI
*/
Y.Env.evt.plugins.windowresize = {
on: function(type, fn) {
// check for single window listener and add if needed
if (!detachHandle) {
detachHandle = Y.Event._attach(['resize', handler]);
}
var a = Y.Array(arguments, 0, true);
a[0] = CE_NAME;
return Y.on.apply(Y, a);
}
};
})();
}, '3.0.0' ,{requires:['node-base']});

File diff suppressed because it is too large Load Diff