@knight-lab/timelinejs 3.8.20 → 3.8.21

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/css/fonts/font.abril-droidsans.css +3 -3
  3. package/dist/css/fonts/font.amatic-andika.css +3 -3
  4. package/dist/css/fonts/font.bevan-pontanosans.css +2 -2
  5. package/dist/css/fonts/font.bitter-raleway.css +4 -4
  6. package/dist/css/fonts/font.clicker-garamond.css +2 -2
  7. package/dist/css/fonts/font.dancing-ledger.css +3 -3
  8. package/dist/css/fonts/font.default.css +4 -4
  9. package/dist/css/fonts/font.fjalla-average.css +2 -2
  10. package/dist/css/fonts/font.lustria-lato.css +3 -3
  11. package/dist/css/fonts/font.medula-lato.css +4 -4
  12. package/dist/css/fonts/font.opensans-gentiumbook.css +4 -4
  13. package/dist/css/fonts/font.playfair-faunaone.css +5 -5
  14. package/dist/css/fonts/font.playfair.css +3 -3
  15. package/dist/css/fonts/font.pt.css +4 -4
  16. package/dist/css/fonts/font.roboto-megrim.css +3 -3
  17. package/dist/css/fonts/font.rufina-sintony.css +4 -4
  18. package/dist/css/fonts/font.ubuntu.css +3 -3
  19. package/dist/css/fonts/font.unicaone-vollkorn.css +3 -3
  20. package/dist/js/locale/nb.json +76 -0
  21. package/dist/js/locale/nn.json +76 -0
  22. package/dist/js/timeline-min.js +2 -10
  23. package/dist/js/timeline.js +2 -10
  24. package/dist/js/timeline.js.map +1 -1
  25. package/dist/timeline3.zip +0 -0
  26. package/jest.config.js +2 -0
  27. package/package.json +4 -3
  28. package/src/js/__tests__/Timeline.test.js +18 -13
  29. package/src/js/date/__tests__/TLDate.test.js +2 -2
  30. package/src/js/language/locale/nb.json +76 -0
  31. package/src/js/language/locale/nn.json +76 -0
  32. package/src/js/media/types/Audio.js +1 -10
  33. package/src/js/media/types/Image.js +1 -10
  34. package/src/js/media/types/Video.js +1 -9
  35. package/src/js/timeline/Timeline.js +6 -7
  36. package/src/js/timenav/TimeEra.js +0 -1
  37. package/src/template/all-media-types.json +21 -14
  38. package/src/template/index.html +4 -1
Binary file
package/jest.config.js CHANGED
@@ -1,3 +1,5 @@
1
+ process.env.TZ = 'UTC';
2
+
1
3
  // For a detailed explanation regarding each configuration property, visit:
2
4
  // https://jestjs.io/docs/en/configuration.html
3
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knight-lab/timelinejs",
3
- "version": "3.8.20",
3
+ "version": "3.8.21",
4
4
  "license": "MPL-2.0",
5
5
  "description": "TimelineJS v3: A Storytelling Timeline built in JavaScript, made by Northwestern University Knight Lab.",
6
6
  "dependencies": {
@@ -56,7 +56,8 @@
56
56
  "stage_latest": "npm run dist && node tasks/stage.js latest",
57
57
  "stage_dev": "npm run dist && node tasks/stage.js dev"
58
58
  },
59
- "contributors": [{
59
+ "contributors": [
60
+ {
60
61
  "name": "Zach Wise",
61
62
  "email": "wise@northwestern.edu",
62
63
  "url": "https://github.com/zachwise"
@@ -67,4 +68,4 @@
67
68
  "url": "https://github.com/JoeGermuska"
68
69
  }
69
70
  ]
70
- }
71
+ }
@@ -50,14 +50,18 @@ beforeEach(() => {
50
50
  '<div id="timeline-embed"></div>';
51
51
  })
52
52
 
