themepile-abstractio 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/.gitignore +28 -0
- data/.rbenv-version +1 -0
- data/CONTRIBUTING.md +53 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +136 -0
- data/Rakefile +2 -0
- data/abstractio.gemspec +18 -0
- data/js/foundation/foundation.alerts.js +50 -0
- data/js/foundation/foundation.clearing.js +516 -0
- data/js/foundation/foundation.cookie.js +74 -0
- data/js/foundation/foundation.dropdown.js +159 -0
- data/js/foundation/foundation.forms.js +516 -0
- data/js/foundation/foundation.joyride.js +842 -0
- data/js/foundation/foundation.js +403 -0
- data/js/foundation/foundation.magellan.js +130 -0
- data/js/foundation/foundation.orbit.js +373 -0
- data/js/foundation/foundation.placeholder.js +159 -0
- data/js/foundation/foundation.reveal.js +276 -0
- data/js/foundation/foundation.section.js +409 -0
- data/js/foundation/foundation.tooltips.js +206 -0
- data/js/foundation/foundation.topbar.js +252 -0
- data/js/foundation/index.js +16 -0
- data/js/vendor/custom.modernizr.js +4 -0
- data/js/vendor/jquery.js +9597 -0
- data/js/vendor/zepto.js +1884 -0
- data/lib/abstractio.rb +17 -0
- data/lib/abstractio/engine.rb +20 -0
- data/lib/abstractio/generators/USAGE +15 -0
- data/lib/abstractio/generators/install_generator.rb +54 -0
- data/lib/abstractio/generators/templates/application.html.erb +46 -0
- data/lib/abstractio/generators/templates/application.html.haml +31 -0
- data/lib/abstractio/generators/templates/application.html.slim +28 -0
- data/lib/abstractio/version.rb +3 -0
- data/lib/themepile-abstractio.rb +17 -0
- data/scss/abstractio.scss +46 -0
- data/scss/abstractio/_variables.scss +1224 -0
- data/scss/abstractio/components/_alert-boxes.scss +107 -0
- data/scss/abstractio/components/_block-grid.scss +68 -0
- data/scss/abstractio/components/_breadcrumbs.scss +125 -0
- data/scss/abstractio/components/_button-groups.scss +89 -0
- data/scss/abstractio/components/_buttons.scss +227 -0
- data/scss/abstractio/components/_clearing.scss +224 -0
- data/scss/abstractio/components/_custom-forms.scss +263 -0
- data/scss/abstractio/components/_dropdown-buttons.scss +115 -0
- data/scss/abstractio/components/_dropdown.scss +150 -0
- data/scss/abstractio/components/_flex-video.scss +46 -0
- data/scss/abstractio/components/_forms.scss +362 -0
- data/scss/abstractio/components/_global.scss +280 -0
- data/scss/abstractio/components/_grid.scss +186 -0
- data/scss/abstractio/components/_inline-lists.scss +53 -0
- data/scss/abstractio/components/_joyride.scss +215 -0
- data/scss/abstractio/components/_keystrokes.scss +57 -0
- data/scss/abstractio/components/_labels.scss +85 -0
- data/scss/abstractio/components/_magellan.scss +23 -0
- data/scss/abstractio/components/_orbit.scss +213 -0
- data/scss/abstractio/components/_pagination.scss +100 -0
- data/scss/abstractio/components/_panels.scss +77 -0
- data/scss/abstractio/components/_pricing-tables.scss +131 -0
- data/scss/abstractio/components/_progress-bars.scss +71 -0
- data/scss/abstractio/components/_reveal.scss +132 -0
- data/scss/abstractio/components/_section.scss +318 -0
- data/scss/abstractio/components/_side-nav.scss +69 -0
- data/scss/abstractio/components/_split-buttons.scss +167 -0
- data/scss/abstractio/components/_sub-nav.scss +68 -0
- data/scss/abstractio/components/_switch.scss +251 -0
- data/scss/abstractio/components/_tables.scss +84 -0
- data/scss/abstractio/components/_thumbs.scss +48 -0
- data/scss/abstractio/components/_tooltips.scss +117 -0
- data/scss/abstractio/components/_top-bar.scss +495 -0
- data/scss/abstractio/components/_type.scss +426 -0
- data/scss/abstractio/components/_visibility.scss +322 -0
- data/scss/normalize.scss +402 -0
- data/templates/project/.gitignore +44 -0
- data/templates/project/MIT-LICENSE.txt +20 -0
- data/templates/project/config.rb +26 -0
- data/templates/project/humans.txt +8 -0
- data/templates/project/index.html +124 -0
- data/templates/project/manifest.rb +45 -0
- data/templates/project/robots.txt +4 -0
- data/templates/project/scss/app.scss +48 -0
- data/templates/upgrade/manifest.rb +34 -0
- metadata +153 -0
@@ -0,0 +1,276 @@
|
|
1
|
+
/*jslint unparam: true, browser: true, indent: 2 */
|
2
|
+
|
3
|
+
;(function ($, window, document, undefined) {
|
4
|
+
'use strict';
|
5
|
+
|
6
|
+
Foundation.libs.reveal = {
|
7
|
+
name: 'reveal',
|
8
|
+
|
9
|
+
version : '4.1.3',
|
10
|
+
|
11
|
+
locked : false,
|
12
|
+
|
13
|
+
settings : {
|
14
|
+
animation: 'fadeAndPop',
|
15
|
+
animationSpeed: 250,
|
16
|
+
closeOnBackgroundClick: true,
|
17
|
+
dismissModalClass: 'close-reveal-modal',
|
18
|
+
bgClass: 'reveal-modal-bg',
|
19
|
+
open: function(){},
|
20
|
+
opened: function(){},
|
21
|
+
close: function(){},
|
22
|
+
closed: function(){},
|
23
|
+
bg : $('.reveal-modal-bg'),
|
24
|
+
css : {
|
25
|
+
open : {
|
26
|
+
'opacity': 0,
|
27
|
+
'visibility': 'visible',
|
28
|
+
'display' : 'block'
|
29
|
+
},
|
30
|
+
close : {
|
31
|
+
'opacity': 1,
|
32
|
+
'visibility': 'hidden',
|
33
|
+
'display': 'none'
|
34
|
+
}
|
35
|
+
}
|
36
|
+
},
|
37
|
+
|
38
|
+
init : function (scope, method, options) {
|
39
|
+
Foundation.inherit(this, 'data_options delay');
|
40
|
+
|
41
|
+
if (typeof method === 'object') {
|
42
|
+
$.extend(true, this.settings, method);
|
43
|
+
} else if (typeof options !== 'undefined') {
|
44
|
+
$.extend(true, this.settings, options);
|
45
|
+
}
|
46
|
+
|
47
|
+
if (typeof method != 'string') {
|
48
|
+
this.events();
|
49
|
+
|
50
|
+
return this.settings.init;
|
51
|
+
} else {
|
52
|
+
return this[method].call(this, options);
|
53
|
+
}
|
54
|
+
},
|
55
|
+
|
56
|
+
events : function () {
|
57
|
+
var self = this;
|
58
|
+
|
59
|
+
$(this.scope)
|
60
|
+
.off('.fndtn.reveal')
|
61
|
+
.on('click.fndtn.reveal', '[data-reveal-id]', function (e) {
|
62
|
+
e.preventDefault();
|
63
|
+
if (!self.locked) {
|
64
|
+
self.locked = true;
|
65
|
+
self.open.call(self, $(this));
|
66
|
+
}
|
67
|
+
})
|
68
|
+
.on('click.fndtn.reveal touchend.click.fndtn.reveal', this.close_targets(), function (e) {
|
69
|
+
e.preventDefault();
|
70
|
+
if (!self.locked) {
|
71
|
+
var settings = $.extend({}, self.settings, self.data_options($('.reveal-modal.open')));
|
72
|
+
if ($(e.target)[0] === $('.' + settings.bgClass)[0] && !settings.closeOnBackgroundClick) {
|
73
|
+
return;
|
74
|
+
}
|
75
|
+
|
76
|
+
self.locked = true;
|
77
|
+
self.close.call(self, $(this).closest('.reveal-modal'));
|
78
|
+
}
|
79
|
+
})
|
80
|
+
.on('open.fndtn.reveal', '.reveal-modal', this.settings.open)
|
81
|
+
.on('opened.fndtn.reveal', '.reveal-modal', this.settings.opened)
|
82
|
+
.on('opened.fndtn.reveal', '.reveal-modal', this.open_video)
|
83
|
+
.on('close.fndtn.reveal', '.reveal-modal', this.settings.close)
|
84
|
+
.on('closed.fndtn.reveal', '.reveal-modal', this.settings.closed)
|
85
|
+
.on('closed.fndtn.reveal', '.reveal-modal', this.close_video);
|
86
|
+
|
87
|
+
return true;
|
88
|
+
},
|
89
|
+
|
90
|
+
open : function (target) {
|
91
|
+
if (target) {
|
92
|
+
var modal = $('#' + target.data('reveal-id'));
|
93
|
+
} else {
|
94
|
+
var modal = $(this.scope);
|
95
|
+
}
|
96
|
+
|
97
|
+
if (!modal.hasClass('open')) {
|
98
|
+
var open_modal = $('.reveal-modal.open');
|
99
|
+
|
100
|
+
if (typeof modal.data('css-top') === 'undefined') {
|
101
|
+
modal.data('css-top', parseInt(modal.css('top'), 10))
|
102
|
+
.data('offset', this.cache_offset(modal));
|
103
|
+
}
|
104
|
+
|
105
|
+
modal.trigger('open');
|
106
|
+
|
107
|
+
if (open_modal.length < 1) {
|
108
|
+
this.toggle_bg(modal);
|
109
|
+
}
|
110
|
+
this.hide(open_modal, this.settings.css.close);
|
111
|
+
this.show(modal, this.settings.css.open);
|
112
|
+
}
|
113
|
+
},
|
114
|
+
|
115
|
+
close : function (modal) {
|
116
|
+
|
117
|
+
var modal = modal || $(this.scope),
|
118
|
+
open_modals = $('.reveal-modal.open');
|
119
|
+
|
120
|
+
if (open_modals.length > 0) {
|
121
|
+
this.locked = true;
|
122
|
+
modal.trigger('close');
|
123
|
+
this.toggle_bg(modal);
|
124
|
+
this.hide(open_modals, this.settings.css.close);
|
125
|
+
}
|
126
|
+
},
|
127
|
+
|
128
|
+
close_targets : function () {
|
129
|
+
var base = '.' + this.settings.dismissModalClass;
|
130
|
+
|
131
|
+
if (this.settings.closeOnBackgroundClick) {
|
132
|
+
return base + ', .' + this.settings.bgClass;
|
133
|
+
}
|
134
|
+
|
135
|
+
return base;
|
136
|
+
},
|
137
|
+
|
138
|
+
toggle_bg : function (modal) {
|
139
|
+
if ($('.reveal-modal-bg').length === 0) {
|
140
|
+
this.settings.bg = $('<div />', {'class': this.settings.bgClass})
|
141
|
+
.appendTo('body');
|
142
|
+
}
|
143
|
+
|
144
|
+
if (this.settings.bg.filter(':visible').length > 0) {
|
145
|
+
this.hide(this.settings.bg);
|
146
|
+
} else {
|
147
|
+
this.show(this.settings.bg);
|
148
|
+
}
|
149
|
+
},
|
150
|
+
|
151
|
+
show : function (el, css) {
|
152
|
+
// is modal
|
153
|
+
if (css) {
|
154
|
+
if (/pop/i.test(this.settings.animation)) {
|
155
|
+
css.top = $(window).scrollTop() - el.data('offset') + 'px';
|
156
|
+
var end_css = {
|
157
|
+
top: $(window).scrollTop() + el.data('css-top') + 'px',
|
158
|
+
opacity: 1
|
159
|
+
};
|
160
|
+
|
161
|
+
return this.delay(function () {
|
162
|
+
return el
|
163
|
+
.css(css)
|
164
|
+
.animate(end_css, this.settings.animationSpeed, 'linear', function () {
|
165
|
+
this.locked = false;
|
166
|
+
el.trigger('opened');
|
167
|
+
}.bind(this))
|
168
|
+
.addClass('open');
|
169
|
+
}.bind(this), this.settings.animationSpeed / 2);
|
170
|
+
}
|
171
|
+
|
172
|
+
if (/fade/i.test(this.settings.animation)) {
|
173
|
+
var end_css = {opacity: 1};
|
174
|
+
|
175
|
+
return this.delay(function () {
|
176
|
+
return el
|
177
|
+
.css(css)
|
178
|
+
.animate(end_css, this.settings.animationSpeed, 'linear', function () {
|
179
|
+
this.locked = false;
|
180
|
+
el.trigger('opened');
|
181
|
+
}.bind(this))
|
182
|
+
.addClass('open');
|
183
|
+
}.bind(this), this.settings.animationSpeed / 2);
|
184
|
+
}
|
185
|
+
|
186
|
+
return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened');
|
187
|
+
}
|
188
|
+
|
189
|
+
// should we animate the background?
|
190
|
+
if (/fade/i.test(this.settings.animation)) {
|
191
|
+
return el.fadeIn(this.settings.animationSpeed / 2);
|
192
|
+
}
|
193
|
+
|
194
|
+
return el.show();
|
195
|
+
},
|
196
|
+
|
197
|
+
hide : function (el, css) {
|
198
|
+
// is modal
|
199
|
+
if (css) {
|
200
|
+
if (/pop/i.test(this.settings.animation)) {
|
201
|
+
var end_css = {
|
202
|
+
top: - $(window).scrollTop() - el.data('offset') + 'px',
|
203
|
+
opacity: 0
|
204
|
+
};
|
205
|
+
|
206
|
+
return this.delay(function () {
|
207
|
+
return el
|
208
|
+
.animate(end_css, this.settings.animationSpeed, 'linear', function () {
|
209
|
+
this.locked = false;
|
210
|
+
el.css(css).trigger('closed');
|
211
|
+
}.bind(this))
|
212
|
+
.removeClass('open');
|
213
|
+
}.bind(this), this.settings.animationSpeed / 2);
|
214
|
+
}
|
215
|
+
|
216
|
+
if (/fade/i.test(this.settings.animation)) {
|
217
|
+
var end_css = {opacity: 0};
|
218
|
+
|
219
|
+
return this.delay(function () {
|
220
|
+
return el
|
221
|
+
.animate(end_css, this.settings.animationSpeed, 'linear', function () {
|
222
|
+
this.locked = false;
|
223
|
+
el.css(css).trigger('closed');
|
224
|
+
}.bind(this))
|
225
|
+
.removeClass('open');
|
226
|
+
}.bind(this), this.settings.animationSpeed / 2);
|
227
|
+
}
|
228
|
+
|
229
|
+
return el.hide().css(css).removeClass('open').trigger('closed');
|
230
|
+
}
|
231
|
+
|
232
|
+
// should we animate the background?
|
233
|
+
if (/fade/i.test(this.settings.animation)) {
|
234
|
+
return el.fadeOut(this.settings.animationSpeed / 2);
|
235
|
+
}
|
236
|
+
|
237
|
+
return el.hide();
|
238
|
+
},
|
239
|
+
|
240
|
+
close_video : function (e) {
|
241
|
+
var video = $(this).find('.flex-video'),
|
242
|
+
iframe = video.find('iframe');
|
243
|
+
|
244
|
+
if (iframe.length > 0) {
|
245
|
+
iframe.attr('data-src', iframe[0].src);
|
246
|
+
iframe.attr('src', 'about:blank');
|
247
|
+
video.hide();
|
248
|
+
}
|
249
|
+
},
|
250
|
+
|
251
|
+
open_video : function (e) {
|
252
|
+
var video = $(this).find('.flex-video'),
|
253
|
+
iframe = video.find('iframe');
|
254
|
+
|
255
|
+
if (iframe.length > 0) {
|
256
|
+
var data_src = iframe.attr('data-src');
|
257
|
+
if (typeof data_src === 'string') {
|
258
|
+
iframe[0].src = iframe.attr('data-src');
|
259
|
+
}
|
260
|
+
video.show();
|
261
|
+
}
|
262
|
+
},
|
263
|
+
|
264
|
+
cache_offset : function (modal) {
|
265
|
+
var offset = modal.show().height() + parseInt(modal.css('top'), 10);
|
266
|
+
|
267
|
+
modal.hide();
|
268
|
+
|
269
|
+
return offset;
|
270
|
+
},
|
271
|
+
|
272
|
+
off : function () {
|
273
|
+
$(this.scope).off('.fndtn.reveal');
|
274
|
+
}
|
275
|
+
};
|
276
|
+
}(Foundation.zj, this, this.document));
|
@@ -0,0 +1,409 @@
|
|
1
|
+
/*jslint unparam: true, browser: true, indent: 2 */
|
2
|
+
|
3
|
+
;(function ($, window, document, undefined) {
|
4
|
+
'use strict';
|
5
|
+
|
6
|
+
Foundation.libs.section = {
|
7
|
+
name: 'section',
|
8
|
+
|
9
|
+
version : '4.1.7',
|
10
|
+
|
11
|
+
settings : {
|
12
|
+
deep_linking: false,
|
13
|
+
one_up: true,
|
14
|
+
section_selector : '[data-section]',
|
15
|
+
region_selector : 'section, .section, [data-section-region]',
|
16
|
+
title_selector : '.title, [data-section-title]',
|
17
|
+
active_region_selector : 'section.active, .section.active, .active[data-section-region]',
|
18
|
+
content_selector : '.content, [data-section-content]',
|
19
|
+
nav_selector : '[data-section="vertical-nav"], [data-section="horizontal-nav"]',
|
20
|
+
callback: function (){}
|
21
|
+
},
|
22
|
+
|
23
|
+
init : function (scope, method, options) {
|
24
|
+
var self = this;
|
25
|
+
Foundation.inherit(this, 'throttle data_options position_right offset_right');
|
26
|
+
|
27
|
+
if (typeof method === 'object') {
|
28
|
+
$.extend(true, self.settings, method);
|
29
|
+
}
|
30
|
+
|
31
|
+
if (typeof method != 'string') {
|
32
|
+
this.set_active_from_hash();
|
33
|
+
this.events();
|
34
|
+
|
35
|
+
return true;
|
36
|
+
} else {
|
37
|
+
return this[method].call(this, options);
|
38
|
+
}
|
39
|
+
},
|
40
|
+
|
41
|
+
events : function () {
|
42
|
+
var self = this;
|
43
|
+
|
44
|
+
$(this.scope)
|
45
|
+
.on('click.fndtn.section', '[data-section] .title, [data-section] [data-section-title]', function (e) {
|
46
|
+
var $this = $(this),
|
47
|
+
section = $this.closest(self.settings.section_selector);
|
48
|
+
|
49
|
+
self.toggle_active.call(this, e, self);
|
50
|
+
self.reflow();
|
51
|
+
});
|
52
|
+
|
53
|
+
$(window)
|
54
|
+
.on('resize.fndtn.section', self.throttle(function () {
|
55
|
+
self.resize.call(this);
|
56
|
+
}, 30))
|
57
|
+
.on('hashchange', function () {
|
58
|
+
if (!self.settings.toggled){
|
59
|
+
self.set_active_from_hash();
|
60
|
+
$(this).trigger('resize');
|
61
|
+
}
|
62
|
+
}).trigger('resize');
|
63
|
+
|
64
|
+
$(document)
|
65
|
+
.on('click.fndtn.section', function (e) {
|
66
|
+
if ($(e.target).closest(self.settings.title_selector).length < 1) {
|
67
|
+
$(self.settings.nav_selector)
|
68
|
+
.children(self.settings.region_selector)
|
69
|
+
.removeClass('active')
|
70
|
+
.attr('style', '');
|
71
|
+
}
|
72
|
+
});
|
73
|
+
|
74
|
+
},
|
75
|
+
|
76
|
+
toggle_active : function (e, self) {
|
77
|
+
var $this = $(this),
|
78
|
+
self = Foundation.libs.section,
|
79
|
+
region = $this.closest(self.settings.region_selector),
|
80
|
+
content = $this.siblings(self.settings.content_selector),
|
81
|
+
parent = region.parent(),
|
82
|
+
settings = $.extend({}, self.settings, self.data_options(parent)),
|
83
|
+
prev_active_section = parent
|
84
|
+
.children(self.settings.active_region_selector);
|
85
|
+
|
86
|
+
self.settings.toggled = true;
|
87
|
+
|
88
|
+
if (!settings.deep_linking && content.length > 0) {
|
89
|
+
e.preventDefault();
|
90
|
+
}
|
91
|
+
|
92
|
+
if (region.hasClass('active')) {
|
93
|
+
// this is causing the style flash.
|
94
|
+
if (self.small(parent)
|
95
|
+
|| self.is_vertical_nav(parent)
|
96
|
+
|| self.is_horizontal_nav(parent)
|
97
|
+
|| self.is_accordion(parent)) {
|
98
|
+
if (prev_active_section[0] !== region[0]
|
99
|
+
|| (prev_active_section[0] === region[0] && !settings.one_up)) {
|
100
|
+
region
|
101
|
+
.removeClass('active')
|
102
|
+
.attr('style', '');
|
103
|
+
}
|
104
|
+
}
|
105
|
+
} else {
|
106
|
+
var prev_active_section = parent
|
107
|
+
.children(self.settings.active_region_selector),
|
108
|
+
title_height = self.outerHeight(region
|
109
|
+
.children(self.settings.title_selector));
|
110
|
+
|
111
|
+
if (self.small(parent) || settings.one_up) {
|
112
|
+
|
113
|
+
if (self.small(parent)) {
|
114
|
+
prev_active_section.attr('style', '');
|
115
|
+
} else {
|
116
|
+
prev_active_section.attr('style',
|
117
|
+
'visibility: hidden; padding-top: '+title_height+'px;');
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
if (self.small(parent)) {
|
122
|
+
region.attr('style', '');
|
123
|
+
} else {
|
124
|
+
region.css('padding-top', title_height);
|
125
|
+
}
|
126
|
+
|
127
|
+
region.addClass('active');
|
128
|
+
|
129
|
+
if (prev_active_section.length > 0) {
|
130
|
+
prev_active_section
|
131
|
+
.removeClass('active')
|
132
|
+
.attr('style', '');
|
133
|
+
}
|
134
|
+
|
135
|
+
// Toggle the content display attribute. This is done to
|
136
|
+
// ensure accurate outerWidth measurements that account for
|
137
|
+
// the scrollbar.
|
138
|
+
if (self.is_vertical_tabs(parent)) {
|
139
|
+
content.css('display', 'block');
|
140
|
+
|
141
|
+
if (prev_active_section !== null) {
|
142
|
+
prev_active_section
|
143
|
+
.children(self.settings.content_selector)
|
144
|
+
.css('display', 'none');
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
148
|
+
|
149
|
+
setTimeout(function () {
|
150
|
+
self.settings.toggled = false;
|
151
|
+
}, 300);
|
152
|
+
|
153
|
+
settings.callback();
|
154
|
+
},
|
155
|
+
|
156
|
+
resize : function () {
|
157
|
+
var self = Foundation.libs.section,
|
158
|
+
sections = $(self.settings.section_selector);
|
159
|
+
|
160
|
+
sections.each(function() {
|
161
|
+
var $this = $(this),
|
162
|
+
active_section = $this
|
163
|
+
.children(self.settings.active_region_selector),
|
164
|
+
settings = $.extend({}, self.settings, self.data_options($this));
|
165
|
+
|
166
|
+
if (active_section.length > 1) {
|
167
|
+
active_section
|
168
|
+
.not(':first')
|
169
|
+
.removeClass('active')
|
170
|
+
.attr('style', '');
|
171
|
+
} else if (active_section.length < 1
|
172
|
+
&& !self.is_vertical_nav($this)
|
173
|
+
&& !self.is_horizontal_nav($this)
|
174
|
+
&& !self.is_accordion($this)) {
|
175
|
+
|
176
|
+
var first = $this.children(self.settings.region_selector).first();
|
177
|
+
|
178
|
+
if (settings.one_up || !self.small($this)) {
|
179
|
+
first.addClass('active');
|
180
|
+
}
|
181
|
+
|
182
|
+
if (self.small($this)) {
|
183
|
+
first.attr('style', '');
|
184
|
+
} else {
|
185
|
+
first.css('padding-top', self.outerHeight(first
|
186
|
+
.children(self.settings.title_selector)));
|
187
|
+
}
|
188
|
+
}
|
189
|
+
|
190
|
+
if (self.small($this)) {
|
191
|
+
active_section.attr('style', '');
|
192
|
+
} else {
|
193
|
+
active_section.css('padding-top', self.outerHeight(active_section
|
194
|
+
.children(self.settings.title_selector)));
|
195
|
+
}
|
196
|
+
|
197
|
+
self.position_titles($this);
|
198
|
+
|
199
|
+
if ( (self.is_horizontal_nav($this) && !self.small($this))
|
200
|
+
|| self.is_vertical_tabs($this)) {
|
201
|
+
self.position_content($this);
|
202
|
+
} else {
|
203
|
+
self.position_content($this, false);
|
204
|
+
}
|
205
|
+
});
|
206
|
+
},
|
207
|
+
|
208
|
+
is_vertical_nav : function (el) {
|
209
|
+
return /vertical-nav/i.test(el.data('section'));
|
210
|
+
},
|
211
|
+
|
212
|
+
is_horizontal_nav : function (el) {
|
213
|
+
return /horizontal-nav/i.test(el.data('section'));
|
214
|
+
},
|
215
|
+
|
216
|
+
is_accordion : function (el) {
|
217
|
+
return /accordion/i.test(el.data('section'));
|
218
|
+
},
|
219
|
+
|
220
|
+
is_horizontal_tabs : function (el) {
|
221
|
+
return /^tabs$/i.test(el.data('section'));
|
222
|
+
},
|
223
|
+
|
224
|
+
is_vertical_tabs : function (el) {
|
225
|
+
return /vertical-tabs/i.test(el.data('section'));
|
226
|
+
},
|
227
|
+
|
228
|
+
set_active_from_hash : function () {
|
229
|
+
var hash = window.location.hash.substring(1),
|
230
|
+
sections = $('[data-section]'),
|
231
|
+
self = this;
|
232
|
+
sections.each(function () {
|
233
|
+
var section = $(this),
|
234
|
+
settings = $.extend({}, self.settings, self.data_options(section));
|
235
|
+
|
236
|
+
if (hash.length > 0 && settings.deep_linking) {
|
237
|
+
var regions = section
|
238
|
+
.children(self.settings.region_selector)
|
239
|
+
.attr('style', '')
|
240
|
+
.removeClass('active');
|
241
|
+
|
242
|
+
var hash_regions = regions.map(function () {
|
243
|
+
var content = $(self.settings.content_selector, this),
|
244
|
+
content_slug = content.data('slug');
|
245
|
+
if (content_slug === hash)
|
246
|
+
return content;
|
247
|
+
});
|
248
|
+
|
249
|
+
$(hash_regions[0]).parent().addClass('active');
|
250
|
+
}
|
251
|
+
});
|
252
|
+
},
|
253
|
+
|
254
|
+
position_titles : function (section, off) {
|
255
|
+
var self = this,
|
256
|
+
titles = section
|
257
|
+
.children(this.settings.region_selector)
|
258
|
+
.map(function () {
|
259
|
+
return $(this).children(self.settings.title_selector);
|
260
|
+
}),
|
261
|
+
previous_width = 0,
|
262
|
+
previous_height = 0,
|
263
|
+
self = this;
|
264
|
+
|
265
|
+
if (typeof off === 'boolean') {
|
266
|
+
titles.attr('style', '');
|
267
|
+
|
268
|
+
} else {
|
269
|
+
titles.each(function () {
|
270
|
+
if (self.is_vertical_tabs(section)) {
|
271
|
+
$(this).css('top', previous_height);
|
272
|
+
previous_height += self.outerHeight($(this));
|
273
|
+
} else {
|
274
|
+
if (!self.rtl) {
|
275
|
+
$(this).css('left', previous_width);
|
276
|
+
} else {
|
277
|
+
$(this).css('right', previous_width);
|
278
|
+
}
|
279
|
+
previous_width += self.outerWidth($(this));
|
280
|
+
}
|
281
|
+
});
|
282
|
+
}
|
283
|
+
},
|
284
|
+
|
285
|
+
position_content : function (section, off) {
|
286
|
+
var self = this,
|
287
|
+
regions = section.children(self.settings.region_selector),
|
288
|
+
titles = regions
|
289
|
+
.map(function () {
|
290
|
+
return $(this).children(self.settings.title_selector);
|
291
|
+
}),
|
292
|
+
content = regions
|
293
|
+
.map(function () {
|
294
|
+
return $(this).children(self.settings.content_selector);
|
295
|
+
});
|
296
|
+
|
297
|
+
if (typeof off === 'boolean') {
|
298
|
+
content.attr('style', '');
|
299
|
+
section.attr('style', '');
|
300
|
+
} else {
|
301
|
+
if (self.is_vertical_tabs(section)
|
302
|
+
&& !self.small(section)) {
|
303
|
+
var content_min_height = 0,
|
304
|
+
content_min_width = Number.MAX_VALUE,
|
305
|
+
title_width = null;
|
306
|
+
|
307
|
+
regions.each(function () {
|
308
|
+
var region = $(this),
|
309
|
+
title = region.children(self.settings.title_selector),
|
310
|
+
content = region.children(self.settings.content_selector),
|
311
|
+
content_width = 0;
|
312
|
+
|
313
|
+
title_width = self.outerWidth(title);
|
314
|
+
content_width = self.outerWidth(section) - title_width;
|
315
|
+
if (content_width < content_min_width) {
|
316
|
+
content_min_width = content_width;
|
317
|
+
}
|
318
|
+
|
319
|
+
// Increment the minimum height of the content region
|
320
|
+
// to align with the height of the titles.
|
321
|
+
content_min_height += self.outerHeight(title);
|
322
|
+
|
323
|
+
// Set all of the inactive tabs to 'display: none'
|
324
|
+
// The CSS sets all of the tabs as 'display: block'
|
325
|
+
// in order to account for scrollbars when measuring the width
|
326
|
+
// of the content regions.
|
327
|
+
if (!$(this).hasClass('active')) {
|
328
|
+
content.css('display', 'none');
|
329
|
+
}
|
330
|
+
});
|
331
|
+
|
332
|
+
regions.each(function () {
|
333
|
+
var content = $(this).children(self.settings.content_selector);
|
334
|
+
content.css('minHeight', content_min_height);
|
335
|
+
|
336
|
+
// Remove 2 pixels to account for the right-shift in the CSS
|
337
|
+
content.css('maxWidth', content_min_width - 2);
|
338
|
+
});
|
339
|
+
|
340
|
+
// Adjust the outer section container width to match
|
341
|
+
// the width of the title and content
|
342
|
+
section.css('maxWidth', title_width + content_min_width);
|
343
|
+
} else {
|
344
|
+
regions.each(function () {
|
345
|
+
var region = $(this),
|
346
|
+
title = region.children(self.settings.title_selector),
|
347
|
+
content = region.children(self.settings.content_selector);
|
348
|
+
if (!self.rtl) {
|
349
|
+
content
|
350
|
+
.css({left: title.position().left - 1,
|
351
|
+
top: self.outerHeight(title) - 2});
|
352
|
+
} else {
|
353
|
+
content
|
354
|
+
.css({right: self.position_right(title) + 1,
|
355
|
+
top: self.outerHeight(title) - 2});
|
356
|
+
}
|
357
|
+
});
|
358
|
+
|
359
|
+
// temporary work around for Zepto outerheight calculation issues.
|
360
|
+
if (typeof Zepto === 'function') {
|
361
|
+
section.height(this.outerHeight($(titles[0])));
|
362
|
+
} else {
|
363
|
+
section.height(this.outerHeight($(titles[0])) - 2);
|
364
|
+
}
|
365
|
+
}
|
366
|
+
}
|
367
|
+
},
|
368
|
+
|
369
|
+
position_right : function (el) {
|
370
|
+
var self = this,
|
371
|
+
section = el.closest(this.settings.section_selector),
|
372
|
+
regions = section.children(this.settings.region_selector),
|
373
|
+
section_width = el.closest(this.settings.section_selector).width(),
|
374
|
+
offset = regions
|
375
|
+
.map(function () {
|
376
|
+
return $(this).children(self.settings.title_selector);
|
377
|
+
}).length;
|
378
|
+
return (section_width - el.position().left - el.width() * (el.index() + 1) - offset);
|
379
|
+
},
|
380
|
+
|
381
|
+
reflow : function (scope) {
|
382
|
+
var scope = scope || document;
|
383
|
+
$(this.settings.section_selector, scope).trigger('resize');
|
384
|
+
},
|
385
|
+
|
386
|
+
small : function (el) {
|
387
|
+
var settings = $.extend({}, this.settings, this.data_options(el));
|
388
|
+
if (this.is_horizontal_tabs(el)) {
|
389
|
+
return false;
|
390
|
+
}
|
391
|
+
if (el && this.is_accordion(el)) {
|
392
|
+
return true;
|
393
|
+
}
|
394
|
+
if ($('html').hasClass('lt-ie9')) {
|
395
|
+
return true;
|
396
|
+
}
|
397
|
+
if ($('html').hasClass('ie8compat')) {
|
398
|
+
return true;
|
399
|
+
}
|
400
|
+
return $(this.scope).width() < 768;
|
401
|
+
},
|
402
|
+
|
403
|
+
off : function () {
|
404
|
+
$(this.scope).off('.fndtn.section');
|
405
|
+
$(window).off('.fndtn.section');
|
406
|
+
$(document).off('.fndtn.section')
|
407
|
+
}
|
408
|
+
};
|
409
|
+
}(Foundation.zj, this, this.document));
|