@knight-lab/timelinejs 3.9.2 → 3.9.3
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.
- package/CHANGELOG.md +6 -0
- package/dist/css/fonts/font.amatic-andika.css +1 -1
- package/dist/css/fonts/font.bevan-pontanosans.css +2 -2
- package/dist/css/fonts/font.default.css +3 -3
- package/dist/css/fonts/font.fjalla-average.css +1 -1
- package/dist/css/fonts/font.lustria-lato.css +2 -2
- package/dist/css/fonts/font.medula-lato.css +3 -3
- package/dist/css/fonts/font.opensans-gentiumbook.css +4 -4
- package/dist/css/fonts/font.playfair-faunaone.css +2 -2
- package/dist/css/fonts/font.pt.css +3 -3
- package/dist/css/fonts/font.roboto-megrim.css +2 -2
- package/dist/css/fonts/font.unicaone-vollkorn.css +3 -3
- package/dist/embed/index.html +1 -1
- package/dist/js/timeline.js +1 -1
- package/dist/js/timeline.js.map +1 -1
- package/package.json +1 -1
- package/src/embed/index.html +1 -1
- package/src/js/core/ConfigFactory.js +8 -2
- package/src/js/slider/Slide.js +3 -4
- package/src/js/slider/StorySlider.js +1 -2
- package/src/js/timeline/Timeline.js +14 -22
- package/src/js/timenav/TimeEra.js +1 -2
- package/src/js/timenav/TimeMarker.js +2 -3
- package/src/template/index.html +1 -0
- package/src/js/dom/DOMUtil.js +0 -25
package/package.json
CHANGED
package/src/embed/index.html
CHANGED
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
var options = optionsFromUrlParams();
|
|
151
151
|
createEmbedDiv('timeline-embed', options.width, options.height);
|
|
152
152
|
// ga_property_id is not something we let users override
|
|
153
|
-
options.
|
|
153
|
+
options.ga_measurement_id = 'G-LVEFKMG087'
|
|
154
154
|
if (typeof(options.source) == 'undefined') {
|
|
155
155
|
options.source = '1xuY4upIooEeszZ_lCmeNx24eSFWe0rHe9ZdqH2xqVNk' // women in computing
|
|
156
156
|
}
|
|
@@ -154,7 +154,13 @@ export async function readGoogleAsCSV(url, sheets_proxy) {
|
|
|
154
154
|
if (error_json.proxy_err_code == 'response_not_csv') {
|
|
155
155
|
throw new TLError('Timeline could not read the data for your timeline. Make sure you have published it to the web.')
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
let msg = "undefined error"
|
|
158
|
+
if (Array.isArray(error_json.message)) {
|
|
159
|
+
msg = error_json.message.join('<br>')
|
|
160
|
+
} else {
|
|
161
|
+
msg = String(error_json.message)
|
|
162
|
+
}
|
|
163
|
+
throw new TLError(msg)
|
|
158
164
|
})
|
|
159
165
|
|
|
160
166
|
let timeline_config = { 'events': [], 'errors': [], 'warnings': [], 'eras': [] }
|
|
@@ -334,4 +340,4 @@ function handleRow(event, timeline_config) {
|
|
|
334
340
|
} else {
|
|
335
341
|
timeline_config.events.push(event);
|
|
336
342
|
}
|
|
337
|
-
}
|
|
343
|
+
}
|
package/src/js/slider/Slide.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import "wicg-inert";
|
|
2
2
|
|
|
3
|
-
import { addClass } from "../dom/DOMUtil"
|
|
4
3
|
import { I18NMixins } from "../language/I18NMixins";
|
|
5
4
|
import Events from "../core/Events";
|
|
6
5
|
import { DOMMixins } from "../dom/DOMMixins";
|
|
@@ -321,17 +320,17 @@ export class Slide {
|
|
|
321
320
|
|
|
322
321
|
// Add to DOM
|
|
323
322
|
if (!this.has.text && !this.has.headline && this.has.media) {
|
|
324
|
-
|
|
323
|
+
this._el.container.classList.add('tl-slide-media-only');
|
|
325
324
|
this._media.addTo(this._el.content);
|
|
326
325
|
} else if (this.has.headline && this.has.media && !this.has.text) {
|
|
327
|
-
|
|
326
|
+
this._el.container.classList.add('tl-slide-media-only');
|
|
328
327
|
this._text.addTo(this._el.content);
|
|
329
328
|
this._media.addTo(this._el.content);
|
|
330
329
|
} else if (this.has.text && this.has.media) {
|
|
331
330
|
this._text.addTo(this._el.content);
|
|
332
331
|
this._media.addTo(this._el.content);
|
|
333
332
|
} else if (this.has.text || this.has.headline) {
|
|
334
|
-
|
|
333
|
+
this._el.container.classList.add('tl-slide-text-only');
|
|
335
334
|
this._text.addTo(this._el.content);
|
|
336
335
|
}
|
|
337
336
|
|
|
@@ -6,7 +6,6 @@ import { Animate } from "../animation/Animate"
|
|
|
6
6
|
import * as DOM from "../dom/DOM"
|
|
7
7
|
import { DOMEvent } from "../dom/DOMEvent"
|
|
8
8
|
import * as Browser from "../core/Browser"
|
|
9
|
-
import { addClass } from "../dom/DOMUtil"
|
|
10
9
|
import Swipable from "../ui/Swipable";
|
|
11
10
|
import Message from "../ui/Message"
|
|
12
11
|
import { Slide } from "./Slide"
|
|
@@ -394,7 +393,7 @@ export class StorySlider {
|
|
|
394
393
|
================================================== */
|
|
395
394
|
_initLayout() {
|
|
396
395
|
|
|
397
|
-
|
|
396
|
+
this._el.container.classList.add('tl-storyslider');
|
|
398
397
|
|
|
399
398
|
// Create Navigation
|
|
400
399
|
this._nav.previous = new SlideNav({ title: "Previous", description: "description" }, { direction: "previous" }, this._el.container);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as DOM from "../dom/DOM"
|
|
2
|
-
import { addClass } from "../dom/DOMUtil"
|
|
3
2
|
import { hexToRgb, mergeData, classMixin, isTrue, trace, addTraceHandler } from "../core/Util";
|
|
4
3
|
import { easeInOutQuint, easeOutStrong } from "../animation/Ease";
|
|
5
4
|
import Message from "../ui/Message"
|
|
@@ -134,6 +133,7 @@ class Timeline {
|
|
|
134
133
|
slide_default_fade: "0%", // landscape fade
|
|
135
134
|
zoom_sequence: [0.5, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89], // Array of Fibonacci numbers for TimeNav zoom levels
|
|
136
135
|
language: "en",
|
|
136
|
+
ga_measurement_id: null,
|
|
137
137
|
ga_property_id: null,
|
|
138
138
|
track_events: ['back_to_start', 'nav_next', 'nav_previous', 'zoom_in', 'zoom_out'],
|
|
139
139
|
theme: null,
|
|
@@ -192,17 +192,17 @@ class Timeline {
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
// Apply base class to container
|
|
195
|
-
|
|
195
|
+
this._el.container.classList.add('tl-timeline');
|
|
196
196
|
this._el.container.setAttribute('tabindex', '0');
|
|
197
197
|
this._el.container.setAttribute('role', 'region');
|
|
198
198
|
this._el.container.setAttribute('aria-label', this._('aria_label_timeline'));
|
|
199
199
|
|
|
200
200
|
if (this.options.is_embed) {
|
|
201
|
-
|
|
201
|
+
this._el.container.classList.add('tl-timeline-embed');
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
if (this.options.is_full_embed) {
|
|
205
|
-
|
|
205
|
+
this._el.container.classList.add('tl-timeline-full-embed');
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
this._loadLanguage(data);
|
|
@@ -992,31 +992,23 @@ class Timeline {
|
|
|
992
992
|
this._el.container.focus();
|
|
993
993
|
}
|
|
994
994
|
|
|
995
|
-
_initGoogleAnalytics() {
|
|
996
|
-
(
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
a = s.createElement(o), m = s.getElementsByTagName(o)[0];
|
|
1002
|
-
a.async = 1;
|
|
1003
|
-
a.src = g;
|
|
1004
|
-
m.parentNode.insertBefore(a, m)
|
|
1005
|
-
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
|
|
1006
|
-
|
|
1007
|
-
ga('create', this.options.ga_property_id, 'auto');
|
|
1008
|
-
ga('set', 'anonymizeIp', true);
|
|
995
|
+
_initGoogleAnalytics(measurement_id) {
|
|
996
|
+
loadJS(`https://www.googletagmanager.com/gtag/js?id=${measurement_id}`)
|
|
997
|
+
window.dataLayer = window.dataLayer || [];
|
|
998
|
+
window.gtag = function(){dataLayer.push(arguments);}
|
|
999
|
+
gtag('js', new Date());
|
|
1000
|
+
gtag('config', measurement_id);
|
|
1009
1001
|
}
|
|
1010
1002
|
|
|
1011
1003
|
_initAnalytics() {
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1004
|
+
let measurement_id = this.options.ga_measurement_id || this.options.ga_property_id || null;
|
|
1005
|
+
if (!measurement_id) { return; }
|
|
1006
|
+
this._initGoogleAnalytics(measurement_id);
|
|
1015
1007
|
var events = this.options.track_events;
|
|
1016
1008
|
for (let i = 0; i < events.length; i++) {
|
|
1017
1009
|
var event_ = events[i];
|
|
1018
1010
|
this.addEventListener(event_, function(e) {
|
|
1019
|
-
|
|
1011
|
+
gtag('event', e.type);
|
|
1020
1012
|
});
|
|
1021
1013
|
}
|
|
1022
1014
|
}
|
|
@@ -2,7 +2,6 @@ import { classMixin, unlinkify, mergeData } from "../core/Util"
|
|
|
2
2
|
import Events from "../core/Events"
|
|
3
3
|
import { DOMMixins } from "../dom/DOMMixins"
|
|
4
4
|
import * as Browser from "../core/Browser"
|
|
5
|
-
import { removeClass } from "../dom/DOMUtil";
|
|
6
5
|
import { easeInSpline } from "../animation/Ease";
|
|
7
6
|
import * as DOM from "../dom/DOM"
|
|
8
7
|
|
|
@@ -156,7 +155,7 @@ export class TimeEra {
|
|
|
156
155
|
this.setPosition({ top: n });
|
|
157
156
|
|
|
158
157
|
if (remainder < 56) {
|
|
159
|
-
|
|
158
|
+
this._el.content_container.remove("tl-timeera-content-container-small");
|
|
160
159
|
}
|
|
161
160
|
}
|
|
162
161
|
|
|
@@ -3,7 +3,6 @@ import Events from "../core/Events"
|
|
|
3
3
|
import { DOMMixins } from "../dom/DOMMixins"
|
|
4
4
|
import { DOMEvent } from "../dom/DOMEvent"
|
|
5
5
|
|
|
6
|
-
import { addClass, removeClass } from "../dom/DOMUtil"
|
|
7
6
|
import * as DOM from "../dom/DOM"
|
|
8
7
|
import { webkit as BROWSER_WEBKIT } from "../core/Browser";
|
|
9
8
|
import { easeInSpline } from "../animation/Ease";
|
|
@@ -181,9 +180,9 @@ export class TimeMarker {
|
|
|
181
180
|
}
|
|
182
181
|
|
|
183
182
|
if (h <= 56) {
|
|
184
|
-
|
|
183
|
+
this._el.content_container.classList.add("tl-timemarker-content-container-small");
|
|
185
184
|
} else {
|
|
186
|
-
|
|
185
|
+
this._el.content_container.classList.remove("tl-timemarker-content-container-small");
|
|
187
186
|
}
|
|
188
187
|
|
|
189
188
|
// Handle number of lines visible vertically
|
package/src/template/index.html
CHANGED
package/src/js/dom/DOMUtil.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/* DomUtil
|
|
2
|
-
Inspired by Leaflet
|
|
3
|
-
DomUtil contains various utility functions for working with DOM
|
|
4
|
-
Why are they in DOMUtil and not DOM?
|
|
5
|
-
================================================== */
|
|
6
|
-
|
|
7
|
-
function hasClass(el, name) {
|
|
8
|
-
return (el.className.length > 0) &&
|
|
9
|
-
new RegExp("(^|\\s)" + name + "(\\s|$)").test(el.className);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function addClass(el, name) {
|
|
13
|
-
if (!hasClass(el, name)) {
|
|
14
|
-
el.className += (el.className ? ' ' : '') + name;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function removeClass(el, name) {
|
|
19
|
-
el.className = el.className.replace(/(\S+)\s*/g, function(w, match) {
|
|
20
|
-
if (match === name) {
|
|
21
|
-
return '';
|
|
22
|
-
}
|
|
23
|
-
return w;
|
|
24
|
-
}).replace(/^\s+/, '');
|
|
25
|
-
}
|