ns-styleguide 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/style-guide/_style-guide.scss +4 -0
- data/style-guide/global/_base.scss +33 -0
- data/style-guide/global/_colors.scss +24 -0
- data/style-guide/global/_extendables.scss +16 -0
- data/style-guide/global/_functions.scss +5 -0
- data/style-guide/global/_mixins.scss +5 -0
- data/style-guide/global/_variables.scss +15 -0
- data/templates/project/assets/6.jpg +0 -0
- data/templates/project/assets/_nsfont/_comment.svg +8 -0
- data/templates/project/assets/_nsfont/_default-user.svg +12 -0
- data/templates/project/assets/_nsfont/_home.svg +12 -0
- data/templates/project/assets/_nsfont/_notify.svg +13 -0
- data/templates/project/assets/_nsfont/_pillbox.svg +27 -0
- data/templates/project/assets/_nsfont/_search.svg +12 -0
- data/templates/project/assets/_nsfont/bs-circulatory.svg +26 -0
- data/templates/project/assets/_nsfont/bs-digestive.svg +28 -0
- data/templates/project/assets/_nsfont/bs-endocrine.svg +33 -0
- data/templates/project/assets/_nsfont/bs-immune.svg +31 -0
- data/templates/project/assets/_nsfont/bs-muscular-skeletal.svg +119 -0
- data/templates/project/assets/_nsfont/bs-nervous.svg +31 -0
- data/templates/project/assets/_nsfont/bs-reprodutive.svg +29 -0
- data/templates/project/assets/_nsfont/bs-respiratory.svg +17 -0
- data/templates/project/assets/_nsfont/ls-athletic.svg +17 -0
- data/templates/project/assets/_nsfont/ls-diet.svg +21 -0
- data/templates/project/assets/_nsfont/ls-energyvitality.svg +14 -0
- data/templates/project/assets/_nsfont/ls-mentalacuity.svg +34 -0
- data/templates/project/assets/_nsfont/ls-sexual.svg +42 -0
- data/templates/project/assets/_nsfont/ls-weightcontrol.svg +17 -0
- data/templates/project/assets/_nsfont/nsa-check.svg +7 -0
- data/templates/project/assets/_nsfont/nsa-questionmark.svg +15 -0
- data/templates/project/assets/_nsfont/nsa-xmark.svg +10 -0
- data/templates/project/assets/_nsfont/st-botanical.svg +18 -0
- data/templates/project/assets/_nsfont/st-food.svg +24 -0
- data/templates/project/assets/_nsfont/st-mineral.svg +15 -0
- data/templates/project/assets/_nsfont/st-other.svg +9 -0
- data/templates/project/assets/_nsfont/st-vitamin.svg +25 -0
- data/templates/project/assets/_nsfont/vote-down.svg +10 -0
- data/templates/project/assets/_nsfont/vote-up.svg +10 -0
- data/templates/project/assets/_nsfont/yp-age.svg +22 -0
- data/templates/project/assets/_nsfont/yp-gender.svg +16 -0
- data/templates/project/assets/_nsfont/yp-preventiontherapy.svg +109 -0
- data/templates/project/assets/aloe-vera.jpg +0 -0
- data/templates/project/assets/alzheimers-brainpuzzle-512.jpg +0 -0
- data/templates/project/assets/blurred1.jpg +0 -0
- data/templates/project/assets/blurred5.jpg +0 -0
- data/templates/project/assets/blurred6.jpg +0 -0
- data/templates/project/assets/botanical.svg +18 -0
- data/templates/project/assets/capsule.jpg +0 -0
- data/templates/project/assets/clouds.jpg +0 -0
- data/templates/project/assets/clouds.png +0 -0
- data/templates/project/assets/factorfiction-s3d0b80354a.png +0 -0
- data/templates/project/assets/factorfiction/factorfiction.png +0 -0
- data/templates/project/assets/factorfiction/factorfiction.svg +420 -0
- data/templates/project/assets/fff.png +0 -0
- data/templates/project/assets/food.svg +24 -0
- data/templates/project/assets/foundation/orbit/bullets.jpg +0 -0
- data/templates/project/assets/foundation/orbit/left-arrow-small.png +0 -0
- data/templates/project/assets/foundation/orbit/left-arrow.png +0 -0
- data/templates/project/assets/foundation/orbit/loading.gif +0 -0
- data/templates/project/assets/foundation/orbit/mask-black.png +0 -0
- data/templates/project/assets/foundation/orbit/pause-black.png +0 -0
- data/templates/project/assets/foundation/orbit/right-arrow-small.png +0 -0
- data/templates/project/assets/foundation/orbit/right-arrow.png +0 -0
- data/templates/project/assets/foundation/orbit/rotator-black.png +0 -0
- data/templates/project/assets/foundation/orbit/timer-black.png +0 -0
- data/templates/project/assets/glyphicons-halflings-white.png +0 -0
- data/templates/project/assets/glyphicons-halflings.png +0 -0
- data/templates/project/assets/hero.jpg +0 -0
- data/templates/project/assets/hero2.jpg +0 -0
- data/templates/project/assets/hero3.jpg +0 -0
- data/templates/project/assets/ice.jpg +0 -0
- data/templates/project/assets/iceberg.jpg +0 -0
- data/templates/project/assets/landing.jpg +0 -0
- data/templates/project/assets/mineral.svg +15 -0
- data/templates/project/assets/moon.jpg +0 -0
- data/templates/project/assets/ns-logo.svg +177 -0
- data/templates/project/assets/nslogo-s56b550b473.png +0 -0
- data/templates/project/assets/nslogo/nslogo.png +0 -0
- data/templates/project/assets/nslogo/nslogo.svg +177 -0
- data/templates/project/assets/other.svg +9 -0
- data/templates/project/assets/pillbox-hover.svg +33 -0
- data/templates/project/assets/pillbox-image.png +0 -0
- data/templates/project/assets/pillbox-image.svg +7880 -0
- data/templates/project/assets/pillbox.svg +27 -0
- data/templates/project/assets/rocket.jpg +0 -0
- data/templates/project/assets/shuttle.jpeg +0 -0
- data/templates/project/assets/svg/community-clear.svg +82 -0
- data/templates/project/assets/svg/community.svg +64 -0
- data/templates/project/assets/svg/conditions.svg +18 -0
- data/templates/project/assets/svg/experts.svg +32 -0
- data/templates/project/assets/svg/fact-or-fiction.svg +420 -0
- data/templates/project/assets/svg/lifestyle.svg +22 -0
- data/templates/project/assets/svg/perspective.svg +22 -0
- data/templates/project/assets/svg/supplements.svg +19 -0
- data/templates/project/assets/svgicons-s95620826ea.png +0 -0
- data/templates/project/assets/svgicons/community.png +0 -0
- data/templates/project/assets/svgicons/community.svg +55 -0
- data/templates/project/assets/svgicons/conditions.png +0 -0
- data/templates/project/assets/svgicons/conditions.svg +16 -0
- data/templates/project/assets/svgicons/experts.png +0 -0
- data/templates/project/assets/svgicons/experts.svg +30 -0
- data/templates/project/assets/svgicons/lifestyle.png +0 -0
- data/templates/project/assets/svgicons/lifestyle.svg +20 -0
- data/templates/project/assets/svgicons/supplements.png +0 -0
- data/templates/project/assets/svgicons/supplements.svg +17 -0
- data/templates/project/assets/svgicons/your-perspective.png +0 -0
- data/templates/project/assets/svgicons/your-perspective.svg +20 -0
- data/templates/project/assets/users/kp.jpg +0 -0
- data/templates/project/assets/video_placeholder.jpg +0 -0
- data/templates/project/assets/vitamin.svg +25 -0
- data/templates/project/component.json +9 -0
- data/templates/project/libs/bootstrap-modal.js +374 -0
- data/templates/project/libs/bootstrap/README.md +106 -0
- data/templates/project/libs/bootstrap/application.js +156 -0
- data/templates/project/libs/bootstrap/bootstrap-affix.js +117 -0
- data/templates/project/libs/bootstrap/bootstrap-alert.js +99 -0
- data/templates/project/libs/bootstrap/bootstrap-button.js +105 -0
- data/templates/project/libs/bootstrap/bootstrap-carousel.js +207 -0
- data/templates/project/libs/bootstrap/bootstrap-collapse.js +167 -0
- data/templates/project/libs/bootstrap/bootstrap-dropdown.js +165 -0
- data/templates/project/libs/bootstrap/bootstrap-modal.js +251 -0
- data/templates/project/libs/bootstrap/bootstrap-popover.js +114 -0
- data/templates/project/libs/bootstrap/bootstrap-scrollspy.js +162 -0
- data/templates/project/libs/bootstrap/bootstrap-tab.js +144 -0
- data/templates/project/libs/bootstrap/bootstrap-tooltip.js +361 -0
- data/templates/project/libs/bootstrap/bootstrap-transition.js +60 -0
- data/templates/project/libs/bootstrap/bootstrap-typeahead.js +335 -0
- data/templates/project/libs/bootstrap/bootstrap.js +2280 -0
- data/templates/project/libs/bootstrap/bootstrap.min.js +6 -0
- data/templates/project/libs/bootstrap/holder/holder.js +401 -0
- data/templates/project/libs/bootstrap/html5shiv.js +8 -0
- data/templates/project/libs/bootstrap/jquery.js +5 -0
- data/templates/project/libs/bootstrap/respond/respond.min.js +6 -0
- data/templates/project/libs/equalheights.js +46 -0
- data/templates/project/libs/foundation/foundation.alerts.js +50 -0
- data/templates/project/libs/foundation/foundation.clearing.js +516 -0
- data/templates/project/libs/foundation/foundation.cookie.js +74 -0
- data/templates/project/libs/foundation/foundation.dropdown.js +175 -0
- data/templates/project/libs/foundation/foundation.forms.js +513 -0
- data/templates/project/libs/foundation/foundation.joyride.js +831 -0
- data/templates/project/libs/foundation/foundation.js +401 -0
- data/templates/project/libs/foundation/foundation.magellan.js +130 -0
- data/templates/project/libs/foundation/foundation.orbit.js +373 -0
- data/templates/project/libs/foundation/foundation.placeholder.js +159 -0
- data/templates/project/libs/foundation/foundation.reveal.js +277 -0
- data/templates/project/libs/foundation/foundation.section.js +407 -0
- data/templates/project/libs/foundation/foundation.tooltips.js +200 -0
- data/templates/project/libs/foundation/foundation.topbar.js +245 -0
- data/templates/project/libs/hello.coffee +1 -0
- data/templates/project/libs/helper.js +385 -0
- data/templates/project/libs/jquery.magnific-popup.js +1783 -0
- data/templates/project/libs/jquery.magnific-popup.min.js +4 -0
- data/templates/project/libs/jquery.mixitup.min.js +43 -0
- data/templates/project/libs/main.js +1 -0
- data/templates/project/libs/ns.js +128 -0
- data/templates/project/libs/select2-3.4.0/README.md +83 -0
- data/templates/project/libs/select2-3.4.0/component.json +8 -0
- data/templates/project/libs/select2-3.4.0/release.sh +69 -0
- data/templates/project/libs/select2-3.4.0/select2-spinner.gif +0 -0
- data/templates/project/libs/select2-3.4.0/select2.css +652 -0
- data/templates/project/libs/select2-3.4.0/select2.jquery.json +36 -0
- data/templates/project/libs/select2-3.4.0/select2.js +3054 -0
- data/templates/project/libs/select2-3.4.0/select2.min.js +22 -0
- data/templates/project/libs/select2-3.4.0/select2.png +0 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_ca.js +17 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_cs.js +49 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_da.js +17 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_de.js +15 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_en.js.template +17 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_es.js +15 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_et.js +17 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_eu.js +43 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_fr.js +15 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_gl.js +43 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_he.js +17 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_hr.js +42 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_hu.js +15 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_is.js +16 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_it.js +15 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_ja.js +15 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_lt.js +29 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_lv.js +16 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_mk.js +17 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_nl.js +15 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_no.js +18 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_pl.js +37 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_pt-BR.js +15 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_pt-PT.js +15 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_ro.js +15 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_ru.js +15 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_sk.js +48 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_sv.js +17 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_tr.js +17 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_ua.js +17 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_vi.js +18 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_zh-CN.js +14 -0
- data/templates/project/libs/select2-3.4.0/select2_locale_zh-TW.js +14 -0
- data/templates/project/libs/select2-3.4.0/select2x2.png +0 -0
- data/templates/project/libs/vendor/modernizr-2.6.2.min.js +4 -0
- data/templates/project/libs/vendor/zepto.js +1884 -0
- data/templates/project/libs/vendor/zepto.min.js +2 -0
- data/templates/project/manifest.rb +9 -0
- data/templates/project/style.scss.erb +2 -0
- metadata +288 -0
@@ -0,0 +1,277 @@
|
|
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
|
+
this.scope = scope || this.scope;
|
40
|
+
Foundation.inherit(this, 'data_options delay');
|
41
|
+
|
42
|
+
if (typeof method === 'object') {
|
43
|
+
$.extend(true, this.settings, method);
|
44
|
+
} else if (typeof options !== 'undefined') {
|
45
|
+
$.extend(true, this.settings, options);
|
46
|
+
}
|
47
|
+
|
48
|
+
if (typeof method != 'string') {
|
49
|
+
this.events();
|
50
|
+
|
51
|
+
return this.settings.init;
|
52
|
+
} else {
|
53
|
+
return this[method].call(this, options);
|
54
|
+
}
|
55
|
+
},
|
56
|
+
|
57
|
+
events : function () {
|
58
|
+
var self = this;
|
59
|
+
|
60
|
+
$(this.scope)
|
61
|
+
.off('.fndtn.reveal')
|
62
|
+
.on('click.fndtn.reveal', '[data-reveal-id]', function (e) {
|
63
|
+
e.preventDefault();
|
64
|
+
if (!self.locked) {
|
65
|
+
self.locked = true;
|
66
|
+
self.open.call(self, $(this));
|
67
|
+
}
|
68
|
+
})
|
69
|
+
.on('click.fndtn.reveal touchend.click.fndtn.reveal', this.close_targets(), function (e) {
|
70
|
+
e.preventDefault();
|
71
|
+
if (!self.locked) {
|
72
|
+
var settings = $.extend({}, self.settings, self.data_options($('.reveal-modal.open')));
|
73
|
+
if ($(e.target)[0] === $('.' + settings.bgClass)[0] && !settings.closeOnBackgroundClick) {
|
74
|
+
return;
|
75
|
+
}
|
76
|
+
|
77
|
+
self.locked = true;
|
78
|
+
self.close.call(self, $(this).closest('.reveal-modal'));
|
79
|
+
}
|
80
|
+
})
|
81
|
+
.on('open.fndtn.reveal', '.reveal-modal', this.settings.open)
|
82
|
+
.on('opened.fndtn.reveal', '.reveal-modal', this.settings.opened)
|
83
|
+
.on('opened.fndtn.reveal', '.reveal-modal', this.open_video)
|
84
|
+
.on('close.fndtn.reveal', '.reveal-modal', this.settings.close)
|
85
|
+
.on('closed.fndtn.reveal', '.reveal-modal', this.settings.closed)
|
86
|
+
.on('closed.fndtn.reveal', '.reveal-modal', this.close_video);
|
87
|
+
|
88
|
+
return true;
|
89
|
+
},
|
90
|
+
|
91
|
+
open : function (target) {
|
92
|
+
if (target) {
|
93
|
+
var modal = $('#' + target.data('reveal-id'));
|
94
|
+
} else {
|
95
|
+
var modal = $(this.scope);
|
96
|
+
}
|
97
|
+
|
98
|
+
if (!modal.hasClass('open')) {
|
99
|
+
var open_modal = $('.reveal-modal.open');
|
100
|
+
|
101
|
+
if (typeof modal.data('css-top') === 'undefined') {
|
102
|
+
modal.data('css-top', parseInt(modal.css('top'), 10))
|
103
|
+
.data('offset', this.cache_offset(modal));
|
104
|
+
}
|
105
|
+
|
106
|
+
modal.trigger('open');
|
107
|
+
|
108
|
+
if (open_modal.length < 1) {
|
109
|
+
this.toggle_bg(modal);
|
110
|
+
}
|
111
|
+
this.hide(open_modal, this.settings.css.close);
|
112
|
+
this.show(modal, this.settings.css.open);
|
113
|
+
}
|
114
|
+
},
|
115
|
+
|
116
|
+
close : function (modal) {
|
117
|
+
|
118
|
+
var modal = modal || $(this.scope),
|
119
|
+
open_modals = $('.reveal-modal.open');
|
120
|
+
|
121
|
+
if (open_modals.length > 0) {
|
122
|
+
this.locked = true;
|
123
|
+
modal.trigger('close');
|
124
|
+
this.toggle_bg(modal);
|
125
|
+
this.hide(open_modals, this.settings.css.close);
|
126
|
+
}
|
127
|
+
},
|
128
|
+
|
129
|
+
close_targets : function () {
|
130
|
+
var base = '.' + this.settings.dismissModalClass;
|
131
|
+
|
132
|
+
if (this.settings.closeOnBackgroundClick) {
|
133
|
+
return base + ', .' + this.settings.bgClass;
|
134
|
+
}
|
135
|
+
|
136
|
+
return base;
|
137
|
+
},
|
138
|
+
|
139
|
+
toggle_bg : function (modal) {
|
140
|
+
if ($('.reveal-modal-bg').length === 0) {
|
141
|
+
this.settings.bg = $('<div />', {'class': this.settings.bgClass})
|
142
|
+
.appendTo('body');
|
143
|
+
}
|
144
|
+
|
145
|
+
if (this.settings.bg.filter(':visible').length > 0) {
|
146
|
+
this.hide(this.settings.bg);
|
147
|
+
} else {
|
148
|
+
this.show(this.settings.bg);
|
149
|
+
}
|
150
|
+
},
|
151
|
+
|
152
|
+
show : function (el, css) {
|
153
|
+
// is modal
|
154
|
+
if (css) {
|
155
|
+
if (/pop/i.test(this.settings.animation)) {
|
156
|
+
css.top = $(window).scrollTop() - el.data('offset') + 'px';
|
157
|
+
var end_css = {
|
158
|
+
top: $(window).scrollTop() + el.data('css-top') + 'px',
|
159
|
+
opacity: 1
|
160
|
+
};
|
161
|
+
|
162
|
+
return this.delay(function () {
|
163
|
+
return el
|
164
|
+
.css(css)
|
165
|
+
.animate(end_css, this.settings.animationSpeed, 'linear', function () {
|
166
|
+
this.locked = false;
|
167
|
+
el.trigger('opened');
|
168
|
+
}.bind(this))
|
169
|
+
.addClass('open');
|
170
|
+
}.bind(this), this.settings.animationSpeed / 2);
|
171
|
+
}
|
172
|
+
|
173
|
+
if (/fade/i.test(this.settings.animation)) {
|
174
|
+
var end_css = {opacity: 1};
|
175
|
+
|
176
|
+
return this.delay(function () {
|
177
|
+
return el
|
178
|
+
.css(css)
|
179
|
+
.animate(end_css, this.settings.animationSpeed, 'linear', function () {
|
180
|
+
this.locked = false;
|
181
|
+
el.trigger('opened');
|
182
|
+
}.bind(this))
|
183
|
+
.addClass('open');
|
184
|
+
}.bind(this), this.settings.animationSpeed / 2);
|
185
|
+
}
|
186
|
+
|
187
|
+
return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened');
|
188
|
+
}
|
189
|
+
|
190
|
+
// should we animate the background?
|
191
|
+
if (/fade/i.test(this.settings.animation)) {
|
192
|
+
return el.fadeIn(this.settings.animationSpeed / 2);
|
193
|
+
}
|
194
|
+
|
195
|
+
return el.show();
|
196
|
+
},
|
197
|
+
|
198
|
+
hide : function (el, css) {
|
199
|
+
// is modal
|
200
|
+
if (css) {
|
201
|
+
if (/pop/i.test(this.settings.animation)) {
|
202
|
+
var end_css = {
|
203
|
+
top: - $(window).scrollTop() - el.data('offset') + 'px',
|
204
|
+
opacity: 0
|
205
|
+
};
|
206
|
+
|
207
|
+
return this.delay(function () {
|
208
|
+
return el
|
209
|
+
.animate(end_css, this.settings.animationSpeed, 'linear', function () {
|
210
|
+
this.locked = false;
|
211
|
+
el.css(css).trigger('closed');
|
212
|
+
}.bind(this))
|
213
|
+
.removeClass('open');
|
214
|
+
}.bind(this), this.settings.animationSpeed / 2);
|
215
|
+
}
|
216
|
+
|
217
|
+
if (/fade/i.test(this.settings.animation)) {
|
218
|
+
var end_css = {opacity: 0};
|
219
|
+
|
220
|
+
return this.delay(function () {
|
221
|
+
return el
|
222
|
+
.animate(end_css, this.settings.animationSpeed, 'linear', function () {
|
223
|
+
this.locked = false;
|
224
|
+
el.css(css).trigger('closed');
|
225
|
+
}.bind(this))
|
226
|
+
.removeClass('open');
|
227
|
+
}.bind(this), this.settings.animationSpeed / 2);
|
228
|
+
}
|
229
|
+
|
230
|
+
return el.hide().css(css).removeClass('open').trigger('closed');
|
231
|
+
}
|
232
|
+
|
233
|
+
// should we animate the background?
|
234
|
+
if (/fade/i.test(this.settings.animation)) {
|
235
|
+
return el.fadeOut(this.settings.animationSpeed / 2);
|
236
|
+
}
|
237
|
+
|
238
|
+
return el.hide();
|
239
|
+
},
|
240
|
+
|
241
|
+
close_video : function (e) {
|
242
|
+
var video = $(this).find('.flex-video'),
|
243
|
+
iframe = video.find('iframe');
|
244
|
+
|
245
|
+
if (iframe.length > 0) {
|
246
|
+
iframe.attr('data-src', iframe[0].src);
|
247
|
+
iframe.attr('src', 'about:blank');
|
248
|
+
video.fadeOut(100).hide();
|
249
|
+
}
|
250
|
+
},
|
251
|
+
|
252
|
+
open_video : function (e) {
|
253
|
+
var video = $(this).find('.flex-video'),
|
254
|
+
iframe = video.find('iframe');
|
255
|
+
|
256
|
+
if (iframe.length > 0) {
|
257
|
+
var data_src = iframe.attr('data-src');
|
258
|
+
if (typeof data_src === 'string') {
|
259
|
+
iframe[0].src = iframe.attr('data-src');
|
260
|
+
}
|
261
|
+
video.show().fadeIn(100);
|
262
|
+
}
|
263
|
+
},
|
264
|
+
|
265
|
+
cache_offset : function (modal) {
|
266
|
+
var offset = modal.show().height() + parseInt(modal.css('top'), 10);
|
267
|
+
|
268
|
+
modal.hide();
|
269
|
+
|
270
|
+
return offset;
|
271
|
+
},
|
272
|
+
|
273
|
+
off : function () {
|
274
|
+
$(this.scope).off('.fndtn.reveal');
|
275
|
+
}
|
276
|
+
};
|
277
|
+
}(Foundation.zj, this, this.document));
|
@@ -0,0 +1,407 @@
|
|
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.3',
|
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
|
+
|
233
|
+
sections.each(function () {
|
234
|
+
var section = $(this),
|
235
|
+
settings = $.extend({}, self.settings, self.data_options(section));
|
236
|
+
|
237
|
+
if (hash.length > 0 && settings.deep_linking) {
|
238
|
+
var regions = section
|
239
|
+
.children(self.settings.region_selector)
|
240
|
+
.attr('style', '')
|
241
|
+
.removeClass('active');
|
242
|
+
regions
|
243
|
+
.map(function () {
|
244
|
+
return $(this).children('.content[data-slug="' + hash + '"], [data-section-content][data-slug="' + hash + '"]');
|
245
|
+
})
|
246
|
+
.parent()
|
247
|
+
.addClass('active');
|
248
|
+
}
|
249
|
+
});
|
250
|
+
},
|
251
|
+
|
252
|
+
position_titles : function (section, off) {
|
253
|
+
var self = this,
|
254
|
+
titles = section
|
255
|
+
.children(this.settings.region_selector)
|
256
|
+
.map(function () {
|
257
|
+
return $(this).children(self.settings.title_selector);
|
258
|
+
}),
|
259
|
+
previous_width = 0,
|
260
|
+
previous_height = 0,
|
261
|
+
self = this;
|
262
|
+
|
263
|
+
if (typeof off === 'boolean') {
|
264
|
+
titles.attr('style', '');
|
265
|
+
|
266
|
+
} else {
|
267
|
+
titles.each(function () {
|
268
|
+
if (self.is_vertical_tabs(section)) {
|
269
|
+
$(this).css('top', previous_height);
|
270
|
+
previous_height += self.outerHeight($(this));
|
271
|
+
} else {
|
272
|
+
if (!self.rtl) {
|
273
|
+
$(this).css('left', previous_width);
|
274
|
+
} else {
|
275
|
+
$(this).css('right', previous_width);
|
276
|
+
}
|
277
|
+
previous_width += self.outerWidth($(this));
|
278
|
+
}
|
279
|
+
});
|
280
|
+
}
|
281
|
+
},
|
282
|
+
|
283
|
+
position_content : function (section, off) {
|
284
|
+
var self = this,
|
285
|
+
regions = section.children(self.settings.region_selector),
|
286
|
+
titles = regions
|
287
|
+
.map(function () {
|
288
|
+
return $(this).children(self.settings.title_selector);
|
289
|
+
}),
|
290
|
+
content = regions
|
291
|
+
.map(function () {
|
292
|
+
return $(this).children(self.settings.content_selector);
|
293
|
+
});
|
294
|
+
|
295
|
+
if (typeof off === 'boolean') {
|
296
|
+
content.attr('style', '');
|
297
|
+
section.attr('style', '');
|
298
|
+
} else {
|
299
|
+
if (self.is_vertical_tabs(section)
|
300
|
+
&& !self.small(section)) {
|
301
|
+
var content_min_height = 0,
|
302
|
+
content_min_width = Number.MAX_VALUE,
|
303
|
+
title_width = null;
|
304
|
+
|
305
|
+
regions.each(function () {
|
306
|
+
var region = $(this),
|
307
|
+
title = region.children(self.settings.title_selector),
|
308
|
+
content = region.children(self.settings.content_selector),
|
309
|
+
content_width = 0;
|
310
|
+
|
311
|
+
title_width = self.outerWidth(title);
|
312
|
+
content_width = self.outerWidth(section) - title_width;
|
313
|
+
if (content_width < content_min_width) {
|
314
|
+
content_min_width = content_width;
|
315
|
+
}
|
316
|
+
|
317
|
+
// Increment the minimum height of the content region
|
318
|
+
// to align with the height of the titles.
|
319
|
+
content_min_height += self.outerHeight(title);
|
320
|
+
|
321
|
+
// Set all of the inactive tabs to 'display: none'
|
322
|
+
// The CSS sets all of the tabs as 'display: block'
|
323
|
+
// in order to account for scrollbars when measuring the width
|
324
|
+
// of the content regions.
|
325
|
+
if (!$(this).hasClass('active')) {
|
326
|
+
content.css('display', 'none');
|
327
|
+
}
|
328
|
+
});
|
329
|
+
|
330
|
+
regions.each(function () {
|
331
|
+
var content = $(this).children(self.settings.content_selector);
|
332
|
+
content.css('minHeight', content_min_height);
|
333
|
+
|
334
|
+
// Remove 2 pixels to account for the right-shift in the CSS
|
335
|
+
content.css('maxWidth', content_min_width - 2);
|
336
|
+
});
|
337
|
+
|
338
|
+
// Adjust the outer section container width to match
|
339
|
+
// the width of the title and content
|
340
|
+
section.css('maxWidth', title_width + content_min_width);
|
341
|
+
} else {
|
342
|
+
regions.each(function () {
|
343
|
+
var region = $(this),
|
344
|
+
title = region.children(self.settings.title_selector),
|
345
|
+
content = region.children(self.settings.content_selector);
|
346
|
+
if (!self.rtl) {
|
347
|
+
content
|
348
|
+
.css({left: title.position().left - 1,
|
349
|
+
top: self.outerHeight(title) - 2});
|
350
|
+
} else {
|
351
|
+
content
|
352
|
+
.css({right: self.position_right(title) + 1,
|
353
|
+
top: self.outerHeight(title) - 2});
|
354
|
+
}
|
355
|
+
});
|
356
|
+
|
357
|
+
// temporary work around for Zepto outerheight calculation issues.
|
358
|
+
if (typeof Zepto === 'function') {
|
359
|
+
section.height(this.outerHeight(titles.first()));
|
360
|
+
} else {
|
361
|
+
section.height(this.outerHeight(titles.first()) - 2);
|
362
|
+
}
|
363
|
+
}
|
364
|
+
}
|
365
|
+
},
|
366
|
+
|
367
|
+
position_right : function (el) {
|
368
|
+
var self = this,
|
369
|
+
section = el.closest(this.settings.section_selector),
|
370
|
+
regions = section.children(this.settings.region_selector),
|
371
|
+
section_width = el.closest(this.settings.section_selector).width(),
|
372
|
+
offset = regions
|
373
|
+
.map(function () {
|
374
|
+
return $(this).children(self.settings.title_selector);
|
375
|
+
}).length;
|
376
|
+
return (section_width - el.position().left - el.width() * (el.index() + 1) - offset);
|
377
|
+
},
|
378
|
+
|
379
|
+
reflow : function (scope) {
|
380
|
+
var scope = scope || document;
|
381
|
+
$(this.settings.section_selector, scope).trigger('resize');
|
382
|
+
},
|
383
|
+
|
384
|
+
small : function (el) {
|
385
|
+
var settings = $.extend({}, this.settings, this.data_options(el));
|
386
|
+
if (this.is_horizontal_tabs(el)) {
|
387
|
+
return false;
|
388
|
+
}
|
389
|
+
if (el && this.is_accordion(el)) {
|
390
|
+
return true;
|
391
|
+
}
|
392
|
+
if ($('html').hasClass('lt-ie9')) {
|
393
|
+
return true;
|
394
|
+
}
|
395
|
+
if ($('html').hasClass('ie8compat')) {
|
396
|
+
return true;
|
397
|
+
}
|
398
|
+
return $(this.scope).width() < 768;
|
399
|
+
},
|
400
|
+
|
401
|
+
off : function () {
|
402
|
+
$(this.scope).off('.fndtn.section');
|
403
|
+
$(window).off('.fndtn.section');
|
404
|
+
$(document).off('.fndtn.section')
|
405
|
+
}
|
406
|
+
};
|
407
|
+
}(Foundation.zj, this, this.document));
|