zurb-foundation 4.0.4 → 4.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +26 -2
- data/CONTRIBUTING.md +0 -8
- data/Gemfile.lock +2 -2
- data/docs/_sidebar-components.html.erb +1 -0
- data/docs/_sidebar.html.erb +1 -0
- data/docs/changelog.html.erb +29 -1
- data/docs/components/block-grid.html.erb +11 -2
- data/docs/components/clearing.html.erb +1 -1
- data/docs/components/custom-forms.html.erb +14 -13
- data/docs/components/dropdown.html.erb +1 -1
- data/docs/components/flex-video.html.erb +1 -1
- data/docs/components/grid.html.erb +2 -2
- data/docs/components/joyride.html.erb +1 -1
- data/docs/components/magellan.html.erb +1 -1
- data/docs/components/orbit.html.erb +5 -1
- data/docs/components/pricing-tables.html.erb +3 -3
- data/docs/components/progress-bars.html.erb +1 -0
- data/docs/components/reveal.html.erb +5 -1
- data/docs/components/section.html.erb +66 -4
- data/docs/components/split-buttons.html.erb +11 -11
- data/docs/components/tooltips.html.erb +1 -1
- data/docs/components/top-bar.html.erb +4 -2
- data/docs/components/type.html.erb +7 -1
- data/docs/components/visibility.html.erb +17 -11
- data/docs/javascript.html.erb +1 -1
- data/docs/layout.html.erb +3 -3
- data/docs/media-queries.html.erb +96 -0
- data/docs/sass.html.erb +82 -2
- data/foundation.gemspec +1 -1
- data/js/foundation/foundation.forms.js +6 -14
- data/js/foundation/foundation.joyride.js +12 -10
- data/js/foundation/foundation.orbit.js +2 -0
- data/js/foundation/foundation.section.js +61 -4
- data/js/foundation/foundation.topbar.js +9 -2
- data/js/vendor/zepto.js +415 -313
- data/lib/foundation/version.rb +1 -1
- data/scss/foundation/_foundation-global.scss +4 -0
- data/scss/foundation/components/_block-grid.scss +4 -4
- data/scss/foundation/components/_button-groups.scss +4 -4
- data/scss/foundation/components/_buttons.scss +2 -1
- data/scss/foundation/components/_custom-forms.scss +1 -1
- data/scss/foundation/components/_forms.scss +3 -4
- data/scss/foundation/components/_global.scss +11 -8
- data/scss/foundation/components/_magellan.scss +7 -2
- data/scss/foundation/components/_orbit.scss +6 -3
- data/scss/foundation/components/_progress-bars.scss +6 -4
- data/scss/foundation/components/_section.scss +48 -1
- data/scss/foundation/components/_top-bar.scss +15 -14
- data/scss/foundation/components/_type.scss +3 -3
- data/scss/foundation/components/_visibility.scss +259 -55
- data/templates/project/scss/_settings.scss +7 -0
- metadata +6 -6
- data/docs/_zurb-jobs.html.erb +0 -5
@@ -334,6 +334,7 @@
|
|
334
334
|
|
335
335
|
set_next_tip : function () {
|
336
336
|
this.settings.$next_tip = $(".joyride-tip-guide[data-index='" + this.settings.$li.index() + "']");
|
337
|
+
this.settings.$next_tip.data('closed', '');
|
337
338
|
},
|
338
339
|
|
339
340
|
set_target : function () {
|
@@ -485,9 +486,7 @@
|
|
485
486
|
}
|
486
487
|
|
487
488
|
} else if (this.settings.$li.length) {
|
488
|
-
|
489
489
|
this.pos_modal($nub);
|
490
|
-
|
491
490
|
}
|
492
491
|
|
493
492
|
if (toggle) {
|
@@ -499,15 +498,16 @@
|
|
499
498
|
pos_modal : function ($nub) {
|
500
499
|
this.center();
|
501
500
|
$nub.hide();
|
501
|
+
if (!this.settings.$next_tip.data('closed')) {
|
502
|
+
if ($('.joyride-modal-bg').length < 1) {
|
503
|
+
$('body').append('<div class="joyride-modal-bg">').show();
|
504
|
+
}
|
502
505
|
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
$('.joyride-modal-bg').show();
|
509
|
-
} else {
|
510
|
-
$('.joyride-modal-bg').fadeIn(this.settings.tipAnimationFadeSpeed);
|
506
|
+
if (/pop/i.test(this.settings.tipAnimation)) {
|
507
|
+
$('.joyride-modal-bg').show();
|
508
|
+
} else {
|
509
|
+
$('.joyride-modal-bg').fadeIn(this.settings.tipAnimationFadeSpeed);
|
510
|
+
}
|
511
511
|
}
|
512
512
|
},
|
513
513
|
|
@@ -590,6 +590,8 @@
|
|
590
590
|
clearTimeout(this.settings.automate);
|
591
591
|
}
|
592
592
|
|
593
|
+
this.settings.$next_tip.data('closed', true);
|
594
|
+
|
593
595
|
$('.joyride-modal-bg').hide();
|
594
596
|
this.settings.$current_tip.hide();
|
595
597
|
this.settings.postStepCallback(this.settings.$li.index(), this.settings.$current_tip);
|
@@ -177,6 +177,7 @@
|
|
177
177
|
}
|
178
178
|
})
|
179
179
|
.on('touchstart.fndtn.orbit', function(e) {
|
180
|
+
if (!e.touches) { e = e.originalEvent; }
|
180
181
|
var data = {
|
181
182
|
start_page_x: e.touches[0].pageX,
|
182
183
|
start_page_y: e.touches[0].pageY,
|
@@ -188,6 +189,7 @@
|
|
188
189
|
e.stopPropagation();
|
189
190
|
})
|
190
191
|
.on('touchmove.fndtn.orbit', function(e) {
|
192
|
+
if (!e.touches) { e = e.originalEvent; }
|
191
193
|
// Ignore pinch/zoom events
|
192
194
|
if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
|
193
195
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Foundation.libs.section = {
|
7
7
|
name: 'section',
|
8
8
|
|
9
|
-
version : '4.0.
|
9
|
+
version : '4.0.5',
|
10
10
|
|
11
11
|
settings : {
|
12
12
|
deep_linking: false,
|
@@ -43,6 +43,19 @@
|
|
43
43
|
self.resize.call(this);
|
44
44
|
}, 30)).trigger('resize');
|
45
45
|
|
46
|
+
$('[data-section] .content').on('click.fndtn.section', function (e) {
|
47
|
+
e.stopPropagation();
|
48
|
+
});
|
49
|
+
|
50
|
+
$('*, html, body').on('click.fndtn.section', function (e) {
|
51
|
+
if ($(e.target).closest('.title').length < 1) {
|
52
|
+
$('[data-section].vertical-nav, [data-section].horizontal-nav')
|
53
|
+
.find('section, .section')
|
54
|
+
.removeClass('active')
|
55
|
+
.attr('style', '');
|
56
|
+
}
|
57
|
+
});
|
58
|
+
|
46
59
|
this.settings.init = true;
|
47
60
|
},
|
48
61
|
|
@@ -60,6 +73,7 @@
|
|
60
73
|
if (section.hasClass('active')) {
|
61
74
|
if (self.small(parent)
|
62
75
|
|| self.is_vertical(parent)
|
76
|
+
|| self.is_horizontal(parent)
|
63
77
|
|| self.is_accordion(parent)) {
|
64
78
|
section
|
65
79
|
.removeClass('active')
|
@@ -73,9 +87,14 @@
|
|
73
87
|
.removeClass('active')
|
74
88
|
.attr('style', '');
|
75
89
|
|
76
|
-
section.css('padding-top', self.outerHeight(section.find('.title'))
|
90
|
+
section.css('padding-top', self.outerHeight(section.find('.title')));
|
77
91
|
}
|
78
92
|
|
93
|
+
$('[data-section].vertical-nav, [data-section].horizontal-nav')
|
94
|
+
.find('section, .section')
|
95
|
+
.removeClass('active')
|
96
|
+
.attr('style', '');
|
97
|
+
|
79
98
|
if (self.small(parent)) {
|
80
99
|
section.attr('style', '');
|
81
100
|
}
|
@@ -100,6 +119,7 @@
|
|
100
119
|
.attr('style', '');
|
101
120
|
} else if (active_section.length < 1
|
102
121
|
&& !self.is_vertical($this)
|
122
|
+
&& !self.is_horizontal($this)
|
103
123
|
&& !self.is_accordion($this)) {
|
104
124
|
var first = $this.find('section, .section').first();
|
105
125
|
first.addClass('active');
|
@@ -107,16 +127,22 @@
|
|
107
127
|
if (self.small($this)) {
|
108
128
|
first.attr('style', '');
|
109
129
|
} else {
|
110
|
-
first.css('padding-top', self.outerHeight(first.find('.title'))
|
130
|
+
first.css('padding-top', self.outerHeight(first.find('.title')));
|
111
131
|
}
|
112
132
|
}
|
113
133
|
|
114
134
|
if (self.small($this)) {
|
115
135
|
active_section.attr('style', '');
|
116
136
|
} else {
|
117
|
-
active_section.css('padding-top', self.outerHeight(active_section.find('.title'))
|
137
|
+
active_section.css('padding-top', self.outerHeight(active_section.find('.title')));
|
118
138
|
}
|
119
139
|
self.position_titles($this);
|
140
|
+
|
141
|
+
if (self.is_horizontal($this) && !self.small($this)) {
|
142
|
+
self.position_content($this);
|
143
|
+
} else {
|
144
|
+
self.position_content($this, false);
|
145
|
+
}
|
120
146
|
});
|
121
147
|
},
|
122
148
|
|
@@ -124,6 +150,10 @@
|
|
124
150
|
return el.hasClass('vertical-nav');
|
125
151
|
},
|
126
152
|
|
153
|
+
is_horizontal : function (el) {
|
154
|
+
return el.hasClass('horizontal-nav');
|
155
|
+
},
|
156
|
+
|
127
157
|
is_accordion : function (el) {
|
128
158
|
return el.hasClass('accordion');
|
129
159
|
},
|
@@ -153,6 +183,7 @@
|
|
153
183
|
|
154
184
|
if (typeof off === 'boolean') {
|
155
185
|
titles.attr('style', '');
|
186
|
+
|
156
187
|
} else {
|
157
188
|
titles.each(function () {
|
158
189
|
$(this).css('left', previous_width);
|
@@ -161,6 +192,32 @@
|
|
161
192
|
}
|
162
193
|
},
|
163
194
|
|
195
|
+
position_content : function (section, off) {
|
196
|
+
var titles = section.find('.title'),
|
197
|
+
content = section.find('.content'),
|
198
|
+
self = this;
|
199
|
+
|
200
|
+
if (typeof off === 'boolean') {
|
201
|
+
content.attr('style', '');
|
202
|
+
section.attr('style', '');
|
203
|
+
} else {
|
204
|
+
section.find('section, .section').each(function () {
|
205
|
+
var title = $(this).find('.title'),
|
206
|
+
content = $(this).find('.content');
|
207
|
+
|
208
|
+
content.css({left: title.position().left - 1, top: self.outerHeight(title) - 2});
|
209
|
+
});
|
210
|
+
|
211
|
+
// temporary work around for Zepto outerheight calculation issues.
|
212
|
+
if (typeof Zepto === 'function') {
|
213
|
+
section.height(this.outerHeight(titles.first()));
|
214
|
+
} else {
|
215
|
+
section.height(this.outerHeight(titles.first()) - 2);
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
},
|
220
|
+
|
164
221
|
small : function (el) {
|
165
222
|
if (el && this.is_accordion(el)) {
|
166
223
|
return true;
|
@@ -11,7 +11,8 @@
|
|
11
11
|
settings : {
|
12
12
|
index : 0,
|
13
13
|
stickyClass : 'sticky',
|
14
|
-
|
14
|
+
custom_back_text: true,
|
15
|
+
back_text: 'Back',
|
15
16
|
init : false
|
16
17
|
},
|
17
18
|
|
@@ -150,8 +151,14 @@
|
|
150
151
|
this.settings.$section.find('.has-dropdown>a').each(function () {
|
151
152
|
var $link = $(this),
|
152
153
|
$dropdown = $link.siblings('.dropdown'),
|
153
|
-
$titleLi = $('<li class="title back js-generated"><h5><a href="#"
|
154
|
+
$titleLi = $('<li class="title back js-generated"><h5><a href="#"></a></h5></li>');
|
155
|
+
|
154
156
|
// Copy link to subnav
|
157
|
+
if (self.settings.custom_back_text == true) {
|
158
|
+
$titleLi.find('h5>a').html('« ' + self.settings.back_text);
|
159
|
+
} else {
|
160
|
+
$titleLi.find('h5>a').html('« ' + $link.html());
|
161
|
+
}
|
155
162
|
$dropdown.prepend($titleLi);
|
156
163
|
});
|
157
164
|
|
data/js/vendor/zepto.js
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
// Zepto.js may be freely distributed under the MIT license.
|
1
|
+
/* Zepto v1.0-1-ga3cab6c - polyfill zepto detect event ajax form fx - zeptojs.com/license */
|
2
|
+
|
4
3
|
|
5
4
|
;(function(undefined){
|
6
5
|
if (String.prototype.trim === undefined) // fix for iOS 3.2
|
7
|
-
String.prototype.trim = function(){ return this.replace(/^\s
|
6
|
+
String.prototype.trim = function(){ return this.replace(/^\s+|\s+$/g, '') }
|
8
7
|
|
9
8
|
// For iOS 3.x
|
10
9
|
// from https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/reduce
|
@@ -33,7 +32,7 @@
|
|
33
32
|
return accumulator
|
34
33
|
}
|
35
34
|
|
36
|
-
})()
|
35
|
+
})()
|
37
36
|
|
38
37
|
var Zepto = (function() {
|
39
38
|
var undefined, key, $, classList, emptyArray = [], slice = emptyArray.slice, filter = emptyArray.filter,
|
@@ -61,7 +60,8 @@ var Zepto = (function() {
|
|
61
60
|
classSelectorRE = /^\.([\w-]+)$/,
|
62
61
|
idSelectorRE = /^#([\w-]*)$/,
|
63
62
|
tagSelectorRE = /^[\w-]+$/,
|
64
|
-
|
63
|
+
class2type = {},
|
64
|
+
toString = class2type.toString,
|
65
65
|
zepto = {},
|
66
66
|
camelize, uniq,
|
67
67
|
tempParent = document.createElement('div')
|
@@ -79,10 +79,17 @@ var Zepto = (function() {
|
|
79
79
|
return match
|
80
80
|
}
|
81
81
|
|
82
|
-
function
|
83
|
-
|
84
|
-
|
85
|
-
|
82
|
+
function type(obj) {
|
83
|
+
return obj == null ? String(obj) :
|
84
|
+
class2type[toString.call(obj)] || "object"
|
85
|
+
}
|
86
|
+
|
87
|
+
function isFunction(value) { return type(value) == "function" }
|
88
|
+
function isWindow(obj) { return obj != null && obj == obj.window }
|
89
|
+
function isDocument(obj) { return obj != null && obj.nodeType == obj.DOCUMENT_NODE }
|
90
|
+
function isObject(obj) { return type(obj) == "object" }
|
91
|
+
function isPlainObject(obj) {
|
92
|
+
return isObject(obj) && !isWindow(obj) && obj.__proto__ == Object.prototype
|
86
93
|
}
|
87
94
|
function isArray(value) { return value instanceof Array }
|
88
95
|
function likeArray(obj) { return typeof obj.length == 'number' }
|
@@ -158,7 +165,7 @@ var Zepto = (function() {
|
|
158
165
|
// Explorer. This method can be overriden in plugins.
|
159
166
|
zepto.Z = function(dom, selector) {
|
160
167
|
dom = dom || []
|
161
|
-
dom.__proto__ =
|
168
|
+
dom.__proto__ = $.fn
|
162
169
|
dom.selector = selector || ''
|
163
170
|
return dom
|
164
171
|
}
|
@@ -210,8 +217,11 @@ var Zepto = (function() {
|
|
210
217
|
|
211
218
|
function extend(target, source, deep) {
|
212
219
|
for (key in source)
|
213
|
-
if (deep && isPlainObject(source[key])) {
|
214
|
-
if (
|
220
|
+
if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {
|
221
|
+
if (isPlainObject(source[key]) && !isPlainObject(target[key]))
|
222
|
+
target[key] = {}
|
223
|
+
if (isArray(source[key]) && !isArray(target[key]))
|
224
|
+
target[key] = []
|
215
225
|
extend(target[key], source[key], deep)
|
216
226
|
}
|
217
227
|
else if (source[key] !== undefined) target[key] = source[key]
|
@@ -234,7 +244,7 @@ var Zepto = (function() {
|
|
234
244
|
// This method can be overriden in plugins.
|
235
245
|
zepto.qsa = function(element, selector){
|
236
246
|
var found
|
237
|
-
return (element
|
247
|
+
return (isDocument(element) && idSelectorRE.test(selector)) ?
|
238
248
|
( (found = element.getElementById(RegExp.$1)) ? [found] : [] ) :
|
239
249
|
(element.nodeType !== 1 && element.nodeType !== 9) ? [] :
|
240
250
|
slice.call(
|
@@ -292,11 +302,18 @@ var Zepto = (function() {
|
|
292
302
|
}
|
293
303
|
}
|
294
304
|
|
305
|
+
$.type = type
|
295
306
|
$.isFunction = isFunction
|
296
|
-
$.
|
307
|
+
$.isWindow = isWindow
|
297
308
|
$.isArray = isArray
|
298
309
|
$.isPlainObject = isPlainObject
|
299
310
|
|
311
|
+
$.isEmptyObject = function(obj) {
|
312
|
+
var name
|
313
|
+
for (name in obj) return false
|
314
|
+
return true
|
315
|
+
}
|
316
|
+
|
300
317
|
$.inArray = function(elem, array, i){
|
301
318
|
return emptyArray.indexOf.call(array, elem, i)
|
302
319
|
}
|
@@ -343,6 +360,11 @@ var Zepto = (function() {
|
|
343
360
|
|
344
361
|
if (window.JSON) $.parseJSON = JSON.parse
|
345
362
|
|
363
|
+
// Populate the class2type map
|
364
|
+
$.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
|
365
|
+
class2type[ "[object " + name + "]" ] = name.toLowerCase()
|
366
|
+
})
|
367
|
+
|
346
368
|
// Define methods that will be available on all
|
347
369
|
// Zepto collections
|
348
370
|
$.fn = {
|
@@ -434,22 +456,30 @@ var Zepto = (function() {
|
|
434
456
|
return el && !isObject(el) ? el : $(el)
|
435
457
|
},
|
436
458
|
find: function(selector){
|
437
|
-
var result
|
438
|
-
if (
|
459
|
+
var result, $this = this
|
460
|
+
if (typeof selector == 'object')
|
461
|
+
result = $(selector).filter(function(){
|
462
|
+
var node = this
|
463
|
+
return emptyArray.some.call($this, function(parent){
|
464
|
+
return $.contains(parent, node)
|
465
|
+
})
|
466
|
+
})
|
467
|
+
else if (this.length == 1) result = $(zepto.qsa(this[0], selector))
|
439
468
|
else result = this.map(function(){ return zepto.qsa(this, selector) })
|
440
469
|
return result
|
441
470
|
},
|
442
471
|
closest: function(selector, context){
|
443
|
-
var node = this[0]
|
444
|
-
|
445
|
-
|
472
|
+
var node = this[0], collection = false
|
473
|
+
if (typeof selector == 'object') collection = $(selector)
|
474
|
+
while (node && !(collection ? collection.indexOf(node) >= 0 : zepto.matches(node, selector)))
|
475
|
+
node = node !== context && !isDocument(node) && node.parentNode
|
446
476
|
return $(node)
|
447
477
|
},
|
448
478
|
parents: function(selector){
|
449
479
|
var ancestors = [], nodes = this
|
450
480
|
while (nodes.length > 0)
|
451
481
|
nodes = $.map(nodes, function(node){
|
452
|
-
if ((node = node.parentNode) && node
|
482
|
+
if ((node = node.parentNode) && !isDocument(node) && ancestors.indexOf(node) < 0) {
|
453
483
|
ancestors.push(node)
|
454
484
|
return node
|
455
485
|
}
|
@@ -606,8 +636,8 @@ var Zepto = (function() {
|
|
606
636
|
return {
|
607
637
|
left: obj.left + window.pageXOffset,
|
608
638
|
top: obj.top + window.pageYOffset,
|
609
|
-
width: obj.width,
|
610
|
-
height: obj.height
|
639
|
+
width: Math.round(obj.width),
|
640
|
+
height: Math.round(obj.height)
|
611
641
|
}
|
612
642
|
},
|
613
643
|
css: function(property, value){
|
@@ -615,17 +645,18 @@ var Zepto = (function() {
|
|
615
645
|
return this[0] && (this[0].style[camelize(property)] || getComputedStyle(this[0], '').getPropertyValue(property))
|
616
646
|
|
617
647
|
var css = ''
|
618
|
-
|
619
|
-
if (!property[key] && property[key] !== 0)
|
620
|
-
this.each(function(){ this.style.removeProperty(dasherize(key)) })
|
621
|
-
else
|
622
|
-
css += dasherize(key) + ':' + maybeAddPx(key, property[key]) + ';'
|
623
|
-
|
624
|
-
if (typeof property == 'string')
|
648
|
+
if (type(property) == 'string') {
|
625
649
|
if (!value && value !== 0)
|
626
650
|
this.each(function(){ this.style.removeProperty(dasherize(property)) })
|
627
651
|
else
|
628
652
|
css = dasherize(property) + ":" + maybeAddPx(property, value)
|
653
|
+
} else {
|
654
|
+
for (key in property)
|
655
|
+
if (!property[key] && property[key] !== 0)
|
656
|
+
this.each(function(){ this.style.removeProperty(dasherize(key)) })
|
657
|
+
else
|
658
|
+
css += dasherize(key) + ':' + maybeAddPx(key, property[key]) + ';'
|
659
|
+
}
|
629
660
|
|
630
661
|
return this.each(function(){ this.style.cssText += ';' + css })
|
631
662
|
},
|
@@ -712,12 +743,13 @@ var Zepto = (function() {
|
|
712
743
|
// Generate the `width` and `height` functions
|
713
744
|
;['width', 'height'].forEach(function(dimension){
|
714
745
|
$.fn[dimension] = function(value){
|
715
|
-
var offset,
|
716
|
-
|
717
|
-
|
746
|
+
var offset, el = this[0],
|
747
|
+
Dimension = dimension.replace(/./, function(m){ return m[0].toUpperCase() })
|
748
|
+
if (value === undefined) return isWindow(el) ? el['inner' + Dimension] :
|
749
|
+
isDocument(el) ? el.documentElement['offset' + Dimension] :
|
718
750
|
(offset = this.offset()) && offset[dimension]
|
719
751
|
else return this.each(function(idx){
|
720
|
-
|
752
|
+
el = $(this)
|
721
753
|
el.css(dimension, funcArg(this, value, idx, el[dimension]()))
|
722
754
|
})
|
723
755
|
}
|
@@ -735,7 +767,11 @@ var Zepto = (function() {
|
|
735
767
|
|
736
768
|
$.fn[operator] = function(){
|
737
769
|
// arguments can be nodes, arrays of nodes, Zepto objects and HTML strings
|
738
|
-
var nodes = $.map(arguments, function(
|
770
|
+
var argType, nodes = $.map(arguments, function(arg) {
|
771
|
+
argType = type(arg)
|
772
|
+
return argType == "object" || argType == "array" || arg == null ?
|
773
|
+
arg : zepto.fragment(arg)
|
774
|
+
}),
|
739
775
|
parent, copyByClone = this.length > 1
|
740
776
|
if (nodes.length < 1) return this
|
741
777
|
|
@@ -781,13 +817,60 @@ var Zepto = (function() {
|
|
781
817
|
return $
|
782
818
|
})()
|
783
819
|
|
784
|
-
// If `$` is not yet defined, point it to `Zepto`
|
785
820
|
window.Zepto = Zepto
|
786
|
-
'$' in window || (window.$ = Zepto)
|
821
|
+
'$' in window || (window.$ = Zepto)
|
787
822
|
|
788
|
-
|
789
|
-
|
790
|
-
|
823
|
+
;(function($){
|
824
|
+
function detect(ua){
|
825
|
+
var os = this.os = {}, browser = this.browser = {},
|
826
|
+
webkit = ua.match(/WebKit\/([\d.]+)/),
|
827
|
+
android = ua.match(/(Android)\s+([\d.]+)/),
|
828
|
+
ipad = ua.match(/(iPad).*OS\s([\d_]+)/),
|
829
|
+
iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/),
|
830
|
+
webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/),
|
831
|
+
touchpad = webos && ua.match(/TouchPad/),
|
832
|
+
kindle = ua.match(/Kindle\/([\d.]+)/),
|
833
|
+
silk = ua.match(/Silk\/([\d._]+)/),
|
834
|
+
blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/),
|
835
|
+
bb10 = ua.match(/(BB10).*Version\/([\d.]+)/),
|
836
|
+
rimtabletos = ua.match(/(RIM\sTablet\sOS)\s([\d.]+)/),
|
837
|
+
playbook = ua.match(/PlayBook/),
|
838
|
+
chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/),
|
839
|
+
firefox = ua.match(/Firefox\/([\d.]+)/)
|
840
|
+
|
841
|
+
// Todo: clean this up with a better OS/browser seperation:
|
842
|
+
// - discern (more) between multiple browsers on android
|
843
|
+
// - decide if kindle fire in silk mode is android or not
|
844
|
+
// - Firefox on Android doesn't specify the Android version
|
845
|
+
// - possibly devide in os, device and browser hashes
|
846
|
+
|
847
|
+
if (browser.webkit = !!webkit) browser.version = webkit[1]
|
848
|
+
|
849
|
+
if (android) os.android = true, os.version = android[2]
|
850
|
+
if (iphone) os.ios = os.iphone = true, os.version = iphone[2].replace(/_/g, '.')
|
851
|
+
if (ipad) os.ios = os.ipad = true, os.version = ipad[2].replace(/_/g, '.')
|
852
|
+
if (webos) os.webos = true, os.version = webos[2]
|
853
|
+
if (touchpad) os.touchpad = true
|
854
|
+
if (blackberry) os.blackberry = true, os.version = blackberry[2]
|
855
|
+
if (bb10) os.bb10 = true, os.version = bb10[2]
|
856
|
+
if (rimtabletos) os.rimtabletos = true, os.version = rimtabletos[2]
|
857
|
+
if (playbook) browser.playbook = true
|
858
|
+
if (kindle) os.kindle = true, os.version = kindle[1]
|
859
|
+
if (silk) browser.silk = true, browser.version = silk[1]
|
860
|
+
if (!silk && os.android && ua.match(/Kindle Fire/)) browser.silk = true
|
861
|
+
if (chrome) browser.chrome = true, browser.version = chrome[1]
|
862
|
+
if (firefox) browser.firefox = true, browser.version = firefox[1]
|
863
|
+
|
864
|
+
os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) || (firefox && ua.match(/Tablet/)))
|
865
|
+
os.phone = !!(!os.tablet && (android || iphone || webos || blackberry || bb10 ||
|
866
|
+
(chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) || (firefox && ua.match(/Mobile/))))
|
867
|
+
}
|
868
|
+
|
869
|
+
detect.call($, navigator.userAgent)
|
870
|
+
// make available to unit tests
|
871
|
+
$.__detect = detect
|
872
|
+
|
873
|
+
})(Zepto)
|
791
874
|
|
792
875
|
;(function($){
|
793
876
|
var $$ = $.zepto.qsa, handlers = {}, _zid = 1, specialEvents={},
|
@@ -818,7 +901,7 @@ window.Zepto = Zepto
|
|
818
901
|
}
|
819
902
|
|
820
903
|
function eachEvent(events, fn, iterator){
|
821
|
-
if ($.
|
904
|
+
if ($.type(events) != "string") $.each(events, iterator)
|
822
905
|
else events.split(/\s/).forEach(function(type){ iterator(type, fn) })
|
823
906
|
}
|
824
907
|
|
@@ -1032,163 +1115,10 @@ window.Zepto = Zepto
|
|
1032
1115
|
return event
|
1033
1116
|
}
|
1034
1117
|
|
1035
|
-
})(Zepto)
|
1036
|
-
|
1037
|
-
// Zepto.js
|
1038
|
-
// (c) 2010-2012 Thomas Fuchs
|
1039
|
-
// Zepto.js may be freely distributed under the MIT license.
|
1040
|
-
|
1041
|
-
;(function($){
|
1042
|
-
function detect(ua){
|
1043
|
-
var os = this.os = {}, browser = this.browser = {},
|
1044
|
-
webkit = ua.match(/WebKit\/([\d.]+)/),
|
1045
|
-
android = ua.match(/(Android)\s+([\d.]+)/),
|
1046
|
-
ipad = ua.match(/(iPad).*OS\s([\d_]+)/),
|
1047
|
-
iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/),
|
1048
|
-
webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/),
|
1049
|
-
touchpad = webos && ua.match(/TouchPad/),
|
1050
|
-
kindle = ua.match(/Kindle\/([\d.]+)/),
|
1051
|
-
silk = ua.match(/Silk\/([\d._]+)/),
|
1052
|
-
blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/),
|
1053
|
-
chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/)
|
1054
|
-
|
1055
|
-
// todo clean this up with a better OS/browser
|
1056
|
-
// separation. we need to discern between multiple
|
1057
|
-
// browsers on android, and decide if kindle fire in
|
1058
|
-
// silk mode is android or not
|
1059
|
-
|
1060
|
-
if (browser.webkit = !!webkit) browser.version = webkit[1]
|
1061
|
-
|
1062
|
-
if (android) os.android = true, os.version = android[2]
|
1063
|
-
if (iphone) os.ios = os.iphone = true, os.version = iphone[2].replace(/_/g, '.')
|
1064
|
-
if (ipad) os.ios = os.ipad = true, os.version = ipad[2].replace(/_/g, '.')
|
1065
|
-
if (webos) os.webos = true, os.version = webos[2]
|
1066
|
-
if (touchpad) os.touchpad = true
|
1067
|
-
if (blackberry) os.blackberry = true, os.version = blackberry[2]
|
1068
|
-
if (kindle) os.kindle = true, os.version = kindle[1]
|
1069
|
-
if (silk) browser.silk = true, browser.version = silk[1]
|
1070
|
-
if (!silk && os.android && ua.match(/Kindle Fire/)) browser.silk = true
|
1071
|
-
if (chrome) browser.chrome = true, browser.version = chrome[1]
|
1072
|
-
}
|
1073
|
-
|
1074
|
-
detect.call($, navigator.userAgent)
|
1075
|
-
// make available to unit tests
|
1076
|
-
$.__detect = detect
|
1077
|
-
|
1078
|
-
})(Zepto);
|
1079
|
-
|
1080
|
-
|
1081
|
-
// Zepto.js
|
1082
|
-
// (c) 2010-2012 Thomas Fuchs
|
1083
|
-
// Zepto.js may be freely distributed under the MIT license.
|
1084
|
-
|
1085
|
-
;(function($, undefined){
|
1086
|
-
var prefix = '', eventPrefix, endEventName, endAnimationName,
|
1087
|
-
vendors = { Webkit: 'webkit', Moz: '', O: 'o', ms: 'MS' },
|
1088
|
-
document = window.document, testEl = document.createElement('div'),
|
1089
|
-
supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,
|
1090
|
-
transform,
|
1091
|
-
transitionProperty, transitionDuration, transitionTiming,
|
1092
|
-
animationName, animationDuration, animationTiming,
|
1093
|
-
cssReset = {}
|
1094
|
-
|
1095
|
-
function dasherize(str) { return downcase(str.replace(/([a-z])([A-Z])/, '$1-$2')) }
|
1096
|
-
function downcase(str) { return str.toLowerCase() }
|
1097
|
-
function normalizeEvent(name) { return eventPrefix ? eventPrefix + name : downcase(name) }
|
1098
|
-
|
1099
|
-
$.each(vendors, function(vendor, event){
|
1100
|
-
if (testEl.style[vendor + 'TransitionProperty'] !== undefined) {
|
1101
|
-
prefix = '-' + downcase(vendor) + '-'
|
1102
|
-
eventPrefix = event
|
1103
|
-
return false
|
1104
|
-
}
|
1105
|
-
})
|
1106
|
-
|
1107
|
-
transform = prefix + 'transform'
|
1108
|
-
cssReset[transitionProperty = prefix + 'transition-property'] =
|
1109
|
-
cssReset[transitionDuration = prefix + 'transition-duration'] =
|
1110
|
-
cssReset[transitionTiming = prefix + 'transition-timing-function'] =
|
1111
|
-
cssReset[animationName = prefix + 'animation-name'] =
|
1112
|
-
cssReset[animationDuration = prefix + 'animation-duration'] =
|
1113
|
-
cssReset[animationTiming = prefix + 'animation-timing-function'] = ''
|
1114
|
-
|
1115
|
-
$.fx = {
|
1116
|
-
off: (eventPrefix === undefined && testEl.style.transitionProperty === undefined),
|
1117
|
-
speeds: { _default: 400, fast: 200, slow: 600 },
|
1118
|
-
cssPrefix: prefix,
|
1119
|
-
transitionEnd: normalizeEvent('TransitionEnd'),
|
1120
|
-
animationEnd: normalizeEvent('AnimationEnd')
|
1121
|
-
}
|
1122
|
-
|
1123
|
-
$.fn.animate = function(properties, duration, ease, callback){
|
1124
|
-
if ($.isObject(duration))
|
1125
|
-
ease = duration.easing, callback = duration.complete, duration = duration.duration
|
1126
|
-
if (duration) duration = (typeof duration == 'number' ? duration :
|
1127
|
-
($.fx.speeds[duration] || $.fx.speeds._default)) / 1000
|
1128
|
-
return this.anim(properties, duration, ease, callback)
|
1129
|
-
}
|
1130
|
-
|
1131
|
-
$.fn.anim = function(properties, duration, ease, callback){
|
1132
|
-
var key, cssValues = {}, cssProperties, transforms = '',
|
1133
|
-
that = this, wrappedCallback, endEvent = $.fx.transitionEnd
|
1134
|
-
|
1135
|
-
if (duration === undefined) duration = 0.4
|
1136
|
-
if ($.fx.off) duration = 0
|
1137
|
-
|
1138
|
-
if (typeof properties == 'string') {
|
1139
|
-
// keyframe animation
|
1140
|
-
cssValues[animationName] = properties
|
1141
|
-
cssValues[animationDuration] = duration + 's'
|
1142
|
-
cssValues[animationTiming] = (ease || 'linear')
|
1143
|
-
endEvent = $.fx.animationEnd
|
1144
|
-
} else {
|
1145
|
-
cssProperties = []
|
1146
|
-
// CSS transitions
|
1147
|
-
for (key in properties)
|
1148
|
-
if (supportedTransforms.test(key)) transforms += key + '(' + properties[key] + ') '
|
1149
|
-
else cssValues[key] = properties[key], cssProperties.push(dasherize(key))
|
1150
|
-
|
1151
|
-
if (transforms) cssValues[transform] = transforms, cssProperties.push(transform)
|
1152
|
-
if (duration > 0 && typeof properties === 'object') {
|
1153
|
-
cssValues[transitionProperty] = cssProperties.join(', ')
|
1154
|
-
cssValues[transitionDuration] = duration + 's'
|
1155
|
-
cssValues[transitionTiming] = (ease || 'linear')
|
1156
|
-
}
|
1157
|
-
}
|
1158
|
-
|
1159
|
-
wrappedCallback = function(event){
|
1160
|
-
if (typeof event !== 'undefined') {
|
1161
|
-
if (event.target !== event.currentTarget) return // makes sure the event didn't bubble from "below"
|
1162
|
-
$(event.target).unbind(endEvent, arguments.callee)
|
1163
|
-
}
|
1164
|
-
$(this).css(cssReset)
|
1165
|
-
callback && callback.call(this)
|
1166
|
-
}
|
1167
|
-
if (duration > 0) this.bind(endEvent, wrappedCallback)
|
1168
|
-
|
1169
|
-
// trigger page reflow so new elements can animate
|
1170
|
-
this.size() && this.get(0).clientLeft
|
1171
|
-
|
1172
|
-
this.css(cssValues)
|
1173
|
-
|
1174
|
-
if (duration <= 0) setTimeout(function() {
|
1175
|
-
that.each(function(){ wrappedCallback.call(this) })
|
1176
|
-
}, 0)
|
1177
|
-
|
1178
|
-
return this
|
1179
|
-
}
|
1180
|
-
|
1181
|
-
testEl = null
|
1182
|
-
})(Zepto);
|
1183
|
-
|
1184
|
-
|
1185
|
-
// Zepto.js
|
1186
|
-
// (c) 2010-2012 Thomas Fuchs
|
1187
|
-
// Zepto.js may be freely distributed under the MIT license.
|
1118
|
+
})(Zepto)
|
1188
1119
|
|
1189
1120
|
;(function($){
|
1190
1121
|
var jsonpID = 0,
|
1191
|
-
isObject = $.isObject,
|
1192
1122
|
document = window.document,
|
1193
1123
|
key,
|
1194
1124
|
name,
|
@@ -1259,33 +1189,38 @@ window.Zepto = Zepto
|
|
1259
1189
|
|
1260
1190
|
var callbackName = 'jsonp' + (++jsonpID),
|
1261
1191
|
script = document.createElement('script'),
|
1262
|
-
|
1192
|
+
cleanup = function() {
|
1193
|
+
clearTimeout(abortTimeout)
|
1263
1194
|
$(script).remove()
|
1264
|
-
|
1265
|
-
|
1195
|
+
delete window[callbackName]
|
1196
|
+
},
|
1197
|
+
abort = function(type){
|
1198
|
+
cleanup()
|
1199
|
+
// In case of manual abort or timeout, keep an empty function as callback
|
1200
|
+
// so that the SCRIPT tag that eventually loads won't result in an error.
|
1201
|
+
if (!type || type == 'timeout') window[callbackName] = empty
|
1202
|
+
ajaxError(null, type || 'abort', xhr, options)
|
1266
1203
|
},
|
1267
1204
|
xhr = { abort: abort }, abortTimeout
|
1268
1205
|
|
1269
|
-
if (options
|
1270
|
-
|
1271
|
-
|
1206
|
+
if (ajaxBeforeSend(xhr, options) === false) {
|
1207
|
+
abort('abort')
|
1208
|
+
return false
|
1272
1209
|
}
|
1273
1210
|
|
1274
1211
|
window[callbackName] = function(data){
|
1275
|
-
|
1276
|
-
$(script).remove()
|
1277
|
-
delete window[callbackName]
|
1212
|
+
cleanup()
|
1278
1213
|
ajaxSuccess(data, xhr, options)
|
1279
1214
|
}
|
1280
1215
|
|
1281
|
-
|
1216
|
+
script.onerror = function() { abort('error') }
|
1217
|
+
|
1282
1218
|
script.src = options.url.replace(/=\?/, '=' + callbackName)
|
1283
1219
|
$('head').append(script)
|
1284
1220
|
|
1285
1221
|
if (options.timeout > 0) abortTimeout = setTimeout(function(){
|
1286
|
-
|
1287
|
-
|
1288
|
-
}, options.timeout)
|
1222
|
+
abort('timeout')
|
1223
|
+
}, options.timeout)
|
1289
1224
|
|
1290
1225
|
return xhr
|
1291
1226
|
}
|
@@ -1322,10 +1257,13 @@ window.Zepto = Zepto
|
|
1322
1257
|
// Default timeout
|
1323
1258
|
timeout: 0,
|
1324
1259
|
// Whether data should be serialized to string
|
1325
|
-
processData: true
|
1260
|
+
processData: true,
|
1261
|
+
// Whether the browser should be allowed to cache GET responses
|
1262
|
+
cache: true,
|
1326
1263
|
}
|
1327
1264
|
|
1328
1265
|
function mimeToDataType(mime) {
|
1266
|
+
if (mime) mime = mime.split(';', 2)[0]
|
1329
1267
|
return mime && ( mime == htmlType ? 'html' :
|
1330
1268
|
mime == jsonType ? 'json' :
|
1331
1269
|
scriptTypeRE.test(mime) ? 'script' :
|
@@ -1338,7 +1276,7 @@ window.Zepto = Zepto
|
|
1338
1276
|
|
1339
1277
|
// serialize payload and append it to the URL for GET requests
|
1340
1278
|
function serializeData(options) {
|
1341
|
-
if (options.processData &&
|
1279
|
+
if (options.processData && options.data && $.type(options.data) != "string")
|
1342
1280
|
options.data = $.param(options.data, options.traditional)
|
1343
1281
|
if (options.data && (!options.type || options.type.toUpperCase() == 'GET'))
|
1344
1282
|
options.url = appendQuery(options.url, options.data)
|
@@ -1353,15 +1291,16 @@ window.Zepto = Zepto
|
|
1353
1291
|
if (!settings.crossDomain) settings.crossDomain = /^([\w-]+:)?\/\/([^\/]+)/.test(settings.url) &&
|
1354
1292
|
RegExp.$2 != window.location.host
|
1355
1293
|
|
1294
|
+
if (!settings.url) settings.url = window.location.toString()
|
1295
|
+
serializeData(settings)
|
1296
|
+
if (settings.cache === false) settings.url = appendQuery(settings.url, '_=' + Date.now())
|
1297
|
+
|
1356
1298
|
var dataType = settings.dataType, hasPlaceholder = /=\?/.test(settings.url)
|
1357
1299
|
if (dataType == 'jsonp' || hasPlaceholder) {
|
1358
1300
|
if (!hasPlaceholder) settings.url = appendQuery(settings.url, 'callback=?')
|
1359
1301
|
return $.ajaxJSONP(settings)
|
1360
1302
|
}
|
1361
1303
|
|
1362
|
-
if (!settings.url) settings.url = window.location.toString()
|
1363
|
-
serializeData(settings)
|
1364
|
-
|
1365
1304
|
var mime = settings.accepts[dataType],
|
1366
1305
|
baseHeaders = { },
|
1367
1306
|
protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol,
|
@@ -1387,6 +1326,7 @@ window.Zepto = Zepto
|
|
1387
1326
|
result = xhr.responseText
|
1388
1327
|
|
1389
1328
|
try {
|
1329
|
+
// http://perfectionkills.com/global-eval-what-are-the-options/
|
1390
1330
|
if (dataType == 'script') (1,eval)(result)
|
1391
1331
|
else if (dataType == 'xml') result = xhr.responseXML
|
1392
1332
|
else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result)
|
@@ -1421,40 +1361,60 @@ window.Zepto = Zepto
|
|
1421
1361
|
return xhr
|
1422
1362
|
}
|
1423
1363
|
|
1424
|
-
|
1364
|
+
// handle optional data/success arguments
|
1365
|
+
function parseArguments(url, data, success, dataType) {
|
1366
|
+
var hasData = !$.isFunction(data)
|
1367
|
+
return {
|
1368
|
+
url: url,
|
1369
|
+
data: hasData ? data : undefined,
|
1370
|
+
success: !hasData ? data : $.isFunction(success) ? success : undefined,
|
1371
|
+
dataType: hasData ? dataType || success : success
|
1372
|
+
}
|
1373
|
+
}
|
1374
|
+
|
1375
|
+
$.get = function(url, data, success, dataType){
|
1376
|
+
return $.ajax(parseArguments.apply(null, arguments))
|
1377
|
+
}
|
1425
1378
|
|
1426
1379
|
$.post = function(url, data, success, dataType){
|
1427
|
-
|
1428
|
-
|
1380
|
+
var options = parseArguments.apply(null, arguments)
|
1381
|
+
options.type = 'POST'
|
1382
|
+
return $.ajax(options)
|
1429
1383
|
}
|
1430
1384
|
|
1431
|
-
$.getJSON = function(url, success){
|
1432
|
-
|
1385
|
+
$.getJSON = function(url, data, success){
|
1386
|
+
var options = parseArguments.apply(null, arguments)
|
1387
|
+
options.dataType = 'json'
|
1388
|
+
return $.ajax(options)
|
1433
1389
|
}
|
1434
1390
|
|
1435
|
-
$.fn.load = function(url, success){
|
1391
|
+
$.fn.load = function(url, data, success){
|
1436
1392
|
if (!this.length) return this
|
1437
|
-
var self = this, parts = url.split(/\s/), selector
|
1438
|
-
|
1439
|
-
|
1393
|
+
var self = this, parts = url.split(/\s/), selector,
|
1394
|
+
options = parseArguments(url, data, success),
|
1395
|
+
callback = options.success
|
1396
|
+
if (parts.length > 1) options.url = parts[0], selector = parts[1]
|
1397
|
+
options.success = function(response){
|
1440
1398
|
self.html(selector ?
|
1441
1399
|
$('<div>').html(response.replace(rscript, "")).find(selector)
|
1442
1400
|
: response)
|
1443
|
-
|
1444
|
-
}
|
1401
|
+
callback && callback.apply(self, arguments)
|
1402
|
+
}
|
1403
|
+
$.ajax(options)
|
1445
1404
|
return this
|
1446
1405
|
}
|
1447
1406
|
|
1448
1407
|
var escape = encodeURIComponent
|
1449
1408
|
|
1450
1409
|
function serialize(params, obj, traditional, scope){
|
1451
|
-
var array = $.isArray(obj)
|
1410
|
+
var type, array = $.isArray(obj)
|
1452
1411
|
$.each(obj, function(key, value) {
|
1412
|
+
type = $.type(value)
|
1453
1413
|
if (scope) key = traditional ? scope : scope + '[' + (array ? '' : key) + ']'
|
1454
1414
|
// handle data in serializeArray() format
|
1455
1415
|
if (!scope && array) params.add(value.name, value.value)
|
1456
1416
|
// recurse into nested objects
|
1457
|
-
else if (
|
1417
|
+
else if (type == "array" || (!traditional && type == "object"))
|
1458
1418
|
serialize(params, value, traditional, key)
|
1459
1419
|
else params.add(key, value)
|
1460
1420
|
})
|
@@ -1466,12 +1426,7 @@ window.Zepto = Zepto
|
|
1466
1426
|
serialize(params, obj, traditional)
|
1467
1427
|
return params.join('&').replace(/%20/g, '+')
|
1468
1428
|
}
|
1469
|
-
})(Zepto)
|
1470
|
-
|
1471
|
-
|
1472
|
-
// Zepto.js
|
1473
|
-
// (c) 2010-2012 Thomas Fuchs
|
1474
|
-
// Zepto.js may be freely distributed under the MIT license.
|
1429
|
+
})(Zepto)
|
1475
1430
|
|
1476
1431
|
;(function ($) {
|
1477
1432
|
$.fn.serializeArray = function () {
|
@@ -1508,8 +1463,178 @@ window.Zepto = Zepto
|
|
1508
1463
|
return this
|
1509
1464
|
}
|
1510
1465
|
|
1511
|
-
})(Zepto)
|
1466
|
+
})(Zepto)
|
1467
|
+
|
1468
|
+
;(function($, undefined){
|
1469
|
+
var prefix = '', eventPrefix, endEventName, endAnimationName,
|
1470
|
+
vendors = { Webkit: 'webkit', Moz: '', O: 'o', ms: 'MS' },
|
1471
|
+
document = window.document, testEl = document.createElement('div'),
|
1472
|
+
supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,
|
1473
|
+
transform,
|
1474
|
+
transitionProperty, transitionDuration, transitionTiming,
|
1475
|
+
animationName, animationDuration, animationTiming,
|
1476
|
+
cssReset = {}
|
1512
1477
|
|
1478
|
+
function dasherize(str) { return downcase(str.replace(/([a-z])([A-Z])/, '$1-$2')) }
|
1479
|
+
function downcase(str) { return str.toLowerCase() }
|
1480
|
+
function normalizeEvent(name) { return eventPrefix ? eventPrefix + name : downcase(name) }
|
1481
|
+
|
1482
|
+
$.each(vendors, function(vendor, event){
|
1483
|
+
if (testEl.style[vendor + 'TransitionProperty'] !== undefined) {
|
1484
|
+
prefix = '-' + downcase(vendor) + '-'
|
1485
|
+
eventPrefix = event
|
1486
|
+
return false
|
1487
|
+
}
|
1488
|
+
})
|
1489
|
+
|
1490
|
+
transform = prefix + 'transform'
|
1491
|
+
cssReset[transitionProperty = prefix + 'transition-property'] =
|
1492
|
+
cssReset[transitionDuration = prefix + 'transition-duration'] =
|
1493
|
+
cssReset[transitionTiming = prefix + 'transition-timing-function'] =
|
1494
|
+
cssReset[animationName = prefix + 'animation-name'] =
|
1495
|
+
cssReset[animationDuration = prefix + 'animation-duration'] =
|
1496
|
+
cssReset[animationTiming = prefix + 'animation-timing-function'] = ''
|
1497
|
+
|
1498
|
+
$.fx = {
|
1499
|
+
off: (eventPrefix === undefined && testEl.style.transitionProperty === undefined),
|
1500
|
+
speeds: { _default: 400, fast: 200, slow: 600 },
|
1501
|
+
cssPrefix: prefix,
|
1502
|
+
transitionEnd: normalizeEvent('TransitionEnd'),
|
1503
|
+
animationEnd: normalizeEvent('AnimationEnd')
|
1504
|
+
}
|
1505
|
+
|
1506
|
+
$.fn.animate = function(properties, duration, ease, callback){
|
1507
|
+
if ($.isPlainObject(duration))
|
1508
|
+
ease = duration.easing, callback = duration.complete, duration = duration.duration
|
1509
|
+
if (duration) duration = (typeof duration == 'number' ? duration :
|
1510
|
+
($.fx.speeds[duration] || $.fx.speeds._default)) / 1000
|
1511
|
+
return this.anim(properties, duration, ease, callback)
|
1512
|
+
}
|
1513
|
+
|
1514
|
+
$.fn.anim = function(properties, duration, ease, callback){
|
1515
|
+
var key, cssValues = {}, cssProperties, transforms = '',
|
1516
|
+
that = this, wrappedCallback, endEvent = $.fx.transitionEnd
|
1517
|
+
|
1518
|
+
if (duration === undefined) duration = 0.4
|
1519
|
+
if ($.fx.off) duration = 0
|
1520
|
+
|
1521
|
+
if (typeof properties == 'string') {
|
1522
|
+
// keyframe animation
|
1523
|
+
cssValues[animationName] = properties
|
1524
|
+
cssValues[animationDuration] = duration + 's'
|
1525
|
+
cssValues[animationTiming] = (ease || 'linear')
|
1526
|
+
endEvent = $.fx.animationEnd
|
1527
|
+
} else {
|
1528
|
+
cssProperties = []
|
1529
|
+
// CSS transitions
|
1530
|
+
for (key in properties)
|
1531
|
+
if (supportedTransforms.test(key)) transforms += key + '(' + properties[key] + ') '
|
1532
|
+
else cssValues[key] = properties[key], cssProperties.push(dasherize(key))
|
1533
|
+
|
1534
|
+
if (transforms) cssValues[transform] = transforms, cssProperties.push(transform)
|
1535
|
+
if (duration > 0 && typeof properties === 'object') {
|
1536
|
+
cssValues[transitionProperty] = cssProperties.join(', ')
|
1537
|
+
cssValues[transitionDuration] = duration + 's'
|
1538
|
+
cssValues[transitionTiming] = (ease || 'linear')
|
1539
|
+
}
|
1540
|
+
}
|
1541
|
+
|
1542
|
+
wrappedCallback = function(event){
|
1543
|
+
if (typeof event !== 'undefined') {
|
1544
|
+
if (event.target !== event.currentTarget) return // makes sure the event didn't bubble from "below"
|
1545
|
+
$(event.target).unbind(endEvent, wrappedCallback)
|
1546
|
+
}
|
1547
|
+
$(this).css(cssReset)
|
1548
|
+
callback && callback.call(this)
|
1549
|
+
}
|
1550
|
+
if (duration > 0) this.bind(endEvent, wrappedCallback)
|
1551
|
+
|
1552
|
+
// trigger page reflow so new elements can animate
|
1553
|
+
this.size() && this.get(0).clientLeft
|
1554
|
+
|
1555
|
+
this.css(cssValues)
|
1556
|
+
|
1557
|
+
if (duration <= 0) setTimeout(function() {
|
1558
|
+
that.each(function(){ wrappedCallback.call(this) })
|
1559
|
+
}, 0)
|
1560
|
+
|
1561
|
+
return this
|
1562
|
+
}
|
1563
|
+
|
1564
|
+
testEl = null
|
1565
|
+
})(Zepto)
|
1566
|
+
|
1567
|
+
// Zepto.js
|
1568
|
+
// (c) 2010-2012 Thomas Fuchs
|
1569
|
+
// Zepto.js may be freely distributed under the MIT license.
|
1570
|
+
|
1571
|
+
;(function($, undefined){
|
1572
|
+
var document = window.document, docElem = document.documentElement,
|
1573
|
+
origShow = $.fn.show, origHide = $.fn.hide, origToggle = $.fn.toggle
|
1574
|
+
|
1575
|
+
function anim(el, speed, opacity, scale, callback) {
|
1576
|
+
if (typeof speed == 'function' && !callback) callback = speed, speed = undefined
|
1577
|
+
var props = { opacity: opacity }
|
1578
|
+
if (scale) {
|
1579
|
+
props.scale = scale
|
1580
|
+
el.css($.fx.cssPrefix + 'transform-origin', '0 0')
|
1581
|
+
}
|
1582
|
+
return el.animate(props, speed, null, callback)
|
1583
|
+
}
|
1584
|
+
|
1585
|
+
function hide(el, speed, scale, callback) {
|
1586
|
+
return anim(el, speed, 0, scale, function(){
|
1587
|
+
origHide.call($(this))
|
1588
|
+
callback && callback.call(this)
|
1589
|
+
})
|
1590
|
+
}
|
1591
|
+
|
1592
|
+
$.fn.show = function(speed, callback) {
|
1593
|
+
origShow.call(this)
|
1594
|
+
if (speed === undefined) speed = 0
|
1595
|
+
else this.css('opacity', 0)
|
1596
|
+
return anim(this, speed, 1, '1,1', callback)
|
1597
|
+
}
|
1598
|
+
|
1599
|
+
$.fn.hide = function(speed, callback) {
|
1600
|
+
if (speed === undefined) return origHide.call(this)
|
1601
|
+
else return hide(this, speed, '0,0', callback)
|
1602
|
+
}
|
1603
|
+
|
1604
|
+
$.fn.toggle = function(speed, callback) {
|
1605
|
+
if (speed === undefined || typeof speed == 'boolean')
|
1606
|
+
return origToggle.call(this, speed)
|
1607
|
+
else return this.each(function(){
|
1608
|
+
var el = $(this)
|
1609
|
+
el[el.css('display') == 'none' ? 'show' : 'hide'](speed, callback)
|
1610
|
+
})
|
1611
|
+
}
|
1612
|
+
|
1613
|
+
$.fn.fadeTo = function(speed, opacity, callback) {
|
1614
|
+
return anim(this, speed, opacity, null, callback)
|
1615
|
+
}
|
1616
|
+
|
1617
|
+
$.fn.fadeIn = function(speed, callback) {
|
1618
|
+
var target = this.css('opacity')
|
1619
|
+
if (target > 0) this.css('opacity', 0)
|
1620
|
+
else target = 1
|
1621
|
+
return origShow.call(this).fadeTo(speed, target, callback)
|
1622
|
+
}
|
1623
|
+
|
1624
|
+
$.fn.fadeOut = function(speed, callback) {
|
1625
|
+
return hide(this, speed, null, callback)
|
1626
|
+
}
|
1627
|
+
|
1628
|
+
$.fn.fadeToggle = function(speed, callback) {
|
1629
|
+
return this.each(function(){
|
1630
|
+
var el = $(this)
|
1631
|
+
el[
|
1632
|
+
(el.css('opacity') == 0 || el.css('display') == 'none') ? 'fadeIn' : 'fadeOut'
|
1633
|
+
](speed, callback)
|
1634
|
+
})
|
1635
|
+
}
|
1636
|
+
|
1637
|
+
})(Zepto)
|
1513
1638
|
|
1514
1639
|
// Zepto.js
|
1515
1640
|
// (c) 2010-2012 Thomas Fuchs
|
@@ -1531,8 +1656,7 @@ window.Zepto = Zepto
|
|
1531
1656
|
}
|
1532
1657
|
})
|
1533
1658
|
}
|
1534
|
-
})(Zepto)
|
1535
|
-
|
1659
|
+
})(Zepto)
|
1536
1660
|
|
1537
1661
|
// Zepto.js
|
1538
1662
|
// (c) 2010-2012 Thomas Fuchs
|
@@ -1600,8 +1724,7 @@ window.Zepto = Zepto
|
|
1600
1724
|
if (store) $.each(names, function(){ delete store[camelize(this)] })
|
1601
1725
|
})
|
1602
1726
|
}
|
1603
|
-
})(Zepto)
|
1604
|
-
|
1727
|
+
})(Zepto)
|
1605
1728
|
|
1606
1729
|
;(function($){
|
1607
1730
|
var zepto = $.zepto, oldQsa = zepto.qsa, oldMatches = zepto.matches
|
@@ -1644,7 +1767,7 @@ window.Zepto = Zepto
|
|
1644
1767
|
sel = sel.replace(/=#\]/g, '="#"]')
|
1645
1768
|
var filter, arg, match = filterRe.exec(sel)
|
1646
1769
|
if (match && match[2] in filters) {
|
1647
|
-
|
1770
|
+
filter = filters[match[2]], arg = match[3]
|
1648
1771
|
sel = match[1]
|
1649
1772
|
if (arg) {
|
1650
1773
|
var num = Number(arg)
|
@@ -1683,8 +1806,7 @@ window.Zepto = Zepto
|
|
1683
1806
|
(!filter || filter.call(node, null, arg) === node)
|
1684
1807
|
})
|
1685
1808
|
}
|
1686
|
-
})(Zepto)
|
1687
|
-
|
1809
|
+
})(Zepto)
|
1688
1810
|
|
1689
1811
|
// Zepto.js
|
1690
1812
|
// (c) 2010-2012 Thomas Fuchs
|
@@ -1707,76 +1829,56 @@ window.Zepto = Zepto
|
|
1707
1829
|
return ret
|
1708
1830
|
}
|
1709
1831
|
})
|
1710
|
-
})(Zepto)
|
1711
|
-
|
1712
|
-
|
1713
|
-
//
|
1714
|
-
|
1715
|
-
|
1716
|
-
;
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1761
|
-
|
1762
|
-
|
1763
|
-
var target = this.css('opacity')
|
1764
|
-
if (target > 0) this.css('opacity', 0)
|
1765
|
-
else target = 1
|
1766
|
-
return origShow.call(this).fadeTo(speed, target, callback)
|
1767
|
-
}
|
1768
|
-
|
1769
|
-
$.fn.fadeOut = function(speed, callback) {
|
1770
|
-
return hide(this, speed, null, callback)
|
1771
|
-
}
|
1772
|
-
|
1773
|
-
$.fn.fadeToggle = function(speed, callback) {
|
1774
|
-
return this.each(function(){
|
1775
|
-
var el = $(this)
|
1776
|
-
el[
|
1777
|
-
(el.css('opacity') == 0 || el.css('display') == 'none') ? 'fadeIn' : 'fadeOut'
|
1778
|
-
](speed, callback)
|
1779
|
-
})
|
1780
|
-
}
|
1781
|
-
|
1782
|
-
})(Zepto)
|
1832
|
+
})(Zepto)
|
1833
|
+
|
1834
|
+
|
1835
|
+
// outer and inner height/width support
|
1836
|
+
if (this.Zepto) {
|
1837
|
+
(function($) {
|
1838
|
+
var ioDim, _base;
|
1839
|
+
ioDim = function(elem, Dimension, dimension, includeBorder, includeMargin) {
|
1840
|
+
var sides, size;
|
1841
|
+
if (elem) {
|
1842
|
+
size = elem[dimension]();
|
1843
|
+
sides = {
|
1844
|
+
width: ["left", "right"],
|
1845
|
+
height: ["top", "bottom"]
|
1846
|
+
};
|
1847
|
+
sides[dimension].forEach(function(side) {
|
1848
|
+
size += parseInt(elem.css("padding-" + side), 10);
|
1849
|
+
if (includeBorder) {
|
1850
|
+
size += parseInt(elem.css("border-" + side + "-width"), 10);
|
1851
|
+
}
|
1852
|
+
if (includeMargin) {
|
1853
|
+
return size += parseInt(elem.css("margin-" + side), 10);
|
1854
|
+
}
|
1855
|
+
});
|
1856
|
+
return size;
|
1857
|
+
} else {
|
1858
|
+
return null;
|
1859
|
+
}
|
1860
|
+
};
|
1861
|
+
["width", "height"].forEach(function(dimension) {
|
1862
|
+
var Dimension, _base, _base1, _name, _name1;
|
1863
|
+
Dimension = dimension.replace(/./, function(m) {
|
1864
|
+
return m[0].toUpperCase();
|
1865
|
+
});
|
1866
|
+
(_base = $.fn)[_name = "inner" + Dimension] || (_base[_name] = function(includeMargin) {
|
1867
|
+
return ioDim(this, Dimension, dimension, false, includeMargin);
|
1868
|
+
});
|
1869
|
+
return (_base1 = $.fn)[_name1 = "outer" + Dimension] || (_base1[_name1] = function(includeMargin) {
|
1870
|
+
return ioDim(this, Dimension, dimension, true, includeMargin);
|
1871
|
+
});
|
1872
|
+
});
|
1873
|
+
return (_base = $.fn).detach || (_base.detach = function(selector) {
|
1874
|
+
var cloned, set;
|
1875
|
+
set = this;
|
1876
|
+
if (selector != null) {
|
1877
|
+
set = set.filter(selector);
|
1878
|
+
}
|
1879
|
+
cloned = set.clone(true);
|
1880
|
+
set.remove();
|
1881
|
+
return cloned;
|
1882
|
+
});
|
1883
|
+
})(Zepto);
|
1884
|
+
}
|