docs-cambiocds-com-jekyll-theme 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +21 -21
- data/README.md +48 -48
- data/_layouts/default.html +96 -100
- data/assets/css/asciidoctor.css +397 -397
- data/assets/css/coderay.css +89 -89
- data/assets/css/custom.css +32 -0
- data/assets/css/font-awesome.css +1801 -1801
- data/assets/css/font-awesome.min.css +3 -3
- data/assets/css/foundation.css +8545 -8545
- data/assets/css/foundation.min.css +8331 -8331
- data/assets/css/normalize.css +427 -427
- data/assets/js/foundation.min.js +6069 -6069
- data/assets/js/foundation/foundation.abide.js +325 -325
- data/assets/js/foundation/foundation.accordion.js +71 -71
- data/assets/js/foundation/foundation.alert.js +46 -46
- data/assets/js/foundation/foundation.clearing.js +573 -573
- data/assets/js/foundation/foundation.dropdown.js +444 -444
- data/assets/js/foundation/foundation.equalizer.js +77 -77
- data/assets/js/foundation/foundation.interchange.js +349 -349
- data/assets/js/foundation/foundation.joyride.js +939 -939
- data/assets/js/foundation/foundation.js +691 -691
- data/assets/js/foundation/foundation.magellan.js +199 -199
- data/assets/js/foundation/foundation.offcanvas.js +154 -154
- data/assets/js/foundation/foundation.orbit.js +512 -512
- data/assets/js/foundation/foundation.reveal.js +455 -455
- data/assets/js/foundation/foundation.slider.js +268 -268
- data/assets/js/foundation/foundation.tab.js +221 -221
- data/assets/js/foundation/foundation.tooltip.js +301 -301
- data/assets/js/foundation/foundation.topbar.js +444 -444
- data/assets/js/toc.js +82 -82
- data/assets/js/vendor/fastclick.js +169 -169
- data/assets/js/vendor/jquery.cookie.js +57 -57
- data/assets/js/vendor/jquery.js +2339 -2339
- data/assets/js/vendor/modernizr.js +304 -304
- data/assets/js/vendor/placeholder.js +75 -75
- metadata +12 -11
data/assets/js/toc.js
CHANGED
@@ -1,82 +1,82 @@
|
|
1
|
-
// https://github.com/ghiculescu/jekyll-table-of-contents
|
2
|
-
(function($){
|
3
|
-
$.fn.toc = function(options) {
|
4
|
-
var defaults = {
|
5
|
-
noBackToTopLinks: false,
|
6
|
-
title: '<i>Jump to...</i>',
|
7
|
-
minimumHeaders: 3,
|
8
|
-
headers: 'h1, h2, h3, h4, h5, h6',
|
9
|
-
listType: 'ol', // values: [ol|ul]
|
10
|
-
showEffect: 'show', // values: [show|slideDown|fadeIn|none]
|
11
|
-
showSpeed: 'slow' // set to 0 to deactivate effect
|
12
|
-
},
|
13
|
-
settings = $.extend(defaults, options);
|
14
|
-
|
15
|
-
var headers = $(settings.headers).filter(function() {
|
16
|
-
// get all headers with an ID
|
17
|
-
var previousSiblingName = $(this).prev().attr( "name" );
|
18
|
-
if (!this.id && previousSiblingName) {
|
19
|
-
this.id = $(this).attr( "id", previousSiblingName.replace(/\./g, "-") );
|
20
|
-
}
|
21
|
-
return this.id;
|
22
|
-
}), output = $(this);
|
23
|
-
if (!headers.length || headers.length < settings.minimumHeaders || !output.length) {
|
24
|
-
return;
|
25
|
-
}
|
26
|
-
|
27
|
-
if (0 === settings.showSpeed) {
|
28
|
-
settings.showEffect = 'none';
|
29
|
-
}
|
30
|
-
|
31
|
-
var render = {
|
32
|
-
show: function() { output.hide().html(html).show(settings.showSpeed); },
|
33
|
-
slideDown: function() { output.hide().html(html).slideDown(settings.showSpeed); },
|
34
|
-
fadeIn: function() { output.hide().html(html).fadeIn(settings.showSpeed); },
|
35
|
-
none: function() { output.html(html); }
|
36
|
-
};
|
37
|
-
|
38
|
-
var get_level = function(ele) { return parseInt(ele.nodeName.replace("H", ""), 10); }
|
39
|
-
var highest_level = headers.map(function(_, ele) { return get_level(ele); }).get().sort()[0];
|
40
|
-
var return_to_top = '<i class="icon-arrow-up back-to-top"> </i>';
|
41
|
-
|
42
|
-
var level = get_level(headers[0]),
|
43
|
-
this_level,
|
44
|
-
html = settings.title + " <"+settings.listType+">";
|
45
|
-
headers.on('click', function() {
|
46
|
-
if (!settings.noBackToTopLinks) {
|
47
|
-
window.location.hash = this.id;
|
48
|
-
}
|
49
|
-
})
|
50
|
-
.addClass('clickable-header')
|
51
|
-
.each(function(_, header) {
|
52
|
-
this_level = get_level(header);
|
53
|
-
if (!settings.noBackToTopLinks && this_level === highest_level) {
|
54
|
-
$(header).addClass('top-level-header').after(return_to_top);
|
55
|
-
}
|
56
|
-
if (this_level === level) // same level as before; same indenting
|
57
|
-
html += "<li><a href='#" + header.id + "'>" + header.innerHTML + "</a>";
|
58
|
-
else if (this_level <= level){ // higher level than before; end parent ol
|
59
|
-
for(i = this_level; i < level; i++) {
|
60
|
-
html += "</li></"+settings.listType+">"
|
61
|
-
}
|
62
|
-
html += "<li><a href='#" + header.id + "'>" + header.innerHTML + "</a>";
|
63
|
-
}
|
64
|
-
else if (this_level > level) { // lower level than before; expand the previous to contain a ol
|
65
|
-
for(i = this_level; i > level; i--) {
|
66
|
-
html += "<"+settings.listType+"><li>"
|
67
|
-
}
|
68
|
-
html += "<a href='#" + header.id + "'>" + header.innerHTML + "</a>";
|
69
|
-
}
|
70
|
-
level = this_level; // update for the next one
|
71
|
-
});
|
72
|
-
html += "</"+settings.listType+">";
|
73
|
-
if (!settings.noBackToTopLinks) {
|
74
|
-
$(document).on('click', '.back-to-top', function() {
|
75
|
-
$(window).scrollTop(0);
|
76
|
-
window.location.hash = '';
|
77
|
-
});
|
78
|
-
}
|
79
|
-
|
80
|
-
render[settings.showEffect]();
|
81
|
-
};
|
82
|
-
})(jQuery);
|
1
|
+
// https://github.com/ghiculescu/jekyll-table-of-contents
|
2
|
+
(function($){
|
3
|
+
$.fn.toc = function(options) {
|
4
|
+
var defaults = {
|
5
|
+
noBackToTopLinks: false,
|
6
|
+
title: '<i>Jump to...</i>',
|
7
|
+
minimumHeaders: 3,
|
8
|
+
headers: 'h1, h2, h3, h4, h5, h6',
|
9
|
+
listType: 'ol', // values: [ol|ul]
|
10
|
+
showEffect: 'show', // values: [show|slideDown|fadeIn|none]
|
11
|
+
showSpeed: 'slow' // set to 0 to deactivate effect
|
12
|
+
},
|
13
|
+
settings = $.extend(defaults, options);
|
14
|
+
|
15
|
+
var headers = $(settings.headers).filter(function() {
|
16
|
+
// get all headers with an ID
|
17
|
+
var previousSiblingName = $(this).prev().attr( "name" );
|
18
|
+
if (!this.id && previousSiblingName) {
|
19
|
+
this.id = $(this).attr( "id", previousSiblingName.replace(/\./g, "-") );
|
20
|
+
}
|
21
|
+
return this.id;
|
22
|
+
}), output = $(this);
|
23
|
+
if (!headers.length || headers.length < settings.minimumHeaders || !output.length) {
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
|
27
|
+
if (0 === settings.showSpeed) {
|
28
|
+
settings.showEffect = 'none';
|
29
|
+
}
|
30
|
+
|
31
|
+
var render = {
|
32
|
+
show: function() { output.hide().html(html).show(settings.showSpeed); },
|
33
|
+
slideDown: function() { output.hide().html(html).slideDown(settings.showSpeed); },
|
34
|
+
fadeIn: function() { output.hide().html(html).fadeIn(settings.showSpeed); },
|
35
|
+
none: function() { output.html(html); }
|
36
|
+
};
|
37
|
+
|
38
|
+
var get_level = function(ele) { return parseInt(ele.nodeName.replace("H", ""), 10); }
|
39
|
+
var highest_level = headers.map(function(_, ele) { return get_level(ele); }).get().sort()[0];
|
40
|
+
var return_to_top = '<i class="icon-arrow-up back-to-top"> </i>';
|
41
|
+
|
42
|
+
var level = get_level(headers[0]),
|
43
|
+
this_level,
|
44
|
+
html = settings.title + " <"+settings.listType+">";
|
45
|
+
headers.on('click', function() {
|
46
|
+
if (!settings.noBackToTopLinks) {
|
47
|
+
window.location.hash = this.id;
|
48
|
+
}
|
49
|
+
})
|
50
|
+
.addClass('clickable-header')
|
51
|
+
.each(function(_, header) {
|
52
|
+
this_level = get_level(header);
|
53
|
+
if (!settings.noBackToTopLinks && this_level === highest_level) {
|
54
|
+
$(header).addClass('top-level-header').after(return_to_top);
|
55
|
+
}
|
56
|
+
if (this_level === level) // same level as before; same indenting
|
57
|
+
html += "<li><a href='#" + header.id + "'>" + header.innerHTML + "</a>";
|
58
|
+
else if (this_level <= level){ // higher level than before; end parent ol
|
59
|
+
for(i = this_level; i < level; i++) {
|
60
|
+
html += "</li></"+settings.listType+">"
|
61
|
+
}
|
62
|
+
html += "<li><a href='#" + header.id + "'>" + header.innerHTML + "</a>";
|
63
|
+
}
|
64
|
+
else if (this_level > level) { // lower level than before; expand the previous to contain a ol
|
65
|
+
for(i = this_level; i > level; i--) {
|
66
|
+
html += "<"+settings.listType+"><li>"
|
67
|
+
}
|
68
|
+
html += "<a href='#" + header.id + "'>" + header.innerHTML + "</a>";
|
69
|
+
}
|
70
|
+
level = this_level; // update for the next one
|
71
|
+
});
|
72
|
+
html += "</"+settings.listType+">";
|
73
|
+
if (!settings.noBackToTopLinks) {
|
74
|
+
$(document).on('click', '.back-to-top', function() {
|
75
|
+
$(window).scrollTop(0);
|
76
|
+
window.location.hash = '';
|
77
|
+
});
|
78
|
+
}
|
79
|
+
|
80
|
+
render[settings.showEffect]();
|
81
|
+
};
|
82
|
+
})(jQuery);
|
@@ -1,169 +1,169 @@
|
|
1
|
-
/**
|
2
|
-
* @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
|
3
|
-
*
|
4
|
-
* @version 1.0.3
|
5
|
-
* @codingstandard ftlabs-jsv2
|
6
|
-
* @copyright The Financial Times Limited [All Rights Reserved]
|
7
|
-
* @license MIT License (see LICENSE.txt)
|
8
|
-
*/
|
9
|
-
function FastClick(a, b) {
|
10
|
-
"use strict";
|
11
|
-
function c(a, b) {
|
12
|
-
return function () {
|
13
|
-
return a.apply(b, arguments)
|
14
|
-
}
|
15
|
-
}
|
16
|
-
|
17
|
-
var d;
|
18
|
-
if (b = b || {}, this.trackingClick = !1, this.trackingClickStart = 0, this.targetElement = null, this.touchStartX = 0, this.touchStartY = 0, this.lastTouchIdentifier = 0, this.touchBoundary = b.touchBoundary || 10, this.layer = a, this.tapDelay = b.tapDelay || 200, !FastClick.notNeeded(a)) {
|
19
|
-
for (var e = ["onMouse", "onClick", "onTouchStart", "onTouchMove", "onTouchEnd", "onTouchCancel"], f = this, g = 0, h = e.length; h > g; g++)f[e[g]] = c(f[e[g]], f);
|
20
|
-
deviceIsAndroid && (a.addEventListener("mouseover", this.onMouse, !0), a.addEventListener("mousedown", this.onMouse, !0), a.addEventListener("mouseup", this.onMouse, !0)), a.addEventListener("click", this.onClick, !0), a.addEventListener("touchstart", this.onTouchStart, !1), a.addEventListener("touchmove", this.onTouchMove, !1), a.addEventListener("touchend", this.onTouchEnd, !1), a.addEventListener("touchcancel", this.onTouchCancel, !1), Event.prototype.stopImmediatePropagation || (a.removeEventListener = function (b, c, d) {
|
21
|
-
var e = Node.prototype.removeEventListener;
|
22
|
-
"click" === b ? e.call(a, b, c.hijacked || c, d) : e.call(a, b, c, d)
|
23
|
-
}, a.addEventListener = function (b, c, d) {
|
24
|
-
var e = Node.prototype.addEventListener;
|
25
|
-
"click" === b ? e.call(a, b, c.hijacked || (c.hijacked = function (a) {
|
26
|
-
a.propagationStopped || c(a)
|
27
|
-
}), d) : e.call(a, b, c, d)
|
28
|
-
}), "function" == typeof a.onclick && (d = a.onclick, a.addEventListener("click", function (a) {
|
29
|
-
d(a)
|
30
|
-
}, !1), a.onclick = null)
|
31
|
-
}
|
32
|
-
}
|
33
|
-
var deviceIsAndroid = navigator.userAgent.indexOf("Android") > 0, deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent), deviceIsIOS4 = deviceIsIOS && /OS 4_\d(_\d)?/.test(navigator.userAgent), deviceIsIOSWithBadTarget = deviceIsIOS && /OS ([6-9]|\d{2})_\d/.test(navigator.userAgent), deviceIsBlackBerry10 = navigator.userAgent.indexOf("BB10") > 0;
|
34
|
-
FastClick.prototype.needsClick = function (a) {
|
35
|
-
"use strict";
|
36
|
-
switch (a.nodeName.toLowerCase()) {
|
37
|
-
case"button":
|
38
|
-
case"select":
|
39
|
-
case"textarea":
|
40
|
-
if (a.disabled)return !0;
|
41
|
-
break;
|
42
|
-
case"input":
|
43
|
-
if (deviceIsIOS && "file" === a.type || a.disabled)return !0;
|
44
|
-
break;
|
45
|
-
case"label":
|
46
|
-
case"video":
|
47
|
-
return !0
|
48
|
-
}
|
49
|
-
return /\bneedsclick\b/.test(a.className)
|
50
|
-
}, FastClick.prototype.needsFocus = function (a) {
|
51
|
-
"use strict";
|
52
|
-
switch (a.nodeName.toLowerCase()) {
|
53
|
-
case"textarea":
|
54
|
-
return !0;
|
55
|
-
case"select":
|
56
|
-
return !deviceIsAndroid;
|
57
|
-
case"input":
|
58
|
-
switch (a.type) {
|
59
|
-
case"button":
|
60
|
-
case"checkbox":
|
61
|
-
case"file":
|
62
|
-
case"image":
|
63
|
-
case"radio":
|
64
|
-
case"submit":
|
65
|
-
return !1
|
66
|
-
}
|
67
|
-
return !a.disabled && !a.readOnly;
|
68
|
-
default:
|
69
|
-
return /\bneedsfocus\b/.test(a.className)
|
70
|
-
}
|
71
|
-
}, FastClick.prototype.sendClick = function (a, b) {
|
72
|
-
"use strict";
|
73
|
-
var c, d;
|
74
|
-
document.activeElement && document.activeElement !== a && document.activeElement.blur(), d = b.changedTouches[0], c = document.createEvent("MouseEvents"), c.initMouseEvent(this.determineEventType(a), !0, !0, window, 1, d.screenX, d.screenY, d.clientX, d.clientY, !1, !1, !1, !1, 0, null), c.forwardedTouchEvent = !0, a.dispatchEvent(c)
|
75
|
-
}, FastClick.prototype.determineEventType = function (a) {
|
76
|
-
"use strict";
|
77
|
-
return deviceIsAndroid && "select" === a.tagName.toLowerCase() ? "mousedown" : "click"
|
78
|
-
}, FastClick.prototype.focus = function (a) {
|
79
|
-
"use strict";
|
80
|
-
var b;
|
81
|
-
deviceIsIOS && a.setSelectionRange && 0 !== a.type.indexOf("date") && "time" !== a.type ? (b = a.value.length, a.setSelectionRange(b, b)) : a.focus()
|
82
|
-
}, FastClick.prototype.updateScrollParent = function (a) {
|
83
|
-
"use strict";
|
84
|
-
var b, c;
|
85
|
-
if (b = a.fastClickScrollParent, !b || !b.contains(a)) {
|
86
|
-
c = a;
|
87
|
-
do {
|
88
|
-
if (c.scrollHeight > c.offsetHeight) {
|
89
|
-
b = c, a.fastClickScrollParent = c;
|
90
|
-
break
|
91
|
-
}
|
92
|
-
c = c.parentElement
|
93
|
-
} while (c)
|
94
|
-
}
|
95
|
-
b && (b.fastClickLastScrollTop = b.scrollTop)
|
96
|
-
}, FastClick.prototype.getTargetElementFromEventTarget = function (a) {
|
97
|
-
"use strict";
|
98
|
-
return a.nodeType === Node.TEXT_NODE ? a.parentNode : a
|
99
|
-
}, FastClick.prototype.onTouchStart = function (a) {
|
100
|
-
"use strict";
|
101
|
-
var b, c, d;
|
102
|
-
if (a.targetTouches.length > 1)return !0;
|
103
|
-
if (b = this.getTargetElementFromEventTarget(a.target), c = a.targetTouches[0], deviceIsIOS) {
|
104
|
-
if (d = window.getSelection(), d.rangeCount && !d.isCollapsed)return !0;
|
105
|
-
if (!deviceIsIOS4) {
|
106
|
-
if (c.identifier && c.identifier === this.lastTouchIdentifier)return a.preventDefault(), !1;
|
107
|
-
this.lastTouchIdentifier = c.identifier, this.updateScrollParent(b)
|
108
|
-
}
|
109
|
-
}
|
110
|
-
return this.trackingClick = !0, this.trackingClickStart = a.timeStamp, this.targetElement = b, this.touchStartX = c.pageX, this.touchStartY = c.pageY, a.timeStamp - this.lastClickTime < this.tapDelay && a.preventDefault(), !0
|
111
|
-
}, FastClick.prototype.touchHasMoved = function (a) {
|
112
|
-
"use strict";
|
113
|
-
var b = a.changedTouches[0], c = this.touchBoundary;
|
114
|
-
return Math.abs(b.pageX - this.touchStartX) > c || Math.abs(b.pageY - this.touchStartY) > c ? !0 : !1
|
115
|
-
}, FastClick.prototype.onTouchMove = function (a) {
|
116
|
-
"use strict";
|
117
|
-
return this.trackingClick ? ((this.targetElement !== this.getTargetElementFromEventTarget(a.target) || this.touchHasMoved(a)) && (this.trackingClick = !1, this.targetElement = null), !0) : !0
|
118
|
-
}, FastClick.prototype.findControl = function (a) {
|
119
|
-
"use strict";
|
120
|
-
return void 0 !== a.control ? a.control : a.htmlFor ? document.getElementById(a.htmlFor) : a.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")
|
121
|
-
}, FastClick.prototype.onTouchEnd = function (a) {
|
122
|
-
"use strict";
|
123
|
-
var b, c, d, e, f, g = this.targetElement;
|
124
|
-
if (!this.trackingClick)return !0;
|
125
|
-
if (a.timeStamp - this.lastClickTime < this.tapDelay)return this.cancelNextClick = !0, !0;
|
126
|
-
if (this.cancelNextClick = !1, this.lastClickTime = a.timeStamp, c = this.trackingClickStart, this.trackingClick = !1, this.trackingClickStart = 0, deviceIsIOSWithBadTarget && (f = a.changedTouches[0], g = document.elementFromPoint(f.pageX - window.pageXOffset, f.pageY - window.pageYOffset) || g, g.fastClickScrollParent = this.targetElement.fastClickScrollParent), d = g.tagName.toLowerCase(), "label" === d) {
|
127
|
-
if (b = this.findControl(g)) {
|
128
|
-
if (this.focus(g), deviceIsAndroid)return !1;
|
129
|
-
g = b
|
130
|
-
}
|
131
|
-
} else if (this.needsFocus(g))return a.timeStamp - c > 100 || deviceIsIOS && window.top !== window && "input" === d ? (this.targetElement = null, !1) : (this.focus(g), this.sendClick(g, a), deviceIsIOS && "select" === d || (this.targetElement = null, a.preventDefault()), !1);
|
132
|
-
return deviceIsIOS && !deviceIsIOS4 && (e = g.fastClickScrollParent, e && e.fastClickLastScrollTop !== e.scrollTop) ? !0 : (this.needsClick(g) || (a.preventDefault(), this.sendClick(g, a)), !1)
|
133
|
-
}, FastClick.prototype.onTouchCancel = function () {
|
134
|
-
"use strict";
|
135
|
-
this.trackingClick = !1, this.targetElement = null
|
136
|
-
}, FastClick.prototype.onMouse = function (a) {
|
137
|
-
"use strict";
|
138
|
-
return this.targetElement ? a.forwardedTouchEvent ? !0 : a.cancelable && (!this.needsClick(this.targetElement) || this.cancelNextClick) ? (a.stopImmediatePropagation ? a.stopImmediatePropagation() : a.propagationStopped = !0, a.stopPropagation(), a.preventDefault(), !1) : !0 : !0
|
139
|
-
}, FastClick.prototype.onClick = function (a) {
|
140
|
-
"use strict";
|
141
|
-
var b;
|
142
|
-
return this.trackingClick ? (this.targetElement = null, this.trackingClick = !1, !0) : "submit" === a.target.type && 0 === a.detail ? !0 : (b = this.onMouse(a), b || (this.targetElement = null), b)
|
143
|
-
}, FastClick.prototype.destroy = function () {
|
144
|
-
"use strict";
|
145
|
-
var a = this.layer;
|
146
|
-
deviceIsAndroid && (a.removeEventListener("mouseover", this.onMouse, !0), a.removeEventListener("mousedown", this.onMouse, !0), a.removeEventListener("mouseup", this.onMouse, !0)), a.removeEventListener("click", this.onClick, !0), a.removeEventListener("touchstart", this.onTouchStart, !1), a.removeEventListener("touchmove", this.onTouchMove, !1), a.removeEventListener("touchend", this.onTouchEnd, !1), a.removeEventListener("touchcancel", this.onTouchCancel, !1)
|
147
|
-
}, FastClick.notNeeded = function (a) {
|
148
|
-
"use strict";
|
149
|
-
var b, c, d;
|
150
|
-
if ("undefined" == typeof window.ontouchstart)return !0;
|
151
|
-
if (c = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [, 0])[1]) {
|
152
|
-
if (!deviceIsAndroid)return !0;
|
153
|
-
if (b = document.querySelector("meta[name=viewport]")) {
|
154
|
-
if (-1 !== b.content.indexOf("user-scalable=no"))return !0;
|
155
|
-
if (c > 31 && document.documentElement.scrollWidth <= window.outerWidth)return !0
|
156
|
-
}
|
157
|
-
}
|
158
|
-
if (deviceIsBlackBerry10 && (d = navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/), d[1] >= 10 && d[2] >= 3 && (b = document.querySelector("meta[name=viewport]")))) {
|
159
|
-
if (-1 !== b.content.indexOf("user-scalable=no"))return !0;
|
160
|
-
if (document.documentElement.scrollWidth <= window.outerWidth)return !0
|
161
|
-
}
|
162
|
-
return "none" === a.style.msTouchAction ? !0 : !1
|
163
|
-
}, FastClick.attach = function (a, b) {
|
164
|
-
"use strict";
|
165
|
-
return new FastClick(a, b)
|
166
|
-
}, "function" == typeof define && "object" == typeof define.amd && define.amd ? define(function () {
|
167
|
-
"use strict";
|
168
|
-
return FastClick
|
169
|
-
}) : "undefined" != typeof module && module.exports ? (module.exports = FastClick.attach, module.exports.FastClick = FastClick) : window.FastClick = FastClick;
|
1
|
+
/**
|
2
|
+
* @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
|
3
|
+
*
|
4
|
+
* @version 1.0.3
|
5
|
+
* @codingstandard ftlabs-jsv2
|
6
|
+
* @copyright The Financial Times Limited [All Rights Reserved]
|
7
|
+
* @license MIT License (see LICENSE.txt)
|
8
|
+
*/
|
9
|
+
function FastClick(a, b) {
|
10
|
+
"use strict";
|
11
|
+
function c(a, b) {
|
12
|
+
return function () {
|
13
|
+
return a.apply(b, arguments)
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
var d;
|
18
|
+
if (b = b || {}, this.trackingClick = !1, this.trackingClickStart = 0, this.targetElement = null, this.touchStartX = 0, this.touchStartY = 0, this.lastTouchIdentifier = 0, this.touchBoundary = b.touchBoundary || 10, this.layer = a, this.tapDelay = b.tapDelay || 200, !FastClick.notNeeded(a)) {
|
19
|
+
for (var e = ["onMouse", "onClick", "onTouchStart", "onTouchMove", "onTouchEnd", "onTouchCancel"], f = this, g = 0, h = e.length; h > g; g++)f[e[g]] = c(f[e[g]], f);
|
20
|
+
deviceIsAndroid && (a.addEventListener("mouseover", this.onMouse, !0), a.addEventListener("mousedown", this.onMouse, !0), a.addEventListener("mouseup", this.onMouse, !0)), a.addEventListener("click", this.onClick, !0), a.addEventListener("touchstart", this.onTouchStart, !1), a.addEventListener("touchmove", this.onTouchMove, !1), a.addEventListener("touchend", this.onTouchEnd, !1), a.addEventListener("touchcancel", this.onTouchCancel, !1), Event.prototype.stopImmediatePropagation || (a.removeEventListener = function (b, c, d) {
|
21
|
+
var e = Node.prototype.removeEventListener;
|
22
|
+
"click" === b ? e.call(a, b, c.hijacked || c, d) : e.call(a, b, c, d)
|
23
|
+
}, a.addEventListener = function (b, c, d) {
|
24
|
+
var e = Node.prototype.addEventListener;
|
25
|
+
"click" === b ? e.call(a, b, c.hijacked || (c.hijacked = function (a) {
|
26
|
+
a.propagationStopped || c(a)
|
27
|
+
}), d) : e.call(a, b, c, d)
|
28
|
+
}), "function" == typeof a.onclick && (d = a.onclick, a.addEventListener("click", function (a) {
|
29
|
+
d(a)
|
30
|
+
}, !1), a.onclick = null)
|
31
|
+
}
|
32
|
+
}
|
33
|
+
var deviceIsAndroid = navigator.userAgent.indexOf("Android") > 0, deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent), deviceIsIOS4 = deviceIsIOS && /OS 4_\d(_\d)?/.test(navigator.userAgent), deviceIsIOSWithBadTarget = deviceIsIOS && /OS ([6-9]|\d{2})_\d/.test(navigator.userAgent), deviceIsBlackBerry10 = navigator.userAgent.indexOf("BB10") > 0;
|
34
|
+
FastClick.prototype.needsClick = function (a) {
|
35
|
+
"use strict";
|
36
|
+
switch (a.nodeName.toLowerCase()) {
|
37
|
+
case"button":
|
38
|
+
case"select":
|
39
|
+
case"textarea":
|
40
|
+
if (a.disabled)return !0;
|
41
|
+
break;
|
42
|
+
case"input":
|
43
|
+
if (deviceIsIOS && "file" === a.type || a.disabled)return !0;
|
44
|
+
break;
|
45
|
+
case"label":
|
46
|
+
case"video":
|
47
|
+
return !0
|
48
|
+
}
|
49
|
+
return /\bneedsclick\b/.test(a.className)
|
50
|
+
}, FastClick.prototype.needsFocus = function (a) {
|
51
|
+
"use strict";
|
52
|
+
switch (a.nodeName.toLowerCase()) {
|
53
|
+
case"textarea":
|
54
|
+
return !0;
|
55
|
+
case"select":
|
56
|
+
return !deviceIsAndroid;
|
57
|
+
case"input":
|
58
|
+
switch (a.type) {
|
59
|
+
case"button":
|
60
|
+
case"checkbox":
|
61
|
+
case"file":
|
62
|
+
case"image":
|
63
|
+
case"radio":
|
64
|
+
case"submit":
|
65
|
+
return !1
|
66
|
+
}
|
67
|
+
return !a.disabled && !a.readOnly;
|
68
|
+
default:
|
69
|
+
return /\bneedsfocus\b/.test(a.className)
|
70
|
+
}
|
71
|
+
}, FastClick.prototype.sendClick = function (a, b) {
|
72
|
+
"use strict";
|
73
|
+
var c, d;
|
74
|
+
document.activeElement && document.activeElement !== a && document.activeElement.blur(), d = b.changedTouches[0], c = document.createEvent("MouseEvents"), c.initMouseEvent(this.determineEventType(a), !0, !0, window, 1, d.screenX, d.screenY, d.clientX, d.clientY, !1, !1, !1, !1, 0, null), c.forwardedTouchEvent = !0, a.dispatchEvent(c)
|
75
|
+
}, FastClick.prototype.determineEventType = function (a) {
|
76
|
+
"use strict";
|
77
|
+
return deviceIsAndroid && "select" === a.tagName.toLowerCase() ? "mousedown" : "click"
|
78
|
+
}, FastClick.prototype.focus = function (a) {
|
79
|
+
"use strict";
|
80
|
+
var b;
|
81
|
+
deviceIsIOS && a.setSelectionRange && 0 !== a.type.indexOf("date") && "time" !== a.type ? (b = a.value.length, a.setSelectionRange(b, b)) : a.focus()
|
82
|
+
}, FastClick.prototype.updateScrollParent = function (a) {
|
83
|
+
"use strict";
|
84
|
+
var b, c;
|
85
|
+
if (b = a.fastClickScrollParent, !b || !b.contains(a)) {
|
86
|
+
c = a;
|
87
|
+
do {
|
88
|
+
if (c.scrollHeight > c.offsetHeight) {
|
89
|
+
b = c, a.fastClickScrollParent = c;
|
90
|
+
break
|
91
|
+
}
|
92
|
+
c = c.parentElement
|
93
|
+
} while (c)
|
94
|
+
}
|
95
|
+
b && (b.fastClickLastScrollTop = b.scrollTop)
|
96
|
+
}, FastClick.prototype.getTargetElementFromEventTarget = function (a) {
|
97
|
+
"use strict";
|
98
|
+
return a.nodeType === Node.TEXT_NODE ? a.parentNode : a
|
99
|
+
}, FastClick.prototype.onTouchStart = function (a) {
|
100
|
+
"use strict";
|
101
|
+
var b, c, d;
|
102
|
+
if (a.targetTouches.length > 1)return !0;
|
103
|
+
if (b = this.getTargetElementFromEventTarget(a.target), c = a.targetTouches[0], deviceIsIOS) {
|
104
|
+
if (d = window.getSelection(), d.rangeCount && !d.isCollapsed)return !0;
|
105
|
+
if (!deviceIsIOS4) {
|
106
|
+
if (c.identifier && c.identifier === this.lastTouchIdentifier)return a.preventDefault(), !1;
|
107
|
+
this.lastTouchIdentifier = c.identifier, this.updateScrollParent(b)
|
108
|
+
}
|
109
|
+
}
|
110
|
+
return this.trackingClick = !0, this.trackingClickStart = a.timeStamp, this.targetElement = b, this.touchStartX = c.pageX, this.touchStartY = c.pageY, a.timeStamp - this.lastClickTime < this.tapDelay && a.preventDefault(), !0
|
111
|
+
}, FastClick.prototype.touchHasMoved = function (a) {
|
112
|
+
"use strict";
|
113
|
+
var b = a.changedTouches[0], c = this.touchBoundary;
|
114
|
+
return Math.abs(b.pageX - this.touchStartX) > c || Math.abs(b.pageY - this.touchStartY) > c ? !0 : !1
|
115
|
+
}, FastClick.prototype.onTouchMove = function (a) {
|
116
|
+
"use strict";
|
117
|
+
return this.trackingClick ? ((this.targetElement !== this.getTargetElementFromEventTarget(a.target) || this.touchHasMoved(a)) && (this.trackingClick = !1, this.targetElement = null), !0) : !0
|
118
|
+
}, FastClick.prototype.findControl = function (a) {
|
119
|
+
"use strict";
|
120
|
+
return void 0 !== a.control ? a.control : a.htmlFor ? document.getElementById(a.htmlFor) : a.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")
|
121
|
+
}, FastClick.prototype.onTouchEnd = function (a) {
|
122
|
+
"use strict";
|
123
|
+
var b, c, d, e, f, g = this.targetElement;
|
124
|
+
if (!this.trackingClick)return !0;
|
125
|
+
if (a.timeStamp - this.lastClickTime < this.tapDelay)return this.cancelNextClick = !0, !0;
|
126
|
+
if (this.cancelNextClick = !1, this.lastClickTime = a.timeStamp, c = this.trackingClickStart, this.trackingClick = !1, this.trackingClickStart = 0, deviceIsIOSWithBadTarget && (f = a.changedTouches[0], g = document.elementFromPoint(f.pageX - window.pageXOffset, f.pageY - window.pageYOffset) || g, g.fastClickScrollParent = this.targetElement.fastClickScrollParent), d = g.tagName.toLowerCase(), "label" === d) {
|
127
|
+
if (b = this.findControl(g)) {
|
128
|
+
if (this.focus(g), deviceIsAndroid)return !1;
|
129
|
+
g = b
|
130
|
+
}
|
131
|
+
} else if (this.needsFocus(g))return a.timeStamp - c > 100 || deviceIsIOS && window.top !== window && "input" === d ? (this.targetElement = null, !1) : (this.focus(g), this.sendClick(g, a), deviceIsIOS && "select" === d || (this.targetElement = null, a.preventDefault()), !1);
|
132
|
+
return deviceIsIOS && !deviceIsIOS4 && (e = g.fastClickScrollParent, e && e.fastClickLastScrollTop !== e.scrollTop) ? !0 : (this.needsClick(g) || (a.preventDefault(), this.sendClick(g, a)), !1)
|
133
|
+
}, FastClick.prototype.onTouchCancel = function () {
|
134
|
+
"use strict";
|
135
|
+
this.trackingClick = !1, this.targetElement = null
|
136
|
+
}, FastClick.prototype.onMouse = function (a) {
|
137
|
+
"use strict";
|
138
|
+
return this.targetElement ? a.forwardedTouchEvent ? !0 : a.cancelable && (!this.needsClick(this.targetElement) || this.cancelNextClick) ? (a.stopImmediatePropagation ? a.stopImmediatePropagation() : a.propagationStopped = !0, a.stopPropagation(), a.preventDefault(), !1) : !0 : !0
|
139
|
+
}, FastClick.prototype.onClick = function (a) {
|
140
|
+
"use strict";
|
141
|
+
var b;
|
142
|
+
return this.trackingClick ? (this.targetElement = null, this.trackingClick = !1, !0) : "submit" === a.target.type && 0 === a.detail ? !0 : (b = this.onMouse(a), b || (this.targetElement = null), b)
|
143
|
+
}, FastClick.prototype.destroy = function () {
|
144
|
+
"use strict";
|
145
|
+
var a = this.layer;
|
146
|
+
deviceIsAndroid && (a.removeEventListener("mouseover", this.onMouse, !0), a.removeEventListener("mousedown", this.onMouse, !0), a.removeEventListener("mouseup", this.onMouse, !0)), a.removeEventListener("click", this.onClick, !0), a.removeEventListener("touchstart", this.onTouchStart, !1), a.removeEventListener("touchmove", this.onTouchMove, !1), a.removeEventListener("touchend", this.onTouchEnd, !1), a.removeEventListener("touchcancel", this.onTouchCancel, !1)
|
147
|
+
}, FastClick.notNeeded = function (a) {
|
148
|
+
"use strict";
|
149
|
+
var b, c, d;
|
150
|
+
if ("undefined" == typeof window.ontouchstart)return !0;
|
151
|
+
if (c = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [, 0])[1]) {
|
152
|
+
if (!deviceIsAndroid)return !0;
|
153
|
+
if (b = document.querySelector("meta[name=viewport]")) {
|
154
|
+
if (-1 !== b.content.indexOf("user-scalable=no"))return !0;
|
155
|
+
if (c > 31 && document.documentElement.scrollWidth <= window.outerWidth)return !0
|
156
|
+
}
|
157
|
+
}
|
158
|
+
if (deviceIsBlackBerry10 && (d = navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/), d[1] >= 10 && d[2] >= 3 && (b = document.querySelector("meta[name=viewport]")))) {
|
159
|
+
if (-1 !== b.content.indexOf("user-scalable=no"))return !0;
|
160
|
+
if (document.documentElement.scrollWidth <= window.outerWidth)return !0
|
161
|
+
}
|
162
|
+
return "none" === a.style.msTouchAction ? !0 : !1
|
163
|
+
}, FastClick.attach = function (a, b) {
|
164
|
+
"use strict";
|
165
|
+
return new FastClick(a, b)
|
166
|
+
}, "function" == typeof define && "object" == typeof define.amd && define.amd ? define(function () {
|
167
|
+
"use strict";
|
168
|
+
return FastClick
|
169
|
+
}) : "undefined" != typeof module && module.exports ? (module.exports = FastClick.attach, module.exports.FastClick = FastClick) : window.FastClick = FastClick;
|