-
Notifications
You must be signed in to change notification settings - Fork 702
Expand file tree
/
Copy pathfastclick.js
More file actions
46 lines (35 loc) · 1.1 KB
/
fastclick.js
File metadata and controls
46 lines (35 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
if (typeof FastClick === 'undefined') {
throw new Error('mobile-angular-ui\'s JavaScript requires FastClick')
}
(function(FastClick) {
'use strict';
var module = angular.module('mobile-angular-ui.core.fastclick', []);
module.run(['$window', function($window) {
// Temporarly bugfix in overthrow/fastclick:
var orgHandler = FastClick.prototype.onTouchEnd;
// Some old versions of Android don't have Function.prototype.bind
function bind(method, context) {
return function() {
return method.apply(context, arguments);
};
}
FastClick.prototype.onTouchEnd = function(event) {
if (!event.changedTouches) {
event.changedTouches = [{}];
}
orgHandler = bind(orgHandler, this);
orgHandler(event);
};
FastClick.attach($window.document.body);
}]);
angular.forEach(['select', 'input', 'textarea'], function(directiveName) {
module.directive(directiveName, function() {
return {
restrict: 'E',
compile: function(elem) {
elem.addClass('needsclick');
}
};
});
});
})(FastClick);