-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·54 lines (51 loc) · 1.62 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no" />
<link rel="stylesheet" href="reset.css">
<link rel="stylesheet" href="main.css">
</head>
<body>
<!-- Please feel free to remove the following HTML! -->
<div class="container">
<div>
<h1>Hello world.</h1>
<p>Edit the contents of /assets/index.html to change this text.</p>
<p id="text"></p>
</div>
</div>
</body>
<script type="text/javascript">
// This code is here to make the cover clickable when it is on the homepage
new function () {
function postMessage(data) {
window.parent.postMessage(JSON.stringify(data), '*');
}
window.addEventListener('message', function (event) {
var data = JSON.parse(event.data);
// Ignore messages that do not contain the domain_path property:
if (!data.domain_path) return;
// If we are on the homepage, add a link to body to have the parent redirect to the magazine URL:
var onHomepage = /homepage\=1/.test(window.location.search);
if (onHomepage) {
document.body.addEventListener('click', function () {
// Tell parent to redirect us:
postMessage({
status: 'redirect',
domain_path: data.domain_path
});
});
document.body.style.cursor = 'pointer';
}
});
// Get unique cover id from url:
// Tell parent that loading of this iframe is ready
postMessage({
status: 'ready',
coverId: window.location.pathname.split('/')[4]
});
}();
</script>
<script src="main.js"></script>
</html>