/files/photoswipe/3.0.5/code.photoswipe-3.0.5.js
JavaScript | 2268 lines | 1276 code | 681 blank | 311 comment | 181 complexity | 77f4104a6b9fae365445942b87376ea6 MD5 | raw file
- // Copyright (c) 2012 by Code Computerlove (http://www.codecomputerlove.com)
- // Licensed under the MIT license
- // version: 3.0.5
-
- (function (window) {
-
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind
- if (!Function.prototype.bind ) {
-
- Function.prototype.bind = function( obj ) {
- var slice = [].slice,
- args = slice.call(arguments, 1),
- self = this,
- nop = function () {},
- bound = function () {
- return self.apply( this instanceof nop ? this : ( obj || {} ),
- args.concat( slice.call(arguments) ) );
- };
-
- nop.prototype = self.prototype;
-
- bound.prototype = new nop();
-
- return bound;
- };
- }
-
-
-
- if (typeof window.Code === "undefined") {
- window.Code = {};
- }
-
-
-
- window.Code.Util = {
-
-
- /*
- * Function: registerNamespace
- */
- registerNamespace: function () {
- var
- args = arguments, obj = null, i, j, ns, nsParts, root, argsLen, nsPartsLens;
- for (i=0, argsLen=args.length; i<argsLen; i++) {
- ns = args[i];
- nsParts = ns.split(".");
- root = nsParts[0];
- if (typeof window[root] === "undefined"){
- window[root] = {};
- }
- obj = window[root];
- //eval('if (typeof ' + root + ' == "undefined"){' + root + ' = {};} obj = ' + root + ';');
- for (j=1, nsPartsLens=nsParts.length; j<nsPartsLens; ++j) {
- obj[nsParts[j]] = obj[nsParts[j]] || {};
- obj = obj[nsParts[j]];
- }
- }
- },
-
-
-
- /*
- * Function: coalesce
- * Takes any number of arguments and returns the first non Null / Undefined argument.
- */
- coalesce: function () {
- var i, j;
- for (i=0, j=arguments.length; i<j; i++) {
- if (!this.isNothing(arguments[i])) {
- return arguments[i];
- }
- }
- return null;
- },
-
-
-
- /*
- * Function: extend
- */
- extend: function(destination, source, overwriteProperties){
- var prop;
- if (this.isNothing(overwriteProperties)){
- overwriteProperties = true;
- }
- if (destination && source && this.isObject(source)){
- for(prop in source){
- if (this.objectHasProperty(source, prop)) {
- if (overwriteProperties){
- destination[prop] = source[prop];
- }
- else{
- if(typeof destination[prop] === "undefined"){
- destination[prop] = source[prop];
- }
- }
- }
- }
- }
- },
-
-
-
- /*
- * Function: clone
- */
- clone: function(obj) {
- var retval = {};
- this.extend(retval, obj);
- return retval;
- },
-
-
-
- /*
- * Function: isObject
- */
- isObject: function(obj){
- return obj instanceof Object;
- },
-
-
-
- /*
- * Function: isFunction
- */
- isFunction: function(obj){
- return ({}).toString.call(obj) === "[object Function]";
- },
-
-
-
- /*
- * Function: isArray
- */
- isArray: function(obj){
- return obj instanceof Array;
- },
-
-
- /*
- * Function: isLikeArray
- */
- isLikeArray: function(obj) {
- return typeof obj.length === 'number';
- },
-
-
-
- /*
- * Function: isNumber
- */
- isNumber: function(obj){
- return typeof obj === "number";
- },
-
-
-
- /*
- * Function: isString
- */
- isString: function(obj){
- return typeof obj === "string";
- },
-
-
- /*
- * Function: isNothing
- */
- isNothing: function (obj) {
-
- if (typeof obj === "undefined" || obj === null) {
- return true;
- }
- return false;
-
- },
-
-
-
- /*
- * Function: swapArrayElements
- */
- swapArrayElements: function(arr, i, j){
-
- var temp = arr[i];
- arr[i] = arr[j];
- arr[j] = temp;
-
- },
-
-
-
- /*
- * Function: trim
- */
- trim: function(val) {
- return val.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
- },
-
-
-
- /*
- * Function: toCamelCase
- */
- toCamelCase: function(val){
- return val.replace(/(\-[a-z])/g, function($1){return $1.toUpperCase().replace('-','');});
- },
-
-
-
- /*
- * Function: toDashedCase
- */
- toDashedCase: function(val){
- return val.replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();});
- },
-
-
-
- /*
- * Function: indexOf
- */
- arrayIndexOf: function(obj, array, prop){
-
- var i, j, retval, arrayItem;
-
- retval = -1;
-
- for (i=0, j=array.length; i<j; i++){
-
- arrayItem = array[i];
-
- if (!this.isNothing(prop)){
- if (this.objectHasProperty(arrayItem, prop)) {
- if (arrayItem[prop] === obj){
- retval = i;
- break;
- }
- }
- }
- else{
- if (arrayItem === obj){
- retval = i;
- break;
- }
- }
-
- }
-
- return retval;
-
- },
-
-
-
- /*
- * Function: objectHasProperty
- */
- objectHasProperty: function(obj, propName){
-
- if (obj.hasOwnProperty){
- return obj.hasOwnProperty(propName);
- }
- else{
- return ('undefined' !== typeof obj[propName]);
- }
-
- }
-
-
- };
-
- }(window));
- // Copyright (c) 2012 by Code Computerlove (http://www.codecomputerlove.com)
- // Licensed under the MIT license
- // version: 3.0.5
-
- (function(window, Util) {
-
- Util.Browser = {
-
- ua: null,
- version: null,
- safari: null,
- webkit: null,
- opera: null,
- msie: null,
- chrome: null,
- mozilla: null,
-
- android: null,
- blackberry: null,
- iPad: null,
- iPhone: null,
- iPod: null,
- iOS: null,
-
- is3dSupported: null,
- isCSSTransformSupported: null,
- isTouchSupported: null,
- isGestureSupported: null,
-
-
- _detect: function(){
-
- this.ua = window.navigator.userAgent;
- this.version = (this.ua.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || []);
- this.safari = (/Safari/gi).test(window.navigator.appVersion);
- this.webkit = /webkit/i.test(this.ua);
- this.opera = /opera/i.test(this.ua);
- this.msie = /msie/i.test(this.ua) && !this.opera;
- this.chrome = /Chrome/i.test(this.ua);
- this.firefox = /Firefox/i.test(this.ua);
- this.fennec = /Fennec/i.test(this.ua);
- this.mozilla = /mozilla/i.test(this.ua) && !/(compatible|webkit)/.test(this.ua);
- this.android = /android/i.test(this.ua);
- this.blackberry = /blackberry/i.test(this.ua);
- this.iOS = (/iphone|ipod|ipad/gi).test(window.navigator.platform);
- this.iPad = (/ipad/gi).test(window.navigator.platform);
- this.iPhone = (/iphone/gi).test(window.navigator.platform);
- this.iPod = (/ipod/gi).test(window.navigator.platform);
-
- var testEl = document.createElement('div');
- this.is3dSupported = !Util.isNothing(testEl.style.WebkitPerspective);
- this.isCSSTransformSupported = ( !Util.isNothing(testEl.style.WebkitTransform) || !Util.isNothing(testEl.style.MozTransform) || !Util.isNothing(testEl.style.transformProperty) );
- this.isTouchSupported = this.isEventSupported('touchstart');
- this.isGestureSupported = this.isEventSupported('gesturestart');
-
- },
-
-
- _eventTagNames: {
- 'select':'input',
- 'change':'input',
- 'submit':'form',
- 'reset':'form',
- 'error':'img',
- 'load':'img',
- 'abort':'img'
- },
-
-
- /*
- * Function: isEventSupported
- * http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
- */
- isEventSupported: function(eventName) {
- var
- el = document.createElement(this._eventTagNames[eventName] || 'div'),
- isSupported;
- eventName = 'on' + eventName;
- isSupported = Util.objectHasProperty(el, eventName);
- if (!isSupported) {
- el.setAttribute(eventName, 'return;');
- isSupported = typeof el[eventName] === 'function';
- }
- el = null;
- return isSupported;
- },
-
-
- isLandscape: function(){
- return (Util.DOM.windowWidth() > Util.DOM.windowHeight());
- }
- };
-
- Util.Browser._detect();
-
- }
- (
- window,
- window.Code.Util
- ))
- ;
- // Copyright (c) 2012 by Code Computerlove (http://www.codecomputerlove.com)
- // Licensed under the MIT license
- // version: 3.0.5
-
- (function (window, Util) {
-
- Util.extend(Util, {
-
- Events: {
-
-
- /*
- * Function: add
- * Add an event handler
- */
- add: function(obj, type, handler){
-
- this._checkHandlersProperty(obj);
-
- if (type === 'mousewheel'){
- type = this._normaliseMouseWheelType();
- }
-
- if (typeof obj.__eventHandlers[type] === 'undefined'){
- obj.__eventHandlers[type] = [];
- }
- obj.__eventHandlers[type].push(handler);
-
- // DOM element
- if (this._isBrowserObject(obj)){
- obj.addEventListener(type, handler, false);
- }
-
- },
-
-
-
- /*
- * Function: remove
- * Removes a handler or all handlers associated with a type
- */
- remove: function(obj, type, handler){
-
- this._checkHandlersProperty(obj);
-
- if (type === 'mousewheel'){
- type = this._normaliseMouseWheelType();
- }
-
- if (obj.__eventHandlers[type] instanceof Array){
-
- var
- i, j,
- handlers = obj.__eventHandlers[type];
-
- // Removing all handlers for a type
- if (Util.isNothing(handler)){
-
- if (this._isBrowserObject(obj)){
- for (i=0, j=handlers.length; i<j; i++){
- obj.removeEventListener(type, handlers[i], false);
- }
- }
-
- obj.__eventHandlers[type] = [];
- return;
- }
-
- // Removing a specific handler
- for (i=0, j=handlers.length; i<j; i++){
- if (handlers[i] === handler){
- handlers.splice(i, 1);
- break;
- }
- }
-
- // DOM element
- if (this._isBrowserObject(obj)){
- obj.removeEventListener(type, handler, false);
- return;
- }
-
- }
-
- },
-
-
- /*
- * Function: fire
- * Fire an event
- */
- fire: function(obj, type){
-
- var
- i, j,
- event,
- listeners,
- listener,
- args = Array.prototype.slice.call(arguments).splice(2),
- isNative;
-
-
- if (type === 'mousewheel'){
- type = this._normaliseMouseWheelType();
- }
-
-
- // DOM element
- if (this._isBrowserObject(obj)){
-
- if (typeof type !== "string"){
- throw 'type must be a string for DOM elements';
- }
-
- isNative = this._NATIVE_EVENTS[type];
- event = document.createEvent(isNative ? "HTMLEvents" : "UIEvents");
- event[isNative ? 'initEvent' : 'initUIEvent'](type, true, true, window, 1);
-
- // Fire an event on an element that has no extra arguments
- if (args.length < 1){
- obj.dispatchEvent(event);
- return;
- }
-
- }
-
- this._checkHandlersProperty(obj);
-
- if (typeof type === "string"){
- event = { type: type };
- }
- else{
- event = type;
- }
- if (!event.target){
- event.target = obj;
- }
-
- if (!event.type){
- throw new Error("Event object missing 'type' property.");
- }
-
- if (obj.__eventHandlers[event.type] instanceof Array){
- listeners = obj.__eventHandlers[event.type];
- args.unshift(event);
- for (i=0, j=listeners.length; i<j; i++){
- listener = listeners[i];
- if (!Util.isNothing(listener)){
- listener.apply(obj, args);
- }
- }
- }
-
- },
-
-
- /*
- * Function: getMousePosition
- */
- getMousePosition: function(event){
-
- var retval = {
- x: 0,
- y: 0
- };
-
- if (event.pageX) {
- retval.x = event.pageX;
- }
- else if (event.clientX) {
- retval.x = event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft);
- }
-
- if (event.pageY) {
- retval.y = event.pageY;
- }
- else if (event.clientY) {
- retval.y = event.clientY + ( document.documentElement.scrollTop || document.body.scrollTop);
- }
-
- return retval;
- },
-
-
- /*
- * Function: getTouchEvent
- */
- getTouchEvent: function(event){
-
- return event;
-
- },
-
-
-
- /*
- * Function: getWheelDelta
- */
- getWheelDelta: function(event){
-
- var delta = 0;
-
- if (!Util.isNothing(event.wheelDelta)){
- delta = event.wheelDelta / 120;
- }
- else if (!Util.isNothing(event.detail)){
- delta = -event.detail / 3;
- }
-
- return delta;
-
- },
-
-
- /*
- * Function: domReady
- */
- domReady: function(handler){
-
- document.addEventListener('DOMContentLoaded', handler, false);
-
- },
-
-
- _checkHandlersProperty: function(obj){
-
- if (Util.isNothing(obj.__eventHandlers)){
- Util.extend(obj, {
- __eventHandlers: { }
- });
- }
-
- },
-
-
- _isBrowserObject: function(obj){
- if (obj === window || obj === window.document){
- return true;
- }
- return this._isElement(obj) || this._isNode(obj);
- },
-
-
- _isElement: function(obj){
- return (
- typeof window.HTMLElement === "object" ? obj instanceof window.HTMLElement : //DOM2
- typeof obj === "object" && obj.nodeType === 1 && typeof obj.nodeName==="string"
- );
- },
-
-
-
- _isNode: function(obj){
- return (
- typeof window.Node === "object" ? obj instanceof window.Node :
- typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName==="string"
- );
- },
-
-
-
- _normaliseMouseWheelType: function(){
-
- if (Util.Browser.isEventSupported('mousewheel')){
- return 'mousewheel';
- }
- return 'DOMMouseScroll';
-
- },
-
-
-
- _NATIVE_EVENTS: {
- click: 1, dblclick: 1, mouseup: 1, mousedown: 1, contextmenu: 1, //mouse buttons
- mousewheel: 1, DOMMouseScroll: 1, //mouse wheel
- mouseover: 1, mouseout: 1, mousemove: 1, selectstart: 1, selectend: 1, //mouse movement
- keydown: 1, keypress: 1, keyup: 1, //keyboard
- orientationchange: 1, // mobile
- touchstart: 1, touchmove: 1, touchend: 1, touchcancel: 1, // touch
- gesturestart: 1, gesturechange: 1, gestureend: 1, // gesture
- focus: 1, blur: 1, change: 1, reset: 1, select: 1, submit: 1, //form elements
- load: 1, unload: 1, beforeunload: 1, resize: 1, move: 1, DOMContentLoaded: 1, readystatechange: 1, //window
- error: 1, abort: 1, scroll: 1
- }
-
- }
-
-
- });
-
-
- }
- (
- window,
- window.Code.Util
- ));// Copyright (c) 2012 by Code Computerlove (http://www.codecomputerlove.com)
- // Licensed under the MIT license
- // version: 3.0.5
-
- (function (window, Util) {
-
- Util.extend(Util, {
-
- DOM: {
-
-
-
- /*
- * Function: setData
- */
- setData: function(el, key, value){
-
- if (Util.isLikeArray(el)){
- var i, len;
- for (i=0, len=el.length; i<len; i++){
- Util.DOM._setData(el[i], key, value);
- }
- }
- else{
- Util.DOM._setData(el, key, value);
- }
-
- },
- _setData: function(el, key, value){
-
- Util.DOM.setAttribute(el, 'data-' + key, value);
-
- },
-
-
-
- /*
- * Function: getData
- */
- getData: function(el, key, defaultValue){
-
- return Util.DOM.getAttribute(el, 'data-' + key, defaultValue);
-
- },
-
-
-
- /*
- * Function: removeData
- */
- removeData: function(el, key){
-
- if (Util.isLikeArray(el)){
- var i, len;
- for (i=0, len=el.length; i<len; i++){
- Util.DOM._removeData(el[i], key);
- }
- }
- else{
- Util.DOM._removeData(el, key);
- }
-
- },
- _removeData: function(el, key){
-
- Util.DOM.removeAttribute(el, 'data-' + key);
-
- },
-
-
-
- /*
- * Function: isChildOf
- */
- isChildOf: function(childEl, parentEl)
- {
- if (parentEl === childEl){
- return false;
- }
- while (childEl && childEl !== parentEl)
- {
- childEl = childEl.parentNode;
- }
-
- return childEl === parentEl;
- },
-
-
-
- /*
- * Function: find
- */
- find: function(selectors, contextEl){
- if (Util.isNothing(contextEl)){
- contextEl = window.document;
- }
- var
- els = contextEl.querySelectorAll(selectors),
- retval = [],
- i, j;
-
- for (i=0, j=els.length; i<j; i++){
- retval.push(els[i]);
- }
- return retval;
- },
-
-
-
- /*
- * Function: createElement
- */
- createElement: function(type, attributes, content){
-
- var
- attribute,
- retval = document.createElement(type);
-
- for(attribute in attributes) {
- if(Util.objectHasProperty(attributes, attribute)){
- retval.setAttribute(attribute, attributes[attribute]);
- }
- }
-
- retval.innerHTML = content || '';
-
- return retval;
-
- },
-
-
- /*
- * Function: appendChild
- */
- appendChild: function(childEl, parentEl){
-
- parentEl.appendChild(childEl);
-
- },
-
-
- /*
- * Function: insertBefore
- */
- insertBefore: function(newEl, refEl, parentEl){
-
- parentEl.insertBefore(newEl, refEl);
-
- },
-
-
- /*
- * Function: appendText
- */
- appendText: function(text, parentEl){
-
- Util.DOM.appendChild(document.createTextNode(text), parentEl);
-
- },
-
-
- /*
- * Function: appendToBody
- */
- appendToBody: function(childEl){
-
- this.appendChild(childEl, document.body);
-
- },
-
-
- /*
- * Function: removeChild
- */
- removeChild: function(childEl, parentEl){
-
- parentEl.removeChild(childEl);
-
- },
-
-
-
- /*
- * Function: removeChildren
- */
- removeChildren: function(parentEl){
-
- if (parentEl.hasChildNodes()){
-
- while (parentEl.childNodes.length >= 1){
- parentEl.removeChild(parentEl.childNodes[parentEl.childNodes.length -1]);
- }
-
- }
-
- },
-
-
-
- /*
- * Function: hasAttribute
- */
- hasAttribute: function(el, attributeName){
-
- return !Util.isNothing(el.getAttribute(attributeName));
-
- },
-
-
-
- /*
- * Function: getAttribute
- */
- getAttribute: function(el, attributeName, defaultValue){
-
- var retval = el.getAttribute(attributeName);
- if (Util.isNothing(retval) && !Util.isNothing(defaultValue)){
- retval = defaultValue;
- }
- return retval;
-
- },
-
-
-
- /*
- * Function: el, attributeName
- */
- setAttribute: function(el, attributeName, value){
-
- if (Util.isLikeArray(el)){
- var i, len;
- for (i=0, len=el.length; i<len; i++){
- Util.DOM._setAttribute(el[i], attributeName, value);
- }
- }
- else{
- Util.DOM._setAttribute(el, attributeName, value);
- }
-
- },
- _setAttribute: function(el, attributeName, value){
-
- el.setAttribute(attributeName, value);
-
- },
-
-
-
- /*
- * Function: removeAttribute
- */
- removeAttribute: function(el, attributeName){
-
- if (Util.isLikeArray(el)){
- var i, len;
- for (i=0, len=el.length; i<len; i++){
- Util.DOM._removeAttribute(el[i], attributeName);
- }
- }
- else{
- Util.DOM._removeAttribute(el, attributeName);
- }
-
- },
- _removeAttribute: function(el, attributeName){
-
- if (this.hasAttribute(el, attributeName)){
-
- el.removeAttribute(attributeName);
-
- }
-
- },
-
-
-
- /*
- * Function: addClass
- */
- addClass: function(el, className){
-
- if (Util.isLikeArray(el)){
- var i, len;
- for (i=0, len=el.length; i<len; i++){
- Util.DOM._addClass(el[i], className);
- }
- }
- else{
- Util.DOM._addClass(el, className);
- }
-
- },
- _addClass: function(el, className){
- var
- currentClassValue = Util.DOM.getAttribute(el, 'class', ''),
- re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
-
- if ( ! re.test(currentClassValue) ){
- if (currentClassValue !== ''){
- currentClassValue = currentClassValue + ' ';
- }
- currentClassValue = currentClassValue + className;
- Util.DOM.setAttribute(el, 'class', currentClassValue);
- }
- },
-
-
-
- /*
- * Function: removeClass
- */
- removeClass: function(el, className){
-
- if (Util.isLikeArray(el)){
- var i, len;
- for (i=0, len=el.length; i<len; i++){
- Util.DOM._removeClass(el[i], className);
- }
- }
- else{
- Util.DOM._removeClass(el, className);
- }
-
- },
- _removeClass: function(el, className){
-
- var
- currentClassValue = Util.DOM.getAttribute(el, 'class', ''),
- classes = Util.trim(currentClassValue).split(' '),
- newClassVal = '',
- i, j;
-
- for (i=0, j=classes.length; i<j; i++){
- if (classes[i] !== className){
- if (newClassVal !== ''){
- newClassVal += ' ';
- }
- newClassVal += classes[i];
- }
- }
-
- if (newClassVal === ''){
- Util.DOM.removeAttribute(el, 'class');
- }
- else{
- Util.DOM.setAttribute(el, 'class', newClassVal);
- }
-
- },
-
-
-
- /*
- * Function: hasClass
- */
- hasClass: function(el, className){
-
- var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
- return re.test(Util.DOM.getAttribute(el, 'class', ''));
-
- },
-
-
-
- /*
- * Function: setStyle
- */
- setStyle: function(el, style, value){
-
- if (Util.isLikeArray(el)){
- var i, len;
- for (i=0, len=el.length; i<len; i++){
- Util.DOM._setStyle(el[i], style, value);
- }
- }
- else{
- Util.DOM._setStyle(el, style, value);
- }
-
- },
- _setStyle: function(el, style, value){
-
- var prop, val;
-
- if (Util.isObject(style)) {
- for(prop in style) {
- if(Util.objectHasProperty(style, prop)){
-
- if (prop === 'width'){
- Util.DOM.width(el, style[prop]);
- }
- else if (prop === 'height'){
- Util.DOM.height(el, style[prop]);
- }
- else{
- el.style[prop] = style[prop];
- }
-
- }
- }
- }
- else {
- el.style[style] = value;
- }
- },
-
-
-
- /*
- * Function: getStyle
- */
- getStyle: function(el, styleName){
-
- var retval = window.getComputedStyle(el,'').getPropertyValue(styleName);
- if (retval === ''){
- retval = el.style[styleName];
- }
- return retval;
-
- },
-
-
-
- /*
- * Function: hide
- */
- hide: function(el){
-
- if (Util.isLikeArray(el)){
- var i, len;
- for (i=0, len=el.length; i<len; i++){
- Util.DOM._hide(el[i]);
- }
- }
- else{
- Util.DOM._hide(el);
- }
-
- },
- _hide: function(el){
-
- // Store the current display value if we use show
- Util.DOM.setData(el, 'ccl-disp', Util.DOM.getStyle(el, 'display'));
- Util.DOM.setStyle(el, 'display', 'none');
-
- },
-
-
-
- /*
- * Function: show
- */
- show: function(el){
-
- if (Util.isLikeArray(el)){
- var i, len;
- for (i=0, len=el.length; i<len; i++){
- Util.DOM._show(el[i]);
- }
- }
- else{
- Util.DOM._show(el);
- }
-
- },
- _show: function(el){
-
- if (Util.DOM.getStyle(el, 'display') === 'none'){
- var oldDisplayValue = Util.DOM.getData(el, 'ccl-disp', 'block');
- if (oldDisplayValue === 'none' || oldDisplayValue === ''){
- oldDisplayValue = 'block';
- }
- Util.DOM.setStyle(el, 'display', oldDisplayValue);
- }
-
- },
-
-
-
- /*
- * Function: width
- * Content width, excludes padding
- */
- width: function(el, value){
-
- if (!Util.isNothing(value)){
- if (Util.isNumber(value)){
- value = value + 'px';
- }
- el.style.width = value;
- }
-
- return this._getDimension(el, 'width');
-
- },
-
-
-
- /*
- * Function: outerWidth
- */
- outerWidth: function(el){
-
- var retval = Util.DOM.width(el);
-
- retval += parseInt(Util.DOM.getStyle(el, 'padding-left'), 10) + parseInt(Util.DOM.getStyle(el, 'padding-right'), 10);
- retval += parseInt(Util.DOM.getStyle(el, 'margin-left'), 10) + parseInt(Util.DOM.getStyle(el, 'margin-right'), 10);
- retval += parseInt(Util.DOM.getStyle(el, 'border-left-width'), 10) + parseInt(Util.DOM.getStyle(el, 'border-right-width'), 10);
- return retval;
-
- },
-
-
-
- /*
- * Function: height
- * Content height, excludes padding
- */
- height: function(el, value){
-
- if (!Util.isNothing(value)){
- if (Util.isNumber(value)){
- value = value + 'px';
- }
- el.style.height = value;
- }
-
- return this._getDimension(el, 'height');
-
- },
-
-
-
- /*
- * Function: _getDimension
- */
- _getDimension: function(el, dimension){
-
- var
- retval = window.parseInt(window.getComputedStyle(el,'').getPropertyValue(dimension)),
- styleBackup;
-
- if (isNaN(retval)){
-
- // If this is the case, chances are the element is not displayed and we can't get
- // the width and height. This temporarily shows and hides to get the value
- styleBackup = {
- display: el.style.display,
- left: el.style.left
- };
-
- el.style.display = 'block';
- el.style.left = '-1000000px';
-
- retval = window.parseInt(window.getComputedStyle(el,'').getPropertyValue(dimension));
-
- el.style.display = styleBackup.display;
- el.style.left = styleBackup.left;
- }
- return retval;
-
- },
-
-
-
- /*
- * Function: outerHeight
- */
- outerHeight: function(el){
-
- var retval = Util.DOM.height(el);
-
- retval += parseInt(Util.DOM.getStyle(el, 'padding-top'), 10) + parseInt(Util.DOM.getStyle(el, 'padding-bottom'), 10);
- retval += parseInt(Util.DOM.getStyle(el, 'margin-top'), 10) + parseInt(Util.DOM.getStyle(el, 'margin-bottom'), 10);
- retval += parseInt(Util.DOM.getStyle(el, 'border-top-width'), 10) + parseInt(Util.DOM.getStyle(el, 'border-bottom-width'), 10);
-
- return retval;
-
- },
-
-
-
- /*
- * Function: documentWidth
- */
- documentWidth: function(){
-
- return Util.DOM.width(document.documentElement);
-
- },
-
-
-
- /*
- * Function: documentHeight
- */
- documentHeight: function(){
-
- return Util.DOM.height(document.documentElement);
-
- },
-
-
-
- /*
- * Function: documentOuterWidth
- */
- documentOuterWidth: function(){
-
- return Util.DOM.width(document.documentElement);
-
- },
-
-
-
- /*
- * Function: documentOuterHeight
- */
- documentOuterHeight: function(){
-
- return Util.DOM.outerHeight(document.documentElement);
-
- },
-
-
-
- /*
- * Function: bodyWidth
- */
- bodyWidth: function(){
-
- return Util.DOM.width(document.body);
-
- },
-
-
-
- /*
- * Function: bodyHeight
- */
- bodyHeight: function(){
-
- return Util.DOM.height(document.body);
-
- },
-
-
-
- /*
- * Function: bodyOuterWidth
- */
- bodyOuterWidth: function(){
-
- return Util.DOM.outerWidth(document.body);
-
- },
-
-
-
- /*
- * Function: bodyOuterHeight
- */
- bodyOuterHeight: function(){
-
- return Util.DOM.outerHeight(document.body);
-
- },
-
-
-
- /*
- * Function: windowWidth
- */
- windowWidth: function(){
-
- return window.innerWidth;
-
- },
-
-
-
- /*
- * Function: windowHeight
- */
- windowHeight: function(){
-
- return window.innerHeight;
-
- },
-
-
-
- /*
- * Function: windowScrollLeft
- */
- windowScrollLeft: function(){
-
- return window.pageXOffset;
-
- },
-
-
-
- /*
- * Function: windowScrollTop
- */
- windowScrollTop: function(){
-
- return window.pageYOffset;
-
- }
-
- }
-
-
- });
-
-
- }
- (
- window,
- window.Code.Util
- ));
- // Copyright (c) 2012 by Code Computerlove (http://www.codecomputerlove.com)
- // Licensed under the MIT license
- // version: 3.0.5
-
- (function (window, Util) {
-
- Util.extend(Util, {
-
- Animation: {
-
- _applyTransitionDelay: 50,
-
- _transitionEndLabel: (window.document.documentElement.style.webkitTransition !== undefined) ? "webkitTransitionEnd" : "transitionend",
-
- _transitionEndHandler: null,
-
- _transitionPrefix: (window.document.documentElement.style.webkitTransition !== undefined) ? "webkitTransition" : (window.document.documentElement.style.MozTransition !== undefined) ? "MozTransition" : "transition",
-
- _transformLabel: (window.document.documentElement.style.webkitTransform !== undefined) ? "webkitTransform" : (window.document.documentElement.style.MozTransition !== undefined) ? "MozTransform" : "transform",
-
-
- /*
- * Function: _getTransitionEndHandler
- */
- _getTransitionEndHandler: function(){
-
- if (Util.isNothing(this._transitionEndHandler)){
- this._transitionEndHandler = this._onTransitionEnd.bind(this);
- }
-
- return this._transitionEndHandler;
-
- },
-
-
-
- /*
- * Function: stop
- */
- stop: function(el){
-
- if (Util.Browser.isCSSTransformSupported){
- var
- property = el.style[this._transitionPrefix + 'Property'],
- callbackLabel = (property !== '') ? 'ccl' + property + 'callback' : 'cclallcallback',
- style = {};
-
- Util.Events.remove(el, this._transitionEndLabel, this._getTransitionEndHandler());
- if (Util.isNothing(el.callbackLabel)){
- delete el.callbackLabel;
- }
-
- style[this._transitionPrefix + 'Property'] = '';
- style[this._transitionPrefix + 'Duration'] = '';
- style[this._transitionPrefix + 'TimingFunction'] = '';
- style[this._transitionPrefix + 'Delay'] = '';
- style[this._transformLabel] = '';
-
- Util.DOM.setStyle(el, style);
- }
- else if (!Util.isNothing(window.jQuery)){
-
- window.jQuery(el).stop(true, true);
-
- }
-
-
- },
-
-
-
- /*
- * Function: fadeIn
- */
- fadeIn: function(el, speed, callback, timingFunction, opacity){
-
- opacity = Util.coalesce(opacity, 1);
- if (opacity <= 0){
- opacity = 1;
- }
-
- if (speed <= 0){
- Util.DOM.setStyle(el, 'opacity', opacity);
- if (!Util.isNothing(callback)){
- callback(el);
- return;
- }
- }
-
- var currentOpacity = Util.DOM.getStyle(el, 'opacity');
-
- if (currentOpacity >= 1){
- Util.DOM.setStyle(el, 'opacity', 0);
- }
-
- if (Util.Browser.isCSSTransformSupported){
- this._applyTransition(el, 'opacity', opacity, speed, callback, timingFunction);
- }
- else if (!Util.isNothing(window.jQuery)){
- window.jQuery(el).fadeTo(speed, opacity, callback);
- }
-
- },
-
-
-
- /*
- * Function: fadeTo
- */
- fadeTo: function(el, opacity, speed, callback, timingFunction){
- this.fadeIn(el, speed, callback, timingFunction, opacity);
- },
-
-
-
- /*
- * Function: fadeOut
- */
- fadeOut: function(el, speed, callback, timingFunction){
-
- if (speed <= 0){
- Util.DOM.setStyle(el, 'opacity', 0);
- if (!Util.isNothing(callback)){
- callback(el);
- return;
- }
- }
-
- if (Util.Browser.isCSSTransformSupported){
-
- this._applyTransition(el, 'opacity', 0, speed, callback, timingFunction);
-
- }
- else{
-
- window.jQuery(el).fadeTo(speed, 0, callback);
-
- }
-
- },
-
-
-
- /*
- * Function: slideBy
- */
- slideBy: function(el, x, y, speed, callback, timingFunction){
-
- var style = {};
-
- x = Util.coalesce(x, 0);
- y = Util.coalesce(y, 0);
- timingFunction = Util.coalesce(timingFunction, 'ease-out');
-
- style[this._transitionPrefix + 'Property'] = 'all';
- style[this._transitionPrefix + 'Delay'] = '0';
-
- if (speed === 0){
- style[this._transitionPrefix + 'Duration'] = '';
- style[this._transitionPrefix + 'TimingFunction'] = '';
- }
- else{
- style[this._transitionPrefix + 'Duration'] = speed + 'ms';
- style[this._transitionPrefix + 'TimingFunction'] = Util.coalesce(timingFunction, 'ease-out');
-
- Util.Events.add(el, this._transitionEndLabel, this._getTransitionEndHandler());
-
- }
-
- style[this._transformLabel] = (Util.Browser.is3dSupported) ? 'translate3d(' + x + 'px, ' + y + 'px, 0px)' : 'translate(' + x + 'px, ' + y + 'px)';
-
- if (!Util.isNothing(callback)){
- el.cclallcallback = callback;
- }
-
- Util.DOM.setStyle(el, style);
-
- if (speed === 0){
- window.setTimeout(function(){
- this._leaveTransforms(el);
- }.bind(this), this._applyTransitionDelay);
- }
-
- },
-
-
-
- /*
- * Function:
- */
- resetTranslate: function(el){
-
- var style = {};
- style[this._transformLabel] = style[this._transformLabel] = (Util.Browser.is3dSupported) ? 'translate3d(0px, 0px, 0px)' : 'translate(0px, 0px)';
- Util.DOM.setStyle(el, style);
-
- },
-
-
-
- /*
- * Function: _applyTransition
- */
- _applyTransition: function(el, property, val, speed, callback, timingFunction){
-
- var style = {};
-
- timingFunction = Util.coalesce(timingFunction, 'ease-in');
-
- style[this._transitionPrefix + 'Property'] = property;
- style[this._transitionPrefix + 'Duration'] = speed + 'ms';
- style[this._transitionPrefix + 'TimingFunction'] = timingFunction;
- style[this._transitionPrefix + 'Delay'] = '0';
-
- Util.Events.add(el, this._transitionEndLabel, this._getTransitionEndHandler());
-
- Util.DOM.setStyle(el, style);
-
- if (!Util.isNothing(callback)){
- el['ccl' + property + 'callback'] = callback;
- }
-
- window.setTimeout(function(){
- Util.DOM.setStyle(el, property, val);
- }, this._applyTransitionDelay);
-
- },
-
-
-
- /*
- * Function: _onTransitionEnd
- */
- _onTransitionEnd: function(e){
-
- Util.Events.remove(e.currentTarget, this._transitionEndLabel, this._getTransitionEndHandler());
- this._leaveTransforms(e.currentTarget);
-
- },
-
-
-
- /*
- * Function: _leaveTransforms
- */
- _leaveTransforms: function(el){
-
- var
- property = el.style[this._transitionPrefix + 'Property'],
- callbackLabel = (property !== '') ? 'ccl' + property + 'callback' : 'cclallcallback',
- callback,
- transform = Util.coalesce(el.style.webkitTransform, el.style.MozTransform, el.style.transform),
- transformMatch,
- transformExploded,
- domX = window.parseInt(Util.DOM.getStyle(el, 'left'), 0),
- domY = window.parseInt(Util.DOM.getStyle(el, 'top'), 0),
- transformedX,
- transformedY,
- style = {};
-
- if (transform !== ''){
- if (Util.Browser.is3dSupported){
- transformMatch = transform.match( /translate3d\((.*?)\)/ );
- }
- else{
- transformMatch = transform.match( /translate\((.*?)\)/ );
- }
- if (!Util.isNothing(transformMatch)){
- transformExploded = transformMatch[1].split(', ');
- transformedX = window.parseInt(transformExploded[0], 0);
- transformedY = window.parseInt(transformExploded[1], 0);
- }
- }
-
- style[this._transitionPrefix + 'Property'] = '';
- style[this._transitionPrefix + 'Duration'] = '';
- style[this._transitionPrefix + 'TimingFunction'] = '';
- style[this._transitionPrefix + 'Delay'] = '';
-
- Util.DOM.setStyle(el, style);
-
- window.setTimeout(function(){
-
- if(!Util.isNothing(transformExploded)){
-
- style = {};
- style[this._transformLabel] = '';
- style.left = (domX + transformedX) + 'px';
- style.top = (domY + transformedY) + 'px';
-
- Util.DOM.setStyle(el, style);
-
- }
-
- if (!Util.isNothing(el[callbackLabel])){
- callback = el[callbackLabel];
- delete el[callbackLabel];
- callback(el);
- }
-
- }.bind(this), this._applyTransitionDelay);
-
- }
-
-
- }
-
-
- });
-
-
- }
- (
- window,
- window.Code.Util
- ));
- // Copyright (c) 2012 by Code Computerlove (http://www.codecomputerlove.com)
- // Licensed under the MIT license
- // version: 3.0.5
-
- (function(window, klass, Util){
-
-
- Util.registerNamespace('Code.Util.TouchElement');
-
-
- Util.TouchElement.EventTypes = {
-
- onTouch: 'CodeUtilTouchElementOnTouch'
-
- };
-
-
- Util.TouchElement.ActionTypes = {
-
- touchStart: 'touchStart',
- touchMove: 'touchMove',
- touchEnd: 'touchEnd',
- touchMoveEnd: 'touchMoveEnd',
- tap: 'tap',
- doubleTap: 'doubleTap',
- swipeLeft: 'swipeLeft',
- swipeRight: 'swipeRight',
- swipeUp: 'swipeUp',
- swipeDown: 'swipeDown',
- gestureStart: 'gestureStart',
- gestureChange: 'gestureChange',
- gestureEnd: 'gestureEnd'
-
- };
-
-
- }
- (
- window,
- window.klass,
- window.Code.Util
- ));// Copyright (c) 2012 by Code Computerlove (http://www.codecomputerlove.com)
- // Licensed under the MIT license
- // version: 3.0.5
-
- (function(window, klass, Util){
-
-
- Util.registerNamespace('Code.Util.TouchElement');
-
-
- Util.TouchElement.TouchElementClass = klass({
-
- el: null,
-
- captureSettings: null,
-
- touchStartPoint: null,
- touchEndPoint: null,
- touchStartTime: null,
- doubleTapTimeout: null,
-
- touchStartHandler: null,
- touchMoveHandler: null,
- touchEndHandler: null,
-
- mouseDownHandler: null,
- mouseMoveHandler: null,
- mouseUpHandler: null,
- mouseOutHandler: null,
-
- gestureStartHandler: null,
- gestureChangeHandler: null,
- gestureEndHandler: null,
-
- swipeThreshold: null,
- swipeTimeThreshold: null,
- doubleTapSpeed: null,
-
-
-
- /*
- * Function: dispose
- */
- dispose: function(){
-
- var prop;
-
- this.removeEventHandlers();
-
- for (prop in this) {
- if (Util.objectHasProperty(this, prop)) {
- this[prop] = null;
- }
- }
-
- },
-
-
-
- /*
- * Function: initialize
- */
- initialize: function(el, captureSettings){
-
- this.el = el;
-
- this.captureSettings = {
- swipe: false,
- move: false,
- gesture: false,
- doubleTap: false,
- preventDefaultTouchEvents: true
- };
-
- Util.extend(this.captureSettings, captureSettings);
-
- this.swipeThreshold = 50;
- this.swipeTimeThreshold = 250;
- this.doubleTapSpeed = 250;
-
- this.touchStartPoint = { x: 0, y: 0 };
- this.touchEndPoint = { x: 0, y: 0 };
-
- },
-
-
-
- /*
- * Function: addEventHandlers
- */
- addEventHandlers: function(){
-
- if (Util.isNothing(this.touchStartHandler)){
- this.touchStartHandler = this.onTouchStart.bind(this);
- this.touchMoveHandler = this.onTouchMove.bind(this);
- this.touchEndHandler = this.onTouchEnd.bind(this);
- this.mouseDownHandler = this.onMouseDown.bind(this);
- this.mouseMoveHandler = this.onMouseMove.bind(this);
- this.mouseUpHandler = this.onMouseUp.bind(this);
- this.mouseOutHandler = this.onMouseOut.bind(this);
- this.gestureStartHandler = this.onGestureStart.bind(this);
- this.gestureChangeHandler = this.onGestureChange.bind(this);
- this.gestureEndHandler = this.onGestureEnd.bind(this);
- }
-
- Util.Events.add(this.el, 'touchstart', this.touchStartHandler);
- if (this.captureSettings.move){
- Util.Events.add(this.el, 'touchmove', this.touchMoveHandler);
- }
- Util.Events.add(this.el, 'touchend', this.touchEndHandler);
-
- Util.Events.add(this.el, 'mousedown', this.mouseDownHandler);
-
- if (Util.Browser.isGestureSupported && this.captureSettings.gesture){
- Util.Events.add(this.el, 'gesturestart', this.gestureStartHandler);
- Util.Events.add(this.el, 'gesturechange', this.gestureChangeHandler);
- Util.Events.add(this.el, 'gestureend', this.gestureEndHandler);
- }
-
- },
-
-
-
- /*
- * Function: removeEventHandlers
- */
- removeEventHandlers: function(){
-
- Util.Events.remove(this.el, 'touchstart', this.touchStartHandler);
- if (this.captureSettings.move){
- Util.Events.remove(this.el, 'touchmove', this.touchMoveHandler);
- }
- Util.Events.remove(this.el, 'touchend', this.touchEndHandler);
- Util.Events.remove(this.el, 'mousedown', this.mouseDownHandler);
-
- if (Util.Browser.isGestureSupported && this.captureSettings.gesture){
- Util.Events.remove(this.el, 'gesturestart', this.gestureStartHandler);
- Util.Events.remove(this.el, 'gesturechange', this.gestureChangeHandler);
- Util.Events.remove(this.el, 'gestureend', this.gestureEndHandler);
- }
-
- },
-
-
-
- /*
- * Function: getTouchPoint
- */
- getTouchPoint: function(touches){
-
- return {
- x: touches[0].pageX,
- y: touches[0].pageY
- };
-
- },
-
-
-
- /*
- * Function: fireTouchEvent
- */
- fireTouchEvent: function(e){
-
- var
- action,
- distX = 0,
- distY = 0,
- dist = 0,
- self,
- endTime,
- diffTime;
-
- distX = this.touchEndPoint.x - this.touchStartPoint.x;
- distY = this.touchEndPoint.y - this.touchStartPoint.y;
- dist = Math.sqrt( (distX * distX) + (distY * distY) );
-
- if (this.captureSettings.swipe){
- endTime = new Date();
- diffTime = endTime - this.touchStartTime;
-
- // See if there was a swipe gesture
- if (diffTime <= this.swipeTimeThreshold){
-
- if (window.Math.abs(distX) >= this.swipeThreshold){
-
- Util.Events.fire(this, {
- type: Util.TouchElement.EventTypes.onTouch,
- target: this,
- point: this.touchEndPoint,
- action: (distX < 0) ? Util.TouchElement.ActionTypes.swipeLeft : Util.TouchElement.ActionTypes.swipeRight,
- targetEl: e.target,
- currentTargetEl: e.currentTarget
- });
- return;
-
- }
-
-
- if (window.Math.abs(distY) >= this.swipeThreshold){
-
- Util.Events.fire(this, {
- type: Util.TouchElement.EventTypes.onTouch,
- target: this,
- point: this.touchEndPoint,
- action: (distY < 0) ? Util.TouchElement.ActionTypes.swipeUp : Util.TouchElement.ActionTypes.swipeDown,
- targetEl: e.target,
- currentTargetEl: e.currentTarget
- });
- return;
-
- }
-
- }
- }
-
-
- if (dist > 1){
-
- Util.Events.fire(this, {
- type: Util.TouchElement.EventTypes.onTouch,
- target: this,
- action: Util.TouchElement.ActionTypes.touchMoveEnd,
- point: this.touchEndPoint,
- targetEl: e.target,
- currentTargetEl: e.currentTarget
- });
- return;
- }
-
-
- if (!this.captureSettings.doubleTap){
-
- Util.Events.fire(this, {
- type: Util.TouchElement.EventTypes.onTouch,
- target: this,
- point: this.touchEndPoint,
- action: Util.TouchElement.ActionTypes.tap,
- targetEl: e.target,
- currentTargetEl: e.currentTarget
- });
- return;
-
- }
-
- if (Util.isNothing(this.doubleTapTimeout)){
-
- this.doubleTapTimeout = window.setTimeout(function(){
-
- this.doubleTapTimeout = null;
-
- Util.Events.fire(this, {
- type: Util.TouchElement.EventTypes.onTouch,
- target: this,
- point: this.touchEndPoint,
- action: Util.TouchElement.ActionTypes.tap,
- targetEl: e.target,
- currentTargetEl: e.currentTarget
- });
-
- }.bind(this), this.doubleTapSpeed);
-
- return;
-
- }
- else{
-
- window.clearTimeout(this.doubleTapTimeout);
- this.doubleTapTimeout = null;
-
- Util.Events.fire(this, {
- type: Util.TouchElement.EventTypes.onTouch,
- target: this,
- point: this.touchEndPoint,
- action: Util.TouchElement.ActionTypes.doubleTap,
- targetEl: e.target,
- currentTargetEl: e.currentTarget
- });
-
- }
-
- },
-
-
-
- /*
- * Function: onTouchStart
- */
- onTouchStart: function(e){
-
- if (this.captureSettings.preventDefaultTouchEvents){
- e.preventDefault();
- }
-
- // No longer need mouse events
- Util.Events.remove(this.el, 'mousedown', this.mouseDownHandler);
-
- var
- touchEvent = Util.Events.getTouchEvent(e),
- touches = touchEvent.touches;
-
- if (touches.length > 1 && this.captureSettings.gesture){
- this.isGesture = true;
- return;
- }
-
- this.touchStartTime = new Date();
- this.isGesture = false;
- this.touchStartPoint = this.getTouchPoint(touches);
-
- Util.Events.fire(this, {
- type: Util.TouchElement.EventTypes.onTouch,
- target: this,
- action: Util.TouchElement.ActionTypes.touchStart,
- point: this.touchStartPoint,
- targetEl: e.target,
- currentTargetEl: e.currentTarget
- });
-
-
- },
-
-
-
- /*
- * Function: onTouchMove
- */
- onTouchMove: function(e){
-
- if (this.captureSettings.preventDefaultTouchEvents){
- e.preventDefault();
- }
-
- if (this.isGesture && this.captureSettings.gesture){
- return;
- }
-
- var
- touchEvent = Util.Events.getTouchEvent(e),
- touches = touchEvent.touches;
-
- Util.Events.fire(this, {
- type: Util.TouchElement.EventTypes.onTouch,
- target: this,
- action: Util.TouchElement.ActionTypes.touchMove,
- point: this.getTouchPoint(touches),
- targetEl: e.target,
- currentTargetEl: e.currentTarget
- });
-
- },
-
-
-
- /*
- * Function: onTouchEnd
- */
- onTouchEnd: function(e){
-
- if (this.isGesture && this.captureSettings.gesture){
- return;
- }
-
- if (this.captureSettings.preventDefaultTouchEvents){
- e.preventDefault();
- }
-
- // http://backtothecode.blogspot.com/2009/10/javascript-touch-and-gesture-events.html
- // iOS removed the current touch from e.touches on "touchend"
- // Need to look into e.changedTouches
-
- var
- touchEvent = Util.Events.getTouchEvent(e),
- touches = (!Util.isNothing(touchEvent.changedTouches)) ? touchEvent.changedTouches : touchEvent.touches;
-
- this.touchEndPoint = this.getTouchPoint(touches);
-
- Util.Events.fire(this, {
- type: Util.TouchElement.EventTypes.onTouch,
- target: this,
- action: Util.TouchElement.ActionTypes.touchEnd,
- point: this.touchEndPoint,
- targetEl: e.target,
- currentTargetEl: e.currentTarget
- });
-
- this.fireTouchEvent(e);
-
- },
-
-
-
- /*
- * Function: onMouseDown
- */
- onMouseDown: function(e){
-
- e.preventDefault();
-
- // No longer need touch events
- Util.Events.remove(this.el, 'touchstart', this.mouseDownHandler);
- Util.Events.remove(this.el, 'touchmove', this.touchMoveHandler);
- Util.Events.remove(this.el, 'touchend', this.touchEndHandler);
-
- // Add move/up/out
- if (this.captureSettings.move){
- Util.Events.add(this.el, 'mousemove', this.mouseMoveHandler);
- }
- Util.Events.add(this.el, 'mouseup', this.mouseUpHandler);
- Util.Events.add(this.el, 'mouseout', this.mouseOutHandler);
-
- this.touchStartTime = new Date();
- this.isGesture = false;
- this.touchStartPoint = Util.Events.getMousePosition(e);
-
- Util.Events.fire(this, {
- type: Util.TouchElement.EventTypes.onTouch,
- target: this,
- action: Util.TouchElement.ActionTypes.touchStart,
- point: this.touchStartPoint,
- targetEl: e.target,
- currentTargetEl: e.currentTarget
- });
-
- },
-
-
-
- /*
- * Function: onMouseMove
- */
- onMouseMove: function(e){
-
- e.preventDefault();
-
- Util.Events.fire(this, {
- type: Util.TouchElement.EventTypes.onTouch,
- target: this,
- action: Util.TouchElement.ActionTypes.touchMove,
- point: Util.Events.getMousePosition(e),
- targetEl: e.target,
- currentTargetEl: e.currentTarget
- });
-
- },
-
-
-
- /*
- * Function: onMouseUp
- */
- onMouseUp: function(e){
-
- e.preventDefault();
-
- if (this.captureSettings.move){
- Util.Events.remove(this.el, 'mousemove', this.mouseMoveHandler);
- }
- Util.Events.remove(this.el, 'mouseup', this.mouseUpHandler);
- Util.Events.remove(this.el, 'mouseout', this.mouseOutHandler);
-
- this.touchEndPoint = Util.Events.getMousePosition(e);
-
- Util.Events.fire(this, {
- type: Util.TouchElement.EventTypes.onTouch,
- target: this,
- action: Util.TouchElement.ActionTypes.touchEnd,
- point: this.touchEndPoint,
- targetEl: e.target,
- currentTargetEl: e.currentTarget
- });
-
- this.fireTouchEvent(e);
-
- },
-
-
-
- /*
- * Function: onMouseOut
- */
- onMouseOut: function(e){
-
- /*
- * http://blog.stchur.com/2007/03/15/mouseenter-and-mouseleave-events-for-firefox-and-other-non-ie-browsers/
- */
- var relTarget = e.relatedTarget;
- if (this.el === relTarget || Util.DOM.isChildOf(relTarget, this.el)){
- return;
- }
-
- e.preventDefault();
-
- if (this.captureSettings.move){
- Util.Events.remove(this.el, 'mousemove', this.mouseMoveHandler);
- }
- Util.Events.remove(this.el, 'mouseup', this.mouseUpHandler);
- Util.Events.remove(this.el, 'mouseout', this.mouseOutHandler);
-
- this.touchEndPoint = Util.Events.getMousePosition(e);
-
- Util.Events.fire(this, {
- type: Util.TouchElement.EventTypes.onTouch,
- target: this,
- action: Util.TouchElement.ActionTypes.touchEnd,
- point: this.touchEndPoint,
- targetEl: e.target,
- currentTargetEl: e.currentTarget
- });
-
- this.fireTouchEvent(e);
-
- },
-
-
-