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,401 @@
|
|
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
|
+
// add dusty browser stuff
|
33
|
+
if (!Array.prototype.filter) {
|
34
|
+
Array.prototype.filter = function(fun /*, thisp */) {
|
35
|
+
"use strict";
|
36
|
+
|
37
|
+
if (this == null) {
|
38
|
+
throw new TypeError();
|
39
|
+
}
|
40
|
+
|
41
|
+
var t = Object(this),
|
42
|
+
len = t.length >>> 0;
|
43
|
+
if (typeof fun != "function") {
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
|
47
|
+
var res = [],
|
48
|
+
thisp = arguments[1];
|
49
|
+
for (var i = 0; i < len; i++) {
|
50
|
+
if (i in t) {
|
51
|
+
var val = t[i]; // in case fun mutates this
|
52
|
+
if (fun && fun.call(thisp, val, i, t)) {
|
53
|
+
res.push(val);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
return res;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
if (!Function.prototype.bind) {
|
63
|
+
Function.prototype.bind = function (oThis) {
|
64
|
+
if (typeof this !== "function") {
|
65
|
+
// closest thing possible to the ECMAScript 5 internal IsCallable function
|
66
|
+
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
|
67
|
+
}
|
68
|
+
|
69
|
+
var aArgs = Array.prototype.slice.call(arguments, 1),
|
70
|
+
fToBind = this,
|
71
|
+
fNOP = function () {},
|
72
|
+
fBound = function () {
|
73
|
+
return fToBind.apply(this instanceof fNOP && oThis
|
74
|
+
? this
|
75
|
+
: oThis,
|
76
|
+
aArgs.concat(Array.prototype.slice.call(arguments)));
|
77
|
+
};
|
78
|
+
|
79
|
+
fNOP.prototype = this.prototype;
|
80
|
+
fBound.prototype = new fNOP();
|
81
|
+
|
82
|
+
return fBound;
|
83
|
+
};
|
84
|
+
}
|
85
|
+
|
86
|
+
if (!Array.prototype.indexOf) {
|
87
|
+
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
|
88
|
+
"use strict";
|
89
|
+
if (this == null) {
|
90
|
+
throw new TypeError();
|
91
|
+
}
|
92
|
+
var t = Object(this);
|
93
|
+
var len = t.length >>> 0;
|
94
|
+
if (len === 0) {
|
95
|
+
return -1;
|
96
|
+
}
|
97
|
+
var n = 0;
|
98
|
+
if (arguments.length > 1) {
|
99
|
+
n = Number(arguments[1]);
|
100
|
+
if (n != n) { // shortcut for verifying if it's NaN
|
101
|
+
n = 0;
|
102
|
+
} else if (n != 0 && n != Infinity && n != -Infinity) {
|
103
|
+
n = (n > 0 || -1) * Math.floor(Math.abs(n));
|
104
|
+
}
|
105
|
+
}
|
106
|
+
if (n >= len) {
|
107
|
+
return -1;
|
108
|
+
}
|
109
|
+
var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
|
110
|
+
for (; k < len; k++) {
|
111
|
+
if (k in t && t[k] === searchElement) {
|
112
|
+
return k;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
return -1;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
// fake stop() for zepto.
|
120
|
+
$.fn.stop = $.fn.stop || function() {
|
121
|
+
return this;
|
122
|
+
};
|
123
|
+
|
124
|
+
window.Foundation = {
|
125
|
+
name : 'Foundation',
|
126
|
+
|
127
|
+
version : '4.1.5',
|
128
|
+
|
129
|
+
// global Foundation cache object
|
130
|
+
cache : {},
|
131
|
+
|
132
|
+
init : function (scope, libraries, method, options, response, /* internal */ nc) {
|
133
|
+
var library_arr,
|
134
|
+
args = [scope, method, options, response],
|
135
|
+
responses = [],
|
136
|
+
nc = nc || false;
|
137
|
+
|
138
|
+
// disable library error catching,
|
139
|
+
// used for development only
|
140
|
+
if (nc) this.nc = nc;
|
141
|
+
|
142
|
+
// check RTL
|
143
|
+
this.rtl = /rtl/i.test($('html').attr('dir'));
|
144
|
+
|
145
|
+
// set foundation global scope
|
146
|
+
this.scope = scope || this.scope;
|
147
|
+
|
148
|
+
if (libraries && typeof libraries === 'string') {
|
149
|
+
if (/off/i.test(libraries)) return this.off();
|
150
|
+
|
151
|
+
library_arr = libraries.split(' ');
|
152
|
+
|
153
|
+
if (library_arr.length > 0) {
|
154
|
+
for (var i = library_arr.length - 1; i >= 0; i--) {
|
155
|
+
responses.push(this.init_lib(library_arr[i], args));
|
156
|
+
}
|
157
|
+
}
|
158
|
+
} else {
|
159
|
+
for (var lib in this.libs) {
|
160
|
+
responses.push(this.init_lib(lib, args));
|
161
|
+
}
|
162
|
+
}
|
163
|
+
|
164
|
+
// if first argument is callback, add to args
|
165
|
+
if (typeof libraries === 'function') {
|
166
|
+
args.unshift(libraries);
|
167
|
+
}
|
168
|
+
|
169
|
+
return this.response_obj(responses, args);
|
170
|
+
},
|
171
|
+
|
172
|
+
response_obj : function (response_arr, args) {
|
173
|
+
for (var i = 0, len = args.length; i < len; i++) {
|
174
|
+
if (typeof args[i] === 'function') {
|
175
|
+
return args[i]({
|
176
|
+
errors: response_arr.filter(function (s) {
|
177
|
+
if (typeof s === 'string') return s;
|
178
|
+
})
|
179
|
+
});
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
return response_arr;
|
184
|
+
},
|
185
|
+
|
186
|
+
init_lib : function (lib, args) {
|
187
|
+
return this.trap(function () {
|
188
|
+
if (this.libs.hasOwnProperty(lib)) {
|
189
|
+
this.patch(this.libs[lib]);
|
190
|
+
return this.libs[lib].init.apply(this.libs[lib], args);
|
191
|
+
}
|
192
|
+
}.bind(this), lib);
|
193
|
+
},
|
194
|
+
|
195
|
+
trap : function (fun, lib) {
|
196
|
+
if (!this.nc) {
|
197
|
+
try {
|
198
|
+
return fun();
|
199
|
+
} catch (e) {
|
200
|
+
return this.error({name: lib, message: 'could not be initialized', more: e.name + ' ' + e.message});
|
201
|
+
}
|
202
|
+
}
|
203
|
+
|
204
|
+
return fun();
|
205
|
+
},
|
206
|
+
|
207
|
+
patch : function (lib) {
|
208
|
+
this.fix_outer(lib);
|
209
|
+
lib.scope = this.scope;
|
210
|
+
lib.rtl = this.rtl;
|
211
|
+
},
|
212
|
+
|
213
|
+
inherit : function (scope, methods) {
|
214
|
+
var methods_arr = methods.split(' ');
|
215
|
+
|
216
|
+
for (var i = methods_arr.length - 1; i >= 0; i--) {
|
217
|
+
if (this.lib_methods.hasOwnProperty(methods_arr[i])) {
|
218
|
+
this.libs[scope.name][methods_arr[i]] = this.lib_methods[methods_arr[i]];
|
219
|
+
}
|
220
|
+
}
|
221
|
+
},
|
222
|
+
|
223
|
+
random_str : function (length) {
|
224
|
+
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz'.split('');
|
225
|
+
|
226
|
+
if (!length) {
|
227
|
+
length = Math.floor(Math.random() * chars.length);
|
228
|
+
}
|
229
|
+
|
230
|
+
var str = '';
|
231
|
+
for (var i = 0; i < length; i++) {
|
232
|
+
str += chars[Math.floor(Math.random() * chars.length)];
|
233
|
+
}
|
234
|
+
return str;
|
235
|
+
},
|
236
|
+
|
237
|
+
libs : {},
|
238
|
+
|
239
|
+
// methods that can be inherited in libraries
|
240
|
+
lib_methods : {
|
241
|
+
set_data : function (node, data) {
|
242
|
+
// this.name references the name of the library calling this method
|
243
|
+
var id = [this.name,+new Date(),Foundation.random_str(5)].join('-');
|
244
|
+
|
245
|
+
Foundation.cache[id] = data;
|
246
|
+
node.attr('data-' + this.name + '-id', id);
|
247
|
+
return data;
|
248
|
+
},
|
249
|
+
|
250
|
+
get_data : function (node) {
|
251
|
+
return Foundation.cache[node.attr('data-' + this.name + '-id')];
|
252
|
+
},
|
253
|
+
|
254
|
+
remove_data : function (node) {
|
255
|
+
if (node) {
|
256
|
+
delete Foundation.cache[node.attr('data-' + this.name + '-id')];
|
257
|
+
node.attr('data-' + this.name + '-id', '');
|
258
|
+
} else {
|
259
|
+
$('[data-' + this.name + '-id]').each(function () {
|
260
|
+
delete Foundation.cache[$(this).attr('data-' + this.name + '-id')];
|
261
|
+
$(this).attr('data-' + this.name + '-id', '');
|
262
|
+
});
|
263
|
+
}
|
264
|
+
},
|
265
|
+
|
266
|
+
throttle : function(fun, delay) {
|
267
|
+
var timer = null;
|
268
|
+
return function () {
|
269
|
+
var context = this, args = arguments;
|
270
|
+
clearTimeout(timer);
|
271
|
+
timer = setTimeout(function () {
|
272
|
+
fun.apply(context, args);
|
273
|
+
}, delay);
|
274
|
+
};
|
275
|
+
},
|
276
|
+
|
277
|
+
// parses data-options attribute on nodes and turns
|
278
|
+
// them into an object
|
279
|
+
data_options : function (el) {
|
280
|
+
var opts = {}, ii, p,
|
281
|
+
opts_arr = (el.attr('data-options') || ':').split(';'),
|
282
|
+
opts_len = opts_arr.length;
|
283
|
+
|
284
|
+
function isNumber (o) {
|
285
|
+
return ! isNaN (o-0) && o !== null && o !== "" && o !== false && o !== true;
|
286
|
+
}
|
287
|
+
|
288
|
+
function trim(str) {
|
289
|
+
if (typeof str === 'string') return $.trim(str);
|
290
|
+
return str;
|
291
|
+
}
|
292
|
+
|
293
|
+
// parse options
|
294
|
+
for (ii = opts_len - 1; ii >= 0; ii--) {
|
295
|
+
p = opts_arr[ii].split(':');
|
296
|
+
|
297
|
+
if (/true/i.test(p[1])) p[1] = true;
|
298
|
+
if (/false/i.test(p[1])) p[1] = false;
|
299
|
+
if (isNumber(p[1])) p[1] = parseInt(p[1], 10);
|
300
|
+
|
301
|
+
if (p.length === 2 && p[0].length > 0) {
|
302
|
+
opts[trim(p[0])] = trim(p[1]);
|
303
|
+
}
|
304
|
+
}
|
305
|
+
|
306
|
+
return opts;
|
307
|
+
},
|
308
|
+
|
309
|
+
delay : function (fun, delay) {
|
310
|
+
return setTimeout(fun, delay);
|
311
|
+
},
|
312
|
+
|
313
|
+
// animated scrolling
|
314
|
+
scrollTo : function (el, to, duration) {
|
315
|
+
if (duration < 0) return;
|
316
|
+
var difference = to - $(window).scrollTop();
|
317
|
+
var perTick = difference / duration * 10;
|
318
|
+
|
319
|
+
this.scrollToTimerCache = setTimeout(function() {
|
320
|
+
if (!isNaN(parseInt(perTick, 10))) {
|
321
|
+
window.scrollTo(0, $(window).scrollTop() + perTick);
|
322
|
+
this.scrollTo(el, to, duration - 10);
|
323
|
+
}
|
324
|
+
}.bind(this), 10);
|
325
|
+
},
|
326
|
+
|
327
|
+
// not supported in core Zepto
|
328
|
+
scrollLeft : function (el) {
|
329
|
+
if (!el.length) return;
|
330
|
+
return ('scrollLeft' in el[0]) ? el[0].scrollLeft : el[0].pageXOffset;
|
331
|
+
},
|
332
|
+
|
333
|
+
// test for empty object or array
|
334
|
+
empty : function (obj) {
|
335
|
+
if (obj.length && obj.length > 0) return false;
|
336
|
+
if (obj.length && obj.length === 0) return true;
|
337
|
+
|
338
|
+
for (var key in obj) {
|
339
|
+
if (hasOwnProperty.call(obj, key)) return false;
|
340
|
+
}
|
341
|
+
|
342
|
+
return true;
|
343
|
+
}
|
344
|
+
},
|
345
|
+
|
346
|
+
fix_outer : function (lib) {
|
347
|
+
lib.outerHeight = function (el, bool) {
|
348
|
+
if (typeof Zepto === 'function') {
|
349
|
+
return el.height();
|
350
|
+
}
|
351
|
+
|
352
|
+
if (typeof bool !== 'undefined') {
|
353
|
+
return el.outerHeight(bool);
|
354
|
+
}
|
355
|
+
|
356
|
+
return el.outerHeight();
|
357
|
+
};
|
358
|
+
|
359
|
+
lib.outerWidth = function (el) {
|
360
|
+
if (typeof Zepto === 'function') {
|
361
|
+
return el.width();
|
362
|
+
}
|
363
|
+
|
364
|
+
if (typeof bool !== 'undefined') {
|
365
|
+
return el.outerWidth(bool);
|
366
|
+
}
|
367
|
+
|
368
|
+
return el.outerWidth();
|
369
|
+
};
|
370
|
+
},
|
371
|
+
|
372
|
+
error : function (error) {
|
373
|
+
return error.name + ' ' + error.message + '; ' + error.more;
|
374
|
+
},
|
375
|
+
|
376
|
+
// remove all foundation events.
|
377
|
+
off: function () {
|
378
|
+
$(this.scope).off('.fndtn');
|
379
|
+
$(window).off('.fndtn');
|
380
|
+
return true;
|
381
|
+
},
|
382
|
+
|
383
|
+
zj : function () {
|
384
|
+
try {
|
385
|
+
return Zepto;
|
386
|
+
} catch (e) {
|
387
|
+
return jQuery;
|
388
|
+
}
|
389
|
+
}()
|
390
|
+
};
|
391
|
+
|
392
|
+
$.fn.foundation = function () {
|
393
|
+
var args = Array.prototype.slice.call(arguments, 0);
|
394
|
+
|
395
|
+
return this.each(function () {
|
396
|
+
Foundation.init.apply(Foundation, [this].concat(args));
|
397
|
+
return this;
|
398
|
+
});
|
399
|
+
};
|
400
|
+
|
401
|
+
}(libFuncName, this, this.document));
|
@@ -0,0 +1,130 @@
|
|
1
|
+
/*jslint unparam: true, browser: true, indent: 2 */
|
2
|
+
|
3
|
+
;(function ($, window, document, undefined) {
|
4
|
+
'use strict';
|
5
|
+
|
6
|
+
Foundation.libs.magellan = {
|
7
|
+
name : 'magellan',
|
8
|
+
|
9
|
+
version : '4.0.0',
|
10
|
+
|
11
|
+
settings : {
|
12
|
+
activeClass: 'active'
|
13
|
+
},
|
14
|
+
|
15
|
+
init : function (scope, method, options) {
|
16
|
+
this.scope = scope || this.scope;
|
17
|
+
Foundation.inherit(this, 'data_options');
|
18
|
+
|
19
|
+
if (typeof method === 'object') {
|
20
|
+
$.extend(true, this.settings, method);
|
21
|
+
}
|
22
|
+
|
23
|
+
if (typeof method != 'string') {
|
24
|
+
if (!this.settings.init) {
|
25
|
+
this.fixed_magellan = $("[data-magellan-expedition]");
|
26
|
+
this.set_threshold();
|
27
|
+
this.last_destination = $('[data-magellan-destination]').last();
|
28
|
+
this.events();
|
29
|
+
}
|
30
|
+
|
31
|
+
return this.settings.init;
|
32
|
+
} else {
|
33
|
+
return this[method].call(this, options);
|
34
|
+
}
|
35
|
+
},
|
36
|
+
|
37
|
+
events : function () {
|
38
|
+
var self = this;
|
39
|
+
$(this.scope).on('arrival.fndtn.magellan', '[data-magellan-arrival]', function (e) {
|
40
|
+
var $destination = $(this),
|
41
|
+
$expedition = $destination.closest('[data-magellan-expedition]'),
|
42
|
+
activeClass = $expedition.attr('data-magellan-active-class')
|
43
|
+
|| self.settings.activeClass;
|
44
|
+
|
45
|
+
$destination
|
46
|
+
.closest('[data-magellan-expedition]')
|
47
|
+
.find('[data-magellan-arrival]')
|
48
|
+
.not($destination)
|
49
|
+
.removeClass(activeClass);
|
50
|
+
$destination.addClass(activeClass);
|
51
|
+
});
|
52
|
+
|
53
|
+
this.fixed_magellan
|
54
|
+
.on('update-position.fndtn.magellan', function(){
|
55
|
+
var $el = $(this);
|
56
|
+
// $el.data("magellan-fixed-position","");
|
57
|
+
//$el.data("magellan-top-offset", "");
|
58
|
+
})
|
59
|
+
.trigger('update-position');
|
60
|
+
|
61
|
+
$(window)
|
62
|
+
.on('resize.fndtn.magellan', function() {
|
63
|
+
this.fixed_magellan.trigger('update-position');
|
64
|
+
}.bind(this))
|
65
|
+
|
66
|
+
.on('scroll.fndtn.magellan', function() {
|
67
|
+
var windowScrollTop = $(window).scrollTop();
|
68
|
+
self.fixed_magellan.each(function() {
|
69
|
+
var $expedition = $(this);
|
70
|
+
if (typeof $expedition.data('magellan-top-offset') === 'undefined') {
|
71
|
+
$expedition.data('magellan-top-offset', $expedition.offset().top);
|
72
|
+
}
|
73
|
+
if (typeof $expedition.data('magellan-fixed-position') === 'undefined') {
|
74
|
+
$expedition.data('magellan-fixed-position', false)
|
75
|
+
}
|
76
|
+
var fixed_position = (windowScrollTop + self.settings.threshold) > $expedition.data("magellan-top-offset");
|
77
|
+
var attr = $expedition.attr('data-magellan-top-offset');
|
78
|
+
|
79
|
+
if ($expedition.data("magellan-fixed-position") != fixed_position) {
|
80
|
+
$expedition.data("magellan-fixed-position", fixed_position);
|
81
|
+
if (fixed_position) {
|
82
|
+
$expedition.css({position:"fixed", top:0});
|
83
|
+
} else {
|
84
|
+
$expedition.css({position:"", top:""});
|
85
|
+
}
|
86
|
+
if (fixed_position && typeof attr != 'undefined' && attr != false) {
|
87
|
+
$expedition.css({position:"fixed", top:attr + "px"});
|
88
|
+
}
|
89
|
+
}
|
90
|
+
});
|
91
|
+
});
|
92
|
+
|
93
|
+
|
94
|
+
if (this.last_destination.length > 0) {
|
95
|
+
$(window).on('scroll.fndtn.magellan', function (e) {
|
96
|
+
var windowScrollTop = $(window).scrollTop(),
|
97
|
+
scrolltopPlusHeight = windowScrollTop + $(window).height(),
|
98
|
+
lastDestinationTop = Math.ceil(self.last_destination.offset().top);
|
99
|
+
|
100
|
+
$('[data-magellan-destination]').each(function () {
|
101
|
+
var $destination = $(this),
|
102
|
+
destination_name = $destination.attr('data-magellan-destination'),
|
103
|
+
topOffset = $destination.offset().top - windowScrollTop;
|
104
|
+
|
105
|
+
if (topOffset <= self.settings.threshold) {
|
106
|
+
$("[data-magellan-arrival='" + destination_name + "']").trigger('arrival');
|
107
|
+
}
|
108
|
+
// In large screens we may hit the bottom of the page and dont reach the top of the last magellan-destination, so lets force it
|
109
|
+
if (scrolltopPlusHeight >= $(self.scope).height() && lastDestinationTop > windowScrollTop && lastDestinationTop < scrolltopPlusHeight) {
|
110
|
+
$('[data-magellan-arrival]').last().trigger('arrival');
|
111
|
+
}
|
112
|
+
});
|
113
|
+
});
|
114
|
+
}
|
115
|
+
|
116
|
+
this.settings.init = true;
|
117
|
+
},
|
118
|
+
|
119
|
+
set_threshold : function () {
|
120
|
+
if (!this.settings.threshold) {
|
121
|
+
this.settings.threshold = (this.fixed_magellan.length > 0) ?
|
122
|
+
this.outerHeight(this.fixed_magellan, true) : 0;
|
123
|
+
}
|
124
|
+
},
|
125
|
+
|
126
|
+
off : function () {
|
127
|
+
$(this.scope).off('.fndtn.magellan');
|
128
|
+
}
|
129
|
+
};
|
130
|
+
}(Foundation.zj, this, this.document));
|