summaryrefslogtreecommitdiff
path: root/www/lib/angular-touch/angular-touch.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/lib/angular-touch/angular-touch.js')
-rw-r--r--www/lib/angular-touch/angular-touch.js129
1 files changed, 115 insertions, 14 deletions
diff --git a/www/lib/angular-touch/angular-touch.js b/www/lib/angular-touch/angular-touch.js
index cfb90b04..7df41e56 100644
--- a/www/lib/angular-touch/angular-touch.js
+++ b/www/lib/angular-touch/angular-touch.js
@@ -1,10 +1,13 @@
/**
- * @license AngularJS v1.4.6
- * (c) 2010-2015 Google, Inc. http://angularjs.org
+ * @license AngularJS v1.5.3
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {'use strict';
+/* global ngTouchClickDirectiveFactory: false,
+ */
+
/**
* @ngdoc module
* @name ngTouch
@@ -27,10 +30,108 @@
/* global -ngTouch */
var ngTouch = angular.module('ngTouch', []);
+ngTouch.provider('$touch', $TouchProvider);
+
function nodeName_(element) {
return angular.lowercase(element.nodeName || (element[0] && element[0].nodeName));
}
+/**
+ * @ngdoc provider
+ * @name $touchProvider
+ *
+ * @description
+ * The `$touchProvider` allows enabling / disabling {@link ngTouch.ngClick ngTouch's ngClick directive}.
+ */
+$TouchProvider.$inject = ['$provide', '$compileProvider'];
+function $TouchProvider($provide, $compileProvider) {
+
+ /**
+ * @ngdoc method
+ * @name $touchProvider#ngClickOverrideEnabled
+ *
+ * @param {boolean=} enabled update the ngClickOverrideEnabled state if provided, otherwise just return the
+ * current ngClickOverrideEnabled state
+ * @returns {*} current value if used as getter or itself (chaining) if used as setter
+ *
+ * @kind function
+ *
+ * @description
+ * Call this method to enable/disable {@link ngTouch.ngClick ngTouch's ngClick directive}. If enabled,
+ * the default ngClick directive will be replaced by a version that eliminates the 300ms delay for
+ * click events on browser for touch-devices.
+ *
+ * The default is `false`.
+ *
+ */
+ var ngClickOverrideEnabled = false;
+ var ngClickDirectiveAdded = false;
+ this.ngClickOverrideEnabled = function(enabled) {
+ if (angular.isDefined(enabled)) {
+
+ if (enabled && !ngClickDirectiveAdded) {
+ ngClickDirectiveAdded = true;
+
+ // Use this to identify the correct directive in the delegate
+ ngTouchClickDirectiveFactory.$$moduleName = 'ngTouch';
+ $compileProvider.directive('ngClick', ngTouchClickDirectiveFactory);
+
+ $provide.decorator('ngClickDirective', ['$delegate', function($delegate) {
+ if (ngClickOverrideEnabled) {
+ // drop the default ngClick directive
+ $delegate.shift();
+ } else {
+ // drop the ngTouch ngClick directive if the override has been re-disabled (because
+ // we cannot de-register added directives)
+ var i = $delegate.length - 1;
+ while (i >= 0) {
+ if ($delegate[i].$$moduleName === 'ngTouch') {
+ $delegate.splice(i, 1);
+ break;
+ }
+ i--;
+ }
+ }
+
+ return $delegate;
+ }]);
+ }
+
+ ngClickOverrideEnabled = enabled;
+ return this;
+ }
+
+ return ngClickOverrideEnabled;
+ };
+
+ /**
+ * @ngdoc service
+ * @name $touch
+ * @kind object
+ *
+ * @description
+ * Provides the {@link ngTouch.$touch#ngClickOverrideEnabled `ngClickOverrideEnabled`} method.
+ *
+ */
+ this.$get = function() {
+ return {
+ /**
+ * @ngdoc method
+ * @name $touch#ngClickOverrideEnabled
+ *
+ * @returns {*} current value of `ngClickOverrideEnabled` set in the {@link ngTouch.$touchProvider $touchProvider},
+ * i.e. if {@link ngTouch.ngClick ngTouch's ngClick} directive is enabled.
+ *
+ * @kind function
+ */
+ ngClickOverrideEnabled: function() {
+ return ngClickOverrideEnabled;
+ }
+ };
+ };
+
+}
+
/* global ngTouch: false */
/**
@@ -43,8 +144,7 @@ function nodeName_(element) {
*
* Requires the {@link ngTouch `ngTouch`} module to be installed.
*
- * `$swipe` is used by the `ngSwipeLeft` and `ngSwipeRight` directives in `ngTouch`, and by
- * `ngCarousel` in a separate component.
+ * `$swipe` is used by the `ngSwipeLeft` and `ngSwipeRight` directives in `ngTouch`.
*
* # Usage
* The `$swipe` service is an object with a single method: `bind`. `bind` takes an element
@@ -203,8 +303,17 @@ ngTouch.factory('$swipe', [function() {
/**
* @ngdoc directive
* @name ngClick
+ * @deprecated
*
* @description
+ * <div class="alert alert-danger">
+ * **DEPRECATION NOTICE**: Beginning with Angular 1.5, this directive is deprecated and by default **disabled**.
+ * The directive will receive no further support and might be removed from future releases.
+ * If you need the directive, you can enable it with the {@link ngTouch.$touchProvider $touchProvider#ngClickOverrideEnabled}
+ * function. We also recommend that you migrate to [FastClick](https://github.com/ftlabs/fastclick).
+ * To learn more about the 300ms delay, this [Telerik article](http://developer.telerik.com/featured/300-ms-click-delay-ios-8/)
+ * gives a good overview.
+ * </div>
* A more powerful replacement for the default ngClick designed to be used on touchscreen
* devices. Most mobile browsers wait about 300ms after a tap-and-release before sending
* the click event. This version handles them immediately, and then prevents the
@@ -236,15 +345,7 @@ ngTouch.factory('$swipe', [function() {
</example>
*/
-ngTouch.config(['$provide', function($provide) {
- $provide.decorator('ngClickDirective', ['$delegate', function($delegate) {
- // drop the default ngClick directive
- $delegate.shift();
- return $delegate;
- }]);
-}]);
-
-ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement',
+var ngTouchClickDirectiveFactory = ['$parse', '$timeout', '$rootElement',
function($parse, $timeout, $rootElement) {
var TAP_DURATION = 750; // Shorter than 750ms is a tap, longer is a taphold or drag.
var MOVE_TOLERANCE = 12; // 12px seems to work in most mobile browsers.
@@ -488,7 +589,7 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement',
});
};
-}]);
+}];
/* global ngTouch: false */