govuk_publishing_components 21.69.0 → 23.0.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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics.js +16 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/analytics.js +85 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/auto-track-event.js +30 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js +120 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/download-link-tracker.js +41 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/ecommerce.js +101 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/error-tracking.js +51 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/external-link-tracker.js +56 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/google-analytics-universal-tracker.js +198 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/init.js.erb +50 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/mailto-link-tracker.js +38 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +129 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/pii.js +74 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/print-intent.js +39 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/scroll-tracker.js +513 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/static-analytics.js +132 -0
- data/app/assets/javascripts/govuk_publishing_components/lib/track-click.js +61 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +4 -10
- data/app/views/govuk_publishing_components/components/_contents_list.html.erb +8 -13
- data/app/views/govuk_publishing_components/components/_govspeak.html.erb +8 -12
- data/app/views/govuk_publishing_components/components/_input.html.erb +17 -4
- data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_layout_header.html.erb +6 -5
- data/app/views/govuk_publishing_components/components/_panel.html.erb +5 -2
- data/app/views/govuk_publishing_components/components/docs/contents_list.yml +0 -37
- data/app/views/govuk_publishing_components/components/docs/govspeak.yml +1 -6
- data/app/views/govuk_publishing_components/components/docs/input.yml +7 -3
- data/app/views/govuk_publishing_components/components/docs/layout_header.yml +0 -3
- data/app/views/govuk_publishing_components/components/docs/panel.yml +4 -0
- data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +3 -1
- data/config/initializers/assets.rb +1 -0
- data/config/locales/et.yml +4 -0
- data/config/locales/fr.yml +4 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +21 -2
@@ -0,0 +1,74 @@
|
|
1
|
+
/* global $ */
|
2
|
+
|
3
|
+
;(function (global) {
|
4
|
+
'use strict'
|
5
|
+
|
6
|
+
var GOVUK = global.GOVUK || {}
|
7
|
+
var EMAIL_PATTERN = /[^\s=/?&]+(?:@|%40)[^\s=/?&]+/g
|
8
|
+
var POSTCODE_PATTERN = /[A-PR-UWYZ][A-HJ-Z]?[0-9][0-9A-HJKMNPR-Y]?(?:[\s+]|%20)*[0-9][ABD-HJLNPQ-Z]{2}/gi
|
9
|
+
var DATE_PATTERN = /\d{4}(-?)\d{2}(-?)\d{2}/g
|
10
|
+
|
11
|
+
function shouldStripDates () {
|
12
|
+
return ($('meta[name="govuk:static-analytics:strip-dates"]').length > 0)
|
13
|
+
}
|
14
|
+
|
15
|
+
function shouldStripPostcodes () {
|
16
|
+
return ($('meta[name="govuk:static-analytics:strip-postcodes"]').length > 0)
|
17
|
+
}
|
18
|
+
|
19
|
+
var pii = function () {
|
20
|
+
this.stripDatePII = shouldStripDates()
|
21
|
+
this.stripPostcodePII = shouldStripPostcodes()
|
22
|
+
}
|
23
|
+
|
24
|
+
pii.prototype.stripPII = function (value) {
|
25
|
+
if (typeof value === 'string') {
|
26
|
+
return this.stripPIIFromString(value)
|
27
|
+
} else if (Object.prototype.toString.call(value) === '[object Array]' || Object.prototype.toString.call(value) === '[object Arguments]') {
|
28
|
+
return this.stripPIIFromArray(value)
|
29
|
+
} else if (typeof value === 'object') {
|
30
|
+
return this.stripPIIFromObject(value)
|
31
|
+
} else {
|
32
|
+
return value
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
pii.prototype.stripPIIFromString = function (string) {
|
37
|
+
var stripped = string.replace(EMAIL_PATTERN, '[email]')
|
38
|
+
if (this.stripDatePII === true) {
|
39
|
+
stripped = stripped.replace(DATE_PATTERN, '[date]')
|
40
|
+
}
|
41
|
+
if (this.stripPostcodePII === true) {
|
42
|
+
stripped = stripped.replace(POSTCODE_PATTERN, '[postcode]')
|
43
|
+
}
|
44
|
+
return stripped
|
45
|
+
}
|
46
|
+
|
47
|
+
pii.prototype.stripPIIFromObject = function (object) {
|
48
|
+
if (object) {
|
49
|
+
if (object instanceof GOVUK.Analytics.PIISafe) {
|
50
|
+
return object.value
|
51
|
+
} else {
|
52
|
+
for (var property in object) {
|
53
|
+
var value = object[property]
|
54
|
+
|
55
|
+
object[property] = this.stripPII(value)
|
56
|
+
}
|
57
|
+
return object
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
pii.prototype.stripPIIFromArray = function (array) {
|
63
|
+
for (var i = 0, l = array.length; i < l; i++) {
|
64
|
+
var elem = array[i]
|
65
|
+
|
66
|
+
array[i] = this.stripPII(elem)
|
67
|
+
}
|
68
|
+
return array
|
69
|
+
}
|
70
|
+
|
71
|
+
GOVUK.Pii = pii
|
72
|
+
|
73
|
+
global.GOVUK = GOVUK
|
74
|
+
})(window)
|
@@ -0,0 +1,39 @@
|
|
1
|
+
// Extension to monitor attempts to print pages.
|
2
|
+
;(function (global) {
|
3
|
+
'use strict'
|
4
|
+
|
5
|
+
var GOVUK = global.GOVUK || {}
|
6
|
+
|
7
|
+
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {}
|
8
|
+
|
9
|
+
GOVUK.analyticsPlugins.printIntent = function () {
|
10
|
+
var printAttempt = function () {
|
11
|
+
GOVUK.analytics.trackEvent('Print Intent', document.location.pathname)
|
12
|
+
GOVUK.analytics.trackPageview('/print' + document.location.pathname)
|
13
|
+
}
|
14
|
+
|
15
|
+
// Most browsers
|
16
|
+
if (global.matchMedia) {
|
17
|
+
var mediaQueryList = global.matchMedia('print')
|
18
|
+
var mqlListenerCount = 0
|
19
|
+
mediaQueryList.addListener(function (mql) {
|
20
|
+
if (!mql.matches && mqlListenerCount === 0) {
|
21
|
+
printAttempt()
|
22
|
+
mqlListenerCount++
|
23
|
+
// If we try and print again within 3 seconds, don't log it
|
24
|
+
setTimeout(function () {
|
25
|
+
mqlListenerCount = 0
|
26
|
+
// printing will be tracked again now
|
27
|
+
}, 3000)
|
28
|
+
}
|
29
|
+
})
|
30
|
+
}
|
31
|
+
|
32
|
+
// IE < 10
|
33
|
+
if (global.onafterprint) {
|
34
|
+
global.onafterprint = printAttempt
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
global.GOVUK = GOVUK
|
39
|
+
})(window)
|
@@ -0,0 +1,513 @@
|
|
1
|
+
/* global GOVUK, $ */
|
2
|
+
|
3
|
+
(function () {
|
4
|
+
'use strict'
|
5
|
+
|
6
|
+
window.GOVUK = window.GOVUK || {}
|
7
|
+
|
8
|
+
var CONFIG = {
|
9
|
+
'/transition': [
|
10
|
+
['Percent', 20],
|
11
|
+
['Percent', 40],
|
12
|
+
['Percent', 60],
|
13
|
+
['Percent', 80],
|
14
|
+
['Percent', 100]
|
15
|
+
],
|
16
|
+
'/government/publications/coronavirus-outbreak-faqs-what-you-can-and-cant-do/coronavirus-outbreak-faqs-what-you-can-and-cant-do': [
|
17
|
+
['Percent', 20],
|
18
|
+
['Percent', 40],
|
19
|
+
['Percent', 60],
|
20
|
+
['Percent', 80],
|
21
|
+
['Percent', 100]
|
22
|
+
],
|
23
|
+
'/government/publications/coronavirus-covid-19-online-education-resources/coronavirus-covid-19-list-of-online-education-resources-for-home-education': [
|
24
|
+
['Percent', 20],
|
25
|
+
['Percent', 40],
|
26
|
+
['Percent', 60],
|
27
|
+
['Percent', 80],
|
28
|
+
['Percent', 100]
|
29
|
+
],
|
30
|
+
'/guidance/coronavirus-covid-19-information-for-the-public': [
|
31
|
+
['Percent', 20],
|
32
|
+
['Percent', 40],
|
33
|
+
['Percent', 60],
|
34
|
+
['Percent', 80],
|
35
|
+
['Percent', 100]
|
36
|
+
],
|
37
|
+
'/guidance/saving-for-retirement-if-youre-aged-16-to-50': [
|
38
|
+
['Heading', 'Keep track of your State Pension'],
|
39
|
+
['Heading', 'Consider ways to improve your State Pension'],
|
40
|
+
['Heading', 'Personal and stakeholder pensions']
|
41
|
+
],
|
42
|
+
'/guidance/planning-for-retirement-if-youre-aged-50-or-over': [
|
43
|
+
['Heading', 'Find out your State Pension age'],
|
44
|
+
['Heading', 'Consider ways to improve your State Pension'],
|
45
|
+
['Heading', 'Workplace, personal and stakeholder pensions'],
|
46
|
+
['Heading', 'Personal and stakeholder pensions']
|
47
|
+
],
|
48
|
+
'/guidance/retirement-planning-for-current-pensioners': [
|
49
|
+
['Heading', 'If you reached State Pension age before 6 April 2016'],
|
50
|
+
['Heading', 'Other ways to increase your income in retirement'],
|
51
|
+
['Heading', 'Further support in retirement'],
|
52
|
+
['Heading', 'Winter Fuel Payments']
|
53
|
+
],
|
54
|
+
'/government/collections/disability-confident-campaign': [
|
55
|
+
['Heading', 'Become a Disability Confident employer'],
|
56
|
+
['Heading', 'Aims and objectives'],
|
57
|
+
['Heading', 'Inclusive communication']
|
58
|
+
],
|
59
|
+
'/government/publications/the-essential-trustee-what-you-need-to-know-cc3/the-essential-trustee-what-you-need-to-know-what-you-need-to-do': [
|
60
|
+
['Heading', '1. About this guidance'],
|
61
|
+
['Heading', '2. Trustees’ duties at a glance'],
|
62
|
+
['Heading', '3. Who can be a trustee and how trustees are appointed'],
|
63
|
+
['Heading', '4. Ensure your charity is carrying out its purposes for the public benefit'],
|
64
|
+
['Heading', '5. Comply with your charity’s governing document and the law'],
|
65
|
+
['Heading', '6. Act in your charity’s best interests'],
|
66
|
+
['Heading', '7. Manage your charity’s resources responsibly'],
|
67
|
+
['Heading', '8. Act with reasonable care and skill'],
|
68
|
+
['Heading', '9. Ensure your charity is accountable'],
|
69
|
+
['Heading', '10. Reduce the risk of liability'],
|
70
|
+
['Heading', '11. Your charity’s legal structure and what it means'],
|
71
|
+
['Heading', '12. Charity officers - the chair and treasurer'],
|
72
|
+
['Heading', '13. Technical terms used in this guidance']
|
73
|
+
],
|
74
|
+
'/guidance/universal-credit-how-it-helps-you-into-work': [
|
75
|
+
['Heading', 'Support from your work coach'],
|
76
|
+
['Heading', 'Help available for parents'],
|
77
|
+
['Heading', 'When you can claim Universal Credit'],
|
78
|
+
['Heading', 'More detailed advice']
|
79
|
+
],
|
80
|
+
'/openingupwork': [
|
81
|
+
['Heading', 'How Universal Credit makes work pay'],
|
82
|
+
['Heading', 'When you can claim Universal Credit'],
|
83
|
+
['Heading', 'Help and advice']
|
84
|
+
],
|
85
|
+
'/government/publications/spring-budget-2017-documents/spring-budget-2017': [
|
86
|
+
['Heading', '1. Executive summary'],
|
87
|
+
['Heading', '2. Economic context and public finances'],
|
88
|
+
['Heading', '3. Policy decisions'],
|
89
|
+
['Heading', '4. Tax'],
|
90
|
+
['Heading', '5. Productivity'],
|
91
|
+
['Heading', '6. Public services and markets'],
|
92
|
+
['Heading', '7. Annex A: Financing'],
|
93
|
+
['Heading', '8. Annex B: Office for Budget Responsibility\'s Economic and fiscal outlook']
|
94
|
+
],
|
95
|
+
'/guidance/living-in-the-eu-prepare-for-brexit': [
|
96
|
+
['Heading', 'Travelling in the EU']
|
97
|
+
],
|
98
|
+
'/guidance/driving-in-the-eu-after-brexit-driving-licence-exchange': [
|
99
|
+
['Heading', 'Belgium']
|
100
|
+
],
|
101
|
+
'/settled-status-eu-citizens-families': [
|
102
|
+
['Heading', 'When you can apply']
|
103
|
+
],
|
104
|
+
'/guidance/returning-to-the-uk': [
|
105
|
+
['Heading', 'Ending your time living abroad']
|
106
|
+
],
|
107
|
+
'/council-housing': [
|
108
|
+
['Heading', 'Choice-based lettings']
|
109
|
+
],
|
110
|
+
'/guidance/foreign-travel-insurance': [
|
111
|
+
['Heading', 'What your travel insurance policy should cover']
|
112
|
+
],
|
113
|
+
'/guidance/passport-rules-for-travel-to-europe-after-brexit': [
|
114
|
+
['Heading', 'List of countries affected']
|
115
|
+
],
|
116
|
+
'/visit-europe-brexit': [
|
117
|
+
['Heading', 'Travel']
|
118
|
+
],
|
119
|
+
'/guidance/uk-nationals-in-the-eu-benefits-and-pensions-in-a-no-deal-scenario': [
|
120
|
+
['Heading', 'Pensions and benefits paid by an EEA state or Switzerland']
|
121
|
+
],
|
122
|
+
'/guidance/uk-students-in-the-eu-continuing-your-studies': [
|
123
|
+
['Heading', 'Check whether you’ll get financial help']
|
124
|
+
],
|
125
|
+
'/government/publications/cross-border-maintenance-cases-after-brexit-guidance-for-public/cross-border-maintenance-cases-after-brexit': [
|
126
|
+
['Heading', '2. New cases after Brexit']
|
127
|
+
],
|
128
|
+
'/guidance/social-security-contributions-for-uk-and-eu-workers-if-the-uk-leaves-the-eu-with-no-deal': [
|
129
|
+
['Heading', 'UK employers'],
|
130
|
+
['Heading', 'UK employees and self-employed']
|
131
|
+
],
|
132
|
+
'/guidance/student-finance-arrangements-in-a-no-deal-scenario': [
|
133
|
+
['Heading', 'Other overseas study placements']
|
134
|
+
],
|
135
|
+
'/guidance/advice-for-british-nationals-travelling-and-living-in-europe': [
|
136
|
+
['Heading', 'Travelling to the UK']
|
137
|
+
],
|
138
|
+
'/guidance/living-in-france': [
|
139
|
+
['Heading', 'Passports and travel']
|
140
|
+
],
|
141
|
+
'/family-permit': [
|
142
|
+
['Heading', 'EEA family permit']
|
143
|
+
],
|
144
|
+
'/guidance/european-temporary-leave-to-remain-in-the-uk': [
|
145
|
+
['Heading', 'Applying for European temporary leave to remain']
|
146
|
+
],
|
147
|
+
'/guidance/visiting-the-uk-after-brexit': [
|
148
|
+
['Heading', 'If the UK leaves the EU without a deal']
|
149
|
+
],
|
150
|
+
'/guidance/healthcare-for-eu-and-efta-citizens-visiting-the-uk': [
|
151
|
+
['Heading', 'Travel insurance']
|
152
|
+
],
|
153
|
+
'/guidance/qualified-teacher-status-qts': [
|
154
|
+
['Heading', 'Teachers recognised in the EEA or Switzerland']
|
155
|
+
],
|
156
|
+
'/guidance/driving-in-the-eu-after-brexit': [
|
157
|
+
['Heading', 'GB stickers and number plates']
|
158
|
+
],
|
159
|
+
'/visit-europe-brexit#travel': [
|
160
|
+
['Heading', 'Compensation if your travel is disrupted']
|
161
|
+
],
|
162
|
+
'/apply-for-a-uk-residence-card': [
|
163
|
+
['Heading', 'Fees']
|
164
|
+
],
|
165
|
+
'/guidance/studying-in-the-european-union-after-brexit': [
|
166
|
+
['Heading', 'Applying for Erasmus+']
|
167
|
+
],
|
168
|
+
'/settled-status-eu-citizens-families/not-EU-EEA-Swiss-citizen': [
|
169
|
+
['Heading', 'If you’re a family member of an EU, EEA or Swiss citizen']
|
170
|
+
],
|
171
|
+
'/guidance/get-your-eea-qualification-recognised-in-the-uk-after-brexit': [
|
172
|
+
['Heading', 'Professionals already working in the UK']
|
173
|
+
],
|
174
|
+
'/guidance/visiting-the-uk-after-brexit#if-your-vehicle-is-not-insured-in-the-uk': [
|
175
|
+
['Heading', 'If your vehicle is not insured in the UK']
|
176
|
+
],
|
177
|
+
'/guidance/uk-residents-visiting-the-eueea-and-switzerland-healthcare': [
|
178
|
+
['Heading', 'European Health Insurance Cards (EHIC)']
|
179
|
+
],
|
180
|
+
'/guidance/pet-travel-to-europe-after-brexit': [
|
181
|
+
['Heading', 'Pet travel if there’s a no-deal Brexit']
|
182
|
+
],
|
183
|
+
'/guidance/driving-in-the-eu-after-brexit-international-driving-permits': [
|
184
|
+
['Heading', 'Check which type of IDP you need']
|
185
|
+
],
|
186
|
+
'/guidance/driving-in-the-eu-after-brexit#insurance-for-your-vehicle-caravan-or-trailer': [
|
187
|
+
['Heading', 'Trailer registration']
|
188
|
+
],
|
189
|
+
'/driving-abroad': [
|
190
|
+
['Heading', 'Check your insurance if you’re taking your own vehicle']
|
191
|
+
],
|
192
|
+
'/get-a-passport-urgently': [
|
193
|
+
['Heading', 'Ways to apply']
|
194
|
+
],
|
195
|
+
'/guidance/mobile-roaming-after-eu-exit': [
|
196
|
+
['Heading', 'If you live in Northern Ireland']
|
197
|
+
],
|
198
|
+
'/government/publications/mobile-roaming-after-eu-exit/mobile-roaming-if-theres-no-brexit-deal': [
|
199
|
+
['Heading', '1.2 If there’s no deal']
|
200
|
+
],
|
201
|
+
'/driving-abroad/international-driving-permit': [
|
202
|
+
['Heading', 'Check which IDP you need']
|
203
|
+
],
|
204
|
+
'/vehicle-insurance/driving-abroad': [
|
205
|
+
['Heading', 'Driving in other countries']
|
206
|
+
],
|
207
|
+
'/guidance/driving-in-the-eu-after-brexit#gb-stickers-and-number-plates': [
|
208
|
+
['Heading', 'GB stickers and number plates']
|
209
|
+
],
|
210
|
+
'/guidance/importing-and-exporting-plants-and-plant-products-if-theres-no-withdrawal-deal': [
|
211
|
+
['Heading', 'Movement of wood packaging material']
|
212
|
+
],
|
213
|
+
'/guidance/egg-marketing-standards-if-theres-a-no-deal-brexit': [
|
214
|
+
['Heading', 'Customs checks']
|
215
|
+
],
|
216
|
+
'/guidance/hatching-eggs-and-chicks-marketing-standards-when-the-uk-leaves-the-eu': [
|
217
|
+
['Heading', 'Customs checks']
|
218
|
+
],
|
219
|
+
'/guidance/poultry-meat-marketing-standards-when-the-uk-leaves-the-eu': [
|
220
|
+
['Heading', 'Marketing standards checks']
|
221
|
+
],
|
222
|
+
'/guidance/plant-variety-rights-and-marketing-plant-reproductive-material-if-the-uk-leaves-the-eu-without-a-deal': [
|
223
|
+
['Heading', 'Rules for applying for plant variety rights if there’s a no deal Brexit']
|
224
|
+
],
|
225
|
+
'/guidance/exporting-animals-animal-products-fish-and-fishery-products-if-the-uk-leaves-the-eu-with-no-deal': [
|
226
|
+
['Heading', 'Exports to non-EU countries (third countries) from the UK']
|
227
|
+
],
|
228
|
+
'/guidance/the-farming-sector-and-preparing-for-eu-exit': [
|
229
|
+
['Heading', 'Farm and rural payments: Basic Payment Scheme and Rural Development Programme for England']
|
230
|
+
],
|
231
|
+
'/guidance/protecting-food-and-drink-names-if-theres-no-brexit-deal': [
|
232
|
+
['Heading', 'New product applications']
|
233
|
+
],
|
234
|
+
'/guidance/trading-and-labelling-organic-food-if-theres-no-brexit-deal': [
|
235
|
+
['Heading', 'Exporting organic food to the EU']
|
236
|
+
],
|
237
|
+
'/guidance/hops-and-hops-products-marketing-standards-if-the-uk-leaves-the-eu-without-a-deal': [
|
238
|
+
['Heading', 'How to apply for an EU Attestation of Equivalence']
|
239
|
+
],
|
240
|
+
'/guidance/guidance-for-suppliers-of-cattle-sheep-and-goat-ear-tags': [
|
241
|
+
['Heading', 'Tagging information for livestock keepers']
|
242
|
+
],
|
243
|
+
'/government/publications/meeting-climate-change-requirements-if-theres-no-brexit-deal/meeting-climate-change-requirements-if-theres-no-brexit-deal': [
|
244
|
+
['Heading', 'Summary of actions']
|
245
|
+
],
|
246
|
+
'/guidance/food-labelling-changes-after-brexit': [
|
247
|
+
['Heading', 'Goods sold in the UK']
|
248
|
+
],
|
249
|
+
'/guidance/export-horses-and-ponies-special-rules': [
|
250
|
+
['Heading', 'Moving equines to the EU in a no-deal Brexit']
|
251
|
+
],
|
252
|
+
'/guidance/trading-and-moving-endangered-species-protected-by-cites-if-theres-no-withdrawal-deal': [
|
253
|
+
['Heading', 'Trading with the EU']
|
254
|
+
],
|
255
|
+
'/guidance/wine-trade-regulations': [
|
256
|
+
['Heading', 'Rules for transporting wine into the UK']
|
257
|
+
],
|
258
|
+
'/guidance/the-food-and-drink-sector-and-preparing-for-eu-exit': [
|
259
|
+
['Heading', 'Importing and exporting']
|
260
|
+
],
|
261
|
+
'/guidance/exporting-and-importing-fish-if-theres-no-brexit-deal': [
|
262
|
+
['Heading', 'Send fish to an EU border control post']
|
263
|
+
],
|
264
|
+
'/guidance/the-fisheries-sector-and-preparing-for-eu-exit': [
|
265
|
+
['Heading', 'Licensing arrangements']
|
266
|
+
],
|
267
|
+
'/guidance/import-fish-after-a-no-deal-brexit': [
|
268
|
+
['Heading', 'Direct landings into the UK']
|
269
|
+
],
|
270
|
+
'/guidance/the-chemicals-sector-and-preparing-for-eu-exit': [
|
271
|
+
['Heading', 'Energy and climate']
|
272
|
+
],
|
273
|
+
'/government/publications/trading-electricity-if-theres-no-brexit-deal/trading-electricity-if-theres-no-brexit-deal': [
|
274
|
+
['Heading', 'Summary of actions']
|
275
|
+
],
|
276
|
+
'/guidance/how-to-move-goods-between-or-through-common-transit-countries-including-the-eu': [
|
277
|
+
['Heading', 'Start moving your goods']
|
278
|
+
],
|
279
|
+
'/guidance/ecmt-international-road-haulage-permits': [
|
280
|
+
['Heading', 'Apply for permits']
|
281
|
+
],
|
282
|
+
'/guidance/transporting-goods-between-the-uk-and-eu-in-a-no-deal-brexit-guidance-for-hauliers': [
|
283
|
+
['Heading', 'Cross-border responsibilities when moving goods']
|
284
|
+
],
|
285
|
+
'/guidance/carry-out-international-road-haulage-after-brexit': [
|
286
|
+
['Heading', 'Vehicle and trailer insurance']
|
287
|
+
],
|
288
|
+
'/guidance/prepare-to-drive-in-the-eu-after-brexit-lorry-and-goods-vehicle-drivers': [
|
289
|
+
['Heading', 'Driver CPC for lorry drivers']
|
290
|
+
],
|
291
|
+
'/guidance/run-international-bus-or-coach-services-after-brexit': [
|
292
|
+
['Heading', 'Run regular international services']
|
293
|
+
],
|
294
|
+
'/guidance/vehicle-type-approval-if-theres-no-brexit-deal': [
|
295
|
+
['Heading', 'Existing vehicle and component type-approvals']
|
296
|
+
],
|
297
|
+
'/guidance/hauliers-and-commercial-drivers-you-will-need-new-documents-to-transport-goods-into-the-eu-after-brexit': [
|
298
|
+
['Heading', 'Driver documents']
|
299
|
+
],
|
300
|
+
'/guidance/how-to-move-goods-through-roro-locations-in-a-no-deal-brexit-eu-to-uk-and-uk-to-eu': [
|
301
|
+
['Heading', 'EU to UK: pre-journey from EU to the UK']
|
302
|
+
],
|
303
|
+
'/guidance/the-retail-sector-and-preparing-for-eu-exit': [
|
304
|
+
['Heading', 'Importing and exporting']
|
305
|
+
],
|
306
|
+
'/guidance/the-consumer-goods-sector-and-preparing-for-eu-exit': [
|
307
|
+
['Heading', 'Importing and exporting']
|
308
|
+
],
|
309
|
+
'/guidance/textile-labelling-after-brexit': [
|
310
|
+
['Heading', 'Labelling requirements']
|
311
|
+
],
|
312
|
+
'/guidance/footwear-labelling-after-brexit': [
|
313
|
+
['Heading', 'Labelling requirements']
|
314
|
+
],
|
315
|
+
'/government/publications/banking-insurance-and-other-financial-services-if-theres-no-brexit-deal/banking-insurance-and-other-financial-services-if-theres-no-brexit-deal-information-for-financial-services-institutions': [
|
316
|
+
['Heading', '3. Action taken by the UK']
|
317
|
+
],
|
318
|
+
'/government/publications/eu-lawyers-in-the-uk-after-a-no-deal-brexit/eu-lawyers-in-the-uk-after-a-no-deal-brexit': [
|
319
|
+
['Heading', 'Lawyers with EU, Norway, Iceland or Liechtenstein qualifications and professional titles']
|
320
|
+
],
|
321
|
+
'/government/publications/further-guidance-note-on-the-regulation-of-medicines-medical-devices-and-clinical-trials-if-theres-no-brexit-deal/further-guidance-note-on-the-regulation-of-medicines-medical-devices-and-clinical-trials-if-theres-no-brexit-deal': [
|
322
|
+
['Heading', '1.4 Orphan medicines']
|
323
|
+
],
|
324
|
+
'/guidance/accounting-if-theres-no-brexit-deal': [
|
325
|
+
['Heading', 'UK public companies with an EEA listing']
|
326
|
+
],
|
327
|
+
'/guidance/broadcasting-and-video-on-demand-if-theres-no-brexit-deal': [
|
328
|
+
['Heading', 'Get local legal advice about your video on-demand services']
|
329
|
+
],
|
330
|
+
'/guidance/changes-to-copyright-law-after-brexit': [
|
331
|
+
['Heading', 'Artist’s resale right']
|
332
|
+
],
|
333
|
+
'/guidance/changes-to-eu-and-international-designs-and-trade-mark-protection-after-brexit': [
|
334
|
+
['Heading', 'Registered design']
|
335
|
+
],
|
336
|
+
'/guidance/check-temporary-rates-of-customs-duty-on-imports-after-eu-exit': [
|
337
|
+
['Heading', 'Tariff-rate quotas (TRQ)']
|
338
|
+
],
|
339
|
+
'/guidance/construction-products-regulation-if-there-is-no-brexit-deal': [
|
340
|
+
['Heading', 'UK manufacturers exporting to the EU']
|
341
|
+
],
|
342
|
+
'/guidance/european-and-domestic-funding-after-brexit': [
|
343
|
+
['Heading', 'What you need to do']
|
344
|
+
],
|
345
|
+
'/guidance/exhaustion-of-ip-rights-and-parallel-trade-after-brexit': [
|
346
|
+
['Heading', 'Actions for IP rights holders']
|
347
|
+
],
|
348
|
+
'/guidance/exporting-nuclear-related-items-after-brexit': [
|
349
|
+
['Heading', 'Exporting dual-use items']
|
350
|
+
],
|
351
|
+
'/guidance/guidance-on-substantial-amendments-to-a-clinical-trial-if-the-uk-leaves-the-eu-with-no-deal': [
|
352
|
+
['Heading', 'Investigational medicinal product (IMP) certification and importation']
|
353
|
+
],
|
354
|
+
'/guidance/importing-and-exporting-waste-if-theres-no-brexit-deal': [
|
355
|
+
['Heading', 'Rules after the UK leaves the EU']
|
356
|
+
],
|
357
|
+
'/guidance/merger-review-and-anti-competitive-activity-after-brexit': [
|
358
|
+
['Heading', 'Mergers']
|
359
|
+
],
|
360
|
+
'/guidance/nis-regulations-what-uk-digital-service-providers-operating-in-the-eu-should-do-after-brexit': [
|
361
|
+
['Heading', 'How RDSPs are regulated in the UK']
|
362
|
+
],
|
363
|
+
'/guidance/placing-manufactured-goods-on-the-eu-internal-market-if-theres-no-deal': [
|
364
|
+
['Heading', 'Appointing an authorised representative or responsible person in the EU']
|
365
|
+
],
|
366
|
+
'/guidance/prepare-to-import-relevant-nuclear-materials-from-the-eu-after-brexit-licensing-requirements': [
|
367
|
+
['Heading', 'More information']
|
368
|
+
],
|
369
|
+
'/guidance/prepare-to-use-the-ukca-mark-after-brexit': [
|
370
|
+
['Heading', 'Check whether you will need to use the new UKCA marking']
|
371
|
+
],
|
372
|
+
'/guidance/prepare-to-work-and-operate-in-the-european-aviation-sector-after-brexit': [
|
373
|
+
['Heading', 'Requirements for aviation businesses operating in Europe after the UK leaves the EU']
|
374
|
+
],
|
375
|
+
'/guidance/public-sector-procurement-after-a-no-deal-brexit': [
|
376
|
+
['Heading', 'What will change for contracting authorities and entities']
|
377
|
+
],
|
378
|
+
'/guidance/satellites-and-space-programmes-after-brexit': [
|
379
|
+
['Heading', 'Copernicus']
|
380
|
+
],
|
381
|
+
'/guidance/shipping-radioactive-waste-and-spent-fuel-after-brexit': [
|
382
|
+
['Heading', 'After Brexit']
|
383
|
+
],
|
384
|
+
'/guidance/trading-timber-imports-and-exports-if-theres-no-brexit-deal': [
|
385
|
+
['Heading', 'Importing timber for the UK market']
|
386
|
+
],
|
387
|
+
'/guidance/what-you-need-to-move-goods-between-or-through-common-transit-countries-including-the-eu': [
|
388
|
+
['Heading', 'Getting a guarantee']
|
389
|
+
],
|
390
|
+
'/taking-goods-out-uk-temporarily/get-an-ata-carnet': [
|
391
|
+
['Heading', 'Using an ATA Carnet']
|
392
|
+
],
|
393
|
+
'/wood-packaging-import-export': [
|
394
|
+
['Heading', 'Export solid wood packaging']
|
395
|
+
],
|
396
|
+
'/government/publications/vat-for-businesses-if-theres-no-brexit-deal/vat-for-businesses-if-theres-no-brexit-deal': [
|
397
|
+
['Heading', 'UK businesses importing goods from the EU']
|
398
|
+
],
|
399
|
+
'/guidance/answers-to-the-most-common-topics-asked-about-by-the-public-for-the-coronavirus-press-conference': [
|
400
|
+
['Percent', 20],
|
401
|
+
['Percent', 40],
|
402
|
+
['Percent', 60],
|
403
|
+
['Percent', 80],
|
404
|
+
['Percent', 100]
|
405
|
+
],
|
406
|
+
'/eubusiness': [
|
407
|
+
['Heading', 'Additional help and support']
|
408
|
+
]
|
409
|
+
}
|
410
|
+
|
411
|
+
function ScrollTracker (sitewideConfig) {
|
412
|
+
this.config = this.getConfigForCurrentPath(sitewideConfig)
|
413
|
+
this.SCROLL_TIMEOUT_DELAY = 10
|
414
|
+
|
415
|
+
if (!this.config) {
|
416
|
+
this.enabled = false
|
417
|
+
return
|
418
|
+
}
|
419
|
+
this.enabled = true
|
420
|
+
|
421
|
+
this.trackedNodes = this.buildNodes(this.config)
|
422
|
+
|
423
|
+
$(window).scroll($.proxy(this.onScroll, this))
|
424
|
+
this.trackVisibleNodes()
|
425
|
+
};
|
426
|
+
|
427
|
+
ScrollTracker.prototype.getConfigForCurrentPath = function (sitewideConfig) {
|
428
|
+
for (var path in sitewideConfig) {
|
429
|
+
if (this.normalisePath(window.location.pathname) === this.normalisePath(path)) {
|
430
|
+
return sitewideConfig[path]
|
431
|
+
}
|
432
|
+
}
|
433
|
+
}
|
434
|
+
|
435
|
+
ScrollTracker.prototype.buildNodes = function (config) {
|
436
|
+
var nodes = []
|
437
|
+
var NodeConstructor, nodeData
|
438
|
+
|
439
|
+
for (var i = 0; i < config.length; i++) {
|
440
|
+
NodeConstructor = ScrollTracker[config[i][0] + 'Node']
|
441
|
+
nodeData = config[i][1]
|
442
|
+
nodes.push(new NodeConstructor(nodeData))
|
443
|
+
}
|
444
|
+
|
445
|
+
return nodes
|
446
|
+
}
|
447
|
+
|
448
|
+
ScrollTracker.prototype.normalisePath = function (path) {
|
449
|
+
return path.split('/').join('')
|
450
|
+
}
|
451
|
+
|
452
|
+
ScrollTracker.prototype.onScroll = function () {
|
453
|
+
clearTimeout(this.scrollTimeout)
|
454
|
+
this.scrollTimeout = setTimeout($.proxy(this.trackVisibleNodes, this), this.SCROLL_TIMEOUT_DELAY)
|
455
|
+
}
|
456
|
+
|
457
|
+
ScrollTracker.prototype.trackVisibleNodes = function () {
|
458
|
+
for (var i = 0; i < this.trackedNodes.length; i++) {
|
459
|
+
if (this.trackedNodes[i].isVisible() && !this.trackedNodes[i].alreadySeen) {
|
460
|
+
this.trackedNodes[i].alreadySeen = true
|
461
|
+
|
462
|
+
var action = this.trackedNodes[i].eventData.action
|
463
|
+
var label = this.trackedNodes[i].eventData.label
|
464
|
+
|
465
|
+
GOVUK.analytics.trackEvent('ScrollTo', action, { label: label, nonInteraction: true })
|
466
|
+
}
|
467
|
+
}
|
468
|
+
}
|
469
|
+
|
470
|
+
ScrollTracker.PercentNode = function (percentage) {
|
471
|
+
this.percentage = percentage
|
472
|
+
this.eventData = { action: 'Percent', label: String(percentage) }
|
473
|
+
}
|
474
|
+
|
475
|
+
ScrollTracker.PercentNode.prototype.isVisible = function () {
|
476
|
+
return this.currentScrollPercent() >= this.percentage
|
477
|
+
}
|
478
|
+
|
479
|
+
ScrollTracker.PercentNode.prototype.currentScrollPercent = function () {
|
480
|
+
var $document = $(document)
|
481
|
+
var $window = $(window)
|
482
|
+
return (($window.scrollTop() / ($document.height() - $window.height())) * 100.0)
|
483
|
+
}
|
484
|
+
|
485
|
+
ScrollTracker.HeadingNode = function (headingText) {
|
486
|
+
this.$element = getHeadingElement(headingText)
|
487
|
+
this.eventData = { action: 'Heading', label: headingText }
|
488
|
+
|
489
|
+
function getHeadingElement (headingText) {
|
490
|
+
var $headings = $('h1, h2, h3, h4, h5, h6')
|
491
|
+
for (var i = 0; i < $headings.length; i++) {
|
492
|
+
if ($.trim($headings.eq(i).text()).replace(/\s/g, ' ') === headingText) return $headings.eq(i)
|
493
|
+
}
|
494
|
+
}
|
495
|
+
}
|
496
|
+
|
497
|
+
ScrollTracker.HeadingNode.prototype.isVisible = function () {
|
498
|
+
if (!this.$element) return false
|
499
|
+
return this.elementIsVisible(this.$element)
|
500
|
+
}
|
501
|
+
|
502
|
+
ScrollTracker.HeadingNode.prototype.elementIsVisible = function ($element) {
|
503
|
+
var $window = $(window)
|
504
|
+
var positionTop = $element.offset().top
|
505
|
+
return (positionTop > $window.scrollTop() && positionTop < ($window.scrollTop() + $window.height()))
|
506
|
+
}
|
507
|
+
|
508
|
+
$().ready(function () {
|
509
|
+
window.GOVUK.scrollTracker = new ScrollTracker(CONFIG)
|
510
|
+
})
|
511
|
+
|
512
|
+
window.GOVUK.ScrollTracker = ScrollTracker
|
513
|
+
}())
|