@reuters-graphics/graphics-components 0.0.17 → 0.0.19
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.
|
@@ -41,10 +41,6 @@ declare const __propDef: {
|
|
|
41
41
|
* Share image alt text, up to 420 characters.
|
|
42
42
|
* @type {string}
|
|
43
43
|
*/ shareImgAlt?: string;
|
|
44
|
-
/**
|
|
45
|
-
* [HTML lang attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang). **Two-letter code only.**
|
|
46
|
-
* @type {string}
|
|
47
|
-
*/ lang?: string;
|
|
48
44
|
/**
|
|
49
45
|
* Publish time as an [ISO string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
|
50
46
|
* @type {string}
|
|
@@ -49,11 +49,6 @@ export let shareImgPath;
|
|
|
49
49
|
* @type {string}
|
|
50
50
|
*/
|
|
51
51
|
export let shareImgAlt = '';
|
|
52
|
-
/**
|
|
53
|
-
* [HTML lang attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang). **Two-letter code only.**
|
|
54
|
-
* @type {string}
|
|
55
|
-
*/
|
|
56
|
-
export let lang = 'en';
|
|
57
52
|
/**
|
|
58
53
|
* Publish time as an [ISO string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
|
59
54
|
* @type {string}
|
|
@@ -86,10 +81,16 @@ const getOrigin = (baseUrl) => {
|
|
|
86
81
|
};
|
|
87
82
|
$: origin = getOrigin(baseUrl);
|
|
88
83
|
$: canonicalUrl = origin + pageUrl.pathname;
|
|
84
|
+
let hasEnabledPublisherTags = false;
|
|
89
85
|
// Only fire analytics on prod sites
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
$: {
|
|
87
|
+
if (typeof window !== 'undefined' && includeAnalytics) {
|
|
88
|
+
analytics(canonicalUrl, seoTitle);
|
|
89
|
+
if (!hasEnabledPublisherTags) {
|
|
90
|
+
publisherTags();
|
|
91
|
+
hasEnabledPublisherTags = true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
93
94
|
}
|
|
94
95
|
const orgLdJson = {
|
|
95
96
|
'@context': 'http://schema.org',
|
|
@@ -104,7 +105,7 @@ const orgLdJson = {
|
|
|
104
105
|
},
|
|
105
106
|
url: 'https://www.reuters.com/',
|
|
106
107
|
};
|
|
107
|
-
|
|
108
|
+
$: articleLdJson = {
|
|
108
109
|
'@context': 'http://schema.org',
|
|
109
110
|
'@type': 'NewsArticle',
|
|
110
111
|
headline: seoTitle,
|
|
@@ -141,7 +142,6 @@ const articleLdJson = {
|
|
|
141
142
|
</script>
|
|
142
143
|
|
|
143
144
|
<svelte:head>
|
|
144
|
-
<html lang="{lang}"></html>
|
|
145
145
|
<title>{seoTitle}</title>
|
|
146
146
|
<meta name="description" content="{seoDescription}" />
|
|
147
147
|
<link rel="canonical" href="{canonicalUrl}" />
|
|
@@ -16,32 +16,32 @@ const attachScript = function (i, s, o, g, r, a, m) {
|
|
|
16
16
|
/* eslint-enable */
|
|
17
17
|
|
|
18
18
|
export default (page, title) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
if (!window.ga) {
|
|
20
|
+
attachScript(
|
|
21
|
+
window,
|
|
22
|
+
document,
|
|
23
|
+
'script',
|
|
24
|
+
'https://www.google-analytics.com/analytics.js',
|
|
25
|
+
'ga'
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
window.ga('create', 'UA-41619329-3', { cookieDomain: 'auto' });
|
|
29
|
+
window.ga('require', 'linkid', 'linkid.js');
|
|
30
|
+
}
|
|
31
|
+
|
|
29
32
|
window.ga('send', 'pageview', {
|
|
30
33
|
page,
|
|
31
34
|
title,
|
|
32
35
|
});
|
|
33
36
|
|
|
34
37
|
if (!inIframe()) {
|
|
35
|
-
//start time on page tracking if not in an iframe
|
|
38
|
+
// start time on page tracking if not in an iframe
|
|
36
39
|
riveted.init({
|
|
37
40
|
reportInterval: 30,
|
|
38
41
|
});
|
|
39
42
|
}
|
|
40
43
|
};
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
45
|
// checks if page is in an iframe
|
|
46
46
|
function inIframe() {
|
|
47
47
|
try {
|
|
@@ -51,28 +51,27 @@ function inIframe() {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
55
54
|
/*
|
|
56
55
|
* START: Riveted time on page tracking code
|
|
57
56
|
* see aditional documentation here: https://riveted.parsnip.io/
|
|
58
57
|
*/
|
|
59
|
-
|
|
58
|
+
/* eslint-disable */
|
|
60
59
|
var riveted = (function () {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
60
|
+
let started = false;
|
|
61
|
+
let stopped = false;
|
|
62
|
+
let turnedOff = false;
|
|
63
|
+
let clockTime = 0;
|
|
64
|
+
const startTime = new Date();
|
|
65
|
+
let clockTimer = null;
|
|
66
|
+
let idleTimer = null;
|
|
67
|
+
let sendEvent;
|
|
68
|
+
let sendUserTiming;
|
|
69
|
+
let reportInterval;
|
|
70
|
+
let idleTimeout;
|
|
71
|
+
let nonInteraction;
|
|
72
|
+
let universalGA;
|
|
73
|
+
let classicGA;
|
|
74
|
+
let googleTagManager;
|
|
76
75
|
|
|
77
76
|
function init(options) {
|
|
78
77
|
/*
|
|
@@ -126,8 +125,8 @@ var riveted = (function () {
|
|
|
126
125
|
// Page visibility listeners
|
|
127
126
|
addListener(document, 'visibilitychange', visibilityChange);
|
|
128
127
|
addListener(document, 'webkitvisibilitychange', visibilityChange);
|
|
129
|
-
|
|
130
|
-
//sends initial zero value
|
|
128
|
+
|
|
129
|
+
// sends initial zero value
|
|
131
130
|
sendEvent(0);
|
|
132
131
|
}
|
|
133
132
|
|
|
@@ -140,18 +139,18 @@ var riveted = (function () {
|
|
|
140
139
|
*/
|
|
141
140
|
|
|
142
141
|
function throttle(func, wait) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
let context, args, result;
|
|
143
|
+
let timeout = null;
|
|
144
|
+
let previous = 0;
|
|
145
|
+
const later = function () {
|
|
147
146
|
previous = new Date();
|
|
148
147
|
timeout = null;
|
|
149
148
|
result = func.apply(context, args);
|
|
150
149
|
};
|
|
151
150
|
return function () {
|
|
152
|
-
|
|
151
|
+
const now = new Date();
|
|
153
152
|
if (!previous) previous = now;
|
|
154
|
-
|
|
153
|
+
const remaining = wait - (now - previous);
|
|
155
154
|
context = this;
|
|
156
155
|
args = arguments;
|
|
157
156
|
if (remaining <= 0) {
|
|
@@ -190,7 +189,7 @@ var riveted = (function () {
|
|
|
190
189
|
event: 'RivetedTiming',
|
|
191
190
|
eventCategory: 'Riveted',
|
|
192
191
|
timingVar: 'First Interaction',
|
|
193
|
-
timingValue
|
|
192
|
+
timingValue,
|
|
194
193
|
});
|
|
195
194
|
} else {
|
|
196
195
|
if (universalGA) {
|
|
@@ -233,7 +232,7 @@ var riveted = (function () {
|
|
|
233
232
|
'Time Spent',
|
|
234
233
|
time.toString(),
|
|
235
234
|
reportInterval,
|
|
236
|
-
{ nonInteraction
|
|
235
|
+
{ nonInteraction }
|
|
237
236
|
);
|
|
238
237
|
}
|
|
239
238
|
|
|
@@ -290,8 +289,8 @@ var riveted = (function () {
|
|
|
290
289
|
|
|
291
290
|
function startRiveted() {
|
|
292
291
|
// Calculate seconds from start to first interaction
|
|
293
|
-
|
|
294
|
-
|
|
292
|
+
const currentTime = new Date();
|
|
293
|
+
const diff = currentTime - startTime;
|
|
295
294
|
|
|
296
295
|
// Set global
|
|
297
296
|
started = true;
|
|
@@ -321,12 +320,12 @@ var riveted = (function () {
|
|
|
321
320
|
}
|
|
322
321
|
|
|
323
322
|
return {
|
|
324
|
-
init
|
|
325
|
-
trigger
|
|
326
|
-
setIdle
|
|
323
|
+
init,
|
|
324
|
+
trigger,
|
|
325
|
+
setIdle,
|
|
327
326
|
on: turnOn,
|
|
328
327
|
off: turnOff,
|
|
329
328
|
};
|
|
330
329
|
})();
|
|
331
|
-
|
|
330
|
+
/* eslint-enable */
|
|
332
331
|
/* END: Riveted time on page tracking code */
|
|
@@ -6,7 +6,8 @@ export let stackBackground = true;
|
|
|
6
6
|
|
|
7
7
|
{#each steps as step, i}
|
|
8
8
|
<!-- Load the step(s) before and after the active one, only -->
|
|
9
|
-
|
|
9
|
+
<!-- Unless stackBackground is true. If so, keep all steps before the current one loaded. -->
|
|
10
|
+
{#if preload === 0 || (i >= (stackBackground ? 0 : index - preload) && i <= index + preload)}
|
|
10
11
|
<div
|
|
11
12
|
class="step-background step-{i + 1}"
|
|
12
13
|
class:visible="{stackBackground ? i <= index : i === index}"
|