gent_styleguide 2.10.0 → 2.12.0

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/README.md +2 -2
  3. package/build/styleguide/js/base-min.js +68 -1
  4. package/build/styleguide/js/breadcrumbs.binding-min.js +13 -1
  5. package/build/styleguide/js/breadcrumbs.functions-min.js +131 -1
  6. package/build/styleguide/js/button-drop-min.js +38 -1
  7. package/build/styleguide/js/button-drop.binding-min.js +13 -1
  8. package/build/styleguide/js/button-drop.functions-min.js +48 -1
  9. package/build/styleguide/js/gallery.binding-min.js +12 -1
  10. package/build/styleguide/js/gallery.functions-min.js +29 -1
  11. package/build/styleguide/js/hamburger-menu.binding-min.js +17 -1
  12. package/build/styleguide/js/hamburger-menu.functions-min.js +166 -1
  13. package/build/styleguide/js/header.binding-min.js +18 -1
  14. package/build/styleguide/js/header.functions-min.js +73 -1
  15. package/build/styleguide/js/input-date.binding-min.js +8 -1
  16. package/build/styleguide/js/input-date.functions-min.js +27 -1
  17. package/build/styleguide/js/input-multiselect-chosen.binding-min.js +31 -1
  18. package/build/styleguide/js/input-multiselect-chosen.functions-min.js +24 -1
  19. package/build/styleguide/js/teaser-collection.binding-min.js +14 -1
  20. package/build/styleguide/sass/01-mixins/grid/_default_classes.scss +8 -6
  21. package/build/styleguide/sass/01-mixins/grid/_mixins.scss +22 -20
  22. package/build/styleguide/sass/11-base/forms/_forms.scss +3 -0
  23. package/build/styleguide/sass/11-base/grid/_grid.scss +2 -2
  24. package/build/styleguide/sass/21-atoms/fieldset/_fieldset.scss +1 -1
  25. package/build/styleguide/sass/21-atoms/inputs/input-multiselect-chosen/_input-multiselect-chosen.scss +1 -1
  26. package/build/styleguide/sass/21-atoms/tag/_tag.scss +0 -5
  27. package/build/styleguide/sass/31-molecules/building-blocks/breadcrumbs/_breadcrumbs.scss +33 -37
  28. package/build/styleguide/sass/31-molecules/building-blocks/hamburger-menu/_hamburger-menu.scss +1 -1
  29. package/build/styleguide/sass/41-organisms/header/_header.scss +2 -2
  30. package/build/styleguide/sass/main_cli.scss +102 -0
  31. package/nbproject/private/private.properties +1 -0
  32. package/nbproject/private/private.xml +8 -0
  33. package/nbproject/project.properties +5 -0
  34. package/nbproject/project.xml +9 -0
  35. package/package.json +7 -6
  36. package/yarn.lock +0 -7827
package/CHANGELOG.md CHANGED
@@ -8,11 +8,19 @@ Refer to upcoming changes in our README.md under "Roadmap"
8
8
 
9
9
  All notable changes to this style guide are documented here.
10
10
 
11
- ### 2.10.0
11
+ ### 2.11.0
12
12
 
13
13
  * DTGB-140: Removed some files from the NPM package.
14
14
  * DTGB-140: Fixed a bug where `npm install` breaks
15
15
  the install of the style guide.
16
+ * DTGB-276: Fixed a bug where the breadcrumb alignment was not correct.
17
+
18
+ > **Some markup changes have been introduced so you might need some
19
+ refactoring.**
20
+ * DTGB-397: Changed the markup of radio buttons and checkboxes. They are
21
+ now inside their own fieldset.
22
+ * DTGB-401: Updated links to new public gent_base repository.
23
+ * DTGB-402: Added a required form fields indicator at the top of forms.
16
24
 
17
25
  ### 2.9.0
18
26
 
package/README.md CHANGED
@@ -18,11 +18,11 @@ This repository is a read only version of the style guide part of our own
18
18
  Drupal 8 base theme.
19
19
 
20
20
  If you want to develop for this style guide you need to do it in
