minimal-mistakes-jekyll 4.6.0 → 4.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/LICENSE.txt +59 -21
  4. data/README.md +217 -160
  5. data/_data/navigation.yml +11 -11
  6. data/_data/ui-text.yml +931 -888
  7. data/_includes/analytics-providers/custom.html +2 -2
  8. data/_includes/analytics-providers/google-universal.html +9 -9
  9. data/_includes/analytics-providers/google.html +10 -10
  10. data/_includes/analytics.html +11 -11
  11. data/_includes/archive-single.html +37 -37
  12. data/_includes/author-profile-custom-links.html +6 -6
  13. data/_includes/author-profile.html +249 -249
  14. data/_includes/base_path +4 -4
  15. data/_includes/breadcrumbs.html +39 -39
  16. data/_includes/browser-upgrade.html +2 -2
  17. data/_includes/category-list.html +25 -25
  18. data/_includes/comment.html +22 -22
  19. data/_includes/comments-providers/custom.html +2 -2
  20. data/_includes/comments-providers/discourse.html +13 -13
  21. data/_includes/comments-providers/facebook.html +7 -7
  22. data/_includes/comments-providers/google-plus.html +1 -1
  23. data/_includes/comments-providers/scripts.html +17 -15
  24. data/_includes/comments-providers/staticman.html +41 -41
  25. data/_includes/comments-providers/staticman_v2.html +42 -0
  26. data/_includes/comments.html +168 -96
  27. data/_includes/feature_row +49 -49
  28. data/_includes/figure +12 -12
  29. data/_includes/footer.html +25 -25
  30. data/_includes/footer/custom.html +2 -2
  31. data/_includes/gallery +46 -46
  32. data/_includes/group-by-array +46 -46
  33. data/_includes/head.html +42 -42
  34. data/_includes/head/custom.html +4 -4
  35. data/_includes/masthead.html +23 -20
  36. data/_includes/nav_list +46 -46
  37. data/_includes/page__hero_video.html +4 -4
  38. data/_includes/page__taxonomy.html +6 -6
  39. data/_includes/paginator.html +69 -69
  40. data/_includes/post_pagination.html +13 -13
  41. data/_includes/read-time.html +14 -14
  42. data/_includes/scripts.html +15 -15
  43. data/_includes/seo.html +162 -147
  44. data/_includes/sidebar.html +22 -22
  45. data/_includes/social-share.html +13 -13
  46. data/_includes/tag-list.html +25 -25
  47. data/_includes/toc +6 -6
  48. data/_includes/toc.html +75 -0
  49. data/_includes/video +11 -11
  50. data/_layouts/archive-taxonomy.html +14 -14
  51. data/_layouts/archive.html +25 -25
  52. data/_layouts/compress.html +10 -10
  53. data/_layouts/default.html +1 -1
  54. data/_layouts/home.html +11 -11
  55. data/_layouts/single.html +92 -84
  56. data/_layouts/splash.html +21 -21
  57. data/_sass/minimal-mistakes.scss +1 -1
  58. data/_sass/minimal-mistakes/_animations.scss +20 -20
  59. data/_sass/minimal-mistakes/_archive.scss +317 -317
  60. data/_sass/minimal-mistakes/_base.scss +315 -315
  61. data/_sass/minimal-mistakes/_buttons.scss +97 -97
  62. data/_sass/minimal-mistakes/_footer.scss +82 -82
  63. data/_sass/minimal-mistakes/_forms.scss +399 -389
  64. data/_sass/minimal-mistakes/_masthead.scss +82 -82
  65. data/_sass/minimal-mistakes/_mixins.scss +91 -91
  66. data/_sass/minimal-mistakes/_navigation.scss +552 -552
  67. data/_sass/minimal-mistakes/_notices.scss +99 -99
  68. data/_sass/minimal-mistakes/_page.scss +430 -430
  69. data/_sass/minimal-mistakes/_reset.scss +186 -186
  70. data/_sass/minimal-mistakes/_sidebar.scss +262 -262
  71. data/_sass/minimal-mistakes/_syntax.scss +286 -146
  72. data/_sass/minimal-mistakes/_tables.scss +36 -36
  73. data/_sass/minimal-mistakes/_utilities.scss +519 -519
  74. data/_sass/minimal-mistakes/_variables.scss +137 -137
  75. data/_sass/minimal-mistakes/skins/_air.scss +22 -22
  76. data/_sass/minimal-mistakes/skins/_aqua.scss +30 -0
  77. data/_sass/minimal-mistakes/skins/_contrast.scss +33 -33
  78. data/_sass/minimal-mistakes/skins/_dark.scss +23 -23
  79. data/_sass/minimal-mistakes/skins/_default.scss +5 -5
  80. data/_sass/minimal-mistakes/skins/_dirt.scss +14 -14
  81. data/_sass/minimal-mistakes/skins/_mint.scss +22 -22
  82. data/_sass/minimal-mistakes/skins/_neon.scss +35 -0
  83. data/_sass/minimal-mistakes/skins/_plum.scss +42 -0
  84. data/_sass/minimal-mistakes/skins/_sunrise.scss +25 -25
  85. data/_sass/minimal-mistakes/vendor/breakpoint/_breakpoint.scss +114 -114
  86. data/_sass/minimal-mistakes/vendor/breakpoint/_context.scss +94 -94
  87. data/_sass/minimal-mistakes/vendor/breakpoint/_helpers.scss +151 -151
  88. data/_sass/minimal-mistakes/vendor/breakpoint/_legacy-settings.scss +49 -49
  89. data/_sass/minimal-mistakes/vendor/breakpoint/_no-query.scss +15 -15
  90. data/_sass/minimal-mistakes/vendor/breakpoint/_parsers.scss +215 -215
  91. data/_sass/minimal-mistakes/vendor/breakpoint/_respond-to.scss +82 -82
  92. data/_sass/minimal-mistakes/vendor/breakpoint/_settings.scss +70 -70
  93. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_double.scss +33 -33
  94. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_query.scss +82 -82
  95. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_resolution.scss +31 -31
  96. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_single.scss +26 -26
  97. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_triple.scss +36 -36
  98. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/double/_default-pair.scss +21 -21
  99. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/double/_default.scss +22 -22
  100. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/double/_double-string.scss +21 -21
  101. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/resolution/_resolution.scss +60 -60
  102. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/single/_default.scss +13 -13
  103. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/triple/_default.scss +18 -18
  104. data/_sass/minimal-mistakes/vendor/font-awesome/_animated.scss +34 -34
  105. data/_sass/minimal-mistakes/vendor/font-awesome/_bordered-pulled.scss +25 -25
  106. data/_sass/minimal-mistakes/vendor/font-awesome/_core.scss +12 -12
  107. data/_sass/minimal-mistakes/vendor/font-awesome/_fixed-width.scss +6 -6
  108. data/_sass/minimal-mistakes/vendor/font-awesome/_font-awesome.scss +18 -18
  109. data/_sass/minimal-mistakes/vendor/font-awesome/_icons.scss +789 -789
  110. data/_sass/minimal-mistakes/vendor/font-awesome/_larger.scss +13 -13
  111. data/_sass/minimal-mistakes/vendor/font-awesome/_list.scss +19 -19
  112. data/_sass/minimal-mistakes/vendor/font-awesome/_mixins.scss +60 -60
  113. data/_sass/minimal-mistakes/vendor/font-awesome/_path.scss +15 -15
  114. data/_sass/minimal-mistakes/vendor/font-awesome/_rotated-flipped.scss +20 -20
  115. data/_sass/minimal-mistakes/vendor/font-awesome/_screen-reader.scss +5 -5
  116. data/_sass/minimal-mistakes/vendor/font-awesome/_stacked.scss +20 -20
  117. data/_sass/minimal-mistakes/vendor/font-awesome/_variables.scss +800 -800
  118. data/_sass/minimal-mistakes/vendor/magnific-popup/_magnific-popup.scss +649 -649
  119. data/_sass/minimal-mistakes/vendor/magnific-popup/_settings.scss +45 -45
  120. data/_sass/minimal-mistakes/vendor/susy/_susy-prefix.scss +13 -13
  121. data/_sass/minimal-mistakes/vendor/susy/_susy.scss +5 -5
  122. data/_sass/minimal-mistakes/vendor/susy/plugins/_svg-grid.scss +5 -5
  123. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_prefix.scss +7 -7
  124. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-api.scss +114 -114
  125. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-grid-math.scss +67 -67
  126. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-settings.scss +14 -14
  127. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-unprefix.scss +18 -18
  128. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-utilities.scss +133 -133
  129. data/_sass/minimal-mistakes/vendor/susy/susy/_api.scss +318 -318
  130. data/_sass/minimal-mistakes/vendor/susy/susy/_normalize.scss +261 -261
  131. data/_sass/minimal-mistakes/vendor/susy/susy/_parse.scss +163 -163
  132. data/_sass/minimal-mistakes/vendor/susy/susy/_settings.scss +329 -329
  133. data/_sass/minimal-mistakes/vendor/susy/susy/_su-math.scss +441 -441
  134. data/_sass/minimal-mistakes/vendor/susy/susy/_su-validate.scss +213 -213
  135. data/_sass/minimal-mistakes/vendor/susy/susy/_syntax-helpers.scss +191 -191
  136. data/_sass/minimal-mistakes/vendor/susy/susy/_unprefix.scss +56 -56
  137. data/_sass/minimal-mistakes/vendor/susy/susy/_utilities.scss +167 -167
  138. data/assets/css/main.scss +7 -7
  139. data/assets/fonts/fontawesome-webfont.svg +2671 -2671
  140. data/assets/js/_main.js +72 -72
  141. data/assets/js/main.min.js +1 -1
  142. data/assets/js/plugins/jquery.fitvids.js +81 -81
  143. data/assets/js/plugins/jquery.greedy-navigation.js +77 -77
  144. metadata +8 -3
