-
Notifications
You must be signed in to change notification settings - Fork 644
Expand file tree
/
Copy pathindex.html
More file actions
168 lines (139 loc) · 6.05 KB
/
index.html
File metadata and controls
168 lines (139 loc) · 6.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE html>
<html lang="en">
<head>
<title>TimelineJS Embed</title>
<meta charset="utf-8">
<meta name="description" content="TimelineJS Embed">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<!-- FAVICONS -->
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.knightlab.com/libs/orangeline/latest/assets/favicons/apple-touch-icon.png">
<link rel="icon" type="image/png" href="https://cdn.knightlab.com/libs/orangeline/latest/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.knightlab.com/libs/orangeline/latest/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.knightlab.com/libs/orangeline/latest/assets/favicons/manifest.json">
<link rel="mask-icon" href="https://cdn.knightlab.com/libs/orangeline/latest/assets/favicons/safari-pinned-tab.svg" color="#5bbad5">
<!--
If we want to support loading different versions of timeline like we used to,
this isn't good enough. We used that to get the non-minimized version, for debugging,
but now maybe sourcemaps are a better alternative?
-->
<script id='timeline-script-tag' type="text/javascript" src="../js/timeline.js"></script>
<link rel="stylesheet" href="../css/timeline.css">
<!-- Google Analytics should be handled by Timeline -->
<base target="_blank">
<!-- Style-->
<style>
html,
body {
width: 100%;
height: 100%;
padding: 0px;
margin: 0px;
}
#timeline-embed {
height: 100%;
}
</style>
</head>
<body>
<!-- BEGIN Timeline Embed -->
<div id="timeline-embed"></div>
<!-- Override -->
<script type="text/javascript">
function ready(fn) {
if (document.readyState != 'loading') {
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
function setPageLanguage() {
var lang = window.location.href.match(/&lang=([a-zA-Z]*?)&?/);
if (lang) {
document.getElementsByTagName('html')[0].setAttribute('lang', lang[1]);
}
}
function computeEmbedPath() {
var trim_point = window.location.href.indexOf('embed/index.html');
if (trim_point > 0) {
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
}
return "https://cdn.knightlab.com/libs/timeline3/latest/";
}
function addOembedTag() {
// it's not clear that any tools execute this JS to get the URL, but maybe?
var oembed_link = document.createElement('link');
oembed_link['rel'] = 'alternate';
oembed_link['type'] = 'application/json+oembed';
oembed_link['href'] = 'https://oembed.knightlab.com/timeline/?url=' + encodeURIComponent(window.location.href);
document.head.appendChild(oembed_link);
}
function createEmbedDiv(containerId, width, height) {
if (typeof(width) != 'string' && typeof(width) != 'number') {
width = '100%'
}
if (typeof(height) != 'string' && typeof(height) != 'number') {
height = '100%'
}
// default containerId would be 'timeline-embed'
t = document.createElement('div');
t.style.position = 'relative';
te = document.getElementById(containerId);
te.appendChild(t);
te.classList.add("tl-timeline-embed");
if (width.toString().match("%")) {
te.style.width = width.split("%")[0] + "%";
} else {
width = Number(width) - 2;
te.style.width = (width) + 'px';
}
if (height.toString().match("%")) {
te.style.height = height;
te.classList.add("tl-timeline-full-embed");
} else if (width.toString().match("%")) {
te.classList.add("tl-timeline-full-embed");
height = Number(height) - 16;
te.style.height = (height) + 'px';
} else {
height = height - 16;
te.style.height = (height) + 'px';
}
}
/**
* Parse all URL parameters as possible Timeline options.
* Timeline itself will use or ignore these based on actual
* supported options.
*/
function optionsFromUrlParams() {
var param_str = window.location.href.slice(window.location.href.indexOf('?') + 1);
if (param_str.match('#')) {
param_str = param_str.split('#')[0];
}
param_str = param_str.split('&');
var url_vars = {}
for (var i = 0; i < param_str.length; i++) {
var uv = param_str[i].split('=');
url_vars[uv[0]] = uv[1];
}
return url_vars;
};
ready(function() {
setPageLanguage();
var embed_path = computeEmbedPath();
addOembedTag();
var options = optionsFromUrlParams();
createEmbedDiv('timeline-embed', options.width, options.height);
// ga_property_id is not something we let users override
options.ga_property_id = 'UA-27829802-4';
if (typeof(options.source) == 'undefined') {
options.source = '1xuY4upIooEeszZ_lCmeNx24eSFWe0rHe9ZdqH2xqVNk' // women in computing
}
options.soundcite = true;
options.hide_swipe_to_navigate = true;
window.options = options
window.timeline = new TL.Timeline('timeline-embed', options.source, options)
})
</script>
</body>
</html>