Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorJan Wroniszewski <jan@industreal.pl>2016-07-12 08:26:07 +0300
committerMatthieu Aubry <mattab@users.noreply.github.com>2016-07-12 08:26:07 +0300
commit713806da44a4bb4e9c6d3779188c83d78c8eb9b5 (patch)
tree10f12736010b145b48dc5795f594af53e39528b5 /libs
parent60ee58b4c3295f2e86c1463355e99cb874006a32 (diff)
installing touch-punch lib to fix dragging issue on mobiles (#10045)
Diffstat (limited to 'libs')
-rw-r--r--libs/bower_components/jqueryui-touch-punch/.bower.json19
-rw-r--r--libs/bower_components/jqueryui-touch-punch/README.md41
-rw-r--r--libs/bower_components/jqueryui-touch-punch/bower.json10
-rw-r--r--libs/bower_components/jqueryui-touch-punch/jquery.ui.touch-punch.js180
-rw-r--r--libs/bower_components/jqueryui-touch-punch/jquery.ui.touch-punch.min.js11
5 files changed, 261 insertions, 0 deletions
diff --git a/libs/bower_components/jqueryui-touch-punch/.bower.json b/libs/bower_components/jqueryui-touch-punch/.bower.json
new file mode 100644
index 0000000000..d003eeb236
--- /dev/null
+++ b/libs/bower_components/jqueryui-touch-punch/.bower.json
@@ -0,0 +1,19 @@
+{
+ "name": "jqueryui-touch-punch",
+ "main": "jquery.ui.touch-punch.min.js",
+ "ignore": [],
+ "dependencies": {
+ "jquery": ">=1.6",
+ "jquery-ui": ">=1.8"
+ },
+ "homepage": "https://github.com/furf/jquery-ui-touch-punch",
+ "_release": "4bc0091452",
+ "_resolution": {
+ "type": "branch",
+ "branch": "master",
+ "commit": "4bc009145202d9c7483ba85f3a236a8f3470354d"
+ },
+ "_source": "https://github.com/furf/jquery-ui-touch-punch.git",
+ "_target": "master",
+ "_originalSource": "jqueryui-touch-punch"
+} \ No newline at end of file
diff --git a/libs/bower_components/jqueryui-touch-punch/README.md b/libs/bower_components/jqueryui-touch-punch/README.md
new file mode 100644
index 0000000000..cff7baad70
--- /dev/null
+++ b/libs/bower_components/jqueryui-touch-punch/README.md
@@ -0,0 +1,41 @@
+# jQuery UI Touch Punch
+## Touch Event Support for jQuery UI
+
+> **jQuery UI Touch Punch is a small hack that enables the use of touch events on sites using the jQuery UI user interface library.**
+
+_[Visit the official Touch Punch website](http://touchpunch.furf.com)._
+
+Currently, [jQuery UI](http://jqueryui.com/) user interface library does not support the use of touch events in their widgets and interactions. This means that the slick UI you designed and tested in your desktop browser will fail on most, if not all, touch-enabled mobile devices, because jQuery UI listens to mouse events—mouseover, mousemove and mouseout—not touch events—touchstart, touchmove and touchend.
+
+That's where jQuery UI Touch Punch comes in. Touch Punch works by using [simulated events](https://developer.mozilla.org/en/DOM/document.createEvent) to map [touch events](http://www.html5rocks.com/en/mobile/touch/) to their mouse event analogs. Simply include the script on your page and your touch events will be turned into their corresponding mouse events to which jQuery UI will respond as expected.
+
+As I said, Touch Punch is a hack. It [duck punches](http://en.wikipedia.org/wiki/Monkey_patch) some of jQuery UI's core functionality to handle the mapping of touch events. Touch Punch works with all basic implementations of jQuery UI's interactions and widgets. However, you may find more complex cases where Touch Punch fails. If so, scroll down to learn how you can file and/or fix issues.
+
+This code is dual licensed under the MIT or GPL Version 2 licenses and is therefore free to use, modify and/or distribute, but if you include Touch Punch in other software packages or plugins, please include an attribution to the original software and a link to [this Touch Punch website](http://touchpunch.furf.com/).
+
+## Using Touch Punch is as easy as 1, 2…
+
+Just follow these simple steps to enable touch events in your jQuery UI app:
+
+1. Include jQuery and jQuery UI on your page.
+
+ ```html
+ <script src="http://code.jquery.com/jquery.min.js"></script>
+ <script src="http://code.jquery.com/ui/1.8.17/jquery-ui.min.js"></script>
+ ```
+
+2. Include Touch Punch after jQuery UI and before its first use.
+
+ Please note that if you are using jQuery UI's components, Touch Punch must be included after jquery.ui.mouse.js, as Touch Punch modifies its behavior.
+
+ ```html
+ <script src="jquery.ui.touch-punch.min.js"></script>
+ ```
+
+3. There is no 3. Just use jQuery UI as expected and watch it work at the touch of a finger.
+
+ ```html
+ <script>$('#widget').draggable();</script>
+ ```
+
+_Tested on iPad, iPhone, Android and other touch-enabled mobile devices._
diff --git a/libs/bower_components/jqueryui-touch-punch/bower.json b/libs/bower_components/jqueryui-touch-punch/bower.json
new file mode 100644
index 0000000000..ffc6b89f9a
--- /dev/null
+++ b/libs/bower_components/jqueryui-touch-punch/bower.json
@@ -0,0 +1,10 @@
+{
+ "name": "jqueryui-touch-punch",
+ "version": "0.2.3",
+ "main": "jquery.ui.touch-punch.min.js",
+ "ignore": [],
+ "dependencies": {
+ "jquery": ">=1.6",
+ "jquery-ui": ">=1.8"
+ }
+}
diff --git a/libs/bower_components/jqueryui-touch-punch/jquery.ui.touch-punch.js b/libs/bower_components/jqueryui-touch-punch/jquery.ui.touch-punch.js
new file mode 100644
index 0000000000..16ce41d1ed
--- /dev/null
+++ b/libs/bower_components/jqueryui-touch-punch/jquery.ui.touch-punch.js
@@ -0,0 +1,180 @@
+/*!
+ * jQuery UI Touch Punch 0.2.3
+ *
+ * Copyright 2011–2014, 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,
+ _mouseDestroy = mouseProto._mouseDestroy,
+ 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;
+
+ // Delegate the touch handlers to the widget's element
+ self.element.bind({
+ touchstart: $.proxy(self, '_touchStart'),
+ touchmove: $.proxy(self, '_touchMove'),
+ touchend: $.proxy(self, '_touchEnd')
+ });
+
+ // Call the original $.ui.mouse init method
+ _mouseInit.call(self);
+ };
+
+ /**
+ * Remove the touch event handlers
+ */
+ mouseProto._mouseDestroy = function () {
+
+ var self = this;
+
+ // Delegate the touch handlers to the widget's element
+ self.element.unbind({
+ touchstart: $.proxy(self, '_touchStart'),
+ touchmove: $.proxy(self, '_touchMove'),
+ touchend: $.proxy(self, '_touchEnd')
+ });
+
+ // Call the original $.ui.mouse destroy method
+ _mouseDestroy.call(self);
+ };
+
+})(jQuery); \ No newline at end of file
diff --git a/libs/bower_components/jqueryui-touch-punch/jquery.ui.touch-punch.min.js b/libs/bower_components/jqueryui-touch-punch/jquery.ui.touch-punch.min.js
new file mode 100644
index 0000000000..31272ce6fd
--- /dev/null
+++ b/libs/bower_components/jqueryui-touch-punch/jquery.ui.touch-punch.min.js
@@ -0,0 +1,11 @@
+/*!
+ * jQuery UI Touch Punch 0.2.3
+ *
+ * Copyright 2011–2014, Dave Furfero
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ *
+ * Depends:
+ * jquery.ui.widget.js
+ * jquery.ui.mouse.js
+ */
+!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery); \ No newline at end of file