govuk_publishing_components 62.0.0 → 62.1.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/components/option-select.js +4 -3
- data/app/assets/javascripts/govuk_publishing_components/lib/filter-list.js +48 -0
- data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +373 -245
- data/app/assets/stylesheets/component_guide/application.scss +1 -42
- data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +5 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +6 -11
- data/app/assets/stylesheets/govuk_publishing_components/components/_option-select.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_button.scss +6 -38
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss +2 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +6 -1
- data/app/controllers/govuk_publishing_components/applications_page_controller.rb +50 -0
- data/app/models/govuk_publishing_components/applications_page.rb +64 -0
- data/app/views/govuk_publishing_components/applications_page/_table-content.html.erb +39 -0
- data/app/views/govuk_publishing_components/applications_page/show.html.erb +37 -0
- data/app/views/govuk_publishing_components/audit/show.html.erb +5 -1
- data/app/views/govuk_publishing_components/component_guide/_component_list.html.erb +14 -0
- data/app/views/govuk_publishing_components/component_guide/example.html.erb +3 -3
- data/app/views/govuk_publishing_components/component_guide/index.html.erb +50 -75
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +7 -7
- data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +27 -25
- data/app/views/govuk_publishing_components/components/docs/govspeak.yml +6 -0
- data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +7 -1
- data/config/routes.rb +1 -0
- data/lib/govuk_publishing_components/minitest/component_guide_test.rb +1 -1
- data/lib/govuk_publishing_components/presenters/organisation_logo_helper.rb +7 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +37 -133
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +37 -133
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +4 -4
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/button/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/button/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/fixtures.json +34 -29
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/macro-options.json +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-default.html +23 -23
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-conditional-reveal.html +21 -21
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-divider-and-none.html +30 -30
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-error.html +26 -26
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-hint.html +25 -25
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-long-text.html +23 -23
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small.html +23 -23
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-conditional-items.html +35 -35
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-divider-and-none.html +30 -30
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-divider-none-and-conditional-items.html +40 -40
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-error-message.html +32 -32
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-hint.html +25 -25
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-hints-on-items.html +21 -21
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-legend-as-a-page-heading.html +27 -27
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-optional-form-group-classes-showing-group-error.html +36 -36
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-pre-checked-values.html +35 -35
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-very-long-option-text.html +25 -25
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template.njk +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +2 -1
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +36 -132
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +36 -132
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +35 -6
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/fixtures.json +17 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-multiple-files.html +10 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +4 -4
- data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +20 -20
- data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +7 -15
- data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +4 -2
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/fixtures.json +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-many-pages.html +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/template.njk +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/fixtures.json +36 -31
- data/node_modules/govuk-frontend/dist/govuk/components/radios/macro-options.json +3 -3
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-default.html +17 -17
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-inline.html +19 -19
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-inline.html +23 -23
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-a-divider.html +24 -24
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-conditional-reveal.html +27 -27
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-error.html +26 -26
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-hint.html +25 -25
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-long-text.html +23 -23
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small.html +23 -23
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-a-divider.html +24 -24
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-item-checked.html +35 -35
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-items-and-pre-checked-value.html +35 -35
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-items.html +35 -35
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-fieldset-and-error-message.html +20 -20
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-hint.html +19 -19
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-hints-on-items.html +23 -23
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-legend-as-page-heading.html +21 -21
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-optional-form-group-classes-showing-group-error.html +36 -36
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-very-long-option-text.html +28 -28
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template.njk +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +1 -7
- data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +5 -5
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +16 -16
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/table/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/table/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/fixtures.json +46 -0
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-forced-hover-state.html +37 -0
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +1 -7
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/core/_lists.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/core/_lists.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/core/_typography.scss +3 -3
- data/node_modules/govuk-frontend/dist/govuk/core/_typography.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css +2 -2
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss +34 -0
- data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_media-queries.scss +172 -33
- data/node_modules/govuk-frontend/dist/govuk/helpers/_media-queries.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_spacing.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_spacing.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +4 -4
- data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/i18n.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/i18n.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_button-group.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_button-group.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_main-wrapper.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_main-wrapper.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_width-container.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/objects/_width-container.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/overrides/_display.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/overrides/_display.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/overrides/_width.scss +5 -5
- data/node_modules/govuk-frontend/dist/govuk/overrides/_width.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/settings/_media-queries.scss +7 -0
- data/node_modules/govuk-frontend/dist/govuk/settings/_media-queries.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-em.scss +4 -2
- data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-em.scss.map +1 -1
- data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +1 -1
- data/node_modules/govuk-frontend/package.json +9 -8
- metadata +9 -4
- data/app/assets/javascripts/component_guide/filter-components.js +0 -35
- data/node_modules/govuk-frontend/dist/govuk/vendor/_sass-mq.scss +0 -349
- data/node_modules/govuk-frontend/dist/govuk/vendor/_sass-mq.scss.map +0 -1
|
@@ -22,6 +22,24 @@
|
|
|
22
22
|
(function () {
|
|
23
23
|
'use strict';
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* This file helps keep output size down by aliasing properties that are used often.
|
|
27
|
+
*/
|
|
28
|
+
var activationStart = "activationStart";
|
|
29
|
+
var duration = "duration";
|
|
30
|
+
var entryType = "entryType";
|
|
31
|
+
var length = "length";
|
|
32
|
+
var name = "name";
|
|
33
|
+
var navigationStart = "navigationStart";
|
|
34
|
+
var push = "push";
|
|
35
|
+
var processingEnd = "processingEnd";
|
|
36
|
+
var processingStart = "processingStart";
|
|
37
|
+
var processingTime = "processingTime";
|
|
38
|
+
var script = "script";
|
|
39
|
+
var selector = "selector";
|
|
40
|
+
var startTime$1 = "startTime";
|
|
41
|
+
var totalDuration = "totalDuration";
|
|
42
|
+
|
|
25
43
|
var max = Math.max;
|
|
26
44
|
var floor = Math.floor;
|
|
27
45
|
var round = Math.round;
|
|
@@ -75,8 +93,8 @@
|
|
|
75
93
|
}
|
|
76
94
|
function getNavigationEntry() {
|
|
77
95
|
var navEntries = getEntriesByType("navigation");
|
|
78
|
-
if (navEntries
|
|
79
|
-
var nativeEntry = navEntries
|
|
96
|
+
if (navEntries[length]) {
|
|
97
|
+
var nativeEntry = navEntries.pop().toJSON();
|
|
80
98
|
var entry_1 = {
|
|
81
99
|
navigationStart: 0,
|
|
82
100
|
activationStart: 0,
|
|
@@ -95,8 +113,8 @@
|
|
|
95
113
|
};
|
|
96
114
|
{
|
|
97
115
|
for (var key in timing) {
|
|
98
|
-
if (typeof timing[key] === "number" && key !==
|
|
99
|
-
entry[key] = floor(timing[key] - timing
|
|
116
|
+
if (typeof timing[key] === "number" && key !== navigationStart) {
|
|
117
|
+
entry[key] = floor(timing[key] - timing[navigationStart]);
|
|
100
118
|
}
|
|
101
119
|
}
|
|
102
120
|
}
|
|
@@ -110,7 +128,7 @@
|
|
|
110
128
|
function getEntriesByType(type) {
|
|
111
129
|
if (typeof performance.getEntriesByType === "function") {
|
|
112
130
|
var entries = performance.getEntriesByType(type);
|
|
113
|
-
if (entries && entries
|
|
131
|
+
if (entries && entries[length]) {
|
|
114
132
|
return entries;
|
|
115
133
|
}
|
|
116
134
|
}
|
|
@@ -124,7 +142,7 @@
|
|
|
124
142
|
function getEntriesByName(type) {
|
|
125
143
|
if (typeof performance.getEntriesByName === "function") {
|
|
126
144
|
var entries = performance.getEntriesByName(type);
|
|
127
|
-
if (entries && entries
|
|
145
|
+
if (entries && entries[length]) {
|
|
128
146
|
return entries;
|
|
129
147
|
}
|
|
130
148
|
}
|
|
@@ -163,7 +181,7 @@
|
|
|
163
181
|
}
|
|
164
182
|
}
|
|
165
183
|
function wasPrerendered() {
|
|
166
|
-
return document.prerendering || getNavigationEntry()
|
|
184
|
+
return document.prerendering || getNavigationEntry()[activationStart] > 0;
|
|
167
185
|
}
|
|
168
186
|
function wasRedirected() {
|
|
169
187
|
return getNavigationEntry().redirectCount > 0 || timing.redirectEnd > 0;
|
|
@@ -175,7 +193,7 @@
|
|
|
175
193
|
if (!subscribers[event]) {
|
|
176
194
|
subscribers[event] = [];
|
|
177
195
|
}
|
|
178
|
-
subscribers[event]
|
|
196
|
+
subscribers[event][push](callback);
|
|
179
197
|
// Ensure previous event data is available to new subscribers
|
|
180
198
|
if (eventData[event] !== undefined) {
|
|
181
199
|
callback(eventData[event]);
|
|
@@ -237,7 +255,7 @@
|
|
|
237
255
|
*/
|
|
238
256
|
function getZeroTime() {
|
|
239
257
|
var _a;
|
|
240
|
-
return max(getPageRestoreTime() || 0, getNavigationEntry()
|
|
258
|
+
return max(getPageRestoreTime() || 0, getNavigationEntry()[activationStart], ((_a = getEntriesByName(START_MARK).pop()) === null || _a === void 0 ? void 0 : _a.startTime) || 0);
|
|
241
259
|
}
|
|
242
260
|
/**
|
|
243
261
|
* Most time-based metrics that LUX reports should be relative to the "zero" marker, rounded down
|
|
@@ -253,7 +271,7 @@
|
|
|
253
271
|
if (performance.now) {
|
|
254
272
|
return floor(performance.now());
|
|
255
273
|
}
|
|
256
|
-
return now() - timing
|
|
274
|
+
return now() - timing[navigationStart];
|
|
257
275
|
}
|
|
258
276
|
/**
|
|
259
277
|
* Returns the number of milliseconds since the current page was initialized. For SPAs, this is the
|
|
@@ -263,15 +281,15 @@
|
|
|
263
281
|
var sinceNavigationStart = msSinceNavigationStart();
|
|
264
282
|
var startMark = getEntriesByName(START_MARK).pop();
|
|
265
283
|
if (startMark) {
|
|
266
|
-
return floor(sinceNavigationStart - startMark
|
|
284
|
+
return floor(sinceNavigationStart - startMark[startTime$1]);
|
|
267
285
|
}
|
|
268
286
|
return sinceNavigationStart;
|
|
269
287
|
}
|
|
270
288
|
|
|
271
|
-
var version = "4.
|
|
289
|
+
var version = "4.4.2";
|
|
272
290
|
|
|
273
|
-
function padStart(str, length, char) {
|
|
274
|
-
while (str
|
|
291
|
+
function padStart(str, length$1, char) {
|
|
292
|
+
while (str[length] < length$1) {
|
|
275
293
|
str = char + str;
|
|
276
294
|
}
|
|
277
295
|
return str;
|
|
@@ -316,8 +334,8 @@
|
|
|
316
334
|
var remainingUtValues = utValues.slice(config.maxBeaconUTEntries);
|
|
317
335
|
// Trim UT entries until they fit within the maximum URL length, ensuring at least one UT entry
|
|
318
336
|
// is included.
|
|
319
|
-
while ((url + "&UT=" + beaconUtValues.join(","))
|
|
320
|
-
beaconUtValues
|
|
337
|
+
while ((url + "&UT=" + beaconUtValues.join(","))[length] > config.maxBeaconUrlLength &&
|
|
338
|
+
beaconUtValues[length] > 1) {
|
|
321
339
|
remainingUtValues.unshift(beaconUtValues.pop());
|
|
322
340
|
}
|
|
323
341
|
return [beaconUtValues, remainingUtValues];
|
|
@@ -390,7 +408,7 @@
|
|
|
390
408
|
return this.config.beaconUrlV2;
|
|
391
409
|
};
|
|
392
410
|
Beacon.prototype.onBeforeSend = function (cb) {
|
|
393
|
-
this.onBeforeSendCbs
|
|
411
|
+
this.onBeforeSendCbs[push](cb);
|
|
394
412
|
};
|
|
395
413
|
Beacon.prototype.send = function () {
|
|
396
414
|
if (this.isSent) {
|
|
@@ -413,7 +431,7 @@
|
|
|
413
431
|
metricData[metric] = data;
|
|
414
432
|
}
|
|
415
433
|
}
|
|
416
|
-
if (!Object.keys(metricData)
|
|
434
|
+
if (!Object.keys(metricData)[length] && !this.config.allowEmptyPostBeacon) {
|
|
417
435
|
// TODO: This is only required while the new beacon is supplementary. Once it's the primary
|
|
418
436
|
// beacon, we should send it regardless of how much metric data it has.
|
|
419
437
|
this.logger.logEvent(85 /* LogEvent.PostBeaconCancelled */);
|
|
@@ -453,9 +471,11 @@
|
|
|
453
471
|
(function (BeaconMetricKey) {
|
|
454
472
|
BeaconMetricKey["CLS"] = "cls";
|
|
455
473
|
BeaconMetricKey["INP"] = "inp";
|
|
474
|
+
BeaconMetricKey["FCP"] = "fcp";
|
|
456
475
|
BeaconMetricKey["LCP"] = "lcp";
|
|
457
476
|
BeaconMetricKey["LoAF"] = "loaf";
|
|
458
|
-
BeaconMetricKey["
|
|
477
|
+
BeaconMetricKey["RageClick"] = "rage";
|
|
478
|
+
BeaconMetricKey["NavigationTiming"] = "nt";
|
|
459
479
|
})(BeaconMetricKey || (BeaconMetricKey = {}));
|
|
460
480
|
|
|
461
481
|
function onPageLoad(callback) {
|
|
@@ -551,7 +571,7 @@
|
|
|
551
571
|
// Strip out reserved characters (, and | are used as delimiters)
|
|
552
572
|
key = key.replace(/,/g, "").replace(/\|/g, "");
|
|
553
573
|
value = value.replace(/,/g, "").replace(/\|/g, "");
|
|
554
|
-
strings
|
|
574
|
+
strings[push](key + "|" + value);
|
|
555
575
|
}
|
|
556
576
|
return encodeURIComponent(strings.join(","));
|
|
557
577
|
}
|
|
@@ -569,7 +589,6 @@
|
|
|
569
589
|
}
|
|
570
590
|
return null;
|
|
571
591
|
}
|
|
572
|
-
|
|
573
592
|
function hasParentNode(el) {
|
|
574
593
|
if (el.parentNode && el.parentNode.tagName) {
|
|
575
594
|
return true;
|
|
@@ -585,7 +604,7 @@
|
|
|
585
604
|
if (selector === void 0) { selector = ""; }
|
|
586
605
|
try {
|
|
587
606
|
if (selector &&
|
|
588
|
-
(node.nodeType === 9 || selector
|
|
607
|
+
(node.nodeType === 9 || selector[length] > MAX_SELECTOR_LENGTH || !node.parentNode)) {
|
|
589
608
|
// Final selector.
|
|
590
609
|
return selector;
|
|
591
610
|
}
|
|
@@ -604,13 +623,13 @@
|
|
|
604
623
|
var name_1 = el.nodeType === 1 ? el.nodeName.toLowerCase() : el.nodeName.toUpperCase();
|
|
605
624
|
var classes = el.className ? "." + el.className.replace(/\s+/g, ".") : "";
|
|
606
625
|
// Remove classes until the selector is short enough
|
|
607
|
-
while ((name_1 + classes)
|
|
626
|
+
while ((name_1 + classes)[length] > MAX_SELECTOR_LENGTH) {
|
|
608
627
|
classes = classes.split(".").slice(0, -1).join(".");
|
|
609
628
|
}
|
|
610
629
|
var currentSelector = name_1 + classes + (selector ? ">" + selector : "");
|
|
611
630
|
if (el.parentNode) {
|
|
612
631
|
var selectorWithParent = getNodeSelector(el.parentNode, currentSelector);
|
|
613
|
-
if (selectorWithParent
|
|
632
|
+
if (selectorWithParent[length] < MAX_SELECTOR_LENGTH) {
|
|
614
633
|
return selectorWithParent;
|
|
615
634
|
}
|
|
616
635
|
}
|
|
@@ -654,7 +673,7 @@
|
|
|
654
673
|
}
|
|
655
674
|
Logger.prototype.logEvent = function (event, args) {
|
|
656
675
|
if (args === void 0) { args = []; }
|
|
657
|
-
this.events
|
|
676
|
+
this.events[push]([now(), event, args]);
|
|
658
677
|
};
|
|
659
678
|
Logger.prototype.getEvents = function () {
|
|
660
679
|
return this.events;
|
|
@@ -670,20 +689,20 @@
|
|
|
670
689
|
function processEntry$3(entry) {
|
|
671
690
|
if (!entry.hadRecentInput) {
|
|
672
691
|
var firstEntry = sessionEntries[0];
|
|
673
|
-
var latestEntry = sessionEntries[sessionEntries
|
|
692
|
+
var latestEntry = sessionEntries[sessionEntries[length] - 1];
|
|
674
693
|
var sources = entry.sources
|
|
675
694
|
? entry.sources
|
|
676
695
|
.filter(function (source) { return source.node; })
|
|
677
696
|
.map(function (source) { return ({
|
|
678
697
|
value: entry.value,
|
|
679
|
-
startTime: processTimeMetric(entry
|
|
698
|
+
startTime: processTimeMetric(entry[startTime$1]),
|
|
680
699
|
elementSelector: getNodeSelector(source.node),
|
|
681
700
|
elementType: source.node.nodeName,
|
|
682
701
|
}); })
|
|
683
702
|
: [];
|
|
684
|
-
if (sessionEntries
|
|
685
|
-
(entry
|
|
686
|
-
entry
|
|
703
|
+
if (sessionEntries[length] &&
|
|
704
|
+
(entry[startTime$1] - latestEntry[startTime$1] >= 1000 ||
|
|
705
|
+
entry[startTime$1] - firstEntry[startTime$1] >= 5000)) {
|
|
687
706
|
sessionValue = entry.value;
|
|
688
707
|
sessionEntries = [entry];
|
|
689
708
|
sessionAttributions = sources;
|
|
@@ -691,7 +710,7 @@
|
|
|
691
710
|
}
|
|
692
711
|
else {
|
|
693
712
|
sessionValue += entry.value;
|
|
694
|
-
sessionEntries
|
|
713
|
+
sessionEntries[push](entry);
|
|
695
714
|
sessionAttributions = sessionAttributions.concat(sources);
|
|
696
715
|
if (!largestEntry || entry.value > largestEntry.value) {
|
|
697
716
|
largestEntry = entry;
|
|
@@ -700,26 +719,26 @@
|
|
|
700
719
|
maximumSessionValue = max(maximumSessionValue, sessionValue);
|
|
701
720
|
}
|
|
702
721
|
}
|
|
703
|
-
function reset$
|
|
722
|
+
function reset$4() {
|
|
704
723
|
sessionValue = 0;
|
|
705
724
|
sessionEntries = [];
|
|
706
725
|
maximumSessionValue = 0;
|
|
707
726
|
largestEntry = undefined;
|
|
708
727
|
}
|
|
709
|
-
function getData$
|
|
728
|
+
function getData$5(config) {
|
|
710
729
|
if (!("LayoutShift" in self)) {
|
|
711
730
|
return undefined;
|
|
712
731
|
}
|
|
713
732
|
return {
|
|
714
733
|
value: maximumSessionValue,
|
|
715
|
-
startTime: sessionEntries[0] ? processTimeMetric(sessionEntries[0]
|
|
734
|
+
startTime: sessionEntries[0] ? processTimeMetric(sessionEntries[0][startTime$1]) : null,
|
|
716
735
|
largestEntry: largestEntry
|
|
717
736
|
? {
|
|
718
737
|
value: largestEntry.value,
|
|
719
|
-
startTime: processTimeMetric(largestEntry
|
|
738
|
+
startTime: processTimeMetric(largestEntry[startTime$1]),
|
|
720
739
|
}
|
|
721
740
|
: null,
|
|
722
|
-
sources: sessionAttributions
|
|
741
|
+
sources: sessionAttributions[length]
|
|
723
742
|
? sessionAttributions.slice(0, config.maxAttributionEntries)
|
|
724
743
|
: null,
|
|
725
744
|
};
|
|
@@ -760,15 +779,15 @@
|
|
|
760
779
|
|
|
761
780
|
var entries = [];
|
|
762
781
|
function processEntry$2(entry) {
|
|
763
|
-
entries
|
|
782
|
+
entries[push](entry);
|
|
764
783
|
}
|
|
765
|
-
function reset$
|
|
784
|
+
function reset$3() {
|
|
766
785
|
entries = [];
|
|
767
786
|
}
|
|
768
787
|
function getEntries$1() {
|
|
769
788
|
return entries;
|
|
770
789
|
}
|
|
771
|
-
function getData$
|
|
790
|
+
function getData$4(config) {
|
|
772
791
|
var summarizedEntries = [];
|
|
773
792
|
var totalDuration = 0;
|
|
774
793
|
var totalBlockingDuration = 0;
|
|
@@ -782,7 +801,7 @@
|
|
|
782
801
|
? clamp(startTime + duration - styleAndLayoutStart)
|
|
783
802
|
: 0;
|
|
784
803
|
totalWorkDuration += renderStart ? renderStart - startTime : duration;
|
|
785
|
-
summarizedEntries
|
|
804
|
+
summarizedEntries[push]({
|
|
786
805
|
startTime: floor(startTime),
|
|
787
806
|
duration: floor(duration),
|
|
788
807
|
renderStart: floor(renderStart),
|
|
@@ -793,15 +812,15 @@
|
|
|
793
812
|
return {
|
|
794
813
|
totalBlockingDuration: floor(totalBlockingDuration),
|
|
795
814
|
totalDuration: floor(totalDuration),
|
|
796
|
-
totalEntries: entries
|
|
815
|
+
totalEntries: entries[length],
|
|
797
816
|
totalStyleAndLayoutDuration: floor(totalStyleAndLayoutDuration),
|
|
798
817
|
totalWorkDuration: floor(totalWorkDuration),
|
|
799
818
|
scripts: summarizeLoAFScripts(entries.flatMap(function (entry) { return entry.scripts; }), config),
|
|
800
819
|
// Only keep the slowest LoAF entries
|
|
801
820
|
entries: summarizedEntries
|
|
802
|
-
.sort(function (a, b) { return b
|
|
821
|
+
.sort(function (a, b) { return b[duration] - a[duration]; })
|
|
803
822
|
.slice(0, config.maxAttributionEntries)
|
|
804
|
-
.sort(function (a, b) { return a
|
|
823
|
+
.sort(function (a, b) { return a[startTime$1] - b[startTime$1]; }),
|
|
805
824
|
};
|
|
806
825
|
}
|
|
807
826
|
function summarizeLoAFScripts(scripts, config) {
|
|
@@ -823,15 +842,18 @@
|
|
|
823
842
|
};
|
|
824
843
|
}
|
|
825
844
|
summary[key].totalEntries++;
|
|
826
|
-
summary[key]
|
|
827
|
-
summary[key].totalBlockingDuration += max(0, script
|
|
845
|
+
summary[key][totalDuration] += script[duration];
|
|
846
|
+
summary[key].totalBlockingDuration += max(0, script[duration] - 50);
|
|
828
847
|
summary[key].totalPauseDuration += script.pauseDuration;
|
|
829
848
|
summary[key].totalForcedStyleAndLayoutDuration += script.forcedStyleAndLayoutDuration;
|
|
830
|
-
summary[key].timings
|
|
849
|
+
summary[key].timings[push]([
|
|
850
|
+
floor(script[startTime$1]),
|
|
851
|
+
floor(script[duration]),
|
|
852
|
+
]);
|
|
831
853
|
});
|
|
832
854
|
return Object.values(summary)
|
|
833
|
-
.map(function (script) { return (__assign(__assign({}, script), { totalDuration: floor(script
|
|
834
|
-
.sort(function (a, b) { return b
|
|
855
|
+
.map(function (script) { return (__assign(__assign({}, script), { totalDuration: floor(script[totalDuration]), totalPauseDuration: floor(script.totalPauseDuration), totalForcedStyleAndLayoutDuration: floor(script.totalForcedStyleAndLayoutDuration) })); })
|
|
856
|
+
.sort(function (a, b) { return b[totalDuration] - a[totalDuration]; })
|
|
835
857
|
.slice(0, config.maxAttributionEntries);
|
|
836
858
|
}
|
|
837
859
|
|
|
@@ -853,105 +875,110 @@
|
|
|
853
875
|
var slowestEntriesMap = {};
|
|
854
876
|
// The total number of interactions recorded on the page
|
|
855
877
|
var interactionCountEstimate = 0;
|
|
856
|
-
function reset$
|
|
878
|
+
function reset$2() {
|
|
857
879
|
interactionCountEstimate = 0;
|
|
858
880
|
slowestEntries = [];
|
|
859
881
|
slowestEntriesMap = {};
|
|
860
882
|
}
|
|
861
883
|
function processEntry$1(entry) {
|
|
862
|
-
if (entry.interactionId || (entry
|
|
863
|
-
var duration = entry.duration, startTime = entry.startTime, interactionId = entry.interactionId, name_1 = entry.name, processingStart = entry.processingStart, processingEnd = entry.processingEnd, target = entry.target;
|
|
864
|
-
if (duration < 0) {
|
|
884
|
+
if (entry.interactionId || (entry[entryType] === "first-input" && !entryExists(entry))) {
|
|
885
|
+
var duration$1 = entry.duration, startTime = entry.startTime, interactionId = entry.interactionId, name_1 = entry.name, processingStart$1 = entry.processingStart, processingEnd$1 = entry.processingEnd, target = entry.target;
|
|
886
|
+
if (duration$1 < 0) {
|
|
865
887
|
return;
|
|
866
888
|
}
|
|
867
|
-
var processingTime = processingEnd - processingStart;
|
|
889
|
+
var processingTime$1 = processingEnd$1 - processingStart$1;
|
|
868
890
|
var existingEntry = slowestEntriesMap[interactionId];
|
|
869
|
-
var selector = target ? getNodeSelector(target) : null;
|
|
891
|
+
var selector$1 = target ? getNodeSelector(target) : null;
|
|
870
892
|
if (existingEntry) {
|
|
871
|
-
var longerDuration = duration > existingEntry
|
|
872
|
-
var sameWithLongerProcessingTime = duration === existingEntry
|
|
893
|
+
var longerDuration = duration$1 > existingEntry[duration];
|
|
894
|
+
var sameWithLongerProcessingTime = duration$1 === existingEntry[duration] &&
|
|
895
|
+
processingTime$1 > existingEntry[processingTime];
|
|
873
896
|
if (longerDuration || sameWithLongerProcessingTime) {
|
|
874
897
|
// Only replace an existing interation if the duration is longer, or if the duration is the
|
|
875
898
|
// same but the processing time is longer. The logic around this is that the interaction with
|
|
876
899
|
// longer processing time is likely to be the event that actually had a handler.
|
|
877
|
-
existingEntry
|
|
878
|
-
existingEntry
|
|
879
|
-
existingEntry
|
|
880
|
-
existingEntry
|
|
881
|
-
existingEntry
|
|
882
|
-
existingEntry
|
|
883
|
-
existingEntry
|
|
900
|
+
existingEntry[duration] = duration$1;
|
|
901
|
+
existingEntry[name] = name_1;
|
|
902
|
+
existingEntry[processingEnd] = processingEnd$1;
|
|
903
|
+
existingEntry[processingStart] = processingStart$1;
|
|
904
|
+
existingEntry[processingTime] = processingTime$1;
|
|
905
|
+
existingEntry[selector] = selector$1;
|
|
906
|
+
existingEntry[startTime$1] = startTime;
|
|
884
907
|
existingEntry.target = target;
|
|
885
908
|
}
|
|
886
909
|
}
|
|
887
910
|
else {
|
|
888
911
|
interactionCountEstimate++;
|
|
889
912
|
slowestEntriesMap[interactionId] = {
|
|
890
|
-
duration: duration,
|
|
913
|
+
duration: duration$1,
|
|
891
914
|
interactionId: interactionId,
|
|
892
915
|
name: name_1,
|
|
893
|
-
processingEnd: processingEnd,
|
|
894
|
-
processingStart: processingStart,
|
|
895
|
-
processingTime: processingTime,
|
|
896
|
-
selector: selector,
|
|
916
|
+
processingEnd: processingEnd$1,
|
|
917
|
+
processingStart: processingStart$1,
|
|
918
|
+
processingTime: processingTime$1,
|
|
919
|
+
selector: selector$1,
|
|
897
920
|
startTime: startTime,
|
|
898
921
|
target: target,
|
|
899
922
|
};
|
|
900
|
-
slowestEntries
|
|
923
|
+
slowestEntries[push](slowestEntriesMap[interactionId]);
|
|
901
924
|
}
|
|
902
925
|
// Only store the longest <MAX_INTERACTIONS> interactions
|
|
903
|
-
slowestEntries.sort(function (a, b) { return b
|
|
926
|
+
slowestEntries.sort(function (a, b) { return b[duration] - a[duration]; });
|
|
904
927
|
slowestEntries.splice(MAX_INTERACTIONS).forEach(function (entry) {
|
|
905
928
|
delete slowestEntriesMap[entry.interactionId];
|
|
906
929
|
});
|
|
907
930
|
}
|
|
908
931
|
}
|
|
909
932
|
function entryExists(e1) {
|
|
910
|
-
return slowestEntries.some(function (e2) {
|
|
933
|
+
return slowestEntries.some(function (e2) {
|
|
934
|
+
return e1[startTime$1] === e2[startTime$1] && e1[duration] === e2[duration];
|
|
935
|
+
});
|
|
911
936
|
}
|
|
912
937
|
/**
|
|
913
938
|
* Returns an estimated high percentile INP value based on the total number of interactions on the
|
|
914
939
|
* current page.
|
|
915
940
|
*/
|
|
916
941
|
function getHighPercentileInteraction() {
|
|
917
|
-
var index = Math.min(slowestEntries
|
|
942
|
+
var index = Math.min(slowestEntries[length] - 1, Math.floor(getInteractionCount() / 50));
|
|
918
943
|
return slowestEntries[index];
|
|
919
944
|
}
|
|
920
|
-
function getData$
|
|
945
|
+
function getData$3(config) {
|
|
921
946
|
var _a;
|
|
922
947
|
var interaction = getHighPercentileInteraction();
|
|
923
948
|
if (!interaction) {
|
|
924
949
|
return undefined;
|
|
925
950
|
}
|
|
926
|
-
var duration = interaction.duration, startTime = interaction.startTime, processingStart = interaction.processingStart;
|
|
951
|
+
var duration$1 = interaction.duration, startTime = interaction.startTime, processingStart = interaction.processingStart;
|
|
927
952
|
var inpScripts = getEntries$1()
|
|
928
953
|
.flatMap(function (entry) { return entry.scripts; })
|
|
929
954
|
// Only include scripts that started during the interaction
|
|
930
955
|
.filter(function (script) {
|
|
931
|
-
return script
|
|
956
|
+
return script[startTime$1] + script[duration] >= startTime &&
|
|
957
|
+
script[startTime$1] <= startTime + duration$1;
|
|
932
958
|
})
|
|
933
959
|
.map(function (_script) {
|
|
934
960
|
var script = JSON.parse(JSON.stringify(_script));
|
|
935
961
|
// Clamp the script duration to the time of the interaction
|
|
936
|
-
script
|
|
962
|
+
script[duration] =
|
|
963
|
+
script[startTime$1] + script[duration] - max(startTime, script[startTime$1]);
|
|
937
964
|
script.inpPhase = getINPPhase(script, interaction);
|
|
938
965
|
return script;
|
|
939
966
|
});
|
|
940
967
|
var loafScripts = summarizeLoAFScripts(inpScripts, config);
|
|
941
968
|
return {
|
|
942
|
-
value: interaction
|
|
969
|
+
value: interaction[duration],
|
|
943
970
|
startTime: processTimeMetric(startTime),
|
|
944
|
-
duration: interaction
|
|
971
|
+
duration: interaction[duration],
|
|
945
972
|
subParts: {
|
|
946
973
|
inputDelay: clamp(floor(processingStart - startTime)),
|
|
947
974
|
processingStart: processTimeMetric(processingStart),
|
|
948
|
-
processingEnd: processTimeMetric(interaction
|
|
949
|
-
processingTime: clamp(floor(interaction
|
|
950
|
-
presentationDelay: clamp(floor(startTime + interaction
|
|
975
|
+
processingEnd: processTimeMetric(interaction[processingEnd]),
|
|
976
|
+
processingTime: clamp(floor(interaction[processingTime])),
|
|
977
|
+
presentationDelay: clamp(floor(startTime + interaction[duration] - interaction[processingEnd])),
|
|
951
978
|
},
|
|
952
979
|
attribution: {
|
|
953
|
-
eventType: interaction
|
|
954
|
-
elementSelector: interaction
|
|
980
|
+
eventType: interaction[name],
|
|
981
|
+
elementSelector: interaction[selector] || null,
|
|
955
982
|
elementType: ((_a = interaction.target) === null || _a === void 0 ? void 0 : _a.nodeName) || null,
|
|
956
983
|
loafScripts: loafScripts,
|
|
957
984
|
},
|
|
@@ -960,10 +987,10 @@
|
|
|
960
987
|
function getINPPhase(script, interaction) {
|
|
961
988
|
var processingStart = interaction.processingStart, processingTime = interaction.processingTime, startTime = interaction.startTime;
|
|
962
989
|
var inputDelay = processingStart - startTime;
|
|
963
|
-
if (script
|
|
990
|
+
if (script[startTime$1] < startTime + inputDelay) {
|
|
964
991
|
return INPPhase.InputDelay;
|
|
965
992
|
}
|
|
966
|
-
else if (script
|
|
993
|
+
else if (script[startTime$1] >= startTime + inputDelay + processingTime) {
|
|
967
994
|
return INPPhase.PresentationDelay;
|
|
968
995
|
}
|
|
969
996
|
return INPPhase.ProcessingTime;
|
|
@@ -976,30 +1003,38 @@
|
|
|
976
1003
|
}
|
|
977
1004
|
|
|
978
1005
|
var lcpEntry;
|
|
1006
|
+
var lcpAttribution = null;
|
|
979
1007
|
function processEntry(entry) {
|
|
980
|
-
if (!lcpEntry || entry
|
|
1008
|
+
if (!lcpEntry || entry[startTime$1] > lcpEntry[startTime$1]) {
|
|
981
1009
|
lcpEntry = entry;
|
|
1010
|
+
lcpAttribution = entry.element
|
|
1011
|
+
? {
|
|
1012
|
+
elementSelector: getNodeSelector(entry.element),
|
|
1013
|
+
elementType: entry.element.nodeName,
|
|
1014
|
+
}
|
|
1015
|
+
: null;
|
|
982
1016
|
}
|
|
983
1017
|
}
|
|
984
|
-
function reset() {
|
|
1018
|
+
function reset$1() {
|
|
985
1019
|
lcpEntry = undefined;
|
|
1020
|
+
lcpAttribution = null;
|
|
986
1021
|
}
|
|
987
|
-
function getData() {
|
|
1022
|
+
function getData$2() {
|
|
988
1023
|
if (!lcpEntry) {
|
|
989
1024
|
return undefined;
|
|
990
1025
|
}
|
|
991
1026
|
var subParts = null;
|
|
992
1027
|
if (lcpEntry.url) {
|
|
993
|
-
var lcpResource = getEntriesByType("resource").find(function (resource) { return resource
|
|
1028
|
+
var lcpResource = getEntriesByType("resource").find(function (resource) { return resource[name] === lcpEntry.url; });
|
|
994
1029
|
if (lcpResource) {
|
|
995
1030
|
var navEntry = getNavigationEntry();
|
|
996
1031
|
var responseStart = navEntry.responseStart || timing.responseStart;
|
|
997
|
-
var activationStart = navEntry
|
|
998
|
-
var ttfb = max(0, responseStart - activationStart);
|
|
999
|
-
var lcpStartTime = lcpResource
|
|
1000
|
-
var lcpRequestStart = (lcpResource.requestStart || lcpStartTime) - activationStart;
|
|
1001
|
-
var lcpResponseEnd = max(lcpRequestStart, lcpResource.responseEnd - activationStart);
|
|
1002
|
-
var lcpRenderTime = max(lcpResponseEnd, lcpStartTime - activationStart);
|
|
1032
|
+
var activationStart$1 = navEntry[activationStart];
|
|
1033
|
+
var ttfb = max(0, responseStart - activationStart$1);
|
|
1034
|
+
var lcpStartTime = lcpResource[startTime$1];
|
|
1035
|
+
var lcpRequestStart = (lcpResource.requestStart || lcpStartTime) - activationStart$1;
|
|
1036
|
+
var lcpResponseEnd = max(lcpRequestStart, lcpResource.responseEnd - activationStart$1);
|
|
1037
|
+
var lcpRenderTime = max(lcpResponseEnd, lcpStartTime - activationStart$1);
|
|
1003
1038
|
subParts = {
|
|
1004
1039
|
resourceLoadDelay: clamp(floor(lcpRequestStart - ttfb)),
|
|
1005
1040
|
resourceLoadTime: clamp(floor(lcpResponseEnd - lcpRequestStart)),
|
|
@@ -1007,7 +1042,7 @@
|
|
|
1007
1042
|
};
|
|
1008
1043
|
}
|
|
1009
1044
|
}
|
|
1010
|
-
var value = lcpEntry
|
|
1045
|
+
var value = lcpEntry[startTime$1];
|
|
1011
1046
|
if (!shouldReportValue(value)) {
|
|
1012
1047
|
// It's possible the LCP entry we have occurred before the current page was initialised. In
|
|
1013
1048
|
// this case, we don't want to report the LCP value.
|
|
@@ -1016,15 +1051,90 @@
|
|
|
1016
1051
|
return {
|
|
1017
1052
|
value: processTimeMetric(value),
|
|
1018
1053
|
subParts: subParts,
|
|
1019
|
-
attribution:
|
|
1020
|
-
? {
|
|
1021
|
-
elementSelector: getNodeSelector(lcpEntry.element),
|
|
1022
|
-
elementType: lcpEntry.element.nodeName,
|
|
1023
|
-
}
|
|
1024
|
-
: null,
|
|
1054
|
+
attribution: lcpAttribution,
|
|
1025
1055
|
};
|
|
1026
1056
|
}
|
|
1027
1057
|
|
|
1058
|
+
function getData$1() {
|
|
1059
|
+
var startMark = getEntriesByName(START_MARK).pop();
|
|
1060
|
+
if (startMark) {
|
|
1061
|
+
// Don't report navigation timing in SPA beacons
|
|
1062
|
+
return undefined;
|
|
1063
|
+
}
|
|
1064
|
+
var navEntry = getNavigationEntry();
|
|
1065
|
+
var entry = {};
|
|
1066
|
+
for (var k in navEntry) {
|
|
1067
|
+
var value = navEntry[k];
|
|
1068
|
+
if (typeof value === "number") {
|
|
1069
|
+
entry[k] = processTimeMetric(value);
|
|
1070
|
+
}
|
|
1071
|
+
else if (typeof value === "string") {
|
|
1072
|
+
entry[k] = value;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
return entry;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
var CLICK_THRESHOLD = 5;
|
|
1079
|
+
var CLICK_RADIUS = 50;
|
|
1080
|
+
var COOLDOWN = 5000;
|
|
1081
|
+
var timeout = 0;
|
|
1082
|
+
var startTime = 0;
|
|
1083
|
+
var clicks = 0;
|
|
1084
|
+
var target = null;
|
|
1085
|
+
var x = 0;
|
|
1086
|
+
var y = 0;
|
|
1087
|
+
var listener = function (event) {
|
|
1088
|
+
if (target === null) {
|
|
1089
|
+
startTime = msSinceNavigationStart();
|
|
1090
|
+
target = event.target;
|
|
1091
|
+
x = event.clientX;
|
|
1092
|
+
y = event.clientY;
|
|
1093
|
+
timeout = window.setTimeout(function () {
|
|
1094
|
+
reset();
|
|
1095
|
+
}, COOLDOWN);
|
|
1096
|
+
}
|
|
1097
|
+
var nodeName = target.nodeName;
|
|
1098
|
+
var isSameTarget = event.target === target && (nodeName === "BUTTON" || nodeName === "A" || nodeName === "INPUT");
|
|
1099
|
+
var withinRadius = (Math.abs(x - event.clientX) < CLICK_RADIUS && Math.abs(y - event.clientY) < CLICK_RADIUS) ||
|
|
1100
|
+
isSameTarget;
|
|
1101
|
+
if (withinRadius) {
|
|
1102
|
+
clicks++;
|
|
1103
|
+
}
|
|
1104
|
+
if (clicks >= CLICK_THRESHOLD) {
|
|
1105
|
+
// We've reached the rage click threshold, so cancel the reset timeout.
|
|
1106
|
+
clearTimeout(timeout);
|
|
1107
|
+
}
|
|
1108
|
+
else if (clicks && !withinRadius) {
|
|
1109
|
+
// If we haven't reached the rage click threshold, and the clicks move outside the radius, then
|
|
1110
|
+
// reset the current rage status.
|
|
1111
|
+
reset();
|
|
1112
|
+
}
|
|
1113
|
+
};
|
|
1114
|
+
document.addEventListener("click", listener);
|
|
1115
|
+
function reset() {
|
|
1116
|
+
clearTimeout(timeout);
|
|
1117
|
+
clicks = 0;
|
|
1118
|
+
target = null;
|
|
1119
|
+
x = 0;
|
|
1120
|
+
y = 0;
|
|
1121
|
+
}
|
|
1122
|
+
function getData() {
|
|
1123
|
+
if (clicks >= CLICK_THRESHOLD) {
|
|
1124
|
+
return {
|
|
1125
|
+
value: clicks,
|
|
1126
|
+
startTime: startTime,
|
|
1127
|
+
attribution: target
|
|
1128
|
+
? {
|
|
1129
|
+
elementSelector: getNodeSelector(target),
|
|
1130
|
+
elementType: target.nodeName,
|
|
1131
|
+
}
|
|
1132
|
+
: null,
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
return null;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1028
1138
|
var ALL_ENTRIES = [];
|
|
1029
1139
|
function observe(type, callback, options) {
|
|
1030
1140
|
if (typeof PerformanceObserver === "function" &&
|
|
@@ -1038,10 +1148,10 @@
|
|
|
1038
1148
|
return undefined;
|
|
1039
1149
|
}
|
|
1040
1150
|
function getEntries(type) {
|
|
1041
|
-
return ALL_ENTRIES.filter(function (entry) { return entry
|
|
1151
|
+
return ALL_ENTRIES.filter(function (entry) { return entry[entryType] === type; });
|
|
1042
1152
|
}
|
|
1043
1153
|
function addEntry(entry) {
|
|
1044
|
-
ALL_ENTRIES
|
|
1154
|
+
ALL_ENTRIES[push](entry);
|
|
1045
1155
|
}
|
|
1046
1156
|
|
|
1047
1157
|
/**
|
|
@@ -1061,7 +1171,7 @@
|
|
|
1061
1171
|
var spec = config[name];
|
|
1062
1172
|
var multiplier = spec[1];
|
|
1063
1173
|
if (spec[0] === TYPE_DURATION) {
|
|
1064
|
-
pairs[name] = stEntry
|
|
1174
|
+
pairs[name] = stEntry[duration] * (multiplier || 1);
|
|
1065
1175
|
}
|
|
1066
1176
|
else if (description && multiplier) {
|
|
1067
1177
|
var numericValue = parseFloat(description);
|
|
@@ -1088,7 +1198,7 @@
|
|
|
1088
1198
|
if (firstOnly) {
|
|
1089
1199
|
return key;
|
|
1090
1200
|
}
|
|
1091
|
-
matches
|
|
1201
|
+
matches[push](key);
|
|
1092
1202
|
}
|
|
1093
1203
|
}
|
|
1094
1204
|
}
|
|
@@ -1115,7 +1225,8 @@
|
|
|
1115
1225
|
return str.replace(/[-/\\^$+?.()|[\]{}]/g, "\\$&");
|
|
1116
1226
|
}
|
|
1117
1227
|
|
|
1118
|
-
var
|
|
1228
|
+
var global = window;
|
|
1229
|
+
var LUX = global.LUX || {};
|
|
1119
1230
|
var scriptEndTime = scriptStartTime;
|
|
1120
1231
|
LUX = (function () {
|
|
1121
1232
|
// -------------------------------------------------------------------------
|
|
@@ -1134,12 +1245,13 @@
|
|
|
1134
1245
|
var globalConfig = fromObject(LUX);
|
|
1135
1246
|
logger.logEvent(1 /* LogEvent.EvaluationStart */, [VERSION, JSON.stringify(globalConfig)]);
|
|
1136
1247
|
// Variable aliases that allow the minifier to reduce file size.
|
|
1137
|
-
var document =
|
|
1138
|
-
var
|
|
1139
|
-
var
|
|
1140
|
-
var
|
|
1141
|
-
var
|
|
1142
|
-
var
|
|
1248
|
+
var document = global.document;
|
|
1249
|
+
var documentElement = document.documentElement || {};
|
|
1250
|
+
var addEventListener = global.addEventListener;
|
|
1251
|
+
var removeEventListener = global.removeEventListener;
|
|
1252
|
+
var setTimeout = global.setTimeout;
|
|
1253
|
+
var clearTimeout = global.clearTimeout;
|
|
1254
|
+
var encodeURIComponent = global.encodeURIComponent;
|
|
1143
1255
|
var thisScript = document.currentScript || {};
|
|
1144
1256
|
// Log JS errors.
|
|
1145
1257
|
var nErrors = 0;
|
|
@@ -1196,7 +1308,20 @@
|
|
|
1196
1308
|
// Storing the customer ID in a local variable makes it possible to run multiple instances of lux.js
|
|
1197
1309
|
// on the same page.
|
|
1198
1310
|
var _thisCustomerId = LUX.customerid;
|
|
1199
|
-
var beaconCollectors = [
|
|
1311
|
+
var beaconCollectors = [
|
|
1312
|
+
[BeaconMetricKey.RageClick, getData],
|
|
1313
|
+
[BeaconMetricKey.NavigationTiming, getData$1],
|
|
1314
|
+
[
|
|
1315
|
+
BeaconMetricKey.FCP,
|
|
1316
|
+
function () {
|
|
1317
|
+
var fcp = getFcp();
|
|
1318
|
+
if (fcp) {
|
|
1319
|
+
return { value: fcp };
|
|
1320
|
+
}
|
|
1321
|
+
return null;
|
|
1322
|
+
},
|
|
1323
|
+
],
|
|
1324
|
+
];
|
|
1200
1325
|
var logEntry = function (entry) {
|
|
1201
1326
|
logger.logEvent(42 /* LogEvent.PerformanceEntryReceived */, [entry]);
|
|
1202
1327
|
};
|
|
@@ -1215,19 +1340,19 @@
|
|
|
1215
1340
|
// Process the LCP entry for the new beacon
|
|
1216
1341
|
processEntry(entry);
|
|
1217
1342
|
})) {
|
|
1218
|
-
beaconCollectors
|
|
1343
|
+
beaconCollectors[push]([BeaconMetricKey.LCP, getData$2]);
|
|
1219
1344
|
}
|
|
1220
1345
|
if (observe("layout-shift", function (entry) {
|
|
1221
1346
|
processEntry$3(entry);
|
|
1222
1347
|
logEntry(entry);
|
|
1223
1348
|
})) {
|
|
1224
|
-
beaconCollectors
|
|
1349
|
+
beaconCollectors[push]([BeaconMetricKey.CLS, getData$5]);
|
|
1225
1350
|
}
|
|
1226
1351
|
if (observe("long-animation-frame", function (entry) {
|
|
1227
1352
|
processEntry$2(entry);
|
|
1228
1353
|
logEntry(entry);
|
|
1229
1354
|
})) {
|
|
1230
|
-
beaconCollectors
|
|
1355
|
+
beaconCollectors[push]([BeaconMetricKey.LoAF, getData$4]);
|
|
1231
1356
|
}
|
|
1232
1357
|
var handleINPEntry_1 = function (entry) {
|
|
1233
1358
|
processEntry$1(entry);
|
|
@@ -1235,7 +1360,7 @@
|
|
|
1235
1360
|
};
|
|
1236
1361
|
observe("first-input", function (entry) {
|
|
1237
1362
|
logEntry(entry);
|
|
1238
|
-
var entryTime = entry
|
|
1363
|
+
var entryTime = entry[processingStart] - entry[startTime$1];
|
|
1239
1364
|
if (!gFirstInputDelay || gFirstInputDelay < entryTime) {
|
|
1240
1365
|
gFirstInputDelay = floor(entryTime);
|
|
1241
1366
|
}
|
|
@@ -1251,15 +1376,15 @@
|
|
|
1251
1376
|
// need to manually serialize our own object with the keys we want.
|
|
1252
1377
|
logEntry({
|
|
1253
1378
|
interactionId: entry.interactionId,
|
|
1254
|
-
name: entry
|
|
1255
|
-
entryType: entry
|
|
1256
|
-
startTime: entry
|
|
1257
|
-
duration: entry
|
|
1258
|
-
processingStart: entry
|
|
1259
|
-
processingEnd: entry
|
|
1379
|
+
name: entry[name],
|
|
1380
|
+
entryType: entry[entryType],
|
|
1381
|
+
startTime: entry[startTime$1],
|
|
1382
|
+
duration: entry[duration],
|
|
1383
|
+
processingStart: entry[processingStart],
|
|
1384
|
+
processingEnd: entry[processingEnd],
|
|
1260
1385
|
});
|
|
1261
1386
|
}, { durationThreshold: 0 })) {
|
|
1262
|
-
beaconCollectors
|
|
1387
|
+
beaconCollectors[push]([BeaconMetricKey.INP, getData$3]);
|
|
1263
1388
|
}
|
|
1264
1389
|
}
|
|
1265
1390
|
catch (e) {
|
|
@@ -1286,13 +1411,13 @@
|
|
|
1286
1411
|
else {
|
|
1287
1412
|
logger.logEvent(22 /* LogEvent.SessionIsNotSampled */, [globalConfig.samplerate]);
|
|
1288
1413
|
}
|
|
1289
|
-
var gLuxSnippetStart = LUX.ns ? LUX.ns - timing
|
|
1414
|
+
var gLuxSnippetStart = LUX.ns ? LUX.ns - timing[navigationStart] : 0;
|
|
1290
1415
|
if (!performance.timing) {
|
|
1291
1416
|
logger.logEvent(71 /* LogEvent.NavTimingNotSupported */);
|
|
1292
1417
|
gFlags = addFlag(gFlags, 2 /* Flags.NavTimingNotSupported */);
|
|
1293
1418
|
beacon.addFlag(2 /* Flags.NavTimingNotSupported */);
|
|
1294
1419
|
}
|
|
1295
|
-
logger.logEvent(41 /* LogEvent.NavigationStart */, [timing
|
|
1420
|
+
logger.logEvent(41 /* LogEvent.NavigationStart */, [timing[navigationStart]]);
|
|
1296
1421
|
////////////////////// FID BEGIN
|
|
1297
1422
|
// FIRST INPUT DELAY (FID)
|
|
1298
1423
|
// The basic idea behind FID is to attach various input event listeners and measure the time
|
|
@@ -1394,7 +1519,7 @@
|
|
|
1394
1519
|
detail: detail,
|
|
1395
1520
|
startTime: startTime,
|
|
1396
1521
|
};
|
|
1397
|
-
gaMarks
|
|
1522
|
+
gaMarks[push](entry);
|
|
1398
1523
|
gFlags = addFlag(gFlags, 4 /* Flags.UserTimingNotSupported */);
|
|
1399
1524
|
beacon.addFlag(4 /* Flags.UserTimingNotSupported */);
|
|
1400
1525
|
return entry;
|
|
@@ -1434,7 +1559,7 @@
|
|
|
1434
1559
|
if (options) {
|
|
1435
1560
|
// If options were provided, we need to avoid specifying a start mark if an end mark and
|
|
1436
1561
|
// duration were already specified.
|
|
1437
|
-
if (!options.end || !options
|
|
1562
|
+
if (!options.end || !options[duration]) {
|
|
1438
1563
|
args[1].start = startMarkName;
|
|
1439
1564
|
}
|
|
1440
1565
|
}
|
|
@@ -1459,7 +1584,7 @@
|
|
|
1459
1584
|
if (typeof startMarkName === "string") {
|
|
1460
1585
|
var startMark = _getMark(startMarkName);
|
|
1461
1586
|
if (startMark) {
|
|
1462
|
-
startTime = startMark
|
|
1587
|
+
startTime = startMark[startTime$1];
|
|
1463
1588
|
}
|
|
1464
1589
|
else if (typeof navEntry[startMarkName] === "number") {
|
|
1465
1590
|
// the mark name can also be a property from Navigation Timing
|
|
@@ -1472,7 +1597,7 @@
|
|
|
1472
1597
|
if (typeof endMarkName === "string") {
|
|
1473
1598
|
var endMark = _getMark(endMarkName);
|
|
1474
1599
|
if (endMark) {
|
|
1475
|
-
endTime = endMark
|
|
1600
|
+
endTime = endMark[startTime$1];
|
|
1476
1601
|
}
|
|
1477
1602
|
else if (typeof navEntry[endMarkName] === "number") {
|
|
1478
1603
|
// the mark name can also be a property from Navigation Timing
|
|
@@ -1482,11 +1607,11 @@
|
|
|
1482
1607
|
throwError(endMarkName);
|
|
1483
1608
|
}
|
|
1484
1609
|
}
|
|
1485
|
-
var duration = endTime - startTime;
|
|
1610
|
+
var duration$1 = endTime - startTime;
|
|
1486
1611
|
var detail = null;
|
|
1487
1612
|
if (options) {
|
|
1488
|
-
if (options
|
|
1489
|
-
duration = options
|
|
1613
|
+
if (options[duration]) {
|
|
1614
|
+
duration$1 = options[duration];
|
|
1490
1615
|
}
|
|
1491
1616
|
detail = options.detail;
|
|
1492
1617
|
}
|
|
@@ -1495,9 +1620,9 @@
|
|
|
1495
1620
|
name: name,
|
|
1496
1621
|
detail: detail,
|
|
1497
1622
|
startTime: startTime,
|
|
1498
|
-
duration: duration,
|
|
1623
|
+
duration: duration$1,
|
|
1499
1624
|
};
|
|
1500
|
-
gaMeasures
|
|
1625
|
+
gaMeasures[push](entry);
|
|
1501
1626
|
gFlags = addFlag(gFlags, 4 /* Flags.UserTimingNotSupported */);
|
|
1502
1627
|
beacon.addFlag(4 /* Flags.UserTimingNotSupported */);
|
|
1503
1628
|
return entry;
|
|
@@ -1507,11 +1632,11 @@
|
|
|
1507
1632
|
function _getMark(name) {
|
|
1508
1633
|
return _getM(name, _getMarks());
|
|
1509
1634
|
}
|
|
1510
|
-
function _getM(name, aItems) {
|
|
1635
|
+
function _getM(name$1, aItems) {
|
|
1511
1636
|
if (aItems) {
|
|
1512
|
-
for (var i = aItems
|
|
1637
|
+
for (var i = aItems[length] - 1; i >= 0; i--) {
|
|
1513
1638
|
var m = aItems[i];
|
|
1514
|
-
if (name === m
|
|
1639
|
+
if (name$1 === m[name]) {
|
|
1515
1640
|
return m;
|
|
1516
1641
|
}
|
|
1517
1642
|
}
|
|
@@ -1521,7 +1646,7 @@
|
|
|
1521
1646
|
// Return an array of marks.
|
|
1522
1647
|
function _getMarks() {
|
|
1523
1648
|
var marks = getEntriesByType("mark");
|
|
1524
|
-
if (marks
|
|
1649
|
+
if (marks[length]) {
|
|
1525
1650
|
return marks;
|
|
1526
1651
|
}
|
|
1527
1652
|
return gaMarks;
|
|
@@ -1529,7 +1654,7 @@
|
|
|
1529
1654
|
// Return an array of measures.
|
|
1530
1655
|
function _getMeasures() {
|
|
1531
1656
|
var measures = getEntriesByType("measure");
|
|
1532
|
-
if (measures
|
|
1657
|
+
if (measures[length]) {
|
|
1533
1658
|
return measures;
|
|
1534
1659
|
}
|
|
1535
1660
|
return gaMeasures;
|
|
@@ -1546,46 +1671,46 @@
|
|
|
1546
1671
|
var tZero = getZeroTime();
|
|
1547
1672
|
// marks
|
|
1548
1673
|
_getMarks().forEach(function (mark) {
|
|
1549
|
-
var name = mark
|
|
1550
|
-
if (name === START_MARK || name === END_MARK) {
|
|
1674
|
+
var name$1 = mark[name];
|
|
1675
|
+
if (name$1 === START_MARK || name$1 === END_MARK) {
|
|
1551
1676
|
// Don't include the internal marks in the beacon
|
|
1552
1677
|
return;
|
|
1553
1678
|
}
|
|
1554
|
-
var startTime = floor(mark
|
|
1679
|
+
var startTime = floor(mark[startTime$1] - tZero);
|
|
1555
1680
|
if (startTime < 0) {
|
|
1556
1681
|
// Exclude marks that were taken before the current SPA page view
|
|
1557
1682
|
return;
|
|
1558
1683
|
}
|
|
1559
|
-
if (typeof hUT[name] === "undefined") {
|
|
1560
|
-
hUT[name] = { startTime: startTime };
|
|
1684
|
+
if (typeof hUT[name$1] === "undefined") {
|
|
1685
|
+
hUT[name$1] = { startTime: startTime };
|
|
1561
1686
|
}
|
|
1562
1687
|
else {
|
|
1563
|
-
hUT[name]
|
|
1688
|
+
hUT[name$1][startTime$1] = max(startTime, hUT[name$1][startTime$1]);
|
|
1564
1689
|
}
|
|
1565
1690
|
});
|
|
1566
1691
|
// measures
|
|
1567
1692
|
_getMeasures().forEach(function (measure) {
|
|
1568
|
-
if (startMark && measure
|
|
1693
|
+
if (startMark && measure[startTime$1] < startMark[startTime$1]) {
|
|
1569
1694
|
// Exclude measures that were taken before the current SPA page view
|
|
1570
1695
|
return;
|
|
1571
1696
|
}
|
|
1572
|
-
var name = measure
|
|
1573
|
-
var startTime = floor(measure
|
|
1574
|
-
var duration = floor(measure
|
|
1575
|
-
if (typeof hUT[name] === "undefined" || startTime > hUT[name]
|
|
1576
|
-
hUT[name] = { startTime: startTime, duration: duration };
|
|
1697
|
+
var name$1 = measure[name];
|
|
1698
|
+
var startTime = floor(measure[startTime$1] - tZero);
|
|
1699
|
+
var duration$1 = floor(measure[duration]);
|
|
1700
|
+
if (typeof hUT[name$1] === "undefined" || startTime > hUT[name$1][startTime$1]) {
|
|
1701
|
+
hUT[name$1] = { startTime: startTime, duration: duration$1 };
|
|
1577
1702
|
}
|
|
1578
1703
|
});
|
|
1579
1704
|
// Convert the user timing values into a delimited string. This string takes the format
|
|
1580
1705
|
// markName|startTime,measureName|startTime|duration,[markName...]
|
|
1581
1706
|
var aUT = [];
|
|
1582
1707
|
for (var utName in hUT) {
|
|
1583
|
-
var _a = hUT[utName], startTime = _a.startTime, duration = _a.duration;
|
|
1708
|
+
var _a = hUT[utName], startTime = _a.startTime, duration$1 = _a.duration;
|
|
1584
1709
|
var utParts = [utName, startTime];
|
|
1585
|
-
if (typeof duration !== "undefined") {
|
|
1586
|
-
utParts
|
|
1710
|
+
if (typeof duration$1 !== "undefined") {
|
|
1711
|
+
utParts[push](duration$1);
|
|
1587
1712
|
}
|
|
1588
|
-
aUT
|
|
1713
|
+
aUT[push](utParts.join("|"));
|
|
1589
1714
|
}
|
|
1590
1715
|
return aUT;
|
|
1591
1716
|
}
|
|
@@ -1593,11 +1718,11 @@
|
|
|
1593
1718
|
function elementTimingValues() {
|
|
1594
1719
|
var aET = [];
|
|
1595
1720
|
getEntries("element").forEach(function (entry) {
|
|
1596
|
-
if (entry.identifier && entry
|
|
1597
|
-
var value = processTimeMetric(entry
|
|
1721
|
+
if (entry.identifier && entry[startTime$1]) {
|
|
1722
|
+
var value = processTimeMetric(entry[startTime$1]);
|
|
1598
1723
|
if (shouldReportValue(value)) {
|
|
1599
1724
|
logger.logEvent(43 /* LogEvent.PerformanceEntryProcessed */, [entry]);
|
|
1600
|
-
aET
|
|
1725
|
+
aET[push](entry.identifier + "|" + value);
|
|
1601
1726
|
}
|
|
1602
1727
|
}
|
|
1603
1728
|
});
|
|
@@ -1614,31 +1739,31 @@
|
|
|
1614
1739
|
var hCPUDetails = {}; // TODO - Could remove this later after large totals go away.
|
|
1615
1740
|
var longTaskEntries = getEntries("longtask");
|
|
1616
1741
|
// Add up totals for each "type" of long task
|
|
1617
|
-
if (longTaskEntries
|
|
1742
|
+
if (longTaskEntries[length]) {
|
|
1618
1743
|
var tZero_1 = getZeroTime();
|
|
1619
1744
|
longTaskEntries.forEach(function (entry) {
|
|
1620
|
-
var dur = floor(entry
|
|
1621
|
-
if (entry
|
|
1745
|
+
var dur = floor(entry[duration]);
|
|
1746
|
+
if (entry[startTime$1] < tZero_1) {
|
|
1622
1747
|
// In a SPA it is possible that we were in the middle of a Long Task when
|
|
1623
1748
|
// LUX.init() was called. If so, only include the duration after tZero.
|
|
1624
|
-
dur -= tZero_1 - entry
|
|
1749
|
+
dur -= tZero_1 - entry[startTime$1];
|
|
1625
1750
|
}
|
|
1626
1751
|
// Only process entries that we calculated to have a valid duration
|
|
1627
1752
|
if (dur > 0) {
|
|
1628
1753
|
logger.logEvent(43 /* LogEvent.PerformanceEntryProcessed */, [entry]);
|
|
1629
|
-
var type = entry.attribution[0]
|
|
1754
|
+
var type = entry.attribution[0][name];
|
|
1630
1755
|
if (!hCPU[type]) {
|
|
1631
1756
|
hCPU[type] = 0;
|
|
1632
1757
|
hCPUDetails[type] = "";
|
|
1633
1758
|
}
|
|
1634
1759
|
hCPU[type] += dur;
|
|
1635
1760
|
// Send back the raw startTime and duration, as well as the adjusted duration.
|
|
1636
|
-
hCPUDetails[type] += "," + floor(entry
|
|
1761
|
+
hCPUDetails[type] += "," + floor(entry[startTime$1]) + "|" + dur;
|
|
1637
1762
|
}
|
|
1638
1763
|
});
|
|
1639
1764
|
}
|
|
1640
1765
|
// TODO - Add more types if/when they become available.
|
|
1641
|
-
var jsType = typeof hCPU[
|
|
1766
|
+
var jsType = typeof hCPU[script] !== "undefined" ? script : "unknown"; // spec changed from "script" to "unknown" Nov 2018
|
|
1642
1767
|
if (typeof hCPU[jsType] === "undefined") {
|
|
1643
1768
|
// Initialize default values for pages that have *no Long Tasks*.
|
|
1644
1769
|
hCPU[jsType] = 0;
|
|
@@ -1666,12 +1791,12 @@
|
|
|
1666
1791
|
var bFoundFci = typeof fcp === "undefined";
|
|
1667
1792
|
var aValues = [];
|
|
1668
1793
|
var aTuples = sDetails.split(",");
|
|
1669
|
-
for (var i = 0; i < aTuples
|
|
1794
|
+
for (var i = 0; i < aTuples[length]; i++) {
|
|
1670
1795
|
var aTuple = aTuples[i].split("|");
|
|
1671
|
-
if (aTuple
|
|
1796
|
+
if (aTuple[length] === 2) {
|
|
1672
1797
|
var start = parseInt(aTuple[0]);
|
|
1673
1798
|
var dur = parseInt(aTuple[1]);
|
|
1674
|
-
aValues
|
|
1799
|
+
aValues[push](dur);
|
|
1675
1800
|
max = dur > max ? dur : max;
|
|
1676
1801
|
// FCI
|
|
1677
1802
|
if (!bFoundFci && start > fci) {
|
|
@@ -1691,18 +1816,18 @@
|
|
|
1691
1816
|
}
|
|
1692
1817
|
}
|
|
1693
1818
|
}
|
|
1694
|
-
var count = aValues
|
|
1819
|
+
var count = aValues[length];
|
|
1695
1820
|
var median = arrayMedian(aValues);
|
|
1696
1821
|
return { count: count, median: median, max: max, fci: fci };
|
|
1697
1822
|
}
|
|
1698
1823
|
// Return the median value from an array of integers.
|
|
1699
1824
|
function arrayMedian(aValues) {
|
|
1700
|
-
if (0 === aValues
|
|
1825
|
+
if (0 === aValues[length]) {
|
|
1701
1826
|
return 0;
|
|
1702
1827
|
}
|
|
1703
|
-
var half = floor(aValues
|
|
1828
|
+
var half = floor(aValues[length] / 2);
|
|
1704
1829
|
aValues.sort(sortNumeric);
|
|
1705
|
-
if (aValues
|
|
1830
|
+
if (aValues[length] % 2) {
|
|
1706
1831
|
// Return the middle value.
|
|
1707
1832
|
return aValues[half];
|
|
1708
1833
|
}
|
|
@@ -1717,7 +1842,7 @@
|
|
|
1717
1842
|
if (gbFirstPV && performance.getEntriesByName && thisScript.src) {
|
|
1718
1843
|
// Get the lux script URL (including querystring params).
|
|
1719
1844
|
var aResources = performance.getEntriesByName(thisScript.src);
|
|
1720
|
-
if (aResources && aResources
|
|
1845
|
+
if (aResources && aResources[length]) {
|
|
1721
1846
|
var r = aResources[0];
|
|
1722
1847
|
// DO NOT USE DURATION!!!!!
|
|
1723
1848
|
// See https://www.stevesouders.com/blog/2014/11/25/serious-confusion-with-resource-timing/
|
|
@@ -1747,7 +1872,7 @@
|
|
|
1747
1872
|
(typeof transferSize === "number" ? "x" + transferSize : "") +
|
|
1748
1873
|
(typeof gLuxSnippetStart === "number" ? "l" + gLuxSnippetStart : "") +
|
|
1749
1874
|
"s" +
|
|
1750
|
-
(scriptStartTime - timing
|
|
1875
|
+
(scriptStartTime - timing[navigationStart]) + // when lux.js started getting evaluated relative to navigationStart
|
|
1751
1876
|
"";
|
|
1752
1877
|
}
|
|
1753
1878
|
}
|
|
@@ -1763,7 +1888,7 @@
|
|
|
1763
1888
|
function ixValues() {
|
|
1764
1889
|
var aIx = [];
|
|
1765
1890
|
for (var key in ghIx) {
|
|
1766
|
-
aIx
|
|
1891
|
+
aIx[push](key + "|" + encodeURIComponent(ghIx[key]));
|
|
1767
1892
|
}
|
|
1768
1893
|
return aIx.join(",");
|
|
1769
1894
|
}
|
|
@@ -1821,10 +1946,11 @@
|
|
|
1821
1946
|
gbFirstPV = 0;
|
|
1822
1947
|
gSyncId = createSyncId();
|
|
1823
1948
|
gUid = refreshUniqueId(gSyncId);
|
|
1824
|
-
reset();
|
|
1825
|
-
reset$3();
|
|
1826
1949
|
reset$1();
|
|
1950
|
+
reset$4();
|
|
1827
1951
|
reset$2();
|
|
1952
|
+
reset$3();
|
|
1953
|
+
reset();
|
|
1828
1954
|
nErrors = 0;
|
|
1829
1955
|
gFirstInputDelay = undefined;
|
|
1830
1956
|
beacon = initPostBeacon();
|
|
@@ -1847,9 +1973,9 @@
|
|
|
1847
1973
|
}
|
|
1848
1974
|
// Find all the synchronous scripts that are ABOVE the last DOM element in the
|
|
1849
1975
|
// viewport. (If they are BELOW then they do not block rendering of initial viewport.)
|
|
1850
|
-
var aElems = document.getElementsByTagName(
|
|
1976
|
+
var aElems = document.getElementsByTagName(script);
|
|
1851
1977
|
var num = 0;
|
|
1852
|
-
for (var i = 0, len = aElems
|
|
1978
|
+
for (var i = 0, len = aElems[length]; i < len; i++) {
|
|
1853
1979
|
var e = aElems[i];
|
|
1854
1980
|
if (e.src &&
|
|
1855
1981
|
!e.async &&
|
|
@@ -1866,7 +1992,7 @@
|
|
|
1866
1992
|
function blockingStylesheets() {
|
|
1867
1993
|
var nBlocking = 0;
|
|
1868
1994
|
var aElems = document.getElementsByTagName("link");
|
|
1869
|
-
for (var i = 0, len = aElems
|
|
1995
|
+
for (var i = 0, len = aElems[length]; i < len; i++) {
|
|
1870
1996
|
var e = aElems[i];
|
|
1871
1997
|
if (e.href && "stylesheet" === e.rel && 0 !== e.href.indexOf("data:")) {
|
|
1872
1998
|
if (
|
|
@@ -1884,9 +2010,9 @@
|
|
|
1884
2010
|
}
|
|
1885
2011
|
// Return the number of synchronous external scripts in the page.
|
|
1886
2012
|
function syncScripts() {
|
|
1887
|
-
var aElems = document.getElementsByTagName(
|
|
2013
|
+
var aElems = document.getElementsByTagName(script);
|
|
1888
2014
|
var num = 0;
|
|
1889
|
-
for (var i = 0, len = aElems
|
|
2015
|
+
for (var i = 0, len = aElems[length]; i < len; i++) {
|
|
1890
2016
|
var e = aElems[i];
|
|
1891
2017
|
if (e.src && !e.async && !e.defer) {
|
|
1892
2018
|
// If the script has a SRC and async is false, then increment the counter.
|
|
@@ -1897,9 +2023,9 @@
|
|
|
1897
2023
|
}
|
|
1898
2024
|
// Return the number of external scripts in the page.
|
|
1899
2025
|
function numScripts() {
|
|
1900
|
-
var aElems = document.getElementsByTagName(
|
|
2026
|
+
var aElems = document.getElementsByTagName(script);
|
|
1901
2027
|
var num = 0;
|
|
1902
|
-
for (var i = 0, len = aElems
|
|
2028
|
+
for (var i = 0, len = aElems[length]; i < len; i++) {
|
|
1903
2029
|
var e = aElems[i];
|
|
1904
2030
|
if (e.src) {
|
|
1905
2031
|
num++;
|
|
@@ -1911,7 +2037,7 @@
|
|
|
1911
2037
|
function numStylesheets() {
|
|
1912
2038
|
var aElems = document.getElementsByTagName("link");
|
|
1913
2039
|
var num = 0;
|
|
1914
|
-
for (var i = 0, len = aElems
|
|
2040
|
+
for (var i = 0, len = aElems[length]; i < len; i++) {
|
|
1915
2041
|
var e = aElems[i];
|
|
1916
2042
|
if (e.href && "stylesheet" == e.rel) {
|
|
1917
2043
|
num++;
|
|
@@ -1922,10 +2048,10 @@
|
|
|
1922
2048
|
function inlineTagSize(tagName) {
|
|
1923
2049
|
var aElems = document.getElementsByTagName(tagName);
|
|
1924
2050
|
var size = 0;
|
|
1925
|
-
for (var i = 0, len = aElems
|
|
2051
|
+
for (var i = 0, len = aElems[length]; i < len; i++) {
|
|
1926
2052
|
var e = aElems[i];
|
|
1927
2053
|
try {
|
|
1928
|
-
size += e.innerHTML
|
|
2054
|
+
size += e.innerHTML[length];
|
|
1929
2055
|
}
|
|
1930
2056
|
catch (e) {
|
|
1931
2057
|
// It seems like IE throws an error when accessing the innerHTML property
|
|
@@ -1937,15 +2063,16 @@
|
|
|
1937
2063
|
}
|
|
1938
2064
|
function getNavTiming() {
|
|
1939
2065
|
var s = "";
|
|
1940
|
-
var ns = timing
|
|
2066
|
+
var ns = timing[navigationStart];
|
|
1941
2067
|
var startMark = _getMark(START_MARK);
|
|
1942
2068
|
var endMark = _getMark(END_MARK);
|
|
1943
|
-
|
|
2069
|
+
var pageRestoreTime = getPageRestoreTime();
|
|
2070
|
+
if (startMark && endMark && !pageRestoreTime) {
|
|
1944
2071
|
// This is a SPA page view, so send the SPA marks & measures instead of Nav Timing.
|
|
1945
2072
|
// Note: getPageRestoreTime() indicates this was a bfcache restore, which we don't want to treat as a SPA.
|
|
1946
|
-
var start = floor(startMark
|
|
2073
|
+
var start = floor(startMark[startTime$1]); // the start mark is "zero"
|
|
1947
2074
|
ns += start; // "navigationStart" for a SPA is the real navigationStart plus the start mark
|
|
1948
|
-
var end = floor(endMark
|
|
2075
|
+
var end = floor(endMark[startTime$1]) - start; // delta from start mark
|
|
1949
2076
|
s =
|
|
1950
2077
|
ns +
|
|
1951
2078
|
// fetchStart and activationStart are the same as navigationStart for a SPA
|
|
@@ -1977,11 +2104,11 @@
|
|
|
1977
2104
|
var loadEventStartStr = prefixNTValue("loadEventStart", "ls", true);
|
|
1978
2105
|
// If LUX.markLoadTime() was called in SPA Mode, we allow the custom mark to override loadEventEnd
|
|
1979
2106
|
var loadEventEndStr = globalConfig.spaMode && endMark
|
|
1980
|
-
? "le" + processTimeMetric(endMark
|
|
2107
|
+
? "le" + processTimeMetric(endMark[startTime$1])
|
|
1981
2108
|
: prefixNTValue("loadEventEnd", "le", true);
|
|
1982
|
-
if (
|
|
2109
|
+
if (pageRestoreTime && startMark && endMark) {
|
|
1983
2110
|
// For bfcache restores, we set the load time to the time it took for the page to be restored.
|
|
1984
|
-
var loadTime = floor(endMark
|
|
2111
|
+
var loadTime = floor(endMark[startTime$1] - startMark[startTime$1]);
|
|
1985
2112
|
loadEventStartStr = "ls" + loadTime;
|
|
1986
2113
|
loadEventEndStr = "le" + loadTime;
|
|
1987
2114
|
}
|
|
@@ -1989,7 +2116,7 @@
|
|
|
1989
2116
|
var isSecure = document.location.protocol === "https:";
|
|
1990
2117
|
s = [
|
|
1991
2118
|
ns,
|
|
1992
|
-
"as" + clamp(navEntry_1
|
|
2119
|
+
"as" + clamp(navEntry_1[activationStart]),
|
|
1993
2120
|
redirect && !getPageRestoreTime() ? prefixNTValue("redirectStart", "rs") : "",
|
|
1994
2121
|
redirect && !getPageRestoreTime() ? prefixNTValue("redirectEnd", "re") : "",
|
|
1995
2122
|
prefixNTValue("fetchStart", "fs"),
|
|
@@ -2014,7 +2141,7 @@
|
|
|
2014
2141
|
}
|
|
2015
2142
|
else if (endMark) {
|
|
2016
2143
|
// This is a "main" page view that does NOT support Navigation Timing - strange.
|
|
2017
|
-
var end = floor(endMark
|
|
2144
|
+
var end = floor(endMark[startTime$1]);
|
|
2018
2145
|
s =
|
|
2019
2146
|
ns +
|
|
2020
2147
|
"fs" +
|
|
@@ -2030,10 +2157,10 @@
|
|
|
2030
2157
|
// Return First Contentful Paint or undefined if not supported.
|
|
2031
2158
|
function getFcp() {
|
|
2032
2159
|
var paintEntries = getEntriesByType("paint");
|
|
2033
|
-
for (var i = 0; i < paintEntries
|
|
2160
|
+
for (var i = 0; i < paintEntries[length]; i++) {
|
|
2034
2161
|
var entry = paintEntries[i];
|
|
2035
|
-
if (entry
|
|
2036
|
-
var value = processTimeMetric(entry
|
|
2162
|
+
if (entry[name] === "first-contentful-paint") {
|
|
2163
|
+
var value = processTimeMetric(entry[startTime$1]);
|
|
2037
2164
|
if (shouldReportValue(value)) {
|
|
2038
2165
|
return value;
|
|
2039
2166
|
}
|
|
@@ -2044,9 +2171,9 @@
|
|
|
2044
2171
|
// Return Largest Contentful Paint or undefined if not supported.
|
|
2045
2172
|
function getLcp() {
|
|
2046
2173
|
var lcpEntries = getEntries("largest-contentful-paint");
|
|
2047
|
-
if (lcpEntries
|
|
2048
|
-
var lastEntry = lcpEntries[lcpEntries
|
|
2049
|
-
var value = processTimeMetric(lastEntry
|
|
2174
|
+
if (lcpEntries[length]) {
|
|
2175
|
+
var lastEntry = lcpEntries[lcpEntries[length] - 1];
|
|
2176
|
+
var value = processTimeMetric(lastEntry[startTime$1]);
|
|
2050
2177
|
if (shouldReportValue(value)) {
|
|
2051
2178
|
logger.logEvent(43 /* LogEvent.PerformanceEntryProcessed */, [lastEntry]);
|
|
2052
2179
|
return value;
|
|
@@ -2060,10 +2187,10 @@
|
|
|
2060
2187
|
function getStartRender() {
|
|
2061
2188
|
if ("PerformancePaintTiming" in self) {
|
|
2062
2189
|
var paintEntries = getEntriesByType("paint");
|
|
2063
|
-
if (paintEntries
|
|
2064
|
-
var paintValues = paintEntries.map(function (entry) { return entry
|
|
2190
|
+
if (paintEntries[length]) {
|
|
2191
|
+
var paintValues = paintEntries.map(function (entry) { return entry[startTime$1]; }).sort(sortNumeric);
|
|
2065
2192
|
// Use the earliest valid paint entry as the start render time.
|
|
2066
|
-
for (var i = 0; i < paintValues
|
|
2193
|
+
for (var i = 0; i < paintValues[length]; i++) {
|
|
2067
2194
|
var value = processTimeMetric(paintValues[i]);
|
|
2068
2195
|
if (shouldReportValue(value)) {
|
|
2069
2196
|
return value;
|
|
@@ -2073,7 +2200,7 @@
|
|
|
2073
2200
|
}
|
|
2074
2201
|
if (performance.timing && timing.msFirstPaint && true) {
|
|
2075
2202
|
// If IE/Edge, use the prefixed `msFirstPaint` property (see http://msdn.microsoft.com/ff974719).
|
|
2076
|
-
return floor(timing.msFirstPaint - timing
|
|
2203
|
+
return floor(timing.msFirstPaint - timing[navigationStart]);
|
|
2077
2204
|
}
|
|
2078
2205
|
logger.logEvent(72 /* LogEvent.PaintTimingNotSupported */);
|
|
2079
2206
|
return undefined;
|
|
@@ -2096,12 +2223,13 @@
|
|
|
2096
2223
|
*/
|
|
2097
2224
|
function getINPString(details) {
|
|
2098
2225
|
return [
|
|
2099
|
-
"&INP=" + details
|
|
2100
|
-
details
|
|
2101
|
-
"&INPt=" + floor(details
|
|
2102
|
-
"&INPi=" + clamp(floor(details
|
|
2103
|
-
"&INPp=" + clamp(floor(details
|
|
2104
|
-
"&INPd=" +
|
|
2226
|
+
"&INP=" + details[duration],
|
|
2227
|
+
details[selector] ? "&INPs=" + encodeURIComponent(details[selector]) : "",
|
|
2228
|
+
"&INPt=" + floor(details[startTime$1]),
|
|
2229
|
+
"&INPi=" + clamp(floor(details[processingStart] - details[startTime$1])),
|
|
2230
|
+
"&INPp=" + clamp(floor(details[processingTime])),
|
|
2231
|
+
"&INPd=" +
|
|
2232
|
+
clamp(floor(details[startTime$1] + details[duration] - details[processingEnd])),
|
|
2105
2233
|
].join("");
|
|
2106
2234
|
}
|
|
2107
2235
|
function getCustomerId() {
|
|
@@ -2109,12 +2237,12 @@
|
|
|
2109
2237
|
}
|
|
2110
2238
|
function avgDomDepth() {
|
|
2111
2239
|
var aElems = document.getElementsByTagName("*");
|
|
2112
|
-
var i = aElems
|
|
2240
|
+
var i = aElems[length];
|
|
2113
2241
|
var totalParents = 0;
|
|
2114
2242
|
while (i--) {
|
|
2115
2243
|
totalParents += numParents(aElems[i]);
|
|
2116
2244
|
}
|
|
2117
|
-
var average = round(totalParents / aElems
|
|
2245
|
+
var average = round(totalParents / aElems[length]);
|
|
2118
2246
|
return average;
|
|
2119
2247
|
}
|
|
2120
2248
|
function numParents(elem) {
|
|
@@ -2127,13 +2255,13 @@
|
|
|
2127
2255
|
return n;
|
|
2128
2256
|
}
|
|
2129
2257
|
function docHeight(doc) {
|
|
2130
|
-
var body = doc.body
|
|
2131
|
-
var height = max(body ? body.scrollHeight : 0, body ? body.offsetHeight : 0,
|
|
2258
|
+
var body = doc.body;
|
|
2259
|
+
var height = max(body ? body.scrollHeight : 0, body ? body.offsetHeight : 0, documentElement ? documentElement.clientHeight : 0, documentElement ? documentElement.scrollHeight : 0, documentElement ? documentElement.offsetHeight : 0);
|
|
2132
2260
|
return height;
|
|
2133
2261
|
}
|
|
2134
2262
|
function docWidth(doc) {
|
|
2135
|
-
var body = doc.body
|
|
2136
|
-
var width = max(body ? body.scrollWidth : 0, body ? body.offsetWidth : 0,
|
|
2263
|
+
var body = doc.body;
|
|
2264
|
+
var width = max(body ? body.scrollWidth : 0, body ? body.offsetWidth : 0, documentElement ? documentElement.clientWidth : 0, documentElement ? documentElement.scrollWidth : 0, documentElement ? documentElement.offsetWidth : 0);
|
|
2137
2265
|
return width;
|
|
2138
2266
|
}
|
|
2139
2267
|
// Return the main HTML document transfer size (in bytes).
|
|
@@ -2164,10 +2292,10 @@
|
|
|
2164
2292
|
var aImages = document.getElementsByTagName("img");
|
|
2165
2293
|
var aImagesAtf = [];
|
|
2166
2294
|
if (aImages) {
|
|
2167
|
-
for (var i = 0, len = aImages
|
|
2295
|
+
for (var i = 0, len = aImages[length]; i < len; i++) {
|
|
2168
2296
|
var image = aImages[i];
|
|
2169
2297
|
if (inViewport(image)) {
|
|
2170
|
-
aImagesAtf
|
|
2298
|
+
aImagesAtf[push](image);
|
|
2171
2299
|
}
|
|
2172
2300
|
}
|
|
2173
2301
|
}
|
|
@@ -2187,7 +2315,7 @@
|
|
|
2187
2315
|
// Elements are listed in DOM order.
|
|
2188
2316
|
var aChildren = parent.children;
|
|
2189
2317
|
if (aChildren) {
|
|
2190
|
-
for (var i = 0, len = aChildren
|
|
2318
|
+
for (var i = 0, len = aChildren[length]; i < len; i++) {
|
|
2191
2319
|
var child = aChildren[i];
|
|
2192
2320
|
if (inViewport(child)) {
|
|
2193
2321
|
// The children are in DOM order, so we just have to
|
|
@@ -2209,8 +2337,8 @@
|
|
|
2209
2337
|
}
|
|
2210
2338
|
// Return true if the element is in the viewport.
|
|
2211
2339
|
function inViewport(e) {
|
|
2212
|
-
var vh =
|
|
2213
|
-
var vw =
|
|
2340
|
+
var vh = documentElement.clientHeight;
|
|
2341
|
+
var vw = documentElement.clientWidth;
|
|
2214
2342
|
// Return true if the top-left corner is in the viewport and it has width & height.
|
|
2215
2343
|
var lt = findPos(e);
|
|
2216
2344
|
return (lt[0] >= 0 &&
|
|
@@ -2275,14 +2403,14 @@
|
|
|
2275
2403
|
"PN=" + encodeURIComponent(document.location.pathname),
|
|
2276
2404
|
];
|
|
2277
2405
|
if (gFlags) {
|
|
2278
|
-
queryParams
|
|
2406
|
+
queryParams[push]("fl=" + gFlags);
|
|
2279
2407
|
}
|
|
2280
2408
|
if (LUX.snippetVersion) {
|
|
2281
|
-
queryParams
|
|
2409
|
+
queryParams[push]("sv=" + LUX.snippetVersion);
|
|
2282
2410
|
}
|
|
2283
2411
|
var customDataValues = valuesToString(customData);
|
|
2284
2412
|
if (customDataValues) {
|
|
2285
|
-
queryParams
|
|
2413
|
+
queryParams[push]("CD=" + customDataValues);
|
|
2286
2414
|
clearUpdateCustomData();
|
|
2287
2415
|
}
|
|
2288
2416
|
return globalConfig.beaconUrl + "?" + queryParams.join("&");
|
|
@@ -2318,7 +2446,7 @@
|
|
|
2318
2446
|
// For soft navigations, only set the synthetic load time if SPA mode is not enabled, and...
|
|
2319
2447
|
if (!globalConfig.spaMode) {
|
|
2320
2448
|
// ...there is no existing end mark, or the end mark is from a previous SPA page.
|
|
2321
|
-
if (!endMark || endMark
|
|
2449
|
+
if (!endMark || endMark[startTime$1] < startMark[startTime$1]) {
|
|
2322
2450
|
_markLoadTime();
|
|
2323
2451
|
}
|
|
2324
2452
|
}
|
|
@@ -2343,7 +2471,7 @@
|
|
|
2343
2471
|
}
|
|
2344
2472
|
var sET = elementTimingValues(); // Element Timing data
|
|
2345
2473
|
var sCPU = cpuTimes();
|
|
2346
|
-
var clsData = getData$
|
|
2474
|
+
var clsData = getData$5(globalConfig);
|
|
2347
2475
|
var sLuxjs = selfLoading();
|
|
2348
2476
|
if (!isVisible()) {
|
|
2349
2477
|
gFlags = addFlag(gFlags, 8 /* Flags.VisibilityStateNotVisible */);
|
|
@@ -2370,7 +2498,7 @@
|
|
|
2370
2498
|
// We want ALL beacons to have ALL the data used for query filters (geo, pagelabel, browser, & custom data).
|
|
2371
2499
|
// So we create a base URL that has all the necessary information:
|
|
2372
2500
|
var baseUrl = _getBeaconUrl(getAllCustomData());
|
|
2373
|
-
var is = inlineTagSize(
|
|
2501
|
+
var is = inlineTagSize(script);
|
|
2374
2502
|
var ic = inlineTagSize("style");
|
|
2375
2503
|
var ds = docSize();
|
|
2376
2504
|
var ct = connectionType();
|
|
@@ -2395,17 +2523,17 @@
|
|
|
2395
2523
|
blockingStylesheets() +
|
|
2396
2524
|
(ic > -1 ? "ic" + ic : "") +
|
|
2397
2525
|
"ia" +
|
|
2398
|
-
imagesATF()
|
|
2526
|
+
imagesATF()[length] +
|
|
2399
2527
|
"it" +
|
|
2400
|
-
document.getElementsByTagName("img")
|
|
2528
|
+
document.getElementsByTagName("img")[length] + // total number of images
|
|
2401
2529
|
"dd" +
|
|
2402
2530
|
avgDomDepth() +
|
|
2403
2531
|
"nd" +
|
|
2404
|
-
document.getElementsByTagName("*")
|
|
2532
|
+
document.getElementsByTagName("*")[length] + // numdomelements
|
|
2405
2533
|
"vh" +
|
|
2406
|
-
|
|
2534
|
+
documentElement.clientHeight + // see http://www.quirksmode.org/mobile/viewports.html
|
|
2407
2535
|
"vw" +
|
|
2408
|
-
|
|
2536
|
+
documentElement.clientWidth +
|
|
2409
2537
|
"dh" +
|
|
2410
2538
|
docHeight(document) +
|
|
2411
2539
|
"dw" +
|
|
@@ -2431,7 +2559,7 @@
|
|
|
2431
2559
|
// Send the MAIN LUX beacon.
|
|
2432
2560
|
var mainBeaconUrl = baseUrl +
|
|
2433
2561
|
metricsQueryString +
|
|
2434
|
-
(beaconUtValues
|
|
2562
|
+
(beaconUtValues[length] > 0 ? "&UT=" + beaconUtValues.join(",") : "");
|
|
2435
2563
|
logger.logEvent(23 /* LogEvent.MainBeaconSent */, [mainBeaconUrl]);
|
|
2436
2564
|
_sendBeacon(mainBeaconUrl);
|
|
2437
2565
|
// Set some states.
|
|
@@ -2439,7 +2567,7 @@
|
|
|
2439
2567
|
gbNavSent = 1;
|
|
2440
2568
|
gbIxSent = sIx ? 1 : 0;
|
|
2441
2569
|
// Send other beacons for JUST User Timing.
|
|
2442
|
-
while (remainingUtValues
|
|
2570
|
+
while (remainingUtValues[length]) {
|
|
2443
2571
|
_a = fitUserTimingEntries(remainingUtValues, globalConfig, baseUrl), beaconUtValues = _a[0], remainingUtValues = _a[1];
|
|
2444
2572
|
var utBeaconUrl = baseUrl + "&UT=" + beaconUtValues.join(",");
|
|
2445
2573
|
logger.logEvent(24 /* LogEvent.UserTimingBeaconSent */, [utBeaconUrl]);
|
|
@@ -2628,7 +2756,7 @@
|
|
|
2628
2756
|
// Refresh its expiration date and return its value.
|
|
2629
2757
|
function refreshUniqueId(newValue) {
|
|
2630
2758
|
var uid = _getCookie(SESSION_COOKIE_NAME);
|
|
2631
|
-
if (!uid || uid
|
|
2759
|
+
if (!uid || uid[length] < 11) {
|
|
2632
2760
|
uid = newValue;
|
|
2633
2761
|
}
|
|
2634
2762
|
else {
|
|
@@ -2691,7 +2819,7 @@
|
|
|
2691
2819
|
try {
|
|
2692
2820
|
// Seeing "Permission denied" errors, so do a simple try-catch.
|
|
2693
2821
|
var aTuples = document.cookie.split(";");
|
|
2694
|
-
for (var i = 0; i < aTuples
|
|
2822
|
+
for (var i = 0; i < aTuples[length]; i++) {
|
|
2695
2823
|
var aTuple = aTuples[i].split("=");
|
|
2696
2824
|
if (name === aTuple[0].trim()) {
|
|
2697
2825
|
// cookie name starts with " " if not first
|
|
@@ -2840,7 +2968,7 @@
|
|
|
2840
2968
|
// decide whether an init() call can be ignored or not.
|
|
2841
2969
|
var startMark = _getMark(START_MARK);
|
|
2842
2970
|
var endMark = _getMark(END_MARK);
|
|
2843
|
-
if (!endMark || (startMark && endMark
|
|
2971
|
+
if (!endMark || (startMark && endMark[startTime$1] < startMark[startTime$1])) {
|
|
2844
2972
|
_markLoadTime();
|
|
2845
2973
|
}
|
|
2846
2974
|
}
|
|
@@ -2872,17 +3000,17 @@
|
|
|
2872
3000
|
}
|
|
2873
3001
|
}
|
|
2874
3002
|
// Process the command queue
|
|
2875
|
-
if (LUX.ac && LUX.ac
|
|
3003
|
+
if (LUX.ac && LUX.ac[length]) {
|
|
2876
3004
|
LUX.ac.forEach(_runCommand);
|
|
2877
3005
|
}
|
|
2878
3006
|
// process the error events that happened before lux.js got loaded
|
|
2879
|
-
if (typeof
|
|
2880
|
-
|
|
3007
|
+
if (typeof global.LUX_ae !== "undefined") {
|
|
3008
|
+
global.LUX_ae.forEach(errorHandler);
|
|
2881
3009
|
}
|
|
2882
3010
|
logger.logEvent(2 /* LogEvent.EvaluationEnd */);
|
|
2883
3011
|
return globalLux;
|
|
2884
3012
|
})();
|
|
2885
|
-
|
|
3013
|
+
global.LUX = LUX;
|
|
2886
3014
|
scriptEndTime = now();
|
|
2887
3015
|
// ---------------------------------------------------------------------------
|
|
2888
3016
|
// More settings
|