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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +21 -21
  3. data/README.md +48 -48
  4. data/_layouts/default.html +96 -100
  5. data/assets/css/asciidoctor.css +397 -397
  6. data/assets/css/coderay.css +89 -89
  7. data/assets/css/custom.css +32 -0
  8. data/assets/css/font-awesome.css +1801 -1801
  9. data/assets/css/font-awesome.min.css +3 -3
  10. data/assets/css/foundation.css +8545 -8545
  11. data/assets/css/foundation.min.css +8331 -8331
  12. data/assets/css/normalize.css +427 -427
  13. data/assets/js/foundation.min.js +6069 -6069
  14. data/assets/js/foundation/foundation.abide.js +325 -325
  15. data/assets/js/foundation/foundation.accordion.js +71 -71
  16. data/assets/js/foundation/foundation.alert.js +46 -46
  17. data/assets/js/foundation/foundation.clearing.js +573 -573
  18. data/assets/js/foundation/foundation.dropdown.js +444 -444
  19. data/assets/js/foundation/foundation.equalizer.js +77 -77
  20. data/assets/js/foundation/foundation.interchange.js +349 -349
  21. data/assets/js/foundation/foundation.joyride.js +939 -939
  22. data/assets/js/foundation/foundation.js +691 -691
  23. data/assets/js/foundation/foundation.magellan.js +199 -199
  24. data/assets/js/foundation/foundation.offcanvas.js +154 -154
  25. data/assets/js/foundation/foundation.orbit.js +512 -512
  26. data/assets/js/foundation/foundation.reveal.js +455 -455
  27. data/assets/js/foundation/foundation.slider.js +268 -268
  28. data/assets/js/foundation/foundation.tab.js +221 -221
  29. data/assets/js/foundation/foundation.tooltip.js +301 -301
  30. data/assets/js/foundation/foundation.topbar.js +444 -444
  31. data/assets/js/toc.js +82 -82
  32. data/assets/js/vendor/fastclick.js +169 -169
  33. data/assets/js/vendor/jquery.cookie.js +57 -57
  34. data/assets/js/vendor/jquery.js +2339 -2339
  35. data/assets/js/vendor/modernizr.js +304 -304
  36. data/assets/js/vendor/placeholder.js +75 -75
  37. metadata +12 -11
