faker_maker 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/faker_maker.gemspec +2 -2
- data/lib/faker_maker/version.rb +1 -1
- data/lib/faker_maker.rb +1 -0
- data/usefakermaker.com/_site/404.html +213 -0
- data/usefakermaker.com/_site/about/index.html +10 -0
- data/usefakermaker.com/_site/assets/css/main.css +6 -0
- data/usefakermaker.com/_site/assets/css/main.css.map +1 -0
- data/usefakermaker.com/_site/assets/images/pug.png +0 -0
- data/usefakermaker.com/_site/assets/images/unipug.svg +135 -0
- data/usefakermaker.com/_site/assets/js/_main.js +230 -0
- data/usefakermaker.com/_site/assets/js/lunr/lunr-en.js +69 -0
- data/usefakermaker.com/_site/assets/js/lunr/lunr-gr.js +522 -0
- data/usefakermaker.com/_site/assets/js/lunr/lunr-store.js +10 -0
- data/usefakermaker.com/_site/assets/js/lunr/lunr.js +3475 -0
- data/usefakermaker.com/_site/assets/js/lunr/lunr.min.js +6 -0
- data/usefakermaker.com/_site/assets/js/main.min.js +7 -0
- data/usefakermaker.com/_site/assets/js/main.min.js.map +1 -0
- data/usefakermaker.com/_site/assets/js/plugins/gumshoe.js +484 -0
- data/usefakermaker.com/_site/assets/js/plugins/jquery.ba-throttle-debounce.js +252 -0
- data/usefakermaker.com/_site/assets/js/plugins/jquery.fitvids.js +82 -0
- data/usefakermaker.com/_site/assets/js/plugins/jquery.greedy-navigation.js +128 -0
- data/usefakermaker.com/_site/assets/js/plugins/jquery.magnific-popup.js +1860 -0
- data/usefakermaker.com/_site/assets/js/plugins/smooth-scroll.js +650 -0
- data/usefakermaker.com/_site/assets/js/vendor/jquery/jquery-3.6.0.js +10881 -0
- data/usefakermaker.com/_site/feed.xml +17 -0
- data/usefakermaker.com/_site/index.html +258 -0
- data/usefakermaker.com/_site/jekyll/update/welcome-to-jekyll/index.html +18 -0
- data/usefakermaker.com/_site/robots.txt +1 -0
- data/usefakermaker.com/_site/sitemap.xml +13 -0
- metadata +33 -7
@@ -0,0 +1,252 @@
|
|
1
|
+
/*!
|
2
|
+
* jQuery throttle / debounce - v1.1 - 3/7/2010
|
3
|
+
* http://benalman.com/projects/jquery-throttle-debounce-plugin/
|
4
|
+
*
|
5
|
+
* Copyright (c) 2010 "Cowboy" Ben Alman
|
6
|
+
* Dual licensed under the MIT and GPL licenses.
|
7
|
+
* http://benalman.com/about/license/
|
8
|
+
*/
|
9
|
+
|
10
|
+
// Script: jQuery throttle / debounce: Sometimes, less is more!
|
11
|
+
//
|
12
|
+
// *Version: 1.1, Last updated: 3/7/2010*
|
13
|
+
//
|
14
|
+
// Project Home - http://benalman.com/projects/jquery-throttle-debounce-plugin/
|
15
|
+
// GitHub - http://github.com/cowboy/jquery-throttle-debounce/
|
16
|
+
// Source - http://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.js
|
17
|
+
// (Minified) - http://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.min.js (0.7kb)
|
18
|
+
//
|
19
|
+
// About: License
|
20
|
+
//
|
21
|
+
// Copyright (c) 2010 "Cowboy" Ben Alman,
|
22
|
+
// Dual licensed under the MIT and GPL licenses.
|
23
|
+
// http://benalman.com/about/license/
|
24
|
+
//
|
25
|
+
// About: Examples
|
26
|
+
//
|
27
|
+
// These working examples, complete with fully commented code, illustrate a few
|
28
|
+
// ways in which this plugin can be used.
|
29
|
+
//
|
30
|
+
// Throttle - http://benalman.com/code/projects/jquery-throttle-debounce/examples/throttle/
|
31
|
+
// Debounce - http://benalman.com/code/projects/jquery-throttle-debounce/examples/debounce/
|
32
|
+
//
|
33
|
+
// About: Support and Testing
|
34
|
+
//
|
35
|
+
// Information about what version or versions of jQuery this plugin has been
|
36
|
+
// tested with, what browsers it has been tested in, and where the unit tests
|
37
|
+
// reside (so you can test it yourself).
|
38
|
+
//
|
39
|
+
// jQuery Versions - none, 1.3.2, 1.4.2
|
40
|
+
// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome 4-5, Opera 9.6-10.1.
|
41
|
+
// Unit Tests - http://benalman.com/code/projects/jquery-throttle-debounce/unit/
|
42
|
+
//
|
43
|
+
// About: Release History
|
44
|
+
//
|
45
|
+
// 1.1 - (3/7/2010) Fixed a bug in <jQuery.throttle> where trailing callbacks
|
46
|
+
// executed later than they should. Reworked a fair amount of internal
|
47
|
+
// logic as well.
|
48
|
+
// 1.0 - (3/6/2010) Initial release as a stand-alone project. Migrated over
|
49
|
+
// from jquery-misc repo v0.4 to jquery-throttle repo v1.0, added the
|
50
|
+
// no_trailing throttle parameter and debounce functionality.
|
51
|
+
//
|
52
|
+
// Topic: Note for non-jQuery users
|
53
|
+
//
|
54
|
+
// jQuery isn't actually required for this plugin, because nothing internal
|
55
|
+
// uses any jQuery methods or properties. jQuery is just used as a namespace
|
56
|
+
// under which these methods can exist.
|
57
|
+
//
|
58
|
+
// Since jQuery isn't actually required for this plugin, if jQuery doesn't exist
|
59
|
+
// when this plugin is loaded, the method described below will be created in
|
60
|
+
// the `Cowboy` namespace. Usage will be exactly the same, but instead of
|
61
|
+
// $.method() or jQuery.method(), you'll need to use Cowboy.method().
|
62
|
+
|
63
|
+
(function(window,undefined){
|
64
|
+
'$:nomunge'; // Used by YUI compressor.
|
65
|
+
|
66
|
+
// Since jQuery really isn't required for this plugin, use `jQuery` as the
|
67
|
+
// namespace only if it already exists, otherwise use the `Cowboy` namespace,
|
68
|
+
// creating it if necessary.
|
69
|
+
var $ = window.jQuery || window.Cowboy || ( window.Cowboy = {} ),
|
70
|
+
|
71
|
+
// Internal method reference.
|
72
|
+
jq_throttle;
|
73
|
+
|
74
|
+
// Method: jQuery.throttle
|
75
|
+
//
|
76
|
+
// Throttle execution of a function. Especially useful for rate limiting
|
77
|
+
// execution of handlers on events like resize and scroll. If you want to
|
78
|
+
// rate-limit execution of a function to a single time, see the
|
79
|
+
// <jQuery.debounce> method.
|
80
|
+
//
|
81
|
+
// In this visualization, | is a throttled-function call and X is the actual
|
82
|
+
// callback execution:
|
83
|
+
//
|
84
|
+
// > Throttled with `no_trailing` specified as false or unspecified:
|
85
|
+
// > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
|
86
|
+
// > X X X X X X X X X X X X
|
87
|
+
// >
|
88
|
+
// > Throttled with `no_trailing` specified as true:
|
89
|
+
// > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
|
90
|
+
// > X X X X X X X X X X
|
91
|
+
//
|
92
|
+
// Usage:
|
93
|
+
//
|
94
|
+
// > var throttled = jQuery.throttle( delay, [ no_trailing, ] callback );
|
95
|
+
// >
|
96
|
+
// > jQuery('selector').bind( 'someevent', throttled );
|
97
|
+
// > jQuery('selector').unbind( 'someevent', throttled );
|
98
|
+
//
|
99
|
+
// This also works in jQuery 1.4+:
|
100
|
+
//
|
101
|
+
// > jQuery('selector').bind( 'someevent', jQuery.throttle( delay, [ no_trailing, ] callback ) );
|
102
|
+
// > jQuery('selector').unbind( 'someevent', callback );
|
103
|
+
//
|
104
|
+
// Arguments:
|
105
|
+
//
|
106
|
+
// delay - (Number) A zero-or-greater delay in milliseconds. For event
|
107
|
+
// callbacks, values around 100 or 250 (or even higher) are most useful.
|
108
|
+
// no_trailing - (Boolean) Optional, defaults to false. If no_trailing is
|
109
|
+
// true, callback will only execute every `delay` milliseconds while the
|
110
|
+
// throttled-function is being called. If no_trailing is false or
|
111
|
+
// unspecified, callback will be executed one final time after the last
|
112
|
+
// throttled-function call. (After the throttled-function has not been
|
113
|
+
// called for `delay` milliseconds, the internal counter is reset)
|
114
|
+
// callback - (Function) A function to be executed after delay milliseconds.
|
115
|
+
// The `this` context and all arguments are passed through, as-is, to
|
116
|
+
// `callback` when the throttled-function is executed.
|
117
|
+
//
|
118
|
+
// Returns:
|
119
|
+
//
|
120
|
+
// (Function) A new, throttled, function.
|
121
|
+
|
122
|
+
$.throttle = jq_throttle = function( delay, no_trailing, callback, debounce_mode ) {
|
123
|
+
// After wrapper has stopped being called, this timeout ensures that
|
124
|
+
// `callback` is executed at the proper times in `throttle` and `end`
|
125
|
+
// debounce modes.
|
126
|
+
var timeout_id,
|
127
|
+
|
128
|
+
// Keep track of the last time `callback` was executed.
|
129
|
+
last_exec = 0;
|
130
|
+
|
131
|
+
// `no_trailing` defaults to falsy.
|
132
|
+
if ( typeof no_trailing !== 'boolean' ) {
|
133
|
+
debounce_mode = callback;
|
134
|
+
callback = no_trailing;
|
135
|
+
no_trailing = undefined;
|
136
|
+
}
|
137
|
+
|
138
|
+
// The `wrapper` function encapsulates all of the throttling / debouncing
|
139
|
+
// functionality and when executed will limit the rate at which `callback`
|
140
|
+
// is executed.
|
141
|
+
function wrapper() {
|
142
|
+
var that = this,
|
143
|
+
elapsed = +new Date() - last_exec,
|
144
|
+
args = arguments;
|
145
|
+
|
146
|
+
// Execute `callback` and update the `last_exec` timestamp.
|
147
|
+
function exec() {
|
148
|
+
last_exec = +new Date();
|
149
|
+
callback.apply( that, args );
|
150
|
+
};
|
151
|
+
|
152
|
+
// If `debounce_mode` is true (at_begin) this is used to clear the flag
|
153
|
+
// to allow future `callback` executions.
|
154
|
+
function clear() {
|
155
|
+
timeout_id = undefined;
|
156
|
+
};
|
157
|
+
|
158
|
+
if ( debounce_mode && !timeout_id ) {
|
159
|
+
// Since `wrapper` is being called for the first time and
|
160
|
+
// `debounce_mode` is true (at_begin), execute `callback`.
|
161
|
+
exec();
|
162
|
+
}
|
163
|
+
|
164
|
+
// Clear any existing timeout.
|
165
|
+
timeout_id && clearTimeout( timeout_id );
|
166
|
+
|
167
|
+
if ( debounce_mode === undefined && elapsed > delay ) {
|
168
|
+
// In throttle mode, if `delay` time has been exceeded, execute
|
169
|
+
// `callback`.
|
170
|
+
exec();
|
171
|
+
|
172
|
+
} else if ( no_trailing !== true ) {
|
173
|
+
// In trailing throttle mode, since `delay` time has not been
|
174
|
+
// exceeded, schedule `callback` to execute `delay` ms after most
|
175
|
+
// recent execution.
|
176
|
+
//
|
177
|
+
// If `debounce_mode` is true (at_begin), schedule `clear` to execute
|
178
|
+
// after `delay` ms.
|
179
|
+
//
|
180
|
+
// If `debounce_mode` is false (at end), schedule `callback` to
|
181
|
+
// execute after `delay` ms.
|
182
|
+
timeout_id = setTimeout( debounce_mode ? clear : exec, debounce_mode === undefined ? delay - elapsed : delay );
|
183
|
+
}
|
184
|
+
};
|
185
|
+
|
186
|
+
// Set the guid of `wrapper` function to the same of original callback, so
|
187
|
+
// it can be removed in jQuery 1.4+ .unbind or .die by using the original
|
188
|
+
// callback as a reference.
|
189
|
+
if ( $.guid ) {
|
190
|
+
wrapper.guid = callback.guid = callback.guid || $.guid++;
|
191
|
+
}
|
192
|
+
|
193
|
+
// Return the wrapper function.
|
194
|
+
return wrapper;
|
195
|
+
};
|
196
|
+
|
197
|
+
// Method: jQuery.debounce
|
198
|
+
//
|
199
|
+
// Debounce execution of a function. Debouncing, unlike throttling,
|
200
|
+
// guarantees that a function is only executed a single time, either at the
|
201
|
+
// very beginning of a series of calls, or at the very end. If you want to
|
202
|
+
// simply rate-limit execution of a function, see the <jQuery.throttle>
|
203
|
+
// method.
|
204
|
+
//
|
205
|
+
// In this visualization, | is a debounced-function call and X is the actual
|
206
|
+
// callback execution:
|
207
|
+
//
|
208
|
+
// > Debounced with `at_begin` specified as false or unspecified:
|
209
|
+
// > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
|
210
|
+
// > X X
|
211
|
+
// >
|
212
|
+
// > Debounced with `at_begin` specified as true:
|
213
|
+
// > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
|
214
|
+
// > X X
|
215
|
+
//
|
216
|
+
// Usage:
|
217
|
+
//
|
218
|
+
// > var debounced = jQuery.debounce( delay, [ at_begin, ] callback );
|
219
|
+
// >
|
220
|
+
// > jQuery('selector').bind( 'someevent', debounced );
|
221
|
+
// > jQuery('selector').unbind( 'someevent', debounced );
|
222
|
+
//
|
223
|
+
// This also works in jQuery 1.4+:
|
224
|
+
//
|
225
|
+
// > jQuery('selector').bind( 'someevent', jQuery.debounce( delay, [ at_begin, ] callback ) );
|
226
|
+
// > jQuery('selector').unbind( 'someevent', callback );
|
227
|
+
//
|
228
|
+
// Arguments:
|
229
|
+
//
|
230
|
+
// delay - (Number) A zero-or-greater delay in milliseconds. For event
|
231
|
+
// callbacks, values around 100 or 250 (or even higher) are most useful.
|
232
|
+
// at_begin - (Boolean) Optional, defaults to false. If at_begin is false or
|
233
|
+
// unspecified, callback will only be executed `delay` milliseconds after
|
234
|
+
// the last debounced-function call. If at_begin is true, callback will be
|
235
|
+
// executed only at the first debounced-function call. (After the
|
236
|
+
// throttled-function has not been called for `delay` milliseconds, the
|
237
|
+
// internal counter is reset)
|
238
|
+
// callback - (Function) A function to be executed after delay milliseconds.
|
239
|
+
// The `this` context and all arguments are passed through, as-is, to
|
240
|
+
// `callback` when the debounced-function is executed.
|
241
|
+
//
|
242
|
+
// Returns:
|
243
|
+
//
|
244
|
+
// (Function) A new, debounced, function.
|
245
|
+
|
246
|
+
$.debounce = function( delay, at_begin, callback ) {
|
247
|
+
return callback === undefined
|
248
|
+
? jq_throttle( delay, at_begin, false )
|
249
|
+
: jq_throttle( delay, callback, at_begin !== false );
|
250
|
+
};
|
251
|
+
|
252
|
+
})(this);
|
@@ -0,0 +1,82 @@
|
|
1
|
+
/*jshint browser:true */
|
2
|
+
/*!
|
3
|
+
* FitVids 1.1
|
4
|
+
*
|
5
|
+
* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
|
6
|
+
* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
|
7
|
+
* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
|
8
|
+
*
|
9
|
+
*/
|
10
|
+
|
11
|
+
;(function( $ ){
|
12
|
+
|
13
|
+
'use strict';
|
14
|
+
|
15
|
+
$.fn.fitVids = function( options ) {
|
16
|
+
var settings = {
|
17
|
+
customSelector: null,
|
18
|
+
ignore: null
|
19
|
+
};
|
20
|
+
|
21
|
+
if(!document.getElementById('fit-vids-style')) {
|
22
|
+
// appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js
|
23
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
24
|
+
var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
|
25
|
+
var div = document.createElement("div");
|
26
|
+
div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>';
|
27
|
+
head.appendChild(div.childNodes[1]);
|
28
|
+
}
|
29
|
+
|
30
|
+
if ( options ) {
|
31
|
+
$.extend( settings, options );
|
32
|
+
}
|
33
|
+
|
34
|
+
return this.each(function(){
|
35
|
+
var selectors = [
|
36
|
+
'iframe[src*="player.vimeo.com"]',
|
37
|
+
'iframe[src*="youtube.com"]',
|
38
|
+
'iframe[src*="youtube-nocookie.com"]',
|
39
|
+
'iframe[src*="kickstarter.com"][src*="video.html"]',
|
40
|
+
'object',
|
41
|
+
'embed'
|
42
|
+
];
|
43
|
+
|
44
|
+
if (settings.customSelector) {
|
45
|
+
selectors.push(settings.customSelector);
|
46
|
+
}
|
47
|
+
|
48
|
+
var ignoreList = '.fitvidsignore';
|
49
|
+
|
50
|
+
if(settings.ignore) {
|
51
|
+
ignoreList = ignoreList + ', ' + settings.ignore;
|
52
|
+
}
|
53
|
+
|
54
|
+
var $allVideos = $(this).find(selectors.join(','));
|
55
|
+
$allVideos = $allVideos.not('object object'); // SwfObj conflict patch
|
56
|
+
$allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video.
|
57
|
+
|
58
|
+
$allVideos.each(function(count){
|
59
|
+
var $this = $(this);
|
60
|
+
if($this.parents(ignoreList).length > 0) {
|
61
|
+
return; // Disable FitVids on this video.
|
62
|
+
}
|
63
|
+
if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
|
64
|
+
if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width'))))
|
65
|
+
{
|
66
|
+
$this.attr('height', 9);
|
67
|
+
$this.attr('width', 16);
|
68
|
+
}
|
69
|
+
var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
|
70
|
+
width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
|
71
|
+
aspectRatio = height / width;
|
72
|
+
if(!$this.attr('id')){
|
73
|
+
var videoID = 'fitvid' + count;
|
74
|
+
$this.attr('id', videoID);
|
75
|
+
}
|
76
|
+
$this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%');
|
77
|
+
$this.removeAttr('height').removeAttr('width');
|
78
|
+
});
|
79
|
+
});
|
80
|
+
};
|
81
|
+
// Works with either jQuery or Zepto
|
82
|
+
})( window.jQuery || window.Zepto );
|
@@ -0,0 +1,128 @@
|
|
1
|
+
/*
|
2
|
+
GreedyNav.js - https://github.com/lukejacksonn/GreedyNav
|
3
|
+
Licensed under the MIT license - http://opensource.org/licenses/MIT
|
4
|
+
Copyright (c) 2015 Luke Jackson http://lukejacksonn.com
|
5
|
+
*/
|
6
|
+
|
7
|
+
$(function() {
|
8
|
+
|
9
|
+
var $btn = $("nav.greedy-nav .greedy-nav__toggle");
|
10
|
+
var $vlinks = $("nav.greedy-nav .visible-links");
|
11
|
+
var $hlinks = $("nav.greedy-nav .hidden-links");
|
12
|
+
var $nav = $("nav.greedy-nav");
|
13
|
+
var $logo = $('nav.greedy-nav .site-logo');
|
14
|
+
var $logoImg = $('nav.greedy-nav .site-logo img');
|
15
|
+
var $title = $("nav.greedy-nav .site-title");
|
16
|
+
var $search = $('nav.greedy-nav button.search__toggle');
|
17
|
+
|
18
|
+
var numOfItems, totalSpace, closingTime, breakWidths;
|
19
|
+
|
20
|
+
// This function measures both hidden and visible links and sets the navbar breakpoints
|
21
|
+
// This is called the first time the script runs and everytime the "check()" function detects a change of window width that reached a different CSS width breakpoint, which affects the size of navbar Items
|
22
|
+
// Please note that "CSS width breakpoints" (which are only 4) !== "navbar breakpoints" (which are as many as the number of items on the navbar)
|
23
|
+
function measureLinks(){
|
24
|
+
numOfItems = 0;
|
25
|
+
totalSpace = 0;
|
26
|
+
closingTime = 1000;
|
27
|
+
breakWidths = [];
|
28
|
+
|
29
|
+
// Adds the width of a navItem in order to create breakpoints for the navbar
|
30
|
+
function addWidth(i, w) {
|
31
|
+
totalSpace += w;
|
32
|
+
numOfItems += 1;
|
33
|
+
breakWidths.push(totalSpace);
|
34
|
+
}
|
35
|
+
|
36
|
+
// Measures the width of hidden links by making a temporary clone of them and positioning under visible links
|
37
|
+
function hiddenWidth(obj){
|
38
|
+
var clone = obj.clone();
|
39
|
+
clone.css("visibility","hidden");
|
40
|
+
$vlinks.append(clone);
|
41
|
+
addWidth(0, clone.outerWidth());
|
42
|
+
clone.remove();
|
43
|
+
}
|
44
|
+
// Measure both visible and hidden links widths
|
45
|
+
$vlinks.children().outerWidth(addWidth);
|
46
|
+
$hlinks.children().each(function(){hiddenWidth($(this))});
|
47
|
+
}
|
48
|
+
// Get initial state
|
49
|
+
measureLinks();
|
50
|
+
|
51
|
+
var winWidth = $( window ).width();
|
52
|
+
// Set the last measured CSS width breakpoint: 0: <768px, 1: <1024px, 2: < 1280px, 3: >= 1280px.
|
53
|
+
var lastBreakpoint = winWidth < 768 ? 0 : winWidth < 1024 ? 1 : winWidth < 1280 ? 2 : 3;
|
54
|
+
|
55
|
+
var availableSpace, numOfVisibleItems, requiredSpace, timer;
|
56
|
+
|
57
|
+
function check() {
|
58
|
+
|
59
|
+
winWidth = $( window ).width();
|
60
|
+
// Set the current CSS width breakpoint: 0: <768px, 1: <1024px, 2: < 1280px, 3: >= 1280px.
|
61
|
+
var curBreakpoint = winWidth < 768 ? 0 : winWidth < 1024 ? 1 : winWidth < 1280 ? 2 : 3;
|
62
|
+
// If current breakpoint is different from last measured breakpoint, measureLinks again
|
63
|
+
if(curBreakpoint !== lastBreakpoint) measureLinks();
|
64
|
+
// Set the last measured CSS width breakpoint with the current breakpoint
|
65
|
+
lastBreakpoint = curBreakpoint;
|
66
|
+
|
67
|
+
// Get instant state
|
68
|
+
numOfVisibleItems = $vlinks.children().length;
|
69
|
+
// Decrease the width of visible elements from the nav innerWidth to find out the available space for navItems
|
70
|
+
availableSpace = /* nav */ $nav.innerWidth()
|
71
|
+
- /* logo */ ($logo.length !== 0 ? $logo.outerWidth(true) : 0)
|
72
|
+
- /* title */ $title.outerWidth(true)
|
73
|
+
- /* search */ ($search.length !== 0 ? $search.outerWidth(true) : 0)
|
74
|
+
- /* toggle */ (numOfVisibleItems !== breakWidths.length ? $btn.outerWidth(true) : 0);
|
75
|
+
requiredSpace = breakWidths[numOfVisibleItems - 1];
|
76
|
+
|
77
|
+
// There is not enought space
|
78
|
+
if (requiredSpace > availableSpace) {
|
79
|
+
$vlinks.children().last().prependTo($hlinks);
|
80
|
+
numOfVisibleItems -= 1;
|
81
|
+
check();
|
82
|
+
// There is more than enough space. If only one element is hidden, add the toggle width to the available space
|
83
|
+
} else if (availableSpace + (numOfVisibleItems === breakWidths.length - 1?$btn.outerWidth(true):0) > breakWidths[numOfVisibleItems]) {
|
84
|
+
$hlinks.children().first().appendTo($vlinks);
|
85
|
+
numOfVisibleItems += 1;
|
86
|
+
check();
|
87
|
+
}
|
88
|
+
// Update the button accordingly
|
89
|
+
$btn.attr("count", numOfItems - numOfVisibleItems);
|
90
|
+
if (numOfVisibleItems === numOfItems) {
|
91
|
+
$btn.addClass('hidden');
|
92
|
+
} else $btn.removeClass('hidden');
|
93
|
+
}
|
94
|
+
|
95
|
+
// Window listeners
|
96
|
+
$(window).resize(function() {
|
97
|
+
check();
|
98
|
+
});
|
99
|
+
|
100
|
+
$btn.on('click', function() {
|
101
|
+
$hlinks.toggleClass('hidden');
|
102
|
+
$(this).toggleClass('close');
|
103
|
+
clearTimeout(timer);
|
104
|
+
});
|
105
|
+
|
106
|
+
$hlinks.on('mouseleave', function() {
|
107
|
+
// Mouse has left, start the timer
|
108
|
+
timer = setTimeout(function() {
|
109
|
+
$hlinks.addClass('hidden');
|
110
|
+
$('.greedy-nav__toggle').removeClass('close');
|
111
|
+
}, closingTime);
|
112
|
+
}).on('mouseenter', function() {
|
113
|
+
// Mouse is back, cancel the timer
|
114
|
+
clearTimeout(timer);
|
115
|
+
})
|
116
|
+
|
117
|
+
// check if page has a logo
|
118
|
+
if($logoImg.length !== 0){
|
119
|
+
// check if logo is not loaded
|
120
|
+
if(!($logoImg[0].complete || $logoImg[0].naturalWidth !== 0)){
|
121
|
+
// if logo is not loaded wait for logo to load or fail to check
|
122
|
+
$logoImg.one("load error", check);
|
123
|
+
// if logo is already loaded just check
|
124
|
+
} else check();
|
125
|
+
// if page does not have a logo just check
|
126
|
+
} else check();
|
127
|
+
|
128
|
+
});
|