catscope 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/bower.json +1 -0
- data/assets/bower_components/foundation/LICENSE +22 -0
- data/assets/bower_components/foundation/README.md +46 -0
- data/assets/bower_components/foundation/bower.json +2 -4
- data/assets/bower_components/foundation/css/foundation.css +1695 -1230
- data/assets/bower_components/foundation/css/foundation.css.map +1 -1
- data/assets/bower_components/foundation/css/foundation.min.css +1 -0
- data/assets/bower_components/foundation/css/normalize.css +9 -12
- data/assets/bower_components/foundation/css/normalize.css.map +1 -1
- data/assets/bower_components/foundation/css/normalize.min.css +1 -0
- data/assets/bower_components/foundation/js/foundation/foundation.abide.js +171 -75
- data/assets/bower_components/foundation/js/foundation/foundation.accordion.js +70 -12
- data/assets/bower_components/foundation/js/foundation/foundation.alert.js +5 -5
- data/assets/bower_components/foundation/js/foundation/foundation.clearing.js +84 -40
- data/assets/bower_components/foundation/js/foundation/foundation.dropdown.js +104 -79
- data/assets/bower_components/foundation/js/foundation/foundation.equalizer.js +57 -26
- data/assets/bower_components/foundation/js/foundation/foundation.interchange.js +50 -38
- data/assets/bower_components/foundation/js/foundation/foundation.joyride.js +121 -110
- data/assets/bower_components/foundation/js/foundation/foundation.js +121 -79
- data/assets/bower_components/foundation/js/foundation/foundation.magellan.js +75 -59
- data/assets/bower_components/foundation/js/foundation/foundation.offcanvas.js +95 -22
- data/assets/bower_components/foundation/js/foundation/foundation.orbit.js +127 -123
- data/assets/bower_components/foundation/js/foundation/foundation.reveal.js +147 -69
- data/assets/bower_components/foundation/js/foundation/foundation.slider.js +101 -72
- data/assets/bower_components/foundation/js/foundation/foundation.tab.js +52 -39
- data/assets/bower_components/foundation/js/foundation/foundation.tooltip.js +97 -49
- data/assets/bower_components/foundation/js/foundation/foundation.topbar.js +70 -57
- data/assets/bower_components/foundation/js/foundation.js +1544 -951
- data/assets/bower_components/foundation/js/foundation.min.js +5 -4
- data/assets/bower_components/foundation/js/vendor/fastclick.js +8 -9
- data/assets/bower_components/foundation/js/vendor/jquery.js +6 -6
- data/assets/bower_components/foundation/js/vendor/modernizr.js +1 -1
- data/assets/bower_components/foundation/package.json +57 -0
- data/assets/bower_components/foundation/scss/foundation/_functions.scss +53 -43
- data/assets/bower_components/foundation/scss/foundation/_settings.scss +59 -37
- data/assets/bower_components/foundation/scss/foundation/components/_accordion.scss +12 -8
- data/assets/bower_components/foundation/scss/foundation/components/_alert-boxes.scss +12 -12
- data/assets/bower_components/foundation/scss/foundation/components/_block-grid.scss +14 -13
- data/assets/bower_components/foundation/scss/foundation/components/_breadcrumbs.scss +19 -19
- data/assets/bower_components/foundation/scss/foundation/components/_button-groups.scss +33 -25
- data/assets/bower_components/foundation/scss/foundation/components/_buttons.scss +30 -28
- data/assets/bower_components/foundation/scss/foundation/components/_clearing.scss +51 -47
- data/assets/bower_components/foundation/scss/foundation/components/_dropdown-buttons.scss +10 -11
- data/assets/bower_components/foundation/scss/foundation/components/_dropdown.scss +45 -38
- data/assets/bower_components/foundation/scss/foundation/components/_flex-video.scss +7 -7
- data/assets/bower_components/foundation/scss/foundation/components/_forms.scss +99 -62
- data/assets/bower_components/foundation/scss/foundation/components/_global.scss +152 -67
- data/assets/bower_components/foundation/scss/foundation/components/_grid.scss +39 -36
- data/assets/bower_components/foundation/scss/foundation/components/_icon-bar.scss +337 -235
- data/assets/bower_components/foundation/scss/foundation/components/_inline-lists.scss +9 -8
- data/assets/bower_components/foundation/scss/foundation/components/_joyride.scss +40 -42
- data/assets/bower_components/foundation/scss/foundation/components/_keystrokes.scss +2 -3
- data/assets/bower_components/foundation/scss/foundation/components/_labels.scss +6 -6
- data/assets/bower_components/foundation/scss/foundation/components/_magellan.scss +2 -2
- data/assets/bower_components/foundation/scss/foundation/components/_offcanvas.scss +259 -168
- data/assets/bower_components/foundation/scss/foundation/components/_orbit.scss +82 -62
- data/assets/bower_components/foundation/scss/foundation/components/_pagination.scss +16 -15
- data/assets/bower_components/foundation/scss/foundation/components/_panels.scss +21 -15
- data/assets/bower_components/foundation/scss/foundation/components/_pricing-tables.scss +16 -16
- data/assets/bower_components/foundation/scss/foundation/components/_progress-bars.scss +10 -4
- data/assets/bower_components/foundation/scss/foundation/components/_range-slider.scss +28 -20
- data/assets/bower_components/foundation/scss/foundation/components/_reveal.scss +38 -28
- data/assets/bower_components/foundation/scss/foundation/components/_side-nav.scss +15 -11
- data/assets/bower_components/foundation/scss/foundation/components/_split-buttons.scss +22 -18
- data/assets/bower_components/foundation/scss/foundation/components/_sub-nav.scss +14 -12
- data/assets/bower_components/foundation/scss/foundation/components/_switches.scss +22 -19
- data/assets/bower_components/foundation/scss/foundation/components/_tables.scss +8 -8
- data/assets/bower_components/foundation/scss/foundation/components/_tabs.scss +50 -31
- data/assets/bower_components/foundation/scss/foundation/components/_thumbs.scss +8 -8
- data/assets/bower_components/foundation/scss/foundation/components/_tooltips.scss +25 -25
- data/assets/bower_components/foundation/scss/foundation/components/_top-bar.scss +176 -122
- data/assets/bower_components/foundation/scss/foundation/components/_type.scss +38 -38
- data/assets/bower_components/foundation/scss/foundation/components/_visibility.scss +33 -16
- data/assets/bower_components/foundation/scss/foundation.scss +37 -40
- data/assets/bower_components/foundation/scss/normalize.scss +8 -11
- data/assets/bower_components/jquery/bower.json +2 -1
- data/assets/bower_components/jquery/dist/jquery.js +9 -4
- data/assets/bower_components/jquery/dist/jquery.min.js +4 -4
- data/assets/bower_components/jquery/dist/jquery.min.map +1 -1
- data/assets/bower_components/jquery/src/core.js +6 -1
- data/assets/scss/_settings.scss +2 -0
- data/assets/stylesheets/app.css +3066 -2429
- data/lib/catscope/version.rb +1 -1
- data/lib/catscope/views/layout.erb +6 -2
- metadata +8 -4
- data/assets/bower_components/foundation/scss/foundation/components/_toolbar.scss +0 -70
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
* Foundation Responsive Library
|
3
3
|
* http://foundation.zurb.com
|
4
|
-
* Copyright
|
4
|
+
* Copyright 2015, ZURB
|
5
5
|
* Free to use under the MIT license.
|
6
6
|
* http://www.opensource.org/licenses/mit-license.php
|
7
7
|
*/
|
@@ -10,14 +10,12 @@
|
|
10
10
|
'use strict';
|
11
11
|
|
12
12
|
var header_helpers = function (class_array) {
|
13
|
-
var i = class_array.length;
|
14
13
|
var head = $('head');
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
head.append('<meta class="' + class_array[i] + '" />');
|
14
|
+
head.prepend($.map(class_array, function (class_name) {
|
15
|
+
if (head.has('.' + class_name).length === 0) {
|
16
|
+
return '<meta class="' + class_name + '" />';
|
19
17
|
}
|
20
|
-
}
|
18
|
+
}));
|
21
19
|
};
|
22
20
|
|
23
21
|
header_helpers([
|
@@ -34,7 +32,7 @@
|
|
34
32
|
|
35
33
|
// Enable FastClick if present
|
36
34
|
|
37
|
-
$(function() {
|
35
|
+
$(function () {
|
38
36
|
if (typeof FastClick !== 'undefined') {
|
39
37
|
// Don't attach to body if undefined
|
40
38
|
if (typeof document.body !== 'undefined') {
|
@@ -52,7 +50,9 @@
|
|
52
50
|
var cont;
|
53
51
|
if (context.jquery) {
|
54
52
|
cont = context[0];
|
55
|
-
if (!cont)
|
53
|
+
if (!cont) {
|
54
|
+
return context;
|
55
|
+
}
|
56
56
|
} else {
|
57
57
|
cont = context;
|
58
58
|
}
|
@@ -69,8 +69,12 @@
|
|
69
69
|
|
70
70
|
var attr_name = function (init) {
|
71
71
|
var arr = [];
|
72
|
-
if (!init)
|
73
|
-
|
72
|
+
if (!init) {
|
73
|
+
arr.push('data');
|
74
|
+
}
|
75
|
+
if (this.namespace.length > 0) {
|
76
|
+
arr.push(this.namespace);
|
77
|
+
}
|
74
78
|
arr.push(this.name);
|
75
79
|
|
76
80
|
return arr.join('-');
|
@@ -100,24 +104,20 @@
|
|
100
104
|
|
101
105
|
var bindings = function (method, options) {
|
102
106
|
var self = this,
|
103
|
-
|
107
|
+
bind = function(){
|
108
|
+
var $this = S(this),
|
109
|
+
should_bind_events = !$this.data(self.attr_name(true) + '-init');
|
110
|
+
$this.data(self.attr_name(true) + '-init', $.extend({}, self.settings, (options || method), self.data_options($this)));
|
104
111
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
this.events(this.scope);
|
110
|
-
}
|
112
|
+
if (should_bind_events) {
|
113
|
+
self.events(this);
|
114
|
+
}
|
115
|
+
};
|
111
116
|
|
117
|
+
if (S(this.scope).is('[' + this.attr_name() +']')) {
|
118
|
+
bind.call(this.scope);
|
112
119
|
} else {
|
113
|
-
S('[' + this.attr_name() +']', this.scope).each(
|
114
|
-
var should_bind_events = !S(this).data(self.attr_name(true) + '-init');
|
115
|
-
S(this).data(self.attr_name(true) + '-init', $.extend({}, self.settings, (options || method), self.data_options(S(this))));
|
116
|
-
|
117
|
-
if (should_bind_events) {
|
118
|
-
self.events(this);
|
119
|
-
}
|
120
|
-
});
|
120
|
+
S('[' + this.attr_name() +']', this.scope).each(bind);
|
121
121
|
}
|
122
122
|
// # Patch to fix #5043 to move this *after* the if/else clause in order for Backbone and similar frameworks to have improved control over event binding and data-options updating.
|
123
123
|
if (typeof method === 'string') {
|
@@ -155,42 +155,52 @@
|
|
155
155
|
}
|
156
156
|
};
|
157
157
|
|
158
|
-
|
159
|
-
https://github.com/paulirish/matchMedia.js
|
160
|
-
*/
|
158
|
+
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */
|
161
159
|
|
162
|
-
window.matchMedia
|
160
|
+
window.matchMedia || (window.matchMedia = function() {
|
161
|
+
"use strict";
|
163
162
|
|
164
|
-
|
163
|
+
// For browsers that support matchMedium api such as IE 9 and webkit
|
164
|
+
var styleMedia = (window.styleMedia || window.media);
|
165
165
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
div = doc.createElement( 'div' );
|
166
|
+
// For those that don't support matchMedium
|
167
|
+
if (!styleMedia) {
|
168
|
+
var style = document.createElement('style'),
|
169
|
+
script = document.getElementsByTagName('script')[0],
|
170
|
+
info = null;
|
172
171
|
|
173
|
-
|
174
|
-
|
175
|
-
fakeBody.style.background = 'none';
|
176
|
-
fakeBody.appendChild(div);
|
172
|
+
style.type = 'text/css';
|
173
|
+
style.id = 'matchmediajs-test';
|
177
174
|
|
178
|
-
|
175
|
+
script.parentNode.insertBefore(style, script);
|
179
176
|
|
180
|
-
|
177
|
+
// 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
|
178
|
+
info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle;
|
181
179
|
|
182
|
-
|
183
|
-
|
184
|
-
|
180
|
+
styleMedia = {
|
181
|
+
matchMedium: function(media) {
|
182
|
+
var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }';
|
185
183
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
184
|
+
// 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
|
185
|
+
if (style.styleSheet) {
|
186
|
+
style.styleSheet.cssText = text;
|
187
|
+
} else {
|
188
|
+
style.textContent = text;
|
189
|
+
}
|
190
190
|
|
191
|
-
|
191
|
+
// Test if media query is true or false
|
192
|
+
return info.width === '1px';
|
193
|
+
}
|
194
|
+
};
|
195
|
+
}
|
192
196
|
|
193
|
-
|
197
|
+
return function(media) {
|
198
|
+
return {
|
199
|
+
matches: styleMedia.matchMedium(media || 'all'),
|
200
|
+
media: media || 'all'
|
201
|
+
};
|
202
|
+
};
|
203
|
+
}());
|
194
204
|
|
195
205
|
/*
|
196
206
|
* jquery.requestAnimationFrame
|
@@ -203,6 +213,7 @@
|
|
203
213
|
|
204
214
|
(function(jQuery) {
|
205
215
|
|
216
|
+
|
206
217
|
// requestAnimationFrame polyfill adapted from Erik Möller
|
207
218
|
// fixes from Paul Irish and Tino Zijdel
|
208
219
|
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
|
@@ -269,7 +280,6 @@
|
|
269
280
|
|
270
281
|
}( $ ));
|
271
282
|
|
272
|
-
|
273
283
|
function removeQuotes (string) {
|
274
284
|
if (typeof string === 'string' || string instanceof String) {
|
275
285
|
string = string.replace(/^['\\/"]+|(;\s?})+|['\\/"]+$/g, '');
|
@@ -278,27 +288,36 @@
|
|
278
288
|
return string;
|
279
289
|
}
|
280
290
|
|
291
|
+
function MediaQuery(selector) {
|
292
|
+
this.selector = selector;
|
293
|
+
this.query = '';
|
294
|
+
}
|
295
|
+
|
296
|
+
MediaQuery.prototype.toString = function () {
|
297
|
+
return this.query || (this.query = S(this.selector).css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''));
|
298
|
+
};
|
299
|
+
|
281
300
|
window.Foundation = {
|
282
301
|
name : 'Foundation',
|
283
302
|
|
284
|
-
version : '5.5.
|
303
|
+
version : '5.5.3',
|
285
304
|
|
286
305
|
media_queries : {
|
287
|
-
'small' :
|
288
|
-
'small-only' :
|
289
|
-
'medium' :
|
290
|
-
'medium-only' :
|
291
|
-
'large' :
|
292
|
-
'large-only' :
|
293
|
-
'xlarge' :
|
294
|
-
'xlarge-only' :
|
295
|
-
'xxlarge' :
|
306
|
+
'small' : new MediaQuery('.foundation-mq-small'),
|
307
|
+
'small-only' : new MediaQuery('.foundation-mq-small-only'),
|
308
|
+
'medium' : new MediaQuery('.foundation-mq-medium'),
|
309
|
+
'medium-only' : new MediaQuery('.foundation-mq-medium-only'),
|
310
|
+
'large' : new MediaQuery('.foundation-mq-large'),
|
311
|
+
'large-only' : new MediaQuery('.foundation-mq-large-only'),
|
312
|
+
'xlarge' : new MediaQuery('.foundation-mq-xlarge'),
|
313
|
+
'xlarge-only' : new MediaQuery('.foundation-mq-xlarge-only'),
|
314
|
+
'xxlarge' : new MediaQuery('.foundation-mq-xxlarge')
|
296
315
|
},
|
297
316
|
|
298
317
|
stylesheet : $('<style></style>').appendTo('head')[0].sheet,
|
299
318
|
|
300
|
-
global: {
|
301
|
-
namespace: undefined
|
319
|
+
global : {
|
320
|
+
namespace : undefined
|
302
321
|
},
|
303
322
|
|
304
323
|
init : function (scope, libraries, method, options, response) {
|
@@ -323,7 +342,7 @@
|
|
323
342
|
}
|
324
343
|
}
|
325
344
|
|
326
|
-
S(window).load(function(){
|
345
|
+
S(window).load(function () {
|
327
346
|
S(window)
|
328
347
|
.trigger('resize.fndtn.clearing')
|
329
348
|
.trigger('resize.fndtn.dropdown')
|
@@ -345,8 +364,7 @@
|
|
345
364
|
if (args && args.hasOwnProperty(lib)) {
|
346
365
|
if (typeof this.libs[lib].settings !== 'undefined') {
|
347
366
|
$.extend(true, this.libs[lib].settings, args[lib]);
|
348
|
-
}
|
349
|
-
else if (typeof this.libs[lib].defaults !== 'undefined') {
|
367
|
+
} else if (typeof this.libs[lib].defaults !== 'undefined') {
|
350
368
|
$.extend(true, this.libs[lib].defaults, args[lib]);
|
351
369
|
}
|
352
370
|
return this.libs[lib].init.apply(this.libs[lib], [this.scope, args[lib]]);
|
@@ -381,7 +399,7 @@
|
|
381
399
|
}
|
382
400
|
},
|
383
401
|
|
384
|
-
set_namespace: function () {
|
402
|
+
set_namespace : function () {
|
385
403
|
|
386
404
|
// Description:
|
387
405
|
// Don't bother reading the namespace out of the meta tag
|
@@ -469,12 +487,16 @@
|
|
469
487
|
var context = this, args = arguments;
|
470
488
|
var later = function () {
|
471
489
|
timeout = null;
|
472
|
-
if (!immediate)
|
490
|
+
if (!immediate) {
|
491
|
+
result = func.apply(context, args);
|
492
|
+
}
|
473
493
|
};
|
474
494
|
var callNow = immediate && !timeout;
|
475
495
|
clearTimeout(timeout);
|
476
496
|
timeout = setTimeout(later, delay);
|
477
|
-
if (callNow)
|
497
|
+
if (callNow) {
|
498
|
+
result = func.apply(context, args);
|
499
|
+
}
|
478
500
|
return result;
|
479
501
|
};
|
480
502
|
},
|
@@ -511,11 +533,13 @@
|
|
511
533
|
ii = opts_arr.length;
|
512
534
|
|
513
535
|
function isNumber (o) {
|
514
|
-
return !
|
536
|
+
return !isNaN (o - 0) && o !== null && o !== '' && o !== false && o !== true;
|
515
537
|
}
|
516
538
|
|
517
539
|
function trim (str) {
|
518
|
-
if (typeof str === 'string')
|
540
|
+
if (typeof str === 'string') {
|
541
|
+
return $.trim(str);
|
542
|
+
}
|
519
543
|
return str;
|
520
544
|
}
|
521
545
|
|
@@ -523,8 +547,12 @@
|
|
523
547
|
p = opts_arr[ii].split(':');
|
524
548
|
p = [p[0], p.slice(1).join(':')];
|
525
549
|
|
526
|
-
if (/true/i.test(p[1]))
|
527
|
-
|
550
|
+
if (/true/i.test(p[1])) {
|
551
|
+
p[1] = true;
|
552
|
+
}
|
553
|
+
if (/false/i.test(p[1])) {
|
554
|
+
p[1] = false;
|
555
|
+
}
|
528
556
|
if (isNumber(p[1])) {
|
529
557
|
if (p[1].indexOf('.') === -1) {
|
530
558
|
p[1] = parseInt(p[1], 10);
|
@@ -550,7 +578,7 @@
|
|
550
578
|
//
|
551
579
|
// Class (String): Class name for the generated <meta> tag
|
552
580
|
register_media : function (media, media_class) {
|
553
|
-
if(Foundation.media_queries[media] === undefined) {
|
581
|
+
if (Foundation.media_queries[media] === undefined) {
|
554
582
|
$('head').append('<meta class="' + media_class + '"/>');
|
555
583
|
Foundation.media_queries[media] = removeQuotes($('.' + media_class).css('font-family'));
|
556
584
|
}
|
@@ -572,7 +600,7 @@
|
|
572
600
|
|
573
601
|
if (query !== undefined) {
|
574
602
|
Foundation.stylesheet.insertRule('@media ' +
|
575
|
-
Foundation.media_queries[media] + '{ ' + rule + ' }');
|
603
|
+
Foundation.media_queries[media] + '{ ' + rule + ' }', Foundation.stylesheet.cssRules.length);
|
576
604
|
}
|
577
605
|
}
|
578
606
|
},
|
@@ -588,7 +616,19 @@
|
|
588
616
|
var self = this,
|
589
617
|
unloaded = images.length;
|
590
618
|
|
591
|
-
|
619
|
+
function pictures_has_height(images) {
|
620
|
+
var pictures_number = images.length;
|
621
|
+
|
622
|
+
for (var i = pictures_number - 1; i >= 0; i--) {
|
623
|
+
if(images.attr('height') === undefined) {
|
624
|
+
return false;
|
625
|
+
};
|
626
|
+
};
|
627
|
+
|
628
|
+
return true;
|
629
|
+
}
|
630
|
+
|
631
|
+
if (unloaded === 0 || pictures_has_height(images)) {
|
592
632
|
callback(images);
|
593
633
|
}
|
594
634
|
|
@@ -612,7 +652,9 @@
|
|
612
652
|
// Returns:
|
613
653
|
// Rand (String): Pseudo-random, alphanumeric string.
|
614
654
|
random_str : function () {
|
615
|
-
if (!this.fidx)
|
655
|
+
if (!this.fidx) {
|
656
|
+
this.fidx = 0;
|
657
|
+
}
|
616
658
|
this.prefix = this.prefix || [(this.name || 'F'), (+new Date).toString(36)].join('-');
|
617
659
|
|
618
660
|
return this.prefix + (this.fidx++).toString(36);
|
@@ -4,17 +4,17 @@
|
|
4
4
|
Foundation.libs['magellan-expedition'] = {
|
5
5
|
name : 'magellan-expedition',
|
6
6
|
|
7
|
-
version : '5.5.
|
7
|
+
version : '5.5.3',
|
8
8
|
|
9
9
|
settings : {
|
10
|
-
active_class: 'active',
|
11
|
-
threshold: 0, // pixels from the top of the expedition for it to become fixes
|
12
|
-
destination_threshold: 20, // pixels from the top of destination for it to be considered active
|
13
|
-
throttle_delay: 30, // calculation throttling to increase framerate
|
14
|
-
fixed_top: 0, // top distance in pixels assigend to the fixed element on scroll
|
15
|
-
offset_by_height: true, // whether to offset the destination by the expedition height. Usually you want this to be true, unless your expedition is on the side.
|
16
|
-
duration: 700, // animation duration time
|
17
|
-
easing: 'swing' // animation easing
|
10
|
+
active_class : 'active',
|
11
|
+
threshold : 0, // pixels from the top of the expedition for it to become fixes
|
12
|
+
destination_threshold : 20, // pixels from the top of destination for it to be considered active
|
13
|
+
throttle_delay : 30, // calculation throttling to increase framerate
|
14
|
+
fixed_top : 0, // top distance in pixels assigend to the fixed element on scroll
|
15
|
+
offset_by_height : true, // whether to offset the destination by the expedition height. Usually you want this to be true, unless your expedition is on the side.
|
16
|
+
duration : 700, // animation duration time
|
17
|
+
easing : 'swing' // animation easing
|
18
18
|
},
|
19
19
|
|
20
20
|
init : function (scope, method, options) {
|
@@ -32,51 +32,52 @@
|
|
32
32
|
|
33
33
|
S(self.scope)
|
34
34
|
.off('.magellan')
|
35
|
-
.on('click.fndtn.magellan', '[' + self.add_namespace('data-magellan-arrival') + '] a[href
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
35
|
+
.on('click.fndtn.magellan', '[' + self.add_namespace('data-magellan-arrival') + '] a[href*=#]', function (e) {
|
36
|
+
var sameHost = ((this.hostname === location.hostname) || !this.hostname),
|
37
|
+
samePath = self.filterPathname(location.pathname) === self.filterPathname(this.pathname),
|
38
|
+
testHash = this.hash.replace(/(:|\.|\/)/g, '\\$1'),
|
39
|
+
anchor = this;
|
40
|
+
|
41
|
+
if (sameHost && samePath && testHash) {
|
42
|
+
e.preventDefault();
|
43
|
+
var expedition = $(this).closest('[' + self.attr_name() + ']'),
|
44
|
+
settings = expedition.data('magellan-expedition-init'),
|
45
|
+
hash = this.hash.split('#').join(''),
|
46
|
+
target = $('a[name="' + hash + '"]');
|
47
|
+
|
48
|
+
if (target.length === 0) {
|
49
|
+
target = $('#' + hash);
|
41
50
|
|
42
|
-
if (target.length === 0) {
|
43
|
-
target = $('#'+hash);
|
44
|
-
|
45
|
-
}
|
46
|
-
|
47
|
-
|
48
|
-
// Account for expedition height if fixed position
|
49
|
-
var scroll_top = target.offset().top - settings.destination_threshold + 1;
|
50
|
-
if (settings.offset_by_height) {
|
51
|
-
scroll_top = scroll_top - expedition.outerHeight();
|
52
|
-
}
|
53
|
-
|
54
|
-
$('html, body').stop().animate({
|
55
|
-
'scrollTop': scroll_top
|
56
|
-
}, settings.duration, settings.easing, function () {
|
57
|
-
if(history.pushState) {
|
58
|
-
history.pushState(null, null, '#'+hash);
|
59
51
|
}
|
60
|
-
|
61
|
-
|
52
|
+
|
53
|
+
// Account for expedition height if fixed position
|
54
|
+
var scroll_top = target.offset().top - settings.destination_threshold + 1;
|
55
|
+
if (settings.offset_by_height) {
|
56
|
+
scroll_top = scroll_top - expedition.outerHeight();
|
62
57
|
}
|
63
|
-
|
58
|
+
$('html, body').stop().animate({
|
59
|
+
'scrollTop' : scroll_top
|
60
|
+
}, settings.duration, settings.easing, function () {
|
61
|
+
if (history.pushState) {
|
62
|
+
history.pushState(null, null, anchor.pathname + anchor.search + '#' + hash);
|
63
|
+
} else {
|
64
|
+
location.hash = anchor.pathname + anchor.search + '#' + hash;
|
65
|
+
}
|
66
|
+
});
|
67
|
+
}
|
64
68
|
})
|
65
69
|
.on('scroll.fndtn.magellan', self.throttle(this.check_for_arrivals.bind(this), settings.throttle_delay));
|
66
|
-
|
67
|
-
$(window)
|
68
|
-
.on('resize.fndtn.magellan', self.throttle(this.set_expedition_position.bind(this), settings.throttle_delay));
|
69
70
|
},
|
70
71
|
|
71
|
-
check_for_arrivals : function() {
|
72
|
+
check_for_arrivals : function () {
|
72
73
|
var self = this;
|
73
74
|
self.update_arrivals();
|
74
75
|
self.update_expedition_positions();
|
75
76
|
},
|
76
77
|
|
77
|
-
set_expedition_position : function() {
|
78
|
+
set_expedition_position : function () {
|
78
79
|
var self = this;
|
79
|
-
$('[' + this.attr_name() + '=fixed]', self.scope).each(function(idx, el) {
|
80
|
+
$('[' + this.attr_name() + '=fixed]', self.scope).each(function (idx, el) {
|
80
81
|
var expedition = $(this),
|
81
82
|
settings = expedition.data('magellan-expedition-init'),
|
82
83
|
styles = expedition.attr('styles'), // save styles
|
@@ -87,54 +88,55 @@
|
|
87
88
|
|
88
89
|
//set fixed-top by attribute
|
89
90
|
fixed_top = parseInt(expedition.data('magellan-fixed-top'));
|
90
|
-
if(!isNaN(fixed_top))
|
91
|
-
|
91
|
+
if (!isNaN(fixed_top)) {
|
92
|
+
self.settings.fixed_top = fixed_top;
|
93
|
+
}
|
92
94
|
|
93
95
|
expedition.data(self.data_attr('magellan-top-offset'), top_offset);
|
94
96
|
expedition.attr('style', styles);
|
95
97
|
});
|
96
98
|
},
|
97
99
|
|
98
|
-
update_expedition_positions : function() {
|
100
|
+
update_expedition_positions : function () {
|
99
101
|
var self = this,
|
100
102
|
window_top_offset = $(window).scrollTop();
|
101
103
|
|
102
|
-
$('[' + this.attr_name() + '=fixed]', self.scope).each(function() {
|
104
|
+
$('[' + this.attr_name() + '=fixed]', self.scope).each(function () {
|
103
105
|
var expedition = $(this),
|
104
106
|
settings = expedition.data('magellan-expedition-init'),
|
105
107
|
styles = expedition.attr('style'), // save styles
|
106
108
|
top_offset = expedition.data('magellan-top-offset');
|
107
109
|
|
108
110
|
//scroll to the top distance
|
109
|
-
if (window_top_offset+self.settings.fixed_top >= top_offset) {
|
111
|
+
if (window_top_offset + self.settings.fixed_top >= top_offset) {
|
110
112
|
// Placeholder allows height calculations to be consistent even when
|
111
113
|
// appearing to switch between fixed/non-fixed placement
|
112
114
|
var placeholder = expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']');
|
113
115
|
if (placeholder.length === 0) {
|
114
116
|
placeholder = expedition.clone();
|
115
117
|
placeholder.removeAttr(self.attr_name());
|
116
|
-
placeholder.attr(self.add_namespace('data-magellan-expedition-clone'),'');
|
118
|
+
placeholder.attr(self.add_namespace('data-magellan-expedition-clone'), '');
|
117
119
|
expedition.before(placeholder);
|
118
120
|
}
|
119
|
-
expedition.css({position:'fixed', top: settings.fixed_top}).addClass('fixed');
|
121
|
+
expedition.css({position :'fixed', top : settings.fixed_top}).addClass('fixed');
|
120
122
|
} else {
|
121
123
|
expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']').remove();
|
122
|
-
expedition.attr('style',styles).css('position','').css('top','').removeClass('fixed');
|
124
|
+
expedition.attr('style', styles).css('position', '').css('top', '').removeClass('fixed');
|
123
125
|
}
|
124
126
|
});
|
125
127
|
},
|
126
128
|
|
127
|
-
update_arrivals : function() {
|
129
|
+
update_arrivals : function () {
|
128
130
|
var self = this,
|
129
131
|
window_top_offset = $(window).scrollTop();
|
130
132
|
|
131
|
-
$('[' + this.attr_name() + ']', self.scope).each(function() {
|
133
|
+
$('[' + this.attr_name() + ']', self.scope).each(function () {
|
132
134
|
var expedition = $(this),
|
133
135
|
settings = expedition.data(self.attr_name(true) + '-init'),
|
134
136
|
offsets = self.offsets(expedition, window_top_offset),
|
135
137
|
arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']'),
|
136
138
|
active_item = false;
|
137
|
-
offsets.each(function(idx, item) {
|
139
|
+
offsets.each(function (idx, item) {
|
138
140
|
if (item.viewport_offset >= item.top_offset) {
|
139
141
|
var arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']');
|
140
142
|
arrivals.not(item.arrival).removeClass(settings.active_class);
|
@@ -144,16 +146,18 @@
|
|
144
146
|
}
|
145
147
|
});
|
146
148
|
|
147
|
-
if (!active_item)
|
149
|
+
if (!active_item) {
|
150
|
+
arrivals.removeClass(settings.active_class);
|
151
|
+
}
|
148
152
|
});
|
149
153
|
},
|
150
154
|
|
151
|
-
offsets : function(expedition, window_offset) {
|
155
|
+
offsets : function (expedition, window_offset) {
|
152
156
|
var self = this,
|
153
157
|
settings = expedition.data(self.attr_name(true) + '-init'),
|
154
158
|
viewport_offset = window_offset;
|
155
159
|
|
156
|
-
return expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']').map(function(idx, el) {
|
160
|
+
return expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']').map(function (idx, el) {
|
157
161
|
var name = $(this).data(self.data_attr('magellan-arrival')),
|
158
162
|
dest = $('[' + self.add_namespace('data-magellan-destination') + '=' + name + ']');
|
159
163
|
if (dest.length > 0) {
|
@@ -169,14 +173,18 @@
|
|
169
173
|
viewport_offset : viewport_offset
|
170
174
|
}
|
171
175
|
}
|
172
|
-
}).sort(function(a, b) {
|
173
|
-
if (a.top_offset < b.top_offset)
|
174
|
-
|
176
|
+
}).sort(function (a, b) {
|
177
|
+
if (a.top_offset < b.top_offset) {
|
178
|
+
return -1;
|
179
|
+
}
|
180
|
+
if (a.top_offset > b.top_offset) {
|
181
|
+
return 1;
|
182
|
+
}
|
175
183
|
return 0;
|
176
184
|
});
|
177
185
|
},
|
178
186
|
|
179
|
-
data_attr: function (str) {
|
187
|
+
data_attr : function (str) {
|
180
188
|
if (this.namespace.length > 0) {
|
181
189
|
return this.namespace + '-' + str;
|
182
190
|
}
|
@@ -189,6 +197,14 @@
|
|
189
197
|
this.S(window).off('.magellan');
|
190
198
|
},
|
191
199
|
|
200
|
+
filterPathname : function (pathname) {
|
201
|
+
pathname = pathname || '';
|
202
|
+
return pathname
|
203
|
+
.replace(/^\//,'')
|
204
|
+
.replace(/(?:index|default).[a-zA-Z]{3,4}$/,'')
|
205
|
+
.replace(/\/$/,'');
|
206
|
+
},
|
207
|
+
|
192
208
|
reflow : function () {
|
193
209
|
var self = this;
|
194
210
|
// remove placeholder expeditions used for height calculation purposes
|