@@ -1,72 +1,72 @@
1
- /* ==========================================================================
2
- jQuery plugin settings and other scripts
3
- ========================================================================== */
4
-
5
- $(document).ready(function(){
6
-
7
- // Sticky footer
8
- var bumpIt = function() {
9
- $('body').css('margin-bottom', $('.page__footer').outerHeight(true));
10
- },
11
- didResize = false;
12
-
13
- bumpIt();
14
-
15
- $(window).resize(function() {
16
- didResize = true;
17
- });
18
- setInterval(function() {
19
- if(didResize) {
20
- didResize = false;
21
- bumpIt();
22
- }
23
- }, 250);
24
-
25
- // FitVids init
26
- $("#main").fitVids();
27
-
28
- // Follow menu drop down
29
- $(".author__urls-wrapper button").on("click", function() {
30
- $(".author__urls").toggleClass("is--visible");
31
- $(".author__urls-wrapper button").toggleClass("open");
32
- });
33
-
34
- // init smooth scroll
35
- $("a").smoothScroll({offset: -20});
36
-
37
- // add lightbox class to all image links
38
- $("a[href$='.jpg'],a[href$='.jpeg'],a[href$='.JPG'],a[href$='.png'],a[href$='.gif']").addClass("image-popup");
39
-
40
- // Magnific-Popup options
41
- $(".image-popup").magnificPopup({
42
- // disableOn: function() {
43
- // if( $(window).width() < 500 ) {
44
- // return false;
45
- // }
46
- // return true;
47
- // },
48
- type: 'image',
49
- tLoading: 'Loading image #%curr%...',
50
- gallery: {
51
- enabled: true,
52
- navigateByImgClick: true,
53
- preload: [0,1] // Will preload 0 - before current, and 1 after the current image
54
- },
55
- image: {
56
- tError: '<a href="%url%">Image #%curr%</a> could not be loaded.',
57
- },
58
- removalDelay: 500, // Delay in milliseconds before popup is removed
59
- // Class that is added to body when popup is open.
60
- // make it unique to apply your CSS animations just to this exact popup
61
- mainClass: 'mfp-zoom-in',
62
- callbacks: {
63
- beforeOpen: function() {
64
- // just a hack that adds mfp-anim class to markup
65
- this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
66
- }
67
- },
68
- closeOnContentClick: true,
69
- midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source.
70
- });
71
-
72
- });
1
+ /* ==========================================================================
2
+ jQuery plugin settings and other scripts
3
+ ========================================================================== */
4
+
5
+ $(document).ready(function(){
6
+
7
+ // Sticky footer
8
+ var bumpIt = function() {
9
+ $('body').css('margin-bottom', $('.page__footer').outerHeight(true));
10
+ },
11
+ didResize = false;
12
+
13
+ bumpIt();
14
+
15
+ $(window).resize(function() {
16
+ didResize = true;
17
+ });
18
+ setInterval(function() {
19
+ if(didResize) {
20
+ didResize = false;
21
+ bumpIt();
22
+ }
23
+ }, 250);
24
+
25
+ // FitVids init
26
+ $("#main").fitVids();
27
+
28
+ // Follow menu drop down
29
+ $(".author__urls-wrapper button").on("click", function() {
30
+ $(".author__urls").toggleClass("is--visible");
31
+ $(".author__urls-wrapper button").toggleClass("open");
32
+ });
33
+
34
+ // init smooth scroll
35
+ $("a").smoothScroll({offset: -20});
36
+
37
+ // add lightbox class to all image links
38
+ $("a[href$='.jpg'],a[href$='.jpeg'],a[href$='.JPG'],a[href$='.png'],a[href$='.gif']").addClass("image-popup");
39
+
40
+ // Magnific-Popup options
41
+ $(".image-popup").magnificPopup({
42
+ // disableOn: function() {
43
+ // if( $(window).width() < 500 ) {
44
+ // return false;
45
+ // }
46
+ // return true;
47
+ // },
48
+ type: 'image',
49
+ tLoading: 'Loading image #%curr%...',
50
+ gallery: {
51
+ enabled: true,
52
+ navigateByImgClick: true,
53
+ preload: [0,1] // Will preload 0 - before current, and 1 after the current image
54
+ },
55
+ image: {
56
+ tError: '<a href="%url%">Image #%curr%</a> could not be loaded.',
57
+ },
58
+ removalDelay: 500, // Delay in milliseconds before popup is removed
59
+ // Class that is added to body when popup is open.
60
+ // make it unique to apply your CSS animations just to this exact popup
61
+ mainClass: 'mfp-zoom-in',
62
+ callbacks: {
63
+ beforeOpen: function() {
64
+ // just a hack that adds mfp-anim class to markup
65
+ this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
66
+ }
67
+ },
68
+ closeOnContentClick: true,
69
+ midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source.
70
+ });
71
+
72
+ });
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Minimal Mistakes Jekyll Theme 4.6.0 by Michael Rose
2
+ * Minimal Mistakes Jekyll Theme 4.7.0 by Michael Rose
3
3
  * Copyright 2017 Michael Rose - mademistakes.com | @mmistakes
