@knight-lab/timelinejs 3.8.16 → 3.8.20

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 (307) hide show
  1. package/{CHANGELOG → CHANGELOG.md} +71 -8
  2. package/README.md +21 -19
  3. package/RELEASING.md +4 -4
  4. package/dist/css/fonts/font.abril-droidsans.css +143 -0
  5. package/dist/css/fonts/font.amatic-andika.css +143 -0
  6. package/dist/css/fonts/font.bevan-pontanosans.css +141 -0
  7. package/dist/css/fonts/font.bitter-raleway.css +149 -0
  8. package/dist/css/fonts/font.clicker-garamond.css +141 -0
  9. package/dist/css/fonts/font.dancing-ledger.css +143 -0
  10. package/dist/css/fonts/font.default.css +155 -0
  11. package/dist/css/fonts/font.fjalla-average.css +141 -0
  12. package/dist/css/fonts/font.georgia-helvetica.css +123 -0
  13. package/dist/css/fonts/font.knightlab.css +125 -0
  14. package/dist/css/fonts/font.lustria-lato.css +147 -0
  15. package/dist/css/fonts/font.medula-lato.css +149 -0
  16. package/dist/css/fonts/font.oldstandard.css +135 -0
  17. package/dist/css/fonts/font.opensans-gentiumbook.css +155 -0
  18. package/dist/css/fonts/font.playfair-faunaone.css +156 -0
  19. package/dist/css/fonts/font.playfair.css +143 -0
  20. package/dist/css/fonts/font.pt.css +153 -0
  21. package/dist/css/fonts/font.roboto-megrim.css +143 -0
  22. package/dist/css/fonts/font.rufina-sintony.css +149 -0
  23. package/dist/css/fonts/font.ubuntu.css +145 -0
  24. package/dist/css/fonts/font.unicaone-vollkorn.css +143 -0
  25. package/dist/css/icons/tl-icons.eot +0 -0
  26. package/dist/css/icons/tl-icons.svg +63 -0
  27. package/dist/css/icons/tl-icons.ttf +0 -0
  28. package/dist/css/icons/tl-icons.woff +0 -0
  29. package/dist/css/icons/tl-icons.woff2 +0 -0
  30. package/dist/css/themes/timeline.theme.contrast.css +3125 -0
  31. package/dist/css/themes/timeline.theme.dark.css +3125 -0
  32. package/dist/css/timeline.css +3128 -0
  33. package/dist/css/timeline.css.map +1 -0
  34. package/dist/embed/compare.html +91 -0
  35. package/dist/embed/index.html +170 -0
  36. package/dist/embed/old-index.html +170 -0
  37. package/dist/embed/popular_timelines.json +1 -0
  38. package/dist/js/locale/af.json +75 -0
  39. package/dist/js/locale/ar.json +76 -0
  40. package/dist/js/locale/be.json +75 -0
  41. package/dist/js/locale/bg.json +75 -0
  42. package/dist/js/locale/ca.json +75 -0
  43. package/dist/js/locale/cz.json +108 -0
  44. package/dist/js/locale/da.json +75 -0
  45. package/dist/js/locale/de.json +76 -0
  46. package/dist/js/locale/el.json +75 -0
  47. package/dist/js/locale/en-24hr.json +75 -0
  48. package/dist/js/locale/en-week.json +75 -0
  49. package/dist/js/locale/en.json +152 -0
  50. package/dist/js/locale/eo.json +75 -0
  51. package/dist/js/locale/es.json +76 -0
  52. package/dist/js/locale/et.json +75 -0
  53. package/dist/js/locale/eu.json +75 -0
  54. package/dist/js/locale/fa.json +74 -0
  55. package/dist/js/locale/fi.json +95 -0
  56. package/dist/js/locale/fo.json +75 -0
  57. package/dist/js/locale/fr.json +119 -0
  58. package/dist/js/locale/fy.json +75 -0
  59. package/dist/js/locale/ga.json +75 -0
  60. package/dist/js/locale/gl.json +75 -0
  61. package/dist/js/locale/he.json +76 -0
  62. package/dist/js/locale/hi.json +76 -0
  63. package/dist/js/locale/hr.json +75 -0
  64. package/dist/js/locale/hu.json +114 -0
  65. package/dist/js/locale/hy.json +75 -0
  66. package/dist/js/locale/id.json +75 -0
  67. package/dist/js/locale/is.json +75 -0
  68. package/dist/js/locale/it.json +92 -0
  69. package/dist/js/locale/iw.json +76 -0
  70. package/dist/js/locale/ja.json +75 -0
  71. package/dist/js/locale/ka.json +75 -0
  72. package/dist/js/locale/ko.json +75 -0
  73. package/dist/js/locale/lb.json +75 -0
  74. package/dist/js/locale/lt.json +75 -0
  75. package/dist/js/locale/lv.json +75 -0
  76. package/dist/js/locale/ms.json +75 -0
  77. package/dist/js/locale/my.json +124 -0
  78. package/dist/js/locale/ne.json +75 -0
  79. package/dist/js/locale/nl.json +75 -0
  80. package/dist/js/locale/no.json +76 -0
  81. package/dist/js/locale/pl.json +75 -0
  82. package/dist/js/locale/pt-br.json +78 -0
  83. package/dist/js/locale/pt.json +78 -0
  84. package/dist/js/locale/rm.json +75 -0
  85. package/dist/js/locale/ro.json +75 -0
  86. package/dist/js/locale/ru.json +75 -0
  87. package/dist/js/locale/si.json +74 -0
  88. package/dist/js/locale/sk.json +75 -0
  89. package/dist/js/locale/sl.json +75 -0
  90. package/dist/js/locale/sr-cy.json +75 -0
  91. package/dist/js/locale/sr.json +75 -0
  92. package/dist/js/locale/sv.json +86 -0
  93. package/dist/js/locale/ta.json +75 -0
  94. package/dist/js/locale/te.json +74 -0
  95. package/dist/js/locale/th.json +108 -0
  96. package/dist/js/locale/tl.json +75 -0
  97. package/dist/js/locale/tr.json +75 -0
  98. package/dist/js/locale/uk.json +75 -0
  99. package/dist/js/locale/ur.json +123 -0
  100. package/dist/js/locale/vi.json +74 -0
  101. package/dist/js/locale/zh-cn.json +76 -0
  102. package/dist/js/locale/zh-tw.json +75 -0
  103. package/dist/js/timeline-min.js +12 -0
  104. package/dist/js/timeline.js +12 -0
  105. package/dist/js/timeline.js.map +1 -0
  106. package/dist/timeline3.zip +0 -0
  107. package/index.js +1 -0
  108. package/package.json +4 -4
  109. package/src/embed/old-index.html +128 -18
  110. package/src/js/__tests__/Timeline.test.js +18 -3
  111. package/src/js/core/Util.js +1 -1
  112. package/src/js/index.js +1 -1
  113. package/src/js/language/locale/zh-cn.json +1 -1
  114. package/src/js/media/MediaType.js +1 -1
  115. package/src/js/media/types/Audio.js +15 -1
  116. package/src/js/media/types/Image.js +2 -2
  117. package/src/js/media/types/PDF.js +2 -2
  118. package/src/js/media/types/Video.js +17 -1
  119. package/src/js/timeline/Timeline.js +7 -12
  120. package/src/less/fonts/font.georgia-helvetica.less +2 -2
  121. package/src/less/fonts/font.roboto-megrim.less +2 -2
  122. package/src/template/all-media-types.json +61 -24
  123. package/src/template/index.html +39 -19
  124. package/{contrib/women_in_computing.csv → src/template/my-own-timeline.csv} +5 -5
  125. package/contrib/README.md +0 -13
  126. package/contrib/csv_to_json.py +0 -106
  127. package/contrib/docs/ImageHosting.md +0 -120
  128. package/contrib/examples/autoload.html +0 -44
  129. package/contrib/examples/iBooksAuthor/README.md +0 -37
  130. package/contrib/examples/iBooksAuthor/TimelineJS.wdgt/Default.png +0 -0
  131. package/contrib/examples/iBooksAuthor/TimelineJS.wdgt/Info.plist +0 -27
  132. package/contrib/examples/iBooksAuthor/TimelineJS.wdgt/index.html +0 -13
  133. package/contrib/examples/react.html +0 -40
  134. package/contrib/examples/vue.html +0 -29
  135. package/contrib/fedorbeets/README.md +0 -3
  136. package/contrib/fedorbeets/timeline.py.txt +0 -56
  137. package/contrib/iamamoose/README.md +0 -3
  138. package/contrib/iamamoose/timeline.py.txt +0 -53
  139. package/contrib/women_in_computing.json +0 -263
  140. package/fabfile.py +0 -64
  141. package/requirements.txt +0 -29
  142. package/util/convert_json.py +0 -96
  143. package/website/__init__.py +0 -0
  144. package/website/app.py +0 -101
  145. package/website/core/__init__.py +0 -0
  146. package/website/core/settings/__init__.py +0 -0
  147. package/website/core/settings/base.py +0 -6
  148. package/website/core/settings/loc.py +0 -16
  149. package/website/examples.json +0 -114
  150. package/website/faq.json +0 -81
  151. package/website/static/css/desert.css +0 -34
  152. package/website/static/css/site.css +0 -74
  153. package/website/static/img/TimelineJSTags.jpg +0 -0
  154. package/website/static/img/examples/houston/eyesclosedftm_10001.jpg +0 -0
  155. package/website/static/img/examples/houston/family.jpg +0 -0
  156. package/website/static/img/examples/houston/family.png +0 -0
  157. package/website/static/img/examples/houston/wh1.jpg +0 -0
  158. package/website/static/img/examples/houston/wh2.jpg +0 -0
  159. package/website/static/img/examples/houston/wh3.jpg +0 -0
  160. package/website/static/img/examples/houston/whChild.jpg +0 -0
  161. package/website/static/img/examples/houston/whlead.jpg +0 -0
  162. package/website/static/img/examples/houston/young.jpg +0 -0
  163. package/website/static/img/examples/logos/Northwestern University.png +0 -0
  164. package/website/static/img/examples/logos/Social-Logos.png +0 -0
  165. package/website/static/img/examples/logos/knightlab-logo-background.png +0 -0
  166. package/website/static/img/examples/logos/knightlab-logo-small.png +0 -0
  167. package/website/static/img/examples/logos/knightlab-logo.png +0 -0
  168. package/website/static/img/examples/logos/less-small.png +0 -0
  169. package/website/static/img/examples/logos/logo_aljazeera.png +0 -0
  170. package/website/static/img/examples/logos/logo_arte.png +0 -0
  171. package/website/static/img/examples/logos/logo_beyondtheseal.png +0 -0
  172. package/website/static/img/examples/logos/logo_centerforpublicintegrity.png +0 -0
  173. package/website/static/img/examples/logos/logo_cnn.png +0 -0
  174. package/website/static/img/examples/logos/logo_denverpost.png +0 -0
  175. package/website/static/img/examples/logos/logo_engadget.png +0 -0
  176. package/website/static/img/examples/logos/logo_gigaom.png +0 -0
  177. package/website/static/img/examples/logos/logo_ibt.png +0 -0
  178. package/website/static/img/examples/logos/logo_knightlab.png +0 -0
  179. package/website/static/img/examples/logos/logo_ksat.png +0 -0
  180. package/website/static/img/examples/logos/logo_lemonde.png +0 -0
  181. package/website/static/img/examples/logos/logo_maneater.png +0 -0
  182. package/website/static/img/examples/logos/logo_mashable.png +0 -0
  183. package/website/static/img/examples/logos/logo_radiolab.png +0 -0
  184. package/website/static/img/examples/logos/logo_time.png +0 -0
  185. package/website/static/img/examples/logos/logo_vh1.png +0 -0
  186. package/website/static/img/examples/logos/logo_vinepair.png +0 -0
  187. package/website/static/img/examples/logos/logo_wbur.png +0 -0
  188. package/website/static/img/examples/thumbs/thumb_akira.jpg +0 -0
  189. package/website/static/img/examples/thumbs/thumb_aljazeera.jpg +0 -0
  190. package/website/static/img/examples/thumbs/thumb_artetv.jpg +0 -0
  191. package/website/static/img/examples/thumbs/thumb_banana.png +0 -0
  192. package/website/static/img/examples/thumbs/thumb_bulger.jpg +0 -0
  193. package/website/static/img/examples/thumbs/thumb_denver_shooting.jpg +0 -0
  194. package/website/static/img/examples/thumbs/thumb_houston.jpg +0 -0
  195. package/website/static/img/examples/thumbs/thumb_isis.jpg +0 -0
  196. package/website/static/img/examples/thumbs/thumb_lemonde.jpg +0 -0
  197. package/website/static/img/examples/thumbs/thumb_malaysia-airlines.jpg +0 -0
  198. package/website/static/img/examples/thumbs/thumb_mandela.jpg +0 -0
  199. package/website/static/img/examples/thumbs/thumb_mobile_device.jpg +0 -0
  200. package/website/static/img/examples/thumbs/thumb_northkorea.jpg +0 -0
  201. package/website/static/img/examples/thumbs/thumb_perpwalk.jpg +0 -0
  202. package/website/static/img/examples/thumbs/thumb_radiolab-colorwalking.jpg +0 -0
  203. package/website/static/img/examples/thumbs/thumb_republican.jpg +0 -0
  204. package/website/static/img/examples/thumbs/thumb_shtpeoplesay.jpg +0 -0
  205. package/website/static/img/examples/thumbs/thumb_supremecourt.jpg +0 -0
  206. package/website/static/img/examples/thumbs/thumb_univofmissouri.jpg +0 -0
  207. package/website/static/img/examples/thumbs/thumb_userinterface.png +0 -0
  208. package/website/static/img/examples/thumbs/thumb_wine.jpg +0 -0
  209. package/website/static/img/examples/user-interface/4s.jpg +0 -0
  210. package/website/static/img/examples/user-interface/apple.jpg +0 -0
  211. package/website/static/img/examples/user-interface/input.png +0 -0
  212. package/website/static/img/examples/user-interface/palm.png +0 -0
  213. package/website/static/img/examples/user-interface/pascaline.jpg +0 -0
  214. package/website/static/img/examples/user-interface/univac.JPG +0 -0
  215. package/website/static/img/font-options.png +0 -0
  216. package/website/static/img/kl-og.png +0 -0
  217. package/website/static/img/knightlab_logo.png +0 -0
  218. package/website/static/img/loading.gif +0 -0
  219. package/website/static/img/make/abril-droidsans.png +0 -0
  220. package/website/static/img/make/amatic-andika.png +0 -0
  221. package/website/static/img/make/bevan-pontanosans.png +0 -0
  222. package/website/static/img/make/bitter-raleway.png +0 -0
  223. package/website/static/img/make/clicker-garamond.png +0 -0
  224. package/website/static/img/make/dancing-ledger.png +0 -0
  225. package/website/static/img/make/default.png +0 -0
  226. package/website/static/img/make/fakedropdown.svg +0 -1
  227. package/website/static/img/make/fjalla-average.png +0 -0
  228. package/website/static/img/make/font-options.png +0 -0
  229. package/website/static/img/make/georgia-helvetica.png +0 -0
  230. package/website/static/img/make/lustria-lato.png +0 -0
  231. package/website/static/img/make/medula-lato.png +0 -0
  232. package/website/static/img/make/oldstandard.png +0 -0
  233. package/website/static/img/make/opensans-gentiumbook.png +0 -0
  234. package/website/static/img/make/playfair-faunaone.png +0 -0
  235. package/website/static/img/make/playfair.png +0 -0
  236. package/website/static/img/make/pt.png +0 -0
  237. package/website/static/img/make/publish_to_web_browser_url.png +0 -0
  238. package/website/static/img/make/publish_to_web_button_small-od1.png +0 -0
  239. package/website/static/img/make/publish_to_web_button_small.png +0 -0
  240. package/website/static/img/make/publish_to_web_small.png +0 -0
  241. package/website/static/img/make/publish_to_web_url_small.png +0 -0
  242. package/website/static/img/make/roboto-megrim.png +0 -0
  243. package/website/static/img/make/rufina-sintony.png +0 -0
  244. package/website/static/img/make/unicaone-vollkorn.png +0 -0
  245. package/website/static/img/make/v4_step_1.png +0 -0
  246. package/website/static/img/make/v4_step_2.png +0 -0
  247. package/website/static/img/timeline.png +0 -0
  248. package/website/static/img/timeline3_intro_image.png +0 -0
  249. package/website/static/js/faq-generator.js +0 -20
  250. package/website/static/js/main.js +0 -240
  251. package/website/static/welcome/step3.png +0 -0
  252. package/website/static/welcome/welcome.json +0 -266
  253. package/website/templates/_about.html +0 -23
  254. package/website/templates/_analytics.html +0 -10
  255. package/website/templates/_banner.html +0 -26
  256. package/website/templates/_demo.html +0 -5
  257. package/website/templates/_developers.html +0 -19
  258. package/website/templates/_examples.html +0 -156
  259. package/website/templates/_faq.html +0 -117
  260. package/website/templates/_footer.html +0 -54
  261. package/website/templates/_head.html +0 -38
  262. package/website/templates/_header.html +0 -18
  263. package/website/templates/_help.html +0 -50
  264. package/website/templates/_make.html +0 -291
  265. package/website/templates/_nav.html +0 -24
  266. package/website/templates/_overview.html +0 -32
  267. package/website/templates/_roadmap.html +0 -27
  268. package/website/templates/_storytelling_tools.html +0 -35
  269. package/website/templates/base.html +0 -37
  270. package/website/templates/docs/faq.html +0 -223
  271. package/website/templates/docs/index.html +0 -57
  272. package/website/templates/docs/instantiate-a-timeline.html +0 -207
  273. package/website/templates/docs/json-format.html +0 -477
  274. package/website/templates/docs/license.html +0 -29
  275. package/website/templates/docs/media-types.html +0 -82
  276. package/website/templates/docs/options.html +0 -503
  277. package/website/templates/docs/overriding-styles.html +0 -357
  278. package/website/templates/docs/using-spreadsheets.html +0 -94
  279. package/website/templates/error.html +0 -28
  280. package/website/templates/examples/_common_example_embed.html +0 -27
  281. package/website/templates/examples/embed-test/index.html +0 -41
  282. package/website/templates/examples/example.json +0 -328
  283. package/website/templates/examples/houston/index.html +0 -40
  284. package/website/templates/examples/houston/timeline2.json +0 -218
  285. package/website/templates/examples/houston/timeline3.json +0 -271
  286. package/website/templates/examples/mediatypes/index.html +0 -61
  287. package/website/templates/examples/mediatypes/timeline3.json +0 -421
  288. package/website/templates/examples/republican/index.html +0 -49
  289. package/website/templates/examples/republican/timeline2.json +0 -0
  290. package/website/templates/examples/republican/timeline3.json +0 -238
  291. package/website/templates/examples/shit-people-say/index.html +0 -39
  292. package/website/templates/examples/shit-people-say/timeline2.json +0 -243
  293. package/website/templates/examples/shit-people-say/timeline3.json +0 -336
  294. package/website/templates/examples/soundcite/index.html +0 -42
  295. package/website/templates/examples/soundcite/timeline3.json +0 -271
  296. package/website/templates/examples/timeline3.json +0 -271
  297. package/website/templates/examples/twain/index.html +0 -85
  298. package/website/templates/examples/twain/marktwain.json +0 -502
  299. package/website/templates/examples/user-interface/index.html +0 -40
  300. package/website/templates/examples/user-interface/timeline2.json +0 -260
  301. package/website/templates/examples/user-interface/timeline3.json +0 -327
  302. package/website/templates/index.html +0 -17
  303. package/website/templates/mediatype-tests.html +0 -121
  304. package/website/templates/test/GoogleSpreadsheetFeedLegacyFormat.json +0 -1
  305. package/website/templates/test/GoogleSpreadsheetFeedTJS3Format.json +0 -1
  306. package/website/templates/test/maps.html +0 -4
  307. package/website/templates/unit-tests.html +0 -775
