govuk_publishing_components 21.69.0 → 23.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/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,56 @@
|
|
1
|
+
;(function (global) {
|
2
|
+
'use strict'
|
3
|
+
|
4
|
+
var $ = global.jQuery
|
5
|
+
var GOVUK = global.GOVUK || {}
|
6
|
+
|
7
|
+
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {}
|
8
|
+
GOVUK.analyticsPlugins.externalLinkTracker = function (options) {
|
9
|
+
options = options || {}
|
10
|
+
var externalLinkUploadCustomDimension = options.externalLinkUploadCustomDimension
|
11
|
+
var currentHost = GOVUK.analyticsPlugins.externalLinkTracker.getHostname()
|
12
|
+
var externalLinkSelector = 'a[href^="http"]:not(a[href*="' + currentHost + '"])'
|
13
|
+
|
14
|
+
$('body').on('click', externalLinkSelector, trackClickEvent)
|
15
|
+
|
16
|
+
function trackClickEvent (evt) {
|
17
|
+
var $link = getLinkFromEvent(evt)
|
18
|
+
var options = { transport: 'beacon' }
|
19
|
+
var href = $link.attr('href')
|
20
|
+
var linkText = $.trim($link.text())
|
21
|
+
|
22
|
+
if (linkText) {
|
23
|
+
options.label = linkText
|
24
|
+
}
|
25
|
+
|
26
|
+
if (externalLinkUploadCustomDimension !== undefined) {
|
27
|
+
// This custom dimension will be used to duplicate the url information
|
28
|
+
// that we normally send in an "event action". This will be used to join
|
29
|
+
// up with a scheduled custom upload called "External Link Status".
|
30
|
+
// We can only join uploads on custom dimensions, not on `event actions`
|
31
|
+
// where we normally add the url info.
|
32
|
+
var externalLinkToJoinUploadOn = href
|
33
|
+
|
34
|
+
GOVUK.analytics.setDimension(externalLinkUploadCustomDimension, externalLinkToJoinUploadOn)
|
35
|
+
}
|
36
|
+
|
37
|
+
GOVUK.analytics.trackEvent('External Link Clicked', href, options)
|
38
|
+
}
|
39
|
+
|
40
|
+
function getLinkFromEvent (evt) {
|
41
|
+
var $target = $(evt.target)
|
42
|
+
|
43
|
+
if (!$target.is('a')) {
|
44
|
+
$target = $target.parents('a')
|
45
|
+
}
|
46
|
+
|
47
|
+
return $target
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
GOVUK.analyticsPlugins.externalLinkTracker.getHostname = function () {
|
52
|
+
return global.location.hostname
|
53
|
+
}
|
54
|
+
|
55
|
+
global.GOVUK = GOVUK
|
56
|
+
})(window)
|
@@ -0,0 +1,198 @@
|
|
1
|
+
;(function (global) {
|
2
|
+
'use strict'
|
3
|
+
|
4
|
+
var $ = global.jQuery
|
5
|
+
var GOVUK = global.GOVUK || {}
|
6
|
+
var pii
|
7
|
+
|
8
|
+
var GoogleAnalyticsUniversalTracker = function (trackingId, fieldsObject) {
|
9
|
+
pii = new GOVUK.Pii()
|
10
|
+
|
11
|
+
function configureProfile () {
|
12
|
+
// https://developers.google.com/analytics/devguides/collection/analyticsjs/command-queue-reference#create
|
13
|
+
sendToGa('create', trackingId, fieldsObject)
|
14
|
+
}
|
15
|
+
|
16
|
+
function anonymizeIp () {
|
17
|
+
// https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced#anonymizeip
|
18
|
+
sendToGa('set', 'anonymizeIp', true)
|
19
|
+
}
|
20
|
+
|
21
|
+
function disableAdFeatures () {
|
22
|
+
// https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#allowAdFeatures
|
23
|
+
sendToGa('set', 'allowAdFeatures', false)
|
24
|
+
}
|
25
|
+
|
26
|
+
function stripTitlePII () {
|
27
|
+
sendToGa('set', 'title', pii.stripPII(document.title))
|
28
|
+
}
|
29
|
+
|
30
|
+
function stripLocationPII () {
|
31
|
+
sendToGa('set', 'location', pii.stripPII(window.location.href))
|
32
|
+
}
|
33
|
+
|
34
|
+
// Support legacy cookieDomain param
|
35
|
+
if (typeof fieldsObject === 'string') {
|
36
|
+
fieldsObject = { cookieDomain: fieldsObject }
|
37
|
+
}
|
38
|
+
|
39
|
+
configureProfile()
|
40
|
+
anonymizeIp()
|
41
|
+
disableAdFeatures()
|
42
|
+
stripTitlePII()
|
43
|
+
stripLocationPII()
|
44
|
+
}
|
45
|
+
|
46
|
+
GoogleAnalyticsUniversalTracker.load = function () {
|
47
|
+
/* eslint-disable */
|
48
|
+
(function (i, s, o, g, r, a, m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
|
49
|
+
(i[r].q = i[r].q || []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o),
|
50
|
+
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
|
51
|
+
})(global, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga')
|
52
|
+
/* eslint-enable */
|
53
|
+
}
|
54
|
+
|
55
|
+
// https://developers.google.com/analytics/devguides/collection/analyticsjs/pages
|
56
|
+
GoogleAnalyticsUniversalTracker.prototype.trackPageview = function (path, title, options) {
|
57
|
+
var pageviewObject
|
58
|
+
var trackerName = ''
|
59
|
+
|
60
|
+
if (typeof path === 'string') {
|
61
|
+
pageviewObject = { page: path }
|
62
|
+
}
|
63
|
+
|
64
|
+
if (typeof title === 'string') {
|
65
|
+
pageviewObject = pageviewObject || {}
|
66
|
+
pageviewObject.title = title
|
67
|
+
}
|
68
|
+
|
69
|
+
// Set an options object for the pageview (e.g. transport, sessionControl)
|
70
|
+
// https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#transport
|
71
|
+
if (typeof options === 'object') {
|
72
|
+
pageviewObject = $.extend(pageviewObject || {}, options)
|
73
|
+
|
74
|
+
// trackerName is optional
|
75
|
+
if (typeof options.trackerName === 'string') {
|
76
|
+
trackerName = options.trackerName + '.'
|
77
|
+
delete options.trackerName
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
if (!$.isEmptyObject(pageviewObject)) {
|
82
|
+
sendToGa(trackerName + 'send', 'pageview', pageviewObject)
|
83
|
+
} else {
|
84
|
+
sendToGa(trackerName + 'send', 'pageview')
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
// https://developers.google.com/analytics/devguides/collection/analyticsjs/events
|
89
|
+
GoogleAnalyticsUniversalTracker.prototype.trackEvent = function (category, action, options) {
|
90
|
+
options = options || {}
|
91
|
+
var value
|
92
|
+
var trackerName = ''
|
93
|
+
var evt = {
|
94
|
+
hitType: 'event',
|
95
|
+
eventCategory: category,
|
96
|
+
eventAction: action
|
97
|
+
}
|
98
|
+
|
99
|
+
// Label is optional
|
100
|
+
if (typeof options.label === 'string') {
|
101
|
+
evt.eventLabel = options.label
|
102
|
+
delete options.label
|
103
|
+
}
|
104
|
+
|
105
|
+
// Value is optional, but when used must be an
|
106
|
+
// integer, otherwise the event will be invalid
|
107
|
+
// and not logged
|
108
|
+
if (options.value || options.value === 0) {
|
109
|
+
value = parseInt(options.value, 10)
|
110
|
+
if (typeof value === 'number' && !isNaN(value)) {
|
111
|
+
options.eventValue = value
|
112
|
+
}
|
113
|
+
delete options.value
|
114
|
+
}
|
115
|
+
|
116
|
+
// trackerName is optional
|
117
|
+
if (typeof options.trackerName === 'string') {
|
118
|
+
trackerName = options.trackerName + '.'
|
119
|
+
delete options.trackerName
|
120
|
+
}
|
121
|
+
|
122
|
+
// Prevents an event from affecting bounce rate
|
123
|
+
// https://developers.google.com/analytics/devguides/collection/analyticsjs/events#implementation
|
124
|
+
if (options.nonInteraction) {
|
125
|
+
options.nonInteraction = 1
|
126
|
+
}
|
127
|
+
|
128
|
+
if (typeof options === 'object') {
|
129
|
+
$.extend(evt, options)
|
130
|
+
}
|
131
|
+
|
132
|
+
sendToGa(trackerName + 'send', evt)
|
133
|
+
}
|
134
|
+
|
135
|
+
/*
|
136
|
+
https://developers.google.com/analytics/devguides/collection/analyticsjs/social-interactions
|
137
|
+
network – The network on which the action occurs (e.g. Facebook, Twitter)
|
138
|
+
action – The type of action that happens (e.g. Like, Send, Tweet)
|
139
|
+
target – Specifies the target of a social interaction.
|
140
|
+
This value is typically a URL but can be any text.
|
141
|
+
*/
|
142
|
+
GoogleAnalyticsUniversalTracker.prototype.trackSocial = function (network, action, target, options) {
|
143
|
+
var trackingOptions = {
|
144
|
+
hitType: 'social',
|
145
|
+
socialNetwork: network,
|
146
|
+
socialAction: action,
|
147
|
+
socialTarget: target
|
148
|
+
}
|
149
|
+
|
150
|
+
$.extend(trackingOptions, options)
|
151
|
+
|
152
|
+
sendToGa('send', trackingOptions)
|
153
|
+
}
|
154
|
+
|
155
|
+
/*
|
156
|
+
https://developers.google.com/analytics/devguides/collection/analyticsjs/cross-domain
|
157
|
+
trackerId - the UA account code to track the domain against
|
158
|
+
name - name for the tracker
|
159
|
+
domain - the domain to track (must be an array of strings)
|
160
|
+
sendPageView - optional argument which controls the legacy behaviour of sending a pageview
|
161
|
+
on creation of the linked domain.
|
162
|
+
*/
|
163
|
+
GoogleAnalyticsUniversalTracker.prototype.addLinkedTrackerDomain = function (trackerId, name, domain, sendPageView) {
|
164
|
+
sendToGa('create',
|
165
|
+
trackerId,
|
166
|
+
'auto',
|
167
|
+
{ name: name })
|
168
|
+
// Load the plugin.
|
169
|
+
sendToGa(name + '.require', 'linker')
|
170
|
+
|
171
|
+
// Define which domains to autoLink.
|
172
|
+
sendToGa(name + '.linker:autoLink', domain)
|
173
|
+
|
174
|
+
sendToGa(name + '.set', 'anonymizeIp', true)
|
175
|
+
sendToGa(name + '.set', 'allowAdFeatures', false)
|
176
|
+
sendToGa(name + '.set', 'title', pii.stripPII(document.title))
|
177
|
+
sendToGa(name + '.set', 'location', pii.stripPII(window.location.href))
|
178
|
+
|
179
|
+
if (typeof sendPageView === 'undefined' || sendPageView === true) {
|
180
|
+
sendToGa(name + '.send', 'pageview')
|
181
|
+
}
|
182
|
+
}
|
183
|
+
|
184
|
+
// https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets
|
185
|
+
GoogleAnalyticsUniversalTracker.prototype.setDimension = function (index, value) {
|
186
|
+
sendToGa('set', 'dimension' + index, String(value))
|
187
|
+
}
|
188
|
+
|
189
|
+
function sendToGa () {
|
190
|
+
if (typeof global.ga === 'function') {
|
191
|
+
global.ga.apply(global, arguments)
|
192
|
+
}
|
193
|
+
}
|
194
|
+
|
195
|
+
GOVUK.GoogleAnalyticsUniversalTracker = GoogleAnalyticsUniversalTracker
|
196
|
+
|
197
|
+
global.GOVUK = GOVUK
|
198
|
+
})(window)
|
@@ -0,0 +1,50 @@
|
|
1
|
+
var analyticsInit = function(linkedDomains) {
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var consentCookie = window.GOVUK.getConsentCookie();
|
5
|
+
|
6
|
+
var dummyAnalytics = {
|
7
|
+
addLinkedTrackerDomain: function(){},
|
8
|
+
setDimension: function(){},
|
9
|
+
setOptionsForNextPageView: function(){},
|
10
|
+
trackEvent: function(){},
|
11
|
+
trackPageview: function(){},
|
12
|
+
trackShare: function(){},
|
13
|
+
};
|
14
|
+
|
15
|
+
// Disable analytics by default
|
16
|
+
// This will be reversed below, if the consent cookie says usage cookies are allowed
|
17
|
+
window['ga-disable-UA-26179049-1'] = true;
|
18
|
+
|
19
|
+
if (consentCookie && consentCookie["usage"]) {
|
20
|
+
window['ga-disable-UA-26179049-1'] = false;
|
21
|
+
|
22
|
+
// Load Google Analytics libraries
|
23
|
+
GOVUK.StaticAnalytics.load();
|
24
|
+
|
25
|
+
// Use document.domain in dev, preview and staging so that tracking works
|
26
|
+
// Otherwise explicitly set the domain as www.gov.uk (and not gov.uk).
|
27
|
+
var cookieDomain = (document.domain == 'www.gov.uk') ? '.www.gov.uk' : document.domain;
|
28
|
+
|
29
|
+
var universalId = "UA-26179049-1";
|
30
|
+
var secondaryId = "UA-145652997-1";
|
31
|
+
|
32
|
+
// Configure profiles, setup custom vars, track initial pageview
|
33
|
+
var analytics = new GOVUK.StaticAnalytics({
|
34
|
+
universalId: universalId,
|
35
|
+
cookieDomain: cookieDomain,
|
36
|
+
allowLinker: true
|
37
|
+
});
|
38
|
+
|
39
|
+
// Make interface public for virtual pageviews and events
|
40
|
+
GOVUK.analytics = analytics;
|
41
|
+
|
42
|
+
if (linkedDomains && linkedDomains.length > 0) {
|
43
|
+
GOVUK.analytics.addLinkedTrackerDomain(secondaryId, 'govuk', linkedDomains);
|
44
|
+
}
|
45
|
+
} else {
|
46
|
+
GOVUK.analytics = dummyAnalytics
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
window.GOVUK.analyticsInit = analyticsInit
|
@@ -0,0 +1,38 @@
|
|
1
|
+
;(function (global) {
|
2
|
+
'use strict'
|
3
|
+
|
4
|
+
var $ = global.jQuery
|
5
|
+
var GOVUK = global.GOVUK || {}
|
6
|
+
|
7
|
+
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {}
|
8
|
+
GOVUK.analyticsPlugins.mailtoLinkTracker = function () {
|
9
|
+
var mailtoLinkSelector = 'a[href^="mailto:"]'
|
10
|
+
|
11
|
+
$('body').on('click', mailtoLinkSelector, trackClickEvent)
|
12
|
+
|
13
|
+
function trackClickEvent (evt) {
|
14
|
+
var $link = getLinkFromEvent(evt)
|
15
|
+
var options = { transport: 'beacon' }
|
16
|
+
var href = $link.attr('href')
|
17
|
+
var linkText = $.trim($link.text())
|
18
|
+
|
19
|
+
if (linkText) {
|
20
|
+
options.label = linkText
|
21
|
+
}
|
22
|
+
|
23
|
+
GOVUK.analytics.trackEvent('Mailto Link Clicked', href, options)
|
24
|
+
}
|
25
|
+
|
26
|
+
function getLinkFromEvent (evt) {
|
27
|
+
var $target = $(evt.target)
|
28
|
+
|
29
|
+
if (!$target.is('a')) {
|
30
|
+
$target = $target.parents('a')
|
31
|
+
}
|
32
|
+
|
33
|
+
return $target
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
global.GOVUK = GOVUK
|
38
|
+
})(window)
|
@@ -0,0 +1,129 @@
|
|
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 + $('.parent-topic-contents').length
|
12
|
+
case isNavigationAccordionPage():
|
13
|
+
return $('[data-track-count="accordionSection"]').length
|
14
|
+
case isDocumentCollectionPage():
|
15
|
+
return $('.document-collection .group-title').length
|
16
|
+
case isMainstreamBrowsePage():
|
17
|
+
return $('#subsection ul:visible').length || $('#section ul').length
|
18
|
+
case isTopicPage():
|
19
|
+
return $('.topics-page nav.index-list').length
|
20
|
+
case isPolicyAreaPage():
|
21
|
+
return $('.topic section h1.label').length
|
22
|
+
case isFinderPage():
|
23
|
+
case isWhitehallFinderPage():
|
24
|
+
case isNavigationLeafPage():
|
25
|
+
// The default in finders should be one, so it's comparable with A-Z
|
26
|
+
// lists in other navigation pages. Request made by performance
|
27
|
+
// analysts.
|
28
|
+
return 1
|
29
|
+
default:
|
30
|
+
// It's a content page, not a "finding" page
|
31
|
+
var sidebarSections = $('[data-track-count="sidebarRelatedItemSection"]').length
|
32
|
+
var sidebarTaxons = $('[data-track-count="sidebarTaxonSection"]').length
|
33
|
+
|
34
|
+
return sidebarSections || sidebarTaxons
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
PageContent.getNumberOfLinks = function () {
|
39
|
+
switch (true) {
|
40
|
+
case isNavigationGridPage():
|
41
|
+
return $('a[data-track-category="navGridLinkClicked"]').length +
|
42
|
+
$('a[data-track-category="navGridLeafLinkClicked"]').length
|
43
|
+
case isNavigationAccordionPage():
|
44
|
+
return $('a[data-track-category="navAccordionLinkClicked"]').length
|
45
|
+
case isNavigationLeafPage():
|
46
|
+
return $('a[data-track-category="navLeafLinkClicked"]').length
|
47
|
+
case isDocumentCollectionPage():
|
48
|
+
return $('.document-collection .group-document-list li a').length
|
49
|
+
case isMainstreamBrowsePage():
|
50
|
+
return $('#subsection ul a:visible').length ||
|
51
|
+
$('#section ul a').length
|
52
|
+
case isTopicPage():
|
53
|
+
return $('.topics-page .index-list ul a').length ||
|
54
|
+
$('.topics-page .topics ul a').length
|
55
|
+
case isPolicyAreaPage():
|
56
|
+
return $('section.document-block a').length +
|
57
|
+
$('section .collection-list h2 a').length
|
58
|
+
case isWhitehallFinderPage():
|
59
|
+
return $('.document-list .document-row h3 a').length
|
60
|
+
case isFinderPage():
|
61
|
+
return $('.finder-frontend-content li.document a').length
|
62
|
+
default:
|
63
|
+
// It's a content page, not a "finding" page, count related links
|
64
|
+
return $('a[data-track-category="relatedLinkClicked"]').length
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
function getRenderingApplication () {
|
69
|
+
return $('meta[name="govuk:rendering-application"]').attr('content')
|
70
|
+
};
|
71
|
+
|
72
|
+
function getFormat () {
|
73
|
+
return $('meta[name="govuk:format"]').attr('content')
|
74
|
+
};
|
75
|
+
|
76
|
+
function getNavigationPageType () {
|
77
|
+
return $('meta[name="govuk:navigation-page-type"]').attr('content')
|
78
|
+
};
|
79
|
+
|
80
|
+
function isNavigationGridPage () {
|
81
|
+
return getRenderingApplication() === 'collections' &&
|
82
|
+
getFormat() === 'taxon' &&
|
83
|
+
getNavigationPageType() === 'grid'
|
84
|
+
};
|
85
|
+
|
86
|
+
function isNavigationAccordionPage () {
|
87
|
+
return getRenderingApplication() === 'collections' &&
|
88
|
+
getFormat() === 'taxon' &&
|
89
|
+
getNavigationPageType() === 'accordion'
|
90
|
+
};
|
91
|
+
|
92
|
+
function isNavigationLeafPage () {
|
93
|
+
return getRenderingApplication() === 'collections' &&
|
94
|
+
getFormat() === 'taxon' &&
|
95
|
+
getNavigationPageType() === 'leaf'
|
96
|
+
};
|
97
|
+
|
98
|
+
function isMainstreamBrowsePage () {
|
99
|
+
return getRenderingApplication() === 'collections' &&
|
100
|
+
getFormat() === 'mainstream_browse_page'
|
101
|
+
};
|
102
|
+
|
103
|
+
function isTopicPage () {
|
104
|
+
return getRenderingApplication() === 'collections' &&
|
105
|
+
getFormat() === 'topic'
|
106
|
+
};
|
107
|
+
|
108
|
+
function isPolicyAreaPage () {
|
109
|
+
return getRenderingApplication() === 'whitehall' &&
|
110
|
+
getFormat() === 'placeholder_policy_area'
|
111
|
+
};
|
112
|
+
|
113
|
+
function isDocumentCollectionPage () {
|
114
|
+
return getRenderingApplication() === 'government-frontend' &&
|
115
|
+
getFormat() === 'document_collection'
|
116
|
+
};
|
117
|
+
|
118
|
+
function isFinderPage () {
|
119
|
+
return getRenderingApplication() === 'finder-frontend' &&
|
120
|
+
getFormat() === 'finder'
|
121
|
+
};
|
122
|
+
|
123
|
+
function isWhitehallFinderPage () {
|
124
|
+
return getRenderingApplication() === 'whitehall' &&
|
125
|
+
getFormat() === 'finder'
|
126
|
+
};
|
127
|
+
|
128
|
+
GOVUK.PageContent = PageContent
|
129
|
+
})()
|