docs-cambiocds-com-jekyll-theme 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/assets/css/asciidoctor.css +398 -0
  3. data/assets/css/coderay.css +90 -0
  4. data/assets/css/font-awesome.css +1801 -0
  5. data/assets/css/font-awesome.min.css +4 -0
  6. data/assets/css/foundation.css +8545 -0
  7. data/assets/css/foundation.min.css +8331 -0
  8. data/assets/css/normalize.css +427 -0
  9. data/assets/js/foundation.min.js +6069 -0
  10. data/assets/js/foundation/foundation.abide.js +325 -0
  11. data/assets/js/foundation/foundation.accordion.js +71 -0
  12. data/assets/js/foundation/foundation.alert.js +46 -0
  13. data/assets/js/foundation/foundation.clearing.js +573 -0
  14. data/assets/js/foundation/foundation.dropdown.js +444 -0
  15. data/assets/js/foundation/foundation.equalizer.js +77 -0
  16. data/assets/js/foundation/foundation.interchange.js +349 -0
  17. data/assets/js/foundation/foundation.joyride.js +939 -0
  18. data/assets/js/foundation/foundation.js +691 -0
  19. data/assets/js/foundation/foundation.magellan.js +199 -0
  20. data/assets/js/foundation/foundation.offcanvas.js +154 -0
  21. data/assets/js/foundation/foundation.orbit.js +512 -0
  22. data/assets/js/foundation/foundation.reveal.js +455 -0
  23. data/assets/js/foundation/foundation.slider.js +268 -0
  24. data/assets/js/foundation/foundation.tab.js +221 -0
  25. data/assets/js/foundation/foundation.tooltip.js +301 -0
  26. data/assets/js/foundation/foundation.topbar.js +444 -0
  27. data/assets/js/toc.js +82 -0
  28. data/assets/js/vendor/fastclick.js +169 -0
  29. data/assets/js/vendor/jquery.cookie.js +57 -0
  30. data/assets/js/vendor/jquery.js +2339 -0
  31. data/assets/js/vendor/modernizr.js +304 -0
  32. data/assets/js/vendor/placeholder.js +75 -0
  33. metadata +34 -3
