Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Redo commits, branch instead

  • Loading branch information...
commit bac6559ba8debc7e9da13eb84f191ebfcf405eca 1 parent 1f92620
@kokarn kokarn authored
Showing with 0 additions and 335 deletions.
  1. +0 −171 jquery.ui.touch-punch.1.4.4.js
  2. +0 −164 jquery.ui.touch-punch.1.7.2.js
View
171 jquery.ui.touch-punch.1.4.4.js
@@ -1,171 +0,0 @@
-/*!
- * jQuery UI Touch Punch 0.2.2
- *
- * Copyright 2011, Dave Furfero
- * Dual licensed under the MIT or GPL Version 2 licenses.
- *
- * Depends:
- * jquery.ui.widget.js
- * jquery.ui.mouse.js
- */
-(function ($) {
-
- // Detect touch support
- $.support.touch = 'ontouchend' in document;
-
- // Ignore browsers without touch support
- if (!$.support.touch) {
- return;
- }
-
- var mouseProto = $.ui.mouse.prototype,
- _mouseInit = mouseProto._mouseInit,
- touchHandled;
-
- /**
- * Simulate a mouse event based on a corresponding touch event
- * @param {Object} event A touch event
- * @param {String} simulatedType The corresponding mouse event
- */
- function simulateMouseEvent (event, simulatedType) {
-
- // Ignore multi-touch events
- if (event.originalEvent.touches.length > 1) {
- return;
- }
-
- event.preventDefault();
-
- var touch = event.originalEvent.changedTouches[0],
- simulatedEvent = document.createEvent('MouseEvents');
-
- // Initialize the simulated mouse event using the touch event's coordinates
- simulatedEvent.initMouseEvent(
- simulatedType, // type
- true, // bubbles
- true, // cancelable
- window, // view
- 1, // detail
- touch.screenX, // screenX
- touch.screenY, // screenY
- touch.clientX, // clientX
- touch.clientY, // clientY
- false, // ctrlKey
- false, // altKey
- false, // shiftKey
- false, // metaKey
- 0, // button
- null // relatedTarget
- );
-
- // Dispatch the simulated event to the target element
- event.target.dispatchEvent(simulatedEvent);
- }
-
- /**
- * Handle the jQuery UI widget's touchstart events
- * @param {Object} event The widget element's touchstart event
- */
- mouseProto._touchStart = function (event) {
-
- var self = this;
-
- // Ignore the event if another widget is already being handled
- if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) {
- return;
- }
-
- // Set the flag to prevent other widgets from inheriting the touch event
- touchHandled = true;
-
- // Track movement to determine if interaction was a click
- self._touchMoved = false;
-
- // Simulate the mouseover event
- simulateMouseEvent(event, 'mouseover');
-
- // Simulate the mousemove event
- simulateMouseEvent(event, 'mousemove');
-
- // Simulate the mousedown event
- simulateMouseEvent(event, 'mousedown');
- };
-
- /**
- * Handle the jQuery UI widget's touchmove events
- * @param {Object} event The document's touchmove event
- */
- mouseProto._touchMove = function (event) {
-
- // Ignore event if not handled
- if (!touchHandled) {
- return;
- }
-
- // Interaction was not a click
- this._touchMoved = true;
-
- // Simulate the mousemove event
- simulateMouseEvent(event, 'mousemove');
- };
-
- /**
- * Handle the jQuery UI widget's touchend events
- * @param {Object} event The document's touchend event
- */
- mouseProto._touchEnd = function (event) {
-
- // Ignore event if not handled
- if (!touchHandled) {
- return;
- }
-
- // Simulate the mouseup event
- simulateMouseEvent(event, 'mouseup');
-
- // Simulate the mouseout event
- simulateMouseEvent(event, 'mouseout');
-
- // If the touch interaction did not move, it should trigger a click
- if (!this._touchMoved) {
-
- // Simulate the click event
- simulateMouseEvent(event, 'click');
- }
-
- // Unset the flag to allow other widgets to inherit the touch event
- touchHandled = false;
- };
-
- /**
- * A duck punch of the $.ui.mouse _mouseInit method to support touch events.
- * This method extends the widget with bound touch event handlers that
- * translate touch events to mouse events and pass them to the widget's
- * original mouse event handling methods.
- */
- mouseProto._mouseInit = function () {
-
- var self = this,
- parentObject = self.element.parent(),
- objectSelector = '#' + self.element.attr( 'id' );
-
- // Fallback if no id is set
- if( objectSelector === '#' ){
- objectSelector = '.' + self.element.attr( 'class' ).replace(/\s/g, '.');
- }
-
- // Undelegate the global touch events in
- parentObject.undelegate( objectSelector, 'touchstart' );
- parentObject.undelegate( objectSelector, 'touchmove' );
- parentObject.undelegate( objectSelector, 'touchend' );
-
- // Delegate the touch handlers to the widget's element
- parentObject.delegate( objectSelector, 'touchstart', $.proxy( self, '_touchStart' ) );
- parentObject.delegate( objectSelector, 'touchmove', $.proxy( self, '_touchMove' ) );
- parentObject.delegate( objectSelector, 'touchend', $.proxy( self, '_touchEnd' ) );
-
- // Call the original $.ui.mouse init method
- _mouseInit.call(self);
- };
-
-})(jQuery);
View
164 jquery.ui.touch-punch.1.7.2.js
@@ -1,164 +0,0 @@
-/*!
- * jQuery UI Touch Punch 0.2.2
- *
- * Copyright 2011, Dave Furfero
- * Dual licensed under the MIT or GPL Version 2 licenses.
- *
- * Depends:
- * jquery.ui.widget.js
- * jquery.ui.mouse.js
- */
-(function ($) {
-
- // Detect touch support
- $.support.touch = 'ontouchend' in document;
-
- // Ignore browsers without touch support
- if (!$.support.touch) {
- return;
- }
-
- var mouseProto = $.ui.mouse.prototype,
- _mouseInit = mouseProto._mouseInit,
- touchHandled;
-
- /**
- * Simulate a mouse event based on a corresponding touch event
- * @param {Object} event A touch event
- * @param {String} simulatedType The corresponding mouse event
- */
- function simulateMouseEvent (event, simulatedType) {
-
- // Ignore multi-touch events
- if (event.originalEvent.touches.length > 1) {
- return;
- }
-
- event.preventDefault();
-
- var touch = event.originalEvent.changedTouches[0],
- simulatedEvent = document.createEvent('MouseEvents');
-
- // Initialize the simulated mouse event using the touch event's coordinates
- simulatedEvent.initMouseEvent(
- simulatedType, // type
- true, // bubbles
- true, // cancelable
- window, // view
- 1, // detail
- touch.screenX, // screenX
- touch.screenY, // screenY
- touch.clientX, // clientX
- touch.clientY, // clientY
- false, // ctrlKey
- false, // altKey
- false, // shiftKey
- false, // metaKey
- 0, // button
- null // relatedTarget
- );
-
- // Dispatch the simulated event to the target element
- event.target.dispatchEvent(simulatedEvent);
- }
-
- /**
- * Handle the jQuery UI widget's touchstart events
- * @param {Object} event The widget element's touchstart event
- */
- mouseProto._touchStart = function (event) {
-
- var self = this;
-
- // Ignore the event if another widget is already being handled
- if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) {
- return;
- }
-
- // Set the flag to prevent other widgets from inheriting the touch event
- touchHandled = true;
-
- // Track movement to determine if interaction was a click
- self._touchMoved = false;
-
- // Simulate the mouseover event
- simulateMouseEvent(event, 'mouseover');
-
- // Simulate the mousemove event
- simulateMouseEvent(event, 'mousemove');
-
- // Simulate the mousedown event
- simulateMouseEvent(event, 'mousedown');
- };
-
- /**
- * Handle the jQuery UI widget's touchmove events
- * @param {Object} event The document's touchmove event
- */
- mouseProto._touchMove = function (event) {
-
- // Ignore event if not handled
- if (!touchHandled) {
- return;
- }
-
- // Interaction was not a click
- this._touchMoved = true;
-
- // Simulate the mousemove event
- simulateMouseEvent(event, 'mousemove');
- };
-
- /**
- * Handle the jQuery UI widget's touchend events
- * @param {Object} event The document's touchend event
- */
- mouseProto._touchEnd = function (event) {
-
- // Ignore event if not handled
- if (!touchHandled) {
- return;
- }
-
- // Simulate the mouseup event
- simulateMouseEvent(event, 'mouseup');
-
- // Simulate the mouseout event
- simulateMouseEvent(event, 'mouseout');
-
- // If the touch interaction did not move, it should trigger a click
- if (!this._touchMoved) {
-
- // Simulate the click event
- simulateMouseEvent(event, 'click');
- }
-
- // Unset the flag to allow other widgets to inherit the touch event
- touchHandled = false;
- };
-
- /**
- * A duck punch of the $.ui.mouse _mouseInit method to support touch events.
- * This method extends the widget with bound touch event handlers that
- * translate touch events to mouse events and pass them to the widget's
- * original mouse event handling methods.
- */
- mouseProto._mouseInit = function () {
-
- var self = this;
-
- // Undelegate the global touch events in
- self.element.off( 'touchstart' );
- self.element.off( 'touchmove' );
- self.element.off( 'touchend' );
-
- // Delegate the touch handlers to the widget's element
- self.element.on( 'touchstart', $.proxy( self, '_touchStart' ) );
- self.element.on( 'touchmove', $.proxy( self, '_touchMove' ) );
- self.element.on( 'touchend', $.proxy( self, '_touchEnd' ) );
-
- // Call the original $.ui.mouse init method
- _mouseInit.call(self);
- };
-
-})(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.