rails_db 1.5.0 → 1.6.0

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