forked from tapquo/Lungo.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLungo.Fallback.js
62 lines (51 loc) · 1.92 KB
/
Lungo.Fallback.js
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* ?
*
* @namespace LUNGO
* @class Fallback
*
* @author Javier Jimenez Villar <[email protected]> || @soyjavi
*/
LUNGO.Fallback = (function(lng, undefined) {
var CLASS = lng.Constants.CLASS;
var androidButtons = function() {
environment = lng.Core.environment();
if (environment.isMobile && environment.os.name === 'android') {
lng.dom(document.body).on('touchstart', '.button', _addClassActiveToButton);
lng.dom(document.body).on('touchend', '.button', _removeClassActiveToButton);
}
};
var androidInputs = function(article_id, active) {
environment = lng.Core.environment();
if (environment.isMobile && environment.os.name === 'android' && environment.os.version < '4') {
var selector = article_id + ' input, ' + article_id + ' textarea, ' + article_id + ' select';
var input_elements = lng.dom(selector);
for (var i = 0, len = input_elements.length; i < len; i++) {
(active) ? _enableAndroidInput(input_elements[i]) : _disableAndroidInput(input_elements[i]);
}
}
};
var positionFixed = function(sections) {
environment = lng.Core.environment();
if (environment.isMobile && environment.os.name === 'ios' && environment.os.version >= '4.2') {
sections.style('position', 'fixed');
}
};
var _enableAndroidInput = function(input) {
input.removeAttribute('disabled');
};
var _disableAndroidInput = function(input) {
input.setAttribute('disabled', 'disabled');
};
var _addClassActiveToButton = function(element) {
lng.dom(this).addClass(CLASS.ACTIVE);
};
var _removeClassActiveToButton = function(element) {
lng.dom(this).removeClass(CLASS.ACTIVE);
};
return {
androidButtons: androidButtons,
androidInputs: androidInputs,
positionFixed: positionFixed
}
})(LUNGO);