foundation-rails 5.5.1.0 → 5.5.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bower.json +2 -2
- data/lib/foundation/rails/version.rb +1 -1
- data/update-gem.sh +12 -7
- data/vendor/assets/javascripts/foundation.js +2 -2
- data/vendor/assets/javascripts/foundation/foundation.abide.js +62 -40
- data/vendor/assets/javascripts/foundation/foundation.accordion.js +7 -7
- data/vendor/assets/javascripts/foundation/foundation.alert.js +3 -3
- data/vendor/assets/javascripts/foundation/foundation.clearing.js +46 -48
- data/vendor/assets/javascripts/foundation/foundation.dropdown.js +71 -62
- data/vendor/assets/javascripts/foundation/foundation.equalizer.js +18 -14
- data/vendor/assets/javascripts/foundation/foundation.interchange.js +31 -25
- data/vendor/assets/javascripts/foundation/foundation.joyride.js +81 -73
- data/vendor/assets/javascripts/foundation/foundation.js +54 -41
- data/vendor/assets/javascripts/foundation/foundation.magellan.js +44 -39
- data/vendor/assets/javascripts/foundation/foundation.offcanvas.js +19 -19
- data/vendor/assets/javascripts/foundation/foundation.orbit.js +133 -129
- data/vendor/assets/javascripts/foundation/foundation.reveal.js +73 -51
- data/vendor/assets/javascripts/foundation/foundation.slider.js +63 -67
- data/vendor/assets/javascripts/foundation/foundation.tab.js +39 -19
- data/vendor/assets/javascripts/foundation/foundation.tooltip.js +30 -23
- data/vendor/assets/javascripts/foundation/foundation.topbar.js +66 -59
- data/vendor/assets/stylesheets/foundation/_functions.scss +1 -1
- data/vendor/assets/stylesheets/foundation/_settings.scss +99 -77
- data/vendor/assets/stylesheets/foundation/components/_alert-boxes.scss +2 -2
- data/vendor/assets/stylesheets/foundation/components/_block-grid.scss +1 -0
- data/vendor/assets/stylesheets/foundation/components/_breadcrumbs.scss +1 -1
- data/vendor/assets/stylesheets/foundation/components/_button-groups.scss +7 -4
- data/vendor/assets/stylesheets/foundation/components/_buttons.scss +2 -1
- data/vendor/assets/stylesheets/foundation/components/_clearing.scss +11 -2
- data/vendor/assets/stylesheets/foundation/components/_dropdown-buttons.scss +1 -0
- data/vendor/assets/stylesheets/foundation/components/_forms.scss +13 -6
- data/vendor/assets/stylesheets/foundation/components/_global.scss +3 -3
- data/vendor/assets/stylesheets/foundation/components/_icon-bar.scss +32 -2
- data/vendor/assets/stylesheets/foundation/components/_range-slider.scss +6 -4
- data/vendor/assets/stylesheets/foundation/components/_reveal.scss +15 -29
- data/vendor/assets/stylesheets/foundation/components/_split-buttons.scss +12 -0
- data/vendor/assets/stylesheets/foundation/components/_sub-nav.scss +1 -2
- data/vendor/assets/stylesheets/foundation/components/_tabs.scss +3 -1
- data/vendor/assets/stylesheets/foundation/components/_toolbar.scss +3 -1
- data/vendor/assets/stylesheets/foundation/components/_top-bar.scss +10 -3
- data/vendor/assets/stylesheets/foundation/components/_type.scss +1 -62
- data/vendor/assets/stylesheets/foundation/components/_visibility.scss +78 -12
- metadata +2 -3
- data/vendor/assets/_settings.scss +0 -1445
@@ -4,17 +4,17 @@
|
|
4
4
|
Foundation.libs.dropdown = {
|
5
5
|
name : 'dropdown',
|
6
6
|
|
7
|
-
version : '5.5.
|
7
|
+
version : '5.5.1',
|
8
8
|
|
9
9
|
settings : {
|
10
|
-
active_class: 'open',
|
11
|
-
disabled_class: 'disabled',
|
12
|
-
mega_class: 'mega',
|
13
|
-
align: 'bottom',
|
14
|
-
is_hover: false,
|
15
|
-
hover_timeout: 150,
|
16
|
-
opened: function(){},
|
17
|
-
closed: function(){}
|
10
|
+
active_class : 'open',
|
11
|
+
disabled_class : 'disabled',
|
12
|
+
mega_class : 'mega',
|
13
|
+
align : 'bottom',
|
14
|
+
is_hover : false,
|
15
|
+
hover_timeout : 150,
|
16
|
+
opened : function () {},
|
17
|
+
closed : function () {}
|
18
18
|
},
|
19
19
|
|
20
20
|
init : function (scope, method, options) {
|
@@ -57,11 +57,13 @@
|
|
57
57
|
|
58
58
|
var settings = target.data(self.attr_name(true) + '-init') || self.settings;
|
59
59
|
|
60
|
-
if(S(e.currentTarget).data(self.data_attr()) && settings.is_hover) {
|
60
|
+
if (S(e.currentTarget).data(self.data_attr()) && settings.is_hover) {
|
61
61
|
self.closeall.call(self);
|
62
62
|
}
|
63
63
|
|
64
|
-
if (settings.is_hover)
|
64
|
+
if (settings.is_hover) {
|
65
|
+
self.open.apply(self, [dropdown, target]);
|
66
|
+
}
|
65
67
|
})
|
66
68
|
.on('mouseleave.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) {
|
67
69
|
var $this = S(this);
|
@@ -69,17 +71,20 @@
|
|
69
71
|
|
70
72
|
if ($this.data(self.data_attr())) {
|
71
73
|
settings = $this.data(self.data_attr(true) + '-init') || self.settings;
|
72
|
-
}
|
73
|
-
else {
|
74
|
+
} else {
|
74
75
|
var target = S('[' + self.attr_name() + '="' + S(this).attr('id') + '"]'),
|
75
76
|
settings = target.data(self.attr_name(true) + '-init') || self.settings;
|
76
77
|
}
|
77
78
|
|
78
79
|
self.timeout = setTimeout(function () {
|
79
80
|
if ($this.data(self.data_attr())) {
|
80
|
-
if (settings.is_hover)
|
81
|
+
if (settings.is_hover) {
|
82
|
+
self.close.call(self, S('#' + $this.data(self.data_attr())));
|
83
|
+
}
|
81
84
|
} else {
|
82
|
-
if (settings.is_hover)
|
85
|
+
if (settings.is_hover) {
|
86
|
+
self.close.call(self, $this);
|
87
|
+
}
|
83
88
|
}
|
84
89
|
}.bind(this), settings.hover_timeout);
|
85
90
|
})
|
@@ -87,10 +92,14 @@
|
|
87
92
|
var parent = S(e.target).closest('[' + self.attr_name() + '-content]');
|
88
93
|
var links = parent.find('a');
|
89
94
|
|
90
|
-
if (links.length > 0 && parent.attr('aria-autoclose') !==
|
95
|
+
if (links.length > 0 && parent.attr('aria-autoclose') !== 'false') {
|
91
96
|
self.close.call(self, S('[' + self.attr_name() + '-content]'));
|
92
97
|
}
|
93
98
|
|
99
|
+
if (e.target !== document && !$.contains(document.documentElement, e.target)) {
|
100
|
+
return;
|
101
|
+
}
|
102
|
+
|
94
103
|
if (S(e.target).closest('[' + self.attr_name() + ']').length > 0) {
|
95
104
|
return;
|
96
105
|
}
|
@@ -120,14 +129,14 @@
|
|
120
129
|
this.resize();
|
121
130
|
},
|
122
131
|
|
123
|
-
close: function (dropdown) {
|
132
|
+
close : function (dropdown) {
|
124
133
|
var self = this;
|
125
134
|
dropdown.each(function () {
|
126
|
-
var original_target = $('[' + self.attr_name() + '=' + dropdown[0].id + ']') || $('aria-controls=' + dropdown[0].id+ ']');
|
135
|
+
var original_target = $('[' + self.attr_name() + '=' + dropdown[0].id + ']') || $('aria-controls=' + dropdown[0].id + ']');
|
127
136
|
original_target.attr('aria-expanded', 'false');
|
128
137
|
if (self.S(this).hasClass(self.settings.active_class)) {
|
129
138
|
self.S(this)
|
130
|
-
.css(Foundation.rtl ? 'right':'left', '-99999px')
|
139
|
+
.css(Foundation.rtl ? 'right' : 'left', '-99999px')
|
131
140
|
.attr('aria-hidden', 'true')
|
132
141
|
.removeClass(self.settings.active_class)
|
133
142
|
.prev('[' + self.attr_name() + ']')
|
@@ -140,14 +149,14 @@
|
|
140
149
|
dropdown.removeClass('f-open-' + this.attr_name(true));
|
141
150
|
},
|
142
151
|
|
143
|
-
closeall: function() {
|
152
|
+
closeall : function () {
|
144
153
|
var self = this;
|
145
|
-
$.each(self.S('.f-open-' + this.attr_name(true)), function() {
|
154
|
+
$.each(self.S('.f-open-' + this.attr_name(true)), function () {
|
146
155
|
self.close.call(self, self.S(this));
|
147
156
|
});
|
148
157
|
},
|
149
158
|
|
150
|
-
open: function (dropdown, target) {
|
159
|
+
open : function (dropdown, target) {
|
151
160
|
this
|
152
161
|
.css(dropdown
|
153
162
|
.addClass(this.settings.active_class), target);
|
@@ -159,7 +168,7 @@
|
|
159
168
|
dropdown.addClass('f-open-' + this.attr_name(true));
|
160
169
|
},
|
161
170
|
|
162
|
-
data_attr: function () {
|
171
|
+
data_attr : function () {
|
163
172
|
if (this.namespace.length > 0) {
|
164
173
|
return this.namespace + '-' + this.name;
|
165
174
|
}
|
@@ -181,16 +190,17 @@
|
|
181
190
|
|
182
191
|
if (dropdown.hasClass(this.settings.active_class)) {
|
183
192
|
this.close.call(this, dropdown);
|
184
|
-
if (dropdown.data('target') !== target.get(0))
|
193
|
+
if (dropdown.data('target') !== target.get(0)) {
|
185
194
|
this.open.call(this, dropdown, target);
|
195
|
+
}
|
186
196
|
} else {
|
187
197
|
this.open.call(this, dropdown, target);
|
188
198
|
}
|
189
199
|
},
|
190
200
|
|
191
201
|
resize : function () {
|
192
|
-
var dropdown = this.S('[' + this.attr_name() + '-content].open')
|
193
|
-
|
202
|
+
var dropdown = this.S('[' + this.attr_name() + '-content].open');
|
203
|
+
var target = $(dropdown.data("target"));
|
194
204
|
|
195
205
|
if (dropdown.length && target.length) {
|
196
206
|
this.css(dropdown, target);
|
@@ -208,12 +218,12 @@
|
|
208
218
|
|
209
219
|
dropdown.attr('style', '').removeClass('drop-left drop-right drop-top').css({
|
210
220
|
position : 'absolute',
|
211
|
-
width: '95%',
|
212
|
-
'max-width': 'none',
|
213
|
-
top: p.top
|
221
|
+
width : '95%',
|
222
|
+
'max-width' : 'none',
|
223
|
+
top : p.top
|
214
224
|
});
|
215
225
|
|
216
|
-
dropdown.css(Foundation.rtl ? 'right':'left', left_offset);
|
226
|
+
dropdown.css(Foundation.rtl ? 'right' : 'left', left_offset);
|
217
227
|
} else {
|
218
228
|
|
219
229
|
this.style(dropdown, target, settings);
|
@@ -223,7 +233,7 @@
|
|
223
233
|
},
|
224
234
|
|
225
235
|
style : function (dropdown, target, settings) {
|
226
|
-
var css = $.extend({position: 'absolute'},
|
236
|
+
var css = $.extend({position : 'absolute'},
|
227
237
|
this.dirs[settings.align].call(dropdown, target, settings));
|
228
238
|
|
229
239
|
dropdown.attr('style', '').css(css);
|
@@ -240,13 +250,13 @@
|
|
240
250
|
|
241
251
|
p.top -= o.top;
|
242
252
|
p.left -= o.left;
|
243
|
-
|
253
|
+
|
244
254
|
//set some flags on the p object to pass along
|
245
255
|
p.missRight = false;
|
246
256
|
p.missTop = false;
|
247
257
|
p.missLeft = false;
|
248
258
|
p.leftRightFlag = false;
|
249
|
-
|
259
|
+
|
250
260
|
//lets see if the panel will be off the screen
|
251
261
|
//get the actual width of the page and store it
|
252
262
|
var actualBodyWidth;
|
@@ -258,7 +268,7 @@
|
|
258
268
|
|
259
269
|
var actualMarginWidth = (window.outerWidth - actualBodyWidth) / 2;
|
260
270
|
var actualBoundary = actualBodyWidth;
|
261
|
-
|
271
|
+
|
262
272
|
if (!this.hasClass('mega')) {
|
263
273
|
//miss top
|
264
274
|
if (t.offset().top <= this.outerHeight()) {
|
@@ -266,13 +276,13 @@
|
|
266
276
|
actualBoundary = window.outerWidth - actualMarginWidth;
|
267
277
|
p.leftRightFlag = true;
|
268
278
|
}
|
269
|
-
|
279
|
+
|
270
280
|
//miss right
|
271
281
|
if (t.offset().left + this.outerWidth() > t.offset().left + actualMarginWidth && t.offset().left - actualMarginWidth > this.outerWidth()) {
|
272
282
|
p.missRight = true;
|
273
283
|
p.missLeft = false;
|
274
284
|
}
|
275
|
-
|
285
|
+
|
276
286
|
//miss left
|
277
287
|
if (t.offset().left - this.outerWidth() <= 0) {
|
278
288
|
p.missLeft = true;
|
@@ -283,34 +293,34 @@
|
|
283
293
|
return p;
|
284
294
|
},
|
285
295
|
|
286
|
-
top: function (t, s) {
|
296
|
+
top : function (t, s) {
|
287
297
|
var self = Foundation.libs.dropdown,
|
288
298
|
p = self.dirs._base.call(this, t);
|
289
299
|
|
290
300
|
this.addClass('drop-top');
|
291
|
-
|
301
|
+
|
292
302
|
if (p.missTop == true) {
|
293
303
|
p.top = p.top + t.outerHeight() + this.outerHeight();
|
294
304
|
this.removeClass('drop-top');
|
295
305
|
}
|
296
|
-
|
306
|
+
|
297
307
|
if (p.missRight == true) {
|
298
308
|
p.left = p.left - this.outerWidth() + t.outerWidth();
|
299
309
|
}
|
300
310
|
|
301
311
|
if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
|
302
|
-
self.adjust_pip(this,t,s,p);
|
312
|
+
self.adjust_pip(this, t, s, p);
|
303
313
|
}
|
304
314
|
|
305
315
|
if (Foundation.rtl) {
|
306
|
-
return {left: p.left - this.outerWidth() + t.outerWidth(),
|
307
|
-
top: p.top - this.outerHeight()};
|
316
|
+
return {left : p.left - this.outerWidth() + t.outerWidth(),
|
317
|
+
top : p.top - this.outerHeight()};
|
308
318
|
}
|
309
319
|
|
310
|
-
return {left: p.left, top: p.top - this.outerHeight()};
|
320
|
+
return {left : p.left, top : p.top - this.outerHeight()};
|
311
321
|
},
|
312
322
|
|
313
|
-
bottom: function (t,s) {
|
323
|
+
bottom : function (t, s) {
|
314
324
|
var self = Foundation.libs.dropdown,
|
315
325
|
p = self.dirs._base.call(this, t);
|
316
326
|
|
@@ -319,35 +329,35 @@
|
|
319
329
|
}
|
320
330
|
|
321
331
|
if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
|
322
|
-
self.adjust_pip(this,t,s,p);
|
332
|
+
self.adjust_pip(this, t, s, p);
|
323
333
|
}
|
324
334
|
|
325
335
|
if (self.rtl) {
|
326
|
-
return {left: p.left - this.outerWidth() + t.outerWidth(), top: p.top + t.outerHeight()};
|
336
|
+
return {left : p.left - this.outerWidth() + t.outerWidth(), top : p.top + t.outerHeight()};
|
327
337
|
}
|
328
338
|
|
329
|
-
return {left: p.left, top: p.top + t.outerHeight()};
|
339
|
+
return {left : p.left, top : p.top + t.outerHeight()};
|
330
340
|
},
|
331
341
|
|
332
|
-
left: function (t, s) {
|
342
|
+
left : function (t, s) {
|
333
343
|
var p = Foundation.libs.dropdown.dirs._base.call(this, t);
|
334
344
|
|
335
345
|
this.addClass('drop-left');
|
336
|
-
|
346
|
+
|
337
347
|
if (p.missLeft == true) {
|
338
348
|
p.left = p.left + this.outerWidth();
|
339
349
|
p.top = p.top + t.outerHeight();
|
340
350
|
this.removeClass('drop-left');
|
341
351
|
}
|
342
352
|
|
343
|
-
return {left: p.left - this.outerWidth(), top: p.top};
|
353
|
+
return {left : p.left - this.outerWidth(), top : p.top};
|
344
354
|
},
|
345
355
|
|
346
|
-
right: function (t, s) {
|
356
|
+
right : function (t, s) {
|
347
357
|
var p = Foundation.libs.dropdown.dirs._base.call(this, t);
|
348
358
|
|
349
359
|
this.addClass('drop-right');
|
350
|
-
|
360
|
+
|
351
361
|
if (p.missRight == true) {
|
352
362
|
p.left = p.left - this.outerWidth();
|
353
363
|
p.top = p.top + t.outerHeight();
|
@@ -355,26 +365,25 @@
|
|
355
365
|
} else {
|
356
366
|
p.triggeredRight = true;
|
357
367
|
}
|
358
|
-
|
368
|
+
|
359
369
|
var self = Foundation.libs.dropdown;
|
360
370
|
|
361
371
|
if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
|
362
|
-
self.adjust_pip(this,t,s,p);
|
372
|
+
self.adjust_pip(this, t, s, p);
|
363
373
|
}
|
364
374
|
|
365
|
-
return {left: p.left + t.outerWidth(), top: p.top};
|
375
|
+
return {left : p.left + t.outerWidth(), top : p.top};
|
366
376
|
}
|
367
377
|
},
|
368
378
|
|
369
379
|
// Insert rule to style psuedo elements
|
370
|
-
adjust_pip : function (dropdown,target,settings,position) {
|
380
|
+
adjust_pip : function (dropdown, target, settings, position) {
|
371
381
|
var sheet = Foundation.stylesheet,
|
372
382
|
pip_offset_base = 8;
|
373
383
|
|
374
384
|
if (dropdown.hasClass(settings.mega_class)) {
|
375
|
-
pip_offset_base = position.left + (target.outerWidth()/2) - 8;
|
376
|
-
}
|
377
|
-
else if (this.small()) {
|
385
|
+
pip_offset_base = position.left + (target.outerWidth() / 2) - 8;
|
386
|
+
} else if (this.small()) {
|
378
387
|
pip_offset_base += position.left - 8;
|
379
388
|
}
|
380
389
|
|
@@ -385,7 +394,7 @@
|
|
385
394
|
sel_after = '.f-dropdown.open:after',
|
386
395
|
css_before = 'left: ' + pip_offset_base + 'px;',
|
387
396
|
css_after = 'left: ' + (pip_offset_base - 1) + 'px;';
|
388
|
-
|
397
|
+
|
389
398
|
if (position.missRight == true) {
|
390
399
|
pip_offset_base = dropdown.outerWidth() - 23;
|
391
400
|
sel_before = '.f-dropdown.open:before',
|
@@ -393,7 +402,7 @@
|
|
393
402
|
css_before = 'left: ' + pip_offset_base + 'px;',
|
394
403
|
css_after = 'left: ' + (pip_offset_base - 1) + 'px;';
|
395
404
|
}
|
396
|
-
|
405
|
+
|
397
406
|
//just a case where right is fired, but its not missing right
|
398
407
|
if (position.triggeredRight == true) {
|
399
408
|
sel_before = '.f-dropdown.open:before',
|
@@ -427,7 +436,7 @@
|
|
427
436
|
!matchMedia(Foundation.media_queries.medium).matches;
|
428
437
|
},
|
429
438
|
|
430
|
-
off: function () {
|
439
|
+
off : function () {
|
431
440
|
this.S(this.scope).off('.fndtn.dropdown');
|
432
441
|
this.S('html, body').off('.fndtn.dropdown');
|
433
442
|
this.S(window).off('.fndtn.dropdown');
|
@@ -4,13 +4,13 @@
|
|
4
4
|
Foundation.libs.equalizer = {
|
5
5
|
name : 'equalizer',
|
6
6
|
|
7
|
-
version : '5.5.
|
7
|
+
version : '5.5.1',
|
8
8
|
|
9
9
|
settings : {
|
10
|
-
use_tallest: true,
|
11
|
-
before_height_change: $.noop,
|
12
|
-
after_height_change: $.noop,
|
13
|
-
equalize_on_stack: false
|
10
|
+
use_tallest : true,
|
11
|
+
before_height_change : $.noop,
|
12
|
+
after_height_change : $.noop,
|
13
|
+
equalize_on_stack : false
|
14
14
|
},
|
15
15
|
|
16
16
|
init : function (scope, method, options) {
|
@@ -20,22 +20,24 @@
|
|
20
20
|
},
|
21
21
|
|
22
22
|
events : function () {
|
23
|
-
this.S(window).off('.equalizer').on('resize.fndtn.equalizer', function(e){
|
23
|
+
this.S(window).off('.equalizer').on('resize.fndtn.equalizer', function (e) {
|
24
24
|
this.reflow();
|
25
25
|
}.bind(this));
|
26
26
|
},
|
27
27
|
|
28
|
-
equalize: function(equalizer) {
|
28
|
+
equalize : function (equalizer) {
|
29
29
|
var isStacked = false,
|
30
30
|
vals = equalizer.find('[' + this.attr_name() + '-watch]:visible'),
|
31
|
-
settings = equalizer.data(this.attr_name(true)+'-init');
|
31
|
+
settings = equalizer.data(this.attr_name(true) + '-init');
|
32
32
|
|
33
|
-
if (vals.length === 0)
|
33
|
+
if (vals.length === 0) {
|
34
|
+
return;
|
35
|
+
}
|
34
36
|
var firstTopOffset = vals.first().offset().top;
|
35
37
|
settings.before_height_change();
|
36
38
|
equalizer.trigger('before-height-change').trigger('before-height-change.fndth.equalizer');
|
37
39
|
vals.height('inherit');
|
38
|
-
vals.each(function(){
|
40
|
+
vals.each(function () {
|
39
41
|
var el = $(this);
|
40
42
|
if (el.offset().top !== firstTopOffset) {
|
41
43
|
isStacked = true;
|
@@ -43,10 +45,12 @@
|
|
43
45
|
});
|
44
46
|
|
45
47
|
if (settings.equalize_on_stack === false) {
|
46
|
-
if (isStacked)
|
48
|
+
if (isStacked) {
|
49
|
+
return;
|
50
|
+
}
|
47
51
|
};
|
48
52
|
|
49
|
-
var heights = vals.map(function(){ return $(this).outerHeight(false) }).get();
|
53
|
+
var heights = vals.map(function () { return $(this).outerHeight(false) }).get();
|
50
54
|
|
51
55
|
if (settings.use_tallest) {
|
52
56
|
var max = Math.max.apply(null, heights);
|
@@ -62,9 +66,9 @@
|
|
62
66
|
reflow : function () {
|
63
67
|
var self = this;
|
64
68
|
|
65
|
-
this.S('[' + this.attr_name() + ']', this.scope).each(function(){
|
69
|
+
this.S('[' + this.attr_name() + ']', this.scope).each(function () {
|
66
70
|
var $eq_target = $(this);
|
67
|
-
self.image_loaded(self.S('img', this), function(){
|
71
|
+
self.image_loaded(self.S('img', this), function () {
|
68
72
|
self.equalize($eq_target)
|
69
73
|
});
|
70
74
|
});
|
@@ -4,7 +4,7 @@
|
|
4
4
|
Foundation.libs.interchange = {
|
5
5
|
name : 'interchange',
|
6
6
|
|
7
|
-
version : '5.5.
|
7
|
+
version : '5.5.1',
|
8
8
|
|
9
9
|
cache : {},
|
10
10
|
|
@@ -36,7 +36,7 @@
|
|
36
36
|
},
|
37
37
|
|
38
38
|
directives : {
|
39
|
-
replace: function (el, path, trigger) {
|
39
|
+
replace : function (el, path, trigger) {
|
40
40
|
// The trigger argument, if called within the directive, fires
|
41
41
|
// an event named after the directive on the element, passing
|
42
42
|
// any parameters along to the event that you pass to trigger.
|
@@ -51,7 +51,9 @@
|
|
51
51
|
if (/IMG/.test(el[0].nodeName)) {
|
52
52
|
var orig_path = el[0].src;
|
53
53
|
|
54
|
-
if (new RegExp(path, 'i').test(orig_path))
|
54
|
+
if (new RegExp(path, 'i').test(orig_path)) {
|
55
|
+
return;
|
56
|
+
}
|
55
57
|
|
56
58
|
el[0].src = path;
|
57
59
|
|
@@ -60,10 +62,12 @@
|
|
60
62
|
var last_path = el.data(this.data_attr + '-last-path'),
|
61
63
|
self = this;
|
62
64
|
|
63
|
-
if (last_path == path)
|
65
|
+
if (last_path == path) {
|
66
|
+
return;
|
67
|
+
}
|
64
68
|
|
65
69
|
if (/\.(gif|jpg|jpeg|tiff|png)([?#].*)?/i.test(path)) {
|
66
|
-
$(el).css('background-image', 'url('+path+')');
|
70
|
+
$(el).css('background-image', 'url(' + path + ')');
|
67
71
|
el.data('interchange-last-path', path);
|
68
72
|
return trigger(path);
|
69
73
|
}
|
@@ -88,8 +92,8 @@
|
|
88
92
|
this.load('nodes');
|
89
93
|
},
|
90
94
|
|
91
|
-
get_media_hash : function() {
|
92
|
-
var mediaHash='';
|
95
|
+
get_media_hash : function () {
|
96
|
+
var mediaHash = '';
|
93
97
|
for (var queryName in this.settings.named_queries ) {
|
94
98
|
mediaHash += matchMedia(this.settings.named_queries[queryName]).matches.toString();
|
95
99
|
}
|
@@ -115,7 +119,7 @@
|
|
115
119
|
resize : function () {
|
116
120
|
var cache = this.cache;
|
117
121
|
|
118
|
-
if(!this.images_loaded || !this.nodes_loaded) {
|
122
|
+
if (!this.images_loaded || !this.nodes_loaded) {
|
119
123
|
setTimeout($.proxy(this.resize, this), 50);
|
120
124
|
return;
|
121
125
|
}
|
@@ -126,15 +130,17 @@
|
|
126
130
|
|
127
131
|
if (passed) {
|
128
132
|
this.settings.directives[passed
|
129
|
-
.scenario[1]].call(this, passed.el, passed.scenario[0], function () {
|
133
|
+
.scenario[1]].call(this, passed.el, passed.scenario[0], (function (passed) {
|
130
134
|
if (arguments[0] instanceof Array) {
|
131
135
|
var args = arguments[0];
|
132
|
-
} else {
|
136
|
+
} else {
|
133
137
|
var args = Array.prototype.slice.call(arguments, 0);
|
134
138
|
}
|
135
139
|
|
136
|
-
|
137
|
-
|
140
|
+
return function() {
|
141
|
+
passed.el.trigger(passed.scenario[1], args);
|
142
|
+
}
|
143
|
+
}(passed)));
|
138
144
|
}
|
139
145
|
}
|
140
146
|
}
|
@@ -155,7 +161,7 @@
|
|
155
161
|
mq = matchMedia(rule);
|
156
162
|
}
|
157
163
|
if (mq.matches) {
|
158
|
-
return {el: el, scenario: scenarios[count]};
|
164
|
+
return {el : el, scenario : scenarios[count]};
|
159
165
|
}
|
160
166
|
}
|
161
167
|
}
|
@@ -211,7 +217,6 @@
|
|
211
217
|
this.cached_nodes = [];
|
212
218
|
this.nodes_loaded = (count === 0);
|
213
219
|
|
214
|
-
|
215
220
|
while (i--) {
|
216
221
|
loaded_count++;
|
217
222
|
var str = nodes[i].getAttribute(data_attr) || '';
|
@@ -220,7 +225,7 @@
|
|
220
225
|
this.cached_nodes.push(nodes[i]);
|
221
226
|
}
|
222
227
|
|
223
|
-
if(loaded_count === count) {
|
228
|
+
if (loaded_count === count) {
|
224
229
|
this.nodes_loaded = true;
|
225
230
|
this.enhance('nodes');
|
226
231
|
}
|
@@ -259,24 +264,23 @@
|
|
259
264
|
if (directive_match) {
|
260
265
|
var path = directive_match[1],
|
261
266
|
directive = directive_match[2];
|
262
|
-
}
|
263
|
-
else {
|
267
|
+
} else {
|
264
268
|
var cached_split = scenario[0].split(/,\s*$/),
|
265
269
|
path = cached_split[0],
|
266
|
-
directive = '';
|
270
|
+
directive = '';
|
267
271
|
}
|
268
272
|
|
269
273
|
return [this.trim(path), this.convert_directive(directive), this.trim(media_query)];
|
270
274
|
},
|
271
275
|
|
272
|
-
object : function(el) {
|
276
|
+
object : function (el) {
|
273
277
|
var raw_arr = this.parse_data_attr(el),
|
274
|
-
scenarios = [],
|
278
|
+
scenarios = [],
|
275
279
|
i = raw_arr.length;
|
276
280
|
|
277
281
|
if (i > 0) {
|
278
282
|
while (i--) {
|
279
|
-
var split = raw_arr[i].split(/\((
|
283
|
+
var split = raw_arr[i].split(/\(([^\)]*?)(\))$/);
|
280
284
|
|
281
285
|
if (split.length > 1) {
|
282
286
|
var params = this.parse_scenario(split);
|
@@ -292,14 +296,16 @@
|
|
292
296
|
var uuid = this.random_str(),
|
293
297
|
current_uuid = el.data(this.add_namespace('uuid', true));
|
294
298
|
|
295
|
-
if (this.cache[current_uuid])
|
299
|
+
if (this.cache[current_uuid]) {
|
300
|
+
return this.cache[current_uuid];
|
301
|
+
}
|
296
302
|
|
297
303
|
el.attr(this.add_namespace('data-uuid'), uuid);
|
298
304
|
|
299
305
|
return this.cache[uuid] = scenarios;
|
300
306
|
},
|
301
307
|
|
302
|
-
trim : function(str) {
|
308
|
+
trim : function (str) {
|
303
309
|
|
304
310
|
if (typeof str === 'string') {
|
305
311
|
return $.trim(str);
|
@@ -308,7 +314,7 @@
|
|
308
314
|
return str;
|
309
315
|
},
|
310
316
|
|
311
|
-
set_data_attr: function (init) {
|
317
|
+
set_data_attr : function (init) {
|
312
318
|
if (init) {
|
313
319
|
if (this.namespace.length > 0) {
|
314
320
|
return this.namespace + '-' + this.settings.load_attr;
|
@@ -326,7 +332,7 @@
|
|
326
332
|
|
327
333
|
parse_data_attr : function (el) {
|
328
334
|
var raw = el.attr(this.attr_name()).split(/\[(.*?)\]/),
|
329
|
-
i = raw.length,
|
335
|
+
i = raw.length,
|
330
336
|
output = [];
|
331
337
|
|
332
338
|
while (i--) {
|