@@ -1,455 +1,455 @@
1
- ;
2
- (function ($, window, document, undefined) {
3
- 'use strict';
4
-
5
- Foundation.libs.reveal = {
6
- name: 'reveal',
7
-
8
- version: '5.5.0',
9
-
10
- locked: false,
11
-
12
- settings: {
13
- animation: 'fadeAndPop',
14
- animation_speed: 250,
15
- close_on_background_click: true,
16
- close_on_esc: true,
17
- dismiss_modal_class: 'close-reveal-modal',
18
- bg_class: 'reveal-modal-bg',
19
- bg_root_element: 'body',
20
- root_element: 'body',
21
- open: function () {
22
- },
23
- opened: function () {
24
- },
25
- close: function () {
26
- },
27
- closed: function () {
28
- },
29
- bg: $('.reveal-modal-bg'),
30
- css: {
31
- open: {
32
- 'opacity': 0,
33
- 'visibility': 'visible',
34
- 'display': 'block'
35
- },
36
- close: {
37
- 'opacity': 1,
38
- 'visibility': 'hidden',
39
- 'display': 'none'
40
- }
41
- }
42
- },
43
-
44
- init: function (scope, method, options) {
45
- $.extend(true, this.settings, method, options);
46
- this.bindings(method, options);
47
- },
48
-
49
- events: function (scope) {
50
- var self = this,
51
- S = self.S;
52
-
53
- S(this.scope)
54
- .off('.reveal')
55
- .on('click.fndtn.reveal', '[' + this.add_namespace('data-reveal-id') + ']:not([disabled])', function (e) {
56
- e.preventDefault();
57
-
58
- if (!self.locked) {
59
- var element = S(this),
60
- ajax = element.data(self.data_attr('reveal-ajax'));
61
-
62
- self.locked = true;
63
-
64
- if (typeof ajax === 'undefined') {
65
- self.open.call(self, element);
66
- } else {
67
- var url = ajax === true ? element.attr('href') : ajax;
68
-
69
- self.open.call(self, element, {url: url});
70
- }
71
- }
72
- });
73
-
74
- S(document)
75
- .on('click.fndtn.reveal', this.close_targets(), function (e) {
76
-
77
- e.preventDefault();
78
-
79
- if (!self.locked) {
80
- var settings = S('[' + self.attr_name() + '].open').data(self.attr_name(true) + '-init') || self.settings,
81
- bg_clicked = S(e.target)[0] === S('.' + settings.bg_class)[0];
82
-
83
- if (bg_clicked) {
84
- if (settings.close_on_background_click) {
85
- e.stopPropagation();
86
- } else {
87
- return;
88
- }
89
- }
90
-
91
- self.locked = true;
92
- self.close.call(self, bg_clicked ? S('[' + self.attr_name() + '].open') : S(this).closest('[' + self.attr_name() + ']'));
93
- }
94
- });
95
-
96
- if (S('[' + self.attr_name() + ']', this.scope).length > 0) {
97
- S(this.scope)
98
- // .off('.reveal')
99
- .on('open.fndtn.reveal', this.settings.open)
100
- .on('opened.fndtn.reveal', this.settings.opened)
101
- .on('opened.fndtn.reveal', this.open_video)
102
- .on('close.fndtn.reveal', this.settings.close)
103
- .on('closed.fndtn.reveal', this.settings.closed)
104
- .on('closed.fndtn.reveal', this.close_video);
105
- } else {
106
- S(this.scope)
107
- // .off('.reveal')
108
- .on('open.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.open)
109
- .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.opened)
110
- .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.open_video)
111
- .on('close.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.close)
112
- .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.closed)
113
- .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.close_video);
114
- }
115
-
116
- return true;
117
- },
118
-
119
- // PATCH #3: turning on key up capture only when a reveal window is open
120
- key_up_on: function (scope) {
121
- var self = this;
122
-
123
- // PATCH #1: fixing multiple keyup event trigger from single key press
124
- self.S('body').off('keyup.fndtn.reveal').on('keyup.fndtn.reveal', function (event) {
125
- var open_modal = self.S('[' + self.attr_name() + '].open'),
126
- settings = open_modal.data(self.attr_name(true) + '-init') || self.settings;
127
- // PATCH #2: making sure that the close event can be called only while unlocked,
128
- // so that multiple keyup.fndtn.reveal events don't prevent clean closing of the reveal window.
129
- if (settings && event.which === 27 && settings.close_on_esc && !self.locked) { // 27 is the keycode for the Escape key
130
- self.close.call(self, open_modal);
131
- }
132
- });
133
-
134
- return true;
135
- },
136
-
137
- // PATCH #3: turning on key up capture only when a reveal window is open
138
- key_up_off: function (scope) {
139
- this.S('body').off('keyup.fndtn.reveal');
140
- return true;
141
- },
142
-
143
-
144
- open: function (target, ajax_settings) {
145
- var self = this,
146
- modal;
147
-
148
- if (target) {
149
- if (typeof target.selector !== 'undefined') {
150
- // Find the named node; only use the first one found, since the rest of the code assumes there's only one node
151
- modal = self.S('#' + target.data(self.data_attr('reveal-id'))).first();
152
- } else {
153
- modal = self.S(this.scope);
154
-
155
- ajax_settings = target;
156
- }
157
- } else {
158
- modal = self.S(this.scope);
159
- }
160
-
161
- var settings = modal.data(self.attr_name(true) + '-init');
162
- settings = settings || this.settings;
163
-
164
-
165
- if (modal.hasClass('open') && target.attr('data-reveal-id') == modal.attr('id')) {
166
- return self.close(modal);
167
- }
168
-
169
- if (!modal.hasClass('open')) {
170
- var open_modal = self.S('[' + self.attr_name() + '].open');
171
-
172
- if (typeof modal.data('css-top') === 'undefined') {
173
- modal.data('css-top', parseInt(modal.css('top'), 10))
174
- .data('offset', this.cache_offset(modal));
175
- }
176
-
177
- this.key_up_on(modal); // PATCH #3: turning on key up capture only when a reveal window is open
178
- modal.trigger('open').trigger('open.fndtn.reveal');
179
-
180
- if (open_modal.length < 1) {
181
- this.toggle_bg(modal, true);
182
- }
183
-
184
- if (typeof ajax_settings === 'string') {
185
- ajax_settings = {
186
- url: ajax_settings
187
- };
188
- }
189
-
190
- if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
191
- if (open_modal.length > 0) {
192
- this.hide(open_modal, settings.css.close);
193
- }
194
-
195
- this.show(modal, settings.css.open);
196
- } else {
197
- var old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
198
-
199
- $.extend(ajax_settings, {
200
- success: function (data, textStatus, jqXHR) {
201
- if ($.isFunction(old_success)) {
202
- var result = old_success(data, textStatus, jqXHR);
203
- if (typeof result == 'string') data = result;
204
- }
205
-
206
- modal.html(data);
207
- self.S(modal).foundation('section', 'reflow');
208
- self.S(modal).children().foundation();
209
-
210
- if (open_modal.length > 0) {
211
- self.hide(open_modal, settings.css.close);
212
- }
213
- self.show(modal, settings.css.open);
214
- }
215
- });
216
-
217
- $.ajax(ajax_settings);
218
- }
219
- }
220
- self.S(window).trigger('resize');
221
- },
222
-
223
- close: function (modal) {
224
- var modal = modal && modal.length ? modal : this.S(this.scope),
225
- open_modals = this.S('[' + this.attr_name() + '].open'),
226
- settings = modal.data(this.attr_name(true) + '-init') || this.settings;
227
-
228
- if (open_modals.length > 0) {
229
- this.locked = true;
230
- this.key_up_off(modal); // PATCH #3: turning on key up capture only when a reveal window is open
231
- modal.trigger('close').trigger('close.fndtn.reveal');
232
- this.toggle_bg(modal, false);
233
- this.hide(open_modals, settings.css.close, settings);
234
- }
235
- },
236
-
237
- close_targets: function () {
238
- var base = '.' + this.settings.dismiss_modal_class;
239
-
240
- if (this.settings.close_on_background_click) {
241
- return base + ', .' + this.settings.bg_class;
242
- }
243
-
244
- return base;
245
- },
246
-
247
- toggle_bg: function (el, modal, state) {
248
- var settings = el.data(this.attr_name(true) + '-init') || this.settings,
249
- bg_root_element = settings.bg_root_element; // Adding option to specify the background root element fixes scrolling issue
250
-
251
- if (this.S('.' + this.settings.bg_class).length === 0) {
252
- this.settings.bg = $('<div />', {'class': this.settings.bg_class})
253
- .appendTo(bg_root_element).hide();
254
- }
255
-
256
- var visible = this.settings.bg.filter(':visible').length > 0;
257
- if (state != visible) {
258
- if (state == undefined ? visible : !state) {
259
- this.hide(this.settings.bg);
260
- } else {
261
- this.show(this.settings.bg);
262
- }
263
- }
264
- },
265
-
266
- show: function (el, css) {
267
- // is modal
268
- if (css) {
269
- var settings = el.data(this.attr_name(true) + '-init') || this.settings,
270
- root_element = settings.root_element;
271
-
272
- if (el.parent(root_element).length === 0) {
273
- var placeholder = el.wrap('<div style="display: none;" />').parent();
274
-
275
- el.on('closed.fndtn.reveal.wrapped', function () {
276
- el.detach().appendTo(placeholder);
277
- el.unwrap().unbind('closed.fndtn.reveal.wrapped');
278
- });
279
-
280
- el.detach().appendTo(root_element);
281
- }
282
-
283
- var animData = getAnimationData(settings.animation);
284
- if (!animData.animate) {
285
- this.locked = false;
286
- }
287
- if (animData.pop) {
288
- css.top = $(root_element).scrollTop() - el.data('offset') + 'px'; //adding root_element instead of window for scrolling offset if modal trigger is below the fold
289
- var end_css = {
290
- top: $(root_element).scrollTop() + el.data('css-top') + 'px', //adding root_element instead of window for scrolling offset if modal trigger is below the fold
291
- opacity: 1
292
- };
293
-
294
- return setTimeout(function () {
295
- return el
296
- .css(css)
297
- .animate(end_css, settings.animation_speed, 'linear', function () {
298
- this.locked = false;
299
- el.trigger('opened').trigger('opened.fndtn.reveal');
300
- }.bind(this))
301
- .addClass('open');
302
- }.bind(this), settings.animation_speed / 2);
303
- }
304
-
305
- if (animData.fade) {
306
- css.top = $(root_element).scrollTop() + el.data('css-top') + 'px'; //adding root_element instead of window for scrolling offset if modal trigger is below the fold
307
- var end_css = {opacity: 1};
308
-
309
- return setTimeout(function () {
310
- return el
311
- .css(css)
312
- .animate(end_css, settings.animation_speed, 'linear', function () {
313
- this.locked = false;
314
- el.trigger('opened').trigger('opened.fndtn.reveal');
315
- }.bind(this))
316
- .addClass('open');
317
- }.bind(this), settings.animation_speed / 2);
318
- }
319
-
320
- return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened').trigger('opened.fndtn.reveal');
321
- }
322
-
323
- var settings = this.settings;
324
-
325
- // should we animate the background?
326
- if (getAnimationData(settings.animation).fade) {
327
- return el.fadeIn(settings.animation_speed / 2);
328
- }
329
-
330
- this.locked = false;
331
-
332
- return el.show();
333
- },
334
-
335
- hide: function (el, css) {
336
- // is modal
337
- if (css) {
338
- var settings = el.data(this.attr_name(true) + '-init') || this.settings,
339
- root_element = settings.root_element;
340
-
341
- var animData = getAnimationData(settings.animation);
342
- if (!animData.animate) {
343
- this.locked = false;
344
- }
345
- if (animData.pop) {
346
- var end_css = {
347
- top: -$(root_element).scrollTop() - el.data('offset') + 'px', //adding root_element instead of window for scrolling offset if modal trigger is below the fold
348
- opacity: 0
349
- };
350
-
351
- return setTimeout(function () {
352
- return el
353
- .animate(end_css, settings.animation_speed, 'linear', function () {
354
- this.locked = false;
355
- el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
356
- }.bind(this))
357
- .removeClass('open');
358
- }.bind(this), settings.animation_speed / 2);
359
- }
360
-
361
- if (animData.fade) {
362
- var end_css = {opacity: 0};
363
-
364
- return setTimeout(function () {
365
- return el
366
- .animate(end_css, settings.animation_speed, 'linear', function () {
367
- this.locked = false;
368
- el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
369
- }.bind(this))
370
- .removeClass('open');
371
- }.bind(this), settings.animation_speed / 2);
372
- }
373
-
374
- return el.hide().css(css).removeClass('open').trigger('closed').trigger('closed.fndtn.reveal');
375
- }
376
-
377
- var settings = this.settings;
378
-
379
- // should we animate the background?
380
- if (getAnimationData(settings.animation).fade) {
381
- return el.fadeOut(settings.animation_speed / 2);
382
- }
383
-
384
- return el.hide();
385
- },
386
-
387
- close_video: function (e) {
388
- var video = $('.flex-video', e.target),
389
- iframe = $('iframe', video);
390
-
391
- if (iframe.length > 0) {
392
- iframe.attr('data-src', iframe[0].src);
393
- iframe.attr('src', iframe.attr('src'));
394
- video.hide();
395
- }
396
- },
397
-
398
- open_video: function (e) {
399
- var video = $('.flex-video', e.target),
400
- iframe = video.find('iframe');
401
-
402
- if (iframe.length > 0) {
403
- var data_src = iframe.attr('data-src');
404
- if (typeof data_src === 'string') {
405
- iframe[0].src = iframe.attr('data-src');
406
- } else {
407
- var src = iframe[0].src;
408
- iframe[0].src = undefined;
409
- iframe[0].src = src;
410
- }
411
- video.show();
412
- }
413
- },
414
-
415
- data_attr: function (str) {
416
- if (this.namespace.length > 0) {
417
- return this.namespace + '-' + str;
418
- }
419
-
420
- return str;
421
- },
422
-
423
- cache_offset: function (modal) {
424
- var offset = modal.show().height() + parseInt(modal.css('top'), 10);
425
-
426
- modal.hide();
427
-
428
- return offset;
429
- },
430
-
431
- off: function () {
432
- $(this.scope).off('.fndtn.reveal');
433
- },
434
-
435
- reflow: function () {
436
- }
437
- };
438
-
439
- /*
440
- * getAnimationData('popAndFade') // {animate: true, pop: true, fade: true}
441
- * getAnimationData('fade') // {animate: true, pop: false, fade: true}
442
- * getAnimationData('pop') // {animate: true, pop: true, fade: false}
443
- * getAnimationData('foo') // {animate: false, pop: false, fade: false}
444
- * getAnimationData(null) // {animate: false, pop: false, fade: false}
445
- */
446
- function getAnimationData(str) {
447
- var fade = /fade/i.test(str);
448
- var pop = /pop/i.test(str);
449
- return {
450
- animate: fade || pop,
451
- pop: pop,
452
- fade: fade
453
- };
454
- }
455
- }(jQuery, window, window.document));
1
+ ;
2
+ (function ($, window, document, undefined) {
3
+ 'use strict';
4
+
5
+ Foundation.libs.reveal = {
6
+ name: 'reveal',
7
+
8
+ version: '5.5.0',
9
+
10
+ locked: false,
11
+
12
+ settings: {
13
+ animation: 'fadeAndPop',
14
+ animation_speed: 250,
15
+ close_on_background_click: true,
16
+ close_on_esc: true,
17
+ dismiss_modal_class: 'close-reveal-modal',
18
+ bg_class: 'reveal-modal-bg',
19
+ bg_root_element: 'body',
20
+ root_element: 'body',
21
+ open: function () {
22
+ },
23
+ opened: function () {
24
+ },
25
+ close: function () {
26
+ },
27
+ closed: function () {
28
+ },
29
+ bg: $('.reveal-modal-bg'),
30
+ css: {
31
+ open: {
32
+ 'opacity': 0,
33
+ 'visibility': 'visible',
34
+ 'display': 'block'
35
+ },
36
+ close: {
37
+ 'opacity': 1,
38
+ 'visibility': 'hidden',
39
+ 'display': 'none'
40
+ }
41
+ }
42
+ },
43
+
44
+ init: function (scope, method, options) {
45
+ $.extend(true, this.settings, method, options);
46
+ this.bindings(method, options);
47
+ },
48
+
49
+ events: function (scope) {
50
+ var self = this,
51
+ S = self.S;
52
+
53
+ S(this.scope)
54
+ .off('.reveal')
55
+ .on('click.fndtn.reveal', '[' + this.add_namespace('data-reveal-id') + ']:not([disabled])', function (e) {
56
+ e.preventDefault();
57
+
58
+ if (!self.locked) {
59
+ var element = S(this),
60
+ ajax = element.data(self.data_attr('reveal-ajax'));
61
+
62
+ self.locked = true;
63
+
64
+ if (typeof ajax === 'undefined') {
65
+ self.open.call(self, element);
66
+ } else {
67
+ var url = ajax === true ? element.attr('href') : ajax;
68
+
69
+ self.open.call(self, element, {url: url});
70
+ }
71
+ }
72
+ });
73
+
74
+ S(document)
75
+ .on('click.fndtn.reveal', this.close_targets(), function (e) {
76
+
77
+ e.preventDefault();
78
+
79
+ if (!self.locked) {
80
+ var settings = S('[' + self.attr_name() + '].open').data(self.attr_name(true) + '-init') || self.settings,
81
+ bg_clicked = S(e.target)[0] === S('.' + settings.bg_class)[0];
82
+
83
+ if (bg_clicked) {
84
+ if (settings.close_on_background_click) {
85
+ e.stopPropagation();
86
+ } else {
87
+ return;
88
+ }
89
+ }
90
+
91
+ self.locked = true;
92
+ self.close.call(self, bg_clicked ? S('[' + self.attr_name() + '].open') : S(this).closest('[' + self.attr_name() + ']'));
93
+ }
94
+ });
95
+
96
+ if (S('[' + self.attr_name() + ']', this.scope).length > 0) {
97
+ S(this.scope)
98
+ // .off('.reveal')
99
+ .on('open.fndtn.reveal', this.settings.open)
100
+ .on('opened.fndtn.reveal', this.settings.opened)
101
+ .on('opened.fndtn.reveal', this.open_video)
102
+ .on('close.fndtn.reveal', this.settings.close)
103
+ .on('closed.fndtn.reveal', this.settings.closed)
104
+ .on('closed.fndtn.reveal', this.close_video);
105
+ } else {
106
+ S(this.scope)
107
+ // .off('.reveal')
108
+ .on('open.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.open)
109
+ .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.opened)
110
+ .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.open_video)
111
+ .on('close.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.close)
112
+ .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.closed)
113
+ .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.close_video);
114
+ }
115
+
116
+ return true;
117
+ },
118
+
119
+ // PATCH #3: turning on key up capture only when a reveal window is open
120
+ key_up_on: function (scope) {
121
+ var self = this;
122
+
123
+ // PATCH #1: fixing multiple keyup event trigger from single key press
124
+ self.S('body').off('keyup.fndtn.reveal').on('keyup.fndtn.reveal', function (event) {
125
+ var open_modal = self.S('[' + self.attr_name() + '].open'),
126
+ settings = open_modal.data(self.attr_name(true) + '-init') || self.settings;
127
+ // PATCH #2: making sure that the close event can be called only while unlocked,
128
+ // so that multiple keyup.fndtn.reveal events don't prevent clean closing of the reveal window.
129
+ if (settings && event.which === 27 && settings.close_on_esc && !self.locked) { // 27 is the keycode for the Escape key
130
+ self.close.call(self, open_modal);
131
+ }
132
+ });
133
+
134
+ return true;
135
+ },
136
+
137
+ // PATCH #3: turning on key up capture only when a reveal window is open
138
+ key_up_off: function (scope) {
139
+ this.S('body').off('keyup.fndtn.reveal');
140
+ return true;
141
+ },
142
+
143
+
144
+ open: function (target, ajax_settings) {
145
+ var self = this,
146
+ modal;
147
+
148
+ if (target) {
149
+ if (typeof target.selector !== 'undefined') {
150
+ // Find the named node; only use the first one found, since the rest of the code assumes there's only one node
151
+ modal = self.S('#' + target.data(self.data_attr('reveal-id'))).first();
152
+ } else {
153
+ modal = self.S(this.scope);
154
+
155
+ ajax_settings = target;
156
+ }
157
+ } else {
158
+ modal = self.S(this.scope);
159
+ }
160
+
161
+ var settings = modal.data(self.attr_name(true) + '-init');
162
+ settings = settings || this.settings;
163
+
164
+
165
+ if (modal.hasClass('open') && target.attr('data-reveal-id') == modal.attr('id')) {
166
+ return self.close(modal);
167
+ }
168
+
169
+ if (!modal.hasClass('open')) {
170
+ var open_modal = self.S('[' + self.attr_name() + '].open');
171
+
172
+ if (typeof modal.data('css-top') === 'undefined') {
173
+ modal.data('css-top', parseInt(modal.css('top'), 10))
174
+ .data('offset', this.cache_offset(modal));
175
+ }
176
+
177
+ this.key_up_on(modal); // PATCH #3: turning on key up capture only when a reveal window is open
178
+ modal.trigger('open').trigger('open.fndtn.reveal');
179
+
180
+ if (open_modal.length < 1) {
181
+ this.toggle_bg(modal, true);
182
+ }
183
+
184
+ if (typeof ajax_settings === 'string') {
185
+ ajax_settings = {
186
+ url: ajax_settings
187
+ };
188
+ }
189
+
190
+ if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
191
+ if (open_modal.length > 0) {
192
+ this.hide(open_modal, settings.css.close);
193
+ }
194
+
195
+ this.show(modal, settings.css.open);
196
+ } else {
197
+ var old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
198
+
199
+ $.extend(ajax_settings, {
200
+ success: function (data, textStatus, jqXHR) {
201
+ if ($.isFunction(old_success)) {
202
+ var result = old_success(data, textStatus, jqXHR);
203
+ if (typeof result == 'string') data = result;
204
+ }
205
+
206
+ modal.html(data);
207
+ self.S(modal).foundation('section', 'reflow');
208
+ self.S(modal).children().foundation();
209
+
210
+ if (open_modal.length > 0) {
211
+ self.hide(open_modal, settings.css.close);
212
+ }
213
+ self.show(modal, settings.css.open);
214
+ }
215
+ });
216
+
217
+ $.ajax(ajax_settings);
218
+ }
219
+ }
220
+ self.S(window).trigger('resize');
221
+ },
222
+
223
+ close: function (modal) {
224
+ var modal = modal && modal.length ? modal : this.S(this.scope),
225
+ open_modals = this.S('[' + this.attr_name() + '].open'),
226
+ settings = modal.data(this.attr_name(true) + '-init') || this.settings;
227
+
228
+ if (open_modals.length > 0) {
229
+ this.locked = true;
230
+ this.key_up_off(modal); // PATCH #3: turning on key up capture only when a reveal window is open
231
+ modal.trigger('close').trigger('close.fndtn.reveal');
232
+ this.toggle_bg(modal, false);
233
+ this.hide(open_modals, settings.css.close, settings);
234
+ }
235
+ },
236
+
237
+ close_targets: function () {
238
+ var base = '.' + this.settings.dismiss_modal_class;
239
+
240
+ if (this.settings.close_on_background_click) {
241
+ return base + ', .' + this.settings.bg_class;
242
+ }
243
+
244
+ return base;
245
+ },
246
+
247
+ toggle_bg: function (el, modal, state) {
248
+ var settings = el.data(this.attr_name(true) + '-init') || this.settings,
249
+ bg_root_element = settings.bg_root_element; // Adding option to specify the background root element fixes scrolling issue
250
+
251
+ if (this.S('.' + this.settings.bg_class).length === 0) {
252
+ this.settings.bg = $('<div />', {'class': this.settings.bg_class})
253
+ .appendTo(bg_root_element).hide();
254
+ }
255
+
256
+ var visible = this.settings.bg.filter(':visible').length > 0;
257
+ if (state != visible) {
258
+ if (state == undefined ? visible : !state) {
259
+ this.hide(this.settings.bg);
260
+ } else {
261
+ this.show(this.settings.bg);
262
+ }
263
+ }
264
+ },
265
+
266
+ show: function (el, css) {
267
+ // is modal
268
+ if (css) {
269
+ var settings = el.data(this.attr_name(true) + '-init') || this.settings,
270
+ root_element = settings.root_element;
271
+
272
+ if (el.parent(root_element).length === 0) {
273
+ var placeholder = el.wrap('<div style="display: none;" />').parent();
274
+
275
+ el.on('closed.fndtn.reveal.wrapped', function () {
276
+ el.detach().appendTo(placeholder);
277
+ el.unwrap().unbind('closed.fndtn.reveal.wrapped');
278
+ });
279
+
280
+ el.detach().appendTo(root_element);
281
+ }
282
+
283
+ var animData = getAnimationData(settings.animation);
284
+ if (!animData.animate) {
285
+ this.locked = false;
286
+ }
287
+ if (animData.pop) {
288
+ css.top = $(root_element).scrollTop() - el.data('offset') + 'px'; //adding root_element instead of window for scrolling offset if modal trigger is below the fold
289
+ var end_css = {
290
+ top: $(root_element).scrollTop() + el.data('css-top') + 'px', //adding root_element instead of window for scrolling offset if modal trigger is below the fold
291
+ opacity: 1
292
+ };
293
+
294
+ return setTimeout(function () {
295
+ return el
296
+ .css(css)
297
+ .animate(end_css, settings.animation_speed, 'linear', function () {
298
+ this.locked = false;
299
+ el.trigger('opened').trigger('opened.fndtn.reveal');
300
+ }.bind(this))
301
+ .addClass('open');
302
+ }.bind(this), settings.animation_speed / 2);
303
+ }
304
+
305
+ if (animData.fade) {
306
+ css.top = $(root_element).scrollTop() + el.data('css-top') + 'px'; //adding root_element instead of window for scrolling offset if modal trigger is below the fold
307
+ var end_css = {opacity: 1};
308
+
309
+ return setTimeout(function () {
310
+ return el
311
+ .css(css)
312
+ .animate(end_css, settings.animation_speed, 'linear', function () {
313
+ this.locked = false;
314
+ el.trigger('opened').trigger('opened.fndtn.reveal');
315
+ }.bind(this))
316
+ .addClass('open');
317
+ }.bind(this), settings.animation_speed / 2);
318
+ }
319
+
320
+ return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened').trigger('opened.fndtn.reveal');
321
+ }
322
+
323
+ var settings = this.settings;
324
+
325
+ // should we animate the background?
326
+ if (getAnimationData(settings.animation).fade) {
327
+ return el.fadeIn(settings.animation_speed / 2);
328
+ }
329
+
330
+ this.locked = false;
331
+
332
+ return el.show();
333
+ },
334
+
335
+ hide: function (el, css) {
336
+ // is modal
337
+ if (css) {
338
+ var settings = el.data(this.attr_name(true) + '-init') || this.settings,
339
+ root_element = settings.root_element;
340
+
341
+ var animData = getAnimationData(settings.animation);
342
+ if (!animData.animate) {
343
+ this.locked = false;
344
+ }
345
+ if (animData.pop) {
346
+ var end_css = {
347
+ top: -$(root_element).scrollTop() - el.data('offset') + 'px', //adding root_element instead of window for scrolling offset if modal trigger is below the fold
348
+ opacity: 0
349
+ };
350
+
351
+ return setTimeout(function () {
352
+ return el
353
+ .animate(end_css, settings.animation_speed, 'linear', function () {
354
+ this.locked = false;
355
+ el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
356
+ }.bind(this))
357
+ .removeClass('open');
358
+ }.bind(this), settings.animation_speed / 2);
359
+ }
360
+
361
+ if (animData.fade) {
362
+ var end_css = {opacity: 0};
363
+
364
+ return setTimeout(function () {
365
+ return el
366
+ .animate(end_css, settings.animation_speed, 'linear', function () {
367
+ this.locked = false;
368
+ el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
369
+ }.bind(this))
370
+ .removeClass('open');
371
+ }.bind(this), settings.animation_speed / 2);
372
+ }
373
+
374
+ return el.hide().css(css).removeClass('open').trigger('closed').trigger('closed.fndtn.reveal');
375
+ }
376
+
377
+ var settings = this.settings;
378
+
379
+ // should we animate the background?
380
+ if (getAnimationData(settings.animation).fade) {
381
+ return el.fadeOut(settings.animation_speed / 2);
382
+ }
383
+
384
+ return el.hide();
385
+ },
386
+
387
+ close_video: function (e) {
388
+ var video = $('.flex-video', e.target),
389
+ iframe = $('iframe', video);
390
+
391
+ if (iframe.length > 0) {
392
+ iframe.attr('data-src', iframe[0].src);
393
+ iframe.attr('src', iframe.attr('src'));
394
+ video.hide();
395
+ }
396
+ },
397
+
398
+ open_video: function (e) {
399
+ var video = $('.flex-video', e.target),
400
+ iframe = video.find('iframe');
401
+
402
+ if (iframe.length > 0) {
403
+ var data_src = iframe.attr('data-src');
404
+ if (typeof data_src === 'string') {
405
+ iframe[0].src = iframe.attr('data-src');
406
+ } else {
407
+ var src = iframe[0].src;
408
+ iframe[0].src = undefined;
409
+ iframe[0].src = src;
410
+ }
411
+ video.show();
412
+ }
413
+ },
414
+
415
+ data_attr: function (str) {
416
+ if (this.namespace.length > 0) {
417
+ return this.namespace + '-' + str;
418
+ }
419
+
420
+ return str;
421
+ },
422
+
423
+ cache_offset: function (modal) {
424
+ var offset = modal.show().height() + parseInt(modal.css('top'), 10);
425
+
426
+ modal.hide();
427
+
428
+ return offset;
429
+ },
430
+
431
+ off: function () {
432
+ $(this.scope).off('.fndtn.reveal');
433
+ },
434
+
435
+ reflow: function () {
436
+ }
437
+ };
438
+
439
+ /*
440
+ * getAnimationData('popAndFade') // {animate: true, pop: true, fade: true}
441
+ * getAnimationData('fade') // {animate: true, pop: false, fade: true}
442
+ * getAnimationData('pop') // {animate: true, pop: true, fade: false}
443
+ * getAnimationData('foo') // {animate: false, pop: false, fade: false}
444
+ * getAnimationData(null) // {animate: false, pop: false, fade: false}
445
+ */
446
+ function getAnimationData(str) {
447
+ var fade = /fade/i.test(str);
448
+ var pop = /pop/i.test(str);
449
+ return {
450
+ animate: fade || pop,
451
+ pop: pop,
452
+ fade: fade
453
+ };
454
+ }
455
+ }(jQuery, window, window.document));