Binary file
package/index.js ADDED
@@ -0,0 +1 @@
1
+ export { Timeline } from './src/js/index.js';
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@knight-lab/timelinejs",
3
- "version": "3.8.16",
3
+ "version": "3.8.20",
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": {
7
- "dompurify": "^2.0.11"
7
+ "dompurify": "^2.2.7"
8
8
  },
9
9
  "devDependencies": {
10
- "@babel/cli": "^7.10.1",
10
+ "@babel/cli": "^7.14.3",
11
11
  "@babel/core": "^7.10.2",
12
12
  "@babel/preset-env": "^7.10.2",
13
13
  "adm-zip": "^0.4.14",
@@ -22,7 +22,7 @@
22
22
  "jest": "^25.5.4",
23
23
  "less": "^3.11.3",
24
24
  "less-loader": "^6.1.1",
25
- "lodash": "^4.17.19",
25
+ "lodash": "^4.17.21",
26
26
  "mini-css-extract-plugin": "^0.9.0",
27
27
  "npm-run-all": "^4.1.5",
28
28
  "prompt": "^1.0.0",
@@ -8,8 +8,21 @@
8
8
  <meta name="apple-mobile-web-app-capable" content="yes">
9
9
  <meta name="apple-touch-fullscreen" content="yes">
10
10
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
11
- <link rel="icon" type="image/png" href="https://cdn.knightlab.com/libs/purpleline/latest/img/favicon.png">
12
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
11
+ <!-- FAVICONS -->
12
+ <link rel="apple-touch-icon" sizes="180x180" href="https://cdn.knightlab.com/libs/orangeline/latest/assets/favicons/apple-touch-icon.png">
13
+ <link rel="icon" type="image/png" href="https://cdn.knightlab.com/libs/orangeline/latest/assets/favicons/favicon-32x32.png" sizes="32x32">
14
+ <link rel="icon" type="image/png" href="https://cdn.knightlab.com/libs/orangeline/latest/assets/favicons/favicon-16x16.png" sizes="16x16">
15
+ <link rel="manifest" href="https://cdn.knightlab.com/libs/orangeline/latest/assets/favicons/manifest.json">
16
+ <link rel="mask-icon" href="https://cdn.knightlab.com/libs/orangeline/latest/assets/favicons/safari-pinned-tab.svg" color="#5bbad5">
17
+ <!--
18
+ If we want to support loading different versions of timeline like we used to,
19
+ this isn't good enough. We used that to get the non-minimized version, for debugging,
20
+ but now maybe sourcemaps are a better alternative?
21
+ -->
22
+ <script id='timeline-script-tag' type="text/javascript" src="https://cdn.knightlab.com/libs/timeline3/3.8.1/js/timeline.js"></script>
23
+ <link rel="stylesheet" href="https://cdn.knightlab.com/libs/timeline3/3.8.1/css/timeline.css">
24
+ <!-- Google Analytics should be handled by Timeline -->
25
+
13
26
  <base target="_blank">
14
27
 
15
28
  <!-- Style-->
@@ -36,25 +49,122 @@
36
49
  <div id="timeline-embed"></div>
37
50
  <!-- Override -->
38
51
  <script type="text/javascript">
39
- var lang = window.location.href.match(/&lang=([a-zA-Z]*)&?/);
52
+ function ready(fn) {
53
+ if (document.readyState != 'loading') {
54
+ fn();
55
+ } else {
56
+ document.addEventListener('DOMContentLoaded', fn);
57
+ }
58
+ }
59
+
60
+ function setPageLanguage() {
61
+ var lang = window.location.href.match(/&lang=([a-zA-Z]*?)&?/);
62
+
63
+ if (lang) {
64
+ document.getElementsByTagName('html')[0].setAttribute('lang', lang[1]);
65
+ }
40
66
 
41
- if (lang) {
42
- document.getElementsByTagName('html')[0].setAttribute('lang', lang[1]);
43
67
  }
44
- var trim_point = window.location.href.indexOf('embed/index.html');
45
- if (trim_point > 0) {
46
- var embed_path = window.location.href.substring(0, trim_point); // supports https access via https://s3.amazonaws.com/cdn.knightlab.com/libs/timeline/latest/embed/index.html
47
- } else {
48
- var embed_path = "https://cdn.knightlab.com/libs/timeline3/3.6.6/";
68
+
69
+ function computeEmbedPath() {
70
+ var trim_point = window.location.href.indexOf('embed/index.html');
71
+ if (trim_point > 0) {
72
+ return window.location.href.substring(0, trim_point); // supports https access via https://s3.amazonaws.com/cdn.knightlab.com/libs/timeline/latest/embed/index.html
73
+ }
74
+ return "https://cdn.knightlab.com/libs/timeline3/latest/";
75
+ }
76
+
77
+ function addOembedTag() {
78
+ // it's not clear that any tools execute this JS to get the URL, but maybe?
79
+ var oembed_link = document.createElement('link');
80
+ oembed_link['rel'] = 'alternate';
81
+ oembed_link['type'] = 'application/json+oembed';
82
+ oembed_link['href'] = 'https://oembed.knightlab.com/timeline/?url=' + encodeURIComponent(window.location.href);
83
+ document.head.appendChild(oembed_link);
84
+ }
85
+
86
+ function createEmbedDiv(containerId, width, height) {
87
+
88
+ if (typeof(width) != 'string' && typeof(width) != 'number') {
89
+ width = '100%'
90
+ }
91
+
92
+ if (typeof(height) != 'string' && typeof(height) != 'number') {
93
+ height = '100%'
94
+ }
95
+
96
+ // default containerId would be 'timeline-embed'
97
+ t = document.createElement('div');
98
+ t.style.position = 'relative';
99
+
100
+ te = document.getElementById(containerId);
101
+ te.appendChild(t);
102
+ te.classList.add("tl-timeline-embed");
103
+
104
+ if (width.toString().match("%")) {
105
+ te.style.width = width.split("%")[0] + "%";
106
+ } else {
107
+ width = Number(width) - 2;
108
+ te.style.width = (width) + 'px';
109
+ }
110
+
111
+ if (height.toString().match("%")) {
112
+ te.style.height = height;
113
+ te.classList.add("tl-timeline-full-embed");
114
+ } else if (width.toString().match("%")) {
115
+ te.classList.add("tl-timeline-full-embed");
116
+ height = Number(height) - 16;
117
+ te.style.height = (height) + 'px';
118
+ } else {
119
+ height = height - 16;
120
+ te.style.height = (height) + 'px';
121
+ }
49
122
  }
50
- var oembed_link = document.createElement('link');
51
- oembed_link['rel'] = 'alternate';
52
- oembed_link['type'] = 'application/json+oembed';
53
- oembed_link['href'] = 'https://oembed.knightlab.com/timeline/?url=' + encodeURIComponent(window.location.href);
54
- document.head.appendChild(oembed_link);
123
+
124
+ /**
125
+ * Parse all URL parameters as possible Timeline options.
126
+ * Timeline itself will use or ignore these based on actual
127
+ * supported options.
128
+ */
129
+ function optionsFromUrlParams() {
130
+ var param_str = window.location.href.slice(window.location.href.indexOf('?') + 1);
131
+
132
+ if (param_str.match('#')) {
133
+ param_str = param_str.split('#')[0];
134
+ }
135
+
136
+ param_str = param_str.split('&');
137
+
138
+ var url_vars = {}
139
+
140
+ for (var i = 0; i < param_str.length; i++) {
141
+ var uv = param_str[i].split('=');
142
+ url_vars[uv[0]] = uv[1];
143
+ }
144
+
145
+ return url_vars;
146
+ };
147
+
148
+ ready(function() {
149
+ setPageLanguage();
150
+ var embed_path = computeEmbedPath();
151
+ addOembedTag();
152
+
153
+ var options = optionsFromUrlParams();
154
+ createEmbedDiv('timeline-embed', options.width, options.height);
155
+ // ga_property_id is not something we let users override
156
+ options.ga_property_id = 'UA-27829802-4';
157
+ if (typeof(options.source) == 'undefined') {
158
+ options.source = '1xuY4upIooEeszZ_lCmeNx24eSFWe0rHe9ZdqH2xqVNk' // women in computing
159
+ }
160
+
161
+ options.soundcite = true;
162
+
163
+ window.options = options
164
+ window.timeline = new TL.Timeline('timeline-embed', options.source, options)
165
+
166
+ })
55
167
  </script>
56
- <script type="text/javascript" src="https://cdn.knightlab.com/libs/timeline3/3.6.6/js/timeline-embed-cdn.js"></script>
57
- <!-- END Timeline Embed-->
58
168
  </body>
59
169
 
60
- </html>
170
+ </html>
@@ -49,16 +49,31 @@ beforeEach(() => {
49
49
  document.body.innerHTML =
50
50
  '<div id="timeline-embed"></div>';
51
51
  })
52
- test("Ensure options is optional", () => {
53
- let timeline = new Timeline('timeline-embed', TEST_CONFIG);
54
- // it would have errored
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?
56
+ test("Ensure options is optional", async() => {
57
+ let timeline = await new Promise((resolve) => {
58
+ let tl = new Timeline('timeline-embed', TEST_CONFIG)
59
+ debugger
60
+ tl.on('ready', () => resolve(tl))
61
+ });
62
+ // these tests will fail until we figure out how to deal with
63
+ // the fact that the config creation/setting is async
64
+ // tried some things waiting for
65
+ expect(timeline.config).toBeDefined()
55
66
  })
56
67
 
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?
57
71
  test("test remove", () => {
58
72
  let timeline = new Timeline('timeline-embed',
59
73
  TEST_CONFIG, { // i don't think this is actually used?
60
74
  script_path: 'http://localhost:1234/'
61
75
  });
76
+ expect(timeline.config).toBeDefined()
62
77
  expect(timeline.config.events.length).toBe(2)
63
78
  expect(timeline.config.event_dict['vimeo']).toBeTruthy()
64
79
  timeline.removeId('vimeo')
@@ -521,7 +521,7 @@ export function linkify(text, targets, is_touch) {
521
521
  * as a direct image link. Some services have predictable transformations we can use rather than explain to people
522
522
  * this subtlety.
523
523
  */
524
- export function transformImageURL(url) {
524
+ export function transformMediaURL(url) {
525
525
  return url.replace(/(.*)www.dropbox.com\/(.*)/, '$1dl.dropboxusercontent.com/$2')
526
526
  }
527
527
 
package/src/js/index.js CHANGED
@@ -1,4 +1,4 @@
1
- require('../less/TL.Timeline.less')
1
+ import "../less/TL.Timeline.less"
2
2
  export { Timeline }
3
3
  from "./timeline/Timeline"
4
4
  export { parseGoogleSpreadsheetURL }
@@ -59,7 +59,7 @@
59
59
  "loading_content": "正在加载内容",
60
60
  "expand_timeline": "伸展时间",
61
61
  "loading_timeline": "加载时间线... ",
62
- "swipe_to_navigate": "左右撥來瀏覽<br><span class='tl-button'>OK</span>"
62
+ "swipe_to_navigate": "左右拨来浏览<br><span class='tl-button'>OK</span>"
63
63
  },
64
64
  "dateformats": {
65
65
  "full_long": "dddd',' yyyy年 mmm d日'um' HH:MM",
@@ -184,7 +184,7 @@ export function lookupMediaType(m, image_only) {
184
184
  {
185
185
  type: "video",
186
186
  name: "Video",
187
- match_str: /(mp4)(\?.*)?$/i,
187
+ match_str: /(mp4|webm)(\?.*)?$/i,
188
188
  cls: Video
189
189
  },
190
190
  {
@@ -1,5 +1,7 @@
1
1
  import { Media } from "../Media";
2
+ import { transformMediaURL } from "../../core/Util";
2
3
  import * as Browser from "../../core/Browser"
4
+ import { trace } from "../../core/Util";
3
5
 
4
6
  export default class Audio extends Media {
5
7
  _loadMedia() {
@@ -16,6 +18,10 @@ export default class Audio extends Media {
16
18
  }
17
19
 
18
20
  createMedia() {
21
+ //Transform URL for Dropbox
22
+ var url = transformMediaURL(this.data.url),
23
+ self = this;
24
+
19
25
  var self = this,
20
26
  audio_class = "tl-media-item tl-media-audio tl-media-shadow";
21
27
 
@@ -38,9 +44,10 @@ export default class Audio extends Media {
38
44
  self.onMediaLoaded();
39
45
  });
40
46
 
41
- this._el.source_item.src = this.data.url;
47
+ this._el.source_item.src = url;
42
48
  this._el.source_item.type = this._getType(this.data.url, this.data.mediatype.match_str);
43
49
  this._el.content_item.innerHTML += "Your browser doesn't support HTML5 audio with " + this._el.source_item.type;
50
+ this.player_element = this._el.content_item
44
51
  }
45
52
 
46
53
  _updateMediaDisplay(layout) {
@@ -49,6 +56,13 @@ export default class Audio extends Media {
49
56
  }
50
57
  }
51
58
 
59
+ _stopMedia() {
60
+ if (this.player_element) {
61
+ this.player_element.pause()
62
+ }
63
+ }
64
+
65
+
52
66
  _getType(url, reg) {
53
67
  var ext = url.match(reg);
54
68
  var type = "audio/"
@@ -1,5 +1,5 @@
1
1
  import { Media } from "../Media"
2
- import { unhtmlify, transformImageURL } from "../../core/Util"
2
+ import { unhtmlify, transformMediaURL } from "../../core/Util"
3
3
  import * as Browser from "../../core/Browser"
4
4
 
5
5
  export default class Image extends Media {
@@ -57,7 +57,7 @@ export default class Image extends Media {
57
57
  }
58
58
 
59
59
  getImageURL(w, h) {
60
- return transformImageURL(this.data.url);
60
+ return transformMediaURL(this.data.url);
61
61
  }
62
62
 
63
63
  _updateMediaDisplay(layout) {
@@ -1,11 +1,11 @@
1
1
  import { Media } from "../Media";
2
- import { transformImageURL } from "../../core/Util";
2
+ import { transformMediaURL } from "../../core/Util";
3
3
  import * as Browser from "../../core/Browser"
4
4
 
5
5
  export default class PDF extends Media {
6
6
 
7
7
  _loadMedia() {
8
- var url = transformImageURL(this.data.url),
8
+ var url = transformMediaURL(this.data.url),
9
9
  self = this;
10
10
 
11
11
  // Create Dom element
@@ -1,5 +1,6 @@
1
1
  import { Media } from "../Media";
2
2
  import * as Browser from "../../core/Browser"
3
+ import { transformMediaURL } from "../../core/Util";
3
4
 
4
5
  export default class Video extends Media {
5
6
  _loadMedia() {
@@ -16,6 +17,10 @@ export default class Video extends Media {
16
17
  }
17
18
 
18
19
  createMedia() {
20
+ //Transform URL for Dropbox
21
+ var url = transformMediaURL(this.data.url),
22
+ self = this;
23
+
19
24
  var self = this,
20
25
  video_class = "tl-media-item tl-media-video tl-media-shadow";
21
26
 
@@ -38,9 +43,11 @@ export default class Video extends Media {
38
43
  self.onMediaLoaded();
39
44
  });
40
45
 
41
- this._el.source_item.src = this.data.url;
46
+ this._el.source_item.src = url;
42
47
  this._el.source_item.type = this._getType(this.data.url, this.data.mediatype.match_str);
43
48
  this._el.content_item.innerHTML += "Your browser doesn't support HTML5 video with " + this._el.source_item.type;
49
+ this.player_element = this._el.content_item
50
+
44
51
  }
45
52
 
46
53
  _updateMediaDisplay(layout) {
@@ -49,6 +56,12 @@ export default class Video extends Media {
49
56
  }
50
57
  }
51
58
 
59
+ _stopMedia() {
60
+ if (this.player_element) {
61
+ this.player_element.pause()
62
+ }
63
+ }
64
+
52
65
  _getType(url, reg) {
53
66
  var ext = url.match(reg);
54
67
  var type = "video/"
@@ -56,6 +69,9 @@ export default class Video extends Media {
56
69
  case "mp4":
57
70
  type += "mp4";
58
71
  break;
72
+ case "webm":
73
+ type += "webm";
74
+ break;
59
75
  default:
60
76
  type = "video";
61
77
  break;
@@ -50,8 +50,13 @@ function make_keydown_handler(timeline) {
50
50
  * @constructor
51
51
  * @param {HTMLElement|string} elem - the HTML element, or its ID, to which
52
52
  * the Timeline should be bound
53
- * @param {object} - a JavaScript object conforming to the TimelineJS
54
- * configuration format
53
+ * @param {object|String} - a JavaScript object conforming to the TimelineJS
54
+ * configuration format, or a String which is the URL for a Google Sheets document
55
+ * or JSON configuration file which Timeline will retrieve and parse into a JavaScript object.
56
+ * NOTE: do not pass a JSON String for this. TimelineJS doesn't try to distinguish a
57
+ * JSON string from a URL string. If you have a JSON String literal, parse it using
58
+ * `JSON.parse` before passing it to the constructor.
59
+ *
55
60
  * @param {object} [options] - a JavaScript object specifying
56
61
  * presentation options
57
62
  */
@@ -761,16 +766,6 @@ class Timeline {
761
766
  return -1;
762
767
  }
763
768
 
764
- _onTimeNavLoaded() {
765
- this._loaded.timenav = true;
766
- this._onLoaded();
767
- }
768
-
769
- _onStorySliderLoaded() {
770
- this._loaded.storyslider = true;
771
- this._onLoaded();
772
- }
773
-
774
769
  _onLoaded() {
775
770
  if (this._loaded.storyslider && this._loaded.timenav) {
776
771
  this.fire("loaded", this.config);
@@ -25,7 +25,7 @@
25
25
  // Headings
26
26
  @font-size-headings: 42px;
27
27
  @font-headings-lineheight: @font-size-headings;
28
- @font-headings-text-transform: normal;
28
+ @font-headings-text-transform: none;
29
29
  @font-size-headings-small: 24px;
30
30
  @font-headings-weight: 800;
31
31
  @font-size-headline-title: 46px;
@@ -36,4 +36,4 @@
36
36
  // Navigation
37
37
  @font-navigation-text-transform: none;
38
38
 
39
- @import "_font.base.less";
39
+ @import "_font.base.less";
@@ -29,7 +29,7 @@ https://www.google.com/fonts/specimen/Megrim
29
29
  // Headings
30
30
  @font-size-headings: 46px;
31
31
  @font-headings-lineheight: @font-size-headings;
32
- @font-headings-text-transform: normal;
32
+ @font-headings-text-transform: none;
33
33
  @font-size-headings-small: 24px;
34
34
  @font-headings-weight: 400;
35
35
  @font-size-headline-title: 58px;
@@ -40,4 +40,4 @@ https://www.google.com/fonts/specimen/Megrim
40
40
  // Navigation
41
41
  @font-navigation-text-transform: none;
42
42
 
43
- @import "_font.base.less";
43
+ @import "_font.base.less";