aml 0.1.3.2 → 0.1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/bin/aml-kit +3 -0
  3. data/lib/aml-kit.rb +11 -0
  4. data/lib/aml-kit/Build.rb +55 -0
  5. data/lib/aml-kit/core/bootstrap/3.2.0/css/bootstrap-theme.min.css +6 -0
  6. data/lib/aml-kit/core/bootstrap/3.2.0/css/bootstrap.min.css +5 -0
  7. data/lib/aml-kit/core/bootstrap/3.2.0/css/font-awesome.min.css +4 -0
  8. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/FontAwesome.otf +0 -0
  9. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/fontawesome-webfont.eot +0 -0
  10. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/fontawesome-webfont.svg +520 -0
  11. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/fontawesome-webfont.ttf +0 -0
  12. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/fontawesome-webfont.woff +0 -0
  13. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.eot +0 -0
  14. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.svg +229 -0
  15. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.ttf +0 -0
  16. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.woff +0 -0
  17. data/lib/aml-kit/core/bootstrap/3.2.0/index.aml +16 -0
  18. data/lib/aml-kit/core/bootstrap/3.2.0/js/bootstrap.min.js +6 -0
  19. data/lib/aml-kit/core/bootstrap/3.2.0/js/html5shiv.min.js +4 -0
  20. data/lib/aml-kit/core/bootstrap/3.2.0/js/jquery.min.js +4 -0
  21. data/lib/aml-kit/core/bootstrap/3.2.0/js/respond.min.js +5 -0
  22. data/lib/aml-kit/core/bootstrap/3.2.0/mixin.aml +11 -0
  23. data/lib/aml-kit/core/bootstrap/3.2.0/partial/footer.aml +17 -0
  24. data/lib/aml-kit/core/bootstrap/3.2.0/partial/header.aml +20 -0
  25. data/lib/aml-kit/core/bootstrap/3.2.0/partial/navigation-top.aml +17 -0
  26. data/lib/aml-kit/core/foundation/5.3.1/css/foundation.min.css +1 -0
  27. data/lib/aml-kit/core/foundation/5.3.1/css/normalize.css +425 -0
  28. data/lib/aml-kit/core/foundation/5.3.1/index.aml +14 -0
  29. data/lib/aml-kit/core/foundation/5.3.1/js/foundation.min.js +10 -0
  30. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.abide.js +299 -0
  31. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.accordion.js +65 -0
  32. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.alert.js +43 -0
  33. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.clearing.js +542 -0
  34. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.dropdown.js +313 -0
  35. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.equalizer.js +74 -0
  36. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.interchange.js +344 -0
  37. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.joyride.js +846 -0
  38. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.js +613 -0
  39. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.magellan.js +180 -0
  40. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.offcanvas.js +108 -0
  41. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.orbit.js +472 -0
  42. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.reveal.js +437 -0
  43. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.slider.js +226 -0
  44. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.tab.js +167 -0
  45. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.tooltip.js +298 -0
  46. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.topbar.js +426 -0
  47. data/lib/aml-kit/core/foundation/5.3.1/js/vendor/fastclick.js +9 -0
  48. data/lib/aml-kit/core/foundation/5.3.1/js/vendor/jquery.cookie.js +8 -0
  49. data/lib/aml-kit/core/foundation/5.3.1/js/vendor/jquery.js +26 -0
  50. data/lib/aml-kit/core/foundation/5.3.1/js/vendor/modernizr.js +8 -0
  51. data/lib/aml-kit/core/foundation/5.3.1/js/vendor/placeholder.js +2 -0
  52. data/lib/aml-kit/core/foundation/5.3.1/partial/footer.aml +4 -0
  53. data/lib/aml-kit/core/foundation/5.3.1/partial/header.aml +9 -0
  54. data/lib/aml.rb +1 -1
  55. data/lib/aml/Compile.rb +15 -19
  56. data/lib/aml/Definition.rb +0 -1
  57. data/lib/aml/Line.rb +1 -1
  58. data/lib/aml/Prepare.rb +1 -2
  59. data/lib/aml/core/method.rb +42 -19
  60. metadata +59 -6
