govuk_publishing_components 27.17.0 → 28.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/govuk_publishing_components/image-card-srcset/cop26-170.jpg +0 -0
- data/app/assets/images/govuk_publishing_components/image-card-srcset/cop26-240.jpg +0 -0
- data/app/assets/images/govuk_publishing_components/image-card-srcset/cop26-320.jpg +0 -0
- data/app/assets/images/govuk_publishing_components/image-card-srcset/cop26-480.jpg +0 -0
- data/app/assets/images/govuk_publishing_components/image-card-srcset/cop26.jpg +0 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/download-link-tracker.js +21 -16
- data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/analytics/external-link-tracker.js +46 -32
- data/app/assets/javascripts/govuk_publishing_components/analytics/google-analytics-universal-tracker.js +20 -7
- data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +74 -65
- data/app/assets/javascripts/govuk_publishing_components/analytics/scroll-tracker.js +1 -126
- data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +18 -18
- data/app/assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js +25 -11
- data/app/assets/javascripts/govuk_publishing_components/lib/extend-object.js +22 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +19 -14
- data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +6 -35
- data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +17 -7
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +5 -104
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +24 -14
- data/app/assets/stylesheets/govuk_publishing_components/components/_signup-link.scss +34 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_single-page-notification-button.scss +8 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss +7 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/mixins/_grid-helper.scss +141 -0
- data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +5 -1
- data/app/views/govuk_publishing_components/components/_image_card.html.erb +1 -0
- data/app/views/govuk_publishing_components/components/_intervention.html.erb +10 -1
- data/app/views/govuk_publishing_components/components/_search.html.erb +1 -0
- data/app/views/govuk_publishing_components/components/_signup_link.html.erb +30 -0
- data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb +3 -3
- data/app/views/govuk_publishing_components/components/contextual_sidebar/_covid_cta.html.erb +27 -0
- data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +15 -87
- data/app/views/govuk_publishing_components/components/docs/feedback.yml +5 -0
- data/app/views/govuk_publishing_components/components/docs/image_card.yml +29 -0
- data/app/views/govuk_publishing_components/components/docs/intervention.yml +9 -0
- data/app/views/govuk_publishing_components/components/docs/search.yml +3 -0
- data/app/views/govuk_publishing_components/components/docs/signup_link.yml +39 -0
- data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +9 -6
- data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +4 -3
- data/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb +4 -4
- data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +1 -1
- data/config/locales/ar.yml +0 -8
- data/config/locales/az.yml +0 -8
- data/config/locales/be.yml +0 -8
- data/config/locales/bg.yml +0 -8
- data/config/locales/bn.yml +0 -8
- data/config/locales/cs.yml +0 -8
- data/config/locales/cy.yml +0 -8
- data/config/locales/da.yml +0 -8
- data/config/locales/de.yml +0 -8
- data/config/locales/dr.yml +0 -8
- data/config/locales/el.yml +0 -8
- data/config/locales/en.yml +9 -13
- data/config/locales/es-419.yml +0 -8
- data/config/locales/es.yml +0 -8
- data/config/locales/et.yml +0 -8
- data/config/locales/fa.yml +0 -8
- data/config/locales/fi.yml +0 -8
- data/config/locales/fr.yml +0 -8
- data/config/locales/gd.yml +0 -8
- data/config/locales/gu.yml +0 -8
- data/config/locales/he.yml +0 -8
- data/config/locales/hi.yml +0 -8
- data/config/locales/hr.yml +0 -8
- data/config/locales/hu.yml +0 -8
- data/config/locales/hy.yml +0 -8
- data/config/locales/id.yml +0 -8
- data/config/locales/is.yml +0 -8
- data/config/locales/it.yml +0 -8
- data/config/locales/ja.yml +0 -8
- data/config/locales/ka.yml +0 -8
- data/config/locales/kk.yml +0 -8
- data/config/locales/ko.yml +0 -8
- data/config/locales/lt.yml +0 -8
- data/config/locales/lv.yml +0 -8
- data/config/locales/ms.yml +0 -8
- data/config/locales/mt.yml +0 -8
- data/config/locales/nl.yml +0 -8
- data/config/locales/no.yml +0 -8
- data/config/locales/pa-pk.yml +0 -8
- data/config/locales/pa.yml +0 -8
- data/config/locales/pl.yml +0 -8
- data/config/locales/ps.yml +0 -8
- data/config/locales/pt.yml +0 -8
- data/config/locales/ro.yml +0 -8
- data/config/locales/ru.yml +0 -8
- data/config/locales/si.yml +0 -8
- data/config/locales/sk.yml +0 -8
- data/config/locales/sl.yml +0 -8
- data/config/locales/so.yml +0 -8
- data/config/locales/sq.yml +0 -8
- data/config/locales/sr.yml +0 -8
- data/config/locales/sv.yml +0 -8
- data/config/locales/sw.yml +0 -8
- data/config/locales/ta.yml +0 -8
- data/config/locales/th.yml +0 -8
- data/config/locales/tk.yml +0 -8
- data/config/locales/tr.yml +0 -8
- data/config/locales/uk.yml +0 -8
- data/config/locales/ur.yml +0 -8
- data/config/locales/uz.yml +0 -8
- data/config/locales/vi.yml +0 -8
- data/config/locales/zh-hk.yml +0 -8
- data/config/locales/zh-tw.yml +0 -8
- data/config/locales/zh.yml +0 -8
- data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +42 -170
- data/lib/govuk_publishing_components/presenters/image_card_helper.rb +11 -1
- data/lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb +3 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/lib/govuk_publishing_components.rb +0 -2
- metadata +13 -14
- data/app/assets/stylesheets/govuk_publishing_components/components/_highlight-boxes.scss +0 -84
- data/app/assets/stylesheets/govuk_publishing_components/components/_taxonomy-list.scss +0 -21
- data/app/views/govuk_publishing_components/components/_admin_analytics.html.erb +0 -20
- data/app/views/govuk_publishing_components/components/_government_navigation.html.erb +0 -86
- data/app/views/govuk_publishing_components/components/_highlight_boxes.html.erb +0 -47
- data/app/views/govuk_publishing_components/components/_taxonomy_list.html.erb +0 -30
- data/app/views/govuk_publishing_components/components/docs/admin_analytics.yml +0 -10
- data/app/views/govuk_publishing_components/components/docs/government_navigation.yml +0 -20
- data/app/views/govuk_publishing_components/components/docs/highlight_boxes.yml +0 -171
- data/app/views/govuk_publishing_components/components/docs/taxonomy_list.yml +0 -112
- data/lib/govuk_publishing_components/presenters/highlight_boxes_helper.rb +0 -13
- data/lib/govuk_publishing_components/presenters/taxonomy_list_helper.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52ec5aa91a7d5060c6b29671f2206a967ab5af8a3891cb800c95d6b28eb09d15
|
4
|
+
data.tar.gz: 0bbf50f1bb6f0cd64af2986e72a612fe28a65df3987caf523939fcf87e3341ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a144e7583969b1767bb25e64f64772d4c4e632814ba3863f6335570a3a83936eea4aa76daeb1b006f39910b5b6086f1f9f65ea63b3068f929bc167f2f5237ea2
|
7
|
+
data.tar.gz: 78e13b419fba7b1eac89947ca9891e87f4939ed27456e093c474fbeca3afb291c6c86b002fbed478630b78671bd061637a208cf5f043656631b5d12e7b5af72c
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,23 +1,38 @@
|
|
1
1
|
;(function (global) {
|
2
2
|
'use strict'
|
3
3
|
|
4
|
-
var $ = global.jQuery
|
5
4
|
var GOVUK = global.GOVUK || {}
|
6
5
|
|
7
6
|
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {}
|
8
7
|
GOVUK.analyticsPlugins.downloadLinkTracker = function (options) {
|
9
8
|
options = options || {}
|
10
9
|
var downloadLinkSelector = options.selector
|
10
|
+
var selectors = downloadLinkSelector.split(',')
|
11
11
|
|
12
12
|
if (downloadLinkSelector) {
|
13
|
-
|
13
|
+
document.querySelector('body').addEventListener('click', function (event) {
|
14
|
+
var element = event.target
|
15
|
+
if (element.tagName !== 'A') {
|
16
|
+
element = element.closest('a')
|
17
|
+
}
|
18
|
+
|
19
|
+
if (!element) {
|
20
|
+
return
|
21
|
+
}
|
22
|
+
|
23
|
+
for (var i = 0; i < selectors.length; i++) {
|
24
|
+
if (element.matches(selectors[i].trim())) {
|
25
|
+
trackDownload(element)
|
26
|
+
break
|
27
|
+
}
|
28
|
+
}
|
29
|
+
})
|
14
30
|
}
|
15
31
|
|
16
|
-
function trackDownload (
|
17
|
-
var
|
18
|
-
var href = $link.attr('href')
|
32
|
+
function trackDownload (element) {
|
33
|
+
var href = element.getAttribute('href')
|
19
34
|
var evtOptions = { transport: 'beacon' }
|
20
|
-
var linkText =
|
35
|
+
var linkText = element.textContent.trim()
|
21
36
|
|
22
37
|
if (linkText) {
|
23
38
|
evtOptions.label = linkText
|
@@ -25,16 +40,6 @@
|
|
25
40
|
|
26
41
|
GOVUK.analytics.trackEvent('Download Link Clicked', href, evtOptions)
|
27
42
|
}
|
28
|
-
|
29
|
-
function getLinkFromEvent (evt) {
|
30
|
-
var $target = $(evt.target)
|
31
|
-
|
32
|
-
if (!$target.is('a')) {
|
33
|
-
$target = $target.parents('a')
|
34
|
-
}
|
35
|
-
|
36
|
-
return $target
|
37
|
-
}
|
38
43
|
}
|
39
44
|
|
40
45
|
global.GOVUK = GOVUK
|
@@ -1,49 +1,63 @@
|
|
1
|
+
// = require govuk/vendor/polyfills/Element/prototype/closest.js
|
1
2
|
;(function (global) {
|
2
3
|
'use strict'
|
3
4
|
|
4
|
-
var $ = global.jQuery
|
5
5
|
var GOVUK = global.GOVUK || {}
|
6
6
|
|
7
7
|
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {}
|
8
8
|
GOVUK.analyticsPlugins.externalLinkTracker = function (options) {
|
9
9
|
options = options || {}
|
10
|
-
|
10
|
+
GOVUK.analyticsPlugins.externalLinkTracker.options = options
|
11
|
+
document.querySelector('body').addEventListener('click', GOVUK.analyticsPlugins.externalLinkTracker.handleClick)
|
12
|
+
}
|
13
|
+
|
14
|
+
GOVUK.analyticsPlugins.externalLinkTracker.handleClick = function (event) {
|
15
|
+
var element = event.target
|
16
|
+
if (element.tagName !== 'A') {
|
17
|
+
element = element.closest('a')
|
18
|
+
}
|
19
|
+
|
20
|
+
if (!element) {
|
21
|
+
return
|
22
|
+
}
|
23
|
+
|
24
|
+
if (GOVUK.analyticsPlugins.externalLinkTracker.isExternalLink(element.getAttribute('href'))) {
|
25
|
+
GOVUK.analyticsPlugins.externalLinkTracker.trackClickEvent(element)
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
GOVUK.analyticsPlugins.externalLinkTracker.isExternalLink = function (href) {
|
30
|
+
if (!href) {
|
31
|
+
return false
|
32
|
+
}
|
33
|
+
|
11
34
|
var currentHost = GOVUK.analyticsPlugins.externalLinkTracker.getHostname()
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
function trackClickEvent (evt) {
|
16
|
-
var $link = getLinkFromEvent(evt)
|
17
|
-
var options = { transport: 'beacon' }
|
18
|
-
var href = $link.attr('href')
|
19
|
-
var linkText = $.trim($link.text())
|
20
|
-
|
21
|
-
if (linkText) {
|
22
|
-
options.label = linkText
|
23
|
-
}
|
24
|
-
|
25
|
-
if (externalLinkUploadCustomDimension !== undefined) {
|
26
|
-
// This custom dimension will be used to duplicate the url information
|
27
|
-
// that we normally send in an "event action". This will be used to join
|
28
|
-
// up with a scheduled custom upload called "External Link Status".
|
29
|
-
// We can only join uploads on custom dimensions, not on `event actions`
|
30
|
-
// where we normally add the url info.
|
31
|
-
var externalLinkToJoinUploadOn = href
|
32
|
-
|
33
|
-
GOVUK.analytics.setDimension(externalLinkUploadCustomDimension, externalLinkToJoinUploadOn)
|
34
|
-
}
|
35
|
-
GOVUK.analytics.trackEvent('External Link Clicked', href, options)
|
35
|
+
if (href.substring(0, 4) === 'http' && href.indexOf(currentHost) === -1) {
|
36
|
+
return true
|
36
37
|
}
|
38
|
+
}
|
39
|
+
|
40
|
+
GOVUK.analyticsPlugins.externalLinkTracker.trackClickEvent = function (element) {
|
41
|
+
var options = { transport: 'beacon' }
|
42
|
+
var href = element.getAttribute('href')
|
43
|
+
var linkText = element.textContent.trim()
|
37
44
|
|
38
|
-
|
39
|
-
|
45
|
+
if (linkText) {
|
46
|
+
options.label = linkText
|
47
|
+
}
|
40
48
|
|
41
|
-
|
42
|
-
|
43
|
-
|
49
|
+
var externalLinkUploadCustomDimension = GOVUK.analyticsPlugins.externalLinkTracker.options.externalLinkUploadCustomDimension
|
50
|
+
if (externalLinkUploadCustomDimension !== undefined) {
|
51
|
+
// This custom dimension will be used to duplicate the url information
|
52
|
+
// that we normally send in an "event action". This will be used to join
|
53
|
+
// up with a scheduled custom upload called "External Link Status".
|
54
|
+
// We can only join uploads on custom dimensions, not on `event actions`
|
55
|
+
// where we normally add the url info.
|
56
|
+
var externalLinkToJoinUploadOn = href
|
44
57
|
|
45
|
-
|
58
|
+
GOVUK.analytics.setDimension(externalLinkUploadCustomDimension, externalLinkToJoinUploadOn)
|
46
59
|
}
|
60
|
+
GOVUK.analytics.trackEvent('External Link Clicked', href, options)
|
47
61
|
}
|
48
62
|
|
49
63
|
GOVUK.analyticsPlugins.externalLinkTracker.getHostname = function () {
|
@@ -1,7 +1,6 @@
|
|
1
1
|
;(function (global) {
|
2
2
|
'use strict'
|
3
3
|
|
4
|
-
var $ = global.jQuery
|
5
4
|
var GOVUK = global.GOVUK || {}
|
6
5
|
var pii
|
7
6
|
|
@@ -78,7 +77,7 @@
|
|
78
77
|
// Set an options object for the pageview (e.g. transport, sessionControl)
|
79
78
|
// https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#transport
|
80
79
|
if (typeof options === 'object') {
|
81
|
-
pageviewObject =
|
80
|
+
pageviewObject = GOVUK.extendObject(pageviewObject || {}, options)
|
82
81
|
|
83
82
|
// trackerName is optional
|
84
83
|
if (typeof options.trackerName === 'string') {
|
@@ -87,10 +86,24 @@
|
|
87
86
|
}
|
88
87
|
}
|
89
88
|
|
90
|
-
|
91
|
-
|
92
|
-
|
89
|
+
function isEmptyObject (obj) {
|
90
|
+
if (typeof obj === 'undefined') {
|
91
|
+
return true
|
92
|
+
}
|
93
|
+
|
94
|
+
for (var prop in obj) {
|
95
|
+
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
|
96
|
+
return false
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
return JSON.stringify(obj) === JSON.stringify({})
|
101
|
+
}
|
102
|
+
|
103
|
+
if (isEmptyObject(pageviewObject)) {
|
93
104
|
sendToGa(trackerName + 'send', 'pageview')
|
105
|
+
} else {
|
106
|
+
sendToGa(trackerName + 'send', 'pageview', pageviewObject)
|
94
107
|
}
|
95
108
|
}
|
96
109
|
|
@@ -135,7 +148,7 @@
|
|
135
148
|
}
|
136
149
|
|
137
150
|
if (typeof options === 'object') {
|
138
|
-
|
151
|
+
evt = GOVUK.extendObject(evt, options)
|
139
152
|
}
|
140
153
|
|
141
154
|
sendToGa(trackerName + 'send', evt)
|
@@ -156,7 +169,7 @@
|
|
156
169
|
socialTarget: target
|
157
170
|
}
|
158
171
|
|
159
|
-
|
172
|
+
trackingOptions = GOVUK.extendObject(trackingOptions, options)
|
160
173
|
|
161
174
|
sendToGa('send', trackingOptions)
|
162
175
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* global GOVUK
|
1
|
+
/* global GOVUK */
|
2
2
|
|
3
3
|
(function () {
|
4
4
|
'use strict'
|
@@ -8,17 +8,17 @@
|
|
8
8
|
PageContent.getNumberOfSections = function () {
|
9
9
|
switch (true) {
|
10
10
|
case isNavigationGridPage():
|
11
|
-
return 1 +
|
11
|
+
return 1 + document.querySelectorAll('.parent-topic-contents').length
|
12
12
|
case isNavigationAccordionPage():
|
13
|
-
return
|
13
|
+
return document.querySelectorAll('[data-track-count="accordionSection"]').length
|
14
14
|
case isDocumentCollectionPage():
|
15
|
-
return
|
15
|
+
return document.querySelectorAll('.document-collection .group-title').length
|
16
16
|
case isMainstreamBrowsePage():
|
17
|
-
return
|
17
|
+
return countVisible(document.querySelectorAll('#subsection ul')) || document.querySelectorAll('#section ul').length
|
18
18
|
case isTopicPage():
|
19
|
-
return
|
19
|
+
return document.querySelectorAll('.topics-page nav.index-list').length
|
20
20
|
case isPolicyAreaPage():
|
21
|
-
return
|
21
|
+
return document.querySelectorAll('.topic section h1.label').length
|
22
22
|
case isFinderPage():
|
23
23
|
case isWhitehallFinderPage():
|
24
24
|
case isNavigationLeafPage():
|
@@ -28,8 +28,8 @@
|
|
28
28
|
return 1
|
29
29
|
default:
|
30
30
|
// It's a content page, not a "finding" page
|
31
|
-
var sidebarSections =
|
32
|
-
var sidebarTaxons =
|
31
|
+
var sidebarSections = document.querySelectorAll('[data-track-count="sidebarRelatedItemSection"]').length
|
32
|
+
var sidebarTaxons = document.querySelectorAll('[data-track-count="sidebarTaxonSection"]').length
|
33
33
|
|
34
34
|
return sidebarSections || sidebarTaxons
|
35
35
|
}
|
@@ -38,92 +38,101 @@
|
|
38
38
|
PageContent.getNumberOfLinks = function () {
|
39
39
|
switch (true) {
|
40
40
|
case isNavigationGridPage():
|
41
|
-
return
|
42
|
-
|
41
|
+
return document.querySelectorAll('a[data-track-category="navGridLinkClicked"]').length +
|
42
|
+
document.querySelectorAll('a[data-track-category="navGridLeafLinkClicked"]').length
|
43
43
|
case isNavigationAccordionPage():
|
44
|
-
return
|
45
|
-
case isNavigationLeafPage():
|
46
|
-
return $('a[data-track-category="navLeafLinkClicked"]').length
|
44
|
+
return document.querySelectorAll('a[data-track-category="navAccordionLinkClicked"]').length
|
47
45
|
case isDocumentCollectionPage():
|
48
|
-
return
|
46
|
+
return document.querySelectorAll('.document-collection .group-document-list li a').length
|
49
47
|
case isMainstreamBrowsePage():
|
50
|
-
return
|
51
|
-
$('#section ul a').length
|
48
|
+
return countVisible(document.querySelectorAll('#subsection ul a')) || document.querySelectorAll('#section ul a').length
|
52
49
|
case isTopicPage():
|
53
|
-
return
|
54
|
-
|
50
|
+
return document.querySelectorAll('.topics-page .index-list ul a').length ||
|
51
|
+
document.querySelectorAll('.topics-page .topics ul a').length
|
55
52
|
case isPolicyAreaPage():
|
56
|
-
return
|
57
|
-
|
58
|
-
case isWhitehallFinderPage():
|
59
|
-
return $('.document-list .document-row h3 a').length
|
53
|
+
return document.querySelectorAll('section.document-block a').length +
|
54
|
+
document.querySelectorAll('section .collection-list h2 a').length
|
60
55
|
case isFinderPage():
|
61
|
-
return
|
56
|
+
return document.querySelectorAll('.finder-frontend-content li.document a').length
|
57
|
+
case isWhitehallFinderPage():
|
58
|
+
return document.querySelectorAll('.document-list .document-row h3 a').length
|
59
|
+
case isNavigationLeafPage():
|
60
|
+
return document.querySelectorAll('a[data-track-category="navLeafLinkClicked"]').length
|
62
61
|
default:
|
63
62
|
// It's a content page, not a "finding" page, count related links
|
64
|
-
return
|
63
|
+
return document.querySelectorAll('a[data-track-category="relatedLinkClicked"]').length
|
65
64
|
}
|
66
65
|
}
|
67
66
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
function getFormat () {
|
73
|
-
return $('meta[name="govuk:format"]').attr('content')
|
74
|
-
};
|
67
|
+
var metaApplicationSelector = 'meta[name="govuk:rendering-application"]'
|
68
|
+
var metaFormatSelector = 'meta[name="govuk:format"]'
|
69
|
+
var metaNavigationTypeSelector = 'meta[name="govuk:navigation-page-type"]'
|
75
70
|
|
76
|
-
function
|
77
|
-
|
78
|
-
|
71
|
+
function getMetaAttribute (selector) {
|
72
|
+
var element = document.querySelector(selector)
|
73
|
+
if (element) {
|
74
|
+
return element.getAttribute('content')
|
75
|
+
}
|
76
|
+
}
|
79
77
|
|
80
78
|
function isNavigationGridPage () {
|
81
|
-
return
|
82
|
-
|
83
|
-
|
84
|
-
}
|
79
|
+
return getMetaAttribute(metaApplicationSelector) === 'collections' &&
|
80
|
+
getMetaAttribute(metaFormatSelector) === 'taxon' &&
|
81
|
+
getMetaAttribute(metaNavigationTypeSelector) === 'grid'
|
82
|
+
}
|
85
83
|
|
86
84
|
function isNavigationAccordionPage () {
|
87
|
-
return
|
88
|
-
|
89
|
-
|
90
|
-
}
|
85
|
+
return getMetaAttribute(metaApplicationSelector) === 'collections' &&
|
86
|
+
getMetaAttribute(metaFormatSelector) === 'taxon' &&
|
87
|
+
getMetaAttribute(metaNavigationTypeSelector) === 'accordion'
|
88
|
+
}
|
91
89
|
|
92
90
|
function isNavigationLeafPage () {
|
93
|
-
return
|
94
|
-
|
95
|
-
|
96
|
-
}
|
91
|
+
return getMetaAttribute(metaApplicationSelector) === 'collections' &&
|
92
|
+
getMetaAttribute(metaFormatSelector) === 'taxon' &&
|
93
|
+
getMetaAttribute(metaNavigationTypeSelector) === 'leaf'
|
94
|
+
}
|
97
95
|
|
98
96
|
function isMainstreamBrowsePage () {
|
99
|
-
return
|
100
|
-
|
101
|
-
}
|
97
|
+
return getMetaAttribute(metaApplicationSelector) === 'collections' &&
|
98
|
+
getMetaAttribute(metaFormatSelector) === 'mainstream_browse_page'
|
99
|
+
}
|
102
100
|
|
103
101
|
function isTopicPage () {
|
104
|
-
return
|
105
|
-
|
106
|
-
}
|
102
|
+
return getMetaAttribute(metaApplicationSelector) === 'collections' &&
|
103
|
+
getMetaAttribute(metaFormatSelector) === 'topic'
|
104
|
+
}
|
107
105
|
|
108
106
|
function isPolicyAreaPage () {
|
109
|
-
return
|
110
|
-
|
111
|
-
}
|
107
|
+
return getMetaAttribute(metaApplicationSelector) === 'whitehall' &&
|
108
|
+
getMetaAttribute(metaFormatSelector) === 'placeholder_policy_area'
|
109
|
+
}
|
112
110
|
|
113
111
|
function isDocumentCollectionPage () {
|
114
|
-
return
|
115
|
-
|
116
|
-
}
|
112
|
+
return getMetaAttribute(metaApplicationSelector) === 'government-frontend' &&
|
113
|
+
getMetaAttribute(metaFormatSelector) === 'document_collection'
|
114
|
+
}
|
117
115
|
|
118
116
|
function isFinderPage () {
|
119
|
-
return
|
120
|
-
|
121
|
-
}
|
117
|
+
return getMetaAttribute(metaApplicationSelector) === 'finder-frontend' &&
|
118
|
+
getMetaAttribute(metaFormatSelector) === 'finder'
|
119
|
+
}
|
122
120
|
|
123
121
|
function isWhitehallFinderPage () {
|
124
|
-
return
|
125
|
-
|
126
|
-
}
|
122
|
+
return getMetaAttribute(metaApplicationSelector) === 'whitehall' &&
|
123
|
+
getMetaAttribute(metaFormatSelector) === 'finder'
|
124
|
+
}
|
125
|
+
|
126
|
+
function countVisible (elements) {
|
127
|
+
var count = 0
|
128
|
+
for (var i = 0; i < elements.length; i++) {
|
129
|
+
var style = window.getComputedStyle(elements[i])
|
130
|
+
if (!(style.display === 'none' || style.visibility === 'hidden')) {
|
131
|
+
count++
|
132
|
+
}
|
133
|
+
}
|
134
|
+
return count
|
135
|
+
}
|
127
136
|
|
128
137
|
GOVUK.PageContent = PageContent
|
129
138
|
})()
|
@@ -5,132 +5,7 @@
|
|
5
5
|
|
6
6
|
window.GOVUK = window.GOVUK || {}
|
7
7
|
|
8
|
-
var
|
9
|
-
['Percent', 20],
|
10
|
-
['Percent', 40],
|
11
|
-
['Percent', 60],
|
12
|
-
['Percent', 80],
|
13
|
-
['Percent', 100]
|
14
|
-
]
|
15
|
-
|
16
|
-
var CONFIG = {
|
17
|
-
'/brexit': percentages,
|
18
|
-
'/government/publications/the-essential-trustee-what-you-need-to-know-cc3/the-essential-trustee-what-you-need-to-know-what-you-need-to-do': [
|
19
|
-
['Heading', '1. About this guidance'],
|
20
|
-
['Heading', '2. Trustees’ duties at a glance'],
|
21
|
-
['Heading', '3. Who can be a trustee and how trustees are appointed'],
|
22
|
-
['Heading', '4. Ensure your charity is carrying out its purposes for the public benefit'],
|
23
|
-
['Heading', '5. Comply with your charity’s governing document and the law'],
|
24
|
-
['Heading', '6. Act in your charity’s best interests'],
|
25
|
-
['Heading', '7. Manage your charity’s resources responsibly'],
|
26
|
-
['Heading', '8. Act with reasonable care and skill'],
|
27
|
-
['Heading', '9. Ensure your charity is accountable'],
|
28
|
-
['Heading', '10. Reduce the risk of liability'],
|
29
|
-
['Heading', '11. Your charity’s legal structure and what it means'],
|
30
|
-
['Heading', '12. Charity officers - the chair and treasurer'],
|
31
|
-
['Heading', '13. Technical terms used in this guidance']
|
32
|
-
],
|
33
|
-
'/guidance/universal-credit-how-it-helps-you-into-work': [
|
34
|
-
['Heading', 'Support from your work coach'],
|
35
|
-
['Heading', 'Help available for parents'],
|
36
|
-
['Heading', 'When you can claim Universal Credit'],
|
37
|
-
['Heading', 'More detailed advice']
|
38
|
-
],
|
39
|
-
'/government/publications/spring-budget-2017-documents/spring-budget-2017': [
|
40
|
-
['Heading', '1. Executive summary'],
|
41
|
-
['Heading', '2. Economic context and public finances'],
|
42
|
-
['Heading', '3. Policy decisions'],
|
43
|
-
['Heading', '4. Tax'],
|
44
|
-
['Heading', '5. Productivity'],
|
45
|
-
['Heading', '6. Public services and markets'],
|
46
|
-
['Heading', '7. Annex A: Financing'],
|
47
|
-
['Heading', '8. Annex B: Office for Budget Responsibility\'s Economic and fiscal outlook']
|
48
|
-
],
|
49
|
-
'/settled-status-eu-citizens-families': [
|
50
|
-
['Heading', 'When you can apply']
|
51
|
-
],
|
52
|
-
'/guidance/returning-to-the-uk': [
|
53
|
-
['Heading', 'Ending your time living abroad']
|
54
|
-
],
|
55
|
-
'/council-housing': [
|
56
|
-
['Heading', 'Choice-based lettings']
|
57
|
-
],
|
58
|
-
'/guidance/foreign-travel-insurance': [
|
59
|
-
['Heading', 'What your travel insurance policy should cover']
|
60
|
-
],
|
61
|
-
'/guidance/living-in-france': [
|
62
|
-
['Heading', 'Passports and travel']
|
63
|
-
],
|
64
|
-
'/family-permit': [
|
65
|
-
['Heading', 'EEA family permit']
|
66
|
-
],
|
67
|
-
'/guidance/healthcare-for-eu-and-efta-citizens-visiting-the-uk': [
|
68
|
-
['Heading', 'Travel insurance']
|
69
|
-
],
|
70
|
-
'/driving-abroad': [
|
71
|
-
['Heading', 'Check your insurance if you’re taking your own vehicle']
|
72
|
-
],
|
73
|
-
'/get-a-passport-urgently': [
|
74
|
-
['Heading', 'Ways to apply']
|
75
|
-
],
|
76
|
-
'/driving-abroad/international-driving-permit': [
|
77
|
-
['Heading', 'Check which IDP you need']
|
78
|
-
],
|
79
|
-
'/guidance/guidance-for-suppliers-of-cattle-sheep-and-goat-ear-tags': [
|
80
|
-
['Heading', 'Tagging information for livestock keepers']
|
81
|
-
],
|
82
|
-
'/guidance/how-to-move-goods-between-or-through-common-transit-countries-including-the-eu': [
|
83
|
-
['Heading', 'Start moving your goods']
|
84
|
-
],
|
85
|
-
'/guidance/ecmt-international-road-haulage-permits': [
|
86
|
-
['Heading', 'Apply for permits']
|
87
|
-
],
|
88
|
-
'/taking-goods-out-uk-temporarily/get-an-ata-carnet': [
|
89
|
-
['Heading', 'Using an ATA Carnet']
|
90
|
-
],
|
91
|
-
'/wood-packaging-import-export': [
|
92
|
-
['Heading', 'Export solid wood packaging']
|
93
|
-
],
|
94
|
-
'/coronavirus': percentages,
|
95
|
-
'/coronavirus/education-and-childcare': percentages,
|
96
|
-
'/coronavirus/worker-support': percentages,
|
97
|
-
'/coronavirus/business-support': percentages,
|
98
|
-
'/get-coronavirus-test': percentages,
|
99
|
-
'/next-steps-for-your-business/results': [
|
100
|
-
['Heading', 'Things you need to do next'],
|
101
|
-
['Heading', 'Rules to follow'],
|
102
|
-
['Heading', 'Good to know'],
|
103
|
-
['Heading', 'Change your answers']
|
104
|
-
],
|
105
|
-
'/guidance/brexit-guidance-for-businesses': percentages,
|
106
|
-
'/guidance/brexit-guidance-for-businesses.cy': percentages,
|
107
|
-
'/guidance/brexit-guidance-for-individuals-and-families': percentages,
|
108
|
-
'/guidance/brexit-guidance-for-individuals-and-families.cy': percentages,
|
109
|
-
'/guidance/import-and-export-goods-using-preference-agreements': percentages,
|
110
|
-
'/guidance/travel-abroad-from-england-during-coronavirus-covid-19': [
|
111
|
-
['Heading', 'Before you travel abroad'],
|
112
|
-
['Heading', '1. Check the rules for the country you’re going to'],
|
113
|
-
['Heading', '2. Find out what you need to do when you return'],
|
114
|
-
['Heading', '3. Book any COVID-19 tests or quarantine hotel packages you need for your return'],
|
115
|
-
['Heading', 'Before you return'],
|
116
|
-
['Heading', 'After you return'],
|
117
|
-
['Heading', 'Travelling with children'],
|
118
|
-
['Heading', 'Ireland, the UK, the Channel Islands and the Isle of Man'],
|
119
|
-
['Heading', 'Exemptions for work, medical or compassionate reasons']
|
120
|
-
],
|
121
|
-
'/guidance/travel-to-england-from-another-country-during-coronavirus-covid-19': [
|
122
|
-
['Heading', 'Before you travel'],
|
123
|
-
['Heading', '1. Check the rules for the country you’re coming from or have travelled through'],
|
124
|
-
['Heading', '2. Book any COVID-19 tests or quarantine hotel packages you need for your arrival'],
|
125
|
-
['Heading', '3. Get tested and complete documents'],
|
126
|
-
['Heading', 'When you arrive in England'],
|
127
|
-
['Heading', 'Leaving England'],
|
128
|
-
['Heading', 'Travelling with children'],
|
129
|
-
['Heading', 'Ireland, the UK, the Channel Islands and the Isle of Man'],
|
130
|
-
['Heading', 'Exemptions for work, medical or compassionate reasons']
|
131
|
-
],
|
132
|
-
'/find-travel-test-provider': percentages
|
133
|
-
}
|
8
|
+
var CONFIG = {}
|
134
9
|
|
135
10
|
function ScrollTracker (sitewideConfig) {
|
136
11
|
this.config = this.getConfigForCurrentPath(sitewideConfig)
|