docs-cambiocds-com-jekyll-theme 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +21 -21
  3. data/README.md +48 -48
  4. data/_layouts/default.html +96 -100
  5. data/assets/css/asciidoctor.css +397 -397
  6. data/assets/css/coderay.css +89 -89
  7. data/assets/css/custom.css +32 -0
  8. data/assets/css/font-awesome.css +1801 -1801
  9. data/assets/css/font-awesome.min.css +3 -3
  10. data/assets/css/foundation.css +8545 -8545
  11. data/assets/css/foundation.min.css +8331 -8331
  12. data/assets/css/normalize.css +427 -427
  13. data/assets/js/foundation.min.js +6069 -6069
  14. data/assets/js/foundation/foundation.abide.js +325 -325
  15. data/assets/js/foundation/foundation.accordion.js +71 -71
  16. data/assets/js/foundation/foundation.alert.js +46 -46
  17. data/assets/js/foundation/foundation.clearing.js +573 -573
  18. data/assets/js/foundation/foundation.dropdown.js +444 -444
  19. data/assets/js/foundation/foundation.equalizer.js +77 -77
  20. data/assets/js/foundation/foundation.interchange.js +349 -349
  21. data/assets/js/foundation/foundation.joyride.js +939 -939
  22. data/assets/js/foundation/foundation.js +691 -691
  23. data/assets/js/foundation/foundation.magellan.js +199 -199
  24. data/assets/js/foundation/foundation.offcanvas.js +154 -154
  25. data/assets/js/foundation/foundation.orbit.js +512 -512
  26. data/assets/js/foundation/foundation.reveal.js +455 -455
  27. data/assets/js/foundation/foundation.slider.js +268 -268
  28. data/assets/js/foundation/foundation.tab.js +221 -221
  29. data/assets/js/foundation/foundation.tooltip.js +301 -301
  30. data/assets/js/foundation/foundation.topbar.js +444 -444
  31. data/assets/js/toc.js +82 -82
  32. data/assets/js/vendor/fastclick.js +169 -169
  33. data/assets/js/vendor/jquery.cookie.js +57 -57
  34. data/assets/js/vendor/jquery.js +2339 -2339
  35. data/assets/js/vendor/modernizr.js +304 -304
  36. data/assets/js/vendor/placeholder.js +75 -75
  37. metadata +12 -11