21
- [this repository](https://github.com/digipolisgent/drupal_theme_gent-base)
21
+ [this repository](https://github.com/StadGent/drupal_theme_gent-base)
22
22
 
23
23
  > Please do not create any pull requests directly here.
24
24
  > Instead use
25
- > [this repo](https://github.com/digipolisgent/drupal_theme_gent-base) to
25
+ > [this repo](https://github.com/StadGent/drupal_theme_gent-base) to
26
26
  > create your pull requests.
27
27
 
28
28
  To contribute to the style guide please refer to the
@@ -1 +1,68 @@
1
- "use strict";var gent_styleguide=function(){return{TabTrap:function(t){var e=-1,n=function(t){var e=t.querySelectorAll('a[href], area[href], input:not([disabled]):not([hidden]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]');return Array.prototype.slice.call(e)}(t);this.next=function(){++e>n.length-1&&(e=0),n[e].focus()},this.back=function(){--e<0&&(e=n.length-1),n[e].focus()},this.home=function(){n[e=0].focus()},this.end=function(){e=n.length-1,n[e].focus()},this.reset=function(){e=-1},this.hasFocusables=n&&n.length>0}}}();
1
+ 'use strict';
2
+
3
+ var gent_styleguide = (function () { // eslint-disable-line no-unused-vars
4
+
5
+ /**
6
+ * Generates a tabTrap object
7
+ *
8
+ * @param {object} container DOM-element
9
+ * @constructor
10
+ */
11
+ function TabTrap(container) {
12
+ var focusPosition = -1;
13
+ var focusables = getFocusables(container);
14
+
15
+ /**
16
+ * Returns all focusable elements within a given container.
17
+ *
18
+ * @param {object} container hamburger DOM-element
19
+ * @return {array} focusable elements
20
+ */
21
+ function getFocusables(container) {
22
+ var focusables = container
23
+ .querySelectorAll('a[href], ' +
24
+ 'area[href], ' +
25
+ 'input:not([disabled]):not([hidden]), ' +
26
+ 'select:not([disabled]), ' +
27
+ 'textarea:not([disabled]), ' +
28
+ 'button:not([disabled]), ' +
29
+ '[tabindex="0"]');
30
+ return Array.prototype.slice.call(focusables);
31
+ }
32
+
33
+ this.next = function () {
34
+ if (++focusPosition > focusables.length - 1) {
35
+ focusPosition = 0;
36
+ }
37
+ focusables[focusPosition].focus();
38
+ };
39
+
40
+ this.back = function () {
41
+ if (--focusPosition < 0) {
42
+ focusPosition = focusables.length - 1;
43
+ }
44
+ focusables[focusPosition].focus();
45
+ };
46
+
47
+ this.home = function () {
48
+ focusPosition = 0;
49
+ focusables[focusPosition].focus();
50
+ };
51
+
52
+ this.end = function () {
53
+ focusPosition = focusables.length - 1;
54
+ focusables[focusPosition].focus();
55
+ };
56
+
57
+ this.reset = function () {
58
+ focusPosition = -1;
59
+ };
60
+
61
+ this.hasFocusables = focusables && focusables.length > 0;
62
+ }
63
+
64
+ return {
65
+ TabTrap: TabTrap
66
+ };
67
+
68
+ })();
@@ -1 +1,13 @@
1
- "use strict";jQuery(window).on("load",function(e){this.gentStyleGuideBreadcrumb.updateMobileBreadcrumb()});
1
+ /**
2
+ * @file
3
+ * Javascript binding of breadcrumb.functions.js
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ (function ($) {
9
+ $(window).on('load', function (e) {
10
+ this.gentStyleGuideBreadcrumb.updateMobileBreadcrumb();
11
+ });
12
+
13
+ })(jQuery);
@@ -1 +1,131 @@
1
- "use strict";var gentStyleGuideBreadcrumb={};!function(e){function r(r,t,a){e("a, span",r).each(function(){var r=e(this),n=r.text().trim();n.length>t&&(n=!1!==a?n.substr(0,t-3).trim()+"...":n.substr(0,t).trim(),r.text(n))})}function t(r,t,a,n,l){null==a&&(a=2),null==n&&(n=a),t=Math.max(t,a+n+1);var i=e("li",r).length;if(i>=t){for(var u=a+1;u<=i-n;u++)e("li:nth-of-type("+u+")",r).hide();var s=e("<li>").append(e("<a>").text(l||"...").attr("href","#").click(function(t){t.preventDefault(),e(this).parent().remove(),e("li",r).show()}));a?e("li:nth-of-type("+a+")",r).after(s):r.prepend(s)}}gentStyleGuideBreadcrumb.updateMobileBreadcrumb=function(){var a=e("ol.breadcrumb, ul.nav--breadcrumb, ul.breadcrumb");if(a.length&&!a.hasClass("gentbe-processed")){a.addClass("gentbe-processed"),a.addClass("mobile-breadcrumb-processed"),e("select.nav--mobile-breadcrumb").remove();var n=a.clone();n.removeAttr("id").addClass("nav--mobile-breadcrumb"),a.after(n),r(a,150),r(n,100),t(a,6),t(n,5,1,2)}}}(jQuery);
1
+ /**
2
+ * @file
3
+ * Breadcrumb handling and rendering.
4
+ */
5
+
6
+ // Breadcrumb namespace definition.
7
+
8
+ 'use strict';
9
+
10
+ var gentStyleGuideBreadcrumb = {};
11
+
12
+ (function ($) {
13
+
14
+ /**
15
+ * Replace the mobile breadcrumb of Gent base by our own.
16
+ *
17
+ * Adds this function to a global gentStyleBreadcrumb namespace.
18
+ */
19
+ gentStyleGuideBreadcrumb.updateMobileBreadcrumb = function () {
20
+ var breadcrumb = $('ol.breadcrumb, ul.nav--breadcrumb, ul.breadcrumb');
21
+ if (breadcrumb.length && !breadcrumb.hasClass('gentbe-processed')) {
22
+ // Prevent duplicate processing by us or Gent base.
23
+ breadcrumb.addClass('gentbe-processed');
24
+ breadcrumb.addClass('mobile-breadcrumb-processed');
25
+
26
+ // Remove the mobile breadcrumb of Gent base.
27
+ $('select.nav--mobile-breadcrumb').remove();
28
+
29
+ // Duplicate the original breadcrumb as mobile version.
30
+ var mobile = breadcrumb.clone();
31
+ mobile.removeAttr('id').addClass('nav--mobile-breadcrumb');
32
+ breadcrumb.after(mobile);
33
+
34
+ // Truncate the labels.
35
+ truncateBreadcrumbLabels_(breadcrumb, 150);
36
+ truncateBreadcrumbLabels_(mobile, 100);
37
+
38
+ // Collapse the trail.
39
+ collapseBreadcrumbTrail_(breadcrumb, 6);
40
+ collapseBreadcrumbTrail_(mobile, 5, 1, 2);
41
+ }
42
+ };
43
+
44
+ /**
45
+ * Truncate the breadcrumb labels to a maximum length.
46
+ *
47
+ * @param {Object} breadcrumb
48
+ * The breadcrumb element as jQuery object.
49
+ * @param {int} length
50
+ * Maximum length of a label.
51
+ * @param {boolean} [ellipsis]
52
+ * Wether an elipsis should be added, defaults to true.
53
+ */
54
+ function truncateBreadcrumbLabels_(breadcrumb, length, ellipsis) {
55
+ $('a, span', breadcrumb).each(function () {
56
+ var element = $(this);
57
+ var text = element.text().trim();
58
+
59
+ if (text.length > length) {
60
+ if (ellipsis !== false) {
61
+ text = text.substr(0, (length - 3)).trim() + '...';
62
+ }
63
+ else {
64
+ text = text.substr(0, length).trim();
65
+ }
66
+
67
+ element.text(text);
68
+ }
69
+ });
70
+ }
71
+
72
+ /**
73
+ * Collapse the breadcrumb trail by hiding some elements.
74
+ *
75
+ * @param {Object} breadcrumb
76
+ * The breadcrumb element as jQuery object.
77
+ * @param {int} min_length
78
+ * Only collapse if the trail has at least this many items.
79
+ * @param {int} [head]
80
+ * Number of items to show at the start of the trail, defaults to 2.
81
+ * @param {int} [tail]
82
+ * Number of items to show at the end of the trail, defaults to the same value as head.
83
+ * @param {string} [text]
84
+ * Text to use as link to show the collapsed items, defaults to "...".
85
+ */
86
+ function collapseBreadcrumbTrail_(breadcrumb, min_length, head, tail, text) {
87
+ // Set the default head and tail.
88
+ if (head == null) {
89
+ head = 2;
90
+ }
91
+
92
+ if (tail == null) {
93
+ tail = head;
94
+ }
95
+
96
+ // Make sure we have a sensible minimum length.
97
+ min_length = Math.max(min_length, (head + tail + 1));
98
+
99
+ // Get the number of items.
100
+ var length = $('li', breadcrumb).length;
101
+
102
+ // Check if the trail has the minimum length.
103
+ if (length >= min_length) {
104
+ // Hide the items.
105
+ for (var i = (head + 1); i <= (length - tail); i++) {
106
+ $('li:nth-of-type(' + i + ')', breadcrumb).hide();
107
+ }
108
+
109
+ // Create the uncollapse link.
110
+ var link = $('<li>').append(
111
+ $('<a>')
112
+ .text(text ? text : '...')
113
+ .attr('href', '#')
114
+ .click(function (e) {
115
+ e.preventDefault();
116
+
117
+ $(this).parent().remove();
118
+ $('li', breadcrumb).show();
119
+ })
120
+ );
121
+
122
+ // Add it.
123
+ if (head) {
124
+ $('li:nth-of-type(' + head + ')', breadcrumb).after(link);
125
+ }
126
+ else {
127
+ breadcrumb.prepend(link);
128
+ }
129
+ }
130
+ }
131
+ })(jQuery);
@@ -1 +1,38 @@
1
- "use strict";!function(o){o(window).on("load",function(){var n=o(".dropbutton-wrapper");n.find(".dropbutton-toggle button").on("click",function(o){o.stopPropagation(),n.hasClass("open")?n.removeClass("open"):n.addClass("open")}),o(document).on("click",function(o){n.removeClass("open")})})}(jQuery);
1
+ 'use strict';
2
+
3
+ (function ($) {
4
+
5
+ /**
6
+ * Invoked after after loading the initial page and after each AJAX request.
7
+ *
8
+ * @param context
9
+ * The DOM context.
10
+ * @param settings
11
+ * Object of additional settings.
12
+ */
13
+ $(window).on('load', dropButtonLoad);
14
+
15
+ /**
16
+ * Replace the mobile breadcrumb of Gent base by our own.
17
+ */
18
+ function dropButtonLoad() {
19
+ var dropButton = $('.dropbutton-wrapper');
20
+ var dropButtonToggle = dropButton.find('.dropbutton-toggle button');
21
+
22
+ dropButtonToggle.on('click', function (e) {
23
+ e.stopPropagation();
24
+ if (dropButton.hasClass('open')) {
25
+ dropButton.removeClass('open');
26
+ }
27
+ else {
28
+ dropButton.addClass('open');
29
+ }
30
+ });
31
+
32
+ $(document).on('click', function (e) {
33
+ dropButton.removeClass('open');
34
+ });
35
+
36
+ }
37
+
38
+ })(jQuery);
@@ -1 +1,13 @@
1
- "use strict";!function(o){o(window).on("load",function(n){o(".dropbutton-wrapper").dropButtonLoad()})}(jQuery);
1
+ /**
2
+ * @file
3
+ * binding of button-drop.functions.js
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ (function ($) {
9
+ $(window).on('load', function (e) {
10
+ $('.dropbutton-wrapper').dropButtonLoad();
11
+ });
12
+
13
+ })(jQuery);
@@ -1 +1,48 @@
1
- "use strict";!function(o){o.fn.extend({dropButtonLoad:function(){var n=o(this);n.find(".dropbutton-toggle button").on("click",function(o){o.stopPropagation(),n.hasClass("open")?n.removeClass("open"):n.addClass("open")}),o(document).on("click",function(o){n.removeClass("open")})}})}(jQuery);
1
+ /**
2
+ * @file
3
+ * Implements a dropdown button.
4
+ *
5
+ * @author
6
+ * Wim Vantomme
7
+ *
8
+ */
9
+ 'use strict';
10
+
11
+ (function ($) {
12
+ $.fn.extend({
13
+
14
+ /**
15
+ * Implements a jQuery extension function.
16
+ *
17
+ * @fires event:click
18
+ */
19
+ dropButtonLoad: function () {
20
+ var dropButton = $(this);
21
+ var dropButtonToggle = dropButton.find('.dropbutton-toggle button');
22
+
23
+ /**
24
+ * Opens or closes the drop-down botton on click.
25
+ *
26
+ * @event click
27
+ */
28
+ dropButtonToggle.on('click', function (e) {
29
+ e.stopPropagation();
30
+ if (dropButton.hasClass('open')) {
31
+ dropButton.removeClass('open');
32
+ }
33
+ else {
34
+ dropButton.addClass('open');
35
+ }
36
+ });
37
+
38
+ /**
39
+ * Closes the drop-down button
40
+ *
41
+ * @event click
42
+ */
43
+ $(document).on('click', function (e) {
44
+ dropButton.removeClass('open');
45
+ });
46
+ }
47
+ });
48
+ })(jQuery);
@@ -1 +1,12 @@
1
- "use strict";!function(e){e(document).ready(function(){var t=e(".gallery");t.length>0&&t.loadLightGallery()})}(jQuery);
1
+ 'use strict';
2
+
3
+ (function ($) {
4
+ $(document).ready(function () {
5
+ var $gallery = $('.gallery');
6
+
7
+ if ($gallery.length > 0) {
8
+ $gallery.loadLightGallery();
9
+ }
10
+ });
11
+
12
+ })(jQuery);
@@ -1 +1,29 @@
1
- "use strict";!function(t){t.fn.extend({loadLightGallery:function(){t(this).lightGallery({download:!1,getCaptionFromTitleOrAlt:!1,counter:!1})}})}(jQuery);
1
+ /**
2
+ * @file
3
+ * Implements the jQuery light gallery plugin.
4
+ *
5
+ * @author
6
+ * Gert-Jan Meire
7
+ *
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ (function ($) {
13
+ $.fn.extend({
14
+
15
+ /**
16
+ * Creates a jQuery extension function.
17
+ *
18
+ */
19
+ loadLightGallery: function () {
20
+ $(this).lightGallery({
21
+ download: false,
22
+ getCaptionFromTitleOrAlt: false,
23
+ counter: false
24
+ });
25
+
26
+ }
27
+
28
+ });
29
+ })(jQuery);
@@ -1 +1,17 @@
1
- "use strict";!function(n){n(window).on("load",function(u){var e=n(".hamburger-menu");e.length>0&&e.loadHamburgerMenu()})}(jQuery);
1
+ /**
2
+ * @file
3
+ * Javascript binding of hamburger-menu.functions.js.
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ (function ($) {
9
+ $(window).on('load', function (e) {
10
+ var $hamburgerMenu = $('.hamburger-menu');
11
+
12
+ if ($hamburgerMenu.length > 0) {
13
+ $hamburgerMenu.loadHamburgerMenu();
14
+ }
15
+ });
16
+
17
+ })(jQuery);
@@ -1 +1,166 @@
1
- "use strict";!function(e){e.fn.extend({loadHamburgerMenu:function(){var t,n=e(this[0]).find(".hamburger-menu__drawer"),a=n.find(".close"),s=e(".hamburger-menu__overlay");if("undefined"!=typeof gent_styleguide){var r=new gent_styleguide.TabTrap(n[0]),o=function(e){e&&e.preventDefault(),n.removeClass("js-opened"),s.removeClass("js-opened"),document.removeEventListener("keydown",u),r.reset(),t&&(t.focus(),t.setAttribute("aria-expanded",!1)),setTimeout(function(){n.attr("style","display: none")},500)},u=function(e){if(r&&r.hasFocusables&&e)switch(e.keyCode||e.which){case 9:e.preventDefault(),e.shiftKey?r.back():r.next();break;case 40:case 39:e.preventDefault(),r.next();break;case 38:case 37:e.preventDefault(),r.back();break;case 36:e.preventDefault(),r.home();break;case 35:e.preventDefault(),r.end();break;case 27:o(e)}};e(".hamburger-menu__toggle").on("click",function(e){e&&e.preventDefault(),n.attr("style","display: block"),setTimeout(function(){n.addClass("js-opened"),s.addClass("js-opened")}),(t=e.target).setAttribute("aria-expanded",!0),n.focus(),document.addEventListener("keydown",u)}),a.add(s).on("click",o),o()}else console.error("You need to include base.js.")}})}(jQuery);
1
+ /**
2
+ * @file
3
+ * Implements a hamburger-menu button combined with
4
+ * a slide-in panel for easy mobile navigation.
5
+ *
6
+ * @authors
7
+ * Wim Vantomme
8
+ * Bart Delrue
9
+ *
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ (function ($) {
15
+
16
+ $.fn.extend({
17
+
18
+ /**
19
+ * Creates a jQuery extension function.
20
+ *
21
+ * @fires event:click
22
+ */
23
+ loadHamburgerMenu: function () {
24
+ var $drawer = $(this[0]).find('.hamburger-menu__drawer');
25
+ var $closeBtn = $drawer.find('.close');
26
+ var $overlay = $('.hamburger-menu__overlay');
27
+ var trigger;
28
+
29
+ if (typeof gent_styleguide === 'undefined') {
30
+ console.error('You need to include base.js.'); // eslint-disable-line no-console
31
+ return;
32
+ }
33
+
34
+ // TabTrap doens't use jquery opbjects.
35
+ var tabTrap = new gent_styleguide.TabTrap($drawer[0]); // eslint-disable-line no-undef
36
+
37
+ /**
38
+ * Closes the hamburger menu
39
+ *
40
+ * @param {event} e onclick or keydown:escape
41
+ */
42
+ var close = function (e) {
43
+ if (e) {
44
+ e.preventDefault();
45
+ }
46
+ $drawer.removeClass('js-opened');
47
+ $overlay.removeClass('js-opened');
48
+ document.removeEventListener('keydown', handleKeyboardInput);
49
+ tabTrap.reset();
50
+
51
+ // return focus to the trigger
52
+ if (trigger) {
53
+ trigger.focus();
54
+ trigger.setAttribute('aria-expanded', false);
55
+ }
56
+
57
+ // remove the menu from the tabindex
58
+ // jquery .css() doesn't now 'important'
59
+ setTimeout(function () {
60
+ $drawer.attr('style', 'display: none');
61
+ }, 500);
62
+ };
63
+
64
+ /**
65
+ * Opens the hamburger menu
66
+ *
67
+ * @param {event} e onclick
68
+ */
69
+ var open = function (e) {
70
+ if (e) {
71
+ e.preventDefault();
72
+ }
73
+
74
+ // add the menu to the tabindex
75
+ // jquery .css() doesn't now 'important'
76
+ $drawer.attr('style', 'display: block');
77
+
78
+ setTimeout(function () {
79
+ $drawer.addClass('js-opened');
80
+ $overlay.addClass('js-opened');
81
+ });
82
+
83
+
84
+ // remember the trigger
85
+ trigger = e.target;
86
+ trigger.setAttribute('aria-expanded', true);
87
+
88
+ // set focus to the menu
89
+ $drawer.focus();
90
+
91
+ // handle keyboard input
92
+ document.addEventListener('keydown', handleKeyboardInput);
93
+ };
94
+
95
+ /**
96
+ * Handle keyboard input
97
+ *
98
+ * @param {object} e event
99
+ */
100
+ var handleKeyboardInput = function (e) {
101
+
102
+ if (!tabTrap || !tabTrap.hasFocusables || !e) {
103
+ return;
104
+ }
105
+
106
+ var keyCode = e.keyCode || e.which;
107
+
108
+ switch (keyCode) {
109
+ case 9: // tab
110
+ e.preventDefault();
111
+ if (e.shiftKey) {
112
+ tabTrap.back();
113
+ }
114
+ else {
115
+ tabTrap.next();
116
+ }
117
+ break;
118
+ case 40: // arrow down
119
+ case 39: // arrow right
120
+ e.preventDefault();
121
+ tabTrap.next();
122
+ break;
123
+ case 38: // arrow up
124
+ case 37: // arrow left
125
+ e.preventDefault();
126
+ tabTrap.back();
127
+ break;
128
+ case 36: // home
129
+ e.preventDefault();
130
+ tabTrap.home();
131
+ break;
132
+ case 35: // end
133
+ e.preventDefault();
134
+ tabTrap.end();
135
+ break;
136
+ case 27: // esc
137
+ close(e);
138
+ break;
139
+ }
140
+ };
141
+
142
+ /**
143
+ * Indicates that a user has clicked on the hamburger toggle.
144
+ *
145
+ * Opens the overlay and hamburgerMenu.
146
+ *
147
+ * @event click
148
+ */
149
+ $('.hamburger-menu__toggle').on('click', open);
150
+
151
+
152
+ /**
153
+ * Indicates that a user has clicked on the closeBtn hamburger menu
154
+ * toggle.
155
+ *
156
+ * Closes the overlay and hamburgerMenu.
157
+ *
158
+ * @event click
159
+ */
160
+ $closeBtn.add($overlay).on('click', close);
161
+
162
+ // init the menu as closed on startup
163
+ close();
164
+ }
165
+ });
166
+ })(jQuery);
@@ -1 +1,18 @@
1
- "use strict";!function(e){e(window).on("load",function(n){e(".header-search-mobile").loadMobileHeader(),e("header.header .content-container").displaySiteName()}),e(window).on("resize",function(n){e("header.header .content-container").displaySiteName()})}(jQuery);
1
+ /**
2
+ * @file
3
+ * Javascript binding of header.functions.js.
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ (function ($) {
9
+ $(window).on('load', function (e) {
10
+ $('.header-search-mobile').loadMobileHeader();
11
+ $('header.header .content-container').displaySiteName();
12
+ });
13
+
14
+ $(window).on('resize', function (e) {
15
+ $('header.header .content-container').displaySiteName();
16
+ });
17
+
18
+ })(jQuery);
@@ -1 +1,73 @@
1
- "use strict";!function(e){e.fn.extend({loadMobileHeader:function(){var s=e(this),n=s.find(".form-search"),o=s.find('input[type="search"]'),i=n.find('input[type="submit"]'),a=s.find(".close");i.on("click",function(e){i.hasClass("js-form-search-opened")||e.preventDefault(),s.addClass("js-form-search-opened"),o.addClass("js-form-search-opened"),a.addClass("js-form-search-opened")}),a.on("click",function(e){e.preventDefault(),s.removeClass("js-form-search-opened"),o.removeClass("js-form-search-opened"),a.removeClass("js-form-search-opened")})},displaySiteName:function(){var s=70,n=null;this.children(".header-component:visible").each(function(){0===e(this).has(".site-logo").length?s+=e(this).width():n=this}),e(n).width(this.width()-s)}})}(jQuery);
1
+ /**
2
+ * @file
3
+ * Implements a responsive search element in
4
+ * the header of a website.
5
+ *
6
+ * @author
7
+ * Wim Vantomme
8
+ *
9
+ */
10
+ 'use strict';
11
+
12
+ (function ($) {
13
+ $.fn.extend({
14
+
15
+ /**
16
+ * Implements a jQuery extension function.
17
+ *
18
+ * @fires event:click
19
+ */
20
+ loadMobileHeader: function () {
21
+ var mobileHeader = $(this);
22
+ var searchForm = mobileHeader.find('.form-search');
23
+ var searchInput = mobileHeader.find('input[type="search"]');
24
+ var searchButton = searchForm.find('input[type="submit"]');
25
+ var closeButton = mobileHeader.find('.close');
26
+
27
+ /**
28
+ * Opens, submits or closes the mobile form.
29
+ *
30
+ * @event click
31
+ */
32
+ searchButton.on('click', function (e) {
33
+ // Prevent button submission when form is closed.
34
+ if (!searchButton.hasClass('js-form-search-opened')) {
35
+ e.preventDefault();
36
+ }
37
+
38
+ mobileHeader.addClass('js-form-search-opened');
39
+ searchInput.addClass('js-form-search-opened');
40
+ closeButton.addClass('js-form-search-opened');
41
+ });
42
+
43
+ // Close the mobile form.
44
+ closeButton.on('click', function (e) {
45
+ e.preventDefault();
46
+ mobileHeader.removeClass('js-form-search-opened');
47
+ searchInput.removeClass('js-form-search-opened');
48
+ closeButton.removeClass('js-form-search-opened');
49
+ });
50
+ },
51
+
52
+ /**
53
+ * Implements a jQuery extension function.
54
+ */
55
+ displaySiteName: function () {
56
+ var componentsWidth = 70;
57
+ var logo = null;
58
+
59
+ // Calculate component width except for logo.
60
+ this.children('.header-component:visible').each(function () {
61
+ if ($(this).has('.site-logo').length === 0) {
62
+ componentsWidth += $(this).width();
63
+ }
64
+ else {
65
+ logo = this;
66
+ }
67
+ });
68
+
69
+ // Set available width on the logo component to show the site title.
70
+ $(logo).width(this.width() - componentsWidth);
71
+ }
72
+ });
73
+ })(jQuery);