hof 23.0.0-frontend-v4-beta.10 → 23.0.0-frontend-v4-beta.12

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.
@@ -12,7 +12,8 @@ module.exports = config => {
12
12
  }
13
13
  const imagesOutput = config.images.out;
14
14
 
15
- // Due to rebrand logo, images are copied from multiple sources and mapping can cause 'File exist errors'. Remove if exists as a file
15
+ // Due to govuk rebrand logo, images are copied from multiple sources & mapping can cause 'File exists' error.
16
+ // Remove if exists as a file
16
17
  if (fs.existsSync(imagesOutput) && !fs.lstatSync(imagesOutput).isDirectory()) {
17
18
  fs.unlinkSync(imagesOutput);
18
19
  }
@@ -27,8 +28,8 @@ module.exports = config => {
27
28
  console.log(`${chalk.yellow('warning')}: Skipping missing images folder: ${src}`);
28
29
  return Promise.resolve();
29
30
  }
30
- return mkdir(config.images.out)
31
- .then(() => spawn('rsync', ['-a', `${src}/.`, config.images.out]));
31
+ return mkdir(imagesOutput)
32
+ .then(() => spawn('cp', ['-r', `${src}/.`, imagesOutput]));
32
33
  }))
33
34
  .catch(e => {
34
35
  if (e.code !== 'ENOENT') {
@@ -1,22 +1,22 @@
1
- /* eslint-disable max-len, no-var, vars-on-top, no-undef */
1
+ /* eslint-disable no-undef */
2
2
  'use strict';
3
3
 
4
4
  // TODO: update package.json(s)
5
5
 
6
6
  function hideFallbackContent(containerId) {
7
- var container = document.getElementById(containerId);
7
+ const container = document.getElementById(containerId);
8
8
  if (container === null) return;
9
- var fallbackContent = container.getElementsByClassName('js-disabled');
10
- for (var i = 0; i < fallbackContent.length; i++) {
9
+ const fallbackContent = container.getElementsByClassName('js-disabled');
10
+ for (let i = 0; i < fallbackContent.length; i++) {
11
11
  fallbackContent[i].style.display = 'none';
12
12
  }
13
13
  }
14
14
 
15
15
  function showInteractiveContent(containerId) {
16
- var container = document.getElementById(containerId);
16
+ const container = document.getElementById(containerId);
17
17
  if (container === null) return;
18
- var interactiveContent = container.getElementsByClassName('js-enabled');
19
- for (var i = 0; i < interactiveContent.length; i++) {
18
+ const interactiveContent = container.getElementsByClassName('js-enabled');
19
+ for (let i = 0; i < interactiveContent.length; i++) {
20
20
  interactiveContent[i].style.display = 'block';
21
21
  }
22
22
  }
@@ -34,7 +34,7 @@ function setCookiePreferences(preferences) {
34
34
  function showCookieBannerSubmitted() {
35
35
  document.getElementById('cookie-banner-info').style.display = 'none';
36
36
  document.getElementById('cookie-banner-actions').style.display = 'none';
37
- var cookieBannerSubmitted;
37
+ let cookieBannerSubmitted;
38
38
  const cookieBannerDiv = document.getElementById('cookie-banner-submitted-accepted');
39
39
  if (cookieBannerDiv.dataset.acceptCookies === 'true') {
40
40
  cookieBannerSubmitted = document.getElementById('cookie-banner-submitted-accepted');
@@ -70,17 +70,17 @@ function initialiseBannerButtons() {
70
70
  }
71
71
 
72
72
  function initialiseCookieBanner() {
73
- var preferences = GOVUK.cookie('cookie_preferences');
73
+ const preferences = GOVUK.cookie('cookie_preferences');
74
74
 
75
75
  if (preferences !== null) {
76
76
  return;
77
77
  }
78
78
 
79
79
  // the default cookie message container from hof-govuk-template
80
- var bannerContainer = document.getElementById('global-cookie-message');
80
+ const bannerContainer = document.getElementById('global-cookie-message');
81
81
 
82
82
  // the cookie banner that will replace the container's default content if using google analytics
83
- var cookieBanner = document.getElementById('cookie-banner');
83
+ const cookieBanner = document.getElementById('cookie-banner');
84
84
 
85
85
  if (bannerContainer !== null && cookieBanner !== null) {
86
86
  hideFallbackContent('global-cookie-message');
@@ -94,8 +94,8 @@ function handleSaveSettings(e) {
94
94
  e.preventDefault();
95
95
  setCookiePreferences({ essential: true, usage: document.getElementById('radio-1').checked });
96
96
 
97
- var cookieNotification = document.getElementById('cookie-notification');
98
- var cookieBanner = document.getElementById('cookie-banner');
97
+ const cookieNotification = document.getElementById('cookie-notification');
98
+ const cookieBanner = document.getElementById('cookie-banner');
99
99
 
100
100
  if (cookieBanner !== null) {
101
101
  cookieBanner.style.display = 'none';
@@ -108,8 +108,8 @@ function handleSaveSettings(e) {
108
108
  }
109
109
 
110
110
  function initialiseFormControls() {
111
- var preferences = JSON.parse(GOVUK.cookie('cookie_preferences'));
112
- var usage;
111
+ const preferences = JSON.parse(GOVUK.cookie('cookie_preferences'));
112
+ let usage;
113
113
 
114
114
  if (preferences !== null && preferences.usage !== undefined && typeof preferences.usage === 'boolean') {
115
115
  usage = preferences.usage;
@@ -123,7 +123,7 @@ function initialiseFormControls() {
123
123
  }
124
124
 
125
125
  function initialiseCookiePage() {
126
- var shouldDisplayCookieControls = document.getElementById('cookie-settings') !== null;
126
+ const shouldDisplayCookieControls = document.getElementById('cookie-settings') !== null;
127
127
 
128
128
  if (shouldDisplayCookieControls) {
129
129
  hideFallbackContent('cookie-settings');
@@ -134,12 +134,12 @@ function initialiseCookiePage() {
134
134
 
135
135
  function onLoad() {
136
136
  window.onload = function () {
137
- var reloading = sessionStorage.getItem('reloading');
137
+ const reloading = sessionStorage.getItem('reloading');
138
138
  if (reloading) {
139
139
  sessionStorage.removeItem('reloading');
140
140
 
141
- var bannerContainer = document.getElementById('global-cookie-message');
142
- var cookieBanner = document.getElementById('cookie-banner');
141
+ const bannerContainer = document.getElementById('global-cookie-message');
142
+ const cookieBanner = document.getElementById('cookie-banner');
143
143
 
144
144
  if (bannerContainer !== null && cookieBanner !== null) {
145
145
  bannerContainer.style.display = 'block';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hof",
3
3
  "description": "A bootstrap for HOF projects",
4
- "version": "23.0.0-frontend-v4-beta.10",
4
+ "version": "23.0.0-frontend-v4-beta.12",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",
@@ -5,19 +5,19 @@
5
5
  // TODO: update package.json(s)
6
6
 
7
7
  function hideFallbackContent(containerId) {
8
- var container = document.getElementById(containerId);
8
+ const container = document.getElementById(containerId);
9
9
  if (container === null) return;
10
- var fallbackContent = container.getElementsByClassName('js-disabled');
11
- for (var i = 0; i < fallbackContent.length; i++) {
10
+ const fallbackContent = container.getElementsByClassName('js-disabled');
11
+ for (let i = 0; i < fallbackContent.length; i++) {
12
12
  fallbackContent[i].style.display = 'none';
13
13
  }
14
14
  }
15
15
 
16
16
  function showInteractiveContent(containerId) {
17
- var container = document.getElementById(containerId);
17
+ const container = document.getElementById(containerId);
18
18
  if (container === null) return;
19
- var interactiveContent = container.getElementsByClassName('js-enabled');
20
- for (var i = 0; i < interactiveContent.length; i++) {
19
+ const interactiveContent = container.getElementsByClassName('js-enabled');
20
+ for (let i = 0; i < interactiveContent.length; i++) {
21
21
  interactiveContent[i].style.display = 'block';
22
22
  }
23
23
  }
@@ -35,7 +35,7 @@ function setCookiePreferences(preferences) {
35
35
  function showCookieBannerSubmitted() {
36
36
  document.getElementById('cookie-banner-info').style.display = 'none';
37
37
  document.getElementById('cookie-banner-actions').style.display = 'none';
38
- var cookieBannerSubmitted;
38
+ let cookieBannerSubmitted;
39
39
  const cookieBannerDiv = document.getElementById('cookie-banner-submitted-accepted');
40
40
  if (cookieBannerDiv.dataset.acceptCookies === 'true') {
41
41
  cookieBannerSubmitted = document.getElementById('cookie-banner-submitted-accepted');
@@ -71,17 +71,17 @@ function initialiseBannerButtons() {
71
71
  }
72
72
 
73
73
  function initialiseCookieBanner() {
74
- var preferences = GOVUK.cookie('cookie_preferences');
74
+ const preferences = GOVUK.cookie('cookie_preferences');
75
75
 
76
76
  if (preferences !== null) {
77
77
  return;
78
78
  }
79
79
 
80
80
  // the default cookie message container from hof-govuk-template
81
- var bannerContainer = document.getElementById('global-cookie-message');
81
+ const bannerContainer = document.getElementById('global-cookie-message');
82
82
 
83
83
  // the cookie banner that will replace the container's default content if using google analytics
84
- var cookieBanner = document.getElementById('cookie-banner');
84
+ const cookieBanner = document.getElementById('cookie-banner');
85
85
 
86
86
  if (bannerContainer !== null && cookieBanner !== null) {
87
87
  hideFallbackContent('global-cookie-message');
@@ -95,8 +95,8 @@ function handleSaveSettings(e) {
95
95
  e.preventDefault();
96
96
  setCookiePreferences({ essential: true, usage: document.getElementById('radio-1').checked });
97
97
 
98
- var cookieNotification = document.getElementById('cookie-notification');
99
- var cookieBanner = document.getElementById('cookie-banner');
98
+ const cookieNotification = document.getElementById('cookie-notification');
99
+ const cookieBanner = document.getElementById('cookie-banner');
100
100
 
101
101
  if (cookieBanner !== null) {
102
102
  cookieBanner.style.display = 'none';
@@ -109,8 +109,8 @@ function handleSaveSettings(e) {
109
109
  }
110
110
 
111
111
  function initialiseFormControls() {
112
- var preferences = JSON.parse(GOVUK.cookie('cookie_preferences'));
113
- var usage;
112
+ const preferences = JSON.parse(GOVUK.cookie('cookie_preferences'));
113
+ let usage;
114
114
 
115
115
  if (preferences !== null && preferences.usage !== undefined && typeof preferences.usage === 'boolean') {
116
116
  usage = preferences.usage;
@@ -124,7 +124,7 @@ function initialiseFormControls() {
124
124
  }
125
125
 
126
126
  function initialiseCookiePage() {
127
- var shouldDisplayCookieControls = document.getElementById('cookie-settings') !== null;
127
+ const shouldDisplayCookieControls = document.getElementById('cookie-settings') !== null;
128
128
 
129
129
  if (shouldDisplayCookieControls) {
130
130
  hideFallbackContent('cookie-settings');
@@ -135,12 +135,12 @@ function initialiseCookiePage() {
135
135
 
136
136
  function onLoad() {
137
137
  window.onload = function () {
138
- var reloading = sessionStorage.getItem('reloading');
138
+ const reloading = sessionStorage.getItem('reloading');
139
139
  if (reloading) {
140
140
  sessionStorage.removeItem('reloading');
141
141
 
142
- var bannerContainer = document.getElementById('global-cookie-message');
143
- var cookieBanner = document.getElementById('cookie-banner');
142
+ const bannerContainer = document.getElementById('global-cookie-message');
143
+ const cookieBanner = document.getElementById('cookie-banner');
144
144
 
145
145
  if (bannerContainer !== null && cookieBanner !== null) {
146
146
  bannerContainer.style.display = 'block';