hof 23.0.0-frontend-v4-beta.11 → 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.
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/* eslint-disable
|
|
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
|
-
|
|
7
|
+
const container = document.getElementById(containerId);
|
|
8
8
|
if (container === null) return;
|
|
9
|
-
|
|
10
|
-
for (
|
|
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
|
-
|
|
16
|
+
const container = document.getElementById(containerId);
|
|
17
17
|
if (container === null) return;
|
|
18
|
-
|
|
19
|
-
for (
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
98
|
-
|
|
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
|
-
|
|
112
|
-
|
|
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
|
-
|
|
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
|
-
|
|
137
|
+
const reloading = sessionStorage.getItem('reloading');
|
|
138
138
|
if (reloading) {
|
|
139
139
|
sessionStorage.removeItem('reloading');
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
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
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
// TODO: update package.json(s)
|
|
6
6
|
|
|
7
7
|
function hideFallbackContent(containerId) {
|
|
8
|
-
|
|
8
|
+
const container = document.getElementById(containerId);
|
|
9
9
|
if (container === null) return;
|
|
10
|
-
|
|
11
|
-
for (
|
|
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
|
-
|
|
17
|
+
const container = document.getElementById(containerId);
|
|
18
18
|
if (container === null) return;
|
|
19
|
-
|
|
20
|
-
for (
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
99
|
-
|
|
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
|
-
|
|
113
|
-
|
|
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
|
-
|
|
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
|
-
|
|
138
|
+
const reloading = sessionStorage.getItem('reloading');
|
|
139
139
|
if (reloading) {
|
|
140
140
|
sessionStorage.removeItem('reloading');
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
|
|
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';
|