angularjs-rails 1.5.8 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -1
- data/lib/angularjs-rails/engine.rb +1 -1
- data/lib/angularjs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/angular-animate.js +426 -293
- data/vendor/assets/javascripts/angular-aria.js +64 -43
- data/vendor/assets/javascripts/angular-cookies.js +24 -93
- data/vendor/assets/javascripts/angular-loader.js +190 -36
- data/vendor/assets/javascripts/angular-message-format.js +72 -84
- data/vendor/assets/javascripts/angular-messages.js +158 -68
- data/vendor/assets/javascripts/angular-mocks.js +1033 -402
- data/vendor/assets/javascripts/angular-parse-ext.js +14 -10
- data/vendor/assets/javascripts/angular-resource.js +317 -269
- data/vendor/assets/javascripts/angular-route.js +329 -132
- data/vendor/assets/javascripts/angular-sanitize.js +268 -93
- data/vendor/assets/javascripts/angular-touch.js +46 -413
- data/vendor/assets/javascripts/angular.js +9213 -4485
- metadata +2 -3
- data/vendor/assets/javascripts/angular-scenario.js +0 -44134
@@ -1,135 +1,38 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.
|
3
|
-
* (c) 2010-
|
2
|
+
* @license AngularJS v1.8.0
|
3
|
+
* (c) 2010-2020 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
6
6
|
(function(window, angular) {'use strict';
|
7
7
|
|
8
|
-
/* global ngTouchClickDirectiveFactory: false,
|
9
|
-
*/
|
10
|
-
|
11
8
|
/**
|
12
9
|
* @ngdoc module
|
13
10
|
* @name ngTouch
|
14
11
|
* @description
|
15
12
|
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
* The `ngTouch` module provides touch events and other helpers for touch-enabled devices.
|
13
|
+
* The `ngTouch` module provides helpers for touch-enabled devices.
|
19
14
|
* The implementation is based on jQuery Mobile touch event handling
|
20
|
-
* ([jquerymobile.com](http://jquerymobile.com/)).
|
21
|
-
*
|
15
|
+
* ([jquerymobile.com](http://jquerymobile.com/)). *
|
22
16
|
*
|
23
17
|
* See {@link ngTouch.$swipe `$swipe`} for usage.
|
24
18
|
*
|
25
|
-
*
|
26
|
-
*
|
19
|
+
* @deprecated
|
20
|
+
* sinceVersion="1.7.0"
|
21
|
+
* The ngTouch module with the {@link ngTouch.$swipe `$swipe`} service and
|
22
|
+
* the {@link ngTouch.ngSwipeLeft} and {@link ngTouch.ngSwipeRight} directives are
|
23
|
+
* deprecated. Instead, stand-alone libraries for touch handling and gesture interaction
|
24
|
+
* should be used, for example [HammerJS](https://hammerjs.github.io/) (which is also used by
|
25
|
+
* Angular).
|
27
26
|
*/
|
28
27
|
|
29
28
|
// define ngTouch module
|
30
|
-
/* global
|
29
|
+
/* global ngTouch */
|
31
30
|
var ngTouch = angular.module('ngTouch', []);
|
32
31
|
|
33
|
-
ngTouch.
|
32
|
+
ngTouch.info({ angularVersion: '1.8.0' });
|
34
33
|
|
35
34
|
function nodeName_(element) {
|
36
|
-
return angular
|
37
|
-
}
|
38
|
-
|
39
|
-
/**
|
40
|
-
* @ngdoc provider
|
41
|
-
* @name $touchProvider
|
42
|
-
*
|
43
|
-
* @description
|
44
|
-
* The `$touchProvider` allows enabling / disabling {@link ngTouch.ngClick ngTouch's ngClick directive}.
|
45
|
-
*/
|
46
|
-
$TouchProvider.$inject = ['$provide', '$compileProvider'];
|
47
|
-
function $TouchProvider($provide, $compileProvider) {
|
48
|
-
|
49
|
-
/**
|
50
|
-
* @ngdoc method
|
51
|
-
* @name $touchProvider#ngClickOverrideEnabled
|
52
|
-
*
|
53
|
-
* @param {boolean=} enabled update the ngClickOverrideEnabled state if provided, otherwise just return the
|
54
|
-
* current ngClickOverrideEnabled state
|
55
|
-
* @returns {*} current value if used as getter or itself (chaining) if used as setter
|
56
|
-
*
|
57
|
-
* @kind function
|
58
|
-
*
|
59
|
-
* @description
|
60
|
-
* Call this method to enable/disable {@link ngTouch.ngClick ngTouch's ngClick directive}. If enabled,
|
61
|
-
* the default ngClick directive will be replaced by a version that eliminates the 300ms delay for
|
62
|
-
* click events on browser for touch-devices.
|
63
|
-
*
|
64
|
-
* The default is `false`.
|
65
|
-
*
|
66
|
-
*/
|
67
|
-
var ngClickOverrideEnabled = false;
|
68
|
-
var ngClickDirectiveAdded = false;
|
69
|
-
this.ngClickOverrideEnabled = function(enabled) {
|
70
|
-
if (angular.isDefined(enabled)) {
|
71
|
-
|
72
|
-
if (enabled && !ngClickDirectiveAdded) {
|
73
|
-
ngClickDirectiveAdded = true;
|
74
|
-
|
75
|
-
// Use this to identify the correct directive in the delegate
|
76
|
-
ngTouchClickDirectiveFactory.$$moduleName = 'ngTouch';
|
77
|
-
$compileProvider.directive('ngClick', ngTouchClickDirectiveFactory);
|
78
|
-
|
79
|
-
$provide.decorator('ngClickDirective', ['$delegate', function($delegate) {
|
80
|
-
if (ngClickOverrideEnabled) {
|
81
|
-
// drop the default ngClick directive
|
82
|
-
$delegate.shift();
|
83
|
-
} else {
|
84
|
-
// drop the ngTouch ngClick directive if the override has been re-disabled (because
|
85
|
-
// we cannot de-register added directives)
|
86
|
-
var i = $delegate.length - 1;
|
87
|
-
while (i >= 0) {
|
88
|
-
if ($delegate[i].$$moduleName === 'ngTouch') {
|
89
|
-
$delegate.splice(i, 1);
|
90
|
-
break;
|
91
|
-
}
|
92
|
-
i--;
|
93
|
-
}
|
94
|
-
}
|
95
|
-
|
96
|
-
return $delegate;
|
97
|
-
}]);
|
98
|
-
}
|
99
|
-
|
100
|
-
ngClickOverrideEnabled = enabled;
|
101
|
-
return this;
|
102
|
-
}
|
103
|
-
|
104
|
-
return ngClickOverrideEnabled;
|
105
|
-
};
|
106
|
-
|
107
|
-
/**
|
108
|
-
* @ngdoc service
|
109
|
-
* @name $touch
|
110
|
-
* @kind object
|
111
|
-
*
|
112
|
-
* @description
|
113
|
-
* Provides the {@link ngTouch.$touch#ngClickOverrideEnabled `ngClickOverrideEnabled`} method.
|
114
|
-
*
|
115
|
-
*/
|
116
|
-
this.$get = function() {
|
117
|
-
return {
|
118
|
-
/**
|
119
|
-
* @ngdoc method
|
120
|
-
* @name $touch#ngClickOverrideEnabled
|
121
|
-
*
|
122
|
-
* @returns {*} current value of `ngClickOverrideEnabled` set in the {@link ngTouch.$touchProvider $touchProvider},
|
123
|
-
* i.e. if {@link ngTouch.ngClick ngTouch's ngClick} directive is enabled.
|
124
|
-
*
|
125
|
-
* @kind function
|
126
|
-
*/
|
127
|
-
ngClickOverrideEnabled: function() {
|
128
|
-
return ngClickOverrideEnabled;
|
129
|
-
}
|
130
|
-
};
|
131
|
-
};
|
132
|
-
|
35
|
+
return angular.$$lowercase(element.nodeName || (element[0] && element[0].nodeName));
|
133
36
|
}
|
134
37
|
|
135
38
|
/* global ngTouch: false */
|
@@ -138,6 +41,11 @@ function $TouchProvider($provide, $compileProvider) {
|
|
138
41
|
* @ngdoc service
|
139
42
|
* @name $swipe
|
140
43
|
*
|
44
|
+
* @deprecated
|
45
|
+
* sinceVersion="1.7.0"
|
46
|
+
*
|
47
|
+
* See the {@link ngTouch module} documentation for more information.
|
48
|
+
*
|
141
49
|
* @description
|
142
50
|
* The `$swipe` service is a service that abstracts the messier details of hold-and-drag swipe
|
143
51
|
* behavior, to make implementing swipe-related directives more convenient.
|
@@ -249,13 +157,17 @@ ngTouch.factory('$swipe', [function() {
|
|
249
157
|
totalX = 0;
|
250
158
|
totalY = 0;
|
251
159
|
lastPos = startCoords;
|
252
|
-
|
160
|
+
if (eventHandlers['start']) {
|
161
|
+
eventHandlers['start'](startCoords, event);
|
162
|
+
}
|
253
163
|
});
|
254
164
|
var events = getEvents(pointerTypes, 'cancel');
|
255
165
|
if (events) {
|
256
166
|
element.on(events, function(event) {
|
257
167
|
active = false;
|
258
|
-
|
168
|
+
if (eventHandlers['cancel']) {
|
169
|
+
eventHandlers['cancel'](event);
|
170
|
+
}
|
259
171
|
});
|
260
172
|
}
|
261
173
|
|
@@ -284,325 +196,41 @@ ngTouch.factory('$swipe', [function() {
|
|
284
196
|
if (totalY > totalX) {
|
285
197
|
// Allow native scrolling to take over.
|
286
198
|
active = false;
|
287
|
-
|
199
|
+
if (eventHandlers['cancel']) {
|
200
|
+
eventHandlers['cancel'](event);
|
201
|
+
}
|
288
202
|
return;
|
289
203
|
} else {
|
290
204
|
// Prevent the browser from scrolling.
|
291
205
|
event.preventDefault();
|
292
|
-
|
206
|
+
if (eventHandlers['move']) {
|
207
|
+
eventHandlers['move'](coords, event);
|
208
|
+
}
|
293
209
|
}
|
294
210
|
});
|
295
211
|
|
296
212
|
element.on(getEvents(pointerTypes, 'end'), function(event) {
|
297
213
|
if (!active) return;
|
298
214
|
active = false;
|
299
|
-
|
215
|
+
if (eventHandlers['end']) {
|
216
|
+
eventHandlers['end'](getCoordinates(event), event);
|
217
|
+
}
|
300
218
|
});
|
301
219
|
}
|
302
220
|
};
|
303
221
|
}]);
|
304
222
|
|
305
|
-
/* global ngTouch: false,
|
306
|
-
nodeName_: false
|
307
|
-
*/
|
308
|
-
|
309
|
-
/**
|
310
|
-
* @ngdoc directive
|
311
|
-
* @name ngClick
|
312
|
-
* @deprecated
|
313
|
-
*
|
314
|
-
* @description
|
315
|
-
* <div class="alert alert-danger">
|
316
|
-
* **DEPRECATION NOTICE**: Beginning with Angular 1.5, this directive is deprecated and by default **disabled**.
|
317
|
-
* The directive will receive no further support and might be removed from future releases.
|
318
|
-
* If you need the directive, you can enable it with the {@link ngTouch.$touchProvider $touchProvider#ngClickOverrideEnabled}
|
319
|
-
* function. We also recommend that you migrate to [FastClick](https://github.com/ftlabs/fastclick).
|
320
|
-
* To learn more about the 300ms delay, this [Telerik article](http://developer.telerik.com/featured/300-ms-click-delay-ios-8/)
|
321
|
-
* gives a good overview.
|
322
|
-
* </div>
|
323
|
-
* A more powerful replacement for the default ngClick designed to be used on touchscreen
|
324
|
-
* devices. Most mobile browsers wait about 300ms after a tap-and-release before sending
|
325
|
-
* the click event. This version handles them immediately, and then prevents the
|
326
|
-
* following click event from propagating.
|
327
|
-
*
|
328
|
-
* Requires the {@link ngTouch `ngTouch`} module to be installed.
|
329
|
-
*
|
330
|
-
* This directive can fall back to using an ordinary click event, and so works on desktop
|
331
|
-
* browsers as well as mobile.
|
332
|
-
*
|
333
|
-
* This directive also sets the CSS class `ng-click-active` while the element is being held
|
334
|
-
* down (by a mouse click or touch) so you can restyle the depressed element if you wish.
|
335
|
-
*
|
336
|
-
* @element ANY
|
337
|
-
* @param {expression} ngClick {@link guide/expression Expression} to evaluate
|
338
|
-
* upon tap. (Event object is available as `$event`)
|
339
|
-
*
|
340
|
-
* @example
|
341
|
-
<example module="ngClickExample" deps="angular-touch.js">
|
342
|
-
<file name="index.html">
|
343
|
-
<button ng-click="count = count + 1" ng-init="count=0">
|
344
|
-
Increment
|
345
|
-
</button>
|
346
|
-
count: {{ count }}
|
347
|
-
</file>
|
348
|
-
<file name="script.js">
|
349
|
-
angular.module('ngClickExample', ['ngTouch']);
|
350
|
-
</file>
|
351
|
-
</example>
|
352
|
-
*/
|
353
|
-
|
354
|
-
var ngTouchClickDirectiveFactory = ['$parse', '$timeout', '$rootElement',
|
355
|
-
function($parse, $timeout, $rootElement) {
|
356
|
-
var TAP_DURATION = 750; // Shorter than 750ms is a tap, longer is a taphold or drag.
|
357
|
-
var MOVE_TOLERANCE = 12; // 12px seems to work in most mobile browsers.
|
358
|
-
var PREVENT_DURATION = 2500; // 2.5 seconds maximum from preventGhostClick call to click
|
359
|
-
var CLICKBUSTER_THRESHOLD = 25; // 25 pixels in any dimension is the limit for busting clicks.
|
360
|
-
|
361
|
-
var ACTIVE_CLASS_NAME = 'ng-click-active';
|
362
|
-
var lastPreventedTime;
|
363
|
-
var touchCoordinates;
|
364
|
-
var lastLabelClickCoordinates;
|
365
|
-
|
366
|
-
|
367
|
-
// TAP EVENTS AND GHOST CLICKS
|
368
|
-
//
|
369
|
-
// Why tap events?
|
370
|
-
// Mobile browsers detect a tap, then wait a moment (usually ~300ms) to see if you're
|
371
|
-
// double-tapping, and then fire a click event.
|
372
|
-
//
|
373
|
-
// This delay sucks and makes mobile apps feel unresponsive.
|
374
|
-
// So we detect touchstart, touchcancel and touchend ourselves and determine when
|
375
|
-
// the user has tapped on something.
|
376
|
-
//
|
377
|
-
// What happens when the browser then generates a click event?
|
378
|
-
// The browser, of course, also detects the tap and fires a click after a delay. This results in
|
379
|
-
// tapping/clicking twice. We do "clickbusting" to prevent it.
|
380
|
-
//
|
381
|
-
// How does it work?
|
382
|
-
// We attach global touchstart and click handlers, that run during the capture (early) phase.
|
383
|
-
// So the sequence for a tap is:
|
384
|
-
// - global touchstart: Sets an "allowable region" at the point touched.
|
385
|
-
// - element's touchstart: Starts a touch
|
386
|
-
// (- touchcancel ends the touch, no click follows)
|
387
|
-
// - element's touchend: Determines if the tap is valid (didn't move too far away, didn't hold
|
388
|
-
// too long) and fires the user's tap handler. The touchend also calls preventGhostClick().
|
389
|
-
// - preventGhostClick() removes the allowable region the global touchstart created.
|
390
|
-
// - The browser generates a click event.
|
391
|
-
// - The global click handler catches the click, and checks whether it was in an allowable region.
|
392
|
-
// - If preventGhostClick was called, the region will have been removed, the click is busted.
|
393
|
-
// - If the region is still there, the click proceeds normally. Therefore clicks on links and
|
394
|
-
// other elements without ngTap on them work normally.
|
395
|
-
//
|
396
|
-
// This is an ugly, terrible hack!
|
397
|
-
// Yeah, tell me about it. The alternatives are using the slow click events, or making our users
|
398
|
-
// deal with the ghost clicks, so I consider this the least of evils. Fortunately Angular
|
399
|
-
// encapsulates this ugly logic away from the user.
|
400
|
-
//
|
401
|
-
// Why not just put click handlers on the element?
|
402
|
-
// We do that too, just to be sure. If the tap event caused the DOM to change,
|
403
|
-
// it is possible another element is now in that position. To take account for these possibly
|
404
|
-
// distinct elements, the handlers are global and care only about coordinates.
|
405
|
-
|
406
|
-
// Checks if the coordinates are close enough to be within the region.
|
407
|
-
function hit(x1, y1, x2, y2) {
|
408
|
-
return Math.abs(x1 - x2) < CLICKBUSTER_THRESHOLD && Math.abs(y1 - y2) < CLICKBUSTER_THRESHOLD;
|
409
|
-
}
|
410
|
-
|
411
|
-
// Checks a list of allowable regions against a click location.
|
412
|
-
// Returns true if the click should be allowed.
|
413
|
-
// Splices out the allowable region from the list after it has been used.
|
414
|
-
function checkAllowableRegions(touchCoordinates, x, y) {
|
415
|
-
for (var i = 0; i < touchCoordinates.length; i += 2) {
|
416
|
-
if (hit(touchCoordinates[i], touchCoordinates[i + 1], x, y)) {
|
417
|
-
touchCoordinates.splice(i, i + 2);
|
418
|
-
return true; // allowable region
|
419
|
-
}
|
420
|
-
}
|
421
|
-
return false; // No allowable region; bust it.
|
422
|
-
}
|
423
|
-
|
424
|
-
// Global click handler that prevents the click if it's in a bustable zone and preventGhostClick
|
425
|
-
// was called recently.
|
426
|
-
function onClick(event) {
|
427
|
-
if (Date.now() - lastPreventedTime > PREVENT_DURATION) {
|
428
|
-
return; // Too old.
|
429
|
-
}
|
430
|
-
|
431
|
-
var touches = event.touches && event.touches.length ? event.touches : [event];
|
432
|
-
var x = touches[0].clientX;
|
433
|
-
var y = touches[0].clientY;
|
434
|
-
// Work around desktop Webkit quirk where clicking a label will fire two clicks (on the label
|
435
|
-
// and on the input element). Depending on the exact browser, this second click we don't want
|
436
|
-
// to bust has either (0,0), negative coordinates, or coordinates equal to triggering label
|
437
|
-
// click event
|
438
|
-
if (x < 1 && y < 1) {
|
439
|
-
return; // offscreen
|
440
|
-
}
|
441
|
-
if (lastLabelClickCoordinates &&
|
442
|
-
lastLabelClickCoordinates[0] === x && lastLabelClickCoordinates[1] === y) {
|
443
|
-
return; // input click triggered by label click
|
444
|
-
}
|
445
|
-
// reset label click coordinates on first subsequent click
|
446
|
-
if (lastLabelClickCoordinates) {
|
447
|
-
lastLabelClickCoordinates = null;
|
448
|
-
}
|
449
|
-
// remember label click coordinates to prevent click busting of trigger click event on input
|
450
|
-
if (nodeName_(event.target) === 'label') {
|
451
|
-
lastLabelClickCoordinates = [x, y];
|
452
|
-
}
|
453
|
-
|
454
|
-
// Look for an allowable region containing this click.
|
455
|
-
// If we find one, that means it was created by touchstart and not removed by
|
456
|
-
// preventGhostClick, so we don't bust it.
|
457
|
-
if (checkAllowableRegions(touchCoordinates, x, y)) {
|
458
|
-
return;
|
459
|
-
}
|
460
|
-
|
461
|
-
// If we didn't find an allowable region, bust the click.
|
462
|
-
event.stopPropagation();
|
463
|
-
event.preventDefault();
|
464
|
-
|
465
|
-
// Blur focused form elements
|
466
|
-
event.target && event.target.blur && event.target.blur();
|
467
|
-
}
|
468
|
-
|
469
|
-
|
470
|
-
// Global touchstart handler that creates an allowable region for a click event.
|
471
|
-
// This allowable region can be removed by preventGhostClick if we want to bust it.
|
472
|
-
function onTouchStart(event) {
|
473
|
-
var touches = event.touches && event.touches.length ? event.touches : [event];
|
474
|
-
var x = touches[0].clientX;
|
475
|
-
var y = touches[0].clientY;
|
476
|
-
touchCoordinates.push(x, y);
|
477
|
-
|
478
|
-
$timeout(function() {
|
479
|
-
// Remove the allowable region.
|
480
|
-
for (var i = 0; i < touchCoordinates.length; i += 2) {
|
481
|
-
if (touchCoordinates[i] == x && touchCoordinates[i + 1] == y) {
|
482
|
-
touchCoordinates.splice(i, i + 2);
|
483
|
-
return;
|
484
|
-
}
|
485
|
-
}
|
486
|
-
}, PREVENT_DURATION, false);
|
487
|
-
}
|
488
|
-
|
489
|
-
// On the first call, attaches some event handlers. Then whenever it gets called, it creates a
|
490
|
-
// zone around the touchstart where clicks will get busted.
|
491
|
-
function preventGhostClick(x, y) {
|
492
|
-
if (!touchCoordinates) {
|
493
|
-
$rootElement[0].addEventListener('click', onClick, true);
|
494
|
-
$rootElement[0].addEventListener('touchstart', onTouchStart, true);
|
495
|
-
touchCoordinates = [];
|
496
|
-
}
|
497
|
-
|
498
|
-
lastPreventedTime = Date.now();
|
499
|
-
|
500
|
-
checkAllowableRegions(touchCoordinates, x, y);
|
501
|
-
}
|
502
|
-
|
503
|
-
// Actual linking function.
|
504
|
-
return function(scope, element, attr) {
|
505
|
-
var clickHandler = $parse(attr.ngClick),
|
506
|
-
tapping = false,
|
507
|
-
tapElement, // Used to blur the element after a tap.
|
508
|
-
startTime, // Used to check if the tap was held too long.
|
509
|
-
touchStartX,
|
510
|
-
touchStartY;
|
511
|
-
|
512
|
-
function resetState() {
|
513
|
-
tapping = false;
|
514
|
-
element.removeClass(ACTIVE_CLASS_NAME);
|
515
|
-
}
|
516
|
-
|
517
|
-
element.on('touchstart', function(event) {
|
518
|
-
tapping = true;
|
519
|
-
tapElement = event.target ? event.target : event.srcElement; // IE uses srcElement.
|
520
|
-
// Hack for Safari, which can target text nodes instead of containers.
|
521
|
-
if (tapElement.nodeType == 3) {
|
522
|
-
tapElement = tapElement.parentNode;
|
523
|
-
}
|
524
|
-
|
525
|
-
element.addClass(ACTIVE_CLASS_NAME);
|
526
|
-
|
527
|
-
startTime = Date.now();
|
528
|
-
|
529
|
-
// Use jQuery originalEvent
|
530
|
-
var originalEvent = event.originalEvent || event;
|
531
|
-
var touches = originalEvent.touches && originalEvent.touches.length ? originalEvent.touches : [originalEvent];
|
532
|
-
var e = touches[0];
|
533
|
-
touchStartX = e.clientX;
|
534
|
-
touchStartY = e.clientY;
|
535
|
-
});
|
536
|
-
|
537
|
-
element.on('touchcancel', function(event) {
|
538
|
-
resetState();
|
539
|
-
});
|
540
|
-
|
541
|
-
element.on('touchend', function(event) {
|
542
|
-
var diff = Date.now() - startTime;
|
543
|
-
|
544
|
-
// Use jQuery originalEvent
|
545
|
-
var originalEvent = event.originalEvent || event;
|
546
|
-
var touches = (originalEvent.changedTouches && originalEvent.changedTouches.length) ?
|
547
|
-
originalEvent.changedTouches :
|
548
|
-
((originalEvent.touches && originalEvent.touches.length) ? originalEvent.touches : [originalEvent]);
|
549
|
-
var e = touches[0];
|
550
|
-
var x = e.clientX;
|
551
|
-
var y = e.clientY;
|
552
|
-
var dist = Math.sqrt(Math.pow(x - touchStartX, 2) + Math.pow(y - touchStartY, 2));
|
553
|
-
|
554
|
-
if (tapping && diff < TAP_DURATION && dist < MOVE_TOLERANCE) {
|
555
|
-
// Call preventGhostClick so the clickbuster will catch the corresponding click.
|
556
|
-
preventGhostClick(x, y);
|
557
|
-
|
558
|
-
// Blur the focused element (the button, probably) before firing the callback.
|
559
|
-
// This doesn't work perfectly on Android Chrome, but seems to work elsewhere.
|
560
|
-
// I couldn't get anything to work reliably on Android Chrome.
|
561
|
-
if (tapElement) {
|
562
|
-
tapElement.blur();
|
563
|
-
}
|
564
|
-
|
565
|
-
if (!angular.isDefined(attr.disabled) || attr.disabled === false) {
|
566
|
-
element.triggerHandler('click', [event]);
|
567
|
-
}
|
568
|
-
}
|
569
|
-
|
570
|
-
resetState();
|
571
|
-
});
|
572
|
-
|
573
|
-
// Hack for iOS Safari's benefit. It goes searching for onclick handlers and is liable to click
|
574
|
-
// something else nearby.
|
575
|
-
element.onclick = function(event) { };
|
576
|
-
|
577
|
-
// Actual click handler.
|
578
|
-
// There are three different kinds of clicks, only two of which reach this point.
|
579
|
-
// - On desktop browsers without touch events, their clicks will always come here.
|
580
|
-
// - On mobile browsers, the simulated "fast" click will call this.
|
581
|
-
// - But the browser's follow-up slow click will be "busted" before it reaches this handler.
|
582
|
-
// Therefore it's safe to use this directive on both mobile and desktop.
|
583
|
-
element.on('click', function(event, touchend) {
|
584
|
-
scope.$apply(function() {
|
585
|
-
clickHandler(scope, {$event: (touchend || event)});
|
586
|
-
});
|
587
|
-
});
|
588
|
-
|
589
|
-
element.on('mousedown', function(event) {
|
590
|
-
element.addClass(ACTIVE_CLASS_NAME);
|
591
|
-
});
|
592
|
-
|
593
|
-
element.on('mousemove mouseup', function(event) {
|
594
|
-
element.removeClass(ACTIVE_CLASS_NAME);
|
595
|
-
});
|
596
|
-
|
597
|
-
};
|
598
|
-
}];
|
599
|
-
|
600
223
|
/* global ngTouch: false */
|
601
224
|
|
602
225
|
/**
|
603
226
|
* @ngdoc directive
|
604
227
|
* @name ngSwipeLeft
|
605
228
|
*
|
229
|
+
* @deprecated
|
230
|
+
* sinceVersion="1.7.0"
|
231
|
+
*
|
232
|
+
* See the {@link ngTouch module} documentation for more information.
|
233
|
+
*
|
606
234
|
* @description
|
607
235
|
* Specify custom behavior when an element is swiped to the left on a touchscreen device.
|
608
236
|
* A leftward swipe is a quick, right-to-left slide of the finger.
|
@@ -619,7 +247,7 @@ var ngTouchClickDirectiveFactory = ['$parse', '$timeout', '$rootElement',
|
|
619
247
|
* upon left swipe. (Event object is available as `$event`)
|
620
248
|
*
|
621
249
|
* @example
|
622
|
-
<example module="ngSwipeLeftExample" deps="angular-touch.js">
|
250
|
+
<example module="ngSwipeLeftExample" deps="angular-touch.js" name="ng-swipe-left">
|
623
251
|
<file name="index.html">
|
624
252
|
<div ng-show="!showActions" ng-swipe-left="showActions = true">
|
625
253
|
Some list content, like an email in the inbox
|
@@ -639,6 +267,11 @@ var ngTouchClickDirectiveFactory = ['$parse', '$timeout', '$rootElement',
|
|
639
267
|
* @ngdoc directive
|
640
268
|
* @name ngSwipeRight
|
641
269
|
*
|
270
|
+
* @deprecated
|
271
|
+
* sinceVersion="1.7.0"
|
272
|
+
*
|
273
|
+
* See the {@link ngTouch module} documentation for more information.
|
274
|
+
*
|
642
275
|
* @description
|
643
276
|
* Specify custom behavior when an element is swiped to the right on a touchscreen device.
|
644
277
|
* A rightward swipe is a quick, left-to-right slide of the finger.
|
@@ -652,7 +285,7 @@ var ngTouchClickDirectiveFactory = ['$parse', '$timeout', '$rootElement',
|
|
652
285
|
* upon right swipe. (Event object is available as `$event`)
|
653
286
|
*
|
654
287
|
* @example
|
655
|
-
<example module="ngSwipeRightExample" deps="angular-touch.js">
|
288
|
+
<example module="ngSwipeRightExample" deps="angular-touch.js" name="ng-swipe-right">
|
656
289
|
<file name="index.html">
|
657
290
|
<div ng-show="!showActions" ng-swipe-left="showActions = true">
|
658
291
|
Some list content, like an email in the inbox
|