@@ -1,77 +1,77 @@
1
- ;
2
- (function ($, window, document, undefined) {
3
- 'use strict';
4
-
5
- Foundation.libs.equalizer = {
6
- name: 'equalizer',
7
-
8
- version: '5.5.0',
9
-
10
- settings: {
11
- use_tallest: true,
12
- before_height_change: $.noop,
13
- after_height_change: $.noop,
14
- equalize_on_stack: false
15
- },
16
-
17
- init: function (scope, method, options) {
18
- Foundation.inherit(this, 'image_loaded');
19
- this.bindings(method, options);
20
- this.reflow();
21
- },
22
-
23
- events: function () {
24
- this.S(window).off('.equalizer').on('resize.fndtn.equalizer', function (e) {
25
- this.reflow();
26
- }.bind(this));
27
- },
28
-
29
- equalize: function (equalizer) {
30
- var isStacked = false,
31
- vals = equalizer.find('[' + this.attr_name() + '-watch]:visible'),
32
- settings = equalizer.data(this.attr_name(true) + '-init');
33
-
34
- if (vals.length === 0) return;
35
- var firstTopOffset = vals.first().offset().top;
36
- settings.before_height_change();
37
- equalizer.trigger('before-height-change').trigger('before-height-change.fndth.equalizer');
38
- vals.height('inherit');
39
- vals.each(function () {
40
- var el = $(this);
41
- if (el.offset().top !== firstTopOffset) {
42
- isStacked = true;
43
- }
44
- });
45
-
46
- if (settings.equalize_on_stack === false) {
47
- if (isStacked) return;
48
- }
49
- ;
50
-
51
- var heights = vals.map(function () {
52
- return $(this).outerHeight(false)
53
- }).get();
54
-
55
- if (settings.use_tallest) {
56
- var max = Math.max.apply(null, heights);
57
- vals.css('height', max);
58
- } else {
59
- var min = Math.min.apply(null, heights);
60
- vals.css('height', min);
61
- }
62
- settings.after_height_change();
63
- equalizer.trigger('after-height-change').trigger('after-height-change.fndtn.equalizer');
64
- },
65
-
66
- reflow: function () {
67
- var self = this;
68
-
69
- this.S('[' + this.attr_name() + ']', this.scope).each(function () {
70
- var $eq_target = $(this);
71
- self.image_loaded(self.S('img', this), function () {
72
- self.equalize($eq_target)
73
- });
74
- });
75
- }
76
- };
77
- })(jQuery, window, window.document);
1
+ ;
2
+ (function ($, window, document, undefined) {
3
+ 'use strict';
4
+
5
+ Foundation.libs.equalizer = {
6
+ name: 'equalizer',
7
+
8
+ version: '5.5.0',
9
+
10
+ settings: {
11
+ use_tallest: true,
12
+ before_height_change: $.noop,
13
+ after_height_change: $.noop,
14
+ equalize_on_stack: false
15
+ },
16
+
17
+ init: function (scope, method, options) {
18
+ Foundation.inherit(this, 'image_loaded');
19
+ this.bindings(method, options);
20
+ this.reflow();
21
+ },
22
+
23
+ events: function () {
24
+ this.S(window).off('.equalizer').on('resize.fndtn.equalizer', function (e) {
25
+ this.reflow();
26
+ }.bind(this));
27
+ },
28
+
29
+ equalize: function (equalizer) {
30
+ var isStacked = false,
31
+ vals = equalizer.find('[' + this.attr_name() + '-watch]:visible'),
32
+ settings = equalizer.data(this.attr_name(true) + '-init');
33
+
34
+ if (vals.length === 0) return;
35
+ var firstTopOffset = vals.first().offset().top;
36
+ settings.before_height_change();
37
+ equalizer.trigger('before-height-change').trigger('before-height-change.fndth.equalizer');
38
+ vals.height('inherit');
39
+ vals.each(function () {
40
+ var el = $(this);
41
+ if (el.offset().top !== firstTopOffset) {
42
+ isStacked = true;
43
+ }
44
+ });
45
+
46
+ if (settings.equalize_on_stack === false) {
47
+ if (isStacked) return;
48
+ }
49
+ ;
50
+
51
+ var heights = vals.map(function () {
52
+ return $(this).outerHeight(false)
53
+ }).get();
54
+
55
+ if (settings.use_tallest) {
56
+ var max = Math.max.apply(null, heights);
57
+ vals.css('height', max);
58
+ } else {
59
+ var min = Math.min.apply(null, heights);
60
+ vals.css('height', min);
61
+ }
62
+ settings.after_height_change();
63
+ equalizer.trigger('after-height-change').trigger('after-height-change.fndtn.equalizer');
64
+ },
65
+
66
+ reflow: function () {
67
+ var self = this;
68
+
69
+ this.S('[' + this.attr_name() + ']', this.scope).each(function () {
70
+ var $eq_target = $(this);
71
+ self.image_loaded(self.S('img', this), function () {
72
+ self.equalize($eq_target)
73
+ });
74
+ });
75
+ }
76
+ };
77
+ })(jQuery, window, window.document);
@@ -1,349 +1,349 @@
1
- ;
2
- (function ($, window, document, undefined) {
3
- 'use strict';
4
-
5
- Foundation.libs.interchange = {
6
- name: 'interchange',
7
-
8
- version: '5.5.0',
9
-
10
- cache: {},
11
-
12
- images_loaded: false,
13
- nodes_loaded: false,
14
-
15
- settings: {
16
- load_attr: 'interchange',
17
-
18
- named_queries: {
19
- 'default': 'only screen',
20
- 'small': Foundation.media_queries['small'],
21
- 'small-only': Foundation.media_queries['small-only'],
22
- 'medium': Foundation.media_queries['medium'],
23
- 'medium-only': Foundation.media_queries['medium-only'],
24
- 'large': Foundation.media_queries['large'],
25
- 'large-only': Foundation.media_queries['large-only'],
26
- 'xlarge': Foundation.media_queries['xlarge'],
27
- 'xlarge-only': Foundation.media_queries['xlarge-only'],
28
- 'xxlarge': Foundation.media_queries['xxlarge'],
29
- 'landscape': 'only screen and (orientation: landscape)',
30
- 'portrait': 'only screen and (orientation: portrait)',
31
- 'retina': 'only screen and (-webkit-min-device-pixel-ratio: 2),' +
32
- 'only screen and (min--moz-device-pixel-ratio: 2),' +
33
- 'only screen and (-o-min-device-pixel-ratio: 2/1),' +
34
- 'only screen and (min-device-pixel-ratio: 2),' +
35
- 'only screen and (min-resolution: 192dpi),' +
36
- 'only screen and (min-resolution: 2dppx)'
37
- },
38
-
39
- directives: {
40
- replace: function (el, path, trigger) {
41
- // The trigger argument, if called within the directive, fires
42
- // an event named after the directive on the element, passing
43
- // any parameters along to the event that you pass to trigger.
44
- //
45
- // ex. trigger(), trigger([a, b, c]), or trigger(a, b, c)
46
- //
47
- // This allows you to bind a callback like so:
48
- // $('#interchangeContainer').on('replace', function (e, a, b, c) {
49
- // console.log($(this).html(), a, b, c);
50
- // });
51
-
52
- if (/IMG/.test(el[0].nodeName)) {
53
- var orig_path = el[0].src;
54
-
55
- if (new RegExp(path, 'i').test(orig_path)) return;
56
-
57
- el[0].src = path;
58
-
59
- return trigger(el[0].src);
60
- }
61
- var last_path = el.data(this.data_attr + '-last-path'),
62
- self = this;
63
-
64
- if (last_path == path) return;
65
-
66
- if (/\.(gif|jpg|jpeg|tiff|png)([?#].*)?/i.test(path)) {
67
- $(el).css('background-image', 'url(' + path + ')');
68
- el.data('interchange-last-path', path);
69
- return trigger(path);
70
- }
71
-
72
- return $.get(path, function (response) {
73
- el.html(response);
74
- el.data(self.data_attr + '-last-path', path);
75
- trigger();
76
- });
77
-
78
- }
79
- }
80
- },
81
-
82
- init: function (scope, method, options) {
83
- Foundation.inherit(this, 'throttle random_str');
84
-
85
- this.data_attr = this.set_data_attr();
86
- $.extend(true, this.settings, method, options);
87
- this.bindings(method, options);
88
- this.load('images');
89
- this.load('nodes');
90
- },
91
-
92
- get_media_hash: function () {
93
- var mediaHash = '';
94
- for (var queryName in this.settings.named_queries) {
95
- mediaHash += matchMedia(this.settings.named_queries[queryName]).matches.toString();
96
- }
97
- return mediaHash;
98
- },
99
-
100
- events: function () {
101
- var self = this, prevMediaHash;
102
-
103
- $(window)
104
- .off('.interchange')
105
- .on('resize.fndtn.interchange', self.throttle(function () {
106
- var currMediaHash = self.get_media_hash();
107
- if (currMediaHash !== prevMediaHash) {
108
- self.resize();
109
- }
110
- prevMediaHash = currMediaHash;
111
- }, 50));
112
-
113
- return this;
114
- },
115
-
116
- resize: function () {
117
- var cache = this.cache;
118
-
119
- if (!this.images_loaded || !this.nodes_loaded) {
120
- setTimeout($.proxy(this.resize, this), 50);
121
- return;
122
- }
123
-
124
- for (var uuid in cache) {
125
- if (cache.hasOwnProperty(uuid)) {
126
- var passed = this.results(uuid, cache[uuid]);
127
-
128
- if (passed) {
129
- this.settings.directives[passed
130
- .scenario[1]].call(this, passed.el, passed.scenario[0], function () {
131
- if (arguments[0] instanceof Array) {
132
- var args = arguments[0];
133
- } else {
134
- var args = Array.prototype.slice.call(arguments, 0);
135
- }
136
-
137
- passed.el.trigger(passed.scenario[1], args);
138
- });
139
- }
140
- }
141
- }
142
-
143
- },
144
-
145
- results: function (uuid, scenarios) {
146
- var count = scenarios.length;
147
-
148
- if (count > 0) {
149
- var el = this.S('[' + this.add_namespace('data-uuid') + '="' + uuid + '"]');
150
-
151
- while (count--) {
152
- var mq, rule = scenarios[count][2];
153
- if (this.settings.named_queries.hasOwnProperty(rule)) {
154
- mq = matchMedia(this.settings.named_queries[rule]);
155
- } else {
156
- mq = matchMedia(rule);
157
- }
158
- if (mq.matches) {
159
- return {el: el, scenario: scenarios[count]};
160
- }
161
- }
162
- }
163
-
164
- return false;
165
- },
166
-
167
- load: function (type, force_update) {
168
- if (typeof this['cached_' + type] === 'undefined' || force_update) {
169
- this['update_' + type]();
170
- }
171
-
172
- return this['cached_' + type];
173
- },
174
-
175
- update_images: function () {
176
- var images = this.S('img[' + this.data_attr + ']'),
177
- count = images.length,
178
- i = count,
179
- loaded_count = 0,
180
- data_attr = this.data_attr;
181
-
182
- this.cache = {};
183
- this.cached_images = [];
184
- this.images_loaded = (count === 0);
185
-
186
- while (i--) {
187
- loaded_count++;
188
- if (images[i]) {
189
- var str = images[i].getAttribute(data_attr) || '';
190
-
191
- if (str.length > 0) {
192
- this.cached_images.push(images[i]);
193
- }
194
- }
195
-
196
- if (loaded_count === count) {
197
- this.images_loaded = true;
198
- this.enhance('images');
199
- }
200
- }
201
-
202
- return this;
203
- },
204
-
205
- update_nodes: function () {
206
- var nodes = this.S('[' + this.data_attr + ']').not('img'),
207
- count = nodes.length,
208
- i = count,
209
- loaded_count = 0,
210
- data_attr = this.data_attr;
211
-
212
- this.cached_nodes = [];
213
- this.nodes_loaded = (count === 0);
214
-
215
-
216
- while (i--) {
217
- loaded_count++;
218
- var str = nodes[i].getAttribute(data_attr) || '';
219
-
220
- if (str.length > 0) {
221
- this.cached_nodes.push(nodes[i]);
222
- }
223
-
224
- if (loaded_count === count) {
225
- this.nodes_loaded = true;
226
- this.enhance('nodes');
227
- }
228
- }
229
-
230
- return this;
231
- },
232
-
233
- enhance: function (type) {
234
- var i = this['cached_' + type].length;
235
-
236
- while (i--) {
237
- this.object($(this['cached_' + type][i]));
238
- }
239
-
240
- return $(window).trigger('resize').trigger('resize.fndtn.interchange');
241
- },
242
-
243
- convert_directive: function (directive) {
244
-
245
- var trimmed = this.trim(directive);
246
-
247
- if (trimmed.length > 0) {
248
- return trimmed;
249
- }
250
-
251
- return 'replace';
252
- },
253
-
254
- parse_scenario: function (scenario) {
255
- // This logic had to be made more complex since some users were using commas in the url path
256
- // So we cannot simply just split on a comma
257
- var directive_match = scenario[0].match(/(.+),\s*(\w+)\s*$/),
258
- media_query = scenario[1];
259
-
260
- if (directive_match) {
261
- var path = directive_match[1],
262
- directive = directive_match[2];
263
- }
264
- else {
265
- var cached_split = scenario[0].split(/,\s*$/),
266
- path = cached_split[0],
267
- directive = '';
268
- }
269
-
270
- return [this.trim(path), this.convert_directive(directive), this.trim(media_query)];
271
- },
272
-
273
- object: function (el) {
274
- var raw_arr = this.parse_data_attr(el),
275
- scenarios = [],
276
- i = raw_arr.length;
277
-
278
- if (i > 0) {
279
- while (i--) {
280
- var split = raw_arr[i].split(/\((.*?)(\))$/);
281
-
282
- if (split.length > 1) {
283
- var params = this.parse_scenario(split);
284
- scenarios.push(params);
285
- }
286
- }
287
- }
288
-
289
- return this.store(el, scenarios);
290
- },
291
-
292
- store: function (el, scenarios) {
293
- var uuid = this.random_str(),
294
- current_uuid = el.data(this.add_namespace('uuid', true));
295
-
296
- if (this.cache[current_uuid]) return this.cache[current_uuid];
297
-
298
- el.attr(this.add_namespace('data-uuid'), uuid);
299
-
300
- return this.cache[uuid] = scenarios;
301
- },
302
-
303
- trim: function (str) {
304
-
305
- if (typeof str === 'string') {
306
- return $.trim(str);
307
- }
308
-
309
- return str;
310
- },
311
-
312
- set_data_attr: function (init) {
313
- if (init) {
314
- if (this.namespace.length > 0) {
315
- return this.namespace + '-' + this.settings.load_attr;
316
- }
317
-
318
- return this.settings.load_attr;
319
- }
320
-
321
- if (this.namespace.length > 0) {
322
- return 'data-' + this.namespace + '-' + this.settings.load_attr;
323
- }
324
-
325
- return 'data-' + this.settings.load_attr;
326
- },
327
-
328
- parse_data_attr: function (el) {
329
- var raw = el.attr(this.attr_name()).split(/\[(.*?)\]/),
330
- i = raw.length,
331
- output = [];
332
-
333
- while (i--) {
334
- if (raw[i].replace(/[\W\d]+/, '').length > 4) {
335
- output.push(raw[i]);
336
- }
337
- }
338
-
339
- return output;
340
- },
341
-
342
- reflow: function () {
343
- this.load('images', true);
344
- this.load('nodes', true);
345
- }
346
-
347
- };
348
-
349
- }(jQuery, window, window.document));
1
+ ;
2
+ (function ($, window, document, undefined) {
3
+ 'use strict';
4
+
5
+ Foundation.libs.interchange = {
6
+ name: 'interchange',
7
+
8
+ version: '5.5.0',
9
+
10
+ cache: {},
11
+
12
+ images_loaded: false,
13
+ nodes_loaded: false,
14
+
15
+ settings: {
16
+ load_attr: 'interchange',
17
+
18
+ named_queries: {
19
+ 'default': 'only screen',
20
+ 'small': Foundation.media_queries['small'],
21
+ 'small-only': Foundation.media_queries['small-only'],
22
+ 'medium': Foundation.media_queries['medium'],
23
+ 'medium-only': Foundation.media_queries['medium-only'],
24
+ 'large': Foundation.media_queries['large'],
25
+ 'large-only': Foundation.media_queries['large-only'],
26
+ 'xlarge': Foundation.media_queries['xlarge'],
27
+ 'xlarge-only': Foundation.media_queries['xlarge-only'],
28
+ 'xxlarge': Foundation.media_queries['xxlarge'],
29
+ 'landscape': 'only screen and (orientation: landscape)',
30
+ 'portrait': 'only screen and (orientation: portrait)',
31
+ 'retina': 'only screen and (-webkit-min-device-pixel-ratio: 2),' +
32
+ 'only screen and (min--moz-device-pixel-ratio: 2),' +
33
+ 'only screen and (-o-min-device-pixel-ratio: 2/1),' +
34
+ 'only screen and (min-device-pixel-ratio: 2),' +
35
+ 'only screen and (min-resolution: 192dpi),' +
36
+ 'only screen and (min-resolution: 2dppx)'
37
+ },
38
+
39
+ directives: {
40
+ replace: function (el, path, trigger) {
41
+ // The trigger argument, if called within the directive, fires
42
+ // an event named after the directive on the element, passing
43
+ // any parameters along to the event that you pass to trigger.
44
+ //
45
+ // ex. trigger(), trigger([a, b, c]), or trigger(a, b, c)
46
+ //
47
+ // This allows you to bind a callback like so:
48
+ // $('#interchangeContainer').on('replace', function (e, a, b, c) {
49
+ // console.log($(this).html(), a, b, c);
50
+ // });
51
+
52
+ if (/IMG/.test(el[0].nodeName)) {
53
+ var orig_path = el[0].src;
54
+
55
+ if (new RegExp(path, 'i').test(orig_path)) return;
56
+
57
+ el[0].src = path;
58
+
59
+ return trigger(el[0].src);
60
+ }
61
+ var last_path = el.data(this.data_attr + '-last-path'),
62
+ self = this;
63
+
64
+ if (last_path == path) return;
65
+
66
+ if (/\.(gif|jpg|jpeg|tiff|png)([?#].*)?/i.test(path)) {
67
+ $(el).css('background-image', 'url(' + path + ')');
68
+ el.data('interchange-last-path', path);
69
+ return trigger(path);
70
+ }
71
+
72
+ return $.get(path, function (response) {
73
+ el.html(response);
74
+ el.data(self.data_attr + '-last-path', path);
75
+ trigger();
76
+ });
77
+
78
+ }
79
+ }
80
+ },
81
+
82
+ init: function (scope, method, options) {
83
+ Foundation.inherit(this, 'throttle random_str');
84
+
85
+ this.data_attr = this.set_data_attr();
86
+ $.extend(true, this.settings, method, options);
87
+ this.bindings(method, options);
88
+ this.load('images');
89
+ this.load('nodes');
90
+ },
91
+
92
+ get_media_hash: function () {
93
+ var mediaHash = '';
94
+ for (var queryName in this.settings.named_queries) {
95
+ mediaHash += matchMedia(this.settings.named_queries[queryName]).matches.toString();
96
+ }
97
+ return mediaHash;
98
+ },
99
+
100
+ events: function () {
101
+ var self = this, prevMediaHash;
102
+
103
+ $(window)
104
+ .off('.interchange')
105
+ .on('resize.fndtn.interchange', self.throttle(function () {
106
+ var currMediaHash = self.get_media_hash();
107
+ if (currMediaHash !== prevMediaHash) {
108
+ self.resize();
109
+ }
110
+ prevMediaHash = currMediaHash;
111
+ }, 50));
112
+
113
+ return this;
114
+ },
115
+
116
+ resize: function () {
117
+ var cache = this.cache;
118
+
119
+ if (!this.images_loaded || !this.nodes_loaded) {
120
+ setTimeout($.proxy(this.resize, this), 50);
121
+ return;
122
+ }
123
+
124
+ for (var uuid in cache) {
125
+ if (cache.hasOwnProperty(uuid)) {
126
+ var passed = this.results(uuid, cache[uuid]);
127
+
128
+ if (passed) {
129
+ this.settings.directives[passed
130
+ .scenario[1]].call(this, passed.el, passed.scenario[0], function () {
131
+ if (arguments[0] instanceof Array) {
132
+ var args = arguments[0];
133
+ } else {
134
+ var args = Array.prototype.slice.call(arguments, 0);
135
+ }
136
+
137
+ passed.el.trigger(passed.scenario[1], args);
138
+ });
139
+ }
140
+ }
141
+ }
142
+
143
+ },
144
+
145
+ results: function (uuid, scenarios) {
146
+ var count = scenarios.length;
147
+
148
+ if (count > 0) {
149
+ var el = this.S('[' + this.add_namespace('data-uuid') + '="' + uuid + '"]');
150
+
151
+ while (count--) {
152
+ var mq, rule = scenarios[count][2];
153
+ if (this.settings.named_queries.hasOwnProperty(rule)) {
154
+ mq = matchMedia(this.settings.named_queries[rule]);
155
+ } else {
156
+ mq = matchMedia(rule);
157
+ }
158
+ if (mq.matches) {
159
+ return {el: el, scenario: scenarios[count]};
160
+ }
161
+ }
162
+ }
163
+
164
+ return false;
165
+ },
166
+
167
+ load: function (type, force_update) {
168
+ if (typeof this['cached_' + type] === 'undefined' || force_update) {
169
+ this['update_' + type]();
170
+ }
171
+
172
+ return this['cached_' + type];
173
+ },
174
+
175
+ update_images: function () {
176
+ var images = this.S('img[' + this.data_attr + ']'),
177
+ count = images.length,
178
+ i = count,
179
+ loaded_count = 0,
180
+ data_attr = this.data_attr;
181
+
182
+ this.cache = {};
183
+ this.cached_images = [];
184
+ this.images_loaded = (count === 0);
185
+
186
+ while (i--) {
187
+ loaded_count++;
188
+ if (images[i]) {
189
+ var str = images[i].getAttribute(data_attr) || '';
190
+
191
+ if (str.length > 0) {
192
+ this.cached_images.push(images[i]);
193
+ }
194
+ }
195
+
196
+ if (loaded_count === count) {
197
+ this.images_loaded = true;
198
+ this.enhance('images');
199
+ }
200
+ }
201
+
202
+ return this;
203
+ },
204
+
205
+ update_nodes: function () {
206
+ var nodes = this.S('[' + this.data_attr + ']').not('img'),
207
+ count = nodes.length,
208
+ i = count,
209
+ loaded_count = 0,
210
+ data_attr = this.data_attr;
211
+
212
+ this.cached_nodes = [];
213
+ this.nodes_loaded = (count === 0);
214
+
215
+
216
+ while (i--) {
217
+ loaded_count++;
218
+ var str = nodes[i].getAttribute(data_attr) || '';
219
+
220
+ if (str.length > 0) {
221
+ this.cached_nodes.push(nodes[i]);
222
+ }
223
+
224
+ if (loaded_count === count) {
225
+ this.nodes_loaded = true;
226
+ this.enhance('nodes');
227
+ }
228
+ }
229
+
230
+ return this;
231
+ },
232
+
233
+ enhance: function (type) {
234
+ var i = this['cached_' + type].length;
235
+
236
+ while (i--) {
237
+ this.object($(this['cached_' + type][i]));
238
+ }
239
+
240
+ return $(window).trigger('resize').trigger('resize.fndtn.interchange');
241
+ },
242
+
243
+ convert_directive: function (directive) {
244
+
245
+ var trimmed = this.trim(directive);
246
+
247
+ if (trimmed.length > 0) {
248
+ return trimmed;
249
+ }
250
+
251
+ return 'replace';
252
+ },
253
+
254
+ parse_scenario: function (scenario) {
255
+ // This logic had to be made more complex since some users were using commas in the url path
256
+ // So we cannot simply just split on a comma
257
+ var directive_match = scenario[0].match(/(.+),\s*(\w+)\s*$/),
258
+ media_query = scenario[1];
259
+
260
+ if (directive_match) {
261
+ var path = directive_match[1],
262
+ directive = directive_match[2];
263
+ }
264
+ else {
265
+ var cached_split = scenario[0].split(/,\s*$/),
266
+ path = cached_split[0],
267
+ directive = '';
268
+ }
269
+
270
+ return [this.trim(path), this.convert_directive(directive), this.trim(media_query)];
271
+ },
272
+
273
+ object: function (el) {
274
+ var raw_arr = this.parse_data_attr(el),
275
+ scenarios = [],
276
+ i = raw_arr.length;
277
+
278
+ if (i > 0) {
279
+ while (i--) {
280
+ var split = raw_arr[i].split(/\((.*?)(\))$/);
281
+
282
+ if (split.length > 1) {
283
+ var params = this.parse_scenario(split);
284
+ scenarios.push(params);
285
+ }
286
+ }
287
+ }
288
+
289
+ return this.store(el, scenarios);
290
+ },
291
+
292
+ store: function (el, scenarios) {
293
+ var uuid = this.random_str(),
294
+ current_uuid = el.data(this.add_namespace('uuid', true));
295
+
296
+ if (this.cache[current_uuid]) return this.cache[current_uuid];
297
+
298
+ el.attr(this.add_namespace('data-uuid'), uuid);
299
+
300
+ return this.cache[uuid] = scenarios;
301
+ },
302
+
303
+ trim: function (str) {
304
+
305
+ if (typeof str === 'string') {
306
+ return $.trim(str);
307
+ }
308
+
309
+ return str;
310
+ },
311
+
312
+ set_data_attr: function (init) {
313
+ if (init) {
314
+ if (this.namespace.length > 0) {
315
+ return this.namespace + '-' + this.settings.load_attr;
316
+ }
317
+
318
+ return this.settings.load_attr;
319
+ }
320
+
321
+ if (this.namespace.length > 0) {
322
+ return 'data-' + this.namespace + '-' + this.settings.load_attr;
323
+ }
324
+
325
+ return 'data-' + this.settings.load_attr;
326
+ },
327
+
328
+ parse_data_attr: function (el) {
329
+ var raw = el.attr(this.attr_name()).split(/\[(.*?)\]/),
330
+ i = raw.length,
331
+ output = [];
332
+
333
+ while (i--) {
334
+ if (raw[i].replace(/[\W\d]+/, '').length > 4) {
335
+ output.push(raw[i]);
336
+ }
337
+ }
338
+
339
+ return output;
340
+ },
341
+
342
+ reflow: function () {
343
+ this.load('images', true);
344
+ this.load('nodes', true);
345
+ }
346
+
347
+ };
348
+
349
+ }(jQuery, window, window.document));