forked from pangaeasbox/pangaeasbox.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
116 lines (102 loc) · 3.77 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
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
<!DOCTYPE HTML>
<!--
Identity by HTML5 UP
html5up.net | @ajlkn
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
<head>
<title>Identity by HTML5 UP</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="assets/css/main.css" />
<noscript><link rel="stylesheet" href="assets/css/noscript.css" /></noscript>
</head>
<body class="is-preload">
<!-- Wrapper -->
<div id="wrapper">
<!-- Main -->
<section id="main">
<header>
<p>Country:</p><h2>?</h2>
<p>Book:</p> <h1>???</h1>
<p>Author:</p><h3>?</h3>
</header>
<!--
<hr />
<h2>Extra Stuff!</h2>
<form method="post" action="#">
<div class="fields">
<div class="field">
<input type="text" name="name" id="name" placeholder="Name" />
</div>
<div class="field">
<input type="email" name="email" id="email" placeholder="Email" />
</div>
<div class="field">
<select name="department" id="department">
<option value="">Department</option>
<option value="sales">Sales</option>
<option value="tech">Tech Support</option>
<option value="null">/dev/null</option>
</select>
</div>
<div class="field">
<textarea name="message" id="message" placeholder="Message" rows="4"></textarea>
</div>
<div class="field">
<input type="checkbox" id="human" name="human" /><label for="human">I'm a human</label>
</div>
<div class="field">
<label>But are you a robot?</label>
<input type="radio" id="robot_yes" name="robot" /><label for="robot_yes">Yes</label>
<input type="radio" id="robot_no" name="robot" /><label for="robot_no">No</label>
</div>
</div>
<ul class="actions special">
<li><a href="#" class="button">Get Started</a></li>
</ul>
</form>
<hr />
-->
<footer>
<div class="next">
<button id = "travel" class = "button" onClick="travel()">TRAVEL</button>
</div>
</footer>
</section>
<!-- Footer -->
<footer id="footer">
<ul class="copyright">
<li>© Pangaea's Box</li><li>Design: <a href="http://html5up.net">HTML5 UP</a></li>
</ul>
</footer>
</div>
<!-- Scripts -->
<script>
if ('addEventListener' in window) {
window.addEventListener('load', function() { document.body.className = document.body.className.replace(/\bis-preload\b/, ''); });
document.body.className += (navigator.userAgent.match(/(MSIE|rv:11\.0)/) ? ' is-ie' : '');
}
var travel = function() {
// Create a request variable and assign a new XMLHttpRequest object to it.
var request = new XMLHttpRequest();
// Open a new connection, using the GET request on the URL endpoint
request.open('GET', 'https://api.airtable.com/v0/appybL1OJaEEIvAdS/Books?api_key=keymAugpaEvXsyGBr', true);
request.onload = function () {
var data = JSON.parse(this.response);
var choices = data.records.length;
var selection = Math.floor(Math.random() * choices);
var author = data.records[selection].fields.Author;
var title = data.records[selection].fields.Title;
var country = data.records[selection].fields.Country;
document.querySelector('h2').innerHTML = country;
document.querySelector('h1').innerHTML = title;
document.querySelector('h3').innerHTML = author;
}
// Send request
request.send();
}
</script>
</body>
</html>