@@ -0,0 +1,180 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs['magellan-expedition'] = {
5
+ name : 'magellan-expedition',
6
+
7
+ version : '5.3.0',
8
+
9
+ settings : {
10
+ active_class: 'active',
11
+ threshold: 0, // pixels from the top of the expedition for it to become fixes
12
+ destination_threshold: 20, // pixels from the top of destination for it to be considered active
13
+ throttle_delay: 30, // calculation throttling to increase framerate
14
+ fixed_top: 0 // top distance in pixels assigend to the fixed element on scroll
15
+ },
16
+
17
+ init : function (scope, method, options) {
18
+ Foundation.inherit(this, 'throttle');
19
+ this.bindings(method, options);
20
+ },
21
+
22
+ events : function () {
23
+ var self = this,
24
+ S = self.S,
25
+ settings = self.settings;
26
+
27
+ // initialize expedition offset
28
+ self.set_expedition_position();
29
+
30
+ S(self.scope)
31
+ .off('.magellan')
32
+ .on('click.fndtn.magellan', '[' + self.add_namespace('data-magellan-arrival') + '] a[href^="#"]', function (e) {
33
+ e.preventDefault();
34
+ var expedition = $(this).closest('[' + self.attr_name() + ']'),
35
+ settings = expedition.data('magellan-expedition-init'),
36
+ hash = this.hash.split('#').join(''),
37
+ target = $("a[name='"+hash+"']");
38
+
39
+ if (target.length === 0) {
40
+ target = $('#'+hash);
41
+ }
42
+
43
+ // Account for expedition height if fixed position
44
+ var scroll_top = target.offset().top - settings.destination_threshold;
45
+ scroll_top = scroll_top - expedition.outerHeight();
46
+
47
+ $('html, body').stop().animate({
48
+ 'scrollTop': scroll_top
49
+ }, 700, 'swing', function () {
50
+ if(history.pushState) {
51
+ history.pushState(null, null, '#'+hash);
52
+ }
53
+ else {
54
+ location.hash = '#'+hash;
55
+ }
56
+ });
57
+ })
58
+ .on('scroll.fndtn.magellan', self.throttle(this.check_for_arrivals.bind(this), settings.throttle_delay));
59
+
60
+ $(window)
61
+ .on('resize.fndtn.magellan', self.throttle(this.set_expedition_position.bind(this), settings.throttle_delay));
62
+ },
63
+
64
+ check_for_arrivals : function() {
65
+ var self = this;
66
+ self.update_arrivals();
67
+ self.update_expedition_positions();
68
+ },
69
+
70
+ set_expedition_position : function() {
71
+ var self = this;
72
+ $('[' + this.attr_name() + '=fixed]', self.scope).each(function(idx, el) {
73
+ var expedition = $(this),
74
+ settings = expedition.data('magellan-expedition-init'),
75
+ styles = expedition.attr('styles'), // save styles
76
+ top_offset;
77
+
78
+ expedition.attr('style', '');
79
+ top_offset = expedition.offset().top + settings.threshold;
80
+
81
+ expedition.data(self.data_attr('magellan-top-offset'), top_offset);
82
+ expedition.attr('style', styles);
83
+ });
84
+ },
85
+
86
+ update_expedition_positions : function() {
87
+ var self = this,
88
+ window_top_offset = $(window).scrollTop();
89
+
90
+ $('[' + this.attr_name() + '=fixed]', self.scope).each(function() {
91
+ var expedition = $(this),
92
+ settings = expedition.data('magellan-expedition-init'),
93
+ top_offset = expedition.data('magellan-top-offset');
94
+
95
+ if (window_top_offset >= top_offset) {
96
+ // Placeholder allows height calculations to be consistent even when
97
+ // appearing to switch between fixed/non-fixed placement
98
+ var placeholder = expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']');
99
+ if (placeholder.length === 0) {
100
+ placeholder = expedition.clone();
101
+ placeholder.removeAttr(self.attr_name());
102
+ placeholder.attr(self.add_namespace('data-magellan-expedition-clone'),'');
103
+ expedition.before(placeholder);
104
+ }
105
+ expedition.css({position:'fixed', top: settings.fixed_top});
106
+ } else {
107
+ expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']').remove();
108
+ expedition.attr('style','').removeClass('fixed');
109
+ }
110
+ });
111
+ },
112
+
113
+ update_arrivals : function() {
114
+ var self = this,
115
+ window_top_offset = $(window).scrollTop();
116
+
117
+ $('[' + this.attr_name() + ']', self.scope).each(function() {
118
+ var expedition = $(this),
119
+ settings = expedition.data(self.attr_name(true) + '-init'),
120
+ offsets = self.offsets(expedition, window_top_offset),
121
+ arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']'),
122
+ active_item = false;
123
+ offsets.each(function(idx, item) {
124
+ if (item.viewport_offset >= item.top_offset) {
125
+ var arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']');
126
+ arrivals.not(item.arrival).removeClass(settings.active_class);
127
+ item.arrival.addClass(settings.active_class);
128
+ active_item = true;
129
+ return true;
130
+ }
131
+ });
132
+
133
+ if (!active_item) arrivals.removeClass(settings.active_class);
134
+ });
135
+ },
136
+
137
+ offsets : function(expedition, window_offset) {
138
+ var self = this,
139
+ settings = expedition.data(self.attr_name(true) + '-init'),
140
+ viewport_offset = window_offset;
141
+
142
+ return expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']').map(function(idx, el) {
143
+ var name = $(this).data(self.data_attr('magellan-arrival')),
144
+ dest = $('[' + self.add_namespace('data-magellan-destination') + '=' + name + ']');
145
+ if (dest.length > 0) {
146
+ var top_offset = dest.offset().top - settings.destination_threshold - expedition.outerHeight();
147
+ return {
148
+ destination : dest,
149
+ arrival : $(this),
150
+ top_offset : top_offset,
151
+ viewport_offset : viewport_offset
152
+ }
153
+ }
154
+ }).sort(function(a, b) {
155
+ if (a.top_offset < b.top_offset) return -1;
156
+ if (a.top_offset > b.top_offset) return 1;
157
+ return 0;
158
+ });
159
+ },
160
+
161
+ data_attr: function (str) {
162
+ if (this.namespace.length > 0) {
163
+ return this.namespace + '-' + str;
164
+ }
165
+
166
+ return str;
167
+ },
168
+
169
+ off : function () {
170
+ this.S(this.scope).off('.magellan');
171
+ this.S(window).off('.magellan');
172
+ },
173
+
174
+ reflow : function () {
175
+ var self = this;
176
+ // remove placeholder expeditions used for height calculation purposes
177
+ $('[' + self.add_namespace('data-magellan-expedition-clone') + ']', self.scope).remove();
178
+ }
179
+ };
180
+ }(jQuery, window, window.document));
@@ -0,0 +1,108 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs.offcanvas = {
5
+ name : 'offcanvas',
6
+
7
+ version : '5.3.0',
8
+
9
+ settings : {
10
+ open_method: 'move',
11
+ close_on_click: true
12
+ },
13
+
14
+ init : function (scope, method, options) {
15
+ this.bindings(method, options);
16
+ },
17
+
18
+ events : function () {
19
+ var self = this,
20
+ S = self.S,
21
+ move_class = '',
22
+ right_postfix = '',
23
+ left_postfix = '';
24
+
25
+ if (this.settings.open_method === 'move') {
26
+ move_class = 'move-';
27
+ right_postfix = 'right';
28
+ left_postfix = 'left';
29
+ } else if (this.settings.open_method === 'overlap') {
30
+ move_class = 'offcanvas-overlap';
31
+ }
32
+
33
+ S(this.scope).off('.offcanvas')
34
+ .on('click.fndtn.offcanvas', '.left-off-canvas-toggle', function (e) {
35
+ self.click_toggle_class(e, move_class + right_postfix);
36
+ })
37
+ .on('click.fndtn.offcanvas', '.left-off-canvas-menu a', function (e) {
38
+ var settings = self.get_settings(e);
39
+ if (settings.close_on_click) {
40
+ self.hide.call(self, move_class + right_postfix, self.get_wrapper(e));
41
+ }
42
+ })
43
+ .on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) {
44
+ self.click_toggle_class(e, move_class + left_postfix);
45
+ })
46
+ .on('click.fndtn.offcanvas', '.right-off-canvas-menu a', function (e) {
47
+ var settings = self.get_settings(e);
48
+ if (settings.close_on_click) {
49
+ self.hide.call(self, move_class + left_postfix, self.get_wrapper(e));
50
+ }
51
+ })
52
+ .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
53
+ self.click_remove_class(e, move_class + left_postfix);
54
+ if (right_postfix) self.click_remove_class(e, move_class + right_postfix);
55
+ });
56
+
57
+ },
58
+
59
+ toggle: function(class_name, $off_canvas) {
60
+ $off_canvas = $off_canvas || this.get_wrapper();
61
+ if ($off_canvas.is('.' + class_name)) {
62
+ this.hide(class_name, $off_canvas);
63
+ } else {
64
+ this.show(class_name, $off_canvas);
65
+ }
66
+ },
67
+
68
+ show: function(class_name, $off_canvas) {
69
+ $off_canvas = $off_canvas || this.get_wrapper();
70
+ $off_canvas.trigger('open').trigger('open.fndtn.offcanvas');
71
+ $off_canvas.addClass(class_name);
72
+ },
73
+
74
+ hide: function(class_name, $off_canvas) {
75
+ $off_canvas = $off_canvas || this.get_wrapper();
76
+ $off_canvas.trigger('close').trigger('close.fndtn.offcanvas');
77
+ $off_canvas.removeClass(class_name);
78
+ },
79
+
80
+ click_toggle_class: function(e, class_name) {
81
+ e.preventDefault();
82
+ var $off_canvas = this.get_wrapper(e);
83
+ this.toggle(class_name, $off_canvas);
84
+ },
85
+
86
+ click_remove_class: function(e, class_name) {
87
+ e.preventDefault();
88
+ var $off_canvas = this.get_wrapper(e);
89
+ this.hide(class_name, $off_canvas);
90
+ },
91
+
92
+ get_settings: function(e) {
93
+ var offcanvas = this.S(e.target).closest('[' + this.attr_name() + ']');
94
+ return offcanvas.data(this.attr_name(true) + '-init') || this.settings;
95
+ },
96
+
97
+ get_wrapper: function(e) {
98
+ var $off_canvas = this.S(e ? e.target : this.scope).closest('.off-canvas-wrap');
99
+
100
+ if ($off_canvas.length === 0) {
101
+ $off_canvas = this.S('.off-canvas-wrap');
102
+ }
103
+ return $off_canvas;
104
+ },
105
+
106
+ reflow : function () {}
107
+ };
108
+ }(jQuery, window, window.document));
@@ -0,0 +1,472 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ var noop = function() {};
5
+
6
+ var Orbit = function(el, settings) {
7
+ // Don't reinitialize plugin
8
+ if (el.hasClass(settings.slides_container_class)) {
9
+ return this;
10
+ }
11
+
12
+ var self = this,
13
+ container,
14
+ slides_container = el,
15
+ number_container,
16
+ bullets_container,
17
+ timer_container,
18
+ idx = 0,
19
+ animate,
20
+ timer,
21
+ locked = false,
22
+ adjust_height_after = false;
23
+
24
+
25
+ self.slides = function() {
26
+ return slides_container.children(settings.slide_selector);
27
+ };
28
+
29
+ self.slides().first().addClass(settings.active_slide_class);
30
+
31
+ self.update_slide_number = function(index) {
32
+ if (settings.slide_number) {
33
+ number_container.find('span:first').text(parseInt(index)+1);
34
+ number_container.find('span:last').text(self.slides().length);
35
+ }
36
+ if (settings.bullets) {
37
+ bullets_container.children().removeClass(settings.bullets_active_class);
38
+ $(bullets_container.children().get(index)).addClass(settings.bullets_active_class);
39
+ }
40
+ };
41
+
42
+ self.update_active_link = function(index) {
43
+ var link = $('a[data-orbit-link="'+self.slides().eq(index).attr('data-orbit-slide')+'"]');
44
+ link.siblings().removeClass(settings.bullets_active_class);
45
+ link.addClass(settings.bullets_active_class);
46
+ };
47
+
48
+ self.build_markup = function() {
49
+ slides_container.wrap('<div class="'+settings.container_class+'"></div>');
50
+ container = slides_container.parent();
51
+ slides_container.addClass(settings.slides_container_class);
52
+
53
+ if (settings.stack_on_small) {
54
+ container.addClass(settings.stack_on_small_class);
55
+ }
56
+
57
+ if (settings.navigation_arrows) {
58
+ container.append($('<a href="#"><span></span></a>').addClass(settings.prev_class));
59
+ container.append($('<a href="#"><span></span></a>').addClass(settings.next_class));
60
+ }
61
+
62
+ if (settings.timer) {
63
+ timer_container = $('<div>').addClass(settings.timer_container_class);
64
+ timer_container.append('<span>');
65
+ timer_container.append($('<div>').addClass(settings.timer_progress_class));
66
+ timer_container.addClass(settings.timer_paused_class);
67
+ container.append(timer_container);
68
+ }
69
+
70
+ if (settings.slide_number) {
71
+ number_container = $('<div>').addClass(settings.slide_number_class);
72
+ number_container.append('<span></span> ' + settings.slide_number_text + ' <span></span>');
73
+ container.append(number_container);
74
+ }
75
+
76
+ if (settings.bullets) {
77
+ bullets_container = $('<ol>').addClass(settings.bullets_container_class);
78
+ container.append(bullets_container);
79
+ bullets_container.wrap('<div class="orbit-bullets-container"></div>');
80
+ self.slides().each(function(idx, el) {
81
+ var bullet = $('<li>').attr('data-orbit-slide', idx).on('click', self.link_bullet);;
82
+ bullets_container.append(bullet);
83
+ });
84
+ }
85
+
86
+ };
87
+
88
+ self._goto = function(next_idx, start_timer) {
89
+ // if (locked) {return false;}
90
+ if (next_idx === idx) {return false;}
91
+ if (typeof timer === 'object') {timer.restart();}
92
+ var slides = self.slides();
93
+
94
+ var dir = 'next';
95
+ locked = true;
96
+ if (next_idx < idx) {dir = 'prev';}
97
+ if (next_idx >= slides.length) {
98
+ if (!settings.circular) return false;
99
+ next_idx = 0;
100
+ } else if (next_idx < 0) {
101
+ if (!settings.circular) return false;
102
+ next_idx = slides.length - 1;
103
+ }
104
+
105
+ var current = $(slides.get(idx));
106
+ var next = $(slides.get(next_idx));
107
+
108
+ current.css('zIndex', 2);
109
+ current.removeClass(settings.active_slide_class);
110
+ next.css('zIndex', 4).addClass(settings.active_slide_class);
111
+
112
+ slides_container.trigger('before-slide-change.fndtn.orbit');
113
+ settings.before_slide_change();
114
+ self.update_active_link(next_idx);
115
+
116
+ var callback = function() {
117
+ var unlock = function() {
118
+ idx = next_idx;
119
+ locked = false;
120
+ if (start_timer === true) {timer = self.create_timer(); timer.start();}
121
+ self.update_slide_number(idx);
122
+ slides_container.trigger('after-slide-change.fndtn.orbit',[{slide_number: idx, total_slides: slides.length}]);
123
+ settings.after_slide_change(idx, slides.length);
124
+ };
125
+ if (slides_container.height() != next.height() && settings.variable_height) {
126
+ slides_container.animate({'height': next.height()}, 250, 'linear', unlock);
127
+ } else {
128
+ unlock();
129
+ }
130
+ };
131
+
132
+ if (slides.length === 1) {callback(); return false;}
133
+
134
+ var start_animation = function() {
135
+ if (dir === 'next') {animate.next(current, next, callback);}
136
+ if (dir === 'prev') {animate.prev(current, next, callback);}
137
+ };
138
+
139
+ if (next.height() > slides_container.height() && settings.variable_height) {
140
+ slides_container.animate({'height': next.height()}, 250, 'linear', start_animation);
141
+ } else {
142
+ start_animation();
143
+ }
144
+ };
145
+
146
+ self.next = function(e) {
147
+ e.stopImmediatePropagation();
148
+ e.preventDefault();
149
+ self._goto(idx + 1);
150
+ };
151
+
152
+ self.prev = function(e) {
153
+ e.stopImmediatePropagation();
154
+ e.preventDefault();
155
+ self._goto(idx - 1);
156
+ };
157
+
158
+ self.link_custom = function(e) {
159
+ e.preventDefault();
160
+ var link = $(this).attr('data-orbit-link');
161
+ if ((typeof link === 'string') && (link = $.trim(link)) != "") {
162
+ var slide = container.find('[data-orbit-slide='+link+']');
163
+ if (slide.index() != -1) {self._goto(slide.index());}
164
+ }
165
+ };
166
+
167
+ self.link_bullet = function(e) {
168
+ var index = $(this).attr('data-orbit-slide');
169
+ if ((typeof index === 'string') && (index = $.trim(index)) != "") {
170
+ if(isNaN(parseInt(index)))
171
+ {
172
+ var slide = container.find('[data-orbit-slide='+index+']');
173
+ if (slide.index() != -1) {self._goto(slide.index() + 1);}
174
+ }
175
+ else
176
+ {
177
+ self._goto(parseInt(index));
178
+ }
179
+ }
180
+
181
+ }
182
+
183
+ self.timer_callback = function() {
184
+ self._goto(idx + 1, true);
185
+ }
186
+
187
+ self.compute_dimensions = function() {
188
+ var current = $(self.slides().get(idx));
189
+ var h = current.height();
190
+ if (!settings.variable_height) {
191
+ self.slides().each(function(){
192
+ if ($(this).height() > h) { h = $(this).height(); }
193
+ });
194
+ }
195
+ slides_container.height(h);
196
+ };
197
+
198
+ self.create_timer = function() {
199
+ var t = new Timer(
200
+ container.find('.'+settings.timer_container_class),
201
+ settings,
202
+ self.timer_callback
203
+ );
204
+ return t;
205
+ };
206
+
207
+ self.stop_timer = function() {
208
+ if (typeof timer === 'object') timer.stop();
209
+ };
210
+
211
+ self.toggle_timer = function() {
212
+ var t = container.find('.'+settings.timer_container_class);
213
+ if (t.hasClass(settings.timer_paused_class)) {
214
+ if (typeof timer === 'undefined') {timer = self.create_timer();}
215
+ timer.start();
216
+ }
217
+ else {
218
+ if (typeof timer === 'object') {timer.stop();}
219
+ }
220
+ };
221
+
222
+ self.init = function() {
223
+ self.build_markup();
224
+ if (settings.timer) {
225
+ timer = self.create_timer();
226
+ Foundation.utils.image_loaded(this.slides().children('img'), timer.start);
227
+ }
228
+ animate = new FadeAnimation(settings, slides_container);
229
+ if (settings.animation === 'slide')
230
+ animate = new SlideAnimation(settings, slides_container);
231
+
232
+ container.on('click', '.'+settings.next_class, self.next);
233
+ container.on('click', '.'+settings.prev_class, self.prev);
234
+
235
+ if (settings.next_on_click) {
236
+ container.on('click', '.'+settings.slides_container_class+' [data-orbit-slide]', self.link_bullet);
237
+ }
238
+
239
+ container.on('click', self.toggle_timer);
240
+ if (settings.swipe) {
241
+ container.on('touchstart.fndtn.orbit', function(e) {
242
+ if (!e.touches) {e = e.originalEvent;}
243
+ var data = {
244
+ start_page_x: e.touches[0].pageX,
245
+ start_page_y: e.touches[0].pageY,
246
+ start_time: (new Date()).getTime(),
247
+ delta_x: 0,
248
+ is_scrolling: undefined
249
+ };
250
+ container.data('swipe-transition', data);
251
+ e.stopPropagation();
252
+ })
253
+ .on('touchmove.fndtn.orbit', function(e) {
254
+ if (!e.touches) { e = e.originalEvent; }
255
+ // Ignore pinch/zoom events
256
+ if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
257
+
258
+ var data = container.data('swipe-transition');
259
+ if (typeof data === 'undefined') {data = {};}
260
+
261
+ data.delta_x = e.touches[0].pageX - data.start_page_x;
262
+
263
+ if ( typeof data.is_scrolling === 'undefined') {
264
+ data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
265
+ }
266
+
267
+ if (!data.is_scrolling && !data.active) {
268
+ e.preventDefault();
269
+ var direction = (data.delta_x < 0) ? (idx+1) : (idx-1);
270
+ data.active = true;
271
+ self._goto(direction);
272
+ }
273
+ })
274
+ .on('touchend.fndtn.orbit', function(e) {
275
+ container.data('swipe-transition', {});
276
+ e.stopPropagation();
277
+ })
278
+ }
279
+ container.on('mouseenter.fndtn.orbit', function(e) {
280
+ if (settings.timer && settings.pause_on_hover) {
281
+ self.stop_timer();
282
+ }
283
+ })
284
+ .on('mouseleave.fndtn.orbit', function(e) {
285
+ if (settings.timer && settings.resume_on_mouseout) {
286
+ timer.start();
287
+ }
288
+ });
289
+
290
+ $(document).on('click', '[data-orbit-link]', self.link_custom);
291
+ $(window).on('load resize', self.compute_dimensions);
292
+ Foundation.utils.image_loaded(this.slides().children('img'), self.compute_dimensions);
293
+ Foundation.utils.image_loaded(this.slides().children('img'), function() {
294
+ container.prev('.'+settings.preloader_class).css('display', 'none');
295
+ self.update_slide_number(0);
296
+ self.update_active_link(0);
297
+ slides_container.trigger('ready.fndtn.orbit');
298
+ });
299
+ };
300
+
301
+ self.init();
302
+ };
303
+
304
+ var Timer = function(el, settings, callback) {
305
+ var self = this,
306
+ duration = settings.timer_speed,
307
+ progress = el.find('.'+settings.timer_progress_class),
308
+ start,
309
+ timeout,
310
+ left = -1;
311
+
312
+ this.update_progress = function(w) {
313
+ var new_progress = progress.clone();
314
+ new_progress.attr('style', '');
315
+ new_progress.css('width', w+'%');
316
+ progress.replaceWith(new_progress);
317
+ progress = new_progress;
318
+ };
319
+
320
+ this.restart = function() {
321
+ clearTimeout(timeout);
322
+ el.addClass(settings.timer_paused_class);
323
+ left = -1;
324
+ self.update_progress(0);
325
+ };
326
+
327
+ this.start = function() {
328
+ if (!el.hasClass(settings.timer_paused_class)) {return true;}
329
+ left = (left === -1) ? duration : left;
330
+ el.removeClass(settings.timer_paused_class);
331
+ start = new Date().getTime();
332
+ progress.animate({'width': '100%'}, left, 'linear');
333
+ timeout = setTimeout(function() {
334
+ self.restart();
335
+ callback();
336
+ }, left);
337
+ el.trigger('timer-started.fndtn.orbit')
338
+ };
339
+
340
+ this.stop = function() {
341
+ if (el.hasClass(settings.timer_paused_class)) {return true;}
342
+ clearTimeout(timeout);
343
+ el.addClass(settings.timer_paused_class);
344
+ var end = new Date().getTime();
345
+ left = left - (end - start);
346
+ var w = 100 - ((left / duration) * 100);
347
+ self.update_progress(w);
348
+ el.trigger('timer-stopped.fndtn.orbit');
349
+ };
350
+ };
351
+
352
+ var SlideAnimation = function(settings, container) {
353
+ var duration = settings.animation_speed;
354
+ var is_rtl = ($('html[dir=rtl]').length === 1);
355
+ var margin = is_rtl ? 'marginRight' : 'marginLeft';
356
+ var animMargin = {};
357
+ animMargin[margin] = '0%';
358
+
359
+ this.next = function(current, next, callback) {
360
+ current.animate({marginLeft:'-100%'}, duration);
361
+ next.animate(animMargin, duration, function() {
362
+ current.css(margin, '100%');
363
+ callback();
364
+ });
365
+ };
366
+
367
+ this.prev = function(current, prev, callback) {
368
+ current.animate({marginLeft:'100%'}, duration);
369
+ prev.css(margin, '-100%');
370
+ prev.animate(animMargin, duration, function() {
371
+ current.css(margin, '100%');
372
+ callback();
373
+ });
374
+ };
375
+ };
376
+
377
+ var FadeAnimation = function(settings, container) {
378
+ var duration = settings.animation_speed;
379
+ var is_rtl = ($('html[dir=rtl]').length === 1);
380
+ var margin = is_rtl ? 'marginRight' : 'marginLeft';
381
+
382
+ this.next = function(current, next, callback) {
383
+ next.css({'margin':'0%', 'opacity':'0.01'});
384
+ next.animate({'opacity':'1'}, duration, 'linear', function() {
385
+ current.css('margin', '100%');
386
+ callback();
387
+ });
388
+ };
389
+
390
+ this.prev = function(current, prev, callback) {
391
+ prev.css({'margin':'0%', 'opacity':'0.01'});
392
+ prev.animate({'opacity':'1'}, duration, 'linear', function() {
393
+ current.css('margin', '100%');
394
+ callback();
395
+ });
396
+ };
397
+ };
398
+
399
+
400
+ Foundation.libs = Foundation.libs || {};
401
+
402
+ Foundation.libs.orbit = {
403
+ name: 'orbit',
404
+
405
+ version: '5.3.0',
406
+
407
+ settings: {
408
+ animation: 'slide',
409
+ timer_speed: 10000,
410
+ pause_on_hover: true,
411
+ resume_on_mouseout: false,
412
+ next_on_click: true,
413
+ animation_speed: 500,
414
+ stack_on_small: false,
415
+ navigation_arrows: true,
416
+ slide_number: true,
417
+ slide_number_text: 'of',
418
+ container_class: 'orbit-container',
419
+ stack_on_small_class: 'orbit-stack-on-small',
420
+ next_class: 'orbit-next',
421
+ prev_class: 'orbit-prev',
422
+ timer_container_class: 'orbit-timer',
423
+ timer_paused_class: 'paused',
424
+ timer_progress_class: 'orbit-progress',
425
+ slides_container_class: 'orbit-slides-container',
426
+ preloader_class: 'preloader',
427
+ slide_selector: '*',
428
+ bullets_container_class: 'orbit-bullets',
429
+ bullets_active_class: 'active',
430
+ slide_number_class: 'orbit-slide-number',
431
+ caption_class: 'orbit-caption',
432
+ active_slide_class: 'active',
433
+ orbit_transition_class: 'orbit-transitioning',
434
+ bullets: true,
435
+ circular: true,
436
+ timer: true,
437
+ variable_height: false,
438
+ swipe: true,
439
+ before_slide_change: noop,
440
+ after_slide_change: noop
441
+ },
442
+
443
+ init : function (scope, method, options) {
444
+ var self = this;
445
+ this.bindings(method, options);
446
+ },
447
+
448
+ events : function (instance) {
449
+ var orbit_instance = new Orbit(this.S(instance), this.S(instance).data('orbit-init'));
450
+ this.S(instance).data(self.name + '-instance', orbit_instance);
451
+ },
452
+
453
+ reflow : function () {
454
+ var self = this;
455
+
456
+ if (self.S(self.scope).is('[data-orbit]')) {
457
+ var $el = self.S(self.scope);
458
+ var instance = $el.data(self.name + '-instance');
459
+ instance.compute_dimensions();
460
+ } else {
461
+ self.S('[data-orbit]', self.scope).each(function(idx, el) {
462
+ var $el = self.S(el);
463
+ var opts = self.data_options($el);
464
+ var instance = $el.data(self.name + '-instance');
465
+ instance.compute_dimensions();
466
+ });
467
+ }
468
+ }
469
+ };
470
+
471
+
472
+ }(jQuery, window, window.document));