govuk_publishing_components 40.1.0 → 41.1.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/javascripts/govuk_publishing_components/components/accordion.js +1 -79
- data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +1 -34
- data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +0 -17
- data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js +0 -6
- data/app/assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js +0 -7
- data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +8 -74
- data/app/assets/javascripts/govuk_publishing_components/dependencies.js +0 -4
- data/app/assets/javascripts/govuk_publishing_components/domain-config.js +0 -8
- data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +0 -4
- data/app/assets/javascripts/govuk_publishing_components/lib/cookie-settings.js +0 -14
- data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +0 -20
- data/app/assets/javascripts/govuk_publishing_components/lib/toggle.js +0 -33
- data/app/assets/javascripts/govuk_publishing_components/load-analytics.js +0 -25
- data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +192 -171
- data/app/assets/stylesheets/component_guide/application.scss +10 -11
- data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +2 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_attachment.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_big-number.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_cards.scss +47 -22
- data/app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-guidance.scss +1 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +2 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_cross-service-header.scss +19 -19
- data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +14 -10
- data/app/assets/stylesheets/govuk_publishing_components/components/_emergency-banner.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_error-alert.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_error-summary.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +8 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +16 -10
- data/app/assets/stylesheets/govuk_publishing_components/components/_intervention.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +33 -35
- data/app/assets/stylesheets/govuk_publishing_components/components/_lead-paragraph.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_notice.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_option-select.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +13 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_panel.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +6 -6
- data/app/assets/stylesheets/govuk_publishing_components/components/_reorderable-list.scss +2 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +4 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +2 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +3 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +10 -10
- data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_table.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_translation-nav.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_warning-text.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +5 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_contact.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_highlight-answer.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_stat-headline.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_tables.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +5 -5
- data/app/views/govuk_publishing_components/components/_accordion.html.erb +1 -8
- data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_cards.html.erb +6 -11
- data/app/views/govuk_publishing_components/components/_contents_list.html.erb +2 -15
- data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +3 -19
- data/app/views/govuk_publishing_components/components/_details.html.erb +9 -11
- data/app/views/govuk_publishing_components/components/_image_card.html.erb +1 -5
- data/app/views/govuk_publishing_components/components/_intervention.html.erb +4 -4
- data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +7 -21
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +1 -26
- data/app/views/govuk_publishing_components/components/_metadata.html.erb +2 -5
- data/app/views/govuk_publishing_components/components/_organisation_logo.html.erb +2 -7
- data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +0 -10
- data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +1 -3
- data/app/views/govuk_publishing_components/components/_search.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_select.html.erb +1 -2
- data/app/views/govuk_publishing_components/components/_share_links.html.erb +1 -10
- data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +1 -24
- data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +1 -14
- data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +1 -4
- data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +1 -7
- data/app/views/govuk_publishing_components/components/docs/accordion.yml +1 -60
- data/app/views/govuk_publishing_components/components/docs/big_number.yml +2 -6
- data/app/views/govuk_publishing_components/components/docs/breadcrumbs.yml +0 -1
- data/app/views/govuk_publishing_components/components/docs/button.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/cards.yml +41 -20
- data/app/views/govuk_publishing_components/components/docs/checkboxes.yml +0 -33
- data/app/views/govuk_publishing_components/components/docs/cookie_banner.yml +2 -2
- data/app/views/govuk_publishing_components/components/docs/details.yml +0 -15
- data/app/views/govuk_publishing_components/components/docs/document_list.yml +11 -18
- data/app/views/govuk_publishing_components/components/docs/error_alert.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/govspeak.yml +0 -11
- data/app/views/govuk_publishing_components/components/docs/image_card.yml +0 -31
- data/app/views/govuk_publishing_components/components/docs/intervention.yml +0 -26
- data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +2 -2
- data/app/views/govuk_publishing_components/components/docs/meta_tags.yml +0 -2
- data/app/views/govuk_publishing_components/components/docs/option_select.yml +4 -16
- data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +0 -15
- data/app/views/govuk_publishing_components/components/docs/print_link.yml +2 -9
- data/app/views/govuk_publishing_components/components/docs/select.yml +0 -36
- data/app/views/govuk_publishing_components/components/docs/share_links.yml +2 -4
- data/app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml +2 -25
- data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_header.yml +0 -23
- data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_related.yml +0 -10
- data/app/views/govuk_publishing_components/components/docs/subscription_links.yml +3 -15
- data/app/views/govuk_publishing_components/components/docs/table.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/tabs.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/translation_nav.yml +3 -27
- data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +1 -5
- data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb +0 -10
- data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/layout_header/_search.html.erb +0 -5
- data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +0 -7
- data/lib/govuk_publishing_components/presenters/breadcrumbs_helper.rb +1 -19
- data/lib/govuk_publishing_components/presenters/image_card_helper.rb +1 -15
- data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +2 -24
- data/lib/govuk_publishing_components/presenters/select_helper.rb +0 -4
- data/lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb +0 -5
- data/lib/govuk_publishing_components/presenters/translation_nav_helper.rb +0 -7
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +4 -26
- data/app/assets/javascripts/govuk_publishing_components/analytics/analytics.js +0 -92
- data/app/assets/javascripts/govuk_publishing_components/analytics/auto-scroll-tracker.js +0 -221
- data/app/assets/javascripts/govuk_publishing_components/analytics/auto-track-event.js +0 -30
- data/app/assets/javascripts/govuk_publishing_components/analytics/cross-domain-tracking.js +0 -55
- data/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js +0 -133
- data/app/assets/javascripts/govuk_publishing_components/analytics/download-link-tracker.js +0 -46
- data/app/assets/javascripts/govuk_publishing_components/analytics/ecommerce.js +0 -101
- data/app/assets/javascripts/govuk_publishing_components/analytics/error-tracking.js +0 -51
- data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js +0 -88
- data/app/assets/javascripts/govuk_publishing_components/analytics/external-link-tracker.js +0 -68
- data/app/assets/javascripts/govuk_publishing_components/analytics/google-analytics-universal-tracker.js +0 -220
- data/app/assets/javascripts/govuk_publishing_components/analytics/init.js +0 -60
- data/app/assets/javascripts/govuk_publishing_components/analytics/linked-domains.js +0 -135
- data/app/assets/javascripts/govuk_publishing_components/analytics/mailto-link-tracker.js +0 -43
- data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +0 -160
- data/app/assets/javascripts/govuk_publishing_components/analytics/pii.js +0 -115
- data/app/assets/javascripts/govuk_publishing_components/analytics/print-intent.js +0 -39
- data/app/assets/javascripts/govuk_publishing_components/analytics/static-analytics.js +0 -132
- data/app/assets/javascripts/govuk_publishing_components/analytics/track-click.js +0 -75
- data/app/assets/javascripts/govuk_publishing_components/analytics/track-select-change.js +0 -56
- data/app/assets/javascripts/govuk_publishing_components/analytics.js +0 -23
- data/app/assets/javascripts/govuk_publishing_components/components/details.js +0 -48
@@ -1,135 +0,0 @@
|
|
1
|
-
// For Universal Analytics' cross domain tracking.
|
2
|
-
window.GOVUK.analytics = window.GOVUK.analytics || {}
|
3
|
-
window.GOVUK.analytics.linkedDomains = [
|
4
|
-
'access.service.gov.uk',
|
5
|
-
'access.tax.service.gov.uk',
|
6
|
-
'account.companieshouse.gov.uk',
|
7
|
-
'accounts.manage-apprenticeships.service.gov.uk',
|
8
|
-
'account.publishing.service.gov.uk',
|
9
|
-
'add-driving-licence-check-code.service.gov.uk',
|
10
|
-
'analyse-school-performance.service.gov.uk',
|
11
|
-
'appeal-tax-tribunal.service.gov.uk',
|
12
|
-
'apply-basic-criminal-record-check.service.gov.uk',
|
13
|
-
'apply-blue-badge.service.gov.uk',
|
14
|
-
'apply-company-tachograph-card.service.gov.uk',
|
15
|
-
'apply-for-bankruptcy.service.gov.uk',
|
16
|
-
'apply-for-debt-relief-order.service.gov.uk',
|
17
|
-
'apply-for-environmental-permit.service.gov.uk',
|
18
|
-
'apply-for-eu-settled-status.homeoffice.gov.uk',
|
19
|
-
'apply-for-innovation-funding.service.gov.uk',
|
20
|
-
'apply-for-refugee-integration-loan.service.gov.uk',
|
21
|
-
'apply-licence.ozone-depleting-substances.service.gov.uk',
|
22
|
-
'apply-quota.fluorinated-gas.service.gov.uk',
|
23
|
-
'apply-quota.ozone-depleting-substances.service.gov.uk',
|
24
|
-
'apprenticeships.gov.uk',
|
25
|
-
'beta.companieshouse.gov.uk',
|
26
|
-
'biometric-residence-permit.service.gov.uk',
|
27
|
-
'businessreadinessfund.beis.gov.uk',
|
28
|
-
'catchreturn.service.gov.uk',
|
29
|
-
'checklegalaid.service.gov.uk',
|
30
|
-
'check-mot.service.gov.uk',
|
31
|
-
'check-payment-practices.service.gov.uk',
|
32
|
-
'check-vehicle-recalls.service.gov.uk',
|
33
|
-
'civil-service-careers.gov.uk',
|
34
|
-
'civilservicejobs.service.gov.uk',
|
35
|
-
'claim.redundancy-payments.service.gov.uk',
|
36
|
-
'claim-power-of-attorney-refund.service.gov.uk',
|
37
|
-
'compare-school-performance.service.gov.uk',
|
38
|
-
'complete-deputy-report.service.gov.uk',
|
39
|
-
'contractsfinder.service.gov.uk',
|
40
|
-
'coronavirus.data.gov.uk',
|
41
|
-
'coronavirus-business-volunteers.service.gov.uk',
|
42
|
-
'coronavirus-shielding-support.service.gov.uk',
|
43
|
-
'coronavirus-vulnerable-people.service.gov.uk',
|
44
|
-
'courttribunalfinder.service.gov.uk',
|
45
|
-
'create-energy-label.service.gov.uk',
|
46
|
-
'create-qr-code-poster.service.gov.uk',
|
47
|
-
'cymraeg.registertovote.service.gov.uk',
|
48
|
-
'dartford-crossing-charge.service.gov.uk',
|
49
|
-
'design-system.service.gov.uk',
|
50
|
-
'devtracker.dfid.gov.uk',
|
51
|
-
'digitalmarketplace.service.gov.uk',
|
52
|
-
'eforms.homeoffice.gov.uk',
|
53
|
-
'electronic-visa-waiver.service.gov.uk',
|
54
|
-
'employmenttribunals.service.gov.uk',
|
55
|
-
'eu-settled-status-enquiries.service.gov.uk',
|
56
|
-
'faster-uk-entry.service.gov.uk',
|
57
|
-
'finance.manage-apprenticeships.service.gov.uk',
|
58
|
-
'find-and-update.company-information.service.gov.uk',
|
59
|
-
'findapprenticeship.service.gov.uk',
|
60
|
-
'find-coronavirus-support.service.gov.uk',
|
61
|
-
'find-employer-schemes.education.gov.uk',
|
62
|
-
'flood-map-for-planning.service.gov.uk',
|
63
|
-
'flood-warning-information.service.gov.uk',
|
64
|
-
'follow.company-information.service.gov.uk',
|
65
|
-
'gender-pay-gap.service.gov.uk',
|
66
|
-
'get-fishing-licence.service.gov.uk',
|
67
|
-
'get-information-schools.service.gov.uk',
|
68
|
-
'gro.gov.uk',
|
69
|
-
'helpforhouseholds.campaign.gov.uk',
|
70
|
-
'helpwithcourtfees.service.gov.uk',
|
71
|
-
'help-with-prison-visits.service.gov.uk',
|
72
|
-
'identity.company-information.service.gov.uk',
|
73
|
-
'identity-sandbox.company-information.service.gov.uk',
|
74
|
-
'import-products-animals-food-feed.service.gov.uk',
|
75
|
-
'lastingpowerofattorney.service.gov.uk',
|
76
|
-
'live.email-dvla.service.gov.uk',
|
77
|
-
'live.dvla-web-chat.service.gov.uk',
|
78
|
-
'loststolenpassport.service.gov.uk',
|
79
|
-
'makeaplea.service.gov.uk',
|
80
|
-
'managefleetvehicles.service.gov.uk',
|
81
|
-
'manage-apprenticeships.service.gov.uk',
|
82
|
-
'manage-fish-exports.service.gov.uk',
|
83
|
-
'manage-quota.fluorinated-gas.service.gov.uk',
|
84
|
-
'manage-water-abstraction-impoundment-licence.service.gov.uk',
|
85
|
-
'match.redundancy-payments.service.gov.uk',
|
86
|
-
'mot-testing.service.gov.uk',
|
87
|
-
'nominate-uk-honour.service.gov.uk',
|
88
|
-
'notice.redundancy-payments.service.gov.uk',
|
89
|
-
'passport.service.gov.uk',
|
90
|
-
'paydvlafine.service.gov.uk',
|
91
|
-
'payments.service.gov.uk',
|
92
|
-
'publish-payment-practices.service.gov.uk',
|
93
|
-
'queens-awards-enterprise.service.gov.uk',
|
94
|
-
'recruit.manage-apprenticeships.service.gov.uk',
|
95
|
-
'register.fluorinated-gas.service.gov.uk',
|
96
|
-
'register-trailer.service.gov.uk',
|
97
|
-
'register.ozone-depleting-substances.service.gov.uk',
|
98
|
-
'registertovote.service.gov.uk',
|
99
|
-
'register-vehicle.service.gov.uk',
|
100
|
-
'registers.service.gov.uk',
|
101
|
-
'reminders.mot-testing.service.gov.uk',
|
102
|
-
'renewable-heat-calculator.service.gov.uk',
|
103
|
-
'reply-jury-summons.service.gov.uk',
|
104
|
-
'report-director-conduct.service.gov.uk',
|
105
|
-
'report.fluorinated-gas.service.gov.uk',
|
106
|
-
'report.ozone-depleting-substances.service.gov.uk',
|
107
|
-
'right-to-rent.homeoffice.gov.uk',
|
108
|
-
'right-to-work.service.gov.uk',
|
109
|
-
'ruralpayments.service.gov.uk',
|
110
|
-
'schools-financial-benchmarking.service.gov.uk',
|
111
|
-
'secured.studentfinanceni.co.uk',
|
112
|
-
'secured.studentfinancewales.co.uk',
|
113
|
-
'selfservice.payments.service.gov.uk',
|
114
|
-
'send-money-to-prisoner.service.gov.uk',
|
115
|
-
'signin.service.gov.uk',
|
116
|
-
'sorn.service.gov.uk',
|
117
|
-
'staff.helpwithcourtfees.service.gov.uk',
|
118
|
-
'student-finance.service.gov.uk',
|
119
|
-
'tax.service.gov.uk',
|
120
|
-
'teacherservices.education.gov.uk',
|
121
|
-
'teaching-vacancies.service.gov.uk',
|
122
|
-
'to-visit-or-stay-in-the-uk.homeoffice.gov.uk',
|
123
|
-
'trade-tariff.service.gov.uk',
|
124
|
-
'tribunal-response.employmenttribunals.service.gov.uk',
|
125
|
-
'ukri.org',
|
126
|
-
'update-student-loan-employment-details.service.gov.uk',
|
127
|
-
'vehicle-operator-licensing.service.gov.uk',
|
128
|
-
'vehicleenquiry.service.gov.uk',
|
129
|
-
'viewdrivingrecord.service.gov.uk',
|
130
|
-
'view-and-prove-your-rights.homeoffice.gov.uk',
|
131
|
-
'view-immigration-status.service.gov.uk',
|
132
|
-
'visa-address-update.service.gov.uk',
|
133
|
-
'visas-immigration.service.gov.uk',
|
134
|
-
'your-defra-account.defra.gov.uk'
|
135
|
-
]
|
@@ -1,43 +0,0 @@
|
|
1
|
-
//= require ../vendor/polyfills/closest.js
|
2
|
-
;(function (global) {
|
3
|
-
'use strict'
|
4
|
-
|
5
|
-
var GOVUK = global.GOVUK || {}
|
6
|
-
|
7
|
-
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {}
|
8
|
-
GOVUK.analyticsPlugins.mailtoLinkTracker = function () {
|
9
|
-
document.querySelector('body').addEventListener('click', function (event) {
|
10
|
-
var element = event.target
|
11
|
-
if (element.tagName !== 'A') {
|
12
|
-
element = element.closest('a')
|
13
|
-
}
|
14
|
-
|
15
|
-
if (!element) {
|
16
|
-
return
|
17
|
-
}
|
18
|
-
|
19
|
-
var href = element.getAttribute('href')
|
20
|
-
|
21
|
-
if (!href) {
|
22
|
-
return
|
23
|
-
}
|
24
|
-
|
25
|
-
if (href.substring(0, 7) === 'mailto:') {
|
26
|
-
trackClickEvent(element, href)
|
27
|
-
}
|
28
|
-
})
|
29
|
-
|
30
|
-
function trackClickEvent (element, href) {
|
31
|
-
var options = { transport: 'beacon' }
|
32
|
-
var linkText = element.textContent
|
33
|
-
|
34
|
-
if (linkText) {
|
35
|
-
options.label = linkText.trim()
|
36
|
-
}
|
37
|
-
|
38
|
-
GOVUK.analytics.trackEvent('Mailto Link Clicked', href, options)
|
39
|
-
}
|
40
|
-
}
|
41
|
-
|
42
|
-
global.GOVUK = GOVUK
|
43
|
-
})(window)
|
@@ -1,160 +0,0 @@
|
|
1
|
-
/* global GOVUK */
|
2
|
-
|
3
|
-
(function () {
|
4
|
-
'use strict'
|
5
|
-
window.GOVUK = window.GOVUK || {}
|
6
|
-
var PageContent = function () { }
|
7
|
-
|
8
|
-
PageContent.getNumberOfSections = function () {
|
9
|
-
switch (true) {
|
10
|
-
case isNavigationGridPage():
|
11
|
-
return 1 + document.querySelectorAll('.parent-topic-contents').length
|
12
|
-
case isNavigationAccordionPage():
|
13
|
-
return document.querySelectorAll('[data-track-count="accordionSection"]').length
|
14
|
-
case isDocumentCollectionPage():
|
15
|
-
return document.querySelectorAll('.document-collection .group-title').length
|
16
|
-
case isNewBrowsePageLevelTwo():
|
17
|
-
// if there are no accordion sections on the browse level 2 page
|
18
|
-
// then it is a default page with one or two lists
|
19
|
-
return document.querySelectorAll('[data-track-count="accordionSection"]').length || document.querySelectorAll('main .govuk-list').length
|
20
|
-
case isNewBrowsePage():
|
21
|
-
return document.querySelectorAll('[data-track-count="cardList"]').length
|
22
|
-
case isMainstreamBrowsePage():
|
23
|
-
return countVisible(document.querySelectorAll('#subsection ul')) || document.querySelectorAll('#section ul').length || document.querySelectorAll('#root ul').length
|
24
|
-
case isTopicPage():
|
25
|
-
return document.querySelectorAll('.topics-page nav.index-list').length
|
26
|
-
case isPolicyAreaPage():
|
27
|
-
return document.querySelectorAll('.topic section h1.label').length
|
28
|
-
case isFinderPage():
|
29
|
-
case isWhitehallFinderPage():
|
30
|
-
case isNavigationLeafPage():
|
31
|
-
// The default in finders should be one, so it's comparable with A-Z
|
32
|
-
// lists in other navigation pages. Request made by performance
|
33
|
-
// analysts.
|
34
|
-
return 1
|
35
|
-
default:
|
36
|
-
// It's a content page, not a "finding" page
|
37
|
-
var sidebarSections = document.querySelectorAll('[data-track-count="sidebarRelatedItemSection"]').length
|
38
|
-
var sidebarTaxons = document.querySelectorAll('[data-track-count="sidebarTaxonSection"]').length
|
39
|
-
|
40
|
-
return sidebarSections || sidebarTaxons
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
PageContent.getNumberOfLinks = function () {
|
45
|
-
switch (true) {
|
46
|
-
case isNavigationGridPage():
|
47
|
-
return document.querySelectorAll('a[data-track-category="navGridLinkClicked"]').length +
|
48
|
-
document.querySelectorAll('a[data-track-category="navGridLeafLinkClicked"]').length
|
49
|
-
case isNavigationAccordionPage():
|
50
|
-
return document.querySelectorAll('a[data-track-category="navAccordionLinkClicked"]').length
|
51
|
-
case isDocumentCollectionPage():
|
52
|
-
return document.querySelectorAll('.document-collection .group-document-list li a').length
|
53
|
-
case isNewBrowsePageLevelTwo():
|
54
|
-
return document.querySelectorAll('[data-track-count="contentLink"]').length
|
55
|
-
case isNewBrowsePage():
|
56
|
-
return document.querySelectorAll('[data-track-count="cardLink"]').length
|
57
|
-
case isMainstreamBrowsePage():
|
58
|
-
return countVisible(document.querySelectorAll('#subsection ul a')) || document.querySelectorAll('#section ul a').length || document.querySelectorAll('#root ul a').length
|
59
|
-
case isTopicPage():
|
60
|
-
return document.querySelectorAll('.topics-page .index-list ul a').length ||
|
61
|
-
document.querySelectorAll('.topics-page .topics ul a').length
|
62
|
-
case isPolicyAreaPage():
|
63
|
-
return document.querySelectorAll('section.document-block a').length +
|
64
|
-
document.querySelectorAll('section .collection-list h2 a').length
|
65
|
-
case isFinderPage():
|
66
|
-
return document.querySelectorAll('.finder-frontend-content li.document a').length
|
67
|
-
case isWhitehallFinderPage():
|
68
|
-
return document.querySelectorAll('.document-list .document-row h3 a').length
|
69
|
-
case isNavigationLeafPage():
|
70
|
-
return document.querySelectorAll('a[data-track-category="navLeafLinkClicked"]').length
|
71
|
-
default:
|
72
|
-
// It's a content page, not a "finding" page, count related links
|
73
|
-
return document.querySelectorAll('a[data-track-category="relatedLinkClicked"]').length
|
74
|
-
}
|
75
|
-
}
|
76
|
-
|
77
|
-
var metaApplicationSelector = 'meta[name="govuk:rendering-application"]'
|
78
|
-
var metaFormatSelector = 'meta[name="govuk:format"]'
|
79
|
-
var metaNavigationTypeSelector = 'meta[name="govuk:navigation-page-type"]'
|
80
|
-
|
81
|
-
function getMetaAttribute (selector) {
|
82
|
-
var element = document.querySelector(selector)
|
83
|
-
if (element) {
|
84
|
-
return element.getAttribute('content').toLowerCase()
|
85
|
-
}
|
86
|
-
}
|
87
|
-
|
88
|
-
function isNavigationGridPage () {
|
89
|
-
return getMetaAttribute(metaApplicationSelector) === 'collections' &&
|
90
|
-
getMetaAttribute(metaFormatSelector) === 'taxon' &&
|
91
|
-
getMetaAttribute(metaNavigationTypeSelector) === 'grid'
|
92
|
-
}
|
93
|
-
|
94
|
-
function isNavigationAccordionPage () {
|
95
|
-
return getMetaAttribute(metaApplicationSelector) === 'collections' &&
|
96
|
-
getMetaAttribute(metaFormatSelector) === 'taxon' &&
|
97
|
-
getMetaAttribute(metaNavigationTypeSelector) === 'accordion'
|
98
|
-
}
|
99
|
-
|
100
|
-
function isNavigationLeafPage () {
|
101
|
-
return getMetaAttribute(metaApplicationSelector) === 'collections' &&
|
102
|
-
getMetaAttribute(metaFormatSelector) === 'taxon' &&
|
103
|
-
getMetaAttribute(metaNavigationTypeSelector) === 'leaf'
|
104
|
-
}
|
105
|
-
|
106
|
-
function isNewBrowsePageLevelTwo () {
|
107
|
-
return getMetaAttribute(metaApplicationSelector) === 'collections' &&
|
108
|
-
getMetaAttribute(metaNavigationTypeSelector) === 'browse level 2'
|
109
|
-
}
|
110
|
-
|
111
|
-
function isNewBrowsePage () {
|
112
|
-
return getMetaAttribute(metaApplicationSelector) === 'collections' &&
|
113
|
-
(getMetaAttribute(metaNavigationTypeSelector) === 'browse level 0' ||
|
114
|
-
getMetaAttribute(metaNavigationTypeSelector) === 'browse level 1') &&
|
115
|
-
getMetaAttribute(metaFormatSelector) === 'mainstream_browse_page'
|
116
|
-
}
|
117
|
-
|
118
|
-
function isMainstreamBrowsePage () {
|
119
|
-
return getMetaAttribute(metaApplicationSelector) === 'collections' &&
|
120
|
-
getMetaAttribute(metaFormatSelector) === 'mainstream_browse_page'
|
121
|
-
}
|
122
|
-
|
123
|
-
function isTopicPage () {
|
124
|
-
return getMetaAttribute(metaApplicationSelector) === 'collections' &&
|
125
|
-
getMetaAttribute(metaFormatSelector) === 'topic'
|
126
|
-
}
|
127
|
-
|
128
|
-
function isPolicyAreaPage () {
|
129
|
-
return getMetaAttribute(metaApplicationSelector) === 'whitehall' &&
|
130
|
-
getMetaAttribute(metaFormatSelector) === 'placeholder_policy_area'
|
131
|
-
}
|
132
|
-
|
133
|
-
function isDocumentCollectionPage () {
|
134
|
-
return getMetaAttribute(metaApplicationSelector) === 'government-frontend' &&
|
135
|
-
getMetaAttribute(metaFormatSelector) === 'document_collection'
|
136
|
-
}
|
137
|
-
|
138
|
-
function isFinderPage () {
|
139
|
-
return getMetaAttribute(metaApplicationSelector) === 'finder-frontend' &&
|
140
|
-
getMetaAttribute(metaFormatSelector) === 'finder'
|
141
|
-
}
|
142
|
-
|
143
|
-
function isWhitehallFinderPage () {
|
144
|
-
return getMetaAttribute(metaApplicationSelector) === 'whitehall' &&
|
145
|
-
getMetaAttribute(metaFormatSelector) === 'finder'
|
146
|
-
}
|
147
|
-
|
148
|
-
function countVisible (elements) {
|
149
|
-
var count = 0
|
150
|
-
for (var i = 0; i < elements.length; i++) {
|
151
|
-
var style = window.getComputedStyle(elements[i])
|
152
|
-
if (!(style.display === 'none' || style.visibility === 'hidden')) {
|
153
|
-
count++
|
154
|
-
}
|
155
|
-
}
|
156
|
-
return count
|
157
|
-
}
|
158
|
-
|
159
|
-
GOVUK.PageContent = PageContent
|
160
|
-
})()
|
@@ -1,115 +0,0 @@
|
|
1
|
-
;(function (global) {
|
2
|
-
'use strict'
|
3
|
-
|
4
|
-
var GOVUK = global.GOVUK || {}
|
5
|
-
var EMAIL_PATTERN = /[^\s=/?&]+(?:@|%40)[^\s=/?&]+/g
|
6
|
-
var POSTCODE_PATTERN = /\b[A-PR-UWYZ][A-HJ-Z]?[0-9][0-9A-HJKMNPR-Y]?(?:[\s+]|%20)*[0-9](?!refund)[ABD-HJLNPQ-Z]{2,3}\b/gi
|
7
|
-
var DATE_PATTERN = /\d{4}(-?)\d{2}(-?)\d{2}/g
|
8
|
-
var ESCAPE_REGEX_PATTERN = /[|\\{}()[\]^$+*?.]/g
|
9
|
-
|
10
|
-
// specific URL parameters to be redacted from accounts URLs
|
11
|
-
var RESET_PASSWORD_TOKEN_PATTERN = /reset_password_token=[a-zA-Z0-9-]+/g
|
12
|
-
var UNLOCK_TOKEN_PATTERN = /unlock_token=[a-zA-Z0-9-]+/g
|
13
|
-
var STATE_PATTERN = /state=.[^&]+/g
|
14
|
-
|
15
|
-
function shouldStripDates () {
|
16
|
-
var metas = document.querySelectorAll('meta[name="govuk:static-analytics:strip-dates"]')
|
17
|
-
return metas.length > 0
|
18
|
-
}
|
19
|
-
|
20
|
-
function shouldStripPostcodes () {
|
21
|
-
var metas = document.querySelectorAll('meta[name="govuk:static-analytics:strip-postcodes"]')
|
22
|
-
return metas.length > 0
|
23
|
-
}
|
24
|
-
|
25
|
-
function queryStringParametersToStrip () {
|
26
|
-
var meta = document.querySelector('meta[name="govuk:static-analytics:strip-query-string-parameters"]')
|
27
|
-
var value = false
|
28
|
-
if (meta) {
|
29
|
-
value = meta.getAttribute('content')
|
30
|
-
}
|
31
|
-
var parameters = []
|
32
|
-
|
33
|
-
if (value) {
|
34
|
-
var split = value.split(',')
|
35
|
-
for (var i = 0; i < split.length; i++) {
|
36
|
-
parameters.push(split[i].trim())
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
return parameters
|
41
|
-
}
|
42
|
-
|
43
|
-
var pii = function () {
|
44
|
-
this.stripDatePII = shouldStripDates()
|
45
|
-
this.stripPostcodePII = shouldStripPostcodes()
|
46
|
-
this.queryStringParametersToStrip = queryStringParametersToStrip()
|
47
|
-
}
|
48
|
-
|
49
|
-
pii.prototype.stripPII = function (value) {
|
50
|
-
if (typeof value === 'string') {
|
51
|
-
return this.stripPIIFromString(value)
|
52
|
-
} else if (Object.prototype.toString.call(value) === '[object Array]' || Object.prototype.toString.call(value) === '[object Arguments]') {
|
53
|
-
return this.stripPIIFromArray(value)
|
54
|
-
} else if (typeof value === 'object') {
|
55
|
-
return this.stripPIIFromObject(value)
|
56
|
-
} else {
|
57
|
-
return value
|
58
|
-
}
|
59
|
-
}
|
60
|
-
|
61
|
-
pii.prototype.stripPIIFromString = function (string) {
|
62
|
-
var stripped = string.replace(EMAIL_PATTERN, '[email]')
|
63
|
-
stripped = stripped.replace(RESET_PASSWORD_TOKEN_PATTERN, 'reset_password_token=[reset_password_token]')
|
64
|
-
stripped = stripped.replace(UNLOCK_TOKEN_PATTERN, 'unlock_token=[unlock_token]')
|
65
|
-
stripped = stripped.replace(STATE_PATTERN, 'state=[state]')
|
66
|
-
stripped = this.stripQueryStringParameters(stripped)
|
67
|
-
|
68
|
-
if (this.stripDatePII === true) {
|
69
|
-
stripped = stripped.replace(DATE_PATTERN, '[date]')
|
70
|
-
}
|
71
|
-
if (this.stripPostcodePII === true) {
|
72
|
-
stripped = stripped.replace(POSTCODE_PATTERN, '[postcode]')
|
73
|
-
}
|
74
|
-
return stripped
|
75
|
-
}
|
76
|
-
|
77
|
-
pii.prototype.stripPIIFromObject = function (object) {
|
78
|
-
if (object) {
|
79
|
-
if (object instanceof GOVUK.Analytics.PIISafe) {
|
80
|
-
return object.value
|
81
|
-
} else {
|
82
|
-
for (var property in object) {
|
83
|
-
var value = object[property]
|
84
|
-
|
85
|
-
object[property] = this.stripPII(value)
|
86
|
-
}
|
87
|
-
return object
|
88
|
-
}
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
pii.prototype.stripPIIFromArray = function (array) {
|
93
|
-
for (var i = 0, l = array.length; i < l; i++) {
|
94
|
-
var elem = array[i]
|
95
|
-
|
96
|
-
array[i] = this.stripPII(elem)
|
97
|
-
}
|
98
|
-
return array
|
99
|
-
}
|
100
|
-
|
101
|
-
pii.prototype.stripQueryStringParameters = function (string) {
|
102
|
-
for (var i = 0; i < this.queryStringParametersToStrip.length; i++) {
|
103
|
-
var parameter = this.queryStringParametersToStrip[i]
|
104
|
-
var escaped = parameter.replace(ESCAPE_REGEX_PATTERN, '\\$&')
|
105
|
-
var regexp = new RegExp('((?:\\?|&)' + escaped + '=)(?:[^&#\\s]*)', 'g')
|
106
|
-
string = string.replace(regexp, '$1[' + parameter + ']')
|
107
|
-
}
|
108
|
-
|
109
|
-
return string
|
110
|
-
}
|
111
|
-
|
112
|
-
GOVUK.Pii = pii
|
113
|
-
|
114
|
-
global.GOVUK = GOVUK
|
115
|
-
})(window)
|
@@ -1,39 +0,0 @@
|
|
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)
|
@@ -1,132 +0,0 @@
|
|
1
|
-
/* global GOVUK, ga */
|
2
|
-
|
3
|
-
(function () {
|
4
|
-
'use strict'
|
5
|
-
window.GOVUK = window.GOVUK || {}
|
6
|
-
var StaticAnalytics = function (config) {
|
7
|
-
// Create universal tracker
|
8
|
-
// https://github.com/alphagov/govuk_frontend_toolkit/blob/master/docs/analytics.md
|
9
|
-
// https://github.com/alphagov/govuk_frontend_toolkit/blob/master/javascripts/govuk/analytics/analytics.js
|
10
|
-
var consentCookie = window.GOVUK.getConsentCookie()
|
11
|
-
|
12
|
-
if (!consentCookie || consentCookie.usage) {
|
13
|
-
this.analytics = new GOVUK.Analytics(config)
|
14
|
-
}
|
15
|
-
|
16
|
-
var trackingOptions = getOptionsFromCookie()
|
17
|
-
|
18
|
-
// We're setting the client ID inside a callback function because
|
19
|
-
// we don't have access to the client ID until GA returns a tracker object.
|
20
|
-
ga(function (tracker) {
|
21
|
-
this.gaClientId = tracker.get('clientId')
|
22
|
-
|
23
|
-
GOVUK.triggerEvent(window, 'gaClientSet')
|
24
|
-
|
25
|
-
// Start up ecommerce tracking
|
26
|
-
GOVUK.Ecommerce.start()
|
27
|
-
|
28
|
-
// Track initial pageview
|
29
|
-
this.trackPageview(null, null, trackingOptions)
|
30
|
-
|
31
|
-
// Begin error and print tracking
|
32
|
-
GOVUK.analyticsPlugins.error({ filenameMustMatch: /gov\.uk/ })
|
33
|
-
GOVUK.analyticsPlugins.printIntent()
|
34
|
-
GOVUK.analyticsPlugins.mailtoLinkTracker()
|
35
|
-
GOVUK.analyticsPlugins.externalLinkTracker({
|
36
|
-
externalLinkUploadCustomDimension: 36
|
37
|
-
})
|
38
|
-
GOVUK.analyticsPlugins.downloadLinkTracker({
|
39
|
-
selector: 'a[href*="/government/uploads"], a[href*="assets.publishing.service.gov.uk"]'
|
40
|
-
})
|
41
|
-
}.bind(this))
|
42
|
-
}
|
43
|
-
|
44
|
-
StaticAnalytics.load = function () {
|
45
|
-
GOVUK.Analytics.load()
|
46
|
-
}
|
47
|
-
|
48
|
-
StaticAnalytics.prototype.trackPageview = function (path, title, options) {
|
49
|
-
// Add the cookie banner status as a custom dimension
|
50
|
-
var cookieBannerShown = !this.getCookie('seen_cookie_message')
|
51
|
-
var cookieBannerDimension = { dimension100: cookieBannerShown ? cookieBannerShown.toString() : 'false' }
|
52
|
-
options = GOVUK.extendObject(options, cookieBannerDimension)
|
53
|
-
|
54
|
-
var trackingOptions = GOVUK.CustomDimensions.getAndExtendDefaultTrackingOptions(options)
|
55
|
-
this.analytics.trackPageview(path, title, trackingOptions)
|
56
|
-
}
|
57
|
-
|
58
|
-
StaticAnalytics.prototype.trackEvent = function (category, action, options) {
|
59
|
-
var trackingOptions = GOVUK.CustomDimensions.getAndExtendDefaultTrackingOptions(options)
|
60
|
-
this.analytics.trackEvent(category, action, trackingOptions)
|
61
|
-
}
|
62
|
-
|
63
|
-
StaticAnalytics.prototype.setDimension = function (index, value, name, scope) {
|
64
|
-
if (typeof value === 'undefined') {
|
65
|
-
return
|
66
|
-
}
|
67
|
-
this.analytics.setDimension(index, value, name, scope)
|
68
|
-
}
|
69
|
-
|
70
|
-
StaticAnalytics.prototype.trackShare = function (network) {
|
71
|
-
var trackingOptions = GOVUK.CustomDimensions.getAndExtendDefaultTrackingOptions()
|
72
|
-
this.analytics.trackShare(network, trackingOptions)
|
73
|
-
}
|
74
|
-
|
75
|
-
StaticAnalytics.prototype.addLinkedTrackerDomain = function (trackerId, name, domain, sendPageView) {
|
76
|
-
this.analytics.addLinkedTrackerDomain(trackerId, name, domain, sendPageView)
|
77
|
-
}
|
78
|
-
|
79
|
-
StaticAnalytics.prototype.setOptionsForNextPageview = function (options) {
|
80
|
-
if (typeof options !== 'object') {
|
81
|
-
return
|
82
|
-
}
|
83
|
-
|
84
|
-
var cookieOptions = getOptionsFromCookie()
|
85
|
-
|
86
|
-
cookieOptions = GOVUK.extendObject(cookieOptions, options)
|
87
|
-
|
88
|
-
this.setCookie('analytics_next_page_call', cookieOptions)
|
89
|
-
}
|
90
|
-
|
91
|
-
StaticAnalytics.prototype.setCookie = function (cookieName, object) {
|
92
|
-
if (!GOVUK.cookie) {
|
93
|
-
return
|
94
|
-
}
|
95
|
-
|
96
|
-
if (!object) {
|
97
|
-
GOVUK.cookie(cookieName, null)
|
98
|
-
} else {
|
99
|
-
// Singly-stringified JSON sometimes gets escaped when put into a cookie, but inconsistently. The command-line
|
100
|
-
// tests will escape, but browser tests will not. Double-stringify in order to get consistently-escaped strings.
|
101
|
-
GOVUK.cookie(cookieName, JSON.stringify(JSON.stringify(object)))
|
102
|
-
}
|
103
|
-
}
|
104
|
-
|
105
|
-
StaticAnalytics.prototype.getCookie = function (cookieName) {
|
106
|
-
if (!GOVUK.cookie) {
|
107
|
-
return
|
108
|
-
}
|
109
|
-
|
110
|
-
try {
|
111
|
-
return JSON.parse(JSON.parse(GOVUK.cookie(cookieName)))
|
112
|
-
} catch (error) {
|
113
|
-
return null
|
114
|
-
}
|
115
|
-
}
|
116
|
-
|
117
|
-
StaticAnalytics.prototype.stripPII = function (value) {
|
118
|
-
return this.analytics.pii.stripPII(value)
|
119
|
-
}
|
120
|
-
|
121
|
-
function getOptionsFromCookie () {
|
122
|
-
try {
|
123
|
-
var cookie = StaticAnalytics.prototype.getCookie('analytics_next_page_call')
|
124
|
-
StaticAnalytics.prototype.setCookie('analytics_next_page_call', null)
|
125
|
-
return cookie || {}
|
126
|
-
} catch (e) {
|
127
|
-
return {}
|
128
|
-
}
|
129
|
-
}
|
130
|
-
|
131
|
-
GOVUK.StaticAnalytics = StaticAnalytics
|
132
|
-
})()
|