rails_db 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -2
- data/Gemfile.lock +51 -58
- data/app/assets/javascripts/rails_db/application.js +5 -21
- data/app/assets/javascripts/rails_db/{vendor/jquery.js → jquery.js} +0 -0
- data/app/assets/javascripts/rails_db/rails-ujs.js +685 -0
- data/app/assets/stylesheets/rails_db/{app.scss → app.css} +2 -2
- data/lib/rails_db.rb +0 -1
- data/lib/rails_db/engine.rb +2 -3
- data/lib/rails_db/version.rb +1 -1
- data/rails_db.gemspec +0 -2
- data/test/dummy/db/rails_db.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +52 -47
- data/test/standalone/Gemfile +0 -1
- data/test/standalone/Gemfile.lock +0 -5
- metadata +113 -167
- data/app/assets/images/rails_db/down_arrow.gif +0 -0
- data/app/assets/images/rails_db/up_arrow.gif +0 -0
- data/app/assets/javascripts/rails_db/foundation/foundation.abide.js +0 -426
- data/app/assets/javascripts/rails_db/foundation/foundation.accordion.js +0 -125
- data/app/assets/javascripts/rails_db/foundation/foundation.alert.js +0 -43
- data/app/assets/javascripts/rails_db/foundation/foundation.clearing.js +0 -586
- data/app/assets/javascripts/rails_db/foundation/foundation.dropdown.js +0 -468
- data/app/assets/javascripts/rails_db/foundation/foundation.equalizer.js +0 -104
- data/app/assets/javascripts/rails_db/foundation/foundation.interchange.js +0 -360
- data/app/assets/javascripts/rails_db/foundation/foundation.joyride.js +0 -935
- data/app/assets/javascripts/rails_db/foundation/foundation.js +0 -732
- data/app/assets/javascripts/rails_db/foundation/foundation.magellan.js +0 -214
- data/app/assets/javascripts/rails_db/foundation/foundation.offcanvas.js +0 -225
- data/app/assets/javascripts/rails_db/foundation/foundation.orbit.js +0 -476
- data/app/assets/javascripts/rails_db/foundation/foundation.reveal.js +0 -522
- data/app/assets/javascripts/rails_db/foundation/foundation.slider.js +0 -296
- data/app/assets/javascripts/rails_db/foundation/foundation.tab.js +0 -247
- data/app/assets/javascripts/rails_db/foundation/foundation.tooltip.js +0 -348
- data/app/assets/javascripts/rails_db/foundation/foundation.topbar.js +0 -458
- data/app/assets/javascripts/rails_db/vendor/fastclick.js +0 -8
- data/app/assets/javascripts/rails_db/vendor/jquery.cookie.js +0 -8
- data/app/assets/javascripts/rails_db/vendor/modernizr.js +0 -8
- data/app/assets/javascripts/rails_db/vendor/placeholder.js +0 -2
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/rails_db_dev.sqlite3 +0 -0
@@ -1,348 +0,0 @@
|
|
1
|
-
;(function ($, window, document, undefined) {
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
Foundation.libs.tooltip = {
|
5
|
-
name : 'tooltip',
|
6
|
-
|
7
|
-
version : '5.5.3',
|
8
|
-
|
9
|
-
settings : {
|
10
|
-
additional_inheritable_classes : [],
|
11
|
-
tooltip_class : '.tooltip',
|
12
|
-
append_to : 'body',
|
13
|
-
touch_close_text : 'Tap To Close',
|
14
|
-
disable_for_touch : false,
|
15
|
-
hover_delay : 200,
|
16
|
-
fade_in_duration : 150,
|
17
|
-
fade_out_duration : 150,
|
18
|
-
show_on : 'all',
|
19
|
-
tip_template : function (selector, content) {
|
20
|
-
return '<span data-selector="' + selector + '" id="' + selector + '" class="'
|
21
|
-
+ Foundation.libs.tooltip.settings.tooltip_class.substring(1)
|
22
|
-
+ '" role="tooltip">' + content + '<span class="nub"></span></span>';
|
23
|
-
}
|
24
|
-
},
|
25
|
-
|
26
|
-
cache : {},
|
27
|
-
|
28
|
-
init : function (scope, method, options) {
|
29
|
-
Foundation.inherit(this, 'random_str');
|
30
|
-
this.bindings(method, options);
|
31
|
-
},
|
32
|
-
|
33
|
-
should_show : function (target, tip) {
|
34
|
-
var settings = $.extend({}, this.settings, this.data_options(target));
|
35
|
-
|
36
|
-
if (settings.show_on === 'all') {
|
37
|
-
return true;
|
38
|
-
} else if (this.small() && settings.show_on === 'small') {
|
39
|
-
return true;
|
40
|
-
} else if (this.medium() && settings.show_on === 'medium') {
|
41
|
-
return true;
|
42
|
-
} else if (this.large() && settings.show_on === 'large') {
|
43
|
-
return true;
|
44
|
-
}
|
45
|
-
return false;
|
46
|
-
},
|
47
|
-
|
48
|
-
medium : function () {
|
49
|
-
return matchMedia(Foundation.media_queries['medium']).matches;
|
50
|
-
},
|
51
|
-
|
52
|
-
large : function () {
|
53
|
-
return matchMedia(Foundation.media_queries['large']).matches;
|
54
|
-
},
|
55
|
-
|
56
|
-
events : function (instance) {
|
57
|
-
var self = this,
|
58
|
-
S = self.S;
|
59
|
-
|
60
|
-
self.create(this.S(instance));
|
61
|
-
|
62
|
-
function _startShow(elt, $this, immediate) {
|
63
|
-
if (elt.timer) {
|
64
|
-
return;
|
65
|
-
}
|
66
|
-
|
67
|
-
if (immediate) {
|
68
|
-
elt.timer = null;
|
69
|
-
self.showTip($this);
|
70
|
-
} else {
|
71
|
-
elt.timer = setTimeout(function () {
|
72
|
-
elt.timer = null;
|
73
|
-
self.showTip($this);
|
74
|
-
}.bind(elt), self.settings.hover_delay);
|
75
|
-
}
|
76
|
-
}
|
77
|
-
|
78
|
-
function _startHide(elt, $this) {
|
79
|
-
if (elt.timer) {
|
80
|
-
clearTimeout(elt.timer);
|
81
|
-
elt.timer = null;
|
82
|
-
}
|
83
|
-
|
84
|
-
self.hide($this);
|
85
|
-
}
|
86
|
-
|
87
|
-
$(this.scope)
|
88
|
-
.off('.tooltip')
|
89
|
-
.on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip',
|
90
|
-
'[' + this.attr_name() + ']', function (e) {
|
91
|
-
var $this = S(this),
|
92
|
-
settings = $.extend({}, self.settings, self.data_options($this)),
|
93
|
-
is_touch = false;
|
94
|
-
|
95
|
-
if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type) && S(e.target).is('a')) {
|
96
|
-
return false;
|
97
|
-
}
|
98
|
-
|
99
|
-
if (/mouse/i.test(e.type) && self.ie_touch(e)) {
|
100
|
-
return false;
|
101
|
-
}
|
102
|
-
|
103
|
-
if ($this.hasClass('open')) {
|
104
|
-
if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
|
105
|
-
e.preventDefault();
|
106
|
-
}
|
107
|
-
self.hide($this);
|
108
|
-
} else {
|
109
|
-
if (settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
|
110
|
-
return;
|
111
|
-
} else if (!settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
|
112
|
-
e.preventDefault();
|
113
|
-
S(settings.tooltip_class + '.open').hide();
|
114
|
-
is_touch = true;
|
115
|
-
// close other open tooltips on touch
|
116
|
-
if ($('.open[' + self.attr_name() + ']').length > 0) {
|
117
|
-
var prevOpen = S($('.open[' + self.attr_name() + ']')[0]);
|
118
|
-
self.hide(prevOpen);
|
119
|
-
}
|
120
|
-
}
|
121
|
-
|
122
|
-
if (/enter|over/i.test(e.type)) {
|
123
|
-
_startShow(this, $this);
|
124
|
-
|
125
|
-
} else if (e.type === 'mouseout' || e.type === 'mouseleave') {
|
126
|
-
_startHide(this, $this);
|
127
|
-
} else {
|
128
|
-
_startShow(this, $this, true);
|
129
|
-
}
|
130
|
-
}
|
131
|
-
})
|
132
|
-
.on('mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', '[' + this.attr_name() + '].open', function (e) {
|
133
|
-
if (/mouse/i.test(e.type) && self.ie_touch(e)) {
|
134
|
-
return false;
|
135
|
-
}
|
136
|
-
|
137
|
-
if ($(this).data('tooltip-open-event-type') == 'touch' && e.type == 'mouseleave') {
|
138
|
-
return;
|
139
|
-
} else if ($(this).data('tooltip-open-event-type') == 'mouse' && /MSPointerDown|touchstart/i.test(e.type)) {
|
140
|
-
self.convert_to_touch($(this));
|
141
|
-
} else {
|
142
|
-
_startHide(this, $(this));
|
143
|
-
}
|
144
|
-
})
|
145
|
-
.on('DOMNodeRemoved DOMAttrModified', '[' + this.attr_name() + ']:not(a)', function (e) {
|
146
|
-
_startHide(this, S(this));
|
147
|
-
});
|
148
|
-
},
|
149
|
-
|
150
|
-
ie_touch : function (e) {
|
151
|
-
// How do I distinguish between IE11 and Windows Phone 8?????
|
152
|
-
return false;
|
153
|
-
},
|
154
|
-
|
155
|
-
showTip : function ($target) {
|
156
|
-
var $tip = this.getTip($target);
|
157
|
-
if (this.should_show($target, $tip)) {
|
158
|
-
return this.show($target);
|
159
|
-
}
|
160
|
-
return;
|
161
|
-
},
|
162
|
-
|
163
|
-
getTip : function ($target) {
|
164
|
-
var selector = this.selector($target),
|
165
|
-
settings = $.extend({}, this.settings, this.data_options($target)),
|
166
|
-
tip = null;
|
167
|
-
|
168
|
-
if (selector) {
|
169
|
-
tip = this.S('span[data-selector="' + selector + '"]' + settings.tooltip_class);
|
170
|
-
}
|
171
|
-
|
172
|
-
return (typeof tip === 'object') ? tip : false;
|
173
|
-
},
|
174
|
-
|
175
|
-
selector : function ($target) {
|
176
|
-
var dataSelector = $target.attr(this.attr_name()) || $target.attr('data-selector');
|
177
|
-
|
178
|
-
if (typeof dataSelector != 'string') {
|
179
|
-
dataSelector = this.random_str(6);
|
180
|
-
$target
|
181
|
-
.attr('data-selector', dataSelector)
|
182
|
-
.attr('aria-describedby', dataSelector);
|
183
|
-
}
|
184
|
-
|
185
|
-
return dataSelector;
|
186
|
-
},
|
187
|
-
|
188
|
-
create : function ($target) {
|
189
|
-
var self = this,
|
190
|
-
settings = $.extend({}, this.settings, this.data_options($target)),
|
191
|
-
tip_template = this.settings.tip_template;
|
192
|
-
|
193
|
-
if (typeof settings.tip_template === 'string' && window.hasOwnProperty(settings.tip_template)) {
|
194
|
-
tip_template = window[settings.tip_template];
|
195
|
-
}
|
196
|
-
|
197
|
-
var $tip = $(tip_template(this.selector($target), $('<div></div>').html($target.attr('title')).html())),
|
198
|
-
classes = this.inheritable_classes($target);
|
199
|
-
|
200
|
-
$tip.addClass(classes).appendTo(settings.append_to);
|
201
|
-
|
202
|
-
if (Modernizr.touch) {
|
203
|
-
$tip.append('<span class="tap-to-close">' + settings.touch_close_text + '</span>');
|
204
|
-
$tip.on('touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', function (e) {
|
205
|
-
self.hide($target);
|
206
|
-
});
|
207
|
-
}
|
208
|
-
|
209
|
-
$target.removeAttr('title').attr('title', '');
|
210
|
-
},
|
211
|
-
|
212
|
-
reposition : function (target, tip, classes) {
|
213
|
-
var width, nub, nubHeight, nubWidth, objPos;
|
214
|
-
|
215
|
-
tip.css('visibility', 'hidden').show();
|
216
|
-
|
217
|
-
width = target.data('width');
|
218
|
-
nub = tip.children('.nub');
|
219
|
-
nubHeight = nub.outerHeight();
|
220
|
-
nubWidth = nub.outerWidth();
|
221
|
-
|
222
|
-
if (this.small()) {
|
223
|
-
tip.css({'width' : '100%'});
|
224
|
-
} else {
|
225
|
-
tip.css({'width' : (width) ? width : 'auto'});
|
226
|
-
}
|
227
|
-
|
228
|
-
objPos = function (obj, top, right, bottom, left, width) {
|
229
|
-
return obj.css({
|
230
|
-
'top' : (top) ? top : 'auto',
|
231
|
-
'bottom' : (bottom) ? bottom : 'auto',
|
232
|
-
'left' : (left) ? left : 'auto',
|
233
|
-
'right' : (right) ? right : 'auto'
|
234
|
-
}).end();
|
235
|
-
};
|
236
|
-
|
237
|
-
var o_top = target.offset().top;
|
238
|
-
var o_left = target.offset().left;
|
239
|
-
var outerHeight = target.outerHeight();
|
240
|
-
|
241
|
-
objPos(tip, (o_top + outerHeight + 10), 'auto', 'auto', o_left);
|
242
|
-
|
243
|
-
if (this.small()) {
|
244
|
-
objPos(tip, (o_top + outerHeight + 10), 'auto', 'auto', 12.5, $(this.scope).width());
|
245
|
-
tip.addClass('tip-override');
|
246
|
-
objPos(nub, -nubHeight, 'auto', 'auto', o_left);
|
247
|
-
} else {
|
248
|
-
|
249
|
-
if (Foundation.rtl) {
|
250
|
-
nub.addClass('rtl');
|
251
|
-
o_left = o_left + target.outerWidth() - tip.outerWidth();
|
252
|
-
}
|
253
|
-
|
254
|
-
objPos(tip, (o_top + outerHeight + 10), 'auto', 'auto', o_left);
|
255
|
-
// reset nub from small styles, if they've been applied
|
256
|
-
if (nub.attr('style')) {
|
257
|
-
nub.removeAttr('style');
|
258
|
-
}
|
259
|
-
|
260
|
-
tip.removeClass('tip-override');
|
261
|
-
|
262
|
-
var tip_outerHeight = tip.outerHeight();
|
263
|
-
|
264
|
-
if (classes && classes.indexOf('tip-top') > -1) {
|
265
|
-
if (Foundation.rtl) {
|
266
|
-
nub.addClass('rtl');
|
267
|
-
}
|
268
|
-
objPos(tip, (o_top - tip_outerHeight), 'auto', 'auto', o_left)
|
269
|
-
.removeClass('tip-override');
|
270
|
-
} else if (classes && classes.indexOf('tip-left') > -1) {
|
271
|
-
objPos(tip, (o_top + (outerHeight / 2) - (tip_outerHeight / 2)), 'auto', 'auto', (o_left - tip.outerWidth() - nubHeight))
|
272
|
-
.removeClass('tip-override');
|
273
|
-
nub.removeClass('rtl');
|
274
|
-
} else if (classes && classes.indexOf('tip-right') > -1) {
|
275
|
-
objPos(tip, (o_top + (outerHeight / 2) - (tip_outerHeight / 2)), 'auto', 'auto', (o_left + target.outerWidth() + nubHeight))
|
276
|
-
.removeClass('tip-override');
|
277
|
-
nub.removeClass('rtl');
|
278
|
-
}
|
279
|
-
}
|
280
|
-
|
281
|
-
tip.css('visibility', 'visible').hide();
|
282
|
-
},
|
283
|
-
|
284
|
-
small : function () {
|
285
|
-
return matchMedia(Foundation.media_queries.small).matches &&
|
286
|
-
!matchMedia(Foundation.media_queries.medium).matches;
|
287
|
-
},
|
288
|
-
|
289
|
-
inheritable_classes : function ($target) {
|
290
|
-
var settings = $.extend({}, this.settings, this.data_options($target)),
|
291
|
-
inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'radius', 'round'].concat(settings.additional_inheritable_classes),
|
292
|
-
classes = $target.attr('class'),
|
293
|
-
filtered = classes ? $.map(classes.split(' '), function (el, i) {
|
294
|
-
if ($.inArray(el, inheritables) !== -1) {
|
295
|
-
return el;
|
296
|
-
}
|
297
|
-
}).join(' ') : '';
|
298
|
-
|
299
|
-
return $.trim(filtered);
|
300
|
-
},
|
301
|
-
|
302
|
-
convert_to_touch : function ($target) {
|
303
|
-
var self = this,
|
304
|
-
$tip = self.getTip($target),
|
305
|
-
settings = $.extend({}, self.settings, self.data_options($target));
|
306
|
-
|
307
|
-
if ($tip.find('.tap-to-close').length === 0) {
|
308
|
-
$tip.append('<span class="tap-to-close">' + settings.touch_close_text + '</span>');
|
309
|
-
$tip.on('click.fndtn.tooltip.tapclose touchstart.fndtn.tooltip.tapclose MSPointerDown.fndtn.tooltip.tapclose', function (e) {
|
310
|
-
self.hide($target);
|
311
|
-
});
|
312
|
-
}
|
313
|
-
|
314
|
-
$target.data('tooltip-open-event-type', 'touch');
|
315
|
-
},
|
316
|
-
|
317
|
-
show : function ($target) {
|
318
|
-
var $tip = this.getTip($target);
|
319
|
-
if ($target.data('tooltip-open-event-type') == 'touch') {
|
320
|
-
this.convert_to_touch($target);
|
321
|
-
}
|
322
|
-
|
323
|
-
this.reposition($target, $tip, $target.attr('class'));
|
324
|
-
$target.addClass('open');
|
325
|
-
$tip.fadeIn(this.settings.fade_in_duration);
|
326
|
-
},
|
327
|
-
|
328
|
-
hide : function ($target) {
|
329
|
-
var $tip = this.getTip($target);
|
330
|
-
|
331
|
-
$tip.fadeOut(this.settings.fade_out_duration, function () {
|
332
|
-
$tip.find('.tap-to-close').remove();
|
333
|
-
$tip.off('click.fndtn.tooltip.tapclose MSPointerDown.fndtn.tapclose');
|
334
|
-
$target.removeClass('open');
|
335
|
-
});
|
336
|
-
},
|
337
|
-
|
338
|
-
off : function () {
|
339
|
-
var self = this;
|
340
|
-
this.S(this.scope).off('.fndtn.tooltip');
|
341
|
-
this.S(this.settings.tooltip_class).each(function (i) {
|
342
|
-
$('[' + self.attr_name() + ']').eq(i).attr('title', $(this).text());
|
343
|
-
}).remove();
|
344
|
-
},
|
345
|
-
|
346
|
-
reflow : function () {}
|
347
|
-
};
|
348
|
-
}(jQuery, window, window.document));
|
@@ -1,458 +0,0 @@
|
|
1
|
-
;(function ($, window, document, undefined) {
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
Foundation.libs.topbar = {
|
5
|
-
name : 'topbar',
|
6
|
-
|
7
|
-
version : '5.5.3',
|
8
|
-
|
9
|
-
settings : {
|
10
|
-
index : 0,
|
11
|
-
start_offset : 0,
|
12
|
-
sticky_class : 'sticky',
|
13
|
-
custom_back_text : true,
|
14
|
-
back_text : 'Back',
|
15
|
-
mobile_show_parent_link : true,
|
16
|
-
is_hover : true,
|
17
|
-
scrolltop : true, // jump to top when sticky nav menu toggle is clicked
|
18
|
-
sticky_on : 'all',
|
19
|
-
dropdown_autoclose: true
|
20
|
-
},
|
21
|
-
|
22
|
-
init : function (section, method, options) {
|
23
|
-
Foundation.inherit(this, 'add_custom_rule register_media throttle');
|
24
|
-
var self = this;
|
25
|
-
|
26
|
-
self.register_media('topbar', 'foundation-mq-topbar');
|
27
|
-
|
28
|
-
this.bindings(method, options);
|
29
|
-
|
30
|
-
self.S('[' + this.attr_name() + ']', this.scope).each(function () {
|
31
|
-
var topbar = $(this),
|
32
|
-
settings = topbar.data(self.attr_name(true) + '-init'),
|
33
|
-
section = self.S('section, .top-bar-section', this);
|
34
|
-
topbar.data('index', 0);
|
35
|
-
var topbarContainer = topbar.parent();
|
36
|
-
if (topbarContainer.hasClass('fixed') || self.is_sticky(topbar, topbarContainer, settings) ) {
|
37
|
-
self.settings.sticky_class = settings.sticky_class;
|
38
|
-
self.settings.sticky_topbar = topbar;
|
39
|
-
topbar.data('height', topbarContainer.outerHeight());
|
40
|
-
topbar.data('stickyoffset', topbarContainer.offset().top);
|
41
|
-
} else {
|
42
|
-
topbar.data('height', topbar.outerHeight());
|
43
|
-
}
|
44
|
-
|
45
|
-
if (!settings.assembled) {
|
46
|
-
self.assemble(topbar);
|
47
|
-
}
|
48
|
-
|
49
|
-
if (settings.is_hover) {
|
50
|
-
self.S('.has-dropdown', topbar).addClass('not-click');
|
51
|
-
} else {
|
52
|
-
self.S('.has-dropdown', topbar).removeClass('not-click');
|
53
|
-
}
|
54
|
-
|
55
|
-
// Pad body when sticky (scrolled) or fixed.
|
56
|
-
self.add_custom_rule('.f-topbar-fixed { padding-top: ' + topbar.data('height') + 'px }');
|
57
|
-
|
58
|
-
if (topbarContainer.hasClass('fixed')) {
|
59
|
-
self.S('body').addClass('f-topbar-fixed');
|
60
|
-
}
|
61
|
-
});
|
62
|
-
|
63
|
-
},
|
64
|
-
|
65
|
-
is_sticky : function (topbar, topbarContainer, settings) {
|
66
|
-
var sticky = topbarContainer.hasClass(settings.sticky_class);
|
67
|
-
var smallMatch = matchMedia(Foundation.media_queries.small).matches;
|
68
|
-
var medMatch = matchMedia(Foundation.media_queries.medium).matches;
|
69
|
-
var lrgMatch = matchMedia(Foundation.media_queries.large).matches;
|
70
|
-
|
71
|
-
if (sticky && settings.sticky_on === 'all') {
|
72
|
-
return true;
|
73
|
-
}
|
74
|
-
if (sticky && this.small() && settings.sticky_on.indexOf('small') !== -1) {
|
75
|
-
if (smallMatch && !medMatch && !lrgMatch) { return true; }
|
76
|
-
}
|
77
|
-
if (sticky && this.medium() && settings.sticky_on.indexOf('medium') !== -1) {
|
78
|
-
if (smallMatch && medMatch && !lrgMatch) { return true; }
|
79
|
-
}
|
80
|
-
if (sticky && this.large() && settings.sticky_on.indexOf('large') !== -1) {
|
81
|
-
if (smallMatch && medMatch && lrgMatch) { return true; }
|
82
|
-
}
|
83
|
-
|
84
|
-
return false;
|
85
|
-
},
|
86
|
-
|
87
|
-
toggle : function (toggleEl) {
|
88
|
-
var self = this,
|
89
|
-
topbar;
|
90
|
-
|
91
|
-
if (toggleEl) {
|
92
|
-
topbar = self.S(toggleEl).closest('[' + this.attr_name() + ']');
|
93
|
-
} else {
|
94
|
-
topbar = self.S('[' + this.attr_name() + ']');
|
95
|
-
}
|
96
|
-
|
97
|
-
var settings = topbar.data(this.attr_name(true) + '-init');
|
98
|
-
|
99
|
-
var section = self.S('section, .top-bar-section', topbar);
|
100
|
-
|
101
|
-
if (self.breakpoint()) {
|
102
|
-
if (!self.rtl) {
|
103
|
-
section.css({left : '0%'});
|
104
|
-
$('>.name', section).css({left : '100%'});
|
105
|
-
} else {
|
106
|
-
section.css({right : '0%'});
|
107
|
-
$('>.name', section).css({right : '100%'});
|
108
|
-
}
|
109
|
-
|
110
|
-
self.S('li.moved', section).removeClass('moved');
|
111
|
-
topbar.data('index', 0);
|
112
|
-
|
113
|
-
topbar
|
114
|
-
.toggleClass('expanded')
|
115
|
-
.css('height', '');
|
116
|
-
}
|
117
|
-
|
118
|
-
if (settings.scrolltop) {
|
119
|
-
if (!topbar.hasClass('expanded')) {
|
120
|
-
if (topbar.hasClass('fixed')) {
|
121
|
-
topbar.parent().addClass('fixed');
|
122
|
-
topbar.removeClass('fixed');
|
123
|
-
self.S('body').addClass('f-topbar-fixed');
|
124
|
-
}
|
125
|
-
} else if (topbar.parent().hasClass('fixed')) {
|
126
|
-
if (settings.scrolltop) {
|
127
|
-
topbar.parent().removeClass('fixed');
|
128
|
-
topbar.addClass('fixed');
|
129
|
-
self.S('body').removeClass('f-topbar-fixed');
|
130
|
-
|
131
|
-
window.scrollTo(0, 0);
|
132
|
-
} else {
|
133
|
-
topbar.parent().removeClass('expanded');
|
134
|
-
}
|
135
|
-
}
|
136
|
-
} else {
|
137
|
-
if (self.is_sticky(topbar, topbar.parent(), settings)) {
|
138
|
-
topbar.parent().addClass('fixed');
|
139
|
-
}
|
140
|
-
|
141
|
-
if (topbar.parent().hasClass('fixed')) {
|
142
|
-
if (!topbar.hasClass('expanded')) {
|
143
|
-
topbar.removeClass('fixed');
|
144
|
-
topbar.parent().removeClass('expanded');
|
145
|
-
self.update_sticky_positioning();
|
146
|
-
} else {
|
147
|
-
topbar.addClass('fixed');
|
148
|
-
topbar.parent().addClass('expanded');
|
149
|
-
self.S('body').addClass('f-topbar-fixed');
|
150
|
-
}
|
151
|
-
}
|
152
|
-
}
|
153
|
-
},
|
154
|
-
|
155
|
-
timer : null,
|
156
|
-
|
157
|
-
events : function (bar) {
|
158
|
-
var self = this,
|
159
|
-
S = this.S;
|
160
|
-
|
161
|
-
S(this.scope)
|
162
|
-
.off('.topbar')
|
163
|
-
.on('click.fndtn.topbar', '[' + this.attr_name() + '] .toggle-topbar', function (e) {
|
164
|
-
e.preventDefault();
|
165
|
-
self.toggle(this);
|
166
|
-
})
|
167
|
-
.on('click.fndtn.topbar contextmenu.fndtn.topbar', '.top-bar .top-bar-section li a[href^="#"],[' + this.attr_name() + '] .top-bar-section li a[href^="#"]', function (e) {
|
168
|
-
var li = $(this).closest('li'),
|
169
|
-
topbar = li.closest('[' + self.attr_name() + ']'),
|
170
|
-
settings = topbar.data(self.attr_name(true) + '-init');
|
171
|
-
|
172
|
-
if (settings.dropdown_autoclose && settings.is_hover) {
|
173
|
-
var hoverLi = $(this).closest('.hover');
|
174
|
-
hoverLi.removeClass('hover');
|
175
|
-
}
|
176
|
-
if (self.breakpoint() && !li.hasClass('back') && !li.hasClass('has-dropdown')) {
|
177
|
-
self.toggle();
|
178
|
-
}
|
179
|
-
|
180
|
-
})
|
181
|
-
.on('click.fndtn.topbar', '[' + this.attr_name() + '] li.has-dropdown', function (e) {
|
182
|
-
var li = S(this),
|
183
|
-
target = S(e.target),
|
184
|
-
topbar = li.closest('[' + self.attr_name() + ']'),
|
185
|
-
settings = topbar.data(self.attr_name(true) + '-init');
|
186
|
-
|
187
|
-
if (target.data('revealId')) {
|
188
|
-
self.toggle();
|
189
|
-
return;
|
190
|
-
}
|
191
|
-
|
192
|
-
if (self.breakpoint()) {
|
193
|
-
return;
|
194
|
-
}
|
195
|
-
|
196
|
-
if (settings.is_hover && !Modernizr.touch) {
|
197
|
-
return;
|
198
|
-
}
|
199
|
-
|
200
|
-
e.stopImmediatePropagation();
|
201
|
-
|
202
|
-
if (li.hasClass('hover')) {
|
203
|
-
li
|
204
|
-
.removeClass('hover')
|
205
|
-
.find('li')
|
206
|
-
.removeClass('hover');
|
207
|
-
|
208
|
-
li.parents('li.hover')
|
209
|
-
.removeClass('hover');
|
210
|
-
} else {
|
211
|
-
li.addClass('hover');
|
212
|
-
|
213
|
-
$(li).siblings().removeClass('hover');
|
214
|
-
|
215
|
-
if (target[0].nodeName === 'A' && target.parent().hasClass('has-dropdown')) {
|
216
|
-
e.preventDefault();
|
217
|
-
}
|
218
|
-
}
|
219
|
-
})
|
220
|
-
.on('click.fndtn.topbar', '[' + this.attr_name() + '] .has-dropdown>a', function (e) {
|
221
|
-
if (self.breakpoint()) {
|
222
|
-
|
223
|
-
e.preventDefault();
|
224
|
-
|
225
|
-
var $this = S(this),
|
226
|
-
topbar = $this.closest('[' + self.attr_name() + ']'),
|
227
|
-
section = topbar.find('section, .top-bar-section'),
|
228
|
-
dropdownHeight = $this.next('.dropdown').outerHeight(),
|
229
|
-
$selectedLi = $this.closest('li');
|
230
|
-
|
231
|
-
topbar.data('index', topbar.data('index') + 1);
|
232
|
-
$selectedLi.addClass('moved');
|
233
|
-
|
234
|
-
if (!self.rtl) {
|
235
|
-
section.css({left : -(100 * topbar.data('index')) + '%'});
|
236
|
-
section.find('>.name').css({left : 100 * topbar.data('index') + '%'});
|
237
|
-
} else {
|
238
|
-
section.css({right : -(100 * topbar.data('index')) + '%'});
|
239
|
-
section.find('>.name').css({right : 100 * topbar.data('index') + '%'});
|
240
|
-
}
|
241
|
-
|
242
|
-
topbar.css('height', $this.siblings('ul').outerHeight(true) + topbar.data('height'));
|
243
|
-
}
|
244
|
-
});
|
245
|
-
|
246
|
-
S(window).off('.topbar').on('resize.fndtn.topbar', self.throttle(function () {
|
247
|
-
self.resize.call(self);
|
248
|
-
}, 50)).trigger('resize.fndtn.topbar').load(function () {
|
249
|
-
// Ensure that the offset is calculated after all of the pages resources have loaded
|
250
|
-
S(this).trigger('resize.fndtn.topbar');
|
251
|
-
});
|
252
|
-
|
253
|
-
S('body').off('.topbar').on('click.fndtn.topbar', function (e) {
|
254
|
-
var parent = S(e.target).closest('li').closest('li.hover');
|
255
|
-
|
256
|
-
if (parent.length > 0) {
|
257
|
-
return;
|
258
|
-
}
|
259
|
-
|
260
|
-
S('[' + self.attr_name() + '] li.hover').removeClass('hover');
|
261
|
-
});
|
262
|
-
|
263
|
-
// Go up a level on Click
|
264
|
-
S(this.scope).on('click.fndtn.topbar', '[' + this.attr_name() + '] .has-dropdown .back', function (e) {
|
265
|
-
e.preventDefault();
|
266
|
-
|
267
|
-
var $this = S(this),
|
268
|
-
topbar = $this.closest('[' + self.attr_name() + ']'),
|
269
|
-
section = topbar.find('section, .top-bar-section'),
|
270
|
-
settings = topbar.data(self.attr_name(true) + '-init'),
|
271
|
-
$movedLi = $this.closest('li.moved'),
|
272
|
-
$previousLevelUl = $movedLi.parent();
|
273
|
-
|
274
|
-
topbar.data('index', topbar.data('index') - 1);
|
275
|
-
|
276
|
-
if (!self.rtl) {
|
277
|
-
section.css({left : -(100 * topbar.data('index')) + '%'});
|
278
|
-
section.find('>.name').css({left : 100 * topbar.data('index') + '%'});
|
279
|
-
} else {
|
280
|
-
section.css({right : -(100 * topbar.data('index')) + '%'});
|
281
|
-
section.find('>.name').css({right : 100 * topbar.data('index') + '%'});
|
282
|
-
}
|
283
|
-
|
284
|
-
if (topbar.data('index') === 0) {
|
285
|
-
topbar.css('height', '');
|
286
|
-
} else {
|
287
|
-
topbar.css('height', $previousLevelUl.outerHeight(true) + topbar.data('height'));
|
288
|
-
}
|
289
|
-
|
290
|
-
setTimeout(function () {
|
291
|
-
$movedLi.removeClass('moved');
|
292
|
-
}, 300);
|
293
|
-
});
|
294
|
-
|
295
|
-
// Show dropdown menus when their items are focused
|
296
|
-
S(this.scope).find('.dropdown a')
|
297
|
-
.focus(function () {
|
298
|
-
$(this).parents('.has-dropdown').addClass('hover');
|
299
|
-
})
|
300
|
-
.blur(function () {
|
301
|
-
$(this).parents('.has-dropdown').removeClass('hover');
|
302
|
-
});
|
303
|
-
},
|
304
|
-
|
305
|
-
resize : function () {
|
306
|
-
var self = this;
|
307
|
-
self.S('[' + this.attr_name() + ']').each(function () {
|
308
|
-
var topbar = self.S(this),
|
309
|
-
settings = topbar.data(self.attr_name(true) + '-init');
|
310
|
-
|
311
|
-
var stickyContainer = topbar.parent('.' + self.settings.sticky_class);
|
312
|
-
var stickyOffset;
|
313
|
-
|
314
|
-
if (!self.breakpoint()) {
|
315
|
-
var doToggle = topbar.hasClass('expanded');
|
316
|
-
topbar
|
317
|
-
.css('height', '')
|
318
|
-
.removeClass('expanded')
|
319
|
-
.find('li')
|
320
|
-
.removeClass('hover');
|
321
|
-
|
322
|
-
if (doToggle) {
|
323
|
-
self.toggle(topbar);
|
324
|
-
}
|
325
|
-
}
|
326
|
-
|
327
|
-
if (self.is_sticky(topbar, stickyContainer, settings)) {
|
328
|
-
if (stickyContainer.hasClass('fixed')) {
|
329
|
-
// Remove the fixed to allow for correct calculation of the offset.
|
330
|
-
stickyContainer.removeClass('fixed');
|
331
|
-
|
332
|
-
stickyOffset = stickyContainer.offset().top;
|
333
|
-
if (self.S(document.body).hasClass('f-topbar-fixed')) {
|
334
|
-
stickyOffset -= topbar.data('height');
|
335
|
-
}
|
336
|
-
|
337
|
-
topbar.data('stickyoffset', stickyOffset);
|
338
|
-
stickyContainer.addClass('fixed');
|
339
|
-
} else {
|
340
|
-
stickyOffset = stickyContainer.offset().top;
|
341
|
-
topbar.data('stickyoffset', stickyOffset);
|
342
|
-
}
|
343
|
-
}
|
344
|
-
|
345
|
-
});
|
346
|
-
},
|
347
|
-
|
348
|
-
breakpoint : function () {
|
349
|
-
return !matchMedia(Foundation.media_queries['topbar']).matches;
|
350
|
-
},
|
351
|
-
|
352
|
-
small : function () {
|
353
|
-
return matchMedia(Foundation.media_queries['small']).matches;
|
354
|
-
},
|
355
|
-
|
356
|
-
medium : function () {
|
357
|
-
return matchMedia(Foundation.media_queries['medium']).matches;
|
358
|
-
},
|
359
|
-
|
360
|
-
large : function () {
|
361
|
-
return matchMedia(Foundation.media_queries['large']).matches;
|
362
|
-
},
|
363
|
-
|
364
|
-
assemble : function (topbar) {
|
365
|
-
var self = this,
|
366
|
-
settings = topbar.data(this.attr_name(true) + '-init'),
|
367
|
-
section = self.S('section, .top-bar-section', topbar);
|
368
|
-
|
369
|
-
// Pull element out of the DOM for manipulation
|
370
|
-
section.detach();
|
371
|
-
|
372
|
-
self.S('.has-dropdown>a', section).each(function () {
|
373
|
-
var $link = self.S(this),
|
374
|
-
$dropdown = $link.siblings('.dropdown'),
|
375
|
-
url = $link.attr('href'),
|
376
|
-
$titleLi;
|
377
|
-
|
378
|
-
if (!$dropdown.find('.title.back').length) {
|
379
|
-
|
380
|
-
if (settings.mobile_show_parent_link == true && url) {
|
381
|
-
$titleLi = $('<li class="title back js-generated"><h5><a href="javascript:void(0)"></a></h5></li><li class="parent-link hide-for-medium-up"><a class="parent-link js-generated" href="' + url + '">' + $link.html() +'</a></li>');
|
382
|
-
} else {
|
383
|
-
$titleLi = $('<li class="title back js-generated"><h5><a href="javascript:void(0)"></a></h5>');
|
384
|
-
}
|
385
|
-
|
386
|
-
// Copy link to subnav
|
387
|
-
if (settings.custom_back_text == true) {
|
388
|
-
$('h5>a', $titleLi).html(settings.back_text);
|
389
|
-
} else {
|
390
|
-
$('h5>a', $titleLi).html('« ' + $link.html());
|
391
|
-
}
|
392
|
-
$dropdown.prepend($titleLi);
|
393
|
-
}
|
394
|
-
});
|
395
|
-
|
396
|
-
// Put element back in the DOM
|
397
|
-
section.appendTo(topbar);
|
398
|
-
|
399
|
-
// check for sticky
|
400
|
-
this.sticky();
|
401
|
-
|
402
|
-
this.assembled(topbar);
|
403
|
-
},
|
404
|
-
|
405
|
-
assembled : function (topbar) {
|
406
|
-
topbar.data(this.attr_name(true), $.extend({}, topbar.data(this.attr_name(true)), {assembled : true}));
|
407
|
-
},
|
408
|
-
|
409
|
-
height : function (ul) {
|
410
|
-
var total = 0,
|
411
|
-
self = this;
|
412
|
-
|
413
|
-
$('> li', ul).each(function () {
|
414
|
-
total += self.S(this).outerHeight(true);
|
415
|
-
});
|
416
|
-
|
417
|
-
return total;
|
418
|
-
},
|
419
|
-
|
420
|
-
sticky : function () {
|
421
|
-
var self = this;
|
422
|
-
|
423
|
-
this.S(window).on('scroll', function () {
|
424
|
-
self.update_sticky_positioning();
|
425
|
-
});
|
426
|
-
},
|
427
|
-
|
428
|
-
update_sticky_positioning : function () {
|
429
|
-
var klass = '.' + this.settings.sticky_class,
|
430
|
-
$window = this.S(window),
|
431
|
-
self = this;
|
432
|
-
|
433
|
-
if (self.settings.sticky_topbar && self.is_sticky(this.settings.sticky_topbar,this.settings.sticky_topbar.parent(), this.settings)) {
|
434
|
-
var distance = this.settings.sticky_topbar.data('stickyoffset') + this.settings.start_offset;
|
435
|
-
if (!self.S(klass).hasClass('expanded')) {
|
436
|
-
if ($window.scrollTop() > (distance)) {
|
437
|
-
if (!self.S(klass).hasClass('fixed')) {
|
438
|
-
self.S(klass).addClass('fixed');
|
439
|
-
self.S('body').addClass('f-topbar-fixed');
|
440
|
-
}
|
441
|
-
} else if ($window.scrollTop() <= distance) {
|
442
|
-
if (self.S(klass).hasClass('fixed')) {
|
443
|
-
self.S(klass).removeClass('fixed');
|
444
|
-
self.S('body').removeClass('f-topbar-fixed');
|
445
|
-
}
|
446
|
-
}
|
447
|
-
}
|
448
|
-
}
|
449
|
-
},
|
450
|
-
|
451
|
-
off : function () {
|
452
|
-
this.S(this.scope).off('.fndtn.topbar');
|
453
|
-
this.S(window).off('.fndtn.topbar');
|
454
|
-
},
|
455
|
-
|
456
|
-
reflow : function () {}
|
457
|
-
};
|
458
|
-
}(jQuery, window, window.document));
|