/* YUI 3.17.2 (build 9c3c78e) Copyright 2014 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ YUI.add('event-mousewheel', function (Y, NAME) { /** * 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 'wheelDelta' 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.17.2', {"requires": ["node-base"]}); /* YUI 3.17.2 (build 9c3c78e) Copyright 2014 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ YUI.add('event-resize', function (Y, NAME) { /** * 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 */ /** * Old 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.Event.define('windowresize', { on: (Y.UA.gecko && Y.UA.gecko < 1.91) ? function (node, sub, notifier) { sub._handle = Y.Event.attach('resize', function (e) { notifier.fire(e); }); } : function (node, sub, notifier) { // interval bumped from 40 to 100ms as of 3.4.1 var delay = Y.config.windowResizeDelay || 100; sub._handle = Y.Event.attach('resize', function (e) { if (sub._timer) { sub._timer.cancel(); } sub._timer = Y.later(delay, Y, function () { notifier.fire(e); }); }); }, detach: function (node, sub) { if (sub._timer) { sub._timer.cancel(); } sub._handle.detach(); } // delegate methods not defined because this only works for window // subscriptions, so...yeah. }); }, '3.17.2', {"requires": ["node-base", "event-synthetic"]}); /* YUI 3.17.2 (build 9c3c78e) Copyright 2014 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ YUI.add('event-hover', function (Y, NAME) { /** * Adds support for a "hover" event. The event provides a convenience wrapper * for subscribing separately to mouseenter and mouseleave. The signature for * subscribing to the event is
* *node.on("hover", overFn, outFn);
* node.delegate("hover", overFn, outFn, ".filterSelector");
* Y.on("hover", overFn, outFn, ".targetSelector");
* Y.delegate("hover", overFn, outFn, "#container", ".filterSelector");
*
*
* Additionally, for compatibility with a more typical subscription * signature, the following are also supported:
* *Y.on("hover", overFn, ".targetSelector", outFn);
* Y.delegate("hover", overFn, "#container", outFn, ".filterSelector");
*
*
* @module event
* @submodule event-hover
*/
var isFunction = Y.Lang.isFunction,
noop = function () {},
conf = {
processArgs: function (args) {
// Y.delegate('hover', over, out, '#container', '.filter')
// comes in as ['hover', over, out, '#container', '.filter'], but
// node.delegate('hover', over, out, '.filter')
// comes in as ['hover', over, containerEl, out, '.filter']
var i = isFunction(args[2]) ? 2 : 3;
return (isFunction(args[i])) ? args.splice(i,1)[0] : noop;
},
on: function (node, sub, notifier, filter) {
var args = (sub.args) ? sub.args.slice() : [];
args.unshift(null);
sub._detach = node[(filter) ? "delegate" : "on"]({
mouseenter: function (e) {
e.phase = 'over';
notifier.fire(e);
},
mouseleave: function (e) {
var thisObj = sub.context || this;
args[0] = e;
e.type = 'hover';
e.phase = 'out';
sub._extra.apply(thisObj, args);
}
}, filter);
},
detach: function (node, sub, notifier) {
sub._detach.detach();
}
};
conf.delegate = conf.on;
conf.detachDelegate = conf.detach;
Y.Event.define("hover", conf);
}, '3.17.2', {"requires": ["event-mouseenter"]});
/*
YUI 3.17.2 (build 9c3c78e)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('event-touch', function (Y, NAME) {
/**
Adds touch event facade normalization properties (touches, changedTouches, targetTouches etc.) to the DOM event facade. Adds
touch events to the DOM events whitelist.
@example
YUI().use('event-touch', function (Y) {
Y.one('#myDiv').on('touchstart', function(e) {
...
});
});
@module event
@submodule event-touch
*/
var SCALE = "scale",
ROTATION = "rotation",
IDENTIFIER = "identifier",
win = Y.config.win,
GESTURE_MAP = {};
/**
* Adds touch event facade normalization properties to the DOM event facade
*
* @method _touch
* @for DOMEventFacade
* @private
* @param ev {Event} the DOM event
* @param currentTarget {HTMLElement} the element the listener was attached to
* @param wrapper {CustomEvent} the custom event wrapper for this DOM event
*/
Y.DOMEventFacade.prototype._touch = function(e, currentTarget, wrapper) {
var i,l, etCached, et,touchCache;
if (e.touches) {
/**
* Array of individual touch events for touch points that are still in
* contact with the touch surface.
*
* @property touches
* @type {DOMEventFacade[]}
*/
this.touches = [];
touchCache = {};
for (i = 0, l = e.touches.length; i < l; ++i) {
et = e.touches[i];
touchCache[Y.stamp(et)] = this.touches[i] = new Y.DOMEventFacade(et, currentTarget, wrapper);
}
}
if (e.targetTouches) {
/**
* Array of individual touch events still in contact with the touch
* surface and whose `touchstart` event occurred inside the same taregt
* element as the current target element.
*
* @property targetTouches
* @type {DOMEventFacade[]}
*/
this.targetTouches = [];
for (i = 0, l = e.targetTouches.length; i < l; ++i) {
et = e.targetTouches[i];
etCached = touchCache && touchCache[Y.stamp(et, true)];
this.targetTouches[i] = etCached || new Y.DOMEventFacade(et, currentTarget, wrapper);
}
}
if (e.changedTouches) {
/**
An array of event-specific touch events.
For `touchstart`, the touch points that became active with the current
event.
For `touchmove`, the touch points that have changed since the last
event.
For `touchend`, the touch points that have been removed from the touch
surface.
@property changedTouches
@type {DOMEventFacade[]}
**/
this.changedTouches = [];
for (i = 0, l = e.changedTouches.length; i < l; ++i) {
et = e.changedTouches[i];
etCached = touchCache && touchCache[Y.stamp(et, true)];
this.changedTouches[i] = etCached || new Y.DOMEventFacade(et, currentTarget, wrapper);
}
}
if (SCALE in e) {
this[SCALE] = e[SCALE];
}
if (ROTATION in e) {
this[ROTATION] = e[ROTATION];
}
if (IDENTIFIER in e) {
this[IDENTIFIER] = e[IDENTIFIER];
}
};
//Adding MSPointer events to whitelisted DOM Events. MSPointer event payloads
//have the same properties as mouse events.
if (Y.Node.DOM_EVENTS) {
Y.mix(Y.Node.DOM_EVENTS, {
touchstart:1,
touchmove:1,
touchend:1,
touchcancel:1,
gesturestart:1,
gesturechange:1,
gestureend:1,
MSPointerDown:1,
MSPointerUp:1,
MSPointerMove:1,
MSPointerCancel:1,
pointerdown:1,
pointerup:1,
pointermove:1,
pointercancel:1
});
}
//Add properties to Y.EVENT.GESTURE_MAP based on feature detection.
if ((win && ("ontouchstart" in win)) && !(Y.UA.chrome && Y.UA.chrome < 6)) {
GESTURE_MAP.start = ["touchstart", "mousedown"];
GESTURE_MAP.end = ["touchend", "mouseup"];
GESTURE_MAP.move = ["touchmove", "mousemove"];
GESTURE_MAP.cancel = ["touchcancel", "mousecancel"];
}
else if (win && win.PointerEvent) {
GESTURE_MAP.start = "pointerdown";
GESTURE_MAP.end = "pointerup";
GESTURE_MAP.move = "pointermove";
GESTURE_MAP.cancel = "pointercancel";
}
else if (win && ("msPointerEnabled" in win.navigator)) {
GESTURE_MAP.start = "MSPointerDown";
GESTURE_MAP.end = "MSPointerUp";
GESTURE_MAP.move = "MSPointerMove";
GESTURE_MAP.cancel = "MSPointerCancel";
}
else {
GESTURE_MAP.start = "mousedown";
GESTURE_MAP.end = "mouseup";
GESTURE_MAP.move = "mousemove";
GESTURE_MAP.cancel = "mousecancel";
}
/**
* A object literal with keys "start", "end", and "move". The value for each key is a
* string representing the event for that environment. For touch environments, the respective
* values are "touchstart", "touchend" and "touchmove". Mouse and MSPointer environments are also
* supported via feature detection.
*
* @property _GESTURE_MAP
* @type Object
* @static
*/
Y.Event._GESTURE_MAP = GESTURE_MAP;
}, '3.17.2', {"requires": ["node-base"]});
/*
YUI 3.17.2 (build 9c3c78e)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('event-move', function (Y, NAME) {
/**
* Adds lower level support for "gesturemovestart", "gesturemove" and "gesturemoveend" events, which can be used to create drag/drop
* interactions which work across touch and mouse input devices. They correspond to "touchstart", "touchmove" and "touchend" on a touch input
* device, and "mousedown", "mousemove", "mouseup" on a mouse based input device.
*
* Documentation for the gesturemove triplet of events can be found on the YUI global, * along with the other supported events.
@example YUI().use('event-move', function (Y) { Y.one('#myNode').on('gesturemovestart', function (e) { }); Y.one('#myNode').on('gesturemove', function (e) { }); Y.one('#myNode').on('gesturemoveend', function (e) { }); }); * @module event-gestures * @submodule event-move */ var GESTURE_MAP = Y.Event._GESTURE_MAP, EVENT = { start: GESTURE_MAP.start, end: GESTURE_MAP.end, move: GESTURE_MAP.move }, START = "start", MOVE = "move", END = "end", GESTURE_MOVE = "gesture" + MOVE, GESTURE_MOVE_END = GESTURE_MOVE + END, GESTURE_MOVE_START = GESTURE_MOVE + START, _MOVE_START_HANDLE = "_msh", _MOVE_HANDLE = "_mh", _MOVE_END_HANDLE = "_meh", _DEL_MOVE_START_HANDLE = "_dmsh", _DEL_MOVE_HANDLE = "_dmh", _DEL_MOVE_END_HANDLE = "_dmeh", _MOVE_START = "_ms", _MOVE = "_m", MIN_TIME = "minTime", MIN_DISTANCE = "minDistance", PREVENT_DEFAULT = "preventDefault", BUTTON = "button", OWNER_DOCUMENT = "ownerDocument", CURRENT_TARGET = "currentTarget", TARGET = "target", NODE_TYPE = "nodeType", SUPPORTS_POINTER = Y.config.win && ("msPointerEnabled" in Y.config.win.navigator), MS_TOUCH_ACTION_COUNT = 'msTouchActionCount', MS_INIT_TOUCH_ACTION = 'msInitTouchAction', _defArgsProcessor = function(se, args, delegate) { var iConfig = (delegate) ? 4 : 3, config = (args.length > iConfig) ? Y.merge(args.splice(iConfig,1)[0]) : {}; if (!(PREVENT_DEFAULT in config)) { config[PREVENT_DEFAULT] = se.PREVENT_DEFAULT; } return config; }, _getRoot = function(node, subscriber) { return subscriber._extra.root || (node.get(NODE_TYPE) === 9) ? node : node.get(OWNER_DOCUMENT); }, //Checks to see if the node is the document, and if it is, returns the documentElement. _checkDocumentElem = function(node) { var elem = node.getDOMNode(); if (node.compareTo(Y.config.doc) && elem.documentElement) { return elem.documentElement; } else { return false; } }, _normTouchFacade = function(touchFacade, touch, params) { touchFacade.pageX = touch.pageX; touchFacade.pageY = touch.pageY; touchFacade.screenX = touch.screenX; touchFacade.screenY = touch.screenY; touchFacade.clientX = touch.clientX; touchFacade.clientY = touch.clientY; touchFacade[TARGET] = touchFacade[TARGET] || touch[TARGET]; touchFacade[CURRENT_TARGET] = touchFacade[CURRENT_TARGET] || touch[CURRENT_TARGET]; touchFacade[BUTTON] = (params && params[BUTTON]) || 1; // default to left (left as per vendors, not W3C which is 0) }, /* In IE10 touch mode, gestures will not work properly unless the -ms-touch-action CSS property is set to something other than 'auto'. Read http://msdn.microsoft.com/en-us/library/windows/apps/hh767313.aspx for more info. To get around this, we set -ms-touch-action: none which is the same as e.preventDefault() on touch environments. This tells the browser to fire DOM events for all touch events, and not perform any default behavior. The user can over-ride this by setting a more lenient -ms-touch-action property on a node (such as pan-x, pan-y, etc.) via CSS when subscribing to the 'gesturemovestart' event. */ _setTouchActions = function (node) { var elem = _checkDocumentElem(node) || node.getDOMNode(), num = node.getData(MS_TOUCH_ACTION_COUNT); //Checks to see if msTouchAction is supported. if (SUPPORTS_POINTER) { if (!num) { num = 0; node.setData(MS_INIT_TOUCH_ACTION, elem.style.msTouchAction); } elem.style.msTouchAction = Y.Event._DEFAULT_TOUCH_ACTION; num++; node.setData(MS_TOUCH_ACTION_COUNT, num); } }, /* Resets the element's -ms-touch-action property back to the original value, This is called on detach() and detachDelegate(). */ _unsetTouchActions = function (node) { var elem = _checkDocumentElem(node) || node.getDOMNode(), num = node.getData(MS_TOUCH_ACTION_COUNT), initTouchAction = node.getData(MS_INIT_TOUCH_ACTION); if (SUPPORTS_POINTER) { num--; node.setData(MS_TOUCH_ACTION_COUNT, num); if (num === 0 && elem.style.msTouchAction !== initTouchAction) { elem.style.msTouchAction = initTouchAction; } } }, _prevent = function(e, preventDefault) { if (preventDefault) { // preventDefault is a boolean or a function if (!preventDefault.call || preventDefault(e)) { e.preventDefault(); } } }, define = Y.Event.define; Y.Event._DEFAULT_TOUCH_ACTION = 'none'; /** * Sets up a "gesturemovestart" event, that is fired on touch devices in response to a single finger "touchstart", * and on mouse based devices in response to a "mousedown". The subscriber can specify the minimum time * and distance thresholds which should be crossed before the "gesturemovestart" is fired and for the mouse, * which button should initiate a "gesturemovestart". This event can also be listened for using node.delegate(). * *It is recommended that you use Y.bind to set up context and additional arguments for your event handler,
* however if you want to pass the context and arguments as additional signature arguments to on/delegate,
* you need to provide a null value for the configuration object, e.g: node.on("gesturemovestart", fn, null, context, arg1, arg2, arg3)
By default this event is only fired when the same node * has received a "gesturemovestart" event. The subscriber can set standAlone to true, in the configuration properties, * if they want to listen for this event without an initial "gesturemovestart".
* *By default this event sets up it's internal "touchmove" and "mousemove" DOM listeners on the document element. The subscriber * can set the root configuration property, to specify which node to attach DOM listeners to, if different from the document.
* *This event can also be listened for using node.delegate().
* *It is recommended that you use Y.bind to set up context and additional arguments for your event handler,
* however if you want to pass the context and arguments as additional signature arguments to on/delegate,
* you need to provide a null value for the configuration object, e.g: node.on("gesturemove", fn, null, context, arg1, arg2, arg3)
By default this event is only fired when the same node * has received a "gesturemove" or "gesturemovestart" event. The subscriber can set standAlone to true, in the configuration properties, * if they want to listen for this event without a preceding "gesturemovestart" or "gesturemove".
* *By default this event sets up it's internal "touchend" and "mouseup" DOM listeners on the document element. The subscriber * can set the root configuration property, to specify which node to attach DOM listeners to, if different from the document.
* *This event can also be listened for using node.delegate().
* *It is recommended that you use Y.bind to set up context and additional arguments for your event handler,
* however if you want to pass the context and arguments as additional signature arguments to on/delegate,
* you need to provide a null value for the configuration object, e.g: node.on("gesturemoveend", fn, null, context, arg1, arg2, arg3)
Documentation for events added by this module can be found in the event document for the YUI global.
* * @example YUI().use('event-flick', function (Y) { Y.one('#myNode').on('flick', function (e) { }); }); * * @module event-gestures */ /** * Adds support for a "flick" event, which is fired at the end of a touch or mouse based flick gesture, and provides * velocity of the flick, along with distance and time information. * *Documentation for the flick event can be found on the YUI global, * along with the other supported events.
* * @module event-gestures * @submodule event-flick */ var GESTURE_MAP = Y.Event._GESTURE_MAP, EVENT = { start: GESTURE_MAP.start, end: GESTURE_MAP.end, move: GESTURE_MAP.move }, START = "start", END = "end", MOVE = "move", OWNER_DOCUMENT = "ownerDocument", MIN_VELOCITY = "minVelocity", MIN_DISTANCE = "minDistance", PREVENT_DEFAULT = "preventDefault", _FLICK_START = "_fs", _FLICK_START_HANDLE = "_fsh", _FLICK_END_HANDLE = "_feh", _FLICK_MOVE_HANDLE = "_fmh", NODE_TYPE = "nodeType"; /** * Sets up a "flick" event, that is fired whenever the user initiates a flick gesture on the node * where the listener is attached. The subscriber can specify a minimum distance or velocity for * which the event is to be fired. The subscriber can also specify if there is a particular axis which * they are interested in - "x" or "y". If no axis is specified, the axis along which there was most distance * covered is used. * *It is recommended that you use Y.bind to set up context and additional arguments for your event handler,
* however if you want to pass the context and arguments as additional signature arguments to "on",
* you need to provide a null value for the configuration object, e.g: node.on("flick", fn, null, context, arg1, arg2, arg3)