@@ -0,0 +1,301 @@
1
+ ;
2
+ (function ($, window, document, undefined) {
3
+ 'use strict';
4
+
5
+ Foundation.libs.tooltip = {
6
+ name: 'tooltip',
7
+
8
+ version: '5.5.0',
9
+
10
+ settings: {
11
+ additional_inheritable_classes: [],
12
+ tooltip_class: '.tooltip',
13
+ append_to: 'body',
14
+ touch_close_text: 'Tap To Close',
15
+ disable_for_touch: false,
16
+ hover_delay: 200,
17
+ show_on: 'all',
18
+ tip_template: function (selector, content) {
19
+ return '<span data-selector="' + selector + '" id="' + selector + '" class="'
20
+ + Foundation.libs.tooltip.settings.tooltip_class.substring(1)
21
+ + '" role="tooltip">' + content + '<span class="nub"></span></span>';
22
+ }
23
+ },
24
+
25
+ cache: {},
26
+
27
+ init: function (scope, method, options) {
28
+ Foundation.inherit(this, 'random_str');
29
+ this.bindings(method, options);
30
+ },
31
+
32
+ should_show: function (target, tip) {
33
+ var settings = $.extend({}, this.settings, this.data_options(target));
34
+
35
+ if (settings.show_on === 'all') {
36
+ return true;
37
+ } else if (this.small() && settings.show_on === 'small') {
38
+ return true;
39
+ } else if (this.medium() && settings.show_on === 'medium') {
40
+ return true;
41
+ } else if (this.large() && settings.show_on === 'large') {
42
+ return true;
43
+ }
44
+ return false;
45
+ },
46
+
47
+ medium: function () {
48
+ return matchMedia(Foundation.media_queries['medium']).matches;
49
+ },
50
+
51
+ large: function () {
52
+ return matchMedia(Foundation.media_queries['large']).matches;
53
+ },
54
+
55
+ events: function (instance) {
56
+ var self = this,
57
+ S = self.S;
58
+
59
+ self.create(this.S(instance));
60
+
61
+ $(this.scope)
62
+ .off('.tooltip')
63
+ .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip',
64
+ '[' + this.attr_name() + ']', function (e) {
65
+ var $this = S(this),
66
+ settings = $.extend({}, self.settings, self.data_options($this)),
67
+ is_touch = false;
68
+
69
+ if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type) && S(e.target).is('a')) {
70
+ return false;
71
+ }
72
+
73
+ if (/mouse/i.test(e.type) && self.ie_touch(e)) return false;
74
+
75
+ if ($this.hasClass('open')) {
76
+ if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) e.preventDefault();
77
+ self.hide($this);
78
+ } else {
79
+ if (settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
80
+ return;
81
+ } else if (!settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
82
+ e.preventDefault();
83
+ S(settings.tooltip_class + '.open').hide();
84
+ is_touch = true;
85
+ }
86
+
87
+ if (/enter|over/i.test(e.type)) {
88
+ this.timer = setTimeout(function () {
89
+ var tip = self.showTip($this);
90
+ }.bind(this), self.settings.hover_delay);
91
+ } else if (e.type === 'mouseout' || e.type === 'mouseleave') {
92
+ clearTimeout(this.timer);
93
+ self.hide($this);
94
+ } else {
95
+ self.showTip($this);
96
+ }
97
+ }
98
+ })
99
+ .on('mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', '[' + this.attr_name() + '].open', function (e) {
100
+ if (/mouse/i.test(e.type) && self.ie_touch(e)) return false;
101
+
102
+ if ($(this).data('tooltip-open-event-type') == 'touch' && e.type == 'mouseleave') {
103
+ return;
104
+ }
105
+ else if ($(this).data('tooltip-open-event-type') == 'mouse' && /MSPointerDown|touchstart/i.test(e.type)) {
106
+ self.convert_to_touch($(this));
107
+ } else {
108
+ self.hide($(this));
109
+ }
110
+ })
111
+ .on('DOMNodeRemoved DOMAttrModified', '[' + this.attr_name() + ']:not(a)', function (e) {
112
+ self.hide(S(this));
113
+ });
114
+ },
115
+
116
+ ie_touch: function (e) {
117
+ // How do I distinguish between IE11 and Windows Phone 8?????
118
+ return false;
119
+ },
120
+
121
+ showTip: function ($target) {
122
+ var $tip = this.getTip($target);
123
+ if (this.should_show($target, $tip)) {
124
+ return this.show($target);
125
+ }
126
+ return;
127
+ },
128
+
129
+ getTip: function ($target) {
130
+ var selector = this.selector($target),
131
+ settings = $.extend({}, this.settings, this.data_options($target)),
132
+ tip = null;
133
+
134
+ if (selector) {
135
+ tip = this.S('span[data-selector="' + selector + '"]' + settings.tooltip_class);
136
+ }
137
+
138
+ return (typeof tip === 'object') ? tip : false;
139
+ },
140
+
141
+ selector: function ($target) {
142
+ var id = $target.attr('id'),
143
+ dataSelector = $target.attr(this.attr_name()) || $target.attr('data-selector');
144
+
145
+ if ((id && id.length < 1 || !id) && typeof dataSelector != 'string') {
146
+ dataSelector = this.random_str(6);
147
+ $target
148
+ .attr('data-selector', dataSelector)
149
+ .attr('aria-describedby', dataSelector);
150
+ }
151
+
152
+ return (id && id.length > 0) ? id : dataSelector;
153
+ },
154
+
155
+ create: function ($target) {
156
+ var self = this,
157
+ settings = $.extend({}, this.settings, this.data_options($target)),
158
+ tip_template = this.settings.tip_template;
159
+
160
+ if (typeof settings.tip_template === 'string' && window.hasOwnProperty(settings.tip_template)) {
161
+ tip_template = window[settings.tip_template];
162
+ }
163
+
164
+ var $tip = $(tip_template(this.selector($target), $('<div></div>').html($target.attr('title')).html())),
165
+ classes = this.inheritable_classes($target);
166
+
167
+ $tip.addClass(classes).appendTo(settings.append_to);
168
+
169
+ if (Modernizr.touch) {
170
+ $tip.append('<span class="tap-to-close">' + settings.touch_close_text + '</span>');
171
+ $tip.on('touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', function (e) {
172
+ self.hide($target);
173
+ });
174
+ }
175
+
176
+ $target.removeAttr('title').attr('title', '');
177
+ },
178
+
179
+ reposition: function (target, tip, classes) {
180
+ var width, nub, nubHeight, nubWidth, column, objPos;
181
+
182
+ tip.css('visibility', 'hidden').show();
183
+
184
+ width = target.data('width');
185
+ nub = tip.children('.nub');
186
+ nubHeight = nub.outerHeight();
187
+ nubWidth = nub.outerHeight();
188
+
189
+ if (this.small()) {
190
+ tip.css({'width': '100%'});
191
+ } else {
192
+ tip.css({'width': (width) ? width : 'auto'});
193
+ }
194
+
195
+ objPos = function (obj, top, right, bottom, left, width) {
196
+ return obj.css({
197
+ 'top': (top) ? top : 'auto',
198
+ 'bottom': (bottom) ? bottom : 'auto',
199
+ 'left': (left) ? left : 'auto',
200
+ 'right': (right) ? right : 'auto'
201
+ }).end();
202
+ };
203
+
204
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', target.offset().left);
205
+
206
+ if (this.small()) {
207
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', 12.5, $(this.scope).width());
208
+ tip.addClass('tip-override');
209
+ objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);
210
+ } else {
211
+ var left = target.offset().left;
212
+ if (Foundation.rtl) {
213
+ nub.addClass('rtl');
214
+ left = target.offset().left + target.outerWidth() - tip.outerWidth();
215
+ }
216
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', left);
217
+ tip.removeClass('tip-override');
218
+ if (classes && classes.indexOf('tip-top') > -1) {
219
+ if (Foundation.rtl) nub.addClass('rtl');
220
+ objPos(tip, (target.offset().top - tip.outerHeight()), 'auto', 'auto', left)
221
+ .removeClass('tip-override');
222
+ } else if (classes && classes.indexOf('tip-left') > -1) {
223
+ objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left - tip.outerWidth() - nubHeight))
224
+ .removeClass('tip-override');
225
+ nub.removeClass('rtl');
226
+ } else if (classes && classes.indexOf('tip-right') > -1) {
227
+ objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left + target.outerWidth() + nubHeight))
228
+ .removeClass('tip-override');
229
+ nub.removeClass('rtl');
230
+ }
231
+ }
232
+
233
+ tip.css('visibility', 'visible').hide();
234
+ },
235
+
236
+ small: function () {
237
+ return matchMedia(Foundation.media_queries.small).matches && !matchMedia(Foundation.media_queries.medium).matches;
238
+ },
239
+
240
+ inheritable_classes: function ($target) {
241
+ var settings = $.extend({}, this.settings, this.data_options($target)),
242
+ inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'radius', 'round'].concat(settings.additional_inheritable_classes),
243
+ classes = $target.attr('class'),
244
+ filtered = classes ? $.map(classes.split(' '), function (el, i) {
245
+ if ($.inArray(el, inheritables) !== -1) {
246
+ return el;
247
+ }
248
+ }).join(' ') : '';
249
+
250
+ return $.trim(filtered);
251
+ },
252
+
253
+ convert_to_touch: function ($target) {
254
+ var self = this,
255
+ $tip = self.getTip($target),
256
+ settings = $.extend({}, self.settings, self.data_options($target));
257
+
258
+ if ($tip.find('.tap-to-close').length === 0) {
259
+ $tip.append('<span class="tap-to-close">' + settings.touch_close_text + '</span>');
260
+ $tip.on('click.fndtn.tooltip.tapclose touchstart.fndtn.tooltip.tapclose MSPointerDown.fndtn.tooltip.tapclose', function (e) {
261
+ self.hide($target);
262
+ });
263
+ }
264
+
265
+ $target.data('tooltip-open-event-type', 'touch');
266
+ },
267
+
268
+ show: function ($target) {
269
+ var $tip = this.getTip($target);
270
+
271
+ if ($target.data('tooltip-open-event-type') == 'touch') {
272
+ this.convert_to_touch($target);
273
+ }
274
+
275
+ this.reposition($target, $tip, $target.attr('class'));
276
+ $target.addClass('open');
277
+ $tip.fadeIn(150);
278
+ },
279
+
280
+ hide: function ($target) {
281
+ var $tip = this.getTip($target);
282
+
283
+ $tip.fadeOut(150, function () {
284
+ $tip.find('.tap-to-close').remove();
285
+ $tip.off('click.fndtn.tooltip.tapclose MSPointerDown.fndtn.tapclose');
286
+ $target.removeClass('open');
287
+ });
288
+ },
289
+
290
+ off: function () {
291
+ var self = this;
292
+ this.S(this.scope).off('.fndtn.tooltip');
293
+ this.S(this.settings.tooltip_class).each(function (i) {
294
+ $('[' + self.attr_name() + ']').eq(i).attr('title', $(this).text());
295
+ }).remove();
296
+ },
297
+
298
+ reflow: function () {
299
+ }
300
+ };
301
+ }(jQuery, window, window.document));
@@ -0,0 +1,444 @@
1
+ ;
2
+ (function ($, window, document, undefined) {
3
+ 'use strict';
4
+
5
+ Foundation.libs.topbar = {
6
+ name: 'topbar',
7
+
8
+ version: '5.5.0',
9
+
10
+ settings: {
11
+ index: 0,
12
+ sticky_class: 'sticky',
13
+ custom_back_text: true,
14
+ back_text: 'Back',
15
+ mobile_show_parent_link: true,
16
+ is_hover: true,
17
+ scrolltop: true, // jump to top when sticky nav menu toggle is clicked
18
+ sticky_on: 'all'
19
+ },
20
+
21
+ init: function (section, method, options) {
22
+ Foundation.inherit(this, 'add_custom_rule register_media throttle');
23
+ var self = this;
24
+
25
+ self.register_media('topbar', 'foundation-mq-topbar');
26
+
27
+ this.bindings(method, options);
28
+
29
+ self.S('[' + this.attr_name() + ']', this.scope).each(function () {
30
+ var topbar = $(this),
31
+ settings = topbar.data(self.attr_name(true) + '-init'),
32
+ section = self.S('section, .top-bar-section', this);
33
+ topbar.data('index', 0);
34
+ var topbarContainer = topbar.parent();
35
+ if (topbarContainer.hasClass('fixed') || self.is_sticky(topbar, topbarContainer, settings)) {
36
+ self.settings.sticky_class = settings.sticky_class;
37
+ self.settings.sticky_topbar = topbar;
38
+ topbar.data('height', topbarContainer.outerHeight());
39
+ topbar.data('stickyoffset', topbarContainer.offset().top);
40
+ } else {
41
+ topbar.data('height', topbar.outerHeight());
42
+ }
43
+
44
+ if (!settings.assembled) {
45
+ self.assemble(topbar);
46
+ }
47
+
48
+ if (settings.is_hover) {
49
+ self.S('.has-dropdown', topbar).addClass('not-click');
50
+ } else {
51
+ self.S('.has-dropdown', topbar).removeClass('not-click');
52
+ }
53
+
54
+ // Pad body when sticky (scrolled) or fixed.
55
+ self.add_custom_rule('.f-topbar-fixed { padding-top: ' + topbar.data('height') + 'px }');
56
+
57
+ if (topbarContainer.hasClass('fixed')) {
58
+ self.S('body').addClass('f-topbar-fixed');
59
+ }
60
+ });
61
+
62
+ },
63
+
64
+ is_sticky: function (topbar, topbarContainer, settings) {
65
+ var sticky = topbarContainer.hasClass(settings.sticky_class);
66
+
67
+ if (sticky && settings.sticky_on === 'all') {
68
+ return true;
69
+ } else if (sticky && this.small() && settings.sticky_on === 'small') {
70
+ return (matchMedia(Foundation.media_queries.small).matches && !matchMedia(Foundation.media_queries.medium).matches && !matchMedia(Foundation.media_queries.large).matches);
71
+ //return true;
72
+ } else if (sticky && this.medium() && settings.sticky_on === 'medium') {
73
+ return (matchMedia(Foundation.media_queries.small).matches && matchMedia(Foundation.media_queries.medium).matches && !matchMedia(Foundation.media_queries.large).matches);
74
+ //return true;
75
+ } else if (sticky && this.large() && settings.sticky_on === 'large') {
76
+ return (matchMedia(Foundation.media_queries.small).matches && matchMedia(Foundation.media_queries.medium).matches &&
77
+ matchMedia(Foundation.media_queries.large).matches);
78
+ //return true;
79
+ }
80
+
81
+ return false;
82
+ },
83
+
84
+ toggle: function (toggleEl) {
85
+ var self = this,
86
+ topbar;
87
+
88
+ if (toggleEl) {
89
+ topbar = self.S(toggleEl).closest('[' + this.attr_name() + ']');
90
+ } else {
91
+ topbar = self.S('[' + this.attr_name() + ']');
92
+ }
93
+
94
+ var settings = topbar.data(this.attr_name(true) + '-init');
95
+
96
+ var section = self.S('section, .top-bar-section', topbar);
97
+
98
+ if (self.breakpoint()) {
99
+ if (!self.rtl) {
100
+ section.css({left: '0%'});
101
+ $('>.name', section).css({left: '100%'});
102
+ } else {
103
+ section.css({right: '0%'});
104
+ $('>.name', section).css({right: '100%'});
105
+ }
106
+
107
+ self.S('li.moved', section).removeClass('moved');
108
+ topbar.data('index', 0);
109
+
110
+ topbar
111
+ .toggleClass('expanded')
112
+ .css('height', '');
113
+ }
114
+
115
+ if (settings.scrolltop) {
116
+ if (!topbar.hasClass('expanded')) {
117
+ if (topbar.hasClass('fixed')) {
118
+ topbar.parent().addClass('fixed');
119
+ topbar.removeClass('fixed');
120
+ self.S('body').addClass('f-topbar-fixed');
121
+ }
122
+ } else if (topbar.parent().hasClass('fixed')) {
123
+ if (settings.scrolltop) {
124
+ topbar.parent().removeClass('fixed');
125
+ topbar.addClass('fixed');
126
+ self.S('body').removeClass('f-topbar-fixed');
127
+
128
+ window.scrollTo(0, 0);
129
+ } else {
130
+ topbar.parent().removeClass('expanded');
131
+ }
132
+ }
133
+ } else {
134
+ if (self.is_sticky(topbar, topbar.parent(), settings)) {
135
+ topbar.parent().addClass('fixed');
136
+ }
137
+
138
+ if (topbar.parent().hasClass('fixed')) {
139
+ if (!topbar.hasClass('expanded')) {
140
+ topbar.removeClass('fixed');
141
+ topbar.parent().removeClass('expanded');
142
+ self.update_sticky_positioning();
143
+ } else {
144
+ topbar.addClass('fixed');
145
+ topbar.parent().addClass('expanded');
146
+ self.S('body').addClass('f-topbar-fixed');
147
+ }
148
+ }
149
+ }
150
+ },
151
+
152
+ timer: null,
153
+
154
+ events: function (bar) {
155
+ var self = this,
156
+ S = this.S;
157
+
158
+ S(this.scope)
159
+ .off('.topbar')
160
+ .on('click.fndtn.topbar', '[' + this.attr_name() + '] .toggle-topbar', function (e) {
161
+ e.preventDefault();
162
+ self.toggle(this);
163
+ })
164
+ .on('click.fndtn.topbar', '.top-bar .top-bar-section li a[href^="#"],[' + this.attr_name() + '] .top-bar-section li a[href^="#"]', function (e) {
165
+ var li = $(this).closest('li');
166
+ if (self.breakpoint() && !li.hasClass('back') && !li.hasClass('has-dropdown')) {
167
+ self.toggle();
168
+ }
169
+ })
170
+ .on('click.fndtn.topbar', '[' + this.attr_name() + '] li.has-dropdown', function (e) {
171
+ var li = S(this),
172
+ target = S(e.target),
173
+ topbar = li.closest('[' + self.attr_name() + ']'),
174
+ settings = topbar.data(self.attr_name(true) + '-init');
175
+
176
+ if (target.data('revealId')) {
177
+ self.toggle();
178
+ return;
179
+ }
180
+
181
+ if (self.breakpoint()) return;
182
+ if (settings.is_hover && !Modernizr.touch) return;
183
+
184
+ e.stopImmediatePropagation();
185
+
186
+ if (li.hasClass('hover')) {
187
+ li
188
+ .removeClass('hover')
189
+ .find('li')
190
+ .removeClass('hover');
191
+
192
+ li.parents('li.hover')
193
+ .removeClass('hover');
194
+ } else {
195
+ li.addClass('hover');
196
+
197
+ $(li).siblings().removeClass('hover');
198
+
199
+ if (target[0].nodeName === 'A' && target.parent().hasClass('has-dropdown')) {
200
+ e.preventDefault();
201
+ }
202
+ }
203
+ })
204
+ .on('click.fndtn.topbar', '[' + this.attr_name() + '] .has-dropdown>a', function (e) {
205
+ if (self.breakpoint()) {
206
+
207
+ e.preventDefault();
208
+
209
+ var $this = S(this),
210
+ topbar = $this.closest('[' + self.attr_name() + ']'),
211
+ section = topbar.find('section, .top-bar-section'),
212
+ dropdownHeight = $this.next('.dropdown').outerHeight(),
213
+ $selectedLi = $this.closest('li');
214
+
215
+ topbar.data('index', topbar.data('index') + 1);
216
+ $selectedLi.addClass('moved');
217
+
218
+ if (!self.rtl) {
219
+ section.css({left: -(100 * topbar.data('index')) + '%'});
220
+ section.find('>.name').css({left: 100 * topbar.data('index') + '%'});
221
+ } else {
222
+ section.css({right: -(100 * topbar.data('index')) + '%'});
223
+ section.find('>.name').css({right: 100 * topbar.data('index') + '%'});
224
+ }
225
+
226
+ topbar.css('height', $this.siblings('ul').outerHeight(true) + topbar.data('height'));
227
+ }
228
+ });
229
+
230
+ S(window).off('.topbar').on('resize.fndtn.topbar', self.throttle(function () {
231
+ self.resize.call(self);
232
+ }, 50)).trigger('resize').trigger('resize.fndtn.topbar').load(function () {
233
+ // Ensure that the offset is calculated after all of the pages resources have loaded
234
+ S(this).trigger('resize.fndtn.topbar');
235
+ });
236
+
237
+ S('body').off('.topbar').on('click.fndtn.topbar', function (e) {
238
+ var parent = S(e.target).closest('li').closest('li.hover');
239
+
240
+ if (parent.length > 0) {
241
+ return;
242
+ }
243
+
244
+ S('[' + self.attr_name() + '] li.hover').removeClass('hover');
245
+ });
246
+
247
+ // Go up a level on Click
248
+ S(this.scope).on('click.fndtn.topbar', '[' + this.attr_name() + '] .has-dropdown .back', function (e) {
249
+ e.preventDefault();
250
+
251
+ var $this = S(this),
252
+ topbar = $this.closest('[' + self.attr_name() + ']'),
253
+ section = topbar.find('section, .top-bar-section'),
254
+ settings = topbar.data(self.attr_name(true) + '-init'),
255
+ $movedLi = $this.closest('li.moved'),
256
+ $previousLevelUl = $movedLi.parent();
257
+
258
+ topbar.data('index', topbar.data('index') - 1);
259
+
260
+ if (!self.rtl) {
261
+ section.css({left: -(100 * topbar.data('index')) + '%'});
262
+ section.find('>.name').css({left: 100 * topbar.data('index') + '%'});
263
+ } else {
264
+ section.css({right: -(100 * topbar.data('index')) + '%'});
265
+ section.find('>.name').css({right: 100 * topbar.data('index') + '%'});
266
+ }
267
+
268
+ if (topbar.data('index') === 0) {
269
+ topbar.css('height', '');
270
+ } else {
271
+ topbar.css('height', $previousLevelUl.outerHeight(true) + topbar.data('height'));
272
+ }
273
+
274
+ setTimeout(function () {
275
+ $movedLi.removeClass('moved');
276
+ }, 300);
277
+ });
278
+
279
+ // Show dropdown menus when their items are focused
280
+ S(this.scope).find('.dropdown a')
281
+ .focus(function () {
282
+ $(this).parents('.has-dropdown').addClass('hover');
283
+ })
284
+ .blur(function () {
285
+ $(this).parents('.has-dropdown').removeClass('hover');
286
+ });
287
+ },
288
+
289
+ resize: function () {
290
+ var self = this;
291
+ self.S('[' + this.attr_name() + ']').each(function () {
292
+ var topbar = self.S(this),
293
+ settings = topbar.data(self.attr_name(true) + '-init');
294
+
295
+ var stickyContainer = topbar.parent('.' + self.settings.sticky_class);
296
+ var stickyOffset;
297
+
298
+ if (!self.breakpoint()) {
299
+ var doToggle = topbar.hasClass('expanded');
300
+ topbar
301
+ .css('height', '')
302
+ .removeClass('expanded')
303
+ .find('li')
304
+ .removeClass('hover');
305
+
306
+ if (doToggle) {
307
+ self.toggle(topbar);
308
+ }
309
+ }
310
+
311
+ if (self.is_sticky(topbar, stickyContainer, settings)) {
312
+ if (stickyContainer.hasClass('fixed')) {
313
+ // Remove the fixed to allow for correct calculation of the offset.
314
+ stickyContainer.removeClass('fixed');
315
+
316
+ stickyOffset = stickyContainer.offset().top;
317
+ if (self.S(document.body).hasClass('f-topbar-fixed')) {
318
+ stickyOffset -= topbar.data('height');
319
+ }
320
+
321
+ topbar.data('stickyoffset', stickyOffset);
322
+ stickyContainer.addClass('fixed');
323
+ } else {
324
+ stickyOffset = stickyContainer.offset().top;
325
+ topbar.data('stickyoffset', stickyOffset);
326
+ }
327
+ }
328
+
329
+ });
330
+ },
331
+
332
+ breakpoint: function () {
333
+ return !matchMedia(Foundation.media_queries['topbar']).matches;
334
+ },
335
+
336
+ small: function () {
337
+ return matchMedia(Foundation.media_queries['small']).matches;
338
+ },
339
+
340
+ medium: function () {
341
+ return matchMedia(Foundation.media_queries['medium']).matches;
342
+ },
343
+
344
+ large: function () {
345
+ return matchMedia(Foundation.media_queries['large']).matches;
346
+ },
347
+
348
+ assemble: function (topbar) {
349
+ var self = this,
350
+ settings = topbar.data(this.attr_name(true) + '-init'),
351
+ section = self.S('section, .top-bar-section', topbar);
352
+
353
+ // Pull element out of the DOM for manipulation
354
+ section.detach();
355
+
356
+ self.S('.has-dropdown>a', section).each(function () {
357
+ var $link = self.S(this),
358
+ $dropdown = $link.siblings('.dropdown'),
359
+ url = $link.attr('href'),
360
+ $titleLi;
361
+
362
+
363
+ if (!$dropdown.find('.title.back').length) {
364
+
365
+ if (settings.mobile_show_parent_link == true && url) {
366
+ $titleLi = $('<li class="title back js-generated"><h5><a href="javascript:void(0)"></a></h5></li><li class="parent-link show-for-small-only"><a class="parent-link js-generated" href="' + url + '">' + $link.html() + '</a></li>');
367
+ } else {
368
+ $titleLi = $('<li class="title back js-generated"><h5><a href="javascript:void(0)"></a></h5>');
369
+ }
370
+
371
+ // Copy link to subnav
372
+ if (settings.custom_back_text == true) {
373
+ $('h5>a', $titleLi).html(settings.back_text);
374
+ } else {
375
+ $('h5>a', $titleLi).html('&laquo; ' + $link.html());
376
+ }
377
+ $dropdown.prepend($titleLi);
378
+ }
379
+ });
380
+
381
+ // Put element back in the DOM
382
+ section.appendTo(topbar);
383
+
384
+ // check for sticky
385
+ this.sticky();
386
+
387
+ this.assembled(topbar);
388
+ },
389
+
390
+ assembled: function (topbar) {
391
+ topbar.data(this.attr_name(true), $.extend({}, topbar.data(this.attr_name(true)), {assembled: true}));
392
+ },
393
+
394
+ height: function (ul) {
395
+ var total = 0,
396
+ self = this;
397
+
398
+ $('> li', ul).each(function () {
399
+ total += self.S(this).outerHeight(true);
400
+ });
401
+
402
+ return total;
403
+ },
404
+
405
+ sticky: function () {
406
+ var self = this;
407
+
408
+ this.S(window).on('scroll', function () {
409
+ self.update_sticky_positioning();
410
+ });
411
+ },
412
+
413
+ update_sticky_positioning: function () {
414
+ var klass = '.' + this.settings.sticky_class,
415
+ $window = this.S(window),
416
+ self = this;
417
+
418
+ if (self.settings.sticky_topbar && self.is_sticky(this.settings.sticky_topbar, this.settings.sticky_topbar.parent(), this.settings)) {
419
+ var distance = this.settings.sticky_topbar.data('stickyoffset');
420
+ if (!self.S(klass).hasClass('expanded')) {
421
+ if ($window.scrollTop() > (distance)) {
422
+ if (!self.S(klass).hasClass('fixed')) {
423
+ self.S(klass).addClass('fixed');
424
+ self.S('body').addClass('f-topbar-fixed');
425
+ }
426
+ } else if ($window.scrollTop() <= distance) {
427
+ if (self.S(klass).hasClass('fixed')) {
428
+ self.S(klass).removeClass('fixed');
429
+ self.S('body').removeClass('f-topbar-fixed');
430
+ }
431
+ }
432
+ }
433
+ }
434
+ },
435
+
436
+ off: function () {
437
+ this.S(this.scope).off('.fndtn.topbar');
438
+ this.S(window).off('.fndtn.topbar');
439
+ },
440
+
441
+ reflow: function () {
442
+ }
443
+ };
444
+ }(jQuery, window, window.document));