4
4
  * Licensed under MIT
5
5
  */
@@ -1,82 +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
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
82
  })( window.jQuery || window.Zepto );
@@ -1,78 +1,78 @@
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
5
- */
6
-
7
- $(document).ready(function(){
8
-
9
- var $btn = $('nav.greedy-nav button');
10
- var $vlinks = $('nav.greedy-nav .visible-links');
11
- var $hlinks = $('nav.greedy-nav .hidden-links');
12
-
13
- var numOfItems = 0;
14
- var totalSpace = 0;
15
- var closingTime = 1000;
16
- var breakWidths = [];
17
-
18
- // Get initial state
19
- $vlinks.children().outerWidth(function(i, w) {
20
- totalSpace += w;
21
- numOfItems += 1;
22
- breakWidths.push(totalSpace);
23
- });
24
-
25
- var availableSpace, numOfVisibleItems, requiredSpace, timer;
26
-
27
- function check() {
28
-
29
- // Get instant state
30
- availableSpace = $vlinks.width() - 10;
31
- numOfVisibleItems = $vlinks.children().length;
32
- requiredSpace = breakWidths[numOfVisibleItems - 1];
33
-
34
- // There is not enough space
35
- if (requiredSpace > availableSpace) {
36
- $vlinks.children().last().prependTo($hlinks);
37
- numOfVisibleItems -= 1;
38
- check();
39
- // There is more than enough space
40
- } else if (availableSpace > breakWidths[numOfVisibleItems]) {
41
- $hlinks.children().first().appendTo($vlinks);
42
- numOfVisibleItems += 1;
43
- check();
44
- }
45
- // Update the button accordingly
46
- $btn.attr("count", numOfItems - numOfVisibleItems);
47
- if (numOfVisibleItems === numOfItems) {
48
- $btn.addClass('hidden');
49
- } else {
50
- $btn.removeClass('hidden');
51
- }
52
- }
53
-
54
- // Window listeners
55
- $(window).resize(function() {
56
- check();
57
- });
58
-
59
- $btn.on('click', function() {
60
- $hlinks.toggleClass('hidden');
61
- $(this).toggleClass('close');
62
- clearTimeout(timer);
63
- });
64
-
65
- $hlinks.on('mouseleave', function() {
66
- // Mouse has left, start the timer
67
- timer = setTimeout(function() {
68
- $hlinks.addClass('hidden');
69
- $btn.toggleClass('close');
70
- }, closingTime);
71
- }).on('mouseenter', function() {
72
- // Mouse is back, cancel the timer
73
- clearTimeout(timer);
74
- })
75
-
76
- check();
77
-
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
5
+ */
6
+
7
+ $(document).ready(function(){
8
+
9
+ var $btn = $('nav.greedy-nav button');
10
+ var $vlinks = $('nav.greedy-nav .visible-links');
11
+ var $hlinks = $('nav.greedy-nav .hidden-links');
12
+
13
+ var numOfItems = 0;
14
+ var totalSpace = 0;
15
+ var closingTime = 1000;
16
+ var breakWidths = [];
17
+
18
+ // Get initial state
19
+ $vlinks.children().outerWidth(function(i, w) {
20
+ totalSpace += w;
21
+ numOfItems += 1;
22
+ breakWidths.push(totalSpace);
23
+ });
24
+
25
+ var availableSpace, numOfVisibleItems, requiredSpace, timer;
26
+
27
+ function check() {
28
+
29
+ // Get instant state
30
+ availableSpace = $vlinks.width() - 10;
31
+ numOfVisibleItems = $vlinks.children().length;
32
+ requiredSpace = breakWidths[numOfVisibleItems - 1];
33
+
34
+ // There is not enough space
35
+ if (requiredSpace > availableSpace) {
36
+ $vlinks.children().last().prependTo($hlinks);
37
+ numOfVisibleItems -= 1;
38
+ check();
39
+ // There is more than enough space
40
+ } else if (availableSpace > breakWidths[numOfVisibleItems]) {
41
+ $hlinks.children().first().appendTo($vlinks);
42
+ numOfVisibleItems += 1;
43
+ check();
44
+ }
45
+ // Update the button accordingly
46
+ $btn.attr("count", numOfItems - numOfVisibleItems);
47
+ if (numOfVisibleItems === numOfItems) {
48
+ $btn.addClass('hidden');
49
+ } else {
50
+ $btn.removeClass('hidden');
51
+ }
52
+ }
53
+
54
+ // Window listeners
55
+ $(window).resize(function() {
56
+ check();
57
+ });
58
+
59
+ $btn.on('click', function() {
60
+ $hlinks.toggleClass('hidden');
61
+ $(this).toggleClass('close');
62
+ clearTimeout(timer);
63
+ });
64
+
65
+ $hlinks.on('mouseleave', function() {
66
+ // Mouse has left, start the timer
67
+ timer = setTimeout(function() {
68
+ $hlinks.addClass('hidden');
69
+ $btn.toggleClass('close');
70
+ }, closingTime);
71
+ }).on('mouseenter', function() {
72
+ // Mouse is back, cancel the timer
73
+ clearTimeout(timer);
74
+ })
75
+
76
+ check();
77
+
78
78
  });