>>1)+1;--f>0;)e(r,f,u,n);return r}function t(r,n,t){for(var u,f=t-n;--f>0;)u=r[n],r[n]=r[n+f],r[n+f]=u,e(r,1,f,n);return r}function e(n,t,e,u){for(var f,o=n[--u+t],i=r(o);(f=t<<1)<=e&&(e>f&&r(n[u+f])>r(n[u+f+1])&&f++,!(i<=r(n[u+f])));)n[u+t]=n[u+f],t=f;n[u+t]=o}return n.sort=t,n}function f(r){function n(n,e,u,f){var o,i,a,c,l=Array(f=Math.min(u-e,f));for(i=0;f>i;++i)l[i]=n[e++];if(t(l,0,f),u>e){o=r(l[0]);do(a=r(c=n[e])>o)&&(l[0]=c,o=r(t(l,0,f)[0]));while(++eu;++u){for(var f=u,o=n[u],i=r(o);f>t&&r(n[f-1])>i;--f)n[f]=n[f-1];n[f]=o}return n}return n}function i(r){function n(r,n,u){return(U>u-n?e:t)(r,n,u)}function t(t,e,u){var f,o=0|(u-e)/6,i=e+o,a=u-1-o,c=e+u-1>>1,l=c-o,v=c+o,s=t[i],h=r(s),d=t[l],p=r(d),g=t[c],y=r(g),m=t[v],b=r(m),A=t[a],k=r(A);h>p&&(f=s,s=d,d=f,f=h,h=p,p=f),b>k&&(f=m,m=A,A=f,f=b,b=k,k=f),h>y&&(f=s,s=g,g=f,f=h,h=y,y=f),p>y&&(f=d,d=g,g=f,f=p,p=y,y=f),h>b&&(f=s,s=m,m=f,f=h,h=b,b=f),y>b&&(f=g,g=m,m=f,f=y,y=b,b=f),p>k&&(f=d,d=A,A=f,f=p,p=k,k=f),p>y&&(f=d,d=g,g=f,f=p,p=y,y=f),b>k&&(f=m,m=A,A=f,f=b,b=k,k=f);var x=d,w=p,E=m,O=b;t[i]=s,t[l]=t[e],t[c]=g,t[v]=t[u-1],t[a]=A;var M=e+1,U=u-2,z=O>=w&&w>=O;if(z)for(var N=M;U>=N;++N){var C=t[N],S=r(C);if(w>S)N!==M&&(t[N]=t[M],t[M]=C),++M;else if(S>w)for(;;){var q=r(t[U]);{if(!(q>w)){if(w>q){t[N]=t[M],t[M++]=t[U],t[U--]=C;break}t[N]=t[U],t[U--]=C;break}U--}}}else for(var N=M;U>=N;N++){var C=t[N],S=r(C);if(w>S)N!==M&&(t[N]=t[M],t[M]=C),++M;else if(S>O)for(;;){var q=r(t[U]);{if(!(q>O)){w>q?(t[N]=t[M],t[M++]=t[U],t[U--]=C):(t[N]=t[U],t[U--]=C);break}if(U--,N>U)break}}}if(t[e]=t[M-1],t[M-1]=x,t[u-1]=t[U+1],t[U+1]=E,n(t,e,M-1),n(t,U+2,u),z)return t;if(i>M&&U>a){for(var F,q;(F=r(t[M]))<=w&&F>=w;)++M;for(;(q=r(t[U]))<=O&&q>=O;)--U;for(var N=M;U>=N;N++){var C=t[N],S=r(C);if(w>=S&&S>=w)N!==M&&(t[N]=t[M],t[M]=C),M++;else if(O>=S&&S>=O)for(;;){var q=r(t[U]);{if(!(O>=q&&q>=O)){w>q?(t[N]=t[M],t[M++]=t[U],t[U--]=C):(t[N]=t[U],t[U--]=C);break}if(U--,N>U)break}}}}return n(t,M,U+1)}var e=o(r);return n}function a(r){return Array(r)}function c(r,n){return function(t){var e=t.length;return[r.left(t,n,0,e),r.right(t,n,0,e)]}}function l(r,n){var t=n[0],e=n[1];return function(n){var u=n.length;return[r.left(n,t,0,u),r.left(n,e,0,u)]}}function v(r){return[0,r.length]}function s(){return null}function h(){return 0}function d(r){return r+1}function p(r){return r-1}function g(r){return function(n,t){return n+ +r(t)}}function y(r){return function(n,t){return n-r(t)}}function m(){function r(r){var n=E,t=r.length;return t&&(w=w.concat(r),U=S(U,E+=t),C.forEach(function(e){e(r,n,t)})),m}function e(r){function e(n,e,u){P=n.map(r),Q=Y(A(u),0,u),P=t(P,Q);var f,o,i=Z(P),a=i[0],c=i[1];if(T)for(f=0;u>f;++f)T(P[f],o=Q[f]+e)||(U[o]|=W);else{for(f=0;a>f;++f)U[Q[f]+e]|=W;for(f=c;u>f;++f)U[Q[f]+e]|=W}if(!e)return K=P,L=Q,rn=a,nn=c,void 0;var l=K,v=L,s=0,h=0;for(K=Array(E),L=b(E,E),f=0;e>s&&u>h;++f)l[s] s;++s,++f)K[f]=l[s],L[f]=v[s];for(;u>h;++h,++f)K[f]=P[h],L[f]=Q[h]+e;i=Z(K),rn=i[0],nn=i[1]}function o(r,n,t){$.forEach(function(r){r(P,Q,n,t)}),P=Q=null}function a(r){var n=r[0],t=r[1];if(T)return T=null,B(function(r,e){return e>=n&&t>e}),rn=n,nn=t,V;var e,u,f,o=[],i=[];if(rn>n)for(e=n,u=Math.min(rn,t);u>e;++e)U[f=L[e]]^=W,o.push(f);else if(n>rn)for(e=rn,u=Math.min(n,nn);u>e;++e)U[f=L[e]]^=W,i.push(f);if(t>nn)for(e=Math.max(n,nn),u=t;u>e;++e)U[f=L[e]]^=W,o.push(f);else if(nn>t)for(e=Math.max(rn,t),u=nn;u>e;++e)U[f=L[e]]^=W,i.push(f);return rn=n,nn=t,N.forEach(function(r){r(W,o,i)}),V}function m(r){return null==r?R():Array.isArray(r)?F(r):"function"==typeof r?j(r):z(r)}function z(r){return a((Z=c(x,r))(K))}function F(r){return a((Z=l(x,r))(K))}function R(){return a((Z=v)(K))}function j(r){return Z=v,B(T=r),rn=0,nn=E,V}function B(r){var n,t,e,u=[],f=[];for(n=0;E>n;++n)!(U[t=L[n]]&W)^(e=r(K[n],t))&&(e?(U[t]&=X,u.push(t)):(U[t]|=W,f.push(t)));N.forEach(function(r){r(W,u,f)})}function D(r){for(var n,t=[],e=nn;--e>=rn&&r>0;)U[n=L[e]]||(t.push(w[n]),--r);return t}function G(r){for(var n,t=[],e=rn;nn>e&&r>0;)U[n=L[e]]||(t.push(w[n]),--r),e++;return t}function H(r){function t(n,t,u,f){function c(){++P===J&&(m=q(m,I<<=1),R=q(R,I),J=k(I))}var l,v,h,d,p,g,y=F,m=b(P,J),A=D,x=H,O=P,M=0,z=0;for(V&&(A=x=s),F=Array(P),P=0,R=O>1?S(R,E):b(E,J),O&&(h=(v=y[0]).key);f>z&&!((d=r(n[z]))>=d);)++z;for(;f>z;){for(v&&d>=h?(p=v,g=h,m[M]=P,(v=y[++M])&&(h=v.key)):(p={key:d,value:x()},g=d),F[P]=p;!(d>g||(R[l=t[z]+u]=P,U[l]&X||(p.value=A(p.value,w[l])),++z>=f));)d=r(n[z]);c()}for(;O>M;)F[m[M]=P]=y[M++],c();if(P>M)for(M=0;u>M;++M)R[M]=m[R[M]];l=N.indexOf(Q),P>1?(Q=e,T=i):(1===P?(Q=o,T=a):(Q=s,T=s),R=null),N[l]=Q}function e(r,n,t){if(r!==W&&!V){var e,u,f,o;for(e=0,f=n.length;f>e;++e)U[u=n[e]]&X||(o=F[R[u]],o.value=D(o.value,w[u]));for(e=0,f=t.length;f>e;++e)(U[u=t[e]]&X)===r&&(o=F[R[u]],o.value=G(o.value,w[u]))}}function o(r,n,t){if(r!==W&&!V){var e,u,f,o=F[0];for(e=0,f=n.length;f>e;++e)U[u=n[e]]&X||(o.value=D(o.value,w[u]));for(e=0,f=t.length;f>e;++e)(U[u=t[e]]&X)===r&&(o.value=G(o.value,w[u]))}}function i(){var r,n;for(r=0;P>r;++r)F[r].value=H();for(r=0;E>r;++r)U[r]&X||(n=F[R[r]],n.value=D(n.value,w[r]))}function a(){var r,n=F[0];for(n.value=H(),r=0;E>r;++r)U[r]&X||(n.value=D(n.value,w[r]))}function c(){return V&&(T(),V=!1),F}function l(r){var n=j(c(),0,F.length,r);return B.sort(n,0,n.length)}function v(r,n,t){return D=r,G=n,H=t,V=!0,C}function m(){return v(d,p,h)}function A(r){return v(g(r),y(r),h)}function x(r){function n(n){return r(n.value)}return j=f(n),B=u(n),C}function O(){return x(n)}function M(){return P}function z(){var r=N.indexOf(Q);return r>=0&&N.splice(r,1),r=$.indexOf(t),r>=0&&$.splice(r,1),C}var C={top:l,all:c,reduce:v,reduceCount:m,reduceSum:A,order:x,orderNatural:O,size:M,remove:z};_.push(C);var F,R,j,B,D,G,H,I=8,J=k(I),P=0,Q=s,T=s,V=!0;return arguments.length<1&&(r=n),N.push(Q),$.push(t),t(K,L,0,E),m().orderNatural()}function I(){var r=H(s),n=r.all;return delete r.all,delete r.top,delete r.order,delete r.orderNatural,delete r.size,r.value=function(){return n()[0].value},r}function J(){_.forEach(function(r){r.remove()});var r=C.indexOf(e);for(r>=0&&C.splice(r,1),r=C.indexOf(o),r>=0&&C.splice(r,1),r=0;E>r;++r)U[r]&=X;return O&=X,V}var K,L,P,Q,T,V={filter:m,filterExact:z,filterRange:F,filterFunction:j,filterAll:R,top:D,bottom:G,group:H,groupAll:I,remove:J},W=~O&-~O,X=~W,Y=i(function(r){return P[r]}),Z=v,$=[],_=[],rn=0,nn=0;return C.unshift(e),C.push(o),O|=W,(M>=32?!W:O&(1<t;++t)U[t]||(a=c(a,w[t]))}function n(r,n,t){var e,u,f;if(!m){for(e=0,f=n.length;f>e;++e)U[u=n[e]]||(a=c(a,w[u]));for(e=0,f=t.length;f>e;++e)U[u=t[e]]===r&&(a=l(a,w[u]))}}function t(){var r;for(a=v(),r=0;E>r;++r)U[r]||(a=c(a,w[r]))}function e(r,n,t){return c=r,l=n,v=t,m=!0,s}function u(){return e(d,p,h)}function f(r){return e(g(r),y(r),h)}function o(){return m&&(t(),m=!1),a}function i(){var t=N.indexOf(n);return t>=0&&N.splice(t),t=C.indexOf(r),t>=0&&C.splice(t),s}var a,c,l,v,s={reduce:e,reduceCount:u,reduceSum:f,value:o,remove:i},m=!0;return N.push(n),C.push(r),r(w,0,E),u()}function a(){return E}var m={add:r,dimension:e,groupAll:o,size:a},w=[],E=0,O=0,M=8,U=z(0),N=[],C=[];return arguments.length?r(arguments[0]):m}function b(r,n){return(257>n?z:65537>n?N:C)(r)}function A(r){for(var n=b(r,r),t=-1;++t= 0; i--) {
118 | el_patterns.push(this.pattern(els[i]));
119 | }
120 |
121 | return this.check_validation_and_apply_styles(el_patterns);
122 | },
123 |
124 | pattern : function (el) {
125 | var type = el.getAttribute('type'),
126 | required = typeof el.getAttribute('required') === 'string';
127 |
128 | if (this.settings.patterns.hasOwnProperty(type)) {
129 | return [el, this.settings.patterns[type], required];
130 | }
131 |
132 | var pattern = el.getAttribute('pattern') || '';
133 |
134 | if (this.settings.patterns.hasOwnProperty(pattern) && pattern.length > 0) {
135 | return [el, this.settings.patterns[pattern], required];
136 | } else if (pattern.length > 0) {
137 | return [el, new RegExp(pattern), required];
138 | }
139 |
140 | pattern = /.*/;
141 |
142 | return [el, pattern, required];
143 | },
144 |
145 | check_validation_and_apply_styles : function (el_patterns) {
146 | var count = el_patterns.length,
147 | validations = [];
148 |
149 | for (var i = count - 1; i >= 0; i--) {
150 | var el = el_patterns[i][0],
151 | required = el_patterns[i][2],
152 | value = el.value,
153 | is_radio = el.type === "radio",
154 | valid_length = (required) ? (el.value.length > 0) : true;
155 |
156 | if (is_radio && required) {
157 | validations.push(this.valid_radio(el, required));
158 | } else {
159 | if (el_patterns[i][1].test(value) && valid_length ||
160 | !required && el.value.length < 1) {
161 | $(el).removeAttr('data-invalid').parent().removeClass('error');
162 | validations.push(true);
163 | } else {
164 | $(el).attr('data-invalid', '').parent().addClass('error');
165 | validations.push(false);
166 | }
167 | }
168 | }
169 |
170 | return validations;
171 | },
172 |
173 | valid_radio : function (el, required) {
174 | var name = el.getAttribute('name'),
175 | group = document.getElementsByName(name),
176 | count = group.length,
177 | valid = false;
178 |
179 | for (var i=0; i < count; i++) {
180 | if (group[i].checked) valid = true;
181 | }
182 |
183 | for (var i=0; i < count; i++) {
184 | if (valid) {
185 | $(group[i]).removeAttr('data-invalid').parent().removeClass('error');
186 | } else {
187 | $(group[i]).attr('data-invalid', '').parent().addClass('error');
188 | }
189 | }
190 |
191 | return valid;
192 | }
193 | };
194 | }(Foundation.zj, this, this.document));
--------------------------------------------------------------------------------
/js/foundation/foundation.interchange.js:
--------------------------------------------------------------------------------
1 | /*jslint unparam: true, browser: true, indent: 2 */
2 |
3 | ;(function ($, window, document, undefined) {
4 | 'use strict';
5 |
6 | Foundation.libs.interchange = {
7 | name : 'interchange',
8 |
9 | version : '4.2.4',
10 |
11 | cache : {},
12 |
13 | images_loaded : false,
14 |
15 | settings : {
16 | load_attr : 'interchange',
17 |
18 | named_queries : {
19 | 'default' : 'only screen and (min-width: 1px)',
20 | small : 'only screen and (min-width: 768px)',
21 | medium : 'only screen and (min-width: 1280px)',
22 | large : 'only screen and (min-width: 1440px)',
23 | landscape : 'only screen and (orientation: landscape)',
24 | portrait : 'only screen and (orientation: portrait)',
25 | retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),' +
26 | 'only screen and (min--moz-device-pixel-ratio: 2),' +
27 | 'only screen and (-o-min-device-pixel-ratio: 2/1),' +
28 | 'only screen and (min-device-pixel-ratio: 2),' +
29 | 'only screen and (min-resolution: 192dpi),' +
30 | 'only screen and (min-resolution: 2dppx)'
31 | },
32 |
33 | directives : {
34 | replace: function (el, path) {
35 | if (/IMG/.test(el[0].nodeName)) {
36 | var orig_path = el[0].src;
37 |
38 | if (new RegExp(path, 'i').test(orig_path)) return;
39 |
40 | el[0].src = path;
41 |
42 | return el.trigger('replace', [el[0].src, orig_path]);
43 | }
44 | }
45 | }
46 | },
47 |
48 | init : function (scope, method, options) {
49 | Foundation.inherit(this, 'throttle');
50 |
51 | if (typeof method === 'object') {
52 | $.extend(true, this.settings, method);
53 | }
54 |
55 | this.events();
56 | this.images();
57 |
58 | if (typeof method !== 'string') {
59 | return this.settings.init;
60 | } else {
61 | return this[method].call(this, options);
62 | }
63 | },
64 |
65 | events : function () {
66 | var self = this;
67 |
68 | $(window).on('resize.fndtn.interchange', self.throttle(function () {
69 | self.resize.call(self);
70 | }, 50));
71 | },
72 |
73 | resize : function () {
74 | var cache = this.cache;
75 |
76 | if(!this.images_loaded) {
77 | setTimeout($.proxy(this.resize, this), 50);
78 | return;
79 | }
80 |
81 | for (var uuid in cache) {
82 | if (cache.hasOwnProperty(uuid)) {
83 | var passed = this.results(uuid, cache[uuid]);
84 |
85 | if (passed) {
86 | this.settings.directives[passed
87 | .scenario[1]](passed.el, passed.scenario[0]);
88 | }
89 | }
90 | }
91 |
92 | },
93 |
94 | results : function (uuid, scenarios) {
95 | var count = scenarios.length;
96 |
97 | if (count > 0) {
98 | var el = $('[data-uuid="' + uuid + '"]');
99 |
100 | for (var i = count - 1; i >= 0; i--) {
101 | var mq, rule = scenarios[i][2];
102 | if (this.settings.named_queries.hasOwnProperty(rule)) {
103 | mq = matchMedia(this.settings.named_queries[rule]);
104 | } else {
105 | mq = matchMedia(rule);
106 | }
107 | if (mq.matches) {
108 | return {el: el, scenario: scenarios[i]};
109 | }
110 | }
111 | }
112 |
113 | return false;
114 | },
115 |
116 | images : function (force_update) {
117 | if (typeof this.cached_images === 'undefined' || force_update) {
118 | return this.update_images();
119 | }
120 |
121 | return this.cached_images;
122 | },
123 |
124 | update_images : function () {
125 | var images = document.getElementsByTagName('img'),
126 | count = images.length,
127 | loaded_count = 0,
128 | data_attr = 'data-' + this.settings.load_attr;
129 |
130 | this.cached_images = [];
131 | this.images_loaded = false;
132 |
133 | for (var i = count - 1; i >= 0; i--) {
134 | this.loaded($(images[i]), function (image) {
135 | loaded_count++;
136 | if (image) {
137 | var str = image.getAttribute(data_attr) || '';
138 |
139 | if (str.length > 0) {
140 | this.cached_images.push(image);
141 | }
142 | }
143 |
144 | if(loaded_count === count) {
145 | this.images_loaded = true;
146 | this.enhance();
147 | }
148 | }.bind(this));
149 | }
150 |
151 | return 'deferred';
152 | },
153 |
154 | // based on jquery.imageready.js
155 | // @weblinc, @jsantell, (c) 2012
156 |
157 | loaded : function (image, callback) {
158 | function loaded () {
159 | callback(image[0]);
160 | }
161 |
162 | function bindLoad () {
163 | this.one('load', loaded);
164 |
165 | if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
166 | var src = this.attr( 'src' ),
167 | param = src.match( /\?/ ) ? '&' : '?';
168 |
169 | param += 'random=' + (new Date()).getTime();
170 | this.attr('src', src + param);
171 | }
172 | }
173 |
174 | if (!image.attr('src')) {
175 | loaded();
176 | return;
177 | }
178 |
179 | if (image[0].complete || image[0].readyState === 4) {
180 | loaded();
181 | } else {
182 | bindLoad.call(image);
183 | }
184 | },
185 |
186 | enhance : function () {
187 | var count = this.images().length;
188 |
189 | for (var i = count - 1; i >= 0; i--) {
190 | this._object($(this.images()[i]));
191 | }
192 |
193 | return $(window).trigger('resize');
194 | },
195 |
196 | parse_params : function (path, directive, mq) {
197 | return [this.trim(path), this.convert_directive(directive), this.trim(mq)];
198 | },
199 |
200 | convert_directive : function (directive) {
201 | var trimmed = this.trim(directive);
202 |
203 | if (trimmed.length > 0) {
204 | return trimmed;
205 | }
206 |
207 | return 'replace';
208 | },
209 |
210 | _object : function(el) {
211 | var raw_arr = this.parse_data_attr(el),
212 | scenarios = [], count = raw_arr.length;
213 |
214 | if (count > 0) {
215 | for (var i = count - 1; i >= 0; i--) {
216 | var split = raw_arr[i].split(/\((.*?)(\))$/);
217 |
218 | if (split.length > 1) {
219 | var cached_split = split[0].split(','),
220 | params = this.parse_params(cached_split[0],
221 | cached_split[1], split[1]);
222 |
223 | scenarios.push(params);
224 | }
225 | }
226 | }
227 |
228 | return this.store(el, scenarios);
229 | },
230 |
231 | uuid : function (separator) {
232 | var delim = separator || "-";
233 |
234 | function S4() {
235 | return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
236 | }
237 |
238 | return (S4() + S4() + delim + S4() + delim + S4()
239 | + delim + S4() + delim + S4() + S4() + S4());
240 | },
241 |
242 | store : function (el, scenarios) {
243 | var uuid = this.uuid(),
244 | current_uuid = el.data('uuid');
245 |
246 | if (current_uuid) return this.cache[current_uuid];
247 |
248 | el.attr('data-uuid', uuid);
249 |
250 | return this.cache[uuid] = scenarios;
251 | },
252 |
253 | trim : function(str) {
254 | if (typeof str === 'string') {
255 | return $.trim(str);
256 | }
257 |
258 | return str;
259 | },
260 |
261 | parse_data_attr : function (el) {
262 | var raw = el.data(this.settings.load_attr).split(/\[(.*?)\]/),
263 | count = raw.length, output = [];
264 |
265 | for (var i = count - 1; i >= 0; i--) {
266 | if (raw[i].replace(/[\W\d]+/, '').length > 4) {
267 | output.push(raw[i]);
268 | }
269 | }
270 |
271 | return output;
272 | },
273 |
274 | reflow : function () {
275 | this.images(true);
276 | }
277 |
278 | };
279 |
280 | }(Foundation.zj, this, this.document));
--------------------------------------------------------------------------------
/stylesheets/styles.css:
--------------------------------------------------------------------------------
1 | @import url(https://fonts.googleapis.com/css?family=Arvo:400,700,400italic);
2 |
3 | /* MeyerWeb Reset */
4 |
5 | html, body, div, span, applet, object, iframe,
6 | h1, h2, h3, h4, h5, h6, p, blockquote, pre,
7 | a, abbr, acronym, address, big, cite, code,
8 | del, dfn, em, img, ins, kbd, q, s, samp,
9 | small, strike, strong, sub, sup, tt, var,
10 | b, u, i, center,
11 | dl, dt, dd, ol, ul, li,
12 | fieldset, form, label, legend,
13 | table, caption, tbody, tfoot, thead, tr, th, td,
14 | article, aside, canvas, details, embed,
15 | figure, figcaption, footer, header, hgroup,
16 | menu, nav, output, ruby, section, summary,
17 | time, mark, audio, video {
18 | margin: 0;
19 | padding: 0;
20 | border: 0;
21 | font: inherit;
22 | vertical-align: baseline;
23 | }
24 |
25 |
26 | /* Base text styles */
27 |
28 | body {
29 | padding:10px 50px 0 0;
30 | font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;
31 | font-size: 14px;
32 | color: #232323;
33 | background-color: #FBFAF7;
34 | margin: 0;
35 | line-height: 1.8em;
36 | -webkit-font-smoothing: antialiased;
37 |
38 | }
39 |
40 | h1, h2, h3, h4, h5, h6 {
41 | color:#232323;
42 | margin:36px 0 10px;
43 | }
44 |
45 | p, ul, ol, table, dl {
46 | margin:0 0 22px;
47 | }
48 |
49 | h1, h2, h3 {
50 | font-family: Arvo, Monaco, serif;
51 | line-height:1.3;
52 | font-weight: normal;
53 | }
54 |
55 | h1,h2, h3 {
56 | display: block;
57 | border-bottom: 1px solid #ccc;
58 | padding-bottom: 5px;
59 | }
60 |
61 | h1 {
62 | font-size: 30px;
63 | }
64 |
65 | h2 {
66 | font-size: 24px;
67 | }
68 |
69 | h3 {
70 | font-size: 18px;
71 | }
72 |
73 | h4, h5, h6 {
74 | font-family: Arvo, Monaco, serif;
75 | font-weight: 700;
76 | }
77 |
78 | a {
79 | color:#C30000;
80 | font-weight:200;
81 | text-decoration:none;
82 | }
83 |
84 | a:hover {
85 | text-decoration: underline;
86 | }
87 |
88 | a small {
89 | font-size: 12px;
90 | }
91 |
92 | em {
93 | font-style: italic;
94 | }
95 |
96 | strong {
97 | font-weight:700;
98 | }
99 |
100 | ul {
101 | list-style: inside;
102 | padding-left: 25px;
103 | }
104 |
105 | ol {
106 | list-style: decimal inside;
107 | padding-left: 20px;
108 | }
109 |
110 | blockquote {
111 | margin: 0;
112 | padding: 0 0 0 20px;
113 | font-style: italic;
114 | }
115 |
116 | dl, dt, dd, dl p {
117 | font-color: #444;
118 | }
119 |
120 | dl dt {
121 | font-weight: bold;
122 | }
123 |
124 | dl dd {
125 | padding-left: 20px;
126 | font-style: italic;
127 | }
128 |
129 | dl p {
130 | padding-left: 20px;
131 | font-style: italic;
132 | }
133 |
134 | hr {
135 | border:0;
136 | background:#ccc;
137 | height:1px;
138 | margin:0 0 24px;
139 | }
140 |
141 | /* Images */
142 |
143 | img {
144 | position: relative;
145 | margin: 0 auto;
146 | max-width: 650px;
147 | padding: 5px;
148 | margin: 10px 0 32px 0;
149 | border: 1px solid #ccc;
150 | }
151 |
152 | p img {
153 | display: inline;
154 | margin: 0;
155 | padding: 0;
156 | vertical-align: middle;
157 | text-align: center;
158 | border: none;
159 | }
160 |
161 | /* Code blocks */
162 |
163 | code, pre {
164 | font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
165 | color:#000;
166 | font-size:14px;
167 | }
168 |
169 | pre {
170 | padding: 4px 12px;
171 | background: #FDFEFB;
172 | border-radius:4px;
173 | border:1px solid #D7D8C8;
174 | overflow: auto;
175 | overflow-y: hidden;
176 | margin-bottom: 32px;
177 | }
178 |
179 |
180 | /* Tables */
181 |
182 | table {
183 | width:100%;
184 | }
185 |
186 | table {
187 | border: 1px solid #ccc;
188 | margin-bottom: 32px;
189 | text-align: left;
190 | }
191 |
192 | th {
193 | font-family: 'Arvo', Helvetica, Arial, sans-serif;
194 | font-size: 18px;
195 | font-weight: normal;
196 | padding: 10px;
197 | background: #232323;
198 | color: #FDFEFB;
199 | }
200 |
201 | td {
202 | padding: 10px;
203 | background: #ccc;
204 | }
205 |
206 |
207 | /* Wrapper */
208 | .wrapper {
209 | width:960px;
210 | }
211 |
212 |
213 | /* Header */
214 |
215 | header {
216 | background-color: #171717;
217 | color: #FDFDFB;
218 | width:170px;
219 | float:left;
220 | position:fixed;
221 | border: 1px solid #000;
222 | -webkit-border-top-right-radius: 4px;
223 | -webkit-border-bottom-right-radius: 4px;
224 | -moz-border-radius-topright: 4px;
225 | -moz-border-radius-bottomright: 4px;
226 | border-top-right-radius: 4px;
227 | border-bottom-right-radius: 4px;
228 | padding: 34px 25px 22px 50px;
229 | margin: 30px 25px 0 0;
230 | -webkit-font-smoothing: antialiased;
231 | }
232 |
233 | p.header {
234 | font-size: 16px;
235 | }
236 |
237 | h1.header {
238 | font-family: Arvo, sans-serif;
239 | font-size: 30px;
240 | font-weight: 300;
241 | line-height: 1.3em;
242 | border-bottom: none;
243 | margin-top: 0;
244 | }
245 |
246 |
247 | h1.header, a.header, a.name, header a{
248 | color: #fff;
249 | }
250 |
251 | a.header {
252 | text-decoration: underline;
253 | }
254 |
255 | a.name {
256 | white-space: nowrap;
257 | }
258 |
259 | header ul {
260 | list-style:none;
261 | padding:0;
262 | }
263 |
264 | header li {
265 | list-style-type: none;
266 | width:132px;
267 | height:15px;
268 | margin-bottom: 12px;
269 | line-height: 1em;
270 | padding: 6px 6px 6px 7px;
271 |
272 | background: #AF0011;
273 | background: -moz-linear-gradient(top, #AF0011 0%, #820011 100%);
274 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#dddddd));
275 | background: -webkit-linear-gradient(top, #AF0011 0%,#820011 100%);
276 | background: -o-linear-gradient(top, #AF0011 0%,#820011 100%);
277 | background: -ms-linear-gradient(top, #AF0011 0%,#820011 100%);
278 | background: linear-gradient(top, #AF0011 0%,#820011 100%);
279 |
280 | border-radius:4px;
281 | border:1px solid #0D0D0D;
282 |
283 | -webkit-box-shadow: inset 0px 1px 1px 0 rgba(233,2,38, 1);
284 | box-shadow: inset 0px 1px 1px 0 rgba(233,2,38, 1);
285 |
286 | }
287 |
288 | header li:hover {
289 | background: #C3001D;
290 | background: -moz-linear-gradient(top, #C3001D 0%, #950119 100%);
291 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#dddddd));
292 | background: -webkit-linear-gradient(top, #C3001D 0%,#950119 100%);
293 | background: -o-linear-gradient(top, #C3001D 0%,#950119 100%);
294 | background: -ms-linear-gradient(top, #C3001D 0%,#950119 100%);
295 | background: linear-gradient(top, #C3001D 0%,#950119 100%);
296 | }
297 |
298 | a.buttons {
299 | -webkit-font-smoothing: antialiased;
300 | background: url(../images/arrow-down.png) no-repeat;
301 | font-weight: normal;
302 | text-shadow: rgba(0, 0, 0, 0.4) 0 -1px 0;
303 | padding: 2px 2px 2px 22px;
304 | height: 30px;
305 | }
306 |
307 | a.github {
308 | background: url(../images/octocat-small.png) no-repeat 1px;
309 | }
310 |
311 | a.buttons:hover {
312 | color: #fff;
313 | text-decoration: none;
314 | }
315 |
316 |
317 | /* Section - for main page content */
318 |
319 | section {
320 | width:650px;
321 | float:right;
322 | padding-bottom:50px;
323 | }
324 |
325 |
326 | /* Footer */
327 |
328 | footer {
329 | width:170px;
330 | float:left;
331 | position:fixed;
332 | bottom:10px;
333 | padding-left: 50px;
334 | }
335 |
336 | @media print, screen and (max-width: 960px) {
337 |
338 | div.wrapper {
339 | width:auto;
340 | margin:0;
341 | }
342 |
343 | header, section, footer {
344 | float:none;
345 | position:static;
346 | width:auto;
347 | }
348 |
349 | footer {
350 | border-top: 1px solid #ccc;
351 | margin:0 84px 0 50px;
352 | padding:0;
353 | }
354 |
355 | header {
356 | padding-right:320px;
357 | }
358 |
359 | section {
360 | padding:20px 84px 20px 50px;
361 | margin:0 0 20px;
362 | }
363 |
364 | header a small {
365 | display:inline;
366 | }
367 |
368 | header ul {
369 | position:absolute;
370 | right:130px;
371 | top:84px;
372 | }
373 | }
374 |
375 | @media print, screen and (max-width: 720px) {
376 | body {
377 | word-wrap:break-word;
378 | }
379 |
380 | header {
381 | padding:10px 20px 0;
382 | margin-right: 0;
383 | }
384 |
385 | section {
386 | padding:10px 0 10px 20px;
387 | margin:0 0 30px;
388 | }
389 |
390 | footer {
391 | margin: 0 0 0 30px;
392 | }
393 |
394 | header ul, header p.view {
395 | position:static;
396 | }
397 | }
398 |
399 | @media print, screen and (max-width: 480px) {
400 |
401 | header ul li.download {
402 | display:none;
403 | }
404 |
405 | footer {
406 | margin: 0 0 0 20px;
407 | }
408 |
409 | footer a{
410 | display:block;
411 | }
412 |
413 | }
414 |
415 | @media print {
416 | body {
417 | padding:0.4in;
418 | font-size:12pt;
419 | color:#444;
420 | }
421 | }
--------------------------------------------------------------------------------
/js/vendor/custom.modernizr.js:
--------------------------------------------------------------------------------
1 | /* Modernizr 2.6.2 (Custom Build) | MIT & BSD
2 | * Build: http://modernizr.com/download/#-inlinesvg-svg-svgclippaths-touch-shiv-mq-cssclasses-teststyles-prefixes-ie8compat-load
3 | */
4 | ;window.Modernizr=function(a,b,c){function y(a){j.cssText=a}function z(a,b){return y(m.join(a+";")+(b||""))}function A(a,b){return typeof a===b}function B(a,b){return!!~(""+a).indexOf(b)}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:A(f,"function")?f.bind(d||b):f}return!1}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n={svg:"http://www.w3.org/2000/svg"},o={},p={},q={},r=[],s=r.slice,t,u=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["",'"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},v=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return u("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},w={}.hasOwnProperty,x;!A(w,"undefined")&&!A(w.call,"undefined")?x=function(a,b){return w.call(a,b)}:x=function(a,b){return b in a&&A(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=s.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(s.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(s.call(arguments)))};return e}),o.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:u(["@media (",m.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},o.svg=function(){return!!b.createElementNS&&!!b.createElementNS(n.svg,"svg").createSVGRect},o.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML=" ",(a.firstChild&&a.firstChild.namespaceURI)==n.svg},o.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(l.call(b.createElementNS(n.svg,"clipPath")))};for(var D in o)x(o,D)&&(t=D.toLowerCase(),e[t]=o[D](),r.push((e[t]?"":"no-")+t));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)x(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},y(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=m,e.mq=v,e.testStyles=u,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+r.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f
--------------------------------------------------------------------------------
/js/foundation/foundation.reveal.js:
--------------------------------------------------------------------------------
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.2.2',
10 |
11 | locked : false,
12 |
13 | settings : {
14 | animation: 'fadeAndPop',
15 | animationSpeed: 250,
16 | closeOnBackgroundClick: true,
17 | closeOnEsc: true,
18 | dismissModalClass: 'close-reveal-modal',
19 | bgClass: 'reveal-modal-bg',
20 | open: function(){},
21 | opened: function(){},
22 | close: function(){},
23 | closed: function(){},
24 | bg : $('.reveal-modal-bg'),
25 | css : {
26 | open : {
27 | 'opacity': 0,
28 | 'visibility': 'visible',
29 | 'display' : 'block'
30 | },
31 | close : {
32 | 'opacity': 1,
33 | 'visibility': 'hidden',
34 | 'display': 'none'
35 | }
36 | }
37 | },
38 |
39 | init : function (scope, method, options) {
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 |
65 | if (!self.locked) {
66 | var element = $(this),
67 | ajax = element.data('reveal-ajax');
68 |
69 | self.locked = true;
70 |
71 | if (typeof ajax === 'undefined') {
72 | self.open.call(self, element);
73 | } else {
74 | var url = ajax === true ? element.attr('href') : ajax;
75 |
76 | self.open.call(self, element, {url: url});
77 | }
78 | }
79 | })
80 | .on('click.fndtn.reveal', this.close_targets(), function (e) {
81 | e.preventDefault();
82 | if (!self.locked) {
83 | var settings = $.extend({}, self.settings, self.data_options($('.reveal-modal.open')));
84 | if ($(e.target)[0] === $('.' + settings.bgClass)[0] && !settings.closeOnBackgroundClick) {
85 | return;
86 | }
87 |
88 | self.locked = true;
89 | self.close.call(self, $(this).closest('.reveal-modal'));
90 | }
91 | })
92 | .on('open.fndtn.reveal', '.reveal-modal', this.settings.open)
93 | .on('opened.fndtn.reveal', '.reveal-modal', this.settings.opened)
94 | .on('opened.fndtn.reveal', '.reveal-modal', this.open_video)
95 | .on('close.fndtn.reveal', '.reveal-modal', this.settings.close)
96 | .on('closed.fndtn.reveal', '.reveal-modal', this.settings.closed)
97 | .on('closed.fndtn.reveal', '.reveal-modal', this.close_video);
98 |
99 | $( 'body' ).bind( 'keyup.reveal', function ( event ) {
100 | var open_modal = $('.reveal-modal.open'),
101 | settings = $.extend({}, self.settings, self.data_options(open_modal));
102 | if ( event.which === 27 && settings.closeOnEsc) { // 27 is the keycode for the Escape key
103 | open_modal.foundation('reveal', 'close');
104 | }
105 | });
106 |
107 | return true;
108 | },
109 |
110 | open : function (target, ajax_settings) {
111 | if (target) {
112 | if (typeof target.selector !== 'undefined') {
113 | var modal = $('#' + target.data('reveal-id'));
114 | } else {
115 | var modal = $(this.scope);
116 |
117 | ajax_settings = target;
118 | }
119 | } else {
120 | var modal = $(this.scope);
121 | }
122 |
123 | if (!modal.hasClass('open')) {
124 | var open_modal = $('.reveal-modal.open');
125 |
126 | if (typeof modal.data('css-top') === 'undefined') {
127 | modal.data('css-top', parseInt(modal.css('top'), 10))
128 | .data('offset', this.cache_offset(modal));
129 | }
130 |
131 | modal.trigger('open');
132 |
133 | if (open_modal.length < 1) {
134 | this.toggle_bg(modal);
135 | }
136 |
137 | if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
138 | this.hide(open_modal, this.settings.css.close);
139 | this.show(modal, this.settings.css.open);
140 | } else {
141 | var self = this,
142 | old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
143 |
144 | $.extend(ajax_settings, {
145 | success: function (data, textStatus, jqXHR) {
146 | if ( $.isFunction(old_success) ) {
147 | old_success(data, textStatus, jqXHR);
148 | }
149 |
150 | modal.html(data);
151 | $(modal).foundation('section', 'reflow');
152 |
153 | self.hide(open_modal, self.settings.css.close);
154 | self.show(modal, self.settings.css.open);
155 | }
156 | });
157 |
158 | $.ajax(ajax_settings);
159 | }
160 | }
161 | },
162 |
163 | close : function (modal) {
164 |
165 | var modal = modal && modal.length ? modal : $(this.scope),
166 | open_modals = $('.reveal-modal.open');
167 |
168 | if (open_modals.length > 0) {
169 | this.locked = true;
170 | modal.trigger('close');
171 | this.toggle_bg(modal);
172 | this.hide(open_modals, this.settings.css.close);
173 | }
174 | },
175 |
176 | close_targets : function () {
177 | var base = '.' + this.settings.dismissModalClass;
178 |
179 | if (this.settings.closeOnBackgroundClick) {
180 | return base + ', .' + this.settings.bgClass;
181 | }
182 |
183 | return base;
184 | },
185 |
186 | toggle_bg : function (modal) {
187 | if ($('.reveal-modal-bg').length === 0) {
188 | this.settings.bg = $('
', {'class': this.settings.bgClass})
189 | .appendTo('body');
190 | }
191 |
192 | if (this.settings.bg.filter(':visible').length > 0) {
193 | this.hide(this.settings.bg);
194 | } else {
195 | this.show(this.settings.bg);
196 | }
197 | },
198 |
199 | show : function (el, css) {
200 | // is modal
201 | if (css) {
202 | if (/pop/i.test(this.settings.animation)) {
203 | css.top = $(window).scrollTop() - el.data('offset') + 'px';
204 | var end_css = {
205 | top: $(window).scrollTop() + el.data('css-top') + 'px',
206 | opacity: 1
207 | };
208 |
209 | return this.delay(function () {
210 | return el
211 | .css(css)
212 | .animate(end_css, this.settings.animationSpeed, 'linear', function () {
213 | this.locked = false;
214 | el.trigger('opened');
215 | }.bind(this))
216 | .addClass('open');
217 | }.bind(this), this.settings.animationSpeed / 2);
218 | }
219 |
220 | if (/fade/i.test(this.settings.animation)) {
221 | var end_css = {opacity: 1};
222 |
223 | return this.delay(function () {
224 | return el
225 | .css(css)
226 | .animate(end_css, this.settings.animationSpeed, 'linear', function () {
227 | this.locked = false;
228 | el.trigger('opened');
229 | }.bind(this))
230 | .addClass('open');
231 | }.bind(this), this.settings.animationSpeed / 2);
232 | }
233 |
234 | return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened');
235 | }
236 |
237 | // should we animate the background?
238 | if (/fade/i.test(this.settings.animation)) {
239 | return el.fadeIn(this.settings.animationSpeed / 2);
240 | }
241 |
242 | return el.show();
243 | },
244 |
245 | hide : function (el, css) {
246 | // is modal
247 | if (css) {
248 | if (/pop/i.test(this.settings.animation)) {
249 | var end_css = {
250 | top: - $(window).scrollTop() - el.data('offset') + 'px',
251 | opacity: 0
252 | };
253 |
254 | return this.delay(function () {
255 | return el
256 | .animate(end_css, this.settings.animationSpeed, 'linear', function () {
257 | this.locked = false;
258 | el.css(css).trigger('closed');
259 | }.bind(this))
260 | .removeClass('open');
261 | }.bind(this), this.settings.animationSpeed / 2);
262 | }
263 |
264 | if (/fade/i.test(this.settings.animation)) {
265 | var end_css = {opacity: 0};
266 |
267 | return this.delay(function () {
268 | return el
269 | .animate(end_css, this.settings.animationSpeed, 'linear', function () {
270 | this.locked = false;
271 | el.css(css).trigger('closed');
272 | }.bind(this))
273 | .removeClass('open');
274 | }.bind(this), this.settings.animationSpeed / 2);
275 | }
276 |
277 | return el.hide().css(css).removeClass('open').trigger('closed');
278 | }
279 |
280 | // should we animate the background?
281 | if (/fade/i.test(this.settings.animation)) {
282 | return el.fadeOut(this.settings.animationSpeed / 2);
283 | }
284 |
285 | return el.hide();
286 | },
287 |
288 | close_video : function (e) {
289 | var video = $(this).find('.flex-video'),
290 | iframe = video.find('iframe');
291 |
292 | if (iframe.length > 0) {
293 | iframe.attr('data-src', iframe[0].src);
294 | iframe.attr('src', 'about:blank');
295 | video.hide();
296 | }
297 | },
298 |
299 | open_video : function (e) {
300 | var video = $(this).find('.flex-video'),
301 | iframe = video.find('iframe');
302 |
303 | if (iframe.length > 0) {
304 | var data_src = iframe.attr('data-src');
305 | if (typeof data_src === 'string') {
306 | iframe[0].src = iframe.attr('data-src');
307 | } else {
308 | var src = iframe[0].src;
309 | iframe[0].src = undefined;
310 | iframe[0].src = src;
311 | }
312 | video.show();
313 | }
314 | },
315 |
316 | cache_offset : function (modal) {
317 | var offset = modal.show().height() + parseInt(modal.css('top'), 10);
318 |
319 | modal.hide();
320 |
321 | return offset;
322 | },
323 |
324 | off : function () {
325 | $(this.scope).off('.fndtn.reveal');
326 | },
327 |
328 | reflow : function () {}
329 | };
330 | }(Foundation.zj, this, this.document));
--------------------------------------------------------------------------------
/js/foundation/foundation.topbar.js:
--------------------------------------------------------------------------------
1 | /*jslint unparam: true, browser: true, indent: 2 */
2 |
3 | ;(function ($, window, document, undefined) {
4 | 'use strict';
5 |
6 | Foundation.libs.topbar = {
7 | name : 'topbar',
8 |
9 | version: '4.3.1',
10 |
11 | settings : {
12 | index : 0,
13 | stickyClass : 'sticky',
14 | custom_back_text: true,
15 | back_text: 'Back',
16 | is_hover: true,
17 | mobile_show_parent_link: true,
18 | scrolltop : true, // jump to top when sticky nav menu toggle is clicked
19 | init : false
20 | },
21 |
22 | init : function (section, method, options) {
23 | Foundation.inherit(this, 'data_options');
24 | var self = this;
25 |
26 | if (typeof method === 'object') {
27 | $.extend(true, this.settings, method);
28 | } else if (typeof options !== 'undefined') {
29 | $.extend(true, this.settings, options);
30 | }
31 |
32 | if (typeof method !== 'string') {
33 |
34 | $('.top-bar, [data-topbar]').each(function () {
35 | $.extend(true, self.settings, self.data_options($(this)));
36 | self.settings.$w = $(window);
37 | self.settings.$topbar = $(this);
38 | self.settings.$section = self.settings.$topbar.find('section');
39 | self.settings.$titlebar = self.settings.$topbar.children('ul').first();
40 | self.settings.$topbar.data('index', 0);
41 |
42 | var breakpoint = $("
").insertAfter(self.settings.$topbar);
43 | self.settings.breakPoint = breakpoint.width();
44 | breakpoint.remove();
45 |
46 | self.assemble();
47 |
48 | if (self.settings.is_hover) {
49 | self.settings.$topbar.find('.has-dropdown').addClass('not-click');
50 | }
51 |
52 | if (self.settings.$topbar.parent().hasClass('fixed')) {
53 | $('body').css('padding-top', self.outerHeight(self.settings.$topbar));
54 | }
55 | });
56 |
57 | if (!self.settings.init) {
58 | this.events();
59 | }
60 |
61 | return this.settings.init;
62 | } else {
63 | // fire method
64 | return this[method].call(this, options);
65 | }
66 | },
67 |
68 | timer : null,
69 |
70 | events : function () {
71 | var self = this;
72 | var offst = this.outerHeight($('.top-bar, [data-topbar]'));
73 | $(this.scope)
74 | .off('.fndtn.topbar')
75 | .on('click.fndtn.topbar', '.top-bar .toggle-topbar, [data-topbar] .toggle-topbar', function (e) {
76 | var topbar = $(this).closest('.top-bar, [data-topbar]'),
77 | section = topbar.find('section, .section'),
78 | titlebar = topbar.children('ul').first();
79 |
80 | e.preventDefault();
81 |
82 | if (self.breakpoint()) {
83 | if (!self.rtl) {
84 | section.css({left: '0%'});
85 | section.find('>.name').css({left: '100%'});
86 | } else {
87 | section.css({right: '0%'});
88 | section.find('>.name').css({right: '100%'});
89 | }
90 |
91 | section.find('li.moved').removeClass('moved');
92 | topbar.data('index', 0);
93 |
94 | topbar
95 | .toggleClass('expanded')
96 | .css('height', '');
97 | }
98 |
99 | if (!topbar.hasClass('expanded')) {
100 | if (topbar.hasClass('fixed')) {
101 | topbar.parent().addClass('fixed');
102 | topbar.removeClass('fixed');
103 | $('body').css('padding-top',offst);
104 | }
105 | } else if (topbar.parent().hasClass('fixed')) {
106 | topbar.parent().removeClass('fixed');
107 | topbar.addClass('fixed');
108 | $('body').css('padding-top','0');
109 |
110 | if (self.settings.scrolltop) {
111 | window.scrollTo(0,0);
112 | }
113 | }
114 | })
115 |
116 | .on('click.fndtn.topbar', '.top-bar li.has-dropdown', function (e) {
117 | if (self.breakpoint()) return;
118 |
119 | var li = $(this),
120 | target = $(e.target),
121 | topbar = li.closest('[data-topbar], .top-bar'),
122 | is_hover = topbar.data('topbar');
123 |
124 | if (self.settings.is_hover && !Modernizr.touch) return;
125 |
126 | e.stopImmediatePropagation();
127 |
128 | if (target[0].nodeName === 'A' && target.parent().hasClass('has-dropdown')) {
129 | e.preventDefault();
130 | }
131 |
132 | if (li.hasClass('hover')) {
133 | li
134 | .removeClass('hover')
135 | .find('li')
136 | .removeClass('hover');
137 | } else {
138 | li.addClass('hover');
139 | }
140 | })
141 |
142 | .on('click.fndtn.topbar', '.top-bar .has-dropdown>a, [data-topbar] .has-dropdown>a', function (e) {
143 | if (self.breakpoint()) {
144 | e.preventDefault();
145 |
146 | var $this = $(this),
147 | topbar = $this.closest('.top-bar, [data-topbar]'),
148 | section = topbar.find('section, .section'),
149 | titlebar = topbar.children('ul').first(),
150 | dropdownHeight = $this.next('.dropdown').outerHeight(),
151 | $selectedLi = $this.closest('li');
152 |
153 | topbar.data('index', topbar.data('index') + 1);
154 | $selectedLi.addClass('moved');
155 |
156 | if (!self.rtl) {
157 | section.css({left: -(100 * topbar.data('index')) + '%'});
158 | section.find('>.name').css({left: 100 * topbar.data('index') + '%'});
159 | } else {
160 | section.css({right: -(100 * topbar.data('index')) + '%'});
161 | section.find('>.name').css({right: 100 * topbar.data('index') + '%'});
162 | }
163 |
164 | topbar.css('height', self.outerHeight($this.siblings('ul'), true) + self.height(titlebar));
165 | }
166 | });
167 |
168 | $(window).on('resize.fndtn.topbar', function () {
169 | if (!self.breakpoint()) {
170 | $('.top-bar, [data-topbar]')
171 | .css('height', '')
172 | .removeClass('expanded')
173 | .find('li')
174 | .removeClass('hover');
175 | }
176 | }.bind(this));
177 |
178 | $('body').on('click.fndtn.topbar', function (e) {
179 | var parent = $(e.target).closest('[data-topbar], .top-bar');
180 |
181 | if (parent.length > 0) {
182 | return;
183 | }
184 |
185 | $('.top-bar li, [data-topbar] li').removeClass('hover');
186 | });
187 |
188 | // Go up a level on Click
189 | $(this.scope).on('click.fndtn', '.top-bar .has-dropdown .back, [data-topbar] .has-dropdown .back', function (e) {
190 | e.preventDefault();
191 |
192 | var $this = $(this),
193 | topbar = $this.closest('.top-bar, [data-topbar]'),
194 | titlebar = topbar.children('ul').first(),
195 | section = topbar.find('section, .section'),
196 | $movedLi = $this.closest('li.moved'),
197 | $previousLevelUl = $movedLi.parent();
198 |
199 | topbar.data('index', topbar.data('index') - 1);
200 |
201 | if (!self.rtl) {
202 | section.css({left: -(100 * topbar.data('index')) + '%'});
203 | section.find('>.name').css({left: 100 * topbar.data('index') + '%'});
204 | } else {
205 | section.css({right: -(100 * topbar.data('index')) + '%'});
206 | section.find('>.name').css({right: 100 * topbar.data('index') + '%'});
207 | }
208 |
209 | if (topbar.data('index') === 0) {
210 | topbar.css('height', '');
211 | } else {
212 | topbar.css('height', self.outerHeight($previousLevelUl, true) + self.height(titlebar));
213 | }
214 |
215 | setTimeout(function () {
216 | $movedLi.removeClass('moved');
217 | }, 300);
218 | });
219 | },
220 |
221 | breakpoint : function () {
222 | return $(document).width() <= this.settings.breakPoint || $('html').hasClass('lt-ie9');
223 | },
224 |
225 | assemble : function () {
226 | var self = this;
227 | // Pull element out of the DOM for manipulation
228 | this.settings.$section.detach();
229 |
230 | this.settings.$section.find('.has-dropdown>a').each(function () {
231 | var $link = $(this),
232 | $dropdown = $link.siblings('.dropdown'),
233 | url = $link.attr('href');
234 |
235 | if (self.settings.mobile_show_parent_link && url && url.length > 1) {
236 | var $titleLi = $('' + $link.text() +' ');
237 | } else {
238 | var $titleLi = $(' ');
239 | }
240 |
241 | // Copy link to subnav
242 | if (self.settings.custom_back_text == true) {
243 | $titleLi.find('h5>a').html('« ' + self.settings.back_text);
244 | } else {
245 | $titleLi.find('h5>a').html('« ' + $link.html());
246 | }
247 | $dropdown.prepend($titleLi);
248 | });
249 |
250 | // Put element back in the DOM
251 | this.settings.$section.appendTo(this.settings.$topbar);
252 |
253 | // check for sticky
254 | this.sticky();
255 | },
256 |
257 | height : function (ul) {
258 | var total = 0,
259 | self = this;
260 |
261 | ul.find('> li').each(function () { total += self.outerHeight($(this), true); });
262 |
263 | return total;
264 | },
265 |
266 | sticky : function () {
267 | var klass = '.' + this.settings.stickyClass;
268 | if ($(klass).length > 0) {
269 | var distance = $(klass).length ? $(klass).offset().top: 0,
270 | $window = $(window),
271 | offst = this.outerHeight($('.top-bar')),
272 | t_top;
273 |
274 | //Whe resize elements of the page on windows resize. Must recalculate distance
275 | $(window).resize(function() {
276 | clearTimeout(t_top);
277 | t_top = setTimeout (function() {
278 | distance = $(klass).offset().top;
279 | },105);
280 | });
281 | $window.scroll(function() {
282 | if ($window.scrollTop() > (distance)) {
283 | $(klass).addClass("fixed");
284 | $('body').css('padding-top',offst);
285 | } else if ($window.scrollTop() <= distance) {
286 | $(klass).removeClass("fixed");
287 | $('body').css('padding-top','0');
288 | }
289 | });
290 | }
291 | },
292 |
293 | off : function () {
294 | $(this.scope).off('.fndtn.topbar');
295 | $(window).off('.fndtn.topbar');
296 | },
297 |
298 | reflow : function () {}
299 | };
300 | }(Foundation.zj, this, this.document));
301 |
--------------------------------------------------------------------------------
/js/foundation/foundation.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Foundation Responsive Library
3 | * http://foundation.zurb.com
4 | * Copyright 2013, ZURB
5 | * Free to use under the MIT license.
6 | * http://www.opensource.org/licenses/mit-license.php
7 | */
8 |
9 | /*jslint unparam: true, browser: true, indent: 2 */
10 |
11 | // Accommodate running jQuery or Zepto in noConflict() mode by
12 | // using an anonymous function to redefine the $ shorthand name.
13 | // See http://docs.jquery.com/Using_jQuery_with_Other_Libraries
14 | // and http://zeptojs.com/
15 | var libFuncName = null;
16 |
17 | if (typeof jQuery === "undefined" &&
18 | typeof Zepto === "undefined" &&
19 | typeof $ === "function") {
20 | libFuncName = $;
21 | } else if (typeof jQuery === "function") {
22 | libFuncName = jQuery;
23 | } else if (typeof Zepto === "function") {
24 | libFuncName = Zepto;
25 | } else {
26 | throw new TypeError();
27 | }
28 |
29 | (function ($, window, document, undefined) {
30 | 'use strict';
31 |
32 | /*
33 | matchMedia() polyfill - Test a CSS media
34 | type/query in JS. Authors & copyright (c) 2012:
35 | Scott Jehl, Paul Irish, Nicholas Zakas.
36 | Dual MIT/BSD license
37 |
38 | https://github.com/paulirish/matchMedia.js
39 | */
40 |
41 | window.matchMedia = window.matchMedia || (function( doc, undefined ) {
42 |
43 | "use strict";
44 |
45 | var bool,
46 | docElem = doc.documentElement,
47 | refNode = docElem.firstElementChild || docElem.firstChild,
48 | // fakeBody required for
49 | fakeBody = doc.createElement( "body" ),
50 | div = doc.createElement( "div" );
51 |
52 | div.id = "mq-test-1";
53 | div.style.cssText = "position:absolute;top:-100em";
54 | fakeBody.style.background = "none";
55 | fakeBody.appendChild(div);
56 |
57 | return function(q){
58 |
59 | div.innerHTML = "";
60 |
61 | docElem.insertBefore( fakeBody, refNode );
62 | bool = div.offsetWidth === 42;
63 | docElem.removeChild( fakeBody );
64 |
65 | return {
66 | matches: bool,
67 | media: q
68 | };
69 |
70 | };
71 |
72 | }( document ));
73 |
74 | // add dusty browser stuff
75 | if (!Array.prototype.filter) {
76 | Array.prototype.filter = function(fun /*, thisp */) {
77 | "use strict";
78 |
79 | if (this == null) {
80 | throw new TypeError();
81 | }
82 |
83 | var t = Object(this),
84 | len = t.length >>> 0;
85 | if (typeof fun !== "function") {
86 | return;
87 | }
88 |
89 | var res = [],
90 | thisp = arguments[1];
91 | for (var i = 0; i < len; i++) {
92 | if (i in t) {
93 | var val = t[i]; // in case fun mutates this
94 | if (fun && fun.call(thisp, val, i, t)) {
95 | res.push(val);
96 | }
97 | }
98 | }
99 |
100 | return res;
101 | }
102 | }
103 |
104 | if (!Function.prototype.bind) {
105 | Function.prototype.bind = function (oThis) {
106 | if (typeof this !== "function") {
107 | // closest thing possible to the ECMAScript 5 internal IsCallable function
108 | throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
109 | }
110 |
111 | var aArgs = Array.prototype.slice.call(arguments, 1),
112 | fToBind = this,
113 | fNOP = function () {},
114 | fBound = function () {
115 | return fToBind.apply(this instanceof fNOP && oThis
116 | ? this
117 | : oThis,
118 | aArgs.concat(Array.prototype.slice.call(arguments)));
119 | };
120 |
121 | fNOP.prototype = this.prototype;
122 | fBound.prototype = new fNOP();
123 |
124 | return fBound;
125 | };
126 | }
127 |
128 | if (!Array.prototype.indexOf) {
129 | Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
130 | "use strict";
131 | if (this == null) {
132 | throw new TypeError();
133 | }
134 | var t = Object(this);
135 | var len = t.length >>> 0;
136 | if (len === 0) {
137 | return -1;
138 | }
139 | var n = 0;
140 | if (arguments.length > 1) {
141 | n = Number(arguments[1]);
142 | if (n != n) { // shortcut for verifying if it's NaN
143 | n = 0;
144 | } else if (n != 0 && n != Infinity && n != -Infinity) {
145 | n = (n > 0 || -1) * Math.floor(Math.abs(n));
146 | }
147 | }
148 | if (n >= len) {
149 | return -1;
150 | }
151 | var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
152 | for (; k < len; k++) {
153 | if (k in t && t[k] === searchElement) {
154 | return k;
155 | }
156 | }
157 | return -1;
158 | }
159 | }
160 |
161 | // fake stop() for zepto.
162 | $.fn.stop = $.fn.stop || function() {
163 | return this;
164 | };
165 |
166 | window.Foundation = {
167 | name : 'Foundation',
168 |
169 | version : '4.3.1',
170 |
171 | cache : {},
172 |
173 | init : function (scope, libraries, method, options, response, /* internal */ nc) {
174 | var library_arr,
175 | args = [scope, method, options, response],
176 | responses = [],
177 | nc = nc || false;
178 |
179 | // disable library error catching,
180 | // used for development only
181 | if (nc) this.nc = nc;
182 |
183 | // check RTL
184 | this.rtl = /rtl/i.test($('html').attr('dir'));
185 |
186 | // set foundation global scope
187 | this.scope = scope || this.scope;
188 |
189 | if (libraries && typeof libraries === 'string' && !/reflow/i.test(libraries)) {
190 | if (/off/i.test(libraries)) return this.off();
191 |
192 | library_arr = libraries.split(' ');
193 |
194 | if (library_arr.length > 0) {
195 | for (var i = library_arr.length - 1; i >= 0; i--) {
196 | responses.push(this.init_lib(library_arr[i], args));
197 | }
198 | }
199 | } else {
200 | if (/reflow/i.test(libraries)) args[1] = 'reflow';
201 |
202 | for (var lib in this.libs) {
203 | responses.push(this.init_lib(lib, args));
204 | }
205 | }
206 |
207 | // if first argument is callback, add to args
208 | if (typeof libraries === 'function') {
209 | args.unshift(libraries);
210 | }
211 |
212 | return this.response_obj(responses, args);
213 | },
214 |
215 | response_obj : function (response_arr, args) {
216 | for (var i = 0, len = args.length; i < len; i++) {
217 | if (typeof args[i] === 'function') {
218 | return args[i]({
219 | errors: response_arr.filter(function (s) {
220 | if (typeof s === 'string') return s;
221 | })
222 | });
223 | }
224 | }
225 |
226 | return response_arr;
227 | },
228 |
229 | init_lib : function (lib, args) {
230 | return this.trap(function () {
231 | if (this.libs.hasOwnProperty(lib)) {
232 | this.patch(this.libs[lib]);
233 | return this.libs[lib].init.apply(this.libs[lib], args);
234 | } else {
235 | return function () {};
236 | }
237 | }.bind(this), lib);
238 | },
239 |
240 | trap : function (fun, lib) {
241 | if (!this.nc) {
242 | try {
243 | return fun();
244 | } catch (e) {
245 | return this.error({name: lib, message: 'could not be initialized', more: e.name + ' ' + e.message});
246 | }
247 | }
248 |
249 | return fun();
250 | },
251 |
252 | patch : function (lib) {
253 | this.fix_outer(lib);
254 | lib.scope = this.scope;
255 | lib.rtl = this.rtl;
256 | },
257 |
258 | inherit : function (scope, methods) {
259 | var methods_arr = methods.split(' ');
260 |
261 | for (var i = methods_arr.length - 1; i >= 0; i--) {
262 | if (this.lib_methods.hasOwnProperty(methods_arr[i])) {
263 | this.libs[scope.name][methods_arr[i]] = this.lib_methods[methods_arr[i]];
264 | }
265 | }
266 | },
267 |
268 | random_str : function (length) {
269 | var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
270 |
271 | if (!length) {
272 | length = Math.floor(Math.random() * chars.length);
273 | }
274 |
275 | var str = '';
276 | for (var i = 0; i < length; i++) {
277 | str += chars[Math.floor(Math.random() * chars.length)];
278 | }
279 | return str;
280 | },
281 |
282 | libs : {},
283 |
284 | // methods that can be inherited in libraries
285 | lib_methods : {
286 | set_data : function (node, data) {
287 | // this.name references the name of the library calling this method
288 | var id = [this.name,+new Date(),Foundation.random_str(5)].join('-');
289 |
290 | Foundation.cache[id] = data;
291 | node.attr('data-' + this.name + '-id', id);
292 | return data;
293 | },
294 |
295 | get_data : function (node) {
296 | return Foundation.cache[node.attr('data-' + this.name + '-id')];
297 | },
298 |
299 | remove_data : function (node) {
300 | if (node) {
301 | delete Foundation.cache[node.attr('data-' + this.name + '-id')];
302 | node.attr('data-' + this.name + '-id', '');
303 | } else {
304 | $('[data-' + this.name + '-id]').each(function () {
305 | delete Foundation.cache[$(this).attr('data-' + this.name + '-id')];
306 | $(this).attr('data-' + this.name + '-id', '');
307 | });
308 | }
309 | },
310 |
311 | throttle : function(fun, delay) {
312 | var timer = null;
313 | return function () {
314 | var context = this, args = arguments;
315 | clearTimeout(timer);
316 | timer = setTimeout(function () {
317 | fun.apply(context, args);
318 | }, delay);
319 | };
320 | },
321 |
322 | // parses data-options attribute on nodes and turns
323 | // them into an object
324 | data_options : function (el) {
325 | var opts = {}, ii, p,
326 | opts_arr = (el.attr('data-options') || ':').split(';'),
327 | opts_len = opts_arr.length;
328 |
329 | function isNumber (o) {
330 | return ! isNaN (o-0) && o !== null && o !== "" && o !== false && o !== true;
331 | }
332 |
333 | function trim(str) {
334 | if (typeof str === 'string') return $.trim(str);
335 | return str;
336 | }
337 |
338 | // parse options
339 | for (ii = opts_len - 1; ii >= 0; ii--) {
340 | p = opts_arr[ii].split(':');
341 |
342 | if (/true/i.test(p[1])) p[1] = true;
343 | if (/false/i.test(p[1])) p[1] = false;
344 | if (isNumber(p[1])) p[1] = parseInt(p[1], 10);
345 |
346 | if (p.length === 2 && p[0].length > 0) {
347 | opts[trim(p[0])] = trim(p[1]);
348 | }
349 | }
350 |
351 | return opts;
352 | },
353 |
354 | delay : function (fun, delay) {
355 | return setTimeout(fun, delay);
356 | },
357 |
358 | // animated scrolling
359 | scrollTo : function (el, to, duration) {
360 | if (duration < 0) return;
361 | var difference = to - $(window).scrollTop();
362 | var perTick = difference / duration * 10;
363 |
364 | this.scrollToTimerCache = setTimeout(function() {
365 | if (!isNaN(parseInt(perTick, 10))) {
366 | window.scrollTo(0, $(window).scrollTop() + perTick);
367 | this.scrollTo(el, to, duration - 10);
368 | }
369 | }.bind(this), 10);
370 | },
371 |
372 | // not supported in core Zepto
373 | scrollLeft : function (el) {
374 | if (!el.length) return;
375 | return ('scrollLeft' in el[0]) ? el[0].scrollLeft : el[0].pageXOffset;
376 | },
377 |
378 | // test for empty object or array
379 | empty : function (obj) {
380 | if (obj.length && obj.length > 0) return false;
381 | if (obj.length && obj.length === 0) return true;
382 |
383 | for (var key in obj) {
384 | if (hasOwnProperty.call(obj, key)) return false;
385 | }
386 |
387 | return true;
388 | }
389 | },
390 |
391 | fix_outer : function (lib) {
392 | lib.outerHeight = function (el, bool) {
393 | if (typeof Zepto === 'function') {
394 | return el.height();
395 | }
396 |
397 | if (typeof bool !== 'undefined') {
398 | return el.outerHeight(bool);
399 | }
400 |
401 | return el.outerHeight();
402 | };
403 |
404 | lib.outerWidth = function (el, bool) {
405 | if (typeof Zepto === 'function') {
406 | return el.width();
407 | }
408 |
409 | if (typeof bool !== 'undefined') {
410 | return el.outerWidth(bool);
411 | }
412 |
413 | return el.outerWidth();
414 | };
415 | },
416 |
417 | error : function (error) {
418 | return error.name + ' ' + error.message + '; ' + error.more;
419 | },
420 |
421 | // remove all foundation events.
422 | off: function () {
423 | $(this.scope).off('.fndtn');
424 | $(window).off('.fndtn');
425 | return true;
426 | },
427 |
428 | zj : $
429 | };
430 |
431 | $.fn.foundation = function () {
432 | var args = Array.prototype.slice.call(arguments, 0);
433 |
434 | return this.each(function () {
435 | Foundation.init.apply(Foundation, [this].concat(args));
436 | return this;
437 | });
438 | };
439 |
440 | }(libFuncName, this, this.document));
441 |
--------------------------------------------------------------------------------
/js/foundation/foundation.orbit.js:
--------------------------------------------------------------------------------
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 | slides_container.children().first().addClass(settings.active_slide_class);
25 |
26 | self.update_slide_number = function(index) {
27 | if (settings.slide_number) {
28 | number_container.find('span:first').text(parseInt(index)+1);
29 | number_container.find('span:last').text(slides_container.children().length);
30 | }
31 | if (settings.bullets) {
32 | bullets_container.children().removeClass(settings.bullets_active_class);
33 | $(bullets_container.children().get(index)).addClass(settings.bullets_active_class);
34 | }
35 | };
36 |
37 | self.build_markup = function() {
38 | slides_container.wrap('
');
39 | container = slides_container.parent();
40 | slides_container.addClass(settings.slides_container_class);
41 |
42 | if (settings.navigation_arrows) {
43 | container.append($('').addClass(settings.prev_class).append(''));
44 | container.append($('').addClass(settings.next_class).append(''));
45 | }
46 |
47 | if (settings.timer) {
48 | timer_container = $('').addClass(settings.timer_container_class);
49 | timer_container.append('
');
50 | timer_container.append($('').addClass(settings.timer_progress_class));
51 | timer_container.addClass(settings.timer_paused_class);
52 | container.append(timer_container);
53 | }
54 |
55 | if (settings.slide_number) {
56 | number_container = $('
').addClass(settings.slide_number_class);
57 | number_container.append('
of
');
58 | container.append(number_container);
59 | }
60 |
61 | if (settings.bullets) {
62 | bullets_container = $('
').addClass(settings.bullets_container_class);
63 | container.append(bullets_container);
64 | slides_container.children().each(function(idx, el) {
65 | var bullet = $('').attr('data-orbit-slide', idx);
66 | bullets_container.append(bullet);
67 | });
68 | }
69 |
70 | if (settings.stack_on_small) {
71 | container.addClass(settings.stack_on_small_class);
72 | }
73 |
74 | self.update_slide_number(0);
75 | };
76 |
77 | self._goto = function(next_idx, start_timer) {
78 | // if (locked) {return false;}
79 | if (next_idx === idx) {return false;}
80 | if (typeof timer === 'object') {timer.restart();}
81 | var slides = slides_container.children();
82 |
83 | var dir = 'next';
84 | locked = true;
85 | if (next_idx < idx) {dir = 'prev';}
86 | if (next_idx >= slides.length) {next_idx = 0;}
87 | else if (next_idx < 0) {next_idx = slides.length - 1;}
88 |
89 | var current = $(slides.get(idx));
90 | var next = $(slides.get(next_idx));
91 |
92 | current.css('zIndex', 2);
93 | next.css('zIndex', 4).addClass('active');
94 |
95 | slides_container.trigger('orbit:before-slide-change');
96 | settings.before_slide_change();
97 |
98 | var callback = function() {
99 | var unlock = function() {
100 | idx = next_idx;
101 | locked = false;
102 | if (start_timer === true) {timer = self.create_timer(); timer.start();}
103 | self.update_slide_number(idx);
104 | slides_container.trigger('orbit:after-slide-change',[{slide_number: idx, total_slides: slides.length}]);
105 | settings.after_slide_change(idx, slides.length);
106 | };
107 | if (slides_container.height() != next.height()) {
108 | slides_container.animate({'height': next.height()}, 250, 'linear', unlock);
109 | } else {
110 | unlock();
111 | }
112 | };
113 |
114 | if (slides.length === 1) {callback(); return false;}
115 |
116 | var start_animation = function() {
117 | if (dir === 'next') {animate.next(current, next, callback);}
118 | if (dir === 'prev') {animate.prev(current, next, callback);}
119 | };
120 |
121 | if (next.height() > slides_container.height()) {
122 | slides_container.animate({'height': next.height()}, 250, 'linear', start_animation);
123 | } else {
124 | start_animation();
125 | }
126 | };
127 |
128 | self.next = function(e) {
129 | e.stopImmediatePropagation();
130 | e.preventDefault();
131 | self._goto(idx + 1);
132 | };
133 |
134 | self.prev = function(e) {
135 | e.stopImmediatePropagation();
136 | e.preventDefault();
137 | self._goto(idx - 1);
138 | };
139 |
140 | self.link_custom = function(e) {
141 | e.preventDefault();
142 | var link = $(this).attr('data-orbit-link');
143 | if ((typeof link === 'string') && (link = $.trim(link)) != "") {
144 | var slide = container.find('[data-orbit-slide='+link+']');
145 | if (slide.index() != -1) {self._goto(slide.index());}
146 | }
147 | };
148 |
149 | self.link_bullet = function(e) {
150 | var index = $(this).attr('data-orbit-slide');
151 | if ((typeof index === 'string') && (index = $.trim(index)) != "") {
152 | self._goto(index);
153 | }
154 | }
155 |
156 | self.timer_callback = function() {
157 | self._goto(idx + 1, true);
158 | }
159 |
160 | self.compute_dimensions = function() {
161 | var current = $(slides_container.children().get(idx));
162 | var h = current.height();
163 | if (!settings.variable_height) {
164 | slides_container.children().each(function(){
165 | if ($(this).height() > h) { h = $(this).height(); }
166 | });
167 | }
168 | slides_container.height(h);
169 | };
170 |
171 | self.create_timer = function() {
172 | var t = new Timer(
173 | container.find('.'+settings.timer_container_class),
174 | settings,
175 | self.timer_callback
176 | );
177 | return t;
178 | };
179 |
180 | self.stop_timer = function() {
181 | if (typeof timer === 'object') timer.stop();
182 | };
183 |
184 | self.toggle_timer = function() {
185 | var t = container.find('.'+settings.timer_container_class);
186 | if (t.hasClass(settings.timer_paused_class)) {
187 | if (typeof timer === 'undefined') {timer = self.create_timer();}
188 | timer.start();
189 | }
190 | else {
191 | if (typeof timer === 'object') {timer.stop();}
192 | }
193 | };
194 |
195 | self.init = function() {
196 | self.build_markup();
197 | if (settings.timer) {timer = self.create_timer(); timer.start();}
198 | animate = new FadeAnimation(slides_container);
199 | if (settings.animation === 'slide')
200 | animate = new SlideAnimation(slides_container);
201 | container.on('click', '.'+settings.next_class, self.next);
202 | container.on('click', '.'+settings.prev_class, self.prev);
203 | container.on('click', '[data-orbit-slide]', self.link_bullet);
204 | container.on('click', self.toggle_timer);
205 | container.on('touchstart.fndtn.orbit', function(e) {
206 | if (!e.touches) {e = e.originalEvent;}
207 | var data = {
208 | start_page_x: e.touches[0].pageX,
209 | start_page_y: e.touches[0].pageY,
210 | start_time: (new Date()).getTime(),
211 | delta_x: 0,
212 | is_scrolling: undefined
213 | };
214 | container.data('swipe-transition', data);
215 | e.stopPropagation();
216 | })
217 | .on('touchmove.fndtn.orbit', function(e) {
218 | if (!e.touches) { e = e.originalEvent; }
219 | // Ignore pinch/zoom events
220 | if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
221 |
222 | var data = container.data('swipe-transition');
223 | if (typeof data === 'undefined') {data = {};}
224 |
225 | data.delta_x = e.touches[0].pageX - data.start_page_x;
226 |
227 | if ( typeof data.is_scrolling === 'undefined') {
228 | data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
229 | }
230 |
231 | if (!data.is_scrolling && !data.active) {
232 | e.preventDefault();
233 | var direction = (data.delta_x < 0) ? (idx+1) : (idx-1);
234 | data.active = true;
235 | self._goto(direction);
236 | }
237 | })
238 | .on('touchend.fndtn.orbit', function(e) {
239 | container.data('swipe-transition', {});
240 | e.stopPropagation();
241 | })
242 | .on('mouseenter.fndtn.orbit', function(e) {
243 | if (settings.timer && settings.pause_on_hover) {
244 | self.stop_timer();
245 | }
246 | })
247 | .on('mouseleave.fndtn.orbit', function(e) {
248 | if (settings.timer && settings.resume_on_mouseout) {
249 | timer.start();
250 | }
251 | });
252 |
253 | $(document).on('click', '[data-orbit-link]', self.link_custom);
254 | $(window).on('resize', self.compute_dimensions);
255 | $(window).on('load', self.compute_dimensions);
256 | slides_container.trigger('orbit:ready');
257 | };
258 |
259 | self.init();
260 | };
261 |
262 | var Timer = function(el, settings, callback) {
263 | var self = this,
264 | duration = settings.timer_speed,
265 | progress = el.find('.'+settings.timer_progress_class),
266 | start,
267 | timeout,
268 | left = -1;
269 |
270 | this.update_progress = function(w) {
271 | var new_progress = progress.clone();
272 | new_progress.attr('style', '');
273 | new_progress.css('width', w+'%');
274 | progress.replaceWith(new_progress);
275 | progress = new_progress;
276 | };
277 |
278 | this.restart = function() {
279 | clearTimeout(timeout);
280 | el.addClass(settings.timer_paused_class);
281 | left = -1;
282 | self.update_progress(0);
283 | };
284 |
285 | this.start = function() {
286 | if (!el.hasClass(settings.timer_paused_class)) {return true;}
287 | left = (left === -1) ? duration : left;
288 | el.removeClass(settings.timer_paused_class);
289 | start = new Date().getTime();
290 | progress.animate({'width': '100%'}, left, 'linear');
291 | timeout = setTimeout(function() {
292 | self.restart();
293 | callback();
294 | }, left);
295 | el.trigger('orbit:timer-started')
296 | };
297 |
298 | this.stop = function() {
299 | if (el.hasClass(settings.timer_paused_class)) {return true;}
300 | clearTimeout(timeout);
301 | el.addClass(settings.timer_paused_class);
302 | var end = new Date().getTime();
303 | left = left - (end - start);
304 | var w = 100 - ((left / duration) * 100);
305 | self.update_progress(w);
306 | el.trigger('orbit:timer-stopped');
307 | };
308 | };
309 |
310 | var SlideAnimation = function(container) {
311 | var duration = 400;
312 | var is_rtl = ($('html[dir=rtl]').length === 1);
313 | var margin = is_rtl ? 'marginRight' : 'marginLeft';
314 |
315 | this.next = function(current, next, callback) {
316 | next.animate({margin: '0%'}, duration, 'linear', function() {
317 | current.css(margin, '100%');
318 | callback();
319 | });
320 | };
321 |
322 | this.prev = function(current, prev, callback) {
323 | prev.css(margin, '-100%');
324 | prev.animate({margin:'0%'}, duration, 'linear', function() {
325 | current.css(margin, '100%');
326 | callback();
327 | });
328 | };
329 | };
330 |
331 | var FadeAnimation = function(container) {
332 | var duration = 250;
333 |
334 | this.next = function(current, next, callback) {
335 | next.css({'marginLeft':'0%', 'opacity':'0.01'});
336 | next.animate({'opacity':'1'}, duration, 'linear', function() {
337 | current.css('marginLeft', '100%');
338 | callback();
339 | });
340 | };
341 |
342 | this.prev = function(current, prev, callback) {
343 | prev.css({'marginLeft':'0%', 'opacity':'0.01'});
344 | prev.animate({'opacity':'1'}, duration, 'linear', function() {
345 | current.css('marginLeft', '100%');
346 | callback();
347 | });
348 | };
349 | };
350 |
351 |
352 | Foundation.libs = Foundation.libs || {};
353 |
354 | Foundation.libs.orbit = {
355 | name: 'orbit',
356 |
357 | version: '4.3.1',
358 |
359 | settings: {
360 | animation: 'slide',
361 | timer_speed: 10000,
362 | pause_on_hover: true,
363 | resume_on_mouseout: false,
364 | animation_speed: 500,
365 | stack_on_small: false,
366 | navigation_arrows: true,
367 | slide_number: true,
368 | container_class: 'orbit-container',
369 | stack_on_small_class: 'orbit-stack-on-small',
370 | next_class: 'orbit-next',
371 | prev_class: 'orbit-prev',
372 | timer_container_class: 'orbit-timer',
373 | timer_paused_class: 'paused',
374 | timer_progress_class: 'orbit-progress',
375 | slides_container_class: 'orbit-slides-container',
376 | bullets_container_class: 'orbit-bullets',
377 | bullets_active_class: 'active',
378 | slide_number_class: 'orbit-slide-number',
379 | caption_class: 'orbit-caption',
380 | active_slide_class: 'active',
381 | orbit_transition_class: 'orbit-transitioning',
382 | bullets: true,
383 | timer: true,
384 | variable_height: false,
385 | before_slide_change: noop,
386 | after_slide_change: noop
387 | },
388 |
389 | init: function (scope, method, options) {
390 | var self = this;
391 | Foundation.inherit(self, 'data_options');
392 |
393 | if (typeof method === 'object') {
394 | $.extend(true, self.settings, method);
395 | }
396 |
397 | if ($(scope).is('[data-orbit]')) {
398 | var $el = $(scope);
399 | var opts = self.data_options($el);
400 | new Orbit($el, $.extend({},self.settings, opts));
401 | }
402 |
403 | $('[data-orbit]', scope).each(function(idx, el) {
404 | var $el = $(el);
405 | var opts = self.data_options($el);
406 | new Orbit($el, $.extend({},self.settings, opts));
407 | });
408 | }
409 | };
410 |
411 |
412 | }(Foundation.zj, this, this.document));
413 |
--------------------------------------------------------------------------------
/js/foundation/foundation.section.js:
--------------------------------------------------------------------------------
1 | /*jslint unparam: true, browser: true, indent: 2 */
2 |
3 | ;
4 | (function($, window, document) {
5 | 'use strict';
6 |
7 | Foundation.libs.section = {
8 | name : 'section',
9 |
10 | version : '4.3.1',
11 |
12 | settings: {
13 | deep_linking: false,
14 | small_breakpoint: 768,
15 | one_up: true,
16 | section_selector: '[data-section]',
17 | region_selector: 'section, .section, [data-section-region]',
18 | title_selector: '.title, [data-section-title]',
19 | //marker: container is resized
20 | resized_data_attr: 'data-section-resized',
21 | //marker: container should apply accordion style
22 | small_style_data_attr: 'data-section-small-style',
23 | content_selector: '.content, [data-section-content]',
24 | nav_selector: '[data-section="vertical-nav"], [data-section="horizontal-nav"]',
25 | active_class: 'active',
26 | callback: function() {}
27 | },
28 |
29 | init: function(scope, method, options) {
30 | var self = this;
31 | Foundation.inherit(this, 'throttle data_options position_right offset_right');
32 |
33 | if (typeof method === 'object') {
34 | $.extend(true, self.settings, method);
35 | }
36 |
37 | if (typeof method !== 'string') {
38 | this.events();
39 | return true;
40 | } else {
41 | return this[method].call(this, options);
42 | }
43 | },
44 |
45 | events: function() {
46 | var self = this;
47 |
48 | //combine titles selector from settings for click event binding
49 | var click_title_selectors = [],
50 | section_selector = self.settings.section_selector,
51 | region_selectors = self.settings.region_selector.split(","),
52 | title_selectors = self.settings.title_selector.split(",");
53 |
54 | for (var i = 0, len = region_selectors.length; i < len; i++) {
55 | var region_selector = region_selectors[i];
56 |
57 | for (var j = 0, len1 = title_selectors.length; j < len1; j++) {
58 | var title_selector = section_selector + ">" + region_selector + ">" + title_selectors[j];
59 |
60 | click_title_selectors.push(title_selector + " a"); //or we can not do preventDefault for click event of
61 | click_title_selectors.push(title_selector);
62 | }
63 | }
64 |
65 | $(self.scope)
66 | .on('click.fndtn.section', click_title_selectors.join(","), function(e) {
67 | var title = $(this).closest(self.settings.title_selector);
68 |
69 | self.close_navs(title);
70 | if (title.siblings(self.settings.content_selector).length > 0) {
71 | self.toggle_active.call(title[0], e);
72 | }
73 | });
74 |
75 | $(window)
76 | .on('resize.fndtn.section', self.throttle(function() { self.resize(); }, 30))
77 | .on('hashchange.fndtn.section', self.set_active_from_hash);
78 |
79 | $(document).on('click.fndtn.section', function (e) {
80 | if (e.isPropagationStopped && e.isPropagationStopped()) return;
81 | if (e.target === document) return;
82 | self.close_navs($(e.target).closest(self.settings.title_selector));
83 | });
84 |
85 | $(window).triggerHandler('resize.fndtn.section');
86 | $(window).triggerHandler('hashchange.fndtn.section');
87 | },
88 |
89 | //close nav !one_up on click elsewhere
90 | close_navs: function(except_nav_with_title) {
91 | var self = Foundation.libs.section,
92 | navsToClose = $(self.settings.nav_selector)
93 | .filter(function() { return !$.extend({},
94 | self.settings, self.data_options($(this))).one_up; });
95 |
96 | if (except_nav_with_title.length > 0) {
97 | var section = except_nav_with_title.parent().parent();
98 |
99 | if (self.is_horizontal_nav(section) || self.is_vertical_nav(section)) {
100 | //exclude current nav from list
101 | navsToClose = navsToClose.filter(function() { return this !== section[0]; });
102 | }
103 | }
104 | //close navs on click on title
105 | navsToClose.children(self.settings.region_selector).removeClass(self.settings.active_class);
106 | },
107 |
108 | toggle_active: function(e) {
109 | var $this = $(this),
110 | self = Foundation.libs.section,
111 | region = $this.parent(),
112 | content = $this.siblings(self.settings.content_selector),
113 | section = region.parent(),
114 | settings = $.extend({}, self.settings, self.data_options(section)),
115 | prev_active_region = section.children(self.settings.region_selector).filter("." + self.settings.active_class);
116 |
117 | //for anchors inside [data-section-title]
118 | if (!settings.deep_linking && content.length > 0) {
119 | e.preventDefault();
120 | }
121 |
122 | e.stopPropagation(); //do not catch same click again on parent
123 |
124 | if (!region.hasClass(self.settings.active_class)) {
125 | prev_active_region.removeClass(self.settings.active_class);
126 | region.addClass(self.settings.active_class);
127 | //force resize for better performance (do not wait timer)
128 | self.resize(region.find(self.settings.section_selector).not("[" + self.settings.resized_data_attr + "]"), true);
129 | } else if (!settings.one_up && (self.small(section) || self.is_vertical_nav(section) || self.is_horizontal_nav(section) || self.is_accordion(section))) {
130 | region.removeClass(self.settings.active_class);
131 | }
132 | settings.callback(section);
133 | },
134 |
135 | check_resize_timer: null,
136 |
137 | //main function that sets title and content positions; runs for :not(.resized) and :visible once when window width is medium up
138 | //sections:
139 | // selected sections to resize, are defined on resize forced by visibility changes
140 | //ensure_has_active_region:
141 | // is true when we force resize for no resized sections that were hidden and became visible,
142 | // these sections can have no selected region, because all regions were hidden along with section on executing set_active_from_hash
143 | resize: function(sections, ensure_has_active_region) {
144 |
145 | var self = Foundation.libs.section,
146 | is_small_window = self.small($(document)),
147 | //filter for section resize
148 | should_be_resized = function (section, now_is_hidden) {
149 | return !self.is_accordion(section) &&
150 | !section.is("[" + self.settings.resized_data_attr + "]") &&
151 | (!is_small_window || self.is_horizontal_tabs(section)) &&
152 | now_is_hidden === (section.css('display') === 'none' ||
153 | !section.parent().is(':visible'));
154 | };
155 |
156 | sections = sections || $(self.settings.section_selector);
157 |
158 | clearTimeout(self.check_resize_timer);
159 |
160 | if (!is_small_window) {
161 | sections.removeAttr(self.settings.small_style_data_attr);
162 | }
163 |
164 | //resize
165 | sections.filter(function() { return should_be_resized($(this), false); })
166 | .each(function() {
167 | var section = $(this),
168 | regions = section.children(self.settings.region_selector),
169 | titles = regions.children(self.settings.title_selector),
170 | content = regions.children(self.settings.content_selector),
171 | titles_max_height = 0;
172 |
173 | if (ensure_has_active_region &&
174 | section.children(self.settings.region_selector).filter("." + self.settings.active_class).length == 0) {
175 | var settings = $.extend({}, self.settings, self.data_options(section));
176 |
177 | if (!settings.deep_linking && (settings.one_up || !self.is_horizontal_nav(section) &&
178 | !self.is_vertical_nav(section) && !self.is_accordion(section))) {
179 | regions.filter(":visible").first().addClass(self.settings.active_class);
180 | }
181 | }
182 |
183 | if (self.is_horizontal_tabs(section) || self.is_auto(section)) {
184 | // region: position relative
185 | // title: position absolute
186 | // content: position static
187 | var titles_sum_width = 0;
188 |
189 | titles.each(function() {
190 | var title = $(this);
191 |
192 | if (title.is(":visible")) {
193 | title.css(!self.rtl ? 'left' : 'right', titles_sum_width);
194 | var title_h_border_width = parseInt(title.css("border-" + (self.rtl ? 'left' : 'right') + "-width"), 10);
195 |
196 | if (title_h_border_width.toString() === 'Nan') {
197 | title_h_border_width = 0;
198 | }
199 |
200 | titles_sum_width += self.outerWidth(title) - title_h_border_width;
201 | titles_max_height = Math.max(titles_max_height, self.outerHeight(title));
202 | }
203 | });
204 | titles.css('height', titles_max_height);
205 | regions.each(function() {
206 | var region = $(this),
207 | region_content = region.children(self.settings.content_selector),
208 | content_top_border_width = parseInt(region_content.css("border-top-width"), 10);
209 |
210 | if (content_top_border_width.toString() === 'Nan') {
211 | content_top_border_width = 0;
212 | }
213 |
214 | region.css('padding-top', titles_max_height - content_top_border_width);
215 | });
216 |
217 | section.css("min-height", titles_max_height);
218 | } else if (self.is_horizontal_nav(section)) {
219 | var first = true;
220 | // region: positon relative, float left
221 | // title: position static
222 | // content: position absolute
223 | titles.each(function() {
224 | titles_max_height = Math.max(titles_max_height, self.outerHeight($(this)));
225 | });
226 |
227 | regions.each(function() {
228 | var region = $(this);
229 |
230 | region.css("margin-left", "-" + (first ? section : region.children(self.settings.title_selector)).css("border-left-width"));
231 | first = false;
232 | });
233 |
234 | regions.css("margin-top", "-" + section.css("border-top-width"));
235 | titles.css('height', titles_max_height);
236 | content.css('top', titles_max_height);
237 | section.css("min-height", titles_max_height);
238 | } else if (self.is_vertical_tabs(section)) {
239 | var titles_sum_height = 0;
240 | // region: position relative, for .active: fixed padding==title.width
241 | // title: fixed width, position absolute
242 | // content: position static
243 | titles.each(function() {
244 | var title = $(this);
245 |
246 | if (title.is(":visible")) {
247 | title.css('top', titles_sum_height);
248 | var title_top_border_width = parseInt(title.css("border-top-width"), 10);
249 |
250 | if (title_top_border_width.toString() === 'Nan') {
251 | title_top_border_width = 0;
252 | }
253 |
254 | titles_sum_height += self.outerHeight(title) - title_top_border_width;
255 | }
256 | });
257 |
258 | content.css('min-height', titles_sum_height + 1);
259 | } else if (self.is_vertical_nav(section)) {
260 | var titles_max_width = 0,
261 | first1 = true;
262 | // region: positon relative
263 | // title: position static
264 | // content: position absolute
265 | titles.each(function() {
266 | titles_max_width = Math.max(titles_max_width, self.outerWidth($(this)));
267 | });
268 |
269 | regions.each(function () {
270 | var region = $(this);
271 |
272 | region.css("margin-top", "-" + (first1 ? section : region.children(self.settings.title_selector)).css("border-top-width"));
273 | first1 = false;
274 | });
275 |
276 | titles.css('width', titles_max_width);
277 | content.css(!self.rtl ? 'left' : 'right', titles_max_width);
278 | section.css('width', titles_max_width);
279 | }
280 |
281 | section.attr(self.settings.resized_data_attr, true);
282 | });
283 |
284 | //wait elements to become visible then resize
285 | if ($(self.settings.section_selector).filter(function() { return should_be_resized($(this), true); }).length > 0)
286 | self.check_resize_timer = setTimeout(function() {
287 | self.resize(sections.filter(function() { return should_be_resized($(this), false); }), true);
288 | }, 700);
289 |
290 | if (is_small_window) {
291 | sections.attr(self.settings.small_style_data_attr, true);
292 | }
293 | },
294 |
295 | is_vertical_nav: function(el) {
296 | return /vertical-nav/i.test(el.data('section'));
297 | },
298 |
299 | is_horizontal_nav: function(el) {
300 | return /horizontal-nav/i.test(el.data('section'));
301 | },
302 |
303 | is_accordion: function(el) {
304 | return /accordion/i.test(el.data('section'));
305 | },
306 |
307 | is_horizontal_tabs: function(el) {
308 | return /^tabs$/i.test(el.data('section'));
309 | },
310 |
311 | is_vertical_tabs: function(el) {
312 | return /vertical-tabs/i.test(el.data('section'));
313 | },
314 |
315 | is_auto: function (el) {
316 | var data_section = el.data('section');
317 | return data_section === '' || /auto/i.test(data_section);
318 | },
319 |
320 | set_active_from_hash: function() {
321 | var self = Foundation.libs.section,
322 | hash = window.location.hash.substring(1),
323 | sections = $(self.settings.section_selector);
324 |
325 | sections.each(function() {
326 | var section = $(this),
327 | settings = $.extend({}, self.settings, self.data_options(section)),
328 | regions = section.children(self.settings.region_selector),
329 | set_active_from_hash = settings.deep_linking && hash.length > 0,
330 | selected = false;
331 |
332 | regions.each(function() {
333 | var region = $(this);
334 |
335 | if (selected) {
336 | region.removeClass(self.settings.active_class);
337 | } else if (set_active_from_hash) {
338 | var data_slug = region.children(self.settings.content_selector).data('slug');
339 |
340 | if (data_slug && new RegExp(data_slug, 'i').test(hash)) {
341 | if (!region.hasClass(self.settings.active_class))
342 | region.addClass(self.settings.active_class);
343 | selected = true;
344 | } else {
345 | region.removeClass(self.settings.active_class);
346 | }
347 | } else if (region.hasClass(self.settings.active_class)) {
348 | selected = true;
349 | }
350 | });
351 |
352 | if (!selected && !settings.deep_linking && (settings.one_up || !self.is_horizontal_nav(section) &&
353 | !self.is_vertical_nav(section) && !self.is_accordion(section)))
354 | regions.filter(":visible").first().addClass(self.settings.active_class);
355 | });
356 | },
357 |
358 | reflow: function() {
359 | var self = Foundation.libs.section;
360 |
361 | $(self.settings.section_selector).removeAttr(self.settings.resized_data_attr);
362 | self.throttle(function() { self.resize(); }, 30)();
363 | },
364 |
365 | small: function(el) {
366 | var settings = $.extend({}, this.settings, this.data_options(el));
367 |
368 | if (this.is_horizontal_tabs(el)) {
369 | return false;
370 | }
371 | if (el && this.is_accordion(el)) {
372 | return true;
373 | }
374 | if ($('html').hasClass('lt-ie9')) {
375 | return true;
376 | }
377 | if ($('html').hasClass('ie8compat')) {
378 | return true;
379 | }
380 | return $(this.scope).width() < settings.small_breakpoint;
381 | },
382 |
383 | off: function() {
384 | $(this.scope).off('.fndtn.section');
385 | $(window).off('.fndtn.section');
386 | $(document).off('.fndtn.section');
387 | }
388 | };
389 |
390 | //resize selected sections
391 | $.fn.reflow_section = function(ensure_has_active_region) {
392 | var section = this,
393 | self = Foundation.libs.section;
394 |
395 | section.removeAttr(self.settings.resized_data_attr);
396 | self.throttle(function() { self.resize(section, ensure_has_active_region); }, 30)();
397 | return this;
398 | };
399 |
400 | }(Foundation.zj, window, document));
401 |
--------------------------------------------------------------------------------