docs-panacea-jekyll-theme 0.1.1 → 0.1.3
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/LICENSE.txt +21 -0
- data/README.md +47 -0
- data/_layouts/default.html +100 -0
- data/assets/.DS_Store +0 -0
- data/assets/css/asciidoctor.css +398 -0
- data/assets/css/coderay.css +90 -0
- data/assets/css/font-awesome.css +1801 -0
- data/assets/css/font-awesome.min.css +4 -0
- data/assets/css/foundation.css +8545 -0
- data/assets/css/foundation.min.css +8331 -0
- data/assets/css/normalize.css +427 -0
- data/assets/images/header-page.png +0 -0
- data/assets/images/logo-panacea.svg +147 -0
- data/assets/js/foundation.min.js +6069 -0
- data/assets/js/foundation/foundation.abide.js +325 -0
- data/assets/js/foundation/foundation.accordion.js +71 -0
- data/assets/js/foundation/foundation.alert.js +46 -0
- data/assets/js/foundation/foundation.clearing.js +573 -0
- data/assets/js/foundation/foundation.dropdown.js +444 -0
- data/assets/js/foundation/foundation.equalizer.js +77 -0
- data/assets/js/foundation/foundation.interchange.js +349 -0
- data/assets/js/foundation/foundation.joyride.js +939 -0
- data/assets/js/foundation/foundation.js +691 -0
- data/assets/js/foundation/foundation.magellan.js +199 -0
- data/assets/js/foundation/foundation.offcanvas.js +154 -0
- data/assets/js/foundation/foundation.orbit.js +512 -0
- data/assets/js/foundation/foundation.reveal.js +455 -0
- data/assets/js/foundation/foundation.slider.js +268 -0
- data/assets/js/foundation/foundation.tab.js +221 -0
- data/assets/js/foundation/foundation.tooltip.js +301 -0
- data/assets/js/foundation/foundation.topbar.js +444 -0
- data/assets/js/toc.js +82 -0
- data/assets/js/vendor/fastclick.js +169 -0
- data/assets/js/vendor/jquery.cookie.js +57 -0
- data/assets/js/vendor/jquery.js +2339 -0
- data/assets/js/vendor/modernizr.js +304 -0
- data/assets/js/vendor/placeholder.js +75 -0
- metadata +39 -2
@@ -0,0 +1,325 @@
|
|
1
|
+
;
|
2
|
+
(function ($, window, document, undefined) {
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
Foundation.libs.abide = {
|
6
|
+
name: 'abide',
|
7
|
+
|
8
|
+
version: '5.5.0',
|
9
|
+
|
10
|
+
settings: {
|
11
|
+
live_validate: true,
|
12
|
+
validate_on_blur: true,
|
13
|
+
focus_on_invalid: true,
|
14
|
+
error_labels: true, // labels with a for="inputId" will recieve an `error` class
|
15
|
+
error_class: 'error',
|
16
|
+
timeout: 1000,
|
17
|
+
patterns: {
|
18
|
+
alpha: /^[a-zA-Z]+$/,
|
19
|
+
alpha_numeric: /^[a-zA-Z0-9]+$/,
|
20
|
+
integer: /^[-+]?\d+$/,
|
21
|
+
number: /^[-+]?\d*(?:[\.\,]\d+)?$/,
|
22
|
+
|
23
|
+
// amex, visa, diners
|
24
|
+
card: /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,
|
25
|
+
cvv: /^([0-9]){3,4}$/,
|
26
|
+
|
27
|
+
// http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address
|
28
|
+
email: /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/,
|
29
|
+
|
30
|
+
url: /^(https?|ftp|file|ssh):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/,
|
31
|
+
// abc.de
|
32
|
+
domain: /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,8}$/,
|
33
|
+
|
34
|
+
datetime: /^([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))$/,
|
35
|
+
// YYYY-MM-DD
|
36
|
+
date: /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))$/,
|
37
|
+
// HH:MM:SS
|
38
|
+
time: /^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/,
|
39
|
+
dateISO: /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/,
|
40
|
+
// MM/DD/YYYY
|
41
|
+
month_day_year: /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/,
|
42
|
+
// DD/MM/YYYY
|
43
|
+
day_month_year: /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/,
|
44
|
+
|
45
|
+
// #FFF or #FFFFFF
|
46
|
+
color: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/
|
47
|
+
},
|
48
|
+
validators: {
|
49
|
+
equalTo: function (el, required, parent) {
|
50
|
+
var from = document.getElementById(el.getAttribute(this.add_namespace('data-equalto'))).value,
|
51
|
+
to = el.value,
|
52
|
+
valid = (from === to);
|
53
|
+
|
54
|
+
return valid;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
},
|
58
|
+
|
59
|
+
timer: null,
|
60
|
+
|
61
|
+
init: function (scope, method, options) {
|
62
|
+
this.bindings(method, options);
|
63
|
+
},
|
64
|
+
|
65
|
+
events: function (scope) {
|
66
|
+
var self = this,
|
67
|
+
form = self.S(scope).attr('novalidate', 'novalidate'),
|
68
|
+
settings = form.data(this.attr_name(true) + '-init') || {};
|
69
|
+
|
70
|
+
this.invalid_attr = this.add_namespace('data-invalid');
|
71
|
+
|
72
|
+
form
|
73
|
+
.off('.abide')
|
74
|
+
.on('submit.fndtn.abide validate.fndtn.abide', function (e) {
|
75
|
+
var is_ajax = /ajax/i.test(self.S(this).attr(self.attr_name()));
|
76
|
+
return self.validate(self.S(this).find('input, textarea, select').get(), e, is_ajax);
|
77
|
+
})
|
78
|
+
.on('reset', function () {
|
79
|
+
return self.reset($(this));
|
80
|
+
})
|
81
|
+
.find('input, textarea, select')
|
82
|
+
.off('.abide')
|
83
|
+
.on('blur.fndtn.abide change.fndtn.abide', function (e) {
|
84
|
+
if (settings.validate_on_blur === true) {
|
85
|
+
self.validate([this], e);
|
86
|
+
}
|
87
|
+
})
|
88
|
+
.on('keydown.fndtn.abide', function (e) {
|
89
|
+
if (settings.live_validate === true && e.which != 9) {
|
90
|
+
clearTimeout(self.timer);
|
91
|
+
self.timer = setTimeout(function () {
|
92
|
+
self.validate([this], e);
|
93
|
+
}.bind(this), settings.timeout);
|
94
|
+
}
|
95
|
+
});
|
96
|
+
},
|
97
|
+
|
98
|
+
reset: function (form) {
|
99
|
+
form.removeAttr(this.invalid_attr);
|
100
|
+
$(this.invalid_attr, form).removeAttr(this.invalid_attr);
|
101
|
+
$('.' + this.settings.error_class, form).not('small').removeClass(this.settings.error_class);
|
102
|
+
},
|
103
|
+
|
104
|
+
validate: function (els, e, is_ajax) {
|
105
|
+
var validations = this.parse_patterns(els),
|
106
|
+
validation_count = validations.length,
|
107
|
+
form = this.S(els[0]).closest('form'),
|
108
|
+
submit_event = /submit/.test(e.type);
|
109
|
+
|
110
|
+
// Has to count up to make sure the focus gets applied to the top error
|
111
|
+
for (var i = 0; i < validation_count; i++) {
|
112
|
+
if (!validations[i] && (submit_event || is_ajax)) {
|
113
|
+
if (this.settings.focus_on_invalid) els[i].focus();
|
114
|
+
form.trigger('invalid').trigger('invalid.fndtn.abide');
|
115
|
+
this.S(els[i]).closest('form').attr(this.invalid_attr, '');
|
116
|
+
return false;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
if (submit_event || is_ajax) {
|
121
|
+
form.trigger('valid').trigger('valid.fndtn.abide');
|
122
|
+
}
|
123
|
+
|
124
|
+
form.removeAttr(this.invalid_attr);
|
125
|
+
|
126
|
+
if (is_ajax) return false;
|
127
|
+
|
128
|
+
return true;
|
129
|
+
},
|
130
|
+
|
131
|
+
parse_patterns: function (els) {
|
132
|
+
var i = els.length,
|
133
|
+
el_patterns = [];
|
134
|
+
|
135
|
+
while (i--) {
|
136
|
+
el_patterns.push(this.pattern(els[i]));
|
137
|
+
}
|
138
|
+
|
139
|
+
return this.check_validation_and_apply_styles(el_patterns);
|
140
|
+
},
|
141
|
+
|
142
|
+
pattern: function (el) {
|
143
|
+
var type = el.getAttribute('type'),
|
144
|
+
required = typeof el.getAttribute('required') === 'string';
|
145
|
+
|
146
|
+
var pattern = el.getAttribute('pattern') || '';
|
147
|
+
|
148
|
+
if (this.settings.patterns.hasOwnProperty(pattern) && pattern.length > 0) {
|
149
|
+
return [el, this.settings.patterns[pattern], required];
|
150
|
+
} else if (pattern.length > 0) {
|
151
|
+
return [el, new RegExp(pattern), required];
|
152
|
+
}
|
153
|
+
|
154
|
+
if (this.settings.patterns.hasOwnProperty(type)) {
|
155
|
+
return [el, this.settings.patterns[type], required];
|
156
|
+
}
|
157
|
+
|
158
|
+
pattern = /.*/;
|
159
|
+
|
160
|
+
return [el, pattern, required];
|
161
|
+
},
|
162
|
+
|
163
|
+
// TODO: Break this up into smaller methods, getting hard to read.
|
164
|
+
check_validation_and_apply_styles: function (el_patterns) {
|
165
|
+
var i = el_patterns.length,
|
166
|
+
validations = [],
|
167
|
+
form = this.S(el_patterns[0][0]).closest('[data-' + this.attr_name(true) + ']'),
|
168
|
+
settings = form.data(this.attr_name(true) + '-init') || {};
|
169
|
+
while (i--) {
|
170
|
+
var el = el_patterns[i][0],
|
171
|
+
required = el_patterns[i][2],
|
172
|
+
value = el.value.trim(),
|
173
|
+
direct_parent = this.S(el).parent(),
|
174
|
+
validator = el.getAttribute(this.add_namespace('data-abide-validator')),
|
175
|
+
is_radio = el.type === "radio",
|
176
|
+
is_checkbox = el.type === "checkbox",
|
177
|
+
label = this.S('label[for="' + el.getAttribute('id') + '"]'),
|
178
|
+
valid_length = (required) ? (el.value.length > 0) : true,
|
179
|
+
el_validations = [];
|
180
|
+
|
181
|
+
var parent, valid;
|
182
|
+
|
183
|
+
// support old way to do equalTo validations
|
184
|
+
if (el.getAttribute(this.add_namespace('data-equalto'))) {
|
185
|
+
validator = "equalTo"
|
186
|
+
}
|
187
|
+
|
188
|
+
if (!direct_parent.is('label')) {
|
189
|
+
parent = direct_parent;
|
190
|
+
} else {
|
191
|
+
parent = direct_parent.parent();
|
192
|
+
}
|
193
|
+
|
194
|
+
if (validator) {
|
195
|
+
valid = this.settings.validators[validator].apply(this, [el, required, parent]);
|
196
|
+
el_validations.push(valid);
|
197
|
+
}
|
198
|
+
|
199
|
+
if (is_radio && required) {
|
200
|
+
el_validations.push(this.valid_radio(el, required));
|
201
|
+
} else if (is_checkbox && required) {
|
202
|
+
el_validations.push(this.valid_checkbox(el, required));
|
203
|
+
} else {
|
204
|
+
|
205
|
+
if (el_patterns[i][1].test(value) && valid_length ||
|
206
|
+
!required && el.value.length < 1 || $(el).attr('disabled')) {
|
207
|
+
el_validations.push(true);
|
208
|
+
} else {
|
209
|
+
el_validations.push(false);
|
210
|
+
}
|
211
|
+
|
212
|
+
el_validations = [el_validations.every(function (valid) {
|
213
|
+
return valid;
|
214
|
+
})];
|
215
|
+
|
216
|
+
if (el_validations[0]) {
|
217
|
+
this.S(el).removeAttr(this.invalid_attr);
|
218
|
+
el.setAttribute('aria-invalid', 'false');
|
219
|
+
el.removeAttribute('aria-describedby');
|
220
|
+
parent.removeClass(this.settings.error_class);
|
221
|
+
if (label.length > 0 && this.settings.error_labels) {
|
222
|
+
label.removeClass(this.settings.error_class).removeAttr('role');
|
223
|
+
}
|
224
|
+
$(el).triggerHandler('valid');
|
225
|
+
} else {
|
226
|
+
this.S(el).attr(this.invalid_attr, '');
|
227
|
+
el.setAttribute('aria-invalid', 'true');
|
228
|
+
|
229
|
+
// Try to find the error associated with the input
|
230
|
+
var errorElem = parent.find('small.' + this.settings.error_class, 'span.' + this.settings.error_class);
|
231
|
+
var errorID = errorElem.length > 0 ? errorElem[0].id : "";
|
232
|
+
if (errorID.length > 0) el.setAttribute('aria-describedby', errorID);
|
233
|
+
|
234
|
+
// el.setAttribute('aria-describedby', $(el).find('.error')[0].id);
|
235
|
+
parent.addClass(this.settings.error_class);
|
236
|
+
if (label.length > 0 && this.settings.error_labels) {
|
237
|
+
label.addClass(this.settings.error_class).attr('role', 'alert');
|
238
|
+
}
|
239
|
+
$(el).triggerHandler('invalid');
|
240
|
+
}
|
241
|
+
}
|
242
|
+
validations.push(el_validations[0]);
|
243
|
+
}
|
244
|
+
validations = [validations.every(function (valid) {
|
245
|
+
return valid;
|
246
|
+
})];
|
247
|
+
return validations;
|
248
|
+
},
|
249
|
+
|
250
|
+
valid_checkbox: function (el, required) {
|
251
|
+
var el = this.S(el),
|
252
|
+
valid = (el.is(':checked') || !required);
|
253
|
+
|
254
|
+
if (valid) {
|
255
|
+
el.removeAttr(this.invalid_attr).parent().removeClass(this.settings.error_class);
|
256
|
+
} else {
|
257
|
+
el.attr(this.invalid_attr, '').parent().addClass(this.settings.error_class);
|
258
|
+
}
|
259
|
+
|
260
|
+
return valid;
|
261
|
+
},
|
262
|
+
|
263
|
+
valid_radio: function (el, required) {
|
264
|
+
var name = el.getAttribute('name'),
|
265
|
+
group = this.S(el).closest('[data-' + this.attr_name(true) + ']').find("[name='" + name + "']"),
|
266
|
+
count = group.length,
|
267
|
+
valid = false;
|
268
|
+
|
269
|
+
// Has to count up to make sure the focus gets applied to the top error
|
270
|
+
for (var i = 0; i < count; i++) {
|
271
|
+
if (group[i].checked) valid = true;
|
272
|
+
}
|
273
|
+
|
274
|
+
// Has to count up to make sure the focus gets applied to the top error
|
275
|
+
for (var i = 0; i < count; i++) {
|
276
|
+
if (valid) {
|
277
|
+
this.S(group[i]).removeAttr(this.invalid_attr).parent().removeClass(this.settings.error_class);
|
278
|
+
} else {
|
279
|
+
this.S(group[i]).attr(this.invalid_attr, '').parent().addClass(this.settings.error_class);
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
283
|
+
return valid;
|
284
|
+
},
|
285
|
+
|
286
|
+
valid_equal: function (el, required, parent) {
|
287
|
+
var from = document.getElementById(el.getAttribute(this.add_namespace('data-equalto'))).value,
|
288
|
+
to = el.value,
|
289
|
+
valid = (from === to);
|
290
|
+
|
291
|
+
if (valid) {
|
292
|
+
this.S(el).removeAttr(this.invalid_attr);
|
293
|
+
parent.removeClass(this.settings.error_class);
|
294
|
+
if (label.length > 0 && settings.error_labels) label.removeClass(this.settings.error_class);
|
295
|
+
} else {
|
296
|
+
this.S(el).attr(this.invalid_attr, '');
|
297
|
+
parent.addClass(this.settings.error_class);
|
298
|
+
if (label.length > 0 && settings.error_labels) label.addClass(this.settings.error_class);
|
299
|
+
}
|
300
|
+
|
301
|
+
return valid;
|
302
|
+
},
|
303
|
+
|
304
|
+
valid_oneof: function (el, required, parent, doNotValidateOthers) {
|
305
|
+
var el = this.S(el),
|
306
|
+
others = this.S('[' + this.add_namespace('data-oneof') + ']'),
|
307
|
+
valid = others.filter(':checked').length > 0;
|
308
|
+
|
309
|
+
if (valid) {
|
310
|
+
el.removeAttr(this.invalid_attr).parent().removeClass(this.settings.error_class);
|
311
|
+
} else {
|
312
|
+
el.attr(this.invalid_attr, '').parent().addClass(this.settings.error_class);
|
313
|
+
}
|
314
|
+
|
315
|
+
if (!doNotValidateOthers) {
|
316
|
+
var _this = this;
|
317
|
+
others.each(function () {
|
318
|
+
_this.valid_oneof.call(_this, this, null, null, true);
|
319
|
+
});
|
320
|
+
}
|
321
|
+
|
322
|
+
return valid;
|
323
|
+
}
|
324
|
+
};
|
325
|
+
}(jQuery, window, window.document));
|
@@ -0,0 +1,71 @@
|
|
1
|
+
;
|
2
|
+
(function ($, window, document, undefined) {
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
Foundation.libs.accordion = {
|
6
|
+
name: 'accordion',
|
7
|
+
|
8
|
+
version: '5.5.0',
|
9
|
+
|
10
|
+
settings: {
|
11
|
+
content_class: 'content',
|
12
|
+
active_class: 'active',
|
13
|
+
multi_expand: false,
|
14
|
+
toggleable: true,
|
15
|
+
callback: function () {
|
16
|
+
}
|
17
|
+
},
|
18
|
+
|
19
|
+
init: function (scope, method, options) {
|
20
|
+
this.bindings(method, options);
|
21
|
+
},
|
22
|
+
|
23
|
+
events: function () {
|
24
|
+
var self = this;
|
25
|
+
var S = this.S;
|
26
|
+
S(this.scope)
|
27
|
+
.off('.fndtn.accordion')
|
28
|
+
.on('click.fndtn.accordion', '[' + this.attr_name() + '] > .accordion-navigation > a', function (e) {
|
29
|
+
var accordion = S(this).closest('[' + self.attr_name() + ']'),
|
30
|
+
groupSelector = self.attr_name() + '=' + accordion.attr(self.attr_name()),
|
31
|
+
settings = accordion.data(self.attr_name(true) + '-init') || self.settings,
|
32
|
+
target = S('#' + this.href.split('#')[1]),
|
33
|
+
aunts = $('> .accordion-navigation', accordion),
|
34
|
+
siblings = aunts.children('.' + settings.content_class),
|
35
|
+
active_content = siblings.filter('.' + settings.active_class);
|
36
|
+
|
37
|
+
e.preventDefault();
|
38
|
+
|
39
|
+
if (accordion.attr(self.attr_name())) {
|
40
|
+
siblings = siblings.add('[' + groupSelector + '] dd > ' + '.' + settings.content_class);
|
41
|
+
aunts = aunts.add('[' + groupSelector + '] .accordion-navigation');
|
42
|
+
}
|
43
|
+
|
44
|
+
if (settings.toggleable && target.is(active_content)) {
|
45
|
+
target.parent('.accordion-navigation').toggleClass(settings.active_class, false);
|
46
|
+
target.toggleClass(settings.active_class, false);
|
47
|
+
settings.callback(target);
|
48
|
+
target.triggerHandler('toggled', [accordion]);
|
49
|
+
accordion.triggerHandler('toggled', [target]);
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
|
53
|
+
if (!settings.multi_expand) {
|
54
|
+
siblings.removeClass(settings.active_class);
|
55
|
+
aunts.removeClass(settings.active_class);
|
56
|
+
}
|
57
|
+
|
58
|
+
target.addClass(settings.active_class).parent().addClass(settings.active_class);
|
59
|
+
settings.callback(target);
|
60
|
+
target.triggerHandler('toggled', [accordion]);
|
61
|
+
accordion.triggerHandler('toggled', [target]);
|
62
|
+
});
|
63
|
+
},
|
64
|
+
|
65
|
+
off: function () {
|
66
|
+
},
|
67
|
+
|
68
|
+
reflow: function () {
|
69
|
+
}
|
70
|
+
};
|
71
|
+
}(jQuery, window, window.document));
|
@@ -0,0 +1,46 @@
|
|
1
|
+
;
|
2
|
+
(function ($, window, document, undefined) {
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
Foundation.libs.alert = {
|
6
|
+
name: 'alert',
|
7
|
+
|
8
|
+
version: '5.5.0',
|
9
|
+
|
10
|
+
settings: {
|
11
|
+
callback: function () {
|
12
|
+
}
|
13
|
+
},
|
14
|
+
|
15
|
+
init: function (scope, method, options) {
|
16
|
+
this.bindings(method, options);
|
17
|
+
},
|
18
|
+
|
19
|
+
events: function () {
|
20
|
+
var self = this,
|
21
|
+
S = this.S;
|
22
|
+
|
23
|
+
$(this.scope).off('.alert').on('click.fndtn.alert', '[' + this.attr_name() + '] .close', function (e) {
|
24
|
+
var alertBox = S(this).closest('[' + self.attr_name() + ']'),
|
25
|
+
settings = alertBox.data(self.attr_name(true) + '-init') || self.settings;
|
26
|
+
|
27
|
+
e.preventDefault();
|
28
|
+
if (Modernizr.csstransitions) {
|
29
|
+
alertBox.addClass('alert-close');
|
30
|
+
alertBox.on('transitionend webkitTransitionEnd oTransitionEnd', function (e) {
|
31
|
+
S(this).trigger('close').trigger('close.fndtn.alert').remove();
|
32
|
+
settings.callback();
|
33
|
+
});
|
34
|
+
} else {
|
35
|
+
alertBox.fadeOut(300, function () {
|
36
|
+
S(this).trigger('close').trigger('close.fndtn.alert').remove();
|
37
|
+
settings.callback();
|
38
|
+
});
|
39
|
+
}
|
40
|
+
});
|
41
|
+
},
|
42
|
+
|
43
|
+
reflow: function () {
|
44
|
+
}
|
45
|
+
};
|
46
|
+
}(jQuery, window, window.document));
|
@@ -0,0 +1,573 @@
|
|
1
|
+
;
|
2
|
+
(function ($, window, document, undefined) {
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
Foundation.libs.clearing = {
|
6
|
+
name: 'clearing',
|
7
|
+
|
8
|
+
version: '5.5.0',
|
9
|
+
|
10
|
+
settings: {
|
11
|
+
templates: {
|
12
|
+
viewing: '<a href="#" class="clearing-close">×</a>' +
|
13
|
+
'<div class="visible-img" style="display: none"><div class="clearing-touch-label"></div><img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D" alt="" />' +
|
14
|
+
'<p class="clearing-caption"></p><a href="#" class="clearing-main-prev"><span></span></a>' +
|
15
|
+
'<a href="#" class="clearing-main-next"><span></span></a></div>'
|
16
|
+
},
|
17
|
+
|
18
|
+
// comma delimited list of selectors that, on click, will close clearing,
|
19
|
+
// add 'div.clearing-blackout, div.visible-img' to close on background click
|
20
|
+
close_selectors: '.clearing-close, div.clearing-blackout',
|
21
|
+
|
22
|
+
// Default to the entire li element.
|
23
|
+
open_selectors: '',
|
24
|
+
|
25
|
+
// Image will be skipped in carousel.
|
26
|
+
skip_selector: '',
|
27
|
+
|
28
|
+
touch_label: '',
|
29
|
+
|
30
|
+
// event initializers and locks
|
31
|
+
init: false,
|
32
|
+
locked: false
|
33
|
+
},
|
34
|
+
|
35
|
+
init: function (scope, method, options) {
|
36
|
+
var self = this;
|
37
|
+
Foundation.inherit(this, 'throttle image_loaded');
|
38
|
+
|
39
|
+
this.bindings(method, options);
|
40
|
+
|
41
|
+
if (self.S(this.scope).is('[' + this.attr_name() + ']')) {
|
42
|
+
this.assemble(self.S('li', this.scope));
|
43
|
+
} else {
|
44
|
+
self.S('[' + this.attr_name() + ']', this.scope).each(function () {
|
45
|
+
self.assemble(self.S('li', this));
|
46
|
+
});
|
47
|
+
}
|
48
|
+
},
|
49
|
+
|
50
|
+
events: function (scope) {
|
51
|
+
var self = this,
|
52
|
+
S = self.S,
|
53
|
+
$scroll_container = $('.scroll-container');
|
54
|
+
|
55
|
+
if ($scroll_container.length > 0) {
|
56
|
+
this.scope = $scroll_container;
|
57
|
+
}
|
58
|
+
|
59
|
+
S(this.scope)
|
60
|
+
.off('.clearing')
|
61
|
+
.on('click.fndtn.clearing', 'ul[' + this.attr_name() + '] li ' + this.settings.open_selectors,
|
62
|
+
function (e, current, target) {
|
63
|
+
var current = current || S(this),
|
64
|
+
target = target || current,
|
65
|
+
next = current.next('li'),
|
66
|
+
settings = current.closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init'),
|
67
|
+
image = S(e.target);
|
68
|
+
|
69
|
+
e.preventDefault();
|
70
|
+
|
71
|
+
if (!settings) {
|
72
|
+
self.init();
|
73
|
+
settings = current.closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
|
74
|
+
}
|
75
|
+
|
76
|
+
// if clearing is open and the current image is
|
77
|
+
// clicked, go to the next image in sequence
|
78
|
+
if (target.hasClass('visible') &&
|
79
|
+
current[0] === target[0] &&
|
80
|
+
next.length > 0 && self.is_open(current)) {
|
81
|
+
target = next;
|
82
|
+
image = S('img', target);
|
83
|
+
}
|
84
|
+
|
85
|
+
// set current and target to the clicked li if not otherwise defined.
|
86
|
+
self.open(image, current, target);
|
87
|
+
self.update_paddles(target);
|
88
|
+
})
|
89
|
+
|
90
|
+
.on('click.fndtn.clearing', '.clearing-main-next',
|
91
|
+
function (e) {
|
92
|
+
self.nav(e, 'next')
|
93
|
+
})
|
94
|
+
.on('click.fndtn.clearing', '.clearing-main-prev',
|
95
|
+
function (e) {
|
96
|
+
self.nav(e, 'prev')
|
97
|
+
})
|
98
|
+
.on('click.fndtn.clearing', this.settings.close_selectors,
|
99
|
+
function (e) {
|
100
|
+
Foundation.libs.clearing.close(e, this)
|
101
|
+
});
|
102
|
+
|
103
|
+
$(document).on('keydown.fndtn.clearing',
|
104
|
+
function (e) {
|
105
|
+
self.keydown(e)
|
106
|
+
});
|
107
|
+
|
108
|
+
S(window).off('.clearing').on('resize.fndtn.clearing',
|
109
|
+
function () {
|
110
|
+
self.resize()
|
111
|
+
});
|
112
|
+
|
113
|
+
this.swipe_events(scope);
|
114
|
+
},
|
115
|
+
|
116
|
+
swipe_events: function (scope) {
|
117
|
+
var self = this,
|
118
|
+
S = self.S;
|
119
|
+
|
120
|
+
S(this.scope)
|
121
|
+
.on('touchstart.fndtn.clearing', '.visible-img', function (e) {
|
122
|
+
if (!e.touches) {
|
123
|
+
e = e.originalEvent;
|
124
|
+
}
|
125
|
+
var data = {
|
126
|
+
start_page_x: e.touches[0].pageX,
|
127
|
+
start_page_y: e.touches[0].pageY,
|
128
|
+
start_time: (new Date()).getTime(),
|
129
|
+
delta_x: 0,
|
130
|
+
is_scrolling: undefined
|
131
|
+
};
|
132
|
+
|
133
|
+
S(this).data('swipe-transition', data);
|
134
|
+
e.stopPropagation();
|
135
|
+
})
|
136
|
+
.on('touchmove.fndtn.clearing', '.visible-img', function (e) {
|
137
|
+
if (!e.touches) {
|
138
|
+
e = e.originalEvent;
|
139
|
+
}
|
140
|
+
// Ignore pinch/zoom events
|
141
|
+
if (e.touches.length > 1 || e.scale && e.scale !== 1) return;
|
142
|
+
|
143
|
+
var data = S(this).data('swipe-transition');
|
144
|
+
|
145
|
+
if (typeof data === 'undefined') {
|
146
|
+
data = {};
|
147
|
+
}
|
148
|
+
|
149
|
+
data.delta_x = e.touches[0].pageX - data.start_page_x;
|
150
|
+
|
151
|
+
if (Foundation.rtl) {
|
152
|
+
data.delta_x = -data.delta_x;
|
153
|
+
}
|
154
|
+
|
155
|
+
if (typeof data.is_scrolling === 'undefined') {
|
156
|
+
data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
|
157
|
+
}
|
158
|
+
|
159
|
+
if (!data.is_scrolling && !data.active) {
|
160
|
+
e.preventDefault();
|
161
|
+
var direction = (data.delta_x < 0) ? 'next' : 'prev';
|
162
|
+
data.active = true;
|
163
|
+
self.nav(e, direction);
|
164
|
+
}
|
165
|
+
})
|
166
|
+
.on('touchend.fndtn.clearing', '.visible-img', function (e) {
|
167
|
+
S(this).data('swipe-transition', {});
|
168
|
+
e.stopPropagation();
|
169
|
+
});
|
170
|
+
},
|
171
|
+
|
172
|
+
assemble: function ($li) {
|
173
|
+
var $el = $li.parent();
|
174
|
+
|
175
|
+
if ($el.parent().hasClass('carousel')) {
|
176
|
+
return;
|
177
|
+
}
|
178
|
+
|
179
|
+
$el.after('<div id="foundationClearingHolder"></div>');
|
180
|
+
|
181
|
+
var grid = $el.detach(),
|
182
|
+
grid_outerHTML = '';
|
183
|
+
|
184
|
+
if (grid[0] == null) {
|
185
|
+
return;
|
186
|
+
} else {
|
187
|
+
grid_outerHTML = grid[0].outerHTML;
|
188
|
+
}
|
189
|
+
|
190
|
+
var holder = this.S('#foundationClearingHolder'),
|
191
|
+
settings = $el.data(this.attr_name(true) + '-init'),
|
192
|
+
data = {
|
193
|
+
grid: '<div class="carousel">' + grid_outerHTML + '</div>',
|
194
|
+
viewing: settings.templates.viewing
|
195
|
+
},
|
196
|
+
wrapper = '<div class="clearing-assembled"><div>' + data.viewing +
|
197
|
+
data.grid + '</div></div>',
|
198
|
+
touch_label = this.settings.touch_label;
|
199
|
+
|
200
|
+
if (Modernizr.touch) {
|
201
|
+
wrapper = $(wrapper).find('.clearing-touch-label').html(touch_label).end();
|
202
|
+
}
|
203
|
+
|
204
|
+
holder.after(wrapper).remove();
|
205
|
+
},
|
206
|
+
|
207
|
+
open: function ($image, current, target) {
|
208
|
+
var self = this,
|
209
|
+
body = $(document.body),
|
210
|
+
root = target.closest('.clearing-assembled'),
|
211
|
+
container = self.S('div', root).first(),
|
212
|
+
visible_image = self.S('.visible-img', container),
|
213
|
+
image = self.S('img', visible_image).not($image),
|
214
|
+
label = self.S('.clearing-touch-label', container),
|
215
|
+
error = false;
|
216
|
+
|
217
|
+
// Event to disable scrolling on touch devices when Clearing is activated
|
218
|
+
$('body').on('touchmove', function (e) {
|
219
|
+
e.preventDefault();
|
220
|
+
});
|
221
|
+
|
222
|
+
image.error(function () {
|
223
|
+
error = true;
|
224
|
+
});
|
225
|
+
|
226
|
+
function startLoad() {
|
227
|
+
setTimeout(function () {
|
228
|
+
this.image_loaded(image, function () {
|
229
|
+
if (image.outerWidth() === 1 && !error) {
|
230
|
+
startLoad.call(this);
|
231
|
+
} else {
|
232
|
+
cb.call(this, image);
|
233
|
+
}
|
234
|
+
}.bind(this));
|
235
|
+
}.bind(this), 100);
|
236
|
+
}
|
237
|
+
|
238
|
+
function cb(image) {
|
239
|
+
var $image = $(image);
|
240
|
+
$image.css('visibility', 'visible');
|
241
|
+
// toggle the gallery
|
242
|
+
body.css('overflow', 'hidden');
|
243
|
+
root.addClass('clearing-blackout');
|
244
|
+
container.addClass('clearing-container');
|
245
|
+
visible_image.show();
|
246
|
+
this.fix_height(target)
|
247
|
+
.caption(self.S('.clearing-caption', visible_image), self.S('img', target))
|
248
|
+
.center_and_label(image, label)
|
249
|
+
.shift(current, target, function () {
|
250
|
+
target.closest('li').siblings().removeClass('visible');
|
251
|
+
target.closest('li').addClass('visible');
|
252
|
+
});
|
253
|
+
visible_image.trigger('opened.fndtn.clearing')
|
254
|
+
}
|
255
|
+
|
256
|
+
if (!this.locked()) {
|
257
|
+
visible_image.trigger('open.fndtn.clearing');
|
258
|
+
// set the image to the selected thumbnail
|
259
|
+
image
|
260
|
+
.attr('src', this.load($image))
|
261
|
+
.css('visibility', 'hidden');
|
262
|
+
|
263
|
+
startLoad.call(this);
|
264
|
+
}
|
265
|
+
},
|
266
|
+
|
267
|
+
close: function (e, el) {
|
268
|
+
e.preventDefault();
|
269
|
+
|
270
|
+
var root = (function (target) {
|
271
|
+
if (/blackout/.test(target.selector)) {
|
272
|
+
return target;
|
273
|
+
} else {
|
274
|
+
return target.closest('.clearing-blackout');
|
275
|
+
}
|
276
|
+
}($(el))),
|
277
|
+
body = $(document.body), container, visible_image;
|
278
|
+
|
279
|
+
if (el === e.target && root) {
|
280
|
+
body.css('overflow', '');
|
281
|
+
container = $('div', root).first();
|
282
|
+
visible_image = $('.visible-img', container);
|
283
|
+
visible_image.trigger('close.fndtn.clearing');
|
284
|
+
this.settings.prev_index = 0;
|
285
|
+
$('ul[' + this.attr_name() + ']', root)
|
286
|
+
.attr('style', '').closest('.clearing-blackout')
|
287
|
+
.removeClass('clearing-blackout');
|
288
|
+
container.removeClass('clearing-container');
|
289
|
+
visible_image.hide();
|
290
|
+
visible_image.trigger('closed.fndtn.clearing');
|
291
|
+
}
|
292
|
+
|
293
|
+
// Event to re-enable scrolling on touch devices
|
294
|
+
$('body').off('touchmove');
|
295
|
+
|
296
|
+
return false;
|
297
|
+
},
|
298
|
+
|
299
|
+
is_open: function (current) {
|
300
|
+
return current.parent().prop('style').length > 0;
|
301
|
+
},
|
302
|
+
|
303
|
+
keydown: function (e) {
|
304
|
+
var clearing = $('.clearing-blackout ul[' + this.attr_name() + ']'),
|
305
|
+
NEXT_KEY = this.rtl ? 37 : 39,
|
306
|
+
PREV_KEY = this.rtl ? 39 : 37,
|
307
|
+
ESC_KEY = 27;
|
308
|
+
|
309
|
+
if (e.which === NEXT_KEY) this.go(clearing, 'next');
|
310
|
+
if (e.which === PREV_KEY) this.go(clearing, 'prev');
|
311
|
+
if (e.which === ESC_KEY) this.S('a.clearing-close').trigger('click').trigger('click.fndtn.clearing');
|
312
|
+
},
|
313
|
+
|
314
|
+
nav: function (e, direction) {
|
315
|
+
var clearing = $('ul[' + this.attr_name() + ']', '.clearing-blackout');
|
316
|
+
|
317
|
+
e.preventDefault();
|
318
|
+
this.go(clearing, direction);
|
319
|
+
},
|
320
|
+
|
321
|
+
resize: function () {
|
322
|
+
var image = $('img', '.clearing-blackout .visible-img'),
|
323
|
+
label = $('.clearing-touch-label', '.clearing-blackout');
|
324
|
+
|
325
|
+
if (image.length) {
|
326
|
+
this.center_and_label(image, label);
|
327
|
+
image.trigger('resized.fndtn.clearing')
|
328
|
+
}
|
329
|
+
},
|
330
|
+
|
331
|
+
// visual adjustments
|
332
|
+
fix_height: function (target) {
|
333
|
+
var lis = target.parent().children(),
|
334
|
+
self = this;
|
335
|
+
|
336
|
+
lis.each(function () {
|
337
|
+
var li = self.S(this),
|
338
|
+
image = li.find('img');
|
339
|
+
|
340
|
+
if (li.height() > image.outerHeight()) {
|
341
|
+
li.addClass('fix-height');
|
342
|
+
}
|
343
|
+
})
|
344
|
+
.closest('ul')
|
345
|
+
.width(lis.length * 100 + '%');
|
346
|
+
|
347
|
+
return this;
|
348
|
+
},
|
349
|
+
|
350
|
+
update_paddles: function (target) {
|
351
|
+
target = target.closest('li');
|
352
|
+
var visible_image = target
|
353
|
+
.closest('.carousel')
|
354
|
+
.siblings('.visible-img');
|
355
|
+
|
356
|
+
if (target.next().length > 0) {
|
357
|
+
this.S('.clearing-main-next', visible_image).removeClass('disabled');
|
358
|
+
} else {
|
359
|
+
this.S('.clearing-main-next', visible_image).addClass('disabled');
|
360
|
+
}
|
361
|
+
|
362
|
+
if (target.prev().length > 0) {
|
363
|
+
this.S('.clearing-main-prev', visible_image).removeClass('disabled');
|
364
|
+
} else {
|
365
|
+
this.S('.clearing-main-prev', visible_image).addClass('disabled');
|
366
|
+
}
|
367
|
+
},
|
368
|
+
|
369
|
+
center_and_label: function (target, label) {
|
370
|
+
if (!this.rtl) {
|
371
|
+
target.css({
|
372
|
+
marginLeft: -(target.outerWidth() / 2),
|
373
|
+
marginTop: -(target.outerHeight() / 2)
|
374
|
+
});
|
375
|
+
|
376
|
+
if (label.length > 0) {
|
377
|
+
label.css({
|
378
|
+
marginLeft: -(label.outerWidth() / 2),
|
379
|
+
marginTop: -(target.outerHeight() / 2) - label.outerHeight() - 10
|
380
|
+
});
|
381
|
+
}
|
382
|
+
} else {
|
383
|
+
target.css({
|
384
|
+
marginRight: -(target.outerWidth() / 2),
|
385
|
+
marginTop: -(target.outerHeight() / 2),
|
386
|
+
left: 'auto',
|
387
|
+
right: '50%'
|
388
|
+
});
|
389
|
+
|
390
|
+
if (label.length > 0) {
|
391
|
+
label.css({
|
392
|
+
marginRight: -(label.outerWidth() / 2),
|
393
|
+
marginTop: -(target.outerHeight() / 2) - label.outerHeight() - 10,
|
394
|
+
left: 'auto',
|
395
|
+
right: '50%'
|
396
|
+
});
|
397
|
+
}
|
398
|
+
}
|
399
|
+
return this;
|
400
|
+
},
|
401
|
+
|
402
|
+
// image loading and preloading
|
403
|
+
|
404
|
+
load: function ($image) {
|
405
|
+
var href;
|
406
|
+
|
407
|
+
if ($image[0].nodeName === 'A') {
|
408
|
+
href = $image.attr('href');
|
409
|
+
} else {
|
410
|
+
href = $image.closest('a').attr('href');
|
411
|
+
}
|
412
|
+
|
413
|
+
this.preload($image);
|
414
|
+
|
415
|
+
if (href) return href;
|
416
|
+
return $image.attr('src');
|
417
|
+
},
|
418
|
+
|
419
|
+
preload: function ($image) {
|
420
|
+
this
|
421
|
+
.img($image.closest('li').next())
|
422
|
+
.img($image.closest('li').prev());
|
423
|
+
},
|
424
|
+
|
425
|
+
img: function (img) {
|
426
|
+
if (img.length) {
|
427
|
+
var new_img = new Image(),
|
428
|
+
new_a = this.S('a', img);
|
429
|
+
|
430
|
+
if (new_a.length) {
|
431
|
+
new_img.src = new_a.attr('href');
|
432
|
+
} else {
|
433
|
+
new_img.src = this.S('img', img).attr('src');
|
434
|
+
}
|
435
|
+
}
|
436
|
+
return this;
|
437
|
+
},
|
438
|
+
|
439
|
+
// image caption
|
440
|
+
|
441
|
+
caption: function (container, $image) {
|
442
|
+
var caption = $image.attr('data-caption');
|
443
|
+
|
444
|
+
if (caption) {
|
445
|
+
container
|
446
|
+
.html(caption)
|
447
|
+
.show();
|
448
|
+
} else {
|
449
|
+
container
|
450
|
+
.text('')
|
451
|
+
.hide();
|
452
|
+
}
|
453
|
+
return this;
|
454
|
+
},
|
455
|
+
|
456
|
+
// directional methods
|
457
|
+
|
458
|
+
go: function ($ul, direction) {
|
459
|
+
var current = this.S('.visible', $ul),
|
460
|
+
target = current[direction]();
|
461
|
+
|
462
|
+
// Check for skip selector.
|
463
|
+
if (this.settings.skip_selector && target.find(this.settings.skip_selector).length != 0) {
|
464
|
+
target = target[direction]();
|
465
|
+
}
|
466
|
+
|
467
|
+
if (target.length) {
|
468
|
+
this.S('img', target)
|
469
|
+
.trigger('click', [current, target]).trigger('click.fndtn.clearing', [current, target])
|
470
|
+
.trigger('change.fndtn.clearing');
|
471
|
+
}
|
472
|
+
},
|
473
|
+
|
474
|
+
shift: function (current, target, callback) {
|
475
|
+
var clearing = target.parent(),
|
476
|
+
old_index = this.settings.prev_index || target.index(),
|
477
|
+
direction = this.direction(clearing, current, target),
|
478
|
+
dir = this.rtl ? 'right' : 'left',
|
479
|
+
left = parseInt(clearing.css('left'), 10),
|
480
|
+
width = target.outerWidth(),
|
481
|
+
skip_shift;
|
482
|
+
|
483
|
+
var dir_obj = {};
|
484
|
+
|
485
|
+
// we use jQuery animate instead of CSS transitions because we
|
486
|
+
// need a callback to unlock the next animation
|
487
|
+
// needs support for RTL **
|
488
|
+
if (target.index() !== old_index && !/skip/.test(direction)) {
|
489
|
+
if (/left/.test(direction)) {
|
490
|
+
this.lock();
|
491
|
+
dir_obj[dir] = left + width;
|
492
|
+
clearing.animate(dir_obj, 300, this.unlock());
|
493
|
+
} else if (/right/.test(direction)) {
|
494
|
+
this.lock();
|
495
|
+
dir_obj[dir] = left - width;
|
496
|
+
clearing.animate(dir_obj, 300, this.unlock());
|
497
|
+
}
|
498
|
+
} else if (/skip/.test(direction)) {
|
499
|
+
// the target image is not adjacent to the current image, so
|
500
|
+
// do we scroll right or not
|
501
|
+
skip_shift = target.index() - this.settings.up_count;
|
502
|
+
this.lock();
|
503
|
+
|
504
|
+
if (skip_shift > 0) {
|
505
|
+
dir_obj[dir] = -(skip_shift * width);
|
506
|
+
clearing.animate(dir_obj, 300, this.unlock());
|
507
|
+
} else {
|
508
|
+
dir_obj[dir] = 0;
|
509
|
+
clearing.animate(dir_obj, 300, this.unlock());
|
510
|
+
}
|
511
|
+
}
|
512
|
+
|
513
|
+
callback();
|
514
|
+
},
|
515
|
+
|
516
|
+
direction: function ($el, current, target) {
|
517
|
+
var lis = this.S('li', $el),
|
518
|
+
li_width = lis.outerWidth() + (lis.outerWidth() / 4),
|
519
|
+
up_count = Math.floor(this.S('.clearing-container').outerWidth() / li_width) - 1,
|
520
|
+
target_index = lis.index(target),
|
521
|
+
response;
|
522
|
+
|
523
|
+
this.settings.up_count = up_count;
|
524
|
+
|
525
|
+
if (this.adjacent(this.settings.prev_index, target_index)) {
|
526
|
+
if ((target_index > up_count) && target_index > this.settings.prev_index) {
|
527
|
+
response = 'right';
|
528
|
+
} else if ((target_index > up_count - 1) && target_index <= this.settings.prev_index) {
|
529
|
+
response = 'left';
|
530
|
+
} else {
|
531
|
+
response = false;
|
532
|
+
}
|
533
|
+
} else {
|
534
|
+
response = 'skip';
|
535
|
+
}
|
536
|
+
|
537
|
+
this.settings.prev_index = target_index;
|
538
|
+
|
539
|
+
return response;
|
540
|
+
},
|
541
|
+
|
542
|
+
adjacent: function (current_index, target_index) {
|
543
|
+
for (var i = target_index + 1; i >= target_index - 1; i--) {
|
544
|
+
if (i === current_index) return true;
|
545
|
+
}
|
546
|
+
return false;
|
547
|
+
},
|
548
|
+
|
549
|
+
// lock management
|
550
|
+
|
551
|
+
lock: function () {
|
552
|
+
this.settings.locked = true;
|
553
|
+
},
|
554
|
+
|
555
|
+
unlock: function () {
|
556
|
+
this.settings.locked = false;
|
557
|
+
},
|
558
|
+
|
559
|
+
locked: function () {
|
560
|
+
return this.settings.locked;
|
561
|
+
},
|
562
|
+
|
563
|
+
off: function () {
|
564
|
+
this.S(this.scope).off('.fndtn.clearing');
|
565
|
+
this.S(window).off('.fndtn.clearing');
|
566
|
+
},
|
567
|
+
|
568
|
+
reflow: function () {
|
569
|
+
this.init();
|
570
|
+
}
|
571
|
+
};
|
572
|
+
|
573
|
+
}(jQuery, window, window.document));
|