53
- // these tests fail because the timeline config instantiation is async, and the test
54
- // proceeds before it's ready. I still haven't figured out how to make Jest wait
55
- // until it's actually ready, or maybe there's a different problem?
53
+ // Full timeline configuration is asynchronous, so these tests need
54
+ // to be deferred until the timeline is in a "ready" state.
55
+ // However, binding the promise resolution to timeline "on ready"
56
+ // results in test failures because of timeout, even when passing
57
+ // a longer timeout as the third argument to test (up to 10000ms tried)
58
+ // however, when they fire on dataloaded, they pass. This doesn't
59
+ // seem satisfying, but better than ignoring failed test results
60
+ // since passing is still passing.
56
61
  test("Ensure options is optional", async() => {
57
62
  let timeline = await new Promise((resolve) => {
58
63
  let tl = new Timeline('timeline-embed', TEST_CONFIG)
59
- debugger
60
- tl.on('ready', () => resolve(tl))
64
+ tl.on('dataloaded', () => resolve(tl))
61
65
  });
62
66
  // these tests will fail until we figure out how to deal with
63
67
  // the fact that the config creation/setting is async
@@ -65,14 +69,15 @@ test("Ensure options is optional", async() => {
65
69
  expect(timeline.config).toBeDefined()
66
70
  })
67
71
 
68
- // these tests fail because the timeline config instantiation is async, and the test
69
- // proceeds before it's ready. I still haven't figured out how to make Jest wait
70
- // until it's actually ready, or maybe there's a different problem?
71
- test("test remove", () => {
72
- let timeline = new Timeline('timeline-embed',
73
- TEST_CONFIG, { // i don't think this is actually used?
74
- script_path: 'http://localhost:1234/'
75
- });
72
+ test("test remove", async() => {
73
+ let timeline = await new Promise((resolve) => {
74
+ let tl = new Timeline('timeline-embed',
75
+ TEST_CONFIG, { // i don't think this is actually used?
76
+ script_path: 'http://localhost:1234/'
77
+ });
78
+ tl.on('dataloaded', () => resolve(tl))
79
+ })
80
+
76
81
  expect(timeline.config).toBeDefined()
77
82
  expect(timeline.config.events.length).toBe(2)
78
83
  expect(timeline.config.event_dict['vimeo']).toBeTruthy()
@@ -41,7 +41,7 @@ test("before and after", () => {
41
41
 
42
42
  test("small dates are human so time is UNIX Epoch based", () => {
43
43
  var smalldate = makeDate({ year: 2015 });
44
- expect(smalldate.getTime()).toBe(1420092000000)
44
+ expect(smalldate.getTime()).toBe(1420070400000)
45
45
  })
46
46
 
47
47
  test("big dates are cosmological", () => {
@@ -192,7 +192,7 @@ test("test TLDate.floor", () => {
192
192
 
193
193
  var early_ce = makeDate(-59149708181438); // 8/14/95 (95 not 1995)
194
194
  var floored = early_ce.floor('decade');
195
- expect(floored.getTime()).toBe(-59326970964000) // 'Early floored dates should not go into the 20th Century')
195
+ expect(floored.getTime()).toBe(-59326992000000) // 'Early floored dates should not go into the 20th Century')
196
196
 
197
197
  var age_scale = makeDate({ year: 1500000 });
198
198
  expect(() => {
@@ -0,0 +1,76 @@
1
+ {
2
+ "lang": "nb",
3
+ "date": {
4
+ "month_abbr": [
5
+ "Jan.",
6
+ "Feb.",
7
+ "Mars",
8
+ "Apr.",
9
+ "Mai",
10
+ "Juni",
11
+ "Juli",
12
+ "Aug.",
13
+ "Sep.",
14
+ "Okt.",
15
+ "Nov.",
16
+ "Des."
17
+ ],
18
+ "day_abbr": [
19
+ "Søn.",
20
+ "Man.",
21
+ "Tir.",
22
+ "Ons.",
23
+ "Tor.",
24
+ "Fre.",
25
+ "Lør."
26
+ ],
27
+ "day": [
28
+ "Søndag",
29
+ "Mandag",
30
+ "Tirsdag",
31
+ "Onsdag",
32
+ "Torsdag",
33
+ "Fredag",
34
+ "Lørdag"
35
+ ],
36
+ "month": [
37
+ "Januar",
38
+ "Februar",
39
+ "Mars",
40
+ "April",
41
+ "Mai",
42
+ "Juni",
43
+ "Juli",
44
+ "August",
45
+ "September",
46
+ "Oktober",
47
+ "November",
48
+ "Desember"
49
+ ]
50
+ },
51
+ "api": {
52
+ "wikipedia": "no"
53
+ },
54
+ "messages": {
55
+ "loading": "Laster",
56
+ "contract_timeline": "Krymp tidslinje",
57
+ "return_to_title": "Tilbake til tittel",
58
+ "wikipedia": "Fra Wikipedia, den frie encyklopedi",
59
+ "loading_content": "Laster innhold",
60
+ "expand_timeline": "Utvid tidslinje",
61
+ "loading_timeline": "Laster tidslinje... ",
62
+ "swipe_to_navigate": "Sveip for å navigere<br><span class='tl-button'>OK</span>"
63
+ },
64
+ "dateformats": {
65
+ "full_long": "dddd',' d. mmm',' yyyy 'kl.' HH:MM",
66
+ "full_short": "d. mmm",
67
+ "full": "d. mmmm',' yyyy",
68
+ "month_short": "mmm",
69
+ "time_no_seconds_small_date": "HH:MM'<br/><small>'d. mmmm',' yyyy'</small>'",
70
+ "month": "mmmm yyyy",
71
+ "time_no_seconds_short": "HH:MM",
72
+ "time_short": "HH:MM:ss",
73
+ "year": "yyyy",
74
+ "full_long_small_date": "HH:MM'<br/><small>'dddd',' d. mmm',' yyyy'</small>'"
75
+ }
76
+ }
@@ -0,0 +1,76 @@
1
+ {
2
+ "lang": "nn",
3
+ "date": {
4
+ "month_abbr": [
5
+ "Jan.",
6
+ "Feb.",
7
+ "Mars",
8
+ "Apr.",
9
+ "Mai",
10
+ "Juni",
11
+ "Juli",
12
+ "Aug.",
13
+ "Sep.",
14
+ "Okt.",
15
+ "Nov.",
16
+ "Des."
17
+ ],
18
+ "day_abbr": [
19
+ "Søn.",
20
+ "Mån.",
21
+ "Tys.",
22
+ "Ons.",
23
+ "Tor.",
24
+ "Fre.",
25
+ "Lau."
26
+ ],
27
+ "day": [
28
+ "Søndag",
29
+ "Måndag",
30
+ "Tysdag",
31
+ "Onsdag",
32
+ "Torsdag",
33
+ "Fredag",
34
+ "Laurdag"
35
+ ],
36
+ "month": [
37
+ "Januar",
38
+ "Februar",
39
+ "Mars",
40
+ "April",
41
+ "Mai",
42
+ "Juni",
43
+ "Juli",
44
+ "August",
45
+ "September",
46
+ "Oktober",
47
+ "November",
48
+ "Desember"
49
+ ]
50
+ },
51
+ "api": {
52
+ "wikipedia": "nn"
53
+ },
54
+ "messages": {
55
+ "loading": "Lastar",
56
+ "contract_timeline": "Krymp tidslinje",
57
+ "return_to_title": "Tilbake til tittel",
58
+ "wikipedia": "Frå Wikipedia, det frie oppslagsverket",
59
+ "loading_content": "Lastar innhold",
60
+ "expand_timeline": "Utvid tidslinje",
61
+ "loading_timeline": "Lastar tidslinje... ",
62
+ "swipe_to_navigate": "Sveip for å navigere<br><span class='tl-button'>OK</span>"
63
+ },
64
+ "dateformats": {
65
+ "full_long": "dddd',' d. mmm',' yyyy 'kl.' HH:MM",
66
+ "full_short": "d. mmm",
67
+ "full": "d. mmmm',' yyyy",
68
+ "month_short": "mmm",
69
+ "time_no_seconds_small_date": "HH:MM'<br/><small>'d. mmmm',' yyyy'</small>'",
70
+ "month": "mmmm yyyy",
71
+ "time_no_seconds_short": "HH:MM",
72
+ "time_short": "HH:MM:ss",
73
+ "year": "yyyy",
74
+ "full_long_small_date": "HH:MM'<br/><small>'dddd',' d. mmm',' yyyy'</small>'"
75
+ }
76
+ }
@@ -25,16 +25,7 @@ export default class Audio extends Media {
25
25
  var self = this,
26
26
  audio_class = "tl-media-item tl-media-audio tl-media-shadow";
27
27
 
28
- // Link
29
- if (this.data.link) {
30
- this._el.content_link = this.domCreate("a", "", this._el.content);
31
- this._el.content_link.href = this.data.link;
32
- this._el.content_link.target = "_blank";
33
- this._el.content_link.setAttribute('rel', 'noopener');
34
- this._el.content_item = this.domCreate("audio", audio_class, this._el.content_link);
35
- } else {
36
- this._el.content_item = this.domCreate("audio", audio_class, this._el.content);
37
- }
28
+ this._el.content_item = this.domCreate("audio", audio_class, this._el.content);
38
29
 
39
30
  this._el.content_item.controls = true;
40
31
  this._el.source_item = this.domCreate("source", "", this._el.content_item);
@@ -25,16 +25,7 @@ export default class Image extends Media {
25
25
  image_class = "tl-media-item tl-media-image"
26
26
  }
27
27
 
28
- // Link
29
- if (this.data.link) {
30
- this._el.content_link = this.domCreate("a", "", this._el.content);
31
- this._el.content_link.href = this.data.link;
32
- this._el.content_link.target = "_blank";
33
- this._el.content_link.setAttribute('rel', 'noopener');
34
- this._el.content_item = this.domCreate("img", image_class, this._el.content_link);
35
- } else {
36
- this._el.content_item = this.domCreate("img", image_class, this._el.content);
37
- }
28
+ this._el.content_item = this.domCreate("img", image_class, this._el.content);
38
29
 
39
30
  if (this.data.alt) {
40
31
  this._el.content_item.alt = this.data.alt;
@@ -25,15 +25,7 @@ export default class Video extends Media {
25
25
  video_class = "tl-media-item tl-media-video tl-media-shadow";
26
26
 
27
27
  // Link
28
- if (this.data.link) {
29
- this._el.content_link = this.domCreate("a", "", this._el.content);
30
- this._el.content_link.href = this.data.link;
31
- this._el.content_link.target = "_blank";
32
- this._el.content_link.setAttribute('rel', 'noopener')
33
- this._el.content_item = this.domCreate("video", video_class, this._el.content_link);
34
- } else {
35
- this._el.content_item = this.domCreate("video", video_class, this._el.content);
36
- }
28
+ this._el.content_item = this.domCreate("video", video_class, this._el.content);
37
29
 
38
30
  this._el.content_item.controls = true;
39
31
  this._el.source_item = this.domCreate("source", "", this._el.content_item);
@@ -770,6 +770,11 @@ class Timeline {
770
770
  if (this._loaded.storyslider && this._loaded.timenav) {
771
771
  this.fire("loaded", this.config);
772
772
  // Go to proper slide
773
+ if (isTrue(this.options.start_at_end) || this.options.start_at_slide > this.config.events.length) {
774
+ this.goToEnd();
775
+ } else {
776
+ this.goTo(this.options.start_at_slide);
777
+ }
773
778
  if (this.options.hash_bookmark) {
774
779
  if (window.location.hash != "") {
775
780
  this.goToId(window.location.hash.replace("#event-", ""));
@@ -782,12 +787,6 @@ class Timeline {
782
787
  the_timeline.goToId(window.location.hash.replace("#event-", ""));
783
788
  }
784
789
  }, false);
785
- } else {
786
- if (isTrue(this.options.start_at_end) || this.options.start_at_slide > this.config.events.length) {
787
- this.goToEnd();
788
- } else {
789
- this.goTo(this.options.start_at_slide);
790
- }
791
790
  }
792
791
 
793
792
  }
@@ -993,4 +992,4 @@ class Timeline {
993
992
 
994
993
  classMixin(Timeline, I18NMixins, Events)
995
994
 
996
- export { Timeline }
995
+ export { Timeline }
@@ -5,7 +5,6 @@ import * as Browser from "../core/Browser"
5
5
  import { removeClass } from "../dom/DOMUtil";
6
6
  import { easeInSpline } from "../animation/Ease";
7
7
  import * as DOM from "../dom/DOM"
8
- import { head } from "lodash";
9
8
 
10
9
  /**
11
10
  * A TimeEra represents a span of time marked along the edge of the time
@@ -259,9 +259,11 @@
259
259
  },
260
260
  {
261
261
  "media": {
262
- "url": "http://www.kidzone.ws/images-changed/sharks/head.jpg",
263
- "caption": "Sharks!",
264
- "credit": "Kid Zone"
262
+ "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Moraine_Lake_17092005.jpg/960px-Moraine_Lake_17092005.jpg",
263
+ "caption": "Valley of the Ten Peaks and Moraine Lake, Banff National Park, Canada.",
264
+ "credit": "Wikipedia Commons",
265
+ "link": "https://en.wikipedia.org/wiki/Rocky_Mountains#/media/File:Moraine_Lake_17092005.jpg",
266
+ "link_target": "images"
265
267
  },
266
268
  "start_date": {
267
269
  "year": "1915"
@@ -274,16 +276,18 @@
274
276
  },
275
277
  {
276
278
  "media": {
277
- "url": "https://media.giphy.com/media/nEZkc87t9u68U/source.gif",
279
+ "url": "https://media.giphy.com/media/Bzxeif0cR11ny/giphy.gif",
278
280
  "caption": "Groundhog Day clip",
279
- "credit": "USA Today"
281
+ "credit": "USA Today",
282
+ "link": "https://giphy.com/gifs/bored-bill-murray-groundhog-day-Bzxeif0cR11ny",
283
+ "link_target": "images"
280
284
  },
281
285
  "start_date": {
282
286
  "year": "1916"
283
287
  },
284
288
  "text": {
285
289
  "headline": "Image, GIF",
286
- "text": "To embed a GIF, just copy the URL endig in '.gif'."
290
+ "text": "To embed a GIF, just copy the URL ending in '.gif'."
287
291
  },
288
292
  "group": "Image"
289
293
  },
@@ -304,9 +308,11 @@
304
308
  },
305
309
  {
306
310
  "media": {
307
- "url": "http://upload.wikimedia.org/wikipedia/commons/c/c2/Rocky_Mountains.jpeg",
308
- "caption": "Rocky Mountains",
309
- "credit": "Wikipedia Commons"
311
+ "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Moraine_Lake_17092005.jpg/960px-Moraine_Lake_17092005.jpg",
312
+ "caption": "Valley of the Ten Peaks and Moraine Lake, Banff National Park, Canada.",
313
+ "credit": "Wikipedia Commons",
314
+ "link": "https://en.wikipedia.org/wiki/Rocky_Mountains#/media/File:Moraine_Lake_17092005.jpg",
315
+ "link_target": "images"
310
316
  },
311
317
  "start_date": {
312
318
  "year": "1918"
@@ -334,8 +340,9 @@
334
340
  {
335
341
  "media": {
336
342
  "url": "https://en.wikipedia.org/wiki/1997_International_Tennis_Championships_%E2%80%93_Doubles",
337
- "caption": "1997 Inrternational Tennis Championships - Doubles",
338
- "credit": "Wikipedia"
343
+ "caption": "1997 International Tennis Championships - Doubles",
344
+ "credit": "Wikipedia",
345
+ "link": "https://en.wikipedia.org/wiki/1997_International_Tennis_Championships_%E2%80%93_Doubles"
339
346
  },
340
347
  "start_date": {
341
348
  "year": "1920"
@@ -436,7 +443,7 @@
436
443
  },
437
444
  {
438
445
  "media": {
439
- "url": "https://file-examples.com/wp-content/uploads/2017/10/file-sample_150kB.pdf",
446
+ "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
440
447
  "credit": "file-examples.com"
441
448
  },
442
449
  "start_date": {
@@ -463,7 +470,7 @@
463
470
  },
464
471
  {
465
472
  "media": {
466
- "url": "https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4",
473
+ "url": "https://file-examples.com/storage/fef12739526267ac9a2b543/2017/04/file_example_MP4_480_1_5MG.mp4",
467
474
  "credit": "file-examples.com"
468
475
  },
469
476
  "start_date": {
@@ -478,7 +485,7 @@
478
485
  },
479
486
  {
480
487
  "media": {
481
- "url": "https://file-examples-com.github.io/uploads/2020/03/file_example_WEBM_480_900KB.webm",
488
+ "url": "https://file-examples.com/storage/fef12739526267ac9a2b543/2020/03/file_example_WEBM_480_900KB.webm",
482
489
  "credit": "file-examples.com"
483
490
  },
484
491
  "start_date": {
@@ -9,6 +9,8 @@
9
9
  debug: true,
10
10
  height: 650,
11
11
  soundcite: true,
12
+ hash_bookmark: true,
13
+ start_at_end: true,
12
14
  sheets_proxy: 'https://sheets-proxy.knightlab.com/proxy/'
13
15
  }
14
16
 
@@ -55,6 +57,7 @@
55
57
 
56
58
  document.querySelectorAll('nav a').forEach(el => {
57
59
  el.addEventListener('click', e => {
60
+ window.location.hash = ''
58
61
  e.preventDefault()
59
62
  let url = e.target.attributes['href'].value
60
63
  document.getElementById('timeline-src').value = url
@@ -91,7 +94,7 @@
91
94
  <body>
92
95
  <h1>Timeline Development</h1>
93
96
  <div>
94
- <label for="timeline-src">data source URL:</label><input type="text" size="120" name="timeline-src" id="timeline-src">
97
+ <label for="timeline-src">data source URL:</label><input type="text" size="120" name="timeline-src" id="timeline-src" />
95
98
  </div>
96
99
  <nav>
97
100
  <a href='https://docs.google.com/spreadsheets/u/1/d/1xuY4upIooEeszZ_lCmeNx24eSFWe0rHe9ZdqH2xqVNk/pubhtml'>Women in Computing</a>